Esempio n. 1
0
    def _getRentData(self, vehicle, vehiclePricesActionData):
        result = []
        rentPackages = vehicle.rentPackages
        for rentPackage in rentPackages:
            days = rentPackage['days']
            actionRentPrice = None
            if rentPackage['rentPrice'] != rentPackage['defaultRentPrice']:
                actionRentPrice = getItemRentActionTooltipData(vehicle, rentPackage)
            result.append({'itemId': days,
             'label': i18n.makeString(MENU.SHOP_MENU_VEHICLE_RENT_DAYS, days=days),
             'price': rentPackage['rentPrice'],
             'enabled': vehicle.maxRentDuration - vehicle.rentLeftTime >= days * time_utils.ONE_DAY,
             'actionPrice': actionRentPrice})

        result.append({'itemId': -1,
         'label': i18n.makeString(MENU.SHOP_MENU_VEHICLE_RENT_FOREVER),
         'price': vehicle.buyPrice,
         'enabled': not vehicle.isDisabledForBuy and not vehicle.isHidden,
         'actionPrice': vehiclePricesActionData})
        selectedId = -1
        for ddItem in result:
            if ddItem['enabled']:
                selectedId = ddItem['itemId']
                break

        return {'data': result,
         'selectedId': selectedId}
Esempio n. 2
0
 def _getVehicleData(self, node, item):
     nodeCD = node['id']
     tags = item.tags
     credits, gold = item.minRentPrice or item.buyPrice
     status, statusLevel = self._getRentStatus(item)
     action = None
     minRentPricePackage = item.getRentPackage()
     if item.buyPrice != item.defaultPrice and not minRentPricePackage:
         action = getItemActionTooltipData(item)
     elif minRentPricePackage:
         if minRentPricePackage['rentPrice'] != minRentPricePackage['defaultRentPrice']:
             action = getItemRentActionTooltipData(item, minRentPricePackage)
     return {'id': nodeCD,
      'state': node['state'],
      'type': item.itemTypeName,
      'nameString': item.shortUserName,
      'primaryClass': self._vClassInfo.getInfoByTags(tags),
      'level': item.level,
      'longName': item.longUserName,
      'iconPath': item.icon,
      'smallIconPath': item.iconSmall,
      'earnedXP': node['earnedXP'],
      'shopPrice': (credits, gold, action),
      'displayInfo': node['displayInfo'],
      'unlockProps': node['unlockProps']._makeTuple(),
      'status': status,
      'statusLevel': statusLevel,
      'isRemovable': item.isRented,
      'isPremiumIGR': item.isPremiumIGR}
Esempio n. 3
0
 def _getVehicleData(self, node, item):
     nodeCD = node["id"]
     tags = item.tags
     credits, gold = item.minRentPrice or item.buyPrice
     status, statusLevel = self._getRentStatus(item)
     action = None
     minRentPricePackage = item.getRentPackage()
     if item.buyPrice != item.defaultPrice and not minRentPricePackage:
         action = getItemActionTooltipData(item)
     elif minRentPricePackage:
         if minRentPricePackage["rentPrice"] != minRentPricePackage["defaultRentPrice"]:
             action = getItemRentActionTooltipData(item, minRentPricePackage)
     return {
         "id": nodeCD,
         "state": node["state"],
         "type": item.itemTypeName,
         "nameString": item.shortUserName,
         "primaryClass": self._vClassInfo.getInfoByTags(tags),
         "level": item.level,
         "longName": item.longUserName,
         "iconPath": item.icon,
         "smallIconPath": item.iconSmall,
         "earnedXP": node["earnedXP"],
         "shopPrice": (credits, gold, action),
         "displayInfo": node["displayInfo"],
         "unlockProps": node["unlockProps"]._makeTuple(),
         "status": status,
         "statusLevel": statusLevel,
         "isRemovable": item.isRented,
         "isPremiumIGR": item.isPremiumIGR,
     }
