Skip to content

Commit

Permalink
Use count for level for equips
Browse files Browse the repository at this point in the history
  • Loading branch information
memetrollsXD committed Apr 22, 2022
1 parent b507d2c commit d341e4f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
13 changes: 6 additions & 7 deletions src/main/java/emu/grasscutter/command/commands/GiveCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,17 +91,16 @@ public void execute(GenshinPlayer sender, List<String> args) {

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<GenshinItem> 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public GenshinItem(ItemData data, int count) {

// 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()) {
Expand Down

0 comments on commit d341e4f

Please sign in to comment.