ModernUO/Scripts/Engines/Craft/Core/CraftContext.cs
2018-09-14 08:46:14 -07:00

67 lines
1.4 KiB
C#

using System.Collections.Generic;
namespace Server.Engines.Craft
{
public enum CraftMarkOption
{
MarkItem,
DoNotMark,
PromptForMark
}
public class CraftContext
{
private List<CraftItem> m_Items;
private int m_LastResourceIndex;
private int m_LastResourceIndex2;
private int m_LastGroupIndex;
private bool m_DoNotColor;
private CraftMarkOption m_MarkOption;
public List<CraftItem> Items => m_Items;
public int LastResourceIndex{ get => m_LastResourceIndex;
set => m_LastResourceIndex = value;
}
public int LastResourceIndex2{ get => m_LastResourceIndex2;
set => m_LastResourceIndex2 = value;
}
public int LastGroupIndex{ get => m_LastGroupIndex;
set => m_LastGroupIndex = value;
}
public bool DoNotColor{ get => m_DoNotColor;
set => m_DoNotColor = value;
}
public CraftMarkOption MarkOption{ get => m_MarkOption;
set => m_MarkOption = value;
}
public CraftContext()
{
m_Items = new List<CraftItem>();
m_LastResourceIndex = -1;
m_LastResourceIndex2 = -1;
m_LastGroupIndex = -1;
}
public CraftItem LastMade
{
get
{
if ( m_Items.Count > 0 )
return m_Items[0];
return null;
}
}
public void OnMade( CraftItem item )
{
m_Items.Remove( item );
if ( m_Items.Count == 10 )
m_Items.RemoveAt( 9 );
m_Items.Insert( 0, item );
}
}
}