Exemple #1
0
 def _successHandler(self, code, ctx=None):
     return makeI18nSuccess(
         "vehicle_repair/success",
         vehName=self.item.userName,
         money=formatPrice(self._repairCost),
         type=SM_TYPE.Repair,
     )
Exemple #2
0
 def _getMsgCtx(self):
     return {
         'name': self.item.userName,
         'kind': self.item.userType,
         'count': BigWorld.wg_getIntegralFormat(int(self.count)),
         'money': formatPrice(self._getOpPrice())
     }
Exemple #3
0
 def _successHandler(self, code, ctx=None):
     if self.isFemale:
         goldPrice = g_itemsCache.items.shop.passportFemaleChangeCost
     else:
         goldPrice = g_itemsCache.items.shop.passportChangeCost
     return makeI18nSuccess('replace_tankman/success',
                            money=formatPrice((0, goldPrice)),
                            type=SM_TYPE.PurchaseForGold)
Exemple #4
0
 def _successHandler(self, code, ctx=None):
     tmanCost = self.__getRecruitPrice(self.tmanCostTypeIdx)
     prefix = self.__getSysMsgPrefix()
     if tmanCost[0] > 0 or tmanCost[1] > 0:
         return makeI18nSuccess(
             "%s/financial_success" % prefix, price=formatPrice(tmanCost), type=self.__getSysMsgType(), auxData=ctx
         )
     return makeI18nSuccess("%s/success" % prefix, type=self.__getSysMsgType(), auxData=ctx)
Exemple #5
0
 def _successHandler(self, code, ctx=None):
     return makeI18nSuccess(
         "vehicle_rent/success",
         vehName=self.item.userName,
         days=ctx.get("days", 0),
         price=formatPrice(self.price),
         type=self._getSysMsgType(),
     )
Exemple #6
0
 def _successHandler(self, code, ctx=None):
     msgType = self.__getTankmanSysMsgType(self.dropSkillCostIdx)
     price = g_itemsCache.items.shop.dropSkillsCost.get(
         self.dropSkillCostIdx)
     return makeI18nSuccess('drop_tankman_skill/success',
                            money=formatPrice(
                                (price['credits'], price['gold'])),
                            type=msgType)
Exemple #7
0
 def _successHandler(self, code, ctx=None):
     tmanCost = self.__getRecruitPrice(self.tmanCostTypeIdx)
     if tmanCost[0] > 0 or tmanCost[1] > 0:
         return makeI18nSuccess(
             "recruit_window/financial_success",
             price=formatPrice(tmanCost),
             type=self.__getSysMsgType(),
             auxData=ctx,
         )
     return makeI18nSuccess("recruit_window/success", type=self.__getSysMsgType(), auxData=ctx)
Exemple #8
0
 def _successHandler(self, code, ctx=None):
     tmanCost = self.__getRecruitPrice(self.tmanCostTypeIdx)
     if tmanCost[0] > 0 or tmanCost[1] > 0:
         return makeI18nSuccess('recruit_window/financial_success',
                                price=formatPrice(tmanCost),
                                type=self.__getSysMsgType(),
                                auxData=ctx)
     return makeI18nSuccess('recruit_window/success',
                            type=self.__getSysMsgType(),
                            auxData=ctx)
Exemple #9
0
 def _successHandler(self, code, ctx = None):
     msgType = SM_TYPE.FinancialTransactionWithGold
     vehicle = g_itemsCache.items.getItemByCD(self.__vehTypeCompDescr)
     if ctx == EQUIP_TMAN_CODE.OK:
         auxData = makeI18nSuccess('change_tankman_role/installed', vehicle=vehicle.shortUserName)
     elif ctx == EQUIP_TMAN_CODE.NO_FREE_SLOT:
         roleStr = Tankman.getRoleUserName(SKILL_NAMES[self.__roleIdx])
         auxData = makeI18nSuccess('change_tankman_role/slot_is_taken', vehicle=vehicle.shortUserName, role=roleStr)
     else:
         auxData = makeI18nSuccess('change_tankman_role/no_vehicle')
     return makeI18nSuccess('change_tankman_role/success', money=formatPrice((0, self.__changeRoleCost)), type=msgType, auxData=auxData)
