View difference between Paste ID: AWm2JvmW and 716cQ15d
SHOW: | | - or go back to the newest paste.
1
--[[
2
	Xin The Rapist
3
		
4
		]]
5
if myHero.charName ~= "XinZhao" then return end
6
7
require "AllClass"
8
9
--[[		Code		]]
10
local mousemoving = true 
11
local movedelay = 0
12
local unitScanDelay = 0
13
local waitDelay = 300
14
local scanAdditionalRange = 500
15
local units = {}
16
local oldDelayTick = 0
17
local unitScanTick = 0
18
local holding = 0
19
local animPlayedTick = nil
20
local nextTick = 0
21
22
local lasthiton = true
23
24
25
26
local range = 650
27
local AArange = 325
28
29
local lastBasicAttack = 0
30
local swingDelay = 0.15
31
local swing = 0
32
33
-- Active
34
-- draw
35
36
local targetSelected = true	
37
-- ts
38
local ts
39
--
40
local ignite = nil
41
local BRKSlot, DFGSlot, HXGSlot, BWCSlot, SheenSlot, TrinitySlot, LichBaneSlot = nil, nil, nil, nil, nil, nil, nil
42
local QREADY, WREADY, EREADY, RREADY, BRKREADY, DFGREADY, HXGREADY, BWCREADY = false, false, false, false, false, false, false, false
43
44
function OnLoad()
45
	XINConfig= scriptConfig("Xin The Rapist", "xintherapist")
46
	XINConfig:addParam("scriptActive", "Combo", SCRIPT_PARAM_ONKEYDOWN, false, 88)
47
	XINConfig:addParam("scriptActive1", "Combo", SCRIPT_PARAM_ONKEYDOWN, false, 90)
48
	XINConfig:addParam("scriptActive2", "Combo", SCRIPT_PARAM_ONKEYDOWN, false, 67)	
49
	XINConfig:addParam("drawcircles", "Draw Circles", SCRIPT_PARAM_ONOFF, true)
50
	XINConfig:addParam("drawtext", "Draw Text", SCRIPT_PARAM_ONOFF, true)
51
	XINConfig:addParam("autoignite", "Auto Ignite", SCRIPT_PARAM_ONOFF, true)
52-
	XINConfig:addParam("autoAAFarm", "Auto Farm", SCRIPT_PARAM_ONKEYTOGGLE, false, 192)
52+
	XINConfig:addParam("autoAAFarm", "Auto Farm", SCRIPT_PARAM_ONKEYDOWN, false, 192)
53
	XINConfig:permaShow("autoAAFarm")
54
	ts = TargetSelector(TARGET_LOW_HP,range+150,DAMAGE_PHYSICAL)
55
	ts.name = XinZhao
56
	XINConfig:addTS(ts)
57
	if myHero:GetSpellData(SUMMONER_1).name:find("SummonerDot") then ignite = SUMMONER_1
58
	elseif myHero:GetSpellData(SUMMONER_2).name:find("SummonerDot") then ignite = SUMMONER_2 end	
59
end
60
61
	function OnProcessSpell(unit, spell)
62
		if unit.isMe and (spell.name:find("Attack") ~= nil) then
63
			swing = 1
64
			lastBasicAttack = os.clock()
65
		end
66
	end
67
68
function OnTick()
69
	if myHero.dead then
70
		return
71
	end
72
	
73
	if swing == 1 and os.clock() > lastBasicAttack + 0.5 then
74
		swing = 0
75
	end
76
	
77
	
78
	if ignite ~= nil and myHero:CanUseSpell(ignite) == READY then
79
		if IREADY then
80
			local ignitedmg = 0	
81
			for j = 1, heroManager.iCount, 1 do
82
				local enemyhero = heroManager:getHero(j)
83
				if ValidTarget(enemyhero,600) then
84
					ignitedmg = 50 + 20 * myHero.level
85
					if enemyhero.health <= (ignitedmg - 50) then
86
						CastSpell(ignite, enemyhero)
87
					end
88
				end
89
			end
90
		end
91
	end
92
	
93
	ts:update()
94
		
95
	BRKSlot, DFGSlot, HXGSlot, BWCSlot, SheenSlot, TrinitySlot, LichBaneSlot = GetInventorySlotItem(3153), GetInventorySlotItem(3128), GetInventorySlotItem(3146), GetInventorySlotItem(3144), GetInventorySlotItem(3057), GetInventorySlotItem(3078), GetInventorySlotItem(3100)
96
	QREADY = (myHero:CanUseSpell(_Q) == READY)
97
	WREADY = (myHero:CanUseSpell(_W) == READY)
98
	EREADY = (myHero:CanUseSpell(_E) == READY)
99
	RREADY = (myHero:CanUseSpell(_R) == READY)
100
	DFGREADY = (DFGSlot ~= nil and myHero:CanUseSpell(DFGSlot) == READY)
101
	HXGREADY = (HXGSlot ~= nil and myHero:CanUseSpell(HXGSlot) == READY)
102
	BWCREADY = (BWCSlot ~= nil and myHero:CanUseSpell(BWCSlot) == READY)
