taultunleashed logoModified TinyToon PriestBot : General Discussion
newtopic  postreply
 [ 2 posts ] 
blue large dot

Modified TinyToon PriestBot : General Discussion

Posted: April 18th, 2005, 9:37 am
 
Tault_taelron

Total Posts: 2
Joined: April 18th, 2005, 9:32 am
Tault_taelron's Reps: 0
User avatar
-- CONSTANTS
_APPNAME = "TinyToon"
_VERSION = "1.2alpha"
_DATE = "20050221"
_FS_VERSION = 0.993

_SELF_DEFAULT = O
_SELF_PWS = 1

-- ; Time needed between Mind Blast

_MB_TIME = 8000

-- ; Time SW: Pain wll last

_SWP_TIME = 20000

-- ; Time PW: Shield cooldown lasts

_PWS_TIME = 31000

-- ; Distance to cast spell

_SPELL_DIS = 25

-- ; Time Inner Fire lasts

_IFIRE_TIME = 170000

-- ; Time PW: Fortitude cooldown lasts

_PWF_TIME = 1780000

_WAND_TIME = 1800

_USE_WAND = 0

_RENEW_TIME = 10000

_CRITTER_BUGGED = 4

-- ; HOTKEY SETUP, CHANGE TO FIT YOUR NEEDS (Gui coming soon(tm))

_KEY_ATTACK = "1"
_KEY_MB = "8"
_KEY_MF = ""
_KEY_SWP = "4"
_KEY_PWS = "5"
_KEY_RENEW = "6"
_KEY_INNER_FIRE = "7"
_KEY_PWF = "9"
_KEY_WAND = ""
_KEY_HEAL = "0"
_KEY_BIGHEAL = "0"
_KEY_DESPPRAYER = "0"

_KEY_EAT = ""
_KEY_BANDAGE = ""
_KEY_DRINK = "2"
THRESHOLD_HP = 0.2 -- eat if your hp is below threshold (hp < maxhp*threshold), otherwise just stand still to regen
THRESHOLD_BANDAID = 0.3 -- use a bandage if your hp is below this threshold
THRESHOLD_MANA = 0.4 -- drink if your mana below threshold (mana < maxmana*threshold), otherwise just stand still to regen


HOW_CLOSE = 18 -- used in the MoveToNpc function
PET_LOW = 100 -- at what HP should we try to mend the pet

swpain_done = 0
mflay_done = 0
mb_done = 0
renew_done = 0
special = 0

---------------------------------------------------------------------------------
-- ; Player structure
---------------------------------------------------------------------------------
-- modified by deeper 20.02.2005 v1.2
toon = {}
toon.__index = toon
function toon.init(hWnd)
local t = {}
setmetatable(t,toon)
PrintConsole("Initializing Toon! [")
i = 1
while 1 do
-- ; Calculations to defeat DMA by Outlaw
PrintConsole(".")
if i <= 25 then
baseptr="12E194"
else
baseptr="12C3B4"
end
t.hWnd = hWnd
t.ts_Battleshout = 0
t.ptr_unit_struct = HexSub(ReadHex(hWnd,baseptr),"8")
t.ptr_hitpoints = HexAdd(t.ptr_unit_struct,"1CE8")
t.ptr_mana = HexAdd(t.ptr_unit_struct,"1CEC")
t.ptr_maxmana = HexAdd(t.ptr_mana,"18")
t.ptr_maxhp = HexAdd(t.ptr_hitpoints,"18")
t.ptr_current_xp = HexAdd(t.ptr_unit_struct,"21A8")
t.ptr_max_xp = HexAdd(t.ptr_unit_struct,"21AC")
t.ptr_rage = HexAdd(t.ptr_mana,"4")
t.ptr_energy = HexAdd(t.ptr_rage,"8")
t.ptr_facing = HexAdd(t.ptr_unit_struct,"93C")
t.ptr_internal_z = HexSub(t.ptr_facing,"4")
t.ptr_internal_y = HexSub(t.ptr_internal_z,"4")
t.ptr_internal_x = HexSub(t.ptr_internal_y,"4")
if ReadDword(hWnd,t.ptr_hitpoints) > 30 and ReadDword(hWnd,t.ptr_hitpoints) < 10000 and ReadFloat(hWnd,t.ptr_facing) > -1 and ReadFloat(hWnd,t.ptr_facing) < 7 then
PrintConsoleLine("] ready")
t:refresh()
break
else
i = i + 1
if i > 50 then
PrintConsoleLine("] Failed.")
PrintConsoleLine("Make sure you have logged your toon in!")
return nil
end
end
Sleep(100)
end
return t
end
function toon:refresh()
self.hp = ReadDword(self.hWnd,self.ptr_hitpoints)
self.mana = ReadDword(self.hWnd,self.ptr_mana)
self.maxmana = ReadDword(self.hWnd,self.ptr_maxmana)
self.maxhp = ReadDword(self.hWnd,self.ptr_maxhp)
self.energy = ReadDword(self.hWnd,self.ptr_energy)
self.rage = ReadDword(self.hWnd,self.ptr_rage)
self.TargetID = ReadDword(self.hWnd,"9ABFB8")
self.hoverID = ReadDword(self.hWnd,self.ptr_hover_id)
self.playerID = ReadDword(self.hWnd,"9A1B98")
self.xp = ReadDword(self.hWnd,self.ptr_current_xp)
self.maxxp = ReadDword(self.hWnd,self.ptr_max_xp)
self.x = ReadFloat(self.hWnd,self.ptr_internal_x)
self.y = ReadFloat(self.hWnd,self.ptr_internal_y)
self.z = ReadFloat(self.hWnd,self.ptr_internal_z)
self.facing = ReadFloat(self.hWnd,self.ptr_facing)
-- self.inCombat = ReadByte(self.hWnd,"1AAAAF0")
self.inCombat = 0
self.ptrAttacker = nil
self.hp_percent = 100 / self.maxhp * self.hp
self.mana_percent = 100 / self.maxmana * self.mana

if SinceTimeStamp(swpain_timer_start) >= _SWP_TIME then
swpain_done = 0
end

if SinceTimeStamp(mb_timer_start) >= _MB_TIME then
mb_done = 0
end

if SinceTimeStamp(renew_timer_start) >= _RENEW_TIME then
renew_done = 0
end

mflay_done = 0

special = 0

end
function toon:GetAttackerPtr()
PrintConsole("looking up attacker ...")
ptr = nil
-- wait to make sure the server sends a Target
count = 100
while self.TargetID == 0 and count > 0 do
Sleep(1)
self.TargetID = ReadDword(hWnd,"9ABFB8")
count = count - 1
end
if self.TargetID ~= 0 then
ptr = NpcIDToPtr(hWnd,self.TargetID)
Npc = GetNpcData(hWnd,ptr)
if Npc.hp > 0 and Npc.hp <= 100 then
self.ptrAttacker = ptr
end
end
PrintConsoleLine(" done.")
return ptr
end
function toon:GetDistance(x,y)
return GetDistance(self.x,self.y,x,y)
end
function toon:setCorpseLoc()
self.corpsex = self.x
self.corpsey = self.y
end
function toon:GetCorpseLoc()
return self.corpsex,self.corpsey
end
function toon:GetLoc()
return self.x,self.y
end