Exemple #10
0
    def _successHandler(self, code, ctx=None):
        additionalMessages = []
        if len(ctx.get("shells", [])):
            totalPrice = [0, 0]
            for shellCompDescr, price, count in ctx.get("shells", []):
                shell = g_itemsCache.items.getItemByCD(shellCompDescr)
                additionalMessages.append(
                    makeI18nSuccess(
                        "shell_buy/success",
                        name=shell.userName,
                        count=count,
                        money=formatPrice(price),
                        type=self.__getSysMsgType(price),
                    )
                )
                totalPrice[0] += price[0]
                totalPrice[1] += price[1]

            additionalMessages.append(
                makeI18nSuccess(
                    "layout_apply/success_money_spent",
                    money=formatPrice(totalPrice),
                    type=self.__getSysMsgType(totalPrice),
                )
            )
        if len(ctx.get("eqs", [])):
            for eqCompDescr, price, count in ctx.get("eqs", []):
                equipment = g_itemsCache.items.getItemByCD(eqCompDescr)
                additionalMessages.append(
                    makeI18nSuccess(
                        "artefact_buy/success",
                        kind=equipment.userType,
                        name=equipment.userName,
                        count=count,
                        money=formatPrice(price),
                        type=self.__getSysMsgType(price),
                    )
                )

        return makeSuccess(auxData=additionalMessages)
Exemple #11
0
 def _successHandler(self, code, ctx=None):
     crewMembersCount = len(self.tankmen)
     messagePrefix = 'retraining_crew'
     if crewMembersCount == 1:
         messagePrefix = 'retraining_tankman'
     crewRetrainingCost = self._getRecruitPrice(self.tmanCostTypeIdx)
     if crewRetrainingCost[0] > 0 or crewRetrainingCost[1] > 0:
         return makeI18nSuccess('%s/financial_success' % messagePrefix,
                                type=self._getSysMsgType(),
                                auxData=ctx,
                                price=formatPrice(crewRetrainingCost))
     return makeI18nSuccess('%s/success' % messagePrefix,
                            type=self._getSysMsgType(),
                            auxData=ctx)
Exemple #12
0
 def _successHandler(self, code, ctx=None):
     if self.isDismantlingForGold:
         localKey = "vehicle_sell/success_dismantling"
         smType = SM_TYPE.Selling
         if self.isRemovedAfterRent:
             localKey = "vehicle_remove/success_dismantling"
             smType = SM_TYPE.Remove
         return makeI18nSuccess(
             localKey,
             vehName=self.vehicle.userName,
             gainMoney=formatPrice(self.gainMoney),
             spendMoney=formatPrice(self.spendMoney),
             type=smType,
         )
     else:
         localKey = "vehicle_sell/success"
         smType = SM_TYPE.Selling
         if self.isRemovedAfterRent:
             localKey = "vehicle_remove/success"
             smType = SM_TYPE.Remove
         return makeI18nSuccess(
             localKey, vehName=self.vehicle.userName, money=formatPrice(self.gainMoney), type=smType
         )
Exemple #13
0
 def _successHandler(self, code, ctx = None):
     if self.isDismantlingForGold:
         localKey = 'vehicle_sell/success_dismantling'
         smType = SM_TYPE.Selling
         if self.isRemovedAfterRent:
             localKey = 'vehicle_remove/success_dismantling'
             smType = SM_TYPE.Remove
         return makeI18nSuccess(localKey, vehName=self.vehicle.userName, gainMoney=formatPrice(self.gainMoney), spendMoney=formatPrice(self.spendMoney), type=smType)
     else:
         localKey = 'vehicle_sell/success'
         smType = SM_TYPE.Selling
         if self.isRemovedAfterRent:
             localKey = 'vehicle_remove/success'
             smType = SM_TYPE.Remove
         return makeI18nSuccess(localKey, vehName=self.vehicle.userName, money=formatPrice(self.gainMoney), type=smType)
Exemple #14
0
 def __upgradeToPremium(self, days):
     Waiting.show('loadStats')
     attrs = yield DeprecatedStatsRequester().getAccountAttrs()
     isPremium = account_helpers.isPremiumAccount(attrs)
     success = yield DeprecatedStatsRequester().upgradeToPremium(days)
     if success:
         premiumCost = yield DeprecatedStatsRequester().getPremiumCost()
         if premiumCost:
             if isPremium:
                 successMessage = SYSTEM_MESSAGES.PREMIUM_CONTINUESUCCESS
             else:
                 successMessage = SYSTEM_MESSAGES.PREMIUM_BUYINGSUCCESS
             SystemMessages.pushI18nMessage(successMessage, days, formatPrice((0, premiumCost[int(days)])), type=SystemMessages.SM_TYPE.PurchaseForGold)
     else:
         self.__systemErrorMessage(SYSTEM_MESSAGES.PREMIUM_SERVER_ERROR, days, SystemMessages.SM_TYPE.Error)
     Waiting.hide('loadStats')
