64 lines
2.7 KiB
C#
64 lines
2.7 KiB
C#
using CodeStage.AntiCheat.ObscuredTypes;
|
|
using Newtonsoft.Json;
|
|
using System.Collections.Generic;
|
|
|
|
public class EquipmentUpgradeTableData : TableDataBase
|
|
{
|
|
ObscuredInt _EquipGrade; public int n_EquipGrade { get { return _EquipGrade; } set { _EquipGrade = value; _EquipGrade.RandomizeCryptoKey(); } }
|
|
ObscuredInt _MaxLv; public int n_MaxLv { get { return _MaxLv; } set { _MaxLv = value; _MaxLv.RandomizeCryptoKey(); } }
|
|
ObscuredInt _UpgradeGoodsID; public int n_UpgradeGoodsID { get { return _UpgradeGoodsID; } set { _UpgradeGoodsID = value; _UpgradeGoodsID.RandomizeCryptoKey(); } }
|
|
ObscuredInt _UpgradeDefaultPrice; public int n_UpgradeDefaultPrice { get { return _UpgradeDefaultPrice; } set { _UpgradeDefaultPrice = value; _UpgradeDefaultPrice.RandomizeCryptoKey(); } }
|
|
ObscuredInt _UpgradeIncreasePrice; public int n_UpgradeIncreasePrice { get { return _UpgradeIncreasePrice; } set { _UpgradeIncreasePrice = value; _UpgradeIncreasePrice.RandomizeCryptoKey(); } }
|
|
ObscuredInt _UpgradeMainStat_Mul; public int n_UpgradeMainStat_Mul { get { return _UpgradeMainStat_Mul; } set { _UpgradeMainStat_Mul = value; _UpgradeMainStat_Mul.RandomizeCryptoKey(); } }
|
|
ObscuredInt _UpgradeSubStat_Mul; public int n_UpgradeSubStat_Mul { get { return _UpgradeSubStat_Mul; } set { _UpgradeSubStat_Mul = value; _UpgradeSubStat_Mul.RandomizeCryptoKey(); } }
|
|
|
|
public int Get_UpgradePrice(int lv) { return n_UpgradeDefaultPrice + (n_UpgradeIncreasePrice * lv); }
|
|
public int Get_UpgradeAffordablePrice(int lv, int maxlv, out ObscuredInt uplv)
|
|
{
|
|
int curMoney = MyValue.sdata.Get_ItemAmount(n_UpgradeGoodsID);
|
|
int total = 0;
|
|
uplv = 0;
|
|
|
|
for (int i = lv; i < maxlv; i++)
|
|
{
|
|
int price = Get_UpgradePrice(i);
|
|
if (total + price > curMoney)
|
|
break;
|
|
|
|
++uplv; uplv.RandomizeCryptoKey();
|
|
total += price;
|
|
}
|
|
|
|
return total;
|
|
}
|
|
}
|
|
|
|
public class table_EquipmentUpgrade : table_base
|
|
{
|
|
public static table_EquipmentUpgrade Ins;
|
|
|
|
List<EquipmentUpgradeTableData> tableDatas;
|
|
Dictionary<int, EquipmentUpgradeTableData> dic_Data = new Dictionary<int, EquipmentUpgradeTableData>();
|
|
|
|
protected override void Awake()
|
|
{
|
|
Ins = this;
|
|
base.Awake();
|
|
}
|
|
|
|
protected override void Start()
|
|
{
|
|
tableDatas = JsonConvert.DeserializeObject<List<EquipmentUpgradeTableData>>(json_last);
|
|
for (int i = 0; i < tableDatas.Count; i++)
|
|
{
|
|
var temp = tableDatas[i];
|
|
|
|
dic_Data.Add(temp.n_EquipGrade, temp);
|
|
}
|
|
|
|
base.Start();
|
|
}
|
|
|
|
public List<EquipmentUpgradeTableData> Get_DataList() { return tableDatas; }
|
|
public EquipmentUpgradeTableData Get_Data(int grade) { return dic_Data[grade]; }
|
|
} |