From ba95f067143ad3e235cdc8aecfe1fc71e3db7004 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Sun, 7 Dec 2014 13:33:36 +0100 Subject: Implemented UNREGISTER --- Avalon.pm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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") {} -- cgit v1.2.3