; Arena Bot Script by DaveMcW
; Version 1.07
; Get the latest version at www.davemcw.freeservers.com/archmage/
;
;
;
; Installation:
;
; Save this file into your mIRC directory
; In your mIRC status window type: /load -rs c:\mirc\arena.txt
;
; To uninstall, type /unload -rs arena.txt
;
;
;
; Owner commands:
;
; /aa on
; Turns the bot on in the current channel.
;
; /aa on b2
; Turns the bot on and sets the default server to b2.
; Currently supported default servers are: s1, s2, a1, a2, b1, b2, b3, be, ap, es, de, jp, cn.
;
; /aa off
; Turns the bot off in the current channel.
;
; /aa 123
; Looks up mage #123 on the default server.
;
; /aa 123 b2
; Looks up mage #123 on b2.
;
; /ad 123
; Reads mage #123's description on the default server.
;
; /ad 123 b2
; Reads mage #123's description on b2.
;
; /ad 123 b2
; Repeating the command will display the rest of the description that was cut off by flood control.
;
; /an will
; Displays the first 10 mages on the default server whose name contains 'will'.
;
; /an you will be
; Displays the first 10 mages on beta whose name contains 'you will'.
;
; /an you_will_be
; Displays the first 10 mages on the default server whose name contains 'you will be'.
;
;
;
; User commands:
;
; !aa 123
; Looks up mage #123 on the default server.
;
; !aa 123 b2
; Looks up mage #123 on b2.
; Only the first 2 letters of the server name are read.
; In addition to the default servers, the bot also recognizes: sg, sn, ag, an, bg, bn, bs, spanish, german, japanese, chinese.
;
; !ad 123
; Reads mage #123's description on the default server.
;
; !ad 123 b2
; Reads mage #123's description on b2.
;
; !ad 123 b2
; Repeating the command will display the rest of the description that was cut off by flood control.
;
; !an will
; Displays the first 10 mages on the default server whose name contains 'will'.
;
; !an you will be
; Displays the first 10 mages on beta whose name contains 'you will'.
;
; !an you_will_be
; Displays the first 10 mages on the default server whose name contains 'you will be'.
;
;
;
; Notes:
;
; To prevent flooding, the bot ignores all requests while it is looking up a mage. Just wait a bit and try again if it isn't responding.
; Sometimes it can take up to a minute for the bot to realize the server is down.
; If the bot is extremely lagged, it can give strange results as two lookups collide.
; DaveMcW will NOT help you if you attempt to modify the code here.
;Script data begins
alias /aa {
%aaChannel = $chan
%aaUser = $me
if ( $1 == on ) {
unset %aaInProgress
var %tempServer = $2
if ( [ % $+ [ aaBotEnabled $+ [ %aaChannel ] ] ] != $null ) {
if ( $2 == $null ) { echo The arena bot is already on in %aaChannel $+ . Default server is [ % $+ [ aaBotEnabled $+ [ %aaChannel ] ] ] | return }
set [ % $+ [ aaBotEnabled $+ [ %aaChannel ] ] ] %tempServer
echo Default server is %tempServer
return
}
else {
if ( %tempServer == $null ) { %tempServer = [none] }
set [ % $+ [ aaBotEnabled $+ [ %aaChannel ] ] ] %tempServer
msg %aaChannel The arena bot is [on] ***Arena script by DaveMcW***
return
}
}
if ( $1 == off ) {
if ( [ % $+ [ aaBotEnabled $+ [ %aaChannel ] ] ] == $null ) {
echo The arena bot is already off in %aaChannel
return
}
unset %aaBotEnabled $+ [ %aaChannel ]
msg %aaChannel The arena bot is [off]
return
}
if ( [ % $+ [ aaBotEnabled $+ [ %aaChannel ] ] ] == $null ) {
echo To activate the arena bot in this channel type /aa on
return
}
if ( %aaInProgress != $null ) halt
if $isnotnum($1) || $1 == 0 {
echo You should enter a mage number. For example, !aa 123
return
}
%aaMethod = aa
aaBot $1 $2
}
alias /ad {
if ( [ % $+ [ aaBotEnabled $+ [ $chan ] ] ] == $null ) { halt }
if ( %aaInProgress != $null ) { halt }
if $isnotnum($1) || $1 == 0 {
echo You should enter a mage number. For example, !aa 123
return
}
%aaChannel = $chan
%aaUser = $nick
%aaMethod = ad
aaBot $1 $2
}
alias /an {
if ( [ % $+ [ aaBotEnabled $+ [ $chan ] ] ] == $null ) { halt }
if ( %aaInProgress != $null ) { halt }
if ( ( $1- == $null ) || ( $pos($1-, ' ) != $null ) || ( $pos($1-, $chr(35) ) != $null ) ) {
echo Please enter a valid search string. For example, !an will
halt
}
%aaChannel = $chan
%aaUser = $nick
%aaMethod = an
aaBot $1-
}
alias -l /aaBot {
%aaTarget = $1
%aaServer = $left( $2, 2 )
if ( ( %aaMethod == an ) && ( $2- != $null ) ) {
%aaTarget = $left($1-, $calc( $len($1-) - $len($lastword($2-, 2)) ) )
%aaServer = $left( $lastword($2-), 2 )
}
:servers
if ( %aaServer == $null ) { %aaServer = [ % $+ [ aaBotEnabled $+ [ %aaChannel ] ] ] }
else if ( %aaServer == sg ) { %aaServer = s1 }
else if ( %aaServer == sn ) { %aaServer = s2 }
else if ( %aaServer == ag ) { %aaServer = a1 }
else if ( %aaServer == an ) { %aaServer = a2 }
else if ( %aaServer == bn ) { %aaServer = b1 }
else if ( %aaServer == bg ) { %aaServer = b2 }
else if ( %aaServer == bs ) { %aaServer = b3 }
else if ( %aaServer == sp ) { %aaServer = es }
else if ( %aaServer == ge ) { %aaServer = de }
else if ( %aaServer == ja ) { %aaServer = jp }
else if ( %aaServer == ch ) { %aaServer = cn }
if ( %aaServer == s1 ) { %aaServerID = ArchServer1 | %aaServeraddress = arch15.magewar.com }
else if ( %aaServer == s2 ) { %aaServerID = ArchServer2 | %aaServeraddress = arch10.magewar.com }
else if ( %aaServer == a1 ) { %aaServerID = AgerArchmage1 | %aaServeraddress = arch11.magewar.com }
else if ( %aaServer == a2 ) { %aaServerID = AgerArchmage2 | %aaServeraddress = arch12.magewar.com }
else if ( %aaServer == b1 ) { %aaServerID = ArchBlitz1 | %aaServeraddress = arch8.magewar.com }
else if ( %aaServer == b2 ) { %aaServerID = ArchBlitz2 | %aaServeraddress = arch6.magewar.com }
else if ( %aaServer == b3 ) { %aaServerID = ArchBlitz3 | %aaServeraddress = arch4.magewar.com }
else if ( %aaServer == be ) { %aaServerID = ArchBeta | %aaServeraddress = arch18.magewar.com }
else if ( %aaServer == ap ) { %aaServerID = ArchmageNewbie | %aaServeraddress = arch9.magewar.com }
else if ( %aaServer == es ) { %aaServerID = ArchTest | %aaServeraddress = arch7.magewar.com }
else if ( %aaServer == de ) { %aaServerID = DeArchmage | %aaServeraddress = germany.magewar.com }
else if ( %aaServer == jp ) { %aaServerID = JpArchmage | %aaServeraddress = arch5.magewar.com }
else if ( %aaServer == cn ) { %aaServerID = CnArchmage | %aaServeraddress = chinese.magewar.com }
else if ( ( %aaMethod == an ) && ( %anLoop == $null ) ) { var %anLoop = 1 | %aaTarget = $1- | unset %aaServer | goto servers }
else if ( %aaServer == [ % $+ [ aaBotEnabled $+ [ %aaChannel ] ] ] ) { notice %aaUser Please specify a server, for example, ! $+ %aaMethod 123 s1 | return }
else { notice %aaUser No such server ' $+ %aaServer $+ ', try: s1, s2, a1, a2, b1, b2, b3, be, ap, es, de, jp, ch. Default is [ % $+ [ aaBotEnabled $+ [ %aaChannel ] ] ] $+ . | return }
if ( (%aaMethod == ad) && (%adResultServer == %aaServer) && (%adResultTarget == %aaTarget) && (%adResultChannel == %aaChannel) ) {
inc %adResultNextDisplay
if ( [ % $+ [ adResultDisplay $+ [ %adResultNextDisplay ] ] ] != $null ) {
if ( [ % $+ [ adResultDisplay $+ [ $calc( %adResultNextDisplay + 1 ) ] ] ] != $null ) { [ % $+ [ adResultDisplay $+ [ %adResultNextDisplay ] ] ] = [ % $+ [ adResultDisplay $+ [ %adResultNextDisplay ] ] ] ... }
msg %aaChannel ... [ % $+ [ adResultDisplay $+ [ %adResultNextDisplay ] ] ]
unsetall
return
}
}
unset %aaResult*
unset %adResult*
unset %anResult*
set -u60 %aaInProgress 1
sockopen arenaarchmage %aaServeraddress 80
}
alias -l /firstword { return $left( $1, $pos( $1, $chr(32) ) ) }
alias -l /lastword { return $right( $1, $calc( $len($1) - $pos( $1, $chr(32), $count( $1, $chr(32) ) ) ) ) }
alias -l /intd {
var %aaTemp1 = $pos($1,
) + 1)
var %aaTemp3 = $calc($pos($1, | ) - %aaTemp2)
if (%aaTemp3 <= 0) %aaTemp3 = $len($1)
return $mid( $1, %aaTemp2, %aaTemp3 )
}
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 /adedit {
var %aaTemp1 = $remove( $1-,
, , , $chr(13) )
%aaTemp1 = $replace( %aaTemp1, <, <, >, >, &, & )
return %aaTemp1
}
alias -l /datastring {
if (%aaMethod == aa) { return /archmage/idsearch.html?option=1&targetid= $+ %aaTarget }
else if (%aaMethod == ad) { return /archmage/idsearch.html?option=1&targetid= $+ %aaTarget }
else if (%aaMethod == an) { return /archmage/idsearch.html?option=2&targetstr= $+ $replace( %aaTarget, $chr(32), $chr(37) $+ 20 ) }
}
alias -l /unsetall {
unset %aaChannel
unset %aaInProgress
unset %aaMethod
unset %aaServer
unset %aaServeraddress
unset %aaServerID
unset %aaTarget
unset %aaUser
}
on 1:TEXT:!aa*:#:{
if ( [ % $+ [ aaBotEnabled $+ [ $chan ] ] ] == $null ) { halt }
if ( %aaInProgress != $null ) { halt }
if $isnotnum($2) || $2 == 0 {
notice $nick You should enter a mage number. For example, !aa 123
return
}
%aaChannel = $chan
%aaUser = $nick
%aaMethod = aa
aaBot $2 $3
}
on 1:TEXT:!ad*:#:{
if ( [ % $+ [ aaBotEnabled $+ [ $chan ] ] ] == $null ) { halt }
if ( %aaInProgress != $null ) { halt }
if $isnotnum($2) || $2 == 0 {
notice $nick You should enter a mage number. For example, !ad 123
return
}
%aaChannel = $chan
%aaUser = $nick
%aaMethod = ad
aaBot $2 $3
}
on 1:TEXT:!an*:#:{
if ( [ % $+ [ aaBotEnabled $+ [ $chan ] ] ] == $null ) { halt }
if ( %aaInProgress != $null ) { halt }
if ( ( $2- == $null ) || ( $pos($2-, ' ) != $null ) || ( $pos($2-, $chr(35) ) != $null ) ) {
notice $nick Please enter a valid search string. For example, !an will
halt
}
%aaChannel = $chan
%aaUser = $nick
%aaMethod = an
aaBot $2-
}
on *:SOCKOPEN:arenaarchmage: {
if ($sockerr > 0) { msg %aaChannel $upper(%aaServer) $+ : Could not connect to archmage server. | halt }
sockwrite -nt $sockname GET $datastring HTTP/1.1
sockwrite -n $sockname Host: $host
sockwrite -n $sockname Cookie: %aaServerID $+ ID=CEH7KLSOCX0T1A
sockwrite $sockname $crlf
}
on *:SOCKREAD:arenaarchmage: {
if ($sockerr > 0) { msg %aaChannel $upper(%aaServer) $+ : Could not connect to archmage server. }
:nextread
sockread %temp
if ($sockbr == 0) { return }
if ( %temp ) {
;echo %temp
if (%aaMethod == aa) {
if ( $pos( %temp, Status | ) != $null ) { %aaResultStatus = $intd(%temp) }
else if ( $pos( %temp, Estado | ) != $null ) { %aaResultStatus = $intd(%temp) }
else if ( $pos( %temp, Zustand | ) != $null ) { %aaResultStatus = $intd(%temp) }
else if ( $pos( %temp, 状態 | ) != $null ) { %aaResultStatus = $intd(%temp) }
else if ( $pos( %temp, 仇了 | ) != $null ) { %aaResultStatus = $intd(%temp) }
else if ( $pos( %temp, Ranking | ) != $null ) { %aaResultRank = $intd(%temp) }
else if ( $pos( %temp, Posiciones | ) != $null ) { %aaResultRank = $intd(%temp) }
else if ( $pos( %temp, Rangliste | ) != $null ) { %aaResultRank = $intd(%temp) }
else if ( $pos( %temp, ランキング | ) != $null ) { %aaResultRank = $intd(%temp) }
else if ( $pos( %temp, 電兆 | ) != $null ) { %aaResultRank = $intd(%temp) }
else if ( $pos( %temp, Power | ) != $null ) { %aaResultPower = $intd(%temp) }
else if ( $pos( %temp, Poder | ) != $null ) { %aaResultPower = $intd(%temp) }
else if ( $pos( %temp, St rke | ) != $null ) { %aaResultPower = $intd(%temp) }
else if ( $pos( %temp, 国力 | ) != $null ) { %aaResultPower = $intd(%temp) }
else if ( $pos( %temp, 薦楚 | ) != $null ) { %aaResultPower = $intd(%temp) }
else if ( $pos( %temp, Total land | ) != $null ) { %aaResultLand = $firstword($intd(%temp)) }
else if ( $pos( %temp, Tierra Total | ) != $null ) { %aaResultLand = $firstword($intd(%temp)) }
else if ( $pos( %temp, Gesamtland | ) != $null ) { %aaResultLand = $firstword($intd(%temp)) }
else if ( $pos( %temp, 領土 | ) != $null ) { %aaResultLand = $firstword($intd(%temp)) }
else if ( $pos( %temp, 輿仇 | ) != $null ) { %aaResultLand = $firstword($intd(%temp)) }
else if ( $pos( %temp, Fortress | ) != $null ) { %aaResultForts = $intd(%temp) }
else if ( $pos( %temp, Fortalezas | ) != $null ) { %aaResultForts = $intd(%temp) }
else if ( $pos( %temp, Festung | ) != $null ) { %aaResultForts = $intd(%temp) }
else if ( $pos( %temp, 城塞 | ) != $null ) { %aaResultForts = $intd(%temp) }
else if ( $pos( %temp, 廓韻 | ) != $null ) { %aaResultForts = $intd(%temp) }
else if ( $pos( %temp, Specialty | ) != $null ) { %aaResultColor = $firstword($intd(%temp))
if (%aaResultColor == Ascendant) { %aaResultColorCode = 14 }
if (%aaResultColor == Verdant) { %aaResultColorCode = 3 }
if (%aaResultColor == Eradication) { %aaResultColorCode = 4 }
if (%aaResultColor == Nether) { %aaResultColorCode = 1 }
if (%aaResultColor == Phantasm) { %aaResultColorCode = 2 }
}
else if ( $pos( %temp, Especialidad | ) != $null ) { %aaResultColor = $remove( $intd(%temp), Tipo de Magia )
if ($right(%aaResultColor, $calc($len(%aaResultColor)-1)) == Ascendente) { %aaResultColorCode = 14 }
if ($right(%aaResultColor, $calc($len(%aaResultColor)-1)) == Natural) { %aaResultColorCode = 3 }
if ($right(%aaResultColor, $calc($len(%aaResultColor)-1)) == Aniquilacion) { %aaResultColorCode = 4 }
if ($right(%aaResultColor, $calc($len(%aaResultColor)-1)) == Oscura) { %aaResultColorCode = 1 }
if ($right(%aaResultColor, $calc($len(%aaResultColor)-1)) == Fantasmal) { %aaResultColorCode = 2 }
}
else if ( $pos( %temp, Spezialit t | ) != $null ) { %aaResultColor = $firstword($intd(%temp))
if (%aaResultColor == Aszendentenmagie) { %aaResultColorCode = 14 }
if (%aaResultColor == Natur) { %aaResultColorCode = 3 }
if (%aaResultColor == Ausrottungsmagie) { %aaResultColorCode = 4 }
if (%aaResultColor == Magie) { %aaResultColorCode = 1 }
if (%aaResultColor == Trugbildmagie) { %aaResultColorCode = 2 }
}
else if ( $pos( %temp, 魔法色 | ) != $null ) { %aaResultColor = $remove( $intd(%temp), Tipo de Magia )
if ($right(%aaResultColor, $calc($len(%aaResultColor)-0)) == 白魔法) { %aaResultColorCode = 14 }
if ($right(%aaResultColor, $calc($len(%aaResultColor)-0)) == 緑魔法) { %aaResultColorCode = 3 }
if ($right(%aaResultColor, $calc($len(%aaResultColor)-0)) == 赤魔法) { %aaResultColorCode = 4 }
if ($right(%aaResultColor, $calc($len(%aaResultColor)-0)) == 黒魔法) { %aaResultColorCode = 1 }
if ($right(%aaResultColor, $calc($len(%aaResultColor)-0)) == 青魔法) { %aaResultColorCode = 2 }
}
else if ( $pos( %temp, 徴隈e | ) != $null ) { %aaResultColor = $firstword($intd(%temp))
if (%aaResultColor == 舞}) { %aaResultColorCode = 14 }
if (%aaResultColor == 徭隼順) { %aaResultColorCode = 3 }
if (%aaResultColor == 篤) { %aaResultColorCode = 4 }
if (%aaResultColor == 圧菜) { %aaResultColorCode = 1 }
if (%aaResultColor == 暫F) { %aaResultColorCode = 2 }
}
}
if (%aaMethod == ad) {
if ( $pos( %temp, Description | ) != $null ) { set %adResultDisplay1 $adedit($intd(%temp)) | set %adReadMode on }
else if ( $pos( %temp, Descripcin | ) != $null ) { set %adResultDisplay1 $adedit($intd(%temp)) | set %adReadMode on }
else if ( $pos( %temp, Beschreibung | ) != $null ) { set %adResultDisplay1 $adedit($intd(%temp)) | set %adReadMode on }
else if ( $pos( %temp, 説明 | ) != $null ) { set %adResultDisplay1 $adedit($intd(%temp)) | set %adReadMode on }
else if ( $pos( %temp, f苧 | ) != $null ) { set %adResultDisplay1 $adedit($intd(%temp)) | set %adReadMode on }
else if ( %adReadMode == on ) {
if ($len(%adResultDisplay1) < 400) {
var %adTemp1 = %adResultDisplay1 $adedit(%temp)
%adResultDisplay1 = $mid(%adTemp1, 1, 400)
%adResultDisplay2 = %adResultDisplay2 $mid(%adTemp1, 401, 400)
}
else if ($len(%adResultDisplay2) < 400) {
var %adTemp1 = %adResultDisplay2 $adedit(%temp)
%adResultDisplay2 = $mid(%adTemp1, 1, 400)
%adResultDisplay3 = %adResultDisplay3 $mid(%adTemp1, 401, 400)
}
else if ($len(%adResultDisplay3) < 400) {
var %adTemp1 = %adResultDisplay3 $adedit(%temp)
%adResultDisplay3 = $mid(%adTemp1, 1, 400)
%adResultDisplay4 = %adResultDisplay4 $mid(%adTemp1, 401, 400)
}
}
if ( $pos( %temp, ) != $null ) { unset %adReadMode }
}
if (%aaMethod == an) {
if ( $pos( %temp, icon_ASCENDANT.gif ) != $null ) { %aaResultColorCode = 14 }
else if ( $pos( %temp, icon_VERDANCY.gif ) != $null ) { %aaResultColorCode = 3 }
else if ( $pos( %temp, icon_ERADICATION.gif ) != $null ) { %aaResultColorCode = 4 }
else if ( $pos( %temp, icon_NETHER.gif ) != $null ) { %aaResultColorCode = 1 }
else if ( $pos( %temp, icon_PHANTASM.gif ) != $null ) { %aaResultColorCode = 2 }
else if ( $pos( %temp, ) != $null ) { %aaResultRank = $intd(%temp) }
else if ( $pos( %temp, | ) != $null ) {
if ( %anResultMode == 1 ) {
%aaResultLand = $intd(%temp)
inc %anResultMode
}
else if ( %anResultMode == 2 ) {
%aaResultForts = $intd(%temp)
inc %anResultMode
}
else if ( %anResultMode == 3 ) {
%aaResultPower = $intd(%temp)
unset %anResultMode
}
}
else if ( ($pos( %temp, | ) != $null ) && ($pos( %temp, $chr(40) $+ $chr(35) ) != $null) ) {
%aaResultName = $intd(%temp)
%anResultDisplay = %anResultDisplay %aaResultColorCode %aaResultName
inc %anResultLength
inc %anResultMode
}
}
if ( $pos( %temp, | Country | ) != $null ) { %aaResultName = $intd(%temp) }
else if ( $pos( %temp, Reino | ) != $null ) { %aaResultName = $intd(%temp) }
else if ( $pos( %temp, Land | ) != $null ) { %aaResultName = $intd(%temp) }
else if ( $pos( %temp, 国家 | ) != $null ) { %aaResultName = $intd(%temp) }
else if ( $pos( %temp, 社 | ) != $null ) { %aaResultName = $intd(%temp) }
else if ( $pos( %temp, No such mage ) != $null ) { %aaResultNotFound = 1 }
else if ( $pos( %temp, No existe ) != $null ) { %aaResultNotFound = 1 }
else if ( $pos( %temp, Es gibt keinen solche ) != $null ) { %aaResultNotFound = 1 }
else if ( $pos( %temp, テーラに ) != $null ) { %aaResultNotFound = 1 }
else if ( $pos( %temp, 壓密S]嗤@臨 ) != $null ) { %aaResultNotFound = 1 }
else if ( $pos( %temp,