Example #1
0
 def _getMsgCtx(self):
     return {
         "name": self.item.userName,
         "kind": self.item.userType,
         "count": BigWorld.wg_getIntegralFormat(int(self.count)),
         "money": formatPrice(self._getOpPrice()),
     }
Example #2
0
 def _successHandler(self, code, ctx = None):
     tmanCost = self.__getRecruitPrice(self.tmanCostTypeIdx)
     prefix = self.__getSysMsgPrefix()
     sysMsgType = _getSysMsgType(tmanCost)
     if tmanCost:
         return makeI18nSuccess('%s/financial_success' % prefix, price=formatPrice(tmanCost), type=sysMsgType, auxData=ctx)
     return makeI18nSuccess('%s/success' % prefix, type=sysMsgType, auxData=ctx)
Example #3
0
 def _successHandler(self, code, ctx = None):
     price = self.__getSlotPrice()
     if price == ZERO_MONEY:
         money = formatGoldPrice(price.gold)
     else:
         money = formatPrice(price)
     return makeI18nSuccess('vehicle_slot_buy/success', money=money, type=SM_TYPE.FinancialTransactionWithGold)
Example #4
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,
     )
Example #5
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)
Example #6
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)
Example #7
0
 def _successHandler(self, code, ctx = None):
     restoreInfo = ''
     if self.vehicle.isPremium and not self.vehicle.isUnique and not self.vehicle.isUnrecoverable and g_lobbyContext.getServerSettings().isVehicleRestoreEnabled() and not self.vehicle.sellForGold:
         timeKey, formattedTime = getTimeLeftInfo(g_itemsCache.items.shop.vehiclesRestoreConfig.restoreDuration)
         restoreInfo = makeString('#system_messages:vehicle/restoreDuration/%s' % timeKey, time=formattedTime)
     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), restoreInfo=restoreInfo, 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), restoreInfo=restoreInfo, type=smType)
Example #8
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)
Example #9
0
 def _getMsgCtx(self):
     return {'boosterName': self.booster.userName,
      'count': BigWorld.wg_getIntegralFormat(int(self.count)),
      'money': formatPrice(self._getOpPrice())}
Example #10
0
 def _successHandler(self, code, ctx = None):
     return makeI18nSuccess('buy_tankmen_berths/success', money=formatPrice(self.berthsPrice), type=SM_TYPE.PurchaseForGold)
Example #11
0
 def _successHandler(self, code, ctx = None):
     return makeI18nSuccess('vehicle_buy/success', vehName=self.item.userName, price=formatPrice(self.price), type=self._getSysMsgType())
Example #12
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)
Example #13
0
 def _successHandler(self, code, ctx = None):
     tmanCost = self._getRecruitPrice(self.tmanCostTypeIdx)
     sysMsgType = _getSysMsgType(tmanCost)
     if tmanCost:
         return makeI18nSuccess('retraining_tankman/financial_success', price=formatPrice(tmanCost), type=sysMsgType, auxData=ctx)
     return makeI18nSuccess('retraining_tankman/success', type=sysMsgType, auxData=ctx)
Example #14
0
 def _successHandler(self, code, ctx = None):
     return makeI18nSuccess('vehicle_slot_buy/success', money=formatPrice(self.__getSlotPrice()), type=SM_TYPE.FinancialTransactionWithGold)
Example #15
0
    def _successHandler(self, code, ctx = None):
        additionalMessages = []
        if len(ctx.get('shells', [])):
            totalPrice = ZERO_MONEY
            for shellCompDescr, price, count in ctx.get('shells', []):
                price = Money(*price)
                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 += price

            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', []):
                price = Money(*price)
                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)
Example #16
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)
Example #17
0
 def _errorHandler(self, code, errStr = '', ctx = None):
     if len(errStr):
         needed = Money(credits=self._repairCost.credits - g_itemsCache.items.stats.credits)
         return makeI18nError('vehicle_repair/%s' % errStr, vehName=self.item.userName, needed=formatPrice(needed))
     return makeI18nError('vehicle_repair/server_error', vehName=self.item.userName)
Example #18
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)
Example #19
0
 def _successHandler(self, code, ctx = None):
     return makeI18nSuccess('vehicle_repair/success', vehName=self.item.userName, money=formatPrice(self._repairCost), type=SM_TYPE.Repair)
Example #20
0
 def _getMsgCtx(self):
     return {'name': self.item.userName,
      'kind': self.item.userType,
      'count': BigWorld.wg_getIntegralFormat(int(self.count)),
      'money': formatPrice(self._getOpPrice())}
Example #21
0
 def _successHandler(self, code, ctx = None):
     """
     :param code: <int> server response code
     :param ctx: <obj> localization context
     :return: <ResultMsg> success message
     """
     return makeI18nSuccess('vehicle_restore/success', vehName=self.item.userName, price=formatPrice(self.price), type=self._getSysMsgType())