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