Jump to content

Facebook Pet bot


lespoils
 Share

Recommended Posts

I was asked to post the facebook pet bot i and 2 friends were working on. Use the ini file to configure the pet bot settings. we still miss the auto sell function and sometimes the bot hangs. but in overall u'll get to high levels real quick :whistle:

#include <GUIConstants.au3>
#include <IE.au3>
#Include <Misc.au3>
#include <Date.au3>
#include <Array.au3>

Global $AMPM, $aSplit, $iCHK, $iCTime, $iPid
Global $Button2, $Button3, $pets, $oIE, $site, $file, $usegui
Global $antlvldif, $otherlvldif, $mantislvldif, $scorpionlvldif, $spiderlvldif

iniload()

_IEErrorHandlerRegister ()
$oIE = _IECreateEmbedded ()
if $usegui = 1 then
   Opt("GUIOnEventMode", 1)
   $pets = GUICreate("Pet Me", 900, 584, _
           (@DesktopWidth - 1279) / 2, (@DesktopHeight - 797) / 2, _
           $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)
   $GUIActiveX = GUICtrlCreateObj($oIE, 5, 4, 730, 576)
   $Button1 = GUICtrlCreateButton("Start", 768, 495, 110, 25, 0)
       GUICtrlSetOnEvent(-1, "Start")
   $Button2 = GUICtrlCreateButton("Pause", 768, 525, 110, 25, 0)
       GUICtrlSetOnEvent(-1, "Stop")
   $Button3 = GUICtrlCreateButton("Close", 768, 555, 110, 25, 0)
       GUICtrlSetOnEvent($Button3, "Terminate")
   $iCTime = GUICtrlCreateLabel('Current Time' & @CRLF & _GetHour(@HOUR) & ':' & @MIN & ':' & @SEC & ' ' & $AMPM _
           , 776, 10, 80, 37, 0x01, BitOR($SS_CENTER,$SS_CENTERIMAGE))
   GUICtrlCreateGroup("", -99, -99, 1, 1)
   GUISetState(@SW_SHOW)
   GUISetOnEvent($GUI_EVENT_CLOSE, "Terminate", $pets)
   GUISetState()
EndIf

_IENavigate ($oIE, $site)

Stop()

Func Stop()
    While 1
    Sleep(100)
    WEnd
EndFunc
Func Terminate();Terminates the script
   Exit 0
EndFunc
Func Start();This is where all the core functions a called in an eternal loop
   If $usegui <> 1 then
       $oIE = _IEAttach ("Pet me")
   EndIf
   Opt("GUIOnEventMode", 1)
   _IELoadWait ($oIE)
   $sText = _IEPropertyGet($oIE,"innertext")   
   
   while 1 = 1      
        If StringRegExp($sText, 'Pet not showing up on your profile page?') = 0 then
            _IELoadWait ($oIE)
            Feed()
            _IELoadWait ($oIE)
            KillMonster()
            _IELoadWait ($oIE)
            FightorEvade()
            _IELoadWait ($oIE)
            fight()
            _IELoadWait ($oIE)     
        Else
            if StringRegExp($sText, 'You are currently fighting a') = 0 then 
                
                _IELinkClickByIndex ($oIE, 0)
                _IELoadWait ($oIE)     
                KillMonster()
                _IELoadWait ($oIE)
                fight()
                _IELoadWait ($oIE)
            Else                
                _IELoadWait ($oIE)     
                KillMonster()
                _IELoadWait ($oIE)
                fight()
                _IELoadWait ($oIE)          
            EndIf
       EndIf     
      
       If $usegui <> 1 then
           $oIE = _IEAttach ("Pet me")
       EndIf
       $sText = _IEPropertyGet($oIE,"innertext")
   WEnd
