private void CanResetSlotExecuted(object sender, CanExecuteRoutedEventArgs e)
        {
            M2SceneNode node      = ModelSceneService.Instance.MainM2SceneNode;
            bool        slotEmpty = true;
            bool        isChar    = node != null && node.Type == M2Type.MT_CHARACTER && node.IsNpc == false;

            if (e.Parameter != null && isChar)
            {
                E_CHAR_SLOTS slot = (E_CHAR_SLOTS)e.Parameter;
                slotEmpty = 0 == node.GetSlotItemId(slot);
            }

            e.CanExecute = isChar && !slotEmpty;
        }
Пример #2
0
        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
                    });
                }
            }
        }