예제 #1
0
        //todo  check this
        void AddItemAppearance(ItemModifiedAppearanceRecord itemModifiedAppearance)
        {
            if (_appearances.Count <= itemModifiedAppearance.Id)
            {
                uint numBlocks = (uint)(_appearances.Count << 2);
                _appearances.Length = (int)itemModifiedAppearance.Id + 1;
                numBlocks           = (uint)(_appearances.Count << 2) - numBlocks;
                while (numBlocks-- != 0)
                {
                    _owner.GetPlayer().AddDynamicValue(PlayerDynamicFields.Transmog, 0);
                }
            }

            _appearances.Set((int)itemModifiedAppearance.Id, true);
            uint blockIndex  = itemModifiedAppearance.Id / 32;
            uint bitIndex    = itemModifiedAppearance.Id % 32;
            uint currentMask = _owner.GetPlayer().GetDynamicValue(PlayerDynamicFields.Transmog, (ushort)blockIndex);

            _owner.GetPlayer().SetDynamicValue(PlayerDynamicFields.Transmog, (ushort)blockIndex, (uint)((int)currentMask | (1 << (int)bitIndex)));
            var temporaryAppearance = _temporaryAppearances.LookupByKey(itemModifiedAppearance.Id);

            if (!temporaryAppearance.Empty())
            {
                _owner.GetPlayer().RemoveDynamicValue(PlayerDynamicFields.ConditionalTransmog, itemModifiedAppearance.Id);
                _temporaryAppearances.Remove(itemModifiedAppearance.Id);
            }
        }
예제 #2
0
        void AddTemporaryAppearance(ObjectGuid itemGuid, ItemModifiedAppearanceRecord itemModifiedAppearance)
        {
            var itemsWithAppearance = _temporaryAppearances[itemModifiedAppearance.Id];

            if (itemsWithAppearance.Empty())
            {
                _owner.GetPlayer().AddDynamicValue(ActivePlayerDynamicFields.ConditionalTransmog, itemModifiedAppearance.Id);
            }

            itemsWithAppearance.Add(itemGuid);
        }
예제 #3
0
        public void AddItemAppearance(uint itemId, uint appearanceModId = 0)
        {
            ItemModifiedAppearanceRecord itemModifiedAppearance = Global.DB2Mgr.GetItemModifiedAppearance(itemId, appearanceModId);

            if (!CanAddAppearance(itemModifiedAppearance))
            {
                return;
            }

            AddItemAppearance(itemModifiedAppearance);
        }
예제 #4
0
        void AddTemporaryAppearance(ObjectGuid itemGuid, ItemModifiedAppearanceRecord itemModifiedAppearance)
        {
            var itemsWithAppearance = _temporaryAppearances[itemModifiedAppearance.Id];

            if (itemsWithAppearance.Empty())
            {
                _owner.GetPlayer().AddConditionalTransmog(itemModifiedAppearance.Id);
            }

            itemsWithAppearance.Add(itemGuid);
        }
예제 #5
0
        public void LoadAccountItemAppearances(SQLResult knownAppearances, SQLResult favoriteAppearances)
        {
            if (!knownAppearances.IsEmpty())
            {
                uint[] blocks = new uint[1];
                do
                {
                    ushort blobIndex = knownAppearances.Read <ushort>(0);
                    if (blobIndex >= blocks.Length)
                    {
                        Array.Resize(ref blocks, blobIndex + 1);
                    }

                    blocks[blobIndex] = knownAppearances.Read <uint>(1);
                } while (knownAppearances.NextRow());

                _appearances = new BitSet(blocks);
            }

            if (!favoriteAppearances.IsEmpty())
            {
                do
                {
                    _favoriteAppearances[favoriteAppearances.Read <uint>(0)] = FavoriteAppearanceState.Unchanged;
                } while (favoriteAppearances.NextRow());
            }

            // Static item appearances known by every player
            uint[] hiddenAppearanceItems =
            {
                134110, // Hidden Helm
                134111, // Hidden Cloak
                134112, // Hidden Shoulder
                168659, // Hidden Chestpiece
                142503, // Hidden Shirt
                142504, // Hidden Tabard
                168665, // Hidden Bracers
                158329, // Hidden Gloves
                143539, // Hidden Belt
                168664  // Hidden Boots
            };

            foreach (uint hiddenItem in hiddenAppearanceItems)
            {
                ItemModifiedAppearanceRecord hiddenAppearance = Global.DB2Mgr.GetItemModifiedAppearance(hiddenItem, 0);
                //ASSERT(hiddenAppearance);
                if (_appearances.Length <= hiddenAppearance.Id)
                {
                    _appearances.Length = (int)hiddenAppearance.Id + 1;
                }

                _appearances.Set((int)hiddenAppearance.Id, true);
            }
        }
