All pastes #113565 Raw Edit

Untitled

public text v1 · immutable
·published 2006-08-03 17:44 UTC
rendered paste body
alias cmblvl {
  return $calc((0.32707*%att)+(0.249*%def)+(0.324*%str)+(0.25*%hp)+(0.124*%pray))
}
alias magelvl {
  return $calc((0.487*%mage)+ (0.249*%def)+(0.25*%hp)+(0.124*%pray))
}
alias rangelvl {
  return $calc((0.487*%range)+(0.249*%def)+(0.25*%hp)+(0.124*%pray))
}
alias cmblvl.d {
  return $calc((0.32707*%att.d)+(0.249*%def.d)+(0.324*%str.d)+(0.25*%hp.d)+(0.124*%pray.d))
}
/*
$1 = att
$2 = def
$3 = str
$4 = hp
$5 = pray
*/
alias cmbcalc {
  return $calc((0.32707*$1)+(0.249*$2)+(0.324*$3)+(0.25*$4)+(0.124*$5))
}
menu channel {
  Stat:{ 
    dialog -m stat stat
  }
}
dialog stat {
  title "XS RuneScape Stat Lookup"
  size -1 -1 300 350

  text "Player:", 3, 100 10 50 50, right
  edit %defrsn, 4, 155 7 80 20, limit 12
  button "Look Up", 5, 240 7 50 20

  text "COMBAT", 11, 125 30 50 20, center
  text "Attack:", 12, 10 50 50 20, right
  text "Strength:", 13, 100 50 50 20, right
  text "Defence:", 14, 190 50 50 20, right
  text "Hitpoints:", 15, 10 70 50 20, right
  text "Magic:", 16, 100 70 50 20, right
  text "Ranged:", 17, 190 70 50 20, right
  text "Prayer:", 18, 10 90 50 20, right
  text "Combat:", 19, 100 90 50 20, right
  button "ReCalc", 20, 220 90 50 20

  edit , 31, 70 48 25 20
  edit , 32, 70 68 25 20
  edit , 33, 70 88 25 20
  edit , 34, 160 48 25 20
  edit , 35, 160 68 25 20
  edit , 36, 160 88 45 20
  edit , 37, 250 48 25 20
  edit , 38, 250 68 25 20

  text "NONCOMBAT", 50, 115 120 70 20, center
  text "Mining:", 51, 10 140 50 50, right
  text "Smithing:", 52, 100 140 50 20, right
  text "Crafting:", 53, 190 140 50 20, right

  edit , 70, 70 138 25 20
  edit , 71, 160 138 25 20
  edit , 72, 250 138 25 20

  text "Fishing:", 54, 10 180 50 20, right
  text "Cooking:", 55, 100 180 50 20, right
  text "Firemake:", 56, 190 180 50 20, right

  edit , 73, 70 178 25 20
  edit , 74, 160 178 25 20
  edit , 75, 250 178 25 20

  text "Fletching:", 57, 10 220 50 20, right
  text "Woodcut:", 58, 100 220 50 20, right
  text "Runecrft:", 59, 190 220 50 20, right

  edit , 76, 70 218 25 20
  edit , 77, 160 218 25 20
  edit , 78, 250 218 25 20

  text "Theiving:", 60, 10 260 50 20, right
  text "Agility:", 61, 100 260 50 20, right
  text "Herblore:", 62, 190 260 50 20, right

  edit , 79, 70 258 25 20
  edit , 80, 160 258 25 20
  edit , 81, 250 258 25 20

  text "Slayer:", 63, 10 300 50 20, right
  text "Farming:", 64, 100 300 50 20, right
  text "Constr:", 65, 190 300 50 20, right

  edit , 82, 70 298 25 20
  edit , 83, 160 298 25 20
  edit , 84, 250 298 25 20
}
dialog fletch {
  Title "Fletching"
  size -1 -1 200 250

  text "User:", 1, 2 10 50 20
  edit , 2, 30 8 80 20, limit 12

  text "Level:", 3, 10 45 50 20, right
  edit , 4, 63 43 25 20
  text "Next level:", 5, 8 80 70 20
  edit , 6, 63 78 25 20

  text "EXP:", 7, 100 45 50 20
  edit , 8, 125 43 50 20
  text "EXP:", 9, 100 80 50 20
  edit , 10, 125 78 50 20

  text "Items to Next Level", 11, 15 110 130 20
  list 12, 10 125 180 140
}
on *:DIALOG:stat:*:*:{
  if ($devent == init) { 
    if (%defrsn == $null) {
      set %defrsn $left($?="Default Runescape Username?",12)
      if (%defrsn == $null) { halt }
      else { .signal dstat %defrsn }
    }
    if (%defrsn != $null) {
      .signal dstat %defrsn
    }
  }
  if ($devent == sclick) { 
    if ($did == 5) { .signal dstat $replace($did(4),$chr(32),+) }
    if ($did == 20) { did -o $dname 36 1 $cmbcalc($did(31),$did(37),$did(34),$did(32),$did(33)) }
  }
  if ($devent == dclick) {
    if ($inrect($mouse.x,$mouse.y,10,220,50,20)) { 
      dialog -am fletch fletch
      .signal dskill Fletching 
    } 
  }
  if ($devent == close) {
    sockclose dstat   
  }
}
on *:SIGNAL:dstat:{
  did -rb stat 31-38,70-84 
  set %lookup.d $replace($1,$chr(32),+)
  sockopen dstat www.rscript.org 80
}
on *:SOCKOPEN:dstat:{
  sockwrite -nt $sockname GET /statpage.php?user= [ $+ [ %lookup.d ] ]  HTTP/1.1
  sockwrite -nt $sockname User-Agent: RuneScript Public (Crawler Bot; rscript.org;)
  sockwrite -nt $sockname Host: rscript.org $+ $crlf $+ $crlf 
}
on *:SOCKREAD:dstat:{
  sockread -f %total
  tokenize 32 $remove(%total,Stat:)
  if (*does not feature* iswm $1-) { did -er stat 31-38,70-84 | sockclose $sockname }
  if (Attack == $1) { did -eo stat 31 1 $iif($3 isnum,$3,NA) }
  if (Hitpoints == $1) { did -eo stat 32 1 $iif($3 isnum,$3,NA) }
  if (Prayer == $1) { did -eo stat 33 1 $iif($3 isnum,$3,NA) }
  if (Strength == $1) { did -eo stat 34 1 $iif($3 isnum,$3,NA) }
  if (Defence == $1) { did -eo stat 37 1 $iif($3 isnum,$3,1) }
  if (Ranged == $1) { did -eo stat 38 1 $iif($3 isnum,$3,NA) }
  if (Magic == $1) { 
    did -eo stat 35 1 $iif($3 isnum,$3,NA)
    did -eo stat 36 1 $cmbcalc($did(stat,31),$iif($did(stat,37) != NA,$did(stat,37),1),$did(stat,34),$did(stat,32),$did(stat,33))
  }
  if (Herblore == $1) { did -eo stat 81 1 $iif($3 isnum,$3,NA) }
  if (Agility == $1) { did -eo stat 80 1 $iif($3 isnum,$3,NA) }
  if (Thieving == $1) { did -eo stat 79 1 $iif($3 isnum,$3,NA) }
  if (Crafting == $1) { did -eo stat 72 1 $iif($3 isnum,$3,NA) }
  if (Fletching == $1) { did -eo stat 76 1 $iif($3 isnum,$3,NA) }
  if (Slayer == $1) { did -eo stat 82 1 $iif($3 isnum,$3,NA) }
  if (Mining == $1) { did -eo stat 70 1 $iif($3 isnum,$3,NA) }
  if (Smithing == $1) { did -eo stat 71 1 $iif($3 isnum,$3,NA) }
  if (Fishing == $1) { did -eo stat 73 1 $iif($3 isnum,$3,NA) }
  if (Cooking == $1) { did -eo stat 74 1 $iif($3 isnum,$3,NA) }
  if (Runecraft == $1) { did -eo stat 78 1 $iif($3 isnum,$3,NA) }
  if (Firemaking == $1) { did -eo stat 75 1 $iif($3 isnum,$3,NA) }
  if (Woodcutting == $1) { did -eo stat 77 1 $iif($3 isnum,$3,NA) }
  if (Farming == $1) { did -eo stat 83 1 $iif($3 isnum,$3,NA) }
  if (Construction == $1) {
    did -eo stat 84 1 $iif($3 isnum,$3,NA)
    sockclose $sockname
  }
}
alias cmbcalc { 
  return $calc((0.32707*$1)+(0.249*$2)+(0.324*$3)+(0.25*$4)+(0.124*$5))
}
alias nextlvl {
  if ($1 !isnum 1-99) { return NA }
  else { 
    var %nextlvl = $1 + 1
    return $gettok($read(nextlvl.txt,%nextlvl),2,32)
  }
}