103
	BRKREADY = (BRKSlot ~= nil and myHero:CanUseSpell(BRKSlot) == READY)
104
	IREADY = (ignite ~= nil and myHero:CanUseSpell(ignite) == READY)
105
	
106
  
107
  
108
  
109
	if XINConfig.scriptActive and ts.target ~= nil then		
110
		if DFGREADY then CastSpell(DFGSlot, ts.target) end
111
		if HXGREADY then CastSpell(HXGSlot, ts.target) end
112
		if BWCREADY then CastSpell(BWCSlot, ts.target) end
113
		if BRKREADY then CastSpell(BRKSlot, ts.target) end
114
				
115
		if swing == 0  then
116
			if GetDistance(ts.target) < range then
117
        myHero:Attack(ts.target)
118
      end
119
			if EREADY and GetDistance(ts.target) < range then		
120
				CastSpell(_E, ts.target)
121
			end
122
	elseif swing == 1 then
123
      if WREADY and GetDistance(ts.target) < AArange and not EREADY then
124
        CastSpell(_W)
125
      end
126
			if QREADY and os.clock() - lastBasicAttack > swingDelay then		
127
				CastSpell(_Q) 
128
				swing = 0							
129
			end		
130
		end
131
	end
132
	
133
	
134
	if XINConfig.scriptActive1 and ts.target ~= nil then				
135
		if DFGREADY then CastSpell(DFGSlot, ts.target) end
136
		if HXGREADY then CastSpell(HXGSlot, ts.target) end
137
		if BWCREADY then CastSpell(BWCSlot, ts.target) end
138
		if BRKREADY then CastSpell(BRKSlot, ts.target) end				
139
		if swing == 0  then
140
			if GetDistance(ts.target) < range then
141
        myHero:Attack(ts.target)
142
      end
143
	elseif swing == 1 then
144
      if WREADY and GetDistance(ts.target) < AArange then
145
        CastSpell(_W)
146
      end
147
			if QREADY and os.clock() - lastBasicAttack > swingDelay then		
148
				CastSpell(_Q) 
149
				swing = 0							
150
			end		
151
		end
152
	end
153
	
154
	
155
	if XINConfig.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 swing == 0  then
161
			if GetDistance(ts.target) < range then
162
        myHero:Attack(ts.target)
163
      end
164
			if EREADY and GetDistance(ts.target) < range then		
165
				CastSpell(_E, ts.target)
166
			end
167
	elseif swing == 1 then
168
      if RREADY and os.clock() - lastBasicAttack > swingDelay then
169
        CastSpell(_R)
170
        swing = 0
171
  elseif WREADY and GetDistance(ts.target) < AArange and not RREADY then
172
        CastSpell(_W)
173
      end
174
			if QREADY and not RREADY and os.clock() - lastBasicAttack > swingDelay then		
175
				CastSpell(_Q) 
176
				swing = 0							
177
			end		
178
		end
179
	end	
180
181
	if XINConfig.autoAAFarm then
182
		if mousemoving and GetTickCount() > nextTick then
183
			player:MoveTo(mousePos.x, mousePos.z)
184
		end
185
						
186
		local tick = GetTickCount()
187
		if lasthiton then
188
		unitScanTick = tick
189
			for i = 1, objManager.maxObjects, 1 do
190
				local object = objManager:getObject(i)
191
				if object ~= nil and object.team ~= player.team and object.type == "obj_AI_Minion" and string.find(object.charName,"Minion") then
192
					if not object.dead and GetDistance(object,player) <= (player.range + scanAdditionalRange) then
193
						if units[object.name] == nil then
194
							units[object.name] = { obj = object, markTick = 0 }
195
						end
196
					else
197
						units[object.name] = nil
198
					end
199
				end
200
			end
201
		end
202
		for i, unit in pairs(units) do
203
			if unit.obj == nil or unit.obj.dead or GetDistance(player,unit.obj) > (player.range + scanAdditionalRange) then
204
				units[i] = nil
205
			else
206
				if unit.obj.health <= (myHero:CalcDamage(unit.obj,myHero.totalDamage)) then -- 
207
					if lasthiton and GetTickCount() > nextTick then
208
						player:Attack(unit.obj) ---PrintChat("ATTACKING")
209
						nextTick = GetTickCount() + waitDelay	
210
						return
211
					end 
212
				end
213
			end     
214
		end
215
	end	
216
	
217
end
218
function OnDraw()
219
	if XINConfig.drawcircles and not myHero.dead then
220
		if EREADY then DrawCircle(myHero.x, myHero.y, myHero.z, range, 0x992D3D)end
221
		if ts.target ~= nil then
222
			for j=0, 10 do DrawCircle(ts.target.x, ts.target.y, ts.target.z, 40 + j*1.5, 0x00FF00) end
223
		end
224
	end
225
	SC__OnDraw()
226
end
227
function OnWndMsg(msg,key)
228
	SC__OnWndMsg(msg,key)
229
end
230
function OnSendChat(msg)
231
	TargetSelector__OnSendChat(msg)
232
	ts:OnSendChat(msg, "pri")
233
end
234
PrintChat(" >> Xin The Rapist loaded!")