51 lines
2.1 KiB
C#
51 lines
2.1 KiB
C#
using CodeStage.AntiCheat.ObscuredTypes;
|
||
using Newtonsoft.Json;
|
||
using System.Collections.Generic;
|
||
|
||
public class NPCConfigTableData : TableDataBase
|
||
{
|
||
ObscuredInt _NPCID; public int n_NPCID { get { return _NPCID; } set { _NPCID = value; _NPCID.RandomizeCryptoKey(); } }
|
||
public int n_NPCGrade;
|
||
public string s_NPCImg;
|
||
ObscuredInt _AppearRate; public int n_AppearRate { get { return _AppearRate; } set { _AppearRate = value; _AppearRate.RandomizeCryptoKey(); } }
|
||
ObscuredInt _BattleMonsterID; public int n_BattleMonsterID { get { return _BattleMonsterID; } set { _BattleMonsterID = value; _BattleMonsterID.RandomizeCryptoKey(); } }
|
||
public eNPCType e_NPCType;
|
||
ObscuredInt _NPCRequestItemID; public int n_NPCRequestItemID { get { return _NPCRequestItemID; } set { _NPCRequestItemID = value; _NPCRequestItemID.RandomizeCryptoKey(); } }
|
||
ObscuredInt _NPCRewardID; public int n_NPCRewardID { get { return _NPCRewardID; } set { _NPCRewardID = value; _NPCRewardID.RandomizeCryptoKey(); } }
|
||
public int n_AppearTalkID;
|
||
public int n_BattleTalkID;
|
||
public int n_LeaveTalkID;
|
||
public int n_NPCRequestItemTalkID;
|
||
public int n_NPCGiftTalkID;
|
||
public int n_NoGiftTalkID;
|
||
public int n_StealFailTalkID;
|
||
public int n_DieTalkID;
|
||
}
|
||
|
||
public class table_NPCConfig : table_base
|
||
{
|
||
public static table_NPCConfig Ins;
|
||
|
||
List<NPCConfigTableData> tableDatas;
|
||
|
||
protected override void Awake()
|
||
{
|
||
Ins = this;
|
||
base.Awake();
|
||
}
|
||
|
||
protected override void Start()
|
||
{
|
||
tableDatas = JsonConvert.DeserializeObject<List<NPCConfigTableData>>(json_last);
|
||
base.Start();
|
||
}
|
||
|
||
public List<NPCConfigTableData> Get_DataList() { return tableDatas; }
|
||
public NPCConfigTableData Get_Data(int id) { return tableDatas.Find(f => f.n_NPCID == id); }
|
||
public NPCConfigTableData Get_RandomData(int grade)
|
||
{
|
||
var list = tableDatas.FindAll(x => x.n_NPCGrade == grade);
|
||
return DSUtil.WeightedPick(list, x => x.n_AppearRate);
|
||
}
|
||
public NPCConfigTableData Get_RandomData() { return DSUtil.WeightedPick(tableDatas, x => x.n_AppearRate); }
|
||
} |