EndFunc
Func FightOrEvade()
   If $usegui <> 1 then
       $oIE = _IEAttach ("Pet me")
   EndIf
   $sText = _IEPropertyGet($oIE,"innertext")
   dim $iEnemyLvl
   dim $iPetLvl
   
    if StringRegExp($sText, 'You are currently fighting a ') = 0 then
    ; This loop keeps on going until a monster is chosen to be fought.
    ;A monster can only be an Ant and can only be 1 lvl higher
    $while = 0
    while $while = 0       
        ;This is where the decision begins
        If $usegui <> 1 then
            $oIE = _IEAttach ("Pet me")
        EndIf
        $sText = _IEPropertyGet($oIE,"innertext")
        $oTextTable = StringSplit (_IEPropertyGet($oIE,"innertext")," ")       
        $oPetName = $oTextTable[1]
          
        ;this is the only way i found to be able to get a
        ;specific text string (the levels) from the web page
        for $i = 2 to $oTextTable[0]
            if StringRegExp($oTextTable[$i], 'Level') then
                if StringRegExp($oTextTable[$i-2], 'encountered') = 0 Then           
                    if StringRegExp($oTextTable[$i-1], $oPetName)=0 Then   
                        $iEnemyLvl = $oTextTable[$i+1]
                        $iPetLvl = $oTextTable[$i+5]
                    EndIf
                EndIf
            EndIf   
        next   
      
        if StringRegExp($sText, 'Ant')  then     
            ;checks the level difference.
            ;If it is okay, the Fight it button is clicked
            ;If it is not okay, the Evade button is clicked
            $iLvlDiff = $iPetLvl - $iEnemyLvl         
            if $iLvlDiff > $antlvldif then               
                $while = 1       
                ;this is how i choose a specific button from the page
                $oForms = _IEFormGetCollection ($oIE,0)
                $oElement = _IEFormElementGetCollection($oForms,4)
              
                _IELoadWait ($oIE)
                _IEAction($oElement,"click")
                _IELoadWait ($oIE)
              
                If $usegui <> 1 then
                    $oIE = _IEAttach ("Pet me")
                EndIf   
                $sText = _IEPropertyGet($oIE,"innertext")
            Else
            ;this is how i choose a specific button from the page
                $oForms = _IEFormGetCollection ($oIE,1)
                $oElement = _IEFormElementGetCollection($oForms,2)
              
                _IELoadWait ($oIE)
                _IEAction($oElement,"click")       
                _IELoadWait ($oIE)
              
                If $usegui <> 1 then
                    $oIE = _IEAttach ("Pet me")
                EndIf   
                $sText = _IEPropertyGet($oIE,"innertext")
            EndIf
        Elseif StringRegExp($sText, 'Mantis')  then     
            ;checks the level difference.
            ;If it is okay, the Fight it button is clicked
            ;If it is not okay, the Evade button is clicked
            $iLvlDiff = $iPetLvl - $iEnemyLvl         
            if $iLvlDiff > $mantislvldif then               
                $while = 1       
                ;this is how i choose a specific button from the page
                $oForms = _IEFormGetCollection ($oIE,0)
                $oElement = _IEFormElementGetCollection($oForms,4)
              
                _IELoadWait ($oIE)
                _IEAction($oElement,"click")
                _IELoadWait ($oIE)
                
                If $usegui <> 1 then
                    $oIE = _IEAttach ("Pet me")
                EndIf   
                $sText = _IEPropertyGet($oIE,"innertext")
            Else
                ;this is how i choose a specific button from the page
                $oForms = _IEFormGetCollection ($oIE,1)
                $oElement = _IEFormElementGetCollection($oForms,2)
              
                _IELoadWait ($oIE)
                _IEAction($oElement,"click")       
                _IELoadWait ($oIE)
              
                If $usegui <> 1 then
                    $oIE = _IEAttach ("Pet me")
                EndIf   
                $sText = _IEPropertyGet($oIE,"innertext")
            EndIf
        Elseif StringRegExp($sText, 'Scorpion')  then     
            ;checks the level difference.
            ;If it is okay, the Fight it button is clicked
            ;If it is not okay, the Evade button is clicked
            $iLvlDiff = $iPetLvl - $iEnemyLvl         
            if $iLvlDiff > $scorpionlvldif then               
                $while = 1       
            ;this is how i choose a specific button from the page
                $oForms = _IEFormGetCollection ($oIE,0)
                $oElement = _IEFormElementGetCollection($oForms,4)
              
                _IELoadWait ($oIE)
                _IEAction($oElement,"click")
                _IELoadWait ($oIE)
              
                If $usegui <> 1 then
                   $oIE = _IEAttach ("Pet me")
                EndIf   
                $sText = _IEPropertyGet($oIE,"innertext")
            Else
                ;this is how i choose a specific button from the page
                $oForms = _IEFormGetCollection ($oIE,1)
                $oElement = _IEFormElementGetCollection($oForms,2)
              
                _IELoadWait ($oIE)
                _IEAction($oElement,"click")       
                _IELoadWait ($oIE)
              
                If $usegui <> 1 then
                   $oIE = _IEAttach ("Pet me")
                EndIf   
                $sText = _IEPropertyGet($oIE,"innertext")
           EndIf
        Elseif StringRegExp($sText, 'Spider')  then     
      
            ;checks the level difference.
            ;If it is okay, the Fight it button is clicked
            ;If it is not okay, the Evade button is clicked
            $iLvlDiff = $iPetLvl - $iEnemyLvl         
            if $iLvlDiff > $spiderlvldif then               
                $while = 1       
                ;this is how i choose a specific button from the page
                $oForms = _IEFormGetCollection ($oIE,0)
                $oElement = _IEFormElementGetCollection($oForms,4)
              
                _IELoadWait ($oIE)
                _IEAction($oElement,"click")
                _IELoadWait ($oIE)
              
                If $usegui <> 1 then
                   $oIE = _IEAttach ("Pet me")
                EndIf   
                $sText = _IEPropertyGet($oIE,"innertext")
            Else
                ;this is how i choose a specific button from the page
                $oForms = _IEFormGetCollection ($oIE,1)
                $oElement = _IEFormElementGetCollection($oForms,2)
              
                _IELoadWait ($oIE)
                _IEAction($oElement,"click")       
                _IELoadWait ($oIE)
              
                If $usegui <> 1 then
                   $oIE = _IEAttach ("Pet me")
                EndIf   
                $sText = _IEPropertyGet($oIE,"innertext")
            EndIf
        Else
            $iLvlDiff = $iPetLvl - $iEnemyLvl
            if $iLvlDiff > $otherlvldif then
                $while = 1       
                ;this is how i choose a specific button from the page
                $oForms = _IEFormGetCollection ($oIE,0)
                $oElement = _IEFormElementGetCollection($oForms,4)
          
                _IELoadWait ($oIE)
                _IEAction($oElement,"click")
                _IELoadWait ($oIE)
          
                If $usegui <> 1 then
                    $oIE = _IEAttach ("Pet me")
                EndIf   
                $sText = _IEPropertyGet($oIE,"innertext")
            Else           
                ;this is how i choose a specific button from the page
                $oForms = _IEFormGetCollection ($oIE,1)
                $oElement = _IEFormElementGetCollection($oForms,2)
              
                _IELoadWait ($oIE)
                _IEAction($oElement,"click")       
                _IELoadWait ($oIE)
              
                If $usegui <> 1 then
                   $oIE = _IEAttach ("Pet me")
                EndIf   
                $sText = _IEPropertyGet($oIE,"innertext")
                EndIf     
            EndIf
        WEnd 
    EndIf
