public MailAttachedItem(Item item, byte pos) { Position = pos; AttachID = (int)item.GetGUID().GetCounter(); Item = new ItemInstance(item); Count = item.GetCount(); Charges = item.GetSpellCharges(); MaxDurability = item.GetUInt32Value(ItemFields.MaxDurability); Durability = item.GetUInt32Value(ItemFields.Durability); Unlocked = !item.IsLocked(); for (EnchantmentSlot slot = 0; slot < EnchantmentSlot.MaxInspected; slot++) { if (item.GetEnchantmentId(slot) == 0) { continue; } Enchants.Add(new ItemEnchantData((int)item.GetEnchantmentId(slot), item.GetEnchantmentDuration(slot), (int)item.GetEnchantmentCharges(slot), (byte)slot)); } byte i = 0; foreach (ItemDynamicFieldGems gemData in item.GetGems()) { if (gemData.ItemId != 0) { ItemGemData gem = new ItemGemData(); gem.Slot = i; gem.Item = new ItemInstance(gemData); Gems.Add(gem); } ++i; } }
public InspectItemData(Item item, byte index) { CreatorGUID = item.GetGuidValue(ItemFields.Creator); Item = new ItemInstance(item); Index = index; Usable = true; // @todo for (EnchantmentSlot enchant = 0; enchant < EnchantmentSlot.Max; ++enchant) { uint enchId = item.GetEnchantmentId(enchant); if (enchId != 0) { Enchants.Add(new InspectEnchantData(enchId, (byte)enchant)); } } byte i = 0; foreach (ItemDynamicFieldGems gemData in item.GetGems()) { if (gemData.ItemId != 0) { ItemGemData gem = new ItemGemData(); gem.Slot = i; gem.Item = new ItemInstance(gemData); Gems.Add(gem); } ++i; } }
/// <summary> /// Update the observable collections /// </summary> public void UpdateInventoryCategories() { Treasures.Clear(); Gems.Clear(); ArmorSet.Clear(); Buffs.Clear(); foreach (var gameItemQuantity in _inventory) { if (gameItemQuantity.GameItem is Treasure) { Treasures.Add(gameItemQuantity); } if (gameItemQuantity.GameItem is Gem) { Gems.Add(gameItemQuantity); } if (gameItemQuantity.GameItem is ArmorSet) { ArmorSet.Add(gameItemQuantity); } if (gameItemQuantity.GameItem is Buff) { Buffs.Add(gameItemQuantity); } } }
public InspectItemData(Item item, byte index) { CreatorGUID = item.GetCreator(); Item = new ItemInstance(item); Index = index; Usable = true; // @todo for (EnchantmentSlot enchant = 0; enchant < EnchantmentSlot.Max; ++enchant) { uint enchId = item.GetEnchantmentId(enchant); if (enchId != 0) { Enchants.Add(new InspectEnchantData(enchId, (byte)enchant)); } } byte i = 0; foreach (SocketedGem gemData in item.m_itemData.Gems) { if (gemData.ItemId != 0) { ItemGemData gem = new(); gem.Slot = i; gem.Item = new ItemInstance(gemData); Gems.Add(gem); } ++i; } AzeriteItem azeriteItem = item.ToAzeriteItem(); if (azeriteItem != null) { SelectedAzeriteEssences essences = azeriteItem.GetSelectedAzeriteEssences(); if (essences != null) { for (byte slot = 0; slot < essences.AzeriteEssenceID.GetSize(); ++slot) { AzeriteEssenceData essence = new(); essence.Index = slot; essence.AzeriteEssenceID = essences.AzeriteEssenceID[slot]; if (essence.AzeriteEssenceID != 0) { essence.Rank = azeriteItem.GetEssenceRank(essence.AzeriteEssenceID); essence.SlotUnlocked = true; } else { essence.SlotUnlocked = azeriteItem.HasUnlockedEssenceSlot(slot); } AzeriteEssences.Add(essence); } } } }
public void AddGem(string name, long quantity) { if (IsEnoughSpace(quantity) && Gold >= Gems.Sum(g => g.Quantity) + quantity) { Gem gem = Gems.FirstOrDefault(g => g.Name == name); if (gem == null) { gem = new Gem(name); Gems.Add(gem); } gem.Quantity += quantity; } }
public void AddGem(string name, long value) { if (Capacity + value <= MaxCapacity && GetGoldAmount() >= GetGemsAmount() + value) { if (!Gems.Any(g => g.Name == name)) { Gems.Add(new Gem(name)); } var current = Gems.FirstOrDefault(g => g.Name == name); current.Value += value; Capacity += value; } }
public void SetGemsInSlot(IReadOnlyList <Gem> value, ItemSlot slot) { if (value.Any(s => s.ItemSlot != slot)) { throw new ArgumentException("Gems for a slot must all have that slot as ItemSlot", nameof(value)); } var oldValue = GetGemsInSlot(slot); if (oldValue.Any() && value.Any()) { Gems.RemoveAndAdd(oldValue, value); } else if (value.Any()) { Gems.Add(value); } else if (oldValue.Any()) { Gems.Remove(oldValue); } }
public StaffGem(string texture, int originX, int originY, string name, int shoot, bool back = false, float mana = 1f, float dpsModifier = 1f, float speedModifier = 1f, float knockBack = 0f, int critBonus = 0) { Type = Gems.Count + 1; if (Main.netMode != NetmodeID.Server) { Texture = ModLoader.GetMod(Constants.ModName).GetTexture("Content/GFX/Items/Gemstones/" + texture); } Origin = new Vector2(originX, originY); DpsModifier = dpsModifier; SpeedModifier = speedModifier; KnockBack = knockBack; CritBonus = critBonus; Name = name; Mana = mana; Shoot = shoot; Back = back; if (!Gems.ContainsKey(Type)) { Gems.Add(Type, this); } }