1
0
mirror of https://gitlab.com/Deukhoofd/BattleSim.git synced 2025-10-27 18:00:03 +00:00

Fixed major issue with user being undefined on battle pairing, reduced sunlight effect by 40%, reduced "a high level match is being played" spam by 75%

This commit is contained in:
Deukhoofd
2016-02-24 13:02:28 +01:00
parent ed22806774
commit d243354cc2
20 changed files with 18 additions and 16 deletions

View File

@@ -21,7 +21,7 @@ replays = require('./replays')
modify = require('./modify')
MAX_MESSAGE_LENGTH = 250
MAX_RANK_DISPLAYED = 100
MAX_RANK_DISPLAYED = 25
# A MD5 hash of all the JavaScript files used by the client. This is passed to
# each new connection via the .jade template, and when the client connects. If

View File

@@ -306,20 +306,21 @@ class @BattleServer
# Add user to spectators
# TODO: player.id should be using player.name, but alts present a problem.
user = @users.get(player.id)
battle.add(spark) for spark in user.sparks
if typeof user != 'undefined'
battle.add(spark) for spark in user.sparks
# Add/remove player ids to/from user battles
@userBattles[player.id] ?= {}
@userBattles[player.id][battleId] = true
# Add/remove player ids to/from user battles
@userBattles[player.id] ?= {}
@userBattles[player.id][battleId] = true
# Add the player to the list if its not an alt
if player.id == player.ratingKey # hacky - but no alternative right now
@visibleUserBattles[player.id] ?= {}
@visibleUserBattles[player.id][battleId] = true
# Add the player to the list if its not an alt
if player.id == player.ratingKey # hacky - but no alternative right now
@visibleUserBattles[player.id] ?= {}
@visibleUserBattles[player.id][battleId] = true
battle.once 'end', @removeUserBattle.bind(this, player.id, player.name, battleId)
battle.once 'end', @removeUserBattle.bind(this, player.id, player.name, battleId)
battle.once 'expire', @removeBattle.bind(this, battleId)
battle.once 'expire', @removeBattle.bind(this, battleId)
# Add the battle to the achievements system
# Uneligible battles are ignored by this function