EndFunc
Func Feed();Feeds until energy is full
    iniload()
    If $usegui <> 1 then
        $oIE = _IEAttach ("Pet me")
    EndIf   
    $sText = _IEPropertyGet($oIE,"innertext")   
    while StringRegExp($sText, 'Your pet has full hit points, no need to eat ') = 0         
        ;this is how i choose a specific button from the page
        $oForms = _IEFormGetCollection ($oIE,1)
        $oElement = _IEFormElementGetCollection($oForms,3)
        _IELoadWait ($oIE)
        _IEAction($oElement,"click")  
    
        if StringRegExp($sText, 'You are currently fighting a ') then ExitLoop
        $sText = _IEPropertyGet($oIE,"innertext")     
    WEnd
EndFunc
Func KillMonster();Click on the Kill monster button from the main page
   If $usegui <> 1 then
       $oIE = _IEAttach ("Pet me")
   EndIf
   $oForms = _IEFormGetCollection ($oIE,3)
   $oElement = _IEFormElementGetCollection($oForms,0)
   _IELoadWait ($oIE)
   _IEAction($oElement,"click")
   _IELoadWait ($oIE)
EndFunc
Func Fight();Fights until monster dies than loots Losing a battle is not an option...
  
    If $usegui <> 1 then
        $oIE = _IEAttach ("Pet me")
    EndIf
    $sText = _IEPropertyGet($oIE,"innertext")   
    while StringRegExp($sText, 'You have killed a|Pet not showing up|You have died') = 0  
    
        ;this is how i choose a specific button from the page
        $oForms = _IEFormGetCollection ($oIE,0)
        $oElement = _IEFormElementGetCollection($oForms,0) 
        _IEAction($oElement,"click")

        If StringRegExp($sText, 'Pet not showing up on your profile page?') Then ExitLoop
        If StringRegExp($sText, 'You have died') Then ExitLoop
        $sText = _IEPropertyGet($oIE,"innertext")     
    WEnd
    
    ;wait untill the page loads before click loot
    _IELoadWait ($oIE)
    
    if StringRegExp($sText, 'You have killed a') then
        ;this is how i choose a specific button from the page
        $oForms = _IEFormGetCollection ($oIE,0)
        $oElement = _IEFormElementGetCollection($oForms,4)
        _IELoadWait ($oIE)
        _IEAction($oElement,"click")
        _IELoadWait ($oIE)
        elseif StringRegExp($sText, 'Pet not showing up') then
        _IELinkClickByIndex ($oIE, 0)
        _IELoadWait ($oIE)     
        KillMonster()
        _IELoadWait ($oIE)
        fight()
       _IELoadWait ($oIE)
   EndIf
   
   If StringRegExp($sText, 'You have died') then
        $oForms = _IEFormGetCollection ($oIE,0)
        $oElement = _IEFormElementGetCollection($oForms,4)      
        _IELoadWait ($oIE)
        _IEAction($oElement,"click")
        _IELoadWait ($oIE)
   EndIf
