def __packInfoBlock(self, bonuses):
     return [
         formatters.packTextBlockData(
             text=text_styles.titleFont(
                 backport.text(_R_TOOLTIPS_TEXT.bonuses())),
             padding=formatters.packPadding(bottom=20))
     ] + [self.__getBonus(_BONUS_PRESETS[bonusId]) for bonusId in bonuses]
示例#2
0
    def createToolTipData(bodyParamsList):
        result = {}
        bodyData = None
        if bodyParamsList is not None:
            bodyData = {}
            for i in range(0, len(bodyParamsList)):
                bodyData[HeaderItemsTypes.VALUE_PREFIX + str(i)] = text_styles.titleFont(str(bodyParamsList[i]))

        result['body'] = bodyData
        result['header'] = {}
        result['note'] = None
        return result
示例#3
0
    def createToolTipData(bodyParamsList):
        result = {}
        bodyData = None
        if bodyParamsList is not None:
            bodyData = {}
            for i in range(0, len(bodyParamsList)):
                bodyData[HeaderItemsTypes.VALUE_PREFIX + str(i)] = text_styles.titleFont(str(bodyParamsList[i]))

        result['body'] = bodyData
        result['header'] = {}
        result['note'] = None
        return result
    def _initData(self, *args):
        stats = g_itemsCache.items.stats
        self.as_setGoldS(stats.gold)
        self.as_setCreditsS(stats.credits)
        windowExpanded = AccountSettings.getSettings(VEHICLE_BUY_WINDOW_SETTINGS)
        vehicle = g_itemsCache.items.getItem(GUI_ITEM_TYPE.VEHICLE, self.nationID, self.inNationID)
        if vehicle is None:
            LOG_ERROR("Vehicle Item mustn't be None!", 'NationID:', self.nationID, 'InNationID:', self.inNationID)
        elif vehicle.isInInventory and not vehicle.isRented:
            self.onWindowClose()
        else:
            shop = g_itemsCache.items.shop
            shopDefaults = shop.defaults
            tankMenCount = len(vehicle.crew)
            tankMenStudyPrice = shop.tankmanCostWithGoodyDiscount
            totalTankMenStudePrice = (tankMenStudyPrice[1]['credits'] * tankMenCount, tankMenStudyPrice[2]['gold'] * tankMenCount)
            defTankMenStudyPrice = shopDefaults.tankmanCost
            defTotalTankMenStudePrice = (defTankMenStudyPrice[1]['credits'] * tankMenCount, defTankMenStudyPrice[2]['gold'] * tankMenCount)
            studyPriceCreditsActionData = None
            if totalTankMenStudePrice[0] != defTotalTankMenStudePrice[0]:
                studyPriceCreditsActionData = {'type': ACTION_TOOLTIPS_TYPE.ECONOMICS,
                 'key': 'creditsTankmanCost',
                 'isBuying': True,
                 'state': (ACTION_TOOLTIPS_STATE.DISCOUNT, None),
                 'newPrice': (totalTankMenStudePrice[0], 0),
                 'oldPrice': (defTotalTankMenStudePrice[0], 0)}
            studyPriceGoldActionData = None
            if totalTankMenStudePrice[1] != defTotalTankMenStudePrice[1]:
                studyPriceGoldActionData = {'type': ACTION_TOOLTIPS_TYPE.ECONOMICS,
                 'key': 'goldTankmanCost',
                 'isBuying': True,
                 'state': (None, ACTION_TOOLTIPS_STATE.DISCOUNT),
                 'newPrice': (0, totalTankMenStudePrice[1]),
                 'oldPrice': (0, defTotalTankMenStudePrice[1])}
            vehiclePricesActionData = None
            if vehicle.buyPrice != vehicle.defaultPrice:
                vehiclePricesActionData = getItemActionTooltipData(vehicle)
            ammoPrice = [0, 0]
            defAmmoPrice = [0, 0]
            for shell in vehicle.gun.defaultAmmo:
                ammoPrice[0] += shell.buyPrice[0] * shell.defaultCount
                ammoPrice[1] += shell.buyPrice[1] * shell.defaultCount
                defAmmoPrice[0] += shell.defaultPrice[0] * shell.defaultCount
                defAmmoPrice[1] += shell.defaultPrice[1] * shell.defaultCount

            ammoActionPriceData = None
            if ammoPrice[0] != defAmmoPrice[0]:
                ammoActionPriceData = {'type': ACTION_TOOLTIPS_TYPE.AMMO,
                 'key': str(vehicle.intCD),
                 'isBuying': True,
                 'state': (ACTION_TOOLTIPS_STATE.DISCOUNT, None),
                 'newPrice': ammoPrice,
                 'oldPrice': defAmmoPrice}
            slotPrice = shop.getVehicleSlotsPrice(stats.vehicleSlots)
            slotDefaultPrice = shopDefaults.getVehicleSlotsPrice(stats.vehicleSlots)
            slotActionPriceData = None
            if slotPrice != slotDefaultPrice:
                slotActionPriceData = {'type': ACTION_TOOLTIPS_TYPE.ECONOMICS,
                 'key': 'slotsPrices',
                 'isBuying': True,
                 'state': (None, ACTION_TOOLTIPS_STATE.DISCOUNT),
                 'newPrice': (0, slotPrice),
                 'oldPrice': (0, slotDefaultPrice)}
            tankmenLabel = i18n.makeString(DIALOGS.BUYVEHICLEDIALOG_TANKMENLABEL, count=text_styles.titleFont(i18n.makeString(DIALOGS.BUYVEHICLEDIALOG_TANKMEN) + ' ' + str(tankMenCount)))
            initData = {'expanded': windowExpanded,
             'name': vehicle.userName,
             'longName': vehicle.longUserName,
             'description': vehicle.fullDescription,
             'type': vehicle.type,
             'icon': vehicle.icon,
             'nation': self.nationID,
             'level': vehicle.level,
             'isElite': vehicle.isElite,
             'tankmenLabel': tankmenLabel,
             'studyPriceCredits': totalTankMenStudePrice[0],
             'studyPriceCreditsActionData': studyPriceCreditsActionData,
             'studyPriceGold': totalTankMenStudePrice[1],
             'studyPriceGoldActionData': studyPriceGoldActionData,
             'vehiclePrices': vehicle.buyPrice,
             'vehiclePricesActionData': vehiclePricesActionData,
             'ammoPrice': ammoPrice[0],
             'ammoActionPriceData': ammoActionPriceData,
             'slotPrice': slotPrice,
             'slotActionPriceData': slotActionPriceData,
             'isRentable': vehicle.isRentable,
             'isStudyDisabled': vehicle.hasCrew,
             'isNoAmmo': not vehicle.hasShells,
             'rentDataDD': self._getRentData(vehicle, vehiclePricesActionData)}
            self.as_setInitDataS(initData)
        return
 def __pushEnabled(self):
     expiryTime = self.__battlePassController.getSeasonFinishTime()
     SystemMessages.pushMessage(text=backport.text(R.strings.system_messages.battlePass.switch_enabled.body(), expiryTime=text_styles.titleFont(TimeFormatter.getLongDatetimeFormat(expiryTime))), type=SystemMessages.SM_TYPE.Warning)
