Page 26 of 26 FirstFirst ... 16242526
Results 251 to 256 of 256

Thread: [GWA2] Essence+PeacekeeperFarm

  1. #251
    Senior Member Underavelvetmoon's Avatar
    Join Date
    Jun 2011
    Location
    UK
    Posts
    181
    Gonna try post the code so just copy it into a file. You will need to add a couple functions to it since I added some generic functions to my GWA2 to make it easier over multiple different scripts (They are all stored in the same folder)

    Code:
    #region Includes
    #include "GWA2.au3"
    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #include <GuiEdit.au3>
    #include <ScrollBarsConstants.au3>
    #include <Date.au3>
    #endregion Includes
    
    #region GUI
    
    ; Create GUI
    
    Opt("GUIOnEventMode", True)
    
    $GUI = GUICreate("Peacekeeper v2.0", 251, 256, 192, 124)
    $txtName = GUICtrlCreateCombo("", 8, 8, 145, 25)
    GUICtrlSetData(-1, GetLoggedCharNames())
    $bStart = GUICtrlCreateButton("Start", 176, 8, 67, 49)
    $lblRuns = GUICtrlCreateLabel("Runs: ", 8, 40, 76, 17)
    $lblFails = GUICtrlCreateLabel("Fails: ", 104, 40, 68, 17)
    Global $Out = GUICtrlCreateEdit("", 8, 64, 233, 185)
    
    GUISetState(@SW_SHOW)
    GUICtrlSetOnEvent($bStart, "EventHandler")
    GUISetOnEvent($GUI_EVENT_CLOSE, "EventHandler")
    #endregion GUI
    
    #region Globals
    
    ; Define variables to be used throughout the script
    
    Global $g_hTimer, $g_iSecs, $g_iMins, $g_iHour, $g_sTime
    
    Global $Template = 'OwFTQza+Z6qovYHkngmMXsB6ACA'
    Global $bRunning = False
    Global $bInitialized = False
    Global $bCanContinue = True
    Global $GWPID = -1
    
    Global $Runs = 0
    Global $Fails = 0
    
    Global $Beetletun = 136
    Global $NeboTerrace = 59
    
    Global $FirstRun = True
    
    Global $NoSpawn = 0
    Global $EnemiesKilled = 0
    Global $FalkenSpawns = 0
    ; Skillbar locations
    
    Global Const $FGJ = 1
    Global Const $100B = 2
    Global Const $WWA = 3
    Global Const $TTL = 4
    Global Const $IAU = 5
    Global Const $EBSOH = 6
    Global Const $DE = 7
    Global Const $SOD = 8
    
    #endregion Globals
    #region Initialize
    Do
       Sleep(100)
    Until $bInitialized
    
    ; Handle to keep the script looping and manage inventory
    
    While 1
       If $bRunning = True Then
    	  If GetMapID() <> $Beetletun Then
    		 Out("Not in town")
    		 Out("Travelling now")
    		 TravelTo($Beetletun)
    		 $FirstRun = True
    	  EndIf
    	  If $FirstRun = True Then
    		 Out("Setting Up")
    		 Do
    			Setup()
    		 Until $FirstRun = False
    	  EndIf
    	  MainFarm()
    	  If CountFreeSlots() < 5 Then
    		  Out("Inventory Full..")
    		  Out("Going to Merchant")
    		 Merchant()
    	  EndIf
    	  GUICtrlSetData($lblRuns, "Runs: " & $Runs)
    	  GUICtrlSetData($lblFails, "Fails: " & $Fails)
    	  Out("Peacekeepers Killed: " & $EnemiesKilled)
    	  Out("No spawn runs: " & $NoSpawn)
    	  Out("Falken Spawns: " & $FalkenSpawns)
       EndIf
       WEnd
    
       ; Typical event handler to pass Initialize
    
       Func EventHandler()
    	Switch @GUI_CtrlId
    		Case $GUI_EVENT_CLOSE
    			Exit
    		Case $bStart
    			If $bRunning = True Then
    				GUICtrlSetData($bStart, "Will pause after this run")
    				GUICtrlSetState($bStart, $GUI_DISABLE)
    				$bRunning = False
    			ElseIf $bInitialized Then
    				GUICtrlSetData($bStart, "Pause")
    				$bRunning = True
    			Else
    				$bRunning = True
    				GUICtrlSetData($bStart, "Initializing...")
    				GUICtrlSetState($bStart, $GUI_DISABLE)
    				GUICtrlSetState($txtName, $GUI_DISABLE)
    ;~ 				WinSetTitle($GUI, "", GUICtrlRead($txtName))
    				If GUICtrlRead($txtName) = "" Then
    					If Initialize(ProcessExists("gw.exe"), True, True, False) = False Then
    						MsgBox(0, "Error", "Guild Wars it not running.")
    						Exit
    					EndIf
    				Else
    					If Initialize(GUICtrlRead($txtName), True, True, False) = False Then
    						MsgBox(0, "Error", "Can't find a Guild Wars client with that character name.")
    						Exit
    					EndIf
    				EndIf
    				GUICtrlSetData($bStart, "Pause")
    				GUICtrlSetState($bStart, $GUI_ENABLE)
    				WinSetTitle($GUI, "", GetCharname() & " - Peacekeeper v2")
    				$bInitialized = True
    				$GWPID = $mGWHwnd
    			EndIf
    	EndSwitch
    EndFunc
    #endregion Initialize
    #region Setup & Merchant Handle
    Func Setup() ; Sets up the resign trick to always end up at the portal
    
       Do
    	MoveTo(21966, -11651)
    	Move(22500, -11700)
          ; Setup Easy Resign Route
    
       Until WaitMapLoading($NeboTerrace) = True ; Waits until we receive wait map loading
    
    	  ReverseDirection()
          Sleep(1000)
          ToggleAutoRun()
          WaitMapLoading($Beetletun)
    
       ; Setup Complete
    
       $FirstRun = False
       Out("Setup complete")
       Return 1
    EndFunc
    
    Func Merchant()
       Local $lMerch = GetAgentByName("Chios [Merchant]")
    
       GoToNPC($lMerch)
    
       Ident(1)
       Ident(2)
       Sell(1)
       Sell(2)
    
       $FirstRun = True
       Sleep(2000)
    EndFunc
    
    Func Ident($bagIndex)
    	For $i = 1 To $bagIndex
    		Local $lBag = GetBag($i)
    		For $ii = 1 To DllStructGetData($lBag, 'slots')
    			If FindIDKit() = 0 Then
    				If GetGoldCharacter() < 500 And GetGoldStorage() > 499 Then
    					WithdrawGold(500)
    					Sleep(Random(200, 300))
    				EndIf
    				Do
    					BuyIDKit()
    					RndSleep(500)
    				Until FindIDKit() <> 0
    				RndSleep(500)
    			EndIf
    			$aItem = GetItemBySlot($i, $ii)
    			If DllStructGetData($aItem, 'ID') = 0 Then ContinueLoop
    			   IdentifyItem($aItem)
    			RndSleep(250)
    		Next
    	Next
    EndFunc
    
    Func Sell($bagIndex)
    	$bag = GetBag($bagIndex)
    	$numOfSlots = DllStructGetData($bag, "slots")
    	For $i = 1 To $numOfSlots
    		; Out("Selling item: " & $bagIndex & ", " & $i)
    		$aItem = GetItemBySlot($bagIndex, $i)
    		If DllStructGetData($aItem, "ID") = 0 Then ContinueLoop
    		If CanSell($aItem) Then
    			SellItem($aItem)
    		EndIf
    		RndSleep(250)
    	Next
     EndFunc
    #endregion Setup & Merch
    #Region Main
    Func MainFarm()
         Local $lTimer, $lTime
    	 Local $lDeadlock
    	 Local $lGoonName = "Peacekeeper Goon"
    	 Local $lFalken = "Courier Falken"
    	 Local $lDebug, $lDebugTime
    
         Sleep(1000)
    	 Move(22500, -11700)
    	 WaitMapLoading($NeboTerrace)
    
    	 $lTimer = TimerInit()
    	 Out("Begin run #" & $Runs)
         TargetNearestAlly()
    	 $lPos = GetNearestNPCToCoords(-11746, 18436)
    	 $aName = GetAgentName($lPos)
    
    	 If $aName = $lFalken Then
    		$bCanContinue = False
    		$FalkenSpawns = $FalkenSpawns + 1
    	 Else
    		$bCanContinue = True
    	 EndIf
    
    	 If $bCanContinue = True Then
    	 MoveTo(-10998, 18328)
    	 MoveTo(-8005, 17962)
    	 UseSkillEx($DE, -2)
    	 MoveTo(-3618, 17264)
    	 MoveTo(-1077, 16959)
         EndIf
    
    	 Out("Checking Spawn...")
    
    	 TargetNearestAlly()
    	 $lGoon = GetNearestNPCToCoords(-993, 16964)
    	 $lName = GetAgentName($lGoon)
    
    	 If $lName = $lGoonName Then
    		$bCanContinue = True
    	 Else
    		$bCanContinue = False
    	 EndIf
    
         If $bCanContinue = True Then
    	    Out("Found spawn")
            Out("Waiting for text")
    		;$lDebug = TimerInit()
    		Sleep(40000)
    
    		Out("Pre buff")
    		UseSkillEx($SOD, -2)
    
    		Do
    		   Sleep(50)
    	    Until GetNumberOfFoesInRangeOfAgent(-2, 1250) > 0
    
    		UseSkillEx($IAU, -2)
    		UseSkillEx($EBSOH, -2)
    	    ;$lDebugTime = _TicksToTime(Int(TimerDiff($lTimer)), $g_iHour, $g_iMins, $g_iSecs)
            ;$Debugg_sTime = StringFormat("%02i:%02i:%02i", $g_iHour, $g_iMins, $g_iSecs)
    		;Out("Text took: " & $Debugg_sTime)
    		Fight()
    
    		If $bCanContinue = True Then PickUpLoot()
            If $bCanContinue = True Then $EnemiesKilled = $EnemiesKilled + 7
    	    Resign()
            Sleep(3000)
    	    Do
    		   Sleep(200)
            Until GetIsDead(-2) = True
    
    	    ReturnToOutpost()
    	    WaitMapLoading($Beetletun)
    
         Else
    	    Out("No spawn, restarting")
    	    $NoSpawn = $NoSpawn + 1
    
    		Resign()
            Sleep(3000)
    		Do
    		   Sleep(50)
    	    Until GetIsDead(-2) = True
    
    		ReturnToOutpost()
    		WaitMapLoading($Beetletun)
    
    	 EndIf
    
    	    $Runs = $Runs + 1
            Out("Run finished")
    	    Sleep(200)
            $lTime = _TicksToTime(Int(TimerDiff($lTimer)), $g_iHour, $g_iMins, $g_iSecs)
            $g_sTime = StringFormat("%02i:%02i:%02i", $g_iHour, $g_iMins, $g_iSecs)
            Out("Last run took " & $g_sTime)
    	    Sleep(200)
      EndFunc
    
      Func Fight()
        Local $lDeadlock
        Local $lMob
    
    	$lDeadlock = TimerInit()
    
    	$lMob = GetNearestEnemyToAgent(-2)
    	Attack($lMob)
    	UseSkillEx($FGJ, -2)
    	UseSkillEx($TTL, -2)
    	UseSkillEx($100B, -2)
    	UseSkillEx($WWA, $lMob)
    
    	Do
    	   $lMob = GetNearestEnemyToAgent(-2)
           Attack($lMob)
    	   If IsRecharged($WWA) Then UseSkillEx($WWA, $lMob)
    	   If IsRecharged($100B) Then UseSkillEx($100B, $lMob)
    	   If IsRecharged($TTL) Then UseSkillEx($TTL, -2)
    	   If IsRecharged($EBSOH) Then UseSkillEx($EBSOH, -2)
    	   If IsRecharged($SOD) Then UseSkillEx($SOD, -2)
    	   If IsRecharged($IAU) Then UseSkillEx($IAU, -2)
    
    	   If GetIsDead(-2) = True Then ExitLoop
    
    	   Until GetNumberOfFoesInRangeOfAgent(-2, 2000) = 0 Or TimerDiff($lDeadlock) > 180000
    
    	   If GetIsDead(-2) = True Then
    		  $bCanContinue = False
    		  Out("Died at mobs")
    		  $Fails = $Fails + 1
    	   Else
    		  $bCanContinue = True
    	   EndIf
    	EndFunc
    
     Func CanPickUp2($aItem)
    	Local $R = GetRarity($aItem)
    	Local $M = DllStructGetData($aItem, "ModelID")
    	Local $E = DllStructGetData($aItem, "ExtraID")
    	Local $Q = DllStructGetData($aItem, "Quantity")
    
    	Switch $R
    	Case 2624, 2627
    	   Return True
    	EndSwitch
    
    	Switch $M
        Case 146 ; Dyes
    	   If $E = 10 Or $E = 12 Then ; Black & White
    		  Return True
    	   Else
    		  Return False
    	   EndIf
        Case 35123 ; Conf. Orders
    	   Return True
    	EndSwitch
    	If $Q > 10 Then
    	   Return True
    	Else
    	   Return False
    	EndIf
     EndFunc
    
     Func CanSell($aItem)
    	Local $R = GetRarity($aItem)
        Local $Req = GetItemReq($aItem)
        Local $A = GetItemAttribute($aItem)
        Local $M = DllStructGetData($aItem, "ModelID")
    	Local $E = DllStructGetData($aItem, "ExtraID")
    
    	Switch $R
    	Case 2627
    	   Return False
        EndSwitch
    
        Switch $M
    	Case 146 ; Dyes
    	   If $E = 10 Or $E = 12 Then
    		  Return False
    	   Else
    		  Return True
    	   EndIf
        Case 35123 ; Conf. Orders
    	   Return False
    	EndSwitch
    
        Switch $Req
    	Case 8
    	   If GetItemMaxDmg($aItem) = 22 Or GetItemMaxDmg($aItem) = 16 Or GetItemMaxDmg($aItem) = 12 Then
    		  Return False
    	   EndIf
    	EndSwitch
    
    	Return True
     EndFunc
    
     Func CanID($aItem)
     Return True ;Not needed for this script
     EndFunc
    
      Func UseSkillEx($lSkill, $lTgt = -2, $aTimeout = 3000)
    	If GetIsDead(-2) Then Return
    	If Not IsRecharged($lSkill) Then Return
    
    	Local $lDeadLock = TimerInit()
    	UseSkill($lSkill, $lTgt)
    	Do
    		Sleep(50)
    		If GetIsDead(-2) = 1 Then Return
    	Until (Not IsRecharged($lSkill)) Or (TimerDiff($lDeadLock) > $aTimeout)
    	Sleep(50)
     EndFunc
    
     Func Out($msg)
    	GUICtrlSetData($Out, GUICtrlRead($Out) & $msg & @CRLF)
    	_GUICtrlEdit_Scroll($Out, $SB_SCROLLCARET)
    	_GUICtrlEdit_Scroll($Out, $SB_LINEUP)
     EndFunc
    
    Func CountFreeSlots()
    	Local $temp = 0
    	Local $bag
    	$bag = GetBag(1)
    	$temp += DllStructGetData($bag, 'slots') - DllStructGetData($bag, 'ItemsCount')
    	$bag = GetBag(2)
    	$temp += DllStructGetData($bag, 'slots') - DllStructGetData($bag, 'ItemsCount')
    	$bag = GetBag(3)
    	$temp += DllStructGetData($bag, 'slots') - DllStructGetData($bag, 'ItemsCount')
    	Out($temp & " slots free")
    	Return $temp
     EndFunc
    
       Func GetItemMaxDmg($aItem)
    	If Not IsDllStruct($aItem) Then $aItem = GetItemByItemID($aItem)
    	Local $lModString = GetModStruct($aItem)
    	Local $lPos = StringInStr($lModString, "A8A7") ; Weapon Damage
    	If $lPos = 0 Then $lPos = StringInStr($lModString, "C867") ; Energy (focus)
    	If $lPos = 0 Then $lPos = StringInStr($lModString, "B8A7") ; Armor (shield)
    	If $lPos = 0 Then Return 0
    	Return Int("0x" & StringMid($lModString, $lPos - 2, 2))
     EndFunc
     #endregion main
    Here's the other functions from my GWA2 incase you dont have them (I tend to change some things to my own desires!)

    Code:
    Func Ident($bagIndex)
    	For $i = 1 To $bagIndex
    		Local $lBag = GetBag($i)
    		For $ii = 1 To DllStructGetData($lBag, 'slots')
    			If FindIDKit() = 0 Then
    				If GetGoldCharacter() < 500 And GetGoldStorage() > 499 Then
    					WithdrawGold(500)
    					Sleep(Random(200, 300))
    				EndIf
    				Do
    					BuyIDKit()
    					RndSleep(500)
    				Until FindIDKit() <> 0
    				RndSleep(500)
    			EndIf
    			$aItem = GetItemBySlot($i, $ii)
    			If DllStructGetData($aItem, 'ID') = 0 Then ContinueLoop
    			If CanID($aItem) Then
    			   IdentifyItem($aItem)
    		    EndIf
    			RndSleep(250)
    		Next
    	Next
    EndFunc
    
    Func Sell($bagIndex)
    	$bag = GetBag($bagIndex)
    	$numOfSlots = DllStructGetData($bag, "slots")
    	For $i = 1 To $numOfSlots
    		; Out("Selling item: " & $bagIndex & ", " & $i)
    		$aItem = GetItemBySlot($bagIndex, $i)
    		If DllStructGetData($aItem, "ID") = 0 Then ContinueLoop
    		If CanSell($aItem) Then
    			SellItem($aItem)
    		EndIf
    		RndSleep(250)
    	Next
     EndFunc
    I have some statistics too from my many runs. They arent amazingly accurate, but do show the low drop rate of the minipet:

    Code:
    [17/05/17 - 18/05/17]
    Runs: 668
    Fails: 56
    Peacekeepers Killed: 1883
    No Spawn Runs: 343
    Green Axes: 1
    Minipets: 0
    Confessors Orders: N/A
    
    [18/05/17 - After changing script - Took 20 minutes!]
    Runs: 18
    Fails: 1
    Peacekeepers Killed: 49
    No Spawn Runs: 11
    Green Axes: 0
    Minipets: 1
    Confessors Orders: N/A
    
    Chance for Minipet: 0.05146680391147709727225939269171
    Chance per 1000 peacekeepers: 51.46680391147709727225939269171
    Chance per 2000 peacekeepers: 102.93360782295419454451878538342
    
    [18/05/17 - 20/05/17 - Crashed when testing new API]
    Runs: 1700~ 
    Fails: 150~
    Peacekeepers Killed: 2800~
    No Spawn Runs: 700~
    Green Axes: 0
    Minipets: 0
    Confessors Orders: 400~
    
    [20/05/17 - 22/05/17]
    Runs: 1399
    Fails: 127
    Peacekeepers Killed: 3274
    No Spawn Runs: 740
    Falken Spawns: 370
    Green Axes: 2
    Minipets: 0
    Confessors Orders: 150~
    
    [22/05/17] - Part 1
    Runs: 76
    Fails: 15
    Peacekeepers Killed: 196
    No spawn runs: 33
    Falken Spawns: 11
    Green Axes: 1
    Minipets: 0
    Confessors Orders: 30
    
    [23/05/17] - Crashed
    Runs: 813
    Fails: 91
    Peacekeepers Killed: 2310
    No Spawn Runs: 392
    Falken Spawns: 185
    Green Axes: 1
    Minipets: 0
    Confessors Orders: 50~
    
    [29/05/17]
    Runs: 513
    Fails: 50
    Peacekeepers Killed: 1575
    No Spawn Runs: 237
    Falken Spawns: 112
    Green Axes: 1
    Minipets: 0
    Confessors Orders: 150~
    Outside of these stats I probably had around 30k+ peacekeepers killed (The script should count it) without any minipet so I expect the actual probability to sit at around the 0.0005% mark, since the mobs are supposed to be killed in the very high thousands (30-50k) before a minipet drops, so on average it would take a week or 2 of very persistent botting to acomplish.

    Hope this helps you all out!
    Last edited by Underavelvetmoon; 11-23-2017 at 11:14 PM.

    Number one game forever....

  2. #252
    Junior Member
    Join Date
    Oct 2017
    Posts
    3
    Was Wondering does HM affect the drop rate of the mini peacekeeper?

  3. #253
    Junior Member
    Join Date
    Feb 2014
    Posts
    26
    Quote Originally Posted by Synsational View Post
    Was Wondering does HM affect the drop rate of the mini peacekeeper?
    idk but we got drop in nm (first in under 5k of kill)

  4. #254
    Junior Member
    Join Date
    Oct 2017
    Posts
    3
    Quote Originally Posted by rusco95 View Post
    idk but we got drop in nm (first in under 5k of kill)
    Sweet good to know. Thanks for the fast reply!

  5. #255
    Junior Member
    Join Date
    Aug 2015
    Posts
    11
    Quote Originally Posted by rusco95 View Post
    yo all anyone have a model id of peacekeeper?
    I don't know what the ID is, but if you're worried that the script isn't picking up the minipet, don't be. It's also set to pick up all green items.

  6. #256
    Junior Member
    Join Date
    Feb 2014
    Posts
    26
    Quote Originally Posted by Jamamon View Post
    I don't know what the ID is, but if you're worried that the script isn't picking up the minipet, don't be. It's also set to pick up all green items.
    ye ty i alrdy saw ^^

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •