示例#1
0
 def _successHandler(self, code, ctx=None):
     msgType = SM_TYPE.FinancialTransactionWithGold
     vehicle = self.itemsCache.items.getItemByCD(self.__vehTypeCompDescr)
     additionalMsgs = []
     if self.__compensationRequired:
         additionalMsgs.append(
             makeCrewSkinCompensationMessage(
                 self.__compensationPriceObject))
     if ctx == EQUIP_TMAN_CODE.OK:
         additionalMsgs.append(
             makeI18nSuccess(sysMsgKey='change_tankman_role/installed',
                             vehicle=vehicle.shortUserName))
     elif ctx == EQUIP_TMAN_CODE.NO_FREE_SLOT:
         roleStr = Tankman.getRoleUserName(SKILL_NAMES[self.__roleIdx])
         additionalMsgs.append(
             makeI18nSuccess(sysMsgKey='change_tankman_role/slot_is_taken',
                             vehicle=vehicle.shortUserName,
                             role=roleStr))
     else:
         additionalMsgs.append(
             makeI18nSuccess(sysMsgKey='change_tankman_role/no_vehicle'))
     return makeI18nSuccess('change_tankman_role/success',
                            money=formatPrice(
                                Money(gold=self.__changeRoleCost)),
                            type=msgType,
                            auxData=additionalMsgs)
示例#2
0
 def _successHandler(self, code, ctx=None):
     restoreInfo = ''
     sellForGold = self.vehicle.getSellPrice(preferred=True).getCurrency(byWeight=True) == Currency.GOLD
     if self.vehicle.isPremium and not self.vehicle.isUnique and not self.vehicle.isUnrecoverable and self.__lobbyContext.getServerSettings().isVehicleRestoreEnabled() and not sellForGold:
         timeKey, formattedTime = getTimeLeftInfo(self.itemsCache.items.shop.vehiclesRestoreConfig.restoreDuration)
         restoreInfo = backport.text(R.strings.system_messages.vehicle.restoreDuration.dyn(timeKey, R.invalid)(), time=formattedTime)
     additionalMsgs = []
     if self.__compensationRequired:
         additionalMsgs.append(makeCrewSkinCompensationMessage(self.__compensationAmount))
     if self.__hasPairModification:
         additionalMsgs.append(makeAllPairsDiscardMsg(self.vehicle.userName))
     g_tankActiveCamouflage[self.vehicle.intCD] = SeasonType.UNDEFINED
     msgCtx = {'vehName': self.vehicle.userName}
     if self.usedDemountKitsCount:
         msgCtx['countDK'] = self.usedDemountKitsCount
     if self.isDismantlingForMoney:
         msgCtx['gainMoney'] = formatPrice(self.gainMoney)
         msgCtx['spendMoney'] = formatPrice(self.spendMoney)
     else:
         msgCtx['money'] = formatPrice(self.gainMoney)
     if not self.isRemovedAfterRent:
         msgCtx['restoreInfo'] = restoreInfo
     sysMsgR = R.strings.system_messages.dyn('vehicle_remove' if self.isRemovedAfterRent else 'vehicle_sell', R.invalid)
     if sysMsgR:
         sysMsgR = sysMsgR.dyn('success_dismantling' if self.isDismantlingForMoney else 'success', R.invalid)
     if sysMsgR and self.usedDemountKitsCount:
         sysMsgR = sysMsgR.dyn('with_demount_kit', R.invalid)
     if self.isRemovedAfterRent:
         smType = SM_TYPE.Remove
     elif sellForGold:
         smType = SM_TYPE.SellingForGold
     else:
         smType = SM_TYPE.Selling
     return makeSuccess(userMsg=backport.text(sysMsgR(), **msgCtx), msgType=smType, auxData=additionalMsgs)
示例#3
0
 def _successHandler(self, code, ctx=None):
     additionalMsgs = []
     if self.__compensationRequired:
         additionalMsgs.append(
             makeCrewSkinCompensationMessage(
                 self.__compensationPriceObject))
     return makeI18nSuccess('dismiss_tankman/success',
                            type=SM_TYPE.Information,
                            auxData=additionalMsgs)
示例#4
0
 def _successHandler(self, code, ctx=None):
     additionalMsgs = []
     if self.__compensationRequired:
         additionalMsgs.append(
             makeCrewSkinCompensationMessage(
                 self.__compensationPriceObject))
     return makeI18nSuccess(sysMsgKey='crewSkinsNotification/SkinChanged',
                            type=SM_TYPE.Information,
                            auxData=additionalMsgs)
 def _successHandler(self, code, ctx=None):
     restoreInfo = ''
     sellForGold = self.vehicle.getSellPrice(preferred=True).getCurrency(
         byWeight=True) == Currency.GOLD
     if self.vehicle.isPremium and not self.vehicle.isUnique and not self.vehicle.isUnrecoverable and self.lobbyContext.getServerSettings(
     ).isVehicleRestoreEnabled() and not sellForGold:
         timeKey, formattedTime = getTimeLeftInfo(
             self.itemsCache.items.shop.vehiclesRestoreConfig.
             restoreDuration)
         restoreInfo = makeString(
             '#system_messages:vehicle/restoreDuration/{}'.format(timeKey),
             time=formattedTime)
     compMsg = None
     if self.__compensationRequired:
         compMsg = makeCrewSkinCompensationMessage(
             self.__compensationAmount)
     g_tankActiveCamouflage[self.vehicle.intCD] = SeasonType.UNDEFINED
     makeMsg = partial(makeI18nSuccess,
                       vehName=self.vehicle.userName,
                       auxData=compMsg)
     if self.usedDemountKitsCount:
         makeMsg = partial(makeMsg, countDK=self.usedDemountKitsCount)
     if self.isDismantlingForMoney:
         makeMsg = partial(makeMsg,
                           gainMoney=formatPrice(self.gainMoney),
                           spendMoney=formatPrice(self.spendMoney))
     else:
         makeMsg = partial(makeMsg, money=formatPrice(self.gainMoney))
     if not self.isRemovedAfterRent:
         makeMsg = partial(makeMsg, restoreInfo=restoreInfo)
     sysMsgKey = '{}{}{}'.format(
         'vehicle_remove' if self.isRemovedAfterRent else 'vehicle_sell',
         '/success_dismantling'
         if self.isDismantlingForMoney else '/success',
         '/with_demount_kit' if self.usedDemountKitsCount else '')
     if self.isRemovedAfterRent:
         smType = SM_TYPE.Remove
     elif sellForGold:
         smType = SM_TYPE.SellingForGold
     else:
         smType = SM_TYPE.Selling
     return makeMsg(sysMsgKey=sysMsgKey, type=smType)
示例#6
0
 def _successHandler(self, code, ctx=None):
     compMsg = None
     if self.__compensationRequired:
         compMsg = makeCrewSkinCompensationMessage(self.__compensationPriceObject)
     return makeI18nSuccess('dismiss_tankman/success', type=SM_TYPE.Information, auxData=compMsg)
示例#7
0
 def _successHandler(self, code, ctx=None):
     compMsg = None
     if self.__compensationRequired:
         compMsg = makeCrewSkinCompensationMessage(self.__compensationPriceObject)
     return makeI18nSuccess(sysMsgKey='crewSkinsNotification/SkinChanged', type=SM_TYPE.Information, auxData=compMsg)