Ejemplo n.º 1
0
        public static void GetM2ItemsBySlot(this M2ItemCollection items, E_CHAR_SLOTS slot)
        {
            WowDatabase _wowDatabase = Engine.Instance.WowDatabase;
            uint        itemCount    = _wowDatabase.ItemCount;

            items.Clear();

            for (uint i = 0; i < itemCount; ++i)
            {
                SItem?r = _wowDatabase.GetItem(i);
                if (r != null && r.Value.IsMatchSlot(slot) && (r.Value.name.IndexOf("deprecated", StringComparison.CurrentCultureIgnoreCase) == -1))
                {
                    int    itemid = r.Value.id;
                    string modelpath;
                    string texturepath;
                    modelpath = _wowDatabase.GetItemPath(itemid, out texturepath);

                    items.Add(new M2Item()
                    {
                        Name         = r.Value.name,
                        Type         = (E_ITEM_TYPE)r.Value.type,
                        Id           = r.Value.id,
                        SubClassName = r.Value.subclassname,
                        ModelPath    = modelpath,
                        TexturePath  = texturepath
                    });
                }
            }
        }
Ejemplo n.º 2
0
        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.M2Instance.GetSlotItemId(slot);
            }

            e.CanExecute = isChar && !slotEmpty;
        }
Ejemplo n.º 3
0
        public static string GetSlotName(this E_CHAR_SLOTS slot)
        {
            switch (slot)
            {
            case E_CHAR_SLOTS.CS_HEAD:
                return(Application.Current.FindResource("clothesHead") as string);

            case E_CHAR_SLOTS.CS_SHOULDER:
                return(Application.Current.FindResource("clothesShoulder") as string);

            case E_CHAR_SLOTS.CS_SHIRT:
                return(Application.Current.FindResource("clothesShirt") as string);

            case E_CHAR_SLOTS.CS_CHEST:
                return(Application.Current.FindResource("clothesChest") as string);

            case E_CHAR_SLOTS.CS_BELT:
                return(Application.Current.FindResource("clothesBelt") as string);

            case E_CHAR_SLOTS.CS_PANTS:
                return(Application.Current.FindResource("clothesPants") as string);

            case E_CHAR_SLOTS.CS_BOOTS:
                return(Application.Current.FindResource("clothesBoots") as string);

            case E_CHAR_SLOTS.CS_BRACERS:
                return(Application.Current.FindResource("clothesBracers") as string);

            case E_CHAR_SLOTS.CS_GLOVES:
                return(Application.Current.FindResource("clothesGloves") as string);

            case E_CHAR_SLOTS.CS_CAPE:
                return(Application.Current.FindResource("clothesCape") as string);

            case E_CHAR_SLOTS.CS_TABARD:
                return(Application.Current.FindResource("clothesTabard") as string);

            case E_CHAR_SLOTS.CS_HAND_LEFT:
                return(Application.Current.FindResource("weaponLeft") as string);

            case E_CHAR_SLOTS.CS_HAND_RIGHT:
                return(Application.Current.FindResource("weaponRight") as string);

            default:
                return("");
            }
        }
Ejemplo n.º 4
0
        public void FillData(E_CHAR_SLOTS slot)
        {
            App app = Application.Current as App;

            Items.GetM2ItemsBySlot(slot);
            itemsView = CollectionViewSource.GetDefaultView(Items);

            visibleEntries.Clear();
            foreach (Item v in Items)
            {
                if (!visibleEntries.ContainsKey(v.SubClassName))
                {
                    visibleEntries[v.SubClassName] = true;
                }
            }
            BuildTypeContextMenu();
        }
Ejemplo n.º 5
0
        private static int[] GetItemIdsByName(string name, E_CHAR_SLOTS slot, int id)
        {
            WowDatabase _wowDatabase = Engine.Instance.WowDatabase;
            uint        itemCount    = _wowDatabase.ItemCount;

            List <int> idList = new List <int>();

            for (uint i = 0; i < itemCount; ++i)
            {
                SItem?r = _wowDatabase.GetItem(i);
                if (r.HasValue && r.Value.id != id && r.Value.name == name)
                {
                    if (r.Value.IsMatchSlot(slot) && (r.Value.name.IndexOf("deprecated", StringComparison.CurrentCultureIgnoreCase) == -1))
                    {
                        idList.Add(r.Value.id);
                    }
                }
            }

            return(idList.ToArray());
        }
Ejemplo n.º 6
0
 public void ResetSlot(E_CHAR_SLOTS slot)
 {
     M2SceneNode_resetSlot(pointer, (int)slot);
 }
Ejemplo n.º 7
0
 public static bool IsMatchSlot(this SItem item, E_CHAR_SLOTS slot)
 {
     return(WowDatabase.WowDatabase_itemIsCorrectType(item.type, (int)slot));
 }
Ejemplo n.º 8
0
 public bool SlotHasModel(E_CHAR_SLOTS slot)
 {
     return(M2SceneNode_slotHasModel(pointer, (int)slot));
 }
Ejemplo n.º 9
0
 public int GetSlotItemId(E_CHAR_SLOTS slot)
 {
     return(M2SceneNode_getSlotItemId(pointer, (int)slot));
 }
Ejemplo n.º 10
0
 public bool SlotHasModel(E_CHAR_SLOTS slot)
 {
     return(m2Instance_slotHasModel(pointer, (int)slot));
 }
Ejemplo n.º 11
0
 public int GetSlotItemId(E_CHAR_SLOTS slot)
 {
     return(m2Instance_getSlotItemId(pointer, (int)slot));
 }