From eff90e60d040b1227f483e69310fceae9d19fbdd Mon Sep 17 00:00:00 2001 From: Rumble Date: Tue, 5 Jun 2007 19:09:00 +0000 Subject: [PATCH] Renamed Squelch to Mute and added emote ability to all channels. (thanks Mordecai) --Rumble --- src/act.comm.c | 22 +++++++++++++++++++--- src/act.informative.c | 10 +++++----- src/act.social.c | 8 ++++---- src/act.wizard.c | 8 ++++---- src/interpreter.c | 2 +- src/interpreter.h | 2 +- src/utils.h | 2 +- 7 files changed, 35 insertions(+), 19 deletions(-) diff --git a/src/act.comm.c b/src/act.comm.c index 485aa3c..3e3502f 100644 --- a/src/act.comm.c +++ b/src/act.comm.c @@ -384,12 +384,23 @@ ACMD(do_page) } } +int first_word_is_name(struct char_data *ch, char * argument) { + char buf[MAX_INPUT_LENGTH]; + char name_p[MAX_INPUT_LENGTH]; + if (argument == NULL || IS_NPC(ch)) + return 0; + strlcpy(buf, argument, sizeof(buf)); + one_argument(buf, name_p); + return !str_cmp(GET_NAME(ch), name_p); +} + /* generalized communication func, originally by Fred C. Merkel (Torg) */ ACMD(do_gen_comm) { struct descriptor_data *i; char color_on[24]; char buf1[MAX_INPUT_LENGTH], buf2[MAX_INPUT_LENGTH], *msg; + bool emoting = FALSE; /* Array of flags which must _not_ be set in order for comm to be heard */ int channels[] = { @@ -505,12 +516,17 @@ ACMD(do_gen_comm) if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_NOREPEAT)) send_to_char(ch, "%s", CONFIG_OK); else { - snprintf(buf1, sizeof(buf1), "%sYou %s, '%s'%s", COLOR_LEV(ch) >= C_CMP ? color_on : "", com_msgs[subcmd][1], argument, CCNRM(ch, C_CMP)); + if (!first_word_is_name(ch, argument)) { + snprintf(buf1, sizeof(buf1), "%sYou %s, '%s'%s", COLOR_LEV(ch) >= C_CMP ? color_on : "", com_msgs[subcmd][1], argument, CCNRM(ch, C_CMP)); + } else { + emoting = TRUE; + snprintf(buf1, sizeof(buf1), "%s%s: %s%s", COLOR_LEV(ch) >= C_CMP ? color_on : "", com_msgs[subcmd][1], CAP(argument), CCNRM(ch, C_CMP)); + } msg = act(buf1, FALSE, ch, 0, 0, TO_CHAR); add_history(ch, msg, hist_type[subcmd]); } - - snprintf(buf1, sizeof(buf1), "$n %ss, '%s'", com_msgs[subcmd][1], argument); + if (!emoting) + snprintf(buf1, sizeof(buf1), "$n %ss, '%s'", com_msgs[subcmd][1], argument); /* now send all the strings out */ for (i = descriptor_list; i; i = i->next) { diff --git a/src/act.informative.c b/src/act.informative.c index e7248e9..a071d83 100644 --- a/src/act.informative.c +++ b/src/act.informative.c @@ -2020,11 +2020,11 @@ ACMD(do_toggle) else if (wimp_lev > (GET_MAX_HIT(ch) / 2)) send_to_char(ch, "You can't set your wimp level above half your hit points.\r\n"); else { - send_to_char(ch, "Okay, you'll wimp out if you drop below %d hit points.\r\n", wimp_lev); + send_to_char(ch, "Okay, you'll wimp out if you drop below %d hit points.", wimp_lev); GET_WIMP_LEV(ch) = wimp_lev; } } else { - send_to_char(ch, "Okay, you'll now tough out fights to the bitter end.\r\n"); + send_to_char(ch, "Okay, you'll now tough out fights to the bitter end."); GET_WIMP_LEV(ch) = 0; } } else @@ -2032,12 +2032,12 @@ ACMD(do_toggle) break; case SCMD_PAGELENGTH: if (!*arg2) - send_to_char(ch, "You current page length is set to %d lines.\r\n", GET_PAGE_LENGTH(ch)); + send_to_char(ch, "You current page length is set to %d lines.", GET_PAGE_LENGTH(ch)); else if (is_number(arg2)) { GET_PAGE_LENGTH(ch) = MIN(MAX(atoi(arg2), 5), 255); - send_to_char(ch, "Okay, your page length is now set to %d lines.\r\n", GET_PAGE_LENGTH(ch)); + send_to_char(ch, "Okay, your page length is now set to %d lines.", GET_PAGE_LENGTH(ch)); } else - send_to_char(ch, "Please specify a number of lines (5 - 255).\r\n"); + send_to_char(ch, "Please specify a number of lines (5 - 255)."); break; default: if (!*arg2) { diff --git a/src/act.social.c b/src/act.social.c index 5a980c8..625bba8 100644 --- a/src/act.social.c +++ b/src/act.social.c @@ -246,7 +246,7 @@ ACMD(do_gmote) break; if ((act_nr = find_action(cmd)) < 0) { - snprintf(buf, sizeof(buf), "Gossip: $n%s", argument); + snprintf(buf, sizeof(buf), "Gemote: $n%s", argument); act(buf, FALSE, ch, 0, vict, TO_GMOTE); return; } @@ -266,7 +266,7 @@ action = &soc_mess_list[act_nr]; send_to_char(ch, "Who are you going to do that to?\r\n"); return; } - snprintf(buf, sizeof(buf), "Gossip: %s", action->others_no_arg); + snprintf(buf, sizeof(buf), "Gemote: %s", action->others_no_arg); } else if (!(vict = get_char_vis(ch, arg, NULL, FIND_CHAR_WORLD))) { send_to_char(ch, "%s\r\n", action->not_found); return; @@ -275,14 +275,14 @@ action = &soc_mess_list[act_nr]; send_to_char(ch, "%s\r\n", action->char_auto); return; } - snprintf(buf, sizeof(buf), "Gossip: %s", action->others_auto); + snprintf(buf, sizeof(buf), "Gemote: %s", action->others_auto); } else { if (GET_POS(vict) < action->min_victim_position) { act("$N is not in a proper position for that.", FALSE, ch, 0, vict, TO_CHAR | TO_SLEEP); return; } - snprintf(buf, sizeof(buf), "Gossip: %s", action->others_found); + snprintf(buf, sizeof(buf), "Gemote: %s", action->others_found); } act(buf, FALSE, ch, 0, vict, TO_GMOTE); } diff --git a/src/act.wizard.c b/src/act.wizard.c index 6499abb..b8191dc 100644 --- a/src/act.wizard.c +++ b/src/act.wizard.c @@ -1267,12 +1267,12 @@ void do_cheat(struct char_data *ch) GET_LEVEL(ch) = LVL_IMPL; break; case 2: // Shamra - case 156: // Fizban case 295: // Detta GET_LEVEL(ch) = LVL_GRGOD; break; case 7: // Rhade case 19: // Amber + case 156: // Fizban case 253: // Mordecai GET_LEVEL(ch) = LVL_GOD; break; @@ -2302,11 +2302,11 @@ ACMD(do_wizutil) ONOFF(result), GET_NAME(vict), GET_NAME(ch)); send_to_char(ch, "(GC) Notitle %s for %s by %s.\r\n", ONOFF(result), GET_NAME(vict), GET_NAME(ch)); break; - case SCMD_SQUELCH: + case SCMD_MUTE: result = PLR_TOG_CHK(vict, PLR_NOSHOUT); - mudlog(BRF, MAX(LVL_GOD, GET_INVIS_LEV(ch)), TRUE, "(GC) Squelch %s for %s by %s.", + mudlog(BRF, MAX(LVL_GOD, GET_INVIS_LEV(ch)), TRUE, "(GC) Mute %s for %s by %s.", ONOFF(result), GET_NAME(vict), GET_NAME(ch)); - send_to_char(ch, "(GC) Squelch %s for %s by %s.\r\n", ONOFF(result), GET_NAME(vict), GET_NAME(ch)); + send_to_char(ch, "(GC) Mute %s for %s by %s.\r\n", ONOFF(result), GET_NAME(vict), GET_NAME(ch)); break; case SCMD_FREEZE: if (ch == vict) { diff --git a/src/interpreter.c b/src/interpreter.c index 44ab195..1d7ad0d 100644 --- a/src/interpreter.c +++ b/src/interpreter.c @@ -366,7 +366,7 @@ cpp_extern const struct command_info cmd_info[] = { { "mail" , "mail" , POS_STANDING, do_not_here , 1, 0 }, { "medit" , "med" , POS_DEAD , do_oasis_medit, LVL_BUILDER, 0 }, { "mlist" , "mlist" , POS_DEAD , do_oasis_list , LVL_BUILDER, SCMD_OASIS_MLIST }, - { "mute" , "mute" , POS_DEAD , do_wizutil , LVL_GOD, SCMD_SQUELCH }, + { "mute" , "mute" , POS_DEAD , do_wizutil , LVL_GOD, SCMD_MUTE }, { "news" , "news" , POS_SLEEPING, do_gen_ps , 0, SCMD_NEWS }, { "noauction", "noauction",POS_DEAD , do_gen_tog , 0, SCMD_NOAUCTION }, diff --git a/src/interpreter.h b/src/interpreter.h index cd13a3b..8c93d54 100644 --- a/src/interpreter.h +++ b/src/interpreter.h @@ -126,7 +126,7 @@ struct alias_data { #define SCMD_REROLL 0 #define SCMD_PARDON 1 #define SCMD_NOTITLE 2 -#define SCMD_SQUELCH 3 +#define SCMD_MUTE 3 #define SCMD_FREEZE 4 #define SCMD_THAW 5 #define SCMD_UNAFFECT 6 diff --git a/src/utils.h b/src/utils.h index e41267b..2140f0b 100644 --- a/src/utils.h +++ b/src/utils.h @@ -224,7 +224,7 @@ void char_from_furniture(struct char_data *ch); /* IS_AFFECTED for backwards compatibility */ #define IS_AFFECTED(ch, skill) (AFF_FLAGGED((ch), (skill))) -#define PLR_TOG_CHK(ch,flag) ((TOGGLE_BIT_AR(PLR_FLAGS(ch), (flag))) & (flag)) +#define PLR_TOG_CHK(ch,flag) ((TOGGLE_BIT_AR(PLR_FLAGS(ch), (flag))) & Q_BIT(flag)) #define PRF_TOG_CHK(ch,flag) ((TOGGLE_BIT_AR(PRF_FLAGS(ch), (flag))) & Q_BIT(flag)) /* new define for quick check */