strictly necessary handlers

This commit is contained in:
rfi
2024-02-20 23:47:02 +07:00
parent 3dc95a1044
commit 11263bd61e
12 changed files with 217 additions and 6 deletions

View File

@@ -1,7 +1,7 @@
using BLHX.Server.Common.Database;
using BLHX.Server.Common.Proto;
using BLHX.Server.Common.Proto.p11;
using BLHX.Server.Common.Utils;
using BLHX.Server.Game.Handlers;
using ProtoBuf;
using System.Buffers.Binary;
using System.Net;
@@ -117,6 +117,13 @@ namespace BLHX.Server.Game
ns.Write(sendBuf);
}
public void InitClientData()
{
this.NotifyPlayerData();
this.NotifyStatisticsInit();
this.NotifyShipData();
}
public void SendHttpResponse(string rsp, string type = "text/plain")
{
tcpClient.GetStream().Write(Encoding.UTF8.GetBytes(

View File

@@ -8,9 +8,7 @@ namespace BLHX.Server.Game.Handlers
[PacketHandler(Command.Cs11001)]
static void ServerTimeHandler(Connection connection, Packet packet)
{
connection.NotifyPlayerData();
connection.NotifyStatisticsInit();
connection.NotifyShipData();
connection.InitClientData();
connection.Send(new Sc11002()
{
Timestamp = (uint)DateTimeOffset.Now.ToUnixTimeSeconds(),
@@ -19,6 +17,18 @@ namespace BLHX.Server.Game.Handlers
});
}
[PacketHandler(Command.Cs11603)]
static void FetchSecondaryPasswordHandler(Connection connection, Packet packet)
{
connection.Send(new Sc11604());
}
[PacketHandler(Command.Cs11017)]
static void StageDropListHandler(Connection connection, Packet packet)
{
connection.Send(new Sc11018());
}
[PacketHandler(Command.Cs11401)]
static void ChangeChatRoomHandler(Connection connection, Packet packet)
{
@@ -51,7 +61,10 @@ namespace BLHX.Server.Game.Handlers
GmFlag = 1,
Rank = 1,
GuideIndex = 1,
ChatRoomId = 1,
RegisterTime = (uint)new DateTimeOffset(connection.player.CreatedAt).ToUnixTimeSeconds(),
ShipCount = (uint)connection.player.Ships.Count,
CommanderBagMax = 40,
Display = connection.player.DisplayInfo,
Appreciation = new()
});

View File

@@ -18,5 +18,18 @@ namespace BLHX.Server.Game.Handlers
});
}
}
public static void NotifyFleetData(this Connection connection)
{
if (connection.player is not null)
{
connection.Send(new Sc12101()
{
GroupLists = [
new Groupinfo() { Id = 1, ShipLists = [1, 2] }
]
});
}
}
}
}

View File

@@ -0,0 +1,17 @@
using BLHX.Server.Common.Proto;
using BLHX.Server.Common.Proto.p18;
namespace BLHX.Server.Game.Handlers
{
internal static class P18
{
[PacketHandler(Command.Cs18001)]
static void SeasonInfoHandler(Connection connection, Packet packet)
{
connection.Send(new Sc18002()
{
Rank = 1
});
}
}
}

View File

@@ -0,0 +1,14 @@
using BLHX.Server.Common.Proto;
using BLHX.Server.Common.Proto.p24;
namespace BLHX.Server.Game.Handlers
{
internal static class P24
{
[PacketHandler(Command.Cs24020)]
static void LimitChallengeHandler(Connection connection, Packet packet)
{
connection.Send(new Sc24021());
}
}
}

View File

@@ -0,0 +1,14 @@
using BLHX.Server.Common.Proto;
using BLHX.Server.Common.Proto.p26;
namespace BLHX.Server.Game.Handlers
{
internal static class P26
{
[PacketHandler(Command.Cs26101)]
static void MiniGameHandler(Connection connection, Packet packet)
{
connection.Send(new Sc26102());
}
}
}

