def changeTankmanPassport(self, inventoryID, firstNameID, firstNameGroup, lastNameID, lastNameGroup, iconID, iconGroup): items = self.itemsCache.items tankman = items.getTankman(inventoryID) if tankman.descriptor.isFemale: passportChangeCost = items.shop.passportFemaleChangeCost else: passportChangeCost = items.shop.passportChangeCost currentGold = self.itemsCache.items.stats.gold if currentGold < passportChangeCost and isIngameShopEnabled(): showBuyGoldForCrew(passportChangeCost) return def checkFlashInt(value): return None if value == -1 else value firstNameID = checkFlashInt(firstNameID) lastNameID = checkFlashInt(lastNameID) iconID = checkFlashInt(iconID) tankman = self.itemsCache.items.getTankman(int(inventoryID)) result = yield TankmanChangePassport(tankman, firstNameID, firstNameGroup, lastNameID, lastNameGroup, iconID, iconGroup).request() if result.userMsg: SystemMessages.pushI18nMessage(result.userMsg, type=result.sysMsgType)
def submit(self, operationId): if operationId in self.AVAILABLE_OPERATIONS: _, cost = self.getCrewTrainInfo(int(operationId)) currentGold = self.itemsCache.items.stats.gold if currentGold < cost.get(Currency.GOLD, 0) and isIngameShopEnabled(): showBuyGoldForCrew(cost.get(Currency.GOLD)) return self.__processCrewRetrianing(operationId) self.destroy()
def retrainingTankman(self, inventoryID, tankmanCostTypeIdx): operationCost = self.itemsCache.items.shop.tankmanCost[ tankmanCostTypeIdx].get('gold', 0) currentGold = self.itemsCache.items.stats.gold if currentGold < operationCost and isIngameShopEnabled(): showBuyGoldForCrew(operationCost) return tankman = self.itemsCache.items.getTankman(int(inventoryID)) proc = TankmanRetraining(tankman, self.vehicle, tankmanCostTypeIdx) result = yield proc.request() if result.userMsg: SystemMessages.pushI18nMessage(result.userMsg, type=result.sysMsgType)
def changeRole(self, role, vehicleId): changeRoleCost = self.itemsCache.items.shop.changeRoleCost actualGold = self.itemsCache.items.stats.gold if changeRoleCost > actualGold and isIngameShopEnabled(): showBuyGoldForCrew(changeRoleCost) return result = yield TankmanChangeRole(self.__tankman, role, int(vehicleId)).request() if result.userMsg: SystemMessages.pushMessage(result.userMsg, type=result.sysMsgType) if result.auxData: SystemMessages.pushMessage(result.auxData.userMsg, type=result.auxData.sysMsgType) if result.success: self.onWindowClose()
def dropSkills(self, dropSkillCostIdx): tankman = self.itemsCache.items.getTankman(self.tmanInvID) dropSkillCost = self.itemsCache.items.shop.dropSkillsCost[ dropSkillCostIdx].get(Currency.GOLD, 0) currentGold = self.itemsCache.items.stats.gold if currentGold < dropSkillCost and isIngameShopEnabled(): showBuyGoldForCrew(dropSkillCost) return proc = TankmanDropSkills(tankman, dropSkillCostIdx) result = yield proc.request() if result.userMsg: SystemMessages.pushMessage(result.userMsg, type=result.sysMsgType) if result.success: self.onWindowClose() self.fireEvent( events.SkillDropEvent( events.SkillDropEvent.SKILL_DROPPED_SUCCESSFULLY))
def buyTankman(self, nationID, vehTypeID, role, studyType, slot): studyTypeIdx = int(studyType) studyGoldCost = self.itemsCache.items.shop.tankmanCost[studyTypeIdx][ Currency.GOLD] or 0 currentMoney = self.itemsCache.items.stats.money if currentMoney.gold < studyGoldCost and isIngameShopEnabled(): showBuyGoldForCrew(studyGoldCost) return else: if slot is not None and slot != -1: vehicle = self.itemsCache.items.getVehicle( self._currentVehicleInvId) yield self.__buyAndEquipTankman(vehicle, int(slot), studyTypeIdx) else: yield self.__buyTankman(int(nationID), int(vehTypeID), role, studyTypeIdx) self.onWindowClose() return