View difference between Paste ID: DnQiTqZ2 and yF64GjB8
SHOW: | | - or go back to the newest paste.
1
--[[
2
	Rengar The Rapist by jbman
3
]]
4
if myHero.charName ~= "Rengar" then return end
5
--[[		Code		]]
6
7
local mousemoving = true 
8
local movedelay = 0
9
local unitScanDelay = 0
10
local waitDelay = 300
11
local scanAdditionalRange = 500
12
local units = {}
13
local oldDelayTick = 0
14
local unitScanTick = 0
15
local holding = 0
16
local animPlayedTick = nil
17
local nextTick = 0
18
19
local lasthiton = true
20
21
local wrange = 475
22
local range = 750
23
local erange = 650
24
25
local lastBasicAttack = 0
26
local swingDelay = 0.15
27
local swing = 0
28
local tick = nil
29
30
local targetSelected = true
31
32
local ts
33
34
local ignite = nil
35-
local TiamatSlot, SotDSlot BRKSlot, DFGSlot, HXGSlot, BWCSlot, SheenSlot, TrinitySlot, LichBaneSlot = nil, nil, nil, nil, nil, nil, nil, nil
35+
local TiamatSlot, SotDSlot BRKSlot, DFGSlot, HXGSlot, BWCSlot, SheenSlot, TrinitySlot, LichBaneSlot = nil, nil, nil, nil, nil, nil, nil, nil, nil
36-
local QREADY, WREADY, EREADY, RREADY, TiamatREADY, SotDREADY, BRKREADY, DFGREADY, HXGREADY, BWCREADY = false, false, false, false, false, false, false, false
36+
local QREADY, WREADY, EREADY, RREADY, TiamatREADY, SotDREADY, BRKREADY, DFGREADY, HXGREADY, BWCREADY = false, false, false, false, false, false, false, false, false, false
37
38
39
function OnLoad()
40
	RCConfig = scriptConfig("Rengar the Rapist", "rengartherapist v1.1")
41
	RCConfig:addParam("scriptActive", "Combo", SCRIPT_PARAM_ONKEYDOWN, false, 88)
42
	RCConfig:addParam("scriptActive2", "Combo", SCRIPT_PARAM_ONKEYDOWN, false, 90)
43
	RCConfig:addParam("scriptActive3", "Combo", SCRIPT_PARAM_ONKEYDOWN, false, 67)
44
	RCConfig:addParam("escape", "Combo", SCRIPT_PARAM_ONKEYDOWN, false, 89)
45
	RCConfig:addParam("harass", "Harass", SCRIPT_PARAM_ONKEYDOWN, false, 84)
46
	RCConfig:addParam("SHIELD", "Shield", SCRIPT_PARAM_ONKEYDOWN, false, 85) -- Uu
47
	RCConfig:addParam("drawcircles", "Draw Circles", SCRIPT_PARAM_ONOFF, true)
48
	RCConfig:addParam("drawtext", "Draw Text", SCRIPT_PARAM_ONOFF, true)