예제 #6
0
        public bool StoreTo(out ItemModifiedAppearanceRecord val, string arg)
        {
            val = default;

            HyperlinkDataTokenizer t = new(arg);

            if (!t.TryConsumeTo(out uint itemModifiedAppearanceId))
            {
                return(false);
            }

            val = CliDB.ItemModifiedAppearanceStorage.LookupByKey(itemModifiedAppearanceId);
            return(val != null && t.IsEmpty());
        }
예제 #7
0
        //todo  check this
        void AddItemAppearance(ItemModifiedAppearanceRecord itemModifiedAppearance)
        {
            Player owner = _owner.GetPlayer();

            if (_appearances.Count <= itemModifiedAppearance.Id)
            {
                uint numBlocks = (uint)(_appearances.Count << 2);
                _appearances.Length = (int)itemModifiedAppearance.Id + 1;
                numBlocks           = (uint)(_appearances.Count << 2) - numBlocks;
                while (numBlocks-- != 0)
                {
                    owner.AddTransmogBlock(0);
                }
            }

            _appearances.Set((int)itemModifiedAppearance.Id, true);
            uint blockIndex = itemModifiedAppearance.Id / 32;
            uint bitIndex   = itemModifiedAppearance.Id % 32;

            owner.AddTransmogFlag((int)blockIndex, 1u << (int)bitIndex);
            var temporaryAppearance = _temporaryAppearances.LookupByKey(itemModifiedAppearance.Id);

            if (!temporaryAppearance.Empty())
            {
                owner.RemoveConditionalTransmog(itemModifiedAppearance.Id);
                _temporaryAppearances.Remove(itemModifiedAppearance.Id);
            }

            ItemRecord item = CliDB.ItemStorage.LookupByKey(itemModifiedAppearance.ItemID);

            if (item != null)
            {
                int transmogSlot = Item.ItemTransmogrificationSlots[(int)item.inventoryType];
                if (transmogSlot >= 0)
                {
                    _owner.GetPlayer().UpdateCriteria(CriteriaTypes.AppearanceUnlockedBySlot, (ulong)transmogSlot, 1);
                }
            }

            var sets = Global.DB2Mgr.GetTransmogSetsForItemModifiedAppearance(itemModifiedAppearance.Id);

            foreach (TransmogSetRecord set in sets)
            {
                if (IsSetCompleted(set.Id))
                {
                    _owner.GetPlayer().UpdateCriteria(CriteriaTypes.TransmogSetUnlocked, set.TransmogSetGroupID);
                }
            }
        }