示例#6
0
def actionTitleFormat(title):
    return text_styles.titleFont(title)
示例#7
0
    def _initData(self, *args):
        stats = g_itemsCache.items.stats
        self.as_setGoldS(stats.gold)
        self.as_setCreditsS(stats.credits)
        windowExpanded = AccountSettings.getSettings(
            VEHICLE_BUY_WINDOW_SETTINGS)
        vehicle = g_itemsCache.items.getItem(GUI_ITEM_TYPE.VEHICLE,
                                             self.nationID, self.inNationID)
        if vehicle is None:
            LOG_ERROR("Vehicle Item mustn't be None!", 'NationID:',
                      self.nationID, 'InNationID:', self.inNationID)
        elif vehicle.isInInventory and not vehicle.isRented:
            self.onWindowClose()
        else:
            shop = g_itemsCache.items.shop
            shopDefaults = shop.defaults
            tankMenCount = len(vehicle.crew)
            tankMenStudyPrice = shop.tankmanCostWithGoodyDiscount
            totalTankMenStudePrice = tankMenCount * Money(
                credits=tankMenStudyPrice[1]['credits'],
                gold=tankMenStudyPrice[2]['gold'])
            defTankMenStudyPrice = shopDefaults.tankmanCost
            defTotalTankMenStudePrice = tankMenCount * Money(
                credits=defTankMenStudyPrice[1]['credits'],
                gold=defTankMenStudyPrice[2]['gold'])
            studyPriceCreditsActionData = None
            if totalTankMenStudePrice != defTotalTankMenStudePrice:
                studyPriceCreditsActionData = packActionTooltipData(
                    ACTION_TOOLTIPS_TYPE.ECONOMICS, 'creditsTankmanCost', True,
                    totalTankMenStudePrice, defTotalTankMenStudePrice)
            studyPriceGoldActionData = None
            if totalTankMenStudePrice != defTotalTankMenStudePrice:
                studyPriceGoldActionData = packActionTooltipData(
                    ACTION_TOOLTIPS_TYPE.ECONOMICS, 'goldTankmanCost', True,
                    totalTankMenStudePrice, defTotalTankMenStudePrice)
            vehiclePricesActionData = None
            if vehicle.buyPrice != vehicle.defaultPrice:
                vehiclePricesActionData = packItemActionTooltipData(vehicle)
            ammoPrice = ZERO_MONEY
            defAmmoPrice = ZERO_MONEY
            for shell in vehicle.gun.defaultAmmo:
                ammoPrice += shell.buyPrice * shell.defaultCount
                defAmmoPrice += shell.defaultPrice * shell.defaultCount

            ammoActionPriceData = None
            if ammoPrice != defAmmoPrice:
                ammoActionPriceData = packActionTooltipData(
                    ACTION_TOOLTIPS_TYPE.AMMO, str(vehicle.intCD), True,
                    ammoPrice, defAmmoPrice)
            slotPrice = shop.getVehicleSlotsPrice(stats.vehicleSlots)
            slotDefaultPrice = shopDefaults.getVehicleSlotsPrice(
                stats.vehicleSlots)
            slotActionPriceData = None
            if slotPrice != slotDefaultPrice:
                slotActionPriceData = packActionTooltipData(
                    ACTION_TOOLTIPS_TYPE.ECONOMICS, 'slotsPrices', True,
                    Money(gold=slotPrice), Money(gold=slotDefaultPrice))
            tankmenLabel = i18n.makeString(
                DIALOGS.BUYVEHICLEDIALOG_TANKMENLABEL,
                count=text_styles.titleFont(
                    i18n.makeString(DIALOGS.BUYVEHICLEDIALOG_TANKMEN) + ' ' +
                    str(tankMenCount)))
            initData = {
                'expanded': windowExpanded,
                'name': vehicle.userName,
                'shortName': vehicle.shortUserName,
                'longName': vehicle.longUserName,
                'description': vehicle.fullDescription,
                'type': vehicle.type,
                'icon': vehicle.icon,
                'nation': self.nationID,
                'level': vehicle.level,
                'isElite': vehicle.isElite,
                'tankmenLabel': tankmenLabel,
                'studyPriceCredits': totalTankMenStudePrice.credits,
                'studyPriceCreditsActionData': studyPriceCreditsActionData,
                'studyPriceGold': totalTankMenStudePrice.gold,
                'studyPriceGoldActionData': studyPriceGoldActionData,
                'vehiclePrices': vehicle.buyPrice,
                'vehiclePricesActionData': vehiclePricesActionData,
                'ammoPrice': ammoPrice.credits,
                'ammoActionPriceData': ammoActionPriceData,
                'slotPrice': slotPrice,
                'slotActionPriceData': slotActionPriceData,
                'isRentable': vehicle.isRentable,
                'isStudyDisabled': vehicle.hasCrew,
                'isNoAmmo': not vehicle.hasShells,
                'rentDataDD': self._getRentData(vehicle,
                                                vehiclePricesActionData)
            }
            self.as_setInitDataS(initData)
        return
    def _initData(self, *args):
        stats = g_itemsCache.items.stats
        self.as_setGoldS(stats.gold)
        self.as_setCreditsS(stats.credits)
        windowExpanded = AccountSettings.getSettings(VEHICLE_BUY_WINDOW_SETTINGS)
        vehicle = g_itemsCache.items.getItem(GUI_ITEM_TYPE.VEHICLE, self.nationID, self.inNationID)
        self.as_setEnabledSubmitBtnS(self._isSubmitBtnEnabled(vehicle))
        if vehicle is None:
            LOG_ERROR("Vehicle Item mustn't be None!", 'NationID:', self.nationID, 'InNationID:', self.inNationID)
        elif vehicle.isInInventory and not vehicle.isRented:
            self.onWindowClose()
        else:
            shop = g_itemsCache.items.shop
            shopDefaults = shop.defaults
            tankMenCount = len(vehicle.crew)
            tankMenStudyPrice = shop.tankmanCostWithGoodyDiscount
            totalTankMenStudePrice = tankMenCount * Money(credits=tankMenStudyPrice[1]['credits'], gold=tankMenStudyPrice[2]['gold'])
            defTankMenStudyPrice = shopDefaults.tankmanCost
            defTotalTankMenStudePrice = tankMenCount * Money(credits=defTankMenStudyPrice[1]['credits'], gold=defTankMenStudyPrice[2]['gold'])
            studyPriceCreditsActionData = None
            if totalTankMenStudePrice != defTotalTankMenStudePrice:
                studyPriceCreditsActionData = packActionTooltipData(ACTION_TOOLTIPS_TYPE.ECONOMICS, 'creditsTankmanCost', True, totalTankMenStudePrice, defTotalTankMenStudePrice)
            studyPriceGoldActionData = None
            if totalTankMenStudePrice != defTotalTankMenStudePrice:
                studyPriceGoldActionData = packActionTooltipData(ACTION_TOOLTIPS_TYPE.ECONOMICS, 'goldTankmanCost', True, totalTankMenStudePrice, defTotalTankMenStudePrice)
            vehiclePricesActionData = self._getItemPriceActionData(vehicle)
            ammoPrice = ZERO_MONEY
            defAmmoPrice = ZERO_MONEY
            for shell in vehicle.gun.defaultAmmo:
                ammoPrice += shell.buyPrice * shell.defaultCount
                defAmmoPrice += shell.defaultPrice * shell.defaultCount

            ammoActionPriceData = None
            if ammoPrice != defAmmoPrice:
                ammoActionPriceData = packActionTooltipData(ACTION_TOOLTIPS_TYPE.AMMO, str(vehicle.intCD), True, ammoPrice, defAmmoPrice)
            slotPrice = shop.getVehicleSlotsPrice(stats.vehicleSlots)
            slotDefaultPrice = shopDefaults.getVehicleSlotsPrice(stats.vehicleSlots)
            slotActionPriceData = None
            if slotPrice != slotDefaultPrice:
                slotActionPriceData = packActionTooltipData(ACTION_TOOLTIPS_TYPE.ECONOMICS, 'slotsPrices', True, Money(gold=slotPrice), Money(gold=slotDefaultPrice))
            tankmenLabel = i18n.makeString(DIALOGS.BUYVEHICLEDIALOG_TANKMENLABEL, count=text_styles.titleFont(i18n.makeString(DIALOGS.BUYVEHICLEDIALOG_TANKMEN) + ' ' + str(tankMenCount)))
            initData = {'expanded': windowExpanded,
             'name': vehicle.userName,
             'shortName': vehicle.shortUserName,
             'longName': vehicle.longUserName,
             'description': vehicle.fullDescription,
             'type': vehicle.type,
             'icon': vehicle.icon,
             'nation': self.nationID,
             'level': vehicle.level,
             'isElite': vehicle.isElite,
             'tankmenLabel': tankmenLabel,
             'studyPriceCredits': totalTankMenStudePrice.credits,
             'studyPriceCreditsActionData': studyPriceCreditsActionData,
             'studyPriceGold': totalTankMenStudePrice.gold,
             'studyPriceGoldActionData': studyPriceGoldActionData,
             'vehiclePrices': self._getVehiclePrice(vehicle),
             'vehiclePricesActionData': vehiclePricesActionData,
             'ammoPrice': ammoPrice.credits,
             'ammoActionPriceData': ammoActionPriceData,
             'slotPrice': slotPrice,
             'slotActionPriceData': slotActionPriceData,
             'isRentable': vehicle.isRentable,
             'isStudyDisabled': vehicle.hasCrew,
             'isNoAmmo': not vehicle.hasShells,
             'rentDataDD': self._getRentData(vehicle, vehiclePricesActionData)}
            initData.update(self._getGuiFields(vehicle))
            self.as_setInitDataS(initData)
        return