EndFunc
Func _AdlibManager()
   Local $aSplit = StringSplit(GUICtrlRead($iCTime), ':')
   If $aSplit[0] >= 3 And (Int($aSplit[1]) >= _GetHour(@HOUR) _
       Or Int($aSplit[2]) >= @MIN Or Int(StringTrimRight($aSplit[3], 3)) > @SEC) Then _
       GUICtrlSetData($iCTime, 'Current Time' & @CRLF & _GetHour(@HOUR) & ':' & @MIN & ':' & @SEC & ' ' & $AMPM)
EndFunc
Func _GetHour($iHour)
   Switch $iHour
       Case 12
           $AMPM = 'PM'
           Return $iHour
       Case 13 To 23
           $AMPM = 'PM'
           Return $iHour - 12
       Case 0
           $AMPM = 'AM'
           Return 12
       Case 1 To 11
           $AMPM = 'AM'
           Return $iHour
   EndSwitch
EndFunc
Func _SwitchHour($iHour)
   Switch $iHour
       Case 12
           If $AMPM = 'AM' Then
               Return 0
           Else
               Return 12
           EndIf
       Case 1 To 11
           If $AMPM = 'PM' Then
               Return $iHour + 12
           Else
               Return $iHour
           EndIf
   EndSwitch
EndFunc
func iniload()
 ;Keys
       $usehotkeys = IniRead("zarox.ini", "keys", "usehotkeys", "1")
 ;Fight
       $antlvldif = IniRead("zarox.ini", "fight", "antleveldifference", "-2")
       $mantislvldif = IniRead("zarox.ini", "fight", "mantisleveldifference", "3")
       $spiderlvldif = IniRead("zarox.ini", "fight", "spiderleveldifference", "3")
       $scorpionlvldif = IniRead("zarox.ini", "fight", "scorpionleveldifference", "3")
       $otherlvldif = IniRead("zarox.ini", "fight", "otherleveldifference", "3")
 ;Other
       $site = IniRead("zarox.ini", "other", "petlink", "http://www.facebook.com")
       $usegui = IniRead("zarox.ini", "other", "usegui", "0")
      
       If $usehotkeys = 1 Then
           $endkey    = IniRead("zarox.ini", "keys", "closekey", "")
               HotKeySet($endkey, "Terminate")
           $startkey = IniRead("zarox.ini", "keys", "startkey", "")
               HotKeySet($startkey, "Start")
           $pausekey = IniRead("zarox.ini", "keys", "pausekey", "")
               HotKeySet($pausekey, "Stop")
       EndIf
