88 lines
2 KiB
C#
88 lines
2 KiB
C#
using System.Collections.Generic;
|
|
using Server.Items;
|
|
|
|
namespace Server.Engines.Craft
|
|
{
|
|
public enum CraftMarkOption
|
|
{
|
|
MarkItem,
|
|
DoNotMark,
|
|
PromptForMark
|
|
}
|
|
|
|
public class CraftContext
|
|
{
|
|
public CraftContext()
|
|
{
|
|
Items = new List<CraftItem>();
|
|
Queue = new List<CraftQueueOrder>();
|
|
LastResourceIndex = -1;
|
|
LastResourceIndex2 = -1;
|
|
LastGroupIndex = -1;
|
|
}
|
|
|
|
public List<CraftItem> Items { get; }
|
|
|
|
public List<CraftQueueOrder> Queue { get; }
|
|
|
|
public int LastResourceIndex { get; set; }
|
|
|
|
public int LastResourceIndex2 { get; set; }
|
|
|
|
public int LastGroupIndex { get; set; }
|
|
|
|
public bool DoNotColor { get; set; }
|
|
|
|
public CraftMarkOption MarkOption { get; set; }
|
|
|
|
public bool IsQueueRunning { get; set; }
|
|
|
|
// T2A: last hue used for hue-aware crafting (tailoring cloth)
|
|
public int LastHue { get; set; } = -1;
|
|
|
|
// T2A jewelry: transient gem info set by GemSelectTarget, consumed by BaseJewel.OnCraft
|
|
public GemType PendingGemType { get; set; }
|
|
public int PendingGemCount { get; set; }
|
|
|
|
public CraftItem LastMade
|
|
{
|
|
get
|
|
{
|
|
if (Items.Count > 0)
|
|
{
|
|
return Items[0];
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Retrieves the first uncompleted work order in the queue.
|
|
/// </summary>
|
|
public CraftQueueOrder GetActiveOrder()
|
|
{
|
|
for (int i = 0; i < Queue.Count; i++)
|
|
{
|
|
if (!Queue[i].IsFinished)
|
|
{
|
|
return Queue[i];
|
|
}
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
public void OnMade(CraftItem item)
|
|
{
|
|
Items.Remove(item);
|
|
|
|
if (Items.Count == 10)
|
|
{
|
|
Items.RemoveAt(9);
|
|
}
|
|
|
|
Items.Insert(0, item);
|
|
}
|
|
}
|
|
}
|