Esempio n. 4
0
 def itemWrapper(self, packedItem):
     module, inventoryCount, vehicleCount, disabled, statusMessage, isEnabledBuyingGoldShellsForCredits, isEnabledBuyingGoldEqsForCredits, extraModuleInfo = (
         packedItem
     )
     credits, gold = g_itemsCache.items.stats.money
     name = module.userName if module.itemTypeID in GUI_ITEM_TYPE.ARTEFACTS else module.longUserName
     price = module.altPrice or module.buyPrice
     defaultPrice = module.defaultAltPrice or module.defaultPrice
     rentLeftTimeStr = RentLeftFormatter(module.rentInfo).getRentLeftStr()
     minRentPricePackage = module.getRentPackage()
     action = None
     if price != defaultPrice and not minRentPricePackage:
         action = getItemActionTooltipData(module)
     elif minRentPricePackage:
         price = minRentPricePackage["rentPrice"]
         if minRentPricePackage["rentPrice"] != minRentPricePackage["defaultRentPrice"]:
             action = getItemRentActionTooltipData(module, minRentPricePackage)
     return {
         "id": str(module.intCD),
         "name": name,
         "desc": module.getShortInfo(),
         "inventoryId": None,
         "inventoryCount": inventoryCount,
         "vehicleCount": vehicleCount,
         "credits": credits,
         "gold": gold,
         "price": price,
         "currency": "credits" if price[1] == 0 else "gold",
         "level": module.level,
         "nation": module.nationID,
         "type": module.itemTypeName
         if module.itemTypeID
         not in (GUI_ITEM_TYPE.VEHICLE, GUI_ITEM_TYPE.OPTIONALDEVICE, GUI_ITEM_TYPE.SHELL, GUI_ITEM_TYPE.EQUIPMENT)
         else module.icon,
         "disabled": disabled,
         "statusMessage": statusMessage,
         "statusLevel": InventoryVehicle.STATE_LEVEL.WARNING,
         "removable": module.isRemovable if module.itemTypeID == GUI_ITEM_TYPE.OPTIONALDEVICE else True,
         "tankType": module.type if module.itemTypeID == GUI_ITEM_TYPE.VEHICLE else type,
         "isPremium": module.isPremium if module.itemTypeID == GUI_ITEM_TYPE.VEHICLE else False,
         "isElite": module.isElite if module.itemTypeID == GUI_ITEM_TYPE.VEHICLE else False,
         "itemTypeName": module.itemTypeName,
         "goldShellsForCredits": isEnabledBuyingGoldShellsForCredits,
         "goldEqsForCredits": isEnabledBuyingGoldEqsForCredits,
         "actionPriceData": action,
         "rentLeft": rentLeftTimeStr,
         "moduleLabel": module.getGUIEmblemID(),
         EXTRA_MODULE_INFO: extraModuleInfo,
     }
