def submit(self, gold, xpToExchange, callback=None): criteria = REQ_CRITERIA.VEHICLE.ELITE | ~REQ_CRITERIA.IN_CD_LIST( [self._parentCD]) eliteVehicles = self._items.getVehicles(criteria).keys() result = yield FreeXPExchanger(xpToExchange, eliteVehicles).request() if callback is not None: callback(result)
def exchange(self, data): exchangeXP = data.exchangeXp vehTypeCompDescrs = list(data.selectedVehicles) eliteVcls = self.itemsCache.items.stats.eliteVehicles xps = self.itemsCache.items.stats.vehiclesXPs commonXp = 0 for vehicleCD in vehTypeCompDescrs: if vehicleCD in eliteVcls: commonXp += xps.get(vehicleCD, 0) xpToExchange = min(commonXp, exchangeXP) money = self.itemsCache.items.stats.money price = self.__getConversionPrice(xpToExchange).price if money.gold < price.gold and self.__isIngameShopEnabled: showBuyGoldForXpWebOverlay(price.gold) else: result = yield FreeXPExchanger( xpToExchange, vehTypeCompDescrs, freeConversion=self.__xpForFree).request() if result.userMsg: SystemMessages.pushI18nMessage(result.userMsg, type=result.sysMsgType) if result.success: self.destroy()
def submit(self, gold, xpToExchange, callback=None): vehiclesCriteria = REQ_CRITERIA.VEHICLE.FULLY_ELITE | REQ_CRITERIA.VEHICLE.ACTIVE_IN_NATION_GROUP criteria = vehiclesCriteria | ~REQ_CRITERIA.IN_CD_LIST([self._parentCD]) eliteVehicles = self.itemsCache.items.getVehicles(criteria).keys() result = yield FreeXPExchanger(xpToExchange, eliteVehicles).request() if callback is not None: callback(result) return
def submit(self, gold, xpToExchange, callback=None): """ Submit exchange operation, send request to exchange and call callback after response received :param gold: <int> gold value :param xpToExchange: <int> xp value to exchange :param callback: <function> """ criteria = REQ_CRITERIA.VEHICLE.FULLY_ELITE | ~REQ_CRITERIA.IN_CD_LIST( [self._parentCD]) eliteVehicles = self.itemsCache.items.getVehicles(criteria).keys() result = yield FreeXPExchanger(xpToExchange, eliteVehicles).request() if callback is not None: callback(result) return
def exchange(self, data): exchangeXP = data.exchangeXp vehTypeCompDescrs = list(data.selectedVehicles) eliteVcls = g_itemsCache.items.stats.eliteVehicles xps = g_itemsCache.items.stats.vehiclesXPs commonXp = 0 for vehicleCD in vehTypeCompDescrs: if vehicleCD in eliteVcls: commonXp += xps.get(vehicleCD, 0) xpToExchange = min(commonXp, exchangeXP) result = yield FreeXPExchanger(xpToExchange, vehTypeCompDescrs, freeConversion=self.__xpForFree).request() if len(result.userMsg): SystemMessages.g_instance.pushI18nMessage(result.userMsg, type=result.sysMsgType) if result.success: self.destroy()
def exchange(self, data): exchangeXP = data.exchangeXp vehTypeCompDescrs = map(int, data.selectedVehicles) eliteVcls = self.itemsCache.items.stats.eliteVehicles xps = self.itemsCache.items.stats.vehiclesXPs commonXp = 0 for vehicleCD in vehTypeCompDescrs: if vehicleCD in eliteVcls: commonXp += xps.get(vehicleCD, 0) xpToExchange = min(commonXp, exchangeXP) money = self.itemsCache.items.stats.money price = self.__getConversionPrice(xpToExchange).price if money.gold < price.gold: self._goToGoldBuy(price.gold) else: result = yield FreeXPExchanger( xpToExchange, vehTypeCompDescrs, freeConversion=self.__xpForFree).request() self._processResult(result, xpToExchange)