basic.lua

main 58 lines · 1.9 KB Raw
Alex Alex Commit Client Upload Part 2 19/10/2026 00:06
1local context = G.botContext
2local Panels = context.Panels
3
4Panels.Turning = function(parent)
5 context.macro(1000, "Turning / AntiIdle", nil, function()
6 context.turn(math.random(1, 4))
7 end, parent)
8end
9Panels.AntiIdle = Panels.Turning
10
11Panels.AttackSpell = function(parent)
12 context.macro(500, "Auto attack spell", nil, function()
13 local target = g_game.getAttackingCreature()
14 if target and context.getCreatureById(target:getId()) and context.storage.autoAttackText:len() > 0 then
15 if context.saySpell(context.storage.autoAttackText, 1000) then
16 context.delay(1000)
17 end
18 end
19 end, parent)
20 context.addTextEdit("autoAttackText", context.storage.autoAttackText or "exori vis", function(widget, text)
21 context.storage.autoAttackText = text
22 end, parent)
23end
24
25Panels.AttackItem = function(parent)
26 if not parent then
27 parent = context.panel
28 end
29
30 local panelName = "attackItem"
31 local ui = g_ui.createWidget("ItemAndButtonPanel", parent)
32 ui:setId(panelName)
33
34 ui.title:setText("Auto attack item")
35
36 if not context.storage.attackItem then
37 context.storage.attackItem = {}
38 end
39
40 ui.title:setOn(context.storage.attackItem.enabled)
41 ui.title.onClick = function(widget)
42 context.storage.attackItem.enabled = not context.storage.attackItem.enabled
43 widget:setOn(context.storage.attackItem.enabled)
44 end
45
46 ui.item.onItemChange = function(widget)
47 context.storage.attackItem.item = widget:getItemId()
48 end
49 ui.item:setItemId(context.storage.attackItem.item or 3155)
50
51 context.macro(500, function()
52 local target = g_game.getAttackingCreature()
53 if context.storage.attackItem.enabled and target and context.getCreatureById(target:getId()) and context.storage.attackItem.item and context.storage.attackItem.item >= 100 then
54 context.useWith(context.storage.attackItem.item, target)
55 end
56 end)
57end
58
Top