mirror of
https://github.com/rafi1212122/BLHX.Server.git
synced 2025-12-12 14:34:39 +01:00
migration testing, manifesto editing
This commit is contained in:
@@ -50,14 +50,14 @@ public abstract class Command
|
||||
}
|
||||
}
|
||||
|
||||
protected T Parse<T>(string? value, T fallback = default)
|
||||
protected T Parse<T>(string? value, T fallback = default!)
|
||||
{
|
||||
var tryParseMethod = typeof(T).GetMethod("TryParse", [typeof(string), typeof(T).MakeByRefType()]);
|
||||
|
||||
if (tryParseMethod != null)
|
||||
{
|
||||
var parameters = new object[] { value, null };
|
||||
bool success = (bool)tryParseMethod.Invoke(null, parameters);
|
||||
var parameters = new object[] { value!, null! };
|
||||
bool success = (bool)tryParseMethod.Invoke(null, parameters)!;
|
||||
|
||||
if (success)
|
||||
return (T)parameters[1];
|
||||
@@ -87,10 +87,10 @@ public static class CommandHandler
|
||||
|
||||
foreach (var commandType in commandTypes)
|
||||
{
|
||||
var commandAttribute = (commandHandler)Attribute.GetCustomAttribute(commandType, typeof(commandHandler));
|
||||
var commandAttribute = (commandHandler?)Attribute.GetCustomAttribute(commandType, typeof(commandHandler));
|
||||
if (commandAttribute != null)
|
||||
{
|
||||
var commandInstance = (Command)Activator.CreateInstance(commandType);
|
||||
var commandInstance = (Command)Activator.CreateInstance(commandType)!;
|
||||
commandFunctions[commandAttribute.Name] = commandInstance.Execute;
|
||||
Commands.Add(commandInstance);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using BLHX.Server.Common.Proto;
|
||||
using BLHX.Server.Common.Database;
|
||||
using BLHX.Server.Common.Proto;
|
||||
using BLHX.Server.Common.Proto.p11;
|
||||
|
||||
namespace BLHX.Server.Game.Handlers
|
||||
@@ -17,6 +18,22 @@ namespace BLHX.Server.Game.Handlers
|
||||
});
|
||||
}
|
||||
|
||||
[PacketHandler(Command.Cs11009)]
|
||||
static void ChangeManifestoHandler(Connection connection, Packet packet)
|
||||
{
|
||||
var req = packet.Decode<Cs11009>();
|
||||
connection.player.Adv = req.Adv;
|
||||
DBManager.PlayerContext.SaveChanges();
|
||||
|
||||
connection.Send(new Sc11010());
|
||||
}
|
||||
|
||||
[PacketHandler(Command.Cs11601)]
|
||||
static void GetEmojiInfoHandler(Connection connection, Packet packet)
|
||||
{
|
||||
connection.Send(new Sc11602());
|
||||
}
|
||||
|
||||
[PacketHandler(Command.Cs11603)]
|
||||
static void FetchSecondaryPasswordHandler(Connection connection, Packet packet)
|
||||
{
|
||||
@@ -54,6 +71,7 @@ namespace BLHX.Server.Game.Handlers
|
||||
Name = connection.player.Name,
|
||||
Level = connection.player.Level,
|
||||
Exp = connection.player.Exp,
|
||||
Adv = connection.player.Adv,
|
||||
ResourceLists = connection.player.Resources.Select(x => new Resource() { Num = x.Num, Type = x.Id }).ToList(),
|
||||
Characters = [1],
|
||||
ShipBagMax = 150,
|
||||
|
||||
@@ -11,6 +11,12 @@ namespace BLHX.Server.Game.Handlers
|
||||
connection.Send(new Sc26102());
|
||||
}
|
||||
|
||||
[PacketHandler(Command.Cs26103)]
|
||||
static void MiniGameOPHandler(Connection connection, Packet packet)
|
||||
{
|
||||
connection.Send(new Sc26104());
|
||||
}
|
||||
|
||||
[PacketHandler(Command.Cs26150)]
|
||||
static void GetMinigameShopHandler(Connection connection, Packet packet)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user