def _fillOutfits(self): styleId = self._service.getStyledOutfit(self.season).id style = self._service.getItemByID(GUI_ITEM_TYPE.STYLE, styleId) if styleId else None isInstalled = self._service.isStyleInstalled() if not isInstalled: if style is not None and style.isHidden and style.fullInventoryCount(g_currentVehicle.item.intCD) == 0: style = None self.__originalStyle = style self.__modifiedStyle = style vehicleCD = g_currentVehicle.item.descriptor.makeCompactDescr() diffs = self._ctx.stylesDiffsCache.getDiffs(style) if style is not None else {} for season in SeasonType.COMMON_SEASONS: if style is None: outfit = self._service.getEmptyOutfit() else: diff = diffs.get(season) if not isInstalled and diff is not None: diffOutfit = Outfit(strCompactDescr=diff, vehicleCD=vehicleCD) self._removeHiddenFromOutfit(diffOutfit, g_currentVehicle.item.intCD) diff = diffOutfit.pack().makeCompDescr() outfit = style.getOutfit(season, vehicleCD=vehicleCD, diff=diff) self._originalOutfits[season] = outfit.copy() self._modifiedOutfits[season] = outfit.copy() return
def _fillOutfits(self): isInstalled = self._service.isStyleInstalled() vehicleCD = g_currentVehicle.item.descriptor.makeCompactDescr() for season in SeasonType.COMMON_SEASONS: diff = self._ctx.stylesDiffsCache.getDiff(self.__style, season) if not isInstalled and diff is not None: diffOutfit = Outfit(strCompactDescr=diff, vehicleCD=vehicleCD) self._removeHiddenFromOutfit(diffOutfit, g_currentVehicle.item.intCD) diff = diffOutfit.pack().makeCompDescr() outfit = self.__style.getOutfit(season, vehicleCD=vehicleCD, diff=diff) self._originalOutfits[season] = outfit.copy() self._modifiedOutfits[season] = outfit.copy() return
def getOutfitComponent(outfitCD, vehicleDescriptor=None, seasonType=None): if outfitCD: outfitComponent = parseOutfitDescr(outfitCD) if seasonType is None: seasonType = _currentMapSeason() if outfitComponent.styleId != 0 and outfitComponent.styleId != EMPTY_ITEM_ID and seasonType is not None: intCD = makeIntCompactDescrByID('customizationItem', CustomizationType.STYLE, outfitComponent.styleId) styleDescr = getItemByCompactDescr(intCD) if IS_EDITOR: if hasattr(outfitComponent, 'edSeasonsMask'): if styleDescr.outfits is not None and bool( styleDescr.outfits): anyOutfit = styleDescr.outfits[ styleDescr.outfits.keys()[0]] seasonType = anyOutfit.edSeasonsMask else: return outfitComponent baseOutfitComponent = deepcopy(styleDescr.outfits[seasonType]) if styleDescr.isProgression or IS_EDITOR: if IS_EDITOR: baseOutfitComponent.styleId = styleDescr.id outfit = Outfit(component=baseOutfitComponent, vehicleCD=vehicleDescriptor.makeCompactDescr()) if outfit and outfit.style and outfit.style.styleProgressions: outfit = getStyleProgressionOutfit( outfit, outfitComponent.styleProgressionLevel, seasonType) baseOutfitComponent = outfit.pack() baseOutfitComponent.styleProgressionLevel = outfitComponent.styleProgressionLevel if styleDescr.isWithSerialNumber: baseOutfitComponent.serial_number = outfitComponent.serial_number if vehicleDescriptor and ItemTags.ADD_NATIONAL_EMBLEM in styleDescr.tags: emblems = createNationalEmblemComponents(vehicleDescriptor) baseOutfitComponent.decals.extend(emblems) if isEditedStyle(outfitComponent): outfitComponent = baseOutfitComponent.applyDiff( outfitComponent) else: outfitComponent = baseOutfitComponent if IS_EDITOR: def setupAlternateItem(itemType, outfit, sourceOutfit, collectionName): alternateItem = outfit.editorData.alternateItems[itemType] if alternateItem != 0: sourceComponents = getattr(sourceOutfit, collectionName) if sourceComponents is not None: if itemType != CustomizationType.MODIFICATION: for componentItem in sourceComponents: componentItem.id = alternateItem else: for index, _ in enumerate(sourceComponents): sourceComponents[index] = alternateItem setattr(sourceOutfit, collectionName, sourceComponents) return anyOutfit = styleDescr.outfits[seasonType] setupAlternateItem(CustomizationType.DECAL, anyOutfit, outfitComponent, 'decals') setupAlternateItem(CustomizationType.PROJECTION_DECAL, anyOutfit, outfitComponent, 'projection_decals') setupAlternateItem(CustomizationType.PAINT, anyOutfit, outfitComponent, 'paints') setupAlternateItem(CustomizationType.CAMOUFLAGE, anyOutfit, outfitComponent, 'camouflages') setupAlternateItem(CustomizationType.MODIFICATION, anyOutfit, outfitComponent, 'modifications') setupAlternateItem(CustomizationType.PERSONAL_NUMBER, anyOutfit, outfitComponent, 'personal_numbers') return outfitComponent else: return CustomizationOutfit()