def onBackClick(self): if self._backAlias == VIEW_ALIAS.LOBBY_RESEARCH and self.__isSecondVehicle( ): firstVehicleCD = g_bootcampGarage.getNationData()['vehicle_first'] event_dispatcher.showResearchView(firstVehicleCD) else: super(BCVehiclePreview, self).onBackClick()
def updateDescriptors(self, componentID): from bootcamp.BootcampLobbyHintsConfig import g_bootcampHintsConfig from bootcamp.BootcampGarage import g_bootcampGarage nationData = g_bootcampGarage.getNationData() component = g_bootcampHintsConfig.objects[componentID] if componentID == 'ResearchNode': component['asInt'] = nationData['module'] elif componentID == 'AmmunitionSlot': component['path'] = 'ammunitionPanel.{0}'.format( nationData['module_type']) elif componentID == 'ResearchNodeTankII': component['asInt'] = nationData['vehicle_second'] elif componentID == 'TechNodeUsa': component['asInt'] = nationData['vehicle_first'] elif componentID == 'ServiceSlotRepairOption': component['asInt'] = nationData['consumable'] elif componentID == 'OptionalDevice': component['asInt'] = nationData['equipment'] elif componentID == 'PersonalCaseSkill': component['skillId'] = nationData['perk'] elif componentID == 'SkillSlot': component['skillId'] = nationData['perk'] elif componentID == 'SecondTank': itemsCache = dependency.instance(IItemsCache) vehicleCD = nationData['vehicle_second'] vehicle = itemsCache.items.getItemByCD(vehicleCD) component['TankIndex'] = str(vehicle.invID) self.setDescriptors(g_bootcampHintsConfig.getItems())
def onBuyOrResearchClick(self): from gui.shared.gui_items.items_actions import factory as ItemsActionsFactory from bootcamp.BootcampGarage import g_bootcampGarage nationData = g_bootcampGarage.getNationData() if nationData['vehicle_second'] == self.__vehicleCD: super(BCVehiclePreview, self).onBuyOrResearchClick() if self._actionType == ItemsActionsFactory.UNLOCK_ITEM: g_bootcampGarage.highlightLobbyHint('DialogAccept')
def request4Buy(self, itemCD): nationData = g_bootcampGarage.getNationData() if nationData['module'] == itemCD: g_bootcampGarage.hideHint() super(BCResearch, self).request4Buy(itemCD) g_bootcampGarage.highlightLobbyHint('DialogAccept') elif nationData['vehicle_second'] == itemCD: shared_events.showVehiclePreview(int(itemCD), self.alias) else: super(BCResearch, self).request4Buy(itemCD)
def __init__(self, dumper): super(BCResearchItemsData, self).__init__(dumper) lessonNum = g_bootcamp.getLessonNum() self.__overrideResearch = lessonNum < g_bootcamp.getContextIntParameter( 'researchFreeLesson') self.__secondVehicleResearch = lessonNum < g_bootcamp.getContextIntParameter( 'researchSecondVehicleLesson') nationData = g_bootcampGarage.getNationData() self.__firstVehicleNode = nationData['vehicle_first'] self.__secondVehicleNode = nationData['vehicle_second'] self.__moduleNodeCD = nationData['module']
def goToNextVehicle(self, vehCD): if not g_bootcamp.isResearchFreeLesson(): nationData = g_bootcampGarage.getNationData() if nationData['vehicle_second'] == vehCD: vehicle = self.itemsCache.items.getItemByCD(int(vehCD)) if vehicle.isInInventory: shared_events.showResearchView(vehCD) return if nationData['vehicle_first'] == vehCD: shared_events.showResearchView(vehCD) else: shared_events.showResearchView(vehCD)
def request4Unlock(self, unlockCD, vehCD, unlockIdx, xpCost): nationData = g_bootcampGarage.getNationData() if nationData['module'] == unlockCD: g_bootcampGarage.hideHint() super(BCResearch, self).request4Unlock(unlockCD, vehCD, unlockIdx, xpCost) g_bootcampGarage.highlightLobbyHint('DialogAccept') elif nationData['vehicle_second'] == unlockCD: shared_events.showVehiclePreview(int(unlockCD), self.alias) else: super(BCResearch, self).request4Unlock(unlockCD, vehCD, unlockIdx, xpCost)
def _populate(self): g_currentPreviewVehicle.selectVehicle(self.__vehicleCD) if g_currentPreviewVehicle.item.level in DISABLED_TANK_LEVELS: self._disableBuyButton = True super(BCVehiclePreview, self)._populate() g_bootcampEvents.onRequestChangeVehiclePreviewBuyButtonState += self.__setBuyButtonState from bootcamp.BootcampGarage import g_bootcampGarage nationData = g_bootcampGarage.getNationData() g_currentPreviewVehicle.onVehicleUnlocked += self.__onVehicleUnlockedMessage g_currentPreviewVehicle.onVehicleInventoryChanged += self.__onVehicleInventoryChanged foundHints = False if nationData['vehicle_second'] == self.__vehicleCD: foundHints = g_bootcampGarage.runViewAlias(self.alias) if not foundHints: g_bootcampGarage.closeAllPopUps() g_bootcampGarage.checkReturnToHangar()
def _buildList(self): defaultModules = super(_BootCampLogicProvider, self)._buildList() if self._slotType != FITTING_TYPES.OPTIONAL_DEVICE: return defaultModules else: nationData = g_bootcampGarage.getNationData() optionalDeviceId = nationData['equipment'] optionalDeviceValue = None for device in defaultModules: if device['id'] == optionalDeviceId: optionalDeviceValue = device if optionalDeviceValue is not None: defaultModules.remove(optionalDeviceValue) defaultModules.insert(0, optionalDeviceValue) scrollCountOptionalDevices = g_bootcamp.getContextIntParameter( 'scrollCountOptionalDevices') del defaultModules[scrollCountOptionalDevices:] return defaultModules
def as_updateS(self, data): researchFreeLesson = g_bootcamp.getContextIntParameter( 'researchFreeLesson') if g_bootcamp.getLessonNum() >= researchFreeLesson and data[ 'rendererName'] != FITTING_TYPES.GUN_TURRET_FITTING_ITEM_RENDERER: nationData = g_bootcampGarage.getNationData() optionalDeviceId = nationData['equipment'] optionalDeviceValue = None deviceList = data['availableDevices'] for device in deviceList: if device['id'] == optionalDeviceId: optionalDeviceValue = device if optionalDeviceValue is not None: deviceList.remove(optionalDeviceValue) deviceList.insert(0, optionalDeviceValue) scrollCountOptionalDevices = g_bootcamp.getContextIntParameter( 'scrollCountOptionalDevices') del deviceList[scrollCountOptionalDevices:] super(BCFittingPopover, self).as_updateS(data) return
def __isSecondVehicle(self): nationData = g_bootcampGarage.getNationData() return nationData['vehicle_second'] == self._vehicleCD