1 | #! perl |
1 | #! perl |
|
|
2 | |
2 | cf::register_command tell => 0, sub |
3 | cf::register_command tell => 0, sub { |
3 | { |
|
|
4 | my ($who, $args) = @_; |
4 | my ($who, $args) = @_; |
5 | my ($target, $msg) = split /\s+/, $args, 2; |
5 | my ($target, $msg) = split /\s+/, $args, 2; |
6 | |
6 | |
7 | my $name = $who->name; |
7 | my $name = $who->name; |
8 | |
8 | |
9 | if (my $other = cf::player::find $target) |
9 | if (my $other = cf::player::find $target) { |
10 | { |
10 | |
11 | if ($other->ob->{ext_ignore_tell}{$name} < time) { |
11 | $other->ob->{ext_ignore_tell}{$name} >= time |
12 | delete $other->ob->{ext_ignore_tell}{$name}; |
12 | or delete $other->ob->{ext_ignore_tell}{$name}; |
13 | } |
13 | |
14 | if ($target ne $name and !$other->ob->{ext_ignore_tell}{$name}) { |
14 | if ($target ne $name and !$other->ob->{ext_ignore_tell}{$name}) { |
15 | $who->message ("You tell $target: $msg"); |
15 | $who->message ("You tell $target: $msg"); |
16 | $other->ob->message ("$name tells you: $msg"); |
16 | $other->ob->message ("$name tells you: $msg"); |
17 | $other->ob->{ext_last_tell} = $name; |
17 | $other->ob->{ext_last_tell} = $name; |
18 | } elsif ($target eq $name) { |
18 | } elsif ($target eq $name) { |
19 | $who->message ("You are talking to yourself, you freak!", cf::NDI_UNIQUE); |
19 | $who->message ("You are talking to yourself, you freak!", cf::NDI_UNIQUE); |
20 | } else { |
20 | } else { |
21 | $who->message ($other->ob->name." ignores what you say. Give up on it.", cf::NDI_UNIQUE); |
21 | $who->message ($other->ob->name . " ignores what you say. Give up on it.", cf::NDI_UNIQUE); |
22 | } |
22 | } |
23 | } |
23 | |
24 | else |
24 | } else { |
25 | { |
|
|
26 | $who->message ("No such player or ambiguous name. Your message: ".$msg, |
25 | $who->message ("No such player or ambiguous name. Your message: $msg", cf::NDI_UNIQUE); |
27 | cf::NDI_UNIQUE); |
|
|
28 | } |
26 | } |
29 | }; |
27 | }; |
30 | |
28 | |
31 | cf::register_command reply => 0, sub |
29 | cf::register_command reply => 0, sub { |
32 | { |
|
|
33 | my ($who, $args) = @_; |
30 | my ($who, $args) = @_; |
34 | my $name = $who->name; |
31 | my $name = $who->name; |
35 | |
32 | |
36 | if (my $other = cf::player::find $who->{ext_last_tell}) |
33 | if (my $other = cf::player::find $who->{ext_last_tell}) { |
37 | { |
34 | |
38 | if ($other->ob->{ext_ignore_tell}{$name} < time) { |
35 | $other->ob->{ext_ignore_tell}{$name} >= time |
39 | delete $other->ob->{ext_ignore_tell}{$name}; |
36 | or delete $other->ob->{ext_ignore_tell}{$name}; |
40 | } |
37 | |
41 | if (!$other->ob->{ext_ignore_tell}{$name}) { |
38 | if (!$other->ob->{ext_ignore_tell}{$name}) { |
42 | $who->message ("You tell ".$other->ob->name.": $args"); |
39 | $who->message ("You tell " . $other->ob->name . ": $args"); |
43 | $other->ob->message ("$name tells you: $args"); |
40 | $other->ob->message ("$name tells you: $args"); |
44 | $who->{ext_last_tell} = $other->ob->name; |
41 | $who->{ext_last_tell} = $other->ob->name; |
45 | } else { |
42 | } else { |
46 | $who->message ($other->ob->name." ignores what you say. Give up on it.", cf::NDI_UNIQUE); |
43 | $who->message ($other->ob->name . " ignores what you say. Give up on it.", cf::NDI_UNIQUE); |
47 | } |
44 | } |
48 | } |
45 | |
49 | else |
46 | } else { |
50 | { |
|
|
51 | $who->message ("Can't reply, player left. Your message: ".$args, |
47 | $who->message ("Can't reply, player left. Your message: $args", cf::NDI_UNIQUE); |
52 | cf::NDI_UNIQUE); |
|
|
53 | } |
48 | } |
54 | }; |
49 | }; |
|
|
50 | |
|
|
51 | |