Esempio n. 5
0
 def itemWrapper(self, packedItem):
     module, inventoryCount, vehicleCount, disabled, statusMessage, isEnabledBuyingGoldShellsForCredits, isEnabledBuyingGoldEqsForCredits, extraModuleInfo = packedItem
     credits, gold = g_itemsCache.items.stats.money
     name = module.userName if module.itemTypeID in GUI_ITEM_TYPE.ARTEFACTS else module.longUserName
     price = module.altPrice or module.buyPrice
     defaultPrice = module.defaultAltPrice or module.defaultPrice
     localization = '#menu:vehicle/rentLeft/%s'
     rentLeftTimeStr = getRentLeftTimeStr(localization, module.rentLeftTime)
     minRentPricePackage = module.getRentPackage()
     action = None
     if price != defaultPrice and not minRentPricePackage:
         action = getItemActionTooltipData(module)
     elif minRentPricePackage:
         price = minRentPricePackage['rentPrice']
         if minRentPricePackage['rentPrice'] != minRentPricePackage['defaultRentPrice']:
             action = getItemRentActionTooltipData(module, minRentPricePackage)
     return {'id': str(module.intCD),
      'name': name,
      'desc': module.getShortInfo(),
      'inventoryId': None,
      'inventoryCount': inventoryCount,
      'vehicleCount': vehicleCount,
      'credits': credits,
      'gold': gold,
      'price': price,
      'currency': 'credits' if price[1] == 0 else 'gold',
      'level': module.level,
      'nation': module.nationID,
      'type': module.itemTypeName if module.itemTypeID not in (GUI_ITEM_TYPE.VEHICLE,
               GUI_ITEM_TYPE.OPTIONALDEVICE,
               GUI_ITEM_TYPE.SHELL,
               GUI_ITEM_TYPE.EQUIPMENT) else module.icon,
      'disabled': disabled,
      'statusMessage': statusMessage,
      'statusLevel': InventoryVehicle.STATE_LEVEL.WARNING,
      'removable': module.isRemovable if module.itemTypeID == GUI_ITEM_TYPE.OPTIONALDEVICE else True,
      'tankType': module.type if module.itemTypeID == GUI_ITEM_TYPE.VEHICLE else type,
      'isPremium': module.isPremium if module.itemTypeID == GUI_ITEM_TYPE.VEHICLE else False,
      'isElite': module.isElite if module.itemTypeID == GUI_ITEM_TYPE.VEHICLE else False,
      'itemTypeName': module.itemTypeName,
      'goldShellsForCredits': isEnabledBuyingGoldShellsForCredits,
      'goldEqsForCredits': isEnabledBuyingGoldEqsForCredits,
      'actionPriceData': action,
      'rentLeft': rentLeftTimeStr,
      'moduleLabel': module.getGUIEmblemID(),
      EXTRA_MODULE_INFO: extraModuleInfo}
Esempio n. 6
0
 def itemWrapper(self, packedItem):
     module, inventoryCount, vehicleCount, disabled, statusMessage, isEnabledBuyingGoldShellsForCredits, isEnabledBuyingGoldEqsForCredits, extraModuleInfo = packedItem
     credits, gold = g_itemsCache.items.stats.money
     name = module.userName if module.itemTypeID in GUI_ITEM_TYPE.ARTEFACTS else module.longUserName
     price = module.altPrice or module.buyPrice
     defaultPrice = module.defaultAltPrice or module.defaultPrice
     rentLeftTimeStr = RentLeftFormatter(module.rentInfo).getRentLeftStr()
     minRentPricePackage = module.getRentPackage()
     action = None
     if price != defaultPrice and not minRentPricePackage:
         action = getItemActionTooltipData(module)
     elif minRentPricePackage:
         price = minRentPricePackage['rentPrice']
         if minRentPricePackage['rentPrice'] != minRentPricePackage['defaultRentPrice']:
             action = getItemRentActionTooltipData(module, minRentPricePackage)
     return {'id': str(module.intCD),
      'name': name,
      'desc': module.getShortInfo(),
      'inventoryId': None,
      'inventoryCount': inventoryCount,
      'vehicleCount': vehicleCount,
      'credits': credits,
      'gold': gold,
      'price': price,
      'currency': 'credits' if price[1] == 0 else 'gold',
      'level': module.level,
      'nation': module.nationID,
      'type': module.itemTypeName if module.itemTypeID not in (GUI_ITEM_TYPE.VEHICLE,
               GUI_ITEM_TYPE.OPTIONALDEVICE,
               GUI_ITEM_TYPE.SHELL,
               GUI_ITEM_TYPE.EQUIPMENT) else module.icon,
      'disabled': disabled,
      'statusMessage': statusMessage,
      'statusLevel': InventoryVehicle.STATE_LEVEL.WARNING,
      'removable': module.isRemovable if module.itemTypeID == GUI_ITEM_TYPE.OPTIONALDEVICE else True,
      'tankType': module.type if module.itemTypeID == GUI_ITEM_TYPE.VEHICLE else type,
      'isPremium': module.isPremium if module.itemTypeID == GUI_ITEM_TYPE.VEHICLE else False,
      'isElite': module.isElite if module.itemTypeID == GUI_ITEM_TYPE.VEHICLE else False,
      'itemTypeName': module.itemTypeName,
      'goldShellsForCredits': isEnabledBuyingGoldShellsForCredits,
      'goldEqsForCredits': isEnabledBuyingGoldEqsForCredits,
      'actionPriceData': action,
      'rentLeft': rentLeftTimeStr,
      'moduleLabel': module.getGUIEmblemID(),
      EXTRA_MODULE_INFO: extraModuleInfo}
