def _comparator(a, b): if a.itemTypeID == b.itemTypeID == GUI_ITEM_TYPE.OPTIONALDEVICE: preResult = (1 if a.isDeluxe() else 0) - (1 if b.isDeluxe() else 0) else: preResult = cmp(_TABS_SORT_ORDER[a.itemTypeID], _TABS_SORT_ORDER[b.itemTypeID]) return preResult or cmp(storage_helpers.getStorageModuleName(a), storage_helpers.getStorageModuleName(b))
def sortKey(item): itemPrice = item.getSellPrice().price if item.itemTypeID in _FOR_SELL_SORT_ORDER: itemTypeIndex = _FOR_SELL_SORT_ORDER.index(item.itemTypeID) else: itemTypeIndex = len(_FOR_SELL_SORT_ORDER) return (itemTypeIndex, -itemPrice.gold if itemPrice.gold is not None else 0, -itemPrice.credits if itemPrice.credits is not None else 0, getStorageModuleName(item))
def __createVO(self, item): priceVO = getItemPricesVO(item.getSellPrice())[0] nationFlagIcon = RES_SHOP.getNationFlagIcon(nations.NAMES[ item.nationID]) if item.nationID != nations.NONE_INDEX else '' return createStorageDefVO(item.intCD, getStorageModuleName(item), getStorageItemDescr(item), item.inventoryCount, priceVO, getStorageItemIcon( item, STORE_CONSTANTS.ICON_SIZE_SMALL), getStorageItemIcon(item), 'altimage', itemType=getBoosterType(item), nationFlagIcon=nationFlagIcon)
def _getVO(self, item): priceVO = getItemPricesVO(item.getSellPrice())[0] itemNationID = self._getItemNationID(item) nationFlagIcon = RES_SHOP.getNationFlagIcon( nations.NAMES[itemNationID] ) if itemNationID != nations.NONE_INDEX else '' vo = storage_helpers.createStorageDefVO( item.intCD, storage_helpers.getStorageModuleName(item), storage_helpers.getStorageItemDescr(item), item.inventoryCount, priceVO, storage_helpers.getStorageItemIcon(item, SC.ICON_SIZE_SMALL), storage_helpers.getStorageItemIcon(item), 'altimage', itemType=getBoosterType(item), nationFlagIcon=nationFlagIcon, enabled=item.itemTypeID != GUI_ITEM_TYPE.BATTLE_BOOSTER) return vo