49
	RCConfig:addParam("autoAAFarm", "Auto AA Farm", SCRIPT_PARAM_ONKEYDOWN, false, 192) -- `~	
50
	RCConfig:addParam("autoignite", "Auto Ignite", SCRIPT_PARAM_ONOFF, true)
51
	RCConfig:permaShow("autoAAFarm")
52
	ts = TargetSelector(TARGET_LOW_HP,range+200,DAMAGE_PHYSICAL,true)	
53
	ts.name = "Rengar"
54
	RCConfig:addTS(ts)
55
	if myHero:GetSpellData(SUMMONER_1).name:find("SummonerDot") then ignite = SUMMONER_1
56
	elseif myHero:GetSpellData(SUMMONER_2).name:find("SummonerDot") then ignite = SUMMONER_2
57
  end
58
59
end
60
61
	function OnProcessSpell(unit, spell)
62
		if unit.isMe then 
63
			if spell and spell.name:find("RengarBasicAttack" or "RengarCritAttack") then
64
				swing = 1
65
				lastBasicAttack = os.clock()
66
			end
67
      if spell and spell.name:find("RengarQ")then
68
				swing = 0
69
			end
70
		end
71
	end
72
	
73
	function OnCreateObj(obj)
74
		if obj and (obj.name == "Rengar_LeapEnd.troy") and GetDistance(obj) < 150 then        	
75
      swing = 1
76
      lastBasicAttack = os.clock()
77
      --leap = 1
78
			--PrintChat(" >> Rengar Leap!")  
79
    end
80
	end
81
82
function OnTick()
83
	if myHero.dead then
84
		return
85
	end
86
	
87
	if swing == 1 and os.clock() > lastBasicAttack + 0.5 then
88
		swing = 0
89
	end
90
			
91
	if ignite ~= nil and myHero:CanUseSpell(ignite) == READY then
92
		if IREADY then
93
			local ignitedmg = 0	
94
			for j = 1, heroManager.iCount, 1 do
95
				local enemyhero = heroManager:getHero(j)
96
				if ValidTarget(enemyhero,600) then
97
					ignitedmg = 50 + 20 * myHero.level
98
					if enemyhero.health <= (ignitedmg - 50) then
99
						CastSpell(ignite, enemyhero)
100
					end
101
				end
102
			end
103
		end
104
	end
105
	
106
	
107
	
108
	TiamatSlot, SotDSlot, BRKSlot, DFGSlot, HXGSlot, BWCSlot, SheenSlot, TrinitySlot, LichBaneSlot = GetInventorySlotItem(3077) or GetInventorySlotItem(3074) , GetInventorySlotItem(3131), GetInventorySlotItem(3153), GetInventorySlotItem(3128), GetInventorySlotItem(3146), GetInventorySlotItem(3144), GetInventorySlotItem(3057), GetInventorySlotItem(3078), GetInventorySlotItem(3100)
109
	QREADY = (myHero:CanUseSpell(_Q) == READY)
110
	WREADY = (myHero:CanUseSpell(_W) == READY)
111
	EREADY = (myHero:CanUseSpell(_E) == READY)
112
	RREADY = (myHero:CanUseSpell(_R) == READY)
113
	DFGREADY = (DFGSlot ~= nil and myHero:CanUseSpell(DFGSlot) == READY)
114
	HXGREADY = (HXGSlot ~= nil and myHero:CanUseSpell(HXGSlot) == READY)
115
	BWCREADY = (BWCSlot ~= nil and myHero:CanUseSpell(BWCSlot) == READY)
116
	TMATREADY = (TiamatSlot ~= nil and myHero:CanUseSpell(TiamatSlot) == READY)
117
SotDREADY = (SotDSlot ~= nil and myHero:CanUseSpell(SotDSlot) == READY)
118
	IREADY = (ignite ~= nil and myHero:CanUseSpell(ignite) == READY)
119
			
120
	ts:update()	
121
  
122
	if RCConfig.harass and ts.target ~= nil then
123
		if EREADY and GetDistance(ts.target) < erange then
124
			CastSpell(_E, ts.target)
125
		end
126
	end
127
	
128
	if RCConfig.scriptActive and ts.target ~= nil then
129
		if DFGREADY then CastSpell(DFGSlot, ts.target) end
130
		if HXGREADY then CastSpell(HXGSlot, ts.target) end
131
		if BWCREADY then CastSpell(BWCSlot, ts.target) end
132
		if BRKREADY then CastSpell(BRKSlot, ts.target) end
133
    if myHero.mana < 5 and GetDistance(ts.target) < wrange and WREADY then			
134
				CastSpell(_W)
135
		end
136
		if swing == 0 then
137
      if (GetDistance(ts.target) < erange and GetDistance(ts.target) > 225) and EREADY then			
138
				CastSpell(_E, ts.target)
139
			end
140
			if ValidTarget(ts.target, wrange) then
141
				myHero:Attack(ts.target)
142
			end						
143
elseif swing == 1 then
144
if SotDREADY and GetDistance(ts.target) < 400 then CastSpell(SotDSlot) end
145
if TMATREADY and GetDistance(ts.target) < 400 and not (QREADY or WREADY) and os.clock() - lastBasicAttack > swingDelay then
146
CastSpell(TiamatSlot)
147
swing = 0
148
end
149
			if EREADY and os.clock() - lastBasicAttack > swingDelay then
150
				CastSpell(_E, ts.target)
151
				swing = 0	
152
	elseif myHero.mana < 5 and QREADY and not EREADY and os.clock() - lastBasicAttack > swingDelay then
153
				CastSpell(_Q)
154
        myHero:Attack(ts.target)
155
				swing = 0
156
			end
157
		end					
158
	end
159
160
	
161
	if RCConfig.scriptActive2 and ts.target ~= nil then
162
		if DFGREADY then CastSpell(DFGSlot, ts.target) end
163
		if HXGREADY then CastSpell(HXGSlot, ts.target) end
164
		if BWCREADY then CastSpell(BWCSlot, ts.target) end
165
		if BRKREADY then CastSpell(BRKSlot, ts.target) end
166
    if myHero.mana < 5 and GetDistance(ts.target) < wrange and WREADY then			
167
				CastSpell(_W)
168
		end				
169
		if swing == 0 then
170
      if myHero.mana == 4 and not (WREADY or QREADY) and (GetDistance(ts.target) < erange and GetDistance(ts.target) > 225) and EREADY then			
171
				CastSpell(_E, ts.target)
172
			end
173
			if ts.target ~= nil and ValidTarget(ts.target, wrange) then
174
				myHero:Attack(ts.target)
175
			end
176
elseif swing == 1 then
177
if SotDREADY and GetDistance(ts.target) < 400 then CastSpell(SotDSlot) end
178
if TMATREADY and GetDistance(ts.target) < 400 and not (QREADY or WREADY) and os.clock() - lastBasicAttack > swingDelay then
179
CastSpell(TiamatSlot)
180
swing = 0
181
end
182
       if QREADY and os.clock() - lastBasicAttack > swingDelay then
183
         CastSpell(_Q)
184
         myHero:Attack(ts.target)
185
         swing = 0
186
	elseif myHero.mana == 4 and not (WREADY or QREADY) and os.clock() - lastBasicAttack > swingDelay then
187
				CastSpell(_E, ts.target)
188
				swing = 0
189
			end
190
		end							
191
	end	
192
	
193
	if RCConfig.scriptActive3 and ts.target ~= nil then
194
		if DFGREADY then CastSpell(DFGSlot, ts.target) end
195
		if HXGREADY then CastSpell(HXGSlot, ts.target) end
196
		if BWCREADY then CastSpell(BWCSlot, ts.target) end
197
		if BRKREADY then CastSpell(BRKSlot, ts.target) end
198
    
199
    if GetDistance(ts.target) < wrange and WREADY then			
200
				CastSpell(_W)
201
		end				
202
		if swing == 0 then
203
      if myHero.mana == 4 and not (WREADY or QREADY) and (GetDistance(ts.target) < erange and GetDistance(ts.target) > 225) and EREADY then			
204
				CastSpell(_E, ts.target)
205
			end
206
			if ts.target ~= nil and ValidTarget(ts.target, wrange) then
207
				myHero:Attack(ts.target)
208
			end
209
elseif swing == 1 then
210
if SotDREADY and GetDistance(ts.target) < 400 then CastSpell(SotDSlot) end
211
if TMATREADY and GetDistance(ts.target) < 400 and not (QREADY or WREADY) and os.clock() - lastBasicAttack > swingDelay then
212
CastSpell(TiamatSlot)
213
swing = 0
214
end
215
      if myHero.mana < 5 and QREADY and os.clock() - lastBasicAttack > swingDelay then
216
         CastSpell(_Q)
217
         myHero:Attack(ts.target)
218
         swing = 0
219
	elseif myHero.mana == 4 and not (WREADY or QREADY) and os.clock() - lastBasicAttack > swingDelay then
220
				CastSpell(_E, ts.target)
221
				swing = 0
222
      end
223
		end							
224
	end
225
 
226
	if RCConfig.autoAAFarm then
227
		if mousemoving and GetTickCount() > nextTick then
228
			player:MoveTo(mousePos.x, mousePos.z)
229
		end
230
						
231
		local tick = GetTickCount()
232
		if lasthiton then
233
		unitScanTick = tick
234
			for i = 1, objManager.maxObjects, 1 do
235
				local object = objManager:getObject(i)
236
				if object ~= nil and object.team ~= player.team and object.type == "obj_AI_Minion" and string.find(object.charName,"Minion") then
237
					if not object.dead and GetDistance(object,player) <= (player.range + scanAdditionalRange) then
238
						if units[object.name] == nil then
239
							units[object.name] = { obj = object, markTick = 0 }
240
						end
241
					else
242
						units[object.name] = nil
243
					end
244
				end
245
			end
246
		end
247
		for i, unit in pairs(units) do
248
			if unit.obj == nil or unit.obj.dead or GetDistance(player,unit.obj) > (player.range + scanAdditionalRange) then
249
				units[i] = nil
250
			else
251
				if unit.obj.health <= (myHero:CalcDamage(unit.obj,myHero.totalDamage)) then -- 
252
					if lasthiton and GetTickCount() > nextTick then
253
						player:Attack(unit.obj) ---PrintChat("ATTACKING")
254
						nextTick = GetTickCount() + waitDelay	
255
						return
256
					end 
257
				end
258
			end     
259
		end
260
	end
261
	
262
end
263
function OnDraw()
264
	if RCConfig.drawcircles and not myHero.dead then		
265
		if WREADY then DrawCircle(myHero.x, myHero.y, myHero.z, wrange, 0x992D3D) end
266
		if EREADY then DrawCircle(myHero.x, myHero.y, myHero.z, erange, 0xFFFFFF) end
267
		if ts.target ~= nil then
268
			for j=0, 10 do DrawCircle(ts.target.x, ts.target.y, ts.target.z, 40 + j*1.5, 0x00FF00) end
269
		end
270
	end
271
	SC__OnDraw()
272
end
273
function OnWndMsg(msg,key)
274
	SC__OnWndMsg(msg,key)
275
end
276
function OnSendChat(msg)
277
	TargetSelector__OnSendChat(msg)
278
	ts:OnSendChat(msg, "pri")
279
end
280
PrintChat(" >> Rengar the Rapist v1.1 loaded!")