---------------------------------------------------------------------------------
-- ; Npc handling
---------------------------------------------------------------------------------
function ResetNpcBuffer(hWnd) WriteDword(hWnd,"B28814",1) Sleep(100) end
function CreateNpcBuffer(hWnd,loops) WriteDword(hWnd,"B28818",loops) end
function GetNpcBufferPtr() return "B28820" end
function GetLocOfNextNpcPtr(buffer,size) return HexAdd(buffer,"4") end
function IsNpcBufferReady(hWnd) if ReadDword(hWnd,"B28818") == 0 then return 1 else return 0 end end
function GetNpcCount(hWnd) return ReadDword(hWnd,"B2881C") end
function WaitForNpcBuffer(hWnd) while IsNpcBufferReady(hWnd) ~= 1 do Sleep(10) end end
function NpcIDToPtr(hWnd,sid)
CreateNpcBuffer(hWnd, 1000)
WaitForNpcBuffer(hWnd)
iNpcs = GetNpcCount(hWnd)
if iNpcs > 0 then
p = GetNpcBufferPtr()
ptr = ReadHex(hWnd,p)
while iNpcs ~= 0 do
Npc = GetNpcData(hWnd,ptr)
if Npc.id == sid then
return ptr
end
p = GetLocOfNextNpcPtr(p)
ptr = ReadHex(hWnd,p)
iNpcs = iNpcs - 1
end
end
return nil
end

---------------------------------------------------------------------------------
-- ; Npc structure
---------------------------------------------------------------------------------
function GetNpcData(hWnd,ptr)

Npc = {
ptr = ptr,
id = ReadDword(hWnd,HexAdd( ptr , "4C0")),
hp = ReadDword(hWnd,HexAdd( ptr , "354")),
level = ReadDword(hWnd,HexAdd( ptr , "548")),
faction = ReadDword(hWnd,HexAdd( ptr , "54C")),
x = ReadFloat(hWnd, HexAdd( ptr , "10")),
y = ReadFloat(hWnd, HexAdd( ptr , "14")),
z = ReadFloat(hWnd, HexAdd( ptr , "18")),
facing = ReadFloat(hWnd, ptr ,"1C"),
}
return Npc
end

---------------------------------------------------------------------------------
-- ; Hook
-- ; 12.2.2005 Redone by Outlaw
-- ; 23.2.2005 Redone by Outlaw
---------------------------------------------------------------------------------

function Hook(hWnd)
WriteOpCodes(hWnd,"B28814","00,00,00,00,00,00,00,00,00,00,00")
WriteOpCodes(hWnd,"B2881F","00,00,00,00,00,00,00,00,00,00,00")
WriteOpCodes(hWnd,"B2882A","00,00,00,00,00,00,00,00,00,00,00")
WriteOpCodes(hWnd,"B28835","00,00,00,00,00,00,00,00,00,00,00")
WriteOpCodes(hWnd,"B28840","00,00,00,00,00,00,00,00,00,00,00")
WriteOpCodes(hWnd,"B2884B","00,00,00,00,00,00,00,00,00,00,00")
WriteOpCodes(hWnd,"B28856","00,00,00,00,00,00,00,00,00,00,00")
WriteOpCodes(hWnd,"B28861","00,00,00,00,00,00,00,00,00,00,00")
WriteOpCodes(hWnd,"B2886C","00,00,00,00,00,00,00,00,00,00,00")
WriteOpCodes(hWnd,"B28877","00,00,00,00,00,00,00,00,00,00,00")
WriteOpCodes(hWnd,"B28882","00,00,00,00,00,00,00,00,00,00,00")
WriteOpCodes(hWnd,"B2888D","00,00,00,00,00,00,00,00,00,00,00")
WriteOpCodes(hWnd,"B28898","00,00,00,00,00,00,00,00,00,00,00")
WriteOpCodes(hWnd,"B288A3","00,00,00,00,00,00,00,00,00,00,00")
WriteOpCodes(hWnd,"B288AE","00,00,00,00,00,00,00,00,00,00,00")
WriteOpCodes(hWnd,"B288B9","00,00,00,00,00,00,00,00,00,00,00")
WriteOpCodes(hWnd,"B288C4","00,00,00,00,00,00,00,00,00,00,00")
WriteOpCodes(hWnd,"B288CF","00,00,00,00,00,00,00,00,00,00,00")
WriteOpCodes(hWnd,"B288DA","00,00,00,00,00,00,00,00,00,00,00")
WriteOpCodes(hWnd,"B288E5","00,00,00,00,00,00,00,00,00,00,00")
WriteOpCodes(hWnd,"B288F0","00,00,00,00,00,00,00,00,00,00,00")
WriteOpCodes(hWnd,"B288FB","00,00,00,00,00,00,00,00,00,00,00")
WriteOpCodes(hWnd,"B28906","00,00,00,00,00,00,00,00,00,00,00")
WriteOpCodes(hWnd,"B28911","00,00,00,00,00,00,00,00,00,00,00")
WriteOpCodes(hWnd,"B2891C","00,00,00,00,00,00,00,00,00,00,00")
WriteOpCodes(hWnd,"B28927","00,00,00,00,00,00,00,00,00,00,00")
WriteOpCodes(hWnd,"B28932","00,00,00,00,00,00,00,00,00,00,00")
WriteOpCodes(hWnd,"B2893D","00,00,00,00,00,00,00,00,00,00,00")
WriteOpCodes(hWnd,"B28948","00,00,00,00,00,00,00,00,00,00,00")
WriteOpCodes(hWnd,"B28953","00,00,00,00,00,00,00,00,00,00,00")
WriteOpCodes(hWnd,"B2895E","00,00,00,00,00,00,00,00,00,00,00")
WriteOpCodes(hWnd,"B28969","00,00,00,00,00,00,00,00,00,00,00")
WriteOpCodes(hWnd,"B28974","00,00,00,00,00,00,00,00,00,00,00")
WriteOpCodes(hWnd,"B2897F","00,00,00,00,00,00,00,00,00,00,00")
WriteOpCodes(hWnd,"B2898A","00,00,00,00,00,00,00,00,00,00,00")
WriteOpCodes(hWnd,"B28995","00,00,00,00,00,00,00,00,00,00,00")
WriteOpCodes(hWnd,"B289A0","00,00,00,00,00,00,00,00,00,00,00")
WriteOpCodes(hWnd,"B289AB","00,00,00,00,00")
WriteOpCodes(hWnd,"7E567F","90,90,90,90,90,90,90,90,51,50,83")
WriteOpCodes(hWnd,"7E568A","3D,14,88,B2,00,01,74,52,83,3D,18")
WriteOpCodes(hWnd,"7E5695","88,B2,00,00,74,68,FF,0D,18,88,B2")
WriteOpCodes(hWnd,"7E56A0","00,81,C1,54,03,00,00,83,39,64,7F")
WriteOpCodes(hWnd,"7E56AB","57,83,39,01,7C,52,81,C1,F4,01,00")
WriteOpCodes(hWnd,"7E56B6","00,83,39,01,7C,47,83,39,50,7F,42")
WriteOpCodes(hWnd,"7E56C1","81,E9,48,05,00,00,B8,20,88,B2,00")
WriteOpCodes(hWnd,"7E56CC","83,38,00,74,09,39,08,74,2E,83,C0")
WriteOpCodes(hWnd,"7E56D7","04,EB,F2,89,08,FF,05,1C,88,B2,00")
WriteOpCodes(hWnd,"7E56E2","EB,1F,B8,1C,88,B2,00,83,38,00,C7")
WriteOpCodes(hWnd,"7E56ED","05,14,88,B2,00,00,00,00,00,74,0B")
WriteOpCodes(hWnd,"7E56F8","C7,00,00,00,00,00,83,C0,04,EB,E6")
WriteOpCodes(hWnd,"7E5703","58,59,83,EC,40,8B,41,38,E9,B9,E7")
WriteOpCodes(hWnd,"7E570E","C9,FF")
WriteOpCodes(hWnd,"483EC3","E9,BF,17,36,00,90")
end
---------------------------------------------------------------------------------
-- ; Helper functions
---------------------------------------------------------------------------------
function DebugMessage(message,line,debug)
if debug == 1 then
PrintConsole(message)
if line == 1 then PrintConsoleLine("") end
end
end

