mirror of
https://github.com/EpinelPS/EpinelPS.git
synced 2025-12-12 15:04:36 +01:00
Fix archives at least i think so
This commit is contained in:
@@ -53,6 +53,7 @@ namespace EpinelPS.StaticInfo
|
|||||||
public Dictionary<int, ArchiveEventQuestRecord> archiveEventQuestRecords = new Dictionary<int, ArchiveEventQuestRecord>();
|
public Dictionary<int, ArchiveEventQuestRecord> archiveEventQuestRecords = new Dictionary<int, ArchiveEventQuestRecord>();
|
||||||
public Dictionary<int, ArchiveEventDungeonStageRecord> archiveEventDungeonStageRecords = new Dictionary<int, ArchiveEventDungeonStageRecord>();
|
public Dictionary<int, ArchiveEventDungeonStageRecord> archiveEventDungeonStageRecords = new Dictionary<int, ArchiveEventDungeonStageRecord>();
|
||||||
public Dictionary<int, UserTitleRecord> userTitleRecords = new Dictionary<int, UserTitleRecord>();
|
public Dictionary<int, UserTitleRecord> userTitleRecords = new Dictionary<int, UserTitleRecord>();
|
||||||
|
public Dictionary<int, ArchiveMessengerConditionRecord> archiveMessengerConditionRecords;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -93,6 +94,7 @@ namespace EpinelPS.StaticInfo
|
|||||||
// Initialize Jukebox data dictionaries
|
// Initialize Jukebox data dictionaries
|
||||||
jukeboxListDataRecords = new Dictionary<int, JukeboxListRecord>();
|
jukeboxListDataRecords = new Dictionary<int, JukeboxListRecord>();
|
||||||
jukeboxThemeDataRecords = new Dictionary<int, JukeboxThemeRecord>();
|
jukeboxThemeDataRecords = new Dictionary<int, JukeboxThemeRecord>();
|
||||||
|
archiveMessengerConditionRecords = new Dictionary<int, ArchiveMessengerConditionRecord>();
|
||||||
|
|
||||||
var rawBytes = File.ReadAllBytes(filePath);
|
var rawBytes = File.ReadAllBytes(filePath);
|
||||||
Sha256Hash = SHA256.HashData(rawBytes);
|
Sha256Hash = SHA256.HashData(rawBytes);
|
||||||
@@ -444,7 +446,12 @@ namespace EpinelPS.StaticInfo
|
|||||||
{
|
{
|
||||||
archiveEventQuestRecords.Add(obj.id, obj);
|
archiveEventQuestRecords.Add(obj.id, obj);
|
||||||
}
|
}
|
||||||
|
// LOAD ARCHIVE MESSENGER CONDITION TABLE
|
||||||
|
var archiveMessengerConditionTable = await LoadZip<ArchiveMessengerConditionTable>("ArchiveMessengerConditionTable.json", progress);
|
||||||
|
foreach (var obj in archiveMessengerConditionTable.records)
|
||||||
|
{
|
||||||
|
archiveMessengerConditionRecords.Add(obj.id, obj);
|
||||||
|
}
|
||||||
var albumResourceTable = await LoadZip<AlbumResourceTable>("AlbumResourceTable.json", progress);
|
var albumResourceTable = await LoadZip<AlbumResourceTable>("AlbumResourceTable.json", progress);
|
||||||
foreach (var obj in albumResourceTable.records)
|
foreach (var obj in albumResourceTable.records)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -406,4 +406,25 @@
|
|||||||
{
|
{
|
||||||
public List<UserTitleRecord> records;
|
public List<UserTitleRecord> 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<ArchiveMessengerConditionList> archive_messenger_condition_list;
|
||||||
|
public string tid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ArchiveMessengerConditionTable
|
||||||
|
{
|
||||||
|
public string version;
|
||||||
|
public List<ArchiveMessengerConditionRecord> records;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,18 +10,19 @@ namespace EpinelPS.LobbyServer.Msgs.Archive
|
|||||||
{
|
{
|
||||||
var req = await ReadData<ReqGetArchiveStoryDungeon>(); // has EventId field
|
var req = await ReadData<ReqGetArchiveStoryDungeon>(); // has EventId field
|
||||||
var evid = req.EventId;
|
var evid = req.EventId;
|
||||||
|
|
||||||
// Retrieve the user based on session (assuming GetCurrentUser is defined elsewhere)
|
|
||||||
var user = GetUser();
|
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))
|
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<string>(), // Initialize empty list
|
||||||
|
Diff = 0, // Default difficulty
|
||||||
|
LastStage = 0 // Default last cleared stage
|
||||||
|
};
|
||||||
|
JsonDb.Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
var eventData = user.EventInfo[evid];
|
var eventData = user.EventInfo[evid];
|
||||||
@@ -30,14 +31,14 @@ namespace EpinelPS.LobbyServer.Msgs.Archive
|
|||||||
var response = new ResGetArchiveStoryDungeon();
|
var response = new ResGetArchiveStoryDungeon();
|
||||||
|
|
||||||
// Populate team data
|
// Populate team data
|
||||||
response.TeamData = new NetUserTeamData()
|
response.TeamData = new NetUserTeamData
|
||||||
{
|
{
|
||||||
LastContentsTeamNumber = 1,
|
LastContentsTeamNumber = 1,
|
||||||
Type = 1
|
Type = 1
|
||||||
};
|
};
|
||||||
|
|
||||||
// Populate the last cleared stage
|
// Populate the last cleared stage
|
||||||
response.LastClearedArchiveStageList.Add(new NetLastClearedArchiveStage()
|
response.LastClearedArchiveStageList.Add(new NetLastClearedArchiveStage
|
||||||
{
|
{
|
||||||
DifficultyId = eventData.Diff,
|
DifficultyId = eventData.Diff,
|
||||||
StageId = eventData.LastStage
|
StageId = eventData.LastStage
|
||||||
|
|||||||
38
EpinelPS/LobbyServer/Msgs/Archive/MessengerGet.cs
Normal file
38
EpinelPS/LobbyServer/Msgs/Archive/MessengerGet.cs
Normal file
@@ -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<ReqGetArchiveMessenger>();
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -31,6 +31,45 @@ namespace EpinelPS.LobbyServer.Msgs.Event
|
|||||||
EventEndDate = DateTime.Now.AddDays(20).Ticks,
|
EventEndDate = DateTime.Now.AddDays(20).Ticks,
|
||||||
EventDisableDate = 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
|
// banner for new guilotine
|
||||||
response.EventList.Add(new NetEventData()
|
response.EventList.Add(new NetEventData()
|
||||||
|
|||||||
Reference in New Issue
Block a user