mirror of
https://github.com/rafi1212122/PemukulPaku
synced 2025-12-14 16:54:34 +01:00
avatar cmd & update assistant
This commit is contained in:
30
GameServer/Commands/LevelCommand.cs
Normal file
30
GameServer/Commands/LevelCommand.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using Common.Utils.ExcelReader;
|
||||
using PemukulPaku.GameServer.Game;
|
||||
using Common.Resources.Proto;
|
||||
|
||||
namespace PemukulPaku.GameServer.Commands
|
||||
{
|
||||
[CommandHandler("level", "Modify the player captain level", CommandType.Player)]
|
||||
internal class LevelCommand : Command
|
||||
{
|
||||
public override void Run(Session session, string[] args)
|
||||
{
|
||||
Run(session.Player, args);
|
||||
|
||||
GetMainDataRsp Rsp = new()
|
||||
{
|
||||
retcode = GetMainDataRsp.Retcode.Succ,
|
||||
Level = (uint)PlayerLevelData.GetInstance().CalculateLevel(session.Player.User.Exp).Level,
|
||||
Exp = (uint)PlayerLevelData.GetInstance().CalculateLevel(session.Player.User.Exp).Exp
|
||||
};
|
||||
session.Send(Packet.FromProto(Rsp, CmdId.GetMainDataRsp), Packet.FromProto(new PlayerLevelUpNotify() { NewLevel = Rsp.Level }, CmdId.PlayerLevelUpNotify));
|
||||
}
|
||||
|
||||
public override void Run(Player player, string[] args)
|
||||
{
|
||||
int level = int.Parse(args[0]);
|
||||
player.User.Exp = PlayerLevelData.GetInstance().CalculateExpForLevel(level).Exp;
|
||||
player.User.Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user