예제 #8
0
        bool IsSetCompleted(uint transmogSetId)
        {
            var transmogSetItems = Global.DB2Mgr.GetTransmogSetItems(transmogSetId);

            if (transmogSetItems.Empty())
            {
                return(false);
            }

            int[] knownPieces = new int[EquipmentSlot.End];
            for (var i = 0; i < EquipmentSlot.End; ++i)
            {
                knownPieces[i] = -1;
            }

            foreach (TransmogSetItemRecord transmogSetItem in transmogSetItems)
            {
                ItemModifiedAppearanceRecord itemModifiedAppearance = CliDB.ItemModifiedAppearanceStorage.LookupByKey(transmogSetItem.ItemModifiedAppearanceID);
                if (itemModifiedAppearance == null)
                {
                    continue;
                }

                ItemRecord item = CliDB.ItemStorage.LookupByKey(itemModifiedAppearance.ItemID);
                if (item == null)
                {
                    continue;
                }

                int transmogSlot = Item.ItemTransmogrificationSlots[(int)item.inventoryType];
                if (transmogSlot < 0 || knownPieces[transmogSlot] == 1)
                {
                    continue;
                }

                (var hasAppearance, bool isTemporary) = HasItemAppearance(transmogSetItem.ItemModifiedAppearanceID);

                knownPieces[transmogSlot] = (hasAppearance && !isTemporary) ? 1 : 0;
            }

            return(!knownPieces.Contains(0));
        }
예제 #9
0
        public void AddTransmogSet(uint transmogSetId)
        {
            var items = Global.DB2Mgr.GetTransmogSetItems(transmogSetId);

            if (items.Empty())
            {
                return;
            }

            foreach (TransmogSetItemRecord item in items)
            {
                ItemModifiedAppearanceRecord itemModifiedAppearance = CliDB.ItemModifiedAppearanceStorage.LookupByKey(item.ItemModifiedAppearanceID);
                if (itemModifiedAppearance == null)
                {
                    continue;
                }

                AddItemAppearance(itemModifiedAppearance);
            }
        }
예제 #10
0
        public void AddItemAppearance(Item item)
        {
            if (!item.IsSoulBound())
            {
                return;
            }

            ItemModifiedAppearanceRecord itemModifiedAppearance = item.GetItemModifiedAppearance();

            if (!CanAddAppearance(itemModifiedAppearance))
            {
                return;
            }

            if (Convert.ToBoolean(item.GetUInt32Value(ItemFields.Flags) & (uint)(ItemFieldFlags.BopTradeable | ItemFieldFlags.Refundable)))
            {
                AddTemporaryAppearance(item.GetGUID(), itemModifiedAppearance);
                return;
            }

            AddItemAppearance(itemModifiedAppearance);
        }
예제 #11
0
        public void AddItemAppearance(Item item)
        {
            if (!item.IsSoulBound())
            {
                return;
            }

            ItemModifiedAppearanceRecord itemModifiedAppearance = item.GetItemModifiedAppearance();

            if (!CanAddAppearance(itemModifiedAppearance))
            {
                return;
            }

            if (item.HasItemFlag(ItemFieldFlags.BopTradeable | ItemFieldFlags.Refundable))
            {
                AddTemporaryAppearance(item.GetGUID(), itemModifiedAppearance);
                return;
            }

            AddItemAppearance(itemModifiedAppearance);
        }
예제 #12
0
        public void RemoveTemporaryAppearance(Item item)
        {
            ItemModifiedAppearanceRecord itemModifiedAppearance = item.GetItemModifiedAppearance();

            if (itemModifiedAppearance == null)
            {
                return;
            }

            var guid = _temporaryAppearances.LookupByKey(itemModifiedAppearance.Id);

            if (guid.Empty())
            {
                return;
            }

            guid.Remove(item.GetGUID());
            if (guid.Empty())
            {
                _owner.GetPlayer().RemoveDynamicValue(ActivePlayerDynamicFields.ConditionalTransmog, itemModifiedAppearance.Id);
                _temporaryAppearances.Remove(itemModifiedAppearance.Id);
            }
        }
