blob: 3958915e5edd7c7560bd63ec1efe38dc14b51acd [file] [log] [blame]
MG Mud User88f12472016-06-24 23:31:02 +02001// MorgenGrauen MUDlib
2//
3// npc/comm.c -- Basiskommunikation fuer NPCs
4//
5// $Id: comm.c 9358 2015-10-22 18:35:04Z Zesstra $
6#pragma strong_types
7#pragma save_types
8#pragma range_check
9#pragma no_clone
MG Mud User88f12472016-06-24 23:31:02 +020010
11inherit "/std/living/comm";
12
13#include <language.h>
14#include <living/comm.h>
15#define NEED_PROTOTYPES
16#include <thing/description.h>
17
18
19void create() {
20 add_action( "sage", "sag", 1 );
21 add_action( "echo", "echo" );
22 add_action( "emote", "emote" );
23}
24
25int echo( string str ) {
26 say( str + "\n" );
27 return 1;
28}
29
30int sage( string str ) {
31 say( break_string(str, 78, capitalize(name(WER,2))+" sagt: "));
32 return 1;
33}
34
35int emote( string str ) {
36 say( capitalize(name(WER,2))+" "+str+"\n" );
37 return 1;
38}
39
40// zum ueberschreiben - DEPRECATED! USE ReceiveMsg()!
41public void catch_msg(mixed *arr, object obj) {}
42public void catch_tell(string str) {}
43
44// by default, the msg is delivered to catch_tell() for compatibility reasons
45// and otherwise ignored.
46public varargs int ReceiveMsg(string msg, int msg_typ, string msg_action,
47 string msg_prefix, object origin)
48{
Zesstra3a261e52022-02-10 14:00:31 +010049 // etwaige Farbtags rausersetzen
50 msg = terminal_colour(msg, ([0:""]));
51
MG Mud User88f12472016-06-24 23:31:02 +020052 // compatibility...
53 if (msg_typ & MSG_DONT_WRAP)
54 catch_tell(sprintf("%s%s", msg_prefix||"", msg));
55 else
56 catch_tell(sprintf("%s%s\n", msg_prefix||"", msg));
57 return MSG_DELIVERED;
58}
59