aboutsummaryrefslogtreecommitdiff
path: root/themes
Commit message (Expand)AuthorAge
* Renamed icon filesDavid2014-09-18
* Clean-upsDavid2014-06-05
4'>14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
package Plugin::Greet;

# FIXME add configurable messages

use strict;
use warnings;

my $config;
my $root_config;

sub configure {
	my $self = shift;
	shift; # cmdref
	shift; # run_command
	$config = shift;
	$root_config = shift;

	IdaliusConfig::assert_scalar($config, $self, "chance_self");
	IdaliusConfig::assert_scalar($config, $self, "chance_other");
	die "chance_self must be from 0 to 100"
		if ($config->{chance_self} < 0 || $config->{chance_self} > 100);
	die "chance_other must be from 0 to 100"
		if ($config->{chance_other} < 0 || $config->{chance_other} > 100);

	return $self;
}

sub self_odds {
	return int(rand(100)) < $config->{chance_self};
}

sub other_odds {
	return int(rand(100)) < $config->{chance_other};