mirror of
https://github.com/EpinelPS/EpinelPS.git
synced 2025-12-12 23:14:34 +01:00
feat: Implement SimRoom functionality with Simple Mode features - Added SimRoomHelper class to manage SimRoom events and logic. - Implemented SimpleModeSelectBuff handler for buff selection in Simple Mode. - Implemented SimpleModeSetSkipOption to enable/disable skip options. - Implemented SimpleModeSkipAll to handle skipping all Simple Mode stages and reward retrieval. - Implemented SimpleModeSkipBuffSelection for skipping buff selection. - Implemented SimpleModeStart to initiate Simple Mode with event handling. - Updated SimRoom data models to include buffs, legacy buffs, and event tracking. - Updated GameData add SimRoom data tables -Added JsonStaticDataReplenish add SimRoom data models - Enhanced User model to manage weekly reset logic and retain legacy buffs. - Added DateTimeHelper utility for managing time zone specific date calculations. - Updated game configuration for static data and resource URLs.
61 lines
1.9 KiB
C#
61 lines
1.9 KiB
C#
using EpinelPS.Database;
|
|
using EpinelPS.Utils;
|
|
using log4net;
|
|
|
|
namespace EpinelPS.LobbyServer.Simroom
|
|
{
|
|
[PacketPath("/simroom/clearbattle")]
|
|
public class ClearBattle : LobbyMsgHandler
|
|
{
|
|
private static readonly ILog log = LogManager.GetLogger(typeof(ClearBattle));
|
|
|
|
protected override async Task HandleAsync()
|
|
{
|
|
// {"location":{"chapter":3,"stage":3,"order":2},"event":111011143,"teamNumber":1,"antiCheatAdditionalInfo":{"clientLocalTime":"638993283799771900"}}
|
|
ReqClearSimRoomBattle req = await ReadData<ReqClearSimRoomBattle>();
|
|
User user = GetUser();
|
|
|
|
ResClearSimRoomBattle response = new()
|
|
{
|
|
Result = SimRoomResult.Success
|
|
};
|
|
|
|
// OverclockOptionChangedHps
|
|
|
|
// Teams
|
|
try
|
|
{
|
|
var team = SimRoomHelper.GetTeamData(user, req.TeamNumber, [.. req.RemainingHps]);
|
|
if (team is not null) response.Teams.Add(team);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
log.Error($"ClearBattle Response Team Exception :{e.Message}");
|
|
}
|
|
|
|
SimRoomHelper.UpdateUserRemainingHps(user, [.. req.RemainingHps], req.TeamNumber);
|
|
|
|
if (req.BattleResult == 1)
|
|
{
|
|
// BuffOptions
|
|
try
|
|
{
|
|
var buffOptions = SimRoomHelper.GetBuffOptions(user, req.Location);
|
|
if (buffOptions is not null && buffOptions.Count > 0)
|
|
{
|
|
response.BuffOptions.AddRange(buffOptions);
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
log.Error($"ClearBattle Response BuffOptions Exception :{e.Message}");
|
|
}
|
|
}
|
|
|
|
JsonDb.Save();
|
|
await WriteDataAsync(response);
|
|
}
|
|
|
|
|
|
}
|
|
} |