예제 #13
0
        bool CanAddAppearance(ItemModifiedAppearanceRecord itemModifiedAppearance)
        {
            if (itemModifiedAppearance == null)
            {
                return(false);
            }

            if (itemModifiedAppearance.TransmogSourceTypeEnum == 6 || itemModifiedAppearance.TransmogSourceTypeEnum == 9)
            {
                return(false);
            }

            if (!CliDB.ItemSearchNameStorage.ContainsKey(itemModifiedAppearance.ItemID))
            {
                return(false);
            }

            ItemTemplate itemTemplate = Global.ObjectMgr.GetItemTemplate(itemModifiedAppearance.ItemID);

            if (itemTemplate == null)
            {
                return(false);
            }

            if (_owner.GetPlayer().CanUseItem(itemTemplate) != InventoryResult.Ok)
            {
                return(false);
            }

            if (itemTemplate.GetFlags2().HasAnyFlag(ItemFlags2.NoSourceForItemVisual) || itemTemplate.GetQuality() == ItemQuality.Artifact)
            {
                return(false);
            }

            switch (itemTemplate.GetClass())
            {
            case ItemClass.Weapon:
            {
                if (!Convert.ToBoolean(_owner.GetPlayer().GetWeaponProficiency() & (1 << (int)itemTemplate.GetSubClass())))
                {
                    return(false);
                }
                if (itemTemplate.GetSubClass() == (int)ItemSubClassWeapon.Exotic ||
                    itemTemplate.GetSubClass() == (int)ItemSubClassWeapon.Exotic2 ||
                    itemTemplate.GetSubClass() == (int)ItemSubClassWeapon.Miscellaneous ||
                    itemTemplate.GetSubClass() == (int)ItemSubClassWeapon.Thrown ||
                    itemTemplate.GetSubClass() == (int)ItemSubClassWeapon.Spear ||
                    itemTemplate.GetSubClass() == (int)ItemSubClassWeapon.FishingPole)
                {
                    return(false);
                }
                break;
            }

            case ItemClass.Armor:
            {
                switch (itemTemplate.GetInventoryType())
                {
                case InventoryType.Body:
                case InventoryType.Shield:
                case InventoryType.Cloak:
                case InventoryType.Tabard:
                case InventoryType.Holdable:
                    break;

                case InventoryType.Head:
                case InventoryType.Shoulders:
                case InventoryType.Chest:
                case InventoryType.Waist:
                case InventoryType.Legs:
                case InventoryType.Feet:
                case InventoryType.Wrists:
                case InventoryType.Hands:
                case InventoryType.Robe:
                    if ((ItemSubClassArmor)itemTemplate.GetSubClass() == ItemSubClassArmor.Miscellaneous)
                    {
                        return(false);
                    }
                    break;

                default:
                    return(false);
                }
                if (itemTemplate.GetInventoryType() != InventoryType.Cloak)
                {
                    if (!Convert.ToBoolean(PlayerClassByArmorSubclass[itemTemplate.GetSubClass()] & _owner.GetPlayer().getClassMask()))
                    {
                        return(false);
                    }
                }
                break;
            }

            default:
                return(false);
            }

            if (itemTemplate.GetQuality() < ItemQuality.Uncommon)
            {
                if (!itemTemplate.GetFlags2().HasAnyFlag(ItemFlags2.IgnoreQualityForItemVisualSource) || !itemTemplate.GetFlags3().HasAnyFlag(ItemFlags3.ActsAsTransmogHiddenVisualOption))
                {
                    return(false);
                }
            }

            if (itemModifiedAppearance.Id < _appearances.Count && _appearances.Get((int)itemModifiedAppearance.Id))
            {
                return(false);
            }

            return(true);
        }
