ON *:TEXT:!kstats *:#:{
if (%kstats.script == off) { msg $chan !kstats script is currently OFF! | halt }
if (# == #aor) { halt }
inc -u4 %fp.kstats
if (%fp.kstats < 4) {
if ($sock(KoCsearch)) { notice $nick Script already in use, please wait... | halt }
if ($sock(KoCstats)) { notice $nick Script already in use, please wait... | halt }
notice $nick Searching for $2 $+ ...
sockopen KoCsearch darkthrone.com 80
set %koc.channel $chan | set %koc.asker $nick | set %koc.search.user /battlefield.php?jump=&search_type=s&search= $+ $2
}
}
alias kstats {
if ($$1 == on) { echo -a !kstats script on | set %kstats.script on }
if ($$1 == off) { echo -a !kstats script off | set %kstats.script off }
}
ON *:INPUT:#:{
if ($$1 == !kstats) {
if (%kstats.script == off) { msg $chan !kstats $$2- | msg $chan !kstats script is currently OFF! | halt }
if ($chan == #aor) { halt }
if ($sock(KoCsearch)) { .notice $me Script already in use, please wait... | halt }
if ($sock(KoCstats)) { notice $nick Script already in use, please wait... | halt }
.notice $me Searching for $2 $+ ...
sockopen KoCsearch darkthrone.com 80
set %koc.channel $chan | set %koc.asker $me | set %koc.search.user /battlefield.php?jump=&search_type=s&search= $+ $2
}
}
ON *:SOCKOPEN:KoCsearch:{
sockwrite -n $sockname GET %koc.search.user HTTP/1.1
sockwrite -n $sockname Host: www.darkthrone.com
sockwrite -n $sockname User-Agent: Can u read this, i guess u did ¬_¬
sockwrite -n $sockname $crlf
}
ON *:SOCKOPEN:KoCstats:{
sockwrite -n $sockname GET / $+ %koc.stats.user HTTP/1.1
sockwrite -n $sockname Host: www.darkthrone.com
sockwrite -n $sockname User-Agent: Can u read this, i guess u did ¬_¬
sockwrite -n $sockname $crlf
}
ON *:SOCKREAD:KoCsearch:{
if ($sockerr) { msg %koc.channel [KoC stats] An Socket error has occured. | sockclose KoCsearch | unset %koc.* | halt }
var %temp
sockread %temp
if (Database Error isin %temp) { msg %koc.channel [KoC stats] Database Error. | sockclose KoCsearch | unset %koc.* | halt }
if (0 players total isin %temp) { msg %koc.channel [KoC stats] No such user exists. | sockclose KoCsearch | unset %koc.* | halt }
if (Rankings are isin %temp) { msg %koc.channel [KoC stats] Rankings are being updated. | sockclose KoCsearch | unset %koc.* | halt }
if (stats.php isin %temp) {
set %koc.pos.1 $calc($pos(%temp,",1)+1)
set %koc.pos.2 $pos(%temp,",2)
set %koc.stats.user $mid(%temp,%koc.pos.1,$calc(%koc.pos.2 - %koc.pos.1)) | notice %koc.asker Player found now opening (http://www.darkthrone.com/ $+ %koc.stats.user $+ )
set %koc.name Name: $remove($gettok(%temp,3,62),</a,</td)
sockopen KoCstats darkthrone.com 80
sockclose KoCsearch
}
}
ON *:SOCKREAD:KoCstats:{
if ($sockerr) { msg %koc.channel [KoC stats] An Socket error has occured. | sockclose KoCstats | unset %koc.* | halt }
var %temp
sockread %temp
if (%koc.user.nextline.1 == 1) {
set %koc.pos.1 $calc($pos(%temp,>,2)+1)
set %koc.pos.2 $pos(%temp,<,3)
set %koc.user.commander Commander: $mid(%temp,%koc.pos.1,$calc(%koc.pos.2 - %koc.pos.1))
if (<td>None</td> isin %temp) { set %koc.user.commander Commander: None }
set %koc.user.nextline.1 0
}
if (Commander: isin %temp) {
set %koc.user.nextline.1 1
}
if (%koc.user.nextline.2 == 1) {
set %koc.user.race Race: $remove($gettok(%temp,2,62),</td)
set %koc.user.nextline.2 0
}
if (Race: isin %temp) {
set %koc.user.nextline.2 1
}
if (%koc.user.nextline.3 == 1) {
set %koc.user.rank Rank: $remove($gettok(%temp,2,62),</td)
set %koc.user.nextline.3 0
}
if (Rank: isin %temp) {
set %koc.user.nextline.3 1
}
if (%koc.user.nextline.4 == 1) {
set %koc.user.armysize Army Size: $remove($gettok(%temp,2,62),</td)
set %koc.user.nextline.4 0
}
if (Army Size: isin %temp) {
set %koc.user.nextline.4 1
}
if (%koc.user.nextline.5 == 1) {
set %koc.user.fortifications Fortifications: $remove($gettok(%temp,2,62),</td)
set %koc.user.nextline.5 0
}
if (Fortifications: isin %temp) {
set %koc.user.nextline.5 1
}
if (Officers total isin %temp) {
set %koc.pos.1 $calc($pos(%temp,>,1)+1)
set %koc.pos.2 $pos(%temp,$chr(124),1)
set %koc.user.officer Officers: $remove($mid(%temp,%koc.pos.1,$calc(%koc.pos.2 - %koc.pos.1)),officers total)
}
msg $$(%koc.channel) [KoC stats] $$(%koc.name) $$(%koc.user.commander) $$(%koc.user.race) $$(%koc.user.rank) $$(%koc.user.armysize) $$(%koc.user.fortifications) $$(%koc.user.officer) Statspage: http://www.darkthrone.com/ $+ %koc.stats.user
sockclose KoCstats
unset %koc.*
}