void gen_board_list(struct board_data *board, struct creature *ch) { PGresult *res; char time_buf[30]; int idx, count; time_t post_time; res = sql_query ("select extract(epoch from post_time), name, subject from board_messages where board='%s' order by idnum desc", tmp_sqlescape(board->name)); count = PQntuples(res); if (count == 0) { send_to_char(ch, "This board is empty.\r\n"); return; } acc_string_clear(); acc_sprintf ("This is a bulletin board. Usage: READ/REMOVE <messg #>, WRITE <header>\r\n%sThere %s %d message%s on the board.%s\r\n", CCGRN(ch, C_NRM), (count == 1) ? "is" : "are", count, (count == 1) ? "" : "s", CCNRM(ch, C_NRM)); for (idx = 0; idx < count; idx++) { post_time = atol(PQgetvalue(res, idx, 0)); strftime(time_buf, 30, "%b %e, %Y", localtime(&post_time)); acc_sprintf("%s%-2d %s:%s %s %-12s :: %s\r\n", CCGRN(ch, C_NRM), count - idx, CCRED(ch, C_NRM), CCNRM(ch, C_NRM), time_buf, tmp_sprintf("(%s)", PQgetvalue(res, idx, 1)), PQgetvalue(res, idx, 2)); } page_string(ch->desc, acc_get_string()); }
/* Set the color string pointers for that which this char will see at color * level NRM. Changing the entries here will change the colour scheme * throughout the OLC. */ void get_char_colors(struct char_data *ch) { nrm = CCNRM(ch, C_NRM); grn = CCGRN(ch, C_NRM); cyn = CCCYN(ch, C_NRM); yel = CCYEL(ch, C_NRM); }
// 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); } }
/* * Set the colour string pointers for that which this char will * see at color level NRM. Changing the entries here will change * the colour scheme throughout the OLC. */ void get_char_cols(CHAR_DATA * ch) { nrm = CCNRM(ch, C_NRM); grn = CCGRN(ch, C_NRM); cyn = CCCYN(ch, C_NRM); yel = CCYEL(ch, C_NRM); iyel = CCIYEL(ch, C_NRM); ired = CCIRED(ch, C_NRM); }