def onRequestList(self, groupName): if not groupName: return else: customization = vehicles.g_cache.customization(self.nationID) result = [] hiddenItems = g_itemsCache.items.shop.getInscriptionsGroupHiddens(self.nationID) if customization is not None: groups = customization.get('inscriptionGroups', {}) group = groups.get(groupName, {}) inscriptions = customization.get('inscriptions', {}) if group is not None: inscriptionIDs, groupUserString, igrType, allow, deny = group isHasNew = self._hasNewItems(CUSTOMIZATION_ITEM_TYPE.INSCRIPTION_TYPE, inscriptionIDs) isHiddenGroup = groupName in hiddenItems hasItemsInHangar = False if isHiddenGroup: hasItemsInHangar = CustomizationHelper.areItemsInHangar(CUSTOMIZATION_ITEM_TYPE.INSCRIPTION, inscriptionIDs, self.nationID) self._isIGR = igrType != constants.IGR_TYPE.NONE if isHasNew or hasItemsInHangar or not isHiddenGroup: for id in inscriptionIDs: itemInfo = self._constructInscription(id, groups, inscriptions, self.currentItemID == id, False if self.isIGRItem(id) else CustomizationHelper.isItemInHangar(CUSTOMIZATION_ITEM_TYPE.INSCRIPTION, id, self.nationID, self.position), False) if itemInfo is not None: if not self._isIGR or self._isIGR and itemInfo.get('igrType') != constants.IGR_TYPE.NONE: result.append(itemInfo) return sorted(result, cmp=self.__comparator)
def buildList(self): hiddenEmblems = g_itemsCache.items.shop.getEmblemsGroupHiddens() groups, emblems, names = vehicles.g_cache.playerEmblems() result = [] if groups is not None: igrRoomType = gui.game_control.g_instance.igr.getRoomType() for name, group in groups.iteritems(): emblemIDs, groupUserString, igrType, nations, allow, deny = group isHasNew = self._hasNewItems(CUSTOMIZATION_ITEM_TYPE.EMBLEM_TYPE, emblemIDs) isHiddenGroup = name in hiddenEmblems hasItemsInHangar = False currVehIntD = g_currentVehicle.item.intCD canBeUsedOnVehicle = currVehIntD not in deny and (len(allow) == 0 or currVehIntD in allow) if isHiddenGroup: hasItemsInHangar = CustomizationHelper.areItemsInHangar(CUSTOMIZATION_ITEM_TYPE.EMBLEM, emblemIDs, self._nationID) if canBeUsedOnVehicle and (isHasNew or hasItemsInHangar or not isHiddenGroup) and (gui.GUI_SETTINGS.igrEnabled or not gui.GUI_SETTINGS.igrEnabled and igrType == constants.IGR_TYPE.NONE) and (nations is None or g_currentVehicle.item.nationID in nations): result.append({'name': name, 'userString': groupUserString, 'hasNew': isHasNew, 'isIGR': igrType != constants.IGR_TYPE.NONE, 'enabled': igrType == constants.IGR_TYPE.NONE or igrType <= igrRoomType, 'tooltip': TOOLTIPS.CUSTOMIZATION_EMBLEM_IGR}) self._list = sorted(result, cmp=self.__comparator) return
def buildList(self): hiddenInscriptions = g_itemsCache.items.shop.getInscriptionsGroupHiddens(self._nationID) customization = vehicles.g_cache.customization(self._nationID) result = [] if customization is not None: igrRoomType = gui.game_control.g_instance.igr.getRoomType() groups = customization.get('inscriptionGroups', {}) for name, group in groups.iteritems(): inscriptionIDs, groupUserString, igrType, allow, deny = group isHasNew = self._hasNewItems(CUSTOMIZATION_ITEM_TYPE.INSCRIPTION_TYPE, inscriptionIDs) isHiddenGroup = name in hiddenInscriptions currVehIntD = g_currentVehicle.item.intCD canBeUsedOnVehicle = currVehIntD not in deny and (len(allow) == 0 or currVehIntD in allow) hasItemsInHangar = False if isHiddenGroup: hasItemsInHangar = CustomizationHelper.areItemsInHangar(CUSTOMIZATION_ITEM_TYPE.INSCRIPTION, inscriptionIDs, self._nationID) if canBeUsedOnVehicle and (isHasNew or hasItemsInHangar or not isHiddenGroup) and (gui.GUI_SETTINGS.igrEnabled or not gui.GUI_SETTINGS.igrEnabled and igrType == constants.IGR_TYPE.NONE): result.append({'name': name, 'userString': groupUserString, 'hasNew': isHasNew, 'isIGR': igrType != constants.IGR_TYPE.NONE, 'enabled': igrType == constants.IGR_TYPE.NONE or igrType <= igrRoomType, 'tooltip': TOOLTIPS.CUSTOMIZATION_INSCRIPTION_IGR}) self._list = sorted(result, cmp=self.__comparator) return
def onRequestList(self, groupName): groups, emblems, names = vehicles.g_cache.playerEmblems() group = groups.get(groupName) result = [] hiddenItems = g_itemsCache.items.shop.getEmblemsGroupHiddens() if group is not None: emblemIDs, groupUserString, igrType, nations, allow, deny = group self._isIGR = igrType != constants.IGR_TYPE.NONE isHasNew = self._hasNewItems(CUSTOMIZATION_ITEM_TYPE.EMBLEM_TYPE, emblemIDs) isHiddenGroup = groupName in hiddenItems hasItemsInHangar = False if isHiddenGroup: hasItemsInHangar = CustomizationHelper.areItemsInHangar(CUSTOMIZATION_ITEM_TYPE.EMBLEM, emblemIDs, self.nationID) if isHasNew or hasItemsInHangar or not isHiddenGroup: for id in emblemIDs: itemInfo = self._constructEmblem(id, groups, emblems, self.position, self.currentItemID == id, False if self.isIGRItem(id) else CustomizationHelper.isItemInHangar(CUSTOMIZATION_ITEM_TYPE.EMBLEM, id, self.nationID, self.position), False) if itemInfo is not None: if not self._isIGR or self._isIGR and itemInfo.get('igrType') != constants.IGR_TYPE.NONE: result.append(itemInfo) return sorted(result, cmp=self.__comparator)