View difference between Paste ID: 55Au0skS and j5kwKhbu
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 = 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
21+
local wrange = 450
22
local range = 750
23-
local erange = 650
23+
local erange = 575
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 ignite = nil
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")
41+
	RCConfig = scriptConfig("Rengar the Rapist", "rengartherapist v1.3")
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("harass", "Harass", SCRIPT_PARAM_ONKEYDOWN, false, 84)
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("autoEFarm", "Auto E Farm", SCRIPT_PARAM_ONKEYDOWN, false, 112) -- F1
51
	RCConfig:addParam("autoignite", "Auto Ignite", SCRIPT_PARAM_ONOFF, 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
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
81+
      swing = 0 
82-
      --leap = 1
82+
83-
			--PrintChat(" >> Rengar Q!")  
83+
84
      swing = 1
85
      lastBasicAttack = os.clock()
86
      canQ = true
87
    end
88-
      --leap = 1
88+
89-
			--PrintChat(" >> Rengar Leap!")  
89+
90
91
function OnTick()
92
	if myHero.dead then
93-
  --[[function OnDeleteObj(obj)
93+
94-
    if obj and obj.name:find("RengarQ") then     
94+
95-
			PrintChat(" >> Rengar Q Gone!")  
95+
96-
    end		
96+
97
		swing = 0
98
	end
99
			
100
	--[[if ignite ~= nil and myHero:CanUseSpell(ignite) == READY then
101
		if IREADY then
102
			local ignitedmg = 0	
103
			for j = 1, heroManager.iCount, 1 do
104
				local enemyhero = heroManager:getHero(j)
105
				if ValidTarget(enemyhero,600) then
106
					ignitedmg = 50 + 20 * myHero.level
107
					if enemyhero.health <= (ignitedmg - 50) then
108-
	if ignite ~= nil and myHero:CanUseSpell(ignite) == READY then
108+
109
					end
110
				end
111
			end
112
		end
113
	end]]
114
	
115
	
116
	
117
	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) -- 
118
	QREADY = (myHero:CanUseSpell(_Q) == READY)
119
	WREADY = (myHero:CanUseSpell(_W) == READY)
120
	EREADY = (myHero:CanUseSpell(_E) == READY)
121
	RREADY = (myHero:CanUseSpell(_R) == READY)
122
	DFGREADY = (DFGSlot ~= nil and myHero:CanUseSpell(DFGSlot) == READY)
123
	HXGREADY = (HXGSlot ~= nil and myHero:CanUseSpell(HXGSlot) == READY)
124
	BWCREADY = (BWCSlot ~= nil and myHero:CanUseSpell(BWCSlot) == READY)
125
	TMATREADY = (TMATSlot ~= nil and myHero:CanUseSpell(TMATSlot) == READY)
126
  SotDREADY = (SotDSlot ~= nil and myHero:CanUseSpell(SotDSlot) == READY)
127
	IREADY = (ignite ~= nil and myHero:CanUseSpell(ignite) == READY)
128
			
129
	ts:update()	
130
  
131
	if RCConfig.harass and ts.target ~= nil then
132
		if EREADY and GetDistance(ts.target) < erange then
133
			CastSpell(_E, ts.target)
134-
SotDREADY = (SotDSlot ~= nil and myHero:CanUseSpell(SotDSlot) == READY)
134+
135
	end
136
	
137
  if RCConfig.autoW then
138
		for k = 1, heroManager.iCount, 1 do
139
			local enemyhero = heroManager:getHero(k)
140
			if WREADY and ValidTarget(enemyhero,475) then
141
					CastSpell(_W)
142
			end
143
		end
144
	end
145
  
146
  if (RCConfig.scriptActive or RCConfig.scriptActive1 or RCConfig.scriptActive2 or RCConfig.scriptActive3) and ts.target ~= nil and RCConfig.autoignite and IREADY then    
147
		local QWEDmg = RENDmgCalculation(ts.target)
148-
			if WREADY and ValidTarget(enemyhero,Wrange) then
148+
		local IDmg = getDmg("IGNITE",ts.target,myHero)    
149-
				 --myHero:Attack(enemyhero)			
149+
		if GetDistance(ts.target) < 600 and ts.target.health > QWEDmg and ts.target.health <= IDmg+QWEDmg then CastSpell(ignite, ts.target) end
150-
				--if swing == 1 and (os.clock() - lastBasicAttack > swingDelay) then
150+
	end  
151-
					CastSpell(_W)							
151+
152-
			--	end	
152+
153
		if DFGREADY then CastSpell(DFGSlot, ts.target) end
154
		if HXGREADY then CastSpell(HXGSlot, ts.target) end
155
		if BWCREADY then CastSpell(BWCSlot, ts.target) end
156
		if BRKREADY then CastSpell(BRKSlot, ts.target) end
157
    if myHero.mana < 5 and GetDistance(ts.target) < wrange and WREADY then			
158
				CastSpell(_W)
159
		end
160
		if swing == 0 then
161
      if (GetDistance(ts.target) < erange and GetDistance(ts.target) > 225) and EREADY then			
162
				CastSpell(_E, ts.target)
163
			end					
164
    elseif swing == 1 then
165
      if TMATREADY and GetDistance(ts.target) < 400 and not QREADY and os.clock() - lastBasicAttack > swingDelay then
166
        CastSpell(TMATSlot)
167
        swing = 0
168
      end
169
      if SotDREADY then
170
        if ts.target.type == "obj_AI_Hero" and GetDistance(ts.target) < 400 then
171-
      if TMATREADY and GetDistance(ts.target) < 400 and not (QREADY or WREADY) and os.clock() - lastBasicAttack > swingDelay then
171+
          CastSpell(SotDSlot)
172
        end
173
      end      
174
			if EREADY and os.clock() - lastBasicAttack > swingDelay then
175-
      if SotDREADY and GetDistance(ts.target) < 400 then
175+
176-
        CastSpell(SotDSlot)
176+
177
	elseif myHero.mana < 5 and QREADY and not EREADY and os.clock() - lastBasicAttack > swingDelay then
178-
      
178+
179
        myHero:Attack(ts.target)
180
				swing = 0
181
			end
182
		end					
183
	end
184
  	
185
	if RCConfig.scriptActive2 and ts.target ~= nil then
186
		if DFGREADY then CastSpell(DFGSlot, ts.target) end
187
		if HXGREADY then CastSpell(HXGSlot, ts.target) end
188
		if BWCREADY then CastSpell(BWCSlot, ts.target) end
189
		if BRKREADY then CastSpell(BRKSlot, ts.target) end
190
    if myHero.mana < 5 and GetDistance(ts.target) < wrange and WREADY then			
191
				CastSpell(_W)
192
		end				
193
		if swing == 0 then
194
      if myHero.mana == 4 and not (WREADY or QREADY) and (GetDistance(ts.target) < erange and GetDistance(ts.target) > 225) and EREADY then			
195
				CastSpell(_E, ts.target)
196
			end
197
			if ts.target ~= nil and ValidTarget(ts.target, wrange) then
198
				myHero:Attack(ts.target)
199
			end
200
    elseif swing == 1 then
201
      if TMATREADY and GetDistance(ts.target) < 400 and not QREADY and os.clock() - lastBasicAttack > swingDelay then --
202
        CastSpell(TMATSlot)
203
        swing = 0
204
      end      
205
      if SotDREADY then
206
        if ts.target.type == "obj_AI_Hero" and GetDistance(ts.target) < 400 then
207-
      if TMATREADY and GetDistance(ts.target) < 400 and not (QREADY or WREADY) and os.clock() - lastBasicAttack > swingDelay then --
207+
          CastSpell(SotDSlot)
208
        end
209
      end      
210
      if canQ == true then
211-
      if SotDREADY and GetDistance(ts.target) < 400 then
211+
212-
        CastSpell(SotDSlot)
212+
213
         CastSpell(_Q)         
214-
       if canQ == true then
214+
215
         swing = 0
216
	elseif myHero.mana == 4 and not (WREADY or QREADY) and os.clock() - lastBasicAttack > swingDelay then
217
				CastSpell(_E, ts.target)
218
				swing = 0
219
        end
220
			end
221
		end							
222
	end	
223
	
224
	if RCConfig.scriptActive3 and ts.target ~= nil then
225
		if DFGREADY then CastSpell(DFGSlot, ts.target) end
226
		if HXGREADY then CastSpell(HXGSlot, ts.target) end
227
		if BWCREADY then CastSpell(BWCSlot, ts.target) end
228
		if BRKREADY then CastSpell(BRKSlot, ts.target) end
229
    
230
    if GetDistance(ts.target) < wrange and WREADY then			
231
				CastSpell(_W)
232
		end				
233
		if swing == 0 then
234
      if myHero.mana == 4 and not (WREADY or QREADY) and (GetDistance(ts.target) < erange and GetDistance(ts.target) > 225) and EREADY then			
235
				CastSpell(_E, ts.target)
236
			end
237
			if ts.target ~= nil and ValidTarget(ts.target, wrange) then
238
				myHero:Attack(ts.target)
239
			end
240
    elseif swing == 1 then
241
      if TMATREADY and GetDistance(ts.target) < 400 and not QREADY and os.clock() - lastBasicAttack > swingDelay then
242
        CastSpell(TMATSlot)
243
        swing = 0
244
      end
245-
      if TMATREADY and GetDistance(ts.target) < 400 and not (QREADY or WREADY) and os.clock() - lastBasicAttack > swingDelay then
245+
      if SotDREADY then
246
        if ts.target.type == "obj_AI_Hero" and GetDistance(ts.target) < 400 then
247
          CastSpell(SotDSlot)
248
        end
249-
      if SotDREADY and GetDistance(ts.target) < 400 then
249+
250-
        CastSpell(SotDSlot)
250+
251
         CastSpell(_Q)
252
         myHero:Attack(ts.target)
253
         swing = 0
254
	elseif myHero.mana == 4 and not (WREADY or QREADY) and os.clock() - lastBasicAttack > swingDelay then
255
				CastSpell(_E, ts.target)
256
				swing = 0
257
      end
258
		end							
259
	end
260
  
261
  if RCConfig.autoEFarm then
262
    if mousemoving and GetTickCount() > nextTick then
263
			player:MoveTo(mousePos.x, mousePos.z)
264
		end
265
		--local myQ = math.floor((myHero:GetSpellData(_Q).level-1)*20 + 40 + myHero.ap * .4)
266
		for k = 1, objManager.maxObjects do
267
			local minionObjectI = objManager:GetObject(k)      
268
			if minionObjectI ~= nil and string.find(minionObjectI.name,"Minion_") == 1 and minionObjectI.team ~= myHero.team and minionObjectI.dead == false then
269
        local myE = getDmg("E",minionObjectI,myHero)
270
				if myHero:GetDistance(minionObjectI) < 575 and minionObjectI.health <= myHero:CalcDamage(minionObjectI, myE) then
271
					CastSpell(_E, minionObjectI)
272-
				if myHero:GetDistance(minionObjectI) < 650 and minionObjectI.health <= myHero:CalcDamage(minionObjectI, myE) then
272+
273
			end
274
		end
275
	end
276
    
277
  
278
	if RCConfig.autoAAFarm then
279
		if mousemoving and GetTickCount() > nextTick then
280
			player:MoveTo(mousePos.x, mousePos.z)
281
		end
282
						
283
		local tick = GetTickCount()
284
		if lasthiton then
285
		unitScanTick = tick
286
			for i = 1, objManager.maxObjects, 1 do
287
				local object = objManager:getObject(i)
288
				if object ~= nil and object.team ~= player.team and object.type == "obj_AI_Minion" and string.find(object.charName,"Minion") then
289
					if not object.dead and GetDistance(object,player) <= (player.range + scanAdditionalRange) then
290
						if units[object.name] == nil then
291
							units[object.name] = { obj = object, markTick = 0 }
292
						end
293
					else
294
						units[object.name] = nil
295
					end
296
				end
297
			end
298
		end
299
		for i, unit in pairs(units) do
300
			if unit.obj == nil or unit.obj.dead or GetDistance(player,unit.obj) > (player.range + scanAdditionalRange) then
301
				units[i] = nil
302
			else
303
				if unit.obj.health <= (myHero:CalcDamage(unit.obj,myHero.totalDamage)) then -- 
304
					if lasthiton and GetTickCount() > nextTick then
305
						player:Attack(unit.obj) ---PrintChat("ATTACKING")
306
						nextTick = GetTickCount() + waitDelay	
307
						return
308
					end 
309
				end
310
			end     
311
		end
312
	end
313
	
314
end
315
316
function RENDmgCalculation(enemy)
317
  local hitdamage = getDmg("AD",enemy,myHero)
318
	local qdamage = getDmg("Q",enemy,myHero)
319
  local qdamage2 = getDmg("Q",enemy,myHero,2) --to Isolated Target
320
	local wdamage = getDmg("W",enemy,myHero)
321
	local edamage = getDmg("E",enemy,myHero)
322
	local combo5 = 0
323
  
324
  if GetDistance(enemy) < 350 then
325
      combo5 = hitdamage
326
    if QREADY and myHero.mana < 5 then
327
      combo5 = combo5 + qdamage + hitdamage
328
    elseif QREADY and myHero.mana == 5 then
329-
PrintChat(" >> Rengar the Rapist v1.2 loaded!")
329+
      combo5 = combo5 + qdamage2 + hitdamage
330
    end    
331
  end
332
	if WREADY and GetDistance(enemy) < wrange then
333
		combo5 = combo5 + wdamage
334
	end
335
	if EREADY and GetDistance(enemy) < erange then
336
		combo5 = combo5 + edamage
337
	end
338
	return combo5
339
end
340
341
function OnDraw()
342
	if RCConfig.drawcircles and not myHero.dead then		
343
		if WREADY then DrawCircle(myHero.x, myHero.y, myHero.z, wrange, 0x992D3D) end
344
		if EREADY then DrawCircle(myHero.x, myHero.y, myHero.z, erange, 0xFFFFFF) end
345
		if ts.target ~= nil then
346
			for j=0, 10 do DrawCircle(ts.target.x, ts.target.y, ts.target.z, 40 + j*1.5, 0x00FF00) end
347
		end
348
	end
349
end
350
function OnSendChat(msg)
351
	ts:OnSendChat(msg, "pri")
352
end
353
PrintChat(" >> Rengar the Rapist v1.3 loaded!")