void start_winter( void ) { ROOM_INDEX_DATA *room; int iHash; echo_to_all( AT_CYAN, "The air takes on a chilling cold as winter sets in.", ECHOTAR_ALL ); echo_to_all( AT_CYAN, "Freshwater bodies everywhere have frozen over.\r\n", ECHOTAR_ALL ); winter_freeze = TRUE; for( iHash = 0; iHash < MAX_KEY_HASH; iHash++ ) { for( room = room_index_hash[iHash]; room; room = room->next ) { switch ( room->sector_type ) { case SECT_WATER_SWIM: case SECT_WATER_NOSWIM: room->winter_sector = room->sector_type; room->sector_type = SECT_ICE; break; } } } return; }
static void SigTerm( int signum ) { list < char_data * >::iterator ich; echo_to_all( "&RATTENTION!! Message from game server: &YEmergency shutdown called.\a", ECHOTAR_ALL ); echo_to_all( "&YExecuting emergency shutdown proceedure.", ECHOTAR_ALL ); log_string( "Message from server: Executing emergency shutdown proceedure." ); shutdown_mud( "Emergency Shutdown" ); for( ich = pclist.begin( ); ich != pclist.end( ); ++ich ) { char_data *vch = *ich; /* * One of two places this gets changed */ vch->pcdata->hotboot = true; } close_mud( ); log_string( "Emergency shutdown complete." ); /* * Using exit here instead of mud_down because the thing sometimes failed to kill when asked!! */ exit( 0 ); }
/* Replaces reboot_check from update.c */ void ev_reboot_count( void *data ) { if( reboot_counter == -5 ) { echo_to_all( "&GReboot countdown cancelled.", ECHOTAR_ALL ); return; } --reboot_counter; if( reboot_counter < 1 ) { echo_to_all( "&YReboot countdown completed. System rebooting.", ECHOTAR_ALL ); log_string( "Rebooted by countdown" ); mud_down = true; return; } if( reboot_counter > 2 ) echo_all_printf( ECHOTAR_ALL, "&YGame reboot in %d minutes.", reboot_counter ); if( reboot_counter == 2 ) echo_to_all( "&RGame reboot in 2 minutes.", ECHOTAR_ALL ); if( reboot_counter == 1 ) echo_to_all( "}RGame reboot in 1 minute!! Please find somewhere to log off.", ECHOTAR_ALL ); add_event( 60, ev_reboot_count, nullptr ); }
void disintegration( CHAR_DATA * ch, CHAR_DATA * victim, long amount ) { BOUNTY_DATA *bounty; bool found; char buf[MAX_STRING_LENGTH]; found = FALSE; for( bounty = first_disintegration; bounty; bounty = bounty->next ) { if( !str_cmp( bounty->target, victim->name ) ) { found = TRUE; break; } } if( !found ) { CREATE( bounty, BOUNTY_DATA, 1 ); LINK( bounty, first_disintegration, last_disintegration, next, prev ); bounty->target = STRALLOC( victim->name ); bounty->amount = 0; } bounty->amount = bounty->amount + amount; save_disintegrations( ); sprintf( buf, "Someone has added %ld credits to the bounty on %s.", amount, victim->name ); echo_to_all( AT_RED, buf, 0 ); }
static void SigChld( int signum ) { int pid, status; list < descriptor_data * >::iterator ds; while( 1 ) { pid = waitpid( WAIT_ANY, &status, WNOHANG ); if( pid < 0 ) break; if( pid == 0 ) break; for( ds = dlist.begin( ); ds != dlist.end( ); ++ds ) { descriptor_data *d = *ds; if( d->connected == CON_FORKED && d->process == pid ) { if( compilelock ) { echo_to_all( "&GCompiler operation completed. Reboot and shutdown commands unlocked.", ECHOTAR_IMM ); compilelock = false; } d->process = 0; d->connected = CON_PLAYING; char_data *ch = d->original ? d->original : d->character; if( ch ) ch->printf( "Process exited with status code %d.\r\n", status ); } } } }
void start_spring( void ) { ROOM_INDEX_DATA *room; int iHash; echo_to_all( AT_DGREEN, "The chill recedes from the air as spring begins to take hold.", ECHOTAR_ALL ); echo_to_all( AT_BLUE, "Freshwater bodies everywhere have thawed out.\r\n", ECHOTAR_ALL ); winter_freeze = FALSE; for( iHash = 0; iHash < MAX_KEY_HASH; iHash++ ) { for( room = room_index_hash[iHash]; room; room = room->next ) { if( room->sector_type == SECT_ICE && room->winter_sector != -1 ) { room->sector_type = room->winter_sector; room->winter_sector = -1; } } } return; }
void do_accept( CHAR_DATA *ch, char *argument ){ CHAR_DATA *victim; char arg[MAX_INPUT_LENGTH]; char buf[MAX_INPUT_LENGTH]; argument = one_argument(argument, arg); if (arg[0] == '\0'){ send_to_char("Syntax: Accept <victim>\n\r", ch); return; } if (( victim = get_char_room(ch, arg)) == NULL){ send_to_char("They aren't here.\n\r", ch); return; } if (IS_NPC(victim) ){ send_to_char("You can't accept a mobs proposel cause they can't propose.\n\r", ch); return; } if (IS_NPC(ch) ){ send_to_char("Why would someone propose to you? Your a mob.\n\r", ch); return; } if (victim->name != ch->pcdata->proposed){ send_to_char("But they haven't proposed to you.\n\r", ch); return; } if (victim->pcdata->propose != ch->name){ send_to_char("So sad they must have proposed to someone else.\n\r", ch); return; } sprintf(buf, "%s has accepted %s's hand in marriage. They will soon be wed.", ch->name, victim->name); echo_to_all( AT_WHITE, buf, ECHOTAR_ALL ); ch->pcdata->propose = NULL; victim->pcdata->proposed = NULL; ch->pcdata->fiance = victim->name; victim->pcdata->fiance = ch->name; return; }
void do_rembounty( CHAR_DATA * ch, char *argument ) { BOUNTY_DATA *bounty; char buf[MAX_INPUT_LENGTH]; bounty = get_disintegration( argument ); if( bounty ) remove_disintegration( bounty ); else { send_to_char( "This bounty does not exist!\n\r", ch ); return; } sprintf( buf, "The bounty on %s has been removed!", argument ); echo_to_all( AT_RED, buf, ECHOTAR_ALL ); }
void season_update( void ) { HOLIDAY_DATA *day; day = get_holiday( time_info.month, time_info.day ); if( day != NULL ) { if( time_info.day + 1 == day->day && time_info.hour == 0 ) { echo_to_all( AT_IMMORT, day->announce, ECHOTAR_ALL ); } } if( time_info.season == SEASON_WINTER && winter_freeze == FALSE ) { ROOM_INDEX_DATA *room; int iHash; winter_freeze = TRUE; for( iHash = 0; iHash < MAX_KEY_HASH; iHash++ ) { for( room = room_index_hash[iHash]; room; room = room->next ) { switch ( room->sector_type ) { case SECT_WATER_SWIM: case SECT_WATER_NOSWIM: room->winter_sector = room->sector_type; room->sector_type = SECT_ICE; break; } } } } return; }
/* * LAG alarm! -Thoric */ static void caught_alarm( int signum ) { echo_to_all( "&[immortal]Alas, the hideous malevalent entity known only as 'Lag' rises once more!", ECHOTAR_ALL ); bug( "&RALARM CLOCK! In section %s", alarm_section ); if( newdesc ) { FD_CLR( newdesc, &in_set ); FD_CLR( newdesc, &out_set ); FD_CLR( newdesc, &exc_set ); log_string( "clearing newdesc" ); } if( fBootDb ) { log_string( "Terminating program. Infinite loop detected during bootup." ); shutdown_mud( "Infinite loop detected during bootup." ); abort( ); } log_string( "&RPossible infinite loop detected during game operation. Restarting game_loop()." ); signal( SIGALRM, caught_alarm ); // Have to reset the signal handler or the next hit will deadlock game_loop( ); /* * Clean up the loose ends. */ close_mud( ); /* * That's all, folks. */ log_string( "Normal termination of game." ); log_string( "Cleaning up Memory.&d" ); cleanup_memory( ); exit( 0 ); }
void do_marry( CHAR_DATA *ch, char *argument) { char arg1[MAX_INPUT_LENGTH]; char arg2[MAX_INPUT_LENGTH]; char buf[MAX_INPUT_LENGTH]; CHAR_DATA *vic1; CHAR_DATA *vic2; argument = one_argument(argument, arg1); argument = one_argument(argument, arg2); if (arg1[0] == '\0' || arg2[0] == '\0') { send_to_char("Syntax: Marry <victim1> <victim2>\n\r", ch); return; } if ( ( vic1 = get_char_room( ch, arg1 ) ) == NULL ) { sprintf(buf, "%s doesn't appear to be here.\n\r", arg1); send_to_char(buf, ch); return; } if ( ( vic2 = get_char_room( ch, arg2 ) ) == NULL ) { sprintf(buf, "%s doesn't appear to be here.\n\r", arg2); send_to_char(buf, ch); return; } if(IS_NPC(vic1)) { sprintf(buf, "%s appears to be a mob. Why marry it off to anyone?\n\r", vic1->name); send_to_char(buf, ch); return; } if(IS_NPC(vic2)) { sprintf(buf, "%s appears to be a mob. Why marry it off to anyone?\n\r", vic2->name); send_to_char(buf, ch); return; } if (!vic1->pcdata->fiance || vic1->pcdata->fiance == NULL || vic1->pcdata->fiance != vic2->name) { sprintf(buf, "%s is not engaged to %s. Perhaps a proposal would be a good first step.\n\r", vic1->name, vic2->name); send_to_char(buf, ch); return; } if (!vic2->pcdata->fiance || vic2->pcdata->fiance == NULL || vic2->pcdata->fiance != vic1->name) { sprintf(buf, "%s is not engaged to %s. Perhaps a proposal would be a good first step.\n\r", vic2->name, vic1->name); send_to_char(buf, ch); return; } if(vic1->top_level < 5) { sprintf(buf, "%s is to low a level to get married.\n\r", vic1->name); send_to_char(buf, ch); return; } if(vic2->top_level < 5) { sprintf(buf, "%s is to low a level to get married.\n\r", vic2->name); send_to_char(buf, ch); return; } if (vic1->sex == SEX_MALE && vic2->sex == SEX_MALE) act(AT_WHITE, "Then by the power invested in me by the Republic I now pronounce you Husband and Husband. You may kiss your husband.", ch, NULL, NULL, TO_ROOM); else if (vic1->sex == SEX_FEMALE && vic2->sex == SEX_FEMALE) act(AT_WHITE, "Then by the power invested in me by the Republic I now pronounce you Wife and Wife. You may kiss your wife.", ch, NULL, NULL, TO_ROOM); else if (vic1->sex == SEX_MALE && vic2->sex == SEX_FEMALE) act(AT_WHITE, "Then by the power invested in me by the Republic I now pronounce you Husband and Wife. You may kiss your wife.", ch, NULL, NULL, TO_ROOM); else act(AT_WHITE, "Then by the power invested in me by the Republic I now pronounce you Wife and Husband. You may kiss your husband.", ch, NULL, NULL, TO_ROOM); vic1->pcdata->spouse = vic2->name; vic2->pcdata->spouse = vic1->name; /*if (vic1->sex == SEX_MALE && vic2->sex == SEX_FEMALE) vic2->pcdata->last_name = vic1->pcdata->last_name; else if (vic1->sex == SEX_FEMALE && vic2->sex == SEX_MALE) vic1->pcdata->last_name = vic2->pcdata->last_name; */ sprintf(buf, "&R(&WMarriage&R} &W%s: I am very pleased to announce that %s and %s are now married.", ch->name, vic1->name, vic2->name); echo_to_all(AT_YELLOW, buf, ECHOTAR_ALL); return; }
void do_propose( CHAR_DATA *ch, char *argument ) { CHAR_DATA *victim; char arg[MAX_INPUT_LENGTH]; char buf[MAX_INPUT_LENGTH]; argument = one_argument(argument, arg); if (arg[0] == '\0'){ send_to_char("Syntax: Propose <victim>\n\r", ch); return; } if (( victim = get_char_room(ch, arg)) == NULL){ send_to_char("They aren't here.\n\r", ch); return; } if ( ch == victim ){ send_to_char("Why would you want to propose to yourself?\n\r", ch); if (ch->sex == SEX_MALE) sprintf(buf, "What a moron. %s proposed to himself.", ch->name); else if (ch->sex == SEX_FEMALE) sprintf(buf, "What a moron. %s proposed to herself.", ch->name); else sprintf(buf, "What a moron. %s proposed to itself.", ch->name); echo_to_all( AT_WHITE, buf, ECHOTAR_ALL ); return; } if ( IS_NPC(victim) ){ send_to_char("Why would you propose to a mob?\n\r", ch); return; } if ( IS_NPC(ch) ){ send_to_char("Why would a mob propose to someone?\n\r", ch); return; } if (victim->pcdata->fiance && victim->pcdata->fiance != NULL){ send_to_char("They are already engaged.\n\r", ch); return; } if (victim->pcdata->spouse && victim->pcdata->spouse != NULL){ send_to_char("They are already married.\n\r", ch); } if (victim->pcdata->proposed && victim->pcdata->proposed != NULL){ sprintf(buf, "They have already been proposed to by %s.\n\r", victim->pcdata->proposed); return; } if (victim->pcdata->propose && victim->pcdata->propose != NULL){ sprintf(buf, "They have already been proposed to %s.\n\r", victim->pcdata->propose); return; } ch->pcdata->propose = victim->name; victim->pcdata->proposed = ch->name; act(AT_WHITE, "$n gets down on one knee and asks your hand in marriage.", ch, NULL, victim, TO_VICT); act(AT_WHITE, "You get down on one knee and ask $N's hand in marriage.", ch, NULL, victim, TO_CHAR); act(AT_WHITE, "$n gets down on one knee and asks for $N's hand in marriage.", ch, NULL, victim, TO_NOTVICT); return; }
void start_fall( void ) { echo_to_all( AT_ORANGE, "The leaves begin changing colors signaling the start of fall.\r\n", ECHOTAR_ALL ); return; }
void start_summer( void ) { echo_to_all( AT_YELLOW, "The days grow longer and hotter as summer grips the world.\r\n", ECHOTAR_ALL ); return; }
void claim_disintegration( CHAR_DATA * ch, CHAR_DATA * victim ) { BOUNTY_DATA *bounty; long int bexp; char buf[MAX_STRING_LENGTH]; CLAN_DATA *clan; if( IS_NPC( victim ) ) return; bounty = get_disintegration( victim->name ); if( ch == victim ) { if( bounty != NULL ) remove_disintegration( bounty ); return; } if( bounty && !ch->pcdata ) { remove_disintegration( bounty ); bounty = NULL; } /* Assassin Experience for Clan Leaders added by Tawnos */ if( victim->pcdata && victim->pcdata->clan ) { clan = victim->pcdata->clan; if( victim->pcdata->clan && ( !str_cmp( victim->name, clan->leader ) || !str_cmp( victim->name, clan->number1 ) || !str_cmp( victim->name, clan->number2 ) ) ) { if( !str_cmp( victim->name, clan->leader ) ) { bexp = ( exp_level( ch->skill_level[ASSASSIN_ABILITY] + 1 ) - exp_level( ch->skill_level[ASSASSIN_ABILITY] ) ); gain_exp( ch, bexp, ASSASSIN_ABILITY ); set_char_color( AT_BLOOD, ch ); ch_printf( ch, "You receive %ld assassin experience for executing a clan leader.\n\r", bexp ); } else if( !str_cmp( victim->name, clan->number1 ) || !str_cmp( victim->name, clan->number2 ) ) { bexp = ( exp_level( ch->skill_level[ASSASSIN_ABILITY] + 1 ) - exp_level( ch->skill_level[ASSASSIN_ABILITY] ) ); gain_exp( ch, bexp, ASSASSIN_ABILITY ); set_char_color( AT_BLOOD, ch ); ch_printf( ch, "You receive %ld assassin experience for executing a prominent clan member.\n\r", bexp ); } } } if( bounty == NULL ) { if( IS_SET( victim->act, PLR_KILLER ) && !IS_NPC( ch ) ) { bexp = URANGE( 1, xp_compute( ch, victim ), ( exp_level( ch->skill_level[HUNTING_ABILITY] + 1 ) - exp_level( ch->skill_level[HUNTING_ABILITY] ) ) ); gain_exp( ch, bexp, HUNTING_ABILITY ); set_char_color( AT_BLOOD, ch ); ch_printf( ch, "You receive %ld hunting experience for executing a wanted killer.\n\r", bexp ); } else if( !IS_NPC( ch ) ) { SET_BIT( ch->act, PLR_KILLER ); ch_printf( ch, "You are now wanted for the murder of %s.\n\r", victim->name ); } sprintf( buf, "%s is Dead!", victim->name ); echo_to_all( AT_RED, buf, 0 ); return; } ch->gold += bounty->amount; bexp = URANGE( 1, bounty->amount + xp_compute( ch, victim ), ( exp_level( ch->skill_level[HUNTING_ABILITY] + 1 ) - exp_level( ch->skill_level[HUNTING_ABILITY] ) ) ); gain_exp( ch, bexp, HUNTING_ABILITY ); set_char_color( AT_BLOOD, ch ); ch_printf( ch, "You receive %ld experience and %ld credits,\n\r from the bounty on %s\n\r", exp, bounty->amount, bounty->target ); sprintf( buf, "The disintegration bounty on %s has been claimed!", victim->name ); echo_to_all( AT_RED, buf, 0 ); sprintf( buf, "%s is Dead!", victim->name ); echo_to_all( AT_RED, buf, 0 ); if( !IS_SET( victim->act, PLR_KILLER ) ) SET_BIT( ch->act, PLR_KILLER ); remove_disintegration( bounty ); }