|
Atrinik Server 2.5
|
00001 /************************************************************************ 00002 * Atrinik, a Multiplayer Online Role Playing Game * 00003 * * 00004 * Copyright (C) 2009-2011 Alex Tokar and Atrinik Development Team * 00005 * * 00006 * Fork from Daimonin (Massive Multiplayer Online Role Playing Game) * 00007 * and Crossfire (Multiplayer game for X-windows). * 00008 * * 00009 * This program is free software; you can redistribute it and/or modify * 00010 * it under the terms of the GNU General Public License as published by * 00011 * the Free Software Foundation; either version 2 of the License, or * 00012 * (at your option) any later version. * 00013 * * 00014 * This program is distributed in the hope that it will be useful, * 00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00017 * GNU General Public License for more details. * 00018 * * 00019 * You should have received a copy of the GNU General Public License * 00020 * along with this program; if not, write to the Free Software * 00021 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * 00022 * * 00023 * The author can be reached at admin@atrinik.org * 00024 ************************************************************************/ 00025 00031 #include <global.h> 00032 00038 int command_say(object *op, char *params) 00039 { 00040 params = cleanup_chat_string(params); 00041 00042 if (!params || *params == '\0') 00043 { 00044 return 0; 00045 } 00046 00047 LOG(llevChat, "Say: %s: %s\n", query_name(op, NULL), params); 00048 communicate(op, params); 00049 00050 return 1; 00051 } 00052 00061 int command_dmsay(object *op, char *params) 00062 { 00063 player *pl; 00064 00065 params = cleanup_chat_string(params); 00066 00067 if (!params || *params == '\0') 00068 { 00069 return 0; 00070 } 00071 00072 LOG(llevChat, "DMsay: %s: %s\n", op->name, params); 00073 00074 for (pl = first_player; pl; pl = pl->next) 00075 { 00076 if (can_do_wiz_command(pl, "dmsay")) 00077 { 00078 new_draw_info_format(NDI_PLAYER, COLOR_RED, pl->ob, "[DM Channel]: %s: %s", op->name, params); 00079 } 00080 } 00081 00082 return 1; 00083 } 00084 00090 int command_shout(object *op, char *params) 00091 { 00092 params = cleanup_chat_string(params); 00093 00094 if (!params || *params == '\0') 00095 { 00096 return 0; 00097 } 00098 00099 if (CONTR(op)->no_shout) 00100 { 00101 new_draw_info(0, COLOR_WHITE, op, "You are no longer allowed to shout."); 00102 return 0; 00103 } 00104 00105 LOG(llevChat, "Shout: %s: %s\n", query_name(op, NULL), params); 00106 new_draw_info_format(NDI_PLAYER | NDI_ALL | NDI_SHOUT, COLOR_ORANGE, NULL, "%s shouts: %s", op->name, params); 00107 00108 return 1; 00109 } 00110 00116 int command_tell(object *op, char *params) 00117 { 00118 char *name = NULL, *msg = NULL; 00119 player *pl; 00120 00121 params = cleanup_chat_string(params); 00122 00123 if (!params || *params == '\0') 00124 { 00125 return 0; 00126 } 00127 00128 LOG(llevChat, "Tell: %s: %s\n", op->name, params); 00129 00130 name = params; 00131 msg = strchr(name, ' '); 00132 00133 if (msg) 00134 { 00135 *(msg++) = '\0'; 00136 00137 if (*msg == '\0') 00138 { 00139 msg = NULL; 00140 } 00141 else 00142 { 00143 msg = cleanup_chat_string(msg); 00144 } 00145 } 00146 00147 if (!name) 00148 { 00149 new_draw_info(0, COLOR_WHITE, op, "Tell whom what?"); 00150 return 1; 00151 } 00152 00153 pl = find_player(name); 00154 00155 if (!pl) 00156 { 00157 new_draw_info(0, COLOR_WHITE, op, "No such player."); 00158 return 1; 00159 } 00160 00161 if (!msg || *msg == '\0') 00162 { 00163 new_draw_info_format(0, COLOR_WHITE, op, "Tell %s what?", pl->ob->name); 00164 return 1; 00165 } 00166 00167 /* Send to yourself? Intelligent... */ 00168 if (pl == CONTR(op)) 00169 { 00170 new_draw_info(0, COLOR_WHITE, op, "You tell yourself the news. Very smart."); 00171 return 1; 00172 } 00173 00174 if (pl->dm_stealth && !(QUERY_FLAG(op, FLAG_WIZ) || CONTR(op)->dm_stealth)) 00175 { 00176 new_draw_info_format(NDI_PLAYER | NDI_TELL, COLOR_NAVY, pl->ob, "%s tells you (dm_stealth): %s", op->name, msg); 00177 new_draw_info(0, COLOR_WHITE, op, "No such player."); 00178 } 00179 else 00180 { 00181 new_draw_info_format(NDI_PLAYER, COLOR_NAVY, op, "You tell %s: %s", name, msg); 00182 new_draw_info_format(NDI_PLAYER | NDI_TELL, COLOR_NAVY, pl->ob, "%s tells you: %s", op->name, msg); 00183 } 00184 00185 return 1; 00186 } 00187 00195 int command_t_tell(object *op, char *params) 00196 { 00197 object *t_obj; 00198 int i, xt, yt; 00199 mapstruct *m; 00200 00201 params = cleanup_chat_string(params); 00202 00203 if (!params || *params == '\0') 00204 { 00205 return 0; 00206 } 00207 00208 if (op->type == PLAYER) 00209 { 00210 t_obj = CONTR(op)->target_object; 00211 00212 if (t_obj && CONTR(op)->target_object_count == t_obj->count) 00213 { 00214 /* Why do I do this and not direct distance calculation? 00215 * Because the player perhaps has left the mapset with the 00216 * target which will invoke some nasty searchings. */ 00217 for (i = 0; i <= SIZEOFFREE2; i++) 00218 { 00219 xt = op->x + freearr_x[i]; 00220 yt = op->y + freearr_y[i]; 00221 00222 if (!(m = get_map_from_coord(op->map, &xt, &yt))) 00223 { 00224 continue; 00225 } 00226 00227 if (m == t_obj->map && xt == t_obj->x && yt == t_obj->y) 00228 { 00229 LOG(llevChat, "Talk to: %s: %s\n", op->name, params); 00230 talk_to_npc(op, t_obj, params); 00231 play_sound_player_only(CONTR(op), CMD_SOUND_EFFECT, "scroll.ogg", 0, 0, 0, 0); 00232 return 1; 00233 } 00234 } 00235 } 00236 } 00237 00238 play_sound_player_only(CONTR(op), CMD_SOUND_EFFECT, "rod.ogg", 0, 0, 0, 0); 00239 return 1; 00240 } 00241 00256 static void emote_other(object *op, object *target, char *str, char *buf, size_t size, char *buf2, size_t size2, char *buf3, size_t size3, int emotion) 00257 { 00258 const char *name = str; 00259 00260 if (target && target->name) 00261 { 00262 name = target->name; 00263 } 00264 00265 switch (emotion) 00266 { 00267 case EMOTE_NOD: 00268 snprintf(buf, size, "You nod solemnly to %s.", name); 00269 snprintf(buf2, size2, "%s nods solemnly to you.", op->name); 00270 snprintf(buf3, size3, "%s nods solemnly to %s.", op->name, name); 00271 break; 00272 00273 case EMOTE_DANCE: 00274 snprintf(buf, size, "You grab %s and begin doing the Cha-Cha!", name); 00275 snprintf(buf2, size2, "%s grabs you, and begins dancing!", op->name); 00276 snprintf(buf3, size3, "Yipe! %s and %s are doing the Macarena!", op->name, name); 00277 break; 00278 00279 case EMOTE_KISS: 00280 snprintf(buf, size, "You kiss %s.", name); 00281 snprintf(buf2, size2, "%s kisses you.", op->name); 00282 snprintf(buf3, size3, "%s kisses %s.", op->name, name); 00283 break; 00284 00285 case EMOTE_BOUNCE: 00286 snprintf(buf, size, "You bounce around the room with %s.", name); 00287 snprintf(buf2, size2, "%s bounces around the room with you.", op->name); 00288 snprintf(buf3, size3, "%s bounces around the room with %s.", op->name, name); 00289 break; 00290 00291 case EMOTE_SMILE: 00292 snprintf(buf, size, "You smile at %s.", name); 00293 snprintf(buf2, size2, "%s smiles at you.", op->name); 00294 snprintf(buf3, size3, "%s beams a smile at %s.", op->name, name); 00295 break; 00296 00297 case EMOTE_LAUGH: 00298 snprintf(buf, size, "You take one look at %s and fall down laughing.", name); 00299 snprintf(buf2, size2, "%s looks at you and falls down on the ground laughing.", op->name); 00300 snprintf(buf3, size3, "%s looks at %s and falls down on the ground laughing.", op->name, name); 00301 break; 00302 00303 case EMOTE_SHAKE: 00304 snprintf(buf, size, "You shake %s's hand.", name); 00305 snprintf(buf2, size2, "%s shakes your hand.", op->name); 00306 snprintf(buf3, size3, "%s shakes %s's hand.", op->name, name); 00307 break; 00308 00309 case EMOTE_PUKE: 00310 snprintf(buf, size, "You puke on %s.", name); 00311 snprintf(buf2, size2, "%s pukes on your clothes!", op->name); 00312 snprintf(buf3, size3, "%s pukes on %s.", op->name, name); 00313 break; 00314 00315 case EMOTE_HUG: 00316 snprintf(buf, size, "You hug %s.", name); 00317 snprintf(buf2, size2, "%s hugs you.", op->name); 00318 snprintf(buf3, size3, "%s hugs %s.", op->name, name); 00319 break; 00320 00321 case EMOTE_CRY: 00322 snprintf(buf, size, "You cry on %s's shoulder.", name); 00323 snprintf(buf2, size2, "%s cries on your shoulder.", op->name); 00324 snprintf(buf3, size3, "%s cries on %s's shoulder.", op->name, name); 00325 break; 00326 00327 case EMOTE_POKE: 00328 snprintf(buf, size, "You poke %s in the ribs.", name); 00329 snprintf(buf2, size2, "%s pokes you in the ribs.", op->name); 00330 snprintf(buf3, size3, "%s pokes %s in the ribs.", op->name, name); 00331 break; 00332 00333 case EMOTE_ACCUSE: 00334 snprintf(buf, size, "You look accusingly at %s.", name); 00335 snprintf(buf2, size2, "%s looks accusingly at you.", op->name); 00336 snprintf(buf3, size3, "%s looks accusingly at %s.", op->name, name); 00337 break; 00338 00339 case EMOTE_GRIN: 00340 snprintf(buf, size, "You grin at %s.", name); 00341 snprintf(buf2, size2, "%s grins evilly at you.", op->name); 00342 snprintf(buf3, size3, "%s grins evilly at %s.", op->name, name); 00343 break; 00344 00345 case EMOTE_BOW: 00346 snprintf(buf, size, "You bow before %s.", name); 00347 snprintf(buf2, size2, "%s bows before you.", op->name); 00348 snprintf(buf3, size3, "%s bows before %s.", op->name, name); 00349 break; 00350 00351 case EMOTE_FROWN: 00352 snprintf(buf, size, "You frown darkly at %s.", name); 00353 snprintf(buf2, size2, "%s frowns darkly at you.", op->name); 00354 snprintf(buf3, size3, "%s frowns darkly at %s.", op->name, name); 00355 break; 00356 00357 case EMOTE_GLARE: 00358 snprintf(buf, size, "You glare icily at %s.", name); 00359 snprintf(buf2, size2, "%s glares icily at you, you feel cold to your bones.", op->name); 00360 snprintf(buf3, size3, "%s glares at %s.", op->name, name); 00361 break; 00362 00363 case EMOTE_LICK: 00364 snprintf(buf, size, "You lick %s.", name); 00365 snprintf(buf2, size2, "%s licks you.", op->name); 00366 snprintf(buf3, size3, "%s licks %s.", op->name, name); 00367 break; 00368 00369 case EMOTE_SHRUG: 00370 snprintf(buf, size, "You shrug at %s.", name); 00371 snprintf(buf2, size2, "%s shrugs at you.", op->name); 00372 snprintf(buf3, size3, "%s shrugs at %s.", op->name, name); 00373 break; 00374 00375 case EMOTE_SLAP: 00376 snprintf(buf, size, "You slap %s.", name); 00377 snprintf(buf2, size2, "You are slapped by %s.", op->name); 00378 snprintf(buf3, size3, "%s slaps %s.", op->name, name); 00379 break; 00380 00381 case EMOTE_SNEEZE: 00382 snprintf(buf, size, "You sneeze and a film of snot shoots onto %s.", name); 00383 snprintf(buf2, size2, "%s sneezes on you, you feel the snot cover you. EEEEEEW.", op->name); 00384 snprintf(buf3, size3, "%s sneezes and a film of snot covers %s.", op->name, name); 00385 break; 00386 00387 case EMOTE_SNIFF: 00388 snprintf(buf, size, "You sniff %s.", name); 00389 snprintf(buf2, size2, "%s sniffs you.", op->name); 00390 snprintf(buf3, size3, "%s sniffs %s.", op->name, name); 00391 break; 00392 00393 case EMOTE_SPIT: 00394 snprintf(buf, size, "You spit on %s.", name); 00395 snprintf(buf2, size2, "%s spits in your face!", op->name); 00396 snprintf(buf3, size3, "%s spits in %s's face.", op->name, name); 00397 break; 00398 00399 case EMOTE_THANK: 00400 snprintf(buf, size, "You thank %s heartily.", name); 00401 snprintf(buf2, size2, "%s thanks you heartily.", op->name); 00402 snprintf(buf3, size3, "%s thanks %s heartily.", op->name, name); 00403 break; 00404 00405 case EMOTE_WAVE: 00406 snprintf(buf, size, "You wave goodbye to %s.", name); 00407 snprintf(buf2, size2, "%s waves goodbye to you. Have a good journey.", op->name); 00408 snprintf(buf3, size3, "%s waves goodbye to %s.", op->name, name); 00409 break; 00410 00411 case EMOTE_WHISTLE: 00412 snprintf(buf, size, "You whistle at %s.", name); 00413 snprintf(buf2, size2, "%s whistles at you.", op->name); 00414 snprintf(buf3, size3, "%s whistles at %s.", op->name, name); 00415 break; 00416 00417 case EMOTE_WINK: 00418 snprintf(buf, size, "You wink suggestively at %s.", name); 00419 snprintf(buf2, size2, "%s winks suggestively at you.", op->name); 00420 snprintf(buf3, size3, "%s winks at %s.", op->name, name); 00421 break; 00422 00423 case EMOTE_BEG: 00424 snprintf(buf, size, "You beg %s for mercy.", name); 00425 snprintf(buf2, size2, "%s begs you for mercy! Show no quarter!", op->name); 00426 snprintf(buf3, size3, "%s begs %s for mercy!", op->name, name); 00427 break; 00428 00429 case EMOTE_BLEED: 00430 snprintf(buf, size, "You slash your wrist and bleed all over %s.", name); 00431 snprintf(buf2, size2, "%s slashes %s wrist and bleeds all over you.", op->name, gender_possessive[object_get_gender(op)]); 00432 snprintf(buf3, size3, "%s slashes %s wrist and bleeds all over %s.", op->name, gender_possessive[object_get_gender(op)], name); 00433 break; 00434 00435 case EMOTE_CRINGE: 00436 snprintf(buf, size, "You cringe away from %s.", name); 00437 snprintf(buf2, size2, "%s cringes away from you.", op->name); 00438 snprintf(buf3, size3, "%s cringes away from %s in mortal terror.", op->name, name); 00439 break; 00440 00441 case EMOTE_STARE: 00442 snprintf(buf, size, "You stare intently at %s.", name); 00443 snprintf(buf2, size2, "%s stares intently at you.", op->name); 00444 snprintf(buf3, size3, "%s stares intently at %s.", op->name, name); 00445 break; 00446 00447 case EMOTE_SNEER: 00448 snprintf(buf, size, "You sneer at %s.", name); 00449 snprintf(buf2, size2, "%s sneers at you.", op->name); 00450 snprintf(buf3, size3, "%s sneers at %s.", op->name, name); 00451 break; 00452 00453 default: 00454 snprintf(buf, size, "You are still nuts."); 00455 snprintf(buf2, size2, "You get the distinct feeling that %s is nuts.", op->name); 00456 snprintf(buf3, size3, "%s is eying %s quizzically.", name, op->name); 00457 break; 00458 } 00459 } 00460 00470 static void emote_self(object *op, char *buf, size_t size, char *buf2, size_t size2, int emotion) 00471 { 00472 switch (emotion) 00473 { 00474 case EMOTE_DANCE: 00475 snprintf(buf, size, "You skip and dance around by yourself."); 00476 snprintf(buf2, size2, "%s embraces %s and begins to dance!", op->name, gender_reflexive[object_get_gender(op)]); 00477 break; 00478 00479 case EMOTE_LAUGH: 00480 snprintf(buf, size, "Laugh at yourself all you want, the others won't understand."); 00481 snprintf(buf2, size2, "%s is laughing at something.", op->name); 00482 break; 00483 00484 case EMOTE_SHAKE: 00485 snprintf(buf, size, "You are shaken by yourself."); 00486 snprintf(buf2, size2, "%s shakes and quivers like a bowlful of jelly.", op->name); 00487 break; 00488 00489 case EMOTE_PUKE: 00490 snprintf(buf, size, "You puke on yourself."); 00491 snprintf(buf2, size2, "%s pukes on %s clothes.", op->name, gender_possessive[object_get_gender(op)]); 00492 break; 00493 00494 case EMOTE_HUG: 00495 snprintf(buf, size, "You hug yourself."); 00496 snprintf(buf2, size2, "%s hugs %s.", op->name, gender_reflexive[object_get_gender(op)]); 00497 break; 00498 00499 case EMOTE_CRY: 00500 snprintf(buf, size, "You cry to yourself."); 00501 snprintf(buf2, size2, "%s sobs quietly to %s.", op->name, gender_reflexive[object_get_gender(op)]); 00502 break; 00503 00504 case EMOTE_POKE: 00505 snprintf(buf, size, "You poke yourself in the ribs, feeling very silly."); 00506 snprintf(buf2, size2, "%s pokes %s in the ribs, looking very sheepish.", op->name, gender_reflexive[object_get_gender(op)]); 00507 break; 00508 00509 case EMOTE_ACCUSE: 00510 snprintf(buf, size, "You accuse yourself."); 00511 snprintf(buf2, size2, "%s seems to have a bad conscience.", op->name); 00512 break; 00513 00514 case EMOTE_BOW: 00515 snprintf(buf, size, "You kiss your toes."); 00516 snprintf(buf2, size2, "%s folds up like a jackknife and kisses %s own toes.", op->name, gender_possessive[object_get_gender(op)]); 00517 break; 00518 00519 case EMOTE_FROWN: 00520 snprintf(buf, size, "You frown at yourself."); 00521 snprintf(buf2, size2, "%s frowns at %s.", op->name, gender_reflexive[object_get_gender(op)]); 00522 break; 00523 00524 case EMOTE_GLARE: 00525 snprintf(buf, size, "You glare icily at your feet, they are suddenly very cold."); 00526 snprintf(buf2, size2, "%s glares at %s feet, what is bothering him?", op->name, gender_possessive[object_get_gender(op)]); 00527 break; 00528 00529 case EMOTE_LICK: 00530 snprintf(buf, size, "You lick yourself."); 00531 snprintf(buf2, size2, "%s licks %s - YUCK.", op->name, gender_reflexive[object_get_gender(op)]); 00532 break; 00533 00534 case EMOTE_SLAP: 00535 snprintf(buf, size, "You slap yourself, silly you."); 00536 snprintf(buf2, size2, "%s slaps %s, really strange...", op->name, gender_reflexive[object_get_gender(op)]); 00537 break; 00538 00539 case EMOTE_SNEEZE: 00540 snprintf(buf, size, "You sneeze on yourself, what a mess!"); 00541 snprintf(buf2, size2, "%s sneezes, and covers %s in a slimy substance.", op->name, gender_reflexive[object_get_gender(op)]); 00542 break; 00543 00544 case EMOTE_SNIFF: 00545 snprintf(buf, size, "You sniff yourself."); 00546 snprintf(buf2, size2, "%s sniffs %s.", op->name, gender_reflexive[object_get_gender(op)]); 00547 break; 00548 00549 case EMOTE_SPIT: 00550 snprintf(buf, size, "You drool all over yourself."); 00551 snprintf(buf2, size2, "%s drools all over %s.", op->name, gender_reflexive[object_get_gender(op)]); 00552 break; 00553 00554 case EMOTE_THANK: 00555 snprintf(buf, size, "You thank yourself since nobody else wants to!"); 00556 snprintf(buf2, size2, "%s thanks %s since you won't.", op->name, gender_reflexive[object_get_gender(op)]); 00557 break; 00558 00559 case EMOTE_WAVE: 00560 snprintf(buf, size, "Are you going on adventures as well??"); 00561 snprintf(buf2, size2, "%s waves goodbye to %s.", op->name, gender_reflexive[object_get_gender(op)]); 00562 break; 00563 00564 case EMOTE_WHISTLE: 00565 snprintf(buf, size, "You whistle while you work."); 00566 snprintf(buf2, size2, "%s whistles to %s in boredom.", op->name, gender_reflexive[object_get_gender(op)]); 00567 break; 00568 00569 case EMOTE_WINK: 00570 snprintf(buf, size, "You wink at yourself?? What are you up to?"); 00571 snprintf(buf2, size2, "%s winks at %s - something strange is going on...", op->name, gender_reflexive[object_get_gender(op)]); 00572 break; 00573 00574 case EMOTE_BLEED: 00575 snprintf(buf, size, "Very impressive! You wipe your blood all over yourself."); 00576 snprintf(buf2, size2, "%s performs some satanic ritual while wiping %s blood on %s.", op->name, gender_possessive[object_get_gender(op)], gender_reflexive[object_get_gender(op)]); 00577 break; 00578 00579 default: 00580 snprintf(buf, size, "My god! is that LEGAL?"); 00581 snprintf(buf2, size2, "You look away from %s.", op->name); 00582 break; 00583 } 00584 } 00585 00594 static void emote_no_target(object *op, char *buf, size_t size, char *buf2, size_t size2, int emotion) 00595 { 00596 switch (emotion) 00597 { 00598 case EMOTE_NOD: 00599 snprintf(buf, size, "%s nods solemnly.", op->name); 00600 snprintf(buf2, size2, "You nod solemnly."); 00601 break; 00602 00603 case EMOTE_DANCE: 00604 snprintf(buf, size, "%s expresses %s through interpretive dance.", op->name, gender_reflexive[object_get_gender(op)]); 00605 snprintf(buf2, size2, "You dance with glee."); 00606 break; 00607 00608 case EMOTE_KISS: 00609 snprintf(buf, size, "%s makes a weird facial contortion", op->name); 00610 snprintf(buf2, size2, "All the lonely people.."); 00611 break; 00612 00613 case EMOTE_BOUNCE: 00614 snprintf(buf, size, "%s bounces around.", op->name); 00615 snprintf(buf2, size2, "BOIINNNNNNGG!"); 00616 break; 00617 00618 case EMOTE_SMILE: 00619 snprintf(buf, size, "%s smiles happily.", op->name); 00620 snprintf(buf2, size2, "You smile happily."); 00621 break; 00622 00623 case EMOTE_CACKLE: 00624 snprintf(buf, size, "%s throws back %s head and cackles with insane glee!", op->name, gender_possessive[object_get_gender(op)]); 00625 snprintf(buf2, size2, "You cackle gleefully."); 00626 break; 00627 00628 case EMOTE_LAUGH: 00629 snprintf(buf, size, "%s falls down laughing.", op->name); 00630 snprintf(buf2, size2, "You fall down laughing."); 00631 break; 00632 00633 case EMOTE_GIGGLE: 00634 snprintf(buf, size, "%s giggles.", op->name); 00635 snprintf(buf2, size2, "You giggle."); 00636 break; 00637 00638 case EMOTE_SHAKE: 00639 snprintf(buf, size, "%s shakes %s head.", op->name, gender_possessive[object_get_gender(op)]); 00640 snprintf(buf2, size2, "You shake your head."); 00641 break; 00642 00643 case EMOTE_PUKE: 00644 snprintf(buf, size, "%s pukes.", op->name); 00645 snprintf(buf2, size2, "Bleaaaaaghhhhhhh!"); 00646 break; 00647 00648 case EMOTE_GROWL: 00649 snprintf(buf, size, "%s growls.", op->name); 00650 snprintf(buf2, size2, "Grrrrrrrrr...."); 00651 break; 00652 00653 case EMOTE_SCREAM: 00654 snprintf(buf, size, "%s screams at the top of %s lungs!", op->name, gender_possessive[object_get_gender(op)]); 00655 snprintf(buf2, size2, "ARRRRRRRRRRGH!!!!!"); 00656 break; 00657 00658 case EMOTE_SIGH: 00659 snprintf(buf, size, "%s sighs loudly.", op->name); 00660 snprintf(buf2, size2, "You sigh."); 00661 break; 00662 00663 case EMOTE_SULK: 00664 snprintf(buf, size, "%s sulks in the corner.", op->name); 00665 snprintf(buf2, size2, "You sulk."); 00666 break; 00667 00668 case EMOTE_CRY: 00669 snprintf(buf, size, "%s bursts into tears.", op->name); 00670 snprintf(buf2, size2, "Waaaaaaahhh.."); 00671 break; 00672 00673 case EMOTE_GRIN: 00674 snprintf(buf, size, "%s grins evilly.", op->name); 00675 snprintf(buf2, size2, "You grin evilly."); 00676 break; 00677 00678 case EMOTE_BOW: 00679 snprintf(buf, size, "%s bows deeply.", op->name); 00680 snprintf(buf2, size2, "You bow deeply."); 00681 break; 00682 00683 case EMOTE_CLAP: 00684 snprintf(buf, size, "%s gives a round of applause.", op->name); 00685 snprintf(buf2, size2, "Clap, clap, clap."); 00686 break; 00687 00688 case EMOTE_BLUSH: 00689 snprintf(buf, size, "%s blushes.", op->name); 00690 snprintf(buf2, size2, "Your cheeks are burning."); 00691 break; 00692 00693 case EMOTE_BURP: 00694 snprintf(buf, size, "%s burps loudly.", op->name); 00695 snprintf(buf2, size2, "You burp loudly."); 00696 break; 00697 00698 case EMOTE_CHUCKLE: 00699 snprintf(buf, size, "%s chuckles politely.", op->name); 00700 snprintf(buf2, size2, "You chuckle politely"); 00701 break; 00702 00703 case EMOTE_COUGH: 00704 snprintf(buf, size, "%s coughs loudly.", op->name); 00705 snprintf(buf2, size2, "Yuck, try to cover your mouth next time!"); 00706 break; 00707 00708 case EMOTE_FLIP: 00709 snprintf(buf, size, "%s flips head over heels.", op->name); 00710 snprintf(buf2, size2, "You flip head over heels."); 00711 break; 00712 00713 case EMOTE_FROWN: 00714 snprintf(buf, size, "%s frowns.", op->name); 00715 snprintf(buf2, size2, "What's bothering you?"); 00716 break; 00717 00718 case EMOTE_GASP: 00719 snprintf(buf, size, "%s gasps in astonishment.", op->name); 00720 snprintf(buf2, size2, "You gasp in astonishment."); 00721 break; 00722 00723 case EMOTE_GLARE: 00724 snprintf(buf, size, "%s glares around him.", op->name); 00725 snprintf(buf2, size2, "You glare at nothing in particular."); 00726 break; 00727 00728 case EMOTE_GROAN: 00729 snprintf(buf, size, "%s groans loudly.", op->name); 00730 snprintf(buf2, size2, "You groan loudly."); 00731 break; 00732 00733 case EMOTE_HICCUP: 00734 snprintf(buf, size, "%s hiccups.", op->name); 00735 snprintf(buf2, size2, "*HIC*"); 00736 break; 00737 00738 case EMOTE_LICK: 00739 snprintf(buf, size, "%s licks %s mouth and smiles.", op->name, gender_possessive[object_get_gender(op)]); 00740 snprintf(buf2, size2, "You lick your mouth and smile."); 00741 break; 00742 00743 case EMOTE_POUT: 00744 snprintf(buf, size, "%s pouts.", op->name); 00745 snprintf(buf2, size2, "Aww, don't take it so hard."); 00746 break; 00747 00748 case EMOTE_SHIVER: 00749 snprintf(buf, size, "%s shivers uncomfortably.", op->name); 00750 snprintf(buf2, size2, "Brrrrrrrrr."); 00751 break; 00752 00753 case EMOTE_SHRUG: 00754 snprintf(buf, size, "%s shrugs helplessly.", op->name); 00755 snprintf(buf2, size2, "You shrug."); 00756 break; 00757 00758 case EMOTE_SMIRK: 00759 snprintf(buf, size, "%s smirks.", op->name); 00760 snprintf(buf2, size2, "You smirk."); 00761 break; 00762 00763 case EMOTE_SNAP: 00764 snprintf(buf, size, "%s snaps %s fingers.", op->name, gender_possessive[object_get_gender(op)]); 00765 snprintf(buf2, size2, "PRONTO! You snap your fingers."); 00766 break; 00767 00768 case EMOTE_SNEEZE: 00769 snprintf(buf, size, "%s sneezes.", op->name); 00770 snprintf(buf2, size2, "Gesundheit!"); 00771 break; 00772 00773 case EMOTE_SNICKER: 00774 snprintf(buf, size, "%s snickers softly.", op->name); 00775 snprintf(buf2, size2, "You snicker softly."); 00776 break; 00777 00778 case EMOTE_SNIFF: 00779 snprintf(buf, size, "%s sniffs sadly.", op->name); 00780 snprintf(buf2, size2, "You sniff sadly. *SNIFF*"); 00781 break; 00782 00783 case EMOTE_SNORE: 00784 snprintf(buf, size, "%s snores loudly.", op->name); 00785 snprintf(buf2, size2, "Zzzzzzzzzzzzzzz."); 00786 break; 00787 00788 case EMOTE_SPIT: 00789 snprintf(buf, size, "%s spits over %s left shoulder.", op->name, gender_possessive[object_get_gender(op)]); 00790 snprintf(buf2, size2, "You spit over your left shoulder."); 00791 break; 00792 00793 case EMOTE_STRUT: 00794 snprintf(buf, size, "%s struts proudly.", op->name); 00795 snprintf(buf2, size2, "Strut your stuff."); 00796 break; 00797 00798 case EMOTE_TWIDDLE: 00799 snprintf(buf, size, "%s patiently twiddles %s thumbs.", op->name, gender_possessive[object_get_gender(op)]); 00800 snprintf(buf2, size2, "You patiently twiddle your thumbs."); 00801 break; 00802 00803 case EMOTE_WAVE: 00804 snprintf(buf, size, "%s waves happily.", op->name); 00805 snprintf(buf2, size2, "You wave."); 00806 break; 00807 00808 case EMOTE_WHISTLE: 00809 snprintf(buf, size, "%s whistles appreciatively.", op->name); 00810 snprintf(buf2, size2, "You whistle appreciatively."); 00811 break; 00812 00813 case EMOTE_WINK: 00814 snprintf(buf, size, "%s winks suggestively.", op->name); 00815 snprintf(buf2, size2, "Have you got something in your eye?"); 00816 break; 00817 00818 case EMOTE_YAWN: 00819 snprintf(buf, size, "%s yawns sleepily.", op->name); 00820 snprintf(buf2, size2, "You open up your yap and let out a big breeze of stale air."); 00821 break; 00822 00823 case EMOTE_CRINGE: 00824 snprintf(buf, size, "%s cringes in terror!", op->name); 00825 snprintf(buf2, size2, "You cringe in terror."); 00826 break; 00827 00828 case EMOTE_BLEED: 00829 snprintf(buf, size, "%s is bleeding all over the carpet - got a spare tourniquet?", op->name); 00830 snprintf(buf2, size2, "You bleed all over your nice new armour."); 00831 break; 00832 00833 case EMOTE_THINK: 00834 snprintf(buf, size, "%s closes %s eyes and thinks really hard.", op->name, gender_possessive[object_get_gender(op)]); 00835 snprintf(buf2, size2, "Anything in particular that you'd care to think about?"); 00836 break; 00837 00838 case EMOTE_STARE: 00839 snprintf(buf, size, "%s stares wide-eyed.", op->name); 00840 snprintf(buf2, size2, "You stare."); 00841 break; 00842 00843 case EMOTE_WINCE: 00844 snprintf(buf, size, "%s winces.", op->name); 00845 snprintf(buf2, size2, "You wince."); 00846 break; 00847 00848 case EMOTE_FACEPALM: 00849 snprintf(buf, size, "%s's face meets %s palm.", op->name, gender_possessive[object_get_gender(op)]); 00850 snprintf(buf2, size2, "Your face meets your palm."); 00851 break; 00852 00853 default: 00854 snprintf(buf, size, "%s dances with glee.", op->name); 00855 snprintf(buf2, size2, "You are nuts."); 00856 break; 00857 } 00858 } 00859 00875 static int basic_emote(object *op, char *params, int emotion) 00876 { 00877 char buf[MAX_BUF], buf2[MAX_BUF], buf3[MAX_BUF]; 00878 00879 LOG(llevChat, "Emote: %s, params: %s, target: %s, emote: %d\n", query_name(op, NULL), params ? params : "NULL", CONTR(op) ? query_name(CONTR(op)->target_object, NULL) : "NULL", emotion); 00880 00881 if (op->type == PLAYER) 00882 { 00883 CONTR(op)->stat_emotes_used++; 00884 } 00885 00886 params = cleanup_chat_string(params); 00887 00888 if (params && *params == '\0') 00889 { 00890 params = NULL; 00891 } 00892 else if (params) 00893 { 00894 if (emotion != EMOTE_ME && emotion != EMOTE_MY && op->type == PLAYER) 00895 { 00896 adjust_player_name(params); 00897 } 00898 } 00899 00900 if (!params) 00901 { 00902 /* If we are a player with legal target, use it as target for the 00903 * emote. */ 00904 if (op->type == PLAYER && CONTR(op)->target_object != op && OBJECT_VALID(CONTR(op)->target_object, CONTR(op)->target_object_count) && CONTR(op)->target_object->name && (CONTR(op)->target_object->type != PLAYER || !CONTR(CONTR(op)->target_object)->dm_stealth || QUERY_FLAG(op, FLAG_WIZ) || CONTR(op)->dm_stealth) && !IS_INVISIBLE(CONTR(op)->target_object, op)) 00905 { 00906 rv_vector rv; 00907 00908 if (get_rangevector(op, CONTR(op)->target_object, &rv, 0) && rv.distance <= 4) 00909 { 00910 emote_other(op, CONTR(op)->target_object, NULL, buf, sizeof(buf), buf2, sizeof(buf2), buf3, sizeof(buf3), emotion); 00911 new_draw_info(NDI_PLAYER, COLOR_YELLOW, op, buf); 00912 00913 if (CONTR(op)->target_object->type == PLAYER) 00914 { 00915 new_draw_info(NDI_PLAYER, COLOR_YELLOW, CONTR(op)->target_object, buf2); 00916 } 00917 00918 new_info_map_except(NDI_EMOTE | NDI_PLAYER, COLOR_YELLOW, op->map, op->x, op->y, MAP_INFO_NORMAL, op, CONTR(op)->target_object, buf3); 00919 return 0; 00920 } 00921 00922 new_draw_info(0, COLOR_WHITE, op, "The target is not in range for this emote action."); 00923 return 0; 00924 } 00925 00926 if (emotion == EMOTE_ME) 00927 { 00928 new_draw_info(0, COLOR_WHITE, op, "Usage: /me <emote to display>"); 00929 return 0; 00930 } 00931 else if (emotion == EMOTE_MY) 00932 { 00933 new_draw_info(0, COLOR_WHITE, op, "Usage: /my <emote to display>"); 00934 return 0; 00935 } 00936 00937 emote_no_target(op, buf, sizeof(buf), buf2, sizeof(buf2), emotion); 00938 00939 if (op->type == PLAYER) 00940 { 00941 new_info_map_except(NDI_EMOTE | NDI_PLAYER, COLOR_YELLOW, op->map, op->x, op->y, MAP_INFO_NORMAL, op, op, buf); 00942 new_draw_info(NDI_PLAYER, COLOR_YELLOW, op, buf2); 00943 } 00944 else 00945 { 00946 new_info_map_except(NDI_EMOTE, COLOR_YELLOW, op->map, op->x, op->y, MAP_INFO_NORMAL, op, op, buf); 00947 } 00948 00949 return 0; 00950 } 00951 /* We have params. */ 00952 else 00953 { 00954 if (emotion == EMOTE_ME || emotion == EMOTE_MY) 00955 { 00956 if (emotion == EMOTE_ME) 00957 { 00958 snprintf(buf, sizeof(buf), "%s %s", op->name, params); 00959 } 00960 else if (emotion == EMOTE_MY) 00961 { 00962 snprintf(buf, sizeof(buf), "%s's %s", op->name, params); 00963 } 00964 00965 if (op->type == PLAYER) 00966 { 00967 new_info_map_except(NDI_EMOTE | NDI_PLAYER, COLOR_YELLOW, op->map, op->x, op->y, MAP_INFO_NORMAL, op, op, buf); 00968 new_draw_info(NDI_PLAYER, COLOR_YELLOW, op, buf); 00969 } 00970 else 00971 { 00972 new_info_map_except(NDI_EMOTE, COLOR_YELLOW, op->map, op->x, op->y, MAP_INFO_NORMAL, op, op, buf); 00973 } 00974 00975 return 0; 00976 } 00977 /* Here we handle player and NPC emotes with parameter. */ 00978 else 00979 { 00980 player *pl; 00981 00982 if (op->type == PLAYER && strcmp(op->name, params) == 0) 00983 { 00984 emote_self(op, buf, sizeof(buf), buf2, sizeof(buf2), emotion); 00985 new_draw_info(NDI_PLAYER, COLOR_YELLOW, op, buf); 00986 new_info_map_except(NDI_EMOTE | NDI_PLAYER, COLOR_YELLOW, op->map, op->x, op->y, MAP_INFO_NORMAL, op, op, buf2); 00987 return 0; 00988 } 00989 00990 pl = find_player(params); 00991 00992 if (pl && (!pl->dm_stealth || QUERY_FLAG(op, FLAG_WIZ) || CONTR(op)->dm_stealth) && !IS_INVISIBLE(pl->ob, op)) 00993 { 00994 rv_vector rv; 00995 00996 if (get_rangevector(op, pl->ob, &rv, 0) && rv.distance <= 4) 00997 { 00998 if (op->type == PLAYER) 00999 { 01000 emote_other(op, pl->ob, NULL, buf, sizeof(buf), buf2, sizeof(buf2), buf3, sizeof(buf3), emotion); 01001 new_draw_info(NDI_PLAYER, COLOR_YELLOW, op, buf); 01002 new_draw_info(NDI_EMOTE | NDI_PLAYER, COLOR_YELLOW, pl->ob, buf2); 01003 new_info_map_except(NDI_EMOTE | NDI_PLAYER, COLOR_YELLOW, op->map, op->x, op->y, MAP_INFO_NORMAL, op, pl->ob, buf3); 01004 } 01005 else 01006 { 01007 emote_other(op, NULL, params, buf, sizeof(buf), buf2, sizeof(buf2), buf3, sizeof(buf3), emotion); 01008 new_draw_info(NDI_EMOTE | NDI_PLAYER, COLOR_YELLOW, pl->ob, buf2); 01009 new_info_map_except(NDI_EMOTE, COLOR_YELLOW, op->map, op->x, op->y, MAP_INFO_NORMAL, NULL, pl->ob, buf3); 01010 } 01011 } 01012 else if (op->type == PLAYER) 01013 { 01014 new_draw_info(0, COLOR_WHITE, op, "The target is not in range for this emote action."); 01015 } 01016 01017 return 0; 01018 } 01019 01020 if (op->type == PLAYER) 01021 { 01022 emote_self(op, buf, sizeof(buf), buf2, sizeof(buf2), -1); 01023 new_draw_info(NDI_PLAYER, COLOR_YELLOW, op, buf); 01024 new_info_map_except(NDI_EMOTE | NDI_PLAYER, COLOR_YELLOW, op->map, op->x, op->y, MAP_INFO_NORMAL, op, op, buf2); 01025 } 01026 else 01027 { 01028 emote_other(op, NULL, params, buf, sizeof(buf), buf2, sizeof(buf2), buf3, sizeof(buf3), emotion); 01029 new_info_map_except(NDI_EMOTE, COLOR_YELLOW, op->map, op->x, op->y, MAP_INFO_NORMAL, NULL, NULL, buf3); 01030 } 01031 } 01032 } 01033 01034 return 0; 01035 } 01036 01039 int command_nod(object *op, char *params) 01040 { 01041 return basic_emote(op, params, EMOTE_NOD); 01042 } 01043 01044 int command_dance(object *op, char *params) 01045 { 01046 return basic_emote(op, params, EMOTE_DANCE); 01047 } 01048 01049 int command_kiss(object *op, char *params) 01050 { 01051 return basic_emote(op, params, EMOTE_KISS); 01052 } 01053 01054 int command_bounce(object *op, char *params) 01055 { 01056 return basic_emote(op, params, EMOTE_BOUNCE); 01057 } 01058 01059 int command_smile(object *op, char *params) 01060 { 01061 return basic_emote(op, params, EMOTE_SMILE); 01062 } 01063 01064 int command_cackle(object *op, char *params) 01065 { 01066 return basic_emote(op, params, EMOTE_CACKLE); 01067 } 01068 01069 int command_laugh(object *op, char *params) 01070 { 01071 return basic_emote(op, params, EMOTE_LAUGH); 01072 } 01073 01074 int command_giggle(object *op, char *params) 01075 { 01076 return basic_emote(op, params, EMOTE_GIGGLE); 01077 } 01078 01079 int command_shake(object *op, char *params) 01080 { 01081 return basic_emote(op, params, EMOTE_SHAKE); 01082 } 01083 01084 int command_puke(object *op, char *params) 01085 { 01086 return basic_emote(op, params, EMOTE_PUKE); 01087 } 01088 01089 int command_growl(object *op, char *params) 01090 { 01091 return basic_emote(op, params, EMOTE_GROWL); 01092 } 01093 01094 int command_scream(object *op, char *params) 01095 { 01096 return basic_emote(op, params, EMOTE_SCREAM); 01097 } 01098 01099 int command_sigh(object *op, char *params) 01100 { 01101 return basic_emote(op, params, EMOTE_SIGH); 01102 } 01103 01104 int command_sulk(object *op, char *params) 01105 { 01106 return basic_emote(op, params, EMOTE_SULK); 01107 } 01108 01109 int command_hug(object *op, char *params) 01110 { 01111 return basic_emote(op, params, EMOTE_HUG); 01112 } 01113 01114 int command_cry(object *op, char *params) 01115 { 01116 return basic_emote(op, params, EMOTE_CRY); 01117 } 01118 01119 int command_poke(object *op, char *params) 01120 { 01121 return basic_emote(op, params, EMOTE_POKE); 01122 } 01123 01124 int command_accuse(object *op, char *params) 01125 { 01126 return basic_emote(op, params, EMOTE_ACCUSE); 01127 } 01128 01129 int command_grin(object *op, char *params) 01130 { 01131 return basic_emote(op, params, EMOTE_GRIN); 01132 } 01133 01134 int command_bow(object *op, char *params) 01135 { 01136 return basic_emote(op, params, EMOTE_BOW); 01137 } 01138 01139 int command_clap(object *op, char *params) 01140 { 01141 return basic_emote(op, params, EMOTE_CLAP); 01142 } 01143 01144 int command_blush(object *op, char *params) 01145 { 01146 return basic_emote(op, params, EMOTE_BLUSH); 01147 } 01148 01149 int command_burp(object *op, char *params) 01150 { 01151 return basic_emote(op, params, EMOTE_BURP); 01152 } 01153 01154 int command_chuckle(object *op, char *params) 01155 { 01156 return basic_emote(op, params, EMOTE_CHUCKLE); 01157 } 01158 01159 int command_cough(object *op, char *params) 01160 { 01161 return basic_emote(op, params, EMOTE_COUGH); 01162 } 01163 01164 int command_flip(object *op, char *params) 01165 { 01166 return basic_emote(op, params, EMOTE_FLIP); 01167 } 01168 01169 int command_frown(object *op, char *params) 01170 { 01171 return basic_emote(op, params, EMOTE_FROWN); 01172 } 01173 01174 int command_gasp(object *op, char *params) 01175 { 01176 return basic_emote(op, params, EMOTE_GASP); 01177 } 01178 01179 int command_glare(object *op, char *params) 01180 { 01181 return basic_emote(op, params, EMOTE_GLARE); 01182 } 01183 01184 int command_groan(object *op, char *params) 01185 { 01186 return basic_emote(op, params, EMOTE_GROAN); 01187 } 01188 01189 int command_hiccup(object *op, char *params) 01190 { 01191 return basic_emote(op, params, EMOTE_HICCUP); 01192 } 01193 01194 int command_lick(object *op, char *params) 01195 { 01196 return basic_emote(op, params, EMOTE_LICK); 01197 } 01198 01199 int command_pout(object *op, char *params) 01200 { 01201 return basic_emote(op, params, EMOTE_POUT); 01202 } 01203 01204 int command_shiver(object *op, char *params) 01205 { 01206 return basic_emote(op, params, EMOTE_SHIVER); 01207 } 01208 01209 int command_shrug(object *op, char *params) 01210 { 01211 return basic_emote(op, params, EMOTE_SHRUG); 01212 } 01213 01214 int command_slap(object *op, char *params) 01215 { 01216 return basic_emote(op, params, EMOTE_SLAP); 01217 } 01218 01219 int command_smirk(object *op, char *params) 01220 { 01221 return basic_emote(op, params, EMOTE_SMIRK); 01222 } 01223 01224 int command_snap(object *op, char *params) 01225 { 01226 return basic_emote(op, params, EMOTE_SNAP); 01227 } 01228 01229 int command_sneeze(object *op, char *params) 01230 { 01231 return basic_emote(op, params, EMOTE_SNEEZE); 01232 } 01233 01234 int command_snicker(object *op, char *params) 01235 { 01236 return basic_emote(op, params, EMOTE_SNICKER); 01237 } 01238 01239 int command_sniff(object *op, char *params) 01240 { 01241 return basic_emote(op, params, EMOTE_SNIFF); 01242 } 01243 01244 int command_snore(object *op, char *params) 01245 { 01246 return basic_emote(op, params, EMOTE_SNORE); 01247 } 01248 01249 int command_spit(object *op, char *params) 01250 { 01251 return basic_emote(op, params, EMOTE_SPIT); 01252 } 01253 01254 int command_strut(object *op, char *params) 01255 { 01256 return basic_emote(op, params, EMOTE_STRUT); 01257 } 01258 01259 int command_thank(object *op, char *params) 01260 { 01261 return basic_emote(op, params, EMOTE_THANK); 01262 } 01263 01264 int command_twiddle(object *op, char *params) 01265 { 01266 return basic_emote(op, params, EMOTE_TWIDDLE); 01267 } 01268 01269 int command_wave(object *op, char *params) 01270 { 01271 return basic_emote(op, params, EMOTE_WAVE); 01272 } 01273 01274 int command_whistle(object *op, char *params) 01275 { 01276 return basic_emote(op, params, EMOTE_WHISTLE); 01277 } 01278 01279 int command_wink(object *op, char *params) 01280 { 01281 return basic_emote(op, params, EMOTE_WINK); 01282 } 01283 01284 int command_yawn(object *op, char *params) 01285 { 01286 return basic_emote(op, params, EMOTE_YAWN); 01287 } 01288 01289 int command_beg(object *op, char *params) 01290 { 01291 return basic_emote(op, params, EMOTE_BEG); 01292 } 01293 01294 int command_bleed(object *op, char *params) 01295 { 01296 return basic_emote(op, params, EMOTE_BLEED); 01297 } 01298 01299 int command_cringe(object *op, char *params) 01300 { 01301 return basic_emote(op, params, EMOTE_CRINGE); 01302 } 01303 01304 int command_think(object *op, char *params) 01305 { 01306 return basic_emote(op, params, EMOTE_THINK); 01307 } 01308 01309 int command_me(object *op, char *params) 01310 { 01311 return basic_emote(op, params, EMOTE_ME); 01312 } 01313 01314 int command_stare(object *op, char *params) 01315 { 01316 return basic_emote(op, params, EMOTE_STARE); 01317 } 01318 01319 int command_sneer(object *op, char *params) 01320 { 01321 return basic_emote(op, params, EMOTE_SNEER); 01322 } 01323 01324 int command_wince(object *op, char *params) 01325 { 01326 return basic_emote(op, params, EMOTE_WINCE); 01327 } 01328 01329 int command_facepalm(object *op, char *params) 01330 { 01331 return basic_emote(op, params, EMOTE_FACEPALM); 01332 } 01333 01334 int command_my(object *op, char *params) 01335 { 01336 return basic_emote(op, params, EMOTE_MY); 01337 } 01338
1.7.4