예제 #14
0
        void HandleTransmogrifyItems(TransmogrifyItems transmogrifyItems)
        {
            Player player = GetPlayer();

            // Validate
            if (!player.GetNPCIfCanInteractWith(transmogrifyItems.Npc, NPCFlags.Transmogrifier))
            {
                Log.outDebug(LogFilter.Network, "WORLD: HandleTransmogrifyItems - Unit (GUID: {0}) not found or player can't interact with it.", transmogrifyItems.ToString());
                return;
            }

            long cost = 0;
            Dictionary <Item, uint> transmogItems = new Dictionary <Item, uint>();
            Dictionary <Item, uint> illusionItems = new Dictionary <Item, uint>();

            List <Item> resetAppearanceItems = new List <Item>();
            List <Item> resetIllusionItems   = new List <Item>();
            List <uint> bindAppearances      = new List <uint>();

            foreach (TransmogrifyItem transmogItem in transmogrifyItems.Items)
            {
                // slot of the transmogrified item
                if (transmogItem.Slot >= EquipmentSlot.End)
                {
                    Log.outDebug(LogFilter.Network, "WORLD: HandleTransmogrifyItems - Player ({0}, name: {1}) tried to transmogrify wrong slot {2} when transmogrifying items.", player.GetGUID().ToString(), player.GetName(), transmogItem.Slot);
                    return;
                }

                // transmogrified item
                Item itemTransmogrified = player.GetItemByPos(InventorySlots.Bag0, (byte)transmogItem.Slot);
                if (!itemTransmogrified)
                {
                    Log.outDebug(LogFilter.Network, "WORLD: HandleTransmogrifyItems - Player (GUID: {0}, name: {1}) tried to transmogrify an invalid item in a valid slot (slot: {2}).", player.GetGUID().ToString(), player.GetName(), transmogItem.Slot);
                    return;
                }

                if (transmogItem.ItemModifiedAppearanceID != 0)
                {
                    ItemModifiedAppearanceRecord itemModifiedAppearance = CliDB.ItemModifiedAppearanceStorage.LookupByKey(transmogItem.ItemModifiedAppearanceID);
                    if (itemModifiedAppearance == null)
                    {
                        Log.outDebug(LogFilter.Network, "WORLD: HandleTransmogrifyItems - {0}, Name: {1} tried to transmogrify using invalid appearance ({2}).", player.GetGUID().ToString(), player.GetName(), transmogItem.ItemModifiedAppearanceID);
                        return;
                    }

                    var pairValue = GetCollectionMgr().HasItemAppearance((uint)transmogItem.ItemModifiedAppearanceID);
                    if (!pairValue.Item1)
                    {
                        Log.outDebug(LogFilter.Network, "WORLD: HandleTransmogrifyItems - {0}, Name: {1} tried to transmogrify using appearance he has not collected ({2}).", player.GetGUID().ToString(), player.GetName(), transmogItem.ItemModifiedAppearanceID);
                        return;
                    }
                    ItemTemplate itemTemplate = Global.ObjectMgr.GetItemTemplate(itemModifiedAppearance.ItemID);
                    if (player.CanUseItem(itemTemplate) != InventoryResult.Ok)
                    {
                        Log.outDebug(LogFilter.Network, "WORLD: HandleTransmogrifyItems - {0}, Name: {1} tried to transmogrify using appearance he can never use ({2}).", player.GetGUID().ToString(), player.GetName(), transmogItem.ItemModifiedAppearanceID);
                        return;
                    }

                    // validity of the transmogrification items
                    if (!Item.CanTransmogrifyItemWithItem(itemTransmogrified, itemModifiedAppearance))
                    {
                        Log.outDebug(LogFilter.Network, "WORLD: HandleTransmogrifyItems - {0}, Name: {1} failed CanTransmogrifyItemWithItem ({2} with appearance {3}).", player.GetGUID().ToString(), player.GetName(), itemTransmogrified.GetEntry(), transmogItem.ItemModifiedAppearanceID);
                        return;
                    }

                    transmogItems[itemTransmogrified] = (uint)transmogItem.ItemModifiedAppearanceID;
                    if (pairValue.Item2)
                    {
                        bindAppearances.Add((uint)transmogItem.ItemModifiedAppearanceID);
                    }

                    // add cost
                    cost += itemTransmogrified.GetSellPrice(_player);
                }
                else
                {
                    resetAppearanceItems.Add(itemTransmogrified);
                }

                if (transmogItem.SpellItemEnchantmentID != 0)
                {
                    if (transmogItem.Slot != EquipmentSlot.MainHand && transmogItem.Slot != EquipmentSlot.OffHand)
                    {
                        Log.outDebug(LogFilter.Network, "WORLD: HandleTransmogrifyItems - {0}, Name: {1} tried to transmogrify illusion into non-weapon slot ({2}).", player.GetGUID().ToString(), player.GetName(), transmogItem.Slot);
                        return;
                    }

                    SpellItemEnchantmentRecord illusion = CliDB.SpellItemEnchantmentStorage.LookupByKey(transmogItem.SpellItemEnchantmentID);
                    if (illusion == null)
                    {
                        Log.outDebug(LogFilter.Network, "WORLD: HandleTransmogrifyItems - {0}, Name: {1} tried to transmogrify illusion using invalid enchant ({2}).", player.GetGUID().ToString(), player.GetName(), transmogItem.SpellItemEnchantmentID);
                        return;
                    }

                    if (illusion.ItemVisual == 0 || !illusion.Flags.HasAnyFlag(EnchantmentSlotMask.Collectable))
                    {
                        Log.outDebug(LogFilter.Network, "WORLD: HandleTransmogrifyItems - {0}, Name: {1} tried to transmogrify illusion using not allowed enchant ({2}).", player.GetGUID().ToString(), player.GetName(), transmogItem.SpellItemEnchantmentID);
                        return;
                    }

                    PlayerConditionRecord condition = CliDB.PlayerConditionStorage.LookupByKey(illusion.TransmogPlayerConditionID);
                    if (condition != null)
                    {
                        if (!ConditionManager.IsPlayerMeetingCondition(player, condition))
                        {
                            Log.outDebug(LogFilter.Network, "WORLD: HandleTransmogrifyItems - {0}, Name: {1} tried to transmogrify illusion using not collected enchant ({2}).", player.GetGUID().ToString(), player.GetName(), transmogItem.SpellItemEnchantmentID);
                            return;
                        }
                    }

                    if (illusion.ScalingClassRestricted > 0 && illusion.ScalingClassRestricted != (byte)player.GetClass())
                    {
                        Log.outDebug(LogFilter.Network, "WORLD: HandleTransmogrifyItems - {0}, Name: {1} tried to transmogrify illusion using not allowed class enchant ({2}).", player.GetGUID().ToString(), player.GetName(), transmogItem.SpellItemEnchantmentID);
                        return;
                    }

                    illusionItems[itemTransmogrified] = (uint)transmogItem.SpellItemEnchantmentID;
                    cost += illusion.TransmogCost;
                }
                else
                {
                    resetIllusionItems.Add(itemTransmogrified);
                }
            }

            if (cost != 0) // 0 cost if reverting look
            {
                if (!player.HasEnoughMoney(cost))
                {
                    return;
                }

                player.ModifyMoney(-cost);
            }

            // Everything is fine, proceed
            foreach (var transmogPair in transmogItems)
            {
                Item transmogrified = transmogPair.Key;

                if (!transmogrifyItems.CurrentSpecOnly)
                {
                    transmogrified.SetModifier(ItemModifier.TransmogAppearanceAllSpecs, transmogPair.Value);
                    transmogrified.SetModifier(ItemModifier.TransmogAppearanceSpec1, 0);
                    transmogrified.SetModifier(ItemModifier.TransmogAppearanceSpec2, 0);
                    transmogrified.SetModifier(ItemModifier.TransmogAppearanceSpec3, 0);
                    transmogrified.SetModifier(ItemModifier.TransmogAppearanceSpec4, 0);
                }
                else
                {
                    if (transmogrified.GetModifier(ItemModifier.TransmogAppearanceSpec1) == 0)
                    {
                        transmogrified.SetModifier(ItemModifier.TransmogAppearanceSpec1, transmogrified.GetModifier(ItemModifier.TransmogAppearanceAllSpecs));
                    }
                    if (transmogrified.GetModifier(ItemModifier.TransmogAppearanceSpec2) == 0)
                    {
                        transmogrified.SetModifier(ItemModifier.TransmogAppearanceSpec2, transmogrified.GetModifier(ItemModifier.TransmogAppearanceAllSpecs));
                    }
                    if (transmogrified.GetModifier(ItemModifier.TransmogAppearanceSpec3) == 0)
                    {
                        transmogrified.SetModifier(ItemModifier.TransmogAppearanceSpec3, transmogrified.GetModifier(ItemModifier.TransmogAppearanceAllSpecs));
                    }
                    if (transmogrified.GetModifier(ItemModifier.TransmogAppearanceSpec4) == 0)
                    {
                        transmogrified.SetModifier(ItemModifier.TransmogAppearanceSpec4, transmogrified.GetModifier(ItemModifier.TransmogAppearanceAllSpecs));
                    }
                    transmogrified.SetModifier(ItemConst.AppearanceModifierSlotBySpec[player.GetActiveTalentGroup()], transmogPair.Value);
                }

                player.SetVisibleItemSlot(transmogrified.GetSlot(), transmogrified);

                transmogrified.SetNotRefundable(player);
                transmogrified.ClearSoulboundTradeable(player);
                transmogrified.SetState(ItemUpdateState.Changed, player);
            }

            foreach (var illusionPair in illusionItems)
            {
                Item transmogrified = illusionPair.Key;

                if (!transmogrifyItems.CurrentSpecOnly)
                {
                    transmogrified.SetModifier(ItemModifier.EnchantIllusionAllSpecs, illusionPair.Value);
                    transmogrified.SetModifier(ItemModifier.EnchantIllusionSpec1, 0);
                    transmogrified.SetModifier(ItemModifier.EnchantIllusionSpec2, 0);
                    transmogrified.SetModifier(ItemModifier.EnchantIllusionSpec3, 0);
                    transmogrified.SetModifier(ItemModifier.EnchantIllusionSpec4, 0);
                }
                else
                {
                    if (transmogrified.GetModifier(ItemModifier.EnchantIllusionSpec1) == 0)
                    {
                        transmogrified.SetModifier(ItemModifier.EnchantIllusionSpec1, transmogrified.GetModifier(ItemModifier.EnchantIllusionAllSpecs));
                    }
                    if (transmogrified.GetModifier(ItemModifier.EnchantIllusionSpec2) == 0)
                    {
                        transmogrified.SetModifier(ItemModifier.EnchantIllusionSpec2, transmogrified.GetModifier(ItemModifier.EnchantIllusionAllSpecs));
                    }
                    if (transmogrified.GetModifier(ItemModifier.EnchantIllusionSpec3) == 0)
                    {
                        transmogrified.SetModifier(ItemModifier.EnchantIllusionSpec3, transmogrified.GetModifier(ItemModifier.EnchantIllusionAllSpecs));
                    }
                    if (transmogrified.GetModifier(ItemModifier.EnchantIllusionSpec4) == 0)
                    {
                        transmogrified.SetModifier(ItemModifier.EnchantIllusionSpec4, transmogrified.GetModifier(ItemModifier.EnchantIllusionAllSpecs));
                    }
                    transmogrified.SetModifier(ItemConst.IllusionModifierSlotBySpec[player.GetActiveTalentGroup()], illusionPair.Value);
                }

                player.SetVisibleItemSlot(transmogrified.GetSlot(), transmogrified);

                transmogrified.SetNotRefundable(player);
                transmogrified.ClearSoulboundTradeable(player);
                transmogrified.SetState(ItemUpdateState.Changed, player);
            }

            foreach (Item item in resetAppearanceItems)
            {
                if (!transmogrifyItems.CurrentSpecOnly)
                {
                    item.SetModifier(ItemModifier.TransmogAppearanceAllSpecs, 0);
                    item.SetModifier(ItemModifier.TransmogAppearanceSpec1, 0);
                    item.SetModifier(ItemModifier.TransmogAppearanceSpec2, 0);
                    item.SetModifier(ItemModifier.TransmogAppearanceSpec3, 0);
                    item.SetModifier(ItemModifier.TransmogAppearanceSpec4, 0);
                }
                else
                {
                    if (item.GetModifier(ItemModifier.TransmogAppearanceSpec1) == 0)
                    {
                        item.SetModifier(ItemModifier.TransmogAppearanceSpec1, item.GetModifier(ItemModifier.TransmogAppearanceAllSpecs));
                    }
                    if (item.GetModifier(ItemModifier.TransmogAppearanceSpec2) == 0)
                    {
                        item.SetModifier(ItemModifier.TransmogAppearanceSpec2, item.GetModifier(ItemModifier.TransmogAppearanceAllSpecs));
                    }
                    if (item.GetModifier(ItemModifier.TransmogAppearanceSpec2) == 0)
                    {
                        item.SetModifier(ItemModifier.TransmogAppearanceSpec3, item.GetModifier(ItemModifier.TransmogAppearanceAllSpecs));
                    }
                    if (item.GetModifier(ItemModifier.TransmogAppearanceSpec4) == 0)
                    {
                        item.SetModifier(ItemModifier.TransmogAppearanceSpec4, item.GetModifier(ItemModifier.TransmogAppearanceAllSpecs));
                    }
                    item.SetModifier(ItemConst.AppearanceModifierSlotBySpec[player.GetActiveTalentGroup()], 0);
                    item.SetModifier(ItemModifier.EnchantIllusionAllSpecs, 0);
                }

                item.SetState(ItemUpdateState.Changed, player);
                player.SetVisibleItemSlot(item.GetSlot(), item);
            }

            foreach (Item item in resetIllusionItems)
            {
                if (!transmogrifyItems.CurrentSpecOnly)
                {
                    item.SetModifier(ItemModifier.EnchantIllusionAllSpecs, 0);
                    item.SetModifier(ItemModifier.EnchantIllusionSpec1, 0);
                    item.SetModifier(ItemModifier.EnchantIllusionSpec2, 0);
                    item.SetModifier(ItemModifier.EnchantIllusionSpec3, 0);
                    item.SetModifier(ItemModifier.EnchantIllusionSpec4, 0);
                }
                else
                {
                    if (item.GetModifier(ItemModifier.EnchantIllusionSpec1) == 0)
                    {
                        item.SetModifier(ItemModifier.EnchantIllusionSpec1, item.GetModifier(ItemModifier.EnchantIllusionAllSpecs));
                    }
                    if (item.GetModifier(ItemModifier.EnchantIllusionSpec2) == 0)
                    {
                        item.SetModifier(ItemModifier.EnchantIllusionSpec2, item.GetModifier(ItemModifier.EnchantIllusionAllSpecs));
                    }
                    if (item.GetModifier(ItemModifier.EnchantIllusionSpec3) == 0)
                    {
                        item.SetModifier(ItemModifier.EnchantIllusionSpec3, item.GetModifier(ItemModifier.EnchantIllusionAllSpecs));
                    }
                    if (item.GetModifier(ItemModifier.EnchantIllusionSpec4) == 0)
                    {
                        item.SetModifier(ItemModifier.EnchantIllusionSpec4, item.GetModifier(ItemModifier.EnchantIllusionAllSpecs));
                    }
                    item.SetModifier(ItemConst.IllusionModifierSlotBySpec[player.GetActiveTalentGroup()], 0);
                    item.SetModifier(ItemModifier.TransmogAppearanceAllSpecs, 0);
                }

                item.SetState(ItemUpdateState.Changed, player);
                player.SetVisibleItemSlot(item.GetSlot(), item);
            }

            foreach (uint itemModifedAppearanceId in bindAppearances)
            {
                var itemsProvidingAppearance = GetCollectionMgr().GetItemsProvidingTemporaryAppearance(itemModifedAppearanceId);
                foreach (ObjectGuid itemGuid in itemsProvidingAppearance)
                {
                    Item item = player.GetItemByGuid(itemGuid);
                    if (item)
                    {
                        item.SetNotRefundable(player);
                        item.ClearSoulboundTradeable(player);
                        GetCollectionMgr().AddItemAppearance(item);
                    }
                }
            }
        }