/* RP AFK Announcements * ******************** * Note, if you already have a PRF_AFK, ignore the parts on adding it to * your PRF flags. You'll also need to look through your code for all * AFK flags that appear and use the afk_aliases[GET_CLASS(ch)] instead * of the AFK to be consistant. Also, this does not include the ways you * can use the afk flag to affect what happens to the character - ie., * if they accept tells, if they flee from agressive mobs, etc. it ONLY * makes it so that when they go afk, you see a message that is more * RP-style, but it provides the framework to begin to do such things. * * Dana Luther * dtluther@mindspring.com */ In structs.h ************* search for the last PRF_ flag and after it add: +#define PRF_AFK (1 << 23) /* Player is AFK */ In constants.c ************** search for the PRF_X constants and add at the end before the "\n": + "AFK", "\n" }; +/* Note = You need one for each class! */ +const char *afk_aliases[]= { + "meditating", /* CLASS_MAGIC_USER */ + "praying", /* CLASS_CLERIC */ + "scheming", /* CLASS_THIEF */ + "planning" /* CLASS_WARRIOR */ +}; In constants.h *************** + extern const char *afk_aliases[]; In interpreter.c ***************** +extern const char *afk_aliases[]; +ACMD(do_afk); then search for the a's in the comand struct and add: + { "afk" , POS_SLEEPING , do_afk , 0, 0}, { "alias" , POS_DEAD , do_alias , 0, 0 }, { "assist" , POS_FIGHTING , do_assist , 1, 0 }, void command_interpreter(struct char_data *ch, char *argument) { int cmd, length; char *line; + /* No sneaking around pretending to be afk */ + if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_AFK)){ + sprintf(buf, "You stop %s.", afk_aliases[GET_CLASS(ch)]); + act(buf, TRUE, ch, 0, 0, TO_CHAR); + sprintf(buf, "$n stops %s.", afk_aliases[GET_CLASS(ch)]); + act(buf, FALSE, ch, 0, 0, TO_ROOM); + REMOVE_BIT(PRF_FLAGS(ch), PRF_AFK); + } ---snip--- In act.other.c ************** after the do_gen_tog stuff, add this: +ACMD(do_afk) +{ + char *roommsg[80], *charmsg[80]; + + if (IS_NPC(ch)) + return; + + if (PRF_TOG_CHK(ch, PRF_AFK)){ + sprintf(charmsg, "You wander away from yourself, %s.", afk_aliases[GET_CLASS(ch)]); + sprintf(roommsg, "$n wanders away from $mself, %s.", afk_aliases[GET_CLASS(ch)]); + } else { + sprintf(charmsg, "You stop %s.", afk_aliases[GET_CLASS(ch)]); + sprintf(roommsg, "$n stops %s.", afk_aliases[GET_CLASS(ch)]); + } + act(charmsg, TRUE, ch, 0, 0, TO_CHAR); + act(roommsg, FALSE, ch, 0, 0, TO_ROOM); + + return; +} In act.informative.c ******************** /* This part is kind of tricky, because who knows what do_who you * have. Just make sure that whatever it is, you includ the PRF_AFK * check for each option you have . */ ACMD(do_who) { ---snip--- (go down to all the PLR_ & PRF_ flags, and at the end add- if (PLR_FLAGGED(tch, PLR_THIEF)) strcat(buf2, " (THIEF)"); if (PLR_FLAGGED(tch, PLR_KILLER)) strcat(buf2, " (KILLER)"); + if (PRF_FLAGGED(tch, PRF_AFK)) + sprintf(buf2 + strlen(buf2), " (%s)", afk_aliases[(GET_CLASS(tch))]); ---snip--- void list_one_char(struct char_data * i, struct char_data * ch) { ---snip--- (again go down to all the PLR_ & PRF_ flags, and at the end add- if (!IS_NPC(i) && !i->desc) strcat(buf, "(linkless)"); if (!IS_NPC(i) && PLR_FLAGGED(i, PLR_WRITING)) strcat(buf, "(writing)"); + if (!IS_NPC(i) && PRF_FLAGGED(i, PRF_AFK)) + sprintf(buf + strlen(buf), "(%s)", afk_aliases[(GET_CLASS(i))]); strcat(buf, "\r\n"); ---snip---