forked from Sida-Scripts/Scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathXT001-SummonerSpells.lua
More file actions
282 lines (253 loc) · 10.8 KB
/
Copy pathXT001-SummonerSpells.lua
File metadata and controls
282 lines (253 loc) · 10.8 KB
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
-- ###################################################################################################### --
-- # # --
-- # XT001-Summoner Spells # --
-- # by Sida # --
-- # Credit for original scripts 100% to the original authors!! # --
-- # # --
-- ###################################################################################################### --
--[--------- Contains ---------]
-- Auto Ignite - Created by SurfaceS
-- Auto Heal - Created by SurfaceS
-- Auto Exhaust - Created by SurfaceS
-- Auto Barrier - Created by SurfaceS
-- ############################################# BARRIER ################################################
--[[ Globals ]]
local barrierCastDelay = 0
local barrierActive = true
local barrierHaveDisplay = true -- don't display chat
local minValue = 0.15 -- Minimum health ratio for using Barrier
local barrierSlot
--[[ Code ]]
local function barrierReady()
if barrierSlot ~= nil and barrierCastDelay < GetTickCount() and player:CanUseSpell(barrierSlot) == READY then return true end
return false
end
function BarrierOnLoad()
--[[ Conditional ]]
if string.find(player:GetSpellData(SUMMONER_1).name..player:GetSpellData(SUMMONER_2).name, "SummonerBarrier") ~= nil then
if player:GetSpellData(SUMMONER_1).name == "SummonerBarrier" then
barrierSlot = SUMMONER_1
elseif player:GetSpellData(SUMMONER_2).name == "SummonerBarrier" then
barrierSlot = SUMMONER_2
end
function BarrierOnTick()
local barrierTick = GetTickCount()
if barrierActive and barrierReady() and player.health / player.maxHealth < minValue then
CastSpell(barrierSlot)
barrierCastDelay = barrierTick + 300
end
end
end
end
-- ############################################# BARRIER ################################################
-- ############################################# HEAL ################################################
--[[ Globals ]]
local healCastDelay = 0
local healActive = true
local minValue = 0.15 -- Minimum health ratio for using Barrier
local slot
--[[ Code ]]
local function healReady()
if slot ~= nil and healCastDelay < GetTickCount() and player:CanUseSpell(slot) == READY then return true end
return false
end
function HealOnLoad()
--[[ Conditional ]]
if string.find(player:GetSpellData(SUMMONER_1).name..player:GetSpellData(SUMMONER_2).name, "SummonerHeal") ~= nil then
if player:GetSpellData(SUMMONER_1).name == "SummonerHeal" then
slot = SUMMONER_1
elseif player:GetSpellData(SUMMONER_2).name == "SummonerHeal" then
slot = SUMMONER_2
end
function HealOnTick()
local healTick = GetTickCount()
if healActive and healReady() and player.health / player.maxHealth < minValue then
CastSpell(slot)
healCastDelay = healTick + 300
end
end
end
end
-- ############################################# HEAL ################################################
-- ############################################# EXHAUST ################################################
--[[ Globals ]]
local autoSummonerExhaust = {
exhaustCastDelay = 0,
exhaustActive = false,
exhaustActiveTick = 0,
exhaustRange = 550,
haveDisplay = false, -- don't display chat
activeKey = 84, -- Press key to use autoSummonerExhaust mode (tTt by default)
}
--[[ Code ]]
function ExhaustOnLoad()
--[[ Conditional ]]
if string.find(player:GetSpellData(SUMMONER_1).name..player:GetSpellData(SUMMONER_2).name, "SummonerExhaust") ~= nil then
if player:GetSpellData(SUMMONER_1).name == "SummonerExhaust" then
autoSummonerExhaust.slot = SUMMONER_1
elseif player:GetSpellData(SUMMONER_2).name == "SummonerExhaust" then
autoSummonerExhaust.slot = SUMMONER_2
end
function autoSummonerExhaust.ready()
return autoSummonerExhaust.slot ~= nil and autoSummonerExhaust.exhaustCastDelay < GetTickCount() and player:CanUseSpell(autoSummonerExhaust.slot) == READY
end
function ExhaustOnWndMsg(msg,wParam)
if msg == KEY_DOWN and wParam == autoSummonerExhaust.activeKey and autoSummonerExhaust.ready() then
if autoSummonerExhaust.exhaustActive == false and autoSummonerExhaust.haveDisplay == false then PrintChat(" >> Auto exhaust forced") end
autoSummonerExhaust.exhaustActive = true
autoSummonerExhaust.exhaustActiveTick = GetTickCount() + 1000
end
end
function ExhaustOnTick()
local exhaustTick = GetTickCount()
if autoSummonerExhaust.exhaustActive then
if autoSummonerExhaust.ready() then
local exhsuatMaxDPShero = nil
local maxDPS = 0
for i = 1, heroManager.iCount, 1 do
local exhaustHero = heroManager:getHero(i)
if ValidTarget(exhaustHero,autoSummonerExhaust.exhaustRange + 100) then
local exhaustDps = exhaustHero.totalDamage * exhaustHero.attackSpeed
if exhsuatMaxDPShero == nil or maxDPS < exhaustDps then maxDPS, exhsuatMaxDPShero = exhaustDps, exhaustHero end
end
end
if exhsuatMaxDPShero ~= nil then
autoSummonerExhaust.exhaustActive = false
autoSummonerExhaust.exhaustCastDelay = exhaustTick + 500
CastSpell(autoSummonerExhaust.slot, exhsuatMaxDPShero)
end
end
if autoSummonerExhaust.exhaustActiveTick < exhaustTick then autoSummonerExhaust.exhaustActive = false end
end
end
else
autoSummonerExhaust = nil
end
end
-- ############################################# EXHAUST ################################################
-- ############################################# IGNITE ################################################
--[[ Globals ]]
local autoSummonerDot = {
igniteRange = 600,
igniteBaseDamage = 50,
damagePerLevel = 20,
castDelay = 0,
haveDisplay = false,
activeKey = 249, -- Press key to use autoSummonerDot mode (space by default)
toggleKey = 108, -- Press key to toggle autoSummonerDot mode (F3/F4 by default -> slot)
forceIgniteKey = 84, -- Press key to force ignite (tTt by default)
active = true,
toggled = true,
forced = true,
forcedTick = 0,
}
--[[ Code ]]
function IgniteOnLoad()
--[[ Conditional ]]
if player == nil then player = GetMyHero() end
if string.find(player:GetSpellData(SUMMONER_1).name..player:GetSpellData(SUMMONER_2).name, "SummonerDot") ~= nil then
if player:GetSpellData(SUMMONER_1).name == "SummonerDot" then
autoSummonerDot.slot = SUMMONER_1
elseif player:GetSpellData(SUMMONER_2).name == "SummonerDot" then
autoSummonerDot.slot = SUMMONER_2
autoSummonerDot.toggleKey = autoSummonerDot.toggleKey + 1
end
function autoSummonerDot.ready()
if autoSummonerDot.slot ~= nil and autoSummonerDot.castDelay < GetTickCount() and player:CanUseSpell(autoSummonerDot.slot) == READY then return true end
return false
end
function autoSummonerDot.autoIgniteIfKill()
if autoSummonerDot.ready() then
local damage = autoSummonerDot.igniteBaseDamage + autoSummonerDot.damagePerLevel * player.level
for i = 1, heroManager.iCount, 1 do
local hero = heroManager:getHero(i)
if hero ~= nil and hero.team ~= player.team and not hero.dead and hero.visible and player:GetDistance(hero) < autoSummonerDot.igniteRange and hero.health <= damage then
return autoSummonerDot.igniteTarget( hero )
end
end
end
return nil
end
function autoSummonerDot.autoIgniteLowestHealth()
if autoSummonerDot.ready() then
local minLifeHero = nil
for i = 1, heroManager.iCount, 1 do
local hero = heroManager:getHero(i)
if hero ~= nil and hero.team ~= player.team and not hero.dead and hero.visible and player:GetDistance(hero) <= autoSummonerDot.igniteRange then
if minLifeHero == nil or hero.health < minLifeHero.health then
minLifeHero = hero
end
end
end
if minLifeHero ~= nil then
return autoSummonerDot.igniteTarget( minLifeHero )
end
end
return nil
end
function autoSummonerDot.igniteTarget(target)
if autoSummonerDot.ready() then
CastSpell(autoSummonerDot.slot, target)
autoSummonerDot.castDelay = GetTickCount() + 500
return target
end
return nil
end
function IgniteOnTick()
local tick = GetTickCount()
if autoSummonerDot.toggled == false then autoSummonerDot.active = IsKeyDown(autoSummonerDot.activeKey) end
if autoSummonerDot.forced then
if autoSummonerDot.forcedTick > tick then
if autoSummonerDot.autoIgniteLowestHealth() ~= nil then autoSummonerDot.forced = false end
else
autoSummonerDot.forced = false
end
elseif autoSummonerDot.active then
autoSummonerDot.autoIgniteIfKill()
end
end
else
autoSummonerDot = nil
end
end
-- ############################################# IGNITE ################################################
-- XT001 --
local hasIgnite, hasHeal, hasExhaust, hasBarrier, enabled = false, false, false, false, true
function OnLoad()
if string.find(player:GetSpellData(SUMMONER_1).name..player:GetSpellData(SUMMONER_2).name, "SummonerExhaust") ~= nil then hasExhaust = true end
if string.find(player:GetSpellData(SUMMONER_1).name..player:GetSpellData(SUMMONER_2).name, "SummonerDot") ~= nil then hasIgnite = true end
if string.find(player:GetSpellData(SUMMONER_1).name..player:GetSpellData(SUMMONER_2).name, "SummonerHeal") ~= nil then hasHeal = true end
if string.find(player:GetSpellData(SUMMONER_1).name..player:GetSpellData(SUMMONER_2).name, "SummonerBarrier") ~= nil then hasBarrier = true end
if hasHeal or hasIgnite or hasExhaust or hasBarrier then KCConfig = scriptConfig("XT001-Summoner Spells", "xt001summonerspells") else enabled = false end
if hasIgnite then KCConfig:addParam("Ignite", "Enable Auto Ignite", SCRIPT_PARAM_ONOFF, true) end
if hasHeal then KCConfig:addParam("Heal", "Enable Auto Heal", SCRIPT_PARAM_ONOFF, true) end
if hasExhaust then KCConfig:addParam("Exhaust", "Enable Auto Exhaust", SCRIPT_PARAM_ONOFF, true) end
if hasBarrier then KCConfig:addParam("Barrier", "Enable Auto Barrier", SCRIPT_PARAM_ONOFF, true) end
if hasIgnite then IgniteOnLoad() end
if hasHeal then HealOnLoad() end
if hasExhaust then ExhaustOnLoad() end
if hasBarrier then BarrierOnLoad() end
end
function OnTick()
if enabled then
if KCConfig.Ignite and hasIgnite then
IgniteOnTick()
end
if KCConfig.Heal and hasHeal then
HealOnTick()
end
if KCConfig.Exhaust and hasExhaust then
ExhaustOnTick()
end
if KCConfig.Barrier and hasBarrier then
BarrierOnTick()
end
end
end
function OnDraw()
end
function OnWndMsg(msg,key)
if enabled then
if hasExhaust and KCConfig.Exhaust then ExhaustOnWndMsg(msg, key) end
end
end