void clan_update( void ) { CLAN_DATA *clan; for ( clan = clan_first; clan; clan = clan->next ) save_clan( clan ); return; }
/* Used to update where people are in the quest */ void update_chquest( CHAR_DATA *ch, QUEST_DATA * quest, int nchapter ) { CHQUEST_DATA *chquest; CHAP_DATA *chapter; int mins, seconds; bool skipped = FALSE; if ( !quest || !ch || !ch->pcdata ) return; for ( chquest = ch->pcdata->first_quest; chquest; chquest = chquest->next ) { if ( chquest->questnum == quest->number ) break; } /* * If no quest need to start it for them */ if ( !chquest ) { if ( nchapter != 1 ) { send_to_char( "&GYou have to do the quest in order. Check your &WJOURNAL&D.\r\n", ch ); return; } chapter = get_chap_from_quest( 1, quest ); if ( !chapter ) { send_to_char ( "For now this is all you can do on this quest. Try back another time.\r\n", ch ); return; } CREATE( chquest, CHQUEST_DATA, 1 ); chquest->questnum = quest->number; chquest->questlimit = quest->timelimit; chquest->progress = 1; chquest->times = 1; chquest->kamount = 0; chquest->chaplimit = chapter->timelimit; link_chquest( ch, chquest ); send_to_char( "\r\n&G¡has iniciado un nuevo quest!&D\r\n", ch ); if ( xIS_SET( ch->act, PLR_BATTLE ) ) send_to_char( "!!SOUND(sound/quest.wav)\r\n", ch ); send_to_char( ">eclea &WDIARIO &Gpara ver más información sobre el quest.&D\r\n", ch ); if ( chquest->chaplimit > 0 ) ch_printf( ch, "&RTienes %s para finalizar este capítulo.&D\r\n", show_timeleft( chquest->chaplimit ) ); if ( chquest->questlimit > 0 ) ch_printf( ch, "&RTienes %s para finalizar el quest.&D\r\n", show_timeleft( chquest->questlimit ) ); return; } if ( !quest->skipchapters ) { if ( nchapter != ( chquest->progress + 1 ) ) { send_to_char( ">ienes que hacer el quest en orden. Mira tu &WDIARIO&D.\r\n", ch ); return; } /* * Ok so we have the chquest so lets increase it */ ++chquest->progress; } else { chquest->progress = nchapter; /* If we skip need to set it to * the new chapter */ skipped = TRUE; } /* * Ok redoing it? */ if ( chquest->progress == 1 ) { int times = chquest->times; chapter = get_chap_from_quest( 1, quest ); if ( !chapter ) { send_to_char ( "Por ahora no puedes hacer más. Inténtalo más tarde.\r\n", ch ); return; } chquest->questlimit = quest->timelimit; chquest->chaplimit = chapter->timelimit; chquest->kamount = 0; send_to_char( "\r\n&G¡Has iniciado un nuevo quest!&D\r\n", ch ); send_to_char( ">eclea &WDIARIO ¶ más información sobre el quest.&D\r\n", ch ); if ( chquest->chaplimit > 0 ) ch_printf( ch, "&RTienes %s para finalizar el capítulo.&D\r\n", show_timeleft( chquest->chaplimit ) ); if ( chquest->questlimit > 0 ) ch_printf( ch, "&RTienes %s para finalizar el capítulo.&D\r\n", show_timeleft( chquest->questlimit ) ); ch_printf( ch, "&Bhas intentado este quest %d %s&D\r\n", times, times >= 5 ? "veces!" : times == 1 ? "veces." : "vez." ); chquest->times++; return; } /* * Was this the end of the quest? */ if ( chquest->progress == ( quest->chapters + 1 ) ) { send_to_char( "&G¡has finalizado tu quest!&D\r\n", ch ); if ( quest->glory == 1 ) { ch->quest_curr += ( quest->level + get_curr_con( ch ) ); ch->quest_accum += ( quest->level + get_curr_con( ch ) ); ch_printf( ch, "&YGanas %d puntos de gloria.&D\r\n", quest->level + get_curr_con( ch ) ); gain_exp( ch, 0 + ch->level * 100 + quest->level * 2000 ); } else { gain_exp( ch, 0 + ch->level * 100 + quest->level * 2000 ); } if ( ch->pcdata->clan ) { CLAN_DATA *clan; clan = ch->pcdata->clan; ch->pcdata->clanpoints += 1; clan->totalpoints += 1; ch_printf( ch, "&G%s ha ganado 1 punto por tu quest, ¡ahora tiene %d puntos de clan!\r\n", clan->name, clan->totalpoints ); save_clan( clan ); } if ( chquest->questlimit ) ch_printf( ch, "&RTenías %s cuando completaste tu quest.&D\r\n", show_timeleft( chquest->questlimit ) ); chquest->chaplimit = 0; chquest->questlimit = 0; chquest->kamount = 0; return; } chapter = get_chap_from_quest( chquest->progress, quest ); if ( !chapter ) { send_to_char( "Por ahora no puedes hacer más en este quest. Inténtalo más tarde.\r\n", ch ); return; } chquest->chaplimit = chapter->timelimit; chquest->kamount = 0; /* * If they aren't skipping show this message */ // if( !quest->skipchapters && skipped ) send_to_char( "&Continúas el quest, teclea &WDIARIO ¶ ver qué sigue.&D\r\n", ch ); if ( chquest->chaplimit > 0 ) ch_printf( ch, "&RTienes %s para finalizar el capítulo.&D\r\n", show_timeleft( chquest->chaplimit ) ); if ( chquest->questlimit > 0 ) ch_printf( ch, "&RTienes %s para finalizar el quest.&D\r\n", show_timeleft( chquest->questlimit ) ); }
void do_bank_clan(Character *ch, char *argument) { char arg1[MAX_INPUT_LENGTH]; char arg2[MAX_INPUT_LENGTH]; arg1[0] = '\0'; arg2[0] = '\0'; long amount; argument = one_argument( argument, arg1 ); argument = one_argument( argument, arg2 ); if (!IS_CLANNED(ch) && !IS_IMMORTAL(ch)) { send_to_char("You are not in a clan.\n\r",ch); return; } if (IS_IMMORTAL(ch)) { CLAN_DATA *clan; int debit; if ((clan = get_clan(arg1)) == NULL) { send_to_char("Syntax: bank clan <clan name> <amount to withdraw (in k)>\n\r",ch); return; } if ((debit = atoi(arg2)) <= 0) { send_to_char("Syntax: bank clan <clan name> <amount to withdraw (in k)>\n\r",ch); return; } if (clan->money < debit * 100000) { send_to_char("The clan doesn't have that much money!\n\r",ch); return; } clan->money -= debit * 100000; ch->gold += debit * 1000; append_file( ch, UPGRADE_FILE, argument ); save_clan(clan); return; } else { if (str_cmp(ch->pcdata->clan->leader, ch->getName() )) { send_to_char("Only your clan leader may access the clan account.\n\r", ch); return; } if (arg2[0] == '\0' || (str_cmp(arg2, "gold") && str_cmp(arg2, "silver"))) { send_to_char("Syntax: bank clan (+/- amount) (gold/silver)\n\r",ch); return; } if (!str_cmp(arg2, "gold")) amount = atoi(arg1) * 100; else amount = atoi(arg1); if ( amount == 0 ) { send_to_char("Nothing much happens.\n\r", ch); return; } if ( amount < 0 && amount * -1 > ch->pcdata->clan->money ) { send_to_char("You cannot withdraw more than your clan has.\n\r", ch); return; } if ((ch->gold * 100) + ch->silver < amount && amount > 0) { send_to_char("You cannot afford to deposit that much.\n\r",ch); return; } if (amount > 0) { if (ch->silver < amount) { ch->gold -= ((amount - ch->silver + 99) / 100); ch->silver -= amount - (100 * ((amount - ch->silver + 99) / 100)); } else ch->silver -= amount; } ch->pcdata->clan->money += amount; save_clan(ch->pcdata->clan); if ( amount < 0 ) { amount = amount * -1; ch->gold += amount / 100; ch->silver += amount - (amount / 100); send_to_char("You withdraw from your clan fund.\n\r",ch); return; } else { send_to_char("You add to your clan fund.\n\r",ch); return; } } }
/* * Bring up the pfile for rare item adjustments */ void adjust_pfile( const string & name ) { char_data *ch; char fname[256]; struct stat fst; list < char_data * >::iterator ich; for( ich = pclist.begin( ); ich != pclist.end( ); ++ich ) { char_data *temp = *ich; if( !str_cmp( name, temp->name ) ) { log_printf( "Skipping rare item adjustments for %s, player is online.", temp->name ); if( temp->is_immortal( ) ) /* Get the rare items off the immortals */ { list < obj_data * >::iterator iobj; log_printf( "Immortal: Removing rare items from %s.", temp->name ); for( iobj = temp->carrying.begin( ); iobj != temp->carrying.end( ); ) { obj_data *tobj = *iobj; ++iobj; rare_purge( temp, tobj ); } } return; } } room_index *temproom, *original; if( !( temproom = get_room_index( ROOM_VNUM_RAREUPDATE ) ) ) { bug( "%s: Error in rare item adjustment, temporary loading room is missing!", __FUNCTION__ ); return; } snprintf( fname, 256, "%s%c/%s", PLAYER_DIR, tolower( name[0] ), capitalize( name ).c_str( ) ); if( stat( fname, &fst ) != -1 ) { descriptor_data *d = new descriptor_data; d->init( ); d->connected = CON_PLOADED; load_char_obj( d, name, false, false ); charlist.push_back( d->character ); pclist.push_back( d->character ); original = d->character->in_room; if( !d->character->to_room( temproom ) ) log_printf( "char_to_room: %s:%s, line %d.", __FILE__, __FUNCTION__, __LINE__ ); ch = d->character; /* Hopefully this will work, if not, we're SOL */ d->character->desc = NULL; d->character = NULL; deleteptr( d ); log_printf( "Updating rare items for %s", ch->name ); ++ch->pcdata->daysidle; expire_items( ch ); ch->from_room( ); if( !ch->to_room( original ) ) log_printf( "char_to_room: %s:%s, line %d.", __FILE__, __FUNCTION__, __LINE__ ); quitting_char = ch; ch->save( ); if( sysdata->save_pets ) { list < char_data * >::iterator pet; for( pet = ch->pets.begin( ); pet != ch->pets.end( ); ) { char_data *cpet = *pet; ++pet; cpet->extract( true ); } } /* * Synch clandata up only when clan member quits now. --Shaddai */ if( ch->pcdata->clan ) save_clan( ch->pcdata->clan ); saving_char = NULL; /* * After extract_char the ch is no longer valid! */ ch->extract( true ); for( int x = 0; x < MAX_WEAR; ++x ) for( int y = 0; y < MAX_LAYERS; ++y ) save_equipment[x][y] = NULL; log_printf( "Rare items for %s updated sucessfully.", name.c_str( ) ); } }
void char_leaving( char_data * ch, int howleft ) { auth_data *old_auth = NULL; /* * new auth */ old_auth = get_auth_name( ch->name ); if( old_auth != NULL ) if( old_auth->state == AUTH_ONLINE ) old_auth->state = AUTH_OFFLINE; /* Logging off */ ch->pcdata->camp = howleft; if( howleft == 0 ) /* Rented at an inn */ { switch ( ch->in_room->area->continent ) { case ACON_ONE: ch->pcdata->one = ch->in_room->vnum; break; default: break; } } /* * Get 'em dismounted until we finish mount saving -- Blodkai, 4/97 */ if( ch->position == POS_MOUNTED ) interpret( ch, "dismount" ); if( ch->morph ) interpret( ch, "revert" ); if( ch->desc ) { if( ch->timer > 24 ) update_connhistory( ch->desc, CONNTYPE_IDLE ); else update_connhistory( ch->desc, CONNTYPE_QUIT ); } list < obj_data * >::iterator iobj; for( iobj = ch->carrying.begin( ); iobj != ch->carrying.end( ); ) { obj_data *obj = *iobj; ++iobj; inventory_scan( ch, obj ); } quotes( ch ); quitting_char = ch; ch->save( ); if( sysdata->save_pets ) { list < char_data * >::iterator pet; for( pet = ch->pets.begin( ); pet != ch->pets.end( ); ) { char_data *cpet = *pet; ++pet; cpet->extract( true ); } } /* * Synch clandata up only when clan member quits now. --Shaddai */ if( ch->pcdata->clan ) save_clan( ch->pcdata->clan ); saving_char = NULL; ch->extract( true ); for( int x = 0; x < MAX_WEAR; ++x ) for( int y = 0; y < MAX_LAYERS; ++y ) save_equipment[x][y] = NULL; }
void pfile_scan( bool count ) { DIR *dp; struct dirent *dentry; CLAN_DATA *clan; char directory_name[100]; short alpha_loop; short cou = 0; deleted = 0; now_time = time( 0 ); nice( 20 ); /* * Reset all clans to 0 members prior to scan - Samson 7-26-00 */ if( !count ) for( clan = first_clan; clan; clan = clan->next ) clan->members = 0; for( alpha_loop = 0; alpha_loop <= 25; alpha_loop++ ) { sprintf( directory_name, "%s%c", PLAYER_DIR, 'a' + alpha_loop ); /* * log_string( directory_name ); */ dp = opendir( directory_name ); 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] != '.' && str_suffix(".home", dentry->d_name) && str_suffix(".clone", dentry->d_name) ) { if( !count ) read_pfile( directory_name, dentry->d_name, count ); cou++; } dentry = readdir( dp ); } closedir( dp ); } if( !count ) log_string( "Pfile cleanup completed." ); else log_string( "Pfile count completed." ); sprintf( log_buf, "Total pfiles scanned: %d", cou ); log_string( log_buf ); if( !count ) { sprintf( log_buf, "Total pfiles deleted: %d", deleted ); log_string( log_buf ); sprintf( log_buf, "Total pfiles remaining: %d", cou - deleted ); num_pfiles = cou - deleted; log_string( log_buf ); for( clan = first_clan; clan; clan = clan->next ) save_clan( clan ); } else num_pfiles = cou; return; }