def __updateUpgrades(self): upgrades = self.__getUpgradeItems() self.__upgrades = [] if upgrades: hasTwoModules = len(upgrades) == 2 if hasTwoModules: self.__upgrades = [ upgrade.intCD for upgrade in upgrades ] first = upgrades[0] second = upgrades[1] if isItemVehicleHull(first.intCD, self._getVehicle()): titleKey = R.strings.battle_royale.upgradePanel.title.hull else: titleKey = R.strings.battle_royale.upgradePanel.title.dyn(first.itemTypeName, None) if titleKey is None: titleKey = R.strings.battle_royale.upgradePanel.title.default data = {'firstItem': self.__getModuleInfo(first, 0), 'secondItem': self.__getModuleInfo(second, 1), 'title': backport.text(titleKey())} if not self.__textInited: key = br_helpers.getHotKeyString(CommandMapping.CMD_UPGRADE_PANEL_SHOW) data['description'] = backport.text(R.strings.battle_royale.upgradePanel.description(), key=key) data['isInitData'] = True self.__textInited = True self.as_setDataS(data) self.__updateVisibility(hasTwoModules and avatar_getter.isVehicleAlive()) else: logger.warning('Unexpected modules count. Modules list: %s', str(upgrades)) else: self.__updateVisibility(False) return
def setVehicleChangeResponse(self, itemCD, success): if success: progressionCtrl = self.__getProgressionCtrl() item = progressionCtrl.getModule(itemCD) if isItemVehicleHull(itemCD, self._getVehicle()): moduleKey = R.strings.battle_royale.player_messages.moduleType.hull else: moduleKey = R.strings.battle_royale.player_messages.moduleType.dyn(item.itemTypeName, None) self.__sessionProvider.shared.messages.onShowPlayerMessageByKey('VEHICLE_UPGRADE', {'module': getTreeModuleHeader(item), 'moduleType': backport.text(moduleKey()) if moduleKey else ''}) self.__playEffect(True) return
def setVehicleChangeResponse(self, itemCD, success): if not success: return else: progressionCtrl = self.__sessionProvider.dynamic.progression module = progressionCtrl.getModule(itemCD) typeCD = module.descriptor.typeID moduleLevel = module.level if moduleLevel == self.__PLAYER_MIDDLE_LEVEL: eventName = BREvents.PLAYER_LEVEL_MIDDLE elif moduleLevel == progressionCtrl.maxLevel: eventName = BREvents.LEVEL_UP_MAX elif typeCD == GUI_ITEM_TYPE.CHASSIS: if isItemVehicleHull(itemCD, progressionCtrl.getCurrentVehicle()): eventName = BREvents.INSTALL_MODULE_HULL else: eventName = BREvents.INSTALL_MODULE_CHASSIS else: eventName = BREvents.INSTALL_MODULE.get(typeCD) if eventName is not None: BREvents.playSound(eventName) return
def _getHeaderIcon(item, vehicle): return _ITEM_TYPE_TO_HEADER_ICON['hull'] if item.itemTypeID == GUI_ITEM_TYPE.CHASSIS and isItemVehicleHull(item.intCD, vehicle) else _ITEM_TYPE_TO_HEADER_ICON[item.itemTypeID]