rendered paste bodyon $*:TEXT:/^[@!]set ?co?m?b((a)?(t))? ?(.+)$/Si:#: {
if ($nick isop $chan) {
writeini -n pccheck.ini $chan cmb $regml($regml(0))
msg $chan $+($chr(3),$readini(pccheck.ini,$chan,color1)) $+ The required combat level for $+($chr(3),$readini(pccheck.ini,$chan,color2)) $+ $chan $+($chr(3),$readini(pccheck.ini,$chan,color1)) $+ has been set to $+($chr(3),$iif(? iswm $readini(pccheck.ini,$chan,color2),0 $+ $v2,$v2)) $+ $regml($regml(0))
}
}
on $*:TEXT:/^[@!]set ?(at[kt]|str) ?(.+)$/Si:#: {
if ($nick isop $chan) {
writeini -n pccheck.ini $chan attstr $regml($regml(0))
msg $chan $+($chr(3),$readini(pccheck.ini,$chan,color1)) $+ The required combined attack and strength level for $+($chr(3),$readini(pccheck.ini,$chan,color2)) $+ $chan $+($chr(3),$readini(pccheck.ini,$chan,color1)) $+ has been set to $+($chr(3),$iif(? iswm $readini(pccheck.ini,$chan,color2),0 $+ $v2,$v2)) $+ $regml($regml(0))
}
}
on $*:TEXT:/^[@!]ban ?(time)? ?(.+)$/Si:#: {
if ($nick isop $chan) {
writeini -n pccheck.ini $chan ban $regml($regml(0))
msg $chan $+($chr(3),$readini(pccheck.ini,$chan,color1)) $+ The amount of Seconds a user will be banned when not meeting the requirements for $+($chr(3),$readini(pccheck.ini,$chan,color2)) $+ $chan $+($chr(3),$readini(pccheck.ini,$chan,color1)) $+ has been set to $+($chr(3),$iif(? iswm $readini(pccheck.ini,$chan,color2),0 $+ $v2,$v2)) $+ $regml($regml(0))
}
}
on $*:TEXT:/^[@!]color1 ?(.+)$/Si:#: {
if ($nick isop $chan) {
writeini -n pccheck.ini $chan color1 $regml($regml(0))
msg $chan $+($chr(3),$readini(pccheck.ini,$chan,color1)) $+ The first color for $+($chr(3),$readini(pccheck.ini,$chan,color2)) $+ $chan $+($chr(3),$readini(pccheck.ini,$chan,color1)) $+ has been set to $+($chr(3),$iif(? iswm $readini(pccheck.ini,$chan,color2),0 $+ $v2,$v2)) $+ $regml($regml(0))
}
}
on $*:TEXT:/^[@!]color2 ?(.+)$/Si:#: {
if ($nick isop $chan) {
writeini -n pccheck.ini $chan color2 $regml($regml(0))
msg $chan $+($chr(3),$readini(pccheck.ini,$chan,color1)) $+ The second color for $+($chr(3),$readini(pccheck.ini,$chan,color2)) $+ $chan $+($chr(3),$readini(pccheck.ini,$chan,color1)) $+ has been set to $+($chr(3),$iif(? iswm $readini(pccheck.ini,$chan,color2),0 $+ $v2,$v2)) $+ $regml($regml(0))
}
}
on $*:TEXT:/^[@!]enable$/:#: {
if ($nick isop $chan) {
if ($istok($readini(pccheck.ini,achan,achan),$chan,44)) { msg $chan $+($chr(3),$readini(pccheck.ini,$chan,color1)) $+ The combat checking function has already been enabled $+($chr(3),$readini(pccheck.ini,$chan,color2)) $+ $chan }
else {
writeini -n pccheck.ini achan achan $addtok($readini(pccheck.ini,achan,achan),$chan,44)
set %pccheck.chans $readini(pccheck.ini,achan,achan)
if (!$readini(pccheck.ini,$chan,cmb)) { writeini -n pccheck.ini $chan cmb 100 }
if (!$readini(pccheck.ini,$chan,attstr)) { writeini -n pccheck.ini $chan attstr 180 }
if (!$readini(pccheck.ini,$chan,color1)) { writeini -n pccheck.ini $chan color1 14 }
if (!$readini(pccheck.ini,$chan,color2)) { writeini -n pccheck.ini $chan color2 04 }
if (!$readini(pccheck.ini,$chan,ban)) { writeini -n pccheck.ini $chan ban 600 }
msg $chan $+($chr(3),$readini(pccheck.ini,$chan,color1)) $+ The combat checking function has been enabled for $+($chr(3),$readini(pccheck.ini,$chan,color2)) $+ $chan $+ $+($chr(3),$readini(pccheck.ini,$chan,color1)) $+ $iif($me isop $chan,$chr(46),$iif($me ishop $chan,$chr(46),$chr(44) but I do not have the power to kick users if they do not meet the requirements.))
}
}
}
on $*:TEXT:/^[@!]disable$/:#: {
if ($nick isop $chan) {
if (!$istok($readini(pccheck.ini,achan,achan),$chan,44)) { msg $chan $+($chr(3),$iif($readini(pccheck.ini,$chan,color1),$v1,14)) $+ The combat checking function has already been disabled $+($chr(3),$iif($readini(pccheck.ini,$chan,color2),$v1,14)) $+ $chan }
else {
writeini -n pccheck.ini achan achan $iif($deltok($readini(pccheck.ini,achan,achan),$findtok($readini(pccheck.ini,achan,achan),$chan,1,44),44),$v1,#&null)
set %pccheck.chans $readini(pccheck.ini,achan,achan)
msg $chan $+($chr(3),$readini(pccheck.ini,$chan,color1)) $+ The combat checking function has been disabled for $+($chr(3),$readini(pccheck.ini,$chan,color2)) $+ $chan
}
}
}
on *:JOIN:%pccheck.chans: {
if ($nick == Erm) { Halt }
if ($nick == Pest-Control) { Halt }
if ($nick == Swift-Bot) { Halt }
if ($nick == Noob_Work) { Halt }
if ($nick == Deadftw) { Halt }
if ($nick == Unknown_Range) { Halt }
pccheck $chan $nick
}
alias pccheck {
if ($2) {
var %i 1
while ($sock(pccheck. $+ %i)) {
inc %i
}
set %pccheck. $+ %i $+ .chan $1
set %pccheck. $+ %i $+ .user $2
sockopen pccheck. $+ %i www.o-ss.net 80
}
}
on *:SOCKOPEN:pccheck.*:{
/sockwrite -t $sockname GET /parsers/stats.php?user= $+ $($+(%,pccheck.,$gettok($sockname,2,46),.user),2) HTTP/1.1 $+ $crlf
/sockwrite -t $sockname Host: www.o-ss.net $+ $crlf
/sockwrite -t $sockname $crlf
}
on *:SOCKREAD:pccheck.*:{
if ($sockerr) {
$($+(%,pccheck.,$gettok($sockname,2,46),.self),2) Socket error while looking up $(% $+ $sockname $+ .user,2) $+ : $sockerr
unset %pccheck. $+
}
else {
sockread %read
while ($sockbr > 0) {
sockread %read
tokenize 32 %read
if ($1 == <b>Warning</b>:) { msg $($+(%,pccheck.,$gettok($sockname,2,46),.chan),2) $+($chr(3),$readini(pccheck.ini,$($+(%,pccheck.,$gettok($sockname,2,46),.chan),2),color1)) $+ Unable to connect to highscores for user $+($chr(3),$readini(pccheck.ini,$($+(%,pccheck.,$gettok($sockname,2,46),.chan),2),color2)) $+ $($+(%,pccheck.,$gettok($sockname,2,46),.user),2) | sockclose $sockname }
else {
if ($1 == Attack) { var %att = $replace($3,Ranked,1) }
if ($1 == Defence) { var %def = $replace($3,Ranked,1) }
if ($1 == Strength) { var %str = $replace($3,Ranked,1) }
if ($1 == Hitpoints) { var %hp = $replace($3,Ranked,10) }
if ($1 == Ranged) { var %range = $replace($3,Ranked,1) }
if ($1 == Prayer) { var %pray = $replace($3,Ranked,1) }
if ($1 == Magic) { var %mage = $replace($3,Ranked,1) }
if ($1 == END) {
var %cmb = $meleecmb(%att,%str,%def,%hp,%range,%mage,%pray) Melee
if ($rangecmb(%att,%str,%def,%hp,%range,%mage,%pray) > $gettok(%cmb,1,32)) { var %cmb = $v1 Ranged }
if ($magecmb(%att,%str,%def,%hp,%range,%mage,%pray) > $gettok(%cmb,1,32)) { var %cmb = $v1 Magic }
msg $($+(%,pccheck.,$gettok($sockname,2,46),.chan),2) 14[12RSN: 04 $+ $($+(%,pccheck.,$gettok($sockname,2,46),.user),2) 14× 12Cmb: 04 $+ $gettok(%cmb,1,32) 14× 12Class: 04 $+ $gettok(%cmb,2,32) $+ 14] × [12Att: 04 $+ %att 14× 12Str: 04 $+ %str 14× 12Def: 04 $+ %def 14× 12HP: 04 $+ %hp 14× 12Mage: 04 $+ %mage 14× 12Range: 04 $+ %range 14× 12Prayer: 04 $+ %pray $+ 14]
if ($gettok(%cmb,1,32) < $readini(pccheck.ini,n,$($+(%,pccheck.,$gettok($sockname,2,46),.chan),2),cmb)) {
if ($calc(%att + %str) >= $readini(pccheck.ini,n,$($+(%,pccheck.,$gettok($sockname,2,46),.chan),2),attstr)) {
mode $($+(%,pccheck.,$gettok($sockname,2,46),.chan),2) +v $($+(%,pccheck.,$gettok($sockname,2,46),.user),2)
}
else {
ban -u $+ $readini(pccheck.ini,n,$($+(%,pccheck.,$gettok($sockname,2,46),.chan),2),ban) $($+(%,pccheck.,$gettok($sockname,2,46),.chan),2) $($+(%,pccheck.,$gettok($sockname,2,46),.user),2) 2
kick $($+(%,pccheck.,$gettok($sockname,2,46),.chan),2) $($+(%,pccheck.,$gettok($sockname,2,46),.user),2) $+($chr(3),$readini(pccheck.ini,$($+(%,pccheck.,$gettok($sockname,2,46),.chan),2),color1)) $+ You do not meet the minimum requirements (Combat Level $readini(pccheck.ini,n,$($+(%,pccheck.,$gettok($sockname,2,46),.chan),2),cmb) or att+str lvl $v2 $+ ) for this channel.
}
}
else { mode $($+(%,pccheck.,$gettok($sockname,2,46),.chan),2) +v $($+(%,pccheck.,$gettok($sockname,2,46),.user),2) }
}
}
}
}
}
alias meleecmb {
if ($0 == 7) { return $calc((($1 + $2) * 0.325) + ($3 * 0.25) + ($4 * 0.25) + ($7 * 0.125)) }
elseif ($0 == 5) { return $calc((($1 + $2) * 0.325) + ($3 * 0.25) + ($4 * 0.25) + ($5 * 0.125)) }
}
alias rangecmb {
if ($0 == 7) { return $calc((($5 * 1.5) * 0.325) + ($3 * 0.25) + ($4 * 0.25) + ($7 * 0.125)) }
elseif ($0 == 4) { return $calc((($1 * 1.5) * 0.325) + ($2 * 0.25) + ($3 * 0.25) + ($4 * 0.125)) }
}
alias magecmb {
if ($0 == 7) { return $calc((($6 * 1.5) * 0.325) + ($3 * 0.25) + ($4 * 0.25) + ($7 * 0.125)) }
elseif ($0 == 4) { return $calc((($1 * 1.5) * 0.325) + ($2 * 0.25) + ($3 * 0.25) + ($4 * 0.125)) }
}
on *:text:*#*:#:{ kick $chan $nick 4No advertising other PestControl Channels! }
}
on $*:TEXT:$(/^(?>\Q $+ $me $+ \E,? ?)?([!.@~]price)/Si):*:{
if (($readini(dchans.ini, dchans, $chan) == on) && ($me !isin $1)) /halt
/tokenize 32 $iif($me isin $1,$deltok($1-,1,32),$1-)
if (!$2) {
.notice 9$nick No item entered.
}
;;; Loops through the sockets to find the first open one.;;;
else {
var %x = 1
while ($sock($+(Price.,%x))) {
inc %x
}
;;; Set vars and open socket;;;
set $+(%,price.target,.,%x) $iif($left($1,1) == @ && ($nick !isreg $chan),.msg $chan,.notice $nick)
set $+(%,price.search,.,%x) $replace($2-,$chr(32),+)
sockopen $+(Price,.,%x) www.o-ss.net 80
}
}
On *:SockOpen:Price.*:{
var %id = $right($sockname,-6)
sockwrite -nt $sockname GET /parsers/price.php?item= $+ $eval($+(%,price.search,.,%id),2) HTTP/1.1
sockwrite -nt $sockname Host: www.o-ss.net $+ $crlf $+ $crlf
}
On *:SockRead:Price.*:{
var %id = $right($sockname,-6)
var %target = $eval($+(%,price.target,.,%id),2)
if ($sockerr) {
%target 8A socket error has occured, please try again later.
/cleanup %id
/halt
}
;;; Opens an Infinate loop to find results;;;
/var %read
/sockread %read
/tokenize 32 %read
if (*END* iswm $1-) {
/inc %matches. [ $+ [ %id ] ]
/set %results. [ $+ [ %id ] ] $(%results. [ $+ [ %id ] ],2) $iif(%results. [ $+ [ %id ] ],$col1($+($chr(2),$chr(124),$chr(2))),$chr(32)) $col2($deltok($1-,$0,32))
}
if (DONE isin $1-) {
if (!%matches. [ $+ [ %id ] ]) {
%target $col1(No matches found)
/cleanupr %id
}
if (%matches. [ $+ [ %id ] ]) {
9 %target $col1(Returning) $col2(%matches. [ $+ [ %id ] ]) $col1(results:)
%target %results. [ $+ [ %id ] ]
/cleanupr %id
}
}
}
;;; Local aliases for running the script.;;;
alias -l col1 {
return $+($chr(3),2,$1-,$chr(3))
}
alias -l col2 {
return $+($chr(3),10,$1-,$chr(3))
}
alias -l cleanupr {
sockclose price. $+ $1
unset $+(%,Price,.,*,.,$1)