on $*:TEXT:/^[!@]rsf */Si:#: {
if ($sock(rsf)) { halt }
var %yay
%yay = $regex(type,$2-,/(-s".+?")/Si)
%yay = $regex(num,$2-,/(-n[0-9]+)/Si)
.set %rsf.out $iif($left($1,1) == @,msg $chan,notice $nick)
.set %rsf.num $iif($regml(num,1) && $remove($regml(num,1),-n) <
80,$remove($regml(num,1),-n),1)
if ($replace(%rsf.string,+,$chr(32)) ==
$remove($2-,$regml(num,1),$regml(type,1))) { .f.display | halt }
.set %rsf.string $replace($remove($2-,$regml(num,1),$regml(type,1)),$chr(32),+)
.set %rsf.styp $f.stype($remove($regml(type,1),-s,"))
.set %rsf.rw $false
.unset %rsf.ret.*
.sockopen rsf forum.runescape.com 80
}
alias nohtml {
var %x,%i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x)
%x = $replace(%x, ,$null)
return %x
}
alias f.stype {
if (!$1 || $1 == All forums) { return -1 }
if ($1 == News & Announcements) { return 13 }
if ($1 == General) { return 14 }
if ($1 == Recent Updates) { return 15 }
if ($1 == Future Updates) { return 16 }
if ($1 == Item Discussion) { return 17 }
if ($1 == Locations) { return 18 }
if ($1 == Monsters) { return 19 }
if ($1 == Quests) { return 20 }
if ($1 == Clue Scrolls) { return 21 }
if ($1 == Skills) { return 22 }
if ($1 == Off Topic) { return 23 }
if ($1 == Suggestions) { return 24 }
if ($1 == Tech Support) { return 25 }
if ($1 == Compliments) { return 26 }
if ($1 == Rants) { return 27 }
if ($1 == Forum Feedback) { return 28 }
if ($1 == Website Feedback) { return 29 }
if ($1 == Crafting) { return 30 }
if ($1 == Fletching) { return 31 }
if ($1 == Farming) { return 32 }
if ($1 == Food) { return 33 }
if ($1 == Herblore) { return 34 }
if ($1 == Ores and Bars) { return 35 }
if ($1 == Construction) { return 56 }
if ($1 == Discontinued Items) { return 36 }
if ($1 == Runes) { return 37 }
if ($1 == Weapons) { return 38 }
if ($1 == Armour) { return 39 }
if ($1 == Treasure Trail Items) { return 40 }
if (Misc* iswm $1) { return 41 }
if ($1 == Events) { return 42 }
if ($1 == Forums Games) { return 55 }
if ($1 == Clans Reqruitment) { return 43 }
if ($1 == Clans Discussion) { return 44 }
if ($1 == Duelling) { return 45 }
if ($1 == Roleplaying) { return 46 }
if (PK* iswm $1) { return 47 }
if ($1 == Goals & Achievements) { return 48 }
if ($1 == Stories) { return 49 }
if ($1 == RSC General) { return 50 }
if (RSC Market* iswm $1) { return 51 }
if (RSC PK* iswm $1) { return 52 }
if ($1 == RSC Clans) { return 53 }
if ($1 == RSC Rants) { return 54 }
else { return -1 }
}
alias f.title { return $($+(%,rsf.ret.title.,$1),2) }
alias f.date { return $($+(%,rsf.ret.date.,$1),2) }
alias f.rel { return $($+(%,rsf.ret.sword.,$1),2) }
alias f.url { return http://forum.runescape.com/lang/en/aff/runescape/ $+
$($+(%,rsf.ret.url.,$1),2) }
alias f.qfind { return $replace($gettok($($+(%,rsf.ret.url.,$1),2),2,63),$chr(44),-)
}
alias f.loc { return $($+(%,rsf.ret.loc.,$1),2) }
alias tc1 { return $+($chr(3),04,$1,$chr(3),) }
alias tc2 { return $+($chr(3),07,$1,$chr(3),) }
on *:SOCKOPEN:rsf: {
if ($sockerr) { echo 4 -s ** SockOpen Error ** $sock($sockname).wsmsg | return }
.sockwrite -n $sockname GET /lang/en/aff/runescape/searchthreads.ws?search=search&srcfrm=
$+ %rsf.styp $+ &srcstr= $+ %rsf.string HTTP/1.1
.sockwrite -n $sockname Host: forum.runescape.com $+ $crlf $+ $crlf
}
on *:SOCKREAD:rsf: {
if ($sockerr) { echo 4 -s ** SockRead Error ** $sock($sockname).wsmsg | return }
.sockread %rsf
if ($remove(%rsf, ,$chr(32)) == $null) { halt }
if (*<DIV class=searchresult>* iswm %rsf) { .set %rsf.rw $true | halt }
if (%rsf.rw == $false) { halt }
if (</DIV> == %rsf) {
.set %rsf.rw $false
if ($var(%rsf.ret.title.*,0) == %rsf.num) { .f.display }
halt
}
if (*/lang/en/aff/runescape/img/kbase/sword* iswm %rsf) { .set $+(%,rsf.ret.sword.,$calc($var(%rsf.ret.title.*,0)
+1)) $gettok(%rsf,2,34) | halt }
elseif (<a href=* iswm %rsf) {
.set $+(%,rsf.ret.url.,$calc($var(%rsf.ret.url.*,0) +1)) $gettok(%rsf,2,34)
.set $+(%,rsf.ret.title.,$calc($var(%rsf.ret.title.*,0) +1)) $nohtml(%rsf)
}
elseif (in forum* iswm %rsf) { .set $+(%,rsf.ret.loc.,$calc($var(%rsf.ret.loc.*,0)
+1)) $nohtml($remove(%rsf,in forum)) }
else { .set $+(%,rsf.ret.date.,$calc($var(%rsf.ret.date.*,0) +1)) %rsf }
}
on *:SOCKCLOSE:rsf: {
if ($var(%rsf.ret.title.*,0) <= %rsf.num) {
.f.display
}
}
alias f.display {
if ($($+(%,rsf.ret.title.,%rsf.num),2) == $null) { %rsf.out $tc2(No match to
return.) | halt }
%rsf.out $+($chr(35),%rsf.num,:) $tc2($f.title(%rsf.num)) ( $+ $tc2($f.rel(%rsf.num))
$+ ) $tc1(Posted on) $tc2($f.date(%rsf.num)) $tc1(In) $tc2($f.loc(%rsf.num)) -
$tc1(QuickFind) $tc2($f.qfind(%rsf.num)) // $tc2($f.url(%rsf.num))
}