You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -29,6 +73,13 @@ class Inventory(val type: InventoryType, var slotLimit: Byte = 96) : Iterable<It
29
73
return slotId
30
74
}
31
75
76
+
/**
77
+
* Adds an item to the inventory from the database.
78
+
*
79
+
* This function is typically used when loading the inventory from the database. It checks if the item's position is not negative and the inventory type is not EQUIPPED. If these conditions are met, the item is added to the inventory at its position.
80
+
*
81
+
* @param item The item to be added to the inventory.
82
+
*/
32
83
funaddFromDatabase(item:Item) {
33
84
if (item.position <0&& type !=InventoryType.EQUIPPED) return
34
85
inventory[item.position] = item
@@ -105,15 +156,34 @@ class Inventory(val type: InventoryType, var slotLimit: Byte = 96) : Iterable<It
105
156
106
157
funallInventories() =listOf(this)
107
158
159
+
/**
160
+
* Finds an item in the inventory by its cash ID.
161
+
*
162
+
* This function is used to find an item in the inventory by its cash ID.
163
+
* It first checks if the item is of type `Equip`. If it is, it checks if the item is a ring.
164
+
* If the item is a ring, it uses the ring ID. If the item is not a ring, it uses the cash ID.
165
+
* If the item is not of type `Equip`, it checks if the item is a pet. If it is, it uses the pet ID.
* Provides an iterator over the items in the inventory.
183
+
*
184
+
* This function is used to iterate over the items in the inventory. It returns an iterator over the values in the inventory map, which are the items in the inventory.
185
+
*
186
+
* @return An iterator over the items in the inventory.
0 commit comments