View difference between Paste ID: j5kwKhbu and DnQiTqZ2
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
11+
local scanAdditionalRange = 750
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
local canQ = false
25
26
local lastBasicAttack = 0
27
local swingDelay = 0.15
28
local swing = 0
29
local tick = nil
30
31
local targetSelected = true
32
33
local ts
34
35-
local TiamatSlot, SotDSlot BRKSlot, DFGSlot, HXGSlot, BWCSlot, SheenSlot, TrinitySlot, LichBaneSlot = nil, nil, nil, nil, nil, nil, nil, nil, nil
35+
36-
local QREADY, WREADY, EREADY, RREADY, TiamatREADY, SotDREADY, BRKREADY, DFGREADY, HXGREADY, BWCREADY = false, false, false, false, false, false, false, false, false, false
36+
local TMATSlot, SotDSlot BRKSlot, DFGSlot, HXGSlot, BWCSlot, SheenSlot, TrinitySlot, LichBaneSlot = nil, nil, nil, nil, nil, nil, nil, nil, nil
37
local QREADY, WREADY, EREADY, RREADY, TMATREADY, SotDREADY, BRKREADY, DFGREADY, HXGREADY, BWCREADY = false, false, false, false, false, false, false, false, false, false
38
39
40
function OnLoad()
41
	RCConfig = scriptConfig("Rengar the Rapist", "rengartherapist v1.1")
42
	RCConfig:addParam("scriptActive", "Combo", SCRIPT_PARAM_ONKEYDOWN, false, 88)
43
	RCConfig:addParam("scriptActive2", "Combo", SCRIPT_PARAM_ONKEYDOWN, false, 90)
44
	RCConfig:addParam("scriptActive3", "Combo", SCRIPT_PARAM_ONKEYDOWN, false, 67)
45
	RCConfig:addParam("escape", "Combo", SCRIPT_PARAM_ONKEYDOWN, false, 89)
46-
	RCConfig:addParam("SHIELD", "Shield", SCRIPT_PARAM_ONKEYDOWN, false, 85) -- Uu
46+
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) -- `~	
49+
	RCConfig:addParam("autoAAFarm", "Auto AA Farm", SCRIPT_PARAM_ONKEYDOWN, false, 192) -- `~
50
  RCConfig:addParam("autoEFarm", "Auto E Farm", SCRIPT_PARAM_ONKEYDOWN, false, 112) -- F1
51
	RCConfig:addParam("autoignite", "Auto Ignite", SCRIPT_PARAM_ONOFF, true)
52-
	ts = TargetSelector(TARGET_LOW_HP,range+200,DAMAGE_PHYSICAL,true)	
52+
  RCConfig:addParam("autoW", "Auto W", SCRIPT_PARAM_ONKEYTOGGLE, false, 84)
53
	RCConfig:permaShow("autoAAFarm")
54
  RCConfig:permaShow("autoEFarm")
55
  RCConfig:permaShow("autoW")
56
	ts = TargetSelector(TARGET_LOW_HP,range+150,DAMAGE_PHYSICAL,true)	
57
	ts.name = "Rengar"
58
	RCConfig:addTS(ts)
59
	if myHero:GetSpellData(SUMMONER_1).name:find("SummonerDot") then ignite = SUMMONER_1
60
	elseif myHero:GetSpellData(SUMMONER_2).name:find("SummonerDot") then ignite = SUMMONER_2
61
  end
62-
		if unit.isMe then 
62+
63
end
64
65
	function OnProcessSpell(unit, spell)
66
		if unit.isMe then
67
      if spell and spell.name:find("RengarQ")then
68
        canQ = false
69
				swing = 0
70
			end
71
			if spell and spell.name:find("RengarBasicAttack" or "RengarCritAttack") then
72
				swing = 1
73
				lastBasicAttack = os.clock()
74
			end      
75
		end
76
	end
77
	
78
	function OnCreateObj(obj)
79
    if canQ == true and obj and obj.name:find("RengarQ") then
80
      canQ = false
81
      swing = 0
82
      --leap = 1
83
			--PrintChat(" >> Rengar Q!")  
84
    end