Exemple #15
0
 def _successHandler(self, code, ctx=None):
     msgType = SM_TYPE.FinancialTransactionWithGold
     vehicle = g_itemsCache.items.getItemByCD(self.__vehTypeCompDescr)
     if ctx == EQUIP_TMAN_CODE.OK:
         auxData = makeI18nSuccess('change_tankman_role/installed',
                                   vehicle=vehicle.shortUserName)
     elif ctx == EQUIP_TMAN_CODE.NO_FREE_SLOT:
         roleStr = Tankman.getRoleUserName(SKILL_NAMES[self.__roleIdx])
         auxData = makeI18nSuccess('change_tankman_role/slot_is_taken',
                                   vehicle=vehicle.shortUserName,
                                   role=roleStr)
     else:
         auxData = makeI18nSuccess('change_tankman_role/no_vehicle')
     return makeI18nSuccess('change_tankman_role/success',
                            money=formatPrice((0, self.__changeRoleCost)),
                            type=msgType,
                            auxData=auxData)
Exemple #16
0
 def buyVehicle(self, vehCD):
     itemTypeID, nationID, itemID = vehicles.parseIntCompactDescr(vehCD)
     if itemTypeID is not _VEHICLE:
         LOG_ERROR('Value of int-type descriptor is not refer to vehicle',
                   vehCD)
         return
     else:
         if not self._data.hasInvItem(vehCD):
             price = self._data.getShopPrice(vehCD)
             if price is None:
                 self._showMessage4Vehicle(self.MSG_SCOPE.Shop, 'not_found',
                                           vehCD)
                 return
             accCredits = self._data._accCredits
             accGold = self._data._accGold
             if (accCredits, accGold) >= price:
                 self.fireEvent(
                     events.ShowWindowEvent(
                         events.ShowWindowEvent.SHOW_VEHICLE_BUY_WINDOW, {
                             'nationID': nationID,
                             'itemID': itemID
                         }))
             else:
                 _credits = price[0] - accCredits if price[0] > 0 else 0
                 _gold = price[1] - accGold if price[1] > 0 else 0
                 self._showMessage4Vehicle(self.MSG_SCOPE.Shop,
                                           'not_enough_money',
                                           vehCD,
                                           price=gui_items.formatPrice(
                                               [_credits, _gold]))
         else:
             self._showMessage4Vehicle(
                 self.MSG_SCOPE.Inventory,
                 'already_exists',
                 vehCD,
                 msgType=SystemMessages.SM_TYPE.Warning)
         return
Exemple #17
0
 def __upgradeToPremium(self, days):
     Waiting.show('loadStats')
     attrs = yield StatsRequester().getAccountAttrs()
     isPremium = account_helpers.isPremiumAccount(attrs)
     success = yield StatsRequester().upgradeToPremium(days)
     if success:
         premiumCost = yield StatsRequester().getPremiumCost()
         if premiumCost:
             if isPremium:
                 successMessage = SYSTEM_MESSAGES.PREMIUM_CONTINUESUCCESS
             else:
                 successMessage = SYSTEM_MESSAGES.PREMIUM_BUYINGSUCCESS
             SystemMessages.pushI18nMessage(
                 successMessage,
                 days,
                 formatPrice((0, premiumCost[int(days)])),
                 type=SystemMessages.SM_TYPE.PurchaseForGold)
         self.fireEvent(LobbySimpleEvent(
             LobbySimpleEvent.UPDATE_TANK_PARAMS),
                        scope=EVENT_BUS_SCOPE.LOBBY)
     else:
         self.__systemErrorMessage(SYSTEM_MESSAGES.PREMIUM_SERVER_ERROR,
                                   days, SystemMessages.SM_TYPE.Error)
     Waiting.hide('loadStats')
Exemple #18
0
 def _getMsgCtx(self):
     return {'name': self.item.userName,
      'kind': self.item.userType,
      'count': BigWorld.wg_getIntegralFormat(int(self.count)),
      'money': formatPrice(self._getOpPrice())}
