on *:input:*:{ if ($left($1,1) isin /~) && ($istok(stats compare,$right($1,-1),32) || $setskill($right($1,-1)) || $setgame($right($1,-1)) || $regex($right($1,-1),/^c(mb|ombat|lose(st)?)|f(ar|[au]rthest)|(high|low)(est)?|p(c|est)$/i)) { if (!%defname) { if ($?("What is your rsn?")) set %defname $replace($v1,$chr(32),-,-,_) else { echo -agt $c1(Specify a default rsn.) halt } } var %id = 1, %type = $right($1,-1), %style = $iif(/* iswm $1,echo -agt,msg $target), %output while ($sock(stats.*,%id)) inc %id if ($istok(stats,%type,32)) || ($setgame(%type)) || ($regex(%type,/^c(mb|ombat|lose(st)?)|f(ar|[au]rthest)|(high|low)(est)?$/i)) %output = %type $iif($2-,$replace($v1,$chr(32),-),%defname) if ($setskill(%type)) { if (#* iswm $2) && ($right($2,-1) isnum 1-99) %output = %type $2 $iif($3-,$replace($v1,$chr(32),-),%defname) else %output = %type $iif($2-,$replace($v1,$chr(32),-),%defname) } if ($setskill(%type)) || ($regex(%type,/^p(c|est)$/i)) { if ($v1 isnum) { var %pc = $setskill($2) tokenize 32 $2- if (!$istok(Attack Strength Defence Hitpoints Ranged Prayer Magic,%pc,32)) { echo -agt $c1(Supply a combat skill.) halt } } if (#* iswm $2) && ($right($2,-1) isnum 1-99) %output = %type %pc $2 $iif($3-,$replace($v1,$chr(32),-),%defname) else %output = %type %pc $iif($2-,$replace($v1,$chr(32),-),%defname) } if ($istok(compare,%type,32)) { if ($3) && ($setskill($2)) { %output = %type $v1 $3 $iif($4,$v1,%defname) if ($gettok(%output,3,32) == $gettok(%output,4,32)) echo -agt $c1(Guess.) else { unset $($+(%,id,.,%id)) sockopen $+(stats,.,%id) hiscore.runescape.com 80 sockmark $+(stats,.,%id) %style com $iif($4,$v1,%defname) $3 inc %id } } else echo -agt $c1(Specify a skill and person to compare.) } if (%output) { unset $($+(%,id,.,%id)) sockopen $+(stats,.,%id) hiscore.runescape.com 80 sockmark $+(stats,.,%id) %style %output } haltdef } } on *:sockopen:stats.*:{ sockwrite -nt $sockname GET $+(/index_lite.ws?player=,$gettok($sock($sockname).mark,-1,32)) HTTP/1.1 sockwrite -nt $sockname Host: hiscore.runescape.com sockwrite -nt $sockname $crlf inc $+(%,id,.,$right($sockname,-6)) } on *:sockread:stats.*:{ if ($sockerr) return var %id = $right($sockname,-6), %num = $calc($($+(%,id,.,%id),2) - 11), %rsn = $gettok($sock($sockname).mark,-1,32), %sock sockread %sock if (*404 Not found iswm %sock) sockmark $sockname $gettok($sock($sockname).mark,1-2,32) Unranked %rsn if ($setskill(%num)) || ($setgame(%num)) hadd -m %rsn $v1 %sock inc $+(%,id,.,%id) } on *:sockclose:stats.*:{ tokenize 32 $sock($sockname).mark var %style = $1-2, %type = $3, %rsn = $gettok($1-,-1,32), %stats.a, %stats.b, %stats.c if (%type == unranked) %stats.a = $c1(The nick) $c2(%rsn) $c1(does not appear in the highscores for any skills.) if ($regex(%type,/^com(pare)?$/i)) { var %rsn.a = $gettok($1-,-1,32), %rsn.b = $gettok($1-,-2,32), %skill = $gettok($1-,-3,32) if ($hget(%rsn.a,%skill)) && ($hget(%rsn.b,%skill)) { var $& %rank.a = $gettok($hget(%rsn.a,%skill),1,44), %level.a = $gettok($hget(%rsn.a,%skill),2,44), %exp.a = $gettok($hget(%rsn.a,%skill),3,44), $& %rank.b = $gettok($hget(%rsn.b,%skill),1,44), %level.b = $gettok($hget(%rsn.b,%skill),2,44), %exp.b = $gettok($hget(%rsn.b,%skill),3,44), $& %rank = $abs($calc(%rank.a - %rank.b)), %level = $abs($calc(%level.a - %level.b)), %exp = $abs($calc(%exp.a - %exp.b)), $& %rank.pl = $iif(%rank > 1,s), %level.pl = $iif(%level > 1,s), $& %2lvl = %exp if (%rank.a == -1) || (%rank.b == -1) %stats.a = $c2($iif(%rank.a == -1,%rsn.a,%rsn.b)) $c1(does not appear in the highscores for) $+($c2(%skill),$c1(.)) else { %stats.a = $c2(%rsn.a) $c1(is level) $c2($bytes(%level.a,b)) $c1(and) $c2(%rsn.b) $c1(is level) $c2($bytes(%level.b,b)) $+($c1($chr(40)),$c2(%skill),$c1($chr(41))) if (%level.a == %level.b) { if (%exp.a == %exp.b) %stats.b = $c2(%rsn.a) $c1(and) $c2(%rsn.b) $c1(both have the same $+(experience,$chr(44)) but) $c2($iif(%rank.a < %rank.b,%rsn.a,%rsn.b)) $c1(is) $c2($bytes(%rank,b)) $c1($+(rank,%rank.pl)) $c1(higher.) if (%exp.a > %exp.b) %stats.b = $c2(%rsn.a) $c1(and) $c2(%rsn.b) $c1(are both level) $+($c2(%level.a),$c1($chr(44))) $c1(but) $c2(%rsn.a) $c1(is) $c2($bytes(%exp,b)) $c1(experience and) $c2($bytes(%rank,b)) $c1($+(rank,%rank.pl)) $c1(higher.) if (%exp.a < %exp.b) %stats.b = $c2(%rsn.a) $c1(and) $c2(%rsn.b) $c1(are both level) $+($c2(%level.a),$c1($chr(44))) $c1(but) $c2(%rsn.a) $c1(is) $c2($bytes(%exp,b)) $c1(experience and) $c2($bytes(%rank,b)) $c1($+(rank,%rank.pl)) $c1(lower.) } if (%level.a > %level.b) { if (%exp.a > %exp.b) %stats.b = $c2(%rsn.a) $c1(is) $c2($bytes(%level,b)) $c1($+(level,%level.pl,$chr(44))) $c2($bytes(%exp,b)) $c1(experience and) $c2($bytes(%rank,b)) $c1($+(rank,%rank.pl) above) $+($c2(%rsn.b),$c1(.)) if (%exp.a < %exp.b) %stats.b = $c2(%rsn.a) $c1(is) $c2($bytes(%level,b)) $c1($+(level,%level.pl) and) $c2($bytes(%rank,b)) $c1($+(rank,%rank.pl) $+(above,$chr(44)) but) $c2($bytes(%exp,b)) $c1(experience below) $+($c2(%rsn.b),$c1(.)) } if (%level.a < %level.b) { if (%exp.a > %exp.b) %stats.b = $c2(%rsn.a) $c1(is) $c2($bytes(%level,b)) $c1($+(level,%level.pl) and) $c2($bytes(%rank,b)) $c1($+(rank,%rank.pl) $+(below,$chr(44)) but) $c2($bytes(%exp,b)) $c1(experience above) $+($c2(%rsn.b),$c1(.)) if (%exp.a < %exp.b) %stats.b = $c2(%rsn.a) $c1(is) $c2($bytes(%level,b)) $c1($+(level,%level.pl,$chr(44))) $c2($bytes(%exp,b)) $c1(experience and) $c2($bytes(%rank,b)) $c1($+(rank,%rank.pl) below) $+($c2(%rsn.b),$c1(.)) } if (%exp.a != %exp.b) && ($read(stats.txt,s,%skill,1)) %stats.c = $+($+($chr(2),$c1([),$chr(2)),$c1(For) $c2($bytes(%2lvl,b)) $c1(experience),$+($chr(2),$c1(]),$chr(2)),$c1(:)) $read(stats.txt,s,%skill,1) } hfree %rsn.a hfree %rsn.b } } if (%type == stats) { var %a = 0 %stats.a = $c1(Stats for) $+($chr(2),$c2([),$chr(2),$c2(%rsn),$chr(2),$c2(]),$chr(2),$c1(:)) while ($setskill(%a)) { tokenize 44 $hget(%rsn,$v1) %stats.b = %stats.b $iif($1 > 0,$c1($setskill(%a)) $c2($bytes($2,b))) inc %a } while ($setgame(%a)) { tokenize 44 $hget(%rsn,$v1) %stats.c = %stats.c $iif($1 > 0,$c1($replace($setgame(%a),-,$chr(32))) $c2($bytes($2,b))) inc %a } if (%stats.b) %stats.b = $+($chr(2),$c2([),$chr(2),$c2(Skills),$chr(2),$c2(]),$chr(2)) %stats.b if (%stats.c) %stats.c = $+($chr(2),$c2([),$chr(2),$c2(Minigames),$chr(2),$c2(]),$chr(2)) %stats.c hfree %rsn } if ($setskill(%type)) { var %skill = $v1, %aim, %2lvl, %norm if (#* iswm $4) %aim = $right($4,-1) tokenize 44 $hget(%rsn,%skill) if ($1 == -1) %stats.a = $c2(%rsn) $c1(does not appear in the highscores for) $+($c2($setskill(%type)),$c1(.)) else { if (!%aim) || (%aim < $calc($2 + 1)) %aim = $calc($2 + 1) if ($calc($2 + 1) != 100) && (!$istok(Overall,%skill,32)) %norm = $true if (%norm) %2lvl = $calc($xp(%aim) - $3) %stats.a = $c2(%skill) $c1(stats for) $+($chr(2),$c2([),$chr(2),$c2(%rsn),$chr(2),$c2(]),$chr(2),$c1(:)) %stats.b = $c1(Rank:) $c2($bytes($1,b)) $c1(Level:) $c2($bytes($2,b)) $c1(Exp:) $c2($bytes($3,b)) $iif(%norm,$c1(Exp to lvl) $+($c2(%aim),$c1(:)) $c2($bytes(%2lvl,b))) %stats.c = $iif(%norm && $read(stats.txt,s,%skill,1),$+($chr(2),$c1([),$chr(2),$c1(For level) $c2(%aim),$chr(2),$c1(]),$chr(2),$c1(:)) $read(stats.txt,s,%skill,1)) } hfree %rsn } if ($setgame(%type)) { var %a = 1, %b = Attack Strength Defence Hitpoints Ranged Prayer Magic Summoning, %c = $v1, %d = $replace($v1,-,$chr(32)) tokenize 44 $hget(%rsn,%c) %stats.a = $c2($+($chr(2),[,$chr(2),$c2(%rsn),$chr(2),],$chr(2))) $c1(is) $iif($1 > 0,$c1(rank) $c2($bytes($1,b)) $c1(with a score of) $+($c2($bytes($2,b)),$c1(.)),$+($c2(Unranked),$c1(.))) $+($c1($chr(40)),$c2(%d),$c1($chr(41))) while ($gettok(%b,%a,32)) { tokenize 44 $hget(%rsn,$v1) %stats.b = %stats.b $c1($+($gettok(%b,%a,32),:)) $c2($iif($2 > 0,$gettok(%b,%a,32),-)) inc %a } hfree %rsn } if ($regex(%type,/^c(mb|ombat)$/i)) { var %x, %y = 1, %z = 1, %skill while ($gettok(Attack Strength Defence Hitpoints Ranged Prayer Magic Summoning,%z,32)) { %skill = $v1 tokenize 44 $hget(%rsn,%skill) set -l $+(%,%skill) $iif($2 > 0,$2,$iif(%skill == Hitpoints,10,1)) var %levels = %levels $c1($+(%skill,:)) $c2($iif($2 > 0,$v1,-)) if (!%ranked) var %ranked = $calc($1 + 1) inc %z } if (%ranked) { var $& %base = $calc((%defence + %hitpoints + $floor($calc(%prayer / 2)) + $floor($calc(%summoning / 2))) / 4), $& %melee = $calc((%attack + %strength) * (13 / 40)), %range = $calc($floor($calc(%ranged * 1.5)) * (13 / 40)), %mage = $calc($floor($calc(%magic * 1.5)) * (13 / 40)), $& %cmb = $calc(%base + $gettok($sorttok(%melee %range %mage,32,n),-1,32)), %cmbstyle, %cmb.temp = $abs($calc($int($calc(%cmb +1)) - %cmb)), $& %attack.2lvl = $ceil($calc(%cmb.temp / (13 / 40))), %hitpoints.2lvl = $ceil($calc(%cmb.temp / (1 / 4))), $& %strength.2lvl = $ceil($calc(%cmb.temp / (13 / 40))), %ranged.2lvl = $ceil($calc(%cmb.temp / (1 / 2))), $& %defence.2lvl = $ceil($calc(%cmb.temp / (1 / 4))), %magic.2lvl = $ceil($calc(%cmb.temp / (1 / 2))), $& %prayer.2lvl = $ceil($calc(%cmb.temp / (1 / 8))), %summoning.2lvl = $ceil($calc(%cmb.temp / (1 / 8))), $& %2lvl if (2 \\ $calc(%prayer + %prayer.2lvl)) $iif(2 \\ %prayer.2lvl,inc,dec) %prayer.2lvl if (2 \\ $calc(%summoning + %summoning.2lvl)) $iif(2 \\ %summoning.2lvl,inc,dec) %summoning.2lvl if (%melee > %range) && (%melee > %mage) %cmbstyle = melee else { if (%mage > %range) %cmbstyle = magic else %cmbstyle = ranged } if (%cmbstyle == melee) %x = $iif(%attack < 99,1) $iif(%strength < 99,3) if (%cmbstyle == mage) %x = $iif(%magic < 99,7) if (%cmbstyle == ranged) %x = $iif(%ranged < 99,5) %x = %x $iif(%defence < 99,2) $iif(%hitpoints < 99,4) $iif(%prayer < 99,6) $iif(%summoning < 99,24) while ($gettok(%x,%y,32)) { %2lvl = %2lvl $c1($+($setskill($gettok(%x,%y,32)),:)) $c2($($+(%,$setskill($gettok(%x,%y,32)),.,2lvl),2)) inc %y } %stats.a = $+($chr(2),$c2([),$chr(2),$c2(%rsn),$chr(2),$c2(]),$chr(2)) $c1(is) $c2(%cmb) $c1(%cmbstyle style combat.) %stats.b = %levels %stats.c = $iif(%2lvl && $calc($int(%cmb) + 1) isnum 1-138,$+($chr(2),$c1([),$chr(2),$c1(For level) $c2($calc($int(%cmb) + 1)),$chr(2),$c1(]),$chr(2),$c1(:)) %2lvl) } else %stats.a = $c1(The nick) $c2(%rsn) $c1(does not appear in the hiscores for any combat skills.) hfree %rsn } if ($regex(%type,/^(close(st)?|f(ar|[au]rthest))$/i)) { var %a = 1, %b, %c, %d, %e = $iif(close* iswm %type,closest,furthest), %2lvl while ($setskill(%a)) { tokenize 44 $hget(%rsn,$v1) %b = $calc($2 + 1) %c = $calc($xp(%b) - $3) if (%b isnum 1-99) { if (%d) { if (%c $iif(close* iswm %e,<,>) $gettok(%d,3,32)) %d = $setskill(%a) %b %c } else %d = $setskill(%a) %b %c } inc %a } tokenize 32 %d if (!$1) %stats.a = $c2(%rsn) $c1(can't level any further.) else { %2lvl = $3 %stats.a = $+($c2(%rsn),$c1('s)) $c1(%e skill $iif(close* iswm %e,to,from) a level is) $c2($1) $+($c1($chr(40)),$c2($bytes($3,b)) $c1(exp for level) $c2($2),$c1($chr(41))) %stats.b = $iif($read(stats.txt,s,$1,1),$+($chr(2),$c1([),$chr(2),$c1(For level) $c2($2),$chr(2),$c1(]),$chr(2),$c1(:)) $read(stats.txt,s,$1,1)) } hfree %rsn } if ($regex(%type,/^(high|low)(est)?$/i)) { var %a = 1, %b, %c = $iif(high* iswm %type,highest,lowest) while ($setskill(%a)) { tokenize 44 $hget(%rsn,$v1) if (!%b) && ($calc($3 + 1)) %b = $1- $setskill(%a) if ($3 $iif(high* iswm %c,>,<) $gettok(%b,3,32)) && ($calc($3 + 1)) %b = $1- $setskill(%a) inc %a } tokenize 32 %b var %next = $calc($2 + 1), %2lvl = $calc($xp(%next) - $3) %stats.a = $+($c2(%rsn),$c1('s)) $c1(%c skill is) $+($c2($4),$c1(.)) %stats.b = $c1(Rank:) $c2($bytes($1,b)) $c1(Level:) $c2($bytes($2,b)) $c1(Exp:) $c2($bytes($3,b)) $iif(%next isnum 1-99,$c1(Exp to lvl) $+($c2($bytes(%next,b)),$c1(:)) $c2($bytes(%2lvl,b))) %stats.c = $iif(%next isnum 1-99 && $read(stats.txt,s,$4,1),$+($chr(2),$c1([),$chr(2),$c1(For level) $c2(%next),$chr(2),$c1(]),$chr(2),$c1(:)) $read(stats.txt,s,$4,1)) hfree %rsn } if ($regex(%type,/^c(mb|ombat)%$/i)) { var %a = 1, %b = Attack Strength Defence Hitpoints Ranged Prayer Magic Summoning, %c = $gettok($hget(%rsn,overall),3,44), %d while ($gettok(%b,%a,32)) { tokenize 44 $hget(%rsn,$setskill($v1)) %d = $calc(%d $iif($calc($3 + 1),+ $3)) inc %a } %stats.a = $c2(%rsn) $c1(is) $c2($iif(%d,$+($round($calc((%d / %c) * 100),2),%),an unknown percentage)) $c1(combat $+(based,$chr(44)) with) $c2($iif(%d,$bytes(%d,b),unknown)) $c1(combat experience and) $c2($iif($calc(%c + 1),$bytes(%c,b),unknown)) $c1(experience overall.) hfree %rsn } if ($regex(%type,/^p(c|est)$/i)) { var %skill = $setskill($4), %aim = $iif(#* iswm $5,$5) tokenize 44 $hget(%rsn,%skill) if ($1 == -1) %stats.a = $c2(%rsn) $c1(does not appear in the highscores for) $+($c2(%skill),$c1(.)) else { if ($2 == 99) %stats.a = $c2(%rsn) $c1(can't level) $c2(%skill) $c1(any further.) else { var $& %aim = $iif($right(%aim,-1) > $calc($2 + 1),$right(%aim,-1),$calc($2 + 1)), %to = $calc($xp(%aim) - $3), $& %1 = $int($calc((($2 ^ 2) / $iif($istok(Prayer,%skill,32),12,6) * $iif($istok(Ranged Magic,%skill,32),.25,.35)))), $& %10 = $int($calc(%1 * 10.1)), $& %100 = $int($calc(%1 * 110)), $& %1.to = $ceil($calc(%to / %1)), $& %10.to = $ceil($calc(%to / %10)), $& %100.to = $ceil($calc(%to / %100)) %stats.a = $c2(%rsn) $c1(needs) $c2($bytes(%1.to,b)) $c1($+(single points,$chr(44))) $c2($bytes(%10.to,b)) $c1(sets of 10 points or) $c2($bytes(%100.to,b)) $c1(sets of 100 points) $c1(for level) $c2(%aim) $+($c2(%skill),$c1(.)) } } hfree %rsn } if (%stats.a) %style $v1 if (%stats.b) %style $v1 if (%stats.c) %style $v1 unset $+(%,id,.,$right($sockname,-6)) } alias setskill { if ($1 == 0) || ($regex($1,/^(tota|overal)l$/i)) return Overall if ($1 == 1) || ($regex($1,/^at(t(ack)?|k)$/i)) return Attack if ($1 == 2) || ($regex($1,/^def(en[cs]e)?$/i)) return Defence if ($1 == 3) || ($regex($1,/^str(ength)?$/i)) return Strength if ($1 == 4) || ($regex($1,/^h(p|it(point)?s)$/i)) return Hitpoints if ($1 == 5) || ($regex($1,/^rang(ed?|ing)$/i)) return Ranged if ($1 == 6) || ($regex($1,/^pray(er)?$/i)) return Prayer if ($1 == 7) || ($regex($1,/^mag(e|ic)$/i)) return Magic if ($1 == 8) || ($regex($1,/^cook(ing)?$/i)) return Cooking if ($1 == 9) || ($regex($1,/^w(c|oodcut(ting)?)$/i)) return Woodcutting if ($1 == 10) || ($regex($1,/^fletch(ing)?$/i)) return Fletching if ($1 == 11) || ($regex($1,/^fish(ing)?$/i)) return Fishing if ($1 == 12) || ($regex($1,/^f(m|iremak(e|ing))$/i)) return Firemaking if ($1 == 13) || ($regex($1,/^craft(ing)?$/i)) return Crafting if ($1 == 14) || ($regex($1,/^sm(ith|elt)(ing)?$/i)) return Smithing if ($1 == 15) || ($regex($1,/^min(e|ing)$/i)) return Mining if ($1 == 16) || ($regex($1,/^herb(l(aw|ore))?$/i)) return Herblore if ($1 == 17) || ($regex($1,/^agil(ity)?$/i)) return Agility if ($1 == 18) || ($regex($1,/^thie(f|v(e|ing))$/i)) return Thieving if ($1 == 19) || ($regex($1,/^slay(er)?$/i)) return Slayer if ($1 == 20) || ($regex($1,/^farm(ing)?|rak(e|in['g]?)$/i)) return Farming if ($1 == 21) || ($regex($1,/^r(c|unecraft)(ing)?$/i)) return Runecraft if ($1 == 22) || ($regex($1,/^hunt(er)?$/i)) return Hunter if ($1 == 23) || ($regex($1,/^con(struct(ion)?)?$/i)) return Construction if ($1 == 24) || ($regex($1,/^sum(mon(ing)?)?$/i)) return Summoning } alias setgame { if ($1 == 25) || ($regex($1,/^duel(ling)?$/i)) return Duel-tournament if ($1 == 26) || ($regex($1,/^b(ounty)?(h(unt(er|ing)?)?)$/i)) return Bounty-hunter if ($1 == 27) || ($regex($1,/^bh?r(ogue)?$/i)) return Bounty-hunter-rogue } alias xp return $gettok(0 83 174 276 388 512 650 801 969 1154 1358 1584 1833 2107 2411 2746 3115 3523 3973 4470 5018 5624 6291 7028 7842 8740 9730 10824 12031 13363 14833 16456 18247 20224 22406 24815 27473 30408 33648 37224 41171 45529 50339 55649 61512 67983 75127 83014 91721 101333 111945 123660 136594 150872 166636 184040 203254 224466 247886 273742 302288 333804 368599 407015 449428 496254 547953 605032 668051 737627 814445 899257 992895 1096278 1210421 1336443 1475581 1629200 1798808 1986068 2192818 2421087 2673114 2951373 3258594 3597792 3972294 4385776 4842295 5346332 5902831 6517253 7195629 7944614 8771558 9684577 10692629 11805606 13034431,$1,32) alias c1 return $+($chr(3),07,$1-) alias c2 return $+($chr(3),03,$1-)