1 | #! perl |
1 | #! perl # depends=irc |
2 | #CONVERSION: PARTIAL |
2 | #CONVERSION: PARTIAL |
3 | |
3 | |
4 | # implement a replacement for the built-in say/chat/shout/tell/reply commands |
4 | # implement a replacement for the built-in say/chat/shout/tell/reply commands |
5 | # adds ignore/unignore functionality |
5 | # adds ignore/unignore functionality |
6 | |
6 | |
… | |
… | |
783 | 0..24 |
783 | 0..24 |
784 | ) { |
784 | ) { |
785 | # if some listener teleported us somewhere else, stop right here |
785 | # if some listener teleported us somewhere else, stop right here |
786 | last unless $map->path == $pl->map->path; |
786 | last unless $map->path == $pl->map->path; |
787 | |
787 | |
788 | my $dialog = new NPC_Dialogue ob => $pl, npc => $npc; |
788 | my $dialog = new NPC_Dialogue pl => $pl->contr, npc => $npc; |
789 | my ($reply, @kw) = $dialog->tell ($msg); |
789 | my ($reply, @kw) = $dialog->tell ($msg); |
790 | |
790 | |
791 | if (defined $reply) { |
791 | if (defined $reply) { |
792 | if ($npc->type == cf::MAGIC_EAR) { |
792 | if ($npc->type == cf::MAGIC_EAR) { |
793 | if (length $reply) { |
793 | if (length $reply) { |
… | |
… | |
824 | if ($msg) { |
824 | if ($msg) { |
825 | my $name = $pl->name; |
825 | my $name = $pl->name; |
826 | my $NOW = time; |
826 | my $NOW = time; |
827 | |
827 | |
828 | cf::LOG cf::llevDebug, sprintf "QBERT [%s] %s\n", $name, $msg; |
828 | cf::LOG cf::llevDebug, sprintf "QBERT [%s] %s\n", $name, $msg; |
829 | ext::schmorp_irc::do_notice (sprintf "[%s] %s", $name, $msg); |
829 | ext::irc::do_notice (sprintf "[%s] %s", $name, $msg); |
830 | |
830 | |
831 | $_->ob->message ("$name chats: $msg", cf::NDI_BLUE) |
831 | $_->ob->message ("$name chats: $msg", cf::NDI_BLUE) |
832 | for grep { $_->ob->{ext_ignore_shout}{$name} < $NOW && $_->listening >= 10 } cf::player::list; |
832 | for grep { $_->ob->{ext_ignore_shout}{$name} < $NOW && $_->listening >= 10 } cf::player::list; |
833 | |
833 | |
834 | } else { |
834 | } else { |
… | |
… | |
846 | if ($msg) { |
846 | if ($msg) { |
847 | my $NOW = time; |
847 | my $NOW = time; |
848 | my $name = $pl->name; |
848 | my $name = $pl->name; |
849 | |
849 | |
850 | cf::LOG cf::llevDebug, sprintf "QBERT {%s} %s\n", $name, $msg; |
850 | cf::LOG cf::llevDebug, sprintf "QBERT {%s} %s\n", $name, $msg; |
851 | ext::schmorp_irc::do_notice (sprintf "\007\0034{%s} %s\n", $name, $msg); |
851 | ext::irc::do_notice (sprintf "\007\0034{%s} %s\n", $name, $msg); |
852 | |
852 | |
853 | $_->ob->message ("$name shouts: $msg", cf::NDI_RED) |
853 | $_->ob->message ("$name shouts: $msg", cf::NDI_RED) |
854 | for grep { $_->ob->{ext_ignore_shout}{$name} < $NOW && $_->listening >= 2 } cf::player::list; |
854 | for grep { $_->ob->{ext_ignore_shout}{$name} < $NOW && $_->listening >= 2 } cf::player::list; |
855 | |
855 | |
856 | } else { |
856 | } else { |
… | |
… | |
869 | my $name = $pl->name; |
869 | my $name = $pl->name; |
870 | |
870 | |
871 | if ($target =~ /irc\//) { |
871 | if ($target =~ /irc\//) { |
872 | my (undef, $nick) = split /\//, $target, 2; |
872 | my (undef, $nick) = split /\//, $target, 2; |
873 | $pl->message ("You tell $target: $args"); |
873 | $pl->message ("You tell $target: $args"); |
874 | ext::schmorp_irc::do_notice (sprintf "(%s) %s: %s\n", $name, $nick, $msg); |
874 | ext::irc::do_notice (sprintf "(%s) %s: %s\n", $name, $nick, $msg); |
875 | } elsif (my $other = cf::player::find_active $target) { |
875 | } elsif (my $other = cf::player::find_active $target) { |
876 | |
876 | |
877 | if ($msg) { |
877 | if ($msg) { |
878 | if ($target eq $name) { |
878 | if ($target eq $name) { |
879 | $pl->message ("You are talking to yourself, you freak!", cf::NDI_UNIQUE); |
879 | $pl->message ("You are talking to yourself, you freak!", cf::NDI_UNIQUE); |
… | |
… | |
905 | return if $pl->contr->invoke (cf::EVENT_PLAYER_TELL, $pl->{ext_last_tell}, $args); |
905 | return if $pl->contr->invoke (cf::EVENT_PLAYER_TELL, $pl->{ext_last_tell}, $args); |
906 | |
906 | |
907 | if ($pl->{ext_last_tell} =~ /irc\//) { |
907 | if ($pl->{ext_last_tell} =~ /irc\//) { |
908 | my (undef, $nick) = split /\//, $pl->{ext_last_tell}, 2; |
908 | my (undef, $nick) = split /\//, $pl->{ext_last_tell}, 2; |
909 | $pl->message ("You tell " . $pl->{ext_last_tell} . ": $args"); |
909 | $pl->message ("You tell " . $pl->{ext_last_tell} . ": $args"); |
910 | ext::schmorp_irc::do_notice (sprintf "(%s) %s: %s\n", $name, $nick, $args); |
910 | ext::irc::do_notice (sprintf "(%s) %s: %s\n", $name, $nick, $args); |
911 | } elsif (my $other = cf::player::find_active $pl->{ext_last_tell}) { |
911 | } elsif (my $other = cf::player::find_active $pl->{ext_last_tell}) { |
912 | |
912 | |
913 | if ($args) { |
913 | if ($args) { |
914 | $other->ob->{ext_ignore_tell}{$name} >= time |
914 | $other->ob->{ext_ignore_tell}{$name} >= time |
915 | or delete $other->ob->{ext_ignore_tell}{$name}; |
915 | or delete $other->ob->{ext_ignore_tell}{$name}; |