mirror of
https://github.com/rafi1212122/BLHX.Server.git
synced 2025-12-13 06:54:51 +01:00
player dbs...
This commit is contained in:
@@ -31,7 +31,7 @@ namespace BLHX.Server.Game.Handlers
|
||||
"dTag-1"
|
||||
],
|
||||
Timestamp = (uint)DateTimeOffset.Now.ToUnixTimeSeconds(),
|
||||
Monday0oclockTimestamp = 1606114800
|
||||
Monday0oclockTimestamp = Connection.Monday0oclockTimestamp
|
||||
});
|
||||
connection.EndProtocol();
|
||||
}
|
||||
@@ -75,10 +75,40 @@ namespace BLHX.Server.Game.Handlers
|
||||
{
|
||||
rsp.Result = 1;
|
||||
connection.Send(rsp);
|
||||
connection.EndProtocol();
|
||||
return;
|
||||
}
|
||||
// TODO: Create/access player data!
|
||||
|
||||
connection.account = account;
|
||||
rsp.ServerTicket = req.ServerTicket;
|
||||
|
||||
var player = DBManager.PlayerContext.Players.SingleOrDefault(x => x.Token == req.ServerTicket);
|
||||
if (player is null)
|
||||
{
|
||||
connection.Send(rsp);
|
||||
return;
|
||||
}
|
||||
|
||||
connection.player = player;
|
||||
rsp.UserId = player.Uid;
|
||||
connection.Send(rsp);
|
||||
}
|
||||
|
||||
[PacketHandler(Command.Cs10024)]
|
||||
static void CreateNewPlayerHandler(Connection connection, Packet packet)
|
||||
{
|
||||
var req = packet.Decode<Cs10024>();
|
||||
var rsp = new Sc10025();
|
||||
if (connection.player is not null)
|
||||
{
|
||||
rsp.Result = 1011;
|
||||
connection.Send(rsp);
|
||||
return;
|
||||
}
|
||||
|
||||
var player = DBManager.PlayerContext.Init(connection.account.Token, req.ShipId, req.NickName);
|
||||
connection.player = player;
|
||||
rsp.UserId = connection.player.Uid;
|
||||
connection.Send(rsp);
|
||||
}
|
||||
|
||||
|
||||
61
BLHX.Server.Game/Handlers/P11.cs
Normal file
61
BLHX.Server.Game/Handlers/P11.cs
Normal file
@@ -0,0 +1,61 @@
|
||||
using BLHX.Server.Common.Proto;
|
||||
using BLHX.Server.Common.Proto.p11;
|
||||
|
||||
namespace BLHX.Server.Game.Handlers
|
||||
{
|
||||
internal static class P11
|
||||
{
|
||||
[PacketHandler(Command.Cs11001)]
|
||||
static void ServerTimeHandler(Connection connection, Packet packet)
|
||||
{
|
||||
connection.NotifyPlayerData();
|
||||
connection.NotifyStatisticsInit();
|
||||
connection.NotifyShipData();
|
||||
connection.Send(new Sc11002()
|
||||
{
|
||||
Timestamp = (uint)DateTimeOffset.Now.ToUnixTimeSeconds(),
|
||||
Monday0oclockTimestamp = Connection.Monday0oclockTimestamp,
|
||||
ShipCount = connection.player is null ? 0 : (uint)connection.player.Ships.Count
|
||||
});
|
||||
}
|
||||
|
||||
[PacketHandler(Command.Cs11401)]
|
||||
static void ChangeChatRoomHandler(Connection connection, Packet packet)
|
||||
{
|
||||
var req = packet.Decode<Cs11401>();
|
||||
|
||||
connection.Send(new Sc11402()
|
||||
{
|
||||
Result = 0,
|
||||
RoomId = req.RoomId
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
static class P11ConnectionNotifyExtensions
|
||||
{
|
||||
public static void NotifyPlayerData(this Connection connection)
|
||||
{
|
||||
if (connection.player is not null)
|
||||
{
|
||||
connection.Send(new Sc11003()
|
||||
{
|
||||
Id = connection.player.Uid,
|
||||
Name = connection.player.Name,
|
||||
Level = connection.player.Level,
|
||||
Exp = connection.player.Exp,
|
||||
ResourceLists = connection.player.Resources.Select(x => new Resource() { Num = x.Num, Type = x.Id }).ToList(),
|
||||
Characters = [1],
|
||||
ShipBagMax = 150,
|
||||
EquipBagMax = 350,
|
||||
GmFlag = 1,
|
||||
Rank = 1,
|
||||
GuideIndex = 1,
|
||||
RegisterTime = (uint)new DateTimeOffset(connection.player.CreatedAt).ToUnixTimeSeconds(),
|
||||
Display = connection.player.DisplayInfo,
|
||||
Appreciation = new()
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
22
BLHX.Server.Game/Handlers/P12.cs
Normal file
22
BLHX.Server.Game/Handlers/P12.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using BLHX.Server.Common.Proto.p12;
|
||||
|
||||
namespace BLHX.Server.Game.Handlers
|
||||
{
|
||||
internal static class P12
|
||||
{
|
||||
}
|
||||
|
||||
static class P12ConnectionNotifyExtensions
|
||||
{
|
||||
public static void NotifyShipData(this Connection connection)
|
||||
{
|
||||
if (connection.player is not null)
|
||||
{
|
||||
connection.Send(new Sc12001()
|
||||
{
|
||||
Shiplists = connection.player.Ships.Select(x => x.ToProto()).ToList()
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
34
BLHX.Server.Game/Handlers/P17.cs
Normal file
34
BLHX.Server.Game/Handlers/P17.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using BLHX.Server.Common.Data;
|
||||
using BLHX.Server.Common.Proto.p17;
|
||||
|
||||
namespace BLHX.Server.Game.Handlers
|
||||
{
|
||||
internal class P17
|
||||
{
|
||||
}
|
||||
|
||||
static class P17ConnectionNotifyExtensions
|
||||
{
|
||||
public static void NotifyStatisticsInit(this Connection connection)
|
||||
{
|
||||
if (connection.player is not null)
|
||||
{
|
||||
connection.Send(new Sc17001()
|
||||
{
|
||||
ShipInfoLists = connection.player.Ships.OrderByDescending(x => x.Level).DistinctBy(x => x.TemplateId).Select(x =>
|
||||
{
|
||||
var template = Data.ShipDataTemplate[(int)x.TemplateId];
|
||||
|
||||
return new ShipStatisticsInfo()
|
||||
{
|
||||
Id = template.GroupType,
|
||||
Star = template.Star,
|
||||
LvMax = x.Level,
|
||||
IntimacyMax = x.Intimacy
|
||||
};
|
||||
}).ToList()
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user