mirror of
https://github.com/MikuLeaks/MikuSB.git
synced 2026-06-04 09:23:57 +00:00
Remove hardcode (Rogue3D_SelectDiff)
This commit is contained in:
17
Common/Data/Excel/Rogue3DDifficultExcel.cs
Normal file
17
Common/Data/Excel/Rogue3DDifficultExcel.cs
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace MikuSB.Data.Excel;
|
||||||
|
|
||||||
|
[ResourceEntity("server_01_difficult.json")]
|
||||||
|
public class Rogue3DDifficultExcel : ExcelResource
|
||||||
|
{
|
||||||
|
[JsonProperty("DifficultID")] public uint DifficultId { get; set; }
|
||||||
|
[JsonProperty("GameplayGroup")] public List<uint> GameplayGroup { get; set; } = [];
|
||||||
|
|
||||||
|
public override uint GetId() => DifficultId;
|
||||||
|
|
||||||
|
public override void Loaded()
|
||||||
|
{
|
||||||
|
GameData.Rogue3DDifficultData[DifficultId] = this;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -15,6 +15,7 @@ public static class GameData
|
|||||||
public static Dictionary<uint, ChapterLevelExcel> ChapterLevelData { get; private set; } = [];
|
public static Dictionary<uint, ChapterLevelExcel> ChapterLevelData { get; private set; } = [];
|
||||||
public static Dictionary<uint, ArItemExcel> ArItemData { get; private set; } = [];
|
public static Dictionary<uint, ArItemExcel> ArItemData { get; private set; } = [];
|
||||||
public static Dictionary<uint, ManifestationExcel> ManifestationData { get; private set; } = [];
|
public static Dictionary<uint, ManifestationExcel> ManifestationData { get; private set; } = [];
|
||||||
|
public static Dictionary<uint, Rogue3DDifficultExcel> Rogue3DDifficultData { get; private set; } = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class GameResourceTemplateId
|
public static class GameResourceTemplateId
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
|
using MikuSB.Data;
|
||||||
using MikuSB.Database.Player;
|
using MikuSB.Database.Player;
|
||||||
using MikuSB.GameServer.Game.Player;
|
using MikuSB.GameServer.Game.Player;
|
||||||
using MikuSB.Proto;
|
using MikuSB.Proto;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
|
||||||
namespace MikuSB.GameServer.Server.CallGS.Handlers.Rogue3D;
|
namespace MikuSB.GameServer.Server.CallGS.Handlers.Rogue3D;
|
||||||
|
|
||||||
// Selects the Rogue3D difficulty.
|
// Selects the Rogue3D difficulty.
|
||||||
@@ -18,16 +18,6 @@ public class Rogue3D_SelectDiff : ICallGSHandler
|
|||||||
private const uint CurDiffSid = 5;
|
private const uint CurDiffSid = 5;
|
||||||
private const uint GameplayIdSid = 6;
|
private const uint GameplayIdSid = 6;
|
||||||
|
|
||||||
// First gameplay group per difficulty (from server_01_difficult.txt, GameplayGroup column)
|
|
||||||
private static readonly Dictionary<uint, uint> DiffToGameplayGroup = new()
|
|
||||||
{
|
|
||||||
{ 1, 100 },
|
|
||||||
{ 2, 200 },
|
|
||||||
{ 3, 300 },
|
|
||||||
{ 4, 400 },
|
|
||||||
{ 100, 811 },
|
|
||||||
};
|
|
||||||
|
|
||||||
public async Task Handle(Connection connection, string param, ushort seqNo)
|
public async Task Handle(Connection connection, string param, ushort seqNo)
|
||||||
{
|
{
|
||||||
var req = JsonSerializer.Deserialize<SelectDiffParam>(param);
|
var req = JsonSerializer.Deserialize<SelectDiffParam>(param);
|
||||||
@@ -37,7 +27,7 @@ public class Rogue3D_SelectDiff : ICallGSHandler
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!DiffToGameplayGroup.TryGetValue(req.DiffId, out var gameplayGroup))
|
if (!GameData.Rogue3DDifficultData.TryGetValue(req.DiffId, out var cfg) || cfg.GameplayGroup.Count == 0)
|
||||||
{
|
{
|
||||||
await CallGSRouter.SendScript(connection, "Rogue3D_SelectDiff", "{\"sErr\":\"rogue3.massage_gameProcessError\"}");
|
await CallGSRouter.SendScript(connection, "Rogue3D_SelectDiff", "{\"sErr\":\"rogue3.massage_gameProcessError\"}");
|
||||||
return;
|
return;
|
||||||
@@ -47,7 +37,7 @@ public class Rogue3D_SelectDiff : ICallGSHandler
|
|||||||
var sync = new NtfSyncPlayer();
|
var sync = new NtfSyncPlayer();
|
||||||
|
|
||||||
SetAttr(player, CurDiffSid, req.DiffId, sync);
|
SetAttr(player, CurDiffSid, req.DiffId, sync);
|
||||||
SetAttr(player, GameplayIdSid, gameplayGroup, sync);
|
SetAttr(player, GameplayIdSid, cfg.GameplayGroup[0], sync);
|
||||||
|
|
||||||
await CallGSRouter.SendScript(connection, "Rogue3D_SelectDiff", "{}", sync);
|
await CallGSRouter.SendScript(connection, "Rogue3D_SelectDiff", "{}", sync);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user