| Current Path : /home/mudbot/eggdrop/scripts/bogustrivia/ |
| Current File : //home/mudbot/eggdrop/scripts/bogustrivia/t-2.commands.tcl |
#%v2064#%dt140814#%t-2.commands.tcl#
################################################## Date: 14Aug14 ##
## BogusTrivia 2.06.4.7 by SpiKe^^ Commands File v2064 ##
###################################################################
###################################################################
## Included ReadMe Files ##
## !! Please Read !! ##
## ##
## 1. ReadMe.txt ##
## 2. Installation.txt ##
## 3. Commands.txt ##
## 4. Important Notes.txt ##
## ##
###################################################################
###################################################################
# #
# BogusTrivia Commands File Install Notes: #
# #
# This tcl script Must be in the /scripts/t2 directory to work! #
# Does Not Require a source line in your eggdrop conf file! #
# #
###################################################################
#############################################################################
# Copyright (c) 2006-2014, Richard Fischer (SpiKe^^) spike@mytclscripts.com #
# #
# Permission to use, copy, modify, and/or distribute this software for any #
# purpose with or without fee is hereby granted, provided that the above #
# copyright notice and this permission notice appear in all copies. #
# #
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES #
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF #
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR #
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES #
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN #
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF #
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #
# #
# v1.1 by SpiKe^^ spike@mytclscripts.com, August 14, 2014 #
#############################################################################
############################################################################
### NO SCRIPT SETTINGS IN THIS FILE!! NO SCRIPT SETTINGS IN THIS FILE!! ###
############################################################################
####### !! DO NOT EDIT THIS FILE !! DO NOT EDIT THIS FILE !! #######
############################################################################
### !! All BogusTrivia Script Settings In File: t-2.settings.tcl !! ###
############################################################################
if {![info exists t2(_cm)]} { return 1 }
if {$t2(_cm) eq "c"} {
if {$t2(custclr)!="1"} {
proc TDOMorClr {} { global t2 tclr tscl
set dov 0 ; set dog 0 ; set doa 0 ; set doc 0 ; set dot 0
if {$t2(greet)>"0"} { set dog 1 }
if {$t2(voice)>"0" && $t2(v-how)>"0"} { set dov 1 }
if {$t2(autostart)>"0"} { set doa 1 }
if {$t2(pubcmd)>"0"} {
if {$t2(p-top-d) ne "" || $t2(p-top-w) ne "" || $t2(p-top-m) ne "" || $t2(p-top-e) ne ""} { set dot 1 }
if {$t2(p-mystat) ne "" || $t2(p-info) ne "" || $t2(p-owner) ne ""} { set doc 1 }
if {$t2(p-page) ne "" || $t2(p-other) ne "" || $t2(p-opstat) ne ""} { set doc 1 }
}
if {$t2(color)=="2"} {
if {$dov>"0"} { array set tclr {-vo1 \00300,02 -vo2 \00308,02 -vo3 \00304,02 -vo4 \00300,02} }
if {$dog>"0"} { array set tclr {-gr1 \00300,01 -gr2 \00300,01 -gstat \00308,02 -gsta2 \00300,02 -gsta3 \00308,02} }
if {$doa>"0"} { array set tclr {-as1 "" -as2 ""} }
if {$dot>"0"} {
array set tclr {-ptd1 \00308,02 -ptd2 "" -ptd3 "" -ptw1 \00308,02 -ptw2 "" -ptw3 ""}
array set tclr {-ptm1 \00308,02 -ptm2 "" -ptm3 "" -pte1 \00308,02 -pte2 "" -pte3 ""}
}
if {$doc>"0"} { array set tclr {-pinf1 \00300,02 -pinf2 \00308,02 -pinf3 \00300,01}
array set tclr {-pmy1 \00308,02 -pmy2 \00300,02 -pmy3 \00308,02 -pown \00300,01}
array set tclr {-ppg1 \00300,02 -ppg2 \00308,02 -ppg3 \00300,01}
array set tclr {-poth1 \00300,02 -poth2 \00308,02 -poth3 \00300,01}
}
} elseif {$t2(color)=="3"} {
if {$dov>"0"} { array set tclr {-vo1 \00301,08 -vo2 \00304,08 -vo3 \00304,08 -vo4 \00301,08} }
if {$dog>"0"} { array set tclr {-gr1 \00301,08 -gr2 \00301,08 -gstat \00304,08 -gsta2 \00301,08 -gsta3 \00304,08} }
if {$doa>"0"} { array set tclr {-as1 "" -as2 ""} }
if {$dot>"0"} {
array set tclr {-ptd1 \00301,08 -ptd2 \00301,08 -ptd3 \00300,04 -ptw1 \00300,04 -ptw2 \00300,04 -ptw3 \00301,08}
array set tclr {-ptm1 \00301,08 -ptm2 \00301,08 -ptm3 \00300,04 -pte1 \00300,04 -pte2 \00300,04 -pte3 \00301,08}
}
if {$doc>"0"} { array set tclr {-pinf1 \00301,08 -pinf2 \00304,08 -pinf3 \00301,08}
array set tclr {-pmy1 \00304,08 -pmy2 \00301,08 -pmy3 \00304,08 -pown \00301,08}
array set tclr {-ppg1 \00301,08 -ppg2 \00304,08 -ppg3 \00301,08}
array set tclr {-poth1 \00301,08 -poth2 \00304,08 -poth3 \00301,08}
}
} elseif {$t2(color)=="4"} {
if {$dov>"0"} { array set tclr {-vo1 \00314,15 -vo2 \00306,15 -vo3 \00306,15 -vo4 \00314,15} }
if {$dog>"0"} { array set tclr {-gr1 \00300,14 -gr2 \00300,14 -gstat \00306,15 -gsta2 \00314,15 -gsta3 \00306,15} }
if {$doa>"0"} { array set tclr {-as1 "" -as2 ""} }
if {$dot>"0"} {
array set tclr {-ptd1 \00306,15 -ptd2 \00314,15 -ptd3 \00306,15 -ptw1 \00306,15 -ptw2 \00306,15 -ptw3 \00314,15}
array set tclr {-ptm1 \00306,15 -ptm2 \00314,15 -ptm3 \00306,15 -pte1 \00306,15 -pte2 \00306,15 -pte3 \00314,15}
}
if {$doc>"0"} { array set tclr {-pinf1 \00314,15 -pinf2 \00306,15 -pinf3 \00300,14}
array set tclr {-pmy1 \00306,15 -pmy2 \00314,15 -pmy3 \00306,15 -pown \00300,14}
array set tclr {-ppg1 \00314,15 -ppg2 \00306,15 -ppg3 \00300,14}
array set tclr {-poth1 \00314,15 -poth2 \00306,15 -poth3 \00300,14}
}
} elseif {$t2(color)=="5"} {
if {$dov>"0"} { array set tclr {-vo1 \00314,15 -vo2 \00305,15 -vo3 \00305,15 -vo4 \00314,15} }
if {$dog>"0"} { array set tclr {-gr1 \00300,14 -gr2 \00300,14 -gstat \00305,15 -gsta2 \00314,15 -gsta3 \00305,15} }
if {$doa>"0"} { array set tclr {-as1 "" -as2 ""} }
if {$dot>"0"} {
array set tclr {-ptd1 \00305,15 -ptd2 \00314,15 -ptd3 \00305,15 -ptw1 \00305,15 -ptw2 \00305,15 -ptw3 \00314,15}
array set tclr {-ptm1 \00305,15 -ptm2 \00314,15 -ptm3 \00305,15 -pte1 \00305,15 -pte2 \00305,15 -pte3 \00314,15}
}
if {$doc>"0"} { array set tclr {-pinf1 \00314,15 -pinf2 \00305,15 -pinf3 \00300,14}
array set tclr {-pmy1 \00305,15 -pmy2 \00314,15 -pmy3 \00305,15 -pown \00300,14}
array set tclr {-ppg1 \00314,15 -ppg2 \00305,15 -ppg3 \00300,14}
array set tclr {-poth1 \00314,15 -poth2 \00305,15 -poth3 \00300,14}
}
} elseif {$t2(color)=="6"} {
if {$dov>"0"} { array set tclr {-vo1 \00300,01 -vo2 \00307,01 -vo3 \00307,01 -vo4 \00300,01} }
if {$dog>"0"} { array set tclr {-gr1 \00300,01 -gr2 \00300,01 -gstat \00307,01 -gsta2 \00300,01 -gsta3 \00307,01} }
if {$doa>"0"} { array set tclr {-as1 "" -as2 ""} }
if {$dot>"0"} {
array set tclr {-ptd1 \00300,01 -ptd2 \00307,01 -ptd3 \00307,01 -ptw1 \00300,01 -ptw2 \00307,01 -ptw3 \00307,01}
array set tclr {-ptm1 \00300,01 -ptm2 \00307,01 -ptm3 \00307,01 -pte1 \00300,01 -pte2 \00307,01 -pte3 \00307,01}
}
if {$doc>"0"} { array set tclr {-pinf1 \00300,01 -pinf2 \00307,01 -pinf3 \00300,01}
array set tclr {-pmy1 \00307,01 -pmy2 \00300,01 -pmy3 \00307,01 -pown \00300,01}
array set tclr {-ppg1 \00300,01 -ppg2 \00307,01 -ppg3 \00300,01}
array set tclr {-poth1 \00300,01 -poth2 \00307,01 -poth3 \00300,01}
}
} elseif {$t2(color)=="7"} {
if {$dov>"0"} { array set tclr {-vo1 \00309,02 -vo2 \00308,02 -vo3 \00308,02 -vo4 \00309,02} }
if {$dog>"0"} { array set tclr {-gr1 \00301,08 -gr2 \00301,08 -gstat \00308,02 -gsta2 \00309,02 -gsta3 \00308,02} }
if {$doa>"0"} { array set tclr {-as1 "" -as2 ""} }
if {$dot>"0"} {
array set tclr {-ptd1 \00308,02 -ptd2 \00309,02 -ptd3 \00308,02 -ptw1 \00308,02 -ptw2 \00309,02 -ptw3 \00308,02}
array set tclr {-ptm1 \00308,02 -ptm2 \00309,02 -ptm3 \00308,02 -pte1 \00308,02 -pte2 \00309,02 -pte3 \00308,02}
}
if {$doc>"0"} { array set tclr {-pinf1 \00309,02 -pinf2 \00308,02 -pinf3 \00301,08}
array set tclr {-pmy1 \00308,02 -pmy2 \00309,02 -pmy3 \00308,02 -pown \00301,08}
array set tclr {-ppg1 \00309,02 -ppg2 \00308,02 -ppg3 \00301,08}
array set tclr {-poth1 \00309,02 -poth2 \00308,02 -poth3 \00301,08}
}
} elseif {$t2(color)=="8"} {
if {$dov>"0"} { array set tclr {-vo1 \00315,01 -vo2 \00307,01 -vo3 \00307,01 -vo4 \00315,01} }
if {$dog>"0"} { array set tclr {-gr1 \00300,01 -gr2 \00300,01 -gstat \00307,01 -gsta2 \00315,01 -gsta3 \00307,01} }
if {$doa>"0"} { array set tclr {-as1 "" -as2 ""} }
if {$dot>"0"} {
array set tclr {-ptd1 \00315,01 -ptd2 \00307,01 -ptd3 \00315,01 -ptw1 \00315,01 -ptw2 \00307,01 -ptw3 \00315,01}
array set tclr {-ptm1 \00315,01 -ptm2 \00307,01 -ptm3 \00315,01 -pte1 \00315,01 -pte2 \00307,01 -pte3 \00315,01}
}
if {$doc>"0"} { array set tclr {-pinf1 \00315,01 -pinf2 \00307,01 -pinf3 \00300,01}
array set tclr {-pmy1 \00307,01 -pmy2 \00315,01 -pmy3 \00307,01 -pown \00300,01}
array set tclr {-ppg1 \00315,01 -ppg2 \00307,01 -ppg3 \00300,01}
array set tclr {-poth1 \00315,01 -poth2 \00307,01 -poth3 \00300,01}
}
} elseif {$t2(color)=="0"} {
if {$dov>"0"} { array set tclr {-vo1 "" -vo2 "" -vo3 "" -vo4 ""} }
if {$dog>"0"} { array set tclr {-gr1 "" -gr2 "" -gstat "" -gsta2 "" -gsta3 ""} }
if {$doa>"0"} { array set tclr {-as1 "" -as2 ""} }
if {$dot>"0"} { array set tclr {-ptd1 "" -ptd2 "" -ptd3 "" -ptw1 "" -ptw2 "" -ptw3 ""}
array set tclr {-ptm1 "" -ptm2 "" -ptm3 "" -pte1 "" -pte2 "" -pte3 ""}
}
if {$doc>"0"} { array set tclr {-pmy1 "" -pmy2 "" -pmy3 "" -pown "" -pinf1 "" -pinf2 "" -pinf3 ""}
array set tclr {-ppg1 "" -ppg2 "" -ppg3 "" -poth1 "" -poth2 "" -poth3 ""}
}
} else {
if {$dov>"0"} { array set tclr {-vo1 \00300,10 -vo2 \00308,10 -vo3 \00308,10 -vo4 \00300,10} }
if {$dog>"0"} { array set tclr {-gr1 \00300,01 -gr2 \00300,01 -gstat \00308,10 -gsta2 \00300,10 -gsta3 \00308,10} }
if {$doa>"0"} { array set tclr {-as1 "" -as2 ""} }
if {$dot>"0"} {
array set tclr {-ptd1 \00300,10 -ptd2 \00308,10 -ptd3 \00300,10 -ptw1 \00300,10 -ptw2 \00308,10 -ptw3 \00300,10}
array set tclr {-ptm1 \00300,10 -ptm2 \00308,10 -ptm3 \00300,10 -pte1 \00300,10 -pte2 \00308,10 -pte3 \00300,10}
}
if {$doc>"0"} { array set tclr {-pinf1 \00300,10 -pinf2 \00308,10 -pinf3 \00300,01}
array set tclr {-pmy1 \00308,10 -pmy2 \00300,10 -pmy3 \00308,10 -pown \00300,01}
array set tclr {-ppg1 \00300,10 -ppg2 \00308,10 -ppg3 \00300,01}
array set tclr {-poth1 \00300,10 -poth2 \00308,10 -poth3 \00300,01}
}
}
}
}
if {$t2(pubcmd)>"0"} { set t2(-ptrigls) "" ; set t2(-ptrigl2) ""
if {[string match *m* $t2(p-ompls)]} { set t2(-mtrigls) "" ; set t2(-mtrigl2) ""
} elseif {[info exists t2(-mtrigls)]} { unset t2(-mtrigls) t2(-mtrigl2) }
if {$t2(p-top-d) eq "" && $t2(p-top-w) eq "" && $t2(p-top-m) eq "" && $t2(p-top-e) eq ""} { unset t2(p-tflag) }
if {$t2(p-mystat) eq "" && $t2(p-info) eq "" && $t2(p-owner) eq "" && $t2(p-page) eq "" && $t2(p-other) eq ""} {
if {$t2(p-opstat) eq ""} { unset t2(p-gflag) }
}
if {$t2(p-top-d) ne ""} {
foreach ttmp(x) $t2(p-top-d) { lappend t2(-ptrigls) $ttmp(x) ; lappend t2(-ptrigl2) 1
bind pubm $t2(p-tflag) "$t2(chan) $ttmp(x)" TPubTrig }
}
if {$t2(p-top-d) ne "" && $t2(p-t20-d) ne ""} {
foreach ttmp(x) $t2(p-t20-d) { lappend t2(-ptrigls) $ttmp(x) ; lappend t2(-ptrigl2) 2
bind pubm $t2(p-tflag) "$t2(chan) $ttmp(x)" TPubTrig }
}
if {$t2(p-top-d) ne "" && $t2(p-tmor-d) ne ""} {
foreach ttmp(x) $t2(p-tmor-d) {
if {[string first %% $ttmp(x)]=="-1"} { continue } ; set ttmp(y) [string map {%% ?0} $ttmp(x)]
lappend t2(-ptrigls) $ttmp(y) ; lappend t2(-ptrigl2) 3
bind pubm $t2(p-tflag) "$t2(chan) $ttmp(y)" TPubTrig
if {[string length $t2(p-tmax-d)]>"2"} { set ttmp(y) [string map {%% ??0} $ttmp(x)]
lappend t2(-ptrigls) $ttmp(y) ; lappend t2(-ptrigl2) 3
bind pubm $t2(p-tflag) "$t2(chan) $ttmp(y)" TPubTrig
}
}
}
if {$t2(p-top-w) ne ""} {
foreach ttmp(x) $t2(p-top-w) { lappend t2(-ptrigls) $ttmp(x) ; lappend t2(-ptrigl2) 4
bind pubm $t2(p-tflag) "$t2(chan) $ttmp(x)" TPubTrig }
}
if {$t2(p-top-w) ne "" && $t2(p-t20-w) ne ""} {
foreach ttmp(x) $t2(p-t20-w) { lappend t2(-ptrigls) $ttmp(x) ; lappend t2(-ptrigl2) 5
bind pubm $t2(p-tflag) "$t2(chan) $ttmp(x)" TPubTrig }
}
if {$t2(p-top-w) ne "" && $t2(p-tmor-w) ne ""} {
foreach ttmp(x) $t2(p-tmor-w) {
if {[string first %% $ttmp(x)]=="-1"} { continue } ; set ttmp(y) [string map {%% ?0} $ttmp(x)]
lappend t2(-ptrigls) $ttmp(y) ; lappend t2(-ptrigl2) 6
bind pubm $t2(p-tflag) "$t2(chan) $ttmp(y)" TPubTrig
if {[string length $t2(p-tmax-w)]>"2"} { set ttmp(y) [string map {%% ??0} $ttmp(x)]
lappend t2(-ptrigls) $ttmp(y) ; lappend t2(-ptrigl2) 6
bind pubm $t2(p-tflag) "$t2(chan) $ttmp(y)" TPubTrig
}
}
}
if {$t2(p-top-m) ne ""} {
foreach ttmp(x) $t2(p-top-m) { lappend t2(-ptrigls) $ttmp(x) ; lappend t2(-ptrigl2) 7
bind pubm $t2(p-tflag) "$t2(chan) $ttmp(x)" TPubTrig }
}
if {$t2(p-top-m) ne "" && $t2(p-t20-m) ne ""} {
foreach ttmp(x) $t2(p-t20-m) { lappend t2(-ptrigls) $ttmp(x) ; lappend t2(-ptrigl2) 8
bind pubm $t2(p-tflag) "$t2(chan) $ttmp(x)" TPubTrig }
}
if {$t2(p-top-m) ne "" && $t2(p-tmor-m) ne ""} {
foreach ttmp(x) $t2(p-tmor-m) {
if {[string first %% $ttmp(x)]=="-1"} { continue } ; set ttmp(y) [string map {%% ?0} $ttmp(x)]
lappend t2(-ptrigls) $ttmp(y) ; lappend t2(-ptrigl2) 9
bind pubm $t2(p-tflag) "$t2(chan) $ttmp(y)" TPubTrig
if {[string length $t2(p-tmax-m)]>"2"} { set ttmp(y) [string map {%% ??0} $ttmp(x)]
lappend t2(-ptrigls) $ttmp(y) ; lappend t2(-ptrigl2) 9
bind pubm $t2(p-tflag) "$t2(chan) $ttmp(y)" TPubTrig
}
}
}
if {$t2(p-top-e) ne ""} {
foreach ttmp(x) $t2(p-top-e) { lappend t2(-ptrigls) $ttmp(x) ; lappend t2(-ptrigl2) 10
bind pubm $t2(p-tflag) "$t2(chan) $ttmp(x)" TPubTrig }
}
if {$t2(p-top-e) ne "" && $t2(p-t20-e) ne ""} {
foreach ttmp(x) $t2(p-t20-e) { lappend t2(-ptrigls) $ttmp(x) ; lappend t2(-ptrigl2) 11
bind pubm $t2(p-tflag) "$t2(chan) $ttmp(x)" TPubTrig }
}
if {$t2(p-top-e) ne "" && $t2(p-tmor-e) ne ""} {
foreach ttmp(x) $t2(p-tmor-e) {
if {[string first %% $ttmp(x)]=="-1"} { continue } ; set ttmp(y) [string map {%% ?0} $ttmp(x)]
lappend t2(-ptrigls) $ttmp(y) ; lappend t2(-ptrigl2) 12
bind pubm $t2(p-tflag) "$t2(chan) $ttmp(y)" TPubTrig
if {[string length $t2(p-tmax-e)]>"2"} { set ttmp(y) [string map {%% ???0} $ttmp(x)]
lappend t2(-ptrigls) $ttmp(y) ; lappend t2(-ptrigl2) 12
bind pubm $t2(p-tflag) "$t2(chan) $ttmp(y)" TPubTrig
}
if {[string length $t2(p-tmax-e)]>"3"} { set ttmp(y) [string map {%% ??0} $ttmp(x)]
lappend t2(-ptrigls) $ttmp(y) ; lappend t2(-ptrigl2) 12
bind pubm $t2(p-tflag) "$t2(chan) $ttmp(y)" TPubTrig
}
}
}
if {$t2(p-mystat) ne ""} {
foreach ttmp(x) $t2(p-mystat) { lappend t2(-ptrigls) $ttmp(x) ; lappend t2(-ptrigl2) 50
bind pubm $t2(p-gflag) "$t2(chan) $ttmp(x)" TPubTrig }
}
if {$t2(p-opstat) ne ""} {
foreach ttmp(x) $t2(p-opstat) { lappend t2(-ptrigls) $ttmp(x) ; lappend t2(-ptrigl2) 60
bind pubm $t2(p-gflag) "$t2(chan) $ttmp(x) *" TPubTrig
bind pubm $t2(p-gflag) "$t2(chan) $ttmp(x)" TPubTrig }
}
if {$t2(p-info) ne ""} {
foreach ttmp(x) $t2(p-info) { lappend t2(-ptrigls) $ttmp(x) ; lappend t2(-ptrigl2) 90
bind pubm $t2(p-gflag) "$t2(chan) $ttmp(x)" TPubTrig }
}
if {$t2(p-page) ne ""} {
foreach ttmp(x) $t2(p-page) { lappend t2(-ptrigls) $ttmp(x) ; lappend t2(-ptrigl2) 92
bind pubm $t2(p-gflag) "$t2(chan) $ttmp(x)" TPubTrig }
}
if {$t2(p-owner) ne ""} {
foreach ttmp(x) $t2(p-owner) { lappend t2(-ptrigls) $ttmp(x) ; lappend t2(-ptrigl2) 99
bind pubm $t2(p-gflag) "$t2(chan) $ttmp(x)" TPubTrig }
}
if {$t2(p-other) ne ""} { set ttmp(c) 0
foreach ttmp(x) $t2(p-otrls) ttmp(y) $t2(p-otxls) ttmp(z) $t2(p-oflls) ttmp(q) $t2(p-ompls) {
incr ttmp(c)
if {$ttmp(z) ne "-"} {
if {$ttmp(z) eq "" || $ttmp(z) eq "-|-"} { set ttmp(z) -
} elseif {[string first | $ttmp(z)]=="-1"} { append ttmp(z) |$ttmp(z) }
}
if {$ttmp(c)>"9"} { set t2(P1$ttmp(c)) $ttmp(y) } else { set t2(P10$ttmp(c)) $ttmp(y) }
foreach ttmp(t) $ttmp(x) {
if {$ttmp(q) eq "p"} { lappend t2(-ptrigls) $ttmp(t)
if {$ttmp(c)=="1"} { lappend t2(-ptrigl2) 94
} elseif {$ttmp(c)>"9"} { lappend t2(-ptrigl2) 1$ttmp(c)
} else { lappend t2(-ptrigl2) 10$ttmp(c) }
bind pubm $ttmp(z) "$t2(chan) $ttmp(t)" TPubTrig
} else { lappend t2(-mtrigls) $ttmp(t)
if {$ttmp(c)=="1"} { lappend t2(-mtrigl2) 94
} elseif {$ttmp(c)>"9"} { lappend t2(-mtrigl2) 1$ttmp(c)
} else { lappend t2(-mtrigl2) 10$ttmp(c) }
bind msgm $ttmp(z) $ttmp(t) TMsgTrig
}
}
}
}
if {[info exists t2(-mtrigls)]} {
proc TMsgTrig {nk uh hn tx} { global t2 tclr botnick
if {[info exists t2(-nopub)]} { return 0 }
if {![onchan $nk $t2(chan)]} { return 0 }
TPubTrig $nk $uh $hn 0 $tx
}
}
proc TPubTrig {nk uh hn ch tx} { global t2 tclr botnick
if {[info exists t2(-nopub)]} { return 0 }
set tx [split [TStrTrSp $tx]] ; set arg [lindex $tx 1] ; set tx [lindex $tx 0]
set fnd 0 ; set map [list %n $nk %b $botnick %c $t2(chan) %m $tx]
if {$ch eq "0"} { set ch $nk ; set from m ; set ls1 $t2(-mtrigls) ; set ls2 $t2(-mtrigl2)
} else { set ch $t2(chan) ; set from p ; set ls1 $t2(-ptrigls) ; set ls2 $t2(-ptrigl2) }
foreach trg $ls1 ret $ls2 {
if {[string match -nocase $trg $tx]} {
if {$ret<"13"} {
if {$ret<"4"} { set topls $t2(S-dls) ; set sa2 $t2(P04)
lappend map %1 $tclr(-ptd1) %2 $tclr(-ptd2) %3 $tclr(-ptd3)
if {$ret=="1"} { set start 1 ; set end 10 ; set say $t2(P01)
} elseif {$ret=="2"} { set start 11 ; set end 20 ; set say $t2(P02)
} else {
if {[set x [string first ??0 $trg]]>"-1"} { set end [string range $tx $x [incr x 2]]
} elseif {[set x [string first ?0 $trg]]>"-1"} { set end [string range $tx $x [incr x]]
} else { continue }
if {![TStrDig $end] || $end<"10" || $end>$t2(p-tmax-d)} { continue }
set start [expr {$end-9}] ; set say $t2(P03)
}
} elseif {$ret<"7"} { set topls $t2(S-wls) ; set sa2 $t2(P14)
lappend map %1 $tclr(-ptw1) %2 $tclr(-ptw2) %3 $tclr(-ptw3)
if {$ret=="4"} { set start 1 ; set end 10 ; set say $t2(P11)
} elseif {$ret=="5"} { set start 11 ; set end 20 ; set say $t2(P12)
} else {
if {[set x [string first ??0 $trg]]>"-1"} { set end [string range $tx $x [incr x 2]]
} elseif {[set x [string first ?0 $trg]]>"-1"} { set end [string range $tx $x [incr x]]
} else { continue }
if {![TStrDig $end] || $end<"10" || $end>$t2(p-tmax-w)} { continue }
set start [expr {$end-9}] ; set say $t2(P13)
}
} elseif {$ret<"10"} { set topls $t2(S-mls) ; set sa2 $t2(P24)
lappend map %1 $tclr(-ptm1) %2 $tclr(-ptm2) %3 $tclr(-ptm3)
if {$ret=="7"} { set start 1 ; set end 10 ; set say $t2(P21)
} elseif {$ret=="8"} { set start 11 ; set end 20 ; set say $t2(P22)
} else {
if {[set x [string first ??0 $trg]]>"-1"} { set end [string range $tx $x [incr x 2]]
} elseif {[set x [string first ?0 $trg]]>"-1"} { set end [string range $tx $x [incr x]]
} else { continue }
if {![TStrDig $end] || $end<"10" || $end>$t2(p-tmax-m)} { continue }
set start [expr {$end-9}] ; set say $t2(P23)
}
} else { set topls $t2(S-els) ; set sa2 $t2(P34)
lappend map %1 $tclr(-pte1) %2 $tclr(-pte2) %3 $tclr(-pte3)
if {$ret=="10"} { set start 1 ; set end 10 ; set say $t2(P31)
} elseif {$ret=="11"} { set start 11 ; set end 20 ; set say $t2(P32)
} else {
if {[set x [string first ???0 $trg]]>"-1"} { set end [string range $tx $x [incr x 3]]
} elseif {[set x [string first ??0 $trg]]>"-1"} { set end [string range $tx $x [incr x 2]]
} elseif {[set x [string first ?0 $trg]]>"-1"} { set end [string range $tx $x [incr x]]
} else { continue }
if {![TStrDig $end] || $end<"10" || $end>$t2(p-tmax-e)} { continue }
set start [expr {$end-9}] ; set say $t2(P33)
}
}
set fnd 1
if {$start>[llength $topls]} {
} else { set fnd 2 ; set topls [lrange $topls [expr {$start-1}] [expr {$end-1}]]
lappend map %s $start %e $end ; set x ""
foreach nls $topls {
foreach {p c n ut} $nls { break } ; set ma2 [list %r $start %p $p %q $c %n $n]
append x [string map $ma2 [lindex $sa2 0]] ; incr start
}
incr start -1 ; lappend map %l $start
foreach txln $say { set txln [string map $map [string map [list %x $x] $txln]]
if {$txln ne "" && $txln ne " "} { puthelp "PRIVMSG $ch :$txln" }
}
}
}
if {$ret=="50" || $ret=="60"} { lappend map %1 $tclr(-pmy1) %2 $tclr(-pmy2) %3 $tclr(-pmy3)
if {$ret=="50"} { set kno $t2(P50) ; set z P5
} else {
if {$arg eq ""} {
foreach txln $t2(P70) { set txln [string map $map $txln]
if {$txln ne "" && $txln ne " "} { incr fnd ; puthelp "PRIVMSG $ch :$txln" }
}
if {$fnd>"0"} { set t2(-nopub) 1 ; utimer $t2(pubcmd) [list TNoPub] }
return 1
}
lset map 1 $arg ; set nk $arg ; set kno $t2(P60) ; set z P6
}
set g 0 ; set fnd 1
if {$kno ne ""} {
if {[set tkno [TKnown $nk 4]] && [string match {*%[pqr]e*} $kno]} { set g 1
} elseif {$tkno=="1" && [string match *%e* $kno]} { set g 1
} elseif {[set tkno [TKnown $nk 3]] && [string match {*%[pqr]m*} $kno]} { set g 1
} elseif {$tkno=="1" && [string match *%m* $kno]} { set g 1
} elseif {[set tkno [TKnown $nk 2]] && [string match {*%[pqr]w*} $kno]} { set g 1
} elseif {$tkno=="1" && [string match *%w* $kno]} { set g 1
} elseif {[set tkno [TKnown $nk 1]] && [string match {*%[pqr]d*} $kno]} { set g 1
} elseif {$tkno=="1" && [string match *%d* $kno]} { set g 1 }
}
if {$g=="1"} { set ma4 ""
if {[string match *%d* $kno]} {
if {[TKnown $nk 1]} { lappend ma4 %d [join $t2(${z}2)] } else { lappend ma4 %d [join $t2(${z}3)] }
}
if {[string match *%w* $kno]} {
if {[TKnown $nk 2]} { lappend ma4 %w [join $t2(${z}4)] } else { lappend ma4 %w [join $t2(${z}5)] }
}
if {[string match *%m* $kno]} {
if {[TKnown $nk 3]} { lappend ma4 %m [join $t2(${z}6)] } else { lappend ma4 %m [join $t2(${z}7)] }
}
if {[string match *%e* $kno]} {
if {[TKnown $nk 4]} { lappend ma4 %e [join $t2(${z}8)] } else { lappend ma4 %e [join $t2(${z}9)] }
}
if {$ma4 ne ""} { set newtx ""
foreach txln $kno { lappend newtx [string map $ma4 $txln] }
set kno $newtx
}
set saytx $kno
} else { set saytx $t2(${z}1) }
if {$saytx ne ""} { set fnd 2
if {[string match {*%[pqr][demw]*} $saytx]} { set st [TGetStat $nk]
foreach {d w m e} $st { break } ; set p 0 ; set q 0 ; set r 0
if {$d ne "0"} { foreach {p q r} $d { break } }
lappend map %pd $p %qd $q %rd $r ; set p 0 ; set q 0 ; set r 0
if {$w ne "0"} { foreach {p q r} $w { break } }
lappend map %pw $p %qw $q %rw $r ; set p 0 ; set q 0 ; set r 0
if {$m ne "0"} { foreach {p q r} $m { break } }
lappend map %pm $p %qm $q %rm $r ; set p 0 ; set q 0 ; set r 0
if {$e ne "0"} { foreach {p q r} $e { break } }
lappend map %pe $p %qe $q %re $r
}
foreach txln $saytx { set txln [string map $map $txln]
if {$txln ne "" && $txln ne " "} { puthelp "PRIVMSG $ch :$txln" }
}
}
}
if {$ret>"89"} { set ut [unixtime] ; set fnd 1
lappend map %s $t2(script) %v $t2(ver) %a $t2(auth) %d $t2(p-activ) %t $t2(-ufilcnt)
if {$t2(p-pwww) ne ""} { lappend map %w $t2(p-pwww) } else { lappend map %w N/A }
lappend map %q $t2(-qtotal) %k $t2(-ktotal) %z [expr {$t2(-qtotal)+$t2(-ktotal)}]
if {[info exists t2(S-akp)] && $t2(S-akp)>"0"} { lappend map %g $t2(S-acnt)
if {$t2(-ison)=="0" && [expr {$t2(S-aut)+300}]<$ut} { TSetStat 1 }
} else { lappend map %g N/A }
if {$ret=="90"} { lappend map %1 $tclr(-pinf1) %2 $tclr(-pinf2) %3 $tclr(-pinf3)
set stxt [concat $t2(P45) $t2(P46)]
} elseif {$ret=="92"} { lappend map %1 $tclr(-ppg1) %2 $tclr(-ppg2) %3 $tclr(-ppg3)
set stxt $t2(P42)
} elseif {$ret=="94"} { lappend map %1 $tclr(-poth1) %2 $tclr(-poth2) %3 $tclr(-poth3)
set stxt $t2(P43)
} elseif {$ret>"101" && $ret<"126"} { set stxt $t2(P$ret)
lappend map %1 $tclr(-poth1) %2 $tclr(-poth2) %3 $tclr(-poth3)
} else { lappend map %1 $tclr(-pown) ; set stxt $t2(P41) }
set dtmap [list %o [strftime %x $t2(-reldate)] %u [strftime %x $t2(-ufiledt)]]
lappend dtmap %l [strftime %X $ut] %i [strftime %x $ut] %f ""
foreach txln $stxt {
if {$txln ne "" && $txln ne " "} { set fnd 2
if {[string match *%f* $txln]} { set nst 0 ; set nxf -1 ; set newln "" ; set dun 0
while {$dun=="0"} { set nxf [string first %f $txln]
if {$nxf=="0"} { set nst 2 ; set nxf -1
} else { append newln [string range $txln 0 [expr {$nxf-1}]]
set nst [incr nxf 2] ; set nxf -1
}
if {$nst>=[string length $txln]} { break }
set txln [string range $txln $nst end] ; set nst 0
set nxf [string first %o [string map {%u %o %l %o %i %o} $txln]]
if {$nxf=="-1"} { append newln $txln ; break }
set dtc [string index $txln [expr {$nxf+1}]]
if {$nxf=="0"} { set tdstr "" ; set nst 2 ; set nxf -1 ; append newln %$dtc
} else { set tdstr [string range $txln 0 [expr {$nxf-1}]]
set nst [incr nxf 2] ; set nxf -1
if {[string match *%* $tdstr]} {
if {$dtc=="o"} { set tdut $t2(-reldate)
} elseif {$dtc=="u"} { set tdut $t2(-ufiledt)
} else { set tdut $ut }
if {[string match *%e* $tdstr]} { set e [string trim [strftime %e $tdut]]
set tdstr [string map [list %e $e] $tdstr]
}
if {![info exists tdmap]} { set tdmap [list %%f "" %% %% %f "" %s %%s %v %%v]
lappend tdmap %1 %%1 %2 %%2 %3 %%3 %n %%n %w %%w %t %%t %q %%q %k %%k %z %%z
}
append newln [strftime [string map $tdmap $tdstr] $tdut]
} else { append newln $tdstr%$dtc }
}
if {$nst>=[string length $txln]} { break }
set txln [string range $txln $nst end] ; set nst 0
set nxf [string first %f $txln]
if {![string match *%f* $txln]} { append newln $txln ; break }
}
set txln $newln
}
puthelp "PRIVMSG $ch :[string map [concat $map $dtmap] $txln]"
}
}
}
if {$fnd>"0"} { break }
}
}
if {$fnd>"1"} { set t2(-nopub) 1 ; utimer $t2(pubcmd) [list TNoPub] }
}
proc TNoPub {} { global t2
if {[info exists t2(-nopub)]} { unset t2(-nopub) }
}
}
array unset t2 _* ; return 0
}
if {$t2(_cm) eq "s"} {
proc TSetStat { {wat 0} {mor 0} } { global t2
if {$t2(-stats)=="0"} { array unset t2 S-* ; return 1 }
if {$wat=="0"} { array unset t2 S-*
set t2(S-dkp) 0 ; set t2(S-wkp) 0 ; set t2(S-mkp) 0 ; set t2(S-ekp) 0 ; set t2(S-akp) 0
}
if {$wat=="0" && $t2(voice)>"0"} {
if {$t2(v-top3)>"0"} {
if {$t2(v-top3)=="1" || $t2(v-top3)=="3"} { set t2(S-wkp) 3 ;set t2(S-wls) "" ;set t2(S-wpt) 1
if {$t2(v-min)>"0"} { set t2(S-wpt) $t2(v-min) }
}
if {$t2(v-top3)=="2" || $t2(v-top3)=="3"} { set t2(S-mkp) 3 ;set t2(S-mls) "" ;set t2(S-mpt) 1
if {$t2(v-min)>"0"} { set t2(S-mpt) $t2(v-min) }
}
}
if {$t2(v-top10)>"0"} {
if {$t2(v-top10)=="1" || $t2(v-top10)=="3"} { set t2(S-wkp) 10 ;set t2(S-wls) "" ;set t2(S-wpt) 1
if {$t2(v-min)>"0"} { set t2(S-wpt) $t2(v-min) }
}
if {$t2(v-top10)=="2" || $t2(v-top10)=="3"} { set t2(S-mkp) 10 ;set t2(S-mls) "" ;set t2(S-mpt) 1
if {$t2(v-min)>"0"} { set t2(S-mpt) $t2(v-min) }
}
}
}
if {$wat=="0" && $t2(greet)>"0"} {
foreach ttmp(x) {G01 G11 G21 G31 G02} {
if {[string match {*%[pqr]d*} $t2($ttmp(x))] || [string match *%d* $t2($ttmp(x))]} {
set t2(S-dkp) 1000 ; set t2(S-dls) "" ; set t2(S-dpt) 1
} elseif {[string match *%a* $t2($ttmp(x))] && [string match {*%u[dnpqr]d*} $t2(G81)]} {
set t2(S-dkp) 1000 ; set t2(S-dls) "" ; set t2(S-dpt) 1
} elseif {[string match *%h* $t2($ttmp(x))] && [string match {*%u[dnpqr]d*} $t2(G84)]} {
set t2(S-dkp) 1000 ; set t2(S-dls) "" ; set t2(S-dpt) 1 }
if {[string match {*%[pqr]w*} $t2($ttmp(x))] || [string match *%w* $t2($ttmp(x))]} {
set t2(S-wkp) 1000 ; set t2(S-wls) "" ; set t2(S-wpt) 1
} elseif {[string match *%a* $t2($ttmp(x))] && [string match {*%u[dnpqr]w*} $t2(G81)]} {
set t2(S-wkp) 1000 ; set t2(S-wls) "" ; set t2(S-wpt) 1
} elseif {[string match *%h* $t2($ttmp(x))] && [string match {*%u[dnpqr]w*} $t2(G84)]} {
set t2(S-wkp) 1000 ; set t2(S-wls) "" ; set t2(S-wpt) 1 }
if {[string match {*%[pqr]m*} $t2($ttmp(x))] || [string match *%m* $t2($ttmp(x))]} {
set t2(S-mkp) 1000 ; set t2(S-mls) "" ; set t2(S-mpt) 1
} elseif {[string match *%a* $t2($ttmp(x))] && [string match {*%u[dnpqr]m*} $t2(G81)]} {
set t2(S-mkp) 1000 ; set t2(S-mls) "" ; set t2(S-mpt) 1
} elseif {[string match *%h* $t2($ttmp(x))] && [string match {*%u[dnpqr]m*} $t2(G84)]} {
set t2(S-mkp) 1000 ; set t2(S-mls) "" ; set t2(S-mpt) 1 }
if {[string match {*%[pqr]e*} $t2($ttmp(x))] || [string match *%e* $t2($ttmp(x))]} {
set t2(S-ekp) 1000 ; set t2(S-els) "" ; set t2(S-ept) 1
} elseif {[string match *%a* $t2($ttmp(x))] && [string match {*%u[dnpqr]e*} $t2(G81)]} {
set t2(S-ekp) 1000 ; set t2(S-els) "" ; set t2(S-ept) 1
} elseif {[string match *%h* $t2($ttmp(x))] && [string match {*%u[dnpqr]e*} $t2(G84)]} {
set t2(S-ekp) 1000 ; set t2(S-els) "" ; set t2(S-ept) 1 }
}
}
if {$wat=="0" && $t2(pubcmd)>"0"} {
if {$t2(S-dkp)<"1000"} {
if {$t2(p-mystat) ne "" && ([string match *%d* $t2(P50)] || [string match {*%[pqr]d*} $t2(P50)])} {
set t2(S-dkp) 1000 ; set t2(S-dls) "" ; set t2(S-dpt) 1 }
if {$t2(S-dkp)<"1000" && $t2(p-opstat) ne "" && ([string match *%d* $t2(P60)] || [string match {*%[pqr]d*} $t2(P60)])} {
set t2(S-dkp) 1000 ; set t2(S-dls) "" ; set t2(S-dpt) 1 }
if {$t2(S-dkp)<"1000" && $t2(p-top-d) ne ""} { set keep 10
if {$t2(p-t20-d) ne ""} { set keep 20 }
if {$t2(p-tmor-d) ne ""} { set keep $t2(p-tmax-d) }
if {$keep>$t2(S-dkp)} { set t2(S-dkp) $keep ; set t2(S-dls) "" ; set t2(S-dpt) 1 }
}
}
if {$t2(S-wkp)<"1000"} {
if {$t2(p-mystat) ne "" && ([string match *%w* $t2(P50)] || [string match {*%[pqr]w*} $t2(P50)])} {
set t2(S-wkp) 1000 ; set t2(S-wls) "" ; set t2(S-wpt) 1 }
if {$t2(S-wkp)<"1000" && $t2(p-opstat) ne "" && ([string match *%w* $t2(P60)] || [string match {*%[pqr]w*} $t2(P60)])} {
set t2(S-wkp) 1000 ; set t2(S-wls) "" ; set t2(S-wpt) 1 }
if {$t2(S-wkp)<"1000" && $t2(p-top-w) ne ""} { set keep 10
if {$t2(p-t20-w) ne ""} { set keep 20 }
if {$t2(p-tmor-w) ne ""} { set keep $t2(p-tmax-w) }
if {$keep>$t2(S-wkp)} { set t2(S-wkp) $keep ; set t2(S-wls) "" ; set t2(S-wpt) 1 }
}
}
if {$t2(S-mkp)<"1000"} {
if {$t2(p-mystat) ne "" && ([string match *%m* $t2(P50)] || [string match {*%[pqr]m*} $t2(P50)])} {
set t2(S-mkp) 1000 ; set t2(S-mls) "" ; set t2(S-mpt) 1 }
if {$t2(S-mkp)<"1000" && $t2(p-opstat) ne "" && ([string match *%m* $t2(P60)] || [string match {*%[pqr]m*} $t2(P60)])} {
set t2(S-mkp) 1000 ; set t2(S-mls) "" ; set t2(S-mpt) 1 }
if {$t2(S-mkp)<"1000" && $t2(p-top-m) ne ""} { set keep 10
if {$t2(p-t20-m) ne ""} { set keep 20 }
if {$t2(p-tmor-m) ne ""} { set keep $t2(p-tmax-m) }
if {$keep>$t2(S-mkp)} { set t2(S-mkp) $keep ; set t2(S-mls) "" ; set t2(S-mpt) 1 }
}
}
if {$t2(S-ekp)<"1000"} {
if {$t2(p-mystat) ne "" && ([string match *%e* $t2(P50)] || [string match {*%[pqr]e*} $t2(P50)])} {
set t2(S-ekp) 1000 ; set t2(S-els) "" ; set t2(S-ept) 1 }
if {$t2(S-ekp)<"1000" && $t2(p-opstat) ne "" && ([string match *%e* $t2(P60)] || [string match {*%[pqr]e*} $t2(P60)])} {
set t2(S-ekp) 1000 ; set t2(S-els) "" ; set t2(S-ept) 1 }
if {$t2(S-ekp)<"1000" && $t2(p-top-e) ne ""} { set keep 10
if {$t2(p-t20-e) ne ""} { set keep 20 }
if {$t2(p-tmor-e) ne ""} { set keep $t2(p-tmax-e) }
if {$keep>$t2(S-ekp)} { set t2(S-ekp) $keep ; set t2(S-els) "" ; set t2(S-ept) 1 }
}
}
if {$t2(S-akp)=="0" && $t2(p-owner) ne ""} {
if {[string match *%g* $t2(P41)]} { set t2(S-akp) 1 }
}
if {$t2(S-akp)=="0" && $t2(p-page) ne ""} {
if {[string match *%g* $t2(P42)]} { set t2(S-akp) 1 }
}
if {$t2(S-akp)=="0" && $t2(p-info) ne ""} {
if {[string match *%g* [concat $t2(P45) $t2(P46)]]} { set t2(S-akp) 1 }
}
if {$t2(S-akp)=="0" && $t2(p-other) ne ""} {
if {[string match *%g* $t2(P43)]} { set t2(S-akp) 1
} elseif {[string match *%g* $t2(p-otxls)]} { set t2(S-akp) 1 }
}
}
if {$t2(S-dkp)=="0" && $t2(S-wkp)=="0" && $t2(S-mkp)=="0" && $t2(S-ekp)=="0" && $t2(S-akp)=="0"} {
set t2(-stats) 0 ; array unset t2 S-* ; return 1 }
if {$t2(S-akp)>"0"} { set t2(S-acnt) 0 ; set t2(S-aut) [unixtime]
set asec [expr {[unixtime]-($t2(p-activ)*86400)}]
}
if {![file exists $t2(sfpath)t2.users]} { return 2 }
set tusfile [open $t2(sfpath)t2.users] ; set tulin0 [gets $tusfile] ; set adun 0
while {![eof $tusfile]} { set temp [gets $tusfile]
if {$temp ne ""} { set temp [split $temp]
foreach {nk hn uh tp tc wp wc mp mc ep ec at st n2 u2} $temp { break }
set nk [string range $nk 3 end]
if {$wat=="0"} {
if {$t2(S-dkp)>"0" && $tp>=$t2(S-dpt)} { lappend t2(S-dls) [list $tp $tc $nk $at] }
if {$t2(S-wkp)>"0" && $wp>=$t2(S-wpt)} { lappend t2(S-wls) [list $wp $wc $nk $at] }
if {$t2(S-mkp)>"0" && $mp>=$t2(S-mpt)} { lappend t2(S-mls) [list $mp $mc $nk $at] }
if {$t2(S-ekp)>"0" && $ep>=$t2(S-ept)} { lappend t2(S-els) [list $ep $ec $nk $at] }
}
if {$t2(S-akp)>"0" && $adun=="0"} {
if {$st<$asec} {
if {$t2(S-dkp)=="0" && $t2(S-wkp)=="0" && $t2(S-mkp)=="0" && $t2(S-ekp)=="0"} {
close $tusfile ; return 3
} elseif {$wat=="1"} { close $tusfile ; return 4 } else { set adun 1 }
} else { incr t2(S-acnt) }
}
}
}
close $tusfile
if {$wat=="1"} { return 5 }
foreach {x y z} {dkp dls dpt wkp wls wpt mkp mls mpt ekp els ept} {
if {$t2(S-$x)>"0" && $t2(S-$y) ne ""} { set rest ""
set t2(S-$y) [lsort -index 0 -integer -decreasing $t2(S-$y)]
if {[llength $t2(S-$y)]>$t2(S-$x)} { set rest [lrange $t2(S-$y) $t2(S-$x) end]
set t2(S-$y) [lreplace $t2(S-$y) $t2(S-$x) end] }
if {[llength $t2(S-$y)]==$t2(S-$x)} { set t2(S-$z) [lindex $t2(S-$y) end 0] }
if {$rest ne "" && [lindex $rest 0 0]==$t2(S-$z)} {
foreach usr $rest {
if {[lindex $usr 0]==$t2(S-$z)} { lappend $t2(S-$y) $usr } else { break }
}
}
set t2(S-$y) [TRanking $t2(S-$y) $t2(S-$x)]
}
}
return 0
}
TSetStat
if {$t2(-stats)=="0"} { array unset t2 _* ; rename TSetStat "" ; return 0 }
proc TKnown {nk {wat 0} } { global t2 ; set d 0 ; set w 0 ; set m 0 ; set e 0
if {$t2(-stats)=="0"} { return 0 } ; set nk [TStrLo $nk]
if {$wat<"2" && [info exists t2(S-dls)] && $t2(S-dls) ne ""} {
foreach pl $t2(S-dls) {
if {[TStrLo [lindex $pl 2]] eq $nk} { set d 1 ; break }
}
}
if {($wat=="0" || $wat=="2") && [info exists t2(S-wls)] && $t2(S-wls) ne ""} {
foreach pl $t2(S-wls) {
if {[TStrLo [lindex $pl 2]] eq $nk} { set w 1 ; break }
}
}
if {($wat=="0" || $wat=="3") && [info exists t2(S-mls)] && $t2(S-mls) ne ""} {
foreach pl $t2(S-mls) {
if {[TStrLo [lindex $pl 2]] eq $nk} { set m 1 ; break }
}
}
if {($wat=="0" || $wat=="4") && [info exists t2(S-els)] && $t2(S-els) ne ""} {
foreach pl $t2(S-els) {
if {[TStrLo [lindex $pl 2]] eq $nk} { set e 1 ; break }
}
}
if {$wat=="1"} { return $d } ; if {$wat=="2"} { return $w }
if {$wat=="3"} { return $m } ; if {$wat=="4"} { return $e }
return [list $d $w $m $e]
}
proc TGetNxUp {nk {wat 0} } { global t2 ; set d 0 ; set w 0 ; set m 0 ; set e 0
if {$t2(-stats)=="0"} { return 0 } ; set nk [TStrLo $nk]
if {$wat<"2" && [info exists t2(S-dls)] && $t2(S-dls) ne ""} { set c 0 ; set l "" ; set fnd 0
foreach pl $t2(S-dls) { incr c
foreach {v x y z} $pl { break }
if {[TStrLo $y] eq $nk} { set fnd 1
if {$c>"1"} { set pt 0 ; set nx ""
foreach p2 $l { incr c -1
foreach {v2 x2 y2 z2} $p2 { break }
if {$pt=="0"} { set pt $v2 ; set nx $p2 ; lappend nx $c
} elseif {$v2==$pt} { set nx $p2 ; lappend nx $c } else { break }
}
foreach {v2 x2 y2 z2 rnk} $nx { break }
set dif [expr {round(("$v2.0"-$v)+1)}] ; set d [list $y2 $v2 $x2 $rnk $dif]
} else { set d 1 }
break
} else { set l [linsert $l 0 $pl] }
}
if {$fnd=="0"} { set pt [lindex $l 0 0] ; set nx [lindex $l 0] ; lappend nx $c
if {[llength $l]>"1"} {
foreach p2 [lrange $l 1 end] { incr c -1
foreach {v2 x2 y2 z2} $p2 { break }
if {$v2==$pt} { set nx $p2 ; lappend nx $c } else { break }
}
}
foreach {v2 x2 y2 z2 rnk} $nx { break }
set dif [expr {round("$v2.0"+1)}] ; set d [list $y2 $v2 $x2 $rnk $dif]
}
}
if {($wat=="0" || $wat=="2") && [info exists t2(S-wls)] && $t2(S-wls) ne ""} { set c 0 ; set l "" ; set fnd 0
foreach pl $t2(S-wls) { incr c
foreach {v x y z} $pl { break }
if {[TStrLo $y] eq $nk} { set fnd 1
if {$c>"1"} { set pt 0 ; set nx ""
foreach p2 $l { incr c -1
foreach {v2 x2 y2 z2} $p2 { break }
if {$pt=="0"} { set pt $v2 ; set nx $p2 ; lappend nx $c
} elseif {$v2==$pt} { set nx $p2 ; lappend nx $c } else { break }
}
foreach {v2 x2 y2 z2 rnk} $nx { break }
set dif [expr {round(("$v2.0"-$v)+1)}] ; set w [list $y2 $v2 $x2 $rnk $dif]
} else { set w 1 }
break
} else { set l [linsert $l 0 $pl] }
}
if {$fnd=="0"} { set pt [lindex $l 0 0] ; set nx [lindex $l 0] ; lappend nx $c
if {[llength $l]>"1"} {
foreach p2 [lrange $l 1 end] { incr c -1
foreach {v2 x2 y2 z2} $p2 { break }
if {$v2==$pt} { set nx $p2 ; lappend nx $c } else { break }
}
}
foreach {v2 x2 y2 z2 rnk} $nx { break }
set dif [expr {round("$v2.0"+1)}] ; set w [list $y2 $v2 $x2 $rnk $dif]
}
}
if {($wat=="0" || $wat=="3") && [info exists t2(S-mls)] && $t2(S-mls) ne ""} { set c 0 ; set l "" ; set fnd 0
foreach pl $t2(S-mls) { incr c
foreach {v x y z} $pl { break }
if {[TStrLo $y] eq $nk} { set fnd 1
if {$c>"1"} { set pt 0 ; set nx ""
foreach p2 $l { incr c -1
foreach {v2 x2 y2 z2} $p2 { break }
if {$pt=="0"} { set pt $v2 ; set nx $p2 ; lappend nx $c
} elseif {$v2==$pt} { set nx $p2 ; lappend nx $c } else { break }
}
foreach {v2 x2 y2 z2 rnk} $nx { break }
set dif [expr {round(("$v2.0"-$v)+1)}] ; set m [list $y2 $v2 $x2 $rnk $dif]
} else { set m 1 }
break
} else { set l [linsert $l 0 $pl] }
}
if {$fnd=="0"} { set pt [lindex $l 0 0] ; set nx [lindex $l 0] ; lappend nx $c
if {[llength $l]>"1"} {
foreach p2 [lrange $l 1 end] { incr c -1
foreach {v2 x2 y2 z2} $p2 { break }
if {$v2==$pt} { set nx $p2 ; lappend nx $c } else { break }
}
}
foreach {v2 x2 y2 z2 rnk} $nx { break }
set dif [expr {round("$v2.0"+1)}] ; set m [list $y2 $v2 $x2 $rnk $dif]
}
}
if {($wat=="0" || $wat=="4") && [info exists t2(S-els)] && $t2(S-els) ne ""} { set c 0 ; set l "" ; set fnd 0
foreach pl $t2(S-els) { incr c
foreach {v x y z} $pl { break }
if {[TStrLo $y] eq $nk} { set fnd 1
if {$c>"1"} { set pt 0 ; set nx ""
foreach p2 $l { incr c -1
foreach {v2 x2 y2 z2} $p2 { break }
if {$pt=="0"} { set pt $v2 ; set nx $p2 ; lappend nx $c
} elseif {$v2==$pt} { set nx $p2 ; lappend nx $c } else { break }
}
foreach {v2 x2 y2 z2 rnk} $nx { break }
set dif [expr {round(("$v2.0"-$v)+1)}] ; set e [list $y2 $v2 $x2 $rnk $dif]
} else { set e 1 }
break
} else { set l [linsert $l 0 $pl] }
}
if {$fnd=="0"} { set pt [lindex $l 0 0] ; set nx [lindex $l 0] ; lappend nx $c
if {[llength $l]>"1"} {
foreach p2 [lrange $l 1 end] { incr c -1
foreach {v2 x2 y2 z2} $p2 { break }
if {$v2==$pt} { set nx $p2 ; lappend nx $c } else { break }
}
}
foreach {v2 x2 y2 z2 rnk} $nx { break }
set dif [expr {round("$v2.0"+1)}] ; set e [list $y2 $v2 $x2 $rnk $dif]
}
}
if {$wat=="1"} { return $d } ; if {$wat=="2"} { return $w }
if {$wat=="3"} { return $m } ; if {$wat=="4"} { return $e }
return [list $d $w $m $e]
}
proc TGetStat {nk {wat 0} } { global t2 ; set d 0 ; set w 0 ; set m 0 ; set e 0
if {$t2(-stats)=="0"} { return 0 } ; set nk [TStrLo $nk]
if {$wat<"2" && [info exists t2(S-dls)] && $t2(S-dls) ne ""} { set c 0
foreach pl $t2(S-dls) { incr c
foreach {v x y z} $pl { break }
if {[TStrLo $y] eq $nk} { set d [list $v $x $c] ; break }
}
}
if {($wat=="0" || $wat=="2") && [info exists t2(S-wls)] && $t2(S-wls) ne ""} { set c 0
foreach pl $t2(S-wls) { incr c
foreach {v x y z} $pl { break }
if {[TStrLo $y] eq $nk} { set w [list $v $x $c] ; break }
}
}
if {($wat=="0" || $wat=="3") && [info exists t2(S-mls)] && $t2(S-mls) ne ""} { set c 0
foreach pl $t2(S-mls) { incr c
foreach {v x y z} $pl { break }
if {[TStrLo $y] eq $nk} { set m [list $v $x $c] ; break }
}
}
if {($wat=="0" || $wat=="4") && [info exists t2(S-els)] && $t2(S-els) ne ""} { set c 0
foreach pl $t2(S-els) { incr c
foreach {v x y z} $pl { break }
if {[TStrLo $y] eq $nk} { set e [list $v $x $c] ; break }
}
}
if {$wat=="1"} { return $d } ; if {$wat=="2"} { return $w }
if {$wat=="3"} { return $m } ; if {$wat=="4"} { return $e }
return [list $d $w $m $e]
}
if {$t2(voice)>"0"} {
proc TCheckV {nk} { global t2 botnick ; set nk [TStrLo $nk] ; set num 0 ; set wen 0
if {$nk eq [TStrLo $botnick] || $t2(voice)=="0"} { return 0 }
if {($t2(v-top3)=="1" || $t2(v-top3)=="3") && $t2(S-wls) ne ""} { set rnk 0
foreach usr [lrange $t2(S-wls) 0 2] { incr rnk
foreach {x y z} $usr { break }
if {[TStrLo $z] eq $nk} {
if {$x>=$t2(v-min)} { set num 3 ; incr wen 1 } ; break
}
}
}
if {($t2(v-top3)=="2" || $t2(v-top3)=="3") && $t2(S-mls) ne ""} { set rnk 0
foreach usr [lrange $t2(S-mls) 0 2] { incr rnk
foreach {x y z} $usr { break }
if {[TStrLo $z] eq $nk} {
if {$x>=$t2(v-min)} { set num 3 ; incr wen 2 } ; break
}
}
}
if {$num>"0"} { set x [list $num $wen] ; return $x }
if {($t2(v-top10)=="1" || $t2(v-top10)=="3") && $t2(S-wls) ne ""} { set rnk 0
foreach usr [lrange $t2(S-wls) 0 9] { incr rnk
foreach {x y z} $usr { break }
if {[TStrLo $z] eq $nk} {
if {$x>=$t2(v-min)} { set num 10 ; incr wen 1 } ; break
}
}
}
if {($t2(v-top10)=="2" || $t2(v-top10)=="3") && $t2(S-mls) ne ""} { set rnk 0
foreach usr [lrange $t2(S-mls) 0 9] { incr rnk
foreach {x y z} $usr { break }
if {[TStrLo $z] eq $nk} {
if {$x>=$t2(v-min)} { set num 10 ; incr wen 2 } ; break
}
}
}
if {$num>"0"} { set x [list $num $wen] ; return $x } ; return 0
}
}
if {$t2(voice)>"1"} {
proc TDoActV {recnkls} { global t2 tclr botnick
if {[botisop $t2(chan)]} { set vls ""
foreach n $recnkls {
if {![onchan $n $t2(chan)] || [isvoice $n $t2(chan)]} { continue }
if {[isop $n $t2(chan)] && $t2(v-op)<"2"} { continue }
if {[set z [TCheckV $n]] ne "0"} {
foreach {x y} $z { break } ; lappend vls $n $x $y
}
}
if {$vls ne ""} { lappend vls 0 0 0 ; set cnt 0 ; set nxt "" ; set say ""
if {$t2(v-how)>"0"} {
if {$t2(v-how)>"2"} { set say $t2(V21) } else { set say $t2(V31) }
}
if {$say ne ""} { set map [list %b $botnick %c $t2(chan) %tf $t2(off) %th $t2(hint)]
if {$t2(usrqes) eq "0"} { lappend map %tq N/A } else { lappend map %tq $t2(upubq) }
lappend map %to $t2(on) %1 $tclr(-vo1) %2 $tclr(-vo2) %3 $tclr(-vo3) %4 $tclr(-vo4)
if {$t2(v-how)=="2" || $t2(v-how)=="4"} { set putpre NOTICE } else { set putpre PRIVMSG }
}
foreach {n x y} $vls {
if {($cnt==$t2(v-max) || $x eq "0") && $nxt ne ""} { set z "+" ; set nls ""
foreach {n2 x2 y2} $nxt { append z v ; append nls $n2 }
putserv "MODE $t2(chan) $z [join $nls]"
if {$say ne ""} {
foreach {n2 x2 y2} $nxt { set ma6 [list %n $n2 %x $x2 %y $x2]
if {$y2=="3"} { set tm $t2(V92)$t2(V91)$t2(V93) ; lappend ma6 %w $t2(V93) %z $tm
} elseif {$y2=="2"} { lappend ma6 %w $t2(V93) %z $t2(V93)
} else { lappend ma6 %w $t2(V92) %z $t2(V92) }
if {$t2(v-how)<"3"} { set pre "$putpre $n2 :" } else { set pre "$putpre $t2(chan) :" }
if {[string match {*%[pqr][demw]*} $say]} { set st [TGetStat $n2]
foreach {d w m e} $st { break } ; set p 0 ; set q 0 ; set r 0
if {$d ne "0"} { foreach {p q r} $d { break } }
lappend ma6 %pd $p %qd $q %rd $r ; set p 0 ; set q 0 ; set r 0
if {$w ne "0"} { foreach {p q r} $w { break } }
lappend ma6 %pw $p %qw $q %rw $r ; set p 0 ; set q 0 ; set r 0
if {$m ne "0"} { foreach {p q r} $m { break } }
lappend ma6 %pm $p %qm $q %rm $r ; set p 0 ; set q 0 ; set r 0
if {$e ne "0"} { foreach {p q r} $e { break } }
lappend ma6 %pe $p %qe $q %re $r
}
if {[string match {*%[ah]*} $say]} { set st [TGetNxUp $n2]
foreach {d w m e} $st { break }
foreach {up u2} {%a 81 %h 84} { set vs $t2(V$u2) ; set vg V
if {[string match *$up* $say]} { set ma2 $up ; set go err ; set z err
if {[string match {*%u[dnpqr]d*} $vs]} { set go $d ; set z d
} elseif {[string match {*%u[dnpqr]w*} $vs]} { set go $w ; set z w
} elseif {[string match {*%u[dnpqr]m*} $vs]} { set go $m ; set z m
} elseif {[string match {*%u[dnpqr]e*} $vs]} { set go $e ; set z e }
if {$go eq "err"} { lappend ma2 *ERROR*
} elseif {$go eq "1" && $up eq "%a"} { lappend ma2 $t2(${vg}83)
} elseif {$go eq "1"} { lappend ma2 $t2(${vg}86)
} elseif {$go eq "0" && $up eq "%a"} { lappend ma2 $t2(${vg}82)
} elseif {$go eq "0"} { lappend ma2 $t2(${vg}85)
} else {
if {$up eq "%a"} { lappend ma2 $t2(${vg}81) } else { lappend ma2 $t2(${vg}84) }
if {$z eq "d"} { foreach {n3 p q r g} $d { break }
lappend ma6 %und $n3 %upd $p %uqd $q %urd $r %udd $g
} elseif {$z eq "w"} { foreach {n3 p q r g} $w { break }
lappend ma6 %unw $n3 %upw $p %uqw $q %urw $r %udw $g
} elseif {$z eq "m"} { foreach {n3 p q r g} $m { break }
lappend ma6 %unm $n3 %upm $p %uqm $q %urm $r %udm $g
} elseif {$z eq "e"} { foreach {n3 p q r g} $e { break }
lappend ma6 %une $n3 %upe $p %uqe $q %ure $r %ude $g
}
}
set newtx "" ; foreach txln $say { lappend newtx [string map $ma2 $txln] }
set say $newtx
}
}
}
foreach txln $say { set txln [string map $ma6 [string map $map $txln]]
if {$txln ne "" && $txln ne " "} { putserv "$pre$txln" }
}
}
}
set cnt 0 ; set nxt ""
}
lappend nxt $n $x $y ; incr cnt
}
}
}
}
}
array unset t2 _* ; return 0
}
if {$t2(_cm) eq "j"} {
if {![info exists t2(-jls)]} { array set t2 {-jcnt 0 -jflud 0 -wasjflud 0 -jls ""} }
bind join - "$t2(chan) *" TJoin
if {$t2(greet)>"0"} {
if {$t2(g-xnick) ne ""} { set t2(g-xnick) " [join $t2(g-xnick)] " }
set t2(g-same) [expr {$t2(g-same)*60}]
if {$t2(greet)>"2"} { set t2(G11) "" ; set t2(G31) "" }
if {![info exists t2(-gls)]} { array set t2 {-gls "" -lastgnk "" -lastgut 0} }
}
if {$t2(voice)=="1" || $t2(voice)=="3"} {
if {$t2(v-xnick) ne ""} { set t2(v-xnick) " [join $t2(v-xnick)] " }
set t2(v-same) [expr {$t2(v-same)*60}]
if {![info exists t2(-vls)]} { array set t2 {-vls "" -lastvnk "" -lastvut 0} }
}
if {$t2(autostart)>"0"} {
if {$t2(a-xnick) ne ""} { set t2(a-xnick) " [join $t2(a-xnick)] " }
set t2(a-same) [expr {$t2(a-same)*60}]
if {$t2(autostart)>"1" && $t2(A01) eq ""} { set t2(autostart) 1 }
if {$t2(autostart)=="1"} { unset t2(A01) t2(A11) }
if {![info exists t2(-aoff)]} { array set t2 {-aoff 0 -als "" -lastank "" -lastaut 0} }
}
proc TJoin {nk uh hn ch} { global t2 botnick ; set addg 0 ; set addv 0 ; set adda 0 ; set len [string length $nk]
if {$nk eq $botnick || ($t2(greet)=="0" && $t2(voice)=="0" && $t2(autostart)=="0")} { return 0 }
if {$t2(greet)>"0"} { set xmpt 0
if {[string match -nocase "* $nk *" $t2(g-xnick)]} { set xmpt 1 }
if {$t2(g-xflag) ne "" && $hn ne "*"} { foreach {ng nc} $t2(g-xflag) { break }
set flgs [split [chattr $hn $ch] |] ; foreach {hg hc} $flgs { break }
if {$ng ne "-" && $ng ne ""} {
if {$ng eq "*" && $hg ne "-"} { set xmpt 1
} else { set patrn *\[$ng\]*
if {[string match $patrn $hg]} { set xmpt 1 }
}
}
if {$xmpt=="0" && $nc ne "-" && $nc ne ""} {
if {$nc eq "*" && $hc ne "-"} { set xmpt 1
} else { set patrn *\[$nc\]*
if {[string match $patrn $hc]} { set xmpt 1 }
}
}
}
if {$xmpt=="0"} { set addg 1 }
}
if {[botisop $ch] && ($t2(voice)=="1" || $t2(voice)=="3")} { set xmpt 0
if {[string match -nocase "* $nk *" $t2(v-xnick)]} { set xmpt 1 }
if {$xmpt=="0" && $t2(v-xflag) ne "" && $hn ne "*"} { foreach {ng nc} $t2(v-xflag) { break }
set flgs [split [chattr $hn $ch] |] ; foreach {hg hc} $flgs { break }
if {$ng ne "-" && $ng ne ""} {
if {$ng eq "*" && $hg ne "-"} { set xmpt 1
} else { set patrn *\[$ng\]*
if {[string match $patrn $hg]} { set xmpt 1 }
}
}
if {$xmpt=="0" && $nc ne "-" && $nc ne ""} {
if {$nc eq "*" && $hc ne "-"} { set xmpt 1
} else { set patrn *\[$nc\]*
if {[string match $patrn $hc]} { set xmpt 1 }
}
}
}
if {$xmpt=="0" && [TCheckV $nk] ne "0"} { set addv 1 }
}
if {$t2(autostart)>"0"} { set xmpt 0
if {[string match -nocase "* $nk *" $t2(a-xnick)]} { set xmpt 1 }
if {$xmpt=="0" && $t2(a-xflag) ne "" && $hn ne "*"} { foreach {ng nc} $t2(a-xflag) { break }
set flgs [split [chattr $hn $ch] |] ; foreach {hg hc} $flgs { break }
if {$ng ne "-" && $ng ne ""} {
if {$ng eq "*" && $hg ne "-"} { set xmpt 1
} else { set patrn *\[$ng\]*
if {[string match $patrn $hg]} { set xmpt 1 }
}
}
if {$xmpt=="0" && $nc ne "-" && $nc ne ""} {
if {$nc eq "*" && $hc ne "-"} { set xmpt 1
} else { set patrn *\[$nc\]*
if {[string match $patrn $hc]} { set xmpt 1 }
}
}
}
if {$xmpt=="0"} { set adda 1 }
}
if {$addg=="0" && $addv=="0" && $adda=="0"} { return 0 }
if {$adda>"0" && $addg=="0" && $addv=="0" && $t2(-ison)=="0" && $t2(-aoff)=="1"} {
if {$t2(-jcnt)==$t2(jflud)} { set t2(-jflud) 1 ; set t2(-wasjflud) 1 }
incr t2(-jcnt)
}
if {$adda>"0"} { set y " [join $t2(-als)] "
if {[set z [string first " [TStrLo $nk] " [TStrLo $y]]]>"-1"} {
set t2(-als) [split [string trim [string replace $y $z [expr {$z+$len}]]]]
}
lappend t2(-als) $nk
if {$addg=="0" && $t2(autostart)>"1"} {
if {$addv=="0" || ($addv=="1" && $t2(v-how)=="0")} {
if {$t2(-jcnt)==$t2(jflud)} { set t2(-jflud) 1 ; set t2(-wasjflud) 1 }
incr t2(-jcnt)
}
}
}
if {$addg>"0"} { set y " [join $t2(-gls)] "
if {[set z [string first " [TStrLo $nk] " [TStrLo $y]]]>"-1"} {
set t2(-gls) [split [string trim [string replace $y $z [expr {$z+$len}]]]]
}
lappend t2(-gls) $nk
if {$t2(-jcnt)==$t2(jflud)} { set t2(-jflud) 1 ; set t2(-wasjflud) 1 }
incr t2(-jcnt)
}
if {$addv>"0"} { set y " [join $t2(-vls)] "
if {[set z [string first " [TStrLo $nk] " [TStrLo $y]]]>"-1"} {
set t2(-vls) [split [string trim [string replace $y $z [expr {$z+$len}]]]]
}
lappend t2(-vls) $nk
if {[info exists t2(-sayvls)]} { set y " [join $t2(-sayvls)] "
if {[set z [string first " [TStrLo $nk] " [TStrLo $y]]]>"-1"} {
set t2(-sayvls) [split [string trim [string replace $y $z [expr {$z+$len}]]]]
}
if {$t2(-sayvls) eq ""} { unset t2(-sayvls) }
}
if {$t2(v-how)>"0"} {
if {$t2(-jcnt)==$t2(jflud)} { set t2(-jflud) 1 ; set t2(-wasjflud) 1 }
incr t2(-jcnt)
}
}
set y " [join $t2(-jls)] "
if {[set z [string first " [TStrLo $nk] " [TStrLo $y]]]>"-1"} {
set t2(-jls) [split [string trim [string replace $y $z [expr {$z+$len}]]]]
}
lappend t2(-jls) $nk
if {![info exists t2(-jqtimr)]} { set t2(-jqtimr) [utimer 6 [list TSndJmsg]] }
if {![info exists t2(-jtimer)]} { set t2(-jtimer) [utimer $t2(jftime) [list TZroJcnt]] }
}
proc TZroJcnt {} { global t2
if {$t2(greet)=="0" && $t2(voice)=="0" && $t2(autostart)=="0"} { return 0 }
if {$t2(-jcnt)>$t2(jflud)} { set t2(-wasjflud) 1 } else { set t2(-wasjflud) 0 }
set t2(-jcnt) 0
if {$t2(-wasjflud)=="0"} { unset t2(-jtimer)
if {$t2(-jls) eq ""} {
if {$t2(-wasjflud)=="0"} { set t2(-jflud) 0 }
}
return 0
}
set t2(-jtimer) [utimer $t2(jftime) [list TZroJcnt]]
}
proc TSndJmsg {} { global t2 botnick tclr ; set ch $t2(chan)
if {$t2(greet)=="0" && [info exists t2(-gls)]} { unset t2(-gls) }
if {($t2(voice)=="0" || $t2(voice)=="2") && [info exists t2(-vls)]} { unset t2(-vls) }
if {$t2(autostart)=="0" && [info exists t2(-als)]} { unset t2(-als) }
if {$t2(greet)=="0" && ($t2(voice)=="0" || $t2(voice)=="2") && $t2(autostart)=="0"} { return 0 }
if {$t2(greet)>"0" && $t2(-lastgnk) ne ""} {
if {[unixtime]>[expr {$t2(-lastgut)+$t2(g-same)}]} { set t2(-lastgnk) "" ; set t2(-lastgut) 0 }
}
if {($t2(voice)=="1" || $t2(voice)=="3") && $t2(-lastvnk) ne ""} {
if {[unixtime]>[expr {$t2(-lastvut)+$t2(v-same)}]} { set t2(-lastvnk) "" ; set t2(-lastvut) 0 }
}
if {$t2(autostart)>"0" && $t2(-lastank) ne ""} {
if {[unixtime]>[expr {$t2(-lastaut)+$t2(a-same)}]} { set t2(-lastank) "" ; set t2(-lastaut) 0 }
}
set newjls ""
foreach nk $t2(-jls) {
if {[onchan $nk $ch]} { lappend newjls $nk
} else { set len [string length $nk]
if {$t2(greet)>"0" && $t2(-gls) ne ""} { set y " [join $t2(-gls)] "
if {[set z [string first " [TStrLo $nk] " [TStrLo $y]]]>"-1"} {
set t2(-gls) [split [string trim [string replace $y $z [expr {$z+$len}]]]]
}
}
if {$t2(voice)=="1" || $t2(voice)=="3"} {
if {$t2(-vls) ne ""} { set y " [join $t2(-vls)] "
if {[set z [string first " [TStrLo $nk] " [TStrLo $y]]]>"-1"} {
set t2(-vls) [split [string trim [string replace $y $z [expr {$z+$len}]]]]
}
}
if {[info exists t2(-sayvls)]} { set y " [join $t2(-sayvls)] "
if {[set z [string first " [TStrLo $nk] " [TStrLo $y]]]>"-1"} {
set t2(-sayvls) [split [string trim [string replace $y $z [expr {$z+$len}]]]]
}
if {$t2(-sayvls) eq ""} { unset t2(-sayvls) }
}
}
if {$t2(autostart)>"0" && $t2(-als) ne ""} { set y " [join $t2(-als)] "
if {[set z [string first " [TStrLo $nk] " [TStrLo $y]]]>"-1"} {
set t2(-als) [split [string trim [string replace $y $z [expr {$z+$len}]]]]
}
}
}
}
set t2(-jls) $newjls
if {$t2(-jls) ne ""} { set idx -1 ; set got 0 ; set voice 0 ; set greet 0 ; set start 0 ; set putcnt 0
foreach nk $t2(-jls) { incr idx ; set len [string length $nk]
if {$t2(greet)>"0" && $t2(-gls) ne ""} { set y " [join $t2(-gls)] "
if {[set z [string first " [TStrLo $nk] " [TStrLo $y]]]>"-1"} {
set t2(-gls) [split [string trim [string replace $y $z [expr {$z+$len}]]]]
if {[TStrLo $nk] ne $t2(-lastgnk)} { incr got ; set greet 1 }
}
}
if {$got>"0" && ($t2(voice)=="1" || $t2(voice)=="3") && $t2(-vls) ne ""} { set y " [join $t2(-vls)] "
if {[set z [string first " [TStrLo $nk] " [TStrLo $y]]]>"-1"} {
if {[botisop $ch]} {
if {$t2(v-how)=="0" || [TStrLo $nk] eq $t2(-lastvnk)} {
set t2(-vls) [split [string trim [string replace $y $z [expr {$z+$len}]]]]
if {![isvoice $nk $ch]} {
if {[isop $nk $ch] && ($t2(v-op)=="0" || $t2(v-op)=="2")} {
} else { set voice 1 }
}
} else { incr got ; set voice 3 }
} else { set t2(-vls) "" }
}
}
if {$got>"0"} {
} elseif {[info exists t2(-sayvls)]} { set y " [join $t2(-sayvls)] "
if {[set z [string first " [TStrLo $nk] " [TStrLo $y]]]>"-1"} { incr got ; set voice 2
set t2(-sayvls) [split [string trim [string replace $y $z [expr {$z+$len}]]]]
}
if {$t2(-sayvls) eq ""} { unset t2(-sayvls) }
} elseif {($t2(voice)=="1" || $t2(voice)=="3") && $t2(-vls) ne ""} { set y " [join $t2(-vls)] "
if {[set z [string first " [TStrLo $nk] " [TStrLo $y]]]>"-1"} {
if {[botisop $ch]} {
set t2(-vls) [split [string trim [string replace $y $z [expr {$z+$len}]]]]
if {![isvoice $nk $ch]} {
if {[isop $nk $ch] && ($t2(v-op)=="0" || $t2(v-op)=="2")} {
} elseif {[TStrLo $nk] eq $t2(-lastvnk)} { incr got ; set voice 1
} else { incr got
if {$t2(v-how)>"0"} { set voice 3 } else { set voice 1 }
}
}
} else { set t2(-vls) "" }
}
}
if {$t2(autostart)>"0" && $t2(-als) ne ""} { set y " [join $t2(-als)] "
if {[set z [string first " [TStrLo $nk] " [TStrLo $y]]]>"-1"} {
set t2(-als) [split [string trim [string replace $y $z [expr {$z+$len}]]]]
if {[TStrLo $nk] ne $t2(-lastank)} { set start 1 }
}
}
if {$got>"0"} { break }
}
if {$got=="0"} { set t2(-jls) ""
} else { set dovls "" ; set sayvls "" ; set saygls ""
if {$idx>"0"} { set t2(-jls) [lrange $t2(-jls) $idx end] }
if {$got=="1" || $voice<"2"} { set t2(-jls) [lreplace $t2(-jls) 0 0] }
if {$greet>"0"} { lappend saygls $nk
if {$t2(-jflud)>"0" && $t2(-gls) ne ""} { set saygls $t2(-gls)
set t2(-gls) "" ; set saygls [linsert $saygls 0 $nk]
}
}
if {($saygls eq "" && $voice>"0") || $voice=="1"} {
if {$voice=="1" || $voice=="3"} { set newvls "" ; lappend dovls $nk
if {$t2(-vls) ne "" && $t2(v-max)>"1" && ($t2(v-mhow)=="1" || $t2(-jflud)>"0")} {
foreach n2 $t2(-vls) { set rem 0
if {[isvoice $n2 $ch]} { set rem 1
} elseif {[isop $n2 $ch] && ($t2(v-op)=="0" || $t2(v-op)=="2")} { set rem 1
} elseif {[llength $dovls]<$t2(v-max)} { lappend dovls $n2 ; set rem 2
} else { lappend newvls $n2 }
}
set t2(-vls) $newvls
if {$voice=="3"} {
if {$t2(v-msg)=="1" || $t2(-jflud)>"0"} { set sayvls $dovls
} else { lappend sayvls $nk
if {[llength $dovls]>"1"} { set t2(-sayvls) [lrange $dovls 1 end] }
}
}
} else {
if {$voice=="3"} { lappend sayvls $nk }
}
} else { lappend sayvls $nk
if {$t2(-jflud)>"0" && [info exists t2(-sayvls)]} {
set sayvls $t2(-sayvls) ; unset t2(-sayvls) ; set sayvls [linsert $sayvls 0 $nk] }
}
}
if {$sayvls ne "" || $saygls ne ""} { set tmp "" ; set how 2
set map [list %b $botnick %c $ch]
if {$sayvls ne ""} { set t2(-lastvnk) [TStrLo [lindex $sayvls end]] ; set t2(-lastvut) [unixtime]
set sayls $sayvls ; set sayopt $t2(v-how) ; set saying 1
if {$dovls ne ""} { set x "+" ; incr putcnt
foreach z $dovls { append x v }
putserv "MODE $ch $x [join $dovls]" ; set dunvls $dovls ; set dovls ""
}
set num 0 ; set wen 0
foreach n2 $sayls { set tls [TCheckV $n2]
if {$tls eq "0"} { continue }
foreach {x y} $tls { break }
if {$num<"3"} {
if {$x=="3"} {
if {$num=="0" || $num=="2"} { incr num }
} else {
if {$num<"2"} { incr num 2 }
}
}
if {$wen<"3"} {
if {$y=="1"} {
if {$wen=="0" || $wen=="2"} { incr wen }
} else {
if {$wen<"2"} { incr wen 2 }
}
}
if {$num=="3" && $wen=="3"} { break }
}
if {$num=="0"} {
if {$t2(v-top10)>"0"} { set num 2 ; set wen $t2(v-top10) }
if {$num=="2" && $wen=="3"} {
} elseif {$t2(v-top3)>"0"} {
if {$num=="2"} {
if {$wen=="2" && ($t2(v-top3)=="1" || $t2(v-top3)=="3")} { set num 3 ; set wen 3
} elseif {$wen=="1" && $t2(v-top3)>"2"} { set num 3 ; set wen 3 }
} else { set num 1 ; set wen $t2(v-top3) }
}
if {$num=="3"} { set x 3$t2(V91)10 ; lappend map %x $x %y $x
} elseif {$num=="2"} { lappend map %x 10 %y 10 } else { lappend map %x 3 %y 3 }
if {$wen=="3"} { set x $t2(V92)$t2(V91)$t2(V93) ; lappend map %w $x %z $x
} elseif {$wen=="2"} { lappend map %w $t2(V93) %z $t2(V93)
} else { lappend map %w $t2(V92) %z $t2(V92) }
} else {
if {$num=="3"} { set x 3$t2(V91)10 ; lappend map %x 10 %y $x
} elseif {$num=="2"} { lappend map %x 10 %y 10 } else { lappend map %x 3 %y 3 }
if {$wen=="3"} { set x $t2(V92)$t2(V91)$t2(V93) ; lappend map %w $t2(V93) %z $x
} elseif {$wen=="2"} { lappend map %w $t2(V93) %z $t2(V93)
} else { lappend map %w $t2(V92) %z $t2(V92) }
}
lappend map %1 $tclr(-vo1) %2 $tclr(-vo2) %3 $tclr(-vo3) %4 $tclr(-vo4)
if {[llength $sayls]>"1"} { set saytx $t2(V02)
} elseif {$sayopt>"2"} { set saytx $t2(V01)
} else { set saytx $t2(V11) }
} else { set t2(-lastgnk) [TStrLo [lindex $saygls end]] ; set t2(-lastgut) [unixtime]
lappend map %1 $tclr(-gr1) %2 $tclr(-gr2) %3 $tclr(-gstat) %4 $tclr(-gsta2) %5 $tclr(-gsta3)
set sayls $saygls ; set sayopt $t2(greet) ; set saying 2
if {[llength $sayls]>"1"} { set saytx $t2(G02)
} else {
if {$sayopt>"2"} { set kno $t2(G21) ; set unk $t2(G01)
} else { set kno $t2(G31) ; set unk $t2(G11) }
set g 0
if {$kno ne ""} {
if {[set tkno [TKnown $nk 4]] && [string match {*%[pqr]e*} $kno]} { set g 1
} elseif {$tkno=="1" && [string match *%e* $kno]} { set g 1
} elseif {$tkno=="1" && [string match *%a* $kno] && [string match {*%u[dnpqr]e*} $t2(G81)]} { set g 1
} elseif {$tkno=="1" && [string match *%h* $kno] && [string match {*%u[dnpqr]e*} $t2(G84)]} { set g 1
} elseif {[set tkno [TKnown $nk 3]] && [string match {*%[pqr]m*} $kno]} { set g 1
} elseif {$tkno=="1" && [string match *%m* $kno]} { set g 1
} elseif {$tkno=="1" && [string match *%a* $kno] && [string match {*%u[dnpqr]m*} $t2(G81)]} { set g 1
} elseif {$tkno=="1" && [string match *%h* $kno] && [string match {*%u[dnpqr]m*} $t2(G84)]} { set g 1
} elseif {[set tkno [TKnown $nk 2]] && [string match {*%[pqr]w*} $kno]} { set g 1
} elseif {$tkno=="1" && [string match *%w* $kno]} { set g 1
} elseif {$tkno=="1" && [string match *%a* $kno] && [string match {*%u[dnpqr]w*} $t2(G81)]} { set g 1
} elseif {$tkno=="1" && [string match *%h* $kno] && [string match {*%u[dnpqr]w*} $t2(G84)]} { set g 1
} elseif {[set tkno [TKnown $nk 1]] && [string match {*%[pqr]d*} $kno]} { set g 1
} elseif {$tkno=="1" && [string match *%d* $kno]} { set g 1
} elseif {$tkno=="1" && [string match *%a* $kno] && [string match {*%u[dnpqr]d*} $t2(G81)]} { set g 1
} elseif {$tkno=="1" && [string match *%h* $kno] && [string match {*%u[dnpqr]d*} $t2(G84)]} { set g 1 }
}
if {$g=="1"} { set ma4 ""
if {[string match *%d* $kno]} {
if {[TKnown $nk 1]} { lappend ma4 %d $t2(G91) } else { lappend ma4 %d $t2(G92) }
}
if {[string match *%w* $kno]} {
if {[TKnown $nk 2]} { lappend ma4 %w $t2(G93) } else { lappend ma4 %w $t2(G94) }
}
if {[string match *%m* $kno]} {
if {[TKnown $nk 3]} { lappend ma4 %m $t2(G95) } else { lappend ma4 %m $t2(G96) }
}
if {[string match *%e* $kno]} {
if {[TKnown $nk 4]} { lappend ma4 %e $t2(G97) } else { lappend ma4 %e $t2(G98) }
}
if {$ma4 ne ""} { set newtx ""
foreach txln $kno { lappend newtx [string map $ma4 $txln] }
set kno $newtx
}
set saytx $kno
} else { set saytx $unk }
}
}
if {$saytx ne ""} { lappend map %n [join $sayls]
if {[llength $sayls]>"1" && $sayopt=="1"} { set putpre "PRIVMSG $ch :"
} elseif {[llength $sayls]>"1" && $sayopt=="2"} { set putpre "NOTICE $ch :"
} elseif {$sayopt=="1"} { set putpre "PRIVMSG $nk :" ; set how 1
} elseif {$sayopt=="2"} { set putpre "NOTICE $nk :" ; set how 1
} elseif {$sayopt=="4"} { set putpre "NOTICE $ch :"
} else { set putpre "PRIVMSG $ch :" }
if {[string match {*%[pqr][demw]*} $saytx]} {
set st [TGetStat $nk]
foreach {d w m e} $st { break } ; set p 0 ; set q 0 ; set r 0
if {$d ne "0"} { foreach {p q r} $d { break } }
lappend map %pd $p %qd $q %rd $r ; set p 0 ; set q 0 ; set r 0
if {$w ne "0"} { foreach {p q r} $w { break } }
lappend map %pw $p %qw $q %rw $r ; set p 0 ; set q 0 ; set r 0
if {$m ne "0"} { foreach {p q r} $m { break } }
lappend map %pm $p %qm $q %rm $r ; set p 0 ; set q 0 ; set r 0
if {$e ne "0"} { foreach {p q r} $e { break } }
lappend map %pe $p %qe $q %re $r
}
if {[string match {*%[ah]*} $saytx]} { set st [TGetNxUp $nk]
foreach {d w m e} $st { break }
foreach {up u2} {%a 81 %h 84} {
if {$saying=="1"} { set x $t2(V$u2) ; set vg V } else { set x $t2(G$u2) ; set vg G }
if {[string match *$up* $saytx]} { set ma2 $up ; set y err ; set z err
if {[string match {*%u[dnpqr]d*} $x]} { set y $d ; set z d
} elseif {[string match {*%u[dnpqr]w*} $x]} { set y $w ; set z w
} elseif {[string match {*%u[dnpqr]m*} $x]} { set y $m ; set z m
} elseif {[string match {*%u[dnpqr]e*} $x]} { set y $e ; set z e }
if {$y eq "err"} { lappend ma2 *ERROR*
} elseif {$y eq "1" && $up eq "%a"} { lappend ma2 $t2(${vg}83)
} elseif {$y eq "1"} { lappend ma2 $t2(${vg}86)
} elseif {$y eq "0" && $up eq "%a"} { lappend ma2 $t2(${vg}82)
} elseif {$y eq "0"} { lappend ma2 $t2(${vg}85)
} else {
if {$up eq "%a"} { lappend ma2 $t2(${vg}81) } else { lappend ma2 $t2(${vg}84) }
if {$z eq "d"} { foreach {n p q r g} $d { break }
lappend map %und $n %upd $p %uqd $q %urd $r %udd $g
} elseif {$z eq "w"} { foreach {n p q r g} $w { break }
lappend map %unw $n %upw $p %uqw $q %urw $r %udw $g
} elseif {$z eq "m"} { foreach {n p q r g} $m { break }
lappend map %unm $n %upm $p %uqm $q %urm $r %udm $g
} elseif {$z eq "e"} { foreach {n p q r g} $e { break }
lappend map %une $n %upe $p %uqe $q %ure $r %ude $g
}
}
set newtx ""
foreach txln $saytx { lappend newtx [string map $ma2 $txln] }
set saytx $newtx
}
}
}
}
}
if {$dovls ne ""} { set dunvls $dovls }
}
if {$t2(autostart)>"0"} {
if {$start=="0" && $t2(-als) ne ""} { set y " [join $t2(-als)] "
if {$saygls ne "" && [llength $saygls]>"1"} {
foreach z [lrange $saygls 1 end] { set z [TStrLo $z]
if {$z ne $t2(-lastank) && [string first " $z " [TStrLo $y]]>"-1"} { set start 1 ; break }
}
}
if {$start=="0" && [info exists dunvls] && [llength $dunvls]>"1"} {
foreach z [lrange $dunvls 1 end] { set z [TStrLo $z]
if {$z ne $t2(-lastank) && [string first " $z " [TStrLo $y]]>"-1"} { set start 1 ; break }
}
}
if {$start=="0" && $sayvls ne "" && [llength $sayvls]>"1"} {
foreach z [lrange $dunvls 1 end] { set z [TStrLo $z]
if {$z ne $t2(-lastank) && [string first " $z " [TStrLo $y]]>"-1"} { set start 1 ; break }
}
}
} elseif {$start=="1"} { set z [TStrLo $nk] }
}
if {[info exists saytx] && $saytx ne ""} {
if {$saying=="2" && [string match *%x* $saytx]} { set ma4 %x ; set newtx ""
if {$t2(-ison)=="1"} { lappend ma4 $t2(G78) } else { lappend ma4 $t2(G79) }
foreach txln $saytx { lappend newtx [string map $ma4 $txln] }
set saytx $newtx
}
if {$saying=="2" && [string match *%o* $saytx]} { set ma4 %o
if {$t2(-ison)=="1"} { lappend ma4 $t2(G71)
} elseif {$t2(autostart)>"0" && $start=="1" && $t2(-aoff)=="1"} { lappend ma4 $t2(G74)
} elseif {$t2(oflag) eq "-" || $t2(oflag) eq "-|-"} { lappend ma4 $t2(G72)
} else { set can 0
foreach n2 $sayls {
if {[set h2 [nick2hand $n2 $ch]] ne "" && $h2 ne "*"} {
if {[matchattr $h2 $t2(oflag) $ch]} { set can 1 ; break }
}
}
if {$can=="1"} { lappend ma4 $t2(G72) } else { lappend ma4 $t2(G73) }
}
set newtx ""
foreach txln $saytx { lappend newtx [string map $ma4 $txln] }
set saytx $newtx
}
if {[string match {*%t[fhoq]*} $saytx]} {
lappend map %to $t2(on) %tf $t2(off) %th $t2(hint)
if {[string match *%tq* $saytx]} {
if {$t2(usrqes) eq "0"} { lappend map %tq N/A } else { lappend map %tq $t2(upubq) }
}
}
foreach txln $saytx { set txln [string map $map $txln]
if {$txln ne "" && $txln ne " "} { putserv "$putpre$txln" ; incr putcnt }
}
}
if {[info exists dovls] && $dovls ne ""} { set x "+" ; incr putcnt
foreach y $dovls { append x v } ; putserv "MODE $ch $x [join $dovls]"
}
if {$t2(autostart)>"0" && $start=="1"} {
if {$got<"2"} {
if {$t2(-ison)=="0" && $t2(-aoff)=="1"} { set t2(-aoff) 0 ; set adelay $t2(a-delay)
if {$putcnt>"0"} { incr adelay $putcnt }
set t2(-lastank) $z ; set t2(-lastaut) [unixtime]
TOnOff $botnick autostart $adelay $t2(chan) 1 5
if {$t2(autostart)>"1"} { set map [list %b $botnick %c $ch %x $t2(a-delay)]
lappend map %1 $tclr(-as1) %2 $tclr(-as2)
if {$t2(autostart)=="3"} { set putpre "NOTICE $ch :"
} else { set putpre "PRIVMSG $ch :" }
foreach txln $t2(A01) { set txln [string map $map $txln]
if {$txln ne "" && $txln ne " "} { putserv "$putpre$txln" }
}
}
}
} else { set t2(-als) [linsert $t2(-als) 0 $nk] ; set start 0 }
}
}
if {$t2(-jls) ne ""} { set ok 0
if {$t2(greet)>"0" && $t2(-gls) ne ""} { set ok 1
} elseif {($t2(voice)=="1" || $t2(voice)=="3") && $t2(-vls) ne ""} { set ok 1
} elseif {[info exists t2(-sayvls)]} { set ok 1 }
if {$ok=="0"} { set t2(-jls) "" }
}
if {$t2(-jls) ne ""} { set newj ""
foreach n2 $t2(-jls) { set ok 0
if {$t2(greet)>"0" && $t2(-gls) ne ""} { set y " [join $t2(-gls)] "
if {[set z [string first " [TStrLo $n2] " [TStrLo $y]]]>"-1"} { set ok 1 }
}
if {$t2(voice)=="1" || $t2(voice)=="3"} {
if {$ok=="0" && $t2(-vls) ne ""} { set y " [join $t2(-vls)] "
if {[set z [string first " [TStrLo $n2] " [TStrLo $y]]]>"-1"} { set ok 1 }
}
}
if {$ok=="0" && [info exists t2(-sayvls)]} { set y " [join $t2(-sayvls)] "
if {[set z [string first " [TStrLo $n2] " [TStrLo $y]]]>"-1"} { set ok 1 }
}
if {$ok=="1"} { lappend newj $n2 }
}
set t2(-jls) $newj
}
if {$t2(autostart)>"0" && $t2(-als) ne "" && $t2(-jls) ne ""} { set newa "" ; set y " [join $t2(-jls)] "
foreach n2 $t2(-als) {
if {[string first " [TStrLo $n2] " [TStrLo $y]]>"-1"} { lappend newa $n2 }
}
set t2(-als) $newa
}
if {$t2(-jls) eq ""} { unset t2(-jqtimr)
if {$t2(-wasjflud)=="0"} { set t2(-jflud) 0 }
if {$t2(greet)>"0"} { set t2(-gls) "" }
if {$t2(voice)=="1" || $t2(voice)=="3"} { set t2(-vls) "" }
if {[info exists t2(-sayvls)]} { unset t2(-sayvls) }
if {$t2(autostart)>"0"} { set t2(-als) "" }
} else { set t2(-jqtimr) [utimer $t2(jqtime) [list TSndJmsg]] }
}
array unset t2 _* ; return 0
}
if {$t2(_cm) eq "h"} { set t2(_event) "" ; set t2(_evls) ""
set t2(_dals) "" ; set t2(_wels) "" ; set t2(_mols) "" ; set t2(_other) ""
set t2(_op) [open $t2(sfpath)t2.hist] ; set t2(_new) [open $t2(sfpath)t2.hst.tmp w]
set t2(_ln) [gets $t2(_op)] ; puts $t2(_new) [string replace $t2(_ln) 2 2 N2]
set t2(_ln) [gets $t2(_op)] ; set t2(_info) [open $t2(sfpath)t2.hist.info w]
puts $t2(_info) [string range $t2(_ln) 4 end] ; close $t2(_info)
while {![eof $t2(_op)]} { set t2(_ln) [gets $t2(_op)]
if {$t2(_event) ne "" && ![string match :N:* $t2(_ln)]} {
if {[string match ::D:* $t2(_event)]} {
set t2(_dals) [linsert $t2(_dals) 0 $t2(_event) $t2(_evls)]
} elseif {[string match ::W:* $t2(_event)]} {
set t2(_wels) [linsert $t2(_wels) 0 $t2(_event) $t2(_evls)]
} else { set t2(_mols) [linsert $t2(_mols) 0 $t2(_event) $t2(_evls)] }
set t2(_event) "" ; set t2(_evls) ""
}
if {[string match {::[DWM]:*} $t2(_ln)]} { set t2(_event) $t2(_ln)
} elseif {[string match :N:* $t2(_ln)]} { lappend t2(_evls) $t2(_ln)
} elseif {$t2(_ln) ne ""} { set t2(_other) [linsert $t2(_other) 0 $t2(_ln)] }
}
close $t2(_op)
foreach {t2(_y) t2(_z)} {_dals _da2 _wels _we2 _mols _mo2} {
if {[llength $t2($t2(_y))]>"14"} { set t2($t2(_z)) [lrange $t2($t2(_y)) 14 end]
set t2($t2(_y)) [lrange $t2($t2(_y)) 0 13] }
}
foreach t2(_x) {_dals _wels _mols _da2 _we2 _mo2} {
if {[info exists t2($t2(_x))] && $t2($t2(_x)) ne ""} {
foreach {t2(_y) t2(_z)} $t2($t2(_x)) { puts $t2(_new) $t2(_y)
if {$t2(_z) ne ""} {
foreach t2(_plar) $t2(_z) { puts $t2(_new) $t2(_plar) }
}
}
}
if {$t2(_x) eq "_mols"} { puts $t2(_new) "::X: Extra History:" }
}
if {$t2(_other) ne ""} {
foreach t2(_y) $t2(_other) { puts $t2(_new) $t2(_y) }
}
close $t2(_new) ; file delete $t2(sfpath)t2.hist
file rename -force $t2(sfpath)t2.hst.tmp $t2(sfpath)t2.hist ; file delete $t2(sfpath)t2.hst.tmp
array unset t2 _* ; return 0
}
if {$t2(_cm) eq "m"} {
if {$t2(_td)=="0"} { set t2(_nm) "" ; set t2(_wt) "" ; TCntQes 1
set t2(_tx) [TStrLo [string trim $t2(_tx)]]
if {$t2(_tx)==""} { set t2(_nm) 4
} else { set t2(_tx) [split $t2(_tx)]
foreach t2(_tm) $t2(_tx) {
if {[TStrDig $t2(_tm)]} {
if {$t2(_nm)!="+"} { set t2(_tm) [string trimleft $t2(_tm) 0]
if {$t2(_tm)=="" || $t2(_tm)>"9"} { set t2(_nm) 4 } else { set t2(_nm) $t2(_tm) }
}
} else { set t2(_fr) [string index $t2(_tm) 0] ; set t2(_ls) [string index $t2(_tm) end]
if {$t2(_fr)=="+" || $t2(_ls)=="+"} { set t2(_nm) "+"
} elseif {[TStrDig $t2(_fr)] || [TStrDig $t2(_ls)]} {
if {$t2(_nm)!="+"} {
if {[TStrDig $t2(_fr)] && $t2(_fr)>"0"} { set t2(_nm) $t2(_fr)
} elseif {[TStrDig $t2(_ls)] && $t2(_ls)>"0"} { set t2(_nm) $t2(_ls)
} else { set t2(_nm) 4 }
}
}
set t2(_tm) [string trim $t2(_tm) "+1234567890"]
if {$t2(_tm)!=""} {
if {[string match q* $t2(_tm)]} { set t2(_wt) q
} elseif {[string match k* $t2(_tm)]} { set t2(_wt) k }
}
}
}
if {$t2(_nm)==""} { set t2(_nm) 4 }
}
set t2(_tx) $t2(_nm) ; set t2(_td) "" ; set t2(_er) 0
if {$t2(_qfl)!="" && $t2(_wt)!="k"} {
if {$t2(-qtotal)>"3499"} { lappend t2(_td) ques } else { incr t2(_er) }
}
if {$t2(_kfl)!="" && $t2(_wt)!="q"} {
if {$t2(-ktotal)>"99"} { lappend t2(_td) kaos } else { incr t2(_er) 2 }
}
if {$t2(_td)==""} {
if {$t2(_wt)=="q"} { set t2(_tm) " for Questions."
} elseif {$t2(_wt)=="k"} { set t2(_tm) " for Kaos."
} else { set t2(_tm) "." }
putserv "PRIVMSG $t2(_nk) :Mix Disabled$t2(_tm) Requires a larger database."
set t2(_tm) "The .mix command currently requires a minimum of"
if {$t2(_wt)!=""} { set t2(_tm) [string replace $t2(_tm) 7 8 "x $t2(_wt) "] }
if {$t2(_wt)=="k"} { putserv "PRIVMSG $t2(_nk) :$t2(_tm) 100 kaos to function."
} elseif {$t2(_er)>"1" && $t2(_wt)==""} {
putserv "PRIVMSG $t2(_nk) :$t2(_tm) 3500 questions and/or 100 kaos to function."
} else { putserv "PRIVMSG $t2(_nk) :$t2(_tm) 3500 questions to function." }
array unset t2 _* ; return 2
} elseif {$t2(_er)=="2"} {
putserv "PRIVMSG $t2(_nk) :Mix Disabled for Koas. Requires 100+ to function."
} elseif {$t2(_er)=="1"} {
putserv "PRIVMSG $t2(_nk) :Mix Disabled for Questions. Requires 3500+ to function."
}
if {$t2(-ison)=="1"} { TOnOff $t2(_nk) $t2(_uh) $t2(_hn) $t2(chan) 0 1
putquick "PRIVMSG $t2(chan) :Game Stopped. Mixing Questions..." ; set t2(_wo) 1
}
}
incr t2(_ti)
if {[lindex $t2(_td) 0]=="ques"} { set t2(_dbl) $t2(_qfl)
if {$t2(_tx)=="+"} {
if {$t2(_ti)=="1"} { putserv "PRIVMSG $t2(_nk) :Thoroughly Mixing Questions..." }
putserv "PRIVMSG $t2(_nk) :mix+ dont work. Mixing questions 4 times..." ; set t2(_tx) 4
} else {
if {$t2(_ti)=="1"} { putserv "PRIVMSG $t2(_nk) :Mixing questions $t2(_tx) times..."
} else { putserv "PRIVMSG $t2(_nk) :Question mix #$t2(_ti)..." }
}
} else { set t2(_dbl) $t2(_kfl) ; set t2(_kcl) ""
if {$t2(-ktotal)<"3999"} {
foreach t2(_tm) $t2(_kfl) { set t2(_tm) [split [lindex [split $t2(_tm) /] end] .]
if {[llength $t2(_tm)]=="3"} { lappend t2(_kcl) 1000
} else { lappend t2(_kcl) [lindex $t2(_tm) 3] }
}
}
if {$t2(_tx)=="+"} {
if {$t2(_ti)=="1"} { putserv "PRIVMSG $t2(_nk) :Thoroughly Mixing Kaos..." }
putserv "PRIVMSG $t2(_nk) :mix+ dont work. Mixing kaos 4 times..." ; set t2(_tx) 4
} else {
if {$t2(_ti)=="1"} { putserv "PRIVMSG $t2(_nk) :Mixing kaos $t2(_tx) times..."
} else { putserv "PRIVMSG $t2(_nk) :Kaos mix #$t2(_ti)..." }
}
}
set t2(_qfc) [llength $t2(_dbl)]
if {$t2(_tx)=="+"} {
} else { set t2(_mlc) [expr {$t2(_qfc)/10}]
if {[expr {$t2(_qfc)%10}] > "0"} { incr t2(_mlc) }
set t2(_tm) 0 ; set t2(_tml) ""
while {$t2(_tm)<$t2(_mlc)} { set mlist($t2(_tm)) ""
lappend t2(_tml) $t2(_tm) ; incr t2(_tm) }
set t2(_tm) 0
while {$t2(_dbl)!=""} { set t2(_t2) [rand [llength $t2(_dbl)]]
lappend mlist($t2(_tm)) [lindex $t2(_dbl) $t2(_t2)]
set t2(_dbl) [lreplace $t2(_dbl) $t2(_t2) $t2(_t2)] ; incr t2(_tm)
if {$t2(_tm)==$t2(_mlc)} { set t2(_tm) 0 }
}
set newqfil(0) [open $t2(qfpath)qfil.tmp.0 w] ; set nqfcnt(0) 0
set newqfil(1) [open $t2(qfpath)qfil.tmp.1 w] ; set nqfcnt(1) 0
set newqfil(2) [open $t2(qfpath)qfil.tmp.2 w] ; set nqfcnt(2) 0
set newqfil(3) [open $t2(qfpath)qfil.tmp.3 w] ; set nqfcnt(3) 0
set t2(_lnf) 3 ; set t2(_pc) 0 ; set t2(_pt) 0
foreach t2(_nm) $t2(_tml) { set t2(_ofl) ""
foreach t2(_dbf) $mlist($t2(_nm)) {
if {[lindex $t2(_td) 0]=="ques"} { set t2(_tm) [lindex [split $t2(_dbf) .] end]
} else { set t2(_tm) [lindex [split [lindex [split $t2(_dbf) /] end] .] 2] }
set oldfile($t2(_tm)) [open $t2(_dbf) r] ; lappend t2(_ofl) $t2(_tm)
}
set t2(_lr) "" ; set t2(_lg) ""
while {$t2(_ofl) != ""} { set t2(_gf) [rand [llength $t2(_ofl)]]
if {[llength $t2(_ofl)]>"2" && ($t2(_gf)==$t2(_lr) || $t2(_gf)==$t2(_lg))} {
if {$t2(_gf)!=$t2(_lr)} { set t2(_lr) $t2(_gf) }
set t2(_tmi) [expr {$t2(_lg)+1}]
if {$t2(_tmi)>=[llength $t2(_ofl)]} { set t2(_tmi) 0 }
set t2(_gf) $t2(_tmi) ; set t2(_lg) $t2(_tmi)
} else { set t2(_lr) $t2(_gf) ; set t2(_lg) $t2(_gf) }
set t2(_qe) [gets $oldfile([lindex $t2(_ofl) $t2(_gf)])]
if {$t2(_qe)==""} { close $oldfile([lindex $t2(_ofl) $t2(_gf)])
file delete [lindex $mlist($t2(_nm)) $t2(_gf)]
set mlist($t2(_nm)) [lreplace $mlist($t2(_nm)) $t2(_gf) $t2(_gf)]
set t2(_ofl) [lreplace $t2(_ofl) $t2(_gf) $t2(_gf)]
} else { incr t2(_pc)
puts $newqfil($t2(_pt)) "$t2(_qe)" ; incr nqfcnt($t2(_pt))
if {[lindex $t2(_td) 0]=="kaos" && $t2(_kcl)!="" && $nqfcnt(3)<"1000"} {
if {$nqfcnt($t2(_pt))==[lindex $t2(_kcl) $t2(_pt)]} {
if {$t2(_pt)=="3"} { set t2(_pc) 0
if {$nqfcnt(0)==$nqfcnt(3)} { set t2(_pt) 0
} else { set t2(_t2) 0 ; set t2(_tc) 0
foreach t2(_t3) $t2(_kcl) {
if {$t2(_t3)<$t2(_t2)} { set t2(_pt) $t2(_tc) ; break }
set t2(_t2) $t2(_t3) ; incr t2(_tc)
}
}
} else { incr t2(_pt) ; set t2(_pc) 0 }
} elseif {$t2(_pc)=="20" || $nqfcnt($t2(_pt))>[lindex $t2(_kcl) $t2(_pt)]} {
set t2(_pc) 0
if {$t2(_pt)=="3"} { set t2(_pt) 0 } else { incr t2(_pt) }
}
} elseif {$t2(_pt)=="3"} {
if {$nqfcnt(3)=="1000"} {
if {[lindex $t2(_td) 0]=="kaos" && $t2(_kcl)!=""} { set t2(_kcl) "" }
close $newqfil(3) ; close $newqfil(2)
close $newqfil(1) ; close $newqfil(0) ; set t2(_tc) 0
while {$t2(_tc)<"4"} { incr t2(_lnf)
set newqfil($t2(_tc)) [open $t2(qfpath)qfil.tmp.$t2(_lnf) w]
set nqfcnt($t2(_tc)) 0 ; incr t2(_tc)
}
set t2(_pc) 0 ; set t2(_pt) 0
} elseif {$t2(_pc)=="20"} { set t2(_pc) 0 ; set t2(_pt) 0 }
} else {
if {$t2(_pc)=="20"} { incr t2(_pt) ; set t2(_pc) 0 }
}
}
}
}
close $newqfil(3) ; close $newqfil(2)
close $newqfil(1) ; close $newqfil(0) ; set t2(_fwq) ""
if {$nqfcnt(0)=="0"} { file delete $t2(qfpath)qfil.tmp.$t2(_lnf)
file delete $t2(qfpath)qfil.tmp.[incr t2(_lnf) -1]
file delete $t2(qfpath)qfil.tmp.[incr t2(_lnf) -1]
file delete $t2(qfpath)qfil.tmp.[incr t2(_lnf) -1]
} elseif {[lindex $t2(_td) 0]=="kaos" && $t2(_kcl)!=""} { set t2(_fwq) 4kaos
} else {
if {$nqfcnt(0)<"1000"} { lappend t2(_fwq) [expr {$t2(_lnf)-3}] }
if {$nqfcnt(1)>"0" && $nqfcnt(1)<"1000"} { lappend t2(_fwq) [expr {$t2(_lnf)-2}]
} elseif {$nqfcnt(1)=="0"} { file delete $t2(qfpath)qfil.tmp.[expr {$t2(_lnf)-2}] }
if {$nqfcnt(2)>"0" && $nqfcnt(2)<"1000"} { lappend t2(_fwq) [expr {$t2(_lnf)-1}]
} elseif {$nqfcnt(2)=="0"} { file delete $t2(qfpath)qfil.tmp.[expr {$t2(_lnf)-1}] }
if {$nqfcnt(3)>"0" && $nqfcnt(3)<"1000"} { lappend t2(_fwq) $t2(_lnf)
} elseif {$nqfcnt(3)=="0"} { file delete $t2(qfpath)qfil.tmp.$t2(_lnf) }
if {[llength $t2(_fwq)]>"1"} { set t2(_dun) 0 ; set t2(_wfo) 0
set t2(_rfo) 0 ; set t2(_nf) [lindex $t2(_fwq) 0]
while {$t2(_dun)=="0"} {
if {$t2(_wfo)=="0"} { set t2(_wfi) [open $t2(qfpath)qfil.tmp.last w]
set t2(_wc) 0 ; set t2(_wfo) 1 }
if {$t2(_rfo)=="0"} { set t2(_rfi) [open $t2(qfpath)qfil.tmp.[lindex $t2(_fwq) 0]]
set t2(_rfo) "$t2(qfpath)qfil.tmp.[lindex $t2(_fwq) 0]" }
while {![eof $t2(_rfi)]} { set t2(_rl) [gets $t2(_rfi)]
if {$t2(_rl)!=""} { puts $t2(_wfi) "$t2(_rl)" ; incr t2(_wc)
if {$t2(_wc)=="1000"} { close $t2(_wfi)
file rename $t2(qfpath)qfil.tmp.last $t2(qfpath)qfil.tmp.$t2(_nf)
set t2(_wfi) [open $t2(qfpath)qfil.tmp.last w] ; set t2(_wc) 0 ; incr t2(_nf)
}
}
}
close $t2(_rfi) ; file delete $t2(_rfo) ; set t2(_rfo) 0
set t2(_fwq) [lreplace $t2(_fwq) 0 0]
if {$t2(_fwq)==""} { close $t2(_wfi)
if {$t2(_wc)=="0"} { file delete $t2(qfpath)qfil.tmp.last
} else {
if {$t2(_wc)<"1000"} { set t2(_nf) "$t2(_wc).$t2(_nf)" }
file rename $t2(qfpath)qfil.tmp.last $t2(qfpath)qfil.tmp.$t2(_nf)
}
set t2(_dun) 1 ; break
}
}
} else {
file rename $t2(qfpath)qfil.tmp.$t2(_fwq) $t2(qfpath)qfil.tmp.$nqfcnt($t2(_fwq)).$t2(_fwq)
}
}
if {$t2(_fwq)=="4kaos"} { set t2(_tm) 0
while {$t2(_tm)<"4"} { set t2(_tn) 00$t2(_tm)
if {$nqfcnt($t2(_tm))<"1000"} { append t2(_tn) .$nqfcnt($t2(_tm)) }
file rename $t2(qfpath)qfil.tmp.$t2(_tm) $t2(qfpath)t2.kf.$t2(_tn) ; incr t2(_tm)
}
} else { set t2(_tfl) [glob -directory $dir -nocomplain qfil.tmp.*]
foreach t2(_tfi) $t2(_tfl) { set t2(_t2) [split [lindex [split $t2(_tfi) /] end] .]
set t2(_tn) [lindex $t2(_t2) end]
if {[string length $t2(_tn)]=="1"} { set t2(_tn) "00$t2(_tn)"
} elseif {[string length $t2(_tn)]=="2"} { set t2(_tn) "0$t2(_tn)" }
if {[lindex $t2(_td) 0]=="ques"} {
if {[llength $t2(_t2)]>"3"} { set t2(_tn) "qf.[lindex $t2(_t2) end-1].$t2(_tn)"
} else { set t2(_tn) "qf.$t2(_tn)" }
} else {
if {[llength $t2(_t2)]>"3"} { set t2(_tn) "kf.$t2(_tn).[lindex $t2(_t2) end-1]"
} else { set t2(_tn) "kf.$t2(_tn)" }
}
file rename $t2(_tfi) $t2(qfpath)t2.$t2(_tn)
}
}
}
array unset mlist ; array unset newqfil ; array unset nqfcnt ; array unset oldfile
if {$t2(_ti)==$t2(_tx) || $t2(_tx)=="+"} {
if {[lindex $t2(_td) 0]=="ques"} { file delete $t2(sfpath)t2.qcount
} else { file delete $t2(sfpath)t2.kcount }
if {[llength $t2(_td)]=="2"} { set t2(_td) [lindex $t2(_td) 1]
utimer 2 [list TMix $t2(_nk) $t2(_uh) $t2(_hn) $t2(_tx) 0 $t2(_wo) $t2(_td)]
} else {
TCntQes
if {$t2(_wo)=="1"} { TOnOff $t2(_nk) $t2(_uh) $t2(_hn) $t2(chan) 1 1 }
}
} else { utimer 2 [list TMix $t2(_nk) $t2(_uh) $t2(_hn) $t2(_tx) $t2(_ti) $t2(_wo) $t2(_td)] }
array unset t2 _* ; return 0
}
array unset t2 _* ; return 9