mirror of
https://github.com/MikuLeaks/MikuSB.git
synced 2026-06-04 17:04:13 +00:00
add all weapon & skin on init and fix CallGS
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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", "{}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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", "{}");
|
||||
}
|
||||
}
|
||||
|
||||
24
GameServer/Server/CallGS/Handlers/Girl/GirlSkin_Change.cs
Normal file
24
GameServer/Server/CallGS/Handlers/Girl/GirlSkin_Change.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
@@ -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", "{}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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", "[]");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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", "{}");
|
||||
}
|
||||
}
|
||||
|
||||
5
GameServer/Server/CallGS/Models/Girl/GirlSkin_Change.cs
Normal file
5
GameServer/Server/CallGS/Models/Girl/GirlSkin_Change.cs
Normal file
@@ -0,0 +1,5 @@
|
||||
public class ChangeSkinParam
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int CardId { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user