EndFunc

and the ini, my ini was called zarox.ini you can change the name but u'll have to change the ini file name in the code also. else just name it zarox.ini. also u'll have to add your pet link in the ini.

here it is

CODE
[keys]

usehotkeys = 1

*** IF usehotkeys=1 then you have to set what keys you want to use. ***

*** the key you wish to use MUST have { } around it!! ***

*** Example: closekey={DEL} ***

closekey= {esc}

startkey = +!s

pausekey = +!p

[fight]

*** Lower the number the high level monster you attack ***

antleveldifference = 0

mantisleveldifference = 2

spiderleveldifference = 1

scorpionleveldifference = 4

otherleveldifference = 2

[other]

*** IF usegui=1 then a gui menu will open and you need to ***

*** paste your link in petlink.. IF usegui=0 then you have ***

*** to get your petlink and paste it in IE then start. ***

usegui = 1

petlink = ADD YOUR PET LINK HERE

have fun

Comments and suggestions are always welcomed

Lespoils

Link to comment
Share on other sites

well i ran it while i was out and i'm guessing it went for a while hahaha

Gold Armor of the Phantom (x 10)

edit* ok i got the error i had earlier figured out it was something with my version of flash

now the only thing is in the GUI the "Current Time" thing doesnt change, it just shows the time of when the script was started

also the pause/close buttons don't do anything :lmao:

edit#2* did a new test and with a little changing i am now leveling 2 pets at once :whistle:

Edited by gunnagitcha
Link to comment
Share on other sites

I had that problem aswell, hopefully reinstall flash stops it. Thanks for the update though. We know that the Current Time doesn't work, but it isn't on top priority at the moment.

yea the little out of memory on line 4 thing keeps happening lol so i guess it wasnt that

Link to comment
Share on other sites

hi, can u be more specific on the instructions? i can't get it to work some how, it says some error is on line 4 and the error returned was "unable to parse line" im a noob, i don't know much about this program so plz be more specific, thanx.

Link to comment
Share on other sites

hi,

about the instruction and the pet link:

you have to use firefox, go to your facebook pets then click somewhere in the frame where the game is and select this frame -> show this frame only. your pet link is now in the adress bar. copy that to a IE browser if u don't use the gui. wich i suggest, the gui ins't finished. so just copy the pet link into a broswer and in the ini file put "usegui = 0".

sorry about the lack of information.

About the line 4 error:

i think it's somthing new that facebook/eggmon put in to stop from using the script, tho i'm not sure as this never happened to me before and line 4 is "#include <Date.au3>" so i don't see why an error occurs there.

also sometimes you get the "cannot find page" in the browser, this is also something that didnt hapen earlier.

to be honest for now i have no plans of doing much work on the pet bot. but feel free to do any mods :) if you find work around about the line 4 or the cant find page glitches, post them ! If i do continue the bot, i will post it again. for sure :P

Lespoils

Link to comment
Share on other sites

everytime when i start this up i always get these errors

what do they mean?

--> IE.au3 Warning from function _IEFormGetCollection, $_IEStatus_NoMatch

--> IE.au3 Error from function _IEFormElementGetCollection, $_IEStatus_InvalidDataType

--> IE.au3 Error from function _IEAction, $_IEStatus_InvalidDataType

Link to comment
Share on other sites

  • 3 weeks later...

could somone tell me how to use this, it look were good, i am a beginner autoit writer (or what you call it) but i dont understand how to use this, i get

