;reputation (love/hate) script by mruno
;!luv !hate !rep !mosthated !mostloved
;save to a file and /load -rs rep.mrc
;edit the lines below
;---------------------------------------------------
;channel to run the script in
alias -l rep.chan return #CHANNEL
;number of times a nick and !love/!hate per day
alias -l max.rep.today return 4
;nicks banned from using !love/!hate
alias rep.banned.nicks return
;captcha nicks when using !love/!hate. REQUIRES CAPTCHA.MRC
alias -l rep.captcha.check.times return 0
;---------------------------------------------------
;#########################################################################
;do not edit below this line unless you know what you are doing!
;#########################################################################
alias -l iseven return $iif(2 // $1,$true,$false)
alias -l isodd return $iif(!$iseven($1),$true,$false)
alias import.rep {
var %file " $+ $mircdirsave\rep. $+ $network $+ .ini"
var %loop 0
var %total 0
while ($ini(%file,rep,0) > %loop) {
inc %loop
var %nick $ini(%file,rep,%loop)
var %rep $readini(%file,rep,%nick)
if (!%rep) set %rep 0
if (%nick) {
hadd REPUTATION %nick %rep
inc %total
}
else iecho %nick - %rep not imported
}
iecho %total out o' $ini(%file,rep,0) reps imported
}
alias rep.captcha.check {
;/rep.captcha.check <nick> - counts times nick has loved or hated today. if XX times perform captcha check.
; iecho rep.captcha.check $1-
if (!$1) return
var %table REPUTATION.TODAY
hinc %table $1
var %times $hget(%table,$1)
if ($rep.captcha.check.times // %times) && (%times > 1) rep.perform.captcha $1
}
alias rep.perform.captcha {
;/rep.perform.captcha <nick> - asks player a captcha question
;iecho rep.perform.captcha $1-
;set -e %rep.captcha.check. $+ $1 $Captcha.question
}
alias Rep.Top {
;/Rep.Top CHANNEL <#>
if (!$1) return
REP.Sort.TOP
var %table REPUTATION
var %file rep.tmp
var %loop 0
var %top
var %rep
while ($2 > %loop) {
var %nick
inc %loop
if (%loop == 1) msg $1 Most LoVeD 4♥13♥4♥ users:
set %nick $hget(%table,$gettok($read(%file,%loop),1,32)).item
if ($iseven(%loop)) msg $1 %rep $str(.,$calc(50 - $len(%rep))) %loop $+ . %nick 12 $gettok($read(%file,%loop),2,32)
else {
if (%nick) set %rep %loop $+ . %nick 12 $gettok($read(%file,%loop),2,32)
else set %rep %loop $+ . None
}
}
if (%top) && (%total) msg $EPirate.chan %top
}
alias REP.Sort.TOP {
var %file rep.tmp
var %table REPUTATION
hsave -n %table %file
filter -ffcuten 2 32 %file %file
}
alias Rep.Down {
;/Rep.Top CHANNEL <#>
if (!$1) return
REP.Sort.Down
var %table REPUTATION
var %file rep.tmp
var %loop 0
var %top
var %rep
while ($2 > %loop) {
var %nick
inc %loop
if (%loop == 1) msg $1 Most HaTeD 4┌∩┐(◣_◢)┌∩┐ users:
set %nick $hget(%table,$gettok($read(%file,%loop),1,32)).item
if ($iseven(%loop)) msg $1 %rep $str(.,$calc(50 - $len(%rep))) %loop $+ . %nick 12 $gettok($read(%file,%loop),2,32)
else {
if (%nick) set %rep %loop $+ . %nick 12 $gettok($read(%file,%loop),2,32)
else set %rep %loop $+ . None
}
}
if (%top) && (%total) msg $EPirate.chan %top
}
alias REP.Sort.DOWN {
var %file rep.tmp
var %table REPUTATION
hsave -n %table %file
filter -ffcutn 2 32 %file %file
}
alias timer.ignore {
var %a
if ($1 isin %a) {
.timerlove.spam 1 5 msg $rep.CHAN $1 has been ignored due to suspected timer abuse.
return 1
}
}
on 1:CONNECT:/unset.vars
on 1:NOTICE:*status *:?:{
if ($nick == nickserv) && (%rep.regcheck == $2) {
if ($3 == 3) {
hadd REGISTERED.NICKS $2 $ctime
if (!luv isin %rep.cmd) || (!love isin %rep.cmd) .timeraddlove 1 3 addlove %rep.cmd
elseif (!hate isin %rep.cmd) .timeraddhate 1 3 addhate %rep.cmd
}
}
elseif (%rep.regcheck) && (%rep.regcheck ison $rep.CHAN) .timerregister. $+ $2 1 5 .notice %rep.regcheck You must be registered to use this trigger. To register type: /ns HELP REGISTER
}
alias registeredcheck if ($hget(registered.nicks,$1)) return 1
on 1:EXIT:{
reputation.save
}
alias reputation.save {
hsave Registered.Nicks " $+ $mircdirsave\registered.nicks.dat $+ "
hsave REPUTATION " $+ $mircdirsave\REPUTATION.dat $+ "
hsave REPUTATION.TODAY " $+ $mircdirsave\REPUTATION.TODAY.dat $+ "
}
on 1:START:{
var %table registered.nicks
hmake %table
var %file " $+ $mircdirsave\registered.nicks.dat"
if ($exists(%file)) hload %table %file
else echo -st ERROR %file does not exist
set %table REPUTATION
hmake %table 10000
set %file " $+ $mircdirsave\REPUTATION.dat"
if ($exists(%file)) hload %table %file
else echo -st ERROR %file does not exist
.timerREp.SAVE -o 0 7200 reputation.save
set %table REPUTATION.TODAY
hmake %table 250
set %file " $+ $mircdirsave\REPUTATION.TODAY.dat"
if ($exists(%file)) hload %table %file
else echo -st ERROR %file does not exist
unset %rep.*
.timerRep.New.Day.Check -o 0 300 Rep.New.Day.Check
}
alias Rep.New.Day.Check {
var %table reputation.today
if ($hget(%table,date) != $date) {
hdel -w %table *
hadd %table date $date
}
}
alias r.luv {
var %i = 1
while (%i <= $ini(save\rep. $+ $network $+ .ini,rep,0)) {
if ($readini(save\rep. $+ $network $+ .ini,rep,$ini(save\rep. $+ $network $+ .ini,rep,%i)) == $1) var %rep = %rep $readini(save\rep. $+ $network $+ .ini,propernick,$ini(save\rep. $+ $network $+ .ini,rep,%i))
inc %i
}
if (!%rep) return 0
else return %rep
}
on *:TEXT:*:#elite-chat:{
if ($chr(37) isin $1-) || ($chr(36) isin $2-) || ([EWG]* iswm $nick) return
if ([ewg] isin $nick) return
if ($1 == !topluv) || ($1 == !toplove) || ($1 == !mostlove) || ($1 == !mostloved) Rep.Top $chan 10
elseif ($1 == !mosthate) || ($1 == !mosthated) || ($1 == !tophate) Rep.Down $chan 10
elseif ($1 == !rep) || ($1 == !pop) {
var %rep $hget(REPUTATION,$iif($2,$2,$nick))
if (!$2) {
if ($nick isin $rep.banned.nicks) return
msg $chan $nick $+ $chr(44) Your reputation is12 $iif(%rep,%rep,0)
}
if ($2) {
if ($2 isin $rep.banned.nicks) return
if (!%rep) msg $chan $2 has no reputation ...
else msg $chan $2 $+ 's reputation is12 %rep
}
}
elseif ($1 == !luv) || ($1 == !love) {
set %rep.nick $nick
if ($timer.ignore($nick)) || ($2 isin $rep.banned.nicks) || ([ [ $+(%,rep.ignore.,$nick) ] ]) return
if (!$registeredcheck($nick)) { set %rep.regcheck $nick | set %rep.cmd $1- | ns status $nick | halt }
if ($timer(rep.love. $+ $2)) && (%rep.nick ison $rep.CHAN) .notice %rep.nick Sorry $nick $+ , your !love has been buffered. Try again in one minute.
else {
;if ($($+(%,EPirate.Join.Spam.Skip.,$1),2)) return
;if ($nick == mruno) && ([ [ $+(%,rep.captcha.check.,$nick) ] ]) .notice $nick Just making sure you are human, please answer the following with !captcha <answer>: [ [ $ifmatch ] ]
;else .timeraddlove 1 3 addlove $1-
var %today 0
if ($hget(REPUTATION.TODAY,$+($nick,$chr(187),$2))) set %today $ifmatch
if (%today >= $max.rep.today) .notice $nick Ye repped 'em too much today!
else .timeraddlove 1 1 addlove $1-
}
}
elseif ($1 == !hate) {
set %rep.nick $nick
if ($timer.ignore($nick)) || ($2 isin $rep.banned.nicks) || ([ [ $+(%,rep.ignore.,$nick) ] ]) return
; || ($+(%,rep.ignore.,$nick))
if (!$registeredcheck($nick)) { set %rep.regcheck $nick | set %rep.cmd $1- | ns status $nick | halt }
if ($timer(rep.hate. $+ $2)) && ($nick ison $rep.CHAN) .notice %rep.nick Sorry $nick $+ , your !hate has been buffered. Try again in one minute.
else {
;if ($nick == mruno) && ([ [ $+(%,rep.captcha.check.,$nick) ] ]) .notice $nick Just making sure you are human, please answer the following with !captcha <answer>: [ [ $ifmatch ] ]
;else .timeraddhate 1 3 addhate $1-
var %today 0
if ($hget(REPUTATION.TODAY,$+($nick,$chr(187),$2))) set %today $ifmatch
if (%today >= $max.rep.today) .notice $nick Ye repped 'em too much today!
else .timeraddhate 1 3 addhate $1-
}
}
elseif ($1 == !captcha) {
if ($+(%,rep.captcha.check.,$nick)) {
var %question [ [ $ifmatch ] ]
if ($2) {
var %response $lower($remove($2-,<,>,$chr(44)))
if ($Captcha.answer($replace(%question,$chr(32),$chr(187)),%response)) {
.notice $nick Correct! You can now !luv or !hate
iecho before: $+(%,rep.captcha.check.,$nick)
unset $+(%,rep.captcha.check.,$nick)
iecho after: $+(%,rep.captcha.check.,$nick) : [ [ $+(%,rep.captcha.check.,$nick) ] ]
}
else {
.notice $nick Wrong answer. You will be ignored from !luv and !hate for 15mins.
set -eu900 %rep.ignore. $+ $nick 1
.timer 1 900 set -e %rep.captcha.check. $+ $nick $Captcha.question
}
}
else .notice $nick Please answer the following with !Captcha <answer>: %question
}
else .notice No need to answer this or captcha already answered
}
}
alias make.love {
if (!$2) return
var %r $rand(1,21), %m
if (%r == 1) set %m sees $1 and $2 knockin' boots...
elseif (%r == 2) set %m smells $1 and $2 making bacon...
elseif (%r == 3) set %m turns away from $1 and $2 $+ 's bed wrestling...
elseif (%r == 4) set %m sees $1 and $2 making babies...
elseif (%r == 5) set %m hears $1 and $2 moaning together...
elseif (%r == 6) set %m sees $1 boinking $2 $+ ...
elseif (%r == 7) set %m sees $1 and $2 doing the boom-boom...
elseif (%r == 8) set %m sees $1 burying the bone into $2 $+ ...
elseif (%r == 9) set %m notices $1 checking $2 $+ 's oil...
elseif (%r == 10) set %m sees $1 and $2 exchanging bodily fluids...
elseif (%r == 11) set %m sees $1 and $2 doing the four legged frolic...
elseif (%r == 12) set %m sees $1 and $2 fucking...
elseif (%r == 13) set %m sees $1 and $2 doing the horizontal hustle...
elseif (%r == 14) set %m hears $1 and $2 making love...
elseif (%r == 15) set %m hears $1 and $2 doing the mommy-daddy dance...
elseif (%r == 16) set %m sees $1 nailing $2 $+ ...
elseif (%r == 17) set %m videos $1 and $2 playing doctor...
elseif (%r == 18) set %m videos $1 ramming $2 $+ ...
elseif (%r == 19) set %m watches $1 and $2 slap bellies...
elseif (%r == 20) set %m watches $1 and $2 doing two person pushups...
elseif (%r == 21) set %m watches $1 and $2 shagging...
elseif (%r == 21) set %m joins $1 and $2 in a three some...
return %m
}
alias addlove {
; %rep.nick : $2
if (%rep.nick == $2) {
rep.captcha.check %rep.nick
var %time $rand(25,65)
var %sec $calc(60 * %time)
set -u [ $+ [ %sec ] ] %rep. [ $+ [ $me ] ] 1
hinc REPUTATION $me
msg $rep.chan $+($me,`s) reputation is now12 $hget(REPUTATION,$me)
;writeini save\rep. $+ $network $+ .ini rep $me $iif($readini(save\rep. $+ $network $+ .ini,rep,$me) == $NULL,1,$calc($readini(save\rep. $+ $network $+ .ini,rep,$me) + 1 ))
;writeini save\rep. $+ $network $+ .ini rep2nick $readini(save\rep. $+ $network $+ .ini,rep,$me) $me
;if ($readini(save\rep. $+ $network $+ .ini,settings,max) < $readini(save\rep. $+ $network $+ .ini,rep,$me)) writeini save\rep. $+ $network $+ .ini settings max $readini(save\rep. $+ $network $+ .ini,rep,$me)
;writeini save\rep. $+ $network $+ .ini propernick $me $me
;msg $rep.chan $+($me,`s) reputation is now12 $readini(save\rep. $+ $network $+ .ini,rep,$me)
set %time $calc(%time - 2)
var %random1 $rand(0,3)
var %random2 $rand(0,3)
var %fake
if (%random1 == 0) set %fake %time
elseif (%random1 == 1) set %fake 00,00 $rand(15,45) 12 %time $+
elseif (%random1 == 2) set %fake 00,00 $rand(15,45) $rand(15,45) 12 %time $+
elseif (%random1 == 3) set %fake 00,00 $rand(15,45) $rand(15,45) $rand(15,45) 12 %time $+
if (%random2 == 1) set %fake %fake 00,00 $+ $rand(15,45) $+
elseif (%random2 == 2) set %fake %fake 00,00 $+ $rand(15,45) $rand(15,45) $+
elseif (%random2 == 3) set %fake %fake 00,00 $+ $rand(15,45) $rand(15,45) $rand(15,45) $+
if (!%rep.regcheck) && (%rep.nick) && (%rep.nick ison $rep.chan) .notice %rep.nick You are not allowed to use this trigger for the next12 %fake minutes...
halt
}
if ($2 !ison $rep.chan) {
if ($2) describe $rep.chan doesn't see $2
else .notice %rep.nick try $1 <nick>
return
}
if (%rep. [ $+ [ %rep.nick ] ] != 1 ) {
.timerrep.love. $+ $2 1 30 noop
rep.captcha.check %rep.nick
var %time $rand(25,65)
var %sec $calc(60 * %time)
set -u [ $+ [ %sec ] ] %rep. [ $+ [ %rep.nick ] ] 1
if (%rep.make.love. [ $+ [ $2 ] ] == %rep.nick) {
if (%rep.nick) {
var %tmp $make.love(%rep.nick,$2)
.timermake.love 1 5 if (%tmp) describe $rep.chan %tmp
}
}
set -u300 %rep.make.love. [ $+ [ %rep.nick ] ] $2
hinc REPUTATION $2
hinc REPUTATION.TODAY $+(%rep.nick,$chr(187),$2)
msg $rep.chan %rep.nick has increased $2 $+ 's popularity rating to12 $hget(REPUTATION,$2) 13♥
;writeini save\rep. $+ $network $+ .ini rep $2 $iif($readini(save\rep. $+ $network $+ .ini,rep,$2) == $NULL,1,$calc($readini(save\rep. $+ $network $+ .ini,rep,$2) + 1 ))
;writeini save\rep. $+ $network $+ .ini rep2nick $readini(save\rep. $+ $network $+ .ini,rep,$2) $2
;if ($readini(save\rep. $+ $network $+ .ini,settings,max) < $readini(save\rep. $+ $network $+ .ini,rep,$2)) writeini save\rep. $+ $network $+ .ini settings max $readini(save\rep. $+ $network $+ .ini,rep,$2)
;writeini save\rep. $+ $network $+ .ini propernick $2 $2
;msg $rep.chan %rep.nick has increased $2 $+ 's popularity rating to12 $readini(save\rep. $+ $network $+ .ini,rep,$2) 13♥
set %time $calc(%time - 2)
var %random1 $rand(0,3)
var %random2 $rand(0,3)
var %fake
if (%random1 == 0) set %fake %time
elseif (%random1 == 1) set %fake 00,00 $rand(15,45) 12 %time $+
elseif (%random1 == 2) set %fake 00,00 $rand(15,45) $rand(15,45) 12 %time $+
elseif (%random1 == 3) set %fake 00,00 $rand(15,45) $rand(15,45) $rand(15,45) 12 %time $+
if (%random2 == 1) set %fake %fake 00,00 $+ $rand(15,45) $+
elseif (%random2 == 2) set %fake %fake 00,00 $+ $rand(15,45) $rand(15,45) $+
elseif (%random2 == 3) set %fake %fake 00,00 $+ $rand(15,45) $rand(15,45) $rand(15,45) $+
if (!%rep.regcheck) && (%rep.nick) && (%rep.nick ison $rep.chan) .notice %rep.nick You are not allowed to use this trigger for the next12 %fake minutes...
}
.timerunset.vars 1 10 unset.vars
}
alias addhate {
;%rep.nick : $2
if ($2 !ison $rep.chan) {
if ($2) describe $rep.chan doesn't see $2
else .notice %rep.nick try $1 <nick>
halt
}
if ($2 == $me) {
var %time $rand(25,65)
var %sec $calc(60 * %time)
set -u [ $+ [ %sec ] ] %rep. [ $+ [ $nick ] ] 1
if (%rep.make.love. [ $+ [ %rep.nick ] ] ) {
var %tmp $make.love(%rep.nick,$2)
if (%tmp) .timermake.love 1 5 describe $rep.chan %tmp
}
if (!%rep.nick) return
rep.captcha.check $2
set -u300 %rep.make.love. [ $+ [ %rep.nick ] ] $2
hdec REPUTATION %rep.nick
msg $rep.chan %rep.nick $+ 's reputation is now12 $hget(REPUTATION,%rep.nick)
;iecho writeini save\rep. $+ $network $+ .ini rep $nick $iif($readini(save\rep. $+ $network $+ .ini,rep,%rep.nick) == $NULL,-1,$calc($readini(save\rep. $+ $network $+ .ini,rep,$nick) - 1))
;writeini save\rep. $+ $network $+ .ini rep $nick $iif($readini(save\rep. $+ $network $+ .ini,rep,%rep.nick) == $NULL,-1,$calc($readini(save\rep. $+ $network $+ .ini,rep,$nick) - 1))
;writeini save\rep. $+ $network $+ .ini rep2nick $readini(save\rep. $+ $network $+ .ini,rep,%rep.nick) %rep.nick
;if ($readini(save\rep. $+ $network $+ .ini,settings,min) > $readini(save\rep. $+ $network $+ .ini,rep,%rep.nick)) writeini save\rep. $+ $network $+ .ini settings min $readini(save\rep. $+ $network $+ .ini,rep,%rep.nick)
;msg $rep.chan %rep.nick $+ 's reputation is now12 $readini(save\rep. $+ $network $+ .ini,rep,%rep.nick)
set %time $calc(%time - 2)
var %random1 $rand(0,3)
var %random2 $rand(0,3)
var %fake
if (%random1 == 0) set %fake %time
elseif (%random1 == 1) set %fake 00,00 $rand(15,45) 12 %time $+
elseif (%random1 == 2) set %fake 00,00 $rand(15,45) $rand(15,45) 12 %time $+
elseif (%random1 == 3) set %fake 00,00 $rand(15,45) $rand(15,45) $rand(15,45) 12 %time $+
if (%random2 == 1) set %fake %fake 00,00 $+ $rand(15,45) $+
elseif (%random2 == 2) set %fake %fake 00,00 $+ $rand(15,45) $rand(15,45) $+
elseif (%random2 == 3) set %fake %fake 00,00 $+ $rand(15,45) $rand(15,45) $rand(15,45) $+
if (!%rep.regcheck) && (%rep.nick) && (%rep.nick ison $rep.chan) .notice %rep.nick You are not allowed to use this trigger for the next12 %fake minutes...
;writeini save\rep. $+ $network $+ .ini propernick $nick $nick
halt
}
if (%rep. [ $+ [ %rep.nick ] ] != 1 ) {
.timerrep.hate. $+ $2 1 30 noop
.timerrep.hate. $+ %rep.nick 1 30 noop
var %time $rand(25,65)
var %sec $calc(60 * %time)
set -u [ $+ [ %sec ] ] %rep. [ $+ [ %rep.nick ] ] 1
if (%rep.make.love. [ $+ [ $2 ] ] == %rep.nick) {
var %tmp $make.love(%rep.nick,$2)
if (%tmp) .timermake.love 1 5 describe $rep.chan %tmp
}
rep.captcha.check $2
set -u300 %rep.make.love. [ $+ [ %rep.nick ] ] $2
hdec REPUTATION $2
hinc REPUTATION.TODAY $+(%rep.nick,$chr(187),$2)
msg $rep.chan %rep.nick has decreased $2 $+ 's popularity rating to12 $hget(REPUTATION,$2) 4┌∩┐
;writeini save\rep. $+ $network $+ .ini rep $2 $iif($readini(save\rep. $+ $network $+ .ini,rep,$2) == $NULL,-1,$calc($readini(save\rep. $+ $network $+ .ini,rep,$2) - 1 ))
;writeini save\rep. $+ $network $+ .ini rep2nick $readini(save\rep. $+ $network $+ .ini,rep,$2) $2
;if ($readini(save\rep. $+ $network $+ .ini,settings,min) > $readini(save\rep. $+ $network $+ .ini,rep,$2) ) writeini save\rep. $+ $network $+ .ini settings min $readini(save\rep. $+ $network $+ .ini,rep,$2)
;msg $rep.chan %rep.nick has decreased $2 $+ 's popularity rating to12 $readini(save\rep. $+ $network $+ .ini,rep,$2) 4┌∩┐
set %time $calc(%time - 2)
var %random1 $rand(0,3)
var %random2 $rand(0,3)
var %fake
if (%random1 == 0) set %fake %time
elseif (%random1 == 1) set %fake 00,00 $rand(15,45) 12 %time $+
elseif (%random1 == 2) set %fake 00,00 $rand(15,45) $rand(15,45) 12 %time $+
elseif (%random1 == 3) set %fake 00,00 $rand(15,45) $rand(15,45) $rand(15,45) 12 %time $+
if (%random2 == 1) set %fake %fake 00,00 $+ $rand(15,45) $+
elseif (%random2 == 2) set %fake %fake 00,00 $+ $rand(15,45) $rand(15,45) $+
elseif (%random2 == 3) set %fake %fake 00,00 $+ $rand(15,45) $rand(15,45) $rand(15,45) $+
if (!%rep.regcheck) && (%rep.nick) && (%rep.nick ison $rep.chan) .notice %rep.nick You are not allowed to use this trigger for the next12 %fake minutes...
;writeini save\rep. $+ $network $+ .ini propernick $2 $2
}
.timerunset.vars 1 10 unset.vars
}
alias -l unset.vars {
unset %rep.nick
unset %rep.cmd
unset %rep.regcheck
}