def fillKillerInfoBlock(vehicleStateBlock, deathReason, killerID, reusable): reason = style.makeI18nDeathReason(deathReason) vehicleStateBlock.vehicleState = reason.i18nString vehicleStateBlock.vehicleStatePrefix = reason.prefix vehicleStateBlock.vehicleStateSuffix = reason.suffix pi = reusable.getPlayerInfoByVehicleID(killerID) playerKillerBlock = KillerPlayerNameBlock() playerKillerBlock.setPlayerInfo(pi) vi = reusable.vehicles.getVehicleInfo(killerID) if vi.isTeamKiller: playerKillerBlock.setTeamKillerInfo() vehicleStateBlock.isKilledByTeamKiller = True vehicleStateBlock.addComponent(vehicleStateBlock.getNextComponentIndex(), playerKillerBlock)
def setRecord(self, result, reusable): killerID = result.get('killerID', 0) deathReason = result.get('deathReason', DEATH_REASON_ALIVE) self.killerID = killerID if reusable.personal.avatar.isPrematureLeave: self.isPrematureLeave = True self.vehicleState = i18n.makeString(BATTLE_RESULTS.COMMON_VEHICLESTATE_PREMATURELEAVE) elif deathReason > DEATH_REASON_ALIVE: if self._isVehicleStatusDefined and killerID: reason = style.makeI18nDeathReason(deathReason) self.vehicleState = reason.i18nString self.vehicleStatePrefix = reason.prefix self.vehicleStateSuffix = reason.suffix block = KillerPlayerNameBlock() block.setPlayerInfo(reusable.getPlayerInfoByVehicleID(killerID)) self.addComponent(self.getNextComponentIndex(), block) else: self.vehicleState = i18n.makeString(BATTLE_RESULTS.COMMON_VEHICLESTATE_ALIVE)
def _setVehicleState(self, result, reusable): if self._isObserver: return self.killerID = result.killerID self.deathReason = result.deathReason if self.isPersonal and reusable.personal.avatar.isPrematureLeave: state = i18n.makeString(BATTLE_RESULTS.COMMON_VEHICLESTATE_PREMATURELEAVE) self.vehicleState = state self.vehicleStatePrefix = state elif self.deathReason > DEATH_REASON_ALIVE: if self.killerID: reason = style.makeI18nDeathReason(self.deathReason) self.vehicleState = reason.i18nString self.vehicleStatePrefix = reason.prefix self.vehicleStateSuffix = reason.suffix block = personal.KillerPlayerNameBlock() block.setPlayerInfo(reusable.getPlayerInfoByVehicleID(self.killerID)) self.addComponent(self.getNextComponentIndex(), block) else: self.vehicleState = i18n.makeString(BATTLE_RESULTS.COMMON_VEHICLESTATE_ALIVE)