All pastes #459913 Raw Edit

Someone

public text v1 · immutable
#459913 ·published 2007-04-26 19:25 UTC
rendered paste body
on $*:TEXT:/^[!@.]*(Lvl|level)/Si:#:{ 
  if (!$2) { msg $chan 9,7 To work it use 11,7 !/@lvl/level Skill(Must start with a caps letter) Startlvl Currentlvl targetlvl
  }
  else {
    unset %Things.*
    unset %t
    unset %z
    sockclose lvl
    set %output.lvl $iif($left($1,1) == @, msg $chan, notice $nick)
    set %skill $2
    set %startlvl $3
    set %curentlvl $4
    set %target $5
    sockopen lvl www.zybez.net 80
  }
}

on *:sockopen:lvl: {
  sockwrite -nt $sockname GET /calcs.php?calc= $+ %skill $+ &level_start= $+ %startlvl $+ &current= $+ %curentlvl $+ &target= $+ %target $+ &current_type=level&special=0  HTTP/1.1
  sockwrite -nt $sockname Host: www.zybez.net
  sockwrite -nt $sockname $crlf
}
on *:sockread:lvl: {
  if ($sockerr) { msg $chan Error while doing command
    sockclose $sockname
    halt
  }
  else {
    var %readd
    sockread %readd
    if (*You have completed * of your goal and you will need a total of * to finish it!* iswm %readd) { 
      set %xp %readd
    }
    if (*<td class="tablebottom">* iswm %readd) {
      inc %z
      if (%z < 200) { 
        set %things. $+ %z $htmlfree(%readd) 
      }
      inc %t
      if (%t < 2) { 
        %output.lvl %xp
        %output.lvl %things.2 %things.5 %things.8 %things.10 %things.13 %things.15 %things.43 %things.45 %things.72 %things.75 %things.97 %things.99
      }
    }
  }
}

alias htmlfree {
  var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$chr(32),%x), %x = $remove(%x,&nbsp;)
  return %x
}