function WaitForTargetID(hWnd,id,time)
PrintConsole("[+ Waiting for Target ID: "..IntToStr(id).." ...")
tn:refresh()
ohp = tn.hp
while tn.TargetID ~= id do
if time == 1 then PrintConsoleLine(" time out]") return 0 end
Sleep(10)
time = time - 1
tn:refresh()
if tn.hp < ohp then
PrintConsoleLine(" skipping]")
return 0
end
ohp = tn.hp
end
PrintConsoleLine(" ready]")
return 1
end

function WaitForTargetIsNotNull(hWnd,time)
PrintConsole("[+ Waiting until there is a Target ...")
tn:refresh()
ohp = tn.hp
while tn.TargetID == 0 do
if time == 1 then PrintConsoleLine(" time out]") return 0 end
Sleep(10)
time = time - 1
tn:refresh()
if tn.hp < ohp then
PrintConsoleLine(" skipping]")
return 0
end
ohp = tn.hp
end
PrintConsoleLine(" ready]")
return 1
end

function GetNpc(hWnd,cat,corpse,wpx,wpy,minl,maxl,rad,debug)
-- optimized by deeper v1.2
-- looksup a valid Npc, returns a Npc
-- cat: 0 return lowest range, ... (more to come)
-- corpse: 1 return corpses found, 0 dont
data = {}
i = 0
PrintConsoleLine("SCANNING FOR MOBS!")

CreateNpcBuffer(hWnd,2000)
WaitForNpcBuffer(hWnd)
iNpcs = GetNpcCount(hWnd)

if iNpcs > 0 then

p = GetNpcBufferPtr()
ptr = ReadHex(hWnd,p)
tn:refresh()

while iNpcs ~= 0 do

valid = 1

Npc = GetNpcData(hWnd,ptr)
DebugMessage(" scanning ... Npc HP% : "..IntToStr(Npc.hp).." range: "..IntToStr(GetDistance(tn.x,tn.y,Npc.x,Npc.y)).." level: "..IntToStr(Npc.level).." ID: "..IntToStr(Npc.id),1,debug)
-- is the Npc blacklisted?
n = blacklist_count
while n > 0 and valid == 1 do
if Blacklist[n] == Npc.id then
DebugMessage(" ... is blacklisted!",1,debug)
valid = 0
end
n = n - 1
end

-- is the Npc in the hunting Radius of the current Waypoint?
if GetDistance(wpx,wpy,Npc.x,Npc.y) > rad and valid == 1 then
DebugMessage(" ... is out of hunting radius!",1,debug)
valid = 0
end

-- is the Npc dead?
if Npc.hp == 0 and valid == 1 then
if corpse == 1 then
DebugMessage(" ... corpse found! ok.",1,debug)
return ptr
else
DebugMessage(" ... is dead!",1,debug)
valid = 0
end
end

-- does the Npc match the level requirements?
if (Npc.level < minl or Npc.level > maxl) and valid == 1 then
DebugMessage(" ... does not match level requirement!",1,debug)
valid = 0
end

-- is the Npc at full health?
if Npc.hp ~= 100 and valid == 1 then
DebugMessage(" ... is already fighting!",1,debug)
valid = 0
end

if Npc.id <= 0 or Npc.id >= 297000000 then
DebugMessage(" ... id not valid!",1,debug)
valid = 0
end

-- if everything was ok, add the Npc to our list for category checks ...
if valid == 1 then
DebugMessage(" ... adding to valid list!",1,debug)
data[i] = ptr
i = i + 1
end

p = GetLocOfNextNpcPtr(p)
ptr = ReadHex(hWnd,p)
iNpcs = iNpcs - 1
end

if i > 0 then
rNpc = GetNpcData(hWnd,data[i])
-- category 0 (closest range)
if cat == 0 then
PrintConsole(" Looking up nearest Npc ...")
while i > 0 do
i = i - 1
Npc = GetNpcData(hWnd,data[i])
if tn:GetDistance(Npc.x,Npc.y) < tn:GetDistance(rNpc.x,rNpc.y) then
rNpc = Npc
end
end
end
if cat == 1 then
-- other categories
end

ResetNpcBuffer(hWnd)
PrintConsoleLine(" found ID: "..IntToStr(rNpc.id))
return rNpc
else
ResetNpcBuffer(hWnd)
return nil
end
else
ResetNpcBuffer(hWnd)
return nil
end

ResetNpcBuffer(hWnd)
return nil
end

function XYtoFace(hWnd,x,y)

tn:refresh()

RealX = tn.x - x
RealY = tn.y - y
if RealX < 0 then RealX = RealX * -1 end
if RealY < 0 then RealY = RealY * -1 end

if x > tn.x and y > tn.y then
g = math.deg ( math.atan( RealY / RealX ) )
end
if x > tn.x and y < tn.y then
g = ( ( math.deg ( math.atan( RealY / RealX ) ) * - 1 ) + 90 ) + 270
end
if x < tn.x and y < tn.y then
g = math.deg ( math.atan( RealY / RealX ) ) + 180
end
if x < tn.x and y > tn.y then
g = ( ( math.deg ( math.atan( RealY / ( RealX ) ) ) * - 1 ) + 90 ) + 90
end

if g == nil then return 0 end

return ( ( 2 * math.pi ) / 360 ) * g
end

function SpinPlayer(hWnd,Target)
tn:refresh()
-- ; 9.2.2005 - New improved spinning code by Outlaw
-- ; 13.2.2005 - Improved by n1ce

-- L
if tn.facing > Target then
L = ( ( 2 * math.pi ) - tn.facing ) + Target
else
L = Target - tn.facing
end

