; Player info bot by DaveMcW ; Version 1.07 ; Get the latest version at http://davemcw.freeservers.com/archspace/bot/ ; ; Save this file to your mirc directory ; To install, type /load -rs c:\mirc\playerinfo.txt ; To uninstall, type /unload -rs playerinfo.txt ; ; ; Commands are: ; ; /pp login PortalName password ; Log into the server (only needed once) ; ; /pp on ; Turn the bot on in the channel ; ; /pp off ; Turn the bot off in the channel ; ; /pp 123 ; Get info on player #123 ; ; /cc 123 ; Look up council #123 ; ; /cm 123 ; Get council #123's member list ; ; /pn abc ; Look up players with 'abc' in their name ; ; /cn abc ; Look up councils with 'abc' in their name ; ; /pr 123 ; /br 123 ; Get player #123's recent battles ; ; /cr 123 ; Get council #123's recent battles (not working yet) ; ; Script data begins on 1:TEXT:!pp*:#:{ if ( [ % $+ [ ppBotEnabled $+ [ $chan ] ] ] == $null ) { halt } if ( %ppBotInProgress != $null ) { halt } if $isnotnum($2) || $2 == 0 || $2 > 999999 { notice $nick You should enter a player number. For example, !pp 123 return } %ppBotChannel = $chan set -u30 %ppBotInProgress 1 ppBotLookupPlayerId $2 } on 1:TEXT:!pn*:#:{ if ( [ % $+ [ ppBotEnabled $+ [ $chan ] ] ] == $null ) { halt } if ( %ppBotInProgress != $null ) { halt } if $2 == $null { notice $nick You should enter a player name. For example, !pn Joe return } %ppBotChannel = $chan set -u30 %ppBotInProgress 1 ppBotLookupPlayerName $2- } on 1:TEXT:!cc*:#:{ if ( [ % $+ [ ppBotEnabled $+ [ $chan ] ] ] == $null ) { halt } if ( %ppBotInProgress != $null ) { halt } if $isnotnum($2) || $2 == 0 || $2 > 999999 { notice $nick You should enter a council number. For example, !cc 123 return } %ppBotChannel = $chan set -u30 %ppBotInProgress 1 ppBotLookupCouncilId $2 } on 1:TEXT:!cm*:#:{ if ( [ % $+ [ ppBotEnabled $+ [ $chan ] ] ] == $null ) { halt } if ( %ppBotInProgress != $null ) { halt } if $isnotnum($2) || $2 == 0 || $2 > 999999 { notice $nick You should enter a council number. For example, !cm 123 return } %ppBotChannel = $chan set -u30 %ppBotInProgress 1 ppBotLookupCouncilMembers $2 } on 1:TEXT:!cn*:#:{ if ( [ % $+ [ ppBotEnabled $+ [ $chan ] ] ] == $null ) { halt } if ( %ppBotInProgress != $null ) { halt } if $2 == $null { notice $nick You should enter a council name. For example, !cn EGAD return } %ppBotChannel = $chan set -u30 %ppBotInProgress 1 ppBotLookupCouncilName $2- } on 1:TEXT:!br*:#:{ if ( [ % $+ [ ppBotEnabled $+ [ $chan ] ] ] == $null ) { halt } if ( %ppBotInProgress != $null ) { halt } if $isnotnum($2) || $2 > 999999 { notice $nick You should enter a player number. For example, !cm 123 return } %ppBotChannel = $chan set -u30 %ppBotInProgress 1 ppBotLookupPlayerReports $2 } on 1:TEXT:!pr*:#:{ if ( [ % $+ [ ppBotEnabled $+ [ $chan ] ] ] == $null ) { halt } if ( %ppBotInProgress != $null ) { halt } if $isnotnum($2) || $2 > 999999 { notice $nick You should enter a player number. For example, !cm 123 return } %ppBotChannel = $chan set -u30 %ppBotInProgress 1 ppBotLookupPlayerReports $2 } on 1:TEXT:!cr*:#:{ if ( [ % $+ [ ppBotEnabled $+ [ $chan ] ] ] == $null ) { halt } if ( %ppBotInProgress != $null ) { halt } if $isnotnum($2) || $2 > 999999 { notice $nick You should enter a council number. For example, !cm 123 return } %ppBotChannel = $chan set -u30 %ppBotInProgress 1 ppBotLookupCouncilReports $2 } alias /pp { %ppBotChannel = $chan if ( $1 == login ) { ppBotLogin $2- return } if ( $1 == on ) { set %ppBotEnabled $+ [ $chan ] 1 msg %ppBotChannel The player info bot is [on] return } if ( $1 == off ) { unset %ppBotEnabled $+ [ $chan ] msg %ppBotChannel The player info bot is [off] return } if ( [ % $+ [ ppBotEnabled $+ [ $chan ] ] ] == $null ) { echo %ppBotChannel You need to turn the bot on, type /pp on return } if ( %ppBotInProgress != $null ) { return } if $isnotnum($1) || $1 == 0 || $1 > 999999 { echo %ppBotChannel You should enter a player number. For example, !pp 123 return } set -u30 %ppBotInProgress 1 ppBotLookupPlayerId $1 } alias /pn { if ( [ % $+ [ ppBotEnabled $+ [ $chan ] ] ] == $null ) { echo You need to turn the bot on, type /pp on return } if ( %ppBotInProgress != $null ) { return } if $1 == $null { echo You should enter a player name. For example, !pn Joe return } %ppBotChannel = $chan set -u30 %ppBotInProgress 1 ppBotLookupPlayerName $1- } alias /cc { if ( [ % $+ [ ppBotEnabled $+ [ $chan ] ] ] == $null ) { echo You need to turn the bot on, type /pp on return } if ( %ppBotInProgress != $null ) { return } if $isnotnum($1) || $1 == 0 || $1 > 999999 { echo You should enter a council number. For example, !cc 123 return } %ppBotChannel = $chan set -u30 %ppBotInProgress 1 ppBotLookupCouncilId $1 } alias /pr { if ( [ % $+ [ ppBotEnabled $+ [ $chan ] ] ] == $null ) { echo You need to turn the bot on, type /pp on return } if ( %ppBotInProgress != $null ) { return } if $isnotnum($1) || $1 > 999999 { echo You should enter a player number. For example, !cc 123 return } %ppBotChannel = $chan set -u30 %ppBotInProgress 1 ppBotLookupPlayerReports $1 } alias /br { if ( [ % $+ [ ppBotEnabled $+ [ $chan ] ] ] == $null ) { echo You need to turn the bot on, type /pp on return } if ( %ppBotInProgress != $null ) { return } if $isnotnum($1) || $1 > 999999 { echo You should enter a player number. For example, !cc 123 return } %ppBotChannel = $chan set -u30 %ppBotInProgress 1 ppBotLookupPlayerReports $1 } alias /cr { if ( [ % $+ [ ppBotEnabled $+ [ $chan ] ] ] == $null ) { echo You need to turn the bot on, type /pp on return } if ( %ppBotInProgress != $null ) { return } if $isnotnum($1) || $1 > 999999 { echo You should enter a council number. For example, !cc 123 return } %ppBotChannel = $chan set -u30 %ppBotInProgress 1 ppBotLookupCouncilReports $1 } alias /cm { if ( [ % $+ [ ppBotEnabled $+ [ $chan ] ] ] == $null ) { echo You need to turn the bot on, type /pp on return } if ( %ppBotInProgress != $null ) { return } if $isnotnum($1) || $1 == 0 || $1 > 999999 { echo You should enter a council number. For example, !cm 123 return } %ppBotChannel = $chan set -u30 %ppBotInProgress 1 ppBotLookupCouncilMembers $1 } alias /cn { if ( [ % $+ [ ppBotEnabled $+ [ $chan ] ] ] == $null ) { echo You need to turn the bot on, type /pp on return } if ( %ppBotInProgress != $null ) { return } if $1 == $null { echo You should enter a council name. For example, !cn EGAD return } %ppBotChannel = $chan set -u30 %ppBotInProgress 1 ppBotLookupCouncilName $1- } alias -l /inGtLt { var %aaTemp1 = $pos( $2, < $+ $1 ) var %aaTemp2 = $calc(%aaTemp1 + $pos($right($2, $calc($len($2)-%aaTemp1)), >) + 1) var %aaTemp3 = $calc( $pos($2, ) - %aaTemp2) if (%aaTemp3 <= 0) %aaTemp3 = $len($2) var %aaTemp4 = $mid( $2, %aaTemp2, %aaTemp3 ) var %aaTemp5 = $remove( %aaTemp4,   ) return $replace( %aaTemp5, >, >, <, <, &gt;, >, &lt;, <, ", $chr(34) ) } alias -l /convertGtLt { return $replace( $1-, >, &gt;, <, &lt; ) } alias -l /isnotnum { if ( $1 == $null ) return $true var %aaTemp1 = 1 :start if ( $asc( $mid( $1, %aaTemp1, 1 ) ) < 48 || $asc( $mid( $1, %aaTemp1, 1 ) ) > 57 ) { return $true } inc %aaTemp1 if ( %aaTemp1 <= $len($1) ) { goto start } return $false } alias -l /addcommas { if $isnotnum($1) { return $1 } if $len($1) < 4 { return $1 } var %aaTemp1 = $1 var %aaTemp2 = $right(%aaTemp1,3) %aaTemp1 = $left( $1, $calc($len(%aaTemp1)-3) ) :start if ( $len(%aaTemp1) < 4 ) return %aaTemp1 $+ , $+ %aaTemp2 %aaTemp2 = $right(%aaTemp1,3) $+ , $+ %aaTemp2 %aaTemp1 = $left( $1, $calc($len(%aaTemp1)-3) ) goto start } alias -l /raceColor { if $1 == Agerus { return 5 } if $1 == Bosalian { return 7 } if $1 == Buckaneer { return 14 } if $1 == Evintos { return 4 } if $1 == Human { return 2 } if $1 == Targoid { return 3 } if $1 == Tecanoid { return 12 } if $1 == Xeloss { return 6 } if $1 == Xerusian { return 10 } if $1 == Xesperados { return 9 } return 1 } alias -l /playerNumber { return $remove( $mid( $1-, $calc( $pos($1-, $chr(35)) + 1 ), 10 ), $chr(41) ) } alias -l /readCookie { if ( $pos( $1-, Set-Cookie: ID_STRING ) != $null ) %ppBotcookieID_STRING = $remove( $1-, Set-Cookie: $+ $chr(32), ; path=/; domain= $+ %ppBotServer ) else if ( $pos( $1-, Set-Cookie: NAME ) != $null ) %ppBotcookieNAME = $remove( $1-, Set-Cookie: $+ $chr(32), ; path=/; domain= $+ %ppBotServer ) else if ( $pos( $1-, Set-Cookie: ID ) != $null ) %ppBotcookieID = $remove( $1-, Set-Cookie: $+ $chr(32), ; path=/; domain= $+ %ppBotServer ) else if ( $pos( $1-, Set-Cookie: AS_STRING ) != $null ) %ppBotcookieAS_STRING = $remove( $1-, Set-Cookie: $+ $chr(32), ; path=/; domain= $+ %ppBotServer ) } alias /ppBotLookupPlayerId { unset %ppBotResult* %ppBotMode = pp %ppBotId = $1 %ppBotMethod = POST %ppBotPage = /archspace/info/player_search.as %ppBotInput = BY_WHAT=PLAYER_ID&PLAYER_ID= $+ %ppBotId sockclose ppBotSocket sockopen ppBotSocket %ppBotServer 80 } alias -l /ppBotReadPlayerId { if ( $pos( $1-, BGCOLOR="#171717">  ) != $null ) { %ppBotResultMode = $inGtLt(td, $1-) } else if ( $pos( $1-, CLASS="tabletxt" ) != $null ) { set %ppBotResult $+ [ %ppBotResultMode ] $inGtLt(td, $1-) } else if ( $pos( $1-, not_logged_in.html ) != $null ) { set %ppBotResultNotFound 1 } else if ( $1 == ) { if ( %ppBotResultName != $null ) { msg %ppBotChannel $& %ppBotResultRanking  $+ $raceColor(%ppBotResultRace) $& %ppBotResultName $&  %ppBotResultPlanets $&  %ppBotResultPower $&  %ppBotResultCouncil $&  $chr(91) $+ $addcommas($int($calc(0.5 + 0.5 * $remove(%ppBotResultPower, $chr(44))))) $+ - $+ $addcommas($calc(2 * $remove(%ppBotResultPower, $chr(44)))) $+ $chr(93) } else { if (%ppBotResultNotFound == 1) { msg %ppBotChannel Could not log in to archspace server. } else { msg %ppBotChannel Player $chr(35) $+ %ppBotId doesn't exist. } } unset %ppBotInProgress } } alias /ppBotLookupPlayerName { unset %ppBotResult* %ppBotMode = pn %ppBotName = $1- %ppBotMethod = POST %ppBotPage = /archspace/info/player_search.as %ppBotInput = BY_WHAT=PLAYER_NAME&PLAYER_NAME= $+ $convertGtLt(%ppBotName) sockclose ppBotSocket sockopen ppBotSocket %ppBotServer 80 } alias -l /ppBotReadPlayerName { if ( $pos( $1-,   ) != $null ) { %ppBotResultMode = $remove( $inGtLt(td, $1-), Council $+ $chr(32) ) } else if ( $pos( $1-, ) != $null ) { set %ppBotResultMode MemberList } else if ( $pos( $1-, CLASS="tabletxt" WIDTH="352" ) != $null ) { set %ppBotResult $+ [ %ppBotResultMode ] $inGtLt(td, $1-) } else if ( $pos( $1-, CLASS="tabletxt" WIDTH="151" ) != $null ) { if %ppBotResultCount == $null { %ppBotResultCount = 0 } else { inc %ppBotResultCount set %ppBotResultName $+ [ %ppBotResultCount ] $inGtLt(td, $1-) } } else if ( $pos( $1-, CLASS="tabletxt" WIDTH="82" ) != $null ) { if %ppBotResultCount > 0 { set %ppBotResultColor $+ [ %ppBotResultCount ] $raceColor($inGtLt(td, $1-)) } } else if ( $pos( $1-, CLASS="tabletxt" WIDTH="80" ) != $null ) { if %ppBotResultCount > 0 { set %ppBotResultPower $+ [ %ppBotResultCount ] $remove($inGtLt(td, $1-), $chr(44)) } } else if ( $pos( $1-, not_logged_in.html ) != $null ) { set %ppBotResultNotFound 1 } else if ( $1 == ) { var %g, %h, %i, %j, %tempName, %tempColor, %tempPower %i = 1 while ( %i <= %ppBotResultCount ) { %j = $calc( %i + 1 ) %g = %i %h = [ % $+ [ ppBotResultPower $+ [ %i ] ] ] while ( %j <= %ppBotResultCount ) { if %h < [ % $+ [ ppBotResultPower $+ [ %j ] ] ] { %h = [ % $+ [ ppBotResultPower $+ [ %j ] ] ] %g = %j } inc %j } if %g != %i { set %tempName [ % $+ [ ppBotResultName $+ [ %i ] ] ] set %tempColor [ % $+ [ ppBotResultColor $+ [ %i ] ] ] set %tempPower [ % $+ [ ppBotResultPower $+ [ %i ] ] ] set % $+ [ ppBotResultName $+ [ %i ] ] [ % $+ [ ppBotResultName $+ [ %g ] ] ] set % $+ [ ppBotResultColor $+ [ %i ] ] [ % $+ [ ppBotResultColor $+ [ %g ] ] ] set % $+ [ ppBotResultPower $+ [ %i ] ] [ % $+ [ ppBotResultPower $+ [ %g ] ] ] set % $+ [ ppBotResultName $+ [ %g ] ] %tempName set % $+ [ ppBotResultColor $+ [ %g ] ] %tempColor set % $+ [ ppBotResultPower $+ [ %g ] ] %tempPower } inc %i } %ppBotResultPower = 0 %i = 1 while ( %i <= %ppBotResultCount ) { if %i > 1 { %ppBotResultString = %ppBotResultString  } %ppBotResultString = %ppBotResultString $+  $+ [ % $+ [ ppBotResultColor $+ [ %i ] ] ] [ % $+ [ ppBotResultName $+ [ %i ] ] ] $addcommas( [ % $+ [ ppBotResultPower $+ [ %i ] ] ] ) $+  %ppBotResultString = $left( %ppBotResultString, 800 ) %ppBotResultPower = $calc( %ppBotResultPower + [ % $+ [ ppBotResultPower $+ [ %i ] ] ] ) if ( %ppBotResultSpeaker == [ % $+ [ ppBotResultName $+ [ %i ] ] ] ) { %ppBotResultSpeakerIndex = %i } inc %i } if ( %ppBotResultName != $null ) { if ( %ppBotMode == cm ) { msg %ppBotChannel %ppBotResultString } else if ( %ppBotMode == cc ) { msg %ppBotChannel %ppBotResultName  %ppBotResultMembers  $addcommas( %ppBotResultPower )  $+ [ % $+ [ ppBotResultColor $+ [ %ppBotResultSpeakerIndex ] ] ] %ppBotResultSpeaker  %ppBotResultSlogan } } else { if (%ppBotResultNotFound == 1) { msg %ppBotChannel Could not log in to archspace server. } else { msg %ppBotChannel Council $chr(35) $+ %ppBotId doesn't exist. } } unset %ppBotInProgress } } alias /ppBotLookupCouncilName { unset %ppBotResult* %ppBotMode = cn %ppBotName = $1- %ppBotMethod = POST %ppBotPage = /archspace/info/council_search.as %ppBotInput = BY_WHAT=COUNCIL_NAME&COUNCIL_NAME= $+ $convertGtLt(%ppBotName) sockclose ppBotSocket sockopen ppBotSocket %ppBotServer 80 } alias -l /ppBotReadCouncilName { if ( $pos( $1-, Result ) != $null ) { %ppBotResultMode = 1 } else if ( $pos( $1-, CLASS="tabletxt" ALIGN="CENTER"> ) != $null ) { if %ppBotResultMode == 1 { inc %ppBotResultCount set %ppBotResultAttacker $+ [ %ppBotResultCount ] $inGtLt(td, $1-) } if %ppBotResultMode == 2 { set %ppBotResultDefender $+ [ %ppBotResultCount ] $inGtLt(td, $1-) } if %ppBotResultMode == 3 { set %ppBotResultType $+ [ %ppBotResultCount ] $inGtLt(td, $1-) } if %ppBotResultMode == 4 { set %ppBotResultResult $+ [ %ppBotResultCount ] $inGtLt(td, $1-) } inc %ppBotResultMode if %ppBotResultMode >= 5 { %ppBotResultMode = 1 } } else if ( $pos( $1-, not_logged_in.html ) != $null ) { set %ppBotResultNotFound 1 } else if ( $1 == ) { var %i = 0 var %last, %count, %battle, %s, %color, %stringcount, %lastcolor while ( %i <= $calc(%ppBotResultCount + 1) ) { if ( %last != %battle || %lastcolor != %color ) { if %stringcount > 1 { %ppBotResultString = %ppBotResultString $+ , } if %count > 1 { %s = %last x $+ %count } else { %s = %last } if %lastcolor != $null { %s = %lastcolor %s $+  } else { %s = $chr(32) $+ %s } %ppBotResultString = $left( %ppBotResultString $+ %s , 800 ) %count = 1 inc %stringcount } else { inc %count } %last = %battle %lastcolor = %color inc %i var %attacker = [ % $+ [ ppBotResultAttacker $+ [ %i ] ] ] var %defender = [ % $+ [ ppBotResultDefender $+ [ %i ] ] ] if $playerNumber(%attacker) == %ppBotId { %battle = %defender } else { %battle = %attacker } unset %color if ( [ % $+ [ ppBotResultResult $+ [ %i ] ] ] == Attacker Win ) { if %battle == %attacker { %color = 4 } else if %battle == %defender { %color = 3 } echo %color %battle } } if (%ppBotResultCount > 0) { msg %ppBotChannel %ppBotResultString } else if (%ppBotResultNotFound == 1) { msg %ppBotChannel Could not log in to archspace server. } else { msg %ppBotChannel Player $chr(35) $+ %ppBotId has no reports. } unset %ppBotInProgress } } alias /ppBotLookupCouncilReports { unset %ppBotInProgress return } alias -l /ppBotLogin { %ppBotServer = as.mlsecurity.com %ppBotMode = login %ppBotMethod = POST %ppBotPage = /login.php %ppBotInput = username= $+ $1 $+ &password= $+ $2 sockclose ppBotSocket sockopen ppBotSocket %ppBotServer 80 } alias -l /ppBotLoginResult { if ( $pos( $1-, Content-Type: text/html ) != $null ) { .timer2 1 1 ppBotLogin2 unset %ppBotInput } } alias /ppBotLogin2 { %ppBotMode = login2 %ppBotMethod = GET %ppBotPage = /archspace/login.as sockclose ppBotSocket sockopen ppBotSocket %ppBotServer 80 } alias -l /ppBotLoginResult2 { if ( $pos( $1-, Entering Archspace. Please wait... ) != $null ) { echo %ppBotChannel Login successful. } } on *:SOCKOPEN:ppBotSocket: { sockwrite -n $sockname %ppBotMethod %ppBotPage HTTP/1.1 if (%ppBotMethod == POST) { sockwrite -n $sockname Content-Type: application/x-www-form-urlencoded sockwrite -n $sockname Content-Length: $len(%ppBotInput) } sockwrite -n $sockname Host: %ppBotServer ;sockwrite -n $sockname Connection: Keep-Alive sockwrite -n $sockname Cookie: %ppBotcookieID_STRING $+ ; %ppBotcookieNAME $+ ; %ppBotcookieID $+ ; %ppBotcookieAS_STRING sockwrite -n $sockname if (%ppBotMethod == POST) { sockwrite -nt $sockname %ppBotInput } sockwrite $sockname $crlf } on *:SOCKREAD:ppBotSocket: { if ($sockerr > 0) { echo Could not connect to archspace server. } :nextread set %ppBotResultLine3 %ppBotResultLine2 set %ppBotResultLine2 %ppBotResultLine1 sockread %ppBotResultLine1 if ($sockbr == 0) { set %ppBotResultLine1 %ppBotResultLine2 set %ppBotResultLine2 %ppBotResultLine3 return } readCookie %ppBotResultLine1 if $len(%ppBotResultLine2) == 3 && %ppBotResultLine2 !=
set %ppBotResultLine3 } ;echo : %ppBotResultLine3 if %ppBotMode == login { ppBotLoginResult %ppBotResultLine3 } else if %ppBotMode == login2 { ppBotLoginResult2 %ppBotResultLine3 } else if %ppBotMode == pp { ppBotReadPlayerId %ppBotResultLine3 } else if %ppBotMode == pn { ppBotReadPlayerName %ppBotResultLine3 } else if %ppBotMode == pr { ppBotReadPlayerReports %ppBotResultLine3 } else if %ppBotMode == cc { ppBotReadCouncilId %ppBotResultLine3 } else if %ppBotMode == cm { ppBotReadCouncilId %ppBotResultLine3 } else if %ppBotMode == cn { ppBotReadCouncilName %ppBotResultLine3 } goto nextread }