Miscellany
public text v1 · immutableusing System;
using System.Collections.Generic;
using System.Text;
namespace Chief
{
public class Units : List<NPC>
{
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<NPC> FindAll(string Name)
{
lock (this)
{
List<NPC> tempList = new List<NPC>();
foreach (NPC npc in this)
{
if (npc.Name == Name)
tempList.Add(npc);
}
if (tempList.Count != 0)
return tempList;
return null;
}
}
public List<NPC> FindAll(D2Data.NPCCode ID)
{
lock (this)
{
List<NPC> tempList = new List<NPC>();
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();
}
}
}
}