Fix artifact & weapon generation by give command

This commit is contained in:
zamlty 2022-04-21 22:21:39 +08:00
parent 4c1dc34c1f
commit bce3e256cf

View File

@ -95,18 +95,19 @@ public final class GiveCommand implements CommandHandler {
} }
private void item(GenshinPlayer player, ItemData itemData, int amount) { private void item(GenshinPlayer player, ItemData itemData, int amount) {
GenshinItem genshinItem = new GenshinItem(itemData);
if (itemData.isEquip()) { if (itemData.isEquip()) {
List<GenshinItem> items = new LinkedList<>(); List<GenshinItem> items = new LinkedList<>();
for (int i = 0; i < amount; i++) { for (int i = 0; i < amount; i++) {
items.add(genshinItem); items.add(new GenshinItem(itemData));
} }
player.getInventory().addItems(items); player.getInventory().addItems(items);
player.sendPacket(new PacketItemAddHintNotify(items, ActionReason.SubfieldDrop)); player.sendPacket(new PacketItemAddHintNotify(items, ActionReason.SubfieldDrop));
} else { } else {
GenshinItem genshinItem = new GenshinItem(itemData);
genshinItem.setCount(amount); genshinItem.setCount(amount);
player.getInventory().addItem(genshinItem); player.getInventory().addItem(genshinItem);
player.sendPacket(new PacketItemAddHintNotify(genshinItem, ActionReason.SubfieldDrop)); player.sendPacket(new PacketItemAddHintNotify(genshinItem, ActionReason.SubfieldDrop));
} }
} }
} }