All pastes #442833 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-04-16 14:32 UTC
rendered paste body
alias -l c1 { return $+($chr(3),01,$1-) } 
alias -l c2 { return $+($chr(3),09,$1-) } 

on *:TEXT:*:#: { 
  if ($1 == shit) || ($regex($1,/(=|[^<]*>|<[^>]*>|<[^>]|[0-9])/Si)) || ($3) { halt } 
  inc %ID 

  ;if !defname (you cant use $findfile w/ this); 

  if ($right($1,-1) == defname) && ($2) && ($len($2-) <12> 12) { $hget(table. $+ %ID,display. $+ %ID) $c1(The nickname) $c2($2-) $c1(is too long) | halt } 
  if ($2) /hadd -m table. $+ %ID target. $+ %ID $replace($2-,$chr(32),$chr(95)) 
  elseif ($readini(DefRSN.ini,RSNs,$mask($fulladdress,3))) /hadd -m table. $+ %ID target. $+ %ID $ifmatch 
  elseif ($readini(DefRSN.ini,RSNs,$nick)) /hadd -m table. $+ %ID target. $+ %ID $ifmatch 
  else /hadd -m table. $+ %ID target. $+ %ID $nick 
  sockopen $+(rs.,%ID) hiscore.runescape.com 80 
} 
elseif ($right($1,-1) == stats) { 

  ;if its !stats; 

  /hadd -m table. $+ %ID Style. $+ %ID allstats 
  /hadd -m table. $+ %ID target. $+ %ID $replace($2-,$chr(32),$chr(95)) 
  /hadd -m table. $+ %ID display. $+ %ID $iif($left($1,1) == @,msg $chan,notice $nick) 
  if ($len($2-) > 12) { $hget(table. $+ %ID,display. $+ %ID) $c1(The nickname) $c2($2-) $c1(is too long) | halt } 
  if ($2) /hadd -m table. $+ %ID target. $+ %ID $replace($2-,$chr(32),$chr(95)) 
  elseif ($readini(DefRSN.ini,RSNs,$mask($fulladdress,3))) /hadd -m table. $+ %ID target. $+ %ID $ifmatch 
  elseif ($readini(DefRSN.ini,RSNs,$nick)) /hadd -m table. $+ %ID target. $+ %ID $ifmatch 
  else /hadd -m table. $+ %ID target. $+ %ID $nick 
  sockopen $+(rs.,%ID) hiscore.runescape.com 80 
  halt 
} 
elseif ($regex($1,/co?mb(at)?/Si)) { 

  ;if its !cmb; 

  /hadd -m table. $+ %ID Style. $+ %ID combat 
  /hadd -m table. $+ %ID target. $+ %ID $replace($2-,$chr(32),$chr(95)) 
  /hadd -m table. $+ %ID display. $+ %ID $iif($left($1,1) == @,msg $chan,notice $nick) 
  if ($len($2-) > 12) { $hget(table. $+ %ID,display. $+ %ID) $c1(The nickname) $c2($2-) $c1(is too long) | halt } 
  if ($2) /hadd -m table. $+ %ID target. $+ %ID $replace($2-,$chr(32),$chr(95)) 
  elseif ($readini(DefRSN.ini,RSNs,$mask($fulladdress,3))) /hadd -m table. $+ %ID target. $+ %ID $ifmatch 
  elseif ($readini(DefRSN.ini,RSNs,$nick)) /hadd -m table. $+ %ID target. $+ %ID $ifmatch 
  else /hadd -m table. $+ %ID target. $+ %ID $nick 
  sockopen $+(rs.,%ID) hiscore.runescape.com 80 
  halt 
} 
else { halt } 
} 
on *:SOCKOPEN:rs.*:{ 
  var %ID = $gettok($sockname,2,46) 
  sockwrite -nt $sockname GET /lang/en/aff/runescape/hiscorepersonal.ws?user1= $+ $hget(table. $+ %ID,target. $+ %ID) HTTP/1.1 
  sockwrite -nt $sockname Host: hiscore.runescape.com $+ $crlf $+ $crlf 
} 
on *:SOCKREAD:rs.*:{ 
  var %ID = $gettok($sockname,2,46), $& 
    %file = $hget(table. $+ %ID,search. $+ %ID), $& 
    %style = $hget(table. $+ %ID,style. $+ %ID) 
  if ($sockerr) { 
    echo -a Error. 
    halt 
  } 
  else { 
    var %read 
    sockread %read 
    if (*feature* iswm %read) { 

      ;if none of the skills for $nick is in highscores; 

      $hget(table. $+ %ID,display. $+ %ID) $c1(The nickname:) $c2($hget(table. $+ %ID,target. $+ %ID)) $c1(did not feature in runescape highscores for any skill!)              
      sockclose $sockname 
      halt 
    } 
    elseif (%style == stat) { 
      if (%file iswm %read) { 

        ;get the rank/level/exp for certain skill; 

        /hadd -m table. $+ %ID rank. $+ %ID $htmlfree($GetRank(%read)) 
        /hadd -m table. $+ %ID Level. $+ %ID $htmlfree($ReadNextLine(%read)) 
        /hadd -m table. $+ %ID exp. $+ %ID $htmlfree($ReadNextLine(%read)) 
        if (!$hget(table. $+ %ID,level. $+ %ID)) { 

          ;if skill isnt ranked; 

          $hget(table. $+ %ID,display. $+ %ID) $c1(The nickname:) $c2($hget(table. $+ %ID,target. $+ %ID)) $c1(did not feature in runescape highscores for) $c2($hget(table. $+ %ID,search. $+ %ID))                    
          sockclose $sockname 
          halt 
        } 

        ;display the informations witch you got above; 

        $hget(table. $+ %ID,display. $+ %ID) $c2(%file) $c1(stats for) $c2($hget(table. $+ %ID,target. $+ %ID)) $+ $c1(:) 
        if (%file == overall) { 
          $hget(table. $+ %ID,display. $+ %ID) $c1(Level:) $c2($hget(table. $+ %ID,level. $+ %ID)) $c1(Rank:) $c2($hget(table. $+ %id,rank. $+ %ID)) $c1(Exp:) $c2($hget(table. $+ %ID,Exp. $+ %ID)) 
          sockclose $sockname 
          halt 
        } 
        $hget(table. $+ %ID,display. $+ %ID) $c1(Level:) $c2($hget(table. $+ %ID,level. $+ %ID)) $c1(Rank:) $c2($hget(table. $+ %id,rank. $+ %ID)) 
        $hget(table. $+ %ID,display. $+ %ID) $c1(Exp:) $c2($hget(table. $+ %ID,Exp. $+ %ID)) $c1(Exp for) $c2($calc($hget(table. $+ %ID,level. $+ %ID) + 1)) $c1(%file) $+ $c1(:) $c2($comma($xp2next($hget(table. $+ %ID,level. $+ %ID),$hget(table. $+ %ID,exp. $+ %ID))))      
        sockclose $sockname 
        halt 
      } 
    } 
    elseif (%style == allstats) { 

      ;get information about every single stat,; 

      if (Overall iswm %read) /hadd -m table. $+ %ID Hoverall. $+ %ID $c1(Overall:) $c2($htmlfree($GetLevel(%read))) 
      if (Attack iswm %read) /hadd -m table. $+ %ID Hattack. $+ %ID $c1(Attack:) $c2($htmlfree($GetLevel(%read))) 
      if (Defence iswm %read) /hadd -m table. $+ %ID Hdefence. $+ %ID $c1(Defence:) $c2($htmlfree($GetLevel(%read))) 
      if (Strength iswm %read) /hadd -m table. $+ %ID Hstrength. $+ %ID $c1(Strength:) $c2($htmlfree($GetLevel(%read))) 
      if (Hitpoints iswm %read) /hadd -m table. $+ %ID Hhitpoints. $+ %ID $c1(Hitpoints:) $c2($htmlfree($GetLevel(%read))) 
      if (Ranged iswm %read) /hadd -m table. $+ %ID Hrange. $+ %ID $c1(Ranged:) $c2($htmlfree($GetLevel(%read))) 
      if (Prayer iswm %read) /hadd -m table. $+ %ID Hprayer. $+ %ID $c1(Prayer:) $c2($htmlfree($GetLevel(%read))) 
      if (Magic iswm %read) /hadd -m table. $+ %ID Hmagic. $+ %ID $c1(Magic:) $c2($htmlfree($GetLevel(%read))) 
      if (cooking iswm %read) /hadd -m table. $+ %ID Hcook. $+ %ID $c1(Cooking:) $c2($htmlfree($GetLevel(%read))) 
      if (woodcutting iswm %read) /hadd -m table. $+ %ID Hwc. $+ %ID $c1(Woodcutting:) $c2($htmlfree($GetLevel(%read))) 
      if (fletching iswm %read) /hadd -m table. $+ %ID Hfletch. $+ %ID $c1(Fletching:) $c2($htmlfree($GetLevel(%read))) 
      if (fishing iswm %read) /hadd -m table. $+ %ID Hfish. $+ %ID $c1(Fishing:) $c2($htmlfree($GetLevel(%read))) 
      if (Firemaking iswm %read) /hadd -m table. $+ %ID Hfm. $+ %ID $c1(Firemaking:) $c2($htmlfree($GetLevel(%read))) 
      if (Crafting iswm %read) /hadd -m table. $+ %ID Hcraft. $+ %ID $c1(Crafting:) $c2($htmlfree($GetLevel(%read))) 
      if (Smithing iswm %read) /hadd -m table. $+ %ID Hsmith. $+ %ID $c1(Smithing:) $c2($htmlfree($GetLevel(%read))) 
      if (Mining iswm %read) /hadd -m table. $+ %ID Hmining. $+ %ID $c1(Mining:) $c2($htmlfree($GetLevel(%read))) 
      if (Herblore iswm %read) /hadd -m table. $+ %ID Hherb. $+ %ID $c1(Herblore:) $c2($htmlfree($GetLevel(%read))) 
      if (Agility iswm %read) /hadd -m table. $+ %ID Hagility. $+ %ID $c1(Agility:) $c2($htmlfree($GetLevel(%read))) 
      if (Thieving iswm %read) /hadd -m table. $+ %ID Hthieving. $+ %ID $c1(Thieving:) $c2($htmlfree($GetLevel(%read))) 
      if (Slayer iswm %read) /hadd -m table. $+ %ID Hslayer. $+ %ID $c1(Slayer:) $c2($htmlfree($GetLevel(%read))) 
      if (Farming iswm %read) /hadd -m table. $+ %ID Hfarming. $+ %ID $c1(Farming:) $c2($htmlfree($GetLevel(%read)))} 
      if (Runecraft iswm %read) /hadd -m table. $+ %ID Hrunecraft. $+ %ID $c1(Runecraft:) $c2($htmlfree($GetLevel(%read))) 
      if (Hunter iswm %read) /hadd -m table. $+ %ID Hhunter. $+ %ID $c1(Hunter:) $c2($htmlfree($GetLevel(%read)))) 
      if (Construction iswm %read) /hadd -m table. $+ %ID Hcon. $+ %ID $c1(Construction:) $c2($htmlfree($GetLevel(%read))) 
    } 
    if (*class="mainscroll-bottom"* iswm %read) { 

      ;display the information; 

      $hget(table. $+ %ID,display. $+ %ID) $c1(stats for) $c2($hget(table. $+ %ID,target. $+ %ID)) $+ $c1(:) 
      $hget(table. $+ %ID,display. $+ %ID) $hget(table. $+ %ID,hoverall. $+ %ID) 
      $hget(table. $+ %ID,display. $+ %ID) $hget(table. $+ %ID,Hattack. $+ %ID) $hget(table. $+ %ID,Hstrength. $+ %ID) $hget(table. $+ %ID,Hdefence. $+ %ID) $hget(table. $+ %ID,Hhitpoints. $+ %ID) $hget(table. $+ %ID,HRange. $+ %ID) $hget(table. $+ %ID,Hprayer. $+ %ID) $hget(table. $+ %ID,Hmagic. $+ %ID) $hget(table. $+ %ID,Hcook. $+ %ID) $hget(table. $+ %ID,Hwc. $+ %ID) $hget(table. $+ %ID,Hfletch. $+ %ID) $hget(table. $+ %ID,Hfish. $+ %ID) $& 
        $hget(table. $+ %ID,Hfm. $+ %ID) $hget(table. $+ %ID,Hsmith. $+ %ID) $hget(table. $+ %ID,Hmining. $+ %ID) $hget(table. $+ %ID,Hcraft. $+ %ID) $hget(table. $+ %ID,HAgility. $+ %ID) $hget(table. $+ %ID,HThieving. $+ %ID) $hget(table. $+ %ID,HSlayer. $+ %ID) $hget(table. $+ %ID,Hfarming. $+ %ID) $hget(table. $+ %ID,Hrunecarft. $+ %ID) $hget(table. $+ %ID,HHunter. $+ %ID) $hget(table. $+ %ID,Hcon. $+ %ID)      
      sockclose $sockname 
      halt 
    } 
    elseif (%style == combat) { 

      ;Get the Combat skills information; 

      if (Attack iswm %read) /hadd -m table. $+ %ID Hattack. $+ %ID $htmlfree($GetLevel(%read)) 
      if (Defence iswm %read) /hadd -m table. $+ %ID Hdefence. $+ %ID $htmlfree($GetLevel(%read)) 
      if (Strength iswm %read) /hadd -m table. $+ %ID Hstrength. $+ %ID $htmlfree($GetLevel(%read)) 
      if (Hitpoints iswm %read) /hadd -m table. $+ %ID Hhitpoints. $+ %ID $htmlfree($GetLevel(%read)) 
      if (Ranged iswm %read) /hadd -m table. $+ %ID Hrange. $+ %ID $htmlfree($GetLevel(%read)) 
      if (Prayer iswm %read) /hadd -m table. $+ %ID Hprayer. $+ %ID $htmlfree($GetLevel(%read)) 
      if (Magic iswm %read) /hadd -m table. $+ %ID Hmagic. $+ %ID $htmlfree($GetLevel(%read)) 

      ;Calculate the combat level using the Skills, many thanks to steiner for showing me calculate syntax; 

      var %a = $calc($hget(table. $+ %ID,Hdefence. $+ %ID) * 100), $& 
        %b = $calc($hget(table. $+ %ID,Hhitpoints. $+ %ID) * 100), $& 
        %c = $calc($hget(table. $+ %ID,Hprayer. $+ %ID) * 50), $& 
        %base = $calc($calc(%a + %b + %c) / 400), $& 
        %d = $calc($hget(table. $+ %ID,Hattack. $+ %ID) * 130), $& 
        %e = $calc($hget(table. $+ %ID,Hstrength. $+ %ID) * 130) 
      if ($and($hget(table. $+ %ID,Hrange. $+ %ID),1) == 0) var %f = $calc($calc($calc($hget(table. $+ %ID,Hrange. $+ %ID) - 1) + $calc($hget(table. $+ %ID,Hrange. $+ %ID) * 2)) * 65) 
      elseif ($and($hget(table. $+ %ID,Hrange. $+ %ID),1) == 1) var %f = $calc($hget(table. $+ %ID,Hrange. $+ %ID) * 195) 
      if ($and($hget(table. $+ %ID,Hmagic. $+ %ID),1) == 0) var %g = $calc($calc($calc($hget(table. $+ %ID,Hmagic. $+ %ID) - 1) + $calc($hget(table. $+ %ID,Hmagic. $+ %ID) * 2)) * 65) 
      elseif ($and($hget(table. $+ %ID,Hmagic. $+ %ID),1) == 1) var %g = $calc($hget(table. $+ %ID,Hmagic. $+ %ID) * 195) 
      var %mcombat = $calc($calc(%d + %e) / 400), $& 
        %rcombat = $calc(%f / 400), $& 
        %macombat = $calc(%g / 400) 
      if (%mcombat > %rcombat) && (%mcombat > %macombat) { 
        /hadd -m table. $+ %ID HCombat. $+ %id $calc(%mcombat + %base) 
        /hadd -m table. $+ %ID HClass. $+ %id Melee Based 
      } 
      elseif (%rcombat > %mcombat) && (%rcombat > %macombat) { 
        /hadd -m table. $+ %ID HCombat. $+ %id $calc(%rcombat + %base) 
        /hadd -m table. $+ %ID HClass. $+ %id Ranged Based 
      } 
      elseif (%macombat > %mcombat) && (%macombat > %rcombat) { 
        /hadd -m table. $+ %ID HCombat. $+ %id $calc(%macombat + %base) 
        /hadd -m table. $+ %ID HClass. $+ %id Magic Based 
      } 
      var %temp = $abs($calc($int($calc($hget(table. $+ %ID,Hcombat. $+ %ID) +1)) - $hget(table. $+ %ID,Hcombat. $+ %ID))), $& 
        %a.lvl = $ceil($calc(%temp / .32707)), %s.lvl = $ceil($calc(%temp / .324)), $& 
        %d.lvl = $ceil($calc(%temp / .25)), $& 
        %m.lvl = $ceil($calc(%temp / .487)), $& 
        %r.lvl = $ceil($calc(%temp / .487)), $& 
        %p.lvl = $ceil($calc(%temp / .124)) 
      if ($hget(table. $+ %ID,Hclass. $+ %ID) == Magic Based) var %lvl.base = Magic: %m.lvl 
      elseif ($hget(table. $+ %ID,Hclass. $+ %ID) == Ranged Based) var %lvl.base = Ranged: %r.lvl 
      else var %lvl.base = $c1(Att:) $c2(%a.lvl) $c1(Str:) $c2(%s.lvl) 

      ;Calculation end; 

      if (Cooking iswm %read) { 

        ;Message out combat information; 

        $hget(table. $+ %ID,display. $+ %ID) $c1(Combat stats for) $hget(table. $+ %ID,target. $+ %ID) $+ 12: 
        $hget(table. $+ %ID,display. $+ %ID) $c1(Level) $c2($hget(table. $+ %ID,Hcombat. $+ %ID) ( $+ $hget(table. $+ %ID,Hclass. $+ %ID) $+ )) 
        $hget(table. $+ %ID,display. $+ %ID) $c1(Attack) $c2($hget(table. $+ %ID,Hattack. $+ %ID)) $c1(Strength) $c2($hget(table. $+ %ID,Hstrength. $+ %ID)) $c1(Defence) $c2($hget(table. $+ %ID,Hdefence. $+ %ID)) $c1(Hitpoints) $c2($hget(table. $+ %ID,Hhitpoints. $+ %ID)) $c1(Ranged) $c2($hget(table. $+ %ID,HRange. $+ %ID)) $c1(Prayer) $c2($hget(table. $+ %ID,Hprayer. $+ %ID)) $c1(Magic) $c2($hget(table. $+ %ID,Hmagic. $+ %ID)) 
        $hget(table. $+ %ID,display. $+ %ID) $c1(Levels for) $c2($int($calc($hget(table. $+ %ID,Hcombat. $+ %ID) + 1)) combat) $+ $c1(:) %lvl.base $c1(def/hp:) $c2(%d.lvl) $c1(Prayer:) $c2(%p.lvl)        
        sockclose $sockname 
        halt 
      } 
    } 
  } 
} 

