public static void GetAllSlotItems(this SlotItemCollection slotItems, M2SceneNode node) { slotItems.Clear(); if (node.Type != M2Type.MT_CHARACTER || node.IsNpc) { return; } WowDatabase wowDatabase = Engine.Instance.WowDatabase; E_CHAR_SLOTS[] slots = { E_CHAR_SLOTS.CS_HEAD, E_CHAR_SLOTS.CS_SHOULDER, E_CHAR_SLOTS.CS_SHIRT, E_CHAR_SLOTS.CS_CHEST, E_CHAR_SLOTS.CS_BELT, E_CHAR_SLOTS.CS_PANTS, E_CHAR_SLOTS.CS_BOOTS, E_CHAR_SLOTS.CS_BRACERS, E_CHAR_SLOTS.CS_GLOVES, E_CHAR_SLOTS.CS_CAPE, E_CHAR_SLOTS.CS_TABARD, E_CHAR_SLOTS.CS_HAND_LEFT, E_CHAR_SLOTS.CS_HAND_RIGHT, }; for (int i = 0; i < slots.GetLength(0); ++i) { int id = node.GetSlotItemId(slots[i]); SItem?item = wowDatabase.GetItemById(id); if (item.HasValue) { slotItems.Add(new SlotItem() { SlotName = slots[i].GetSlotName(), ItemId = item.Value.id, ItemName = item.Value.name, ModelId = item.Value.modelId, SubClassName = item.Value.subclassname }); } } }
public static void GetAllSlotItemsWithSameName(this SlotItemCollection slotItems, M2SceneNode node) { slotItems.Clear(); if (node.Type != M2Type.MT_CHARACTER || node.IsNpc) { return; } WowDatabase wowDatabase = Engine.Instance.WowDatabase; E_CHAR_SLOTS[] slots = { E_CHAR_SLOTS.CS_HEAD, E_CHAR_SLOTS.CS_SHOULDER, E_CHAR_SLOTS.CS_SHIRT, E_CHAR_SLOTS.CS_CHEST, E_CHAR_SLOTS.CS_BELT, E_CHAR_SLOTS.CS_PANTS, E_CHAR_SLOTS.CS_BOOTS, E_CHAR_SLOTS.CS_BRACERS, E_CHAR_SLOTS.CS_GLOVES, E_CHAR_SLOTS.CS_CAPE, E_CHAR_SLOTS.CS_TABARD, E_CHAR_SLOTS.CS_HAND_LEFT, E_CHAR_SLOTS.CS_HAND_RIGHT, }; for (int i = 0; i < slots.GetLength(0); ++i) { int id = node.M2Instance.GetSlotItemId(slots[i]); SItem?item = wowDatabase.GetItemById(id); if (!item.HasValue || item.Value.name.Length == 0) { continue; } slotItems.Add(new SlotItem() { SlotName = slots[i].GetSlotName(), ItemId = item.Value.id, ItemName = item.Value.name, SubClassName = item.Value.subclassname }); if (slots[i] != E_CHAR_SLOTS.CS_HEAD && slots[i] != E_CHAR_SLOTS.CS_SHOULDER && slots[i] != E_CHAR_SLOTS.CS_CHEST && slots[i] != E_CHAR_SLOTS.CS_PANTS && slots[i] != E_CHAR_SLOTS.CS_GLOVES) { continue; } //add name int[] idArray = GetItemIdsByName(item.Value.name, slots[i], id); foreach (int _id in idArray) { SItem?_item = wowDatabase.GetItemById(_id); if (!_item.HasValue) { continue; } slotItems.Add(new SlotItem() { SlotName = slots[i].GetSlotName(), ItemId = _item.Value.id, ItemName = _item.Value.name, SubClassName = _item.Value.subclassname }); } } }