----> $IEComErrorSource =

----> $IEComErrorHelpFile =

----> $IEComErrorHelpContext = 0

----> $IEComErrorLastDllError = 0

when i run it, i dont know it thats good or bad, but i know that it does not do anything...

please help me understand this

thanks

Link to comment
Share on other sites

Better Version

#include <GUIConstants.au3>
#include <IE.au3>
#Include <Misc.au3>
#include <Date.au3>
#include <Array.au3>

Global $AMPM, $aSplit, $iCHK, $iCTime, $iPid
Global $Button2, $Button3, $pets, $oIE, $site, $file, $usegui
Global $otherlvldif

iniload()

_IEErrorHandlerRegister()
$oIE = _IECreateEmbedded()
If $usegui = 1 Then
    Opt("GUIOnEventMode", 1)
    $pets = GUICreate("Pet Me", 900, 584, _
            (@DesktopWidth - 1279) / 2, (@DesktopHeight - 797) / 2, _
            $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)
    $GUIActiveX = GUICtrlCreateObj($oIE, 5, 4, 730, 576)
    $Button1 = GUICtrlCreateButton("Start", 768, 495, 110, 25, 0)
    GUICtrlSetOnEvent(-1, "Start")
    $Button2 = GUICtrlCreateButton("Pause", 768, 525, 110, 25, 0)
    GUICtrlSetOnEvent(-1, "Stop")
    $Button3 = GUICtrlCreateButton("Close", 768, 555, 110, 25, 0)
    GUICtrlSetOnEvent($Button3, "Terminate")
    $iCTime = GUICtrlCreateLabel('Current Time' & @CRLF & _GetHour(@HOUR) & ':' & @MIN & ':' & @SEC & ' ' & $AMPM _
            , 776, 10, 80, 37, 0x01, BitOR($SS_CENTER, $SS_CENTERIMAGE))
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    GUISetState(@SW_SHOW)
    GUISetOnEvent($GUI_EVENT_CLOSE, "Terminate", $pets)
    GUISetState()
EndIf

_IENavigate($oIE, $site)

Stop()

Func Stop()
    While 1
        Sleep(100)
    WEnd
EndFunc  ;==>Stop
Func Terminate();Terminates the script
    Exit 0
EndFunc  ;==>Terminate
Func Start();This is where all the core functions a called in an eternal loop
    If $usegui <> 1 Then
        $oIE = _IEAttach("Pet me")
    EndIf
    Opt("GUIOnEventMode", 1)
    _IELoadWait($oIE)
    $sText = _IEPropertyGet($oIE, "innertext")

    While 1 = 1
        If StringRegExp($sText, 'Pet not showing up on your profile page?') = 0 Then
            _IELoadWait($oIE)
            Feed()
            _IELoadWait($oIE)
            KillMonster()
            _IELoadWait($oIE)
            FightOrEvade()
            _IELoadWait($oIE)
            Fight()
            _IELoadWait($oIE)
        Else
            If StringRegExp($sText, 'You are currently fighting a') = 0 Then

                _IELinkClickByIndex($oIE, 0)
                _IELoadWait($oIE)
                KillMonster()
                _IELoadWait($oIE)
                Fight()
                _IELoadWait($oIE)
            Else
                _IELoadWait($oIE)
                KillMonster()
                _IELoadWait($oIE)
                Fight()
                _IELoadWait($oIE)
            EndIf
        EndIf

        If $usegui <> 1 Then
            $oIE = _IEAttach("Pet me")
        EndIf
        $sText = _IEPropertyGet($oIE, "innertext")
    WEnd
