blob: 892d8fa676fb7764a92ecc361fa0d4fcfeeeb468 [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
10#pragma pedantic
11
12inherit "/std/living/comm";
13
14#include <language.h>
15#include <living/comm.h>
16#define NEED_PROTOTYPES
17#include <thing/description.h>
18
19
20void create() {
21 add_action( "sage", "sag", 1 );
22 add_action( "echo", "echo" );
23 add_action( "emote", "emote" );
24}
25
26int echo( string str ) {
27 say( str + "\n" );
28 return 1;
29}
30
31int sage( string str ) {
32 say( break_string(str, 78, capitalize(name(WER,2))+" sagt: "));
33 return 1;
34}
35
36int emote( string str ) {
37 say( capitalize(name(WER,2))+" "+str+"\n" );
38 return 1;
39}
40
41// zum ueberschreiben - DEPRECATED! USE ReceiveMsg()!
42public void catch_msg(mixed *arr, object obj) {}
43public void catch_tell(string str) {}
44
45// by default, the msg is delivered to catch_tell() for compatibility reasons
46// and otherwise ignored.
47public varargs int ReceiveMsg(string msg, int msg_typ, string msg_action,
48 string msg_prefix, object origin)
49{
50 // compatibility...
51 if (msg_typ & MSG_DONT_WRAP)
52 catch_tell(sprintf("%s%s", msg_prefix||"", msg));
53 else
54 catch_tell(sprintf("%s%s\n", msg_prefix||"", msg));
55 return MSG_DELIVERED;
56}
57