From a52eaf9bbcaccdc794085e4f65e694a63c5cd048 Mon Sep 17 00:00:00 2001 From: memetrollsXD Date: Fri, 22 Apr 2022 23:19:58 +0200 Subject: [PATCH] Use count for level for equips --- .../grasscutter/command/commands/GiveCommand.java | 13 ++++++------- .../emu/grasscutter/game/inventory/GenshinItem.java | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/main/java/emu/grasscutter/command/commands/GiveCommand.java b/src/main/java/emu/grasscutter/command/commands/GiveCommand.java index a533130bc..c427d9d89 100644 --- a/src/main/java/emu/grasscutter/command/commands/GiveCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/GiveCommand.java @@ -91,17 +91,16 @@ public final class GiveCommand implements CommandHandler { this.item(targetPlayer, itemData, amount); - CommandHandler.sendMessage(sender, String.format("Given %s of %s to %s.", amount, item, target)); + if (!itemData.isEquip()) CommandHandler.sendMessage(sender, String.format("Given %s of %s to %s.", amount, item, target)); + else CommandHandler.sendMessage(sender, String.format("Given %s with level %s to %s", item, amount, target)); } private void item(GenshinPlayer player, ItemData itemData, int amount) { if (itemData.isEquip()) { - List items = new LinkedList<>(); - for (int i = 0; i < amount; i++) { - items.add(new GenshinItem(itemData)); - } - player.getInventory().addItems(items); - player.sendPacket(new PacketItemAddHintNotify(items, ActionReason.SubfieldDrop)); + GenshinItem item = new GenshinItem(itemData); + item.setLevel(amount); + player.getInventory().addItem(item); + player.sendPacket(new PacketItemAddHintNotify(item, ActionReason.SubfieldDrop)); } else { GenshinItem genshinItem = new GenshinItem(itemData); genshinItem.setCount(amount); diff --git a/src/main/java/emu/grasscutter/game/inventory/GenshinItem.java b/src/main/java/emu/grasscutter/game/inventory/GenshinItem.java index 0b0db49c4..fccc49307 100644 --- a/src/main/java/emu/grasscutter/game/inventory/GenshinItem.java +++ b/src/main/java/emu/grasscutter/game/inventory/GenshinItem.java @@ -90,7 +90,7 @@ public class GenshinItem { // Equip data if (getItemType() == ItemType.ITEM_WEAPON) { - this.level = 1; + this.level = this.count > 1 ? this.count : 1; this.affixes = new ArrayList<>(2); if (getItemData().getSkillAffix() != null) { for (int skillAffix : getItemData().getSkillAffix()) {