All pastes #708215 Raw Edit

Something

public text v1 · immutable
#708215 ·published 2007-09-23 17:37 UTC
rendered paste body
on *:text:*:#:{  
  if ($left($1,1) isin !.@) {
    if ($skill($right($1,-1))) {
      if ($mid($me,5) == SwiftRS) {
        if (%antispam.skill [ $+ [ $chan ] ] == yes) { halt }
        if (!$2) {
          if (!$hget(RSN, $address($nick,2))) {
            notice $nick $+($c2,[,$c1,SKILL,$c2,],$c1) Please save a $c2(RSN) 7via 4!defname RSN7 or use12 $1 USER
          }
        }
        if (*$* iswm $2-) || (*%* iswm $2-) {
          notice $nick Error: $replace($v1,*,') found in ' $+ $1- $+ ' 
          halt
        }
        else {
          set -u2.5 %antispam.skill [ $+ [ $chan ] ] yes 
          var %socketid $rand(1,99999)
          set %output.skill [ $+ [ %socketid ] ]  $iif($left($1,1) == @,msg $chan,notice $nick)
          set %skill.user. [ $+ [ %socketid ] ] $replace($iif($2-,$2-,$hget(RSN, $address($nick,2))),$chr(32),_)
          set %statid. [ $+ [ %socketid ] ] $statid($skill($remove($1,@,.,!)))
          sockopen $+(skill.,%socketid) hiscore.runescape.com 80
        }
      }

    }
  }
}
on *:sockopen:skill.*:{
  sockwrite -nt $sockname GET $+(/index_lite.ws?player=,%skill.user. [ $+ [ $gettok($sockname,2,46) ] ]) HTTP/1.1
  sockwrite -nt $sockname Host: hiscore.runescape.com
  sockwrite -nt $sockname $crlf $crlf
}
on *:sockread:skill.*:{
  var %sockread
  sockread %sockread
  if (*HTTP/1.1 404 Not found* iswm %sockread) {
    %output $+($c1,[,$c2,HighScores,$c1,],$c2) %skill.user. [ $+ [ $gettok($sockname,2,46) ] ] could not be found in the highscores
    sockclose $sockname
  } 
  if (($Chr(44) isin %sockread) && (GMT !isin %sockread)) {
    if (!%id. [ $+ [ $gettok($sockname,2,46) ] ]) set %id [ $+ [ $gettok($sockname,2,46) ] ] 0
    if (%statid. [ $+ [ $gettok($sockname,2,46) ] ] == %id. [ $+ [ $gettok($sockname,2,46) ] ]) {
      tokenize 44 %sockread
      if ($1 == -1) && ($2 == -1) && ($3 == -1) {
        %output.skill [ $+ [ $gettok($sockname,2,46) ] ] $+($c1,[,$c2,HighScores,$c1,],$c2) $upper(%skill.user. [ $+ [ $gettok($sockname,2,46) ] ]) does not feature in the highscores for $+($c2,$skill(%statid. [ $+ [ $gettok($sockname,2,46) ] ]))
        sockclose $sockname
      } 
      else {
        %output.skill [ $+ [ $gettok($sockname,2,46) ] ] $+($c1,[,$c2,$skill(%statid. [ $+ [ $gettok($sockname,2,46) ] ]),$c1,],$c2) $+($c1,[,$c2,$upper(%skill.user. [ $+ [ $gettok($sockname,2,46) ] ]),$c1,],$c2) $+($c1,[,$c2,LVL,$c1,],$c2) $2 $+($c1,[,$c2,EXP,$c1,],$c2) $comma($3) $+($c1,[,$c2,RANK,$c1,],$c2) $comma($1) $+($c1,[,$c2,EXP Til: $calc($2 + 1),$c1,],$c2) $comma($calc($explvl($calc($2 + 1)) - $3))
        unset %output.skill [ $+ [ $gettok($sockname,2,46) ] ]
        unset %id. [ $+ [ $gettok($sockname,2,46) ] ]
        unset %statid. [ $+ [ $gettok($sockname,2,46) ] ]
        unset %skill.user. [ $+ [ $gettok($sockname,2,46) ] ]
        sockclose $sockname
      }
    }
    elseif (%statid. [ $+ [ $gettok($sockname,2,46) ] ] != %id. [ $+ [ $gettok($sockname,2,46) ] ]) {
      inc %id. [ $+ [ $gettok($sockname,2,46) ] ]
    }
  }
}
alias explvl { 
  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 14391160 15889109 17542976 19368992 21385073 23611006 26068632 28782069 31777943 35085654 38737661 42769801 47221641 52136869 57563718 63555443 70170840 77474828 85539082 94442737 104273167 115126838 127110260 140341028 154948977 171077457 188884740 208545572,$1,32) 
} 



alias -l 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) || ($regex($1,/^Agil(ity)?/Si))) 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
}
alias statid {
  if ($1 == Overall) return 0
  if ($1 == Attack) return 1
  if ($1 == Defence) return 2
  if ($1 == Strength) return 3
  if ($1 == Hitpoints) return 4
  if ($1 == Ranged) return 5
  if ($1 == Prayer) return 6
  if ($1 == Magic) return 7
  if ($1 == Cooking) return 8
  if ($1 == Woodcutting) return 9
  if ($1 == Fletching) return 10
  if ($1 == Fishing) return 11
  if ($1 == Firemaking) return 12
  if ($1 == Crafting) return 13
  if ($1 == Smithing) return 14
  if ($1 == Mining) return 15
  if ($1 == Herblore) return 16
  if ($1 == Agility) return 17
  if ($1 == Thieving) return 18
  if ($1 == Slayer) return 19
  if ($1 == Farming) return 20
  if ($1 == Runecraft) return 21
  if ($1 == Hunter) return 22
  if ($1 == Construction) return 23
}

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