;my custom aliases; 

alias -l comma { Var %a, %b = $regsub($ticks,$$1,/G([+-]?d+?)(?=(?:d{3})++(?=.d++$|$))/g,1 $+ $chr(44),%a) | Return %a } 
alias -l htmlfree { var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x,&) | return %x } 
alias -l ReadNextLine { var %x = $1 | sockread %x |  return %x } 
alias -l GetRank { var %x = $1 | sockread %x | var %y | sockread %y | return %y } 
alias -l GetLevel { var %x = $1 | sockread %x | var %z | sockread %z | var %y | sockread %y | return %y } 
alias -l xp2Next { var %xp = $remove($2,$chr(44)), %nextxp = $xp($calc($1 + 1)) | return $calc(%nextxp - %xp) } 
alias -l xp { var %x = 1, %level = $calc($1 - 1), %xp = 0 | while (%x <= %level) { var %TempXp = $calc((%x + 300 * 2^(%x / 7)) /4) | inc %xp %TempXp | inc %x } | return $int(%xp) } 
alias -l setskill { 
  if ($regex($1,/^(st|(skill)?total|overall)$/Si)) return Overall 
  elseif ($1 == 1) || ($regex($1,/^at(t|k|tack)$/Si)) return Attack 
  elseif ($1 == 2) || ($regex($1,/^def(en[cs]e)?$$/Si)) return Defence 
  elseif ($1 == 3) || ($regex($1,/^str(ength)?$/Si)) return Strength 
  elseif ($1 == 4) || ($regex($1,/^hp|hit(s|points?)?$/Si)) return Hitpoints 
  elseif ($1 == 5) || ($regex($1,/^range(r|d|ing)?$/Si)) return Ranged 
  elseif ($1 == 6) || ($regex($1,/^Pray(er)?$$/Si)) return Prayer 
  elseif ($1 == 7) || ($regex($1,/^mag(e|ic)$$/Si)) return Magic 
  elseif ($1 == 8) || ($regex($1,/^cook(ing)?$/Si)) return Cooking 
  elseif ($1 == 9) || ($regex($1,/^wc|wood(cut(ting)?)?$/Si)) return Woodcutting 
  elseif ($1 == 10) || ($regex($1,/^fletch(ing)?$/Si)) return Fletching 
  elseif ($1 == 11) || ($regex($1,/^fish(ing)?$/Si)) return Fishing 
  elseif ($1 == 12) || ($regex($1,/^(fire|fm)(make?(ing)?|ing)?$/Si)) return Firemaking 
  elseif ($1 == 13) || ($regex($1,/^craft(ing)?$/Si)) return Crafting 
  elseif ($1 == 14) || ($regex($1,/^(smith|smelt)(ing)?$/Si)) return Smithing 
  elseif ($1 == 15) || ($regex($1,/^mine(ing)?$/Si)) return Mining 
  elseif ($1 == 16) || ($regex($1,/^herb(law|lore)?$/Si)) return Herblore 
  elseif ($1 == 17) || ($regex($1,/^agil(ity)?$/Si)) return Agility 
  elseif ($1 == 18) || ($regex($1,/^(th(ei|ie)[fv](e|ing)?)$/Si)) return Thieving 
  elseif ($1 == 19) || ($regex($1,/^slay(er|ing)?$/Si)) return Slayer 
  elseif ($1 == 20) || ($regex($1,/^farm(er|ing)?$/Si)) return Farming 
  elseif ($1 == 21) || ($regex($1,/^(rc|runecraft)(er|ing)?$/Si)) return Runecraft 
  elseif ($1 == 22) || ($regex($1,/^(hunt)(er|ing)?$/si)) return Hunter 
  elseif ($1 == 23) || ($regex($1,/^(con)(struc?tion)?$/si)) return Construction 
}