Project_WL/Assets/Script/Server/ServerClass.cs

2900 lines
98 KiB
C#
Raw Normal View History

2024-12-15 01:39:39 +00:00
using System;
using System.Collections.Generic;
using System.Linq;
2025-03-17 23:31:46 +00:00
using System.Security.Cryptography;
2024-12-22 01:07:25 +00:00
using CodeStage.AntiCheat.ObscuredTypes;
2024-12-15 01:39:39 +00:00
using UnityEngine;
#region
[Serializable]
public class SC_ServerStatus
{
public int ContentsLock;
public string URL_ChatServer, URL_LogServer, URL_CouponServer, HotTime;
public DateTime HotTimeStart, HotTimeEnd;
}
[Serializable]
public class SC_Version
{
public string Version, VersionStatus;
}
#endregion
#region
public class SC_Mail { public List<ServerMailData> Mail; }
[Serializable]
public class ServerMailData
{
public string Msg, Reward, RemainTime;
public double RewardAmount;
public int ID, IsShopItem;
public eItem Item;
public DateTime RemnantTime;
}
#endregion
public class SC_MyError { public int error; }
public class SC_MyResult { public int result; }
public partial class ServerData
{
public DateTime LastTime;
public List<ObscuredInt> Common;
2024-12-15 01:39:39 +00:00
public Dictionary<string, Dictionary<string, SD_MapData>> MapData; // <맵ID, <난이도, 데이터>>
public SD_Buff Buff;
public SD_Equip Equip;
/// <summary>
/// { ID, 0 갯수, 1 제련 레벨, 2 제련 시도 횟수(성공 시 초기화) }
/// </summary>
public Dictionary<string, List<ObscuredDouble>> Equipment = new Dictionary<string, List<ObscuredDouble>>();
public List<SD_Slot> Slot;
/// <summary>
/// { ID, 0 갯수, 1 총 획득량, 2 총 사용량 }
/// </summary>
public Dictionary<string, List<ObscuredDouble>> Item = new Dictionary<string, List<ObscuredDouble>>();
/// <summary>
/// { ID, 0 갯수, 1 레벨, 2 총 획득량, 3 총 사용량 }
/// </summary>
public Dictionary<string, List<ObscuredDouble>> Enchant = new Dictionary<string, List<ObscuredDouble>>();
/// <summary>
/// { ID, 0 레벨, 1 각성 }
/// </summary>
public Dictionary<string, List<ObscuredInt>> Skill = new Dictionary<string, List<ObscuredInt>>();
public Dictionary<string, ObscuredInt> Ability = new Dictionary<string, ObscuredInt>();
public SD_PC PC;
public Dictionary<string, SD_PCAwakenData> Awaken;
public Dictionary<string, List<SD_PCLimitSlotData>> LimitSlot;
/// <summary>
/// { ID, 0 갯수, 1 레벨 }
/// </summary>
public Dictionary<string, List<ObscuredInt>> Pet = new Dictionary<string, List<ObscuredInt>>();
/// <summary>
/// { ID, 0 갯수, 1 레벨, 2 별 }
/// </summary>
public Dictionary<string, List<ObscuredInt>> Relic = new Dictionary<string, List<ObscuredInt>>();
public Dictionary<string, ObscuredInt> Collection = new Dictionary<string, ObscuredInt>(); // collectionlist n_TargetValue, lv
public Dictionary<string, ObscuredDouble> MobKill = new Dictionary<string, ObscuredDouble>(); // 몬스터 id, 처치 수
public SD_Farm Farm;
/// <summary>
2025-01-23 20:50:53 +00:00
/// { 던전타입, 0 Lv, 1 소탕값1, 2 소탕값2, 3 소탕값3 }
/// </summary>
public Dictionary<string, List<ObscuredInt>> Dungeon = new Dictionary<string, List<ObscuredInt>>();
2025-03-17 07:34:17 +00:00
/// <summary>
2025-03-17 23:31:46 +00:00
/// { 미션그룹, { 미션 Index, 0 미션 레벨, 1 미션 카운트 } }
2025-03-17 07:34:17 +00:00
/// </summary>
public Dictionary<string, Dictionary<string, List<ObscuredInt>>> Mission = new Dictionary<string, Dictionary<string, List<ObscuredInt>>>();
2024-12-15 01:39:39 +00:00
public List<ServerData_Book> Book;
public List<ServerData_ChapterQuest> ChapterQuest;
public List<List<ObscuredInt>> Title, Pass;
public Dictionary<string, ObscuredInt> Inven = new Dictionary<string, ObscuredInt>(); // ID, 개수
public Dictionary<string, List<ObscuredInt>> Shop, Potion;
public Dictionary<string, ObscuredInt> Event;
//public Dictionary<string, List<List<double>>> TotalAdd = new Dictionary<string, List<List<double>>> (); // 아이템, 0 ID, 1 획득개수
//public Dictionary<string, List<List<double>>> TotalUse = new Dictionary<string, List<List<double>>> (); // 아이템, 0 ID, 1 획득개수
// 서버에 저장되지 않는 값
public ObscuredBool IsEnemy;
public ServerData()
{ // 신규 유저 데이터
LastTime = ServerInfo.ServerTime;
MapData = new Dictionary<string, Dictionary<string, SD_MapData>>();
var mapdatas = table_battlemapdifficulty.Ins.Get_DataList();
for (int i = 0; i < mapdatas.Count; i++)
{
if (mapdatas[i].n_MapID > 0 && mapdatas[i].n_MapID < 1001)
{
var key1 = Get_Key(mapdatas[i].n_MapID);
var key2 = Get_Key(MyEnumToInt.Ins.Get_Int(mapdatas[i].e_Difficult));
2024-12-15 01:39:39 +00:00
if (!MapData.ContainsKey(key1))
MapData.Add(key1, new Dictionary<string, SD_MapData>());
2024-12-15 01:39:39 +00:00
if (!MapData[key1].ContainsKey(key2))
MapData[key1].Add(key2, new SD_MapData { Stat = new List<ObscuredInt> { 0, 0, 0 } });
}
2024-12-15 01:39:39 +00:00
}
Buff = new SD_Buff { Time = new List<ObscuredInt> { 0, 0, 0 } };
var enchantlst = table_enchanlist.Ins.Get_DataList();
for (int i = 0; i < enchantlst.Count; i++)
Enchant.Add(Get_Key(enchantlst[i].n_EnchantID), new List<ObscuredDouble> { 0, 1, 0, 0 });
Equip = new SD_Equip();
Equip.Init_NewUser(equipskills =>
{
for (int i = 0; i < equipskills.Count; i++)
if (equipskills[i] > 0)
Add_SkillLv(equipskills[i]);
});
PC = new SD_PC();
Awaken = new Dictionary<string, SD_PCAwakenData> { { "STR", new SD_PCAwakenData() }, { "DEX", new SD_PCAwakenData() },
{ "INT", new SD_PCAwakenData() }, { "LUK", new SD_PCAwakenData() } };
LimitSlot = new Dictionary<string, List<SD_PCLimitSlotData>> { { "1", new List<SD_PCLimitSlotData>() },
{ "2", new List<SD_PCLimitSlotData>() }, { "3", new List<SD_PCLimitSlotData>() } };
foreach (var item in LimitSlot) for (int i = 0; i < 6; i++) item.Value.Add(new SD_PCLimitSlotData { ID = 0, Lock = 0 });
Farm = new SD_Farm();
Add_Item(table_GlobalValue.Ins.Get_Int("n_FirstClassID"), 1);
2024-12-23 01:05:19 +00:00
Add_Item(table_GlobalValue.Ins.Get_Int("n_FirstEquipPet"), 1);
2024-12-15 01:39:39 +00:00
// TODO 정인호 : 테스트 지급
Equip.Set_Equip(eItem.Skill, 703304, 0);
Equip.Set_Equip(eItem.Skill, 702005, 1);
Equip.Set_Equip(eItem.Skill, 702010, 2);
Equip.Set_Equip(eItem.Skill, 702012, 3);
Equip.Set_Equip(eItem.Skill, 702008, 4);
Equip.Set_Equip(eItem.Skill, 703502, 5);
2024-12-31 06:30:12 +00:00
Add_Item(110001, 1);
Add_Item(110002, 1);
Add_Item(110003, 1);
2024-12-15 01:39:39 +00:00
Add_Item(1, 10000);
Add_Item(101, 10000);
Add_Item(10001, 1000);
Add_Item(201, 10000);
Add_Item(202, 10000);
Add_Item(333, 10000);
Add_Item(445, 2);
Add_Item(450, 2000);
Add_Item(451, 100);
Add_Item(452, 100);
Add_Item(453, 100);
Add_Item(454, 100);
Add_Item(461, 10000);
Add_Item(50001, 5);
Add_Item(50002, 5);
Add_Item(441, 50000);
Add_Item(2000001, 11);
Add_Item(2000002, 12);
Add_Item(2000003, 13);
Add_Item(2000004, 14);
Add_Item(2000005, 15);
Add_Item(2000006, 16);
Add_Item(456, 16);
//Add_SkillAwakenLv(700003);
//Add_SkillAwakenLv(700003);
//Add_SkillAwakenLv(700003);
///////////////////////////
Slot = new List<SD_Slot>();
foreach (var item in MyValue.dic_EquipmentKey)
Slot.Add(new SD_Slot
{
Parts = item.Key,
Lv = 0,
Use = 0,
Enchant = new List<SD_Slot_Enchant> { new SD_Slot_Enchant(), new SD_Slot_Enchant(), new SD_Slot_Enchant(), new SD_Slot_Enchant(), }
});
Add_SkillLv(1); // 최초 스킬 하나 지급
Common = new List<ObscuredInt>(); for (eCommon i = 0; i < eCommon.Max; i++) Common.Add(0);
Set_Common(eCommon.Title, 1);
Book = new List<ServerData_Book>();
var booktabledata = table_book.Ins.Get_DataList();
for (int i = 0; i < booktabledata.Count; i++)
{
var booksdata = new ServerData_Book();
booksdata.Init(booktabledata[i].ID);
Book.Add(booksdata);
}
ChapterQuest = new List<ServerData_ChapterQuest>();
var chapterdatas = table_chaptertext.Ins.Get_DataList();
for (int i = 0; i < chapterdatas.Count; i++)
{
var cqdata = new ServerData_ChapterQuest();
cqdata.Init(chapterdatas[i].ID);
ChapterQuest.Add(cqdata);
}
var titledata = table_title.Ins.Get_DataList();
Title = new List<List<ObscuredInt>>();
for (int i = 0; i < titledata.Count; i++) // 최초 새싹 칭호 지급, 최초 애기 집사 칭호 지급
Title.Add(new List<ObscuredInt> { titledata[i].ID, titledata[i].ID == 1 || titledata[i].ID == 94 ? 1 : 0, 0, 0 }); // 0 ID, 1 획득 여부, 2 카운트, 3 젬 획득 여부
var passdata = table_pass.Ins.Get_PassTypes();
Pass = new List<List<ObscuredInt>>();
foreach (var item in passdata)
Pass.Add(new List<ObscuredInt> { item.Key, 0, 0, 0, 0 }); // 0 PassType, 1 패스 구매 상태, 2 획득 무료 스텝, 3 획득 패스 스텝, 4 출석 DoY
Shop = new Dictionary<string, List<ObscuredInt>>();
var shopdata = table_shop.Ins.Get_DataList();
for (int i = 0; i < shopdata.Count; i++)
Shop.Add(shopdata[i].ID.ToString(), new List<ObscuredInt>() { 0, 0, 0, 0, 0 }); // 0 광고 쿨타임, 1 총 구매횟수, 2 일일 구매, 3 주간 구매, 4 월간 구매
Potion = new Dictionary<string, List<ObscuredInt>>();
var potionTdata = table_kettle.Ins.Get_DataList(eItem.Potion);
for (int i = 0; i < potionTdata.Count; i++)
Potion.Add(potionTdata[i].ID.ToString(), new List<ObscuredInt>() { 0, 0 }); // 0 개수, 1 효과 남은 시간
}
public ServerData_Read Get_ServerRead()
{ // 서버로 보내는 저장 데이터
ServerData_Read temp = new ServerData_Read();
temp.LastTime = LastTime.ToString("yyyyMMddHHmmss");
temp.MapData = new Dictionary<string, Dictionary<string, SD_MapData_Read>>();
foreach (var item in MapData)
{
temp.MapData.Add(item.Key, new Dictionary<string, SD_MapData_Read>());
foreach (var item2 in item.Value)
temp.MapData[item.Key].Add(item2.Key, item2.Value.Get());
}
temp.Buff = Buff.Get();
temp.Skill = DSUtil.Get_T_Dic(Skill);
temp.Equip = Equip.Get();
temp.Equipment = DSUtil.Get_T_Dic(Equipment);
temp.Slot = new List<SD_Slot_Read>();
for (int i = 0; i < Slot.Count; i++)
temp.Slot.Add(Slot[i].Get());
temp.Item = DSUtil.Get_T_Dic(Item);
temp.Enchant = DSUtil.Get_T_Dic(Enchant);
temp.Ability = DSUtil.Get_T_Dic(Ability);
temp.PC = PC.Get();
temp.Awaken = new Dictionary<string, SD_PCAwakenData_Read>();
foreach (var item in Awaken) temp.Awaken.Add(item.Key, item.Value.Get());
temp.LimitSlot = new Dictionary<string, List<SD_PCLimitSlotData_Read>>();
foreach (var item in LimitSlot)
{
temp.LimitSlot.Add(item.Key, new List<SD_PCLimitSlotData_Read>());
for (int i = 0; i < item.Value.Count; i++)
temp.LimitSlot[item.Key].Add(item.Value[i].Get());
}
temp.Pet = DSUtil.Get_T_Dic(Pet);
temp.Relic = DSUtil.Get_T_Dic(Relic);
temp.Collection = DSUtil.Get_T_Dic(Collection);
temp.MobKill = DSUtil.Get_T_Dic(MobKill);
temp.Farm = Farm.Get();
temp.Dungeon = DSUtil.Get_T_Dic(Dungeon);
2025-03-17 07:34:17 +00:00
temp.Mission = DSUtil.Get_T_Dic(Mission);
2024-12-15 01:39:39 +00:00
temp.Common = DSUtil.Get_T_List(Common);
temp.Book = new List<ServerData_Book_Read>();
for (int i = 0; i < Book.Count; i++)
temp.Book.Add(Book[i].Get());
temp.ChapterQuest = new List<ServerData_ChapterQuest_Read>();
for (int i = 0; i < ChapterQuest.Count; i++)
temp.ChapterQuest.Add(ChapterQuest[i].Get());
temp.Title = DSUtil.Get_T_List(Title);
temp.Pass = DSUtil.Get_T_List(Pass);
foreach (var item in Inven)
temp.Inven.Add(item.Key, item.Value);
temp.Shop = DSUtil.Get_T_Dic(Shop);
temp.Potion = DSUtil.Get_T_Dic(Potion);
if (Event != null) temp.Event = DSUtil.Get_T_Dic(Event);
//temp.TotalAdd = TotalAdd;
//temp.TotalUse = TotalUse;
return temp;
}
}
[Serializable]
public class ServerData_Read
{
public string LastTime;
public Dictionary<string, Dictionary<string, SD_MapData_Read>> MapData; // <맵ID, <난이도, 데이터>>
public SD_Buff_Read Buff;
public SD_Equip_Read Equip;
public Dictionary<string, List<double>> Equipment, Item, Enchant;
public List<SD_Slot_Read> Slot;
public Dictionary<string, List<int>> Skill;
public Dictionary<string, int> Ability;
public SD_PC_Read PC;
public Dictionary<string, SD_PCAwakenData_Read> Awaken;
public Dictionary<string, List<SD_PCLimitSlotData_Read>> LimitSlot;
public Dictionary<string, List<int>> Pet, Relic, Dungeon;
2024-12-15 01:39:39 +00:00
public Dictionary<string, int> Collection;
public Dictionary<string, double> MobKill;
public SD_Farm_Read Farm;
2025-03-17 07:34:17 +00:00
public Dictionary<string, Dictionary<string, List<int>>> Mission = new Dictionary<string, Dictionary<string, List<int>>>();
2024-12-15 01:39:39 +00:00
public List<ServerData_Book_Read> Book;
public List<ServerData_ChapterQuest_Read> ChapterQuest;
public List<int> Common;
public List<double> Money;
2024-12-15 01:39:39 +00:00
public List<List<int>> Title, Pass;
public Dictionary<string, int> Inven = new Dictionary<string, int>();
public Dictionary<string, List<int>> Shop, Potion;
public Dictionary<string, int> Event;
public Dictionary<string, List<List<double>>> TotalAdd = new Dictionary<string, List<List<double>>>(); // 아이템, 0 ID, 1 획득개수
public Dictionary<string, List<List<double>>> TotalUse = new Dictionary<string, List<List<double>>>(); // 아이템, 0 ID, 1 획득개수
public ServerData Get_ServerData(bool _isEnemy)
{ // 서버 데이터 로드
ServerData temp = new ServerData();
temp.IsEnemy = _isEnemy;
temp.LastTime = DateTime.ParseExact(LastTime, "yyyyMMddHHmmss", new System.Globalization.CultureInfo("en-US"));
temp.MapData = new Dictionary<string, Dictionary<string, SD_MapData>>();
foreach (var item in MapData)
{
temp.MapData.Add(item.Key, new Dictionary<string, SD_MapData>());
foreach (var item2 in item.Value)
temp.MapData[item.Key].Add(item2.Key, item2.Value.Get());
}
temp.Buff = Buff.Get();
temp.Skill = DSUtil.Get_T_Dic(Skill);
temp.Equip = Equip.Get();
temp.Equipment = DSUtil.Get_T_Dic(Equipment);
temp.Slot = new List<SD_Slot>();
for (int i = 0; i < Slot.Count; i++)
temp.Slot.Add(Slot[i].Get());
temp.Item = DSUtil.Get_T_Dic(Item);
temp.Enchant = DSUtil.Get_T_Dic(Enchant);
temp.Ability = DSUtil.Get_T_Dic(Ability);
temp.PC = PC.Get();
temp.Awaken = new Dictionary<string, SD_PCAwakenData>();
foreach (var item in Awaken) temp.Awaken.Add(item.Key, item.Value.Get());
temp.LimitSlot = new Dictionary<string, List<SD_PCLimitSlotData>>();
foreach (var item in LimitSlot)
{
temp.LimitSlot.Add(item.Key, new List<SD_PCLimitSlotData>());
for (int i = 0; i < item.Value.Count; i++)
temp.LimitSlot[item.Key].Add(item.Value[i].Get());
}
temp.Pet = DSUtil.Get_T_Dic(Pet);
temp.Relic = DSUtil.Get_T_Dic(Relic);
temp.Collection = DSUtil.Get_T_Dic(Collection);
temp.MobKill = DSUtil.Get_T_Dic(MobKill);
temp.Farm = Farm.Get();
temp.Dungeon = DSUtil.Get_T_Dic(Dungeon);
2025-03-17 07:34:17 +00:00
temp.Mission = DSUtil.Get_T_Dic(Mission);
2024-12-15 01:39:39 +00:00
temp.Common = DSUtil.Get_T_List(Common);
temp.Book = new List<ServerData_Book>();
for (int i = 0; i < Book.Count; i++)
temp.Book.Add(Book[i].Get());
temp.ChapterQuest = new List<ServerData_ChapterQuest>();
for (int i = 0; i < ChapterQuest.Count; i++)
temp.ChapterQuest.Add(ChapterQuest[i].Get());
temp.Title = DSUtil.Get_T_List(Title);
temp.Pass = DSUtil.Get_T_List(Pass);
foreach (var item in Inven)
temp.Inven.Add(item.Key, item.Value);
temp.Shop = DSUtil.Get_T_Dic(Shop);
temp.Potion = DSUtil.Get_T_Dic(Potion);
if (Event != null) temp.Event = DSUtil.Get_T_Dic(Event);
//temp.TotalAdd = TotalAdd;
//temp.TotalUse = TotalUse;
#region
var mapdatas = table_battlemapdifficulty.Ins.Get_DataList();
for (int i = 0; i < mapdatas.Count; i++)
{
var key1 = mapdatas[i].n_MapID.ToString();
var key2 = MyEnumToInt.Ins.Get_Int(mapdatas[i].e_Difficult).ToString();
if (!temp.MapData.ContainsKey(key1))
temp.MapData.Add(key1, new Dictionary<string, SD_MapData>());
if (!temp.MapData[key1].ContainsKey(key2))
temp.MapData[key1].Add(key2, new SD_MapData { Stat = new List<ObscuredInt> { 0, 0, 0 } });
}
DataCheck(Common, temp.Common, (int)eCommon.Max);
#endregion
return temp;
}
public void DataCheck(List<int> read, List<ObscuredInt> sdata, int max)
{
if (read.Count < max)
{
int diff = max - read.Count;
for (int i = 0; i < diff; i++)
sdata.Add(0);
}
}
}
public partial class ServerData
{
Dictionary<int, string> dic_Key = new Dictionary<int, string>();
string Get_Key(int itemid)
{
if (!dic_Key.ContainsKey(itemid))
dic_Key.Add(itemid, itemid.ToString());
return dic_Key[itemid];
}
#region MapData
public bool MapData_isClearChaper(int mapid, int diff)
{
var key1 = Get_Key(mapid);
var key2 = Get_Key(diff);
if (MapData.ContainsKey(key1) && MapData[key1].ContainsKey(key2))
return MapData[key1][key2].isClear();
return false;
}
public void MapData_SetClearChapter(int mapid, int diff)
{
var key1 = Get_Key(mapid);
var key2 = Get_Key(diff);
if (MapData.ContainsKey(key1) && MapData[key1].ContainsKey(key2))
{
MapData[key1][key2].Clear = 1;
MapData[key1][key2].Clear.RandomizeCryptoKey();
}
}
2024-12-15 01:39:39 +00:00
public ObscuredInt MapData_Get_StatLv(int mapid, int diff, eMainStatType stat)
{
var key1 = Get_Key(mapid);
var key2 = Get_Key(diff);
if (MapData.ContainsKey(key1) && MapData[key1].ContainsKey(key2))
return MapData[key1][key2].Get_Stat(stat);
return 0;
}
public List<ObscuredInt> MapData_Get_StatLvs(int mapid, int diff)
{
var key1 = Get_Key(mapid);
var key2 = Get_Key(diff);
if (MapData.ContainsKey(key1) && MapData[key1].ContainsKey(key2))
return MapData[key1][key2].Get_Stats();
return new List<ObscuredInt> { 0, 0, 0 };
}
public void MapData_Add_StatLv(int mapid, int diff, eMainStatType stat, int addlv = 1)
{
var key1 = Get_Key(mapid);
var key2 = Get_Key(diff);
if (MapData.ContainsKey(key1) && MapData[key1].ContainsKey(key2))
MapData[key1][key2].Add_Stat(stat, addlv);
}
#endregion
#region
public int Get_EquipSkillID(int _slot) { return Equip.Skill[Equip.Preset][_slot]; }
public bool IsEquipSkill(int skillid, int preset = 0)
{
if (preset == 0) preset = Equip.Preset;
var lst = Equip.Skill[preset];
for (int i = 0; i < lst.Count; i++)
if (lst[i] > 0 && lst[i] == skillid)
return true;
return false;
}
public int Get_SkillLv(eRole role, int id)
{
return role == eRole.PC || role == eRole.EnemyPC ? Get_SkillLv(id) : Get_PetLv(id);
}
int Get_SkillLv(int _skillid)
{
var key = Get_Key(_skillid);
return Skill.ContainsKey(key) ? Skill[key][0] : 0;
}
public int Get_SkillAwakenLv(int _skillid)
{
var key = Get_Key(_skillid);
return Skill.ContainsKey(key) ? Skill[key][1] : 0;
}
public int Get_PetSkillAwakenLv(int petid)
{
var petlv = Get_PetLv(petid);
if (petlv >= table_GlobalValue.Ins.Get_Int("n_PetSkillAwaken_Lv3"))
return 3;
else if (petlv >= table_GlobalValue.Ins.Get_Int("n_PetSkillAwaken_Lv2"))
return 2;
else if (petlv >= table_GlobalValue.Ins.Get_Int("n_PetSkillAwaken_Lv1"))
return 1;
return 0;
}
public void Add_SkillLv(int _skillid, int _lv = 1)
{
var key = Get_Key(_skillid);
if (!Skill.ContainsKey(key))
Skill.Add(key, new List<ObscuredInt> { 0, 0 });
Skill[key][0] += _lv;
Skill[key][0].RandomizeCryptoKey();
}
public void Add_SkillAwakenLv(int _skillid)
{
var key = Get_Key(_skillid);
if (!Skill.ContainsKey(key))
Skill.Add(key, new List<ObscuredInt> { 0, 0 });
++Skill[key][1];
Skill[key][1].RandomizeCryptoKey();
}
#endregion
#region (, , , , , )
public int Get_EqiupmentEquip(eItem _item) { return Equip.Equip[_item]; }
public int Get_SmeltingLv(int id)
{
var key = Get_Key(id);
if (Equipment.ContainsKey(key))
return (int)Equipment[key][1];
return 0;
}
public void Try_SmeltingLvUp(EquipmentSmeltingTableData Tdata, int id, Action<bool> refresh)
{
var lv = Get_SmeltingLv(id);
var limitdata = table_breakinglimit.Ins.Get_Data_orNull(Get_LimitLv());
if (lv < limitdata.n_Equip_Upgrade_Limit)
{
if (Check_ItemAmount(id, Tdata.n_UpgradePrice))
{
var key = Get_Key(id);
Use_Item(id, Tdata.n_UpgradePrice);
if (DSUtil.RandomTrue(Tdata.f_NextStepRate * 0.01))
{
++Equipment[key][1];
Equipment[key][1].RandomizeCryptoKey();
Equipment[key][2] = 0;
refresh(true);
MyValue.Get_ActorStatInfoorNull(eRole.PC);
}
else
{
Equipment[key][2]++;
Equipment[key][2].RandomizeCryptoKey();
refresh(false);
}
}
}
else
ToastUI.Ins.Set(266);
}
public int Get_EquipmentTLv(eItem _type, int _id)
{
var key = MyValue.dic_EquipmentKey[_type];
//return Equipment[_type.ToString()].Find(f => f[0] == _id)[2];
return 0;
}
public void Add_EquipmentTLv(eItem item, int id, int lv = 1)
{
var key = MyValue.dic_EquipmentKey[item];
//var data = Equipment[item.ToString()].Find(f => f[0] == id);
//data[2] += lv;
//data[2].RandomizeCryptoKey();
}
public bool IsEquip(eItem _type, int _id) { return Get_EqiupmentEquip(_type) == _id; }
public SD_Slot Get_SlotData(eItem parts) { return Slot.Find(f => f.Parts == parts); }
public void Add_SlotLv(eItem parts, double useAmount, int addlv = 1)
{
var slot = Get_SlotData(parts);
if (!DSUtil.CheckNull(slot))
{
slot.Use += useAmount;
slot.Use.RandomizeCryptoKey();
slot.Lv += addlv;
slot.Lv.RandomizeCryptoKey();
}
}
public void Init_SlotLv(eItem parts, int itemid)
{
// TODO 정인호 : slot.Use 값만큼 재료 돌려주기
var slot = Get_SlotData(parts);
if (!DSUtil.CheckNull(slot))
{
Add_Item(itemid, slot.Use);
ToastUI.Ins.Set(174, $"초기화하여 {itemid} 아이템 {slot.Use}개를 획득");
slot.Use = 0;
slot.Use.RandomizeCryptoKey();
slot.Lv = 0;
slot.Lv.RandomizeCryptoKey();
}
}
public void Set_SlotEnchant(eItem parts, int index, int optionid, int lv)
{
var slot = Get_SlotData(parts);
if (!DSUtil.CheckNull(slot))
{
slot.Enchant[index].ID = optionid;
slot.Enchant[index].ID.RandomizeCryptoKey();
slot.Enchant[index].Lv = lv;
slot.Enchant[index].Lv.RandomizeCryptoKey();
// TODO 정인호 : RND_SKILL 의 경우 스킬 ID를 지정해야한다.
}
}
#endregion
#region
public double Get_EnchantAmount(int id)
{
var key = Get_Key(id);
return Enchant.ContainsKey(key) ? Enchant[key][0] : 0;
}
public int Get_EnchantLv(int id)
{
var key = Get_Key(id);
return Enchant.ContainsKey(key) ? (int)Enchant[Get_Key(id)][1] : 0;
}
public void Add_EnchantLv(int id, int addlv = 1)
{
var key = Get_Key(id);
if (Enchant.ContainsKey(key))
{
++Enchant[Get_Key(id)][1];
Enchant[Get_Key(id)][1].RandomizeCryptoKey();
}
}
#endregion
#region
public void Init_Ability(eBattleType battleType)
{
var lst = table_abilityconfig.Ins.Get_DataList(battleType);
var moneyid = table_GlobalValue.Ins.Get_Int("n_AbilityMaterialID");
for (int i = 0; i < lst.Count; i++)
{
var key = Get_Key(lst[i].n_AbilityID);
if (Ability.ContainsKey(key))
{
Add_Item(moneyid, Ability[key]);
Ability[key] = 0;
Ability[key].RandomizeCryptoKey();
}
}
}
public int Get_AbilityLv(int id)
{
var key = Get_Key(id);
if (Ability.ContainsKey(key)) return Ability[key];
return 0;
}
public void Add_AbilityLv(int id, int lv = 1)
{
var key = Get_Key(id);
if (!Ability.ContainsKey(key))
Ability.Add(key, 0);
++Ability[key];
Ability[key].RandomizeCryptoKey();
}
public int Get_ObtainAbility(List<AbilityConfigTableData> lst)
{
int count = 0;
for (int i = 0; i < lst.Count; i++)
{
if (Get_AbilityLv(lst[i].n_AbilityID) > 0)
++count;
}
return count;
}
#endregion
#region
public int Get_AwakenLv(eStat stat) { return Awaken[stat.ToString()].Lv; }
public void Add_AwakenLv(eStat stat)
{
var key = stat.ToString();
++Awaken[key].Lv;
Awaken[key].Lv.RandomizeCryptoKey();
Awaken[key].Exp = 0;
Awaken[key].Exp.RandomizeCryptoKey();
}
public int Get_AwakenExp(eStat stat) { return Awaken[stat.ToString()].Exp; }
public void Add_AwakenExp(eStat stat)
{
var key = stat.ToString();
++Awaken[key].Exp;
Awaken[key].Exp.RandomizeCryptoKey();
}
public int Get_AwakenNow(eStat stat) { return Get_AwakenExp(stat) % 4; }
int Get_AwakenCurStepSlotLv(eStat stat, int updradeOrder, int exp)
{
var slotlv = (exp / 4) + 1 - (4 - updradeOrder);
if (exp < updradeOrder) slotlv = 0; // 요구 조건을 만족하지 못하면 lv 0
else slotlv = (exp - updradeOrder) / 4 + 1;
return slotlv;
}
public int Get_AwakenSlotLv(eStat stat, int updradeOrder)
{
int slotlv = 0;
var lv = Get_AwakenLv(stat);
for (int i = 0; i < lv; i++)
{
var upgradedata = table_awakenupgrade.Ins.Get_Data_orNull(i + 1);
var templv = lv - 1 == i ? Get_AwakenCurStepSlotLv(stat, updradeOrder, Get_AwakenExp(stat)) :
Get_AwakenCurStepSlotLv(stat, updradeOrder, upgradedata.n_MaxUpgradeLevel);
slotlv += templv;
}
return slotlv;
}
#endregion
#region ()
public int Get_LimitLv() { return PC.LLv; }
public void Add_LimitLv()
{
++PC.LLv;
PC.LLv.RandomizeCryptoKey();
Add_MissionCount(ePurpose.HERO_TRANSCENDENCE_ACC);
}
2024-12-15 01:39:39 +00:00
public List<SD_PCLimitSlotData> Get_LimitSlot(string preset) { return LimitSlot[preset]; }
public void Set_LimitSlotID(string preset, int slot, int id, int lv)
{
var lst = Get_LimitSlot(preset);
var index = slot - 1;
if (lst[index].Lock == 0)
{
lst[index].ID = id;
lst[index].ID.RandomizeCryptoKey();
lst[index].Lv = lv;
lst[index].Lv.RandomizeCryptoKey();
}
}
public void Set_LimitSlotLock(string preset, int slot)
{
var lst = Get_LimitSlot(preset);
var index = slot - 1;
lst[index].Lock = lst[index].Lock == 0 ? 1 : 0;
lst[index].Lock.RandomizeCryptoKey();
}
#endregion
#region
public int Get_PetLv(int _petid)
{
var key = Get_Key(_petid);
return Pet.ContainsKey(key) ? Pet[key][1] : 0;
}
public void Add_PetLv(int _petid, int _addlv = 1)
{
var key = Get_Key(_petid);
if (Pet.ContainsKey(key))
{
Pet[key][1] += _addlv;
Pet[key][1].RandomizeCryptoKey();
}
}
#endregion
#region
public int Get_RelicLv(int id)
{
var key = Get_Key(id);
if (Relic.ContainsKey(key))
return Relic[key][1];
return 0;
}
public void Add_RelicLv(int id)
{
var key = Get_Key(id);
if (!Relic.ContainsKey(key))
Relic.Add(key, new List<ObscuredInt> { 0, 0, 0 });
++Relic[key][1];
Relic[key][1].RandomizeCryptoKey();
}
public int Get_RelicStar(int id)
{
var key = Get_Key(id);
if (Relic.ContainsKey(key))
return Relic[key][2];
return 0;
}
public void Add_RelicStar(int id)
{
var key = Get_Key(id);
if (!Relic.ContainsKey(key))
Relic.Add(key, new List<ObscuredInt> { 0, 0, 0 });
++Relic[key][2];
Relic[key][2].RandomizeCryptoKey();
}
#endregion
#region ,
public int Get_CollectionLv(int id)
{
var key = Get_Key(id);
if (Collection.ContainsKey(key))
return Collection[key];
return 0;
}
public void Add_CollectionLv(int id)
{
var key = Get_Key(id);
if (!Collection.ContainsKey(key))
Collection.Add(key, 0);
++Collection[key];
Collection[key].RandomizeCryptoKey();
}
public double Get_CollectionMobKill(int id)
{
var key = Get_Key(id);
if (MobKill.ContainsKey(key))
return MobKill[key];
return 0;
}
public void Add_CollectionMobKill(int id)
{
var key = Get_Key(id);
if (!MobKill.ContainsKey(key))
MobKill.Add(key, 0);
++MobKill[key];
MobKill[key].RandomizeCryptoKey();
}
public void Use_CollectionMobKill(int id, int amount)
{
var key = Get_Key(id);
if (MobKill.ContainsKey(key))
{
MobKill[key] -= amount;
MobKill[key].RandomizeCryptoKey();
}
}
2025-03-16 02:20:46 +00:00
public bool CanGetMobCollection(int id, int condition, bool showtoast)
2024-12-15 01:39:39 +00:00
{
2025-03-16 02:20:46 +00:00
var key = Get_Key(id);
if (MobKill.ContainsKey(key)) return MobKill[key] >= condition;
if (showtoast) ToastUI.Ins.Set(300);
2024-12-15 01:39:39 +00:00
return false;
}
2025-03-16 02:20:46 +00:00
public bool Noti_CollectionEM(eTargetCondition targetCondition, int menucategory)
2024-12-15 01:39:39 +00:00
{
var lst = table_collectionlist.Ins.Get_DataList(targetCondition, menucategory);
for (int i = 0; i < lst.Count; i++)
{
while (true)
{
2025-03-16 02:20:46 +00:00
var amount = targetCondition == eTargetCondition.TakeEquip ? Get_ItemAmount(lst[i].n_TargetValue) :
Get_CollectionMobKill(lst[i].n_TargetValue);
2024-12-15 01:39:39 +00:00
var conditon = lst[i].Get_ConditionCount(Get_CollectionLv(lst[i].n_TargetValue));
if (amount >= conditon)
return true;
else
break;
}
}
return false;
}
#endregion
#region
public void Add_FarmMaxSlot()
{
++Farm.MaxSlot;
if (Farm.Slot.Count - 1 < Farm.MaxSlot)
Farm.MaxSlot = Farm.Slot.Count - 1;
Farm.MaxSlot.RandomizeCryptoKey();
}
public int Get_FarmMaxSlot() { return Farm.MaxSlot; }
public void Set_FarmSlot(int slot, int grade, double time, int enchantid)
{
var sSlot = Farm.Slot.Find(f => f.Slot == slot);
sSlot.Grade = grade;
sSlot.Grade.RandomizeCryptoKey();
sSlot.Time = Math.Round(time, 3); // 소수점 셋째 자리에서 반올림
sSlot.Time.RandomizeCryptoKey();
sSlot.EnchantID = enchantid;
sSlot.EnchantID.RandomizeCryptoKey();
}
public void Sub_AllFarmSlotTime(int sec = 1)
{
for (int i = 0; i < Farm.Slot.Count; i++)
{
if (Farm.Slot[i].Time > 0)
{
Farm.Slot[i].Time -= sec;
if (Farm.Slot[i].Time < 0) Farm.Slot[i].Time = 0;
Farm.Slot[i].Time.RandomizeCryptoKey();
}
}
}
public int Get_EatFruitCount(int fruitid)
{
var key = Get_Key(fruitid);
if (Farm.Eat.ContainsKey(key)) return Farm.Eat[key];
return 0;
}
public void Add_EatFruitCount(int fruitid, int amount)
{
var key = Get_Key(fruitid);
if (!Farm.Eat.ContainsKey(key))
Farm.Eat.Add(key, amount);
else
Farm.Eat[key] += amount;
Farm.Eat[key].RandomizeCryptoKey();
}
public void Buy_FarmShopItem(int shopid, int time)
{
var data = Get_FarmShopData(shopid);
++data[1]; data[1].RandomizeCryptoKey(); // 구매 횟수 증가
data[2] = time; data[2].RandomizeCryptoKey(); // 구매 딜레이 시간
}
public List<ObscuredInt> Get_FarmShopData(int shopid)
{
return Farm.Shop.Find(f => f[0] == shopid);
}
public void Sub_AllFarmShopTime(int sec = 1)
{
for (int i = 0; i < Farm.Shop.Count; i++)
{
if (Farm.Shop[i][2] > 0)
{
Farm.Shop[i][2] -= sec;
if (Farm.Shop[i][2] < 0) Farm.Shop[i][2] = 0;
Farm.Shop[i][2].RandomizeCryptoKey();
}
}
}
#endregion
#region
Dictionary<eDungeon, string> dic_dungeonkey = new Dictionary<eDungeon, string>
{ { eDungeon.d1_Mimic, "d1_Mimic" }, { eDungeon.d2_Maze, "d2_Maze" }, { eDungeon.d3_Nightmare, "d3_Nightmare" },
{ eDungeon.d4_Wave, "d4_Wave" }, };
public void Init_DungeonTicket()
{
for (int i = 0; i < 3; i++)
{
var ticketid = 501 + i;
var amount = Get_ItemAmount(ticketid);
int limit = ticketid == 501 || ticketid == 503 ? 2 : 3;
if (amount < limit)
Add_Item(ticketid, limit - amount);
}
}
2025-01-23 20:50:53 +00:00
public int Get_DungeonLv(eDungeon dungeon)
{
if (Dungeon.ContainsKey(dic_dungeonkey[dungeon]))
return Dungeon[dic_dungeonkey[dungeon]][0];
return 0;
}
public void Add_DungeonLv(eDungeon dungeon)
{
if (!Dungeon.ContainsKey(dic_dungeonkey[dungeon]))
Dungeon.Add(dic_dungeonkey[dungeon], new List<ObscuredInt> { 0, 0, 0, 0 });
++Dungeon[dic_dungeonkey[dungeon]][0];
Dungeon[dic_dungeonkey[dungeon]][0].RandomizeCryptoKey();
}
2025-01-26 18:40:10 +00:00
public void Set_DungeonLv(eDungeon dungeon, int lv)
{
if (!Dungeon.ContainsKey(dic_dungeonkey[dungeon]))
Dungeon.Add(dic_dungeonkey[dungeon], new List<ObscuredInt> { 0, 0, 0, 0 });
Dungeon[dic_dungeonkey[dungeon]][0] = lv;
Dungeon[dic_dungeonkey[dungeon]][0].RandomizeCryptoKey();
}
2025-02-02 05:19:34 +00:00
/// <summary>
/// index 1 ~ 3
/// </summary>
2025-02-01 03:05:20 +00:00
public int Get_DungeonValue(eDungeon dungeon, int index)
{
if (Dungeon.ContainsKey(dic_dungeonkey[dungeon]))
return Dungeon[dic_dungeonkey[dungeon]][index];
return 0;
}
public void Add_DungeonValue(eDungeon dungeon, int index, int val)
{
if (!Dungeon.ContainsKey(dic_dungeonkey[dungeon]))
Dungeon.Add(dic_dungeonkey[dungeon], new List<ObscuredInt> { 0, 0, 0, 0 });
Dungeon[dic_dungeonkey[dungeon]][index] += val;
Dungeon[dic_dungeonkey[dungeon]][index].RandomizeCryptoKey();
}
public void Set_DungeonValue(eDungeon dungeon, int index, int val)
{
if (!Dungeon.ContainsKey(dic_dungeonkey[dungeon]))
Dungeon.Add(dic_dungeonkey[dungeon], new List<ObscuredInt> { 0, 0, 0, 0 });
Dungeon[dic_dungeonkey[dungeon]][index] = val;
Dungeon[dic_dungeonkey[dungeon]][index].RandomizeCryptoKey();
}
2025-02-03 06:58:53 +00:00
public bool CanGetWaveReward()
{
var lst = table_waverewardlist.Ins.Get_DataList();
var rewardindex = Get_DungeonValue(eDungeon.d4_Wave, 3);
var score = Get_DungeonValue(eDungeon.d4_Wave, 2);
for (int i = 0; i < lst.Count; i++)
{
if (lst[i].n_Index - 1 == rewardindex && lst[i].n_Score <= score)
return true;
}
return false;
}
#endregion
2025-03-18 04:09:31 +00:00
#region
public void Init_Mission(int group)
{
var key1 = Get_Key(group);
if (Mission.ContainsKey(key1))
{
var lst = table_missionlist.Ins.Get_DataList(group);
for (int i = 0; i < lst.Count; i++)
{
var key2 = Get_Key(lst[i].n_MissionIndex);
if (Mission[key1].ContainsKey(key2))
{
Mission[key1][key2][0] = Mission[key1][key2][1] = 0;
Mission[key1][key2][0].RandomizeCryptoKey();
Mission[key1][key2][1].RandomizeCryptoKey();
}
}
}
}
2025-03-18 04:25:43 +00:00
public int Get_MissionLv(int group, int _id)
{
var key1 = Get_Key(group);
if (Mission.ContainsKey(key1))
{
var key2 = Get_Key(_id);
if (Mission[key1].ContainsKey(key2))
return Mission[key1][key2][0];
}
2025-03-18 04:37:33 +00:00
return 0;
2025-03-18 04:25:43 +00:00
}
2025-03-19 00:49:50 +00:00
public void Add_MissionLv(int group, int _id)
{
var key1 = Get_Key(group);
if (Mission.ContainsKey(key1))
{
var key2 = Get_Key(_id);
if (!Mission[key1].ContainsKey(key2)) // 레벨, 플레이타임과 같이 다른 값 참조하는 미션이 있으므로
Mission[key1].Add(key2, new List<ObscuredInt> { 0, 0 });
++Mission[key1][key2][0];
Mission[key1][key2][0].RandomizeCryptoKey();
}
}
public void Add_MissionCount(ePurpose purpose, int conditionvalue = 0, int _v = 1, bool setValue = false)
2025-03-18 04:09:31 +00:00
{
2025-03-19 05:50:23 +00:00
if (_v < 1) return;
2025-03-18 04:09:31 +00:00
var lst = table_missionlist.Ins.Get_DataList(purpose);
for (int i = 0; i < lst.Count; i++)
{
2025-03-18 06:04:31 +00:00
if (lst[i].n_MissionConditionValue == 0 || conditionvalue == lst[i].n_MissionConditionValue)
2025-03-18 04:09:31 +00:00
{
var key1 = Get_Key(lst[i].n_MissionGroupId);
var key2 = Get_Key(lst[i].n_MissionIndex);
if (!Mission.ContainsKey(key1)) Mission.Add(key1, new Dictionary<string, List<ObscuredInt>>());
if (!Mission[key1].ContainsKey(key2)) Mission[key1].Add(key2, new List<ObscuredInt> { 0, 0 });
if (setValue) Mission[key1][key2][1] = _v;
else Mission[key1][key2][1] += _v;
2025-03-18 04:09:31 +00:00
Mission[key1][key2][1].RandomizeCryptoKey();
}
}
}
public void Add_MissionCompletCount(int group)
{
var completeData = table_missionlist.Ins.Get_CompleteData(group);
var key1 = Get_Key(group);
var key2 = Get_Key(completeData.n_MissionIndex);
if (!Mission.ContainsKey(key1)) Mission.Add(key1, new Dictionary<string, List<ObscuredInt>>());
if (!Mission[key1].ContainsKey(key2)) Mission[key1].Add(key2, new List<ObscuredInt> { 0, 0 });
++Mission[key1][key2][1];
Mission[key1][key2][1].RandomizeCryptoKey();
}
2025-03-18 04:09:31 +00:00
public int Get_MissionCount(int group, int _id)
{
var data = table_missionlist.Ins.Get_Data_orNull(group, _id);
switch (data.e_MissionConditionType)
{
case ePurpose.HERO_LEVEL_ACC:
2025-03-18 04:09:31 +00:00
return PC.Lv;
2025-03-19 00:49:50 +00:00
case ePurpose.CHECK_PLAYTIME:
case ePurpose.CHECK_PLAYTIME_ACC:
return Get_Common(eCommon.PlayTime) / 60;
case ePurpose.HERO_TRANSCENDENCE_ACC:
return Get_LimitLv();
2025-03-20 06:36:59 +00:00
case ePurpose.HERO_BASE_STAT_LIMIT:
switch (data.n_MissionConditionValue)
{
case 1: return table_classconfig.Ins.Get_PureStat(eStat.STR, this);
case 2: return table_classconfig.Ins.Get_PureStat(eStat.DEX, this);
case 3: return table_classconfig.Ins.Get_PureStat(eStat.INT, this);
case 4: return table_classconfig.Ins.Get_PureStat(eStat.LUK, this);
}
break;
2025-03-18 04:09:31 +00:00
default:
var key1 = Get_Key(group);
if (Mission.ContainsKey(key1))
{
var key2 = Get_Key(_id);
if (Mission[key1].ContainsKey(key2))
return Mission[key1][key2][1];
}
break;
}
return 0;
}
public bool CanGet_Mission(int group, int _id)
{
var condition = table_missionlist.Ins.Get_Data_orNull(group, _id);
2025-03-18 04:25:43 +00:00
return Get_MissionLv(group, _id) == 0 && Get_MissionCount(group, _id) >= condition.l_MissionConditionCount;
2025-03-18 04:09:31 +00:00
}
#endregion
2024-12-15 01:39:39 +00:00
#region Common
public void Init_Daily()
{
Set_Common(eCommon.DOY_Day, ServerInfo.ServerTime.DayOfYear);
Farm.Shop = table_farmshoplist.Ins.Get_ShopInit();
if (!DSUtil.CheckNull(FarmShopUI.Ins) && FarmShopUI.Ins.isActiveAndEnabled) FarmShopUI.Ins.Set();
Init_DungeonTicket();
2024-12-15 01:39:39 +00:00
Set_Common(eCommon.Roullette_Count, 0);
Set_Common(eCommon.Roullette_LuckyCount, 0);
Set_Common(eCommon.Roullette_ADCount, 0);
2025-03-17 07:34:17 +00:00
Init_Mission(0);
2024-12-15 01:39:39 +00:00
Init_Pass();
Init_Shop();
2024-12-22 01:07:25 +00:00
//var amount = 1 - Get_ItemAmount(eItem.MemoryField);
//if (amount > 0) Add_Item(new ItemData(eItem.MemoryField, 0, amount));
//amount = 2 - Get_ItemAmount(eItem.MemoryForest);
//if (amount > 0) Add_Item(new ItemData(eItem.MemoryForest, 0, amount));
//amount = 1 - Get_ItemAmount(eItem.MemoryDungeon);
//if (amount > 0) Add_Item(new ItemData(eItem.MemoryDungeon, 0, amount));
//amount = 1 - Get_ItemAmount(eItem.MemoryWitchGrade);
//if (amount > 0) Add_Item(new ItemData(eItem.MemoryWitchGrade, 0, amount));
//amount = 5 - Get_ItemAmount(eItem.MemoryPetBattle);
//if (amount > 0) Add_Item(new ItemData(eItem.MemoryPetBattle, 0, amount));
//Memory[4] = 0; Memory[4].RandomizeCryptoKey();
2024-12-15 01:39:39 +00:00
if (GameUI.Ins != null) GameUI.Ins.LobbyUI.Set_Noti();
}
public void Init_Week(int numweek)
{
Set_Common(eCommon.DOY_Week, numweek);
LastTime = ServerInfo.ServerTime;
Init_ShopWeek();
2025-03-17 07:34:17 +00:00
Init_Mission(1);
2024-12-15 01:39:39 +00:00
}
public void Init_Month()
{
Set_Common(eCommon.DOY_Month, ServerInfo.ServerTime.DayOfYear);
2024-12-15 01:39:39 +00:00
Init_ShopMonth();
}
public int Get_Common(eCommon common, bool _realvalue = false)
{
return Common[MyEnumToInt.Ins.Get_Int(common)];
}
public void Add_Common(eCommon _common, int _value = 1)
{
var index = MyEnumToInt.Ins.Get_Int(_common);
Common[index] += _value;
Common[index].RandomizeCryptoKey();
}
public void Set_Common(eCommon _common, int _value)
{
var index = MyEnumToInt.Ins.Get_Int(_common);
Common[index] = _value;
Common[index].RandomizeCryptoKey();
}
public void Sub_Common(eCommon _common, int _value = 1)
{
var index = MyEnumToInt.Ins.Get_Int(_common);
Common[index] -= _value;
if (Common[index] < 0) Common[index] = 0; // 23.01.31 정인호. 현 시점까진 0 미만 값 없음
Common[index].RandomizeCryptoKey();
}
#endregion
#region
public int Get_BookSumPage(int _id) { return Book.Find(f => f.ID == _id).Page.Sum(s => s); }
public int Get_BookPage(int _id, int _page) { return Book.Find(f => f.ID == _id).Page[_page - 1]; }
public bool IsComplete_Book(int _id) { return Book.Find(f => f.ID == _id).Complete > 0; }
public void Set_BookComplete(int _id) { Book.Find(f => f.ID == _id).Set_Complete(); }
public bool ExistCanCompleteBook()
{
var tdata = table_book.Ins.Get_DataList();
for (int i = 0; i < tdata.Count; i++)
{
var temp = tdata[i] as BookTableData;
if (!IsComplete_Book(temp.ID) && Get_BookSumPage(tdata[i].ID) == temp.TotalPage)
return true;
}
return false;
}
#endregion
#region
public void Add_TitleCondition(params int[] ids)
{
for (int i = 0; i < ids.Length; i++)
{
var title = Title.Find(f => f[0] == ids[i]);
if (title[2] + 100 < int.MaxValue)
{
++title[2];
title[2].RandomizeCryptoKey();
var tdata = table_title.Ins.Get_Data(ids[i]);
if (title[2] >= tdata.ConditionValue)
Add_Item(new ItemData(eItem.Title, ids[i], 1));
}
}
}
public int Get_TitleCondition(int id) { return Title.Find(f => f[0] == id)[2]; }
public void Check_TitleCondition(double _v, params int[] ids)
{
for (int i = 0; i < ids.Length; i++)
{
if (ids[i] > 0)
{
var title = Title.Find(f => f[0] == ids[i]);
if (title[1] == 0)
{
var tdata = table_title.Ins.Get_Data(ids[i]);
if (tdata.BiggerThan)
{
if (_v >= tdata.ConditionValue)
Add_Item(new ItemData(eItem.Title, ids[i], 1));
}
else
{
if (_v <= tdata.ConditionValue)
Add_Item(new ItemData(eItem.Title, ids[i], 1));
}
}
}
}
}
public float Get_TitleValue(eStat _stat)
{
var lst = table_title.Ins.Get_DataList(_stat);
ObscuredFloat rtn = 0f;
for (int i = 0; i < lst.Count; i++)
{
for (int j = 0; j < Title.Count; j++)
{
if (Title[j][1] > 0 && Title[j][0] == lst[i].ID)
{
rtn += (lst[i] as TitleTableData).StatValue;
break;
}
}
}
rtn.RandomizeCryptoKey();
return rtn;
}
#endregion
#region ()
#endregion
#region
void Init_Pass()
{
var pass = Pass.Find(f => f[0] == 0);
if (pass[2] > 28)
{
pass[1] = pass[2] = 0;
pass[1].RandomizeCryptoKey();
pass[2].RandomizeCryptoKey();
}
}
public void Add_PassStep(int _type, bool _free, int _v = 1)
{
var pass = Pass.Find(f => f[0] == _type);
pass[_free ? 2 : 3] += _v;
pass[_free ? 2 : 3].RandomizeCryptoKey();
if (_type == 0 && _free)
{
pass[4] = ServerInfo.ServerTime.DayOfYear;
pass[4].RandomizeCryptoKey();
}
}
public int Get_PassStep(int _type, bool _free) { return Pass.Find(f => f[0] == _type)[_free ? 2 : 3]; }
public void Set_PassBuyStep(int _type, int _step)
{
var pass = Pass.Find(f => f[0] == _type);
pass[1] = _step;
pass[1].RandomizeCryptoKey();
if (_step == 0)
{ // 초기화임
pass[2] = pass[3] = 0;
pass[2].RandomizeCryptoKey();
pass[3].RandomizeCryptoKey();
}
}
public int Get_PassBuy(int _type) { return Pass.Find(f => f[0] == _type)[1]; }
public bool ExistCanGetPass(int _type = -1)
{
List<TableDataBase> passtabledata;
if (_type == -1) passtabledata = table_pass.Ins.Get_DataList();
else passtabledata = table_pass.Ins.Get_DataList(_type);
for (int i = 0; i < passtabledata.Count; i++)
{
var check = CanGetPass(passtabledata[i] as PassTableData);
if (check[0] || check[1]) return true;
}
return false;
}
public List<bool> CanGetPass(PassTableData passdata)
{ // 0 PassType, 1 패스 구매 상태, 2 획득 무료 스텝, 3 획득 패스 스텝, 4 출석 DoY
List<bool> rtn = new List<bool> { false, false };
var pass = Pass.Find(f => f[0] == passdata.PassType);
var checkstep_free = pass[2] + 1 == passdata.ID;
var checkstep_pay = pass[1] >= 2 && pass[3] + 1 == passdata.ID;
switch (passdata.PassType)
{
case 0: // 출석
if (checkstep_free && pass[4] != ServerInfo.ServerTime.DayOfYear)
rtn[0] = true;
if (checkstep_pay && pass[2] > pass[3])
rtn[1] = true;
break;
case 1:
case 2: // 레벨업
if (passdata.ConditionValue <= PC.Lv)
{
rtn[0] = checkstep_free;
rtn[1] = checkstep_pay;
}
break;
case 3:
case 4: // 스테이지 클리어
//if (checkstep_free)
//{
// if (Get_Common(eCommon.MaxMapID) > passdata.Chapter)
// rtn[0] = true;
// else if (Get_Common(eCommon.MaxMapID) == passdata.Chapter && Get_Common(eCommon.MaxStage) >= passdata.ConditionValue)
// rtn[0] = true;
//}
//if (checkstep_pay)
//{
// if (Get_Common(eCommon.MaxMapID) > passdata.Chapter)
// rtn[1] = true;
// else if (Get_Common(eCommon.MaxMapID) == passdata.Chapter && Get_Common(eCommon.MaxStage) >= passdata.ConditionValue)
// rtn[1] = true;
//}
break;
default: // 몬스터 처치
2025-03-17 07:34:17 +00:00
//if (Get_MissionCount(MyValue.arr_Mission[1], 1) >= passdata.ConditionValue)
//{
// rtn[0] = checkstep_free;
// rtn[1] = checkstep_pay;
//}
2024-12-15 01:39:39 +00:00
break;
}
return rtn;
}
public List<bool> AleadyGetPass(PassTableData passdata)
{
var pass = Pass.Find(f => f[0] == passdata.PassType);
return new List<bool> { pass[2] >= passdata.ID, pass[3] >= passdata.ID };
}
public bool IsNohavePass()
{
for (int i = 0; i < Pass.Count; i++)
if (Pass[i][1] > 0) return false;
return true;
}
#endregion
#region ()
public bool IsCanGetChapterClearReward(int _chapter)
{
var cqdata = ChapterQuest.Find(f => f.Chapter == _chapter);
if (cqdata.GetReward < 1)
{
for (int i = 0; i < cqdata.list_QuestClear.Count; i++)
{
if (cqdata.list_QuestClear[i] == 0)
return false;
}
return true;
}
return false;
}
public bool IsCanGetChapterClearReward()
{
var chaptercount = table_chaptertext.Ins.Get_DataList();
for (int i = 0; i < chaptercount.Count; i++)
{
bool canget = IsCanGetChapterClearReward(i + 1);
if (canget) return true;
}
return false;
}
public bool IsAlreadyGetChapterClearReward(int _chapter)
{
var cqdata = ChapterQuest.Find(f => f.Chapter == _chapter);
return cqdata.GetReward == 1;
}
public int Get_ChapterQuestClearCount(int _chapter, int _id)
{
return ChapterQuest.Find(f => f.Chapter == _chapter).list_QuestClear[_id - 1];
}
public int Get_ChapterQuestID(int _chapter)
{
return ChapterQuest.Find(f => f.Chapter == _chapter).ID;
}
public void Set_ChapterQuestID(int _chapter, int _id)
{
var data = ChapterQuest.Find(f => f.Chapter == _chapter);
data.ID = _id;
data.ID.RandomizeCryptoKey();
}
#endregion
#region
// 0 광고 쿨타임, 1 총 구매횟수, 2 일일 구매, 3 주간 구매, 4 월간 구매
void Init_Shop()
{
foreach (var item in Shop)
{
Shop[item.Key][0] = Shop[item.Key][2] = 0;
Shop[item.Key][0].RandomizeCryptoKey();
Shop[item.Key][2].RandomizeCryptoKey();
}
}
void Init_ShopWeek()
{
foreach (var item in Shop)
{
Shop[item.Key][3] = 0;
Shop[item.Key][3].RandomizeCryptoKey();
}
}
void Init_ShopMonth()
{
foreach (var item in Shop)
{
Shop[item.Key][4] = 0;
Shop[item.Key][4].RandomizeCryptoKey();
}
}
public bool CanShow_ShopAD(int _id)
{
var data = table_shop.Ins.Get_Data(_id);
if (data.PriceType == ePriceType.AD)
{
var shopdata = Shop[_id.ToString()];
return shopdata[2] < data.BuyLimit_Day && shopdata[0] <= 0;
}
return false;
}
public bool CanShow_ShopAD(eShopTab _tab)
{
var lst = table_shop.Ins.Get_DataList(_tab);
for (int i = 0; i < lst.Count; i++)
{
var canshow = CanShow_ShopAD(lst[i].ID);
if (canshow) return canshow;
}
return false;
}
public bool CanShow_ShopAD()
{
var lst = table_shop.Ins.Get_AD_DataList();
for (int i = 0; i < lst.Count; i++)
{
var canshow = CanShow_ShopAD(lst[i].ID);
if (canshow) return canshow;
}
return false;
}
public int Get_ShopADTime(int _id) { return Shop[_id.ToString()][0]; }
public void Add_ShopADTime(int _id, int _sec = 1)
{
var shopdata = Shop[_id.ToString()];
shopdata[0] += _sec;
shopdata[0].RandomizeCryptoKey();
}
public void Sub_ShopADTime(int _id, int _sec = 1)
{
int index = 0;
if (_id == -1)
{
foreach (var item in Shop)
{
Shop[item.Key][index] -= _sec;
if (Shop[item.Key][index] < 0) Shop[item.Key][index] = 0;
Shop[item.Key][index].RandomizeCryptoKey();
}
}
else
{
var shopdata = Shop[_id.ToString()];
shopdata[index] -= _sec;
if (shopdata[index] < 0) shopdata[index] = 0;
shopdata[index].RandomizeCryptoKey();
}
}
public void Add_ShopBuyCount(int _id, params int[] index)
{
var shopdata = Shop[_id.ToString()];
for (int i = 0; i < index.Length; i++)
{
++shopdata[index[i]];
shopdata[index[i]].RandomizeCryptoKey();
}
}
public int Get_ShopBuyCount(int _id, byte _limitType)
{
return Shop[_id.ToString()][_limitType];
}
public string Can_BuyShopItem(ShopTableData _std)
{
if (!string.IsNullOrEmpty(_std.BuyCondition))
{
if (ServerInfo.Ins.m_SC_ServerStatus.ContentsLock == 1)
{
switch (_std.BuyCondition)
{
case "Chapter14Clear":
//if (Get_Common(eCommon.MaxMapID) < 15)
// return "14챕터 클리어\n필요";
break;
}
}
}
if (!ServerInfo.Ins.m_ServerData.Check_ItemAmount(_std.ObtainCheckItem, 1, _std.ObtainCheckItemID, false))
{
if (_std.BuyLimit > 0) return Get_ShopBuyCount(_std.ID, 1) < _std.BuyLimit ? "" : "구매 완료";
else if (_std.BuyLimit_Day > 0) return Get_ShopBuyCount(_std.ID, 2) < _std.BuyLimit_Day ? "" : "구매 완료";
else if (_std.BuyLimit_Week > 0) return Get_ShopBuyCount(_std.ID, 3) < _std.BuyLimit_Week ? "" : "구매 완료";
else if (_std.BuyLimit_Month > 0) return Get_ShopBuyCount(_std.ID, 4) < _std.BuyLimit_Month ? "" : "구매 완료";
return null;
}
return "구매 완료";
}
#endregion
#region
public int Get_PotionRemainTime(int _id) { return Potion[_id.ToString()][1]; }
public bool Is_UsePotion()
{
foreach (var item in Potion)
{
if (item.Value[1] > 0)
return true;
}
return false;
}
public void Add_PotionTime(int _id)
{
Use_Item(eItem.Potion, 1, _id);
var key = _id.ToString();
Potion[key][1] += MyValue.PotionAddMin * 60;
Potion[key][1].RandomizeCryptoKey();
}
public void Sub_AllPotionTime()
{
foreach (var item in Potion)
{
if (item.Value[1] > 0)
{
var before = item.Value[1];
--item.Value[1];
if (item.Value[1] == 0)
{
item.Value[1] = 0;
//if (before > 0)
// ActorInfo.Ins.ReSet_AllActorStat();
}
item.Value[1].RandomizeCryptoKey();
}
}
}
#endregion
#region
void Add_Item_Log(eItem item, int id, double amount)
{
//var strItem = item.ToString();
//if (!TotalAdd.ContainsKey(strItem))
// TotalAdd.Add(strItem, new List<List<double>>());
//for (int i = 0; i < TotalAdd[strItem].Count; i++)
//{
// if (TotalAdd[strItem][i][0] == id)
// {
// TotalAdd[strItem][i][1] += amount;
// return;
// }
//}
//TotalAdd[strItem].Add(new List<double> { id, amount });
}
void Use_Item_Log(eItem item, int id, double amount)
{
//var strItem = item.ToString();
//if (!TotalUse.ContainsKey(strItem))
// TotalUse.Add(strItem, new List<List<double>>());
//for (int i = 0; i < TotalUse[strItem].Count; i++)
//{
// if (TotalUse[strItem][i][0] == id)
// {
// TotalUse[strItem][i][1] += amount;
// return;
// }
//}
//TotalUse[strItem].Add(new List<double> { id, amount });
}
public List<ItemData> Add_Item(ItemData _itemdata)
{
Add_Item_Log(_itemdata.ItemType, _itemdata.Get_ID(), _itemdata.Amount); // 중간에 리턴있어서 앞에서 해줌
switch (_itemdata.ItemType)
{
case eItem.Gold:
case eItem.Gem:
case eItem.WeaponStone:
case eItem.RingStone:
case eItem.NeckStone:
case eItem.BootsStone:
case eItem.FairyStone:
case eItem.SelectSkillShuffle:
case eItem.ChapterQuestShuffle:
case eItem.mClover:
case eItem.MemoryField:
case eItem.MemoryForest:
case eItem.MemoryDungeon:
case eItem.MemoryWitchGrade:
case eItem.MemoryPetBattle:
{
var key = Get_Key(_itemdata.Get_ID());
var amount = Math.Truncate(_itemdata.Amount);
if (!Item.ContainsKey(key))
Item.Add(key, new List<ObscuredDouble> { amount, amount, 0 });
else
{
Item[key][0] += amount;
Item[key][0].RandomizeCryptoKey();
Item[key][1] += amount;
Item[key][1].RandomizeCryptoKey();
}
2025-03-06 07:47:57 +00:00
if (TopMoney.isIns) TopMoney.Ins.Set();
2024-12-15 01:39:39 +00:00
}
break;
case eItem.Exp:
PC.Exp += (uint)_itemdata.Amount;
PC.Exp.RandomizeCryptoKey();
break;
case eItem.PC:
break;
case eItem.Pet:
break;
case eItem.Weapon:
case eItem.Armor:
case eItem.Helmet:
case eItem.Extra:
case eItem.Necklace:
case eItem.Ring:
{
var key = Get_Key(_itemdata.Get_ID());
if (!Equipment.ContainsKey(key))
Equipment.Add(key, new List<ObscuredDouble> { _itemdata.Amount, 0, 0 });
else
Equipment[key][1] += _itemdata.Amount;
Equipment[key][1].RandomizeCryptoKey();
}
break;
case eItem.Fairy:
//var equipment = Equipment[_itemdata.ItemType.ToString()].Find(f => f[0] == _itemdata.Get_ID());
//if (equipment != null) Check_EquipmentGet(equipment, _itemdata.Amount);
//if (MessageInfo.Ins != null && _itemdata.Grade >= eItemGrade.Legend)
// MessageInfo.Ins.Add_NotiToChatServer(DSUtil.Format("{0} {1}{2}[-] 획득", ServerInfo.Ins.UserName, MyValue.Get_GradeColor(_itemdata.Grade), _itemdata.Name));
//if (GameUI.Ins != null) GameUI.Ins.Add_newItem(_itemdata.ItemType, _itemdata.Get_ID());
break;
case eItem.Skill: // ID, 갯수, 레벨, 특성1, 특성2
//var magicamount = (int)_itemdata.Amount;
//var magic = Skill.Find(f => f[0] == _itemdata.Get_ID());
//if (magic[2] == 0) { magic[2] = 1; magic[2].RandomizeCryptoKey(); --magicamount; }
//magic[1] += magicamount;
//magic[1].RandomizeCryptoKey();
//if (MessageInfo.Ins != null && _itemdata.Grade >= eItemGrade.Legend)
// MessageInfo.Ins.Add_NotiToChatServer(DSUtil.Format("{0} {1}{2}[-] 획득", ServerInfo.Ins.UserName, MyValue.Get_GradeColor(_itemdata.Grade), _itemdata.Name));
//if (GameUI.Ins != null) GameUI.Ins.Add_newItem(_itemdata.ItemType, _itemdata.Get_ID());
break;
case eItem.AllGambleTicket:
case eItem.WeaponTicket:
case eItem.RingTicket:
case eItem.NeckTicket:
case eItem.BootsTicket:
case eItem.FairyTicket:
case eItem.MagicTicket:
case eItem.PetTicket:
break;
case eItem.WeaponCostume:
break;
case eItem.Farmer:
break;
case eItem.Book: break; // 책은 없음
case eItem.Page:
var pagedata = table_bookpage.Ins.Get_Data(_itemdata.Get_ID());
var booksdata = Book.Find(f => f.ID == pagedata.Book);
if (booksdata.Page[pagedata.Page - 1] < 1)
{ // 새로운 페이지 획득 체크
if (Menu_Book.dic_newBookPage.ContainsKey(pagedata.Book))
{
if (Menu_Book.dic_newBookPage[pagedata.Book].Find(f => f == pagedata.Page) == 0)
Menu_Book.dic_newBookPage[pagedata.Book].Add(pagedata.Page);
}
else
Menu_Book.dic_newBookPage.Add(pagedata.Book, new List<int> { pagedata.Page });
}
booksdata.Page[pagedata.Page - 1] = 1;
booksdata.Page[pagedata.Page - 1].RandomizeCryptoKey();
break;
case eItem.Food:
case eItem.Seed:
break;
case eItem.Title:
var title = Title.Find(f => f[0] == _itemdata.Get_ID());
if (title[1] == 0)
{
TitleGetUI.Ins.Set(_itemdata.Get_ID()); // 타이틀 획득 팝업
title[1] = 1;
title[1].RandomizeCryptoKey();
}
break;
case eItem.Pass:
if (_itemdata.Get_ID() < 100)
{
var pass = Pass.Find(f => f[0] == _itemdata.Get_ID());
++pass[1];
pass[1].RandomizeCryptoKey();
}
else if (_itemdata.Get_ID() == 101)
{
for (int i = 0; i < Pass.Count; i++)
{
Pass[i][1]++;
Pass[i][1].RandomizeCryptoKey();
}
}
break;
case eItem.ShopPackage:
var pdata = table_shoppackage.Ins.Get_Data(_itemdata.Get_ID());
List<ItemData> itemlst = new List<ItemData>();
for (int i = 0; i < pdata.itemdata.Count; i++)
{
//if (pdata.itemdata[i].item != eItem.None)
// itemlst.AddRange(Add_Item(new ItemData(pdata.itemdata[i].item, pdata.itemdata[i].itemid, pdata.itemdata[i].amount, _itemdata.Name, eUICardType.GetItem)));
}
return itemlst;
case eItem.ADRemove:
Set_Common(eCommon.ADRemove, 1);
break;
case eItem.Potion:
var potionkey = _itemdata.Get_ID().ToString();
Potion[potionkey][0] += (int)_itemdata.Amount;
Potion[potionkey][0].RandomizeCryptoKey();
break;
case eItem.Relic:
break;
case eItem.DailyInit:
Set_Common(eCommon.DOY_Day, 0);
break;
case eItem.RoulletteTicket:
Add_Common(eCommon.Roullette_Ticket, (int)_itemdata.Amount);
break;
}
return new List<ItemData> { _itemdata };
}
public void Add_Item(int id, double amount)
{
var itemdata = table_itemlist.Ins.Get_Data(id);
var key = Get_Key(id);
#if UNITY_EDITOR
if (itemdata == null)
2024-12-22 01:07:25 +00:00
{
string errorMessage = $"Item ID {id} not found!";
string callStack = Environment.StackTrace;
// 로그 추가
var logEntry = new LogEntry(id.ToString(), errorMessage, callStack);
// 텍스트 파일에 저장
DSUtil.SaveLogToFile(logEntry);
return;
}
2024-12-15 01:39:39 +00:00
#endif
switch (itemdata.e_ItemType)
{
default:
if (!Item.ContainsKey(key))
Item.Add(key, new List<ObscuredDouble> { amount, amount, 0 });
else
{
Item[key][0] += amount;
Item[key][0].RandomizeCryptoKey();
Item[key][1] += amount;
Item[key][1].RandomizeCryptoKey();
}
2025-03-06 07:47:57 +00:00
if (TopMoney.isIns) TopMoney.Ins.Set();
2024-12-15 01:39:39 +00:00
break;
case eItem.Weapon:
case eItem.Armor:
case eItem.Helmet:
case eItem.Extra:
case eItem.Necklace:
case eItem.Ring:
if (!Equipment.ContainsKey(key))
Equipment.Add(key, new List<ObscuredDouble> { amount, 0, 0 });
else
Equipment[key][0] += amount;
Equipment[key][1].RandomizeCryptoKey();
break;
case eItem.PC:
PC.Add_PC(id);
break;
case eItem.Pet:
if (!Pet.ContainsKey(key))
Pet.Add(key, new List<ObscuredInt> { (int)amount - 1, 1 });
else
Pet[key][0] += (int)amount;
Pet[key][0].RandomizeCryptoKey();
break;
case eItem.Enchant:
if (!Enchant.ContainsKey(key))
Enchant.Add(key, new List<ObscuredDouble> { amount, 0, amount, 0 });
else
Enchant[key][0] += amount;
Enchant[key][0].RandomizeCryptoKey();
break;
case eItem.Relic:
if (!Relic.ContainsKey(key))
Relic.Add(key, new List<ObscuredInt> { 0, 0, 0 });
Relic[key][0] += (int)amount;
Relic[key][0].RandomizeCryptoKey();
break;
}
2025-03-18 04:09:31 +00:00
Add_MissionCount(ePurpose.TAKE_GOODS, id, (int)amount);
2025-03-19 04:45:25 +00:00
Add_MissionCount(ePurpose.TAKE_GOODS_ACC, id, (int)amount);
Add_MissionCount(ePurpose.TAKE_GOODS_LIMIT, id, (int)amount);
if (itemdata.IsEquipItem())
{
Add_MissionCount(ePurpose.GET_EQUIP_ITEM_ALL, 0, (int)amount);
Add_MissionCount(ePurpose.GET_EQUIP_ITEM_GRADE_ACC, itemdata.n_ItemGrade, (int)amount);
}
else if (itemdata.e_ItemType == eItem.Relic)
Add_MissionCount(ePurpose.TAKE_RELIC_ALL, 0, (int)amount);
else if (itemdata.e_ItemType == eItem.Essence)
{
Add_MissionCount(ePurpose.GET_ESSENCE_GRADE_ACC, itemdata.n_ItemGrade, (int)amount);
Add_MissionCount(ePurpose.GET_ESSENCE_GRADE_ALL, 0, (int)amount);
}
2024-12-15 01:39:39 +00:00
}
public void Use_Item(int id, double amount)
{
var itemdata = table_itemlist.Ins.Get_Data(id);
var key = Get_Key(id);
switch (itemdata.e_ItemType)
{
default:
if (Item.ContainsKey(key))
{
var amonut = Math.Truncate(amount);
Item[key][0] -= amonut;
Item[key][0].RandomizeCryptoKey();
Item[key][2] += amonut;
Item[key][2].RandomizeCryptoKey();
}
2025-03-06 07:47:57 +00:00
if (TopMoney.isIns) TopMoney.Ins.Set();
2024-12-15 01:39:39 +00:00
break;
case eItem.Weapon:
case eItem.Armor:
case eItem.Helmet:
case eItem.Extra:
case eItem.Necklace:
case eItem.Ring:
if (Equipment.ContainsKey(key))
{
Equipment[key][0] -= amount;
Equipment[key][0] = Math.Truncate(Equipment[key][0]);
Equipment[key][0].RandomizeCryptoKey();
}
break;
case eItem.PC: break;
case eItem.Pet:
if (Pet.ContainsKey(key))
{
Pet[key][0] -= (int)amount;
Pet[key][0].RandomizeCryptoKey();
}
break;
case eItem.Enchant:
if (Enchant.ContainsKey(key))
{
Enchant[key][0] -= amount;
Enchant[key][0].RandomizeCryptoKey();
Enchant[key][3] -= amount;
Enchant[key][3].RandomizeCryptoKey();
}
break;
case eItem.Relic:
if (Relic.ContainsKey(key))
{
Relic[key][0] -= (int)amount;
Relic[key][0].RandomizeCryptoKey();
}
break;
}
2025-03-18 04:09:31 +00:00
Add_MissionCount(ePurpose.CONSUME_GOODS, id, (int)amount);
2025-03-19 04:45:25 +00:00
Add_MissionCount(ePurpose.CONSUME_GOODS_ACC, id, (int)amount);
2024-12-15 01:39:39 +00:00
}
public bool Check_ItemAmount(int id, double amount, bool _showtoast = true)
{
bool result = Get_ItemAmount(id) >= amount;
if (_showtoast && !result)
2024-12-22 01:07:25 +00:00
ToastUI.Ins.Set(160, table_itemlist.Ins.Get_ItemName(id));
2024-12-15 01:39:39 +00:00
return result;
}
public double Get_ItemAmount(int id)
{
var itemdata = table_itemlist.Ins.Get_Data(id);
var key = Get_Key(id);
if (Item.ContainsKey(key)) return Item[key][0];
else if (Equipment.ContainsKey(key)) return Equipment[key][0];
else if (Enchant.ContainsKey(key)) return Enchant[key][0];
else if (Pet.ContainsKey(key)) return Pet[key][0];
else if (Relic.ContainsKey(key)) return Relic[key][0];
return 0;
}
public bool IsObtainItem(int id)
{
var key = Get_Key(id);
if (Item.ContainsKey(key)) return true;
else if (Equipment.ContainsKey(key)) return true;
else if (Enchant.ContainsKey(key)) return true;
else if (Pet.ContainsKey(key)) return true;
else if (Relic.ContainsKey(key)) return true;
else
{
var itemdata = table_itemlist.Ins.Get_Data(id);
if (!DSUtil.CheckNull(itemdata))
{
if (itemdata.e_ItemType == eItem.PC) return PC.IsObtainPC(id);
}
}
2024-12-15 01:39:39 +00:00
return false;
}
public bool IsEquipItem(int id, int preset = 0)
{
var itemData = table_itemlist.Ins.Get_Data(id);
if (!DSUtil.CheckNull(itemData))
{
if (itemData.IsEquipItem())
return Equip.Equip[itemData.e_ItemType] == id;
else if (itemData.e_ItemType == eItem.Skill)
{
if (preset == 0) preset = Equip.Preset;
return Equip.Skill[preset].Find(f => f == id) > 0;
}
}
return false;
}
int NoteNotiID;
public void Use_Item(eItem item, double _amount = 1d, int _id = 0, string _cause = "")
{
switch (item)
{
default:
var key = Get_Key(_id);
if (Item.ContainsKey(key))
{
var amonut = Math.Truncate(_amount);
Item[key][0] -= amonut;
Item[key][0].RandomizeCryptoKey();
Item[key][2] += amonut;
Item[key][2].RandomizeCryptoKey();
2025-03-06 07:47:57 +00:00
if (TopMoney.isIns) TopMoney.Ins.Set();
2024-12-15 01:39:39 +00:00
}
else if (Equipment.ContainsKey(key))
{
Equipment[key][0] -= _amount;
Equipment[key][0] = Math.Truncate(Equipment[key][0]);
Equipment[key][0].RandomizeCryptoKey();
}
break;
case eItem.PC:
break;
case eItem.Pet:
break;
case eItem.Fairy:
//var equipment = Equipment[item.ToString()].Find(f => f[0] == _id);
//if (equipment[3] >= _amount)
//{
// equipment[3] -= (int)_amount;
// equipment[3].RandomizeCryptoKey();
// Use_Item_Log(item, _id, _amount);
// ServerInfo.Ins.Add_Log(0, DSUtil.Format("use,{0},{1},{2},{3}", item, _amount, equipment[3], _cause));
//}
break;
case eItem.Skill:
//var magic = Skill.Find(f => f[0] == _id);
//if (magic[1] >= _amount)
//{
// magic[1] -= (int)_amount;
// magic[1].RandomizeCryptoKey();
// Use_Item_Log(item, _id, _amount);
// ServerInfo.Ins.Add_Log(0, DSUtil.Format("use,{0},{1},{2},{3}", item, _amount, magic[1], _cause));
//}
break;
case eItem.AllGambleTicket:
case eItem.WeaponTicket:
case eItem.RingTicket:
case eItem.NeckTicket:
case eItem.BootsTicket:
case eItem.FairyTicket:
case eItem.MagicTicket:
case eItem.PetTicket:
break;
case eItem.Seed:
case eItem.Food:
break;
case eItem.Exp:
break;
case eItem.WeaponCostume:
break;
case eItem.Farmer:
break;
case eItem.Book:
break;
2025-03-07 04:53:50 +00:00
case eItem.Max: break;
2024-12-15 01:39:39 +00:00
case eItem.Potion:
var potionkey = _id.ToString();
if (Potion[potionkey][0] >= 1)
{
--Potion[potionkey][0];
Potion[potionkey][0].RandomizeCryptoKey();
Use_Item_Log(item, _id, _amount);
ServerInfo.Ins.Add_Log(0, DSUtil.Format("use,{0},{1},{2},{3}", item, _amount, Potion[potionkey][0], _cause));
}
break;
}
}
public double Get_ItemAmount(eItem item, int id = 0)
{
switch (item)
{
default:
var key = Get_Key(id);
if (Item.ContainsKey(key))
return Item[key][0];
else if (Equipment.ContainsKey(key))
return Equipment[key][0];
break;
case eItem.AllGambleTicket:
case eItem.WeaponTicket:
case eItem.RingTicket:
case eItem.NeckTicket:
case eItem.BootsTicket:
case eItem.FairyTicket:
case eItem.MagicTicket:
case eItem.PetTicket:
break;
case eItem.Exp:
return PC.Exp;
case eItem.PC:
return 0d;
case eItem.WeaponCostume:
break;
case eItem.Fairy:
return 0d;
//if (id == 0) return 0d;
//var equipment = Equipment[item.ToString()].Find(f => f[0] == id);
//return equipment[3];
case eItem.Skill:
if (id == 0) return 0d;
//return Skill.Find(f => f[0] == id)[1];
break;
case eItem.Pet:
case eItem.Farmer:
break;
case eItem.Book:
break;
case eItem.Food:
return 0d;
case eItem.Seed:
return 0d;
case eItem.Potion:
return Potion[id.ToString()][0];
}
return 0d;
}
public bool Check_ItemAmount(eItem item, double _amount, int _id = 0, bool _showtoast = true)
{
bool result = Get_ItemAmount(item, _id) >= _amount;
2024-12-22 01:07:25 +00:00
//if (_showtoast && !result)
// ToastUI.Ins.Set(160, MyText.Get_ItemName(_id));
2024-12-15 01:39:39 +00:00
return result;
}
#endregion
}
#region
public class ServerData_Book
{
public ObscuredInt ID, Complete;
public List<ObscuredInt> Page;
public void Init(int _id)
{
ID = _id;
ID.RandomizeCryptoKey();
Complete = 0;
Complete.RandomizeCryptoKey();
var totalpage = table_book.Ins.Get_Data(ID).TotalPage;
Page = new List<ObscuredInt>();
for (int i = 0; i < totalpage; i++)
Page.Add(0);
Page.ForEach(f => f.RandomizeCryptoKey());
}
public void Set_Complete() { Complete = 1; Complete.RandomizeCryptoKey(); }
public ServerData_Book_Read Get()
{
var rtn = new ServerData_Book_Read();
rtn.ID = ID;
rtn.Complete = Complete;
rtn.Page = new List<int>();
for (int i = 0; i < Page.Count; i++)
rtn.Page.Add(Page[i]);
return rtn;
}
}
public class ServerData_Book_Read
{
public int ID, Complete;
public List<int> Page;
public ServerData_Book Get()
{
var rtn = new ServerData_Book();
rtn.ID = ID;
rtn.ID.RandomizeCryptoKey();
rtn.Complete = Complete;
rtn.Complete.RandomizeCryptoKey();
rtn.Page = new List<ObscuredInt>();
for (int i = 0; i < Page.Count; i++)
rtn.Page.Add(Page[i]);
rtn.Page.ForEach(f => f.RandomizeCryptoKey());
return rtn;
}
}
public class ServerData_ChapterQuest
{
public ObscuredInt Chapter, GetReward, ID; // 현재 선택된 퀘스트 아이디
public List<ObscuredInt> list_QuestClear = new List<ObscuredInt>();
public void Init(int _chapter)
{
Chapter = _chapter;
Chapter.RandomizeCryptoKey();
GetReward = 0;
GetReward.RandomizeCryptoKey();
ID = 0;
ID.RandomizeCryptoKey();
var datas = table_chapterquest.Ins.Get_DataList(_chapter);
for (int i = 0; i < datas.Count; i++)
list_QuestClear.Add(0);
list_QuestClear.ForEach(f => f.RandomizeCryptoKey());
}
public ServerData_ChapterQuest_Read Get()
{
var rtn = new ServerData_ChapterQuest_Read
{
Chapter = Chapter,
GetReward = GetReward,
ID = ID
};
for (int i = 0; i < list_QuestClear.Count; i++)
rtn.list_QuestClear.Add(list_QuestClear[i]);
return rtn;
}
}
public class ServerData_ChapterQuest_Read
{
public int Chapter, GetReward, ID;
public List<int> list_QuestClear = new List<int>();
public ServerData_ChapterQuest Get()
{
var rtn = new ServerData_ChapterQuest
{
Chapter = Chapter,
GetReward = GetReward,
ID = ID
};
for (int i = 0; i < list_QuestClear.Count; i++)
rtn.list_QuestClear.Add(list_QuestClear[i]);
return rtn;
}
}
#endregion
#region New
public class SD_Equip
{
public Dictionary<eItem, ObscuredInt> Equip;
public ObscuredInt PC, Preset, LimitPreset;
public Dictionary<int, List<ObscuredInt>> Skill;
public void Set_Equip(eItem item, int equipid, int slot = 0, int unequipid = 0)
{
switch (item)
{
default:
Equip[item] = equipid;
Equip[item].RandomizeCryptoKey();
break;
case eItem.Skill:
List<ObscuredInt> lst = Skill[Preset];
for (int i = 0; i < lst.Count; i++)
{
if (lst[i] == equipid || (unequipid > 0 && lst[i] == unequipid))
{
lst[i] = 0;
lst[i].RandomizeCryptoKey();
}
}
lst[slot] = equipid;
lst[slot].RandomizeCryptoKey();
break;
}
}
public void Init_NewUser(Action<List<ObscuredInt>> act)
{
Equip = new Dictionary<eItem, ObscuredInt>
{
[eItem.PC] = table_GlobalValue.Ins.Get_Int("n_FirstClassID"),
[eItem.PCCostume] = 110001, // table_GlobalValue.Ins.Get_Int("n_FirstPCCostumeID"),
2024-12-15 01:39:39 +00:00
[eItem.Weapon] = 0,
[eItem.WeaponCostume] = 0,
[eItem.Armor] = 0,
[eItem.Helmet] = 0,
[eItem.Extra] = 0,
[eItem.Necklace] = 0,
[eItem.Ring] = 0,
2024-12-23 01:05:19 +00:00
[eItem.Pet] = table_GlobalValue.Ins.Get_Int("n_FirstEquipPet"),
2024-12-15 01:39:39 +00:00
[eItem.Fairy] = 0,
[eItem.Farmer] = 0,
[eItem.Worker] = 70001,
2024-12-15 01:39:39 +00:00
};
foreach (var item in Equip) item.Value.RandomizeCryptoKey();
Preset = LimitPreset = 1;
Preset.RandomizeCryptoKey();
LimitPreset.RandomizeCryptoKey();
var classdata = table_classconfig.Ins.Get_Data_orNull(Equip[eItem.PC]);
var equipSkillValues = new List<ObscuredInt>()
{
classdata.n_AcquiredSkill1, classdata.n_AcquiredSkill2, classdata.n_AcquiredSkill3, 0, 0, 0
};
act(equipSkillValues);
Skill = new Dictionary<int, List<ObscuredInt>>
{
{ 1, new List<ObscuredInt>() }, { 2, new List<ObscuredInt>() }, { 3, new List<ObscuredInt>() }
};
foreach (var item in Skill)
{
item.Value.Clear(); // 기존 값을 지운 후 새로 추가
item.Value.AddRange(equipSkillValues);
item.Value.ForEach(f => f.RandomizeCryptoKey()); // 암호화 키 랜덤화
}
}
public SD_Equip_Read Get()
{
var temp = new SD_Equip_Read();
temp.Preset = Preset;
temp.LimitPreset = LimitPreset;
temp.Equip = Get_T_Dic(Equip);
temp.Skill = Get_T_Dic(Skill);
return temp;
}
public Dictionary<string, int> Get_T_Dic(Dictionary<eItem, ObscuredInt> dic)
{
var temp = new Dictionary<string, int>();
if (dic != null)
{
foreach (var item in dic)
temp.Add(item.Key.ToString(), item.Value);
}
return temp;
}
public Dictionary<string, List<int>> Get_T_Dic(Dictionary<int, List<ObscuredInt>> dic)
{
var temp = new Dictionary<string, List<int>>();
if (dic != null)
{
foreach (var item in dic)
temp.Add(item.Key.ToString(), Get_T_List(item.Value));
}
return temp;
}
private List<int> Get_T_List(List<ObscuredInt> lst)
{
var temp = new List<int>();
for (int i = 0; i < lst.Count; i++)
temp.Add(lst[i]);
return temp;
}
}
public class SD_Equip_Read
{
public Dictionary<string, int> Equip;
public int Preset, LimitPreset;
public Dictionary<string, List<int>> Skill;
public SD_Equip Get()
{
var temp = new SD_Equip();
temp.Preset = Preset;
temp.LimitPreset = LimitPreset;
temp.Equip = Get_T_Dic(Equip);
temp.Skill = Get_T_Dic(Skill);
return temp;
}
public Dictionary<eItem, ObscuredInt> Get_T_Dic(Dictionary<string, int> dic)
{
var temp = new Dictionary<eItem, ObscuredInt>();
if (dic != null)
{
foreach (var item in dic)
temp.Add(DSUtil.StringToEnum<eItem>(item.Key), item.Value);
}
return temp;
}
public Dictionary<int, List<ObscuredInt>> Get_T_Dic(Dictionary<string, List<int>> dic)
{
var temp = new Dictionary<int, List<ObscuredInt>>();
if (dic != null)
{
foreach (var item in dic)
temp.Add(int.Parse(item.Key), Get_T_List(item.Value));
}
return temp;
}
private List<ObscuredInt> Get_T_List(List<int> lst)
{
var temp = new List<ObscuredInt>();
for (ObscuredInt i = 0; i < lst.Count; i++)
temp.Add(lst[i]);
return temp;
}
}
public class SD_Slot
{
public eItem Parts;
public ObscuredInt Lv;
public ObscuredDouble Use;
public List<SD_Slot_Enchant> Enchant;
public SD_Slot_Read Get()
{
var rtn = new SD_Slot_Read();
rtn.Parts = Parts;
rtn.Lv = Lv;
rtn.Use = Use;
if (Enchant != null)
{
rtn.Enchant = new List<SD_Slot_Enchant_Read>();
for (int i = 0; i < Enchant.Count; i++)
rtn.Enchant.Add(Enchant[i].Get());
}
return rtn;
}
}
public class SD_Slot_Enchant
{
public ObscuredInt ID, EXTRA, Lv;
public float Get_Value() { return table_optionconfig.Ins.Get_Data(ID).Get_Value(Lv); }
public SD_Slot_Enchant_Read Get()
{
return new SD_Slot_Enchant_Read
{
ID = ID,
EXTRA = EXTRA,
Lv = Lv
};
}
}
public class SD_Slot_Read
{
public eItem Parts;
public int Lv;
public double Use;
public List<SD_Slot_Enchant_Read> Enchant;
public SD_Slot Get()
{
var rtn = new SD_Slot();
rtn.Parts = Parts;
rtn.Lv = Lv;
rtn.Use = Use;
if (Enchant != null)
{
rtn.Enchant = new List<SD_Slot_Enchant>();
for (int i = 0; i < Enchant.Count; i++)
rtn.Enchant.Add(Enchant[i].Get());
}
return rtn;
}
}
public class SD_Slot_Enchant_Read
{
public int ID, EXTRA, Lv;
public SD_Slot_Enchant Get()
{
return new SD_Slot_Enchant
{
ID = ID,
EXTRA = EXTRA,
Lv = Lv
};
}
}
public class SD_Equipment
{
public ObscuredInt ID, Lv;
public ObscuredDouble Amount;
public SD_Equipment_Read Get()
{
var rtn = new SD_Equipment_Read();
rtn.ID = ID;
rtn.Lv = Lv;
rtn.Amount = Amount;
return rtn;
}
}
public class SD_Equipment_Read
{
public int ID, Lv;
public double Amount;
public SD_Equipment Get()
{
var rtn = new SD_Equipment();
rtn.ID = ID; rtn.ID.RandomizeCryptoKey();
rtn.Lv = Lv; rtn.Lv.RandomizeCryptoKey();
rtn.Amount = Amount; rtn.Amount.RandomizeCryptoKey();
return rtn;
}
}
public class SD_MapData
{
public ObscuredInt Clear;
public Dictionary<string, ObscuredInt> Way = new Dictionary<string, ObscuredInt>();
2024-12-15 01:39:39 +00:00
public List<ObscuredInt> Stat; // 0 힘, 1 민, 2 지
public SD_MapData_Read Get()
{
var rtn = new SD_MapData_Read();
rtn.Clear = Clear;
rtn.Way = DSUtil.Get_T_Dic(Way);
rtn.Stat = DSUtil.Get_T_List(Stat);
2024-12-15 01:39:39 +00:00
return rtn;
}
public bool isClear() { return Clear > 0; }
2024-12-15 01:39:39 +00:00
int Get_Index_byStat(eMainStatType stat)
{
int index = -1;
switch (stat)
{
case eMainStatType.STR: index = 0; break;
case eMainStatType.DEX: index = 1; break;
case eMainStatType.INT: index = 2; break;
}
return index;
}
public ObscuredInt Get_Stat(eMainStatType stat)
{
var index = Get_Index_byStat(stat);
if (index > -1)
return Stat[index];
return 0;
}
public List<ObscuredInt> Get_Stats() { return Stat; }
public void Add_Stat(eMainStatType stat, int addlv)
{
var index = Get_Index_byStat(stat);
if (index > -1)
{
Stat[index] += addlv;
Stat[index].RandomizeCryptoKey();
}
}
}
public class SD_MapData_Read
{
public int Clear;
public Dictionary<string, int> Way = new Dictionary<string, int>();
2024-12-15 01:39:39 +00:00
public List<int> Stat; // 0 힘, 1 민, 2 지
public SD_MapData Get()
{
var rtn = new SD_MapData();
rtn.Clear = Clear;
rtn.Way = DSUtil.Get_T_Dic(Way);
rtn.Stat = DSUtil.Get_T_List(Stat);
2024-12-15 01:39:39 +00:00
return rtn;
}
}
public class SD_Buff
{
public ObscuredInt Infinity; // 1 이상이면 무한 버프
public List<ObscuredInt> Time; // 버프 남은 시간들
public SD_Buff_Read Get()
{
var rtn = new SD_Buff_Read();
rtn.Infinity = Infinity;
rtn.Time = new List<int>();
for (int i = 0; i < Time.Count; i++)
rtn.Time.Add(Time[i]);
return rtn;
}
public bool isInfinity() { return Infinity > 0; }
public int Get_RemainTime(int index) { return Time[index]; }
public void Set_Time(int index, int time) { Time[index] = time; Time[index].RandomizeCryptoKey(); }
public void Sub_Time(int index = -1, int sec = 1)
{
if (index == -1)
{
for (int i = 0; i < Time.Count; i++)
{
if (Time[i] > 0)
{
Time[i] -= sec;
Time[i].RandomizeCryptoKey();
}
}
}
else if (index > -1)
{
if (Time[index] > 0)
{
Time[index] -= sec;
Time[index].RandomizeCryptoKey();
}
}
}
}
public class SD_Buff_Read
{
public int Infinity;
public List<int> Time;
public SD_Buff Get()
{
var rtn = new SD_Buff();
rtn.Infinity = Infinity;
rtn.Infinity.RandomizeCryptoKey();
rtn.Time = new List<ObscuredInt>();
for (int i = 0; i < Time.Count; i++)
rtn.Time.Add(Time[i]);
rtn.Time.ForEach(f => f.RandomizeCryptoKey());
return rtn;
}
}
public class SD_PC
{
public ObscuredInt Lv, ALv, AExp, LLv;
public ObscuredUInt Exp;
public List<ObscuredInt> Stat, Obtain;
// 서버 저장 x
Dictionary<eStat, int> dic_StatIndex = new Dictionary<eStat, int>
{ { eStat.STR, 0 }, { eStat.DEX, 1 }, { eStat.INT, 2 }, { eStat.LUK, 3 } };
public SD_PC()
{
Lv = 1; Lv.RandomizeCryptoKey();
LLv = 1; LLv.RandomizeCryptoKey();
ALv = 1; ALv.RandomizeCryptoKey();
Exp = 0; Exp.RandomizeCryptoKey();
AExp = 0; AExp.RandomizeCryptoKey();
Stat = new List<ObscuredInt> { 0, 0, 0, 0 };
Stat.ForEach(f => f.RandomizeCryptoKey());
Obtain = new List<ObscuredInt>();
}
uint Get_Exp(int lv)
{
float result = Mathf.Pow((lv * 10) + 21 + (lv * 50), 1.05f + Mathf.Sqrt(lv * 0.0000000001f));
return (uint)Mathf.Max(result, 0);
}
public void Add_Exp(uint exp)
{
Exp += exp;
Exp.RandomizeCryptoKey();
while (Exp >= Get_Exp(Lv + 1))
{
++Lv;
Lv.RandomizeCryptoKey();
// TODO 정인호 : 유저 레벨업 함
}
if (MyInfoUI.isIns) MyInfoUI.Ins.Set_Exp();
2024-12-15 01:39:39 +00:00
}
public float Get_ExpSliderValue()
{
float prevLevelExp = Get_Exp(Lv);
float nextLevelExp = Get_Exp(Lv + 1);
return (Exp - prevLevelExp) / (nextLevelExp - prevLevelExp);
2024-12-15 01:39:39 +00:00
}
public void Reset_Stat()
{
for (int i = 0; i < Stat.Count; i++)
{
Stat[i] = 0;
Stat[i].RandomizeCryptoKey();
}
}
public int Get_Stat(eStat stat) { return Stat[dic_StatIndex[stat]]; }
public int Get_UsePoint() { return Stat.Select(stat => (int)stat).Sum(); }
public int Get_Point() { return (Lv - 1) * 5 - Get_UsePoint(); }
2025-03-19 05:50:23 +00:00
public void Add_StatPoint(eStat stat, int add)
2024-12-15 01:39:39 +00:00
{
Stat[dic_StatIndex[stat]] += add;
Stat[dic_StatIndex[stat]].RandomizeCryptoKey();
}
public bool IsObtainPC(int id) { return Obtain.Find(f => f == id) > 0; }
public void Add_PC(int id)
{
if (!IsObtainPC(id))
{
Obtain.Add(id);
Obtain.ForEach(f => f.RandomizeCryptoKey());
}
}
public SD_PC_Read Get()
{
var temp = new SD_PC_Read();
temp.Lv = Lv;
temp.Exp = Exp;
temp.ALv = ALv;
temp.AExp = AExp;
temp.LLv = LLv;
temp.Stat = new List<int>();
for (int i = 0; i < Stat.Count; i++)
temp.Stat.Add(Stat[i]);
temp.Obtain = new List<int>();
for (int i = 0; i < Obtain.Count; i++)
temp.Obtain.Add(Obtain[i]);
return temp;
}
}
public class SD_PC_Read
{
public int Lv, ALv, AExp, LLv;
public uint Exp;
public List<int> Stat, Obtain;
public SD_PC Get()
{
var temp = new SD_PC();
temp.Lv = Lv; temp.Lv.RandomizeCryptoKey();
temp.Exp = Exp; temp.Exp.RandomizeCryptoKey();
temp.ALv = ALv; temp.ALv.RandomizeCryptoKey();
temp.AExp = AExp; temp.AExp.RandomizeCryptoKey();
temp.LLv = LLv; temp.LLv.RandomizeCryptoKey();
temp.Stat = new List<ObscuredInt>();
for (int i = 0; i < Stat.Count; i++)
temp.Stat.Add(Stat[i]);
temp.Stat.ForEach(f => f.RandomizeCryptoKey());
temp.Obtain = new List<ObscuredInt>();
for (int i = 0; i < Obtain.Count; i++)
temp.Obtain.Add(Obtain[i]);
temp.Obtain.ForEach(f => f.RandomizeCryptoKey());
return temp;
}
}
public class SD_PCAwakenData
{
public ObscuredInt Lv, Exp;
public SD_PCAwakenData()
{
Lv = 1; Lv.RandomizeCryptoKey();
}
public SD_PCAwakenData_Read Get()
{
var rtn = new SD_PCAwakenData_Read();
rtn.Lv = Lv;
rtn.Exp = Exp;
return rtn;
}
}
public class SD_PCAwakenData_Read
{
public int Lv, Exp;
public SD_PCAwakenData Get()
{
var rtn = new SD_PCAwakenData();
rtn.Lv = Lv; rtn.Lv.RandomizeCryptoKey();
rtn.Exp = Exp; rtn.Exp.RandomizeCryptoKey();
return rtn;
}
}
public class SD_PCLimitSlotData
{
public ObscuredInt ID, Lv, Lock;
public SD_PCLimitSlotData_Read Get()
{
var rtn = new SD_PCLimitSlotData_Read();
rtn.ID = ID;
rtn.Lv = Lv;
rtn.Lock = Lock;
return rtn;
}
}
public class SD_PCLimitSlotData_Read
{
public int ID, Lv, Lock;
public SD_PCLimitSlotData Get()
{
var rtn = new SD_PCLimitSlotData();
rtn.ID = ID; rtn.ID.RandomizeCryptoKey();
rtn.Lv = Lv; rtn.Lv.RandomizeCryptoKey();
rtn.Lock = Lock; rtn.Lock.RandomizeCryptoKey();
return rtn;
}
}
public class SD_Farm
{
public ObscuredInt MaxSlot;
public List<SD_FarmSlot> Slot;
public Dictionary<string, ObscuredInt> Eat = new Dictionary<string, ObscuredInt>(); // 먹은 갯수
public List<List<ObscuredInt>> Shop; // 0 FarmShop ID, 1 구매 횟수, 2 남은 시간
public SD_Farm()
{
MaxSlot = 0;
MaxSlot.RandomizeCryptoKey();
Slot = new List<SD_FarmSlot>();
for (int i = 0; i < 8; i++)
Slot.Add(new SD_FarmSlot(i));
Shop = table_farmshoplist.Ins.Get_ShopInit();
}
public SD_Farm_Read Get()
{
var temp = new SD_Farm_Read
{
MaxSlot = MaxSlot,
};
temp.Slot = new List<SD_FarmSlot_Read>();
for (int i = 0; i < Slot.Count; i++)
temp.Slot.Add(Slot[i].Get());
foreach (var item in Eat) temp.Eat.Add(item.Key, item.Value);
temp.Shop = DSUtil.Get_T_List(Shop);
return temp;
}
}
public class SD_Farm_Read
{
public int MaxSlot;
public List<SD_FarmSlot_Read> Slot;
public Dictionary<string, int> Eat = new Dictionary<string, int>(); // 먹은 갯수
public List<List<int>> Shop; // 0 FarmShop ID, 1 구매 횟수, 2 남은 시간
public SD_Farm Get()
{
var temp = new SD_Farm
{
MaxSlot = MaxSlot
};
temp.MaxSlot.RandomizeCryptoKey();
temp.Slot = new List<SD_FarmSlot>();
for (int i = 0; i < Slot.Count; i++)
temp.Slot.Add(Slot[i].Get());
foreach (var item in Eat) temp.Eat.Add(item.Key, item.Value);
temp.Shop = DSUtil.Get_T_List(Shop);
return temp;
}
}
public class SD_FarmSlot
{
public ObscuredInt Slot, Grade, EnchantID;
public ObscuredDouble Time;
public SD_FarmSlot() { }
public SD_FarmSlot(int slot)
{
Slot = slot; Slot.RandomizeCryptoKey();
Grade = 0; Grade.RandomizeCryptoKey();
EnchantID = 0; EnchantID.RandomizeCryptoKey();
Time = 0; Time.RandomizeCryptoKey();
}
public SD_FarmSlot_Read Get()
{
return new SD_FarmSlot_Read { Slot = Slot, Grade = Grade, EnchantID = EnchantID, Time = Time };
}
}
public class SD_FarmSlot_Read
{
public int Slot, Grade, EnchantID;
public double Time;
public SD_FarmSlot Get()
{
return new SD_FarmSlot { Slot = Slot, Grade = Grade, EnchantID = EnchantID, Time = Time };
}
}
#endregion