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