Repository navigation
LuaAPI Items
itvnnnd87 edited this page Oct 24, 2026
·
2 revisions
Item code = group * 512 + index (Helpers.MakeItemId(group, index), see Library).
Functions that return an item (Player.GetItem, Warehouse.GetItem, EventInventory.GetItem, MuunInventory.GetItem, Item.GetGroundItem) return this table, or nil for an empty slot:
| Field | Meaning |
|---|---|
Index |
Item code. |
Serial |
Serial number. |
Level, Durability
|
Level, durability (stack size for stackable items). |
Skill, Luck, Option
|
Skill, luck, additional option. |
Exc, Ancient, Harmony, Option380
|
Excellent (bit mask), ancient, harmony, 380 option. |
Sockets |
5 values: -1 no socket, 254 empty socket. |
SocketBonus, ExpireDate
|
Socket bonus, expiry time (Unix timestamp, 0 = none). |
X, Y
|
Only Item.GetGroundItem: position on the ground. |
Functions that create an item take the same fields (all optional except Index), plus Duration (seconds before it expires, 0 = never) and Count. Durability = 0 or 255 means the default durability.
| Function | Description |
|---|---|
Inventory.GetSizes() |
3 values: equipment slots (12), end of the main inventory (76), total slots (239). |
Inventory.CountItem(aIndex, itemCode, level) |
Number of items. level -1 = any level. Stacks count their size. |
Inventory.FreeSlots(aIndex) |
Free 1x1 cells. |
Inventory.HasSpaceForItem(aIndex, itemCode) |
true if the item fits. |
Inventory.HasSpace(aIndex, width, height) |
true if a width x height item fits. |
Inventory.DeleteSlot(aIndex, slot) |
Deletes the item of one slot (equipment too). false during a trade or with a window open. |
Inventory.DeleteItems(aIndex, itemCode, level, count) |
Deletes exactly count items. If there are not enough, nothing is deleted (false). |
Inventory.SetItem(aIndex, slot, table) |
Changes the fields given in the table (Level, Durability, Skill, Luck, Option, Exc, Ancient, Harmony, Option380, Sockets, SocketBonus). The item code cannot be changed. |
Inventory.ReduceDurability(aIndex, slot, amount) |
Lowers durability. |
Inventory.SendSlot(aIndex, slot) |
Resends one slot to the client. |
Inventory.SendList(aIndex) |
Resends the whole inventory. |
-- Take 10 Jewels of Bless (14 * 512 + 13) for a reward
local BLESS = Helpers.MakeItemId(14, 13)
if Inventory.CountItem(aIndex, BLESS, -1) >= 10 and Inventory.DeleteItems(aIndex, BLESS, -1, 10) then
Coin.Add(aIndex, 100, 0, 0)
end| Function | Description |
|---|---|
Warehouse.GetItem(aIndex, slot) |
Item table or nil. |
Warehouse.CountItem(aIndex, itemCode, level) |
|
EventInventory.GetSize() |
Slots of the event inventory. |
EventInventory.GetItem(aIndex, slot), CountItem(aIndex, itemCode, level)
|
|
MuunInventory.GetSizes() |
2 values: equipped Muun slots (3), total slots (103). |
MuunInventory.GetItem(aIndex, slot), CountItem(aIndex, itemCode, level)
|
|
MuunInventory.DeleteSlot(aIndex, slot) |
Deletes a Muun from the Muun inventory (not an equipped one). |
| Function | Description |
|---|---|
Item.Give(aIndex, table) |
Creates the item in the right inventory (main, event or Muun). Count 1..50, limited by free space. Returns how many were created; 0 if there is no space or a trade / window is open. |
Item.Drop(map, x, y, table, ownerIndex) |
Drops the item on the ground. ownerIndex: only that character can pick it up; -1 or nothing: anyone. |
Item.GiveBag(aIndex, bag) |
Opens a random item bag (ItemBag GUID number or name) into the inventory. |
Item.DropBag(aIndex, bag, map, x, y) |
Drops the bag items on the ground (the character is the owner). Without map, x, y: at the character. |
Item.GremoryAdd(aIndex, table) |
Sends the item to the Gremory Case (below). |
Item.GremoryFreeSlots(aIndex, storage) |
Free slots of the Gremory Case. storage 1 = character, 2 = account. |
The item is created a moment later (the server gets a serial number first). Always check the space before giving, or use the Gremory Case.
local given = Item.Give(aIndex, { Index = Helpers.MakeItemId(14, 13), Count = 5 })
if given < 5 then
Message.Send(aIndex, 3, "Not enough space in your inventory")
end
Item.GremoryAdd(aIndex, {
Index = Helpers.MakeItemId(12, 37),
Level = 15, Skill = 1, Luck = 1, Option = 4, Exc = 63,
Sockets = { -1, -1, -1, -1, -1 },
Duration = 86400, -- time in the case (seconds), 0 = 7 days
Count = 1, -- 1..100
Storage = 1, -- 1 = character case, 2 = account case
Reward = 100, -- reward source shown on the client
})| Function | Description |
|---|---|
Item.IsValid(itemCode) |
true if the item exists in the item list. |
Item.GetName(itemCode) |
Name. |
Item.GetKindA(itemCode), GetKindB
|
Item kind values. |
Item.GetSize(itemCode) |
2 values: width, height. |
Item.GetMaxStack(itemCode) |
Maximum stack (0 = not stackable). |
Item.IsSocket, IsExcSocketAccessory, IsElemental
|
Item type checks. |
Item.IsPentagram, IsMasterPentagram, IsPentagramJewel, IsMasterPentagramJewel
|
Pentagram checks. |
Item.RandomAncientOption(itemCode) |
Random ancient option for the item (0 = no set). |
Item.RandomLevel(min, max) |
Random level in [min, max]. |
Item.GetGroundItem(map, itemIndex) |
Item on the ground, or nil. |
index can be a character or a monster.
| Function | Description |
|---|---|
Buff.Add(index, buffId, seconds, effect1, value1, effect2, value2) |
Adds a buff. Without effects: the values of the buff data. |
Buff.AddItem(index, itemCode, seconds) |
Buff of an item (potions, scrolls ...). |
Buff.AddCashShop(index, itemCode, seconds) |
Buff of a cash shop item. Saved: still there after logging in again. |
Buff.Remove(index, buffId) |
|
Buff.Has(index, buffId) |
true if the buff is active. |
Buff.Clear(index, all) |
Removes combat buffs; all = true: cash shop buffs too. |
Next: Game events