Exemple #19
0
 def _successHandler(self, code, ctx = None):
     return makeI18nSuccess('vehicle_slot_buy/success', money=formatPrice(self.__getSlotPrice()), type=SM_TYPE.FinancialTransactionWithGold)
Exemple #20
0
 def _successHandler(self, code, ctx = None):
     if self.isFemale:
         goldPrice = g_itemsCache.items.shop.passportFemaleChangeCost
     else:
         goldPrice = g_itemsCache.items.shop.passportChangeCost
     return makeI18nSuccess('replace_tankman/success', money=formatPrice((0, goldPrice)), type=SM_TYPE.PurchaseForGold)
Exemple #21
0
 def _successHandler(self, code, ctx = None):
     return makeI18nSuccess('vehicle_buy/success', vehName=self.item.userName, price=formatPrice(self.price), type=self._getSysMsgType())
Exemple #22
0
 def _successHandler(self, code, ctx = None):
     return makeI18nSuccess('vehicle_slot_buy/success', money=formatPrice(self.__getSlotPrice()), type=SM_TYPE.FinancialTransactionWithGold)
Exemple #23
0
 def _sendMoneyValidationMsg(self, price, item, errorID):
     stats = g_itemsCache.items.stats
     money = [price[0] - stats.credits if price[0] > 0 else 0, price[1] - stats.gold if price[1] > 0 else 0]
     self._showMessage(self.MSG_SCOPE.Shop, errorID, item, price=gui_items.formatPrice(money))
Exemple #24
0
 def _successHandler(self, code, ctx = None):
     return makeI18nSuccess('buy_tankmen_berths/success', money=formatPrice(self.berthsPrice), type=SM_TYPE.Information)
Exemple #25
0
 def _successHandler(self, code, ctx = None):
     return makeI18nSuccess('vehicle_rent/success', vehName=self.item.userName, days=ctx.get('days', 0), price=formatPrice(self.price), type=self._getSysMsgType())
Exemple #26
0
 def _successHandler(self, code, ctx = None):
     tmanCost = self._getRecruitPrice(self.tmanCostTypeIdx)
     if tmanCost[0] > 0 or tmanCost[1] > 0:
         return makeI18nSuccess('retraining_tankman/financial_success', price=formatPrice(tmanCost), type=self._getSysMsgType(), auxData=ctx)
     return makeI18nSuccess('retraining_tankman/success', type=self._getSysMsgType(), auxData=ctx)
Exemple #27
0
 def _successHandler(self, code, ctx=None):
     return makeI18nSuccess('buy_tankmen_berths/success',
                            money=formatPrice(self.berthsPrice),
                            type=SM_TYPE.PurchaseForGold)
Exemple #28
0
 def _successHandler(self, code, ctx = None):
     crewMembersCount = len(self.tankmen)
     messagePrefix = 'retraining_crew'
     if crewMembersCount == 1:
         messagePrefix = 'retraining_tankman'
     crewRetrainingCost = self._getRecruitPrice(self.tmanCostTypeIdx)
     if crewRetrainingCost[0] > 0 or crewRetrainingCost[1] > 0:
         return makeI18nSuccess('%s/financial_success' % messagePrefix, type=self._getSysMsgType(), auxData=ctx, price=formatPrice(crewRetrainingCost))
     return makeI18nSuccess('%s/success' % messagePrefix, type=self._getSysMsgType(), auxData=ctx)
 def buyVehicle(self, vehCD):
     itemTypeID, nationID, itemID = vehicles.parseIntCompactDescr(vehCD)
     if itemTypeID is not _VEHICLE:
         LOG_ERROR('Value of int-type descriptor is not refer to vehicle', vehCD)
         return
     else:
         if not self._data.hasInvItem(vehCD):
             price = self._data.getShopPrice(vehCD)
             if price is None:
                 self._showMessage4Vehicle(self.MSG_SCOPE.Shop, 'not_found', vehCD)
                 return
             accCredits = self._data._accCredits
             accGold = self._data._accGold
             if (accCredits, accGold) >= price:
                 self.fireEvent(events.ShowWindowEvent(events.ShowWindowEvent.SHOW_VEHICLE_BUY_WINDOW, {'nationID': nationID,
                  'itemID': itemID}))
             else:
                 _credits = price[0] - accCredits if price[0] > 0 else 0
                 _gold = price[1] - accGold if price[1] > 0 else 0
                 self._showMessage4Vehicle(self.MSG_SCOPE.Shop, 'not_enough_money', vehCD, price=gui_items.formatPrice([_credits, _gold]))
         else:
             self._showMessage4Vehicle(self.MSG_SCOPE.Inventory, 'already_exists', vehCD, msgType=SystemMessages.SM_TYPE.Warning)
         return