EndFunc  ;==>Start
Func FightOrEvade()
    If $usegui <> 1 Then
        $oIE = _IEAttach("Pet me")
    EndIf
    $sText = _IEPropertyGet($oIE, "innertext")
    Dim $iEnemyLvl, $iEnemyName
    Dim $iPetLvl

    If StringRegExp($sText, 'You are currently fighting a ') = 0 Then
    ; This loop keeps on going until a monster is chosen to be fought.
    ;A monster can only be an Ant and can only be 1 lvl higher
        $while = 0
        While $while = 0
        ;This is where the decision begins
            If $usegui <> 1 Then
                $oIE = _IEAttach("Pet me")
            EndIf
            $sText = _IEPropertyGet($oIE, "innertext")
            $oTextTable = StringSplit(_IEPropertyGet($oIE, "innertext"), " ")
            $oPetName = $oTextTable[1]

        ;this is the only way i found to be able to get a
        ;specific text string (the levels) from the web page
            For $i = 2 To $oTextTable[0]
                If StringRegExp($oTextTable[$i], 'Level') Then
                    If StringRegExp($oTextTable[$i - 2], 'encountered') = 0 Then
                        If StringRegExp($oTextTable[$i - 1], $oPetName) = 0 Then
                            $iEnemyLvl = $oTextTable[$i + 1]
                            $iEnemyName = $oTextTable[$i + 2]
                            $iPetLvl = $oTextTable[$i + 5]
                        EndIf
                    EndIf
                EndIf
            Next

            $iLvlDiff = $iPetLvl - $iEnemyLvl
            If $iLvlDiff >= IniRead('zarox.ini', 'fight', $iEnemyName, $otherlvldif) Then
                $while = 1
            ;this is how i choose a specific button from the page
                $oForms = _IEFormGetCollection($oIE, 0)
                $oElement = _IEFormElementGetCollection($oForms, 4)

                _IELoadWait($oIE)
                _IEAction($oElement, "click")
                _IELoadWait($oIE)

                If $usegui <> 1 Then
                    $oIE = _IEAttach("Pet me")
                EndIf
                $sText = _IEPropertyGet($oIE, "innertext")
            Else
            ;this is how i choose a specific button from the page
                $oForms = _IEFormGetCollection($oIE, 1)
                $oElement = _IEFormElementGetCollection($oForms, 2)

                _IELoadWait($oIE)
                _IEAction($oElement, "click")
                _IELoadWait($oIE)

                If $usegui <> 1 Then
                    $oIE = _IEAttach("Pet me")
                EndIf
                $sText = _IEPropertyGet($oIE, "innertext")
            EndIf
        WEnd
    EndIf
EndFunc  ;==>FightOrEvade
Func Feed();Feeds until energy is full
    iniload()
    If $usegui <> 1 Then
        $oIE = _IEAttach("Pet me")
    EndIf
    $sText = _IEPropertyGet($oIE, "innertext")
    While StringRegExp($sText, 'Your pet has full hit points, no need to eat ') = 0
    ;this is how i choose a specific button from the page
        $oForms = _IEFormGetCollection($oIE, 1)
        $oElement = _IEFormElementGetCollection($oForms, 3)
        _IELoadWait($oIE)
        _IEAction($oElement, "click")

        If StringRegExp($sText, 'You are currently fighting a ') Then ExitLoop
        $sText = _IEPropertyGet($oIE, "innertext")
    WEnd
EndFunc  ;==>Feed
Func KillMonster();Click on the Kill monster button from the main page
    If $usegui <> 1 Then
        $oIE = _IEAttach("Pet me")
    EndIf
    $oForms = _IEFormGetCollection($oIE, 3)
    $oElement = _IEFormElementGetCollection($oForms, 0)
    _IELoadWait($oIE)
    _IEAction($oElement, "click")
    _IELoadWait($oIE)
EndFunc  ;==>KillMonster
Func Fight();Fights until monster dies than loots Losing a battle is not an option...

    If $usegui <> 1 Then
        $oIE = _IEAttach("Pet me")
    EndIf
    $sText = _IEPropertyGet($oIE, "innertext")
    While StringRegExp($sText, 'You have killed a|Pet not showing up|You have died') = 0

    ;this is how i choose a specific button from the page
        $oForms = _IEFormGetCollection($oIE, 0)
        $oElement = _IEFormElementGetCollection($oForms, 0)
        _IEAction($oElement, "click")

        If StringRegExp($sText, 'Pet not showing up on your profile page?') Then ExitLoop
        If StringRegExp($sText, 'You have died') Then ExitLoop
        $sText = _IEPropertyGet($oIE, "innertext")
    WEnd