示例#9
0
    def _initData(self, *args):
        stats = g_itemsCache.items.stats
        self.as_setGoldS(stats.gold)
        self.as_setCreditsS(stats.credits)
        windowExpanded = AccountSettings.getSettings(
            VEHICLE_BUY_WINDOW_SETTINGS)
        vehicle = g_itemsCache.items.getItem(GUI_ITEM_TYPE.VEHICLE,
                                             self.nationID, self.inNationID)
        if vehicle is None:
            LOG_ERROR("Vehicle Item mustn't be None!", 'NationID:',
                      self.nationID, 'InNationID:', self.inNationID)
        elif vehicle.isInInventory and not vehicle.isRented:
            self.onWindowClose()
        else:
            shop = g_itemsCache.items.shop
            shopDefaults = shop.defaults
            tankMenCount = len(vehicle.crew)
            tankMenStudyPrice = shop.tankmanCostWithGoodyDiscount
            totalTankMenStudePrice = (tankMenStudyPrice[1]['credits'] *
                                      tankMenCount,
                                      tankMenStudyPrice[2]['gold'] *
                                      tankMenCount)
            defTankMenStudyPrice = shopDefaults.tankmanCost
            defTotalTankMenStudePrice = (defTankMenStudyPrice[1]['credits'] *
                                         tankMenCount,
                                         defTankMenStudyPrice[2]['gold'] *
                                         tankMenCount)
            studyPriceCreditsActionData = None
            if totalTankMenStudePrice[0] != defTotalTankMenStudePrice[0]:
                studyPriceCreditsActionData = {
                    'type': ACTION_TOOLTIPS_TYPE.ECONOMICS,
                    'key': 'creditsTankmanCost',
                    'isBuying': True,
                    'state': (ACTION_TOOLTIPS_STATE.DISCOUNT, None),
                    'newPrice': (totalTankMenStudePrice[0], 0),
                    'oldPrice': (defTotalTankMenStudePrice[0], 0)
                }
            studyPriceGoldActionData = None
            if totalTankMenStudePrice[1] != defTotalTankMenStudePrice[1]:
                studyPriceGoldActionData = {
                    'type': ACTION_TOOLTIPS_TYPE.ECONOMICS,
                    'key': 'goldTankmanCost',
                    'isBuying': True,
                    'state': (None, ACTION_TOOLTIPS_STATE.DISCOUNT),
                    'newPrice': (0, totalTankMenStudePrice[1]),
                    'oldPrice': (0, defTotalTankMenStudePrice[1])
                }
            vehiclePricesActionData = None
            if vehicle.buyPrice != vehicle.defaultPrice:
                vehiclePricesActionData = getItemActionTooltipData(vehicle)
            ammoPrice = [0, 0]
            defAmmoPrice = [0, 0]
            for shell in vehicle.gun.defaultAmmo:
                ammoPrice[0] += shell.buyPrice[0] * shell.defaultCount
                ammoPrice[1] += shell.buyPrice[1] * shell.defaultCount
                defAmmoPrice[0] += shell.defaultPrice[0] * shell.defaultCount
                defAmmoPrice[1] += shell.defaultPrice[1] * shell.defaultCount

            ammoActionPriceData = None
            if ammoPrice[0] != defAmmoPrice[0]:
                ammoActionPriceData = {
                    'type': ACTION_TOOLTIPS_TYPE.AMMO,
                    'key': str(vehicle.intCD),
                    'isBuying': True,
                    'state': (ACTION_TOOLTIPS_STATE.DISCOUNT, None),
                    'newPrice': ammoPrice,
                    'oldPrice': defAmmoPrice
                }
            slotPrice = shop.getVehicleSlotsPrice(stats.vehicleSlots)
            slotDefaultPrice = shopDefaults.getVehicleSlotsPrice(
                stats.vehicleSlots)
            slotActionPriceData = None
            if slotPrice != slotDefaultPrice:
                slotActionPriceData = {
                    'type': ACTION_TOOLTIPS_TYPE.ECONOMICS,
                    'key': 'slotsPrices',
                    'isBuying': True,
                    'state': (None, ACTION_TOOLTIPS_STATE.DISCOUNT),
                    'newPrice': (0, slotPrice),
                    'oldPrice': (0, slotDefaultPrice)
                }
            tankmenLabel = i18n.makeString(
                DIALOGS.BUYVEHICLEDIALOG_TANKMENLABEL,
                count=text_styles.titleFont(
                    i18n.makeString(DIALOGS.BUYVEHICLEDIALOG_TANKMEN) + ' ' +
                    str(tankMenCount)))
            initData = {
                'expanded': windowExpanded,
                'name': vehicle.userName,
                'longName': vehicle.longUserName,
                'description': vehicle.fullDescription,
                'type': vehicle.type,
                'icon': vehicle.icon,
                'nation': self.nationID,
                'level': vehicle.level,
                'isElite': vehicle.isElite,
                'tankmenLabel': tankmenLabel,
                'studyPriceCredits': totalTankMenStudePrice[0],
                'studyPriceCreditsActionData': studyPriceCreditsActionData,
                'studyPriceGold': totalTankMenStudePrice[1],
                'studyPriceGoldActionData': studyPriceGoldActionData,
                'vehiclePrices': vehicle.buyPrice,
                'vehiclePricesActionData': vehiclePricesActionData,
                'ammoPrice': ammoPrice[0],
                'ammoActionPriceData': ammoActionPriceData,
                'slotPrice': slotPrice,
                'slotActionPriceData': slotActionPriceData,
                'isRentable': vehicle.isRentable,
                'isStudyDisabled': vehicle.hasCrew,
                'isNoAmmo': not vehicle.hasShells,
                'rentDataDD': self._getRentData(vehicle,
                                                vehiclePricesActionData)
            }
            self.as_setInitDataS(initData)