cf::register_command ignore => 0, sub { my ($who, $args) = @_; my ($target, $type, $timeout) = split /\s+/, $args, 4; my @ignored_players = split /\s+/, $who->{ignore}; if ($args eq "list") { if ((my @ignored_tell = sort keys %{$who->{ext_ignore_tell}}) + (my @ignored_shout = sort keys %{$who->{ext_ignore_shout}})) { $who->message ("Currently ignoring private messages from: ", cf::NDI_UNIQUE); $who->message (join (", ", @ignored_tell ), cf::NDI_UNIQUE); $who->message ("Currently ignoring shouts from: ", cf::NDI_UNIQUE); $who->message (join (", ", @ignored_shout ), cf::NDI_UNIQUE); $who->message ("To stop ignoring one, use unignore.", cf::NDI_UNIQUE); } else { $who->message ("Not ignoring anyone", cf::NDI_UNIQUE); } } elsif ($target ne "" && $type ne "") { if ($timeout eq "") { $timeout = 24; } my $absolute_timeout = time + ( $timeout * 3600 ); if (my $other = cf::player::find $target) { if ($type eq "tell") { $who->message ("Now ignoring private messages from ".$other->ob->name." for $timeout hours.", cf::NDI_UNIQUE); $who->{ext_ignore_tell}{$other->ob->name} = $absolute_timeout; } elsif ($type eq "shout") { $who->message ("Now ignoring shouts from ".$other->ob->name." for $timeout hours.", cf::NDI_UNIQUE); $who->{ext_ignore_shout}{$other->ob->name} = $absolute_timeout; } elsif ($type eq "all") { $who->message ("Now ignoring everything from ".$other->ob->name." for $timeout hours.", cf::NDI_UNIQUE); $who->{ext_ignore_tell}{$other->ob->name} = $absolute_timeout; $who->{ext_ignore_shout}{$other->ob->name} = $absolute_timeout; } else { $who->message ("You need to specify tell, shout or all.", cf::NDI_UNIQUE); } } else { $who->message ("No such player or ambiguous name: $target", cf::NDI_UNIQUE); } } else { $who->message ("Usage:", cf::NDI_UNIQUE); $who->message ("ignore ", cf::NDI_UNIQUE); $who->message ("will ignore a player for hours.", cf::NDI_UNIQUE); $who->message ("ignore list", cf::NDI_UNIQUE); $who->message ("will show you a list of players currently ignored.", cf::NDI_UNIQUE); } }; cf::register_command unignore => 0, sub { my ($who, $args) = @_; my ($target, $type) = split /\s+/, $args, 3; my @ignored_players = split /\s+/, $who->{ignore}; if ($args eq "") { if ($who->{ ext_ignore_tell }) { $who->message ("Currently ignoring private messages from: ", cf::NDI_UNIQUE); $who->message (join (", ", sort keys %{ $who->{ ext_ignore_tell } } ), cf::NDI_UNIQUE); $who->message ("Currently ignoring shouts from: ", cf::NDI_UNIQUE); $who->message (join (", ", sort keys %{ $who->{ ext_ignore_shout } } ), cf::NDI_UNIQUE); } else { $who->message ("Not ignoring anyone", cf::NDI_UNIQUE); } } else { if (my $other = cf::player::find $target) { if ($type eq "tell") { $who->message ("Not ignoring private messages from ".$other->ob->name." anymore.", cf::NDI_UNIQUE); delete $who->{ext_ignore_tell}{$other->ob->name}; } elsif ($type eq "shout") { $who->message ("Not ignoring shouts from ".$other->ob->name." anymore.", cf::NDI_UNIQUE); delete $who->{ext_ignore_shout}{$other->ob->name}; } elsif ($type eq "all") { $who->message ("Not ignoring anything from ".$other->ob->name." anymore.", cf::NDI_UNIQUE); delete $who->{ext_ignore_tell}{$other->ob->name}; delete $who->{ext_ignore_shout}{$other->ob->name}; } else { $who->message ("You need to specify tell, shout or all.", cf::NDI_UNIQUE); } } else { $who->message ("No such player or ambiguous name: $target", cf::NDI_UNIQUE); } } };