mirror of
https://github.com/pragma-/pbot.git
synced 2024-12-22 18:52:40 +01:00
Plugin/Spinach: fix subroutine signatures
This commit is contained in:
parent
1cb6a114b8
commit
7d3cd3f215
@ -1345,8 +1345,8 @@ sub create_states($self) {
|
||||
$self->{states}{'gameover'}{trans}{next} = 'getplayers';
|
||||
}
|
||||
|
||||
sub commify($self) {
|
||||
my $text = reverse $_[0];
|
||||
sub commify($self, $value) {
|
||||
my $text = reverse $value;
|
||||
$text =~ s/(\d\d\d)(?=\d)(?!\d*\.)/$1,/g;
|
||||
return scalar reverse $text;
|
||||
}
|
||||
@ -1662,7 +1662,7 @@ sub getnewquestion($self, $state) {
|
||||
}
|
||||
}
|
||||
|
||||
sub showquestion($self, $state, $show_category) {
|
||||
sub showquestion($self, $state, $show_category = undef) {
|
||||
return if $state->{reroll_category};
|
||||
|
||||
if (exists $state->{current_question}) {
|
||||
|
@ -28,34 +28,34 @@ sub initialize($self, %conf) {
|
||||
$self->{stats} = PBot::Plugin::Spinach::Stats->new(pbot => $self->{pbot}, filename => $self->{filename});
|
||||
}
|
||||
|
||||
sub sort_generic($self, $key) {
|
||||
sub sort_generic($self, $key, @rest) {
|
||||
if ($self->{rank_direction} eq '+') { return $b->{$key} <=> $a->{$key}; }
|
||||
else { return $a->{$key} <=> $b->{$key}; }
|
||||
}
|
||||
|
||||
sub print_generic($self, $key, $player) {
|
||||
sub print_generic($self, $key, $player, @rest) {
|
||||
return undef if $player->{games_played} == 0;
|
||||
return "$player->{nick}: $player->{$key}";
|
||||
}
|
||||
|
||||
sub print_avg_score($self, $player) {
|
||||
sub print_avg_score($self, $player, @rest) {
|
||||
return undef if $player->{games_played} == 0;
|
||||
my $result = int $player->{avg_score};
|
||||
return "$player->{nick}: $result";
|
||||
}
|
||||
|
||||
sub sort_bad_lies($self) {
|
||||
sub sort_bad_lies($self, @rest) {
|
||||
if ($self->{rank_direction} eq '+') { return $b->{questions_played} - $b->{good_lies} <=> $a->{questions_played} - $a->{good_lies}; }
|
||||
else { return $a->{questions_played} - $a->{good_lies} <=> $b->{questions_played} - $b->{good_lies}; }
|
||||
}
|
||||
|
||||
sub print_bad_lies($self, $player) {
|
||||
sub print_bad_lies($self, $player, @rest) {
|
||||
return undef if $player->{games_played} == 0;
|
||||
my $result = $player->{questions_played} - $player->{good_lies};
|
||||
return "$player->{nick}: $result";
|
||||
}
|
||||
|
||||
sub sort_mentions($self) {
|
||||
sub sort_mentions($self, @rest) {
|
||||
if ($self->{rank_direction} eq '+') {
|
||||
return $b->{games_played} - $b->{times_first} - $b->{times_second} - $b->{times_third} <=> $a->{games_played} - $a->{times_first} - $a->{times_second} -
|
||||
$a->{times_third};
|
||||
@ -65,13 +65,13 @@ sub sort_mentions($self) {
|
||||
}
|
||||
}
|
||||
|
||||
sub print_mentions($self, $player) {
|
||||
sub print_mentions($self, $player, @rest) {
|
||||
return undef if $player->{games_played} == 0;
|
||||
my $result = $player->{games_played} - $player->{times_first} - $player->{times_second} - $player->{times_third};
|
||||
return "$player->{nick}: $result";
|
||||
}
|
||||
|
||||
sub sort_expr($self) {
|
||||
sub sort_expr($self, @rest) {
|
||||
my $result = eval {
|
||||
my $result_a = $self->{expr}->val(
|
||||
{
|
||||
@ -123,7 +123,7 @@ sub sort_expr($self) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
sub print_expr($self, $player) {
|
||||
sub print_expr($self, $player, @rest) {
|
||||
return undef if $player->{games_played} == 0;
|
||||
|
||||
my $result = eval {
|
||||
@ -155,7 +155,7 @@ sub print_expr($self, $player) {
|
||||
return "$player->{nick}: $result";
|
||||
}
|
||||
|
||||
sub rank($self, $arguments) {
|
||||
sub rank($self, $arguments, @rest) {
|
||||
my %ranks = (
|
||||
highscore => {
|
||||
sort => sub { $self->sort_generic('high_score', @_) },
|
||||
|
@ -75,7 +75,7 @@ sub add_player($self, $id, $nick, $channel) {
|
||||
return $id;
|
||||
}
|
||||
|
||||
sub get_player_id($self, $nick, $channel, $dont_create_new) {
|
||||
sub get_player_id($self, $nick, $channel, $dont_create_new = undef) {
|
||||
my ($account_id) = $self->{pbot}->{messagehistory}->{database}->find_message_account_by_nick($nick);
|
||||
$account_id = $self->{pbot}->{messagehistory}->{database}->get_ancestor_id($account_id);
|
||||
|
||||
|
@ -25,8 +25,8 @@ use PBot::Imports;
|
||||
# These are set by the /misc/update_version script
|
||||
use constant {
|
||||
BUILD_NAME => "PBot",
|
||||
BUILD_REVISION => 4705,
|
||||
BUILD_DATE => "2024-03-05",
|
||||
BUILD_REVISION => 4706,
|
||||
BUILD_DATE => "2024-03-06",
|
||||
};
|
||||
|
||||
sub initialize {}
|
||||
|
Loading…
Reference in New Issue
Block a user