All pastes #491845 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-05-16 21:38 UTC
rendered paste body
proc stats:pc {unick uhost chan mode input} {
  global rs_stats stats_exp stats_lvl
	if {$input == "-help"} { stats:out $unick $uhost $chan $mode "Syntax( <required> \[optional\] |or|): $rs_stats(trig)\[p\]pc* \[-n\] <RuneScape Nick>"; return 0 }

  if {([string range $input 0 0] == "-") && ([llength [split $input]] >= 1)} {
    set flags [string range [lindex [split $input] 0] 1 end]
    set input [lrange [split $input] 1 end]
    foreach temp [split $flags ";"] {
      switch -glob -- "$temp" {
        "n*" {
          set input [sb:rsn [getchanhost [lindex [split [join $input]] 0]]]
        }
      }
    }
  }
	
  set input [sb:testnick "$input" $uhost]
  if {$input == "Not Valid"} { stats:out $unick $uhost $chan $mode "Syntax( <required> \[optional\] |or|): $rs_stats(trig)\[p\]pc* \[-n\] <RuneScape Nick>"; return 0 }
  if {![info exists rs_stats(busy)]} {
    set rs_stats(busy) "$unick"
    timer 1 [list sb:open]
    set found [stats:getinfo $unick $uhost $chan "all" $input]
    if {$found == 1} {
			if {[info exists stats_exp(Attack)]} {
				append msg " \[att\]$rs_stats(c) [util:xp "pc $stats_exp(Attack)"]"
			}
			if {[info exists stats_exp(Defence)]} {
				append msg " \[def\]$rs_stats(c) [util:xp "pc $stats_exp(Defence)"]"
			}
			if {[info exists stats_exp(Strength)]} {
				append msg " \[str\]$rs_stats(c) [util:xp "pc $stats_exp(Strength)"]"
			}
			if {[info exists stats_exp(Hitpoints)]} {
				append msg " \[hp\]$rs_stats(c) [util:xp "pc $stats_exp(Hitpoints)"]"
			}
			if {[info exists stats_exp(Ranged)]} {
				append msg " \[range\]$rs_stats(c) [util:xp "pc $stats_exp(Ranged)"]"
			}
			if {[info exists stats_exp(Magic)]} {
				append msg " \[magic\]$rs_stats(c) [util:xp "pc $stats_exp(Magic)"]"
			}
			if {[info exists stats_exp(Prayer)]} {
				append msg " \[pray\]$rs_stats(c) [util:xp "pcpray $stats_exp(Prayer)"]"
			}
			if {[info exists msg]} {
			  stats:out $unick $uhost $chan $mode "[sb:style2 "User:"] $input $rs_stats(sep) Points Needed: $msg"
			} else {
			  stats:out $unick $uhost $chan $mode "The combat stats of \"${input}\" was not found."
			}
    } elseif {$found == 0} {
      #set status [stats:userinfo $unick $uhost $chan $input]
      set status "HAX"
      if {$status == "na"} {
        stats:out $unick $uhost $chan $mode "[sb:style2 "User"] $input cannot be registered"
      } elseif {$status == "registered"} {
        stats:out $unick $uhost $chan $mode "[sb:style2 "User"] $input is registered but does not have any hiscores"
      } elseif {$status == "not registered"} {
        stats:out $unick $uhost $chan $mode "[sb:style2 "User"] $input is not registered"
      } else {
        stats:out $unick $uhost $chan $mode "[sb:style2 "Stats of"] $input was not found"
      }
    }
    if {[info exists stats_exp]} { unset stats_exp }
    unset rs_stats(busy)
  } else {
    stats:out $unick $uhost $chan "n" "Already in Use by $rs_stats(busy). Please try again in a few seconds"
  }
  return 1
}
proc addslashes {string} { return [string map {\\ \\\\ \| \\| \[ \\[ \] \\] \{ \\{ \} \( \\( \) \\) \\} $ \\$ \` \\` \' \\' \" \\" "\*" "\\*" "\+" "\\+" "\-" "\\-"} $string] }