def getList(self): result = [] for itemData in self.getCustomizations(): itemTypeName = itemData.get('custType') itemID = itemData.get('id') boundVehicle = itemData.get('vehTypeCompDescr') boundToCurrentVehicle = itemData.get('boundToCurrentVehicle', False) itemTypeID = GUI_ITEM_TYPE_INDICES.get(itemTypeName) item = self.c11n.getItemByID(itemTypeID, itemID) value = itemData.get('value', 0) valueStr = None if value > 1: valueStr = text_styles.main( i18n.makeString(QUESTS.BONUSES_CUSTOMIZATION_VALUE, count=value)) result.append({ 'intCD': item.intCD, 'texture': item.icon, 'value': value, 'valueStr': valueStr, 'boundVehicle': boundVehicle, 'boundToCurrentVehicle': boundToCurrentVehicle, 'showPrice': False }) return result
def getRankedAwardVOs(self, iconSize='small', withCounts=False, withKey=False): result = [] for item, data in zip(self.getCustomizations(), self.getList()): itemTypeName = item.get('custType') itemID = item.get('id') itemTypeID = GUI_ITEM_TYPE_INDICES.get(itemTypeName) c11nItem = self.c11n.getItemByID(itemTypeID, itemID) count = item.get('value', 1) itemData = { 'imgSource': RES_ICONS.getBonusIcon(iconSize, c11nItem.itemTypeName), 'label': text_styles.hightlight('x{}'.format(count)), 'align': TEXT_ALIGN.RIGHT } itemData.update(self.__itemTooltip(data, isReceived=False)) if withKey: itemData['itemKey'] = 'customization_{}'.format( item.get('custType')) if withCounts: itemData['count'] = count result.append(itemData) return result
def getEpicAwardVOs(self, withDescription=False): result = [] for item, data in zip(self.getCustomizations(), self.getList()): itemData = self.__getCommonAwardsVOs(item, data, iconSize='big', align=TEXT_ALIGN.CENTER) itemData.update(_EPIC_AWARD_STATIC_VO_ENTRIES) if withDescription: itemTypeName = item.get('custType') itemID = item.get('id') itemTypeID = GUI_ITEM_TYPE_INDICES.get(itemTypeName) item = self.c11n.getItemByID(itemTypeID, itemID) itemData['description'] = item.userType itemData['title'] = item.userName result.append(itemData) return result
def __getCommonAwardsVOs(self, item, data, iconSize='small', align=TEXT_ALIGN.RIGHT, withCounts=False): itemTypeName = item.get('custType') itemID = item.get('id') itemTypeID = GUI_ITEM_TYPE_INDICES.get(itemTypeName) c11nItem = self.c11n.getItemByID(itemTypeID, itemID) count = item.get('value', 1) itemData = { 'imgSource': RES_ICONS.getBonusIcon(iconSize, c11nItem.itemTypeName), 'label': text_styles.hightlight('x{}'.format(count)), 'align': align } itemData.update(self.__itemTooltip(data, isReceived=False)) if withCounts: itemData['count'] = count return itemData
def __getC11nItem(cls, item): itemTypeName = item.get('custType') itemID = item.get('id') itemTypeID = GUI_ITEM_TYPE_INDICES.get(itemTypeName) return cls.c11n.getItemByID(itemTypeID, itemID)