This repository has been archived by the owner on Jan 6, 2023. It is now read-only.
/
Engine States.lua
91 lines (77 loc) · 2.54 KB
/
Engine States.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
init start
-- local SCRIPT_VERSION = '1.0.0'
local header, closeButton, closed, moving
local cursorPosition = {}
local engines = {'Cavebot', 'Looting', 'Targeting', 'Spell Healer', 'Potion Healer', 'Condition Healer', 'Mana Trainer'}
filterinput(false, true, false, false)
function inputevents(e)
if e.type == IEVENT_LMOUSEUP then
if e.elementid == closeButton then
closed = true
return
end
for _, v in ipairs(engines) do
if e.elementid == v.shape then
toggle(v.name:gsub(' ', '') .. '/Enabled')
return
end
end
elseif e.elementid == header then
if e.type == IEVENT_MMOUSEDOWN then
moving = true
cursorPosition.x = $cursor.x
cursorPosition.y = $cursor.y
return
elseif e.type == IEVENT_MMOUSEUP then
moving = false
return
end
end
end
-- Taken from Sirmate's MMH
local blueGradient = {0.0, color(36, 68, 105, 20), 0.23, color(39, 73, 114, 20), 0.76, color(21, 39, 60, 20)}
local blackGradient = {0.0, color(75, 75, 75, 20), 0.23, color(45, 45, 45, 20), 0.76, color(19, 19, 19, 20)}
local redGradient = {0.0, color(136, 35, 12, 20), 0.23, color(139, 37, 13, 20), 0.76, color(92, 6, 6, 20)}
local greenGradient = {0.0, color(65, 96, 12, 20), 0.23, color(67, 99, 13, 20), 0.76, color(36, 52, 6, 20)}
for k, v in ipairs(engines) do
engines[k] = {
name = v,
shape = nil
}
end
setposition($clientwin.right - 424, $worldwin.top + 300)
setfontstyle('Tahoma', 8, 75, 0xFFFFFF, 1, 0x000000)
setfillstyle('gradient', 'linear', 2, 0, 0, 0, 21)
setbordercolor(color(0, 0, 0, 50))
setantialiasing(true)
init end
auto(100)
if moving then
auto(10)
local curPosition = getposition()
setposition(
curPosition.x + ($cursor.x - cursorPosition.x),
curPosition.y + ($cursor.y - cursorPosition.y)
)
cursorPosition.x = $cursor.x
cursorPosition.y = $cursor.y
end
if closed then
return
end
addgradcolors(table.unpack(blueGradient))
header = addshape('roundrect', 0, 0, 150, 20, 3, 3)
addtext('ENGINE STATES', 24, 3)
addgradcolors(table.unpack(blackGradient))
closeButton = addshape('roundrect', 130, 0, 20, 20, 3, 3)
addtext('X', 137, 3)
local isEnabled
for k, v in ipairs(engines) do
addgradcolors(table.unpack(blackGradient))
addshape('roundrect', 0, k * 23, 150, 20, 3, 3)
addtext(v.name, 6, k * 23 + 3)
isEnabled = get(v.name:gsub(' ', '') .. '/Enabled') == 'yes'
addgradcolors(table.unpack(tern(isEnabled, greenGradient, redGradient)))
engines[k].shape = addshape('roundrect', 120, k * 23, 30, 20, 3, 3)
addtext(tern(isEnabled, 'ON', 'OFF'), 126 + tern(isEnabled, 2, 0), k * 23 + 3)
end