1local context = G.botContext
2local Panels = context.Panels
3
4Panels.Haste = function(parent)
5 context.macro(500, "Auto Haste", nil, function()
6 if not context.hasHaste() and context.storage.autoHasteText:len() > 0 then
7 if context.saySpell(context.storage.autoHasteText, 2500) then
8 context.delay(5000)
9 end
10 end
11 end, parent)
12 context.addTextEdit("autoHasteText", context.storage.autoHasteText or "utani hur", function(widget, text)
13 context.storage.autoHasteText = text
14 end, parent)
15end
16
17Panels.ManaShield = function(parent)
18 local lastManaShield = 0
19 context.macro(100, "Auto Mana Shield", nil, function()
20 if not context.hasManaShield() or context.now > lastManaShield + 90000 then
21 if context.saySpell("utamo vita", 200) then
22 lastManaShield = context.now
23 end
24 end
25 end, parent)
26end
27
28Panels.AntiParalyze = function(parent)
29 context.macro(100, "Anti Paralyze", nil, function()
30 if context.isParalyzed() and context.storage.autoAntiParalyzeText:len() > 0 then
31 context.saySpell(context.storage.autoAntiParalyzeText, 750)
32 end
33 end, parent)
34 context.addTextEdit("autoAntiParalyzeText", context.storage.autoAntiParalyzeText or "utani hur", function(widget, text)
35 context.storage.autoAntiParalyzeText = text
36 end, parent)
37end
38
39
40Panels.Health = function(parent)
41 if not parent then
42 parent = context.panel
43 end
44
45 local panelName = "autoHealthPanel"
46 local panelId = 1
47 while parent:getChildById(panelName .. panelId) do
48 panelId = panelId + 1
49 end
50 panelName = panelName .. panelId
51
52 local ui = g_ui.createWidget("DualScrollPanel", parent)
53 ui:setId(panelName)
54
55 if not context.storage[panelName] then
56 context.storage[panelName] = {
57 item = 266,
58 min = 20,
59 max = 80,
60 text = "exura"
61 }
62 end
63
64 ui.title:setOn(context.storage[panelName].enabled)
65 ui.title.onClick = function(widget)
66 context.storage[panelName].enabled = not context.storage[panelName].enabled
67 widget:setOn(context.storage[panelName].enabled)
68 end
69
70 ui.text.onTextChange = function(widget, text)
71 context.storage[panelName].text = text
72 end
73 ui.text:setText(context.storage[panelName].text or "exura")
74
75 local updateText = function()
76 ui.title:setText("" .. context.storage[panelName].min .. "% <= hp <= " .. context.storage[panelName].max .. "%")
77 end
78
79 ui.scroll1.onValueChange = function(scroll, value)
80 context.storage[panelName].min = value
81 updateText()
82 end
83 ui.scroll2.onValueChange = function(scroll, value)
84 context.storage[panelName].max = value
85 updateText()
86 end
87
88 ui.scroll1:setValue(context.storage[panelName].min)
89 ui.scroll2:setValue(context.storage[panelName].max)
90
91 context.macro(25, function()
92 if context.storage[panelName].enabled and context.storage[panelName].text:len() > 0 and context.storage[panelName].min <= context.hppercent() and context.hppercent() <= context.storage[panelName].max then
93 if context.saySpell(context.storage[panelName].text, 500) then
94 context.delay(200)
95 end
96 end
97 end)
98end
99
100Panels.HealthItem = function(parent)
101 if not parent then
102 parent = context.panel
103 end
104
105 local panelName = "autoHealthItemPanel"
106 local panelId = 1
107 while parent:getChildById(panelName .. panelId) do
108 panelId = panelId + 1
109 end
110 panelName = panelName .. panelId
111
112 local ui = g_ui.createWidget("DualScrollItemPanel", parent)
113 ui:setId(panelName)
114
115 if not context.storage[panelName] then
116 context.storage[panelName] = {
117 item = 266,
118 min = 0,
119 max = 60
120 }
121 end
122
123 ui.title:setOn(context.storage[panelName].enabled)
124 ui.title.onClick = function(widget)
125 context.storage[panelName].enabled = not context.storage[panelName].enabled
126 widget:setOn(context.storage[panelName].enabled)
127 end
128
129 ui.item.onItemChange = function(widget)
130 context.storage[panelName].item = widget:getItemId()
131 end
132 ui.item:setItemId(context.storage[panelName].item)
133
134 local updateText = function()
135 ui.title:setText("" .. (context.storage[panelName].min or "") .. "% <= hp <= " .. (context.storage[panelName].max or "") .. "%")
136 end
137
138 ui.scroll1.onValueChange = function(scroll, value)
139 context.storage[panelName].min = value
140 updateText()
141 end
142 ui.scroll2.onValueChange = function(scroll, value)
143 context.storage[panelName].max = value
144 updateText()
145 end
146
147 ui.scroll1:setValue(context.storage[panelName].min)
148 ui.scroll2:setValue(context.storage[panelName].max)
149
150 context.macro(25, function()
151 if context.storage[panelName].enabled and context.storage[panelName].item >= 100 and context.storage[panelName].min <= context.hppercent() and context.hppercent() <= context.storage[panelName].max then
152 if context.useRune(context.storage[panelName].item, context.player, 500) then
153 context.delay(300)
154 end
155 end
156 end)
157end
158
159Panels.Mana = function(parent)
160 if not parent then
161 parent = context.panel
162 end
163
164 local panelName = "autoManaItemPanel"
165 local panelId = 1
166 while parent:getChildById(panelName .. panelId) do
167 panelId = panelId + 1
168 end
169 panelName = panelName .. panelId
170
171 local ui = g_ui.createWidget("DualScrollItemPanel", parent)
172 ui:setId(panelName)
173
174 if not context.storage[panelName] then
175 context.storage[panelName] = {
176 item = 268,
177 min = 0,
178 max = 60
179 }
180 end
181
182 ui.title:setOn(context.storage[panelName].enabled)
183 ui.title.onClick = function(widget)
184 context.storage[panelName].enabled = not context.storage[panelName].enabled
185 widget:setOn(context.storage[panelName].enabled)
186 end
187
188 ui.item.onItemChange = function(widget)
189 context.storage[panelName].item = widget:getItemId()
190 end
191 ui.item:setItemId(context.storage[panelName].item)
192
193 local updateText = function()
194 ui.title:setText("" .. (context.storage[panelName].min or "") .. "% <= mana <= " .. (context.storage[panelName].max or "") .. "%")
195 end
196
197 ui.scroll1.onValueChange = function(scroll, value)
198 context.storage[panelName].min = value
199 updateText()
200 end
201 ui.scroll2.onValueChange = function(scroll, value)
202 context.storage[panelName].max = value
203 updateText()
204 end
205
206 ui.scroll1:setValue(context.storage[panelName].min)
207 ui.scroll2:setValue(context.storage[panelName].max)
208
209 context.macro(25, function()
210 if context.storage[panelName].enabled and context.storage[panelName].item >= 100 and context.storage[panelName].min <= context.manapercent() and context.manapercent() <= context.storage[panelName].max then
211 if context.useRune(context.storage[panelName].item, context.player, 500) then
212 context.delay(300)
213 end
214 end
215 end)
216end
217Panels.ManaItem = Panels.Mana
218
219Panels.Equip = function(parent)
220 if not parent then
221 parent = context.panel
222 end
223
224 local panelName = "autoEquipItem"
225 local panelId = 1
226 while parent:getChildById(panelName .. panelId) do
227 panelId = panelId + 1
228 end
229 panelName = panelName .. panelId
230
231 local ui = g_ui.createWidget("TwoItemsAndSlotPanel", parent)
232 ui:setId(panelName)
233
234 if not context.storage[panelName] then
235 context.storage[panelName] = {}
236 if panelId == 1 then
237 context.storage[panelName].item1 = 3052
238 context.storage[panelName].item2 = 3089
239 context.storage[panelName].slot = 9
240 end
241 end
242
243 ui.title:setText("Auto equip")
244 ui.title:setOn(context.storage[panelName].enabled)
245 ui.title.onClick = function(widget)
246 context.storage[panelName].enabled = not context.storage[panelName].enabled
247 widget:setOn(context.storage[panelName].enabled)
248 end
249
250 ui.item1:setItemId(context.storage[panelName].item1 or 0)
251 ui.item1.onItemChange = function(widget)
252 context.storage[panelName].item1 = widget:getItemId()
253 end
254
255 ui.item2:setItemId(context.storage[panelName].item2 or 0)
256 ui.item2.onItemChange = function(widget)
257 context.storage[panelName].item2 = widget:getItemId()
258 end
259
260 if not context.storage[panelName].slot then
261 context.storage[panelName].slot = 1
262 end
263 ui.slot:setCurrentIndex(context.storage[panelName].slot)
264 ui.slot.onOptionChange = function(widget)
265 context.storage[panelName].slot = widget.currentIndex
266 end
267
268 context.macro(250, function()
269 if context.storage[panelName].enabled and context.storage[panelName].slot > 0 then
270 local item1 = context.storage[panelName].item1 or 0
271 local item2 = context.storage[panelName].item2 or 0
272 if item1 < 100 and item2 < 100 then
273 return
274 end
275 local slotItem = context.getSlot(context.storage[panelName].slot)
276 if slotItem and (slotItem:getId() == item1 or slotItem:getId() == item2) then
277 return
278 end
279 local newItem = context.findItem(context.storage[panelName].item1)
280 if not newItem then
281 newItem = context.findItem(context.storage[panelName].item2)
282 if not newItem then
283 return
284 end
285 end
286 g_game.move(newItem, {x=65535, y=context.storage[panelName].slot, z=0})
287 context.delay(1000)
288 end
289 end)
290end
291Panels.AutoEquip = Panels.Equip
292
293Panels.Eating = function(parent)
294 if not parent then
295 parent = context.panel
296 end
297
298 local panelName = "autoEatingPanel"
299 local panelId = 1
300 while parent:getChildById(panelName .. panelId) do
301 panelId = panelId + 1
302 end
303 panelName = panelName .. panelId
304
305 local ui = g_ui.createWidget("ItemsPanel", parent)
306 ui:setId(panelName)
307
308 if not context.storage[panelName] then
309 context.storage[panelName] = {}
310 end
311
312 ui.title:setText("Auto eating")
313 ui.title:setOn(context.storage[panelName].enabled)
314 ui.title.onClick = function(widget)
315 context.storage[panelName].enabled = not context.storage[panelName].enabled
316 widget:setOn(context.storage[panelName].enabled)
317 end
318
319 if type(context.storage[panelName].items) ~= 'table' then
320 context.storage[panelName].items = {3725, 0, 0, 0, 0}
321 end
322
323 for i=1,5 do
324 ui.items:getChildByIndex(i).onItemChange = function(widget)
325 context.storage[panelName].items[i] = widget:getItemId()
326 end
327 ui.items:getChildByIndex(i):setItemId(context.storage[panelName].items[i])
328 end
329
330 context.macro(15000, function()
331 if not context.storage[panelName].enabled then
332 return
333 end
334 local candidates = {}
335 for i, item in pairs(context.storage[panelName].items) do
336 if item >= 100 then
337 table.insert(candidates, item)
338 end
339 end
340 if #candidates == 0 then
341 return
342 end
343 context.use(candidates[math.random(1, #candidates)])
344 end)
345end
346
347