forked from dd2repo/BoL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathd2wukong.lua
272 lines (240 loc) · 8.45 KB
/
d2wukong.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
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
if myHero.charName ~= "MonkeyKing" then
return
end
require 'SxOrbWalk'
local selectedTar = nil
local VP = nil
local version = 1.1
local AUTOUPDATE = true
local SCRIPT_NAME = "d2wukong"
local selectedTar = nil
local SOURCELIB_URL = "https://raw.github.com/TheRealSource/public/master/common/SourceLib.lua"
local SOURCELIB_PATH = LIB_PATH.."SourceLib.lua"
if FileExist(SOURCELIB_PATH) then
require("SourceLib")
else
DONLOADING_SOURCELIB = true
DownloadFile(SOURCELIB_URL, SOURCELIB_PATH, function() print("Required libraries downloaded successfully, please reload") end)
end
if DOWNLOADING_SOURCELIB then print("Downloading required libraries, please wait...") return end
local RequireI = Require("SourceLib")
RequireI:Check()
if AUTOUPDATE then
SourceUpdater(SCRIPT_NAME, version, "raw.github.com", "/dd2repo/BoL/master/"..SCRIPT_NAME..".lua", SCRIPT_PATH .. GetCurrentEnv().FILE_NAME, "/dd2repo/BoL/master/"..SCRIPT_NAME..".version"):CheckUpdate()
end
function OnLoad()
ts = TargetSelector(TARGET_LESS_CAST_PRIORITY,315)
m = scriptConfig("[D2 Wukong v1.1]", "d2wukong")
orb = SxOrb
orb:RegisterAfterAttackCallback(hydra)
--orb:RegisterOnAttackCallback(CastQ)
Ignite = (myHero:GetSpellData(SUMMONER_1).name:find("summonerdot") and SUMMONER_1) or (myHero:GetSpellData(SUMMONER_2).name:find("summonerdot") and SUMMONER_2) or nil
m:addSubMenu("Combo Settings", "combosettings")
m.combosettings:addParam("useq", "Use Q", SCRIPT_PARAM_ONOFF, true)
m.combosettings:addParam("usee", "Use E", SCRIPT_PARAM_ONOFF, true)
m:addSubMenu("Ultimate Settings", "ultimatesettings")
m.ultimatesettings:addParam("useau", "Use Auto-Ultimate", SCRIPT_PARAM_ONOFF, true)
m.ultimatesettings:addParam("auv", "Use Auto-Ultimate if it hits", SCRIPT_PARAM_LIST, 1, {"2 Targets", "3 Targets", "4 Targets", "5 Targets" })
m:addSubMenu("KS Settings", "ks")
m.ks:addParam("ignite", "Use Ignite", SCRIPT_PARAM_ONOFF, true)
m.ks:addParam("user", "Use Ultimate", SCRIPT_PARAM_ONOFF, true)
m.ks:addParam("usee", "Use E", SCRIPT_PARAM_ONOFF, true)
m:addSubMenu("Drawings", "draws")
m.draws:addParam("drawq", "Draw Q range", SCRIPT_PARAM_ONOFF, false)
m.draws:addParam("drawe", "Draw E range", SCRIPT_PARAM_ONOFF, false)
m.draws:addParam("drawr", "Draw R range", SCRIPT_PARAM_ONOFF, false)
m:addParam("combokey", "Combo", SCRIPT_PARAM_ONKEYDOWN, false, 32)
--m:addParam("magnet", "Meele Magnet", SCRIPT_PARAM_ONOFF, true)
m:addParam("target", "Left Click Target Selection", SCRIPT_PARAM_ONOFF, true)
m:addSubMenu("Orbwalker", "orbwalk")
orb:LoadToMenu(m.orbwalk)
m:addTS(ts)
ts.name = "Selection"
PrintChat ("<font color='#00BCFF'>[D2 Wukong v1.1] loaded!</font>")
end
function OnGainBuff(unit, buff)
if buff.name == 'MonkeyKingSpinToWin' and unit.isMe then
usingult = true
end
end
function OnLoseBuff(unit, buff)
if buff.name == 'MonkeyKingSpinToWin' and unit.isMe then
usingult = false
end
end
function OnCreateObj(object)
if object.name == 'MonkeyKing_Base_R_Cas_Glow.troy' then
usingult2 = true
end
if object.name == 'MonkeyKing_Base_R_Cas.troy' then
usingult3 = true
end
end
function OnDeleteObj(object)
if object.name == 'MonkeyKing_Base_R_Cas_Glow.troy' then
usingult2 = false
end
if object.name == 'MonkeyKing_Base_R_Cas.troy' then
usingult3 = false
end
end
function OnTick()
checks()
--targetmagnet()
checks()
Killsteal()
CastQ()
CastE()
CST()
Autoult()
end
function checks()
ts:update()
Qready = (myHero:CanUseSpell(_Q) == READY)
Wready = (myHero:CanUseSpell(_W) == READY)
Eready = (myHero:CanUseSpell(_E) == READY)
Rready = (myHero:CanUseSpell(_R) == READY)
target = ts.target
end
function CountEnemyHeroInRange(range)
local enemyInRange = 0
for i = 1, heroManager.iCount, 1 do
local hero = heroManager:getHero(i)
if ValidTarget(hero,range) then
enemyInRange = enemyInRange + 1
end
end
return enemyInRange
end
function Autoult()
if m.ultimatesettings.useau and not (usingult or usingult2 or usingult3) then
if m.ultimatesettings.auv == 1 then
if CountEnemyHeroInRange(315) >= 2 then
CastSpell(_R)
end
elseif m.ultimatesettings.auv == 2 then
if CountEnemyHeroInRange(315) >= 3 then
CastSpell(_R)
end
elseif m.ultimatesettings.auv == 3 then
if CountEnemyHeroInRange(315) >= 4 then
CastSpell(_R)
end
elseif m.ultimatesettings.auv == 4 then
if CountEnemyHeroInRange(315) >= 5 then
CastSpell(_R)
end
end
end
end
function hydra()
if m.combokey and target and ValidTarget(target, 200) and GetDistance(target) <= 200 then CastItem(3074) CastItem(3077)
end
end
function CastQ()
if not (usingult or usingult2 or usingult3) then
if m.combokey and Qready and m.combosettings.useq and target and ValidTarget(target, 290) and GetDistance(target) <= 290 then
CastSpell(_Q)
end
end
end
function CastE()
if not (usingult or usingult2 or usingult3) then
if m.combokey and Eready then
ts.range = 620
ts:update()
if ValidTarget(ts.target, 620) then
CastSpell(_E, ts.target)
end
ts.range = 315
ts:update()
end
end
end
function Killsteal()
for _, enemy in pairs(GetEnemyHeroes()) do
if Ignite ~= nil and m.ks.ignite and enemy.health < getDmg("IGNITE", enemy, myHero) and ValidTarget(enemy, 600) then CastSpell(Ignite, enemy)
end
if ValidTarget(enemy, 315) and m.ks.user and not (usingult or usingult2 or usingult3) then
local RDmg = getDmg('R', enemy, myHero) or 0
if Rready and enemy.health <= RDmg*4 then
CastSpell(_R)
end
end
if m.ks.usee and ValidTarget(enemy, 610) and not (usingult or usingult2 or usingult3) then
local EDmg = getDmg('E', enemy, myHero) or 0
if Eready and enemy.health <= EDmg then
CastSpell(_E, enemy)
end
end
end
end
--[[
function targetmagnet()
if m.combokey and target and ValidTarget(target, 300) and m.magnet then
local dist = GetDistanceSqr(target)
if dist < 300^2 and dist > 50^2 then
stayclose(target, true)
elseif dist <= 50^2 then
stayclose(target, false)
end
end
end
function stayclose(unit, mode)
if mode then
local myVector = Vector(myHero.x, myHero.y, myHero.z)
local targetVector = Vector(unit.x, unit.y, unit.z)
local orbwalkPoint1 = targetVector + (myVector-targetVector):normalized()*100
local orbwalkPoint2 = targetVector - (myVector-targetVector):normalized()*100
if GetDistanceSqr(orbwalkPoint1) < GetDistanceSqr(orbwalkPoint2) then
orb:OrbWalk(unit, orbwalkPoint1)
else
orb:OrbWalk(unit, orbwalkPoint2)
end
else
orb:OrbWalk(unit, myHero)
end
end
]]
function CST()
local Target = nil
if selectedTar then Target = selectedTar
else Target = ts.target
end
end
function OnWndMsg(Msg, Key)
if m.target then
if Msg == WM_LBUTTONDOWN then
local minD = 10
local starget = nil
for i, enemy in ipairs(GetEnemyHeroes()) do
if ValidTarget(enemy) then
if GetDistance(enemy, mousePos) <= minD or starget == nil then
minD = GetDistance(enemy, mousePos)
starget = enemy
end
end
end
if starget and minD < 500 then
if selectedTar and starget.charName == selectedTar.charName then
selectedTar = nil
print("<font color=\"#FFFFFF\">Wukong: Target <b>UNSELECTED</b>: "..starget.charName.."</font>")
else
selectedTar = starget
print("<font color=\"#FFFFFF\">Wukong: New target <b>selected</b>: "..starget.charName.."</font>")
end
end
end
end
end
function OnDraw()
if m.draws.drawq then
DrawCircle(myHero.x, myHero.y, myHero.z, 300, ARGB(255, 255, 255, 255))
end
if m.draws.drawe then
DrawCircle(myHero.x, myHero.y, myHero.z, 625, ARGB(255, 255, 255, 255))
end
if m.draws.drawr then
DrawCircle(myHero.x, myHero.y, myHero.z, 315, ARGB(255, 255, 255, 255))
end
end