ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/maps/perl/tell.ext
Revision: 1.4
Committed: Sat May 6 21:05:07 2006 UTC (18 years ago) by root
Branch: MAIN
Changes since 1.3: +24 -27 lines
Log Message:
minor formatting changes

File Contents

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