Exemple #30
0
 def _successHandler(self, code, ctx = None):
     return makeI18nSuccess('vehicle_repair/success', vehName=self.item.userName, money=formatPrice(self._repairCost), type=SM_TYPE.Repair)
Exemple #31
0
 def _errorHandler(self, code, errStr = '', ctx = None):
     if len(errStr):
         needed = (self._repairCost[0] - g_itemsCache.items.stats.credits, 0)
         return makeI18nError('vehicle_repair/%s' % errStr, vehName=self.item.userName, needed=formatPrice(needed))
     return makeI18nError('vehicle_repair/server_error', vehName=self.item.userName)
Exemple #32
0
 def _successHandler(self, code, ctx = None):
     return makeI18nSuccess('exchange/success', gold=BigWorld.wg_getGoldFormat(self.gold), credits=formatPrice((self.credits, 0)), type=SM_TYPE.FinancialTransactionWithGold)
Exemple #33
0
 def _successHandler(self, code, ctx=None):
     return makeI18nSuccess('exchange/success',
                            gold=BigWorld.wg_getGoldFormat(self.gold),
                            credits=formatPrice((self.credits, 0)),
                            type=SM_TYPE.FinancialTransactionWithGold)
Exemple #34
0
 def _successHandler(self, code, ctx = None):
     if self.isDismantlingForGold:
         return makeI18nSuccess('vehicle_sell/success_dismantling', vehName=self.vehicle.userName, gainMoney=formatPrice(self.gainMoney), spendMoney=formatPrice(self.spendMoney), type=SM_TYPE.Selling)
     else:
         return makeI18nSuccess('vehicle_sell/success', vehName=self.vehicle.userName, money=formatPrice(self.gainMoney), type=SM_TYPE.Selling)
Exemple #35
0
 def _errorHandler(self, code, errStr = '', ctx = None):
     if len(errStr):
         needed = (self._repairCost[0] - g_itemsCache.items.stats.credits, 0)
         return makeI18nError('vehicle_repair/%s' % errStr, vehName=self.item.userName, needed=formatPrice(needed))
     return makeI18nError('vehicle_repair/server_error', vehName=self.item.userName)
Exemple #36
0
    def _successHandler(self, code, ctx = None):
        additionalMessages = []
        if len(ctx.get('shells', [])):
            totalPrice = [0, 0]
            for shellCompDescr, price, count in ctx.get('shells', []):
                shell = g_itemsCache.items.getItemByCD(shellCompDescr)
                additionalMessages.append(makeI18nSuccess('shell_buy/success', name=shell.userName, count=count, money=formatPrice(price), type=getPurchaseSysMessageType(price)))
                totalPrice[0] += price[0]
                totalPrice[1] += price[1]

            additionalMessages.append(makeI18nSuccess('layout_apply/success_money_spent', money=formatPrice(totalPrice), type=getPurchaseSysMessageType(totalPrice)))
        if len(ctx.get('eqs', [])):
            for eqCompDescr, price, count in ctx.get('eqs', []):
                equipment = g_itemsCache.items.getItemByCD(eqCompDescr)
                additionalMessages.append(makeI18nSuccess('artefact_buy/success', kind=equipment.userType, name=equipment.userName, count=count, money=formatPrice(price), type=getPurchaseSysMessageType(price)))

        return makeSuccess(auxData=additionalMessages)
Exemple #37
0
 def _successHandler(self, code, ctx = None):
     return makeI18nSuccess('vehicle_buy/success', vehName=self.item.userName, price=formatPrice(self.price), type=self.__getSysMsgType())
Exemple #38
0
 def _successHandler(self, code, ctx = None):
     msgType = self.__getTankmanSysMsgType(self.dropSkillCostIdx)
     price = g_itemsCache.items.shop.dropSkillsCost.get(self.dropSkillCostIdx)
     return makeI18nSuccess('drop_tankman_skill/success', money=formatPrice((price['credits'], price['gold'])), type=msgType)