void do_fileio( CHAR_DATA *ch, char *argument ) { FILE_DATA *filedata; char buf[MSL]; int count = 0; pager_printf( ch, " &YFilename &wMode &WOpened &CFunction &OLine\r\n" ); send_to_pager ( "&c------------------------------------------------------------------------------------------\r\n", ch ); if ( !first_filedata ) send_to_pager( "\r\n&RCongrats, &Yyou have no &WOpen &Yfiles!\r\n", ch ); for ( filedata = first_filedata; filedata; filedata = filedata->next ) { sprintf( buf, "&Y%-25.25s &w%-1.1s &W%-20.20s &C%-15.15s &O%-4.4d\r\n", filedata->filename, filedata->mode, filedata->file, filedata->function, filedata->line ); count++; send_to_pager( buf, ch ); } // *Add to the evil* // send_to_pager( "\r\n", ch ); // *Make sure the count is right.* // if ( FilesOpen != count ) { send_to_pager( "&RThats Odd, the FilesOpen and count don't match!!!!", ch ); } return; }
void do_holidays( CHAR_DATA* ch, const char* argument) { HOLIDAY_DATA *day; send_to_pager( "&RHoliday &YMonth &GDay\r\n", ch ); send_to_pager( "&g----------------------+----------------+---------------\r\n", ch ); for( day = first_holiday; day; day = day->next ) pager_printf( ch, "&G%-21s &g%-11s %-2d\r\n", day->name, month_name[day->month - 1], day->day ); return; }
/* updated for the new display type 5/1/02 */ void display_news( CHAR_DATA * ch, NEWS * news, NEWS_TYPE * type ) { pager_printf_color( ch, "\r\n&g--------------------------------------\r\n" ); send_to_pager( type->header, ch ); pager_printf_color( ch, "&g--------------------------------------\r\n" ); send_to_pager( NEWS_HEADER_READ, ch ); pager_printf_color( ch, "&g(&W%2d&g) &W%-12s &%-11s &W%s&g\r\n", news->number, news->name, news->date, news->title ); pager_printf_color( ch, "\r\n" ); if( news->post[0] != '\0' ) send_to_pager( news->post, ch ); else pager_printf_color( ch, "&gNo further information.\r\n" ); pager_printf_color( ch, "&g--------------------------------------\r\n" ); pager_printf_color( ch, "\r\n" ); return; }
void do_classes( CHAR_DATA *ch, char *argument ) { int iClass = 0; int counter = 0; if ( !IS_IMMORTAL( ch ) ) counter = 1; send_to_pager( "\r\n", ch ); for ( iClass = 0; iClass < MAX_PC_CLASS; iClass++ ) { if ( !class_table[iClass] || !VLD_STR( class_table[iClass]->who_name ) ) { if ( IS_IMMORTAL( ch ) ) counter++; continue; } pager_printf( ch, "&c[&C%2d&c]&W %-15s", counter, class_table[iClass]->who_name ); if ( IS_IMMORTAL( ch ) ) pager_printf( ch, " &cStarting:&W%3s &cExpbase:&W %-5d &cPrime: &W%-14s &cMana: &W%2d-%-2d", class_table[iClass]->starting ? "Yes" : "No", class_table[iClass]->exp_base, a_types[class_table[iClass]->attr_prime], class_table[iClass]->mana_min, class_table[iClass]->mana_max ); pager_printf( ch, "&D\r\n" ); counter++; } return; }
/* 1997, Blodkai */ void do_remains( CHAR_DATA* ch, const char* argument) { char buf[MAX_STRING_LENGTH]; OBJ_DATA *obj; bool found = FALSE; if( IS_NPC( ch ) ) return; set_char_color( AT_MAGIC, ch ); if( !ch->pcdata->deity ) { send_to_pager( "You have no deity from which to seek such assistance...\r\n", ch ); return; } if( ch->pcdata->favor < ch->level * 2 ) { send_to_pager( "Your favor is insufficient for such assistance...\r\n", ch ); return; } pager_printf( ch, "%s appears in a vision, revealing that your remains... ", ch->pcdata->deity->name ); snprintf( buf, MAX_STRING_LENGTH, "the corpse of %s", ch->name ); for( obj = first_object; obj; obj = obj->next ) { if( obj->in_room && !str_cmp( buf, obj->short_descr ) && ( obj->pIndexData->vnum == OBJ_VNUM_CORPSE_PC ) ) { found = TRUE; pager_printf( ch, "\r\n - at %s will endure for %d ticks", obj->in_room->name, obj->timer ); } } if( !found ) send_to_pager( " no longer exist.\r\n", ch ); else { send_to_pager( "\r\n", ch ); ch->pcdata->favor -= ch->level * 2; } return; }
void show_colorthemes( CHAR_DATA * ch ) { DIR *dp; struct dirent *dentry; int count = 0, col = 0; send_to_pager( "&YThe following themes are available:\r\n", ch ); dp = opendir( COLOR_DIR ); dentry = readdir( dp ); while( dentry ) { /* * Added by Tarl 3 Dec 02 because we are now using CVS */ if( !str_cmp( dentry->d_name, "CVS" ) ) { dentry = readdir( dp ); continue; } if( dentry->d_name[0] != '.' ) { ++count; pager_printf( ch, "%s%-15.15s", color_str( AT_PLAIN, ch ), dentry->d_name ); if( ++col % 6 == 0 ) send_to_pager( "\r\n", ch ); } dentry = readdir( dp ); } closedir( dp ); if( count == 0 ) send_to_pager( "No themes defined yet.\r\n", ch ); if( col % 6 != 0 ) send_to_pager( "\r\n", ch ); return; }
/* * Print the bans out to the screen. Shaddai */ void show_bans( CHAR_DATA * ch, int type ) { BAN_DATA *pban; int bnum; set_pager_color( AT_IMMORT, ch ); switch ( type ) { case BAN_SITE: send_to_pager( "Banned sites:\r\n", ch ); send_to_pager( "[ #] Warn (Lv) Time By For Site\r\n", ch ); send_to_pager( "---- ---- ---- ------------------------ --------------- ---- ---------------\r\n", ch ); pban = first_ban; set_pager_color( AT_PLAIN, ch ); for( bnum = 1; pban; pban = pban->next, bnum++ ) { pager_printf( ch, "[%2d] %-4s (%2d) %-24s %-15s %4d %c%s%c\r\n", bnum, ( pban->warn ) ? "YES" : "no", pban->level, pban->ban_time, pban->ban_by, pban->duration, ( pban->prefix ) ? '*' : ' ', pban->name, ( pban->suffix ) ? '*' : ' ' ); } return; case BAN_RACE: send_to_pager( "Banned races:\r\n", ch ); send_to_pager( "[ #] Warn (Lv) Time By For Race\r\n", ch ); pban = first_ban_race; break; case BAN_CLASS: send_to_pager( "Banned classes:\r\n", ch ); send_to_pager( "[ #] Warn (Lv) Time By For Class\r\n", ch ); pban = first_ban_class; break; default: bug( "Bad type in show_bans: %d", type ); return; } send_to_pager( "---- ---- ---- ------------------------ --------------- ---- ---------------\r\n", ch ); set_pager_color( AT_PLAIN, ch ); for( bnum = 1; pban; pban = pban->next, bnum++ ) pager_printf( ch, "[%2d] %-4s (%2d) %-24s %-15s %4d %s\r\n", bnum, ( pban->warn ) ? "YES" : "no", pban->level, pban->ban_time, pban->ban_by, pban->duration, pban->name ); return; }
/* * display the news entry from the command hook -Nopey */ void display_news_type( CHAR_DATA * ch, NEWS_TYPE * type, char *argument ) { if( !type->first_news ) { send_to_char_color( "&gThere are currently no news items for this news type.\r\n", ch ); return; } if( argument[0] == '\0' || !str_cmp( argument, "all" ) ) { bool all_news = FALSE; NEWS *news = NULL; int x = type->last_news->number, y = NEWS_VIEW; int skipper = ( x - y ); if( !str_cmp( argument, "all" ) ) all_news = TRUE; pager_printf_color( ch, "\r\n&g--------------------------------------\r\n" ); if( type->header ) send_to_pager( type->header, ch ); pager_printf_color( ch, "&g--------------------------------------\r\n" ); send_to_pager( NEWS_HEADER_ALL, ch ); for( news = type->first_news; news; news = news->next ) { if( !all_news ) { if( skipper > -1 ) { skipper--; continue; } } pager_printf_color( ch, "&g(&W%2d&g) &W%-12s &%-11s &W%s&g\r\n", news->number, news->name, news->date, news->title ); } if( !all_news ) { if( type->last_news->number == 1 ) pager_printf_color( ch, "&g\r\nThere is one news item.\r\n" ); else if( type->last_news->number > NEWS_VIEW - 1 ) pager_printf_color( ch, "\r\n&gThere are &w%d&g total items, the oldest of which are not listed here.\r\nUse '&w%s all&g' to list them all.&g\r\n", type->last_news->number, type->cmd_name ); else pager_printf_color( ch, "\r\n&gThere are &w%d&g total items.\r\n", type->last_news->number ); pager_printf_color( ch, "\r\n&gTo read individual items type '&w%s <number>&g'.\r\n", type->cmd_name ); return; } pager_printf_color( ch, "\r\n&gTo read individual items type '&w%s <number>&g'.\r\n", type->cmd_name ); } { NEWS *news = NULL; if( ( news = grab_news( type, argument ) ) == NULL ) { if( str_cmp( argument, "all" ) ) send_to_char_color( "&g\r\nThat's not a news post number.\r\nUse '&wnews&g' to view them.\r\n", ch ); return; } display_news( ch, news, type ); return; } }
void do_worth( CHAR_DATA* ch, const char* argument) { char buf[MAX_STRING_LENGTH]; char buf2[MAX_STRING_LENGTH]; if( IS_NPC( ch ) ) return; set_pager_color( AT_SCORE, ch ); pager_printf( ch, "\r\nWorth for %s%s.\r\n", ch->name, ch->pcdata->title ); send_to_pager( " ----------------------------------------------------------------------------\r\n", ch ); if( !ch->pcdata->deity ) snprintf( buf, MAX_STRING_LENGTH, "%s", "N/A" ); else if( ch->pcdata->favor > 2250 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "loved" ); else if( ch->pcdata->favor > 2000 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "cherished" ); else if( ch->pcdata->favor > 1750 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "honored" ); else if( ch->pcdata->favor > 1500 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "praised" ); else if( ch->pcdata->favor > 1250 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "favored" ); else if( ch->pcdata->favor > 1000 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "respected" ); else if( ch->pcdata->favor > 750 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "liked" ); else if( ch->pcdata->favor > 250 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "tolerated" ); else if( ch->pcdata->favor > -250 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "ignored" ); else if( ch->pcdata->favor > -750 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "shunned" ); else if( ch->pcdata->favor > -1000 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "disliked" ); else if( ch->pcdata->favor > -1250 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "dishonored" ); else if( ch->pcdata->favor > -1500 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "disowned" ); else if( ch->pcdata->favor > -1750 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "abandoned" ); else if( ch->pcdata->favor > -2000 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "despised" ); else if( ch->pcdata->favor > -2250 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "hated" ); else snprintf( buf, MAX_STRING_LENGTH, "%s", "damned" ); if( ch->level < 10 ) { if( ch->alignment > 900 ) snprintf( buf2, MAX_STRING_LENGTH, "%s", "devout" ); else if( ch->alignment > 700 ) snprintf( buf2, MAX_STRING_LENGTH, "%s", "noble" ); else if( ch->alignment > 350 ) snprintf( buf2, MAX_STRING_LENGTH, "%s", "honorable" ); else if( ch->alignment > 100 ) snprintf( buf2, MAX_STRING_LENGTH, "%s", "worthy" ); else if( ch->alignment > -100 ) snprintf( buf2, MAX_STRING_LENGTH, "%s", "neutral" ); else if( ch->alignment > -350 ) snprintf( buf2, MAX_STRING_LENGTH, "%s", "base" ); else if( ch->alignment > -700 ) snprintf( buf2, MAX_STRING_LENGTH, "%s", "evil" ); else if( ch->alignment > -900 ) snprintf( buf2, MAX_STRING_LENGTH, "%s", "ignoble" ); else snprintf( buf2, MAX_STRING_LENGTH, "%s", "fiendish" ); } else snprintf( buf2, MAX_STRING_LENGTH, "%d", ch->alignment ); pager_printf( ch, "|Level: %-4d |Favor: %-10s |Alignment: %-9s |Experience: %-9d|\r\n", ch->level, buf, buf2, ch->exp ); send_to_pager( " ----------------------------------------------------------------------------\r\n", ch ); switch ( ch->style ) { case STYLE_EVASIVE: snprintf( buf, MAX_STRING_LENGTH, "%s", "evasive" ); break; case STYLE_DEFENSIVE: snprintf( buf, MAX_STRING_LENGTH, "%s", "defensive" ); break; case STYLE_AGGRESSIVE: snprintf( buf, MAX_STRING_LENGTH, "%s", "aggressive" ); break; case STYLE_BERSERK: snprintf( buf, MAX_STRING_LENGTH, "%s", "berserk" ); break; default: snprintf( buf, MAX_STRING_LENGTH, "%s", "standard" ); break; } pager_printf( ch, "|Glory: %-4d |Weight: %-9d |Style: %-13s |Gold: %-14s |\r\n", ch->pcdata->quest_curr, ch->carry_weight, buf, num_punct( ch->gold ) ); send_to_pager( " ----------------------------------------------------------------------------\r\n", ch ); if( ch->level < 15 && !IS_PKILL( ch ) ) pager_printf( ch, "| |Hitroll: -------- |Damroll: ----------- | |\r\n" ); else pager_printf( ch, "| |Hitroll: %-8d |Damroll: %-11d | |\r\n", GET_HITROLL( ch ), GET_DAMROLL( ch ) ); send_to_pager( " ----------------------------------------------------------------------------\r\n", ch ); return; }
/* * New score command by Haus */ void do_score( CHAR_DATA* ch, const char* argument ) { char buf[MAX_STRING_LENGTH]; AFFECT_DATA *paf; int iLang; /*const char *suf; short day; day = ch->pcdata->day + 1; if( day > 4 && day < 20 ) suf = "th"; else if( day % 10 == 1 ) suf = "st"; else if( day % 10 == 2 ) suf = "nd"; else if( day % 10 == 3 ) suf = "rd"; else suf = "th"; * - Uncomment this if you want Birthdays dispayed on score for players - Kayle 1/22/08 */ set_pager_color( AT_SCORE, ch ); pager_printf( ch, "\r\nScore for %s%s.\r\n", ch->name, IS_NPC(ch) ? "" : ch->pcdata->title ); if( get_trust( ch ) != ch->level ) pager_printf( ch, "You are trusted at level %d.\r\n", get_trust( ch ) ); send_to_pager( "----------------------------------------------------------------------------\r\n", ch ); /*if( time_info.day == ch->pcdata->day && time_info.month == ch->pcdata->month ) send_to_char( "Today is your birthday!\r\n", ch ); else ch_printf( ch, "Your birthday is: Day of %s, %d%s day in the Month of %s, in the year %d.\r\n", day_name[ch->pcdata->day % sysdata.daysperweek], day, suf, month_name[ch->pcdata->month], ch->pcdata->year ); send_to_pager( "----------------------------------------------------------------------------\r\n", ch ); * - Uncomment this if you want players to see their birthday's on score. - Kayle 1/22/08 */ pager_printf( ch, "LEVEL: %-3d Race : %-10.10s Played: %ld hours\r\n", ch->level, capitalize( get_race( ch ) ), ( long int )GET_TIME_PLAYED( ch ) ); pager_printf( ch, "YEARS: %-6d Class: %-11.11s Log In: %s\r", calculate_age( ch ), capitalize( get_class( ch ) ), ctime( &( ch->logon ) ) ); if( ch->level >= 15 || IS_PKILL( ch ) ) { pager_printf( ch, "STR : %2.2d(%2.2d) HitRoll: %-4d Saved: %s\r", get_curr_str( ch ), ch->perm_str, GET_HITROLL( ch ), ch->save_time ? ctime( &( ch->save_time ) ) : "no save this session\n" ); pager_printf( ch, "INT : %2.2d(%2.2d) DamRoll: %-4d Time: %s\r", get_curr_int( ch ), ch->perm_int, GET_DAMROLL( ch ), ctime( ¤t_time ) ); } else { pager_printf( ch, "STR : %2.2d(%2.2d) Saved: %s\r", get_curr_str( ch ), ch->perm_str, ch->save_time ? ctime( &( ch->save_time ) ) : "no\n" ); pager_printf( ch, "INT : %2.2d(%2.2d) Time: %s\r", get_curr_int( ch ), ch->perm_int, ctime( ¤t_time ) ); } if( GET_AC( ch ) >= 101 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "the rags of a beggar" ); else if( GET_AC( ch ) >= 80 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "improper for adventure" ); else if( GET_AC( ch ) >= 55 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "shabby and threadbare" ); else if( GET_AC( ch ) >= 40 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "of poor quality" ); else if( GET_AC( ch ) >= 20 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "scant protection" ); else if( GET_AC( ch ) >= 10 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "that of a knave" ); else if( GET_AC( ch ) >= 0 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "moderately crafted" ); else if( GET_AC( ch ) >= -10 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "well crafted" ); else if( GET_AC( ch ) >= -20 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "the envy of squires" ); else if( GET_AC( ch ) >= -40 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "excellently crafted" ); else if( GET_AC( ch ) >= -60 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "the envy of knights" ); else if( GET_AC( ch ) >= -80 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "the envy of barons" ); else if( GET_AC( ch ) >= -100 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "the envy of dukes" ); else if( GET_AC( ch ) >= -200 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "the envy of emperors" ); else snprintf( buf, MAX_STRING_LENGTH, "%s", "that of an avatar" ); if( ch->level > 24 ) pager_printf( ch, "WIS : %2.2d(%2.2d) Armor: %4.4d, %s\r\n", get_curr_wis( ch ), ch->perm_wis, GET_AC( ch ), buf ); else pager_printf( ch, "WIS : %2.2d(%2.2d) Armor: %s \r\n", get_curr_wis( ch ), ch->perm_wis, buf ); if( ch->alignment > 900 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "devout" ); else if( ch->alignment > 700 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "noble" ); else if( ch->alignment > 350 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "honorable" ); else if( ch->alignment > 100 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "worthy" ); else if( ch->alignment > -100 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "neutral" ); else if( ch->alignment > -350 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "base" ); else if( ch->alignment > -700 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "evil" ); else if( ch->alignment > -900 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "ignoble" ); else snprintf( buf, MAX_STRING_LENGTH, "%s", "fiendish" ); if( ch->level < 10 ) pager_printf( ch, "DEX : %2.2d(%2.2d) Align: %-20.20s Items: %5.5d (max %5.5d)\r\n", get_curr_dex( ch ), ch->perm_dex, buf, ch->carry_number, can_carry_n( ch ) ); else pager_printf( ch, "DEX : %2.2d(%2.2d) Align: %+4.4d, %-14.14s Items: %5.5d (max %5.5d)\r\n", get_curr_dex( ch ), ch->perm_dex, ch->alignment, buf, ch->carry_number, can_carry_n( ch ) ); switch ( ch->position ) { case POS_DEAD: snprintf( buf, MAX_STRING_LENGTH, "%s", "slowly decomposing" ); break; case POS_MORTAL: snprintf( buf, MAX_STRING_LENGTH, "%s", "mortally wounded" ); break; case POS_INCAP: snprintf( buf, MAX_STRING_LENGTH, "%s", "incapacitated" ); break; case POS_STUNNED: snprintf( buf, MAX_STRING_LENGTH, "%s", "stunned" ); break; case POS_SLEEPING: snprintf( buf, MAX_STRING_LENGTH, "%s", "sleeping" ); break; case POS_RESTING: snprintf( buf, MAX_STRING_LENGTH, "%s", "resting" ); break; case POS_STANDING: snprintf( buf, MAX_STRING_LENGTH, "%s", "standing" ); break; case POS_FIGHTING: snprintf( buf, MAX_STRING_LENGTH, "%s", "fighting" ); break; case POS_EVASIVE: snprintf( buf, MAX_STRING_LENGTH, "%s", "fighting (evasive)" ); /* Fighting style support -haus */ break; case POS_DEFENSIVE: snprintf( buf, MAX_STRING_LENGTH, "%s", "fighting (defensive)" ); break; case POS_AGGRESSIVE: snprintf( buf, MAX_STRING_LENGTH, "%s", "fighting (aggressive)" ); break; case POS_BERSERK: snprintf( buf, MAX_STRING_LENGTH, "%s", "fighting (berserk)" ); break; case POS_MOUNTED: snprintf( buf, MAX_STRING_LENGTH, "%s", "mounted" ); break; case POS_SITTING: snprintf( buf, MAX_STRING_LENGTH, "%s", "sitting" ); break; } pager_printf( ch, "CON : %2.2d(%2.2d) Pos'n: %-21.21s Weight: %5.5d (max %7.7d)\r\n", get_curr_con( ch ), ch->perm_con, buf, ch->carry_weight, can_carry_w( ch ) ); /* * Fighting style support -haus */ pager_printf( ch, "CHA : %2.2d(%2.2d) Wimpy: %-5d ", get_curr_cha( ch ), ch->perm_cha, ch->wimpy ); switch ( ch->style ) { case STYLE_EVASIVE: snprintf( buf, MAX_STRING_LENGTH, "%s", "evasive" ); break; case STYLE_DEFENSIVE: snprintf( buf, MAX_STRING_LENGTH, "%s", "defensive" ); break; case STYLE_AGGRESSIVE: snprintf( buf, MAX_STRING_LENGTH, "%s", "aggressive" ); break; case STYLE_BERSERK: snprintf( buf, MAX_STRING_LENGTH, "%s", "berserk" ); break; default: snprintf( buf, MAX_STRING_LENGTH, "%s", "standard" ); break; } pager_printf( ch, "Style: %-10.10s\r\n", buf ); pager_printf( ch, "LCK : %2.2d(%2.2d) \r\n", get_curr_lck( ch ), ch->perm_lck ); pager_printf( ch, "Glory: %4.4d(%4.4d) \r\n", ch->pcdata->quest_curr, ch->pcdata->quest_accum ); pager_printf( ch, "PRACT: %3.3d Hitpoints: %-5d of %5d Pager: (%c) %3d AutoExit(%c)\r\n", ch->practice, ch->hit, ch->max_hit, IS_SET( ch->pcdata->flags, PCFLAG_PAGERON ) ? 'X' : ' ', ch->pcdata->pagerlen, xIS_SET( ch->act, PLR_AUTOEXIT ) ? 'X' : ' ' ); if( IS_VAMPIRE( ch ) ) pager_printf( ch, "XP : %-9d Blood: %-5d of %5d MKills: %-5.5d AutoLoot(%c)\r\n", ch->exp, ch->pcdata->condition[COND_BLOODTHIRST], 10 + ch->level, ch->pcdata->mkills, xIS_SET( ch->act, PLR_AUTOLOOT ) ? 'X' : ' ' ); else if( ch->Class == CLASS_WARRIOR ) pager_printf( ch, "XP : %-9d MKills: %-5.5d AutoLoot(%c)\r\n", ch->exp, ch->pcdata->mkills, xIS_SET( ch->act, PLR_AUTOLOOT ) ? 'X' : ' ' ); else pager_printf( ch, "XP : %-9d Mana: %-5d of %5d MKills: %-5.5d AutoLoot(%c)\r\n", ch->exp, ch->mana, ch->max_mana, ch->pcdata->mkills, xIS_SET( ch->act, PLR_AUTOLOOT ) ? 'X' : ' ' ); pager_printf( ch, "GOLD : %-13s Move: %-5d of %5d Mdeaths: %-5.5d AutoSac (%c)\r\n", num_punct( ch->gold ), ch->move, ch->max_move, ch->pcdata->mdeaths, xIS_SET( ch->act, PLR_AUTOSAC ) ? 'X' : ' ' ); if( !IS_NPC( ch ) && ch->pcdata->condition[COND_DRUNK] > 10 ) send_to_pager( "You are drunk.\r\n", ch ); if( !IS_NPC( ch ) && ch->pcdata->condition[COND_THIRST] == 0 ) send_to_pager( "You are in danger of dehydrating.\r\n", ch ); if( !IS_NPC( ch ) && ch->pcdata->condition[COND_FULL] == 0 ) send_to_pager( "You are starving to death.\r\n", ch ); if( ch->position != POS_SLEEPING ) switch ( ch->mental_state / 10 ) { default: send_to_pager( "You're completely messed up!\r\n", ch ); break; case -10: send_to_pager( "You're barely conscious.\r\n", ch ); break; case -9: send_to_pager( "You can barely keep your eyes open.\r\n", ch ); break; case -8: send_to_pager( "You're extremely drowsy.\r\n", ch ); break; case -7: send_to_pager( "You feel very unmotivated.\r\n", ch ); break; case -6: send_to_pager( "You feel sedated.\r\n", ch ); break; case -5: send_to_pager( "You feel sleepy.\r\n", ch ); break; case -4: send_to_pager( "You feel tired.\r\n", ch ); break; case -3: send_to_pager( "You could use a rest.\r\n", ch ); break; case -2: send_to_pager( "You feel a little under the weather.\r\n", ch ); break; case -1: send_to_pager( "You feel fine.\r\n", ch ); break; case 0: send_to_pager( "You feel great.\r\n", ch ); break; case 1: send_to_pager( "You feel energetic.\r\n", ch ); break; case 2: send_to_pager( "Your mind is racing.\r\n", ch ); break; case 3: send_to_pager( "You can't think straight.\r\n", ch ); break; case 4: send_to_pager( "Your mind is going 100 miles an hour.\r\n", ch ); break; case 5: send_to_pager( "You're high as a kite.\r\n", ch ); break; case 6: send_to_pager( "Your mind and body are slipping apart.\r\n", ch ); break; case 7: send_to_pager( "Reality is slipping away.\r\n", ch ); break; case 8: send_to_pager( "You have no idea what is real, and what is not.\r\n", ch ); break; case 9: send_to_pager( "You feel immortal.\r\n", ch ); break; case 10: send_to_pager( "You are a Supreme Entity.\r\n", ch ); break; } else if( ch->mental_state > 45 ) send_to_pager( "Your sleep is filled with strange and vivid dreams.\r\n", ch ); else if( ch->mental_state > 25 ) send_to_pager( "Your sleep is uneasy.\r\n", ch ); else if( ch->mental_state < -35 ) send_to_pager( "You are deep in a much needed sleep.\r\n", ch ); else if( ch->mental_state < -25 ) send_to_pager( "You are in deep slumber.\r\n", ch ); send_to_pager( "Languages: ", ch ); for( iLang = 0; lang_array[iLang] != LANG_UNKNOWN; iLang++ ) if( knows_language( ch, lang_array[iLang], ch ) || ( IS_NPC( ch ) && ch->speaks == 0 ) ) { if( lang_array[iLang] & ch->speaking || ( IS_NPC( ch ) && !ch->speaking ) ) set_pager_color( AT_RED, ch ); send_to_pager( lang_names[iLang], ch ); send_to_pager( " ", ch ); set_pager_color( AT_SCORE, ch ); } send_to_pager( "\r\n", ch ); if( ch->pcdata->bestowments && ch->pcdata->bestowments[0] != '\0' ) pager_printf( ch, "You are bestowed with the command(s): %s.\r\n", ch->pcdata->bestowments ); if( ch->morph && ch->morph->morph ) { send_to_pager( "----------------------------------------------------------------------------\r\n", ch ); if( IS_IMMORTAL( ch ) ) pager_printf( ch, "Morphed as (%d) %s with a timer of %d.\r\n", ch->morph->morph->vnum, ch->morph->morph->short_desc, ch->morph->timer ); else pager_printf( ch, "You are morphed into a %s.\r\n", ch->morph->morph->short_desc ); send_to_pager( "----------------------------------------------------------------------------\r\n", ch ); } if( CAN_PKILL( ch ) ) { send_to_pager( "----------------------------------------------------------------------------\r\n", ch ); pager_printf( ch, "PKILL DATA: Pkills (%3.3d) Illegal Pkills (%3.3d) Pdeaths (%3.3d)\r\n", ch->pcdata->pkills, ch->pcdata->illegal_pk, ch->pcdata->pdeaths ); } if( ch->pcdata->clan && ch->pcdata->clan->clan_type != CLAN_ORDER && ch->pcdata->clan->clan_type != CLAN_GUILD ) { send_to_pager( "----------------------------------------------------------------------------\r\n", ch ); pager_printf( ch, "CLAN STATS: %-14.14s Clan AvPkills : %-5d Clan NonAvpkills : %-5d\r\n", ch->pcdata->clan->name, ch->pcdata->clan->pkills[6], ( ch->pcdata->clan->pkills[1] + ch->pcdata->clan->pkills[2] + ch->pcdata->clan->pkills[3] + ch->pcdata->clan->pkills[4] + ch->pcdata->clan->pkills[5] ) ); pager_printf( ch, " Clan AvPdeaths: %-5d Clan NonAvpdeaths: %-5d\r\n", ch->pcdata->clan->pdeaths[6], ( ch->pcdata->clan->pdeaths[1] + ch->pcdata->clan->pdeaths[2] + ch->pcdata->clan->pdeaths[3] + ch->pcdata->clan->pdeaths[4] + ch->pcdata->clan->pdeaths[5] ) ); } if( ch->pcdata->deity ) { send_to_pager( "----------------------------------------------------------------------------\r\n", ch ); if( ch->pcdata->favor > 2250 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "loved" ); else if( ch->pcdata->favor > 2000 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "cherished" ); else if( ch->pcdata->favor > 1750 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "honored" ); else if( ch->pcdata->favor > 1500 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "praised" ); else if( ch->pcdata->favor > 1250 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "favored" ); else if( ch->pcdata->favor > 1000 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "respected" ); else if( ch->pcdata->favor > 750 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "liked" ); else if( ch->pcdata->favor > 250 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "tolerated" ); else if( ch->pcdata->favor > -250 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "ignored" ); else if( ch->pcdata->favor > -750 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "shunned" ); else if( ch->pcdata->favor > -1000 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "disliked" ); else if( ch->pcdata->favor > -1250 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "dishonored" ); else if( ch->pcdata->favor > -1500 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "disowned" ); else if( ch->pcdata->favor > -1750 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "abandoned" ); else if( ch->pcdata->favor > -2000 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "despised" ); else if( ch->pcdata->favor > -2250 ) snprintf( buf, MAX_STRING_LENGTH, "%s", "hated" ); else snprintf( buf, MAX_STRING_LENGTH, "%s", "damned" ); pager_printf( ch, "Deity: %-20s Favor: %s\r\n", ch->pcdata->deity->name, buf ); } if( ch->pcdata->clan && ch->pcdata->clan->clan_type == CLAN_ORDER ) { send_to_pager( "----------------------------------------------------------------------------\r\n", ch ); pager_printf( ch, "Order: %-20s Order Mkills: %-6d Order MDeaths: %-6d\r\n", ch->pcdata->clan->name, ch->pcdata->clan->mkills, ch->pcdata->clan->mdeaths ); } if( ch->pcdata->clan && ch->pcdata->clan->clan_type == CLAN_GUILD ) { send_to_pager( "----------------------------------------------------------------------------\r\n", ch ); pager_printf( ch, "Guild: %-20s Guild Mkills: %-6d Guild MDeaths: %-6d\r\n", ch->pcdata->clan->name, ch->pcdata->clan->mkills, ch->pcdata->clan->mdeaths ); } if( IS_IMMORTAL( ch ) ) { send_to_pager( "----------------------------------------------------------------------------\r\n", ch ); pager_printf( ch, "IMMORTAL DATA: Wizinvis [%s] Wizlevel (%d)\r\n", xIS_SET( ch->act, PLR_WIZINVIS ) ? "X" : " ", ch->pcdata->wizinvis ); pager_printf( ch, "Bamfin: %s %s\r\n", ch->name, ( ch->pcdata->bamfin[0] != '\0' ) ? ch->pcdata->bamfin : "appears in a swirling mist." ); pager_printf( ch, "Bamfout: %s %s\r\n", ch->name, ( ch->pcdata->bamfout[0] != '\0' ) ? ch->pcdata->bamfout : "leaves in a swirling mist." ); /* * Area Loaded info - Scryn 8/11 */ if( ch->pcdata->area ) { pager_printf( ch, "Vnums: Room (%-5.5d - %-5.5d) Object (%-5.5d - %-5.5d) Mob (%-5.5d - %-5.5d)\r\n", ch->pcdata->area->low_r_vnum, ch->pcdata->area->hi_r_vnum, ch->pcdata->area->low_o_vnum, ch->pcdata->area->hi_o_vnum, ch->pcdata->area->low_m_vnum, ch->pcdata->area->hi_m_vnum ); pager_printf( ch, "Area Loaded [%s]\r\n", ( IS_SET( ch->pcdata->area->status, AREA_LOADED ) ) ? "yes" : "no" ); } } if( ch->first_affect ) { int i; SKILLTYPE *sktmp; i = 0; send_to_pager( "----------------------------------------------------------------------------\r\n", ch ); send_to_pager( "AFFECT DATA: ", ch ); for( paf = ch->first_affect; paf; paf = paf->next ) { if( ( sktmp = get_skilltype( paf->type ) ) == NULL ) continue; if( ch->level < 20 ) { pager_printf( ch, "[%-34.34s] ", sktmp->name ); if( i == 0 ) i = 2; if( ( ++i % 3 ) == 0 ) send_to_pager( "\r\n", ch ); } if( ch->level >= 20 ) { if( paf->modifier == 0 ) pager_printf( ch, "[%-24.24s;%5d rds] ", sktmp->name, paf->duration ); else if( paf->modifier > 999 ) pager_printf( ch, "[%-15.15s; %7.7s;%5d rds] ", sktmp->name, tiny_affect_loc_name( paf->location ), paf->duration ); else pager_printf( ch, "[%-11.11s;%+-3.3d %7.7s;%5d rds] ", sktmp->name, paf->modifier, tiny_affect_loc_name( paf->location ), paf->duration ); if( i == 0 ) i = 1; if( ( ++i % 2 ) == 0 ) send_to_pager( "\r\n", ch ); } } } send_to_pager( "\r\n", ch ); return; }
void do_color( CHAR_DATA* ch, const char* argument) { bool dMatch, cMatch; short count = 0, y = 0; int x; char arg[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH]; char log_buf[MAX_STRING_LENGTH]; dMatch = FALSE; cMatch = FALSE; if( IS_NPC( ch ) ) { send_to_pager( "Only PC's can change colors.\r\n", ch ); return; } if( !argument || argument[0] == '\0' ) { show_colors( ch ); return; } argument = one_argument( argument, arg ); if( !str_cmp( arg, "savetheme" ) && IS_IMMORTAL( ch ) ) { FILE *fp; char filename[256]; if( !argument || argument[0] == '\0' ) { send_to_char( "You must specify a name for this theme to save it.\r\n", ch ); return; } if( strstr( argument, "." ) || strstr( argument, "/" ) || strstr( argument, "\\" ) ) { send_to_char( "Invalid theme name.\r\n", ch ); return; } snprintf( filename, sizeof( filename ), "%s%s", COLOR_DIR, argument ); if( !( fp = fopen( filename, "w" ) ) ) { ch_printf( ch, "Unable to write to color file %s\r\n", filename ); return; } fprintf( fp, "%s", "#COLORTHEME\n" ); fprintf( fp, "Name %s~\n", argument ); fprintf( fp, "MaxColors %d\n", MAX_COLORS ); fprintf( fp, "%s", "Colors " ); for( x = 0; x < MAX_COLORS; ++x ) fprintf( fp, " %d", ch->colors[x] ); fprintf( fp, "%s", "\nEnd\n" ); fclose( fp ); fp = NULL; ch_printf( ch, "Color theme %s saved.\r\n", argument ); return; } if( !str_cmp( arg, "theme" ) ) { FILE *fp; char filename[256]; int max_colors = 0; if( !argument || argument[0] == '\0' ) { show_colorthemes( ch ); return; } if( strstr( argument, "." ) || strstr( argument, "/" ) || strstr( argument, "\\" ) ) { send_to_char( "Invalid theme.\r\n", ch ); return; } snprintf( filename, sizeof( filename ), "%s%s", COLOR_DIR, argument ); if( !( fp = fopen( filename, "r" ) ) ) { ch_printf( ch, "There is no theme called %s.\r\n", argument ); return; } while( !feof( fp ) ) { char *word = fread_word( fp ); if( !str_cmp( word, "MaxColors" ) ) { int temp = fread_number( fp ); max_colors = UMIN( temp, MAX_COLORS ); continue; } if( !str_cmp( word, "Colors" ) ) { for( x = 0; x < max_colors; ++x ) ch->colors[x] = fread_number( fp ); fread_to_eol( fp ); continue; } if( !str_cmp( word, "End" ) ) { fclose( fp ); fp = NULL; ch_printf( ch, "Color theme has been changed to %s.\r\n", argument ); save_char_obj( ch ); return; } } fclose( fp ); fp = NULL; ch_printf( ch, "An error occured while trying to set color theme %s.\r\n", argument ); return; } if( !str_cmp( arg, "ansitest" ) ) { snprintf( log_buf, MAX_STRING_LENGTH, "%sBlack\r\n", ANSI_BLACK ); write_to_buffer( ch->desc, log_buf, 0 ); snprintf( log_buf, MAX_STRING_LENGTH, "%sDark Red\r\n", ANSI_DRED ); write_to_buffer( ch->desc, log_buf, 0 ); snprintf( log_buf, MAX_STRING_LENGTH, "%sDark Green\r\n", ANSI_DGREEN ); write_to_buffer( ch->desc, log_buf, 0 ); snprintf( log_buf, MAX_STRING_LENGTH, "%sOrange/Brown\r\n", ANSI_ORANGE ); write_to_buffer( ch->desc, log_buf, 0 ); snprintf( log_buf, MAX_STRING_LENGTH, "%sDark Blue\r\n", ANSI_DBLUE ); write_to_buffer( ch->desc, log_buf, 0 ); snprintf( log_buf, MAX_STRING_LENGTH, "%sPurple\r\n", ANSI_PURPLE ); write_to_buffer( ch->desc, log_buf, 0 ); snprintf( log_buf, MAX_STRING_LENGTH, "%sCyan\r\n", ANSI_CYAN ); write_to_buffer( ch->desc, log_buf, 0 ); snprintf( log_buf, MAX_STRING_LENGTH, "%sGrey\r\n", ANSI_GREY ); write_to_buffer( ch->desc, log_buf, 0 ); snprintf( log_buf, MAX_STRING_LENGTH, "%sDark Grey\r\n", ANSI_DGREY ); write_to_buffer( ch->desc, log_buf, 0 ); snprintf( log_buf, MAX_STRING_LENGTH, "%sRed\r\n", ANSI_RED ); write_to_buffer( ch->desc, log_buf, 0 ); snprintf( log_buf, MAX_STRING_LENGTH, "%sGreen\r\n", ANSI_GREEN ); write_to_buffer( ch->desc, log_buf, 0 ); snprintf( log_buf, MAX_STRING_LENGTH, "%sYellow\r\n", ANSI_YELLOW ); write_to_buffer( ch->desc, log_buf, 0 ); snprintf( log_buf, MAX_STRING_LENGTH, "%sBlue\r\n", ANSI_BLUE ); write_to_buffer( ch->desc, log_buf, 0 ); snprintf( log_buf, MAX_STRING_LENGTH, "%sPink\r\n", ANSI_PINK ); write_to_buffer( ch->desc, log_buf, 0 ); snprintf( log_buf, MAX_STRING_LENGTH, "%sLight Blue\r\n", ANSI_LBLUE ); write_to_buffer( ch->desc, log_buf, 0 ); snprintf( log_buf, MAX_STRING_LENGTH, "%sWhite\r\n", ANSI_WHITE ); write_to_buffer( ch->desc, log_buf, 0 ); snprintf( log_buf, MAX_STRING_LENGTH, "%sBlack\r\n", BLINK_BLACK ); write_to_buffer( ch->desc, log_buf, 0 ); snprintf( log_buf, MAX_STRING_LENGTH, "%sDark Red\r\n", BLINK_DRED ); write_to_buffer( ch->desc, log_buf, 0 ); snprintf( log_buf, MAX_STRING_LENGTH, "%sDark Green\r\n", BLINK_DGREEN ); write_to_buffer( ch->desc, log_buf, 0 ); snprintf( log_buf, MAX_STRING_LENGTH, "%sOrange/Brown\r\n", BLINK_ORANGE ); write_to_buffer( ch->desc, log_buf, 0 ); snprintf( log_buf, MAX_STRING_LENGTH, "%sDark Blue\r\n", BLINK_DBLUE ); write_to_buffer( ch->desc, log_buf, 0 ); snprintf( log_buf, MAX_STRING_LENGTH, "%sPurple\r\n", BLINK_PURPLE ); write_to_buffer( ch->desc, log_buf, 0 ); snprintf( log_buf, MAX_STRING_LENGTH, "%sCyan\r\n", BLINK_CYAN ); write_to_buffer( ch->desc, log_buf, 0 ); snprintf( log_buf, MAX_STRING_LENGTH, "%sGrey\r\n", BLINK_GREY ); write_to_buffer( ch->desc, log_buf, 0 ); snprintf( log_buf, MAX_STRING_LENGTH, "%sDark Grey\r\n", BLINK_DGREY ); write_to_buffer( ch->desc, log_buf, 0 ); snprintf( log_buf, MAX_STRING_LENGTH, "%sRed\r\n", BLINK_RED ); write_to_buffer( ch->desc, log_buf, 0 ); snprintf( log_buf, MAX_STRING_LENGTH, "%sGreen\r\n", BLINK_GREEN ); write_to_buffer( ch->desc, log_buf, 0 ); snprintf( log_buf, MAX_STRING_LENGTH, "%sYellow\r\n", BLINK_YELLOW ); write_to_buffer( ch->desc, log_buf, 0 ); snprintf( log_buf, MAX_STRING_LENGTH, "%sBlue\r\n", BLINK_BLUE ); write_to_buffer( ch->desc, log_buf, 0 ); snprintf( log_buf, MAX_STRING_LENGTH, "%sPink\r\n", BLINK_PINK ); write_to_buffer( ch->desc, log_buf, 0 ); snprintf( log_buf, MAX_STRING_LENGTH, "%sLight Blue\r\n", BLINK_LBLUE ); write_to_buffer( ch->desc, log_buf, 0 ); snprintf( log_buf, MAX_STRING_LENGTH, "%sWhite\r\n", BLINK_WHITE ); write_to_buffer( ch->desc, log_buf, 0 ); write_to_buffer( ch->desc, ANSI_RESET, 0 ); snprintf( log_buf, MAX_STRING_LENGTH, "%s%sBlack\r\n", ANSI_WHITE, BACK_BLACK ); write_to_buffer( ch->desc, log_buf, 0 ); snprintf( log_buf, MAX_STRING_LENGTH, "%s%sDark Red\r\n", ANSI_BLACK, BACK_DRED ); write_to_buffer( ch->desc, log_buf, 0 ); snprintf( log_buf, MAX_STRING_LENGTH, "%s%sDark Green\r\n", ANSI_BLACK, BACK_DGREEN ); write_to_buffer( ch->desc, log_buf, 0 ); snprintf( log_buf, MAX_STRING_LENGTH, "%s%sOrange/Brown\r\n", ANSI_BLACK, BACK_ORANGE ); write_to_buffer( ch->desc, log_buf, 0 ); snprintf( log_buf, MAX_STRING_LENGTH, "%s%sDark Blue\r\n", ANSI_BLACK, BACK_DBLUE ); write_to_buffer( ch->desc, log_buf, 0 ); snprintf( log_buf, MAX_STRING_LENGTH, "%s%sPurple\r\n", ANSI_BLACK, BACK_PURPLE ); write_to_buffer( ch->desc, log_buf, 0 ); snprintf( log_buf, MAX_STRING_LENGTH, "%s%sCyan\r\n", ANSI_BLACK, BACK_CYAN ); write_to_buffer( ch->desc, log_buf, 0 ); snprintf( log_buf, MAX_STRING_LENGTH, "%s%sGrey\r\n", ANSI_BLACK, BACK_GREY ); write_to_buffer( ch->desc, log_buf, 0 ); snprintf( log_buf, MAX_STRING_LENGTH, "%s%sDark Grey Background\r\n", ANSI_BLACK, BACK_DGREY ); write_to_buffer( ch->desc, log_buf, 0 ); snprintf( log_buf, MAX_STRING_LENGTH, "%s%sRed Background\r\n", ANSI_BLACK, BACK_RED ); write_to_buffer( ch->desc, log_buf, 0 ); snprintf( log_buf, MAX_STRING_LENGTH, "%s%sGreen Background\r\n", ANSI_BLACK, BACK_GREEN ); write_to_buffer( ch->desc, log_buf, 0 ); snprintf( log_buf, MAX_STRING_LENGTH, "%s%sYellow Background\r\n", ANSI_BLACK, BACK_YELLOW ); write_to_buffer( ch->desc, log_buf, 0 ); snprintf( log_buf, MAX_STRING_LENGTH, "%s%sBlue Background\r\n", ANSI_BLACK, BACK_BLUE ); write_to_buffer( ch->desc, log_buf, 0 ); snprintf( log_buf, MAX_STRING_LENGTH, "%s%sPink Background\r\n", ANSI_BLACK, BACK_PINK ); write_to_buffer( ch->desc, log_buf, 0 ); snprintf( log_buf, MAX_STRING_LENGTH, "%s%sLight Blue Background\r\n", ANSI_BLACK, BACK_LBLUE ); write_to_buffer( ch->desc, log_buf, 0 ); snprintf( log_buf, MAX_STRING_LENGTH, "%s%sWhite Background\r\n", ANSI_BLACK, BACK_WHITE ); write_to_buffer( ch->desc, log_buf, 0 ); snprintf( log_buf, MAX_STRING_LENGTH, "%s%sItalics%s\r\n", ANSI_GREY, ANSI_ITALIC, ANSI_RESET ); write_to_buffer( ch->desc, log_buf, 0 ); snprintf( log_buf, MAX_STRING_LENGTH, "%sStrikeout%s\r\n", ANSI_STRIKEOUT, ANSI_RESET ); write_to_buffer( ch->desc, log_buf, 0 ); snprintf( log_buf, MAX_STRING_LENGTH, "%sUnderline\r\n", ANSI_UNDERLINE ); write_to_buffer( ch->desc, log_buf, 0 ); write_to_buffer( ch->desc, ANSI_RESET, 0 ); return; } if( !str_prefix( arg, "_reset_" ) ) { reset_colors( ch ); send_to_pager( "All color types reset to default colors.\r\n", ch ); return; } argument = one_argument( argument, arg2 ); if( arg[0] == '\0' ) { send_to_char( "Change which color type?\r\n", ch ); return; } if( !str_prefix( arg, "_all_" ) ) { dMatch = TRUE; count = -1; /* * search for a valid color setting */ for( y = 0; y < 16; y++ ) { if( !str_cmp( arg2, valid_color[y] ) ) { cMatch = TRUE; break; } } } else if( arg2[0] == '\0' ) cMatch = FALSE; else { /* * search for the display type and str_cmp */ for( count = 0; count < MAX_COLORS; count++ ) { if( !str_prefix( arg, pc_displays[count] ) ) { dMatch = TRUE; break; } } if( !dMatch ) { ch_printf( ch, "%s is an invalid color type.\r\n", arg ); send_to_char( "Type color with no arguments to see available options.\r\n", ch ); return; } if( !str_cmp( arg2, "default" ) ) { ch->colors[count] = default_set[count]; ch_printf( ch, "Display %s set back to default.\r\n", pc_displays[count] ); return; } /* * search for a valid color setting */ for( y = 0; y < 16; y++ ) { if( !str_cmp( arg2, valid_color[y] ) ) { cMatch = TRUE; break; } } } if( !cMatch ) { if( arg[0] ) ch_printf( ch, "Invalid color for type %s.\n", arg ); else send_to_pager( "Invalid color.\r\n", ch ); send_to_pager( "Choices are:\r\n", ch ); for( count = 0; count < 16; count++ ) { if( count % 5 == 0 && count != 0 ) send_to_pager( "\r\n", ch ); pager_printf( ch, "%-10s", valid_color[count] ); } pager_printf( ch, "%-10s\r\n", "default" ); return; } else pager_printf( ch, "Color type %s set to color %s.\r\n", count == -1 ? "_all_" : pc_displays[count], valid_color[y] ); if( !str_cmp( argument, "blink" ) ) y += AT_BLINK; if( count == -1 ) { int ccount; for( ccount = 0; ccount < MAX_COLORS; ++ccount ) ch->colors[ccount] = y; set_pager_color( y, ch ); pager_printf( ch, "All color types set to color %s%s.%s\r\n", valid_color[y > AT_BLINK ? y - AT_BLINK : y], y > AT_BLINK ? " [BLINKING]" : "", ANSI_RESET ); } else { ch->colors[count] = y; set_pager_color( count, ch ); if( !str_cmp( argument, "blink" ) ) ch_printf( ch, "Display %s set to color %s [BLINKING]%s\r\n", pc_displays[count], valid_color[y - AT_BLINK], ANSI_RESET ); else ch_printf( ch, "Display %s set to color %s.\r\n", pc_displays[count], valid_color[y] ); } return; }
void show_colors( CHAR_DATA * ch ) { short count; send_to_pager( "&BSyntax: color [color type] [color] | default\r\n", ch ); send_to_pager( "&BSyntax: color _reset_ (Resets all colors to default set)\r\n", ch ); send_to_pager( "&BSyntax: color _all_ [color] (Sets all color types to [color])\r\n\r\n", ch ); send_to_pager( "&BSyntax: color theme [name] (Sets all color types to a defined theme)\r\n\r\n", ch ); send_to_pager( "&W********************************[ COLORS ]*********************************\r\n", ch ); for( count = 0; count < 16; ++count ) { if( ( count % 8 ) == 0 && count != 0 ) { send_to_pager( "\r\n", ch ); } pager_printf( ch, "%s%-10s", color_str( count, ch ), pc_displays[count] ); } send_to_pager( "\r\n\r\n&W******************************[ COLOR TYPES ]******************************\r\n", ch ); for( count = 32; count < MAX_COLORS; ++count ) { if( ( count % 8 ) == 0 && count != 32 ) { send_to_pager( "\r\n", ch ); } pager_printf( ch, "%s%-10s%s", color_str( count, ch ), pc_displays[count], ANSI_RESET ); } send_to_pager( "\r\n\r\n", ch ); send_to_pager( "&YAvailable colors are:\r\n", ch ); for( count = 0; valid_color[count][0] != '\0'; ++count ) { if( ( count % 8 ) == 0 && count != 0 ) send_to_pager( "\r\n", ch ); pager_printf( ch, "%s%-10s", color_str( AT_PLAIN, ch ), valid_color[count] ); } send_to_pager( "\r\n", ch ); show_colorthemes( ch ); return; }
int gaso_level(CHAR_DATA * ch, int level) { char buf[MAX_STRING_LENGTH], buf2[MAX_STRING_LENGTH]; int count, type, gcount, i; GASO_STRUCT stats[MAX_ITEM_TYPE+1]; /* duh */ OBJ_DATA *obj; double dcount; count = 0; gcount = 0; for(type=0;type<=MAX_ITEM_TYPE;type++){ stats[type].weight = stats[type].cost = stats[type].count = 0; stats[type].value[0] = 0; stats[type].value[1] = 0; stats[type].value[2] = 0; stats[type].value[3] = 0; stats[type].value[4] = 0; stats[type].value[5] = 0; for(i=0;i<32;i++){ stats[type].extra_flags[i]=0; } } for ( obj = first_object; obj; obj = obj->next ){ if(obj->level==level){ count++; stats[obj->item_type].count++; stats[obj->item_type].weight+=obj->weight; stats[obj->item_type].cost+=obj->cost; stats[obj->item_type].value[0]+=obj->value[0]; stats[obj->item_type].value[1]+=obj->value[1]; stats[obj->item_type].value[2]+=obj->value[2]; stats[obj->item_type].value[3]+=obj->value[3]; stats[obj->item_type].value[4]+=obj->value[4]; stats[obj->item_type].value[5]+=obj->value[5]; for(i=0;i<32;i++){ if(xIS_SET(obj->pIndexData->extra_flags, i)) stats[obj->item_type].extra_flags[i]++; } } gcount++; } if(count==0){ /* send_to_pager("No objects in this range.\n\r",ch); */ return(0); } for(type=0;type<=MAX_ITEM_TYPE;type++){ if(stats[type].count!=0){ #define TODUB(x) ( (double)(1.0 * x) ) dcount= TODUB(stats[type].count); sprintf(buf,"%d,%d,%d,%2.2f,%2.2f,%2.2f,%2.2f,%2.2f,%2.2f,%2.2f,%2.2f,%2.2f", level, type, stats[type].count, (double) (100.0 * (dcount/TODUB(count))), /* %-age of objs at this level */ (double) (TODUB(stats[type].weight) /dcount), /* average weight of this item_type for lev*/ (double) (TODUB(stats[type].cost) /dcount), /* average cost of this item_type for lev*/ (double) (TODUB(stats[type].value[0]) /dcount), (double) (TODUB(stats[type].value[1]) /dcount), (double) (TODUB(stats[type].value[2]) /dcount), (double) (TODUB(stats[type].value[3]) /dcount), (double) (TODUB(stats[type].value[4]) /dcount), (double) (TODUB(stats[type].value[5]) /dcount) ); for(i=0;i<32;i++){ sprintf(buf2,",%2.2f", (double) (TODUB(stats[type].extra_flags[i]) /dcount) ); strcat(buf,buf2); } strcat(buf,"\n\r"); send_to_pager(buf,ch); } } #undef TODUB(x) return count; }
/* Display class information -Thoric */ void do_showclass( CHAR_DATA *ch, char *argument ) { char arg1[MIL], arg2[MIL]; struct class_type *Class; int cl, low, hi, ct, i; set_pager_color( AT_PLAIN, ch ); argument = one_argument( argument, arg1 ); argument = one_argument( argument, arg2 ); if ( !VLD_STR( arg1 ) ) { do_classes( ch, ( char * ) "" ); send_to_char( "Syntax: showclass <class> [level range]\r\n", ch ); return; } if ( is_number( arg1 ) && ( cl = atoi( arg1 ) ) >= 0 && cl < MAX_CLASS ) Class = class_table[cl]; else { Class = NULL; for ( cl = 0; cl < MAX_CLASS && class_table[cl]; cl++ ) if ( !str_cmp( class_table[cl]->who_name, arg1 ) ) { Class = class_table[cl]; break; } } if ( !Class ) { send_to_char( "No such class.\r\n", ch ); return; } pager_printf( ch, "&wCLASS: &W%s\r\n&w", VLD_STR( Class->who_name ) ? Class->who_name : "(Not set)" ); pager_printf( ch, "&wFilename: &W%s\r\n&w", VLD_STR( Class->filename ) ? Class->filename : "(Not set)" ); pager_printf( ch, "&wPrime Attribute: &W%-14s\r\n", a_types[Class->attr_prime] ); pager_printf( ch, "&wSecond Attribute: &W%-14s\r\n", a_types[Class->attr_second] ); pager_printf( ch, "&wDeficient Attribute: &W%-14s\r\n", a_types[Class->attr_deficient] ); ct = 0; send_to_pager( "&wDisallowed Races:&W\r\n", ch ); for ( i = 0; i < MAX_RACE; i++ ) { if ( IS_SET( Class->race_restriction, 1 << i ) ) { ct++; pager_printf( ch, "%10s ", race_table[i]->race_name ); if ( ct % 6 == 0 ) send_to_pager( "\r\n", ch ); } } if ( ( ct % 6 != 0 ) || ( ct == 0 ) ) send_to_pager( "\r\n", ch ); ct = 0; send_to_pager( "&wAllowed Races:&W\r\n", ch ); for ( i = 0; i < MAX_RACE; i++ ) { if ( !IS_SET( Class->race_restriction, 1 << i ) ) { ct++; pager_printf( ch, "%10s ", race_table[i]->race_name ); if ( ct % 6 == 0 ) send_to_pager( "\r\n", ch ); } } // Added in combo restrictions by: Taon... /* if((ct % 6 != 0) || (ct == 0)) send_to_pager("\r\n", ch); ct = 0; send_to_pager("&wAllowed combos:&W\r\n", ch); for(i = 0; i < MAX_CLASS; i++) { ct++; if(!IS_SET(Class->combo_restriction, 1 << i)) { pager_printf(ch, "%10s ", class_table[i]->who_name); send_to_pager("\r\n", ch); } } if((ct % 6 != 0) || (ct == 0)) send_to_pager("\r\n", ch); ct = 0; send_to_pager("&wNot Allowed combos:&W\r\n", ch); for(i = 0; i < MAX_CLASS; i++) { ct++; if(IS_SET(Class->combo_restriction, 1 << i)) { pager_printf(ch, "%10s ", class_table[i]->who_name); send_to_pager("\r\n", ch); } } */ send_to_char( "\r\n", ch ); pager_printf( ch, "&wMax Skill Adept: &W%-3d &wThac0 : &W%-5d &wThac32: &W%d\r\n", Class->skill_adept, Class->thac0_00, Class->thac0_32 ); pager_printf( ch, "&wHp Min/Hp Max : &W%-2d/%-2d &wMana Min/Max: &W%-2d/%-2d &wExpBase: &W%d\r\n", Class->hp_min, Class->hp_max, Class->mana_min, Class->mana_max, Class->exp_base ); pager_printf( ch, "&W%s &wClass\r\n", Class->starting ? "Starting" : "Non-Starting" ); pager_printf( ch, "&wAffected by: &W%s\r\n", !xIS_EMPTY( Class->affected ) ? ext_flag_string( &Class->affected, a_flags ) : "Nothing" ); pager_printf( ch, "&wResistant to: &W%s\r\n", flag_string( Class->resist, ris_flags ) ); pager_printf( ch, "&wSusceptible to: &W%s\r\n", flag_string( Class->suscept, ris_flags ) ); pager_printf( ch, "&wCrafting Base: &W%d\r\n", Class->craft_base ); /* * These are no longer in use. -Taon if(Class->reclass1 > 0) pager_printf(ch, "%s ", * class_table[class->reclass1]->who_name); if(Class->reclass2 > 0) pager_printf(ch, * "%s ", class_table[class->reclass2]->who_name); if(Class->reclass3 > 0) * pager_printf(ch, "%s ", class_table[class->reclass3]->who_name); * send_to_pager("\r\n", ch); */ /* if(VLD_STR(arg2)) { int x, y, cnt; low = UMAX(0, atoi(arg2)); hi = URANGE(low, atoi(argument), MAX_LEVEL); for(x = low; x <= hi; x++) { set_pager_color(AT_LBLUE, ch); pager_printf(ch, "Male: %-30s Female: %s\r\n", title_table[cl][x][0], title_table[cl][x][1]); cnt = 0; set_pager_color(AT_BLUE, ch); for(y = gsn_first_spell; y < gsn_top_sn; y++) if(skill_table[y]->skill_level[cl] == x) { pager_printf(ch, " %-7s %-19s%3d ", skill_tname[skill_table[y]->type], skill_table[y]->name, skill_table[y]->skill_adept[cl]); if(++cnt % 2 == 0) send_to_pager("\r\n", ch); if(cnt % 2 != 0) send_to_pager("\r\n", ch); send_to_pager("\r\n", ch); } } } */ if ( arg2 && arg2[0] != '\0' ) { int x, y, cnt; low = UMAX( 0, atoi( arg2 ) ); hi = URANGE( low, atoi( argument ), MAX_LEVEL ); for ( x = low; x <= hi; x++ ) { pager_printf( ch, "&wMale: &W%-30s &wFemale: &W%s\r\n", title_table[cl][x][0], title_table[cl][x][1] ); cnt = 0; for ( y = gsn_first_spell; y < gsn_top_sn; y++ ) if ( skill_table[y]->skill_level[cl] == x ) { pager_printf( ch, " &[skill]%-7s %-19s%3d ", skill_tname[skill_table[y]->type], skill_table[y]->name, skill_table[y]->skill_adept[cl] ); if ( ++cnt % 2 == 0 ) send_to_pager( "\r\n", ch ); } if ( cnt % 2 != 0 ) send_to_pager( "\r\n", ch ); send_to_pager( "\r\n", ch ); } } return; }
void do_disable( CHAR_DATA * ch, char *argument ) { DISABLED_DATA *disabled; CMDTYPE *cmd; if( IS_NPC( ch ) ) { send_to_char( "Hi, I'm sorry but npcs can't use this command!\r\n", ch ); return; } if( argument == NULL || argument[0] == '\0' ) { char buf[MIL]; if( !first_disabled ) { send_to_char( "No commands are disabled.\r\n", ch ); return; } sprintf( buf, "Disabled commands:\r\n%-10s %5s %-15s\r\n", "Command", "Level", "Who Disabled" ); for( disabled = first_disabled; disabled; disabled = disabled->next ) { sprintf( buf + strlen( buf ), "%-10s %5d %-15s\r\n", disabled->command->name, disabled->level, disabled->who ); } send_to_pager( buf, ch ); return; } cmd = find_command( argument ); for( disabled = first_disabled; disabled; disabled = disabled->next ) if( disabled->command == cmd ) break; if( disabled ) { /* * Do they have access? */ if( disabled->level > get_trust( ch ) ) { send_to_char( "You don't have the access to un-disable this command.\r\n", ch ); return; } /* * They do, remove it */ if( first_disabled == disabled ) first_disabled = disabled->next; else { DISABLED_DATA *tmp; for( tmp = first_disabled; tmp->next != disabled; tmp = tmp->next ) ; tmp->next = disabled->next; } STRFREE( disabled->who ); DISPOSE( disabled ); save_disabled( ); send_to_char( "Command is now enabled.\r\n", ch ); } else { /* * DOn't let them disable this command. */ if( !str_cmp( argument, "disable" ) ) { send_to_char( "You cannot disable this command.\r\n", ch ); return; } cmd = find_command( argument ); if( !cmd ) { send_to_char( "No such command", ch ); return; } if( cmd->level > get_trust( ch ) ) { send_to_char( "You don't have access to this command.\r\n", ch ); return; } CREATE( disabled, DISABLED_DATA, 1 ); disabled->command = cmd; disabled->who = STRALLOC( ch->name ); disabled->level = get_trust( ch ); disabled->next = first_disabled; first_disabled = disabled; ch_printf( ch, "%s is now disabled.\r\n", cmd->name ); save_disabled( ); return; } }
void do_note( CHAR_DATA * ch, char *arg_passed, bool IS_MAIL ) { char buf[MAX_STRING_LENGTH]; char arg[MAX_INPUT_LENGTH]; NOTE_DATA *pnote = NULL; BOARD_DATA *board = NULL; int vnum = 0; int anum = 0; int first_list = 0; OBJ_DATA *paper = NULL, *tmpobj = NULL; EXTRA_DESCR_DATA *ed = NULL; char notebuf[MAX_STRING_LENGTH]; char short_desc_buf[MAX_STRING_LENGTH]; char long_desc_buf[MAX_STRING_LENGTH]; char keyword_buf[MAX_STRING_LENGTH]; bool mfound = FALSE; bool wasfound = FALSE; if( IS_NPC( ch ) ) return; if( !ch->desc ) { bug( "do_note: no descriptor", 0 ); return; } switch ( ch->substate ) { default: break; case SUB_WRITING_NOTE: if( ( paper = get_eq_char( ch, WEAR_HOLD ) ) == NULL || paper->item_type != ITEM_PAPER ) { bug( "do_note: player not holding paper", 0 ); stop_editing( ch ); return; } ed = ( EXTRA_DESCR_DATA * ) ch->dest_buf; STRFREE( ed->description ); ed->description = copy_buffer( ch ); stop_editing( ch ); return; } set_char_color( AT_NOTE, ch ); arg_passed = one_argument( arg_passed, arg ); smash_tilde( arg_passed ); if( !str_cmp( arg, "list" ) ) { board = find_board( ch ); if( !board ) { send_to_char( "There is no board here to look at.\r\n", ch ); return; } if( !can_read( ch, board ) ) { send_to_char ( "You cannot make any sense of the cryptic scrawl on this board...\r\n", ch ); return; } first_list = atoi( arg_passed ); if( first_list ) { if( IS_MAIL ) { send_to_char ( "You cannot use a list number (at this time) with mail.\r\n", ch ); return; } if( first_list < 1 ) { send_to_char( "You can't read a message before 1!\r\n", ch ); return; } } if( !IS_MAIL ) { vnum = 0; set_pager_color( AT_NOTE, ch ); for( pnote = board->first_note; pnote; pnote = pnote->next ) { vnum++; if( ( first_list && vnum >= first_list ) || !first_list ) pager_printf( ch, "%2d%c %-12s%c %-12s %s\r\n", vnum, is_note_to( ch, pnote ) ? ')' : '}', pnote->sender, ( pnote->voting != VOTE_NONE ) ? ( pnote->voting == VOTE_OPEN ? 'V' : 'C' ) : ':', pnote->to_list, pnote->subject ); } act( AT_ACTION, "$n glances over the messages.", ch, NULL, NULL, TO_ROOM ); return; } else { vnum = 0; if( IS_MAIL ) /* SB Mail check for Brit */ { for( pnote = board->first_note; pnote; pnote = pnote->next ) if( is_note_to( ch, pnote ) ) mfound = TRUE; if( !mfound && !IS_IMMORTAL( ch ) ) { ch_printf( ch, "You have no mail.\r\n" ); return; } } for( pnote = board->first_note; pnote; pnote = pnote->next ) if( is_note_to( ch, pnote ) || IS_IMMORTAL( ch ) ) ch_printf( ch, "%2d%c %s: %s\r\n", ++vnum, is_note_to( ch, pnote ) ? '-' : '}', pnote->sender, pnote->subject ); return; } } if( !str_cmp( arg, "read" ) ) { bool fAll = FALSE; board = find_board( ch ); if( !board ) { send_to_char( "There is no board here to look at.\r\n", ch ); return; } if( !can_read( ch, board ) ) { send_to_char ( "You cannot make any sense of the cryptic scrawl on this board...\r\n", ch ); return; } if( !str_cmp( arg_passed, "all" ) ) { fAll = TRUE; anum = 0; } else if( is_number( arg_passed ) ) { fAll = FALSE; anum = atoi( arg_passed ); } else { send_to_char( "Note read which number?\r\n", ch ); return; } set_pager_color( AT_NOTE, ch ); if( !IS_MAIL ) { vnum = 0; for( pnote = board->first_note; pnote; pnote = pnote->next ) { vnum++; if( vnum == anum || fAll ) { wasfound = TRUE; pager_printf( ch, "[%3d] %s: %s\r\n%s\r\nTo: %s\r\n%s", vnum, pnote->sender, pnote->subject, pnote->date, pnote->to_list, pnote->text ); if( pnote->yesvotes[0] != '\0' || pnote->novotes[0] != '\0' || pnote->abstentions[0] != '\0' ) { send_to_pager ( "------------------------------------------------------------\r\n", ch ); pager_printf( ch, "Votes:\r\nYes: %s\r\nNo: %s\r\nAbstain: %s\r\n", pnote->yesvotes, pnote->novotes, pnote->abstentions ); } act( AT_ACTION, "$n reads a message.", ch, NULL, NULL, TO_ROOM ); } } if( !wasfound ) ch_printf( ch, "No such message: %d\r\n", anum ); return; } else { vnum = 0; for( pnote = board->first_note; pnote; pnote = pnote->next ) { if( is_note_to( ch, pnote ) || IS_IMMORTAL( ch ) ) { vnum++; if( vnum == anum || fAll ) { wasfound = TRUE; pager_printf( ch, "[%3d] %s: %s\r\n%s\r\nTo: %s\r\n%s", vnum, pnote->sender, pnote->subject, pnote->date, pnote->to_list, pnote->text ); } } } if( !wasfound ) ch_printf( ch, "No such message: %d\r\n", anum ); return; } } /* Voting added by Narn, June '96 */ if( !str_cmp( arg, "vote" ) ) { char arg2[MAX_INPUT_LENGTH]; arg_passed = one_argument( arg_passed, arg2 ); board = find_board( ch ); if( !board ) { send_to_char( "There is no bulletin board here.\r\n", ch ); return; } if( !can_read( ch, board ) ) { send_to_char( "You cannot vote on this board.\r\n", ch ); return; } if( is_number( arg2 ) ) anum = atoi( arg2 ); else { send_to_char( "Note vote which number?\r\n", ch ); return; } vnum = 1; for( pnote = board->first_note; pnote && vnum < anum; pnote = pnote->next ) vnum++; if( !pnote ) { send_to_char( "No such note.\r\n", ch ); return; } /* Options: open close yes no abstain */ /* If you're the author of the note and can read the board you can open and close voting, if you can read it and voting is open you can vote. */ if( !str_cmp( arg_passed, "open" ) ) { if( str_cmp( ch->name, pnote->sender ) ) { send_to_char( "You are not the author of this message.\r\n", ch ); return; } pnote->voting = VOTE_OPEN; act( AT_ACTION, "$n opens voting on a note.", ch, NULL, NULL, TO_ROOM ); send_to_char( "Voting opened.\r\n", ch ); write_board( board ); return; } if( !str_cmp( arg_passed, "close" ) ) { if( str_cmp( ch->name, pnote->sender ) ) { send_to_char( "You are not the author of this message.\r\n", ch ); return; } pnote->voting = VOTE_CLOSED; act( AT_ACTION, "$n closes voting on a note.", ch, NULL, NULL, TO_ROOM ); send_to_char( "Voting closed.\r\n", ch ); write_board( board ); return; } /* Make sure the note is open for voting before going on. */ if( pnote->voting != VOTE_OPEN ) { send_to_char( "Voting is not open on this note.\r\n", ch ); return; } /* Can only vote once on a note. */ sprintf( buf, "%s %s %s", pnote->yesvotes, pnote->novotes, pnote->abstentions ); if( is_name( ch->name, buf ) ) { send_to_char( "You have already voted on this note.\r\n", ch ); return; } if( !str_cmp( arg_passed, "yes" ) ) { sprintf( buf, "%s %s", pnote->yesvotes, ch->name ); DISPOSE( pnote->yesvotes ); pnote->yesvotes = str_dup( buf ); act( AT_ACTION, "$n votes on a note.", ch, NULL, NULL, TO_ROOM ); send_to_char( "Ok.\r\n", ch ); write_board( board ); return; } if( !str_cmp( arg_passed, "no" ) ) { sprintf( buf, "%s %s", pnote->novotes, ch->name ); DISPOSE( pnote->novotes ); pnote->novotes = str_dup( buf ); act( AT_ACTION, "$n votes on a note.", ch, NULL, NULL, TO_ROOM ); send_to_char( "Ok.\r\n", ch ); write_board( board ); return; } if( !str_cmp( arg_passed, "abstain" ) ) { sprintf( buf, "%s %s", pnote->abstentions, ch->name ); DISPOSE( pnote->abstentions ); pnote->abstentions = str_dup( buf ); act( AT_ACTION, "$n votes on a note.", ch, NULL, NULL, TO_ROOM ); send_to_char( "Ok.\r\n", ch ); write_board( board ); return; } do_note( ch, STRLIT_EMPTY, FALSE ); } if( !str_cmp( arg, "write" ) ) { if( ch->substate == SUB_RESTRICTED ) { send_to_char ( "You cannot write a note from within another command.\r\n", ch ); return; } if( ( paper = get_eq_char( ch, WEAR_HOLD ) ) == NULL || paper->item_type != ITEM_PAPER ) { paper = create_object( get_obj_index( OBJ_VNUM_NOTE ) ); if( ( tmpobj = get_eq_char( ch, WEAR_HOLD ) ) != NULL ) unequip_char( ch, tmpobj ); paper = obj_to_char( paper, ch ); equip_char( ch, paper, WEAR_HOLD ); act( AT_MAGIC, "$n grabs a message disk to record a note.", ch, NULL, NULL, TO_ROOM ); act( AT_MAGIC, "You get a message disk to record your note.", ch, NULL, NULL, TO_CHAR ); } if( paper->value[0] < 2 ) { paper->value[0] = 1; ed = SetOExtra( paper, "_text_" ); ch->substate = SUB_WRITING_NOTE; ch->dest_buf = ed; start_editing( ch, ed->description ); return; } else { send_to_char( "You cannot modify this message.\r\n", ch ); return; } } if( !str_cmp( arg, "subject" ) ) { if( !arg_passed || arg_passed[0] == '\0' ) { send_to_char( "What do you wish the subject to be?\r\n", ch ); return; } if( ( paper = get_eq_char( ch, WEAR_HOLD ) ) == NULL || paper->item_type != ITEM_PAPER ) { paper = create_object( get_obj_index( OBJ_VNUM_NOTE ) ); if( ( tmpobj = get_eq_char( ch, WEAR_HOLD ) ) != NULL ) unequip_char( ch, tmpobj ); paper = obj_to_char( paper, ch ); equip_char( ch, paper, WEAR_HOLD ); act( AT_MAGIC, "$n grabs a message disk.", ch, NULL, NULL, TO_ROOM ); act( AT_MAGIC, "You get a message disk to record your note.", ch, NULL, NULL, TO_CHAR ); } if( paper->value[1] > 1 ) { send_to_char( "You cannot modify this message.\r\n", ch ); return; } else { paper->value[1] = 1; ed = SetOExtra( paper, "_subject_" ); STRFREE( ed->description ); ed->description = STRALLOC( arg_passed ); send_to_char( "Ok.\r\n", ch ); return; } } if( !str_cmp( arg, "to" ) ) { struct stat fst; char fname[1024]; if( !arg_passed || arg_passed[0] == '\0' ) { send_to_char( "Please specify an addressee.\r\n", ch ); return; } if( ( paper = get_eq_char( ch, WEAR_HOLD ) ) == NULL || paper->item_type != ITEM_PAPER ) { paper = create_object( get_obj_index( OBJ_VNUM_NOTE ) ); if( ( tmpobj = get_eq_char( ch, WEAR_HOLD ) ) != NULL ) unequip_char( ch, tmpobj ); paper = obj_to_char( paper, ch ); equip_char( ch, paper, WEAR_HOLD ); act( AT_MAGIC, "$n gets a message disk to record a note.", ch, NULL, NULL, TO_ROOM ); act( AT_MAGIC, "You grab a message disk to record your note.", ch, NULL, NULL, TO_CHAR ); } if( paper->value[2] > 1 ) { send_to_char( "You cannot modify this message.\r\n", ch ); return; } arg_passed[0] = UPPER( arg_passed[0] ); sprintf( fname, "%s%c/%s", PLAYER_DIR, tolower( ( int ) arg_passed[0] ), capitalize( arg_passed ) ); if( !IS_MAIL || stat( fname, &fst ) != -1 || !str_cmp( arg_passed, "all" ) ) { paper->value[2] = 1; ed = SetOExtra( paper, "_to_" ); STRFREE( ed->description ); ed->description = STRALLOC( arg_passed ); send_to_char( "Ok.\r\n", ch ); return; } else { send_to_char( "No player exists by that name.\r\n", ch ); return; } } if( !str_cmp( arg, "show" ) ) { const char *subject = ""; const char *to_list = ""; const char *text = ""; if( ( paper = get_eq_char( ch, WEAR_HOLD ) ) == NULL || paper->item_type != ITEM_PAPER ) { send_to_char( "You are not holding a message disk.\r\n", ch ); return; } if( ( subject = get_extra_descr( "_subject_", paper->first_extradesc ) ) == NULL ) subject = "(no subject)"; if( ( to_list = get_extra_descr( "_to_", paper->first_extradesc ) ) == NULL ) to_list = "(nobody)"; sprintf( buf, "%s: %s\r\nTo: %s\r\n", ch->name, subject, to_list ); send_to_char( buf, ch ); if( ( text = get_extra_descr( "_text_", paper->first_extradesc ) ) == NULL ) text = "The disk is blank.\r\n"; send_to_char( text, ch ); return; } if( !str_cmp( arg, "post" ) ) { char *strtime = NULL; const char *text = NULL; if( ( paper = get_eq_char( ch, WEAR_HOLD ) ) == NULL || paper->item_type != ITEM_PAPER ) { send_to_char( "You are not holding a message disk.\r\n", ch ); return; } if( paper->value[0] == 0 ) { send_to_char( "There is nothing written on this disk.\r\n", ch ); return; } if( paper->value[1] == 0 ) { send_to_char( "This message has no subject... using 'none'.\r\n", ch ); paper->value[1] = 1; ed = SetOExtra( paper, "_subject_" ); STRFREE( ed->description ); ed->description = STRALLOC( "none" ); } if( paper->value[2] == 0 ) { if( IS_MAIL ) { send_to_char( "This message is addressed to no one!\r\n", ch ); return; } else { send_to_char ( "This message is addressed to no one... sending to 'all'!\r\n", ch ); paper->value[2] = 1; ed = SetOExtra( paper, "_to_" ); STRFREE( ed->description ); ed->description = STRALLOC( "All" ); } } board = find_board( ch ); if( !board ) { send_to_char ( "There is no terminal here to upload your message to.\r\n", ch ); return; } if( !can_post( ch, board ) ) { send_to_char ( "You cannot use this terminal. It is encrypted...\r\n", ch ); return; } if( board->num_posts >= board->max_posts ) { send_to_char ( "This terminal is full. There is no room for your message.\r\n", ch ); return; } act( AT_ACTION, "$n uploads a message.", ch, NULL, NULL, TO_ROOM ); strtime = ctime( ¤t_time ); strtime[strlen( strtime ) - 1] = '\0'; CREATE( pnote, NOTE_DATA, 1 ); pnote->date = STRALLOC( strtime ); text = get_extra_descr( "_text_", paper->first_extradesc ); pnote->text = text ? STRALLOC( text ) : STRALLOC( "" ); text = get_extra_descr( "_to_", paper->first_extradesc ); pnote->to_list = text ? STRALLOC( text ) : STRALLOC( "all" ); text = get_extra_descr( "_subject_", paper->first_extradesc ); pnote->subject = text ? STRALLOC( text ) : STRALLOC( "" ); pnote->sender = QUICKLINK( ch->name ); pnote->voting = 0; pnote->yesvotes = str_dup( "" ); pnote->novotes = str_dup( "" ); pnote->abstentions = str_dup( "" ); LINK( pnote, board->first_note, board->last_note, next, prev ); board->num_posts++; write_board( board ); send_to_char( "You upload your message to the terminal.\r\n", ch ); extract_obj( paper ); return; } if( !str_cmp( arg, "remove" ) || !str_cmp( arg, "take" ) || !str_cmp( arg, "copy" ) ) { char take = 0; board = find_board( ch ); if( !board ) { send_to_char ( "There is no terminal here to download a note from!\r\n", ch ); return; } if( !str_cmp( arg, "take" ) ) take = 1; else if( !str_cmp( arg, "copy" ) ) { if( !IS_IMMORTAL( ch ) ) { send_to_char( "Huh? Type 'help note' for usage.\r\n", ch ); return; } take = 2; } else take = 0; if( !is_number( arg_passed ) ) { send_to_char( "Note remove which number?\r\n", ch ); return; } if( !can_read( ch, board ) ) { send_to_char ( "You can't make any sense of what's posted here, let alone remove anything!\r\n", ch ); return; } anum = atoi( arg_passed ); vnum = 0; for( pnote = board->first_note; pnote; pnote = pnote->next ) { if( IS_MAIL && ( ( is_note_to( ch, pnote ) ) || IS_IMMORTAL( ch ) ) ) vnum++; else if( !IS_MAIL ) vnum++; if( ( !str_cmp( ch->name, pnote->sender ) || can_remove( ch, board ) ) && ( vnum == anum ) ) { if( ( is_name( "all", pnote->to_list ) ) && ( !IS_IMMORTAL( ch ) ) && ( take == 1 ) ) { send_to_char ( "Notes addressed to 'all' can not be taken.\r\n", ch ); return; } if( take != 0 ) { paper = create_object( get_obj_index( OBJ_VNUM_NOTE ) ); ed = SetOExtra( paper, "_sender_" ); STRFREE( ed->description ); ed->description = QUICKLINK( pnote->sender ); ed = SetOExtra( paper, "_text_" ); STRFREE( ed->description ); ed->description = QUICKLINK( pnote->text ); ed = SetOExtra( paper, "_to_" ); STRFREE( ed->description ); ed->description = QUICKLINK( pnote->to_list ); ed = SetOExtra( paper, "_subject_" ); STRFREE( ed->description ); ed->description = QUICKLINK( pnote->subject ); ed = SetOExtra( paper, "_date_" ); STRFREE( ed->description ); ed->description = QUICKLINK( pnote->date ); ed = SetOExtra( paper, "note" ); STRFREE( ed->description ); sprintf( notebuf, "From: " ); strcat( notebuf, pnote->sender ); strcat( notebuf, "\r\nTo: " ); strcat( notebuf, pnote->to_list ); strcat( notebuf, "\r\nSubject: " ); strcat( notebuf, pnote->subject ); strcat( notebuf, "\r\n\r\n" ); strcat( notebuf, pnote->text ); strcat( notebuf, "\r\n" ); ed->description = STRALLOC( notebuf ); paper->value[0] = 2; paper->value[1] = 2; paper->value[2] = 2; sprintf( short_desc_buf, "a note from %s to %s", pnote->sender, pnote->to_list ); STRFREE( paper->short_descr ); paper->short_descr = STRALLOC( short_desc_buf ); sprintf( long_desc_buf, "A note from %s to %s lies on the ground.", pnote->sender, pnote->to_list ); STRFREE( paper->description ); paper->description = STRALLOC( long_desc_buf ); sprintf( keyword_buf, "note parchment paper %s", pnote->to_list ); STRFREE( paper->name ); paper->name = STRALLOC( keyword_buf ); } if( take != 2 ) note_remove( board, pnote ); send_to_char( "Ok.\r\n", ch ); if( take == 1 ) { act( AT_ACTION, "$n downloads a message.", ch, NULL, NULL, TO_ROOM ); obj_to_char( paper, ch ); } else if( take == 2 ) { act( AT_ACTION, "$n copies a message.", ch, NULL, NULL, TO_ROOM ); obj_to_char( paper, ch ); } else act( AT_ACTION, "$n removes a message.", ch, NULL, NULL, TO_ROOM ); return; } } send_to_char( "No such message.\r\n", ch ); return; } send_to_char( "Huh? Type 'help note' for usage.\r\n", ch ); }