feat: add giveall material

This commit is contained in:
Naruse
2025-06-15 21:45:27 +08:00
parent 6a55234187
commit 27b1284dcc
2 changed files with 15 additions and 1 deletions

View File

@@ -31,4 +31,17 @@ public class CommandGiveall : ICommands
await arg.Target!.Player!.SyncInventory();
await arg.SendMsg(I18NManager.Translate("Game.Command.GiveAll.GiveAllItems", I18NManager.Translate("Word.Stigmata")));
}
[CommandMethod("material")]
public async ValueTask GiveMaterial(CommandArg arg)
{
if (!await arg.CheckOnlineTarget()) return;
foreach (var conf in GameData.MaterialData.Values)
{
var quantity = conf.Id == 100 ? 99999999 : (conf.QuantityLimit > 999 ? 999 : conf.QuantityLimit);
var item = await arg.Target!.Player!.InventoryManager!.AddItem(conf.Id, quantity, ItemMainTypeEnum.Material, 0, sync: false);
}
await arg.Target!.Player!.SyncInventory();
await arg.SendMsg(I18NManager.Translate("Game.Command.GiveAll.GiveAllItems", I18NManager.Translate("Word.Material")));
}
}

View File

@@ -12,7 +12,8 @@ public class PacketGetEquipmentDataRsp : BasePacket
{
WeaponList = { player.InventoryManager!.Data.WeaponItems.Select(weapon => weapon.ToWeaponProto()) },
StigmataList = { player.InventoryManager!.Data.StigmataItems.Select(stigmata => stigmata.ToStigmataProto()) },
MaterialList = { player.InventoryManager!.Data.MaterialItems.Select(material => material.ToMaterialProto()) }
MaterialList = { player.InventoryManager!.Data.MaterialItems.Select(material => material.ToMaterialProto()) },
IsAll = true,
};
SetData(proto);