using CodeStage.AntiCheat.ObscuredTypes; using Newtonsoft.Json; using System; using System.Collections.Generic; [Serializable] public class RandomBagTableData : TableDataBase { ObscuredInt _DropIndex; public int n_DropIndex { get { return _DropIndex; } set { _DropIndex = value; _DropIndex.RandomizeCryptoKey(); } } // 랜덤백 고유 ID ObscuredInt _ItemGrade; public int n_ItemGrade { get { return _ItemGrade; } set { _ItemGrade = value; _ItemGrade.RandomizeCryptoKey(); } } // 아이템 등급 ObscuredInt _ItemId; public int n_ItemId { get { return _ItemId; } set { _ItemId = value; _ItemId.RandomizeCryptoKey(); } } // 드랍 타입 별 ID ObscuredFloat _DropRate; public float f_DropRate { get { return _DropRate; } set { _DropRate = value; _DropRate.RandomizeCryptoKey(); } } // 드랍 확률 ObscuredInt _DropCount; public int n_DropCount { get { return _DropCount; } set { _DropCount = value; _DropCount.RandomizeCryptoKey(); } } // 드랍 수량 } public class table_randombag : table_missionbase { public static table_randombag Ins; List tableDatas; Dictionary<(int, int), List> dic_RateData = new Dictionary<(int, int), List>(); Dictionary<(int, int), List> dic_ItemData = new Dictionary<(int, int), List>(); Dictionary> dic_ItemList = new Dictionary>(); protected override void Awake() { base.Awake(); Ins = this; } protected override void Start() { tableDatas = JsonConvert.DeserializeObject>(json_last); for (int i = 0; i < Get_DataList().Count; i++) { var temp = Get_DataList()[i]; if (!dic_RateData.ContainsKey((temp.n_DropIndex, temp.n_ItemGrade))) dic_RateData.Add((temp.n_DropIndex, temp.n_ItemGrade), new List()); dic_RateData[(temp.n_DropIndex, temp.n_ItemGrade)].Add(temp.f_DropRate); if (!dic_ItemData.ContainsKey((temp.n_DropIndex, temp.n_ItemGrade))) dic_ItemData.Add((temp.n_DropIndex, temp.n_ItemGrade), new List()); dic_ItemData[(temp.n_DropIndex, temp.n_ItemGrade)].Add(new ItemSimpleData { itemid = temp.n_ItemId, amount = temp.n_DropCount }); if (!dic_ItemList.ContainsKey(temp.n_DropIndex)) dic_ItemList.Add(temp.n_DropIndex, new List()); dic_ItemList[temp.n_DropIndex].Add(temp); } base.Start(); } public ItemSimpleData Get_RandomItemData(int index, int grade) { var itemindex = DSUtil.Get_RandomIndex(Get_Rate(index, grade)); return dic_ItemData[(index, grade)][itemindex]; } public List Get_Rate(int index, int grade) { return dic_RateData[(index, grade)]; } public RandomBagTableData Get_Data(int itemid) { return Get_DataList().Find(f => f.n_ItemId == itemid); } public List Get_DataList() { return tableDatas; } public List Get_DataList(int id) { return dic_ItemList[id]; } }