alias z1 { return $+($chr(3),03 $+ $1) } alias z2 { return $+($chr(3),07 $+ $1) } alias theoutput { return *** $chr(91) $+ 7 $1- $+ $chr(93) } on $*:text:/^[!@](halo3|h3)/Si:#: { if ($chan == #msl) { halt } var %randnum = $right($ticks,6) set %halo3.reply [ $+ [ %randnum ] ] $iif($left($1,1) == @, msg $chan, notice $nick) if (!$2) { %halo3.reply [ $+ [ %randnum ] ] $theoutput(ERROR) $z1(Please state the service you wish to use.) | unset %halo3.reply [ $+ [ %randnum ] ] | halt } if ($2 !== stats) { %halo3.reply [ $+ [ %randnum ] ] $theoutput(ERROR) $z1(Please state a valid service you wish to use.) | unset %halo3.reply [ $+ [ %randnum ] ] | halt } if (!$3) { %halo3.reply [ $+ [ %randnum ] ] $theoutput(ERROR) $z1(Please state the gamertag you wish to lookup.) | unset %halo3.reply [ $+ [ %randnum ] ] | halt } if ($len($3-) > 15) { %halo3.reply [ $+ [ %randnum ] ] $theoutput(ERROR) $z1(Invalid Gamertag - Gamertags can only be 15 chracters long.) | unset %halo3.reply [ $+ [ %randnum ] ] | halt } if ($left($3,1) isnum) { %halo3.reply [ $+ [ %randnum ] ] $theoutput(ERROR) $z1(Invalid Gamertag - Gamertags can't start with numbers.) | unset %halo3.reply [ $+ [ %randnum ] ] | halt | halt } if (!$regex($3-,/^[a-z0-9\s_-]+$/Si)) { %halo3.reply [ $+ [ %randnum ] ] $theoutput(ERROR) $z1(Invalid Gamertag - Gamertags can only contain Letters,Numbers and spaces.) $z2(Underscores and hyphons also representing spaces.) | unset %halo3.reply [ $+ [ %randnum ] ] | halt } set %halo3.name [ $+ [ %randnum ] ] $replace($3-,$chr(32),+,_,+,-,+) if ($right(%halo3.name [ $+ [ %randnum ] ],1) == +) { %halo3.reply [ $+ [ %randnum ] ] $theoutput(ERROR) $z1(Invalid Gamertag - Gamertags can't end in spaces.) | unset %halo3.* [ $+ [ %randnum ] ] | halt } if ($left(%halo3.name [ $+ [ %randnum ] ],1) == +) { %halo3.reply [ $+ [ %randnum ] ] $theoutput(ERROR) $z1(Invalid Gamertag - Gamertags can't start in spaces.) | unset %halo3.* [ $+ [ %randnum ] ] | halt } if (*++* iswm %halo3.name [ $+ [ %randnum ] ]) { %halo3.reply [ $+ [ %randnum ] ] $theoutput(ERROR) $z1(Invalid Gamertag - Single spaces only.) | unset %halo3.* [ $+ [ %randnum ] ] | halt } if ($2 = stats) { sockopen halo3.stats [ $+ [ %randnum ] ] www.bungie.net 80 } } on *:SOCKOPEN:halo3.stats*: { sockwrite -nt $sockname GET /Stats/Halo3/Default.aspx?player= $+ %halo3.name [ $+ [ $right($sockname,6) ] ] HTTP/1.0 sockwrite -nt $sockname Host: www.bungie.net sockwrite -nt $sockname $crlf } on *:SOCKREAD:halo3.stats*: { var %id = $right($sockname,6) if ($sockerr) { %halo3.reply [ $+ [ %id ] ] $theoutput(ERROR) $z1(occured, please try again.) | unset %halo3.reply [ $+ [ %id ] ] | unset halo3.* [ $+ [ %id ] ] } else { var %bungepage sockread %bungepage if (*Halo 3 Service Record Not Found* iswm %bungepage) { %halo3.reply [ $+ [ %id ] ] $theoutput(ERROR) $z1(No Halo3 Player under the name of) $z2($qt($replace(%halo3.name [ $+ [ %id ] ],+,$chr(32)))) $z1(Was found.) | unset %halo3.* [ $+ [ %id ] ] | halt } if (*