on *:TEXT:!*:%spl.chan: {
if ($1 == !showteam) && ($findtok(%spl.teams,$2,1,32)) {
msg $iif($chan,$chan,$nick) $getfullname($2) Credits: $getcredits($2) $chr(124) Bidders: $getbidders($2) $chr(124) Players: $getplayers($2)
}
if ($chan) {
if (($1 == !withdraw) && (%spl.active == 1) && ($getbidderteam($nick) == $getcurrteam)) {
if ($getnumplayers($getcurrteam) < 8) {
msg $chan $+ %colour $+ Team must have purchased 8 players before withdrawing.
return
}
set %spl.skip $puttok(%spl.skip,0,$getteam($getcurrteam),32)
msg $chan $getfullname($getcurrteam) have withdrawn from the auction.
msg $chan $getfullname($getnext) up to nominate. Bidders: $getbidders($getcurrteam)
}
if (($1 == !nominate) && (%spl.active == 1) && ($getbidderteam($nick) == $getcurrteam)) {
if ($read(ftime.txt,s,$replace($2-,$chr(32),\))) {
if ($findtok(%spl.bought,$replace($2-,$chr(32),\),1,58)) {
msg $chan $+ %colour $+ $+ $2- has already been sold.
return
}
msg $chan $+ %colour $+ $getplayerdata($replace($gettok($read(ftime.txt,$readn),1,32),$chr(32),\))
set %spl.nominated $gettok($read(ftime.txt,$readn),1,32)
set %spl.active 2
set %spl.highbid 3000
set %spl.highbidteam $getcurrteam
msg $chan $getfullname($getbidderteam($nick)) $+ : 3000
set %spl.bids $puttok(%spl.bids,%spl.highbid,$getteam($getbidderteam($nick)),32)
.timerinitial 1 %spl.time lastten
}
else {
msg $chan $getfullname($getbidderteam($nick)) $+ : Player " $+ $2- $+ " not found.
}
}
if ((($left($right($1,-1),1) isnum) || ($left($right($1,-1),1) == +)) && (%spl.active == 2)) {
if ($isbidder($nick)) {
if (!$gettok(%spl.skip,$getteam($getbidderteam($nick)),32)) {
return
}
var %bid $processbid($right($1,-1))
if (!%bid) {
msg $chan $getfullname($getbidderteam($nick)) $+ : Invalid bid amount.
return
}
if (($right(%bid,3) != 000) && ($right(%bid,3) != 500)) {
msg $chan $getfullname($getbidderteam($nick)) $+ : Only bids that are multiples of 500 are accepted.
return
}
if (%bid > $getmaxbid($getbidderteam($nick))) {
msg $chan $getfullname($getbidderteam($nick)) $+ : Bid exceeds max bid of $getmaxbid($getbidderteam($nick)) $+ .
return
}
if (%bid < $calc(%spl.highbid + 500)) {
msg $chan $getfullname($getbidderteam($nick)) $+ : Bid must be at least 500 above %spl.highbid $+ .
return
}
set %spl.highbid %bid
set %spl.highbidteam $getbidderteam($nick)
set %spl.bids $puttok(%spl.bids,%bid,$getteam($getbidderteam($nick)),32)
msg $chan $getfullname($getbidderteam($nick)) $+ : %bid
if (%spl.10) {
lastten
}
}
}
if (($address($nick,2) == *!*@Dont.get.burned) || ($address($nick,2) == *!*@last.hope) || ($address($nick,2) == *!*@uld.be.the.one)) {
if ($1 == !showall) {
var %i 1
while (%i <= $numtok(%spl.teams,32)) {
msg $chan $getfullname($gettok(%spl.teams,%i,32)) Credits: $getcredits($gettok(%spl.teams,%i,32)) $+ $chr(124) Bidders: $getbidders($gettok(%spl.teams,%i,32)) $chr(124) Players: $getplayers($gettok(%spl.teams,%i,32))
inc %i
}
}
if (($1 == !setchan) && ($2)) {
join $2
set %spl.chan $2
msg $chan $+ %colour $+ Commands will now function only in $2 $+ .
}
if (($1 == !addcredits) && ($findtok(%spl.teams,$2,1,32)) && ($3 isnum)) {
set %spl.credits $puttok(%spl.credits,$calc($getcredits($2) + $3),$getteam($2),32)
msg $chan $+ %colour $+ $+ $3 credits added to $getfullname($2) $+ .
}
if (($1 == !addretainer) && ($findtok(%spl.teams,$2,1,32)) && ($3 isnum) && ($4-)) {
if ($read(ftime.txt,s,$replace($4-,$chr(32),\))) {
set %spl.credits $puttok(%spl.credits,$calc($getcredits($2) - $3),$getteam($2),32)
set %spl.players $puttok(%spl.players,$addtok($gettok(%spl.players,$getteam($2),32),$replace($4-,$chr(32),\),44),$getteam($2),32)
set %spl.bought %spl.bought $+ : $+ $replace($4-,$chr(32),\)
set %spl.prices %spl.prices $+ : $+ $3
set %spl.crspndteam %spl.crspndteam $+ : $+ $2
msg $chan $+ %colour $+ $+ $replace($4-,\,$chr(32)) retained by $getfullname($2) for $3 $+ .
}
else {
msg $chan $getfullname($2) $+ : Player " $+ $4- $+ " not found.
}
}
if (($1 == !settimer) && ($2 isnum)) {
set %spl.time $2
msg $chan $+ %colour $+ Initial timer changed to $2 seconds.
}
if ($1 == !undobid) {
msg $chan $+ %colour $+ The highest bid has been forcefully retracted.
set %spl.highbid $gettok($sorttok(%spl.bids,32,nr),2,32)
set %spl.highbidteam $gettok(%spl.teams,$findtok(%spl.bids,%spl.highbid,1,32),32)
msg $chan $getfullname(%spl.highbidteam) $+ : %spl.highbid
}
if (($1 == !pause) && (%spl.active >= 1)) {
turntimersoff
msg $chan $+ %colour $+ The auction has been paused.
set %spl.active 4 %spl.active
}
if (($1 == !resume) && ($gettok(%spl.active,1,32) == 4)) {
set %spl.active $gettok(%spl.active,2,32)
msg $chan $+ %colour $+ The auction has been resumed.
if (%spl.active == 2) {
.timerinitial 1 %spl.time lastten
msg $chan $getfullname(%spl.highbidteam) $+ : %spl.highbid
}
else if (%spl.active == 3) {
.timercont 1 3 nextbidding
}
}
if (($1 == !start) && (!%spl.active)) {
msg $chan $getfullname($getnext) up to nominate. Bidders: $getbidders($getcurrteam)
set %spl.active 1
}
if (($1 == !next) && (%spl.active)) {
msg $chan $+ %colour $+ Skipping to next team.
msg $chan $getfullname($getnext) up to nominate. Bidders: $getbidders($getcurrteam)
set %spl.active 1
turntimersoff
}
if ($1 == !reset) {
unset %spl.*
set %spl.teams dwo bcb sps sds tkk hah psk dfd
set %spl.credits 75000 75000 75000 75000 75000 75000 75000 75000
set %spl.bidders . . . . . . . .
set %spl.players ^ ^ ^ ^ ^ ^ ^ ^
set %spl.bids 0 0 0 0 0 0 0 0
set %spl.skip 1 1 1 1 1 1 1 1
set %spl.currbid 0
set %spl.currdir 1
set %spl.time 20
set %spl.chan $chan
turntimersoff
msg $chan $+ %colour $+ All details have been reset.
}
if ((($1 == !setcolour) || ($1 == !setcolor)) && ($2 isnum)) {
if ($len($2) == 2) {
set %colour $2
}
else {
set %colour 0 $+ $2
}
msg $chan $+ %colour $+ Text colour changed.
}
if (($1 == !addbidder) && ($findtok(%spl.teams,$2,1,32)) && ($3)) {
if ($isbidder($3)) {
msg $chan $+ %colour $+ $3 is already a bidder for $getfullname($getbidderteam($3)) $+ .
return
}
set %spl.bidders $puttok(%spl.bidders,$addtok($gettok(%spl.bidders,$getteam($2),32),$3,44),$getteam($2),32)
msg $chan $+ %colour $+ $3 added to bidders for $getfullname($2) $+ . Bidders: $getbidders($2)
}
if (($1 == !removebidder) && ($findtok(%spl.teams,$2,1,32)) && ($3) && ($3 != .)) {
if (!$findtok($gettok(%spl.bidders,$getteam($2),32),$3,1,44)) {
msg $chan $+ %colour $+ $3 is not a bidder for $getfullname($2) $+ . Bidders: $getbidders($2)
return
}
set %spl.bidders $puttok(%spl.bidders,$remtok($gettok(%spl.bidders,$getteam($2),32),$3,1,44),$getteam($2),32)
msg $chan $+ %colour $+ $3 removed from bidders for $getfullname($2) $+ . Bidders: $getbidders($2)
}
}
}
}
alias getteam {
return $findtok(%spl.teams,$1,1,32)
}
alias getfullname {
if ($1 == dwo) { return 07The Distortion World Origins $+ %colour }
if ($1 == bcb) { return 05The Black City Blazikens $+ %colour }
if ($1 == sps) { return 03The Spear Pillar Skymins $+ %colour }
if ($1 == sds) { return 06The Soul Dew Strongs $+ %colour }
if ($1 == tkk) { return 12The .Krazy Kyogres $+ %colour }
if ($1 == hah) { return 04The Hazy Ho-Ohs $+ %colour }
if ($1 == psk) { return 13The Psycho Killers $+ %colour }
if ($1 == dfd) { return 09The Defiant Durians $+ %colour }
}
alias getbidders {
return $replace($gettok(%spl.bidders,$getteam($1),32),. $+ $chr(44),$chr(32),.,$chr(32),$chr(44),$chr(32) / $chr(32))
}
alias getcredits {
return $gettok(%spl.credits,$getteam($1),32)
}
alias getplayers {
return $replace($gettok(%spl.players,$getteam($1),32),\,$chr(32),^ $+ $chr(44),$chr(32),^,$chr(32),$chr(44),$chr(32) / $chr(32))
}
alias getcurrteam {
return $gettok(%spl.teams,%spl.currbid,32)
}
alias getnext {
set %spl.currbid $calc(%spl.currbid + %spl.currdir)
if (%spl.currbid == 9) {
set %spl.currbid 8
set %spl.currdir -1
}
else if (%spl.currbid == 0) {
set %spl.currbid 1
set %spl.currdir 1
}
var %count 0
while ($gettok(%spl.skip,$getteam($getcurrteam),32) == 0) {
set %spl.currbid $calc(%spl.currbid + %spl.currdir)
if (%spl.currbid == 9) {
set %spl.currbid 8
set %spl.currdir -1
}
else if (%spl.currbid == 0) {
set %spl.currbid 1
set %spl.currdir 1
}
inc %count
if (%count == 20) {
endauction
halt
}
}
return $gettok(%spl.teams,%spl.currbid,32)
}
alias isbidder {
var %i 1
while (%i <= 10) {
if ($findtok($gettok(%spl.bidders,%i,32),$1,1,44)) {
return $true
}
inc %i
}
return $false
}
alias processbid {
; if ($left($1,1) == +) {
; var %pbid $right($1,-1)
; var %pbid $processplusbid(%pbid)
; if (%pbid == 0) {
; return 0
; }
; var %mbid %spl.highbid
; }
; else {
var %pbid 0
var %mbid $1
; }
if (%mbid isnum 1-43) {
return $iif($numtok($calc(%mbid * 1000),46) == 1,$calc(%mbid * 1000 + %pbid),0)
}
else if (%mbid isnum 1000-43000) {
return $iif($numtok(%mbid,46) == 1,$calc(%mbid + %pbid),0)
}
else if ($right(%mbid,1) == k) {
var %kbid $left(%mbid,-1)
if (%kbid isnum 1-43) {
return $iif($numtok($calc(%kbid * 1000),46) == 1,$calc(%kbid * 1000 + %pbid),0)
}
}
return 0
}
alias processplusbid {
if ($left($1,1) == +) {
return 0
}
else {
var %pbid 0
var %mbid $1
}
if (%mbid isnum 0.5-43) {
return $iif($numtok($calc(%mbid * 1000),46) == 1,$calc(%mbid * 1000 + %pbid),0)
}
else if (%mbid isnum 500-43000) {
return $iif($numtok(%mbid,46) == 1,$calc(%mbid + %pbid),0)
}
else if ($right(%mbid,1) == k) {
var %kbid $left(%mbid,-1)
if (%kbid isnum 0.5-43) {
return $iif($numtok($calc(%kbid * 1000),46) == 1,$calc(%kbid * 1000 + %pbid),0)
}
}
return 0
}
alias getbidderteam {
var %i 1
while (%i <= 10) {
if ($findtok($gettok(%spl.bidders,%i,32),$1,1,44)) {
return $gettok(%spl.teams,%i,32)
}
inc %i
}
}
alias getnumplayers {
return $calc($numtok($gettok(%spl.players,$getteam($1),32),44) - 1)
}
alias getmaxbid {
return $calc($getcredits($1) - ($iif($calc(7 - $getnumplayers($1)) >= 0,$calc(7 - $getnumplayers($1)),0) * 1000))
}
alias getplayerdata {
var %metagames BW2 DPP_Pre-Arceus ADV
var %i 1
var %data $read(ftime.txt,s,$1)
while (%i <= 6) {
if (y isin $gettok(%data,%i,58)) {
var %mplayed %mplayed $replace($gettok(%metagames,%i,32),_,$chr(32)) /
}
inc %i
}
var %mplayed $deltok(%mplayed,$numtok(%mplayed,32),32)
return $+ $replace($1,\,$chr(32)) is up for auction. Metagames: %mplayed
}
alias lastten {
.timerfive off
.timerten off
set %spl.10 1
.timerten 1 15 endbidding
.timerfive 1 10 msg %spl.chan $+ %colour $+ 5 seconds remaining.
}
alias endbidding {
msg %spl.chan $+ %colour $+ SOLD: $replace(%spl.nominated,\,$chr(32)) to $getfullname(%spl.highbidteam) for %spl.highbid $+ .
set %spl.credits $puttok(%spl.credits,$calc($getcredits(%spl.highbidteam) - %spl.highbid),$getteam(%spl.highbidteam),32)
set %spl.players $puttok(%spl.players,$addtok($gettok(%spl.players,$getteam(%spl.highbidteam),32),$replace(%spl.nominated,$chr(32),\),44),$getteam(%spl.highbidteam),32)
set %spl.active 3
set %spl.bids 0 0 0 0 0 0
unset %spl.10
set %spl.bought %spl.bought $+ : $+ %spl.nominated
set %spl.prices %spl.prices $+ : $+ %spl.highbid
set %spl.crspndteam %spl.crspndteam $+ : $+ %spl.highbidteam
if ($getcredits(%spl.highbidteam) < 1000) {
set %spl.skip $puttok(%spl.skip,0,$getteam(%spl.highbidteam),32)
}
.timercont 1 8 nextbidding
}
alias nextbidding {
var %i 1
while (%i <= $numtok(%spl.teams,32)) {
msg %spl.chan $getfullname($gettok(%spl.teams,%i,32)) Credits: $getcredits($gettok(%spl.teams,%i,32)) $+ $chr(124) Players: $getplayers($gettok(%spl.teams,%i,32))
inc %i
}
msg %spl.chan $getfullname($getnext) up to nominate. Bidders: $getbidders($getcurrteam)
set %spl.active 1
}
alias endauction {
msg %spl.chan $+ %colour $+ The auction has officially ended.
turntimersoff
outputtofile
}
alias turntimersoff {
.timercont off
.timerten off
.timerfive off
.timerinitial off
}
alias outputtofile {
write ftimerecord.txt -----
write ftimerecord.txt -----
write ftimerecord.txt -----
write ftimerecord.txt -----
write ftimerecord.txt -----
write ftimerecord.txt Log for auction that concluded at $fulldate in %spl.chan
var %i 1
var %num $numtok(%spl.bought,58)
while (%i <= %num) {
write ftimerecord.txt $replace($gettok(%spl.bought,%i,58),\,$chr(32)) $+ : $gettok(%spl.prices,%i,58) ( $+ $strip($getfullname($gettok(%spl.crspndteam,%i,58))) $+ )
inc %i
}
}