From 7336c2a3b03223fa969de00248c1c95d4b5a3ca2 Mon Sep 17 00:00:00 2001 From: Collin Smith Date: Sat, 30 May 2020 16:35:37 -0700 Subject: [PATCH] Moved ItemData#drop and added ItemManager#dropCursor --- .../com/riiablo/engine/server/ItemManager.java | 4 ++++ core/src/com/riiablo/save/ItemData.java | 16 ++++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/core/src/com/riiablo/engine/server/ItemManager.java b/core/src/com/riiablo/engine/server/ItemManager.java index 20e6a0ec..6d76c04a 100644 --- a/core/src/com/riiablo/engine/server/ItemManager.java +++ b/core/src/com/riiablo/engine/server/ItemManager.java @@ -14,6 +14,10 @@ public class ItemManager extends PassiveSystem { protected ComponentMapper mPlayer; + public void dropCursor(int entityId) { + mPlayer.get(entityId).data.dropCursor(); + } + public void storeToCursor(int entityId, int i) { mPlayer.get(entityId).data.storeToCursor(i); } diff --git a/core/src/com/riiablo/save/ItemData.java b/core/src/com/riiablo/save/ItemData.java index 737b80d2..68c0f5ae 100644 --- a/core/src/com/riiablo/save/ItemData.java +++ b/core/src/com/riiablo/save/ItemData.java @@ -204,14 +204,6 @@ public class ItemData { return copy; } - void pickup(int i) { - assert cursor == INVALID_ITEM; - Item item = itemData.get(i); - if (item.location == Location.STORED) notifyStoreRemoved(item); - cursor = i; - setLocation(item, Location.CURSOR); - } - // TODO: should item location change if the item is dropped? is this what UNK3 and UNK5 represent? void drop() { assert cursor != INVALID_ITEM; @@ -220,6 +212,14 @@ public class ItemData { setLocation(item, null); } + void pickup(int i) { + assert cursor == INVALID_ITEM; + Item item = itemData.get(i); + if (item.location == Location.STORED) notifyStoreRemoved(item); + cursor = i; + setLocation(item, Location.CURSOR); + } + void storeCursor(StoreLoc storeLoc, int x, int y) { assert cursor != INVALID_ITEM; store(storeLoc, cursor, x, y);