mirror of
https://github.com/Melledy/LunarCore.git
synced 2026-02-04 06:55:05 +01:00
Fix locking/discarding items
This commit is contained in:
@@ -532,12 +532,14 @@ public class InventoryService extends BaseGameService {
|
|||||||
// Lock items
|
// Lock items
|
||||||
for (int equipId : list) {
|
for (int equipId : list) {
|
||||||
GameItem item = player.getInventory().getItemByUid(equipId);
|
GameItem item = player.getInventory().getItemByUid(equipId);
|
||||||
if (item == null || !item.getExcel().isEquippable()) {
|
if (item == null || !item.getExcel().isEquippable() || item.isDiscarded()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
item.setLocked(locked);
|
item.setLocked(locked);
|
||||||
item.save();
|
item.save();
|
||||||
|
|
||||||
|
items.add(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send packet
|
// Send packet
|
||||||
@@ -550,15 +552,17 @@ public class InventoryService extends BaseGameService {
|
|||||||
// List of items to update on the client
|
// List of items to update on the client
|
||||||
List<GameItem> items = new ArrayList<>();
|
List<GameItem> items = new ArrayList<>();
|
||||||
|
|
||||||
// Lock items
|
// Discard items
|
||||||
for (int equipId : list) {
|
for (int equipId : list) {
|
||||||
GameItem item = player.getInventory().getItemByUid(equipId);
|
GameItem item = player.getInventory().getItemByUid(equipId);
|
||||||
if (item == null || !item.getExcel().isEquippable()) {
|
if (item == null || !item.getExcel().isEquippable() || item.isLocked()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
item.setDiscarded(discarded);
|
item.setDiscarded(discarded);
|
||||||
item.save();
|
item.save();
|
||||||
|
|
||||||
|
items.add(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send packet
|
// Send packet
|
||||||
|
|||||||
Reference in New Issue
Block a user