thewar_server/Server/SQL/ConsumableItemData.cs

52 lines
1.5 KiB
C#

using Server.Git;
using System.ComponentModel.DataAnnotations;
namespace Server.SQL
{
public class ConsumableItemData
{
[Key]
public long index { get; set; }
public string name { get; set; }
public eItemType item_type { get; set; }
public string reward { get; set; }
}
public enum eItemType
{
exp = 1,
package,
random
}
public class ConsumableItemDataExcel
{
private Dictionary<long, ConsumableItemData> consumableItemData;
public string sheetName = "ConsumableItemData";
public ConsumableItemData getConsumableItemData(long key)
{
return consumableItemData[key];
}
public List<ConsumableItemData> getConsumableItemData()
{
return consumableItemData.Values.ToList();
}
public void init(Sheet data)
{
this.consumableItemData = new Dictionary<long, ConsumableItemData>();
foreach (var item in data.dicViewer)
{
ConsumableItemData consumableItemData = new ConsumableItemData();
consumableItemData.index = item.Key;
consumableItemData.name = (string)item.Value["name"];
consumableItemData.item_type = (eItemType)item.Value["item_type"];
consumableItemData.reward = item.Value["reward"].ToString();
this.consumableItemData.Add(item.Key, consumableItemData);
}
}
}
}