Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Guild Wars > GW Bots
You last visited: Today at 00:00

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement


Guild Wars Drachenmoos Bot

Discussion on Guild Wars Drachenmoos Bot within the GW Bots forum part of the Guild Wars category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Nov 2007
Posts: 647
Received Thanks: 155
Guild Wars Drachenmoos Bot

Habe in einem anderen Forum einen Bot zum Drachenmoos farmen gefunden.
Allerdings scheint irgendwas nicht zu stimmen, wenn man auf Start klick kommt immer folgende Fehlermeldung

Quote:
Line 81 (Pfad)

GUICtrlSetState ($GUI_BUTTON_REFRESH,$GUI_DISABLE)
GUICtrlSetState (^ERROR

Error:Variable used without being declared
Da ich mich zu meinen bedauern mit sowas nicht auskenne wollte ich mal Fragen ob jemand hier ne Ahnung hat woran das liegen könnte.

Folgende Dateien wurden für den Bot hochgeladen

fiber.au3
PHP Code:
#include "GWCAConstants.au3"
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
#include <Date.au3>

Global $BotRunning False$Time$Stopped 0$hour$mins$secs$dead$alltime 0$timeStart$TotalRuns$Successfull$failed$totaltime$besttime$worsttime$averagetime$storegolds$disablegraphics$charname
Opt
("GUIOnEventMode"1)
$GUI GUICreate("Dragon Moss Bot"303311848188)
GUICtrlCreateGroup(" Status : Runs "176811381)
GUICtrlCreateLabel("Total Runs:"192325917)
GUICtrlCreateLabel("Successful:"192485917)
GUICtrlSetColor(-10x008000)
GUICtrlCreateLabel("Failed:"192643517)
GUICtrlSetColor(-10x800000)
$GUi_TotalRuns GUICtrlCreateLabel("0"254322017$SS_RIGHT)
$GUI_Successfull GUICtrlCreateLabel("0"254482017$SS_RIGHT)
$GUI_Failed GUICtrlCreateLabel("0"254642017$SS_RIGHT)
GUICtrlCreateGroup("", -99, -9911)
GUICtrlCreateGroup("Status : Time "88828165)
GUICtrlCreateLabel("Total:"241123117)
GUICtrlCreateLabel("Best:"241282817)
GUICtrlSetColor(-10x008000)
GUICtrlCreateLabel("Worst:"1681283517)
GUICtrlSetColor(-10x800000)
$GUI_TotalTime GUICtrlCreateLabel("0"701126017$SS_RIGHT)
$GUI_BestTime GUICtrlCreateLabel("0"701286017$SS_RIGHT)
$GUI_WorstTime GUICtrlCreateLabel("0"2141286017$SS_RIGHT)
GUICtrlCreateLabel("Average:"1681124717)
$GUI_AverageTime GUICtrlCreateLabel("0"2141126017$SS_RIGHT)
GUICtrlCreateGroup("", -99, -9911)
GUICtrlCreateLabel("Dragon Moss Bot"162414828)
GUICtrlSetFont(-1144000"MS Sans Serif")
GUICtrlSetColor(-10x000000)
GUICtrlCreateLabel("By Nicolas210"48569020)
GUICtrlSetFont(-1104000"MS Sans Serif")
GUICtrlCreateGroup("Config : General "815228173)
GUICtrlCreateLabel("Name :"181745320)
GUICtrlSetFont(-1108000"MS Sans Serif")
$GUI_CHARNAME GUICtrlCreateInput("My Char Name"7417420921)
;~ Global 
$GUI_CHARNAME GUICtrlCreateCombo(""1817019221BitOR(364))
;~ 
GUICtrlSetTip(-1"Choose which instance of the game you want to use")
;~ Global 
$GUI_BUTTON_REFRESH GUICtrlCreateButton("Refresh"21516970230)
;~ 
GUICtrlSetOnEvent(-1"gui_eventHandler")
$GUI_DisableGraphics GUICtrlCreateCheckbox("Disable graphics"1819810517BitOR($GUI_SS_DEFAULT_CHECKBOX,$BS_RIGHT))
GUICtrlSetOnEvent(-1"gui_eventHandler")
$GUI_StoreGolds GUICtrlCreateCheckbox("Store golds items"14619810517BitOR($GUI_SS_DEFAULT_CHECKBOX,$BS_RIGHT))
GUICtrlSetOnEvent(-1"gui_eventHandler")
GUICtrlCreateGroup("", -99, -9911)
GUICtrlCreateGroup("Status : Current Action "822428149)
$GUI_CurrentAction GUICtrlCreateLabel("Script not started yet"1624825017)
GUICtrlCreateGroup("", -99, -9911)
$GUI_ButtonStart GUICtrlCreateButton("Start"828028325)
GUICtrlSetOnEvent(-1"gui_eventHandler")
GUISetOnEvent($GUI_EVENT_CLOSE"gui_eventHandler")
GUISetState(@SW_SHOW)

Func GUI_EVENTHANDLER()
    Switch (@
GUI_CtrlId)
        Case 
$GUI_EVENT_CLOSE
            
Exit
        Case 
$GUI_ButtonStart
            
If $BotRunning False Then
                $TimeStart 
TimerInit()
                
$BotRunning True
                $Stopped 
0
                $TotalRuns 
0
                $Successfull 
0
                $failed 
0
                $TotalTime 
0
                $WorstTime 
0
                $BestTime 
0
                $AverageTime 
0
                $storegolds 
GUICtrlRead($GUI_StoreGolds)
                
$DisableGraphics GUICtrlRead($GUI_DisableGraphics)
                
$CHARNAME GUICtrlRead($GUI_CHARNAME)
                
GUICtrlSetState($GUI_CHARNAME$GUI_DISABLE)
                
GUICtrlSetState($GUI_BUTTON_REFRESH$GUI_DISABLE)
                
GUICtrlSetData($GUI_ButtonStart"Stop")
                
_GWCA_CLOSESTREAM()
                If 
$CHARNAME "" Then
                    $SGW 
"Guild Wars -"
                
Else
                    
$SGW $CHARNAME
                
EndIf
                
GUICtrlSetData($GUI_TotalRuns0)
                
GUICtrlSetData($GUI_Successfull0)
                
GUICtrlSetData($GUI_Failed0)
                
GUICtrlSetData($GUI_TotalTime0)
                
GUICtrlSetData($GUI_WorstTime0)
                
GUICtrlSetData($GUI_BestTime0)
                
GUICtrlSetData($GUI_AverageTime0)
                
$cbType "int"
                
$map CmdCB($CA_GetMapId)
                If 
$map[0] <> 349 Then
                    GuiUpdateStatus
("Traveling to outpost")
                    
TravelTo(349)
                    Do
                        
$cbType "int"
                        
$hp cmdCB($CA_GetMyMaxHP)
                        
$map CmdCB($CA_GetMapId)
                        
sleep(250)
                    
Until $hp[0] <> And $map[0] = 349
                
EndIf
                
            Else
                
$BotRunning False
                GUICtrlSetState
($GUI_CHARNAME$GUI_ENABLE)
                
GUICtrlSetState($GUI_BUTTON_REFRESH$GUI_ENABLE)
                
GUICtrlSetData($GUI_ButtonStart"Start")
                
GUICtrlSetState($GUI_ButtonStart$GUI_DISABLE)
                
$Stopped 1
                GuiUpdateStatus
("Bot will stop after this run.")
            EndIf
        Case 
$GUI_DisableGraphics
            $DisableGraphics 
GUICtrlRead($GUI_DisableGraphics)
            
$CHARNAME GUICtrlRead($GUI_CHARNAME)
            If 
$CHARNAME "" Then
                $SGW 
"Guild Wars -"
            
Else
                
$SGW $CHARNAME
            
EndIf
            If 
$DisableGraphics $GUI_CHECKED Then
                WinSetState
($SGW"", @SW_HIDE)
                
CMD($CA_SETENGINEHOOK1)
            Else
                
CMD($CA_SETENGINEHOOK0)
                
WinSetState($SGW"", @SW_SHOW)
            EndIf
        Case 
$GUI_StoreGolds
            $StoreGolds 
GUICtrlRead($GUI_StoreGolds)
    EndSwitch
EndFunc

Func GuiUpdateStatus
($msg)
    
GUICtrlSetData($GUI_CurrentAction$msg)
EndFunc

Func KeepBuff
()
    
$old_cbtype $cbType
    
If $dead Then Return
    
$cbType "float"
    
$sh CmdCB($CA_GetEffectDuration299)
    
$sa CmdCB($CA_GetEffectDuration1399)
    
$ps CmdCB($CA_GetEffectDuration245)
    If 
$ps[1] < 7500 Then UseSkill(1)
    If 
$sh[1] < 3000 And $sa[1] < 3000 Then 
        $cbType 
"int"
        
$sh1 CmdCB($CA_SkillRecharge2)        
        
$sa1 CmdCB($CA_SkillRecharge3)
        If 
$sh1[0] = 0 Then 
            UseSkill
(2)
        ElseIf 
$sa1[0] = 0 Then 
            UseSkill
(3)
        EndIf
    EndIf
    
$cbType $old_cbtype
EndFunc 
; => KeepBuff Maintenir main du prot Bouclier d'abso + esprit prot.

Func UseSkill($slot)
    $old_cbtype = $cbType
    $cbType = "int"
    CmdCB($CA_SkillRecharge, $slot)
    If $cbVar[0] = 0 And $dead = 0 Then
        Cmd($CA_UseSkill, $slot)
        $blurp2 = TimerInit()
        Do
            $cbType = "int"
            CmdCB($CA_SkillRecharge, $slot)
            Sleep(250)
        Until $cbVar[0] <> 0 Or TimerDiff($blurp2) > 2500
    EndIf
    $cbType = $old_cbtype
EndFunc ; => UseSkill : Utiliser un skill s'
il est recast et attendre qu'il soit en recast (donc utilis驍

Func DeathCheck()
    $old_cbtype = $cbType
    If $dead = 0 Then
        $cbType = "float"
        CmdCB($CA_GetDead)
        If $cbVar[0] = 1 Or TimerDiff($runTime) > 150000 Then $dead = 1
    EndIf
    $cbType = $old_cbtype
EndFunc ; => DeathCheck : Check si t'
es mort !

Func Timer()
    
_TicksToTime(Int(TimerDiff($timestart)), $Hour$Mins$Secs )
  
Local $sTime $TotalTimesave current time to be able to test and avoid flicker..
  
$Time StringFormat("%02i:%02i:%02i"$Hour$Mins$Secs)
  
GUICtrlSetData($GUI_TotalTime$Time)
EndFunc

Func Farm
()
    
$dead 0
    
Global $runTime TimerInit()
    
GuiUpdateStatus("Going out and waiting for map load")
    
MoveEx(-11242, -23500)
    Do
        
$cbType "int"
        
$hp cmdCB($CA_GetMyMaxHP)
        
$map CmdCB($CA_GetMapId)
        
sleep(250)
    
Until $hp[0] <> And $map[0] = 195
    Sleep
(2500)
    
GuiUpdateStatus("Putting ench 7")
    
$cbType "int"
    
Do
        
UseSkill(7) ; buffs
        CmdCB
($CA_GetEffectCount)
    
Until $cbVar[0] = 2
    GuiUpdateStatus
("Putting ench 8")
    Do
        
UseSkill(8) ; buffs
        CmdCB
($CA_GetEffectCount)
    
Until $cbVar[0] = buffs
    GuiUpdateStatus
("Moving to waypoint: FarmSpot 1")
    
MoveToEx(-8789.9,18906.1) ; move 1
    GuiUpdateStatus
("Moving to waypoint: FarmSpot 2")
    
MoveToEx(-8102.6,18965.2) ; move 2
    GuiUpdateStatus
("Moving to waypoint: FarmSpot 3")
    
MoveToEx(-7618,18600) ; move 3
    GuiUpdateStatus
("Moving to waypoint: FarmSpot 4")
    
MoveToEx(-7249.8,18406.8) ; move 4
    GuiUpdateStatus
("Moving to waypoint: FarmSpot 5")
    
MoveToEx(-6573,17207) ; adlib
    GuiUpdateStatus
("Putting protection ench")
    
AdlibRegister("KeepBuff"1000)
    
AdlibRegister("DeathCheck"1000)
    
GuiUpdateStatus("Moving to waypoint: Aggro 1")
    If 
$dead 0 Then MoveToEx(-5948.5,16253.3) ; aggro 1
    GuiUpdateStatus
("Moving to waypoint: Aggro 2")
    If 
$dead 0 Then MoveToEx(-5092.1,15772.3) ; aggro    2
    GuiUpdateStatus
("Moving to waypoint: Back 1")
    If 
$dead 0 Then MoveToEx(-6271,16624) ; back
    GuiUpdateStatus
("Moving to waypoint: Back 2")
    If 
$dead 0 Then MoveToEx(-7134.1,17502.2) ; back 2
    GuiUpdateStatus
("Moving to waypoint: Back 3")
    If 
$dead 0 Then MoveToEx(-7436,18397.9) ; back 3
;~     If $dead 0 Then MoveToEx(-6718,17760) ; bad waypontdon't work
;~     If $dead = 0 Then MoveToEx(-6418.3,16931.7) ; bad waypont too
    
    GuiUpdateStatus("Killing all Dragon Moss")
    Do
        $cbType = "float"
        $sh2 = CmdCB($CA_GetEffectDuration, 299)
        $sa2 = CmdCB($CA_GetEffectDuration, 1399)
        $ps2 = CmdCB($CA_GetEffectDuration, 245)
        If ($sh2[1] > 6000 Or $sa2[1] > 6000) And $ps2[1] > 12000 Then
            If $dead = 0 Then UseSkill(4)
            If $dead = 0 Then UseSkill(5)
        EndIf
        $cbType = "int"
        $soj = CmdCB($CA_SkillRecharge, 5)
    Until $soj[0] <> 0 Or $dead = 1

    $blurp = TimerInit()
    While TimerDiff($blurp) < 17000 And $dead = 0
        Sleep(100)
    WEnd
    If $dead = 0 Then UseSkill(4)
    
    $timetokill = TimerInit()
    Do
        UseSkill(6)
        sleep(1000)
        If TimerDiff($timetokill) > 25000 Then UseSkill(5)
        $cbType = "float"
        CmdCB($CA_GetNearestAliveEnemyToAgent, -2)
        $distance = $cbVar[1]
    Until $distance > 1800 Or $dead = 1 Or TimerDiff($timetokill) > 60000
    
    AdlibUnRegister("KeepBuff")
    
    GuiUpdateStatus("Picking up items")
    $nbItems = 0
    $deadlock = TimerInit()
    Do
        $cbType = "int"
        $item = CmdCB($CA_GetNearestItemToAgentEx, -2)
        If $item[0] = 0 Or _INTTOFLOAT($item[1]) > 1700 Or TimerDiff($deadlock) > 30000 Then ExitLoop
        Cmd($CA_PickupItem, $item[0])
        $deadlock2 = TimerInit()
        Do
            Sleep(500)
            CmdCB($CA_GetAgentExist, $item[0])    
            If TimerDiff($deadlock2) > 5000 Then ContinueLoop 2
        Until $cbVar[0] = 0
        $nbItems += 1
    Until $nbItems = -1    Or $dead = 1
    
    AdlibUnRegister("DeathCheck")
    
    GuiUpdateStatus("Traveling to outpost")
    Travel(349)
EndFunc

Func StoreGolds()
    GuiUpdateStatus("Going to storage")
    $cbType = "int"
    $storage = GetNearestNpcToCoords(8027, -18227)
    Cmd($CA_GONPC, $storage)
    Sleep(10000)
    
    GuiUpdateStatus("Storing golds")
    For $bag = 0 To 4
        
        $cbType = "int"
        $bagsize = CmdCB($CA_GetBagSize, $bag)
            
        For $slot = 0 to $bagsize[0]
            $cbType = "int"
            CmdCB($CA_GetItemInfo, $slot, $bag)        
            If $cbvar[0] = 64 Then
                $cbType = "int"
                $emptystorage = CmdCB($CA_FindEmptySlot,8)      
                MoveItem($bag, $slot, $emptystorage[0], $emptystorage[1])
                sleep(500)
            EndIf        
        Next
    Next
EndFunc ; => StoreGolds().

Func CountSlots()
    Local $temp = 0
    $cbType = "int"
    $Bag1 = CmdCB($CA_GetBagSize, 1)
    $temp += $Bag1[0] - $Bag1[1]
    $Bag2 = CmdCB($CA_GetBagSize, 2)
    $temp += $Bag2[0] - $Bag2[1]
    $Bag3 = CmdCB($CA_GetBagSize, 3)
    $temp += $Bag3[0] - $Bag3[1]
    $Bag4 = CmdCB($CA_GetBagSize, 4)
    $temp += $Bag4[0] - $Bag4[1]
    Return $temp
EndFunc

Func Mercant()
    GuiUpdateStatus("Going To Mercant")
    $mercant = GetNearestNPCToCoords(11040,-18944)
    Cmd($CA_GoNPC, $mercant)
    Sleep(10000)
    Dim $item[10][25][5]
    For $bag = 0 To 4
        $cbType = "int"
        $bagsize = CmdCB($CA_GetBagSize, $bag)
        For $slot = 0 to $bagsize[0]
            $cbType = "int"
            CmdCB($CA_GetItemId, $slot, $bag)
            $item[$bag][$slot][0] = $cbVar[0] ; => item ID
            $item[$bag][$slot][1] = $cbVar[1] ; => item ModelId
            CmdCB($CA_GetItemInfo, $slot, $bag)
            $item[$bag][$slot][2] = $cbVar[0] ; => item Rarity
            CmdCB($CA_GetItemReq, $slot, $bag)
            $item[$bag][$slot][3] = $cbVar[0] ; => item req
        Next
    Next
    
    GuiUpdateStatus("Identifying all items")
    If CountSlots() = 0 Then Cmd($CA_SellItem, 4, 9)
    If CountSlots() = 0 Then Cmd($CA_SellItem, 4, 8)
        For $bag = 0 To 4
        $cbType = "int"
        $bagsize = CmdCB($CA_GetBagSize, $bag)
        For $slot = 0 to $bagsize[0]
            $cbType = "int"
            CmdCB($CA_GetIdKit)
            If $cbVar[0] = 0 Then
                Cmd($CA_BuyIdKit)
                Sleep(Random(500,1000))
                CmdCB($CA_GetIdKit)
                Sleep(Random(500,1000))
                MoveItemById($cbVar[0], 4, 1) ;Move IDKit to Spot (4, 1)
                Sleep(Random(500,1000))
            EndIf
            
            If $item[$bag][$slot][2] <> 64 Or $storegolds <> $GUI_Checked Then Cmd($CA_IdentifyItem, $bag, $slot)
            Sleep(Random(290, 310))
        Next
    Next

    GuiUpdateStatus("Selling all items")
    For $bag = 0 To 4
        $cbType = "int"
        $bagsize = CmdCB($CA_GetBagSize, $bag)
        For $slot = 0 to $bagsize[0]
            If $item[$bag][$slot][2] <> 64 Or $storegolds <> $GUI_Checked Then
                If ($item[$bag][$slot][1] <> 934 Or $item[$bag][$slot][3] <> 0)  And $item[$bag][$slot][1] <> 956 And $item[$bag][$slot][1] <> 819 And $item[$bag][$slot][1] <> 146 Then
                    Cmd($CA_SellItem, $bag, $slot)
                    Sleep(Random(500,750))
                EndIf
            EndIf
        Next
    Next
EndFunc

Func OutPost()
    If CountSlots() < 4 Then
        Travel(284)
        If $storegolds = $GUI_Checked Then    StoreGolds()
        Mercant()
        Travel(349)
    EndIf
EndFunc

Func Travel($outpost)
    TravelTo($outpost)
    Do
        $cbType = "int"
        $hp = cmdCB($CA_GetMyMaxHP)
        $map = CmdCB($CA_GetMapId)
        sleep(250)
    Until $hp[0] <> 0 And $map[0] = $outpost
    Sleep(2000)
EndFunc

Func UpdateStats()
    $TotalRuns += 1
;~     $TotalTime = TimerDiff($TimeStart)/60000
    If $dead = 0 Then
        $Successfull += 1
        $AllTime += TimerDiff($runTime)
        If $totalRuns = 1 Then $BestTime = Ceiling(TimerDiff($runTime)/1000)
        If TimerDiff($runTime)/1000 > $WorstTime Then $WorstTime = Ceiling(TimerDiff($runTime)/1000)
        If TimerDiff($runTime)/1000 < $BestTime Then $BestTime = Ceiling(TimerDiff($runTime)/1000)
    Else
        $Failed += 1
    EndIf
    $AverageTime = Ceiling($AllTime/(1000*$Successfull))
    
    GuiUpdateStatus("Updating Stats")
    GUICtrlSetData($GUI_TotalRuns, $TotalRuns)
    GUICtrlSetData($GUI_Successfull, $Successfull)
    GUICtrlSetData($GUI_Failed, $Failed)
;~     GUICtrlSetData($GUI_TotalTime, $TotalTime & " min")
    GUICtrlSetData($GUI_WorstTime, $WorstTime & " secs")
    GUICtrlSetData($GUI_BestTime, $BestTime & " secs")
    GUICtrlSetData($GUI_AverageTime, $AverageTime & " secs")
EndFunc

Func PurgeEngineHook()
    CMD($CA_SETENGINEHOOK, 0)
    Sleep(150)
    CMD($CA_SETENGINEHOOK, 1)
    GuiUpdateStatus("Purging Engine Hook")
EndFunc

Func HM()
    Cmd($CA_SwitchMode, 1)
    GuiUpdateStatus("Switching to Hard Mode")    
EndFunc

While 1
    If $BotRunning Then
        AdlibRegister("timer", 500)
        If $DisableGraphics = $GUI_CHECKED Then PurgeEngineHook()
        HM()
        OutPost()
        Farm()
        UpdateStats()
        AdlibUnRegister("timer")
    EndIf
    
    If $Stopped =1 Then 
        GuiUpdateStatus("Script not started yet")
        GUICtrlSetState($GUI_ButtonStrat, $GUI_ENABLE)
        $Stopped = 0
    EndIf
WEnd 
GWCAConstants.au3
PHP Code:
# -+-+-+-+-+-+-+ #
;   GWCA Constants
;      By Sune C
# +-+-+-+-+-+-+- #

#include-once

#include <NamedPipes.au3>
#include <WinAPI.au3>

The SkillLog structure for use with the Skill Log feature
Global $tagSKILLLOGSTRUCT "long AgentId;long MyId;long SkillId;float Activation;byte TeamId;ushort Allegiance;float Distance;long Ping;long TargetId"
Global $tagPARTYINFO "hwnd Receiver;long TeamSize;long TeamId;" _
    
"long Agent1Id;float Agent1X;float Agent1Y;float Agent1HP;long Agent1Effects;byte Agent1Hex;dword Agent1Name;byte Agent1Primary;byte Agent1Secondary;long Agent1Target;word Agent1Skill;word Agent1Weapon;" _
    
"long Agent2Id;float Agent2X;float Agent2Y;float Agent2HP;long Agent2Effects;byte Agent2Hex;dword Agent2Name;byte Agent2Primary;byte Agent2Secondary;long Agent2Target;word Agent2Skill;word Agent2Weapon;" _
    
"long Agent3Id;float Agent3X;float Agent3Y;float Agent3HP;long Agent3Effects;byte Agent3Hex;dword Agent3Name;byte Agent3Primary;byte Agent3Secondary;long Agent3Target;word Agent3Skill;word Agent3Weapon;" _
    
"long Agent4Id;float Agent4X;float Agent4Y;float Agent4HP;long Agent4Effects;byte Agent4Hex;dword Agent4Name;byte Agent4Primary;byte Agent4Secondary;long Agent4Target;word Agent4Skill;word Agent4Weapon;" _
    
"long Agent5Id;float Agent5X;float Agent5Y;float Agent5HP;long Agent5Effects;byte Agent5Hex;dword Agent5Name;byte Agent5Primary;byte Agent5Secondary;long Agent5Target;word Agent5Skill;word Agent5Weapon;" _
    
"long Agent6Id;float Agent6X;float Agent6Y;float Agent6HP;long Agent6Effects;byte Agent6Hex;dword Agent6Name;byte Agent6Primary;byte Agent6Secondary;long Agent6Target;word Agent6Skill;word Agent6Weapon;" _
    
"long Agent7Id;float Agent7X;float Agent7Y;float Agent7HP;long Agent7Effects;byte Agent7Hex;dword Agent7Name;byte Agent7Primary;byte Agent7Secondary;long Agent7Target;word Agent7Skill;word Agent7Weapon;" _
    
"long Agent8Id;float Agent8X;float Agent8Y;float Agent8HP;long Agent8Effects;byte Agent8Hex;dword Agent8Name;byte Agent8Primary;byte Agent8Secondary;long Agent8Target;word Agent8Skill;word Agent8Weapon;"

The constants
Global Enum $CA_DisconnectPipe 0x001$CA_AliveRequest$CA_IsAlive_
    $CA_Error 
0x050_
    $CA_CommandsBegin 
0x101_
    $CA_Attack
$CA_Dialog$CA_CancelAction$CA_ClearPacketQueue$CA_QuestAbandon$CA_DonateFaction$CA_SetLogAndHwnd,  _
    $CA_Move
$CA_GoNpc$CA_GoPlayer$CA_GoSignpost$CA_GoAgent,  _
    $CA_UseSkill
$CA_SetEventSkillMode$CA_SetSkillbarSkill$CA_SetAttribute$CA_ChangeSecondProfession,  _
    $CA_ChangeWeaponSet
$CA_EquipItem$CA_EquipItemById$CA_UseItem$CA_UseItemById,  _
    $CA_DropGold
$CA_DepositGold$CA_WithdrawGold_
    $CA_ChangeTarget
$CA_TargetNearestFoe$CA_TargetNearestAlly$CA_TargetNextPartyMember$CA_TargetNextFoe,  _
    $CA_TargetNearestItem
$CA_TargetCalledTarget_
    $CA_UseHero1Skill
$CA_UseHero2Skill$CA_UseHero3Skill_
    $CA_CommandHero1
$CA_CommandHero2$CA_CommandHero3$CA_CommandAll$CA_SetHeroMode,  _
    $CA_AddHero
$CA_KickHero$CA_AddNpc$CA_KickNpc,  _
    $CA_ChangeDistrict
$CA_ZoneMap$CA_SwitchMode$CA_InitMapLoad$CA_SkipCinematic,  _
    $CA_DismissBuff
$CA_SendChat$CA_SetTeamSize$CA_FreeMem,  _
    $CA_Resign
$CA_ReturnToOutpost$CA_EnterChallenge$CA_TravelGH$CA_LeaveGH,  _
    $CA_SetBag
$CA_PrepareMoveItem$CA_MoveItem,  _
    $CA_IdentifyItem
$CA_IdentifyItemById$CA_SalvageItem,  _
    $CA_SellItem
$CA_SellItemById$CA_BuyIdKit$CA_BuySuperiorIdKit_
    $CA_BuyItem
$CA_TraderRequest$CA_TraderRequestSell$CA_TraderRequestSellById$CA_TraderBuy$CA_TraderSell_
    $CA_OpenChest
$CA_AcceptAllItems$CA_PickupItem$CA_DropItem$CA_DropItemById$CA_OpenStorage_
    $CA_UpdateAgentPosition
$CA_MoveOld$CA_TradePlayer$CA_SubmitOffer$CA_ChangeOffer$CA_OfferItem_
    $CA_CancelTrade
$CA_AcceptTrade$CA_ResetAttributes$CA_SetEquipmentAgent$CA_SetEquipmentModelId$CA_SetEquipmentDye_
    $CA_SetEquipmentShinyness
$CA_WriteWhisper$CA_LockHero$CA_CancelMaintainedEnchantment$CA_EnterChallengeForeign_
    $CA_PrepareZoneMapEx
$CA_ZoneMapEx_
    $CA_CommandsEnd
Global Enum $CA_RequestsBegin 0x301,  _
    $CA_GetCurrentTarget
,  _
    $CA_GetMyId
$CA_GetMyMaxHP$CA_GetMyMaxEnergy$CA_GetMyNearestAgent$CA_GetMyDistanceToAgent,  _
    $CA_Casting
$CA_SkillRecharge$CA_SkillAdrenaline$CA_GetSkillbarSkillId,  _
    $CA_GetTarget
$CA_GetAgentAndTargetPtr,  _
    $CA_GetBuildNumber
$CA_ChangeMaxZoom$CA_GetLastDialogId$CA_SetEngineHook,  _
    $CA_GetGold
$CA_GetBagSize$CA_GetItemId,  _
    $CA_GetIdKit
$CA_GetSalvageKit,  _
    $CA_GetItemInfo
$CA_GetItemLastModifier$CA_GetItemLastModifierById,  _
    $CA_FindItemByModelId
$CA_FindEmptySlot$CA_FindGoldItem,  _
    $CA_GetItemPositionByItemId
$CA_GetItemPositionByModelId$CA_GetItemPositionByRarity,  _
    $CA_GetItemModelIdById
$CA_GetItemInfoById,  _
    $CA_GetItemIdByAgent
$CA_GetItemInfoByAgent$CA_GetItemLastModifierByAgent$CA_GetNearestItemByModelId_
    $CA_GetMapLoading
$CA_GetMapId$CA_MapIsLoaded$CA_GetRegionAndLanguage$CA_GetPing$CA_GetLoggedIn$CA_GetDead,  _
    $CA_GetBalthFaction
$CA_GetKurzFaction$CA_GetLuxonFaction,  _
    $CA_GetTitleTreasure
$CA_GetTitleLucky$CA_GetTitleUnlucky$CA_GetTitleWisdom$CA_GetTitleGamer$CA_GetExperience_
    $CA_GetTitleSunspear
$CA_GetTitleLightbringer$CA_GetTitleVanguard$CA_GetTitleNorn$CA_GetTitleAsura$CA_GetTitleDeldrimor,  _
    $CA_GetTitleNorthMastery
$CA_GetTitleDrunkard$CA_GetTitleSweet$CA_GetTitleParty$CA_GetTitleCommander$CA_GetTitleLuxon$CA_GetTitleKurzick,  _
    $CA_GetMapOverlayCoords
$CA_GetMapOverlayInfo$CA_GetNearestMapOverlayToCoords$CA_GetPartyInfo,  _
    $CA_GetAgentExist
$CA_GetProfessions$CA_GetPlayerNumber$CA_GetName$CA_GetHP$CA_GetRotation,  _
    $CA_GetSkill
$CA_GetCoords$CA_GetWeaponSpeeds$CA_GetSpiritRange$CA_GetTeamId$CA_GetCombatMode,  _
    $CA_GetModelMode
$CA_GetHpPips$CA_GetEffects$CA_GetHex$CA_GetModelAnimation$CA_GetEnergy$CA_GetAgentPtr,  _
    $CA_GetType
$CA_GetLevel$CA_GetNameProperties$CA_GetMaxId$CA_GetSpeed$CA_GetAllegiance$CA_GetWeaponType,  _
    $CA_GetModelState
$CA_GetIsAttacking$CA_GetIsKnockedDown$CA_GetIsMoving$CA_GetIsDead$CA_GetIsCasting$CA_GetIsAttackedMelee_
    $CA_PlayerHasBuff
$CA_Hero1HasBuff$CA_Hero2HasBuff$CA_Hero3HasBuff,  _
    $CA_GetFirstAgentByPlayerNumber
$CA_GetNearestAgentToAgent$CA_GetDistanceFromAgentToAgent,  _
    $CA_GetNearestAgentToAgentEx
$CA_GetNearestEnemyToAgentEx$CA_GetNearestItemToAgentEx,  _
    $CA_GetNearestAgentByPlayerNumber
$CA_GetNearestEnemyToAgentByAllegiance$CA_GetNearestAliveEnemyToAgent,  _
    $CA_GetNearestSignpostToAgent
$CA_GetNearestNpcToAgentByAllegiance$CA_GetNearestAgentToCoords_
    $CA_GetNearestNpcToCoords
$CA_GetLoginNumber$CA_GetNumberOfAgentsByPlayerNumber$CA_GetNumberOfAliveEnemyAgents$CA_GetNextItem,  _
    $CA_QuestCheck
$CA_QuestCoords$CA_QuestActive$CA_AllocMem$CA_TraderCheck_
    $CA_GetItemExtraId
$CA_GetItemExtraIdById$CA_GetConnection_
    $CA_GetItemExtraIdByAgent
$CA_GetItemReq$CA_GetItemReqById$CA_GetItemReqByAgent$CA_GetDyePositionByColor_
    $CA_GetNumberOfFoesInRangeOfAgent
$CA_GetNumberOfAlliesInRangeOfAgent$CA_GetNumberOfItemsInRangeOfAgent_
    $CA_GetAgentMovementPtr
$CA_GetMapBoundariesPtr$CA_GetEffectCount$CA_GetEffect$CA_GetEffectByIndex$CA_GetEffectDuration_
    $CA_GetTimeStamp
$CA_GetAgentDanger$CA_GetTypeMap$CA_GetAgentWeapons$CA_GetMatchStatus_
    $CA_GetNextAgent
$CA_GetNextAlly$CA_GetNextFoe$CA_GetItemDmgMod$CA_GetItemDmgModById$CA_GetItemDmgModByAgent_
    $CA_GetEquipmentModelId
$CA_GetEquipmentDyeInfo$CA_GetExtraType_
    $CA_PrepareNearestPlayerNumberToCoords
$CA_GetNearestPlayerNumberToCoords$CA_GetSkillType$CA_GetFirstAgentByPlayerNumberByTeam_
    $CA_GetNearestAliveEnemyToCoords
$CA_GetNextAliveFoe$CA_GetHeroCasting$CA_GetHeroSkillRecharge$CA_GetHeroSkillAdrenaline_
    $CA_GetHeroSkillId
$CA_GetHeroAgentId$CA_PrepareNearestAliveEnemyToCoordsByPlayerNumber$CA_GetNearestAliveEnemyToCoordsByPlayerNumber_
    $CA_GetNearestAliveAgentByPlayerNumber
_
    $CA_RequestsEnd


Global Enum $RARITY_White 0x3D$RARITY_Blue 0x3F$RARITY_Purple 0x42$RARITY_Gold 0x40$RARITY_Green 0x43

Global Enum $BAG_Backpack 1$BAG_BeltPouch$BAG_Bag1$BAG_Bag2$BAG_EquipmentPack$BAG_UnclaimedItems 7$BAG_Storage1$BAG_Storage2_
            $BAG_Storage3
$BAG_Storage4$BAG_Storage5$BAG_Storage6$BAG_Storage7$BAG_Storage8$BAG_StorageAnniversary

Global Enum $HERO_Norgu 1$HERO_Goren$HERO_Tahlkora$HERO_MasterOfWhispers$HERO_AcolyteJin$HERO_Koss$HERO_Dunkoro$HERO_AcolyteSousuke$HERO_Melonni_
            $HERO_ZhedShadowhoof
$HERO_GeneralMorgahn$HERO_MargridTheSly$HERO_Olias 14$HERO_Razah$HERO_MOX$HERO_Jora 18$HERO_PyreFierceshot_
            $HERO_Livia 
21$HERO_Hayda$HERO_Kahmu$HERO_Gwen$HERO_Xandra$HERO_Vekk$HERO_Ogden

Global Enum $HEROMODE_Fight$HEROMODE_Guard$HEROMODE_Avoid

Global Enum $DYE_Blue 2$DYE_Green$DYE_Purple$DYE_Red$DYE_Yellow$DYE_Brown$DYE_Orange$DYE_Silver$DYE_Black$DYE_Gray$DYE_White

Global Enum $ATTRIB_FastCasting$ATTRIB_IllusionMagic$ATTRIB_DominationMagic$ATTRIB_InspirationMagic_
            $ATTRIB_BloodMagic
$ATTRIB_DeathMagic$ATTRIB_SoulReaping$ATTRIB_Curses_
            $ATTRIB_AirMagic
$ATTRIB_EarthMagic$ATTRIB_FireMagic$ATTRIB_WaterMagic$ATTRIB_EnergyStorage_
            $ATTRIB_HealingPrayers
$ATTRIB_SmitingPrayers$ATTRIB_ProtectionPrayers$ATTRIB_DivineFavor_
            $ATTRIB_Strength
$ATTRIB_AxeMastery$ATTRIB_HammerMastery$ATTRIB_Swordsmanship$ATTRIB_Tactics_
            $ATTRIB_BeastMastery
$ATTRIB_Expertise$ATTRIB_WildernessSurvival$ATTRIB_Marksmanship_
            $ATTRIB_DaggerMastery
$ATTRIB_DeadlyArts$ATTRIB_ShadowArts_
            $ATTRIB_Communing
$ATTRIB_RestorationMagic$ATTRIB_ChannelingMagic_
            $ATTRIB_CriticalStrikes
_
            $ATTRIB_SpawningPower
_
            $ATTRIB_SpearMastery
$ATTRIB_Command$ATTRIB_Motivation$ATTRIB_Leadership_
            $ATTRIB_ScytheMastery
$ATTRIB_WindPrayers$ATTRIB_EarthPrayers$ATTRIB_Mysticism

Global Enum $EQUIP_Weapon$EQUIP_Offhand$EQUIP_Chest$EQUIP_Legs$EQUIP_Head$EQUIP_Feet$EQUIP_Hands

Global Enum $SKILLTYPE_Stance 3$SKILLTYPE_Hex$SKILLTYPE_Spell$SKILLTYPE_Enchantment$SKILLTYPE_Signet$SKILLTYPE_Well 9_
            $SKILLTYPE_Skill
$SKILLTYPE_Ward$SKILLTYPE_Glyph$SKILLTYPE_Attack 14$SKILLTYPE_Shout$SKILLTYPE_Preparation 19_
            $SKILLTYPE_Trap 
21$SKILLTYPE_Ritual$SKILLTYPE_ItemSpell 24$SKILLTYPE_WeaponSpell$SKILLTYPE_Chant 27$SKILLTYPE_EchoRefrain

Global Enum $REGION_International = -2$REGION_America 0$REGION_Korea$REGION_Europe$REGION_China$REGION_Japan

Global Enum $LANGUAGE_English 0$LANGUAGE_French 2$LANGUAGE_German$LANGUAGE_Italian$LANGUAGE_Spanish$LANGUAGE_Polish 9$LANGUAGE_Russian

Global Enum $IS_NUMERIC 0x00_
            $IS_TEXT 
0x01_
            $IS_COMMAND 
0x02_
            $IS_REQUEST 
0x04_
            $IS_RESPONSE 
0x08

Global Const $MSG_PartyCallback 0x4A_
             $MSG_SkillLogCallback 
0x4A_
             $MSG_SkillCancelCallback 
0x501_
             $MSG_SkillCompleteCallback 
0x502

Global Const $FLAG_RESET 0x7F800000

VARIABLES

Opt
("WinTitleMatchMode", -1) ;Make sure that Guild Wars receives the messages (match startsubstringexact)

Global 
$cbType "int" ;What to read the callback values as
Global 
$cbVar[2] ;Array for callback wParam and lParam
Global $sGW "Guild Wars -" ;Name of window
Global $hGWCA_STREAM ;Handle to the stream
Global $bGWCA_INTERNAL False ;Is set to True when inside a Cmd() or CmdCB() call

FUNCTIONS

Func _IntToFloat
($iInt)
    
Local $tFloat$tInt

    $tInt 
DllStructCreate("int")
    
$tFloat DllStructCreate("float"DllStructGetPtr($tInt))
    
DllStructSetData($tInt1$iInt)
    Return 
DllStructGetData($tFloat1)
EndFunc

Func _FloatToInt
($fFloat)
    
Local $tFloat$tInt

    $tFloat 
DllStructCreate("float")
    
$tInt DllStructCreate("int"DllStructGetPtr($tFloat))
    
DllStructSetData($tFloat1$fFloat)
    Return 
DllStructGetData($tInt1)
EndFunc

Func Cmd
($uMsg$wparam 0$lparam 0)
    
Local $iRead 0
    Local $OutBuffer 
DllStructCreate("WORD header;WORD type;BYTE wparam[4];BYTE lparam[4]") ;Pipes sending buffer
    Local $InBuffer 
DllStructCreate("WORD header;WORD type;BYTE wparam[4];BYTE lparam[4]") ;Pipes incoming buffer
    $bGWCA_INTERNAL 
True
    DllStructSetData
($OutBuffer,"header",$uMsg)
    
DllStructSetData($OutBuffer,"type",BitOR($IS_COMMAND$IS_NUMERIC))
    
DllStructSetData($OutBuffer,"wparam",Number($wparam)) ; set wparam
    DllStructSetData
($OutBuffer,"lparam",Number($lparam)) ; set lparam

    
If Not $hGWCA_STREAM Then
        
If Not _NamedPipes_WaitNamedPipe("\\.\pipe\GWCA_"&WinGetProcess($sGW), 1000Then
            
Return
        EndIf
        
$hGWCA_STREAM _WinAPI_CreateFile("\\.\pipe\GWCA_"&WinGetProcess($sGW), 26)
    EndIf

    If 
Not _WinAPI_WriteFile($hGWCA_STREAM,DllStructGetPtr($OutBuffer),12,$iReadThen
        _GWCA_CloseStream
()
    EndIf

    
$bGWCA_INTERNAL False
EndFunc

Func CmdCB
($uMsg$wparam 0$lparam 0)
    
Local $iRead 0
    Local $OutBuffer 
DllStructCreate("WORD header;WORD type;BYTE wparam[4];BYTE lparam[4]") ;Pipes sending buffer
    Local $InBuffer 
DllStructCreate("WORD header;WORD type;BYTE wparam[4];BYTE lparam[4]") ;Pipes incoming buffer
    $bGWCA_INTERNAL 
True
    $cbVar
[0] = ""
    
$cbVar[1] = ""
    
DllStructSetData($OutBuffer,"header",$uMsg)
    
DllStructSetData($OutBuffer,"type",BitOR($IS_REQUEST$IS_NUMERIC))
    
DllStructSetData($OutBuffer,"wparam",Number($wparam)) ; set wparam
    DllStructSetData
($OutBuffer,"lparam",Number($lparam)) ; set lparam

    
If Not $hGWCA_STREAM Then
        
If Not _NamedPipes_WaitNamedPipe("\\.\pipe\GWCA_"&WinGetProcess($sGW), 1000Then
            
Return SetError(10$cbVar)
        EndIf
        
$hGWCA_STREAM _WinAPI_CreateFile("\\.\pipe\GWCA_"&WinGetProcess($sGW), 26)
    EndIf

    If 
Not _WinAPI_WriteFile($hGWCA_STREAM,DllStructGetPtr($OutBuffer),12,$iReadThen
        _GWCA_CloseStream
()
    EndIf

    If 
Not _WinAPI_ReadFile($hGWCA_STREAM,DllStructGetPtr($InBuffer),12,$iReadThen
        _GWCA_CloseStream
()
    EndIf

    Switch 
$cbType
        
Case "float"
            
$cbVar[0] = DllStructGetData(DllStructCreate("float"DllStructGetPtr($InBuffer"wparam")), 1)
            
$cbVar[1] = DllStructGetData(DllStructCreate("float"DllStructGetPtr($InBuffer"lparam")), 1)
        Case 
"int"
            
$cbVar[0] = DllStructGetData(DllStructCreate("int"DllStructGetPtr($InBuffer"wparam")), 1)
            
$cbVar[1] = DllStructGetData(DllStructCreate("int"DllStructGetPtr($InBuffer"lparam")), 1)
        Case 
"hex"
            
$cbVar[0] = "0x"&Hex(DllStructGetData(DllStructCreate("int"DllStructGetPtr($InBuffer"wparam")), 1))
            
$cbVar[1] = "0x"&Hex(DllStructGetData(DllStructCreate("int"DllStructGetPtr($InBuffer"lparam")), 1))
        Case Else
            
$cbVar[0] = DllStructGetData(DllStructCreate("int"DllStructGetPtr($InBuffer"wparam")), 1)
            
$cbVar[1] = DllStructGetData(DllStructCreate("int"DllStructGetPtr($InBuffer"lparam")), 1)
    EndSwitch

    
$bGWCA_INTERNAL False

    
Return $cbVar
EndFunc

Func _GWCA_CloseStream
()
    
_WinAPI_CloseHandle($hGWCA_STREAM)
    
$hGWCA_STREAM 0
EndFunc

Func MoveEx
($x$y$random 50)
    
Cmd($CA_MOVE_FloatToInt($x+Random(-$random,$random)), _FloatToInt($y+Random(-$random,$random)))
EndFunc

Func GetNearestAgentToCoords
($x$y)
    
$oldCbType $cbType

    $cbType 
"int"
    
CmdCB($CA_GetNearestAgentToCoords_FloatToInt($x), _FloatToInt($y))

    
$cbType $oldCbType

    
Return $cbVar[0]
EndFunc

Func GetNearestNPCToCoords
($x$y)
    
$oldCbType $cbType

    $cbType 
"int"
    
CmdCB($CA_GetNearestNpcToCoords_FloatToInt($x), _FloatToInt($y))

    
$cbType $oldCbType

    
Return $cbVar[0]
EndFunc

Func GetNearestMapOverlayToCoords
($x$y)
    
$oldCbType $cbType

    $cbType 
"int"
    
CmdCB($CA_GetNearestMapOverlayToCoords_FloatToInt($x), _FloatToInt($y))

    
$cbType $oldCbType

    
Return $cbVar[0]
EndFunc

Func GetNearestPlayerNumberToCoords
($plNum$x$y)
    
$oldCbType $cbType

    $cbType 
"int"
    
CmdCB($CA_PrepareNearestPlayerNumberToCoords$plNum)
    
CmdCB($CA_GetNearestPlayerNumberToCoords_FloatToInt($x), _FloatToInt($y))

    
$cbType $oldCbType

    
Return $cbVar[0]
EndFunc

Func GetNearestAliveEnemyToCoordsByPlayerNumber
($plNum$x$y)
    
$oldCbType $cbType

    $cbType 
"int"
    
CmdCB($CA_PrepareNearestAliveEnemyToCoordsByPlayerNumber$plNum)
    
CmdCB($CA_GetNearestAliveEnemyToCoordsByPlayerNumber_FloatToInt($x), _FloatToInt($y))

    
$cbType $oldCbType

    
Return $cbVar[0]
EndFunc

Func GetNearestAliveEnemyToCoords
($x$y)
    
$oldCbType $cbType

    $cbType 
"int"
    
CmdCB($CA_GetNearestAliveEnemyToCoords_FloatToInt($x), _FloatToInt($y))

    
$cbType $oldCbType

    
Return $cbVar[0]
EndFunc

Func TravelTo
($iMapId$iDis 0)
    
$tMap TimerInit()
    
Cmd($CA_InitMapLoad)
    
Cmd($CA_ZoneMap$iMapId$iDis)
    Do
        
Sleep(200)
        
$aLoad CmdCB($CA_GetMapLoading)
        If 
TimerDiff($tMap) > 15000 AND $aLoad[0] <> 2 Then Cmd($CA_ZoneMap$iMapId$iDis)
        
$aLoaded CmdCB($CA_MapIsLoaded)
    
Until $aLoad[0] = AND $aLoaded[0] = 1
EndFunc

Func MoveItem
($itemBag$itemSlot$newBag$newSlot)
    
Cmd($CA_PREPAREMOVEITEM$itemBag$itemSlot)
    
Sleep(20)
    
Cmd($CA_MOVEITEM$newBag$newSlot)
EndFunc

Func MoveItemById
($itemId$newBag$newSlot)
    
Cmd($CA_PREPAREMOVEITEM$itemId)
    
Sleep(20)
    
Cmd($CA_MOVEITEM$newBag$newSlot)
EndFunc

Func PickupItems
($iItems = -1$fMaxDistance 1012)
    
Local $iItemsPicked 0

    $oldCbType 
$cbType

    $cbType 
"int"

    
$tDeadlock TimerInit()
    Do
        
$aItem CmdCB($CA_GETNEARESTITEMTOAGENTEX, -2)
        If 
$aItem[0] = OR _IntToFloat($aItem[1]) > $fMaxDistance OR TimerDiff($tDeadlock) > 30000 Then ExitLoop

        Cmd
($CA_PICKUPITEM$aItem[0])
        
$tDeadlock2 TimerInit()
        Do
            
Sleep(500)
            
CmdCB($CA_GETAGENTEXIST$aItem[0])
            If 
TimerDiff($tDeadlock2) > 5000 Then ContinueLoop 2
        Until $cbVar
[0] = 0

        $iItemsPicked 
+= 1
    Until $iItemsPicked 
$iItems

    $cbType 
$oldCbType
EndFunc

Func GetItemId
($iBag$iSlot)
    
$oldCbType $cbType

    $cbType 
"int"

    
CmdCB($CA_SetBag$iBag)
    
CmdCB($CA_GetItemId$iSlot)

    
$cbType $oldCbType

    
Return $cbVar
EndFunc

Func GetItemInfo
($iBag$iSlot)
    
$oldCbType $cbType

    $cbType 
"int"

    
CmdCB($CA_SetBag$iBag)
    
CmdCB($CA_GetItemInfo$iSlot)

    
$cbType $oldCbType

    
Return $cbVar
EndFunc

Func GetItemLastModifier
($iBag$iSlot)
    
$oldCbType $cbType

    $cbType 
"int"

    
CmdCB($CA_SetBag$iBag)
    
CmdCB($CA_GetItemLastModifier$iSlot)

    
$cbType $oldCbType

    
Return $cbVar
EndFunc

Func MoveToEx
($x$y$random 50)
    
Local $iBlocked 0

    $oldCbType 
$cbType

    $cbType 
"int"
    
$mState CmdCB($CA_GetMapLoading)

    
$cbType "float"
    
MoveEx($x$y$random)
    
PingSleep()
    Do
        
Sleep(150)
        
$cbType "int"
        
CmdCB($CA_GETDEAD)
        If 
$cbVar[0] = 1 Then ExitLoop

        $mStateOld 
$mState
        $mState 
CmdCB($CA_GetMapLoading)
        If 
$mState[0] <> $mStateOld[0Then ExitLoop

        CmdCB
($CA_GetIsMoving, -2)
        If 
$cbVar[0] = 0 Then
            $iBlocked 
+= 1
            Cmd
($CA_UpdateAgentPosition, -2)
            
MoveEx($x$y$random)
        EndIf

        
$cbType "float"
        
CmdCB($CA_GETCOORDS, -2)
    
Until ComputeDistanceEx($cbVar[0], $cbVar[1], $x$y) < 220 OR $iBlocked 14

    $cbType 
$oldCbType
EndFunc

Func ComputeDistanceEx
($x1$y1$x2$y2)
    Return 
Sqrt(($y2 $y1)^+ ($x2 $x1)^2)
EndFunc

Func UseSkillEx
($iSkillSlot$iTarget 0)
    
$oldCbType $cbType

    $tDeadlock 
TimerInit()
    
$cbType "int"
    
Cmd($CA_USESKILL$iSkillSlot$iTarget)
    Do
        
Sleep(250)
        
CmdCB($CA_GETDEAD)
        If 
$cbVar[0] = 1 Then ExitLoop
        CmdCB
($CA_GETSKILL, -2)
        If 
$cbVar[0] = AND TimerDiff($tDeadlock) > 1000 Then ExitLoop
        CmdCB
($CA_SKILLRECHARGE$iSkillSlot)
    
Until $cbVar[0] <> OR TimerDiff($tDeadlock) > 15000

    $cbType 
$oldCbType
EndFunc

Func _GWCAMemOpen
($iv_Pid$iv_DesiredAccess 0x1F0FFF$iv_InheritHandle 1)
    If 
Not ProcessExists($iv_PidThen
        SetError
(1)
        Return 
0
    
EndIf

    
Local $ah_Handle[2] = [DllOpen('kernel32.dll')]

    If @
Error Then
        SetError
(2)
        Return 
0
    
EndIf

    
Local $av_OpenProcess DllCall($ah_Handle[0], 'int''OpenProcess''int'$iv_DesiredAccess'int'$iv_InheritHandle'int'$iv_Pid)

    If @
Error Then
        DllClose
($ah_Handle[0])
        
SetError(3)
        Return 
0
    
EndIf

    
$ah_Handle[1] = $av_OpenProcess[0]
    Return 
$ah_Handle
EndFunc

Func _GWCAMemClose
($ah_Handle)
    If 
Not IsArray($ah_HandleThen
        SetError
(1)
        Return 
0
    
EndIf

    
DllCall($ah_Handle[0], 'int''CloseHandle''int'$ah_Handle[1])
    If 
Not @Error Then
        DllClose
($ah_Handle[0])
        Return 
1
    
Else
        
DllClose($ah_Handle[0])
        
SetError(2)
        Return 
0
    
EndIf
EndFunc


Func _GWCAMemWrite
($iv_Address$ah_Handle$v_Data$sv_Type 'dword')
    If 
Not IsArray($ah_HandleThen
        SetError
(1)
        Return 
0
    
EndIf

    
Local $v_Buffer DllStructCreate($sv_Type)

    If @
Error Then
        SetError
(@Error 1)
        Return 
0
    
Else
        
DllStructSetData($v_Buffer1$v_Data)
        If @
Error Then
            SetError
(6)
            Return 
0
        
EndIf
    EndIf

    
DllCall($ah_Handle[0], 'int''WriteProcessMemory''int'$ah_Handle[1], 'int'$iv_Address'ptr'DllStructGetPtr($v_Buffer), 'int'DllStructGetSize($v_Buffer), 'int''')

    If 
Not @Error Then
        
Return 1
    
Else
        
SetError(7)
        Return 
0
    
EndIf
EndFunc

Func _GWCAMemRead
($iv_Address$ah_Handle$sv_Type 'dword')
    If 
Not IsArray($ah_HandleThen
        SetError
(1)
        Return 
0
    
EndIf

    
Local $v_Buffer DllStructCreate($sv_Type)

    If @
Error Then
        SetError
(@Error 1)
        Return 
0
    
EndIf

    
DllCall($ah_Handle[0], 'int''ReadProcessMemory''int'$ah_Handle[1], 'int'$iv_Address'ptr'DllStructGetPtr($v_Buffer), 'int'DllStructGetSize($v_Buffer), 'int''')

    If 
Not @Error Then
        Local $v_Value 
DllStructGetData($v_Buffer1)
        Return 
$v_Value
    
Else
        
SetError(6)
        Return 
0
    
EndIf
EndFunc

Func SendChat
($hprocess$Message)
    
Local $ownHandle True

    
If Not IsArray($hprocessThen
        $hprocess 
_GWCAMemOpen($hprocess)
        If 
Not IsArray($hprocessThen Return
        
$ownHandle False
    
EndIf

    
$oldCbType $cbType
    $cbType 
"int"

    
$StringLen StringLen($Message)
    
$MemPtr CmdCB($CA_AllocMem, ($StringLen 1) * 2)
    
$MemPtr $MemPtr[0]

    
_GWCAMemWrite($MemPtr$hprocess$Message"wchar[" $StringLen "]")

    
Cmd($CA_SendChat$MemPtr)

    If 
$MemPtr <> 0 Then Cmd($CA_FreeMem$MemPtr)
    If 
Not $ownHandle Then _GWCAMemClose($hprocess)

    
$cbType $oldCbType
EndFunc

Func GetPlayerName
($iAgent = -2)
    
Local $sRet ""

    
$oldCbType $cbType

    $cbType 
"int"
    
CmdCB($CA_GetName$iAgent)
    If 
Not @error AND $cbVar[0] <> 0 Then
        $ahHndl 
_GWCAMemOpen(WinGetProcess($sGW))
        If 
Not @error Then
            $sRet 
_GWCAMemRead($cbVar[0], $ahHndl"wchar[24]")
            
_GWCAMemClose($ahHndl)
        EndIf
    EndIf

    
$cbType $oldCbType

    
Return $sRet
EndFunc

Func RechargeTimeLeft
($iSkillSlot)
    
Local $iRet 0

    $oldCbType 
$cbType

    $cbType 
"int"

    
$aRecharge CmdCB($CA_SkillRecharge$iSkillSlot)
    
$aTimeStamp CmdCB($CA_GetTimeStamp)
    If 
$aRecharge[0] = 0 Then
        $iRet 
0
    
Else
        
$iRet = ($aRecharge[0] - $aTimeStamp[0])
    EndIf

    
$cbType $oldCbType

    
Return $iRet
EndFunc

Func HeroRechargeTimeLeft
($iHeroIndex$iSkillSlot)
    
Local $iRet 0

    $oldCbType 
$cbType

    $cbType 
"int"

    
$aRecharge CmdCB($CA_GetHeroSkillRecharge$iHeroIndex$iSkillSlot)
    
$aTimeStamp CmdCB($CA_GetTimeStamp)
    If 
$aRecharge[0] = 0 Then
        $iRet 
0
    
Else
        
$iRet = ($aRecharge[0] - $aTimeStamp[0])
    EndIf

    
$cbType $oldCbType

    
Return $iRet
EndFunc

Func PingSleep
($msExtra 0)
    
$oldCbType $cbType

    $cbType 
"int"
    
CmdCB($CA_GetPing)
    
Sleep($cbVar[0] + $msExtra)

    
$cbType $oldCbType
EndFunc

Func WriteWhisper
($hprocess$Name$Message)
    
Local $ownHandle True

    
If Not IsArray($hprocessThen
        $hprocess 
_GWCAMemOpen($hprocess)
        If 
Not IsArray($hprocessThen Return
        
$ownHandle False
    
EndIf

    
$oldCbType $cbType
    $cbType 
"int"

    
$StringLen StringLen($Name)
    
$MemPtr CmdCB($CA_AllocMem, ($StringLen 1) * 2)
    
$MemPtr $MemPtr[0]

    
$StringLen2 StringLen($Message)
    
$MemPtr2 CmdCB($CA_AllocMem, ($StringLen2 1) * 2)
    
$MemPtr2 $MemPtr2[0]

    
_GWCAMemWrite($MemPtr$hprocess$Name"wchar[" $StringLen "]")
    
_GWCAMemWrite($MemPtr2$hprocess$Message"wchar[" $StringLen2 "]")

    
Cmd($CA_WriteWhisper$MemPtr2$MemPtr)

    If 
$MemPtr <> 0 Then Cmd($CA_FreeMem$MemPtr)
    If 
$MemPtr2 <> 0 Then Cmd($CA_FreeMem$MemPtr2)

    If 
Not $ownHandle Then _GWCAMemClose($hprocess)

    
$cbType $oldCbType
EndFunc

Func ZoneMapEx
($iMapId$iRegion$iLanguage)
    
Cmd($CA_PrepareZoneMapEx$iMapId)
    
Cmd($CA_ZoneMapEx$iRegion$iLanguage)
EndFunc

END OF FILE 
Währe schön wenn sich das mal jemand angucken könnte, da der Drachenmoos Bot von Dani ja nicht mehr verfügbar ist
eddi233 is offline  
Old 08/05/2012, 00:55   #2
 
elite*gold: 0
Join Date: Feb 2010
Posts: 761
Received Thanks: 204
da ist ein ganz einfacher fehler drin.
relativ am anfang im GUI bereich sind ein paar zeilen hintereinander die mit ";~" anfangen. das musst du entfernen dann geht der error weg. Außerdem ist das GUI unsauber, weil 2 Labels übereinander liegen.

edit:
habs mal überarbeitet sodass du den fehler nicht mehr hast und die beiden sachen nicht mehr übereinander liegen.

Code:
#include "GWCAConstants.au3"
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
#include <Date.au3>

Global $BotRunning = False, $Time, $Stopped = 0, $hour, $mins, $secs, $dead, $alltime = 0, $timeStart, $TotalRuns, $Successfull, $failed, $totaltime, $besttime, $worsttime, $averagetime, $storegolds, $disablegraphics, $charname
Opt("GUIOnEventMode", 1)
$GUI = GUICreate("Dragon Moss Bot", 303, 363, 848, 188)
GUICtrlCreateGroup(" Status : Runs ", 176, 8, 113, 81)
GUICtrlCreateLabel("Total Runs:", 192, 32, 59, 17)
GUICtrlCreateLabel("Successful:", 192, 48, 59, 17)
GUICtrlSetColor(-1, 0x008000)
GUICtrlCreateLabel("Failed:", 192, 64, 35, 17)
GUICtrlSetColor(-1, 0x800000)
$GUi_TotalRuns = GUICtrlCreateLabel("0", 254, 32, 20, 17, $SS_RIGHT)
$GUI_Successfull = GUICtrlCreateLabel("0", 254, 48, 20, 17, $SS_RIGHT)
$GUI_Failed = GUICtrlCreateLabel("0", 254, 64, 20, 17, $SS_RIGHT)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateGroup("Status : Time ", 8, 88, 281, 65)
GUICtrlCreateLabel("Total:", 24, 112, 31, 17)
GUICtrlCreateLabel("Best:", 24, 128, 28, 17)
GUICtrlSetColor(-1, 0x008000)
GUICtrlCreateLabel("Worst:", 168, 128, 35, 17)
GUICtrlSetColor(-1, 0x800000)
$GUI_TotalTime = GUICtrlCreateLabel("0", 70, 112, 60, 17, $SS_RIGHT)
$GUI_BestTime = GUICtrlCreateLabel("0", 70, 128, 60, 17, $SS_RIGHT)
$GUI_WorstTime = GUICtrlCreateLabel("0", 214, 128, 60, 17, $SS_RIGHT)
GUICtrlCreateLabel("Average:", 168, 112, 47, 17)
$GUI_AverageTime = GUICtrlCreateLabel("0", 214, 112, 60, 17, $SS_RIGHT)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateLabel("Dragon Moss Bot", 16, 24, 148, 28)
GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x000000)
GUICtrlCreateLabel("By Nicolas210", 48, 56, 90, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUICtrlCreateGroup("Config : General ", 8, 152, 281, 123)
GUICtrlCreateLabel("Name :", 18, 234, 53, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$GUI_CHARNAME = GUICtrlCreateInput("My Char Name", 74, 234, 209, 21)
Global $GUI_CHARNAME = GUICtrlCreateCombo("", 18, 170, 192, 21, BitOR(3, 64))
GUICtrlSetTip(-1, "Choose which instance of the game you want to use")
Global $GUI_BUTTON_REFRESH = GUICtrlCreateButton("Refresh", 215, 169, 70, 23, 0)
GUICtrlSetOnEvent(-1, "gui_eventHandler")
$GUI_DisableGraphics = GUICtrlCreateCheckbox("Disable graphics", 18, 198, 105, 17, BitOR($GUI_SS_DEFAULT_CHECKBOX,$BS_RIGHT))
GUICtrlSetOnEvent(-1, "gui_eventHandler")
$GUI_StoreGolds = GUICtrlCreateCheckbox("Store golds items", 146, 198, 105, 17, BitOR($GUI_SS_DEFAULT_CHECKBOX,$BS_RIGHT))
GUICtrlSetOnEvent(-1, "gui_eventHandler")
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateGroup("Status : Current Action ", 8, 276, 281, 49)
$GUI_CurrentAction = GUICtrlCreateLabel("Script not started yet", 16, 300, 250, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$GUI_ButtonStart = GUICtrlCreateButton("Start", 8, 332, 283, 25)
GUICtrlSetOnEvent(-1, "gui_eventHandler")
GUISetOnEvent($GUI_EVENT_CLOSE, "gui_eventHandler")
GUISetState(@SW_SHOW)

Func GUI_EVENTHANDLER()
    Switch (@GUI_CtrlId)
        Case $GUI_EVENT_CLOSE
            Exit
        Case $GUI_ButtonStart
            If $BotRunning = False Then
                $TimeStart = TimerInit()
                $BotRunning = True
                $Stopped = 0
                $TotalRuns = 0
                $Successfull = 0
                $failed = 0
                $TotalTime = 0
                $WorstTime = 0
                $BestTime = 0
                $AverageTime = 0
                $storegolds = GUICtrlRead($GUI_StoreGolds)
                $DisableGraphics = GUICtrlRead($GUI_DisableGraphics)
                $CHARNAME = GUICtrlRead($GUI_CHARNAME)
                GUICtrlSetState($GUI_CHARNAME, $GUI_DISABLE)
                GUICtrlSetState($GUI_BUTTON_REFRESH, $GUI_DISABLE)
                GUICtrlSetData($GUI_ButtonStart, "Stop")
                _GWCA_CLOSESTREAM()
                If $CHARNAME = "" Then
                    $SGW = "Guild Wars -"
                Else
                    $SGW = $CHARNAME
                EndIf
                GUICtrlSetData($GUI_TotalRuns, 0)
                GUICtrlSetData($GUI_Successfull, 0)
                GUICtrlSetData($GUI_Failed, 0)
                GUICtrlSetData($GUI_TotalTime, 0)
                GUICtrlSetData($GUI_WorstTime, 0)
                GUICtrlSetData($GUI_BestTime, 0)
                GUICtrlSetData($GUI_AverageTime, 0)
                $cbType = "int"
                $map = CmdCB($CA_GetMapId)
                If $map[0] <> 349 Then
                    GuiUpdateStatus("Traveling to outpost")
                    TravelTo(349)
                    Do
                        $cbType = "int"
                        $hp = cmdCB($CA_GetMyMaxHP)
                        $map = CmdCB($CA_GetMapId)
                        sleep(250)
                    Until $hp[0] <> 0 And $map[0] = 349
                EndIf
                
            Else
                $BotRunning = False
                GUICtrlSetState($GUI_CHARNAME, $GUI_ENABLE)
                GUICtrlSetState($GUI_BUTTON_REFRESH, $GUI_ENABLE)
                GUICtrlSetData($GUI_ButtonStart, "Start")
                GUICtrlSetState($GUI_ButtonStart, $GUI_DISABLE)
                $Stopped = 1
                GuiUpdateStatus("Bot will stop after this run.")
            EndIf
        Case $GUI_DisableGraphics
            $DisableGraphics = GUICtrlRead($GUI_DisableGraphics)
            $CHARNAME = GUICtrlRead($GUI_CHARNAME)
            If $CHARNAME = "" Then
                $SGW = "Guild Wars -"
            Else
                $SGW = $CHARNAME
            EndIf
            If $DisableGraphics = $GUI_CHECKED Then
                WinSetState($SGW, "", @SW_HIDE)
                CMD($CA_SETENGINEHOOK, 1)
            Else
                CMD($CA_SETENGINEHOOK, 0)
                WinSetState($SGW, "", @SW_SHOW)
            EndIf
        Case $GUI_StoreGolds
            $StoreGolds = GUICtrlRead($GUI_StoreGolds)
    EndSwitch
EndFunc

Func GuiUpdateStatus($msg)
    GUICtrlSetData($GUI_CurrentAction, $msg)
EndFunc

Func KeepBuff()
    $old_cbtype = $cbType
    If $dead Then Return
    $cbType = "float"
    $sh = CmdCB($CA_GetEffectDuration, 299)
    $sa = CmdCB($CA_GetEffectDuration, 1399)
    $ps = CmdCB($CA_GetEffectDuration, 245)
    If $ps[1] < 7500 Then UseSkill(1)
    If $sh[1] < 3000 And $sa[1] < 3000 Then 
        $cbType = "int"
        $sh1 = CmdCB($CA_SkillRecharge, 2)        
        $sa1 = CmdCB($CA_SkillRecharge, 3)
        If $sh1[0] = 0 Then 
            UseSkill(2)
        ElseIf $sa1[0] = 0 Then 
            UseSkill(3)
        EndIf
    EndIf
    $cbType = $old_cbtype
EndFunc ; => KeepBuff : Maintenir main du prot + Bouclier d'abso + esprit prot.

Func UseSkill($slot)
    $old_cbtype = $cbType
    $cbType = "int"
    CmdCB($CA_SkillRecharge, $slot)
    If $cbVar[0] = 0 And $dead = 0 Then
        Cmd($CA_UseSkill, $slot)
        $blurp2 = TimerInit()
        Do
            $cbType = "int"
            CmdCB($CA_SkillRecharge, $slot)
            Sleep(250)
        Until $cbVar[0] <> 0 Or TimerDiff($blurp2) > 2500
    EndIf
    $cbType = $old_cbtype
EndFunc ; => UseSkill : Utiliser un skill s'il est recast et attendre qu'il soit en recast (donc utilis?

Func DeathCheck()
    $old_cbtype = $cbType
    If $dead = 0 Then
        $cbType = "float"
        CmdCB($CA_GetDead)
        If $cbVar[0] = 1 Or TimerDiff($runTime) > 150000 Then $dead = 1
    EndIf
    $cbType = $old_cbtype
EndFunc ; => DeathCheck : Check si t'es mort !

Func Timer()
    _TicksToTime(Int(TimerDiff($timestart)), $Hour, $Mins, $Secs )
  Local $sTime = $TotalTime; save current time to be able to test and avoid flicker..
  $Time = StringFormat("%02i:%02i:%02i", $Hour, $Mins, $Secs)
  GUICtrlSetData($GUI_TotalTime, $Time)
EndFunc

Func Farm()
    $dead = 0
    Global $runTime = TimerInit()
    GuiUpdateStatus("Going out and waiting for map load")
    MoveEx(-11242, -23500)
    Do
        $cbType = "int"
        $hp = cmdCB($CA_GetMyMaxHP)
        $map = CmdCB($CA_GetMapId)
        sleep(250)
    Until $hp[0] <> 0 And $map[0] = 195
    Sleep(2500)
    GuiUpdateStatus("Putting ench 7")
    $cbType = "int"
    Do
        UseSkill(7) ; buffs
        CmdCB($CA_GetEffectCount)
    Until $cbVar[0] = 2
    GuiUpdateStatus("Putting ench 8")
    Do
        UseSkill(8) ; buffs
        CmdCB($CA_GetEffectCount)
    Until $cbVar[0] = 3 ; buffs
    GuiUpdateStatus("Moving to waypoint: FarmSpot 1")
    MoveToEx(-8789.9,18906.1) ; move 1
    GuiUpdateStatus("Moving to waypoint: FarmSpot 2")
    MoveToEx(-8102.6,18965.2) ; move 2
    GuiUpdateStatus("Moving to waypoint: FarmSpot 3")
    MoveToEx(-7618,18600) ; move 3
    GuiUpdateStatus("Moving to waypoint: FarmSpot 4")
    MoveToEx(-7249.8,18406.8) ; move 4
    GuiUpdateStatus("Moving to waypoint: FarmSpot 5")
    MoveToEx(-6573,17207) ; adlib
    GuiUpdateStatus("Putting protection ench")
    AdlibRegister("KeepBuff", 1000)
    AdlibRegister("DeathCheck", 1000)
    GuiUpdateStatus("Moving to waypoint: Aggro 1")
    If $dead = 0 Then MoveToEx(-5948.5,16253.3) ; aggro 1
    GuiUpdateStatus("Moving to waypoint: Aggro 2")
    If $dead = 0 Then MoveToEx(-5092.1,15772.3) ; aggro    2
    GuiUpdateStatus("Moving to waypoint: Back 1")
    If $dead = 0 Then MoveToEx(-6271,16624) ; back
    GuiUpdateStatus("Moving to waypoint: Back 2")
    If $dead = 0 Then MoveToEx(-7134.1,17502.2) ; back 2
    GuiUpdateStatus("Moving to waypoint: Back 3")
    If $dead = 0 Then MoveToEx(-7436,18397.9) ; back 3
;~     If $dead = 0 Then MoveToEx(-6718,17760) ; bad waypont, dont work
;~     If $dead = 0 Then MoveToEx(-6418.3,16931.7) ; bad waypont too
    
    GuiUpdateStatus("Killing all Dragon Moss")
    Do
        $cbType = "float"
        $sh2 = CmdCB($CA_GetEffectDuration, 299)
        $sa2 = CmdCB($CA_GetEffectDuration, 1399)
        $ps2 = CmdCB($CA_GetEffectDuration, 245)
        If ($sh2[1] > 6000 Or $sa2[1] > 6000) And $ps2[1] > 12000 Then
            If $dead = 0 Then UseSkill(4)
            If $dead = 0 Then UseSkill(5)
        EndIf
        $cbType = "int"
        $soj = CmdCB($CA_SkillRecharge, 5)
    Until $soj[0] <> 0 Or $dead = 1

    $blurp = TimerInit()
    While TimerDiff($blurp) < 17000 And $dead = 0
        Sleep(100)
    WEnd
    If $dead = 0 Then UseSkill(4)
    
    $timetokill = TimerInit()
    Do
        UseSkill(6)
        sleep(1000)
        If TimerDiff($timetokill) > 25000 Then UseSkill(5)
        $cbType = "float"
        CmdCB($CA_GetNearestAliveEnemyToAgent, -2)
        $distance = $cbVar[1]
    Until $distance > 1800 Or $dead = 1 Or TimerDiff($timetokill) > 60000
    
    AdlibUnRegister("KeepBuff")
    
    GuiUpdateStatus("Picking up items")
    $nbItems = 0
    $deadlock = TimerInit()
    Do
        $cbType = "int"
        $item = CmdCB($CA_GetNearestItemToAgentEx, -2)
        If $item[0] = 0 Or _INTTOFLOAT($item[1]) > 1700 Or TimerDiff($deadlock) > 30000 Then ExitLoop
        Cmd($CA_PickupItem, $item[0])
        $deadlock2 = TimerInit()
        Do
            Sleep(500)
            CmdCB($CA_GetAgentExist, $item[0])    
            If TimerDiff($deadlock2) > 5000 Then ContinueLoop 2
        Until $cbVar[0] = 0
        $nbItems += 1
    Until $nbItems = -1    Or $dead = 1
    
    AdlibUnRegister("DeathCheck")
    
    GuiUpdateStatus("Traveling to outpost")
    Travel(349)
EndFunc

Func StoreGolds()
    GuiUpdateStatus("Going to storage")
    $cbType = "int"
    $storage = GetNearestNpcToCoords(8027, -18227)
    Cmd($CA_GONPC, $storage)
    Sleep(10000)
    
    GuiUpdateStatus("Storing golds")
    For $bag = 0 To 4
        
        $cbType = "int"
        $bagsize = CmdCB($CA_GetBagSize, $bag)
            
        For $slot = 0 to $bagsize[0]
            $cbType = "int"
            CmdCB($CA_GetItemInfo, $slot, $bag)        
            If $cbvar[0] = 64 Then
                $cbType = "int"
                $emptystorage = CmdCB($CA_FindEmptySlot,8)      
                MoveItem($bag, $slot, $emptystorage[0], $emptystorage[1])
                sleep(500)
            EndIf        
        Next
    Next
EndFunc ; => StoreGolds().

Func CountSlots()
    Local $temp = 0
    $cbType = "int"
    $Bag1 = CmdCB($CA_GetBagSize, 1)
    $temp += $Bag1[0] - $Bag1[1]
    $Bag2 = CmdCB($CA_GetBagSize, 2)
    $temp += $Bag2[0] - $Bag2[1]
    $Bag3 = CmdCB($CA_GetBagSize, 3)
    $temp += $Bag3[0] - $Bag3[1]
    $Bag4 = CmdCB($CA_GetBagSize, 4)
    $temp += $Bag4[0] - $Bag4[1]
    Return $temp
EndFunc

Func Mercant()
    GuiUpdateStatus("Going To Mercant")
    $mercant = GetNearestNPCToCoords(11040,-18944)
    Cmd($CA_GoNPC, $mercant)
    Sleep(10000)
    Dim $item[10][25][5]
    For $bag = 0 To 4
        $cbType = "int"
        $bagsize = CmdCB($CA_GetBagSize, $bag)
        For $slot = 0 to $bagsize[0]
            $cbType = "int"
            CmdCB($CA_GetItemId, $slot, $bag)
            $item[$bag][$slot][0] = $cbVar[0] ; => item ID
            $item[$bag][$slot][1] = $cbVar[1] ; => item ModelId
            CmdCB($CA_GetItemInfo, $slot, $bag)
            $item[$bag][$slot][2] = $cbVar[0] ; => item Rarity
            CmdCB($CA_GetItemReq, $slot, $bag)
            $item[$bag][$slot][3] = $cbVar[0] ; => item req
        Next
    Next
    
    GuiUpdateStatus("Identifying all items")
    If CountSlots() = 0 Then Cmd($CA_SellItem, 4, 9)
    If CountSlots() = 0 Then Cmd($CA_SellItem, 4, 8)
        For $bag = 0 To 4
        $cbType = "int"
        $bagsize = CmdCB($CA_GetBagSize, $bag)
        For $slot = 0 to $bagsize[0]
            $cbType = "int"
            CmdCB($CA_GetIdKit)
            If $cbVar[0] = 0 Then
                Cmd($CA_BuyIdKit)
                Sleep(Random(500,1000))
                CmdCB($CA_GetIdKit)
                Sleep(Random(500,1000))
                MoveItemById($cbVar[0], 4, 1) ;Move IDKit to Spot (4, 1)
                Sleep(Random(500,1000))
            EndIf
            
            If $item[$bag][$slot][2] <> 64 Or $storegolds <> $GUI_Checked Then Cmd($CA_IdentifyItem, $bag, $slot)
            Sleep(Random(290, 310))
        Next
    Next

    GuiUpdateStatus("Selling all items")
    For $bag = 0 To 4
        $cbType = "int"
        $bagsize = CmdCB($CA_GetBagSize, $bag)
        For $slot = 0 to $bagsize[0]
            If $item[$bag][$slot][2] <> 64 Or $storegolds <> $GUI_Checked Then
                If ($item[$bag][$slot][1] <> 934 Or $item[$bag][$slot][3] <> 0)  And $item[$bag][$slot][1] <> 956 And $item[$bag][$slot][1] <> 819 And $item[$bag][$slot][1] <> 146 Then
                    Cmd($CA_SellItem, $bag, $slot)
                    Sleep(Random(500,750))
                EndIf
            EndIf
        Next
    Next
EndFunc

Func OutPost()
    If CountSlots() < 4 Then
        Travel(284)
        If $storegolds = $GUI_Checked Then    StoreGolds()
        Mercant()
        Travel(349)
    EndIf
EndFunc

Func Travel($outpost)
    TravelTo($outpost)
    Do
        $cbType = "int"
        $hp = cmdCB($CA_GetMyMaxHP)
        $map = CmdCB($CA_GetMapId)
        sleep(250)
    Until $hp[0] <> 0 And $map[0] = $outpost
    Sleep(2000)
EndFunc

Func UpdateStats()
    $TotalRuns += 1
;~     $TotalTime = TimerDiff($TimeStart)/60000
    If $dead = 0 Then
        $Successfull += 1
        $AllTime += TimerDiff($runTime)
        If $totalRuns = 1 Then $BestTime = Ceiling(TimerDiff($runTime)/1000)
        If TimerDiff($runTime)/1000 > $WorstTime Then $WorstTime = Ceiling(TimerDiff($runTime)/1000)
        If TimerDiff($runTime)/1000 < $BestTime Then $BestTime = Ceiling(TimerDiff($runTime)/1000)
    Else
        $Failed += 1
    EndIf
    $AverageTime = Ceiling($AllTime/(1000*$Successfull))
    
    GuiUpdateStatus("Updating Stats")
    GUICtrlSetData($GUI_TotalRuns, $TotalRuns)
    GUICtrlSetData($GUI_Successfull, $Successfull)
    GUICtrlSetData($GUI_Failed, $Failed)
;~     GUICtrlSetData($GUI_TotalTime, $TotalTime & " min")
    GUICtrlSetData($GUI_WorstTime, $WorstTime & " secs")
    GUICtrlSetData($GUI_BestTime, $BestTime & " secs")
    GUICtrlSetData($GUI_AverageTime, $AverageTime & " secs")
EndFunc

Func PurgeEngineHook()
    CMD($CA_SETENGINEHOOK, 0)
    Sleep(150)
    CMD($CA_SETENGINEHOOK, 1)
    GuiUpdateStatus("Purging Engine Hook")
EndFunc

Func HM()
    Cmd($CA_SwitchMode, 1)
    GuiUpdateStatus("Switching to Hard Mode")    
EndFunc

While 1
    If $BotRunning Then
        AdlibRegister("timer", 500)
        If $DisableGraphics = $GUI_CHECKED Then PurgeEngineHook()
        HM()
        OutPost()
        Farm()
        UpdateStats()
        AdlibUnRegister("timer")
    EndIf
    
    If $Stopped =1 Then 
        GuiUpdateStatus("Script not started yet")
        GUICtrlSetState($GUI_ButtonStrat, $GUI_ENABLE)
        $Stopped = 0
    EndIf
WEnd
Deset is offline  
Reply


Similar Threads Similar Threads
WTS Guild Wars Gold,Guild Wars Ectos,Guild Wars Zaishen Keys for sale
02/19/2013 - Guild Wars Trading - 4 Replies
Hi, i want to sell Guild Wars Gold,Guild Wars Ectos,Guild Wars Zaishen Keys.If someone is interested , you can email me and add my msn. We can talk details there. I will give u a low price of Guild Wars Gold,Guild Wars Ectos,Guild Wars Zaishen Keys including weapons. I am serious. Email:[email protected] MSN:[email protected] Thank you for reading my post.



All times are GMT +2. The time now is 00:00.


Powered by vBulletin®
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2021 elitepvpers All Rights Reserved.