-- R
if tn.facing > Target then
R = tn.facing - Target
else
R = tn.facing + ( ( 2 * math.pi ) - Target )
end
if R < L then
if R > 2 then
PressKey("RIGHT",200)
else
PressKey("RIGHT",100)
end
else
if L > 2 then
PressKey("LEFT",200)
else
PressKey("LEFT",100)
end
end
end

function FaceXY(hWnd,x,y,acc)
while 1 do
Target = XYtoFace(hWnd,x,y)
-- PrintConsoleLine("facing: "..tn.facing.." Target: "..Target)
if ( tn.facing - acc/10) < Target and ( tn.facing + acc/10) > Target then
return 1
else
SpinPlayer(hWnd,Target)
end
end
end

function GetDistance(x1,y1,x2,y2)
-- returns distance of x1,y1 to x2,y2
return (math.sqrt((x1 - x2)^2 + (y1 - y2)^2))
end

function MoveToXY(hWnd,x,y,close)
-- ; Optimized movement code
-- ; improved by deeper 2005.02.20

if sitting == 1 then
sitting = 0
SendKeys(hWnd,"x")
end

PrintConsoleLine("MOVING TO LOCATION x: "..FloatToStr(x).." y: "..FloatToStr(y).." dist: "..IntToStr(GetDistance(x,y,tn.x,tn.y)))
t = GetTimeStamp()
FaceXY(hWnd,x,y,3)
s = GetTimeStamp()
tn:refresh()
oldx = tn.x
oldy = tn.y
oldhp = tn.hp

HoldKey("UP")
while 1 do

Sleep(100)
tn:refresh()

if oldhp > tn.hp then
PrintConsoleLine(" AMBUSH!")
return 0
end
oldhp = tn.hp

if tn:GetDistance(x,y) <= close then
PrintConsoleLine(" arrived at destinaton.")
ReleaseKey("UP")
return 1
else
if SinceTimeStamp(s) > Randomize(1354,2142) then
PrintConsoleLine(" distance to go: "..IntToStr(GetDistance(tn.x,tn.y,x,y)-close))
--evade code
if (GetDistance(tn.x,tn.y,oldx,oldy) < 3) then
ReleaseKey("UP")
PrintConsoleLine(" Toon stuck! Trying to evade.")
FaceXY(hWnd,x*-1,y*-1,3)
PressKey("UP",1000)
FaceXY(hWnd,x,y*-1,3)
HoldKey("UP")
end
FaceXY(hWnd,x,y,3)
s = GetTimeStamp()
oldx = tn.x
oldy = tn.y
end
end

if SinceTimeStamp(t) > 25000 then
PrintConsoleLine(" Can not reach location. Giving up.")
ReleaseKey("UP")
return 0
end
end
end

function MoveToNpc(hWnd,ptr,unstoppable,close,debug)
-- ; Optimized movement code
-- ; improved by deeper 2005.02.20

if sitting == 1 then
sitting = 0
SendKeys(hWnd,"x")
end
Npc = GetNpcData(hWnd,ptr)
tn:refresh()
oldx = tn.x
oldy = tn.y
oldhp = tn.hp
DebugMessage("MOVE TO Npc id: "..IntToStr(Npc.id).." dist: "..IntToStr(GetDistance(tn.x,tn.y,Npc.x,Npc.y)),1,debug)
FaceXY(hWnd,Npc.x,Npc.y,3)
if GetDistance(tn.x,tn.y,Npc.x,Npc.y) < close then return 1 end
t = GetTimeStamp()
s = GetTimeStamp()
HoldKey("UP")

while 1 do
Sleep(100)
Npc = GetNpcData(hWnd,ptr)
tn:refresh()

if oldhp > tn.hp and unstoppable == 0 then
PrintConsoleLine(" AMBUSH!")
return 0
end
oldhp = tn.hp

if GetDistance(tn.x,tn.y,Npc.x,Npc.y) < close then
DebugMessage(" arrived at Npc.",1,debug)
ReleaseKey("UP")
return 1
else
if SinceTimeStamp(s) > Randomize(854,1228) then
DebugMessage(" distance to go: "..IntToStr(GetDistance(tn.x,tn.y,Npc.x,Npc.y)-close),1,debug)
--evade code
if (GetDistance(tn.x,tn.y,oldx,oldy) < 3) then
ReleaseKey("UP")
DebugMessage(" Toon stuck! Trying to evade.",1,debug)
FaceXY(hWnd,Npc.x*-1,Npc.y*-1,3)
PressKey("UP",1000)
FaceXY(hWnd,Npc.x,Npc.y*-1,3)
HoldKey("UP")
end
if (Npc.hp < 100 and Npc.hp ~= 0) and unstoppable == 0 then
ReleaseKey("UP")
DebugMessage(" Npc is under attack, stopping!",1,debug)
return 0
end
if unstoppable == 1 then ReleaseKey("UP") end
FaceXY(hWnd,Npc.x,Npc.y,3)
if unstoppable == 1 then HoldKey("UP") end
s = GetTimeStamp()
oldx = tn.x
oldy = tn.y
end
end

if SinceTimeStamp(t) > 25000 then
DebugMessage(" Can not reach Npc. Giving up.",1,debug)
ReleaseKey("UP")
return 0
end
end
ReleaseKey("UP")
return 0
end

---------------------------------------------------------------------------------
-- ; The control window
---------------------------------------------------------------------------------
function window_open()
gui = OpenGui(_APPNAME,300,350)
Sleep(100)
-- ; Loot settings
AddFrame(gui,"Loot settings",0,0,300,60)
lb_loot = AddLabel(gui,"Size of the looting area:",7,15,290,15)
AddLabel(gui,"<< small",7,33,40,20)
sl_acu = AddSlider(gui,46,30,165,25,20,80)
AddLabel(gui,"big >>",210,33,50,20)
SetSliderStatus(sl_acu,60)
cb_skin = AddCheckBox(gui,"skin",245,33,49,15)

-- ; Area hunting settings
AddFrame(gui,"Area hunting settings",0,62,300,150)

lb_area = AddLabel(gui,"F6 add Corpserun WP. F7 add Hunting WP.",7,78,250,15)

list_cr_x = AddList(gui,7,94,143,50)
list_cr_y = AddList(gui,150,94,143,50)

list_x = AddList(gui,7,150,143,50)
list_y = AddList(gui,150,150,143,50)

lb_radius = AddLabel(gui,"Hunting radius :",7,223,80,15)
eb_radius = AddEditBox(gui,"64",84,220,30,20)

lb_level = AddLabel(gui,"Level range :",7,177+70,120,15)
eb_level_min = AddEditBox(gui,"1",84,174+70,30,20)
lb_leavel2 = AddLabel(gui," - ",125,177+70,20,15)
eb_level_max = AddEditBox(gui,"60",147,174+70,30,20)

