namespace Wizard;

public class Item
{
	public enum Type
	{
		TwoPickTicket = 1,
		CardPackTicket,
		Orb,
		ColosseumTicket,
		OrbPiece,
		SpotCardBuildDeckTicket,
		LeaderSkinTicket
	}

	public const int ID_CHALLENGE_TICKET = 1;

	public const int ID_COLOSSEUM_TICKET = 2;

	public const int ID_ORB = 1000;

	public const int ID_ORB_PIECE = 1001;

	public const int BINGO_TICKET = 2001;

	public const int BINGO_TICKET_2 = 2002;

	public const int BINGO_TICKET_HOCHAN = 2004;

	public const int ID_CARD_PACK_TICKET_MIN = 10001;

	private const int ID_SPOT_CARD_BUILD_DECK_TICKET_MIN = 60000;

	private const int ID_SPOT_CARD_BUILD_DECK_TICKET_MAX = 69999;

	private const int ID_LEADER_SKIN_TICKET_MIN = 70000;

	private const int ID_LEADER_SKIN_TICKET_MAX = 79999;

	public const int ID_TICKET_MAX = 99999;

	public Type type;

	public int UserGoodsId;

	public string name;

	public string thumbnail;

	public string unit;

	public string unitFormat;

	private int index;

	public static bool IsLeaderSkinTicket(int itemId)
	{
		if (itemId >= 70000)
		{
			return itemId <= 79999;
		}
		return false;
	}

	public static bool IsSpotCardBuildDeckTicket(int itemId)
	{
		if (itemId >= 60000)
		{
			return itemId <= 69999;
		}
		return false;
	}

	public Item()
	{
	}

	public Item(string[] columns)
	{
		string text = columns[index++];
		type = (Type)int.Parse(columns[index++]);
		UserGoodsId = int.Parse(text);
		name = Data.Master.GetItemText("IT_" + text);
		thumbnail = columns[index++];
		SystemText systemText = Data.SystemText;
		switch (type)
		{
		case Type.TwoPickTicket:
		case Type.CardPackTicket:
		case Type.ColosseumTicket:
		case Type.SpotCardBuildDeckTicket:
		case Type.LeaderSkinTicket:
			unit = systemText.Get("Common_0117");
			unitFormat = systemText.Get("Mail_0041");
			break;
		case Type.Orb:
		case Type.OrbPiece:
			unit = systemText.Get("Common_0116");
			unitFormat = systemText.Get("Mail_0040");
			break;
		}
	}

	public static Item GetItemData(UserGoods.Type goodsType, int userGoodsId)
	{
		Item result = null;
		if (goodsType == UserGoods.Type.Item)
		{
			result = Data.Master.ItemList.Find((Item data) => data.UserGoodsId == userGoodsId);
		}
		return result;
	}

	public static Type GetItemType(UserGoods.Type goodsType, int userGoodsId)
	{
		return GetItemData(goodsType, userGoodsId).type;
	}

	public static bool IsTicket(UserGoods.Type userGoodsType, int userGoodsId)
	{
		if (userGoodsType == UserGoods.Type.Item)
		{
			if ((uint)(userGoodsId - 1) <= 1u || (uint)(userGoodsId - 2001) <= 1u || userGoodsId == 2004)
			{
				return true;
			}
			if (userGoodsId >= 10001 && userGoodsId <= 99999)
			{
				return true;
			}
		}
		return false;
	}
}
