Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;
- ;; %canreply - If 1, bot can reply to .whois, .whoami, .games, .game, .info and such commands
- ;; If 0, picking ( hero/player ) is in progress. Disable info commands so it will not flood the bot
- ;; %canjoin - If 1, players can join current game, if 0 they cant
- ;; %canpickhero - Cptns can pick heroes
- ;; %canpickplayer - Cptns can pick players
- ;; %game.on - indicates if game is opened or not
- ;; %gamenum - nubmer of game
- ;; %gamelist
- ;; -----------------------------
- ;; %player.game - holds number of current game
- ;; -----------------------------
- ;; %c.gameconfirmed
- alias gameprefix {
- return BGIHL }
- alias channelname {
- return BGIHL
- }
- alias modes {
- return ap.apxl.ardm.sd.Draft.AutoDraft.Reverse.fullrandom.quickstart.cd.cm
- ;; quickstart compatibility added
- }
- alias topicwelcome {
- return 3Welcome to BG Inhouse League3
- }
- alias topicgame {
- if (%c.challenge) {
- return Sign-up for challenge is opened at the moment,
- }
- else {
- return Sign-up is opened at the moment,
- }
- }
- alias topicmode {
- return mode is %c.gamemode $+ $chr(44)
- }
- alias topichosts {
- if (%c.challenge) {
- return $getname($gettok(%c.gameauths,1,46)) and $getname($gettok(%c.gameauths,2,46)) are the captains.
- }
- else {
- return $getname($gettok(%c.gameauths,1,46)) hosts the game.
- }
- }
- alias topicgames {
- var %line = Games currently in progress:
- var %i = 1
- var %l = $numtok(%gamelist,46)
- if (!%l) { return $null }
- while (%i <= %l) {
- var %g = $gettok(%gamelist,%i,46)
- var %line = %line $get.gamename($($+(%,game.mode_,%g),2),%g)
- inc %i
- }
- return %line
- }
- alias get.gamename {
- return $gameprefix $+ $1 $+ $2
- }
- alias get.gamenamen {
- var %game = $get.gamenum($1)
- if ($hget(gamedata,%game)) { var %mode = $game(%game).mode }
- else { var %mode = $($+(%,game.mode_,%game),2) }
- return $gameprefix $+ %mode $+ %game
- }
- alias gamecheck {
- if (($numtok(%c.gameauths,46) < 10) || (!%c.gameconfirmed)) {
- set %game.on 0
- var %i = 1
- var %l = $numtok(%c.gameauths,46)
- while ( %i <= %l ) {
- var %list = %list $nauth($gettok(%c.gameauths,%i,46))
- inc %i
- }
- if ( %l > 5 ) {
- mode %ch -vvvvv $gettok(%list,1-5,32)
- mode %ch -vvvvv $gettok(%list,5-,32)
- }
- else {
- mode %ch -vvvvv $gettok(%list,1-,32)
- }
- unset %c.gameauths
- set %c.challenge 0
- set %canreply 1
- set %canpickhero 0
- set %canpickplayer 0
- describe %ch Failed to get enough players for a game. Game Aborted!
- topic %ch $topicwelcome $topicgames
- }
- }
- on $*:TEXT:/^(\.startgame|\.sg)$/i:%ch: {
- var %u = $getid2($nick)
- if ( $userlvl(%u) >= 20 ) {
- if (%game.on) { return }
- echo -ag %ch
- if (!$game.canjoin(%u)) { return }
- set %game.on 1
- if (( $2 == mode ) && ($istok($modes,$3,46))) { set %c.gamemode $11 }
- echo -ag %ch
- else { set %c.gamemode cm }
- if ( $3 == quickstart ) { set %c.gamemode cm }
- ;; quickstart compatibility added
- echo -ag %ch
- set %c.gameauths %u
- set %c.gameversion 6.69b
- set %c.gameconfirmed 0
- set %c.gameforbid $null
- set %canpickhero 0
- set %canpickplayer 0
- set %canreply 0
- set %c.pickmode 1
- set %c.challenge 0
- ;; quickstart compatibility added
- set %c.quickstartcptpick 0
- set %c.quickstartplayerpick 0
- echo -ag %ch
- mode %ch +v $nick
- echo -ag %ch
- describe %ch $channelname game starts in 450 seconds. Type .sign to enter
- echo -ag %ch
- ;; topic %ch Welcome to my ASS! Sign-up is opened at the moment, mode is %c.gamemode $+ $chr(44) $getname(%u) hosts the game.
- topic %ch $topicwelcome $topicgame $topicmode $topichosts $topicgames
- echo -ag %ch
- timergamestart 1 450 gamecheck
- echo -ag %ch
- if (!$timer(spamcensure)) { timerspamcensure 1 120 spam.censure }
- echo -ag %ch
- ;; Sign-up for challenge is open at the moment, mode is Draft, Enigma_2008 and Suspekt are the captains
- ;; Sign-up is open at the moment, mode is AutoDraft, traffic|Dark hosts the game.
- }
- }
- on $*:TEXT:/^\.(challenge\b.*|cl\b.*)/i:%ch: {
- var %u = $getid2($nick)
- if ( $userlvl(%u) >= 30 ) {
- if (%game.on) { return }
- ;echo -ag ok
- if (!$2) { return }
- ;echo -ag ok
- var %cu = $getid($2)
- if (!$game.canjoin(%u)) { return }
- ;echo -ag ok
- if (!$game.canjoin(%cu)) { return }
- ;echo -ag ok
- if (%u == %cu) { return }
- if ( $userlvl(%cu) < 30 ) { return }
- ;echo -ag ok
- if (!$nauth(%cu)) { return }
- ;echo -ag ok
- set %game.on 1
- set %c.gamemode cm
- set %c.gameauths %u $+ . $+ %cu
- set %c.gameversion 6.70c
- set %c.gameconfirmed 0
- set %c.challenge 1
- set %canpickhero 0
- set %canpickplayer 0
- set %canreply 0
- ;; quickstart compatibility added
- set %c.quickstartcptpick 0
- set %c.quickstartplayerpick 0
- unset %c.voted
- mode %ch +vv $nick $nauth(%cu)
- describe %ch $channelname challenge starts in 450 seconds. Type .sign to enter
- ;; topic %ch Welcome to my ASS! Sign-up for challenge is opened at the moment, mode is %c.gamemode $+ $chr(44) $getname(%u) and $getname(%cu) are the captains.
- topic %ch $topicwelcome $topicgame $topicmode $topichosts $topicgames
- timergamestart 1 450 gamecheck
- if (!$timer(spamcensure)) { timerspamcensure 1 120 spam.censure }
- }
- }
- on $*:TEXT:/^(\.extend|\.e)$/i:%ch: {
- if (!%game.on) { return }
- var %u = $getid2($nick)
- if (($gettok(%c.gameauths,1,46) == %u) || ((%c.challenge) && ($gettok(%c.gameauths,2,46) == %u))) {
- var %time = $timer(gamestart).secs
- if (%time < 200 ) {
- timergamestart 1 $calc( %time + 450) gamecheck
- describe %ch GameTimer has been extended to $calc( %time + 450 ) seconds
- }
- }
- elseif ( $userlvl(%u) >= $adminlvl ) {
- var %time = $timer(gamestart).secs
- if (%time < 200 ) {
- timergamestart 1 $calc( %time + 450) gamecheck
- describe %ch GameTimer has been extended to $calc( %time + 450 ) seconds
- }
- }
- }
- on $*:TEXT:/^(\.abort|\.reject)$/i:%ch: {
- var %u = $getid2($nick)
- if (($gettok(%c.gameauths,1,46) == %u) || ((%c.challenge) && ($gettok(%c.gameauths,2,46) == %u))) {
- if ((%c.challenge) && ($1 = .abort)) { return }
- if ((!%c.challenge) && ($1 = .reject)) { return }
- if ( %c.gameconfirmed ) { return }
- set %game.on 0
- timergamestart off
- unset %c.gameauths
- set %c.challenge 0
- set %canreply 1
- ;; quickstart compatibility added
- set %c.quickstartcptpick 0
- set %c.quickstartplayerpick 0
- sync.voice
- mode %ch -m
- describe %ch Game aborted!
- topic %ch $topicwelcome $topicgames
- timerextendneed off
- }
- }
- on *:TEXT:.forceabort:%ch: {
- var %u = $getid2($nick)
- if ((($gettok(%c.gameauths,1,46) == %u) || ((%c.challenge) && ($gettok(%c.gameauths,2,46) == %u))) || ($userlvl(%u) >= $adminlvl)) {
- if ((!%c.gameconfirmed) && ($userlvl(%u) < $adminlvl)) { return }
- if (!%game.on) { return }
- if (%c.gameconfirmed) {
- dec %gamenum
- if (%c.challenge) { dec %challnum }
- else { dec %regnum }
- }
- set %game.on 0
- timergamestart off
- timerheropick off
- timerheropickre off
- timercanrepick off
- timerextendneed off
- unset %c.gameauths
- set %c.challenge 0
- set %canpickhero 0
- set %canpickplayer 0
- set %canreply 1
- ;; quickstart compatibility added
- set %c.quickstartcptpick 0
- set %c.quickstartplayerpick 0
- sync.voice
- mode %ch -m
- describe %ch Game aborted!
- topic %ch $topicwelcome $topicgames
- }
- }
- alias game.canjoin {
- if ((!$user($1).ig) && (!$user($1).signed)) { return $true }
- else { return $false }
- }
- alias flush.signout {
- if (%line.signout) {
- describe %ch %line.signout $iif(!%c.challenge,$iif($calc(10 - $numtok(%c.gameauths,46)) != 0, $v1 slots remaining, $getname($gettok(%c.gameauths,1,46)) can start the game(.confirmstart)),$numtok(%c.gameauths,46) players have already signed in.)
- }
- }
- on $*:TEXT:/^(\.sign|\.s)$/i:%ch: {
- var %u = $getid2($nick)
- if ( $userlvl(%u) >= 10 ) {
- if (!%game.on) { return }
- ;echo -ag ok
- if (%c.gameconfirmed) { return }
- if (!$game.canjoin(%u)) { return }
- ;echo -ag ok
- if ((!%c.challenge) && ($istok(%c.gameforbid,%u,46))) { return }
- ;echo -ag ok
- if ((!%c.challenge) && ($numtok(%c.gameauths,46) >= 10)) { return }
- ;echo -ag ok
- set %c.gameauths $addtok(%c.gameauths,%u,46)
- if (!%c.challenge) { mode %ch +v $nick }
- if ($timer(spamsignout)) {
- set %line.signout %line.signout $getname(%u) $+ $enclose($get.exprank(%u)) signed in;
- }
- else {
- describe %ch $getname(%u) $+ $enclose($get.exprank(%u)) signed in; $iif(!%c.challenge,$iif($calc(10 - $numtok(%c.gameauths,46)) != 0, $v1 slots remaining, $getname($gettok(%c.gameauths,1,46)) can start the game(.confirmstart)),$numtok(%c.gameauths,46) players have already signed in.)
- set %line.signout $null
- timerspamsignout 1 7 flush.signout
- }
- }
- }
- on $*:TEXT:/^(\.out|\.leave)$/i:%ch: {
- var %u = $getid2($nick)
- if (!%game.on) { return }
- if (%c.gameconfirmed) { return }
- if (!$istok(%c.gameauths,%u,46)) { return }
- if (%c.challenge) {
- if ($gettok(%c.gameauths,1,46) == %u ) { return }
- if ($gettok(%c.gameauths,2,46) == %u ) { return }
- }
- set %c.gameauths $remtok(%c.gameauths,%u,1,46)
- mode %ch -v $nick
- if ($timer(spamsignout)) {
- set %line.signout %line.signout $getname(%u) $+ $enclose($get.exprank(%u)) signed out;
- }
- else {
- describe %ch $getname(%u) $+ $enclose($get.exprank(%u)) signed out; $iif(!%c.challenge,$calc(10 - $numtok(%c.gameauths,46)) slots remaining,$numtok(%c.gameauths,46) players have already signed in.)
- set %line.signout $null
- timerspamsignout 1 7 flush.signout
- }
- }
- on *:TEXT:.remove*:%ch: {
- var %u = $getid2($nick)
- var %ku = $getid($2)
- if (!%game.on) { return }
- if (%c.challenge) { return }
- if ($gettok(%c.gameauths,1,46) != %u ) { return }
- if (!$istok(%c.gameauths,%ku,46)) { return }
- if (%u = %ku) { return }
- set %c.gameauths $remtok(%c.gameauths,%ku,1,46)
- set %c.gameforbid $addtok(%c.gameforbid,%ku,46)
- mode %ch -v $nauth(%ku)
- describe %ch $getname(%ku) has been removed from the game; $calc(10 - $numtok(%c.gameauths,46)) slots remaining
- }
- on *:TEXT:.mode*:%ch: {
- if (!%game.on) { return }
- if (%c.gameconfirmed) { return }
- var %u = $getid2($nick)
- if ($istok($modes,$2,46)) {
- if ($gettok(%c.gameauths,1,46) == %u ) {
- if ((!%c.challenge) && ( $2 == quickstart )) { return }
- ;; quickstart compatibility added
- set %c.gamemode $2
- describe %ch Mode is set to $enclose($2)
- topic %ch $topicwelcome $topicgame $topicmode $topichosts $topicgames
- return
- }
- }
- describe %ch Mode is $enclose(%c.gamemode)
- }
- alias get.usernamelistrank {
- var %i = 1
- var %l = $numtok($1,46)
- var %list = $null
- while ( %i <= %l ) {
- var %list = %list $getname($gettok($1,%i,46)) $+ $enclose($get.exprank($gettok($1,%i,46))) $+ $chr(44)
- inc %i
- }
- var %list = $mid(%list,1,$calc($len(%list)-1))
- return %list
- }
- on $*:TEXT:/^(\.listplayers|\.lpl)$/i:%ch: {
- if (!%game.on) { return }
- if ($timer(listplayers)) { return }
- var %i = 1
- var %l = $numtok(%c.gameauths,46)
- while ( %i <= %l ) {
- var %list = %list $getname($gettok(%c.gameauths,%i,46)) $+ $enclose($get.exprank($gettok(%c.gameauths,%i,46))) $+ $chr(44)
- inc %i
- }
- var %list = $mid(%list,1,$calc($len(%list)-1))
- describe %ch $iif(%list,%list $iif(%c.challenge,( $+ $numtok(%c.gameauths,46) players $+ )) have already signed in.,Game is empty) $iif(!%c.challenge,$enclose($calc(10 - $numtok(%c.gameauths,46)) slots remaining))
- timerlistplayers 1 10 noop
- }
- on $*:TEXT:/^(\.listpool|\.lp)$/i:%ch: {
- if (!%game.on) { return }
- if ($timer(listpool)) { return }
- if (%canpickhero) {
- describe %ch Hero pool: $get.heroliste(%c.gameheropool)
- }
- elseif (%canpickplayer) {
- describe %ch Player pool: $get.usernamelistrank(%c.gameplayerpool)
- }
- elseif (%c.quickstartcptpick) {
- describe %ch Hero pool: $get.heroliste(%c.gameherocptpool)
- }
- elseif (%c.quickstartplayerpick) {
- echo -ag QS - playerpick
- describe %ch Player pool: $get.usernamelistqs(%c.gameplayerpool,%c.gameheroplayerpool)
- }
- timerlistpool 1 10 noop
- }
- on $*:TEXT:/^(\.listteams|\.lt)$/i:%ch: {
- if (!%game.on) { return }
- if ($timer(listteams)) { return }
- if ((!%canpickplayer) && (!%c.quickstartplayerpick)) { return }
- Describe %ch Team Sentinel: $get.usernamelist(%c.playersent)
- Describe %ch Team Scourge: $get.usernamelist(%c.playerscrg)
- timerlistteams 1 10 noop
- }
- on *:TEXT:.timeleft:%ch: {
- if (!%game.on) { return }
- if ($timer(listtimeleft)) { return }
- Describe %ch Time left for sign-ups: $timer(gamestart).secs seconds
- timerlisttimeleft 1 10 noop
- }
- on *:TEXT:.games:%ch: {
- if ((!%canreply) && ($userlvl2($nick) < 50 )) { return }
- if ($timer(listcurrentgames)) { return }
- var %line = Games currently in progress:
- var %i = 1
- var %l = $numtok(%gamelist,46)
- while (%i <= %l) {
- var %g = $gettok(%gamelist,%i,46)
- var %line = %line $get.gamename($($+(%,game.mode_,%g),2),%g) $+ $enclose($round($calc(($ctime - $($+(%,game.date_,%g),2)) / 60),0))
- inc %i
- }
- if (!%l) { var %line = %line none }
- describe %ch %line
- timerlistcurrentgames 1 10 noop
- }
- /*
- Game IHLDraft50(1/2/2008): Team Sentinel: <all4non[+54] DraKill[+56] 4urapa)[+56] tooSCARY[+57] Zhanis[+65]>
- Team Scourge: <U2SantoS[-45] Vavas wt-sk[-42] BigFatPenguinQ GadyaHrenova[-38]> Won by Sentinel
- */
- on $*:TEXT:/^\.(gamedetails\s.*|info\s.*|lastgame)/:*: {
- if ($chan) { var %target = $chan }
- else { var %target = $nick }
- if ((!$2) && ($1 == .lastgame )) { var %game = %gamenum }
- elseif (($2) && ($1 == .lastgame )) { var %u = $getid($2) | var %game = $user(%u).lastgame }
- else {
- if ( $1 != .lastgame ) {
- var %game = $get.gamenum($2)
- }
- }
- if (!%game) { return }
- if (%game > %gamenum ) { return }
- if ($hget(gamedata,%game)) {
- var %sent = $gettok($game(%game).plist,1-5,46)
- var %scrg = $gettok($game(%game).plist,6-10,46)
- if ( $game(%game).result == sentinel ) {
- var %sente = $gettok($game(%game).elist,1-5,46)
- var %scrge = $gettok($game(%game).elist,6-10,46)
- }
- elseif ( $game(%game).result == scourge ) {
- var %sente = $gettok($game(%game).aelist,1-5,46)
- var %scrge = $gettok($game(%game).aelist,6-10,46)
- }
- var %result = $game(%game).result
- var %sentl
- var %i = 1
- while ( %i <= 5 ) {
- var %sentl = %sentl $getname($gettok(%sent,%i,46)) $+ $iif(%result != draw,$enclose($iif($gettok(%sente,%i,46) >= 0, + $+ $v1,$v1)))
- inc %i
- }
- var %i = 1
- while ( %i <= 5 ) {
- var %scrgl = %scrgl $getname($gettok(%scrg,%i,46)) $+ $iif(%result != draw,$enclose($iif($gettok(%scrge,%i,46) >= 0, + $+ $v1,$v1)))
- inc %i
- }
- describe %target Game $get.gamename($game(%game).mode,%game) $+ ( $+ $asctime($game(%game).time,HH:nn:ss dd/mm/yy) $+ ) $+ :Result: %result
- describe %target Team Sentinel: < $+ %sentl $+ >
- describe %target Team Scourge: < $+ %scrgl $+ >
- }
- else {
- var %players = $($+(%,game.auths_,%game),2)
- var %mode = $($+(%,game.mode_,%game),2)
- var %date = $($+(%,game.date_,%game),2)
- if ( %date != 1 ) { var %date_s = Still in progress: $round($calc(($ctime - %date) / 60),0) minutes }
- else { var %date_s = Not started yet }
- describe %target Game $get.gamename(%mode,%game) $+ : %date_s
- describe %target Team Sentinel: < $+ $get.usernamelist($gettok(%players,1-5,46)) $+ >
- describe %target Team Scourge: < $+ $get.usernamelist($gettok(%players,6-10,46)) $+ >
- }
- }
- on *:TEXT:.teams*:*: {
- if (((!%canreply) && ($2)) && ($userlvl2($nick) < 50 )) { return }
- var %u = $getid2($nick)
- if (!$2) {
- if ($timer(listcurrentteams)) { return }
- var %game = $user(%u).gamenum
- if (!%game) { return }
- var %h = $($+(%,game.auths_,%game),2)
- Describe %ch Team Sentinel: $get.usernamelist($gettok(%h,1-5,46))
- Describe %ch Team Scourge: $get.usernamelist($gettok(%h,6-10,46))
- timerlistcurrentteams 1 10 noop
- }
- else {
- if ($2 > %gamenum) { return }
- if ($chan) { var %target = $chan }
- else { var %target = $nick }
- var %game = $get.gamenum($2)
- if (!%game) { return }
- ;echo -ag OK
- Describe %target Team Sentinel: $get.usernamelist($gettok($game(%game).plist,1-5,46))
- Describe %target Team Scourge: $get.usernamelist($gettok($game(%game).plist,6-10,46))
- }
- }
- on $*:TEXT:/\.(top|bottom).*/:*: {
- if (($1 != .top) && ($1 != .bottom)) { return }
- var %u = $getid2($nick)
- if (($timer(listtop)) && ($userlvl(%u) < 90)) { return }
- if (!$2) { var %top = 10 }
- else { var %top = $2 }
- if ((%top < 10) && (%top != 3)) { var %top = 10 }
- if (%top > $calc(%rank.users - 10)) { var %top = %rank.users }
- if ($1 == .bottom ) { var %top = %rank.users }
- if (%top != 3) {
- var %i = %top - 9
- var %l = %top
- while ( %i <= %l ) {
- var %tu = $sort.getuser(%i)
- var %topline = %topline %i $+ . $getname(%tu) $+ $enclose($user(%tu).exp) $+ $chr(44)
- inc %i
- }
- var %topline = $mid(%topline,1,$calc($len(%topline) - 1))
- describe $chan Top %top $+ : %topline
- }
- else {
- var %tu = $sort.getuser(1)
- describe $chan 1. $getname(%tu) $+ $enclose($get.exprank(%tu)) $+ ; $user(%tu).win wins $+ , $user(%tu).lost losses $+ , $user(%tu).exp experience;
- var %tu = $sort.getuser(2)
- describe $chan 2. $getname(%tu) $+ $enclose($get.exprank(%tu)) $+ ; $user(%tu).win wins $+ , $user(%tu).lost losses $+ , $user(%tu).exp experience;
- var %tu = $sort.getuser(3)
- describe $chan 3. $getname(%tu) $+ $enclose($get.exprank(%tu)) $+ ; $user(%tu).win wins $+ , $user(%tu).lost losses $+ , $user(%tu).exp experience;
- }
- timerlisttop 1 30 noop
- }
- ;####################### PICKING & GAMESTART #########################
- ;#####################################################################
- alias pick.whopick {
- if ( $1 == 1 ) { return 1 }
- elseif (( $1 == 2 ) || ( $1 == 3 )) { return 2 }
- elseif (( $1 == 4 ) || ( $1 == 5 )) { return 1 }
- elseif (( $1 == 6 ) || ( $1 == 7 )) { return 2 }
- elseif (( $1 == 8 ) || ( $1 == 9 )) { return 1 }
- elseif ( $1 == 10 ) { return 2 }
- }
- alias get.heroname {
- var %i = 1
- var %l = %heronum
- var %n = 0
- var %needle = / $+ $1- $+ .*/i
- var %list
- while ( %i <= %l ) {
- if ($regex($($+(%,hero_,%i),2),%needle)) {
- inc %n
- var %list = $addtok(%list,$($+(%,hero_,%i),2),46)
- }
- inc %i
- }
- if (%n = 1) { return %list }
- else { return %n }
- }
- alias get.gamemode {
- ;; quickstart compatibility added
- if ($istok(Draft.Reverse.ap.AutoDraft.quickstart,$1,46)) { return ap }
- elseif ( $1 == ardm ) { return ardm }
- elseif ( $1 == apxl ) { return apxl }
- elseif ( $1 == sd ) { return sd }
- elseif ( $1 == Fullrandom ) { return ar }
- }
- on $*:TEXT:/^(\.confirmstart|\.cf)$/i:%ch: {
- var %u = $getid2($nick)
- if (!%game.on) { return }
- if (%c.challenge) { return }
- if ($gettok(%c.gameauths,1,46) != %u ) { return }
- if ($numtok(%c.gameauths,46) < 10) { return }
- if (!$timer(spamcensure)) { timerspamcensure 1 200 spam.censure }
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; PROCESSING TEAMS
- echo -ag PROCESSING TEAMS
- var %i = 1
- var %j = 1
- var %max = 10000
- var %min = 1
- var %sort = %c.gameauths
- while ( %i <= 10 ) {
- while ( %j <= 10 ) {
- var %u = $gettok(%sort,%j,46)
- var %exp = $user(%u).exp
- if ((%exp >= %min) && (%exp <= %max)) { %min = %exp | var %p = %j }
- inc %j
- }
- var %max = $user($gettok(%sort,%p,46)).exp
- var %min = 1
- var %pom = $gettok(%sort,%i,46)
- var %sort = $puttok(%sort,$gettok(%sort,%p,46),%i,46)
- var %sort = $puttok(%sort,%pom,%p,46)
- echo -ag $gettok(%sort,%i,46) -- $user($gettok(%sort,%i,46)).exp
- inc %i
- %j = %i
- }
- echo -ag %c.gameauths
- echo -ag %sort
- var %i = 1
- var %seed = $r(1,2)
- var %sent
- var %scrg
- while ( %i <= 10 ) {
- if (%seed == 1) {
- if ( 2 \\ %i ) {
- var %sent = $addtok(%sent,$gettok(%sort,%i,46),46)
- }
- else {
- var %scrg = $addtok(%scrg,$gettok(%sort,%i,46),46)
- }
- }
- else {
- if ( 2 // %i ) {
- var %sent = $addtok(%sent,$gettok(%sort,%i,46),46)
- }
- else {
- var %scrg = $addtok(%scrg,$gettok(%sort,%i,46),46)
- }
- }
- inc %i
- }
- describe %ch Team Sentinel: $get.usernamelistrank(%sent)
- describe %ch Team Scourge: $get.usernamelistrank(%scrg)
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- inc %gamenum
- inc %regnum
- set %c.gameconfirmed 1
- if (!$istok(Draft.Reverse,%c.gamemode,46)) {
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; NORMAL GAME OR AUTODRAFT - NO PICKING
- echo -ag NORMAL GAME -> GIVE 'EM SOME STUPID MESSAGE
- describe %ch Game mode is - $+ $get.gamemode(%c.gamemode) $+ ; Game name is $get.gamename(%c.gamemode,%gamenum) $+ ; Map version is %c.gameversion
- set %gamelist $addtok(%gamelist,%gamenum,46)
- set %game.mode_ $+ %gamenum %c.gamemode
- set %game.version_ $+ %gamenum %c.gameversion
- set %game.date_ $+ %gamenum $ctime
- set %game.auths_ $+ %gamenum %sent $+ . $+ %scrg
- set %game.chall_ $+ %gamenum %c.challenge
- var %i = 1
- while (%i <= 10) {
- set %player.game_ $+ $gettok(%c.gameauths,%i,46) %gamenum
- inc %i
- }
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; AUTO DRAFT
- if (%c.gamemode == AutoDraft) {
- echo -ag HERO AUTODRAFT -> PICK MOST PICKED HEROES
- autodraft
- }
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- set %game.on 0
- unset %c.gameauths
- set %c.challenge 0
- set %canreply 1
- timergamestart off
- timerextendneed off
- timer1 off
- topic %ch $topicwelcome $topicgames
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- }
- else {
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; DRAFT - ENABLE PICKING
- echo -ag HERO DRAFT -> SET PICKERS AND ENABLE HERO PICKING
- set %game.mode_ $+ %gamenum %c.gamemode
- set %game.version_ $+ %gamenum %c.gameversion
- set %game.auths_ $+ %gamenum %sent $+ . $+ %scrg
- set %game.date_ $+ %gamenum 1
- set %game.chall_ $+ %gamenum %c.challenge
- set %canpickhero 1
- unset %c.herosent
- unset %c.heroscrg
- unset %c.gameheropool
- if ( $r(1,2) == 1 ) {
- set %c.picker1 $gettok(%sent,1,46)
- set %c.picker2 $gettok(%scrg,1,46)
- set %c.first sent
- }
- else {
- set %c.picker1 $gettok(%scrg,1,46)
- set %c.picker2 $gettok(%sent,1,46)
- set %c.first scrg
- }
- set %c.gameheropool
- while ( $numtok(%c.gameheropool,46) != 20 ) {
- set %c.gameheropool $addtok(%c.gameheropool,$($+(%,hero_,$r(1,90)),2),46)
- }
- var %i = 1
- while ( %i <= 20 ) {
- AddHero.pool $gettok(%c.gameheropool,%i,46)
- inc %i
- }
- mode %ch +m
- describe %ch Game mode is %c.gamemode $+ $chr(44) $+ ; Game name is $get.gamename(%c.gamemode,%gamenum) $+ ; Map version is %c.gameversion $+ ; Hero draft starts now, $getname(%c.picker1) has 90 seconds to pick a hero.
- describe %ch Heroes available: $get.heroliste(%c.gameheropool)
- timergamestart off
- timerheropick 1 90 pick.pickhero random
- timerheropickre 1 70 pick.notify
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- }
- }
- on *:TEXT:.ready:%ch: {
- var %u = $getid2($nick)
- if (!%game.on) { return }
- ;echo -ag OK
- if (!%c.challenge) { return }
- ;echo -ag OK
- if (($gettok(%c.gameauths,1,46) != %u ) && ($gettok(%c.gameauths,2,46) != %u )) { return }
- ;echo -ag OK
- if ($numtok(%c.gameauths,46) < 10) { return }
- ;echo -ag OK
- if (!$istok(%c.voted,%u,46)) {
- set %c.voted $addtok(%c.voted,%u,46)
- }
- else { return }
- if ($numtok(%c.voted,46) == 2) {
- if (!$timer(spamcensure)) { timerspamcensure 1 200 spam.censure }
- ;echo -ag OK
- inc %gamenum
- inc %challnum
- if ( $r(1,2) == 1 ) {
- set %c.picker1 $gettok(%c.gameauths,1,46)
- set %c.picker2 $gettok(%c.gameauths,2,46)
- set %c.first sent
- }
- else {
- set %c.picker1 $gettok(%c.gameauths,2,46)
- set %c.picker2 $gettok(%c.gameauths,1,46)
- set %c.first sent
- }
- set %c.gameplayerpool $gettok(%c.gameauths,3-,46)
- set %c.playersent %c.picker1
- set %c.playerscrg %c.picker2
- set %c.challpickround 1
- set %c.gameconfirmed 1
- timergamestart off
- if ( %c.gamemode == quickstart ) {
- ;;############### quickstart #################
- set %game.date_ $+ %gamenum 1
- set %c.gameheropool
- set %c.gameherocptpool
- set %c.gameheroplayerpool
- unset %c.herosent
- unset %c.heroscrg
- unset %c.repicked
- var %l = $numtok(%c.gameplayerpool,46)
- var %l = $calc(%l + 8)
- while ( $numtok(%c.gameheropool,46) != %l ) {
- set %c.gameheropool $addtok(%c.gameheropool,$($+(%,hero_,$r(1,90)),2),46)
- }
- var %i = 1
- while ( %i <= %l ) {
- AddHero.pool $gettok(%c.gameheropool,%i,46)
- inc %i
- }
- set %c.gameherocptpool $gettok(%c.gameheropool,1-8,46)
- set %c.gameheroplayerpool $gettok(%c.gameheropool,9-,46)
- set %c.quickstartcptpick 2
- set %c.quickstartplayerpick 0
- mode %ch +m
- describe %ch Sign-up closed. Captains pick heroes for themselves first, it's $getname(%c.picker1) $+ 's turn to pick.
- ;describe %ch Player pool: $get.usernamelistrank(%c.gameplayerpool)
- describe %ch Heroes available: $get.heroliste(%c.gameherocptpool)
- ;;############### quickstart #################
- }
- else {
- mode %ch +m
- set %canpickplayer 1
- describe %ch Sign-up closed. It's $getname(%c.picker1) $+ 's turn to pick.
- describe %ch Player pool: $get.usernamelistrank(%c.gameplayerpool)
- }
- }
- }
- alias autodraft {
- ; Create a pool first
- var %c.gameheropool = .
- while ( $numtok(%c.gameheropool,46) != 20 ) {
- %c.gameheropool = $addtok(%c.gameheropool,$($+(%,hero_,$r(1,90)),2),46)
- }
- ; Add heroes
- var %i = 1
- while ( %i <= 20 ) {
- AddHero.pool $gettok(%c.gameheropool,%i,46)
- inc %i
- }
- ; Sort 10 heroes based on popularity
- var %i = 1
- var %j = 1
- var %max = 10000
- var %min = 0
- var %sort = %c.gameheropool
- while ( %i <= 10 ) {
- while ( %j <= 20 ) {
- var %u = $gettok(%sort,%j,46)
- var %pop = $hero(%u).pop
- if ((%pop >= %min) && (%pop <= %max)) { %min = %pop | var %p = %j }
- inc %j
- }
- var %max = $hero($gettok(%sort,%p,46)).pop
- var %min = 1
- var %pom = $gettok(%sort,%i,46)
- var %sort = $puttok(%sort,$gettok(%sort,%p,46),%i,46)
- var %sort = $puttok(%sort,%pom,%p,46)
- var %pom = $gettok(%sort,%i,46)
- echo -ag %pom -- $hero(%pom).pop
- inc %i
- %j = %i
- }
- echo -ag %sort
- ; Create "hero" teams
- var %i = 1
- var %seed = $r(1,2)
- while ( %i <= 10 ) {
- if (%seed == 1) {
- if ( $pick.whopick(%i) == 1 ) {
- var %sent = $addtok(%sent,$gettok(%sort,%i,46),46)
- }
- else {
- var %scrg = $addtok(%scrg,$gettok(%sort,%i,46),46)
- }
- }
- else {
- if ( $pick.whopick(%i) == 2 ) {
- var %sent = $addtok(%sent,$gettok(%sort,%i,46),46)
- }
- else {
- var %scrg = $addtok(%scrg,$gettok(%sort,%i,46),46)
- }
- }
- if ( %i == 1 ) { AddHero.fp $gettok(%sort,%i,46) }
- if ( %i == 2 ) { AddHero.sp $gettok(%sort,%i,46) }
- if ( %i == 3 ) { AddHero.tp $gettok(%sort,%i,46) }
- inc %i
- }
- describe %ch Sentinel heroes: $get.herolistpop(%sent)
- describe %ch Scourge heroes: $get.herolistpop(%scrg)
- var %i = 1
- while (%i <= 10) {
- AddHero.picked $gettok(%sort,%i,46)
- inc %i
- }
- set %game.heroes_ $+ %gamenum %sent $+ . $+ %scrg
- }
- ;############################## PICKING ##############################
- ;#####################################################################
- alias pick.round {
- return $calc(21 - $numtok(%c.gameheropool,46))
- }
- alias get.heronamepool {
- if ($2) { var %herolist = $($+(%,c.gamehero,$2,pool),2) }
- else { var %herolist = %c.gameheropool }
- ;echo -ag %herolist $2
- if ($1 == prophet ) {
- if ($istok(%herolist,prophet,46)) {
- if ($istok(%herolist,death prophet,46)) {
- return prophet
- }
- }
- }
- var %i = 1
- var %l = $numtok(%herolist,46)
- var %n = 0
- var %needle = / $+ $1 $+ .*/i
- var %list
- while ( %i <= %l ) {
- if ($regex($gettok(%herolist,%i,46),%needle)) {
- inc %n
- var %list = $addtok(%list,$gettok(%herolist,%i,46),46)
- }
- inc %i
- }
- ;echo -ag %n %list
- if (%n = 1) { return %list }
- else { return %n }
- }
- alias pick.pickhero {
- if (!$1) { return }
- if ($1 != random) {
- var %hero = $get.heronamepool($1-)
- }
- else {
- var %hero = $gettok(%c.gameheropool,$r(1,$numtok(%c.gameheropool,46)),46)
- }
- if ( %hero !isnum) {
- var %who = $pick.whopick($pick.round)
- if (((%who == 1) && (%c.gamemode != reverse)) || ((%who == 2) && (%c.gamemode == reverse))) {
- if ( %c.first == sent ) {
- set %c.herosent $addtok(%c.herosent,%hero,46)
- }
- else {
- set %c.heroscrg $addtok(%c.heroscrg,%hero,46)
- }
- }
- elseif (((%who == 2) && (%c.gamemode != reverse)) || ((%who == 1) && (%c.gamemode == reverse))) {
- if ( %c.first == sent ) {
- set %c.heroscrg $addtok(%c.heroscrg,%hero,46)
- }
- else {
- set %c.herosent $addtok(%c.herosent,%hero,46)
- }
- }
- if ( $pick.round == 1 ) { AddHero.fp %hero }
- if ( $pick.round == 2 ) { AddHero.sp %hero }
- if ( $pick.round == 3 ) { AddHero.tp %hero }
- set %c.gameheropool $remtok(%c.gameheropool,%hero,1,46)
- if ( $numtok(%c.gameheropool,46) > 10 ) {
- describe %ch $getname($($+(%,c.picker,%who),2)) $iif($1 != random,picked,randomized) %hero $+ ; $getname($($+(%,c.picker,$pick.whopick($pick.round)),2)) has 90 seconds to pick a hero
- timerheropick 1 90 pick.pickhero random
- timerheropickre 1 70 pick.notify
- }
- else {
- describe %ch $getname($($+(%,c.picker,%who),2)) picked %hero $+ ;
- describe %ch Team Sentinel's heroes: $get.heroliste(%c.herosent)
- describe %ch Team Scourge's heroes: $get.heroliste(%c.heroscrg)
- describe %ch Game mode is - $+ $get.gamemode(%c.gamemode) $+ ; Game name is $get.gamename(%c.gamemode,%gamenum) $+ ; Map version is %c.gameversion $+ ; Use .teams and .heroes to get a reminder on the line-ups
- set %gamelist $addtok(%gamelist,%gamenum,46)
- set %game.date_ $+ %gamenum $ctime
- set %game.heroes_ $+ %gamenum %c.herosent $+ . $+ %c.heroscrg
- set %game.on 0
- var %i = 1
- while (%i <= 5) {
- AddHero.picked $gettok(%c.herosent,%i,46)
- AddHero.picked $gettok(%c.heroscrg,%i,46)
- inc %i
- }
- var %i = 1
- var %ga = $($+(%,game.auths_,%gamenum),2)
- while (%i <= 10) {
- set %player.game_ $+ $gettok(%ga,%i,46) %gamenum
- inc %i
- }
- unset %c.gameauths
- unset %c.herosent
- unset %c.heroscrg
- unset %c.gameheropool
- set %canpickhero 0
- set %canpickplayer 0
- set %canreply 1
- set %c.challenge 0
- timerheropick off
- timerheropickre off
- timer 1 3 topic %ch $topicwelcome $topicgames
- mode %ch -m
- if (!$timer(spamcensure)) { timerspamcensure 1 120 spam.censure }
- }
- }
- elseif ( %hero == 0 ) { notice $nick no hero | return }
- else { describe %ch Be more specific ( $+ %hero matches) }
- }
- alias get.usernamelistqs {
- var %i = 1
- var %l = $numtok($1,46)
- var %list = $null
- while ( %i <= %l ) {
- var %list = %list $getname($gettok($1,%i,46)) $+ $enclose($gettok($2,%i,46))
- inc %i
- }
- return %list
- }
- alias pick.qs.pickhero {
- if (!$1) { return }
- if ($1 != random) {
- var %hero = $get.heronamepool($1-,cpt)
- }
- else {
- var %hero = $gettok(%c.gameherocptpool,$r(1,$numtok(%c.gameherocptpool,46)),46)
- }
- if ( %hero !isnum) {
- var %who = $pick.whopick(%c.challpickround)
- if (%who == 1) {
- if ( %c.first == sent ) {
- set %c.herosent $addtok(%c.herosent,%hero,46)
- }
- else {
- set %c.heroscrg $addtok(%c.heroscrg,%hero,46)
- }
- }
- elseif (%who == 2) {
- if ( %c.first == sent ) {
- set %c.heroscrg $addtok(%c.heroscrg,%hero,46)
- }
- else {
- set %c.herosent $addtok(%c.herosent,%hero,46)
- }
- }
- if ( %c.challpickround == 1 ) { AddHero.fp %hero }
- if ( %c.challpickround == 2 ) { AddHero.sp %hero }
- set %c.gameherocptpool $remtok(%c.gameherocptpool,%hero,1,46)
- if ( $numtok(%c.gameherocptpool,46) > 6 ) {
- describe %ch $getname($($+(%,c.picker,%who),2)) picked %hero $+ ; $getname($($+(%,c.picker,$pick.whopick($calc( %c.challpickround + 1))),2)) $+ 's turn to pick
- inc %c.challpickround
- dec %c.quickstartcptpick
- }
- else {
- describe %ch $getname($($+(%,c.picker,%who),2)) picked %hero $+ ; $getname($($+(%,c.picker,$pick.whopick($calc( %c.challpickround + 1))),2)) $+ 's turn to pick
- describe %ch Player pool: $get.usernamelistqs(%c.gameplayerpool,%c.gameheroplayerpool)
- describe %ch Players now have 60 seconds to repick hero. Use .repick to get a new one
- inc %c.challpickround
- dec %c.quickstartcptpick
- timercanrepick 1 60 set %c.quickstartplayerpick 1
- }
- }
- elseif ( %hero == 0 ) { notice $nick no hero | return }
- else { describe %ch Be more specific ( $+ %hero matches) }
- }
- alias pick.notify {
- describe %ch Hurry up! 20 seconds remaining for hero choice!
- }
- alias pick.pickplayer {
- if (!$1) { return }
- var %u = $getid($1)
- if (!$istok(%c.gameplayerpool,%u,46)) { return }
- var %who = $pick.whopick(%c.challpickround)
- if (%who == 1) {
- if ( %c.first == sent ) {
- set %c.playersent $addtok(%c.playersent,%u,46)
- }
- else {
- set %c.playerscrg $addtok(%c.playerscrg,%u,46)
- }
- }
- elseif (%who == 2) {
- if ( %c.first == sent ) {
- set %c.playerscrg $addtok(%c.playerscrg,%u,46)
- }
- else {
- set %c.playersent $addtok(%c.playersent,%u,46)
- }
- }
- mode %ch +v $nauth(%u)
- set %c.gameplayerpool $remtok(%c.gameplayerpool,%u,1,46)
- if (%c.challpickround < 8 ) {
- describe %ch $getname($($+(%,c.picker,%who),2)) picked $getname(%u) $+ ; $getname($($+(%,c.picker,$pick.whopick($calc( %c.challpickround + 1))),2)) $+ 's turn to pick
- }
- else {
- if (!$istok(Draft.Reverse,%c.gamemode,46)) {
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; NORMAL GAME OR AUTODRAFT - NO PICKING
- echo -ag NORMAL GAME -> GIVE 'EM SOME STUPID MESSAGE
- describe %ch Team Sentinel: $get.usernamelist(%c.playersent)
- describe %ch Team Scourge: $get.usernamelist(%c.playerscrg)
- describe %ch Game mode is - $+ $get.gamemode(%c.gamemode) $+ ; Game name is $get.gamename(%c.gamemode,%gamenum) $+ ; Map version is %c.gameversion $+ ; Use .teams and .heroes to get a reminder on the line-ups
- set %gamelist $addtok(%gamelist,%gamenum,46)
- set %game.mode_ $+ %gamenum %c.gamemode
- set %game.version_ $+ %gamenum %c.gameversion
- set %game.date_ $+ %gamenum $ctime
- set %game.auths_ $+ %gamenum %c.playersent $+ . $+ %c.playerscrg
- set %game.chall_ $+ %gamenum %c.challenge
- var %i = 1
- var %g = $($+(%,game.auths_,%gamenum),2)
- while (%i <= 10) {
- set %player.game_ $+ $gettok(%g,%i,46) %gamenum
- inc %i
- }
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; AUTO DRAFT
- if (%c.gamemode == AutoDraft) {
- echo -ag HERO AUTODRAFT -> PICK MOST PICKED HEROES
- autodraft
- }
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- set %game.on 0
- unset %c.gameauths
- set %c.challenge 0
- set %canreply 1
- timergamestart off
- mode %ch -m
- topic %ch $topicwelcome $topicgames
- if (!$timer(spamcensure)) { timerspamcensure 1 120 spam.censure }
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- }
- else {
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; DRAFT - ENABLE PICKING
- echo -ag HERO DRAFT -> SET PICKERS AND ENABLE HERO PICKING
- set %game.mode_ $+ %gamenum %c.gamemode
- set %game.version_ $+ %gamenum %c.gameversion
- set %game.auths_ $+ %gamenum %c.playersent $+ . $+ %c.playerscrg
- set %game.date_ $+ %gamenum 1
- set %game.chall_ $+ %gamenum %c.challenge
- set %canpickhero 1
- set %canpickplayer 0
- unset %c.herosent
- unset %c.heroscrg
- if ( $r(1,2) == 1 ) {
- set %c.picker1 $gettok(%c.playersent,1,46)
- set %c.picker2 $gettok(%c.playerscrg,1,46)
- set %c.first sent
- }
- else {
- set %c.picker1 $gettok(%c.playerscrg,1,46)
- set %c.picker2 $gettok(%c.playersent,1,46)
- set %c.first scrg
- }
- set %c.gameheropool
- while ( $numtok(%c.gameheropool,46) != 20 ) {
- set %c.gameheropool $addtok(%c.gameheropool,$($+(%,hero_,$r(1,90)),2),46)
- }
- var %i = 1
- while ( %i <= 20 ) {
- AddHero.pool $gettok(%c.gameheropool,%i,46)
- inc %i
- }
- mode %ch -m
- describe %ch Team Sentinel: $get.usernamelist(%c.playersent)
- describe %ch Team Scourge: $get.usernamelist(%c.playerscrg)
- describe %ch Game mode is - $+ $get.gamemode(%c.gamemode) $+ ; Game name is $get.gamename(%c.gamemode,%gamenum) $+ ; Map version is %c.gameversion $+ ; Hero draft starts now, $getname(%c.picker1) has 90 seconds to pick a hero.
- describe %ch Heroes available: $get.heroliste(%c.gameheropool)
- timergamestart off
- timerheropick 1 90 pick.pickhero random
- timerheropickre 1 70 pick.notify
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- }
- }
- inc %c.challpickround
- }
- alias pick.qs.GetHero {
- var %n = $findtok(%c.gameplayerpool,$1,1,46)
- set %c.lastheropos %n
- return $gettok(%c.gameheroplayerpool,%n,46)
- }
- alias pick.qs.pickplayer {
- if (!$1) { return }
- var %u = $getid($1)
- var %hero = $pick.qs.GetHero(%u)
- if (!$istok(%c.gameplayerpool,%u,46)) { return }
- var %who = $pick.whopick(%c.challpickround)
- if (%who == 1) {
- if ( %c.first == sent ) {
- set %c.playersent $addtok(%c.playersent,%u,46)
- set %c.herosent $addtok(%c.herosent,%hero,46)
- }
- else {
- set %c.playerscrg $addtok(%c.playerscrg,%u,46)
- set %c.heroscrg $addtok(%c.heroscrg,%hero,46)
- }
- }
- elseif (%who == 2) {
- if ( %c.first == sent ) {
- set %c.playerscrg $addtok(%c.playerscrg,%u,46)
- set %c.heroscrg $addtok(%c.heroscrg,%hero,46)
- }
- else {
- set %c.playersent $addtok(%c.playersent,%u,46)
- set %c.herosent $addtok(%c.herosent,%hero,46)
- }
- }
- mode %ch +v $nauth(%u)
- set %c.gameplayerpool $remtok(%c.gameplayerpool,%u,1,46)
- set %c.gameheroplayerpool $deltok(%c.gameheroplayerpool,%c.lastheropos,46)
- if (%c.challpickround < 10 ) {
- describe %ch $getname($($+(%,c.picker,%who),2)) picked $getname(%u) $+ $enclose(%hero) $+ ; $getname($($+(%,c.picker,$pick.whopick($calc( %c.challpickround + 1))),2)) $+ 's turn to pick
- }
- else {
- ;describe %ch $($+(%,c.picker,%who),2) picked $getname(%u) $+ $enclose(%hero) $+ ;
- describe %ch Team Sentinel: $get.usernamelistqs(%c.playersent,%c.herosent)
- describe %ch Team Scourge: $get.usernamelistqs(%c.playerscrg,%c.heroscrg)
- describe %ch Game mode is - $+ $get.gamemode(%c.gamemode) $+ ; Game name is $get.gamename(%c.gamemode,%gamenum) $+ ; Map version is %c.gameversion $+ ; Use .teams and .heroes to get a reminder on the line-ups
- set %gamelist $addtok(%gamelist,%gamenum,46)
- set %game.date_ $+ %gamenum $ctime
- set %game.heroes_ $+ %gamenum %c.herosent $+ . $+ %c.heroscrg
- set %game.mode_ $+ %gamenum %c.gamemode
- set %game.version_ $+ %gamenum %c.gameversion
- set %game.auths_ $+ %gamenum %c.playersent $+ . $+ %c.playerscrg
- set %game.chall_ $+ %gamenum %c.challenge
- set %game.on 0
- var %i = 1
- while (%i <= 5) {
- AddHero.picked $gettok(%c.herosent,%i,46)
- AddHero.picked $gettok(%c.heroscrg,%i,46)
- inc %i
- }
- var %i = 1
- var %ga = $($+(%,game.auths_,%gamenum),2)
- while (%i <= 10) {
- set %player.game_ $+ $gettok(%ga,%i,46) %gamenum
- inc %i
- }
- unset %c.gameauths
- unset %c.herosent
- unset %c.heroscrg
- unset %c.gameheropool
- unset %c.gameherocptpool
- unset %c.gameheroplayerpool
- unset %c.repicked
- set %canpickhero 0
- set %canpickplayer 0
- set %c.quickstartcptpick 0
- set %c.quickstartplayerpick 0
- set %canreply 1
- set %c.challenge 0
- timer 1 3 topic %ch $topicwelcome $topicgames
- if (!$timer(spamcensure)) { timerspamcensure 1 120 spam.censure }
- }
- inc %c.challpickround
- }
- alias flush.repick {
- if (%line.repick) {
- describe %ch %line.repick
- }
- }
- on *:TEXT:.repick:%ch: {
- var %u = $getid2($nick)
- if (!$istok(%c.gameplayerpool,%u,46)) { return }
- if (!$timer(canrepick)) { return }
- if ($istok(%c.repicked,%u,46)) { return }
- var %l = $numtok(%c.gameheropool,46)
- var %l = $calc( %l + 1 )
- while ( $numtok(%c.gameheropool,46) != %l ) {
- set %c.gameheropool $addtok(%c.gameheropool,$($+(%,hero_,$r(1,90)),2),46)
- }
- var %n = $findtok(%c.gameplayerpool,%u,1,46)
- var %oldhero = $gettok(%c.gameheroplayerpool,%n,46)
- var %newhero = $gettok(%c.gameheropool,%l,46)
- set %c.repicked $addtok(%c.repicked,%u,46)
- set %c.gameheroplayerpool $puttok(%c.gameheroplayerpool,%newhero,%n,46)
- ;describe %ch Player $getname(%u) has repicked %oldhero into %newhero
- if ($timer(spamrepick)) {
- set %line.repick %line.repick Player $getname(%u) has repicked %oldhero into %newhero $+ ;
- }
- else {
- describe %ch Player $getname(%u) has repicked %oldhero into %newhero $+ ;
- set %line.repick $null
- timerspamrepick 1 7 flush.repick
- }
- }
- on *:TEXT:.pick*:%ch: {
- ;if ((!%canpickhero) || (!%canpickplayer)) { return }
- var %u = $getid2($nick)
- if ((%u != %c.picker1) && (%u != %c.picker2)) { return }
- if (%canpickhero) {
- if ( %u != $($+(%,c.picker,$pick.whopick($pick.round)),2)) { notice $nick It's not your turn | return }
- pick.pickhero $2-
- }
- elseif (%canpickplayer) {
- if ( %u != $($+(%,c.picker,$pick.whopick(%c.challpickround)),2)) { notice $nick It's not your turn | return }
- pick.pickplayer $2
- }
- elseif (%c.QuickStartCptPick) {
- if ( %u != $($+(%,c.picker,$pick.whopick(%c.challpickround)),2)) { notice $nick It's not your turn | return }
- echo -ag ok
- pick.qs.pickhero $2-
- }
- elseif (%c.QuickStartPlayerPick) {
- if ( %u != $($+(%,c.picker,$pick.whopick(%c.challpickround)),2)) { notice $nick It's not your turn | return }
- echo -ag ok
- pick.qs.pickplayer $2
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement