Skip to content

Commit

Permalink
git-svn-id: svn+ssh://50.28.74.132/home/luminari/svn/luminari/myproje…
Browse files Browse the repository at this point in the history
…ct/trunk@3335 dda7f814-ccd3-4591-a6d7-1bd23e5e64af
  • Loading branch information
luminari committed Jan 26, 2016
1 parent be815b0 commit e3f1092
Show file tree
Hide file tree
Showing 3 changed files with 169 additions and 124 deletions.
72 changes: 58 additions & 14 deletions act.comm.c
Original file line number Diff line number Diff line change
Expand Up @@ -475,11 +475,11 @@ ACMD(do_page)
}

/* Generalized communication function by Fred C. Merkel (Torg). */
ACMD(do_gen_comm)
{
ACMD(do_gen_comm) {
struct descriptor_data *i;
char color_on[24];
char buf1[MAX_INPUT_LENGTH], buf2[MAX_INPUT_LENGTH], *msg = NULL;
char buf3[MAX_INPUT_LENGTH];
bool emoting = FALSE;

/* Array of flags which must _not_ be set in order for comm to be heard. */
Expand All @@ -492,15 +492,13 @@ ACMD(do_gen_comm)
PRF_NOGOSS,
0
};

int hist_type[] = {
HIST_HOLLER,
HIST_SHOUT,
HIST_GOSSIP,
HIST_AUCTION,
HIST_GRATS,
};

/* com_msgs: [0] Message if you can't perform the action because of noshout
* [1] name of the action
* [2] message if you're not on the channel
Expand All @@ -510,27 +508,22 @@ ACMD(do_gen_comm)
"holler",
"",
KYEL},

{"You cannot shout!!\r\n",
"shout",
"Turn off your noshout flag first!\r\n",
KYEL},

{"You cannot gossip!!\r\n",
"chat",
"You aren't even on the channel!\r\n",
KYEL},

{"You cannot auction!!\r\n",
"auction",
"You aren't even on the channel!\r\n",
KMAG},

{"You cannot congratulate!\r\n",
"congrat",
"You aren't even on the channel!\r\n",
KGRN},

{"You cannot gossip your emotions!\r\n",
"gossip",
"You aren't even on the channel!\r\n",
Expand All @@ -546,7 +539,6 @@ ACMD(do_gen_comm)
return;
}


if (subcmd == SCMD_GEMOTE) {
if (!*argument)
send_to_char(ch, "Gemote? Yes? Gemote what?\r\n");
Expand Down Expand Up @@ -603,23 +595,75 @@ ACMD(do_gen_comm)
msg = act(buf1, FALSE, ch, 0, 0, TO_CHAR | TO_SLEEP);
add_history(ch, msg, hist_type[subcmd]);
}
if (!emoting)
if (!emoting) {
snprintf(buf1, sizeof(buf1), "$n %ss, '%s'", com_msgs[subcmd][1], argument);
snprintf(buf3, sizeof(buf3), "%s %ss, '%s'", GET_NAME(ch), com_msgs[subcmd][1], argument);
}

/* Now send all the strings out. */
for (i = descriptor_list; i; i = i->next) {

/* not playing, no descriptor or no character associated with descriptor */
if (STATE(i) != CON_PLAYING || i == ch->desc || !i->character )
/* completely unacceptable connection states */
switch (STATE(i)) {
case CON_CLOSE:
case CON_GET_NAME:
case CON_NAME_CNFRM:
case CON_PASSWORD:
case CON_NEWPASSWD:
case CON_CNFPASSWD:
case CON_QSEX:
case CON_QCLASS:
case CON_RMOTD:
case CON_MENU:
case CON_PLR_DESC:
case CON_CHPWD_GETOLD:
case CON_CHPWD_GETNEW:
case CON_CHPWD_VRFY:
case CON_DELCNF1:
case CON_DELCNF2:
case CON_DISCONNECT:
case CON_GET_PROTOCOL:
case CON_QRACE:
case CON_QCLASS_HELP:
case CON_QALIGN:
case CON_QRACE_HELP:
continue;
}

/* no descriptor or no character associated with descriptor */
if (i == ch->desc || !i->character )
continue;

/* have the channel tuned out */
if (!IS_NPC(ch) && (PRF_FLAGGED(i->character, channels[subcmd])))
continue;

/* we want history for the rest of the conditions */
add_history(i->character, buf1, hist_type[subcmd]);
add_history(i->character, buf3, hist_type[subcmd]);

/* states we don't want to send message to, but want history to catch */
switch (STATE(i)) {
case CON_OEDIT:
case CON_REDIT:
case CON_ZEDIT:
case CON_MEDIT:
case CON_SEDIT:
case CON_TEDIT:
case CON_CEDIT:
case CON_AEDIT:
case CON_TRIGEDIT:
case CON_HEDIT:
case CON_QEDIT:
case CON_PREFEDIT:
case CON_IBTEDIT:
case CON_CLANEDIT:
case CON_MSGEDIT:
case CON_STUDY:
case CON_HLQEDIT:
case CON_QSTATS:
continue;
}

/* 'writing' such as study, olc, mud-mail, etc */
if (!IS_NPC(ch) && PLR_FLAGGED(i->character, PLR_WRITING))
continue;
Expand Down
Loading

0 comments on commit e3f1092

Please sign in to comment.