public static void GetAllNpcs(this NpcCollection npcs, bool isHD, bool includePath) { WowDatabase _wowDatabase = Engine.Instance.WowDatabase; uint npcCount = _wowDatabase.NpcCount; npcs.Clear(); for (uint i = 0; i < npcCount; ++i) { SNpc?r = _wowDatabase.GetNpc(i); if (r != null && r.Value.modelId != -1) { if (includePath) { string path = _wowDatabase.GetNpcPath(r.Value.modelDisplayId, isHD); if (path == "") { continue; } if (!Engine.Instance.WowEnvironment.IsFileExist(path) && isHD) { path = _wowDatabase.GetNpcPath(r.Value.modelDisplayId, false); } npcs.Add(new Npc() { Name = r.Value.name, Type = r.Value.type, ModelDisplayId = r.Value.modelDisplayId, ModelId = r.Value.modelId, Path = path }); } else { npcs.Add(new Npc() { Name = r.Value.name, Type = r.Value.type, ModelDisplayId = r.Value.modelDisplayId, ModelId = r.Value.modelId }); } } } }
private void GetNpcTreeItemFiles(NpcCollection npcCollection, string path, TreeNodeEntry node) { WowEnvironment env = Engine.Instance.WowEnvironment; env.ClearOwnCascFiles(); foreach (Npc npc in npcCollection) { env.AddOwnCascFile(npc.Path); } env.FinishOwnCascFiles(); TreeViewFiles.Clear(); TreeNodeEntry treeNode = TreeViewEntry.TraverseAllUseOwn(path, "*", node); for (int i = 0; i < treeNode.NodeEntrys.Count; i++) { TreeViewFiles.Add(treeNode.NodeEntrys[i]); } }
public void FillData(NpcCollection npcCollection) { npcsView = CollectionViewSource.GetDefaultView(Npcs); GetNpcTreeItemFiles(npcCollection, "", new TreeNodeEntry()); //build string to npclist map m_NpcNameMap.Clear(); foreach (Npc npc in npcCollection) { List <Npc> listNpc; if (!m_NpcNameMap.TryGetValue(npc.Path, out listNpc)) { m_NpcNameMap[npc.Path] = new List <Npc>(); } m_NpcNameMap[npc.Path].Add(npc); } }
public static void GetAllNpcs(this NpcCollection npcs) { WowDatabase _wowDatabase = Engine.Instance.WowDatabase; uint npcCount = _wowDatabase.NpcCount; npcs.Clear(); for (uint i = 0; i < npcCount; ++i) { SNpc?r = _wowDatabase.GetNpc(i); if (r != null && r.Value.modelId != -1) { npcs.Add(new Npc() { Name = r.Value.name, Type = r.Value.type, ModelDisplayId = r.Value.modelDisplayId, ModelId = r.Value.modelId }); } } }