98 lines
3.6 KiB
C#
98 lines
3.6 KiB
C#
|
|
using CodeStage.AntiCheat.ObscuredTypes;
|
||
|
|
using Newtonsoft.Json;
|
||
|
|
using System.Collections.Generic;
|
||
|
|
using UnityEngine;
|
||
|
|
|
||
|
|
public enum eMonsterType { Normal_Melee, Normal_Range, Boss_Melee, Boss_Range }
|
||
|
|
|
||
|
|
public class MonsterListTableData : ActorTableDataBase
|
||
|
|
{
|
||
|
|
ObscuredInt _RewardExp; public int n_RewardExp { get { return _RewardExp; } set { _RewardExp = value; _RewardExp.RandomizeCryptoKey(); } }
|
||
|
|
ObscuredFloat _GoldDropRate; public float f_GoldDropRate { get { return _GoldDropRate; } set { _GoldDropRate = value; _GoldDropRate.RandomizeCryptoKey(); } }
|
||
|
|
ObscuredInt _RewardGoldMin; public int n_RewardGoldMin { get { return _RewardGoldMin; } set { _RewardGoldMin = value; _RewardGoldMin.RandomizeCryptoKey(); } }
|
||
|
|
ObscuredInt _RewardGoldMax; public int n_RewardGoldMax { get { return _RewardGoldMax; } set { _RewardGoldMax = value; _RewardGoldMax.RandomizeCryptoKey(); } }
|
||
|
|
|
||
|
|
public string s_RewardGold;
|
||
|
|
public float f_Scale;
|
||
|
|
|
||
|
|
public eAttackType e_AttackType;
|
||
|
|
public eMonsterType e_MonsterType;
|
||
|
|
public override eAttackType Get_AttackType()
|
||
|
|
{
|
||
|
|
return e_AttackType;
|
||
|
|
|
||
|
|
switch (e_MonsterType)
|
||
|
|
{
|
||
|
|
case eMonsterType.Normal_Range:
|
||
|
|
case eMonsterType.Boss_Range:
|
||
|
|
return eAttackType.Range;
|
||
|
|
}
|
||
|
|
return eAttackType.Melee;
|
||
|
|
}
|
||
|
|
public override bool IsBoss()
|
||
|
|
{
|
||
|
|
return e_MonsterType == eMonsterType.Boss_Melee || e_MonsterType == eMonsterType.Boss_Range;
|
||
|
|
}
|
||
|
|
public int Get_Gold() { return Random.Range(n_RewardGoldMin, n_RewardGoldMax); }
|
||
|
|
public override string Get_ImagePath(eActorStatus actorStatus = eActorStatus.Idle) { return $"Monster/{s_Image}.png"; }
|
||
|
|
}
|
||
|
|
|
||
|
|
public class table_monsterlist : table_base
|
||
|
|
{
|
||
|
|
public static table_monsterlist Ins;
|
||
|
|
|
||
|
|
List<MonsterListTableData> tableDatas;
|
||
|
|
Dictionary<int, MonsterListTableData> dic_data = new Dictionary<int, MonsterListTableData>();
|
||
|
|
|
||
|
|
protected override void Awake()
|
||
|
|
{
|
||
|
|
Ins = this;
|
||
|
|
base.Awake();
|
||
|
|
}
|
||
|
|
|
||
|
|
protected override void Start()
|
||
|
|
{
|
||
|
|
tableDatas = JsonConvert.DeserializeObject<List<MonsterListTableData>>(json_last);
|
||
|
|
for (int i = 0; i < tableDatas.Count; i++)
|
||
|
|
{
|
||
|
|
var temp = tableDatas[i];
|
||
|
|
temp.m_Role = eRole.Mob;
|
||
|
|
temp.f_Cri *= 0.01f;
|
||
|
|
temp.f_CriDmg *= 0.01f;
|
||
|
|
temp.n_Avoid_Meele *= 0.01f;
|
||
|
|
temp.n_Avoid_Range *= 0.01f;
|
||
|
|
temp.f_GoldDropRate *= 0.01f;
|
||
|
|
var split_element = temp.s_RewardGold.Split("^");
|
||
|
|
temp.n_RewardGoldMin = int.Parse(split_element[0]);
|
||
|
|
temp.n_RewardGoldMax = int.Parse(split_element[1]);
|
||
|
|
dic_data.Add(tableDatas[i].n_ID, tableDatas[i]);
|
||
|
|
}
|
||
|
|
|
||
|
|
base.Start();
|
||
|
|
}
|
||
|
|
|
||
|
|
public List<MonsterListTableData> Get_DataList() { return tableDatas; }
|
||
|
|
public List<MonsterListTableData> Get_DataList(eAttackType attackType)
|
||
|
|
{
|
||
|
|
var rtn = new List<MonsterListTableData>();
|
||
|
|
for (int i = 0; i < Get_DataList().Count; i++)
|
||
|
|
{
|
||
|
|
var temp = Get_DataList()[i];
|
||
|
|
if (temp.Get_AttackType() == attackType)
|
||
|
|
rtn.Add(temp);
|
||
|
|
}
|
||
|
|
return rtn;
|
||
|
|
}
|
||
|
|
public List<MonsterListTableData> Get_DataList(eMonsterType mobType)
|
||
|
|
{
|
||
|
|
var rtn = new List<MonsterListTableData>();
|
||
|
|
for (int i = 0; i < Get_DataList().Count; i++)
|
||
|
|
{
|
||
|
|
var temp = Get_DataList()[i];
|
||
|
|
if (temp.e_MonsterType == mobType)
|
||
|
|
rtn.Add(temp);
|
||
|
|
}
|
||
|
|
return rtn;
|
||
|
|
}
|
||
|
|
public MonsterListTableData Get_Data_orNull(int id) { return dic_data.ContainsKey(id) ? dic_data[id]: null; }
|
||
|
|
}
|