Files
The-Forging/Scripts/Services/Craft/Core/CraftItemCol.cs
T

58 lines
1.3 KiB
C#
Raw Normal View History

2026-06-19 00:00:16 -04:00
using System;
namespace Server.Engines.Craft
{
public class CraftItemCol : System.Collections.CollectionBase
{
public CraftItemCol()
{
}
public int Add(CraftItem craftItem)
{
return this.List.Add(craftItem);
}
public void Remove(int index)
{
if (index > this.Count - 1 || index < 0)
{
}
else
{
this.List.RemoveAt(index);
}
}
public CraftItem GetAt(int index)
{
return (CraftItem)this.List[index];
}
public CraftItem SearchForSubclass(Type type)
{
for (int i = 0; i < this.List.Count; i++)
{
CraftItem craftItem = (CraftItem)this.List[i];
if (craftItem.ItemType == type || type.IsSubclassOf(craftItem.ItemType))
return craftItem;
}
return null;
}
public CraftItem SearchFor(Type type)
{
for (int i = 0; i < this.List.Count; i++)
{
CraftItem craftItem = (CraftItem)this.List[i];
if (craftItem.ItemType == type)
{
return craftItem;
}
}
return null;
}
}
}