;wait untill the page loads before click loot
    _IELoadWait($oIE)

    If StringRegExp($sText, 'You have killed a') Then
    ;this is how i choose a specific button from the page
        $oForms = _IEFormGetCollection($oIE, 0)
        $oElement = _IEFormElementGetCollection($oForms, 4)
        _IELoadWait($oIE)
        _IEAction($oElement, "click")
        _IELoadWait($oIE)
    ElseIf StringRegExp($sText, 'Pet not showing up') Then
        _IELinkClickByIndex($oIE, 0)
        _IELoadWait($oIE)
        KillMonster()
        _IELoadWait($oIE)
        Fight()
        _IELoadWait($oIE)
    EndIf

    If StringRegExp($sText, 'You have died') Then
        $oForms = _IEFormGetCollection($oIE, 0)
        $oElement = _IEFormElementGetCollection($oForms, 4)
        _IELoadWait($oIE)
        _IEAction($oElement, "click")
        _IELoadWait($oIE)
    EndIf
EndFunc  ;==>Fight
Func _AdlibManager()
    Local $aSplit = StringSplit(GUICtrlRead($iCTime), ':')
    If $aSplit[0] >= 3 And (Int($aSplit[1]) >= _GetHour(@HOUR) _
            Or Int($aSplit[2]) >= @MIN Or Int(StringTrimRight($aSplit[3], 3)) > @SEC) Then _
            GUICtrlSetData($iCTime, 'Current Time' & @CRLF & _GetHour(@HOUR) & ':' & @MIN & ':' & @SEC & ' ' & $AMPM)
EndFunc  ;==>_AdlibManager
Func _GetHour($iHour)
    Switch $iHour
        Case 12
            $AMPM = 'PM'
            Return $iHour
        Case 13 To 23
            $AMPM = 'PM'
            Return $iHour - 12
        Case 0
            $AMPM = 'AM'
            Return 12
        Case 1 To 11
            $AMPM = 'AM'
            Return $iHour
    EndSwitch
EndFunc  ;==>_GetHour
Func _SwitchHour($iHour)
    Switch $iHour
        Case 12
            If $AMPM = 'AM' Then
                Return 0
            Else
                Return 12
            EndIf
        Case 1 To 11
            If $AMPM = 'PM' Then
                Return $iHour + 12
            Else
                Return $iHour
            EndIf
    EndSwitch
EndFunc  ;==>_SwitchHour
Func iniload()
;Keys
    $usehotkeys = IniRead("zarox.ini", "keys", "usehotkeys", "1")
;Fight
    $otherlvldif = IniRead("zarox.ini", "fight", "leveldifference", "2")
;Other
    $site = IniRead("zarox.ini", "other", "petlink", "http://www.facebook.com")
    $usegui = IniRead("zarox.ini", "other", "usegui", "0")

    If $usehotkeys = 1 Then
        $endkey = IniRead("zarox.ini", "keys", "closekey", "")
        HotKeySet($endkey, "Terminate")
        $startkey = IniRead("zarox.ini", "keys", "startkey", "")
        HotKeySet($startkey, "Start")
        $pausekey = IniRead("zarox.ini", "keys", "pausekey", "")
        HotKeySet($pausekey, "Stop")
    EndIf
EndFunc  ;==>iniload

[keys]
usehotkeys = 1
*** IF usehotkeys=1 then you have to set what keys you want to use. ***
*** the key you wish to use MUST have { } around it!! ***
*** Example: closekey={DEL} ***
closekey= {esc}
startkey = +!s
pausekey = +!p

[fight]
*** Lower the number the high level monster you attack ***
leveldifference = 3
; Our - Enemy = 3 or Less

; For Some Moster You Can Put A Name I Here
Ant = -2

[other]
*** IF usegui=1 then a gui menu will open and you need to ***
*** paste your link in petlink.. IF usegui=0 then you have ***
*** to get your petlink and paste it in IE then start. ***
usegui = 1
petlink = http://www.eggmon.com/showpet?pid=
Edited by athiwatc
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...