(act_comm.c)
---void talk_channel
before:
actoverride = FALSE;
add:
if ( channel != CHANNEL_GLOSOCIAL && channel != CHANNEL_SCOUTER )
{
CHAN_HISTORY_DATA *history;
CREATE( history, CHAN_HISTORY_DATA, 1 );
history->channel = channel;
history->player = STRALLOC( ch->name );
history->verb = str_dup( verb );
history->text = STRALLOC( argument );
if ( IS_NPC(ch) )
history->invis_level = 0;
else if ( xIS_SET(ch->act, PLR_WIZINVIS) )
history->invis_level = ch->pcdata->wizinvis;
else if ( IS_AFFECTED(ch,AFF_INVISIBLE) )
history->invis_level = LEVEL_IMMORTAL-1;
else
history->invis_level = 0;
history->race = ch->race;
if ( (channel == CHANNEL_CLAN || channel == CHANNEL_ALLY) && !IS_NPC(ch) )
history->clan = ch->pcdata->clan;
else
history->clan = NULL;
LINK( history, first_history, last_history, next, prev );
}
void do_history( CHAR_DATA *ch, char *argument )
{
CHAN_HISTORY_DATA *history, *history_prev;
char arg[MAX_STRING_LENGTH];
char arg2[MAX_STRING_LENGTH];
char buf[MAX_STRING_LENGTH];
int channel, count, count2, num;
if ( !str_cmp(argument,"syntax") )
{
stc( "&YSyntax&w: history <channel name>\n\r", ch );
stc( " history <last # of entries>\n\r", ch );
stc( "\n\rAvailable Channel Names:\n\r", ch );
stc( " newbie, music, ask, answer, swear, ooc, rp, glosocial, clan,\n\r", ch );
stc( " ally, wartalk, racetalk", ch );
if ( get_trust(ch) >= LEVEL_IMMORTAL )
{
if ( get_trust(ch) >= 62 )
stc( ", admin", ch );
if ( get_trust(ch) >= 62 )
stc( ", supervisor", ch );
stc( ", immtalk", ch );
}
stc( "\n\r", ch );
return;
}
argument = one_argument(argument,arg);
argument = one_argument(argument,arg2);
num = 25;
if ( arg[0] == '\0' ) channel = -1;
else if ( !str_cmp( arg, "immtalk" ) ) channel = CHANNEL_IMMTALK;
else if ( !str_cmp( arg, "admin" ) ) channel = CHANNEL_ADMIN;
else if ( !str_cmp( arg, "supervisor" ) ) channel = CHANNEL_SUPERVISOR;
else if ( !str_cmp( arg, "newbie" ) ) channel = CHANNEL_NEWBIE;
else if ( !str_cmp( arg, "music" ) ) channel = CHANNEL_MUSIC;
else if ( !str_cmp( arg, "ask" ) ) channel = CHANNEL_ASK;
else if ( !str_cmp( arg, "answer" ) ) channel = CHANNEL_ANSWER;
else if ( !str_cmp( arg, "swear" ) ) channel = CHANNEL_SWEAR;
else if ( !str_cmp( arg, "ooc" ) ) channel = CHANNEL_OOC;
else if ( !str_cmp( arg, "rp" ) ) channel = CHANNEL_RP;
else if ( !str_cmp( arg, "glosocial" ) ) channel = CHANNEL_GLOSOCIAL;
else if ( !str_cmp( arg, "wartalk" ) ) channel = CHANNEL_WARTALK;
else if ( !str_cmp( arg, "racetalk" ) ) channel = CHANNEL_RACETALK;
else if ( !str_cmp( arg, "clan" ) ) channel = CHANNEL_CLAN;
else if ( !str_cmp( arg, "ally" ) ) channel = CHANNEL_ALLY;
else if ( atoi(arg) > 0 )
{
num = atoi(arg);
channel = -1;
}
else
{
do_history( ch, "syntax" );
return;
}
if ( channel != -1 )
{
if ( argument[0] != '\0' && atoi(arg2) > 0 )
{
num = atoi(arg2);
}
}
count = 1000;
for ( history = last_history; history; history = history_prev )
{
history_prev = history->prev;
if ( --count <= 0 )
{
UNLINK( history, first_history, last_history, next, prev );
if ( history->player )
DISPOSE( history->player );
if ( history->verb )
DISPOSE( history->verb );
if ( history->text )
DISPOSE( history->text );
if ( history->clan )
history->clan = NULL;
DISPOSE( history );
}
}
count = 0;
count2 = 0;
for ( history = first_history; history; history = history->next )
{
if ( history->channel == channel || channel == -1 )
{
if ( history->channel == CHANNEL_RACETALK )
{
if ( history->race != ch->race )
{
if ( !IS_IMMORTAL(ch) )
continue;
if ( argument[0] != '\0' && (get_npc_race(argument) == -1 || history->race != get_npc_race(argument)) )
continue;
}
}
if ( history->channel == CHANNEL_CLAN )
{
if ( !ch->pcdata->clan || (history->clan != ch->pcdata->clan) )
{
if ( !IS_IMMORTAL(ch) )
continue;
if ( argument[0] != '\0' && (get_clan(argument) == NULL || history->clan != get_clan(argument)) )
continue;
}
}
if ( history->channel == CHANNEL_IMMTALK )
{
if ( get_trust(ch) < LEVEL_IMMORTAL )
continue;
}
if ( history->channel == CHANNEL_ADMIN )
{
if ( get_trust(ch) < 64 )
continue;
}
if ( history->channel == CHANNEL_SUPERVISOR )
{
if ( get_trust(ch) < 60 )
continue;
}
if ( history->channel == CHANNEL_ALLY )
{
if ( !ch->pcdata->clan || !history->clan || alliancestatus(ch->pcdata->clan,history->clan) != ALLIANCE_ALLIED )
{
if ( !IS_IMMORTAL(ch) )
continue;
if ( !history->clan || (argument[0] != '\0' && get_clan(argument) != NULL && alliancestatus(get_clan(argument),history$
continue;
}
}
count2++;
}
}
SET_BIT( ch->pcdata->flags, PCFLAG_PAGERON );
pager_printf( ch, "&GChannel History for %s&w:\n\r", channel == -1 ? "All Channels" : strupper(arg) );
for ( history = first_history; history; history = history->next )
{
if ( history->channel == channel || channel == -1 )
{
if ( history->channel == CHANNEL_RACETALK )
{
if ( history->race != ch->race )
{
if ( !IS_IMMORTAL(ch) )
continue;
if ( argument[0] != '\0' && (get_npc_race(argument) == -1 || history->race != get_npc_race(argument)) )
continue;
}
}
if ( history->channel == CHANNEL_CLAN )
{
if ( !ch->pcdata->clan || (history->clan != ch->pcdata->clan) )
{
if ( !IS_IMMORTAL(ch) )
continue;
if ( argument[0] != '\0' && (get_clan(argument) == NULL || history->clan != get_clan(argument)) )
continue;
}
}
if ( history->channel == CHANNEL_IMMTALK )
{
if ( get_trust(ch) < LEVEL_IMMORTAL )
continue;
}
if ( history->channel == CHANNEL_ADMIN )
{
if ( get_trust(ch) < 64 )
continue;
}
if ( history->channel == CHANNEL_SUPERVISOR )
{
if ( get_trust(ch) < 60 )
continue;
}
if ( history->channel == CHANNEL_ALLY )
{
if ( !ch->pcdata->clan || !history->clan || alliancestatus(ch->pcdata->clan,history->clan) != ALLIANCE_ALLIED )
{
if ( !IS_IMMORTAL(ch) )
continue;
if ( !history->clan || (argument[0] != '\0' && get_clan(argument) && alliancestatus(get_clan(argument),history->clan))$
continue;
}
}
count++;
if ( count > (count2-num) )
{
sprintf( buf, "'%s'", history->text );
if ( history->invis_level > get_trust(ch) )
{
pager_printf( ch, "&w[&W%s&w] Invis %s", strupper(history->verb), act_string(buf, NULL, ch, NULL, NULL, STRING_NONE) );
}
else
{
pager_printf( ch, "&w[&W%s&w] %s %s", strupper(history->verb), history->player, act_string(buf, NULL, ch, NULL, NULL, $
}
}
}
}
REMOVE_BIT( ch->pcdata->flags, PCFLAG_PAGERON );
if ( count2 == 0 )
stc( "&wNo history for that channel.\n\r", ch );
return;
}
in mud.h:
after:
typedef struct skill_data SKILL_DATA;
add:
typedef struct chan_history_data CHAN_HISTORY_DATA;
after:
extern PROJECT_DATA * first_project;
extern PROJECT_DATA * last_project;
add:
extern CHAN_HISTORY_DATA * first_history;
extern CHAN_HISTORY_DATA * last_history;
add where all the structs are"
struct chan_history_data
{
CHAN_HISTORY_DATA * next;
CHAN_HISTORY_DATA * prev;
int channel;
char * text;
char * verb;
char * player;
int invis_level;
int race;
CLAN_DATA * clan;
};
in db.c:
after:
PROJECT_DATA * first_project;
PROJECT_DATA * last_project;
add:
CHAN_HISTORY_DATA * first_history;
CHAN_HISTORY_DATA * last_history;
as for the history command you would obviously have to edit it, i didn't feel like stripping out channels i have that other muds dont, plus i don't remember all of the original stock channels anyways, i could guess, but you can do that yourself! This will get you more than the last 8 chats, plus every channel is in the history, immortals can view em all (requires setting of race/clan to view specific chans), and takes invis/imm invis into account.