using System; using System.Collections.Generic; using System.Text; namespace Chief { public class Units : List { public NPC Find(uint UID) { lock (this) { foreach (NPC npc in this) { if (npc.UID == UID) return npc; } return null; } } public NPC Find(D2Data.NPCCode ID) { lock (this) { foreach (NPC npc in this) { if (npc.ID == ID) return npc; } return null; } } public NPC Find(string Name) { lock (this) { foreach (NPC npc in this) { if (npc.Name == Name) return npc; } return null; } } public List FindAll(string Name) { lock (this) { List tempList = new List(); foreach (NPC npc in this) { if (npc.Name == Name) tempList.Add(npc); } if (tempList.Count != 0) return tempList; return null; } } public List FindAll(D2Data.NPCCode ID) { lock (this) { List tempList = new List(); foreach (NPC npc in this) { if (npc.ID == ID) tempList.Add(npc); } if (tempList.Count != 0) return tempList; return null; } } public new void Add(NPC npc) { lock (this) { base.Add(npc); } } public new void Remove(NPC npc) { lock (this) { base.Remove(npc); } } public new Enumerator GetEnumerator() { lock (this) { return base.GetEnumerator(); } } } }