def onBuyOrResearchClick(self):
     vehicle = g_currentPreviewVehicle.item
     if self.__packItems is not None:
         requestConfirmed = yield self.__requestConfirmation()
         if requestConfirmed:
             goldPrice = self.__packPrice.get(Currency.GOLD, 0)
             if goldPrice > self.itemsCache.items.stats.gold:
                 showBuyGoldForBundle(goldPrice, self.__buyParams)
             else:
                 showBuyVehicleOverlay(self.__buyParams)
     elif canBuyGoldForVehicleThroughWeb(vehicle):
         event_dispatcher.showVehicleBuyDialog(vehicle)
     elif self.__isHeroTank:
         url = self.heroTanks.getCurrentRelatedURL()
         self.fireEvent(
             events.OpenLinkEvent(events.OpenLinkEvent.SPECIFIED, url=url))
     elif self._actionType == factory.UNLOCK_ITEM:
         unlockProps = g_techTreeDP.getUnlockProps(self._vehicleCD)
         factory.doAction(factory.UNLOCK_ITEM,
                          self._vehicleCD,
                          unlockProps.parentID,
                          unlockProps.unlockIdx,
                          unlockProps.xpCost,
                          skipConfirm=self._skipConfirm)
     else:
         factory.doAction(factory.BUY_VEHICLE,
                          self._vehicleCD,
                          False,
                          VIEW_ALIAS.VEHICLE_PREVIEW_20,
                          skipConfirm=self._skipConfirm)
     return
 def buyVehicle(self):
     vehicle = self.itemsCache.items.getItemByCD(self.vehCD)
     if canBuyGoldForVehicleThroughWeb(vehicle):
         shared_events.showVehicleBuyDialog(vehicle)
     else:
         ItemsActionsFactory.doAction(ItemsActionsFactory.BUY_VEHICLE,
                                      self.vehCD)
Example #3
0
 def toRentContinue(self):
     if g_currentVehicle.isPresent():
         vehicle = g_currentVehicle.item
         canBuyOrRent, _ = vehicle.mayObtainForMoney(
             g_itemsCache.items.stats.money)
         if vehicle.isRentable and vehicle.rentalIsOver and canBuyOrRent:
             shared_events.showVehicleBuyDialog(vehicle)
Example #4
0
 def doAction(self):
     item = g_itemsCache.items.getItemByCD(self.__vehCD)
     if item.itemTypeID is not GUI_ITEM_TYPE.VEHICLE:
         LOG_ERROR('Value of int-type descriptor is not refer to vehicle', self.__vehCD)
         return
     else:
         if item.isInInventory and not item.isRented:
             showInventoryMsg('already_exists', item, msgType=SystemMessages.SM_TYPE.Warning)
         else:
             price = getGUIPrice(item, g_itemsCache.items.stats.money, g_itemsCache.items.shop.exchangeRate)
             if price is None:
                 showShopMsg('not_found', item)
                 return
             if not self._mayObtainForMoney(item):
                 if self._mayObtainWithMoneyExchange(item):
                     if item.isRestoreAvailable():
                         meta = RestoreExchangeCreditsMeta(self.__vehCD)
                     else:
                         meta = ExchangeCreditsMeta(self.__vehCD)
                     isOk, args = yield DialogsInterface.showDialog(meta)
                     if not isOk:
                         return
                 else:
                     showShopMsg('common_rent_or_buy_error', item)
             if self._mayObtainForMoney(item):
                 shared_events.showVehicleBuyDialog(item)
             yield lambda callback = None: callback
         return
Example #5
0
 def doAction(self):
     item = self.itemsCache.items.getItemByCD(self.__vehCD)
     if item.itemTypeID is not GUI_ITEM_TYPE.VEHICLE:
         LOG_ERROR('Value of int-type descriptor is not refer to vehicle', self.__vehCD)
         return
     else:
         if item.isInInventory and not item.isRented:
             showInventoryMsg('already_exists', item, msgType=SystemMessages.SM_TYPE.Warning)
         else:
             price = getGUIPrice(item, self.itemsCache.items.stats.money, self.itemsCache.items.shop.exchangeRate)
             if price is None:
                 showShopMsg('not_found', item)
                 return
             if not self._mayObtainForMoney(item):
                 if self._mayObtainWithMoneyExchange(item):
                     if item.isRestoreAvailable():
                         meta = RestoreExchangeCreditsMeta(self.__vehCD)
                     else:
                         meta = ExchangeCreditsMeta(self.__vehCD)
                     isOk, _ = yield DialogsInterface.showDialog(meta)
                     if not isOk:
                         return
                 else:
                     showShopMsg('common_rent_or_buy_error', item)
             if self._mayObtainForMoney(item):
                 shared_events.showVehicleBuyDialog(item, self.__isTradeIn)
             yield lambda callback=None: callback
         return