-- ; Emergency settings
AddFrame(gui,"In case of an emergency settings",0,201+70,300,41)
lb_eg_key = AddLabel(gui,"Press key",7,219+70,60,15)
eb_eg_key = AddEditBox(gui,"9",60,217+70,15,20)
lb_eg_hp = AddLabel(gui,"if hp are under",81,219+70,80,15)
eb_eg_hp = AddEditBox(gui,"40",158,217+70,26,20)
lb_percent = AddLabel(gui,"percent.",190,219+70,80,15)

-- ; Buttons
save = AddButton(gui,"Save settings",2,246+70,75,25)
load = AddButton(gui,"Load settings",77,246+70,75,25)
lb_info = AddLabel(gui," Press F8 to start the bot.",152,251+70,150,15)
SetItemColor(lb_info,RGB(0,255,0),0)

ExitOnGuiClose(gui)
end

---------------------------------------------------------------------------------
-- ; WoW functions
---------------------------------------------------------------------------------
function ClearTarget()
SendKeys(hWnd,"{ENTER}")
Sleep(10)
SendKeys(hWnd,"/script ClearTarget();")
Sleep(10)
SendKeys(hWnd,"{ENTER}")
end


---------------------------------------------------------------------------------
-- ; The loot function.
-- ; 16.2.2005 Improved by nice
---------------------------------------------------------------------------------

function loot(hWnd,id)
-- ; improved by deeper 2005.02.20
PrintConsoleLine("LOOTING!")
PrintConsoleLine(" Searching for corpse ID: "..IntToStr(id))
lx1,ly1,lx2,ly2 = GetWindowRect(hWnd)
slider = 100 - GetSliderStatus(sl_acu)
lx1 = lx1 + ( ( lx2 - lx1 ) /100 * slider )
ly1 = ly1 + ( ( ly2 - ly1 ) /100 * slider )
lx2 = lx2 - ( ( lx2 - lx1 ) /100 * slider )
ly2 = ly2 - ( ( ly2 - ly1 ) /100 * slider )
lootok = 0
tn:refresh()
ohp = tn.hp
sy = ly1
while lx1 < lx2 do
while ly1 < ly2 do
ly1 = ly1 + 25
LeftClick(lx1,ly1,1)
tn:refresh()
if tn.hp < ohp then
PrintConsoleLine(" AMBUSH!")
return 0
end
ohp = tn.hp
if tn.TargetID == id then
HoldKey("SHIFT")
RightClick(lx1,ly1,1)
if WaitForTargetID(hWnd,id,300) == 0 then
ReleaseKey("SHIFT")
PrintConsoleLine(" Looting timeout, skipping.")
return 0
end
tn:refresh()
if tn.hp < ohp then
ReleaseKey("SHIFT")
PrintConsoleLine(" AMBUSH!")
return 0
end
ohp = tn.hp
PrintConsoleLine(" Npc corpse found ... looting.")
if WaitForTargetID(hWnd,0,300) == 0 then
ReleaseKey("SHIFT")
PrintConsoleLine(" Can't find corpse, skipping.")
return 0
end
tn:refresh()
if tn.hp < ohp then
ReleaseKey("SHIFT")
PrintConsoleLine(" AMBUSH!")
return 0
end
if GetCheckBoxState(cb_skin) == 1 then
PrintConsoleLine(" Npc corpse found ... skinning.")
Sleep(1000)
RightClick(lx1,ly1,1)
if WaitForTargetID(hWnd,0,300) == 0 then
ReleaseKey("SHIFT")
PrintConsoleLine(" Skinning timeout, skipping.")
ClearTarget()
return 0
end
end
PrintConsoleLine(" Npc corpse plundered.")
ReleaseKey("SHIFT")
PrintConsoleLine(" done.")
ClearTarget()
return 1
end
end
lx1 = lx1 + 25
ly1 = sy
end
tn:refresh()
if tn.TargetID ~= 0 then ClearTarget() end
PrintConsoleLine(" failed.")
return 0
end
---------------------------------------------------------------------------------
-- ; The resting is handled here.
-- ; Edit to fit your needs
---------------------------------------------------------------------------------
function rest(rate)
-- ; improved by deeper 2005.02.20
tn:refresh(_SELF_DEFAULT)
sitting = 0
eating = 0
drinking = 0
oldhp = tn.hp

PrintConsoleLine("RESTING!")

-- player died
if tn.hp == 0 then
PrintConsoleLine(" Player is dead!")
return 0
end


if tn.hp < tn.maxhp*rate or tn.mana < tn.maxmana*rate or SinceTimeStamp(pwshield_timer_start) < _PWS_TIME then
PrintConsoleLine(" Resting to recover "..IntToStr(tn.maxhp*rate - tn.hp).." hit point(s), and "..IntToStr(tn.maxmana*rate - tn.mana).." mana point(s), and "..IntToStr(SinceTimeStamp(pwshield_timer_start)))
else
PrintConsoleLine(" Don't need to rest.")
return 0
end

while tn.hp < tn.maxhp*rate or tn.mana < tn.maxmana*rate or SinceTimeStamp(pwshield_timer_start) < _PWS_TIME do
tn:refresh(_SELF_DEFAULT)
PrintConsoleLine(" ***** Resting PWS : "..IntToStr(_PWS_TIME).." Timer state: "..IntToStr(SinceTimeStamp(pwshield_timer_start)))
-- ; Enter some resting code here
-- ; Make sure you set sitting to 1 if you eat/drink something.

-- ; Example (A is your eat/drink key):

-- ; if sitting == 0 then
-- ; SendKeys(hWnd,"A")
-- ; sitting = 1
-- ; end


-- if (tn.hp < tn.maxhp*THRESHOLD_BANDAID and eating == 0) then
-- SENDKEY(_KEY_BANDAID)
-- eating = 1
-- sitting = 1
-- elseif (tn.hp < tn.maxhp*THRESHOLD_HP and eating == 0) then
-- SENDKEY(_KEY_EAT)
-- eating = 1
-- sitting = 1
-- end
-- if (tn.mana < tn.maxmana*THRESHOLD_MANA and drinking == 0) then
-- SENDKEY(_KEY_DRINK)
-- eating = 1
-- sitting = 1
-- end

if tn.hp == tn.maxhp then break end
if tn.hp < oldhp then
PrintConsoleLine(" AMBUSH!")
return 0
end
oldhp = tn.hp
Sleep(1)
end

if SinceTimeStamp(pwf_timer) > _PWF_TIME then
SendKeys(hWnd,_KEY_PWF)
pwf_timer = GetTimeStamp()
PrintConsoleLine(" Casting PWF...")
Sleep(1000)
end

if SinceTimeStamp(ifire_timer) > _IFIRE_TIME then
SendKeys(hWnd,_KEY_INNER_FIRE)
ifire_timer = GetTimeStamp()
PrintConsoleLine(" Casting Inner Fire...")
Sleep(1000)
end

if sitting == 1 then
sitting = 0
SendKeys(hWnd,"x")
end
PrintConsoleLine(" done.")
return 1
end
---------------------------------------------------------------------------------
-- ; The actual fight happens here
-- ; Edit to fit your needs
---------------------------------------------------------------------------------
function fight(hWnd,ptr)

