player_inventory.lua

main 45 lines · 2 KB Raw
Alex Alex Commit Client Upload Part 2 19/10/2026 00:06
1local context = G.botContext
2
3context.SlotOther = InventorySlotOther
4context.SlotHead = InventorySlotHead
5context.SlotNeck = InventorySlotNeck
6context.SlotBack = InventorySlotBack
7context.SlotBody = InventorySlotBody
8context.SlotRight = InventorySlotRight
9context.SlotLeft = InventorySlotLeft
10context.SlotLeg = InventorySlotLeg
11context.SlotFeet = InventorySlotFeet
12context.SlotFinger = InventorySlotFinger
13context.SlotAmmo = InventorySlotAmmo
14context.SlotPurse = InventorySlotPurse
15
16context.getInventoryItem = function(slot) return context.player:getInventoryItem(slot) end
17context.getSlot = context.getInventoryItem
18
19context.getHead = function() return context.getInventoryItem(context.SlotHead) end
20context.getNeck = function() return context.getInventoryItem(context.SlotNeck) end
21context.getBack = function() return context.getInventoryItem(context.SlotBack) end
22context.getBody = function() return context.getInventoryItem(context.SlotBody) end
23context.getRight = function() return context.getInventoryItem(context.SlotRight) end
24context.getLeft = function() return context.getInventoryItem(context.SlotLeft) end
25context.getLeg = function() return context.getInventoryItem(context.SlotLeg) end
26context.getFeet = function() return context.getInventoryItem(context.SlotFeet) end
27context.getFinger = function() return context.getInventoryItem(context.SlotFinger) end
28context.getAmmo = function() return context.getInventoryItem(context.SlotAmmo) end
29context.getPurse = function() return context.getInventoryItem(context.SlotPurse) end
30
31context.getContainers = function() return g_game.getContainers() end
32context.getContainer = function(index) return g_game.getContainer(index) end
33
34context.moveToSlot = function(item, slot, count)
35 if type(item) == 'number' then
36 item = context.findItem(item)
37 end
38 if not item then
39 return
40 end
41 if count == nil then
42 count = item:getCount()
43 end
44 return g_game.move(item, {x=65535, y=slot, z=0}, count)
45end
Top