summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Dessaux2014-12-07 13:33:36 +0100
committerJulien Dessaux2014-12-07 13:33:36 +0100
commitba95f067143ad3e235cdc8aecfe1fc71e3db7004 (patch)
tree4f1d7027b3b084f3139f6e6c2f1ce5e4aa73f2e7
parentImplemented TEAM election gamephase timeout and the kick system (diff)
downloadavalon-arthur-ba95f067143ad3e235cdc8aecfe1fc71e3db7004.tar.gz
avalon-arthur-ba95f067143ad3e235cdc8aecfe1fc71e3db7004.tar.bz2
avalon-arthur-ba95f067143ad3e235cdc8aecfe1fc71e3db7004.zip
Implemented UNREGISTER
-rw-r--r--Avalon.pm9
1 files changed, 8 insertions, 1 deletions
diff --git a/Avalon.pm b/Avalon.pm
index 965d554..cb87adc 100644
--- a/Avalon.pm
+++ b/Avalon.pm
@@ -186,7 +186,14 @@ sub told {
$self->start_game if $self->game_ready;
}
when ("REGISTERED") {}
- when ("UNREGISTER") {}
+ when ("UNREGISTER") {
+ return unless $av->{registered}->{$who} or $who ~~ $av->{players};
+ delete $av->{registered}->{$who};
+ $self->say( channel => $av->{config}->{'game.channel'}, body => "UNREGISTERED $who" );
+ if ($av->{gamephase} == GAMESTART or (scalar @args > 0 and $args[0] eq "now" and $who ~~ $av->{players})) {
+ $self->reset_game;
+ }
+ }
when ("UNREGISTERED") {}
when ("GAMESTART") {}
when ("ROLE") {}