Files
DanhengServer-OpenSource/Command/Command/Cmd/CommandLineup.cs
Somebody 87d228eb79 Feature:Asynchronous Operation & Formatting Code
- Now the async operation is enabled!
- Code formatted by Resharper plugin <3
2024-07-22 17:12:03 +08:00

37 lines
1.3 KiB
C#

using EggLink.DanhengServer.Internationalization;
using EggLink.DanhengServer.Server.Packet.Send.Lineup;
namespace EggLink.DanhengServer.Command.Cmd;
[CommandInfo("lineup", "Game.Command.Lineup.Desc", "Game.Command.Lineup.Usage")]
public class CommandLineup : ICommand
{
[CommandMethod("0 mp")]
public async ValueTask SetLineupMp(CommandArg arg)
{
if (arg.Target == null)
{
await arg.SendMsg(I18nManager.Translate("Game.Command.Notice.PlayerNotFound"));
return;
}
var count = arg.GetInt(0);
await arg.Target.Player!.LineupManager!.GainMp(count == 0 ? 2 : count);
await arg.SendMsg(I18nManager.Translate("Game.Command.Lineup.PlayerGainedMp", Math.Min(count, 2).ToString()));
}
[CommandMethod("0 heal")]
public async ValueTask HealLineup(CommandArg arg)
{
if (arg.Target == null)
{
await arg.SendMsg(I18nManager.Translate("Game.Command.Notice.PlayerNotFound"));
return;
}
var player = arg.Target.Player!;
foreach (var avatar in player.LineupManager!.GetCurLineup()!.AvatarData!.Avatars) avatar.CurrentHp = 10000;
await player.SendPacket(new PacketSyncLineupNotify(player.LineupManager.GetCurLineup()!));
await arg.SendMsg(I18nManager.Translate("Game.Command.Lineup.HealedAllAvatars"));
}
}