Example #6
0
 def request4Buy(self, itemCD):
     itemCD = int(itemCD)
     vehicle = self.itemsCache.items.getItemByCD(itemCD)
     if canBuyGoldForVehicleThroughWeb(vehicle):
         shared_events.showVehicleBuyDialog(vehicle)
     else:
         ItemsActionsFactory.doAction(ItemsActionsFactory.BUY_VEHICLE, itemCD)
Example #7
0
 def doAction(self):
     item = g_itemsCache.items.getItemByCD(self.__vehCD)
     if item.itemTypeID is not GUI_ITEM_TYPE.VEHICLE:
         LOG_ERROR('Value of int-type descriptor is not refer to vehicle',
                   self.__vehCD)
         return
     else:
         if item.isInInventory and not item.isRented:
             showInventoryMsg('already_exists',
                              item,
                              msgType=SystemMessages.SM_TYPE.Warning)
         else:
             price = item.minRentPrice or item.buyPrice
             if price is None:
                 showShopMsg('not_found', item)
                 return
             if not self._canRentOrBuy(item):
                 if self._canBuyWithExchange(item):
                     isOk, args = yield DialogsInterface.showDialog(
                         ExchangeCreditsMeta(self.__vehCD))
                     if not isOk:
                         return
                 else:
                     showShopMsg('common_rent_or_buy_error', item)
             if self._canRentOrBuy(item):
                 shared_events.showVehicleBuyDialog(item)
             yield lambda callback=None: callback
         return
Example #8
0
 def showBuyVehicleView(self, _):
     if self._personalTradeInController.getActiveTradeInSaleVehicleCD(
     ) != UNDEFINED_ITEM_CD and self._personalTradeInController.getActiveTradeInBuyVehicleCD(
     ) != UNDEFINED_ITEM_CD:
         shared_events.showVehicleBuyDialog(
             self._personalTradeInController.getActiveTradeInBuyVehicle(),
             previousAlias=VIEW_ALIAS.LOBBY_STORE,
             returnAlias=VIEW_ALIAS.LOBBY_STORE,
             returnCallback=shared_events.showHangar)
 def restoreItem(self, itemId):
     itemCD = int(itemId)
     item = self._itemsCache.items.getItemByCD(itemCD)
     restoreCreditsPrice = item.restorePrice.credits
     _, needGoldConversion = enoughCreditsForRestore(restoreCreditsPrice, self._itemsCache)
     if needGoldConversion:
         isOk, _ = yield DialogsInterface.showDialog(RestoreExchangeCreditsMeta(itemCD=itemCD))
         if not isOk:
             return
     shared_events.showVehicleBuyDialog(item)
Example #10
0
 def request4Buy(self, itemCD):
     itemCD = int(itemCD)
     if getTypeOfCompactDescr(itemCD) == GUI_ITEM_TYPE.VEHICLE:
         vehicle = self._itemsCache.items.getItemByCD(itemCD)
         if canBuyGoldForVehicleThroughWeb(vehicle):
             shared_events.showVehicleBuyDialog(
                 vehicle, actionType=VehicleBuyActionTypes.BUY)
         else:
             self._doBuyVehicleAction(itemCD)
     else:
         self._doBuyAndInstallItemAction(itemCD)
Example #11
0
 def request4Rent(self, itemCD):
     itemCD = int(itemCD)
     vehicle = self._itemsCache.items.getItemByCD(itemCD)
     if canBuyGoldForVehicleThroughWeb(vehicle):
         shared_events.showVehicleBuyDialog(
             vehicle, actionType=VehicleBuyActionTypes.RENT)
     else:
         ItemsActionsFactory.doAction(ItemsActionsFactory.BUY_VEHICLE,
                                      itemCD,
                                      False,
                                      VehicleBuyActionTypes.RENT,
                                      skipConfirm=self._skipConfirm)
 def onBuyOrResearchClick(self):
     if self.__isHeroTank:
         url = self.heroTanks.getCurrentRelatedURL()
         self.fireEvent(
             events.OpenLinkEvent(events.OpenLinkEvent.SPECIFIED, url=url))
     else:
         vehicle = g_currentPreviewVehicle.item
         if canBuyGoldForVehicleThroughWeb(vehicle):
             event_dispatcher.showVehicleBuyDialog(
                 vehicle, previousAlias=VIEW_ALIAS.VEHICLE_PREVIEW)
         else:
             self.__previewDP.buyAction(self._actionType, self._vehicleCD,
                                        self._skipConfirm)
 def request4Buy(self, itemCD):
     itemCD = int(itemCD)
     if getTypeOfCompactDescr(itemCD) == GUI_ITEM_TYPE.VEHICLE:
         vehicle = self.itemsCache.items.getItemByCD(itemCD)
         if canBuyGoldForVehicleThroughWeb(vehicle):
             shared_events.showVehicleBuyDialog(vehicle)
         else:
             ItemsActionsFactory.doAction(ItemsActionsFactory.BUY_VEHICLE,
                                          itemCD,
                                          skipConfirm=self._skipConfirm)
     else:
         ItemsActionsFactory.doAction(
             ItemsActionsFactory.BUY_AND_INSTALL_ITEM,
             itemCD,
             self._data.getRootCD(),
             skipConfirm=self._skipConfirm)
