mRank — File Browser
mRankv1.1 / mRankv1.1 / mRank.mrc
mRank.mrc — 16 KB — Download this file
; _/_/_/ _/
; _/_/_/ _/_/ _/ _/ _/_/_/ _/_/_/ _/ _/
; _/ _/ _/ _/_/_/ _/ _/ _/ _/ _/_/
; _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/
; _/ _/ _/ _/ _/ _/_/_/ _/ _/ _/ _/
; v1.1
;
; By zack^.
;
;
;
;
; Read the Readme for full command list, and further information + history & updates.
;
on *:LOAD:{ if ($version < 6.1) { echo $color(info) -a /mRank: Sorry, you must be using mIRC 6.1 or above to use this add-on. | .unload -rs $script | return } | set %mRank.dbfile mRank.db | set %mRank.flood.pro.N 5 | set %mRank.output.type msg | set %mRank.hosttype 13 | .enable #mRank | echo $color(info) -a * /mRank: Loaded successfully | echo $color(info) -a * /mRank: Please take time to set up the channels. | mRank }
on *:UNLOAD:{ if ($version > 6.1) { var %db.uninstall $input(Remove Database?,y,mRank UnInstall,mRank UnInstall,Remove Database?) | if (%db.uninstall) { .remove %mRank.dbfile } | unset %mRank.* %db.* %m.* %t10.* | echo $color(info) -a * /mRank: Unloaded successfully } }
#mRank on
on *:TEXT:*:#:{
if ($istok(%mRank.chans,$+($network,$chr(254),#),44)) {
db.parse msg $1-
if ($1 == !stats) && (!%mRank.flood.pro) {
if (%m.data) {
%m.data = %m.data
$iif(%mRank.output.type == notice,.notice $nick,%mRank.output.type #) Stats( $+ $strip($iif($2,$2,$gettok(%m.data,1,%m.chr))) $+ ): Words: $calc($gettok(%m.data,2,%m.chr)) $+ ; Chars: $calc($gettok(%m.data,3,%m.chr)) $+ ; Smilies: $calc($gettok(%m.data,4,%m.chr)) $+ ; Swears: $calc($gettok(%m.data,5,%m.chr)) $+ ; Lines: $calc($gettok(%m.data,6,%m.chr)) $+ ; CtrlCodes: $calc($gettok(%m.data,7,%m.chr)) $+ ; Kicks: $calc($gettok(%m.data,8,%m.chr)) $+ ; Bans: $calc($gettok(%m.data,10,%m.chr)) $+ ; Modes: $calc($gettok(%m.data,9,%m.chr)) $+ ;
$iif(%mRank.output.type == notice,.notice $nick,%mRank.output.type #) Stats( $+ $strip($iif($2,$2,$gettok(%m.data,1,%m.chr))) $+ ): Topics: $calc($gettok(%m.data,11,%m.chr)) $+ ; Actions: $calc($gettok(%m.data,12,%m.chr)) $+ ; Joins: $calc($gettok(%m.data,13,%m.chr)) $+ ; Parts: $calc($gettok(%m.data,14,%m.chr)) $+ ; Nicks: $calc($gettok(%m.data,15,%m.chr)) $+ ; Quits: $calc($gettok(%m.data,16,%m.chr)) $+ ;
}
else {
$iif(%mRank.output.type == notice,.notice $nick,%mRank.output.type #) No stats [If this is your first time typing !stats then you must type anything other than !stats to begin counting your statistics.]
}
set -u2 %mRank.flood.pro %mRank.flood.pro.N
}
elseif (!top* iswm $1) && (!%mRank.flood.pro) {
var %t10.count $remove($1,!top)
if (%t10.count < 10) return
.window -h @top10
%t10.kind = $findtok(!.words.chars.smilies.swears.lines.ctrlcodes.kicks.modes.topics.actions.joins.parts.quits.nicks,$2,1,46)
if (!%t10.kind) %t10.kind = 2
filter -cfwt2ue $calc(%t10.kind + 1) 255 $+(",$scriptdir,%mRank.dbfile,") @top10 $+($network,$chr(254),#,*)
var %t10.temp $calc(%t10.count - 9),%t10.results
while (%t10.temp <= %t10.count) {
%t10.line = $line(@top10,%t10.temp)
%t10.results = %t10.results $ord(%t10.temp) $+ : $iif($gettok($gettok(%t10.line,2,32),1,255) && $gettok($gettok(%t10.line,2,32),%t10.kind,255),$gettok($gettok(%t10.line,2,32),1,255),-) ( $+ $iif($gettok($gettok(%t10.line,2,32),%t10.kind,255),$ifmatch,n/a) $+ )
inc %t10.temp
}
window -c @top10
$iif(%mRank.output.type == notice,.notice $nick,%mRank.output.type #) Top $+ %t10.count Results( $+ $iif(%t10.kind == 2,Words,$+($upper($left($2,1)),$lower($right($2,-1)))) $+ ) %t10.results
set -u2 %mRank.flood.pro %mRank.flood.pro.N
}
elseif ($1 == !place) && (!%mRank.flood.pro) {
%t10.kind = $findtok(!.words.chars.smilies.swears.lines.ctrlcodes.kicks.modes.topics.actions.joins.parts.quits.nicks,$2,1,46)
if (!%t10.kind) %t10.kind = 2
if (%t10.kind == 2) { %db.handle = $strip($iif($3,$3,$iif($2,$iif($istok(words.chars.smilies.swears.lines.ctrlcodes.kicks.modes.topics.actions.joins.parts.nicks.quits,$2,46),$nick,$2),$nick))) } | else { %db.handle = $strip($iif($3,$3,$nick)) }
.window -h @top10
filter -cfwt2ue $calc(%t10.kind +1) 255 $+(",$scriptdir,%mRank.dbfile,") @top10 $+($network,$chr(254),#,*)
if ($address(%db.handle,%mRank.hosttype)) $iif(%mRank.output.type == notice,.notice $nick,%mRank.output.type #) %db.handle placed $ord($fline(@top10,$+($address(%db.handle,%mRank.hosttype),*),1)) out of $line(@top10,0) users in # for $iif(%t10.kind != 2,$iif(!$2,Words,$+($upper($left($2,1)),$lower($right($2,-1)))),$iif(!$3,Words,$iif(%t10.kind == 2,Words,$+($upper($left($3,1)),$lower($right($3,-1))))))
else { $iif(%mRank.output.type == notice,.notice $nick,%mRank.output.type #) Sorry %db.handle is currently not online. Syntax: !place [section] [nick] Sections include: words|chars|smilies|swears|lines|ctrlcodes|kicks|modes|topics|action|joins|parts|quits }
.window -c @top10
set -u2 %mRank.flood.pro %mRank.flood.pro.N
}
}
}
on *:KICK:#:{ if ($istok(%mRank.chans,$+($network,$chr(254),#),44)) { db.parse kick } }
on *:RAWMODE:#:{ if ($istok(%mRank.chans,$+($network,$chr(254),#),44)) { db.parse mode $len($remove($1,+,-)) } }
on *:MODE:#:{ if ($istok(%mRank.chans,$+($network,$chr(254),#),44)) { db.parse mode } }
on *:BAN:#:{ if ($istok(%mRank.chans,$+($network,$chr(254),#),44)) { db.parse ban } }
on *:TOPIC:#:{ if ($istok(%mRank.chans,$+($network,$chr(254),#),44)) { db.parse topic } }
on *:ACTION:*:#:{ if ($istok(%mRank.chans,$+($network,$chr(254),#),44)) { db.parse msg $1- | db.parse action } }
on *:JOIN:#:{ if ($istok(%mRank.chans,$+($network,$chr(254),#),44)) { db.parse join } }
on *:PART:#:{ if ($istok(%mRank.chans,$+($network,$chr(254),#),44)) { db.parse part } }
on *:NICK:{ var %db.temp 1 | while ($comchan($newnick,%db.temp)) { %db.chan = $ifmatch | if ($istok(%mRank.chans,$+($network,$chr(254),%db.chan),44)) db.parse nick %db.chan | inc %db.temp } }
on *:QUIT:{ var %db.temp 1 | while ($comchan($nick,%db.temp)) { %db.chan = $ifmatch | if ($istok(%mRank.chans,$+($network,$chr(254),%db.chan),44)) db.parse quit %db.chan | inc %db.temp } }
#mRank end
alias -l db.parse {
unset %m.*
%m.chr = 255
%m.token = $chr(%m.chr)
%m.file = $+(",$scriptdir,%mRank.dbfile,")
if ($1 == nick) %m.handle = $+($network,$chr(254),$2,$chr(254),$address($newnick,%mRank.hosttype))
elseif ($1 == quit) %m.handle = $+($network,$chr(254),$2,$chr(254),$mask($fulladdress,%mRank.hosttype))
elseif ($2 == !stats) { %m.handle = $+($network,$chr(254),#,$chr(254),$address($strip($iif($3,$3,$nick)),%mRank.hosttype)) | %m.lock = 1 }
else { %m.handle = $+($network,$chr(254),#,$chr(254),$address($nick,%mRank.hosttype)) }
%m.data = $read(%m.file,s,$strip(%m.handle))
%m.data.words = $gettok(%m.data,2,%m.chr)
%m.data.chars = $gettok(%m.data,3,%m.chr)
%m.data.smilies = $gettok(%m.data,4,%m.chr)
%m.data.swears = $gettok(%m.data,5,%m.chr)
%m.data.lines = $gettok(%m.data,6,%m.chr)
%m.data.ctrl = $gettok(%m.data,7,%m.chr)
%m.data.kicks = $gettok(%m.data,8,%m.chr)
%m.data.mode = $gettok(%m.data,9,%m.chr)
%m.data.bans = $gettok(%m.data,10,%m.chr)
%m.data.topics = $gettok(%m.data,11,%m.chr)
%m.data.action = $gettok(%m.data,12,%m.chr)
%m.data.join = $gettok(%m.data,13,%m.chr)
%m.data.part = $gettok(%m.data,14,%m.chr)
%m.data.nick = $gettok(%m.data,15,%m.chr)
%m.data.quit = $gettok(%m.data,16,%m.chr)
if ($1 == msg) {
inc %m.data.words $regex($2-,/(\s?[^ ]{3,}\s?)/g)
inc %m.data.chars $len($2-)
inc %m.data.smilies $db.smilies($2-)
inc %m.data.swears $db.swears($2-)
inc %m.data.lines
inc %m.data.ctrl $db.ctrl($2-)
}
if ($1 == kick) inc %m.data.kicks
if ($1 == mode) inc %m.data.mode $2
if ($1 == ban) inc %m.data.bans
if ($1 == topic) inc %m.data.topics
if ($1 == action) inc %m.data.action
if ($1 == join) inc %m.data.join
if ($1 == part) inc %m.data.part
if ($1 == nick) inc %m.data.nick
if ($1 == quit) inc %m.data.quit
%m.data = $read(%m.file,s,$strip(%m.handle))
if (!%m.lock) { db.w $strip(%m.handle) $strip($db.group(%m.chr $nick $calc(%m.data.words) $calc(%m.data.chars) $calc(%m.data.smilies) $calc(%m.data.swears) $calc(%m.data.lines) $calc(%m.data.ctrl) $calc(%m.data.kicks) $calc(%m.data.mode) $calc(%m.data.bans) $calc(%m.data.topics) $calc(%m.data.action) $calc(%m.data.join) $calc(%m.data.part) $calc(%m.data.nick) $calc(%m.data.quit))) }
}
alias -l db.w { if ($read($+(",$scriptdir,%mRank.dbfile,"),s,$1)) { var %db.l $readn } | write $iif(%db.l,$+(-l,$ifmatch)) $+(",$scriptdir,%mRank.dbfile,") $1- }
alias -l db.d { if ($read($1,s,$2)) { var %db.l $readn } | write $iif(%db.l,$+(-dl,$ifmatch)) $1 }
alias -l db.r return $$read($1,s,$2)
alias -l db.smilies { %db.e = /(:\)|:\(|:\[|:\]|:\\|:/|:P|:x|:o|:\||:D|=\)|=\(|=\]|=\[|=P|=x|=o|=\\|=/|=\||=D|:-\)|:-\(|:-\]|:-\[|:-P|:-x|:-o|:-/|:-\\|:-\||:-D|;\)|;\(|;p|;o|;D|;\||;\\|;/|"_"|-_-|>_<|o_O|o_X|X_o|@_@|xD|:þ|=þ|¬¬)/ig | return $regex($strip($1-),%db.e) }
alias -l db.swears { %db.swear = /(fuck|shit|bitch|cunt|nigger)/ig | return $regex($strip($1-),%db.swear) }
alias -l db.ctrl { %db.ctrl = /(||||)/ig | return $regex($1-,%db.ctrl) }
alias -l db.group {
unset %db.*
var %db.temp 2,%db.output
while ($gettok($1-,%db.temp,32) != $null) {
%db.output = $+(%db.output,$chr($1),$ifmatch)
inc %db.temp
}
return $strip(%db.output)
}
alias -l db.list.chans {
if ($dialog(mRank)) {
did -r $dname 3
var %md 1
while ($gettok(%mRank.chans,%md,44)) {
did -a $dname 3 $replace($ifmatch,þ,:)
inc %md
}
}
}
alias -l db.changehost {
var %mRank.tempfile = $+(",$scriptdir,temp-,%mRank.dbfile,"),%mRank.currenthost,%mRank.currhoststore $1,%mRank.changeticks $ticks
if ($isfile(%mRank.tempfile)) .remove %mRank.tempfile
.fopen mRank %mRank.dbfile
while $fread(mRank) {
tokenize 32 $ifmatch
%mRank.currenthost = $gettok($gettok($1-,3,254),1,255)
if (%mRank.currenthost) write %mRank.tempfile $+($gettok($1-,1-2,254),$chr(254),$mask(%mRank.currenthost,%mRank.currhoststore),$chr(32),$chr(255),$gettok($1-,2-,255))
}
.fclose mRank
.remove $+(",$scriptdir,%mRank.dbfile,")
.copy %mRank.tempfile $+(",$scriptdir,%mRank.dbfile,")
.remove %mRank.tempfile
var %mRank.changehost $input(Updated completed in $calc(($ticks - %mRank.changeticks) /1000) $+ s.,o,mRank)
}
alias mRank { dialog -dm mRank mRank }
menu menubar,channel {
mRank:mRank
}
dialog mRank {
title "mRank"
size -1 -1 149 142
option dbu
box "Channel Setup", 1, 0 0 148 64
button "OK", 2, 111 129 37 12, ok
list 3, 3 29 142 32, sort size vsbar
text "Channel", 4, 3 9 22 8
text "Network", 5, 3 18 22 8
edit "", 6, 25 8 50 10, autohs
edit "", 7, 25 17 50 10, autohs
button "Add", 8, 78 12 21 12
button "Delete", 9, 124 12 21 12
button "Edit", 10, 101 12 21 12
text "Database File:", 11, 5 74 35 8
button "Set", 13, 123 74 21 8
edit "", 12, 40 73 80 10, autohs
box "Options", 14, 0 65 149 62
radio "Msg Channel", 16, 41 83 42 10
text "Message Type:", 17, 3 84 37 8
radio "Notice Nickname", 18, 84 83 50 10
text "Switch:", 19, 22 94 18 8
check "Disabled", 20, 42 93 32 10
text "Flood Pro:", 21, 15 104 25 8
edit "", 22, 41 103 14 10, autohs
text "secs", 23, 56 104 12 8
text "Host Type:", 15, 12 115 27 8
combo 24, 41 114 21 50, size drop
text "Check /help $mask for help.", 25, 65 115 69 8
}
on *:DIALOG:*:*:*:{
if ($dname == mRank) {
if ($devent == init) {
did -ra $dname 12 $iif(%mRank.dbfile,$ifmatch,N/A Please set one!)
did -ra $dname 22 %mRank.flood.pro.N
did -ra $dname 20 $iif($group(#mRank) == on,Enabled,Disabled)
if ($group(#mRank) == on) { did -c $dname 20 }
did -c $dname $iif(%mRank.output.type == msg,16,18)
db.list.chans
var %mRank.lm 0
while (%mRank.lm <= 20) {
did -a $dname 24 %mRank.lm
inc %mRank.lm
}
did -c $dname 24 $didwm($dname,24,%mRank.hosttype,1)
}
elseif ($devent == sclick) {
if ($did == 3) {
set %mRank.curr.chan $did(3).sel
did -ra $dname 6 $gettok($did(3).seltext,2,58)
did -ra $dname 7 $gettok($did(3).seltext,1,58)
}
elseif ($did == 8) {
if ($left($did(6),1) == $chr(35) && $did(7)) { %mRank.chans = $addtok(%mRank.chans,$+($did(7),$chr(254),$did(6)),44) | did -r $dname 6,7 | db.list.chans }
}
elseif ($did == 9) {
if ($replace($did(3).sel,:,þ)) { %mRank.chans = $deltok(%mRank.chans,$ifmatch,44) | db.list.chans }
}
elseif ($did == 10) {
if ($left($did(6),1) == $chr(35) && $did(7) && %mRank.curr.chan) {
%mRank.chans = $reptok(%mRank.chans,$gettok(%mRank.chans,%mRank.curr.chan,44),$+($did(7),$chr(254),$did(6)),44)
did -r $dname 6,7
db.list.chans
}
}
elseif ($did == 13) {
if ($did(12)) { set %mRank.dbfile $ifmatch | did -ra $dname 12 %mRank.dbfile }
}
elseif ($did == 16) set %mRank.output.type msg
elseif ($did == 18) set %mRank.output.type notice
elseif ($did == 20) {
if ($did(20).state) { .enable #mRank | did -ra $dname 20 Enabled } | else { .disable #mRank | did -ra $dname 20 Disabled }
}
elseif ($did == 24) {
var %mRank.currhost $did(24).seltext
if (%mRank.currhost != %mRank.hosttype) && (%mRank.hosttype != $null) {
var %mRank.changehost $input(Do you want to convert all hosts stored in %mRank.dbfile to the new host type? $crlf $+ This can only be done once and that moment is now. $crlf $crlf $+ NOTE: This does not always return desired results and can cause your statisical database to become corrupt.,y,mRank)
if (%mRank.changehost) {
db.changehost %mRank.currhost
dialog -v mRank mRank
}
else {
var %mRank.changehost $input(WARNING: Old stats are now redunant because they were not updated.,o,mRank)
dialog -v mRank mRank
}
}
set %mRank.hosttype $did(24).seltext
}
elseif ($devent == edit) {
if ($did == 22) {
set %mRank.flood.pro.N $iif($did(22),$ifmatch,5)
}
}
}
}
}
/*
alias combine_stats {
if ($address($3,%mRank.hosttype)) {
var %mcomb.file $getdirmRank.db
window -h @mRank.combine
filter -fw %mcomb.file @mRank.combine $+($1,þ,$2,þ,*,ÿ,$3,ÿ,*)
var %mcomb 1,%mc.words,%mc.chars,%mc.smilies,%mc.swears,%mc.lines,%mc.ctrl,%mc.kicks,%mc.bans,%mc.modes,%mc.topics,%mc.actions,%mc.joins,%mc.parts,%mc.nicks,%mc.quits
while ($line(@mRank.combine,%mcomb)) {
var %mcomb.line $ifmatch
write -ds $+ $ifmatch %mcomb.file
inc %mc.words $gettok(%mcomb.line,3,255)
inc %mc.chars $gettok(%mcomb.line,4,255)
inc %mc.smilies $gettok(%mcomb.line,5,255)
inc %mc.swears $gettok(%mcomb.line,6,255)
inc %mc.lines $gettok(%mcomb.line,7,255)
inc %mc.ctrl $gettok(%mcomb.line,8,255)
inc %mc.kicks $gettok(%mcomb.line,9,255)
inc %mc.bans $gettok(%mcomb.line,10,255)
inc %mc.modes $gettok(%mcomb.line,11,255)
inc %mc.topics $gettok(%mcomb.line,12,255)
inc %mc.actions $gettok(%mcomb.line,13,255)
inc %mc.joins $gettok(%mcomb.line,14,255)
inc %mc.parts $gettok(%mcomb.line,15,255)
inc %mc.nicks $gettok(%mcomb.line,16,255)
inc %mc.quits $gettok(%mcomb.line,17,255)
inc %mcomb
}
write %mcomb.file $+($1,þ,$2,þ,$address($3,%mRank.hosttype)) $+(ÿ,$3,$db.group(%m.chr $nick $iif(%mc.words,$ifmatch,0) $iif(%mc.chars,$ifmatch,0) $iif(%mc.smilies,$ifmatch,0) $iif(%mc.swears,$ifmatch,0) $iif(%mc.lines,$ifmatch,0) $iif(%mc.ctrl,$ifmatch,0) $iif(%mc.kicks,$ifmatch,0) $iif(%mc.mode,$ifmatch,0) $iif(%mc.bans,$ifmatch,0) $iif(%mc.topics,$ifmatch,0) $iif(%mc.actions,$ifmatch,0) $iif(%mc.joins,$ifmatch,0) $iif(%mc.parts,$ifmatch,0) $iif(%mc.nicks,$ifmatch,0) $iif(%mc.quits,$ifmatch,0)))
window -c @MRank.combine
}
}
*/