Class MapleStorage

java.lang.Object
server.MapleStorage
All Implemented Interfaces:
Serializable

public class MapleStorage extends Object implements Serializable
角色倉庫(Storage)的記憶體模型與資料庫持久化。

倉庫以帳號(accountId)為單位,儲存跨角色共用的道具清單與楓幣, 並以 MapleInventoryType 分類快取於 typeItems。 主要職責:

  • 靜態方法 create 在首次開通時於資料庫建立記錄;
  • loadStorage 從資料庫讀取倉庫資料並以 ItemLoader 載入道具;
  • saveStorage 將變更(changed = true)寫回資料庫;
  • sendStorage 組裝並送出 NPCPacket 讓客戶端顯示倉庫 UI。
由 NPC 腳本與倉庫 NPC 互動時,透過 MapleCharacter 取得並操作。
See Also:
  • Method Details

    • create

      public static int create(int id) throws SQLException
      Throws:
      SQLException
    • loadStorage

      public static MapleStorage loadStorage(int id)
    • saveToDB

      public void saveToDB()
    • takeOut

      public Item takeOut(byte slot)
    • store

      public void store(Item item)
    • arrange

      public void arrange()
    • getItems

      public List<Item> getItems()
    • getSlot

      public byte getSlot(MapleInventoryType type, byte slot)
    • sendStorage

      public void sendStorage(MapleClient c, int npcId)
    • update

      public void update(MapleClient c)
    • sendStored

      public void sendStored(MapleClient c, MapleInventoryType type)
    • sendTakenOut

      public void sendTakenOut(MapleClient c, MapleInventoryType type)
    • getMeso

      public int getMeso()
    • findById

      public Item findById(int itemId)
    • setMeso

      public void setMeso(int meso)
    • sendMeso

      public void sendMeso(MapleClient c)
    • isFull

      public boolean isFull()
    • getSlots

      public int getSlots()
    • increaseSlots

      public void increaseSlots(byte gain)
    • setSlots

      public void setSlots(byte set)
    • close

      public void close()
    • removeItemByInventoryItemId

      public boolean removeItemByInventoryItemId(long inventoryitemid)