ReleaseKey("UP")
ReleaseKey("SHIFT")
PrintConsoleLine("FIGHT!")
tick = 0
count = 0
Npc = GetNpcData(hWnd,ptr)
tn:refresh()
oldhp = 0
oldNpchp = 0
oldNpcid = Npc.id

if tn.TargetID ~= 0 then
PrintConsoleLine(" clearing Target ...")
ClearTarget()
end
if WaitForTargetID(hWnd,0,100) == 0 then return 0 end

if tn.TargetID == 0 then
i = 0
while i < 3 and tn.TargetID == 0 do
PrintConsoleLine(" waiting for Target ...")
if i > 0 then
if GetDistance(tn.x,tn.y,Npc.x,Npc.y) < 30 then
MoveToNpc(hWnd,ptr,1,4,0)
else
PrintConsoleLine(" Npc no longer in range.")
return 0
end
end
SendKeys(hWnd,_KEY_ATTACK)
if WaitForTargetIsNotNull(hWnd,100) == 1 then break end
tn:refresh()
Npc = GetNpcData(hWnd,ptr)
i = i + 1
end
if tn.TargetID == 0 then
Npc = GetNpcData(hWnd,ptr)
Blacklist[blacklist_count] = Npc.id
PrintConsoleLine(" blacklisting Npc id: "..Blacklist[blacklist_count])
blacklist_count = blacklist_count + 1
tn:refresh()
if tn.TargetID ~= 0 then ClearTarget() end
return 0
end
else
return 0
end

tn:refresh()
if (tn.TargetID) ~= Npc.id then
ptr = tn:GetAttackerPtr()
end

PrintConsoleLine(" fighting ...")
PrintConsoleLine(" Npc id: "..Npc.id..", level: "..Npc.level)

while 1 do

tn:refresh()
Npc = GetNpcData(hWnd,ptr)

if tn.hp == 0 then
PrintConsoleLine(" your toon died while fighting!")
break
end

if tn:GetDistance(Npc.x,Npc.y) < 2 then PressKey("DOWN",200) end

special = 0

if oldhp ~= tn.hp or oldNpchp ~= Npc.hp and oldNpcid == Npc.id then
PrintConsoleLine(" PLAYER HP%: "..IntToStr(tn.hp_percent).." Target HP%: "..IntToStr(Npc.hp))
end

-- PW Shield

PrintConsoleLine(" ***** So PWS ehh: "..IntToStr(_PWS_TIME).." Timer state: "..IntToStr(SinceTimeStamp(pwshield_timer_start)))
if SinceTimeStamp(pwshield_timer_start) >= _PWS_TIME then
PrintConsoleLine(" performing PWS!")
SendKeys(hWnd, _KEY_PWS)
pwshield_timer_start = GetTimeStamp()
Sleep(1500)
end

-- SW Pain

if swpain_done == 0 then
SendKeys(hWnd, _KEY_SWP)
swpain_done = 1
special = 1
swpain_timer_start = GetTimeStamp()
Sleep(1500)
end

-- Mind Flay

if mflay_done == 0 and special == 0 then
SendKeys(hWnd, _KEY_MF)
mflay_done = 1
special = 0
mflay_timer_start = GetTimeStamp()
Sleep(1500)
end

-- Mind Blast

if mb_done == 0 and special == 0 and SinceTimeStamp(mb_timer_start) >= _MB_TIME then
PrintConsoleLine(" performing MB!")
SendKeys(hWnd,_KEY_MB)
mb_timer_start = GetTimeStamp()
special = 1
mb_done = 1
Sleep(1600)
end

-- Cast a Renew

PrintConsoleLine(" PLAYER HP: "..IntToStr(tn.hp).." Divided by 2: "..IntToStr(tn.maxhp / 1.67))
if renew_done == 0 and (tn.hp <= (tn.maxhp / 1.67)) then
PrintConsoleLine(" performing Renew!")
SendKeys(hWnd, _KEY_RENEW)
renew_done = 1
special = 1
renew_timer_start = GetTimeStamp()
end

-- Cast a Life Saver

if (tn.hp <= (tn.maxhp / 2.85)) then
PrintConsoleLine(" I'm in the Poo!!")
if tn.mana >= 170 then
PrintConsoleLine(" performing Heal!")
SendKeys(hWnd, _KEY_BIGHEAL)
else
SendKeys(hWnd, _KEY_DESPPRAYER)
end
tn:refresh(_SELF_DEFAULT)
end

-- Heal

if tn.mana >= 50 and tn.hp <= (tn.maxhp / 2) then
PrintConsoleLine(" performing Heal!")
SendKeys(hWnd,_KEY_HEAL)
tn:refresh(_SELF_DEFAULT)
special = 1
end

-- Use the Wand

if _USE_WAND ==1 and special == 0 and SinceTimeStamp(wand_timer_start) >= _WAND_TIME then
SendKeys(hWnd,_KEY_WAND)
wand_timer_start = GetTimeStamp()
end

-- Is the NPC bugged, as in it runs away but still hits

if special == 0 and critter_bugged_count == 0 then
critter_bugged_hp = Npc.hp
end
if special == 0 and critter_bugged_count == _CRITTER_BUGGED then
if Npc.hp == critter_bugged_hp then
PrintConsoleLine(" The critter is bugged, moving forward!")
PressKey("UP",1000)
critter_bugged_count = 0
end
end

if Npc.hp == 0 or Npc.hp > 100 then break end
if tn.hp_percent <= em_hp then SendKeys(hWnd,em_key) end

if MoveToNpc(hWnd,ptr,1,4,0) == 0 then return 0 end
FaceXY(hWnd,Npc.x,Npc.y,3)

if Npc.hp == 100 then
if count > 10 and tn.hp == tn.maxhp then
PrintConsoleLine(" Can not damage this Target. I try to Get a new one!")
ClearTarget()
return 0
end
end
oldhp = tn.hp
oldNpchp = Npc.hp
count = count + 1
Sleep(Randomize(550,950))
end

PrintConsoleLine(" done.")

if tn.hp == 0 then return 0 end
mobs_killed = mobs_killed + 1

SetWindowTitle(hWnd,_APPNAME.." | NpcS KILLED:["..IntToStr(mobs_killed).."]")

tn:refresh()
if tn.TargetID ~= 0 then ClearTarget() end
return oldNpcid
end

---------------------------------------------------------------------------------
-- ; MAIN LOOP
---------------------------------------------------------------------------------

