diff --git a/EpinelPS/GameData/GameData.cs b/EpinelPS/GameData/GameData.cs index 562c4f1..57bdcfb 100644 --- a/EpinelPS/GameData/GameData.cs +++ b/EpinelPS/GameData/GameData.cs @@ -53,6 +53,7 @@ namespace EpinelPS.StaticInfo public Dictionary archiveEventQuestRecords = new Dictionary(); public Dictionary archiveEventDungeonStageRecords = new Dictionary(); public Dictionary userTitleRecords = new Dictionary(); + public Dictionary archiveMessengerConditionRecords; @@ -93,6 +94,7 @@ namespace EpinelPS.StaticInfo // Initialize Jukebox data dictionaries jukeboxListDataRecords = new Dictionary(); jukeboxThemeDataRecords = new Dictionary(); + archiveMessengerConditionRecords = new Dictionary(); var rawBytes = File.ReadAllBytes(filePath); Sha256Hash = SHA256.HashData(rawBytes); @@ -444,7 +446,12 @@ namespace EpinelPS.StaticInfo { archiveEventQuestRecords.Add(obj.id, obj); } - + // LOAD ARCHIVE MESSENGER CONDITION TABLE + var archiveMessengerConditionTable = await LoadZip("ArchiveMessengerConditionTable.json", progress); + foreach (var obj in archiveMessengerConditionTable.records) + { + archiveMessengerConditionRecords.Add(obj.id, obj); + } var albumResourceTable = await LoadZip("AlbumResourceTable.json", progress); foreach (var obj in albumResourceTable.records) { diff --git a/EpinelPS/GameData/JsonStaticData.cs b/EpinelPS/GameData/JsonStaticData.cs index 78521cc..2c3d93a 100644 --- a/EpinelPS/GameData/JsonStaticData.cs +++ b/EpinelPS/GameData/JsonStaticData.cs @@ -406,4 +406,25 @@ { public List records; } + + public class ArchiveMessengerConditionList + { + public string condition_type; + public int condition_id; + } + + public class ArchiveMessengerConditionRecord + { + public int id; + public int archive_messenger_group_id; + public List archive_messenger_condition_list; + public string tid; + } + + public class ArchiveMessengerConditionTable + { + public string version; + public List records; + } + } diff --git a/EpinelPS/LobbyServer/Msgs/Archive/GetArchiveStoryDungeon.cs b/EpinelPS/LobbyServer/Msgs/Archive/GetArchiveStoryDungeon.cs index d2c6b24..108698f 100644 --- a/EpinelPS/LobbyServer/Msgs/Archive/GetArchiveStoryDungeon.cs +++ b/EpinelPS/LobbyServer/Msgs/Archive/GetArchiveStoryDungeon.cs @@ -10,18 +10,19 @@ namespace EpinelPS.LobbyServer.Msgs.Archive { var req = await ReadData(); // has EventId field var evid = req.EventId; - - // Retrieve the user based on session (assuming GetCurrentUser is defined elsewhere) var user = GetUser(); - if (user == null) - { - throw new Exception("User not found."); - } - // Access EventData directly + // Ensure the EventInfo dictionary contains the requested EventId if (!user.EventInfo.ContainsKey(evid)) { - throw new Exception($"Event with ID {evid} not found."); + // Create a new default entry for the missing EventId + user.EventInfo[evid] = new EventData + { + CompletedScenarios = new List(), // Initialize empty list + Diff = 0, // Default difficulty + LastStage = 0 // Default last cleared stage + }; + JsonDb.Save(); } var eventData = user.EventInfo[evid]; @@ -30,14 +31,14 @@ namespace EpinelPS.LobbyServer.Msgs.Archive var response = new ResGetArchiveStoryDungeon(); // Populate team data - response.TeamData = new NetUserTeamData() + response.TeamData = new NetUserTeamData { LastContentsTeamNumber = 1, Type = 1 }; // Populate the last cleared stage - response.LastClearedArchiveStageList.Add(new NetLastClearedArchiveStage() + response.LastClearedArchiveStageList.Add(new NetLastClearedArchiveStage { DifficultyId = eventData.Diff, StageId = eventData.LastStage diff --git a/EpinelPS/LobbyServer/Msgs/Archive/MessengerGet.cs b/EpinelPS/LobbyServer/Msgs/Archive/MessengerGet.cs new file mode 100644 index 0000000..ebea1cf --- /dev/null +++ b/EpinelPS/LobbyServer/Msgs/Archive/MessengerGet.cs @@ -0,0 +1,38 @@ +using EpinelPS.Utils; +using EpinelPS.StaticInfo; + +namespace EpinelPS.LobbyServer.Msgs.Archive +{ + [PacketPath("/archive/messenger/get")] + public class GetArchiveMessenger : LobbyMsgHandler + { + protected override async Task HandleAsync() + { + // Read the request containing ArchiveMessengerGroupId + var req = await ReadData(); + var groupId = req.ArchiveMessengerGroupId; + + // Initialize the response object + var response = new ResGetArchiveMessenger(); + + // Get the relevant data from ArchiveMessengerConditionTable + var gameData = GameData.Instance; + + if (gameData.archiveMessengerConditionRecords.TryGetValue(groupId, out var conditionRecord)) + { + foreach (var condition in conditionRecord.archive_messenger_condition_list) + { + // Add each condition as a NetArchiveMessage in the response + response.ArchiveMessageList.Add(new NetArchiveMessage + { + ConditionId = condition.condition_id, + MessageId = conditionRecord.tid // Correctly using tid as MessageId + }); + } + } + + // Write the response back + await WriteDataAsync(response); + } + } +} diff --git a/EpinelPS/LobbyServer/Msgs/Event/ListEvents.cs b/EpinelPS/LobbyServer/Msgs/Event/ListEvents.cs index 8087a47..33dc3fe 100644 --- a/EpinelPS/LobbyServer/Msgs/Event/ListEvents.cs +++ b/EpinelPS/LobbyServer/Msgs/Event/ListEvents.cs @@ -31,6 +31,45 @@ namespace EpinelPS.LobbyServer.Msgs.Event EventEndDate = DateTime.Now.AddDays(20).Ticks, EventDisableDate = DateTime.Now.AddDays(20).Ticks }); + // ice dragon saga story 1 + response.EventList.Add(new NetEventData() + { + Id = 40064, + EventSystemType = 5, + EventVisibleDate = DateTime.UtcNow.Subtract(TimeSpan.FromDays(7)).Ticks, + EventStartDate = DateTime.UtcNow.Subtract(TimeSpan.FromDays(1)).Ticks, + EventEndDate = DateTime.Now.AddDays(20).Ticks, + EventDisableDate = DateTime.Now.AddDays(20).Ticks + }); + // ice dragon saga story 2 + response.EventList.Add(new NetEventData() + { + Id = 40065, + EventSystemType = 5, + EventVisibleDate = DateTime.UtcNow.Subtract(TimeSpan.FromDays(7)).Ticks, + EventStartDate = DateTime.UtcNow.Subtract(TimeSpan.FromDays(1)).Ticks, + EventEndDate = DateTime.Now.AddDays(20).Ticks, + EventDisableDate = DateTime.Now.AddDays(20).Ticks + }); + // ice dragon saga challenge mode + response.EventList.Add(new NetEventData() + { + Id = 60064, + EventSystemType = 20, + EventVisibleDate = DateTime.UtcNow.Subtract(TimeSpan.FromDays(7)).Ticks, + EventStartDate = DateTime.UtcNow.Subtract(TimeSpan.FromDays(1)).Ticks, + EventEndDate = DateTime.Now.AddDays(20).Ticks, + EventDisableDate = DateTime.Now.AddDays(20).Ticks + }); + response.EventList.Add(new NetEventData() + { + Id = 81701, + EventSystemType = 39, + EventVisibleDate = DateTime.UtcNow.Subtract(TimeSpan.FromDays(7)).Ticks, + EventStartDate = DateTime.UtcNow.Subtract(TimeSpan.FromDays(1)).Ticks, + EventEndDate = DateTime.Now.AddDays(20).Ticks, + EventDisableDate = DateTime.Now.AddDays(20).Ticks + }); // banner for new guilotine response.EventList.Add(new NetEventData()