ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/c_chat.C
(Generate patch)

Comparing deliantra/server/server/c_chat.C (file contents):
Revision 1.1 by elmex, Sun Aug 13 17:16:03 2006 UTC vs.
Revision 1.2 by root, Tue Aug 29 05:03:55 2006 UTC

1/* 1/*
2 * static char *rcsid_c_chat_c = 2 * static char *rcsid_c_chat_c =
3 * "$Id: c_chat.C,v 1.1 2006/08/13 17:16:03 elmex Exp $"; 3 * "$Id: c_chat.C,v 1.2 2006/08/29 05:03:55 root Exp $";
4 */ 4 */
5 5
6/* 6/*
7 CrossFire, A Multiplayer game for X-windows 7 CrossFire, A Multiplayer game for X-windows
8 8
27*/ 27*/
28 28
29#include <global.h> 29#include <global.h>
30#include <loader.h> 30#include <loader.h>
31#include <sproto.h> 31#include <sproto.h>
32
33int command_say (object *op, char *params)
34{
35 char buf[MAX_BUF];
36
37 if (!params) return 0;
38 snprintf(buf, MAX_BUF-1, "%s says: %s",op->name, params);
39 new_info_map(NDI_WHITE,op->map, buf);
40 communicate(op, params);
41
42 return 0;
43}
44
45 32
46int command_me (object *op, char *params) 33int command_me (object *op, char *params)
47{ 34{
48 char buf[MAX_BUF]; 35 char buf[MAX_BUF];
49 36
93 snprintf(buf, MAX_BUF-1, "You roll %s, %s, %s, %s!", 80 snprintf(buf, MAX_BUF-1, "You roll %s, %s, %s, %s!",
94 orcknuckle[i], orcknuckle[j], orcknuckle[k], orcknuckle[l]); 81 orcknuckle[i], orcknuckle[j], orcknuckle[k], orcknuckle[l]);
95 new_draw_info(NDI_UNIQUE, 0, op, buf); 82 new_draw_info(NDI_UNIQUE, 0, op, buf);
96 new_info_map_except(NDI_UNIQUE, op->map, op, buf2); 83 new_info_map_except(NDI_UNIQUE, op->map, op, buf2);
97 return 0; 84 return 0;
98}
99
100static int command_tell_all(object *op, char *params, int pri, int color, char *desc)
101{
102 if (op->contr->no_shout == 1){
103 new_draw_info(NDI_UNIQUE, 0,op,"You are no longer allowed to shout or chat.");
104 return 1;
105 } else {
106 if (params == NULL) {
107 new_draw_info(NDI_UNIQUE, 0,op,"Shout/Chat what?");
108 return 1;
109 }
110 new_draw_info_format(NDI_UNIQUE | NDI_ALL | color, pri, NULL,
111 "%s %s: %s", op->name, desc, params);
112
113 /* Lauwenmark : Here we handle the SHOUT global event */
114 execute_global_event(EVENT_SHOUT,op,params,pri);
115 return 1;
116 }
117}
118
119int command_shout (object *op, char *params)
120{
121 return command_tell_all(op, params, 1, NDI_RED, "shouts");
122}
123
124int command_chat (object *op, char *params)
125{
126 return command_tell_all(op, params, 9, NDI_BLUE, "chats");
127}
128
129
130
131int command_tell (object *op, char *params)
132{
133 char buf[MAX_BUF],*name = NULL ,*msg = NULL;
134 player *pl;
135
136 if ( params != NULL){
137 name = params;
138 msg = strchr(name, ' ');
139 if(msg){
140 *(msg++)=0;
141 if(*msg == 0)
142 msg = NULL;
143 }
144 }
145
146 if( name == NULL ){
147 new_draw_info(NDI_UNIQUE, 0,op,"Tell whom what?");
148 return 1;
149 } else if ( msg == NULL){
150 new_draw_info_format(NDI_UNIQUE, 0,op,"Tell %s what?", name);
151 return 1;
152 }
153
154 snprintf(buf,MAX_BUF-1, "%s tells you: %s",op->name, msg);
155
156 pl = find_player_partial_name( name );
157
158 if ( pl )
159 {
160 new_draw_info(NDI_UNIQUE | NDI_ORANGE, 0, pl->ob, buf);
161 new_draw_info_format(NDI_UNIQUE | NDI_ORANGE, 0, op,
162 "You tell %s: %s", pl->ob->name, msg);
163
164 /* Update last_tell value [mids 01/14/2002] */
165 strcpy(pl->last_tell, op->name);
166 return 1;
167 }
168
169 new_draw_info(NDI_UNIQUE, 0,op,"No such player or ambiguous name.");
170 return 1;
171}
172
173/* Reply to last person who told you something [mids 01/14/2002] */
174int command_reply (object *op, char *params) {
175 player *pl;
176
177 if (params == NULL) {
178 new_draw_info(NDI_UNIQUE, 0, op, "Reply what?");
179 return 1;
180 }
181
182 if (op->contr->last_tell[0] == '\0') {
183 new_draw_info(NDI_UNIQUE, 0, op, "You can't reply to nobody.");
184 return 1;
185 }
186
187 /* Find player object of player to reply to and check if player still exists */
188 pl = find_player(op->contr->last_tell);
189
190 if (pl == NULL) {
191 new_draw_info(NDI_UNIQUE, 0, op, "You can't reply, this player left.");
192 return 1;
193 }
194
195 /* Update last_tell value */
196 strcpy(pl->last_tell, op->name);
197
198 new_draw_info_format(NDI_UNIQUE | NDI_ORANGE, 0, pl->ob,
199 "%s tells you: %s", op->name, params);
200 new_draw_info_format(NDI_UNIQUE | NDI_ORANGE, 0, op,
201 "You tell to %s: %s", pl->ob->name, params);
202 return 1;
203} 85}
204 86
205/* 87/*
206 * This function covers basic emotions a player can have. An emotion can be 88 * This function covers basic emotions a player can have. An emotion can be
207 * one of three things currently. Directed at oneself, directed at someone, 89 * one of three things currently. Directed at oneself, directed at someone,

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines