Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package CountDown;
- use strict;
- use Storable qw/store retrieve/;
- use SpadsPluginApi;
- use Data::Dumper;
- use POSIX qw(strftime);
- use POSIX;
- use Scalar::Util qw(looks_like_number);
- no warnings 'redefine';
- my $pluginVersion='0.1';
- my $requiredSpadsVersion='0.11.2';
- my %globalPluginParams = ( helpFile => ['notNull'] );
- my %presetPluginParams = ( countDownSeconds => ['integer','integerRange']);
- sub getVersion { return $pluginVersion; }
- sub getRequiredSpadsVersion { return $requiredSpadsVersion; }
- sub getParams { return [\%globalPluginParams,\%presetPluginParams]; }
- sub new {
- my $class=shift;
- my $self = {};
- bless($self,$class);
- slog("Plugin loaded (version $pluginVersion)",3);
- return $self;
- }
- sub onUnload {
- my $self=shift;
- slog("Plugin unloaded",3);
- }
- sub beforeStart {
- my ($self,$automatic,$force)=@_;
- $automatic = 0 if (!$automatic);
- slog("beforeStart: auto = $automatic and force = $force",3);
- my $lobby=getLobbyInterface();
- # skip processing if battle is closed or spring is running
- return 1 unless(getLobbyState() > 5 && %{$lobby->{battle}} && getSpringPid() == 0);
- #fechez la vache
- my $p_conf=getPluginConf();
- my $seconds = $p_conf->{countDownSeconds};
- answer("Preparing to launch the game in $seconds seconds...");
- sleep($seconds);
- return 1;
- }
- 1;
Advertisement
Add Comment
Please, Sign In to add comment