blob: 0cbd26662623d7e096633b9ddd99dd5dff1bf364 [file] [log] [blame]
MG Mud User88f12472016-06-24 23:31:02 +02001// MorgenGrauen MUDlib
2//
3// comm.c
4//
5// $Id: comm.c 8755 2014-04-26 13:13:40Z Zesstra $
6#pragma strict_types
7#pragma save_types
8#pragma range_check
9#pragma no_clone
10#pragma pedantic
11
12#include <wizlevels.h>
13#include <magier.h>
14#define NEED_PROTOTYPES
15#include <thing/properties.h>
16#include <thing/description.h>
17#include <player.h>
18#include <properties.h>
19
20
21// ###########
22//############################ ECHOALL ################################
23// ###########
24
25static int _echoall(string str)
26{
27 if (!(str=_unparsed_args()))
28 return USAGE("echoall <text>\n");
29 str=break_string(str);
30 shout(str);
31 printf(str);
32 return 1;
33}
34
35// ##########
36//############################ ECHOTO #################################
37// ##########
38
39static int _echoto(string str)
40{
41 object ob;
42 string who;
43 string msg;
44
45 if (!(str=_unparsed_args())||sscanf(str, "%s %s", who, msg) != 2)
46 return USAGE("echoto <spieler> <text>\n");
47 ob = find_player(lower_case(who));
48 if (!ob)
49 {
50 printf("echoto: Es ist kein Spieler '%s' eingeloggt.\n",who);
51 return 1;
52 }
53 msg=break_string(msg,78);
54 tell_object(ob,msg);
55 printf("%s->%s",ob->Name(WEN),msg);
56 return 1;
57}
58
59// #########
60//############################ MECHO ##################################
61// #########
62
63static int _mecho(string str) {
64 object *who;
65 int i;
66
67 if (!sizeof(str=_unparsed_args()))
68 return USAGE("mecho <text>\n");
69 who=users();
70 i=sizeof(who);
71 while(i--)if (IS_LEARNER(who[i]))
72 tell_object(who[i], break_string(str,78));
73 return 1;
74}
75
76// ########
77//############################# PING ##################################
78// ########
79
80static int _ping(string str)
81{
82 object pl;
83
84 if (!sizeof(str))
85 return USAGE("ping <spielername>\n");
86 if (!(pl=find_player(lower_case(str))))
87 return
88 _notify_fail(sprintf("ping: Spieler %s nicht gefunden.\n",
89 capitalize(str))),0;
90 tell_object(pl,sprintf("%s pingt Dich an.\a\n",capitalize(getuid())));
91 return printf("PINGGGGGGG! DAS sollte %s auf Dich aufmerksam "
92 "gemacht haben.\n",capitalize(getuid(pl))),1;
93}
94
95// ##########
96//############################ OROPAX #################################
97// ##########
98
99int _oropax(string cmdline)
100{
101 int level,old,new;
102
103 cmdline=_unparsed_args();
104 old=QueryProp(P_EARMUFFS);
105 if (!sizeof(cmdline)||cmdline=="0")
106 {
107 if (old)
108 {
109 printf("Du nimmst das Oropax aus Deinen Ohren und hoerst "
110 "wieder allen anderen zu.\n");
111 SetProp(P_EARMUFFS, 0);
112 }
113 else
114 printf("Du hast doch gar kein Oropax in den Ohren.\n");
115 return 1;
116 }
117 if (sscanf(cmdline, "%d", level) == 0 || level < 1)
118 return USAGE("oropax [<magierlevel>]\n");
119 if ((new=SetProp(P_EARMUFFS, level))==level)
120 {
121 if (new==old)
122 return printf("Du hattest Deine Oropaxmenge schon auf Magierlevel "
123 "%d angepasst.\n",level),1;
124 if (new>old)
125 return printf("Du stopfst Dir soviel Oropax in die Ohren, dass "
126 "Du nur noch %s ab\nLevel %d hoerst.\n",
127 level>=LEARNER_LVL?"Magier":"Seher",level),1;
128 return printf("Du nimmst soviel Oropax aus den Ohren, dass Du ab "
129 "sofort wieder %s ab\nLevel %d verstehst.\n",
130 level>=LEARNER_LVL?"Magier":"Seher",level),1;
131 }
132 return printf("Du stopfst und stopfst, bis Dir das Oropax wieder zur "
133 "Nase herauskommt.\nLeider musst Du damit Magier ab Level "
134 "%d weiterhin hoeren.\n",new),1;
135}
136
137// ###################
138//########################## INITIALISIERUNG #############################
139// ###################
140
141static mixed _query_localcmds()
142{
143 return
144 ({({"oropax","_oropax",0,LEARNER_LVL}),
145 ({"echoto","_echoto",0,LEARNER_LVL}),
146 ({"echoall","_echoall",0,LEARNER_LVL}),
147 ({"mecho","_mecho",0,LEARNER_LVL}),
148 ({"ping","_ping",0,LEARNER_LVL})});
149}