52 lines
1.5 KiB
C#
52 lines
1.5 KiB
C#
using Server.Git;
|
|
using System.ComponentModel.DataAnnotations;
|
|
|
|
namespace Server.SQL.Excel
|
|
{
|
|
public class ConsumableItemData
|
|
{
|
|
[Key]
|
|
public long index { get; set; }
|
|
public string name { get; set; }
|
|
public eItemType item_type { get; set; }
|
|
public int 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)
|
|
{
|
|
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 = (int)item.Value["reward"];
|
|
this.consumableItemData.Add(item.Key, consumableItemData);
|
|
}
|
|
}
|
|
}
|
|
}
|