add all weapon & skin on init and fix CallGS

This commit is contained in:
Naruse
2026-04-25 18:36:35 +08:00
parent 86b1fc75a0
commit a3b421920e
15 changed files with 68 additions and 25 deletions

View File

@@ -38,9 +38,10 @@ public static class CallGSRouter
Logger.Error($"No handler for CallGS API: {req.Api}");
}
public static async Task SendScript(Connection connection, string api, string arg, ushort seqNo = 0)
public static async Task SendScript(Connection connection, string api, string arg, NtfSyncPlayer extra = null!)
{
var rsp = new NtfCallScript { Api = api, Arg = arg };
await connection.SendPacket(CmdIds.RspCallGS, rsp, seqNo);
var rsp = new NtfCallScript { Api = api, Arg = arg, ExtraSync = extra };
await connection.SendPacket(CmdIds.NtfScript, rsp);
await connection.SendPacket(CmdIds.RspCallGS);
}
}

View File

@@ -9,6 +9,6 @@ public class Achievement_GetReward : ICallGSHandler
public async Task Handle(Connection connection, string param, ushort seqNo)
{
// TODO: validate achievement completion and grant reward items
await CallGSRouter.SendScript(connection, "Achievement_GetReward", "{}", seqNo);
await CallGSRouter.SendScript(connection, "Achievement_GetReward", "{}");
}
}

View File

@@ -9,6 +9,6 @@ public class ActivityFace_Update : ICallGSHandler
public async Task Handle(Connection connection, string param, ushort seqNo)
{
// TODO: process face equip/unequip state and return the next face to display
await CallGSRouter.SendScript(connection, "ActivityFace_Update", "{\"nFaceId\":0,\"nId\":0,\"nType\":0}", seqNo);
await CallGSRouter.SendScript(connection, "ActivityFace_Update", "{\"nFaceId\":0,\"nId\":0,\"nType\":0}");
}
}

View File

@@ -8,6 +8,6 @@ public class Daily_GetActivityInfo : ICallGSHandler
public async Task Handle(Connection connection, string param, ushort seqNo)
{
// TODO: return actual daily activity data
await CallGSRouter.SendScript(connection, "Daily_GetActivityInfo", "{}", seqNo);
await CallGSRouter.SendScript(connection, "Daily_GetActivityInfo", "{}");
}
}

View File

@@ -0,0 +1,24 @@
using MikuSB.Proto;
using System.Text.Json;
namespace MikuSB.GameServer.Server.CallGS.Handlers.Daily;
[CallGSApi("GirlSkin_Change")]
public class GirlSkin_Change : ICallGSHandler
{
public async Task Handle(Connection connection, string param, ushort seqNo)
{
var player = connection.Player!;
var girlSkinData = JsonSerializer.Deserialize<ChangeSkinParam>(param);
var cardData = player.CharacterManager.GetCharacterByGUID((uint)girlSkinData!.CardId);
if (cardData == null) return;
cardData.SkinId = (uint)girlSkinData.Id;
var sync = new NtfSyncPlayer
{
Items = { cardData.ToProto() }
};
await CallGSRouter.SendScript(connection, "GirlSkin_Change", "{}", sync);
}
}

View File

@@ -5,6 +5,6 @@ public class Lineup_Update : ICallGSHandler
{
public async Task Handle(Connection connection, string param, ushort seqNo)
{
await CallGSRouter.SendScript(connection, "UpdateLineup", "{}", seqNo);
await CallGSRouter.SendScript(connection, "UpdateLineup", "{}");
}
}

View File

@@ -11,6 +11,6 @@ public class ZoneTime_ReqTime : ICallGSHandler
{
var now = Extensions.GetUnixSec();
var arg = $"{{\"nTime1\":{now},\"nTime2\":{now}}}";
await CallGSRouter.SendScript(connection, "ZoneTime_ChangeTime", arg, seqNo);
await CallGSRouter.SendScript(connection, "ZoneTime_ChangeTime", arg);
}
}

View File

@@ -8,6 +8,6 @@ public class ReqEntranceGreenLevel : ICallGSHandler
public async Task Handle(Connection connection, string param, ushort seqNo)
{
// TODO: return actual skin green levels from player data
await CallGSRouter.SendScript(connection, "ReqEntranceGreenLevel", "[]", seqNo);
await CallGSRouter.SendScript(connection, "ReqEntranceGreenLevel", "[]");
}
}

View File

@@ -9,6 +9,6 @@ public class Role_EnterLevel : ICallGSHandler
public async Task Handle(Connection connection, string param, ushort seqNo)
{
string rsp = $"{{\"tbRet\":{{\"nSeed\":{_random.Next(1, 1000000000)}}}}}";
await CallGSRouter.SendScript(connection, "Role_EnterLevel", rsp, seqNo);
await CallGSRouter.SendScript(connection, "Role_EnterLevel", rsp);
}
}

View File

@@ -8,6 +8,6 @@ public class ShopLogic_GetOpenTime : ICallGSHandler
public async Task Handle(Connection connection, string param, ushort seqNo)
{
// TODO: return actual shop open times from config
await CallGSRouter.SendScript(connection, "ShopLogic_GetOpenTime", "{}", seqNo);
await CallGSRouter.SendScript(connection, "ShopLogic_GetOpenTime", "{}");
}
}

View File

@@ -0,0 +1,5 @@
public class ChangeSkinParam
{
public int Id { get; set; }
public int CardId { get; set; }
}