private void AddPaletteChange(uint paletteID, uint offset, uint length) { var cloSubPalette = new CloSubPalette(); cloSubPalette.PaletteSet = paletteID; var cloSubPaletteRange = new CloSubPaletteRange(); cloSubPaletteRange.Offset = offset * 8; cloSubPaletteRange.NumColors = length * 8; cloSubPalette.Ranges.Add(cloSubPaletteRange); var cloSubPalettes = new List <CloSubPalette>() { cloSubPalette }; if (PaletteChanges == null) { PaletteChanges = new PaletteChanges(cloSubPalettes); } else { PaletteChanges.Add(cloSubPalettes); } }
public void Add(uint clothingTableID, PaletteTemplate paletteTemplate = PaletteTemplate.Undef, float shade = 0.0f) { var clothingTable = DatManager.PortalDat.ReadFromDat <ClothingTable>(clothingTableID); if (!clothingTable.ClothingBaseEffects.TryGetValue(SetupId, out var baseEffect)) { return; } // palette changes if (clothingTable.ClothingSubPalEffects.TryGetValue((uint)paletteTemplate, out var palEffect)) { if (PaletteChanges == null) { PaletteChanges = new PaletteChanges(palEffect.CloSubPalettes, shade); } else { PaletteChanges.Add(palEffect.CloSubPalettes, shade); } } foreach (var objEffect in baseEffect.CloObjectEffects) { if (PartChanges == null) { PartChanges = new Dictionary <uint, PartChange>(); } // gfxobj change if (!PartChanges.TryGetValue(objEffect.Index, out var partChange)) { partChange = new PartChange(objEffect.ModelId); PartChanges.Add(objEffect.Index, partChange); } else { partChange.NewGfxObjId = objEffect.ModelId; } // texture changes foreach (var texEffect in objEffect.CloTextureEffects) { if (partChange.TextureChanges == null) { partChange.TextureChanges = new Dictionary <uint, uint>(); } partChange.TextureChanges[texEffect.OldTexture] = texEffect.NewTexture; } } }