85
		if obj and (obj.name == "Rengar_LeapEnd.troy") and GetDistance(obj) < 150 then        	
86
      swing = 1
87
      lastBasicAttack = os.clock()
88
      --leap = 1
89
			--PrintChat(" >> Rengar Leap!")  
90
    end
91
	end
92
  
93
  --[[function OnDeleteObj(obj)
94
    if obj and obj.name:find("RengarQ") then     
95
			PrintChat(" >> Rengar Q Gone!")  
96
    end		
97
	end]]
98
99
function OnTick()
100
	if myHero.dead then
101
		return
102
	end
103
	
104
	if swing == 1 and os.clock() > lastBasicAttack + 0.5 then
105
		swing = 0
106
	end
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)
108+
109
		if IREADY then
110
			local ignitedmg = 0	
111
			for j = 1, heroManager.iCount, 1 do
112
				local enemyhero = heroManager:getHero(j)
113
				if ValidTarget(enemyhero,600) then
114
					ignitedmg = 50 + 20 * myHero.level
115
					if enemyhero.health <= (ignitedmg - 50) then
116-
	TMATREADY = (TiamatSlot ~= nil and myHero:CanUseSpell(TiamatSlot) == READY)
116+
117
					end
118
				end
119
			end
120
		end
121
	end
122
	
123
	
124
	
125
	TMATSlot, 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) -- 
126
	QREADY = (myHero:CanUseSpell(_Q) == READY)
127
	WREADY = (myHero:CanUseSpell(_W) == READY)
128
	EREADY = (myHero:CanUseSpell(_E) == READY)
129
	RREADY = (myHero:CanUseSpell(_R) == READY)
130
	DFGREADY = (DFGSlot ~= nil and myHero:CanUseSpell(DFGSlot) == READY)
131
	HXGREADY = (HXGSlot ~= nil and myHero:CanUseSpell(HXGSlot) == READY)
132
	BWCREADY = (BWCSlot ~= nil and myHero:CanUseSpell(BWCSlot) == READY)
133
	TMATREADY = (TMATSlot ~= nil and myHero:CanUseSpell(TMATSlot) == READY)
134
SotDREADY = (SotDSlot ~= nil and myHero:CanUseSpell(SotDSlot) == READY)
135
	IREADY = (ignite ~= nil and myHero:CanUseSpell(ignite) == READY)
136
			
137
	ts:update()	
138
  
139
	if RCConfig.harass and ts.target ~= nil then
140-
			if ValidTarget(ts.target, wrange) then
140+
141
			CastSpell(_E, ts.target)
142-
			end						
142+
143-
elseif swing == 1 then
143+
144-
if SotDREADY and GetDistance(ts.target) < 400 then CastSpell(SotDSlot) end
144+
145-
if TMATREADY and GetDistance(ts.target) < 400 and not (QREADY or WREADY) and os.clock() - lastBasicAttack > swingDelay then
145+
  if RCConfig.autoW then
146-
CastSpell(TiamatSlot)
146+
		for k = 1, heroManager.iCount, 1 do
147-
swing = 0
147+
			local enemyhero = heroManager:getHero(k)
148
			if WREADY and ValidTarget(enemyhero,Wrange) then
149
				 --myHero:Attack(enemyhero)			
150
				--if swing == 1 and (os.clock() - lastBasicAttack > swingDelay) then
151
					CastSpell(_W)							
152
			--	end	
153
			end
154
		end
155
	end
156
  
157
  
158
	if RCConfig.scriptActive and ts.target ~= nil then
159
		if DFGREADY then CastSpell(DFGSlot, ts.target) end
160
		if HXGREADY then CastSpell(HXGSlot, ts.target) end
161
		if BWCREADY then CastSpell(BWCSlot, ts.target) end
162
		if BRKREADY then CastSpell(BRKSlot, ts.target) end
163
    if myHero.mana < 5 and GetDistance(ts.target) < wrange and WREADY then			
164
				CastSpell(_W)
165
		end
166
		if swing == 0 then
167
      if (GetDistance(ts.target) < erange and GetDistance(ts.target) > 225) and EREADY then			
168
				CastSpell(_E, ts.target)
169
			end					
170
    elseif swing == 1 then
