// Returns a tmpstr allocated char* containing an appropriate ANSI // color code for the given target struct creature (tch) with the given // recipient struct creature(ch)'s color settings in mind. const char * get_char_class_color_code(struct creature *ch, struct creature *tch, int char_class) { switch (char_class) { case CLASS_MAGIC_USER: return CCMAG(ch, C_NRM); case CLASS_CLERIC: if (IS_GOOD(tch)) { return CCBLU_BLD(ch, C_NRM); } else if (IS_EVIL(tch)) { return CCRED_BLD(ch, C_NRM); } else { return CCYEL(ch, C_NRM); } case CLASS_KNIGHT: if (IS_GOOD(tch)) { return CCBLU_BLD(ch, C_NRM); } else if (IS_EVIL(tch)) { return CCRED(ch, C_NRM); } else { return CCYEL(ch, C_NRM); } case CLASS_RANGER: return CCGRN(ch, C_NRM); case CLASS_BARB: return CCCYN(ch, C_NRM); case CLASS_THIEF: return CCNRM_BLD(ch, C_NRM); case CLASS_CYBORG: return CCCYN(ch, C_NRM); case CLASS_PSIONIC: return CCMAG(ch, C_NRM); case CLASS_PHYSIC: return CCNRM_BLD(ch, C_NRM); case CLASS_BARD: return CCYEL_BLD(ch, C_NRM); case CLASS_MONK: return CCGRN(ch, C_NRM); case CLASS_MERCENARY: return CCYEL(ch, C_NRM); default: return CCNRM(ch, C_NRM); } }
/* * auction_output : takes two strings and dispenses them to everyone connected * based on if they have color on or not. Note that the buf's are * commonly used *color and *black so I allocate my own buffer. */ void auction_output(char *color, char *black) { char buffer[MAX_STRING_LENGTH]; struct descriptor_data *d; if (!auction.auctioneer) auction.auctioneer = str_dup(DEFAULT_AUCTIONEER); for (d = descriptor_list; d; d = d->next) if (!d->connected && d->character && !PLR_FLAGGED(d->character, PLR_WRITING) && !PRF_FLAGGED(d->character, PRF_NOAUCT) && !ROOM_FLAGGED(d->character->in_room, ROOM_SOUNDPROOF) && !ROOM_FLAGGED(d->character->in_room, ROOM_PRISON)) { sprintf(buffer, "%s%s%s auctions, '%s%s%s'%s\r\n", CCMAG(d->character,C_NRM), auction.auctioneer, CCCYN(d->character,C_NRM), CCNRM(d->character,C_NRM), (COLOR_LEV(d->character) > C_NRM) ? color : black, CCMAG(d->character,C_NRM),CCNRM(d->character,C_NRM)); send_to_char(buffer, d->character); } }