-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathvarus.py
426 lines (345 loc) · 16.4 KB
/
varus.py
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
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
import imp
import sys
from winstealer import *
from commons.utils import *
from commons.skills import *
from commons.items import *
from commons.targeting import *
from evade import checkEvade
import json, time, math
import urllib3, json, urllib, ssl
from commons.targit import *
winstealer_script_info = {
"script": "SA1-varus",
"author": "SA1",
"description": "SA1-varus",
"target_champ": "varus",
}
combo_key = 57
harass_key = 45
laneclear_key = 47
killsteal_key = 46
use_q_in_combo = True
use_w_in_combo = True
use_e_in_combo = True
use_r_in_combo = False
lane_clear_with_q = True
lane_clear_with_w = True
lane_clear_with_e = True
jungle_clear_with_q = True
jungle_clear_with_w = True
jungle_clear_with_e = True
smart_combo=1
draw_q_range = True
draw_w_range = True
draw_e_range = True
draw_r_range = True
q = {"Range": 700}
w = {"Range": 370}
r = {"Range": 500}
charging_q=0
spell_priority = {"Q": 0, "W": 0, "E": 0, "R": 0}
def q_range(charge_time):
if charge_time <= 0.25:
return 895
if charge_time >= 1.25:
return 1595
return 400 + 116.67*(charge_time - 0.4)*10
def charge_q(game, q_spell):
global charging_q, charge_start_time
q_spell.trigger(True)
if game.player.mana >= mana_q[game.player.Q.level -1]:
charging_q = True
charge_start_time = game.time
spellTimer = Timer()
def release_q(game, q_spell,target):
global charging_q,spellTimer
if spellTimer.Timer():
q_spell.move_and_trigger(game.world_to_screen(target))
spellTimer.SetTimer(0.4)
charging_q = False
# Get player stats from local server
ssl._create_default_https_context = ssl._create_unverified_context
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
def getPlayerStats():
response = urllib.request.urlopen("https://127.0.0.1:2999/liveclientdata/activeplayer").read()
stats = json.loads(response)
return stats
def winstealer_load_cfg(cfg):
global use_q_in_combo, use_w_in_combo, use_e_in_combo,use_r_in_combo
global draw_q_range, draw_w_range, draw_e_range, draw_r_range
global spell_priority, combo_key, harass_key, laneclear_key, killsteal_key
global lane_clear_with_q, lane_clear_with_w, lane_clear_with_e
global jungle_clear_with_q, jungle_clear_with_w, jungle_clear_with_e,smart_combo
combo_key = cfg.get_int("combo_key", 57)
harass_key = cfg.get_int("harass_key", 45)
laneclear_key = cfg.get_int("laneclear_key", 47)
killsteal_key = cfg.get_int("killsteal_key", 46)
use_q_in_combo = cfg.get_bool("use_q_in_combo", True)
use_w_in_combo = cfg.get_bool("use_w_in_combo", True)
use_e_in_combo = cfg.get_bool("use_e_in_combo", True)
use_r_in_combo=cfg.get_bool("use_r_in_combo",True)
draw_q_range = cfg.get_bool("draw_q_range", False)
draw_w_range = cfg.get_bool("draw_w_range", False)
draw_e_range = cfg.get_bool("draw_e_range", False)
draw_r_range = cfg.get_bool("draw_r_range", False)
lane_clear_with_q = cfg.get_bool("lane_clear_with_q", True)
lane_clear_with_w = cfg.get_bool("lane_clear_with_w", True)
lane_clear_with_e = cfg.get_bool("lane_clear_with_e", True)
smart_combo=cfg.get_int("smart_combo",smart_combo)
#spell_priority = json.loads(
#cfg.get_str("spell_priority", json.dumps(spell_priority))
#)
def winstealer_save_cfg(cfg):
global use_q_in_combo, use_w_in_combo, use_e_in_combo,use_r_in_combo
global draw_q_range, draw_w_range, draw_e_range, draw_r_range
global spell_priority, combo_key, harass_key, laneclear_key, killsteal_key
global lane_clear_with_q, lane_clear_with_w, lane_clear_with_e
global jungle_clear_with_q, jungle_clear_with_w, jungle_clear_with_e,smart_combo
cfg.set_int("combo_key", combo_key)
cfg.set_int("harass_key", harass_key)
cfg.set_int("laneclear_key", laneclear_key)
cfg.set_bool("use_q_in_combo", use_q_in_combo)
cfg.set_bool("use_w_in_combo", use_w_in_combo)
cfg.set_bool("use_e_in_combo", use_e_in_combo)
cfg.set_bool("use_r_in_combo", use_r_in_combo)
cfg.set_bool("draw_q_range", draw_q_range)
cfg.set_bool("draw_w_range", draw_w_range)
cfg.set_bool("draw_e_range", draw_e_range)
cfg.set_bool("draw_r_range", draw_r_range)
cfg.set_bool("lane_clear_with_q", lane_clear_with_q)
cfg.set_bool("lane_clear_with_w", lane_clear_with_w)
cfg.set_bool("lane_clear_with_e", lane_clear_with_e)
cfg.set_int("smart_combo",smart_combo)
def winstealer_draw_settings(game, ui):
global use_q_in_combo, use_w_in_combo, use_e_in_combo,use_r_in_combo
global draw_q_range, draw_w_range, draw_e_range, draw_r_range
global spell_priority, combo_key, harass_key, laneclear_key, killsteal_key
global lane_clear_with_q, lane_clear_with_w, lane_clear_with_e
global jungle_clear_with_q, jungle_clear_with_w, jungle_clear_with_e,smart_combo
combo_key = ui.keyselect("Combo key", combo_key)
laneclear_key = ui.keyselect("Laneclear key", laneclear_key)
ui.text("SA1-Varus : 1.0.0.0")
ui.separator ()
ui.text("W is manual")
# smart_combo=ui.listbox("",["Spam Q/W/E","Combo E>W>Q"],smart_combo)
if ui.treenode("Combo Settings"):
use_q_in_combo = ui.checkbox("Use Q in Combo", use_q_in_combo)
# use_w_in_combo = ui.checkbox("Use W in Combo", use_w_in_combo)
use_e_in_combo = ui.checkbox("Use E in Combo", use_e_in_combo)
use_r_in_combo =ui.checkbox("Use R in Combo", use_r_in_combo)
ui.separator ()
ui.text("<< R when low hp >>")
ui.separator ()
ui.treepop()
if ui.treenode("Lane Clear Settings"):
lane_clear_with_q = ui.checkbox("Laneclear with Q", lane_clear_with_q)
lane_clear_with_e=ui.checkbox("Laneclear with E",lane_clear_with_e)
# lane_clear_with_w = ui.checkbox("Laneclear with W ", lane_clear_with_w)
ui.treepop()
if ui.treenode("Jungle Clear Settings"):
jungle_clear_with_q = ui.checkbox("Jungle with Q", jungle_clear_with_q)
jungle_clear_with_e = ui.checkbox("Jungle with E", jungle_clear_with_e)
# lane_clear_with_w = ui.checkbox("Laneclear with W ", lane_clear_with_w)
ui.treepop()
mana_q = [70,75,80,85,90]
mana_w = [90,100,110,120,130]
mana_r = [100,50,0]
#mana_r = 100 ##for mana check later update???
########################
class Fake_target ():
def __init__(self, name, pos, gameplay_radius):
self.name = name
self.pos = pos
self.gameplay_radius = gameplay_radius
def predict_pos(target,casttime):
"""Predicts the target's new position after a duration"""
target_direction = target.ai_navEnd.sub(target.ai_navBegin).normalize()
veloc=target.ai_velocity
orientation = veloc.normalize()
if veloc.x ==0.0 and veloc.y == 0.0:
return target.pos
# Target movement speed
target_movement_speed = target.movement_speed
# The distance that the target will have traveled after the given duration
distance_to_travel = target_movement_speed * casttime
# distance_to_travel2=(timetoimpact / 2.2)* 1.5
return target.pos.add(target_direction.scale(distance_to_travel))
def RDamage(game, target):
# Calculate raw R damage on target
r_lvl = game.player.R.level
if r_lvl == 0:
return 0
ap = getPlayerStats()["championStats"]["abilityPower"]
min_dmg = [100,200,300]
missing_hp = (target.max_health - target.health)
missing_hp_pct = (missing_hp / target.max_health) * 100
increased_pct = 0.015 * missing_hp_pct
if increased_pct > 1:
increased_pct = 1
r_damage = (1 + increased_pct) * (min_dmg[r_lvl - 1] + 0.75 * ap)
# Reduce damage based on target's magic resist
mr = target.magic_resist
if mr >= 0:
dmg_multiplier = 100 / (100 + mr)
else:
dmg_multiplier = 2 - 100 / (100 - mr)
r_damage *= dmg_multiplier
return r_damage
lastQ=0
def Evade(game):
global e, lastW
e_spell = getSkill(game, "E")
w_spell = getSkill(game, "W")
for missile in game.missiles:
br = game.player.gameplay_radius
if not game.player.is_alive or missile.is_ally_to(game.player):
continue
if not is_skillshot(missile.name):
continue
spell = get_missile_parent_spell(missile.name)
if not spell:
continue
if InSkillShot( game, game.player.pos, missile, spell, game.player.gameplay_radius * 2) and game.is_point_on_screen(missile.pos):
if use_w_in_combo:
if IsReady(game, w_spell) and game.player.mana>=50:
w_spell.move_and_trigger(game.world_to_screen(missile.pos))
current_q_range=0
q_speed=1900
q_mana=[65,70,75,80,85]
def getVrusAttack2(game):
for missile in game.missiles:
# print(missile.name)
if (missile.name == "varuswbasicattack"
or missile.name == "varusqmissile"
) :
return True
return False
def Combo(game):
global use_q_in_combo, use_w_in_combo, use_e_in_combo, use_r_in_combo,current_q_range,q_speed
global draw_q_range, draw_e_range, draw_w_range, draw_r_range
global combo_key, laneclear_key,smart_combo
global q, w, e, r,lastQ ,spellTimer
q_spell = getSkill(game, "Q")
w_spell = getSkill(game, "W")
e_spell = getSkill(game, "E")
r_spell = getSkill(game, "R")
before_cpos = game.get_cursor()
# for b in game.player.buffs:
# print(b.name)
if use_q_in_combo and IsReady(game, q_spell):
target = TargetSelector (game,1700)
q_travel_time = 0.70
if target:
if not charging_q :
charge_q(game, q_spell)
current_charge_time = game.time - charge_start_time
current_q_range = q_range(current_charge_time)
predicted_pos = predict_pos (target, q_travel_time)
predicted_target = Fake_target (target.name, predicted_pos, target.gameplay_radius)
if game.player.pos.distance(predicted_target.pos) <= current_q_range - 50 :
if getBuff(game.player,"VarusQLaunch") :
release_q(game, q_spell,predicted_target.pos)
# spellTimer.SetTimer(0.4)
elif game.player.mana >= mana_q[game.player.Q.level -1] :
release_q(game, q_spell,predicted_target.pos)
# spellTimer.SetTimer(0.4)
if use_e_in_combo and IsReady(game, e_spell) and not charging_q and game.player.mana>=80:
target = TargetSelector (game,925)
if target:
q_travel_time = 925/1750
predicted_pos = predict_pos (target, q_travel_time)
predicted_target = Fake_target (target.name, predicted_pos, target.gameplay_radius)
if game.player.pos.distance (predicted_target.pos) <= 910:
if spellTimer.Timer():
e_spell.move_and_trigger(game.world_to_screen(predicted_target.pos))
spellTimer.SetTimer(0.4)
if use_r_in_combo and IsReady(game, r_spell) and game.player.mana>=100:
targetR=TargetSelector(game,1300)
if targetR:
q_travel_time = 1200/1300
predicted_pos = predict_pos (targetR, q_travel_time)
predicted_target = Fake_target (targetR.name, predicted_pos, targetR.gameplay_radius)
hp = int(targetR.health / targetR.max_health * 100)
if game.player.pos.distance (targetR.pos) > 450 and hp<40 and spellTimer.Timer():
r_spell.move_and_trigger(game.world_to_screen(predicted_target.pos))
spellTimer.SetTimer(0.4)
def Laneclear(game):
#global w, e, r
global q, w, e, r
global lane_clear_with_q, lane_clear_with_w, lane_clear_with_e
global spell_priority, combo_key, laneclear_key, killsteal_key
#q = {"Range": 600}
q_spell = getSkill(game, "Q")
w_spell = getSkill(game, "W")
e_spell = getSkill(game, "E")
before_cpos = game.get_cursor()
if lane_clear_with_q and IsReady(game, q_spell):
target = GetBestMinionsInRange (game,1700)
q_travel_time = 0.70
if target:
if not charging_q :
charge_q(game, q_spell)
current_charge_time = game.time - charge_start_time
current_q_range = q_range(current_charge_time)
if game.player.pos.distance(target.pos) <= current_q_range - 50 :
if getBuff(game.player,"VarusQLaunch") :
release_q(game, q_spell,target.pos)
# spellTimer.SetTimer(0.4)
elif game.player.mana >= mana_q[game.player.Q.level -1] :
release_q(game, q_spell,target.pos)
# spellTimer.SetTimer(0.4)
if lane_clear_with_e and IsReady(game, e_spell) and not charging_q and game.player.mana>=80:
target = GetBestMinionsInRange (game,925)
if target:
if game.player.pos.distance (target.pos) <= 910:
game.move_cursor(game.world_to_screen(target.pos))
e_spell.trigger(False)
time.sleep(0.03)
game.move_cursor(before_cpos)
def Jungleclear(game):
global q, w, e, r
global spell_priority, combo_key, laneclear_key, killsteal_key
global jungle_clear_with_q, jungle_clear_with_w, jungle_clear_with_e
q_spell = getSkill(game, "Q")
w_spell = getSkill(game, "W")
e_spell = getSkill(game, "E")
before_cpos = game.get_cursor()
if jungle_clear_with_q and IsReady(game, q_spell):
target = GetBestJungleInRange (game,1700)
q_travel_time = 0.70
if target:
if not charging_q :
charge_q(game, q_spell)
current_charge_time = game.time - charge_start_time
current_q_range = q_range(current_charge_time)
if game.player.pos.distance(target.pos) <= current_q_range - 50 :
if getBuff(game.player,"VarusQLaunch") :
release_q(game, q_spell,target.pos)
# spellTimer.SetTimer(0.4)
elif game.player.mana >= mana_q[game.player.Q.level -1] :
release_q(game, q_spell,target.pos)
# spellTimer.SetTimer(0.4)
if jungle_clear_with_e and IsReady(game, e_spell) and not charging_q and game.player.mana>=80:
target = GetBestJungleInRange (game,925)
if target:
if game.player.pos.distance (target.pos) <= 910:
game.move_cursor(game.world_to_screen(target.pos))
e_spell.trigger(False)
time.sleep(0.03)
game.move_cursor(before_cpos)
def winstealer_update(game, ui):
global use_q_in_combo, use_w_in_combo, use_e_in_combo
global draw_q_range, draw_w_range, draw_e_range, draw_r_range
global spell_priority, combo_key, laneclear_key, killsteal_key
global lane_clear_with_q, lane_clear_with_w, lane_clear_with_e
global jungle_clear_with_q, jungle_clear_with_w, jungle_clear_with_e
global q, w, e, r
self = game.player
if self.is_alive :
# print(charge_q(game, q_spell))
if game.was_key_pressed(combo_key):
Combo(game)
if game.was_key_pressed(laneclear_key):
Laneclear(game)
Jungleclear(game)