if math.floor(GetVersion()*1000,3)/1000 >= _FS_VERSION then
OpenConsole()
SetConsoleTitle(_APPNAME.." Console")
Sleep(100)
Blacklist = {}
Blacklist[1] = "0"
blacklist_count = 1
earned_exp = 0
exp_last = 0
mobs_killed = 0
runbot = 0
PrintConsoleLine(_APPNAME.." STARTING UP! VERSION ".._VERSION.." / ".._DATE.." using ForceShock "..math.floor(GetVersion()*1000,3)/1000)
wow_ready = 0
while wow_ready == 0 do
PrintConsole("Waiting for World of Warcraft! [")
i = 1
while 1 do
PrintConsole(".")
hWnd = FindWindowByExe("WoW.exe")
if hWnd > 0 then
PrintConsoleLine("] ready")
wow_ready = 1
break
end
i = i + 1
if i > 10 then
PrintConsoleLine("] failed.")
PrintConsoleLine("Make sure World of Warcraft is running!")
break
end
Sleep(100)
end
if wow_ready == 0 then
Sleep(5000)
PrintConsoleLine("Retrying ...")
end
end
tn = toon.init(hWnd)
while tn == nil do
Sleep(5000)
PrintConsoleLine("Retrying ...")
tn = toon.init(hWnd)
end

PrintConsole("Installing hook ...")
Hook(hWnd)
PrintConsoleLine(" ready")
PrintConsole("Opening control panel ...")
window_open()
PrintConsoleLine(" ready")
PrintConsoleLine(_APPNAME.." ".._VERSION.." ready.")

while 1 do -- start main loop

if IsButtonPressed(save) == 1 then
EraseRegistryDir("HKEY_CURRENT_USER","Software\\Blizzbot")
hWndX = FindWindowByTitle(_APPNAME.." Console")
x1,y1,x2,y2 = GetWindowRect(hWndX)
WriteRegistryKey("HKEY_CURRENT_USER","Software\\Blizzbot","consoleX",x1)
WriteRegistryKey("HKEY_CURRENT_USER","Software\\Blizzbot","consoleY",y1)
hWndX = FindWindowByTitle(_APPNAME)
x1,y1,x2,y2 = GetWindowRect(hWndX)
WriteRegistryKey("HKEY_CURRENT_USER","Software\\Blizzbot","guiX",x1)
WriteRegistryKey("HKEY_CURRENT_USER","Software\\Blizzbot","guiY",y1)
WriteRegistryKey("HKEY_CURRENT_USER","Software\\Blizzbot","skin",GetCheckBoxState(cb_skin))
WriteRegistryKey("HKEY_CURRENT_USER","Software\\Blizzbot","accuracy",GetSliderStatus(sl_acu))
WriteRegistryKey("HKEY_CURRENT_USER","Software\\Blizzbot","radius",GetEditBoxText(eb_radius))
WriteRegistryKey("HKEY_CURRENT_USER","Software\\Blizzbot","min_level",GetEditBoxText(eb_level_min))
WriteRegistryKey("HKEY_CURRENT_USER","Software\\Blizzbot","max_level",GetEditBoxText(eb_level_max))
WriteRegistryKey("HKEY_CURRENT_USER","Software\\Blizzbot","eg_key",GetEditBoxText(eb_eg_key))
WriteRegistryKey("HKEY_CURRENT_USER","Software\\Blizzbot","eg_hp",GetEditBoxText(eb_eg_hp))


co = GetListItemCount(list_y) - 1
WriteRegistryKey("HKEY_CURRENT_USER","Software\\Blizzbot","wpcount",IntToStr(co))
while co ~= -1 do
WriteRegistryKey("HKEY_CURRENT_USER","Software\\Blizzbot","wpx"..IntToStr(co),GetListItemText(list_x, co))
WriteRegistryKey("HKEY_CURRENT_USER","Software\\Blizzbot","wpy"..IntToStr(co),GetListItemText(list_y, co))
co = co - 1
end
co = GetListItemCount(list_cr_y) - 1
WriteRegistryKey("HKEY_CURRENT_USER","Software\\Blizzbot","wp_cr_count",IntToStr(co))
while co ~= -1 do
WriteRegistryKey("HKEY_CURRENT_USER","Software\\Blizzbot","wp_cr_x"..IntToStr(co),GetListItemText(list_cr_x, co))
WriteRegistryKey("HKEY_CURRENT_USER","Software\\Blizzbot","wp_cr_y"..IntToStr(co),GetListItemText(list_cr_y, co))
co = co - 1
end
PrintConsoleLine("Settings saved!")
end

if IsButtonPressed(load) == 1 then
ClearList(list_x)
ClearList(list_y)
ClearList(list_cr_x)
ClearList(list_cr_y)

hWndX = FindWindowByTitle(_APPNAME.." Console")
MoveWindow(hWndX,ReadRegistryKey("HKEY_CURRENT_USER","Software\\Blizzbot","consoleX"),ReadRegistryKey("HKEY_CURRENT_USER","Software\\Blizzbot","consoleY"));
hWndX = FindWindowByTitle(_APPNAME)
MoveWindow(hWndX,ReadRegistryKey("HKEY_CURRENT_USER","Software\\Blizzbot","guiX"),ReadRegistryKey("HKEY_CURRENT_USER","Software\\Blizzbot","guiY"));
SetCheckBoxState(cb_skin,ReadRegistryKey("HKEY_CURRENT_USER","Software\\Blizzbot","skin"))
SetSliderStatus(sl_acu,ReadRegistryKey("HKEY_CURRENT_USER","Software\\Blizzbot","accuracy"))
SetEditBoxText(eb_radius,ReadRegistryKey("HKEY_CURRENT_USER","Software\\Blizzbot","radius"))
SetEditBoxText(eb_level_min,ReadRegistryKey("HKEY_CURRENT_USER","Software\\Blizzbot","min_level"))
SetEditBoxText(eb_level_max,ReadRegistryKey("HKEY_CURRENT_USER","Software\\Blizzbot","max_level"))
SetEditBoxText(eb_eg_key,ReadRegistryKey("HKEY_CURRENT_USER","Software\\Blizzbot","eg_key"))
SetEditBoxText(eb_eg_hp,ReadRegistryKey("HKEY_CURRENT_USER","Software\\Blizzbot","eg_hp"))

co = StrToInt(ReadRegistryKey("HKEY_CURRENT_USER","Software\\Blizzbot","wpcount"))
a = 0
while a ~= co + 1 do
AddListItem(list_x,ReadRegistryKey("HKEY_CURRENT_USER","Software\\Blizzbot","wpx"..IntToStr(a)))
AddListItem(list_y,ReadRegistryKey("HKEY_CURRENT_USER","Software\\Blizzbot","wpy"..IntToStr(a)))
a = a + 1
end
co = StrToInt(ReadRegistryKey("HKEY_CURRENT_USER","Software\\Blizzbot","wp_cr_count"))
a = 0
while a ~= co + 1 do
AddListItem(list_cr_x,ReadRegistryKey("HKEY_CURRENT_USER","Software\\Blizzbot","wp_cr_x"..IntToStr(a)))
AddListItem(list_cr_y,ReadRegistryKey("HKEY_CURRENT_USER","Software\\Blizzbot","wp_cr_y"..IntToStr(a)))
a = a + 1
end
PrintConsoleLine("Settings loaded!")
end

