mirror of
https://github.com/MikuLeaks/KianaBH3.git
synced 2025-12-12 21:04:41 +01:00
feat: add giveall command
This commit is contained in:
22
GameServer/Command/Commands/CommandGiveAll.cs
Normal file
22
GameServer/Command/Commands/CommandGiveAll.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using KianaBH.Data;
|
||||
using KianaBH.Enums.Item;
|
||||
using KianaBH.Enums.Player;
|
||||
using KianaBH.Internationalization;
|
||||
|
||||
namespace KianaBH.GameServer.Command.Commands;
|
||||
|
||||
[CommandInfo("giveall", "Game.Command.GiveAll.Desc", "Game.Command.GiveAll.Usage", ["ga"], [PermEnum.Admin, PermEnum.Support])]
|
||||
public class CommandGiveall : ICommands
|
||||
{
|
||||
[CommandMethod("weapon")]
|
||||
public async ValueTask GiveWeapon(CommandArg arg)
|
||||
{
|
||||
if (!await arg.CheckOnlineTarget()) return;
|
||||
foreach (var conf in GameData.WeaponData.Values.Where(weapon => weapon.Rarity == weapon.MaxRarity))
|
||||
{
|
||||
var item = await arg.Target!.Player!.InventoryManager!.AddItem(conf.ID, 1, ItemMainTypeEnum.Weapon, conf.MaxLv, sync:false);
|
||||
}
|
||||
await arg.Target!.Player!.SyncWeapon();
|
||||
await arg.SendMsg(I18NManager.Translate("Game.Command.GiveAll.GiveAllItems", I18NManager.Translate("Word.Weapon")));
|
||||
}
|
||||
}
|
||||
@@ -111,6 +111,11 @@ public class PlayerInstance(PlayerData data)
|
||||
return Data.ToProto();
|
||||
}
|
||||
|
||||
public async ValueTask SyncWeapon()
|
||||
{
|
||||
await SendPacket(new PacketGetEquipmentDataRsp(this));
|
||||
}
|
||||
|
||||
public async ValueTask SyncValk()
|
||||
{
|
||||
await SendPacket(new PacketGetAvatarDataRsp(AvatarManager!.AvatarData!.Avatars!.ToList(), true));
|
||||
|
||||
Reference in New Issue
Block a user