171
      if TMATREADY and GetDistance(ts.target) < 400 and not (QREADY or WREADY) and os.clock() - lastBasicAttack > swingDelay then
172
        CastSpell(TMATSlot)
173
        swing = 0
174
      end
175
      if SotDREADY and GetDistance(ts.target) < 400 then
176-
elseif swing == 1 then
176+
        CastSpell(SotDSlot)
177-
if SotDREADY and GetDistance(ts.target) < 400 then CastSpell(SotDSlot) end
177+
178-
if TMATREADY and GetDistance(ts.target) < 400 and not (QREADY or WREADY) and os.clock() - lastBasicAttack > swingDelay then
178+
      
179-
CastSpell(TiamatSlot)
179+
180-
swing = 0
180+
181
				swing = 0	
182-
       if QREADY and os.clock() - lastBasicAttack > swingDelay then
182+
183
				CastSpell(_Q)
184
        myHero:Attack(ts.target)
185
				swing = 0
186
			end
187
		end					
188
	end
189
  	
190
	if RCConfig.scriptActive2 and ts.target ~= nil then
191
		if DFGREADY then CastSpell(DFGSlot, ts.target) end
192
		if HXGREADY then CastSpell(HXGSlot, ts.target) end
193
		if BWCREADY then CastSpell(BWCSlot, ts.target) end
194
		if BRKREADY then CastSpell(BRKSlot, ts.target) end
195
    if myHero.mana < 5 and GetDistance(ts.target) < wrange and WREADY then			
196
				CastSpell(_W)
197
		end				
198
		if swing == 0 then
199
      if myHero.mana == 4 and not (WREADY or QREADY) and (GetDistance(ts.target) < erange and GetDistance(ts.target) > 225) and EREADY then			
200
				CastSpell(_E, ts.target)
201
			end
202
			if ts.target ~= nil and ValidTarget(ts.target, wrange) then
203
				myHero:Attack(ts.target)
204
			end
205
    elseif swing == 1 then
206
      canQ = true
207
      if TMATREADY and GetDistance(ts.target) < 400 and not (QREADY or WREADY) and os.clock() - lastBasicAttack > swingDelay then --
208
        CastSpell(TMATSlot)
209-
elseif swing == 1 then
209+
        swing = 0
210-
if SotDREADY and GetDistance(ts.target) < 400 then CastSpell(SotDSlot) end
210+
211-
if TMATREADY and GetDistance(ts.target) < 400 and not (QREADY or WREADY) and os.clock() - lastBasicAttack > swingDelay then
211+
      if SotDREADY and GetDistance(ts.target) < 400 then
212-
CastSpell(TiamatSlot)
212+
        CastSpell(SotDSlot)
213-
swing = 0
213+
214
       if canQ == true then
215
       if QREADY and os.clock() - lastBasicAttack > swingDelay and canQ == true then
216
         canQ = false
217
         CastSpell(_Q)         
218
         myHero:Attack(ts.target)
219
         swing = 0
220
	elseif myHero.mana == 4 and not (WREADY or QREADY) and os.clock() - lastBasicAttack > swingDelay then
221
				CastSpell(_E, ts.target)
222
				swing = 0
223
        end
224
			end
225-
 
225+
226
	end	
227
	
228
	if RCConfig.scriptActive3 and ts.target ~= nil then
229
		if DFGREADY then CastSpell(DFGSlot, ts.target) end
230
		if HXGREADY then CastSpell(HXGSlot, ts.target) end
231
		if BWCREADY then CastSpell(BWCSlot, ts.target) end
232
		if BRKREADY then CastSpell(BRKSlot, ts.target) end
233
    
234
    if GetDistance(ts.target) < wrange and WREADY then			
235
				CastSpell(_W)
236
		end				
237
		if swing == 0 then
238
      if myHero.mana == 4 and not (WREADY or QREADY) and (GetDistance(ts.target) < erange and GetDistance(ts.target) > 225) and EREADY then			
239
				CastSpell(_E, ts.target)
240
			end
241
			if ts.target ~= nil and ValidTarget(ts.target, wrange) then
242
				myHero:Attack(ts.target)
243
			end
244
    elseif swing == 1 then