if IsKeyPress("F6") == 1 and runbot == 0 then
tn:refresh()
AddListItem(list_cr_x,FloatToStr(tn.x))
AddListItem(list_cr_y,FloatToStr(tn.y))
PrintConsoleLine("Added coordinates X: "..FloatToStr(tn.x).." Y: "..FloatToStr(tn.y).." to the corpserun waypoint list.")
end
if IsKeyPress("F7") == 1 and runbot == 0 then
tn:refresh()
AddListItem(list_x,FloatToStr(tn.x))
AddListItem(list_y,FloatToStr(tn.y))
PrintConsoleLine("Added coordinates X: "..FloatToStr(tn.x).." Y: "..FloatToStr(tn.y).." to the hunting waypoint list.")
end
if IsKeyPress("F8") == 1 then
if GetListItemCount(list_y) > 0 then
DisableButton(load)
DisableButton(save)
runbot = 1
SetWindowTitle(hWnd,_APPNAME.." | NpcS KILLED:["..IntToStr(mobs_killed).."]")
PrintConsoleLine(_APPNAME.." has started his journey!")
else
PrintConsoleLine("Can't start, no way point(s) in list!")
end
end

if runbot == 1 then

tn:refresh()
FocusWindow(hWnd)

-- BEGIN Corpserun
if tn.hp <= 1 and GetListItemCount(list_cr_y) > 0 then
PrintConsoleLine("Your toon died! Attempting Corpserun.")
tn:setCorpseLoc()
Sleep(2000)
PrintConsoleLine("Releasing Corpse.")
SendKeys(hWnd,"{ENTER}")
Sleep(100)
SendKeys(hWnd,"/script RepopMe();")
Sleep(100)
SendKeys(hWnd,"{ENTER}")
while tn:GetDistance(tn:GetCorpseLoc()) < 3 do
PrintConsoleLine("Waiting for graveyard teleport ...")
Sleep(1000)
tn:refresh()
end
-- wait 10 seconds for WoW loading new data from HDD etc.
Sleep(10000)
wp_cr_count = 0
while wp_cr_count < GetListItemCount(list_cr_y) do
walk_x = StrToFloat(GetListItemText(list_cr_x, wp_cr_count))
walk_y = StrToFloat(GetListItemText(list_cr_y,wp_cr_count))
PrintConsoleLine("Distance to corpse: "..tn:GetDistance(tn:GetCorpseLoc()))
if tn:GetDistance(tn:GetCorpseLoc()) < tn:GetDistance(walk_x,walk_y) then
break
end
PrintConsoleLine("Corpserun, next waypoint: "..IntToStr(wp_cr_count))
MoveToXY(hWnd,walk_x,walk_y,5)
wp_cr_count = wp_cr_count + 1
end
PrintConsoleLine("Corpserun, next waypoint: your corpse.")
MoveToXY(hWnd,tn.corpsex,tn.corpsey,30)
SendKeys(hWnd,"{ENTER}")
Sleep(100)
SendKeys(hWnd,"/script RetrieveCorpse();")
Sleep(100)
SendKeys(hWnd,"{ENTER}")
Sleep(1000)
end
-- END Corpserun

min_level = StrToInt(GetEditBoxText(eb_level_min))
max_level = StrToInt(GetEditBoxText(eb_level_max))

em_hp = StrToInt(GetEditBoxText(eb_eg_hp))
em_key = StrToInt(GetEditBoxText(eb_eg_key))

wp_count = GetListItemCount(list_y) - 1
rad = StrToInt(GetEditBoxText(eb_radius))


while wp_count ~= -1 and tn.hp ~= 0 do

walk_x = StrToFloat(GetListItemText(list_x, wp_count))
walk_y = StrToFloat(GetListItemText(list_y,wp_count))
wp_count = wp_count - 1
id = 0

if MoveToXY(hWnd,walk_x,walk_y,10) ~= 0 then
Npc = GetNpc(hWnd,0,0,walk_x,walk_y,min_level,max_level,rad,0)
while Npc ~= nil do
id = 0
if MoveToNpc(hWnd,Npc.ptr,0,20,1) ~= 0 then
PrintConsoleLine("++ Npc in range, engaging ...")
id = fight(hWnd,Npc.ptr)
tn:refresh()
while tn:GetAttackerPtr() ~= nil do
PrintConsoleLine("++ fighting off ambushers!")
id = fight(hWnd,tn.ptrAttacker)
end
if tn.hp ~= 0 then
if id ~= 0 then
-- let the corpse fall
Sleep(500)
loot(hWnd,id)
else
PrintConsoleLine("++ fight cancelled.")
end
rest(0.8)
else
PrintConsoleLine("++ toon dead.")
break
end
else
-- under attack?
while tn:GetAttackerPtr() ~= nil do
PrintConsoleLine("++ fighting off ambushers!")
id = fight(hWnd,tn.ptrAttacker)
tn:refresh()
end
if tn.hp ~= 0 then
if id ~= 0 then
-- let the corpse fall
Sleep(500)
loot(hWnd,id)
else
PrintConsoleLine("++ fight cancelled.")
end
rest(0.8)
else
PrintConsoleLine("++ toon dead.")
break
end
end
Npc = GetNpc(hWnd,0,0,walk_x,walk_y,min_level,max_level,rad)
end -- while scan for mobs
else
-- under attack?
tn:refresh()
while tn:GetAttackerPtr() ~= nil do
PrintConsoleLine("++ fighting off ambushers!")
id = fight(hWnd,tn.ptrAttacker)
tn:refresh()
end
if tn.hp ~= 0 then
if id ~= 0 then
-- let the corpse fall
Sleep(500)
loot(hWnd,id)
else
PrintConsoleLine("++ fight cancelled.")
end
rest(0.8)
else
PrintConsoleLine("++ toon dead.")
break
end
end -- move to WP
end -- while walk waypoints
end -- end if runbot
Sleep(100)
end -- mail loop
Sleep(1)
else
MessageBox("Error","Your Forceshock version is\r\nto low for this script, you\r\nneed ".._FS_VERSION.." or higher!")
Exit()
end
---------------------------------------------------------------------------------
-- ; EOF
---------------------------------------------------------------------------------


Reply with quote
Posted: April 18th, 2005, 10:12 am
 
tault_o0ofoulo0o
tault_o0ofoulo0o's Reps:
User avatar
put the [CODE] tags around it to stop the smileys


Reply with quote
Want Advertisements After The Last Post Removed? Create A Free Account!

blue large dot Who is online
Users browsing this forum: No registered users and 206 guests

Popular Sections
SWTOR Cheats
Guild Wars 2 Cheats
Guild Wars 2 Hacks
Guild Wars 2 Bots
Diablo 3 Cheats
Guild Wars 2 Mods

Popular Sections
WoW Cataclysm Cheats & Exploits
WoW Cataclysm Hacks & Bots
Star Wars The Old Republic Cheats
SWTOR Mods
Torchlight 2 Cheats
SWTOR Space Mission Bots
Site Nav and RSS
RSS Feed of General Discussion RSS Feed 
Sitemap of General Discussion Sitemap 
SitemapIndex SitemapIndex
RSS Feed RSS Feed
Channel list Channel list
left bottom corner Site and Contents Copyright 2001-2012 All Rights Reserved TaultUnleashed.com bottom corner
top left
top right
createaccount
Username:   Password:   Remember Me?