def _setResult(self, result): self.__uiEpicBattleLogger.log(EpicBattleLogActions.CLICK.value, item=result, parentScreen=EpicBattleLogKeys.DROP_SKILL_DIALOG_CONFIRM.value) if result == DialogButtons.SUBMIT and not self.__isBlank and not self.__freeDropSave100: shortage = self._itemsCache.items.stats.money.getShortage(self.itemPrice.price) if shortage and shortage.getCurrency() == Currency.GOLD: showBuyGoldForCrew(self.itemPrice.price.gold) result = DialogButtons.CANCEL super(SkillDropDialog, self)._setResult(result)
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): showBuyGoldForCrew(cost.get(Currency.GOLD)) return self.__processCrewRetrianing(operationId) self.destroy()
def changeRole(self, role, vehicleId): changeRoleCost = self.itemsCache.items.shop.changeRoleCost actualGold = self.itemsCache.items.stats.gold if changeRoleCost > actualGold: showBuyGoldForCrew(changeRoleCost) return result = yield TankmanChangeRole(self.__tankman, role, int(vehicleId)).request() SystemMessages.pushMessagesFromResult(result) if result.success: self.onWindowClose()
def retrainingTankman(self, inventoryID, tankmanCostTypeIdx): operationCost = self.itemsCache.items.shop.tankmanCost[tankmanCostTypeIdx].get('gold', 0) currentGold = self.itemsCache.items.stats.gold if currentGold < operationCost: showBuyGoldForCrew(operationCost) return tankman = self.__getTankmanByInvID(int(inventoryID)) proc = TankmanRetraining(tankman, self.vehicle, tankmanCostTypeIdx) result = yield proc.request() if result.userMsg: SystemMessages.pushI18nMessage(result.userMsg, type=result.sysMsgType)
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: 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
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: 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))