on $*:TEXT:/^.price */Si:#: { if (!$se(private,active)) { halt } if ($se(status,price) == off) { halt } if ($left($1,1) != $se(trigger,public) && $left($1,1) != $se(trigger,private)) { halt } if ($left($1,1) == $se(trigger,public) && $readini(chansetting.ini,$chan,public) == off) { halt } if ($left($1,1) == $se(trigger,private) && $readini(chansetting.ini,$chan,private) == off) { halt } var %rstr = $+($r(0,9),$r(0,9),$r(0,9),$r(0,9),$r(0,9)) .set %price. $+ $(%rstr,2) $+ .rn $numtok($2-,44) .set %price. $+ $(%rstr,2) $+ .rc 1 .set %price. $+ $(%rstr,2) $+ .rvmi 0 .set %price. $+ $(%rstr,2) $+ .rvma 0 .set %price. $+ $(%rstr,2) $+ .nick $nick .set %price. $+ $(%rstr,2) $+ .type $iif($2 == -e,strict,$iif(-s* iswm $2,spend $dcon($remove($2,-s)),free)) .set %price. $+ $(%rstr,2) $+ .item $iif($2 == -e || -s* iswm $2,$3-,$2-) .set %price. $+ $(%rstr,2) $+ .ret $iif($left($1,1) == $se(trigger,public),msg $chan,notice $nick) .sockopen price. $+ $(%rstr,2) zybez.net 80 } alias mcol { return $+($chr(3),$cntn($se(color,price.support)),$1,$chr(3),) } alias pcol { return $+($chr(3),$cntn($se(color,price.secondary)),$1,$chr(3),) } alias icol { return $+($chr(3),$cntn($se(color,price.base)),$1,$chr(3),) } alias dcon { if (*.* !iswm $1) { return $replace($1-,K,000,M,000000,B,000000000) } if (*.* iswm $1) && (($right($1,1) == K) || ($right($1,1) == M) || ($right($1,1) == B)) { var %rdat = $1, %nums = $len($gettok($remove($1,K,M),2,46)) %rdat = $calc($remove($1,.,K,M,B) * $iif($right($1,1) == K,$+(1,$str(0,$calc(3 - %nums))),$iif($right($1,1) == M,$+(1,$str(0,$calc(6 - %nums))),$+(1,$str(0,$calc(9 - %nums)))))) return %rdat } else { return $1 } } on *:SOCKOPEN:price.*: { if ($sockerr) { $($+(%,price.,$right($sockname,5),.ret),2) SockOpen Error: $sock($sockname).wsmsg return } var %rid = $right($sockname,5) .unset $($+(%,price.calc.,%rid),1) tokenize 32 $gettok($($+(%,price.,%rid,.item),2),$($+(%,price.,%rid,.rc),2),44) if ($remove($1,k,m,.) !isnum) { var %price.tmp.sendname = $replace($1-,$chr(32),+) } else { var %price.tmp.sendname = $replace($remove($2-,$1),$chr(32),+) | .set %price.calc. $+ %rid $dcon($1) } ;if ($right(%price.tmp.sendname,1) == s) { %price.tmp.sendname = $left(%price.tmp.sendname,-1) } .sockwrite -n $sockname GET /priceguide.php?search_terms= $+ %price.tmp.sendname $+ &search_area=1&price_low=&price_high=&member=1 HTTP/1.1 .sockwrite -n $sockname Host: zybez.net $+ $crlf $+ $crlf } on *:SOCKREAD:price.*: { if ($sockerr) { $($+(%,price.,$right($sockname,5),.ret),2) SockRead Error: $sock($sockname).wsmsg return } var %rid = $right($sockname,5) tokenize 32 $gettok($($+(%,price.,%rid,.item),2),$($+(%,price.,%rid,.rc),2),44) if ($remove($1,k,m,.) !isnum) { var %price.tmp.sendname = $replace($1-,$chr(32),+) } else { var %price.tmp.sendname = $replace($2-,$chr(32),+) | .set %price.calc. $+ %rid $dcon($1) } .sockread %sr if (** iswm %sr) && (** !iswm %sr) && (** !iswm %sr) { halt } if (** iswm %sr) { .unset %price.read. $+ %rid } if ($($+(%,price.read.,%rid),2) != $null) && (%sr != $null) { if (*search did not return any* iswm %sr) { .set %price. $+ %rid $+ .rs $($+(%,price.,%rid,.rs),2) $+ , $pcol(No price found for) $icol($gettok($($+(%,price.,%rid,.item),2),$($+(%,price.,%rid,.rc),2),44))) if ($($+(%,price.,%rid,.rc),2) < $($+(%,price.,%rid,.rn),2)) { .next_price %rid halt } } else { if ($($+(%,price.read.,%rid),2) == 4) { if ($+(*,$($+(%,price.tmp.name.,%rid),2),*) !iswm $($+(%,price.,%rid,.rs),2)) { if ($gettok($($+(%,price.,%rid,.type),2),1,32) == spend) { .set %price.calc. $+ %rid $floor($calc($gettok($($+(%,price.,%rid,.type),2),2,32) / $gettok($remove($($+(%,price.tmp.price.,%rid),2),gp,$chr(44)),2,45))) if ($($+(%,price.calc.,%rid),2) == 0) { .unset $($+(%,price.calc.,%rid),1) } } .set %price. $+ %rid $+ .rs $($+(%,price.,%rid,.rs),2) $+ , $+($iif($($+(%,price.calc.,%rid),2) != $null,$+($icol($bytes($ifmatch,b)),$chr(32)),),$mcol($($+(%,price.tmp.type.,%rid),2)),$icol($($+(%,price.tmp.name.,%rid),2)),$chr(32)) $& $+ $iif($($+(%,price.calc.,%rid),2) != $null, $pcol($+($bytes($calc($remove($gettok($($+(%,price.tmp.price.,%rid),2),1,45),gp,$chr(44)) * $ifmatch),b),gp)) - $pcol($+($bytes($calc($remove($gettok($($+(%,price.tmp.price.,%rid),2),2,45),gp,$chr(44)) * $ifmatch),b),gp)) $+($chr(40),$pcol($($+(%,price.tmp.price.,%rid),2)),$chr(41)), $pcol($($+(%,price.tmp.price.,%rid),2))) .inc $($+(%,price.,%rid,.rvmi),1) $iif($($+(%,price.calc.,%rid),2) != $null,$calc($remove($gettok($($+(%,price.tmp.price.,%rid),2),1,45),gp,$chr(44)) * $ifmatch),$remove($gettok($($+(%,price.tmp.price.,%rid),2),1,45),gp,$chr(44))) .inc $($+(%,price.,%rid,.rvma),1) $iif($($+(%,price.calc.,%rid),2) != $null,$calc($remove($gettok($($+(%,price.tmp.price.,%rid),2),2,45),gp,$chr(44)) * $ifmatch),$remove($gettok($($+(%,price.tmp.price.,%rid),2),2,45),gp,$chr(44))) } if ($($+(%,price.,%rid,.rc),2) < $($+(%,price.,%rid,.rn),2)) { .next_price %rid halt } } if ($($+(%,price.read.,%rid),2) == 3) { .set %price.tmp.price. $+ %rid $nohtml(%sr) | inc $($+(%,price.read.,%rid),1) 1 } if ($($+(%,price.read.,%rid),2) == 2) { if ($($+(%,price.,%rid,.type),2) == strict) && ($replace($nohtml(%sr),$chr(32),+) != %price.tmp.sendname) { .set $($+(%,price.read.,%rid),1) -5 } else { .set %price.tmp.name. $+ %rid $nohtml(%sr) inc $($+(%,price.read.,%rid),1) 1 } } if ($($+(%,price.read.,%rid),2) == 1) { .set %price.tmp.type. $+ %rid $iif(* * iswm %sr,,(M)) | .inc $($+(%,price.read.,%rid),1) 1 } if ($($+(%,price.read.,%rid),2) <= 0) { .inc $($+(%,price.read.,%rid),1) 1 } } } if (** iswm %sr) { .set %price.read. $+ %rid 0 } } on *:SOCKCLOSE:price.*: { var %rid = $right($sockname,5) if ($($+(%,price.,%rid,.rc),2) < $($+(%,price.,%rid,.rn),2)) { .next_price %rid halt } if ($numtok($right($($+(%,price.,%rid,.rs),2),-1),44) < $($+(%,price.,%rid,.rc),2)) { .set %price. $+ %rid $+ .rs $($+(%,price.,%rid,.rs),2) $+ , $pcol(No price found for) $icol($+($chr(2),$gettok($($+(%,price.,%rid,.item),2),$($+(%,price.,%rid,.rc),2),44),$chr(2))) } $($+(%,price.,%rid,.ret),2) $right($($+(%,price.,%rid,.rs),2),-2) if ($($+(%,price.,%rid,.rn),2) > 1) { $($+(%,price.,%rid,.ret),2) $pcol(Total Value: $+($bytes($($+(%,price.,%rid,.rvmi),2),b),gp) - $+($bytes($($+(%,price.,%rid,.rvma),2),b),gp)) } .unset $($+(%,price.*,%rid,*),1) } alias -l next_price { .unset $($+(%,price.read.,$1),1) var %sn = price. $+ $1 .sockclose %sn .inc $($+(%,price.,$1,.rc),1) 1 .sockopen %sn zybez.net 80 }