All pastes #716415 Raw Edit

Anonymous

public text v1 · immutable
#716415 ·published 2007-09-26 20:11 UTC
rendered paste body
on $*:text:/^[@!.]stats/Si:#:{
  if ($mid($me,5) == SwiftRS) {
    set %output $iif($left($1,1) == @,msg $chan,notice $nick)
    if (%antispam.stats [ $+ [ $chan ] ] == yes) { halt }
    if (!$2) || ($regex($2,/^[#-.](r|e)/Si)) {
      if (!$hget(RSN, $address($nick,2))) {
        notice $nick $+($c2,[,$c1,STATS,$c2,],$c1) Please save a $c2(RSN) 7via 4!defname RSN7 or use12 $1 USER
        halt
      }

    }
    if (*$* iswm $2-) || (*%* iswm $2-) {
      notice $nick Error: $replace($v1,*,') found in ' $+ $1- $+ '
      halt
    }
    else {
      set -u2.5 %antispam.stats [ $+ [ $chan ] ] yes 
      var %sockid $rand(1,99999)
      if ($regex($2,/^[#-.](r|e)/Si)) set %present [ $+ [ %sockid ] ] $iif($right($2,1) == e,EXP,Ranked)
      set %id. [ $+ [ %sockid ] ] 0  
      set %output. [ $+ [ %sockid ] ] $iif($left($1,1) == @,msg $chan,notice $nick)
      set %statname. [ $+ [ %sockid ] ] $iif(($regex($2,/^[#-.](r|e)/Si)),$replace($iif($3-,$3-,$hget(RSN, $address($nick,2))),$chr(32),_),$replace($iif($2-,$2-,$hget(RSN, $address($nick,2))),$chr(32),_))
      sockopen $+(stats.,%sockid) hiscore.runescape.com 80
    }
  }
}
on $*:text:/^[@!.]RSN/Si:#:{
  if ($mid($me,5) == SwiftRS) {
    set %output.RSN $iif((($nick isop $chan) || ($nick ishop $chan)) && ($left($1,1) == @),msg $chan,notice $nick)
    if (*$* iswm $2-) || (*%* iswm $2-) {
      notice $nick Error: $replace($v1,*,') found in ' $+ $1- $+ '
      halt
    }
    if (!$2) {
      if (!$hget(RSN, $address($nick,2))) {
        %output.RSN $+($c2,[,$c1,RSN,$c2,],$c1) You do not have a $c2(RSN) saved
      }
      else {
        %output.RSN $+($c2,[,$c1,RSN,$c2,],$c1) Your saved RSN, under address $c2($address($nick,2)) 7is $c2($hget(RSN, $address($nick,2)))
      }
    }
    elseif ($2) {
      if ($address($2,2) == $null) {
        %output.RSN $+($c2,[,$c1,RSN,$c2,],$c1) 4Error:7 User must be on a channel I am on for me to retrieve their 12RSN
      }
      else {
        if ($hget(RSN, $address($2,2))) {
          %output.RSN $+($c2,[,$c1,RSN,$c2,]) $2 $c1(is) $c2($hget(RSN, $address($2,2)))
        }
        else {
          %output.RSN $+($c2,[,$c1,RSN,$c2,]) $+($2,$c1) does not have a $c2(RSN) 7saved
        }
      }

    }
  }
}
on $*:text:/^[@!.](def|set)name/Si:#:{
  if ($mid($me,5) == SwiftRS) {
    if (*$* iswm $2-) || (*%* iswm $2-) {
      notice $nick Error: $replace($v1,*,') found in ' $+ $1- $+ '
      halt
    }
    if (!$2) {
      notice $nick Syntax: [!@.](def|set)name RSN 
      halt 
    }
    else {
      hadd -m RSN $address($nick,2) $2-
      notice $nick $+($c2,[,$c1,DEFNAME,$c2,],$c1) Successfully Saved $+($c2,',$2-',$c1) to host $c2($address($nick,2))
    }
  }
}
on *:sockopen:stats.*:{
  sockwrite -nt $sockname GET $+(/index_lite.ws?player=,%statname. [ $+ [ $gettok($sockname,2,46) ] ]) HTTP/1.1
  sockwrite -nt $sockname Host: hiscore.runescape.com
  sockwrite -nt $sockname $crlf $crlf
}
on *:sockread:stats.*:{
  var %sockread
  sockread %sockread
  if (*HTTP/1.1 404 Not found* iswm %sockread) {
    %output. [ $+ [ $gettok($sockname,2,46) ] ] $+($c1,[,$c2,HighScores,$c1,],$c2) %statname. [ $+ [ $gettok($sockname,2,46) ] ] does not feature in the highscores
    unset %statname. [ $+ [ $gettok($sockname,2,46) ] ]
    unset %output. [ $+ [ $gettok($sockname,2,46) ] ]
    unset %id. [ $+ [ $gettok($sockname,2,46) ] ]
    unset %stats. [ $+ [ $gettok($sockname,2,46) ] ]    
    sockclose $sockname
  } 
  if (($Chr(44) isin %sockread) && (GMT !isin %sockread)) {
    tokenize 44 %sockread
    if (%id. [ $+ [ $gettok($sockname,2,46) ] ] == 0) {
      if (!%present [ $+ [ $gettok($sockname,2,46) ] ]) {
        set %stats. [ $+ [ $gettok($sockname,2,46) ] ] %stats. [ $+ [ $gettok($sockname,2,46) ] ] $c1($skill(%id. [ $+ [ $gettok($sockname,2,46) ] ])) $c2($iif($2 != -1,$2,-))
        inc %id. [ $+ [ $gettok($sockname,2,46) ] ]
      }
      if (%present [ $+ [ $gettok($sockname,2,46) ] ] == EXP) {
        set %stats. [ $+ [ $gettok($sockname,2,46) ] ] %stats. [ $+ [ $gettok($sockname,2,46) ] ] $c1($skill(%id. [ $+ [ $gettok($sockname,2,46) ] ])) $c2($iif($2 != -1,$comma($3),-))
        inc %id. [ $+ [ $gettok($sockname,2,46) ] ]
      }
      elseif (%present [ $+ [ $gettok($sockname,2,46) ] ] == Ranked) {
        set %stats. [ $+ [ $gettok($sockname,2,46) ] ] %stats. [ $+ [ $gettok($sockname,2,46) ] ] $c1($skill(%id. [ $+ [ $gettok($sockname,2,46) ] ])) $c2($iif($2 != -1,$comma($1),-))
        inc %id. [ $+ [ $gettok($sockname,2,46) ] ]
      }
    }
    elseif (%id. [ $+ [ $gettok($sockname,2,46) ] ] != 0) {
      if (!%present [ $+ [ $gettok($sockname,2,46) ] ]) { 
        set %stats. [ $+ [ $gettok($sockname,2,46) ] ] %stats. [ $+ [ $gettok($sockname,2,46) ] ] $iif($2 != -1,$c1($skill(%id. [ $+ [ $gettok($sockname,2,46) ] ])) $c2($2))
        inc %id. [ $+ [ $gettok($sockname,2,46) ] ]
      }
      if (%present [ $+ [ $gettok($sockname,2,46) ] ] == EXP) { 
        set %stats. [ $+ [ $gettok($sockname,2,46) ] ] %stats. [ $+ [ $gettok($sockname,2,46) ] ] $iif($2 != -1,$c1($skill(%id. [ $+ [ $gettok($sockname,2,46) ] ])) $c2($comma($3)))
        inc %id. [ $+ [ $gettok($sockname,2,46) ] ]
      }
      elseif (%present [ $+ [ $gettok($sockname,2,46) ] ] == Ranked) { 
        set %stats. [ $+ [ $gettok($sockname,2,46) ] ] %stats. [ $+ [ $gettok($sockname,2,46) ] ] $iif($2 != -1,$c1($skill(%id. [ $+ [ $gettok($sockname,2,46) ] ])) $c2($comma($1)))
        inc %id. [ $+ [ $gettok($sockname,2,46) ] ]
      }
    }
  }
}
on *:sockclose:stats.*:{
  %output. [ $+ [ $gettok($sockname,2,46) ] ] 12Stats for7 %statname. [ $+ [ $gettok($sockname,2,46) ] ] $iif(%present [ $+ [ $gettok($sockname,2,46) ] ] != $null,12in7 %present [ $+ [ $gettok($sockname,2,46) ] ] 12form)
  %output. [ $+ [ $gettok($sockname,2,46) ] ] %stats. [ $+ [ $gettok($sockname,2,46) ] ]
  unset %statname. [ $+ [ $gettok($sockname,2,46) ] ]
  unset %output. [ $+ [ $gettok($sockname,2,46) ] ]
  unset %id. [ $+ [ $gettok($sockname,2,46) ] ]
  unset %stats. [ $+ [ $gettok($sockname,2,46) ] ]
  unset %present [ $+ [ $gettok($sockname,2,46) ] ] 

}

alias skill {
  if (($1 == 0) || ($regex($1,/^Over(?:all)?$/Si))) return Overall
  if (($1 == 1) || ($regex($1,/^Att?(?:a)?c?k?$/Si))) return Attack 
  if (($1 == 2) || ($regex($1,/^def(en[cs]e)?$$/Si)))  return Defence
  if (($1 == 3) || ($regex($1,/^Str(?:ength)?$/Si))) return Strength
  if (($1 == 4) || ($regex($1,/^H(?:its?|p(?:oints)?)$/Si))) return Hitpoints
  if (($1 == 5) || ($regex($1,/^Ranged?$/Si))) return Ranged
  if (($1 == 6) || ($regex($1,/^Pray(?:er)?$/Si))) return Prayer
  if (($1 == 7) || ($regex($1,/^Mag(?:e|ic)$/Si))) return Magic
  if (($1 == 8) || ($regex($1,/^Cook(?:ing?)?$/Si))) return Cooking
  if (($1 == 9) || ($regex($1,/^W(?:ood)?c(?:ut)?(?:ing?)?$/Si))) return Woodcutting
  if (($1 == 10) || ($regex($1,/^Fletch(?:ing)?$/Si))) return Fletching
  if (($1 == 11) || ($regex($1,/^Fish(?:ing)?$/Si))) return Fishing
  if (($1 == 12) || ($regex($1,/^F(?:(?:ire)?m(?:ak(?:e|ing))?)$/Si))) return Firemaking
  if (($1 == 13) || ($regex($1,/^Craft(?:ing?)?$/Si))) return Crafting
  if (($1 == 14) || ($regex($1,/^Smith(?:ing?)?$/Si))) return Smithing
  if (($1 == 15) || ($regex($1,/^Min(?:e|ing?)$/Si))) return Mining
  if (($1 == 16) || ($regex($1,/^Herb(?:y|i?(?:lor)?e)?$/Si))) return Herblore
  if (($1 == 17) || ($1 == Agility)) return Agility
  if (($1 == 18) || ($regex($1,/^Thie[fv](?:e|ing)?$/Si))) return Thieving
  if (($1 == 19) || ($regex($1,/^Slay(?:er)?$/Si))) return Slayer
  if (($1 == 20) || ($regex($1,/^Farm(?:ing)?$/Si))) return Farming
  if (($1 == 21) || ($regex($1,/^R(?:une)?C(?:raft(?:ing)?)?$/Si))) return Runecraft
  if (($1 == 22) || ($regex($1,/^Hunt(?:er|ing)?$/Si))) return Hunter
  if (($1 == 23) || ($regex($1,/^Con(?:struct(?:ion)?)?$/Si))) return Construction
}
on *:disconnect:{
  hsave RSN RSNData.txt
}
on *:START:{
  hmake RSN
  hload RSN RSNData.txt
}

alias c1 { return $+(7,$1-) }
alias c2 { return $+(12,$1-) }