Skip to content

Commit

Permalink
Fix locking/discarding items
Browse files Browse the repository at this point in the history
  • Loading branch information
Melledy committed Aug 4, 2024
1 parent 0b05685 commit 4cd7a51
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/main/java/emu/lunarcore/game/inventory/InventoryService.java
Original file line number Diff line number Diff line change
Expand Up @@ -532,12 +532,14 @@ public void lockItems(Player player, RepeatedInt list, boolean locked) {
// Lock items
for (int equipId : list) {
GameItem item = player.getInventory().getItemByUid(equipId);
if (item == null || !item.getExcel().isEquippable()) {
if (item == null || !item.getExcel().isEquippable() || item.isDiscarded()) {
continue;
}

item.setLocked(locked);
item.save();

items.add(item);
}

// Send packet
Expand All @@ -550,15 +552,17 @@ public void discardRelics(Player player, RepeatedInt list, boolean discarded) {
// List of items to update on the client
List<GameItem> items = new ArrayList<>();

// Lock items
// Discard items
for (int equipId : list) {
GameItem item = player.getInventory().getItemByUid(equipId);
if (item == null || !item.getExcel().isEquippable()) {
if (item == null || !item.getExcel().isEquippable() || item.isLocked()) {
continue;
}

item.setDiscarded(discarded);
item.save();

items.add(item);
}

// Send packet
Expand Down

0 comments on commit 4cd7a51

Please sign in to comment.