Example #14
0
 def onBuy(self):
     result = yield EventProgressionBuyRewardVehicle(
         self.__vehicle).request()
     if result and result.success:
         ctx = {
             'congratulationsViewSettings': {
                 'backBtnLabel':
                 R.strings.store.congratulationAnim.showEpicBtnLabel(),
                 'backBtnEnabled':
                 True
             }
         }
         shared_event.showVehicleBuyDialog(
             vehicle=self.__vehicle,
             previousAlias=VIEW_ALIAS.EVENT_PROGRESSION_VEHICLE_PREVIEW,
             showOnlyCongrats=True,
             ctx=ctx)
     if result and result.userMsg:
         SystemMessages.pushI18nMessage(result.userMsg,
                                        type=result.sysMsgType)
     self.onClose()
Example #15
0
 def doAction(self):
     item = g_itemsCache.items.getItemByCD(self.__vehCD)
     if item.itemTypeID is not GUI_ITEM_TYPE.VEHICLE:
         LOG_ERROR('Value of int-type descriptor is not refer to vehicle', self.__vehCD)
         return
     if item.isInInventory and not item.isRented:
         showInventoryMsg('already_exists', item, msgType=SystemMessages.SM_TYPE.Warning)
     else:
         price = item.minRentPrice or item.buyPrice
         if price is None:
             showShopMsg('not_found', item)
             return
         if not self._canRentOrBuy(item):
             if self._canBuyWithExchange(item):
                 isOk, args = yield DialogsInterface.showDialog(ExchangeCreditsMeta(self.__vehCD))
                 if not isOk:
                     return
             else:
                 showShopMsg('common_rent_or_buy_error', item)
         if self._canRentOrBuy(item):
             shared_events.showVehicleBuyDialog(item)
         yield lambda callback = None: callback
 def buyVehicle(self):
     vehicle = self.itemsCache.items.getItemByCD(self._nodeCD)
     if canBuyGoldForVehicleThroughWeb(vehicle):
         shared_events.showVehicleBuyDialog(vehicle)
     else:
         super(ResearchVehicleContextMenuHandler, self).buyVehicle()
Example #17
0
 def toRentContinue(self):
     if g_currentVehicle.isPresent():
         vehicle = g_currentVehicle.item
         canBuyOrRent, _ = vehicle.mayRentOrBuy(g_itemsCache.items.stats.money)
         if vehicle.isRentable and vehicle.rentalIsOver and canBuyOrRent:
             shared_events.showVehicleBuyDialog(vehicle)
Example #18
0
 def vehicleBuy(self):
     item = g_itemsCache.items.getVehicle(self._itemId)
     if item is not None:
         shared_events.showVehicleBuyDialog(item)
 def __purchaseSingleVehicle(self, vehicle):
     event_dispatcher.showVehicleBuyDialog(vehicle)
 def executeUnifiedTradeIn(self, cmd):
     shared_events.showVehicleBuyDialog(
         self._tradeIn.getSelectedVehicleToBuy(),
         previousAlias=VIEW_ALIAS.LOBBY_STORE,
         returnAlias=VIEW_ALIAS.LOBBY_STORE,
         returnCallback=shared_events.showHangar)
Example #21
0
 def __purchaseSingleVehicle(self, vehicle):
     event_dispatcher.showVehicleBuyDialog(
         vehicle,
         returnAlias=self.__backAlias,
         returnCallback=self.__backCallback)
Example #22
0
 def onBuyClick(self):
     event_dispatcher.showVehicleBuyDialog(
         g_currentPreviewVehicle.item,
         previousAlias=VIEW_ALIAS.TRADE_IN_VEHICLE_PREVIEW,
         returnCallback=self.__backCallback,
         returnAlias=self.__backAlias)
Example #23
0
 def onBuyClick(self):
     event_dispatcher.showVehicleBuyDialog(
         g_currentPreviewVehicle.item,
         previousAlias=VIEW_ALIAS.PERSONAL_TRADE_IN_VEHICLE_PREVIEW,
         returnCallback=event_dispatcher.showHangar)
 def buyVehicle(self):
     vehicle = self.itemsCache.items.getItemByCD(self._vehCD)
     if canBuyGoldForVehicleThroughWeb(vehicle):
         shared_events.showVehicleBuyDialog(vehicle)
     else:
         super(PostProgressionContextMenuHandler, self).buyVehicle()
Example #25
0
 def onBuyClick(self):
     event_dispatcher.showVehicleBuyDialog(g_currentPreviewVehicle.item, previousAlias=VIEW_ALIAS.TRADE_IN_VEHICLE_PREVIEW)