Esempio n. 7
0
 def _getItemData(self, node, item, rootItem):
     nodeCD = node['id']
     vClass = {'name': ''}
     extraInfo = None
     status = statusLevel = ''
     minRentPricePackage = None
     vehicleBtnLabel = ''
     if item.itemTypeID == GUI_ITEM_TYPE.VEHICLE:
         vClass = self._vClassInfo.getInfoByTags(item.tags)
         status, statusLevel = self._getRentStatus(item)
         minRentPricePackage = item.getRentPackage()
         if item.isInInventory:
             vehicleBtnLabel = '#menu:research/labels/button/showInHangar'
         else:
             vehicleBtnLabel = '#menu:research/showInPreviewBtn/label'
     else:
         if item.itemTypeID == GUI_ITEM_TYPE.GUN and item.isClipGun(rootItem.descriptor):
             extraInfo = CLIP_ICON_PATH
         vClass.update({'name': item.itemTypeName})
     credits, gold = item.minRentPrice or item.buyPrice
     action = None
     if item.buyPrice != item.defaultPrice and not minRentPricePackage:
         action = getItemActionTooltipData(item)
     elif minRentPricePackage:
         if minRentPricePackage['rentPrice'] != minRentPricePackage['defaultRentPrice']:
             action = getItemRentActionTooltipData(item, minRentPricePackage)
     return {'id': nodeCD,
      'nameString': item.shortUserName,
      'primaryClass': vClass,
      'level': item.level,
      'longName': item.longUserName,
      'iconPath': item.icon,
      'smallIconPath': item.iconSmall,
      'earnedXP': node['earnedXP'],
      'state': node['state'],
      'shopPrice': (credits, gold, action),
      'displayInfo': node['displayInfo'],
      'unlockProps': node['unlockProps']._makeTuple(),
      'extraInfo': extraInfo,
      'status': status,
      'statusLevel': statusLevel,
      'isPremiumIGR': item.isPremiumIGR,
      'showVehicleBtnLabel': i18n.makeString(vehicleBtnLabel),
      'showVehicleBtnEnabled': item.isInInventory or item.isPreviewAllowed()}
Esempio n. 8
0
    def _getRentData(self, vehicle, vehiclePricesActionData):
        result = []
        rentPackages = vehicle.rentPackages
        for rentPackage in rentPackages:
            days = rentPackage['days']
            actionRentPrice = None
            if rentPackage['rentPrice'] != rentPackage['defaultRentPrice']:
                actionRentPrice = getItemRentActionTooltipData(
                    vehicle, rentPackage)
            result.append({
                'itemId':
                days,
                'label':
                i18n.makeString(MENU.SHOP_MENU_VEHICLE_RENT_DAYS, days=days),
                'price':
                rentPackage['rentPrice'],
                'enabled':
                vehicle.maxRentDuration - vehicle.rentLeftTime >=
                days * time_utils.ONE_DAY,
                'actionPrice':
                actionRentPrice
            })

        result.append({
            'itemId':
            -1,
            'label':
            i18n.makeString(MENU.SHOP_MENU_VEHICLE_RENT_FOREVER),
            'price':
            vehicle.buyPrice,
            'enabled':
            not vehicle.isDisabledForBuy and not vehicle.isHidden,
            'actionPrice':
            vehiclePricesActionData
        })
        selectedId = -1
        for ddItem in result:
            if ddItem['enabled']:
                selectedId = ddItem['itemId']
                break

        return {'data': result, 'selectedId': selectedId}
