rendered paste bodyalias stats {
if ($1) { set %nick $capwords($replace($1-,$chr(32),_,-,_)) }
if (!$1) { set %nick Ghost_boy527 }
set %saystyle msg $active
set %echo .notice $me
sockopen stats hiscore.runescape.com 80
}
on *:sockopen:stats: {
.sockwrite -n $sockname GET /index_lite.ws?player= $+ %nick HTTP/1.1
.sockwrite -n $sockname Host: hiscore.runescape.com $+ $crlf $+ $crlf
}
on *:sockread:stats: {
if (%row == $null) { set %row 1 }
if ($sockerr) {
%saystyle There was a socket error.
halt
}
.sockread %stats
if (%row < 100) {
set % [ $+ [ %row ] ] %stats
if ($gettok(%stats,2,44) == -1 && %row < 37 && %row > 12) { hadd -m ranking unranked $hget(ranking,unranked) $+ $+(|,%row) }
if ($gettok(%stats,2,44) != -1 && %row < 37 && %row > 12) { hadd -m ranking ranked $hget(ranking,ranked) $+ $+(|,%row) }
inc %row 1
}
}
on *:sockclose:stats: {
if (!%30) { %echo Nick not found }
else {
var %x = 1,%y = 1
hadd -m ranking rankeds 0
while (%x <= $numtok($hget(ranking,ranked),124)) {
hadd -m ranking rankeds $calc($hget(ranking,rankeds) + $gettok(% [ $+ [ $gettok($hget(ranking,ranked),%x,124) ] ],2,44))
inc %x 1
}
set %unranked $round($calc(($gettok(%12,2,44) - $hget(ranking,rankeds))/$numtok($hget(ranking,unranked),124)),0)
while (%y <= $numtok($hget(ranking,unranked),124)) {
set % [ $+ [ $gettok($hget(ranking,unranked),%y,124) ] ] Unranked $+ , $+ ~ $+ %unranked $+ , $+ $readini(exp.ini,lvl,%unranked)
inc %y 1
}
set %melee $calc( $calc( $remove($gettok(%13,2,44),-,~) * 0.325 ) + $calc( $remove($gettok(%15,2,44),-,~) * 0.325 ) + $calc( $remove($gettok(%14,2,44),-,~) * 0.25 ) + $calc( $iif($remove($gettok(%16,2,44),~) > 10,$remove($gettok(%16,2,44),10),~) * 0.25 ) + $calc($round($calc(( $remove($gettok(%18,2,44),-,~) /2)-0.1),0)*0.25) + $calc($round($calc(( $remove($gettok(%36,2,44),-,~) /2)-0.1),0)*0.25) )
set %range $calc( ( $remove($gettok(%14,2,44),-,~) * 0.25 ) + $calc( $iif($remove($gettok(%16,2,44),~) > 10,$remove($gettok(%16,2,44),10),~) * 0.25 ) + ( $remove($gettok(%17,2,44),-,~) * 0.483162 ) + ($round($calc(( $remove($gettok(%18,2,44),-,~) /2)-0.1),0)*0.25) + $calc($round($calc(( $remove($gettok(%36,2,44),-,~) /2)-0.1),0)*0.25) )
set %mage $calc( ( $remove($gettok(%14,2,44),-,~) * 0.25 ) + $calc( $iif($remove($gettok(%16,2,44),~) > 10,$remove($gettok(%16,2,44),10),~) * 0.25 ) + ($round($calc(( $remove($gettok(%18,2,44),-,~) /2)-0.1),0)*0.25) + ( $remove($gettok(%19,2,44),-,~) * 0.483162 ) + $calc($round($calc(( $remove($gettok(%36,2,44),-,~) /2)-0.1),0)*0.25) )
set %cmb 0, $+ $remove($gettok($combat,1,32),07) $+ , $+ $calc( $remove($replace($gettok(%13,3,44),-1,0),~) + $remove($replace($gettok(%14,3,44),-1,0),~) + $remove($replace($gettok(%15,3,44),-1,0),~) + $remove($replace($gettok(%16,3,44),-1,1154),~) + $remove($replace($gettok(%17,3,44),-1,0),~) + $remove($replace($gettok(%18,3,44),-1,0),~) + $remove($replace($gettok(%19,3,44),-1,0),~) + $remove($replace($gettok(%36,3,44),-1,0),~) )
set %avg $round($calc($gettok(%12,2,44)/24),1)
%saystyle %nick 07Stats | Level:07 $bytes($gettok(%12,2,44),db) (Avg. Lvl:07 $round($calc($gettok(%12,2,44)/24),1) $+ ) | Exp:07 $bytes($gettok(%12,3,44),db) | Rank:07 $bytes($gettok(%12,1,44),db)
%saystyle Combat Stats: $colavg($gettok(%13,2,44)) Attack; $colavg($gettok(%15,2,44)) Strength; $colavg($gettok(%14,2,44)) Defence; $colavg($gettok($iif($gettok(%16,2,44) > 10,%16,$+(1000000,$chr(44),10,$chr(44),1)),2,44)) Hitpoints; $colavg($gettok(%18,2,44)) Prayer; $colavg($gettok(%17,2,44)) Ranged; $colavg($gettok(%19,2,44)) Magic; $colavg($gettok(%36,2,44)) Summoning;
%saystyle Other Stats: $colavg($gettok(%20,2,44)) Cooking; $colavg($gettok(%21,2,44)) Woodcutting; $colavg($gettok(%22,2,44)) Fletching; $colavg($gettok(%23,2,44)) Fishing; $colavg($gettok(%24,2,44)) Firemaking; $colavg($gettok(%25,2,44)) Crafting; $colavg($gettok(%26,2,44)) Smithing; $&
$colavg($gettok(%27,2,44)) Mining; $colavg($gettok(%28,2,44)) Herblore; $colavg($gettok(%29,2,44)) Agility; $colavg($gettok(%30,2,44)) Thieving; $colavg($gettok(%31,2,44)) Slayer; $colavg($gettok(%32,2,44)) Farming; $colavg($gettok(%33,2,44)) Runecraft; $colavg($gettok(%34,2,44)) Hunter; $colavg($gettok(%35,2,44)) Construction;
%saystyle Minigames: $colavg($gettok(%37,2,44)) Dueling; $colavg($gettok(%38,2,44)) Bounty Hunter; $colavg($gettok(%39,2,44)) Bounty Hunter Rogue;
}
:unset
unset %*
.hfree ranking
}
alias colavg {
if ($calc($remove($1,~) - %avg) >= 8) { return $iif(*~* iswm $1-,$+(03,$remove($1,-),),$+(03,$bytes($remove($1,-),db),)) }
else {
if ($calc($remove($1,~) - %avg) < -8) { return $iif(*~* iswm $1-,$+(04,$remove($1,-),),$+(04,$bytes($remove($1,-),db),)) }
else { return $iif(*~* iswm $1-,$+(07,$remove($1,-),),$+(07,$bytes($remove($1,-),db),)) }
}
}
alias capwords {
if ($left($1,1) isnum) { return $1- }
else {
var %t
var %x = 0
while $1 != $numtok($1-,32) {
inc %x 1
var %t = %t $upper($left($gettok($1-,1,32),1)) $+ $right($gettok($1-,1,32),-1) $gettok($1-,2-,32) } return %t
}
}