View File

@@ -0,0 +1,53 @@
using BLHX.Server.Common.Proto;
using BLHX.Server.Common.Proto.p27;
using BLHX.Server.Common.Utils;
namespace BLHX.Server.Game.Handlers
{
internal static class P27
{
[PacketHandler(Command.Cs27000)]
static void EducateHandler(Connection connection, Packet packet)
{
connection.Send(new Sc27001()
{
Child = new()
{
Tid = 1,
CurTime = new() { Month = (uint)DateTimeOffset.Now.Month, Week = (uint)DateTime.Now.GetWeekOfMonth(), Day = (uint)DateTimeOffset.Now.AddDays(-1).DayOfWeek },
Mood = 50,
Money = 20,
Attrs = [
new ChildAttr() { Id = 101, Val = 0 },
new ChildAttr() { Id = 102, Val = 0 },
new ChildAttr() { Id = 103, Val = 0 },
new ChildAttr() { Id = 104, Val = 0 },
new ChildAttr() { Id = 201, Val = 0 },
new ChildAttr() { Id = 202, Val = 0 },
new ChildAttr() { Id = 203, Val = 0 },
new ChildAttr() { Id = 301, Val = 0 },
new ChildAttr() { Id = 302, Val = 0 },
new ChildAttr() { Id = 303, Val = 0 },
new ChildAttr() { Id = 304, Val = 0 },
new ChildAttr() { Id = 305, Val = 0 },
new ChildAttr() { Id = 306, Val = 0 }
],
Favor = new() { Lv = 1, Exp = 0 },
Tasks = [
new ChildTask() { Id = 101, Progress = 0 },
new ChildTask() { Id = 102, Progress = 0 },
new ChildTask() { Id = 103, Progress = 0 },
],
CanTriggerHomeEvent = 1,
NewGamePlusCount = 1
}
});
}
[PacketHandler(Command.Cs27010)]
static void EducateEndingsHandler(Connection connection, Packet packet)
{
connection.Send(new Sc27011());
}
}
}

View File

@@ -0,0 +1,18 @@
using BLHX.Server.Common.Proto;
using BLHX.Server.Common.Proto.p34;
namespace BLHX.Server.Game.Handlers
{
internal static class P34
{
[PacketHandler(Command.Cs34001)]
static void GetMetaPTHandler(Connection connection, Packet packet)
{
var req = packet.Decode<Cs34001>();
connection.Send(new Sc34002()
{
MetaShipLists = req.GroupIds.Select(x => new MetaShipInfo() { GroupId = x }).ToList()
});
}
}
}

View File

@@ -0,0 +1,35 @@
using BLHX.Server.Common.Proto;
using BLHX.Server.Common.Proto.p60;
namespace BLHX.Server.Game.Handlers
{
internal static class P60
{
[PacketHandler(Command.Cs60037)]
static void GuildInfoHandler(Connection connection, Packet packet)
{
connection.Send(new Sc60000()
{
Guild = new()
{
DonateTasks = [1],
TechIds = [8, 0, 18, 6, 8, 0, 16, 0, 24, 0, 24, 0, 40, 0, 48, 0, 56, 0, 64, 0],
BenefitTime = 1,
WeeklyTaskFlag = 1
}
});
}
[PacketHandler(Command.Cs60102)]
static void GuildUserInfoHandler(Connection connection, Packet packet)
{
connection.Send(new Sc60103()
{
UserInfo = new()
{
DonateTasks = [1, 20, 4]
}
});
}
}
}

View File

@@ -0,0 +1,14 @@
using BLHX.Server.Common.Proto;
using BLHX.Server.Common.Proto.p62;
namespace BLHX.Server.Game.Handlers
{
internal static class P62
{
[PacketHandler(Command.Cs62100)]
static void GuildPublicUserDataHandler(Connection connection, Packet packet)
{
connection.Send(new Sc62101());
}
}
}