Esempio n. 9
0
 def _getItemData(self, node, item, rootItem):
     nodeCD = node['id']
     vClass = {'userString': '',
      'name': ''}
     extraInfo = None
     status = statusLevel = ''
     minRentPricePackage = None
     if item.itemTypeID == GUI_ITEM_TYPE.VEHICLE:
         vClass = self._vClassInfo.getInfoByTags(item.tags)
         status, statusLevel = self._getRentStatus(item)
         minRentPricePackage = item.getRentPackage()
     else:
         if item.itemTypeID == GUI_ITEM_TYPE.GUN and item.isClipGun(rootItem.descriptor):
             extraInfo = CLIP_ICON_PATH
         vClass.update({'name': item.itemTypeName,
          'userString': item.userType})
     credits, gold = item.minRentPrice or item.buyPrice
     action = None
     if item.buyPrice != item.defaultPrice and not minRentPricePackage:
         action = getItemActionTooltipData(item)
     elif minRentPricePackage:
         if minRentPricePackage['rentPrice'] != minRentPricePackage['defaultRentPrice']:
             action = getItemRentActionTooltipData(item, minRentPricePackage)
     return {'id': nodeCD,
      'nameString': item.shortUserName,
      'primaryClass': vClass,
      'level': item.level,
      'longName': item.longUserName,
      'iconPath': item.icon,
      'smallIconPath': item.iconSmall,
      'earnedXP': node['earnedXP'],
      'state': node['state'],
      'shopPrice': (credits, gold, action),
      'displayInfo': node['displayInfo'],
      'unlockProps': node['unlockProps']._makeTuple(),
      'extraInfo': extraInfo,
      'status': status,
      'statusLevel': statusLevel,
      'isRemovable': item.isRented,
      'isPremiumIGR': item.isPremiumIGR}
Esempio n. 10
0
 def _getItemData(self, node, item, rootItem):
     nodeCD = node["id"]
     vClass = {"userString": "", "name": ""}
     extraInfo = None
     status = statusLevel = ""
     minRentPricePackage = None
     if item.itemTypeID == GUI_ITEM_TYPE.VEHICLE:
         vClass = self._vClassInfo.getInfoByTags(item.tags)
         status, statusLevel = self._getRentStatus(item)
         minRentPricePackage = item.getRentPackage()
     else:
         if item.itemTypeID == GUI_ITEM_TYPE.GUN and item.isClipGun(rootItem.descriptor):
             extraInfo = CLIP_ICON_PATH
         vClass.update({"name": item.itemTypeName, "userString": item.userType})
     credits, gold = item.minRentPrice or item.buyPrice
     action = None
     if item.buyPrice != item.defaultPrice and not minRentPricePackage:
         action = getItemActionTooltipData(item)
     elif minRentPricePackage:
         if minRentPricePackage["rentPrice"] != minRentPricePackage["defaultRentPrice"]:
             action = getItemRentActionTooltipData(item, minRentPricePackage)
     return {
         "id": nodeCD,
         "nameString": item.shortUserName,
         "primaryClass": vClass,
         "level": item.level,
         "longName": item.longUserName,
         "iconPath": item.icon,
         "smallIconPath": item.iconSmall,
         "earnedXP": node["earnedXP"],
         "state": node["state"],
         "shopPrice": (credits, gold, action),
         "displayInfo": node["displayInfo"],
         "unlockProps": node["unlockProps"]._makeTuple(),
         "extraInfo": extraInfo,
         "status": status,
         "statusLevel": statusLevel,
         "isRemovable": item.isRented,
         "isPremiumIGR": item.isPremiumIGR,
     }