diff --git a/Assets/PlayFabEditorExtensions/Editor/Resources/.CloudScript.js b/Assets/PlayFabEditorExtensions/Editor/Resources/.CloudScript.js index e62780bce..a08ff7aa2 100644 --- a/Assets/PlayFabEditorExtensions/Editor/Resources/.CloudScript.js +++ b/Assets/PlayFabEditorExtensions/Editor/Resources/.CloudScript.js @@ -688,6 +688,13 @@ function Init_Shop(urod, type) } } +class SD_MapData { + constructor() { + this.Clear = 0; // ObscuredInt 대체 (보안 필요하면 다른 암호화 방식 적용) + this.Way = {}; // string -> int + this.Stat = [0, 0, 0]; // 0 힘, 1 민, 2 지 + } +} handlers.Save_StageResult = function(args) { var readonlydata = Get_UserReadOnlyData(); @@ -698,6 +705,15 @@ handlers.Save_StageResult = function(args) var table = Get_MissionTable(); var itemtable = Get_ItemTable(); + urod.Common[7] = args.Auto; + + // 맵 데이터 체크 + let key1 = args.MapID; + let key2 = args.Diff; + if (!urod.MapData[key1]) urod.MapData[key1] = {}; + if (!urod.MapData[key1][key2]) urod.MapData[key1][key2] = new SD_MapData(); + var mapdata = urod.MapData[key1][key2]; + // 경험치 처리 urod.PC.Exp = Add_Amount(urod.PC.Exp, args.Exp); while (urod.PC.Exp >= Get_Exp(urod.PC.Lv + 1)) { @@ -713,6 +729,21 @@ handlers.Save_StageResult = function(args) Add_Item(table, itemtable, urod, itemId, itemCount); } + // 힘민지 레벨업 처리 (기존 골드 + 획득한 골드 - 사용한 골드) + if (Check_ItemAmount(urod, 2, args.UseGold)) + { + Use_Item(table, urod, 2, args.UseGold); + + mapdata.Stat[0] = Add_Amount(mapdata.Stat[0], args.AddStatSTR); + mapdata.Stat[1] = Add_Amount(mapdata.Stat[1], args.AddStatDEX); + mapdata.Stat[2] = Add_Amount(mapdata.Stat[2], args.AddStatINT); + } + let rtnmainStat = { + STR: mapdata.Stat[0], + DEX: mapdata.Stat[1], + INT: mapdata.Stat[2] + }; + // 몬스터 킬 처리 var mobcount = 0; for (var key in args.Mob) { @@ -750,7 +781,7 @@ handlers.Save_StageResult = function(args) Add_MissionCount(table, urod, "ARRIVAL_MAP_LIMIT", args.MapID, 1); Set_JsonUserData(urod); - return Get_Return(0); + return Get_Return(0, { gold : Get_ItemAmount(urod, 2) , mainstat : rtnmainStat }); } handlers.Save_PC_Stat = function(args) diff --git a/Assets/Script/Character/Projectile/ProjectileBase.cs b/Assets/Script/Character/Projectile/ProjectileBase.cs index 176915c9b..ed849723a 100644 --- a/Assets/Script/Character/Projectile/ProjectileBase.cs +++ b/Assets/Script/Character/Projectile/ProjectileBase.cs @@ -3,7 +3,6 @@ using System; using System.Collections; using System.Collections.Generic; using UnityEngine; -using static UnityEngine.GraphicsBuffer; public enum eProjectileStartPos { None, Shooter, ShooterCenter, Target, TargetCenter, Custom } public enum eProjectileStrait { Forward, Down } diff --git a/Assets/Script/Info/DropItemInfo.cs b/Assets/Script/Info/DropItemInfo.cs index 2897d780d..046ff4718 100644 --- a/Assets/Script/Info/DropItemInfo.cs +++ b/Assets/Script/Info/DropItemInfo.cs @@ -169,4 +169,5 @@ public class StageDropData UseGold += gold; UseGold.RandomizeCryptoKey(); ++AddMainStat[stat]; AddMainStat[stat].RandomizeCryptoKey(); } + public int Get_MainStat(eMainStatType stat) { return AddMainStat[stat].GetDecrypted(); } } \ No newline at end of file diff --git a/Assets/Script/Server/ServerClass.cs b/Assets/Script/Server/ServerClass.cs index 36b5830ce..cc8f4f2f7 100644 --- a/Assets/Script/Server/ServerClass.cs +++ b/Assets/Script/Server/ServerClass.cs @@ -438,6 +438,14 @@ public partial class ServerData if (MapData.ContainsKey(key1) && MapData[key1].ContainsKey(key2)) MapData[key1][key2].Add_Stat(stat, addlv); } + public void MapData_Set_StatLv(int mapid, int diff, eMainStatType stat, int lv) + { + Check_MapData(mapid, diff); + var key1 = Get_Key(mapid); + var key2 = Get_Key(diff); + if (MapData.ContainsKey(key1) && MapData[key1].ContainsKey(key2)) + MapData[key1][key2].Set_Stat(stat, lv); + } #endregion #region 스킬 public int Get_EquipSkillID(int _slot) { return Equip.Skill[Equip.Preset][_slot]; } @@ -1902,6 +1910,79 @@ public partial class ServerData } return new List { _itemdata }; } + public void Set_Item(int id, double amount) + { + var itemdata = table_itemlist.Ins.Get_Data(id); + var key = Get_Key(id); +#if UNITY_EDITOR + if (itemdata == null) + { + string errorMessage = $"Item ID {id} not found!"; + string callStack = Environment.StackTrace; + + // 로그 추가 + var logEntry = new LogEntry(id.ToString(), errorMessage, callStack); + + // 텍스트 파일에 저장 + DSUtil.SaveLogToFile(logEntry); + return; + } +#endif + switch (itemdata.e_ItemType) + { + default: + if (!Item.ContainsKey(key)) + Item.Add(key, new List { amount, amount, 0 }); + else + { + Item[key][0] = amount; + Item[key][0].RandomizeCryptoKey(); + } + + if (TopMoney.isIns) TopMoney.Ins.Set(); + MoneyForm.Refresh_MoneyForms(); + 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 { amount, 0, 0 }); + else + Equipment[key][0] = amount; + Equipment[key][0].RandomizeCryptoKey(); + break; + + case eItem.Skill: Add_Skill(id, (int)amount); break; + + case eItem.PC: PC.Add_PC(id); break; + case eItem.Pet: + if (!Pet.ContainsKey(key)) + Pet.Add(key, new List { (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 { 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 { 0, 0, 0 }); + Relic[key][0] = (int)amount; + Relic[key][0].RandomizeCryptoKey(); + break; + } + } public void Add_Item(int id, double amount) { var itemdata = table_itemlist.Ins.Get_Data(id); @@ -2528,6 +2609,15 @@ public class SD_MapData Stat[index].RandomizeCryptoKey(); } } + public void Set_Stat(eMainStatType stat, int lv) + { + var index = Get_Index_byStat(stat); + if (index > -1) + { + Stat[index] = lv; + Stat[index].RandomizeCryptoKey(); + } + } } public class SD_MapData_Read { @@ -3006,6 +3096,11 @@ public class SC_InitResult public bool initDaily, initWeek, initMonth; public List> farmshop; } +public class SC_StageResult +{ + public int gold; + public Dictionary mainstat; +} public class SC_Items { public int itemid, amount; diff --git a/Assets/Script/Server/ServerInfo.cs b/Assets/Script/Server/ServerInfo.cs index 270867568..1f0722699 100644 --- a/Assets/Script/Server/ServerInfo.cs +++ b/Assets/Script/Server/ServerInfo.cs @@ -793,7 +793,7 @@ public class ServerInfo : MyCoroutine }); } - public void Save_StageResult(Action _act = null) + public void Save_StageResult(Action _act) { NetWait.Ins.Set(true); Dictionary items = new Dictionary(); @@ -823,12 +823,18 @@ public class ServerInfo : MyCoroutine FunctionParameter = new { Token = m_LoginInfo.EntityToken.EntityToken, + Diff = MyValue.MyChoiceMapData.n_Difficult, MapID = MyValue.MyChoiceMapData.n_MapID, Exp = DropItemInfo.Ins.m_StageDropData.GetExp.GetDecrypted(), + UseGold = DropItemInfo.Ins.m_StageDropData.UseGold.GetDecrypted(), + AddStatSTR = DropItemInfo.Ins.m_StageDropData.Get_MainStat(eMainStatType.STR), + AddStatDEX = DropItemInfo.Ins.m_StageDropData.Get_MainStat(eMainStatType.DEX), + AddStatINT = DropItemInfo.Ins.m_StageDropData.Get_MainStat(eMainStatType.INT), Item = items, Mob = MobKill, Elite = EliteKill, - Boss = BossKill + Boss = BossKill, + Auto = m_ServerData.Get_Common(eCommon.Auto), } }, result => @@ -836,12 +842,13 @@ public class ServerInfo : MyCoroutine if (result.Error == null) { NetWait.Ins.Set(false); - var error = MyErrorCheck(result.FunctionResult.ToString()); + var str_result = result.FunctionResult.ToString(); + var error = MyErrorCheck(str_result); switch (error) { - case 0: _act?.Invoke(); break; - //case 1: ToastUI.Ins.Set(999900001); break; - //default: ToastUI.Ins.Set(999900002); break; + case 0: _act?.Invoke(JsonConvert.DeserializeObject(str_result)); break; + //case 1: ToastUI.Ins.Set(999900001); break; + //default: ToastUI.Ins.Set(999900002); break; } } else diff --git a/Assets/Script/UI/Common/GuideQuestUI.cs b/Assets/Script/UI/Common/GuideQuestUI.cs index 46cd358bb..38e4abb61 100644 --- a/Assets/Script/UI/Common/GuideQuestUI.cs +++ b/Assets/Script/UI/Common/GuideQuestUI.cs @@ -12,7 +12,7 @@ public class GuideQuestUI : MonoBehaviour MissionListTableData Tdata; List List_CurArrow = new List(); - bool bOn = true; + bool bOn = true, showtoast = false; private void Awake() { @@ -136,7 +136,11 @@ public class GuideQuestUI : MonoBehaviour var sdata = ServerInfo.Ins.m_ServerData; sdata.Add_Common(eCommon.GuideCount, _v); Set_Count(); - if (gos[0].activeSelf) ToastUI.Ins.Set(161); + if (!showtoast && gos[0].activeSelf) + { + showtoast = true; + ToastUI.Ins.Set(161); + } List_CurArrow.ForEach(f => f.SetActive(false)); List_CurArrow.Clear(); //GuideQuestArrow.Ins.AllArrowOff(); @@ -153,6 +157,7 @@ public class GuideQuestUI : MonoBehaviour var sdata = ServerInfo.Ins.m_ServerData; if (sdata.Get_Common(eCommon.GuideCount) >= Tdata.l_MissionConditionCount) { + showtoast = false; sdata.Set_Common(eCommon.GuideCount, 0); sdata.Add_Common(eCommon.GuideStep); //GetItemUI.Ins.Set(sdata.Add_Item(new ItemData(Tdata.e_Reward, Tdata.n_RewardID, Tdata.n_RewardAmount, DSUtil.Format("guide {0}", Tdata.ID), eUICardType.GetItem))); diff --git a/Assets/Script/UI/NewGameUI.cs b/Assets/Script/UI/NewGameUI.cs index 433921c67..afd7643e8 100644 --- a/Assets/Script/UI/NewGameUI.cs +++ b/Assets/Script/UI/NewGameUI.cs @@ -125,7 +125,15 @@ public class NewGameUI : MonoBehaviourSingletonTemplate DungeonInfo.Ins.Stop_Dungeon(null); else { - ServerInfo.Ins.Save_StageResult(); + ServerInfo.Ins.Save_StageResult(result => + { + var sdata = ServerInfo.Ins.m_ServerData; + sdata.Set_Item(2, result.gold); + var map = MyValue.MyChoiceMapData; + sdata.MapData_Set_StatLv(map.n_MapID, map.n_Difficult, eMainStatType.STR, result.mainstat[eMainStatType.STR]); + sdata.MapData_Set_StatLv(map.n_MapID, map.n_Difficult, eMainStatType.DEX, result.mainstat[eMainStatType.DEX]); + sdata.MapData_Set_StatLv(map.n_MapID, map.n_Difficult, eMainStatType.INT, result.mainstat[eMainStatType.INT]); + }); InGameInfo.Ins.Return_To_Lobby(); }