245
      if TMATREADY and GetDistance(ts.target) < 400 and not (QREADY or WREADY) and os.clock() - lastBasicAttack > swingDelay then
246
        CastSpell(TMATSlot)
247
        swing = 0
248
      end
249
      if SotDREADY and GetDistance(ts.target) < 400 then
250
        CastSpell(SotDSlot)
251
      end
252
      if myHero.mana < 5 and QREADY and os.clock() - lastBasicAttack > swingDelay then
253
         CastSpell(_Q)
254
         myHero:Attack(ts.target)
255
         swing = 0
256
	elseif myHero.mana == 4 and not (WREADY or QREADY) and os.clock() - lastBasicAttack > swingDelay then
257
				CastSpell(_E, ts.target)
258
				swing = 0
259
      end
260
		end							
261
	end
262
  
263
  if RCConfig.autoEFarm then
264
    if mousemoving and GetTickCount() > nextTick then
265
			player:MoveTo(mousePos.x, mousePos.z)
266
		end
267
		--local myQ = math.floor((myHero:GetSpellData(_Q).level-1)*20 + 40 + myHero.ap * .4)
268
		for k = 1, objManager.maxObjects do
269
			local minionObjectI = objManager:GetObject(k)      
270
			if minionObjectI ~= nil and string.find(minionObjectI.name,"Minion_") == 1 and minionObjectI.team ~= myHero.team and minionObjectI.dead == false then
271-
	SC__OnDraw()
271+
        local myE = getDmg("E",minionObjectI,myHero)
272
				if myHero:GetDistance(minionObjectI) < 650 and minionObjectI.health <= myHero:CalcDamage(minionObjectI, myE) then
273-
function OnWndMsg(msg,key)
273+
					CastSpell(_E, minionObjectI)
274-
	SC__OnWndMsg(msg,key)
274+
275
			end
276
		end
277-
	TargetSelector__OnSendChat(msg)
277+
278
    
279
  
280-
PrintChat(" >> Rengar the Rapist v1.1 loaded!")
280+
281
		if mousemoving and GetTickCount() > nextTick then
282
			player:MoveTo(mousePos.x, mousePos.z)
283
		end
284
						
285
		local tick = GetTickCount()
286
		if lasthiton then
287
		unitScanTick = tick
288
			for i = 1, objManager.maxObjects, 1 do
289
				local object = objManager:getObject(i)
290
				if object ~= nil and object.team ~= player.team and object.type == "obj_AI_Minion" and string.find(object.charName,"Minion") then
291
					if not object.dead and GetDistance(object,player) <= (player.range + scanAdditionalRange) then
292
						if units[object.name] == nil then
293
							units[object.name] = { obj = object, markTick = 0 }
294
						end
295
					else
296
						units[object.name] = nil
297
					end
298
				end
299
			end
300
		end
301
		for i, unit in pairs(units) do
302
			if unit.obj == nil or unit.obj.dead or GetDistance(player,unit.obj) > (player.range + scanAdditionalRange) then
303
				units[i] = nil
304
			else
305
				if unit.obj.health <= (myHero:CalcDamage(unit.obj,myHero.totalDamage)) then -- 
306
					if lasthiton and GetTickCount() > nextTick then
307
						player:Attack(unit.obj) ---PrintChat("ATTACKING")
308
						nextTick = GetTickCount() + waitDelay	
309
						return
310
					end 
311
				end
312
			end     
313
		end
314
	end
315
	
316
end
317
function OnDraw()
318
	if RCConfig.drawcircles and not myHero.dead then		
319
		if WREADY then DrawCircle(myHero.x, myHero.y, myHero.z, wrange, 0x992D3D) end
320
		if EREADY then DrawCircle(myHero.x, myHero.y, myHero.z, erange, 0xFFFFFF) end
321
		if ts.target ~= nil then
322
			for j=0, 10 do DrawCircle(ts.target.x, ts.target.y, ts.target.z, 40 + j*1.5, 0x00FF00) end
323
		end
324
	end
325
end
326
function OnSendChat(msg)
327
	ts:OnSendChat(msg, "pri")
328
end
329
PrintChat(" >> Rengar the Rapist v1.2 loaded!")