diff -i smaug14/src/db.c smaug18/src/db.c 8c8 < * Tricops and Fireblade | * --- > * Tricops, Fireblade, Edmond, Conran | * 61a62,69 > LMSG_DATA *first_lmsg; > LMSG_DATA *last_lmsg; > > #ifdef MYSTARIC > CASINO_DATA *first_casino; > CASINO_DATA *last_casino; > #endif > 153a162 > sh_int gsn_pounce; 170a180,183 > sh_int gsn_grapple; > sh_int gsn_cleave; > sh_int gsn_meditate; > sh_int gsn_trance; 195a209 > sh_int gsn_gnomish; 260a275 > void load_credits args( ( AREA_DATA * tarea, FILE * fp ) ); 281a297,299 > void load_noauctions args( ( void ) ); > void sort_noauctions args( ( NOAUCTION_DATA * pNoauc ) ); > void load_loginmsg args( ( void ) ); 369a388 > sysdata.tumble_pk = 5; 373a393,396 > sysdata.dam_nonav_vs_mob = 100; > sysdata.dam_mob_vs_nonav = 100; > sysdata.peaceful_exp_mod = 100; > sysdata.deadly_exp_mod = 100; 380a404,409 > sysdata.max_html_news = -1; > sysdata.news_html_path = STRALLOC( "" ); > sysdata.pk_channels = 1; > sysdata.pk_silence = 0; > sysdata.wizlock = FALSE; > sysdata.magichell = FALSE; 387a417 > sysdata.port_name = str_dup( "mud" ); 420a451,459 > /* > * Extended News - 12/15/01 - Nopey > */ > log_string( "Loading extended news data" ); > load_news( ); > > log_string( "Loading stance data" ); > load_stances( ); > 429a469,474 > /* log_string("Making adminlist"); > make_adminlist(); > */ > log_string( "Making retiredlist" ); > make_retiredlist( ); > 594a640,642 > ASSIGN_GSN( gsn_cleave, "cleave" ); > ASSIGN_GSN( gsn_pounce, "pounce" ); > ASSIGN_GSN( gsn_grapple, "grapple" ); 598a647,648 > ASSIGN_GSN( gsn_meditate, "meditate" ); > ASSIGN_GSN( gsn_trance, "trance" ); 632a683 > ASSIGN_GSN( gsn_gnomish, "gnomish" ); 695a747,748 > log_string( "Randomizing stance data" ); > randomize_stances( ); 701a755,756 > log_string( "Loading vault list" ); > load_vaults( ); 703a759,760 > log_string( "Loading member lists" ); > load_member_lists( ); 713a771,772 > log_string( "Loading noauction vnums" ); > load_noauctions( ); 717a777,778 > log_string( "Loading Hints" ); > load_hint( ); 722a784,789 > log_string( "Loading Housing System, Home Accessories Data," " and Home Auctioning System" ); > load_homedata( ); > load_accessories( ); > load_homebuy( ); > log_string( "Loading login messages" ); > load_loginmsg( ); 754a822 > pArea->credits = STRALLOC( "" ); 840a909,933 > * Load a credits section. Edmond > */ > void load_credits( AREA_DATA * tarea, FILE * fp ) > { > if ( !tarea ) > { > bug( "Load_credits: no #AREA seen yet." ); > if ( fBootDb ) > { > shutdown_mud( "No #AREA" ); > exit( 1 ); > } > else > return; > } > > if ( tarea->credits ) > STRFREE( tarea->credits ); > > tarea->credits = fread_string( fp ); > return; > } > > > /* 1019c1112 < sh_int vnum; --- > int vnum; 1021c1114 < int iHash; --- > int iHash, i; 1075a1169,1171 > for ( i = 0; i < MAX_STANCE; i++ ) /* Make sure the are reset -Shaddai */ > pMobIndex->stances[i] = 0; > 1208c1304 < if ( letter != 'S' && letter != 'C' ) --- > if ( letter != 'S' && letter != 'C' && letter != 'V' ) 1214c1310 < if ( letter == 'C' ) /* Realms complex mob -Thoric */ --- > if ( letter == 'C' || letter == 'V' ) /* Realms complex mob -Thoric */ 1297a1394,1439 > if ( letter == 'V' ) /* Very complex mob (stances) SHADDAI */ > { > int temp; > > for ( temp = 0; temp < MAX_STANCE; temp++ ) > pMobIndex->stances[temp] = fread_number( fp ); > } > else > /* > * Set the BASIC stances if no stances are set > */ > { > int temp; > > if ( pMobIndex->level < 10 ) > { > for ( temp = 0; temp < BASIC_STANCE; temp++ ) > pMobIndex->stances[temp] = 25; > } > else if ( pMobIndex->level < 20 ) > { > for ( temp = 0; temp < BASIC_STANCE; temp++ ) > pMobIndex->stances[temp] = 50; > } > else if ( pMobIndex->level < 30 ) > { > for ( temp = 0; temp < BASIC_STANCE; temp++ ) > pMobIndex->stances[temp] = 100; > } > else if ( pMobIndex->level < 40 ) > { > for ( temp = 0; temp < BASIC_STANCE; temp++ ) > pMobIndex->stances[temp] = 150; > } > else if ( pMobIndex->level < 50 ) > { > for ( temp = 0; temp < BASIC_STANCE; temp++ ) > pMobIndex->stances[temp] = 200; > } > else > { > for ( temp = 0; temp < BASIC_STANCE; temp++ ) > pMobIndex->stances[temp] = 240; > } > pMobIndex->stances[0] = number_range( 0, ( BASIC_STANCE - 1 ) ); > } 1419,1422c1561,1583 < x1 = x2 = 0; < sscanf( ln, "%d %d", &x1, &x2 ); < pObjIndex->wear_flags = x1; < pObjIndex->layers = x2; --- > x1 = x2 = x3 = 0; > if ( area_version > 1 ) > { > sscanf( ln, "%d %d %d", &x1, &x2, &x3 ); > pObjIndex->wear_flags = x1; > if ( area_version == 2 ) > { > if ( x2 == 127 ) > pObjIndex->layers = 0; > else > pObjIndex->layers = x2; > } > else > pObjIndex->layers = x2; > > pObjIndex->level = x3; > } > else > { > sscanf( ln, "%d %d", &x1, &x2 ); > pObjIndex->wear_flags = x1; > pObjIndex->layers = x2; > } 1437c1598 < if ( area_version == 1 ) --- > if ( area_version > 0 ) 1641a1803 > { 1645,1646c1807,1809 < else if ( extra > 1 ) < not01 = TRUE; --- > } > else if ( extra > 1 ) > not01 = TRUE; 1806a1970 > int x7; 1872a2037,2039 > x1 = x2 = x3 = x4 = x5 = x6 = x7 = 0; > x1 = fread_number( fp ); > pRoomIndex->room_flags = fread_bitvector( fp ); 1874,1877c2041,2042 < x1 = x2 = x3 = x4 = x5 = x6 = 0; < sscanf( ln, "%d %d %d %d %d %d", &x1, &x2, &x3, &x4, &x5, &x6 ); < < pRoomIndex->room_flags = x2; --- > sscanf( ln, "%d %d %d %d %d", &x3, &x4, &x5, &x6, &x7 ); > pRoomIndex->max_weight = x7; 1887a2053,2054 > if ( xIS_SET( pRoomIndex->room_flags, ROOM_HOUSE ) ) > pRoomIndex->max_weight = 2000; 1924a2092 > pexit->orig_door = door; 2303c2471 < SET_BIT( pRoomIndex->room_flags, ROOM_NO_MOB ); --- > xSET_BIT( pRoomIndex->room_flags, ROOM_NO_MOB ); 2526a2695 > mob->stance = 0; 2538c2707 < mob->max_hit = mob->level * 8 + number_range( mob->level * mob->level / 4, mob->level * mob->level ); --- > mob->max_hit = mob->level * 70 + number_range( mob->level * mob->level / 4, mob->level * mob->level ); 2627a2797 > obj->owner = STRALLOC( "" ); 2659a2830 > case ITEM_PUDDLE: 2660a2832 > case ITEM_HOUSEKEY: 2663a2836,2837 > case ITEM_PIECE: > case ITEM_ABACUS: 2710a2885 > case ITEM_JOURNAL: 2786a2962 > ch->variables = NULL; 2858a3035 > VARIABLE_DATA *vd, *vd_next; 2918a3096,3099 > if ( ch->pcdata->recent_site ) > STRFREE( ch->pcdata->recent_site ); > if ( ch->pcdata->prev_site ) > STRFREE( ch->pcdata->prev_site ); 2949a3131 > DISPOSE( ch->pcdata->see_me ); 2969a3152,3156 > for ( vd = ch->variables; vd; vd = vd_next ) > { > vd_next = vd->next; > delete_variable( vd ); > } 2994c3181 < MOB_INDEX_DATA *get_mob_index( sh_int vnum ) --- > MOB_INDEX_DATA *get_mob_index( int vnum ) 3483c3670,3672 < exit( 1 ); --- > > if ( !loading_char ) > exit( 1 ); 3568a3758 > * Ooops was (number_mm() % to) + from which doesn't work -Shaddai 3572,3575c3762 < /* int power; < int number;*/ < < if ( ( to = to - from + 1 ) <= 1 ) --- > if ( ( to - from ) < 1 ) 3577,3585c3764 < < /* for ( power = 2; power < to; power <<= 1 ) < ; < < while ( ( number = number_mm( ) & (power - 1) ) >= to ) < ; < < return from + number;*/ < return ( number_mm( ) % to ) + from; --- > return ( ( number_mm( ) % ( to - from + 1 ) ) + from ); 3591a3771 > * number_mm() % 100 only does 0-99, changed to do 1-100 -Shaddai 3595,3601c3775 < /* int percent; < < while ( ( percent = number_mm( ) & (128-1) ) > 99 ) < ; < < return 1 + percent;*/ < return number_mm( ) % 100; --- > return ( number_mm( ) % 100 ) + 1; 3605a3780 > 3713a3889,3930 > char *smash_color( char *str ) > { > static char buf[MAX_STRING_LENGTH]; > char *bufptr; > bool found; > > bufptr = buf; > found = FALSE; > > for ( ; *str != '\0'; str++ ) > { > if ( found ) > { > found = FALSE; > continue; > } > if ( *str == '&' || *str == '^' ) > { > found = TRUE; > continue; > } > else > *bufptr = *str; > bufptr++; > } > > *bufptr = '\0'; > return buf; > } > > void smash_color_token( char *str ) > { > for ( ; *str != '\0'; str++ ) > { > if ( *str == '^' ) > *str = '-'; > if ( *str == '&' ) > *str = '+'; > } > return; > } > 4027c4244,4245 < log_string( buf ); --- > log_string_plus( buf, LOG_BUG, sysdata.log_level ); > /* log_string( buf ); */ 4047c4265,4268 < log_string( buf ); --- > log_string_plus( buf, LOG_BUG, sysdata.log_level ); > /* > * log_string( buf ); > */ 4122a4344,4383 > * Dump a text file to a player, a line at a time -Thoric > * This version picks off the room vnum at each line to be used > * against a range check. -- Alty > */ > void show_file_vnum( CHAR_DATA * ch, char *filename, int lo, int hi ) > { > FILE *fp; > char buf[MAX_STRING_LENGTH]; > int c; > int num = 0; > > fclose( fpReserve ); > if ( ( fp = fopen( filename, "r" ) ) != NULL ) > { > while ( !feof( fp ) ) > { > while ( ( buf[num] = fgetc( fp ) ) != EOF > && buf[num] != '\n' && buf[num] != '\r' && num < ( MAX_STRING_LENGTH - 2 ) ) > num++; > c = fgetc( fp ); > if ( ( c != '\n' && c != '\r' ) || c == buf[num] ) > ungetc( c, fp ); > buf[num++] = '\n'; > buf[num++] = '\r'; > buf[num] = '\0'; > c = atoi( buf + 1 ); > if ( ( lo < 0 || c >= lo ) && ( hi < 0 || c <= hi ) ) > send_to_pager_color( buf, ch ); > num = 0; > } > /* > * Thanks to stu <sprice@ihug.co.nz> from the mailing list in pointing > * * This out. > */ > fclose( fp ); > } > fpReserve = fopen( NULL_FILE, "r" ); > } > > /* 4159a4421,4423 > case LOG_BUG: > to_channel( str + offset, CHANNEL_BUG, "Bug", level ); > break; 4169a4434,4460 > void toretiredfile( const char *line ) > { > int filler, xx; > char outline[MAX_STRING_LENGTH]; > FILE *wfp; > > outline[0] = '\0'; > > if ( line && line[0] != '\0' ) > { > filler = ( 78 - strlen( line ) ); > if ( filler < 1 ) > filler = 1; > filler /= 2; > for ( xx = 0; xx < filler; xx++ ) > strcat( outline, " " ); > strcat( outline, line ); > } > strcat( outline, "\n\r" ); > wfp = fopen( RETIREDLIST_FILE, "a" ); > if ( wfp ) > { > fputs( outline, wfp ); > fclose( wfp ); > } > } > 4240a4532,4618 > void make_retiredlist( ) > { > DIR *dp; > struct dirent *dentry; > FILE *gfp; > char *word = NULL; > int ilevel, iflags; > WIZENT *wiz, *wiznext; > char buf[MAX_STRING_LENGTH]; > > first_wiz = NULL; > last_wiz = NULL; > > dp = opendir( GOD_DIR ); > > ilevel = 0; > dentry = readdir( dp ); > while ( dentry ) > { > if ( dentry->d_name[0] != '.' ) > { > sprintf( buf, "%s%s", GOD_DIR, dentry->d_name ); > gfp = fopen( buf, "r" ); > if ( gfp ) > { > word = feof( gfp ) ? "End" : fread_word( gfp ); > ilevel = fread_number( gfp ); > fread_to_eol( gfp ); > word = feof( gfp ) ? "End" : fread_word( gfp ); > if ( !str_cmp( word, "Pcflags" ) ) > iflags = fread_number( gfp ); > else > iflags = 0; > fclose( gfp ); > if ( IS_SET( iflags, PCFLAG_RETIRED ) ) > add_to_wizlist( dentry->d_name, 50 ); > } > } > dentry = readdir( dp ); > } > closedir( dp ); > > unlink( RETIREDLIST_FILE ); > sprintf( buf, " Retired Immortals of the %s!", sysdata.mud_name ); > toretiredfile( buf ); > buf[0] = '\0'; > ilevel = 65535; > for ( wiz = first_wiz; wiz; wiz = wiz->next ) > { > if ( buf[0] ) > { > toretiredfile( buf ); > buf[0] = '\0'; > } > toretiredfile( "" ); > if ( strlen( buf ) + strlen( wiz->name ) > 76 ) > { > toretiredfile( buf ); > buf[0] = '\0'; > } > strcat( buf, " " ); > strcat( buf, wiz->name ); > if ( strlen( buf ) > 70 ) > { > toretiredfile( buf ); > buf[0] = '\0'; > } > } > > if ( buf[0] ) > toretiredfile( buf ); > > for ( wiz = first_wiz; wiz; wiz = wiznext ) > { > wiznext = wiz->next; > DISPOSE( wiz->name ); > DISPOSE( wiz ); > } > first_wiz = NULL; > last_wiz = NULL; > } > > void do_makeretiredlist( CHAR_DATA * ch, char *argument ) > { > make_retiredlist( ); > } > 4278,4279d4655 < if ( IS_SET( iflags, PCFLAG_RETIRED ) ) < ilevel = MAX_LEVEL - 15; 4282c4658,4659 < add_to_wizlist( dentry->d_name, ilevel ); --- > if ( !IS_SET( iflags, PCFLAG_RETIRED ) ) > add_to_wizlist( dentry->d_name, ilevel ); 4290c4667 < sprintf( buf, " Masters of the %s!", sysdata.mud_name ); --- > sprintf( buf, " &GAdministrators of the %s!", sysdata.mud_name ); 4309c4686 < towizfile( " Supreme Entity" ); --- > towizfile( " &GSupreme Entity&W" ); 4312c4689 < towizfile( " Infinite" ); --- > towizfile( " &GInfinite&W" ); 4315c4692 < towizfile( " Eternal" ); --- > towizfile( " &GEternal&W" ); 4318c4695 < towizfile( " Ancient" ); --- > towizfile( " &GAncient&W" ); 4321c4698 < towizfile( " Exalted Gods" ); --- > towizfile( " &GExalted Gods&W" ); 4324c4701 < towizfile( " Ascendant Gods" ); --- > towizfile( " &GAscendant Gods&W" ); 4327c4704 < towizfile( " Greater Gods" ); --- > towizfile( " &GGreater Gods&W" ); 4330c4707 < towizfile( " Gods" ); --- > towizfile( " &GGods&W" ); 4333c4710 < towizfile( " Lesser Gods" ); --- > towizfile( " &GLesser Gods&W" ); 4336c4713 < towizfile( " Immortals" ); --- > towizfile( " &GImmortals&W" ); 4339c4716 < towizfile( " Demi Gods" ); --- > towizfile( " &GDemi Gods&W" ); 4342c4719 < towizfile( " Saviors" ); --- > towizfile( " &GSaviors&W" ); 4345c4722 < towizfile( " Creators" ); --- > towizfile( " &GCreators&W" ); 4348c4725 < towizfile( " Acolytes" ); --- > towizfile( " &GAcolytes&W" ); 4351,4354c4728 < towizfile( " Neophytes" ); < break; < case MAX_LEVEL - 15: < towizfile( " Retired" ); --- > towizfile( " &GNeophytes&W" ); 4357c4731 < towizfile( " Guests" ); --- > towizfile( " &GGuests&W" ); 4360c4734 < towizfile( " Servants" ); --- > towizfile( " &GServants&W" ); 4469a4844,4847 > if ( !str_cmp( name, "login_prog" ) ) > return LOGIN_PROG; > if ( !str_cmp( name, "void_prog" ) ) > return VOID_PROG; 4477a4856,4867 > if ( !str_cmp( name, "load_prog" ) ) > return LOAD_PROG; > if ( !str_cmp( name, "imminfo_prog" ) ) > return IMMINFO_PROG; > if ( !str_cmp( name, "cmd_prog" ) ) > return CMD_PROG; > if ( !str_cmp( name, "sell_prog" ) ) > return SELL_PROG; > if ( !str_cmp( name, "tell_prog" ) ) > return TELL_PROG; > if ( !str_cmp( name, "greet_in_fight_prog" ) ) > return GREET_IN_FIGHT_PROG; 5348c5738 < pRoomIndex->room_flags = ROOM_PROTOTYPE; --- > xSET_BIT( pRoomIndex->room_flags, ROOM_PROTOTYPE ); 5401a5792 > pObjIndex->level = 0; 5420a5812 > pObjIndex->level = cObjIndex->level; 5454c5846 < MOB_INDEX_DATA *make_mobile( sh_int vnum, sh_int cvnum, char *name ) --- > MOB_INDEX_DATA *make_mobile( int vnum, int cvnum, char *name ) 5588a5981 > pexit->orig_door = door; 5660c6053 < SET_BIT( pRoomIndex->room_flags, ROOM_NO_MOB ); --- > xSET_BIT( pRoomIndex->room_flags, ROOM_NO_MOB ); 5732a6126,6127 > else if ( !str_cmp( word, "CREDITS" ) ) > load_credits( tarea, fpArea ); 5836a6232,6293 > void load_noauctions( void ) > { > NOAUCTION_DATA *noauc; > FILE *fp; > > if ( !( fp = fopen( SYSTEM_DIR NOAUCTION_LIST, "r" ) ) ) > return; > > for ( ;; ) > { > if ( feof( fp ) ) > { > bug( "Load_noauctions: no 0 found." ); > fclose( fp ); > return; > } > > CREATE( noauc, NOAUCTION_DATA, 1 ); > noauc->vnum = fread_number( fp ); > if ( noauc->vnum == 0 ) > break; > if ( get_obj_index( noauc->vnum ) == NULL ) > { > UNLINK( noauc, first_noauc, last_noauc, next, prev ); > DISPOSE( noauc ); > } > sort_noauctions( noauc ); > save_noauctions( ); > } > DISPOSE( noauc ); > fclose( fp ); > return; > } > > void sort_noauctions( NOAUCTION_DATA * pNoauc ) > { > NOAUCTION_DATA *noauc = NULL; > > if ( !pNoauc ) > { > bug( "Sort_Noauction: NULL pNoauc" ); > return; > } > > pNoauc->next = NULL; > pNoauc->prev = NULL; > > for ( noauc = first_noauc; noauc; noauc = noauc->next ) > { > if ( noauc->vnum > pNoauc->vnum ) > { > INSERT( pNoauc, noauc, first_noauc, next, prev ); > break; > } > } > > if ( !noauc ) > LINK( pNoauc, first_noauc, last_noauc, next, prev ); > return; > } > > 6159c6616 < high = 32766; --- > high = 1073741824; 6181c6638 < high = 32766; --- > high = 1073741824; 6203c6660 < high = 32766; --- > high = 1073741824; 6232a6690 > fprintf( fp, "PortName %s~\n", sys.port_name ); 6234a6693 > fprintf( fp, "NewsPath %s~\n", sys.news_html_path ); 6258a6718 > fprintf( fp, "Tumblepk %d\n", sys.tumble_pk ); 6262a6723,6726 > fprintf( fp, "Damnonavvsmob %d\n", sys.dam_nonav_vs_mob ); > fprintf( fp, "Dammobvsnonav %d\n", sys.dam_mob_vs_nonav ); > fprintf( fp, "Peaceexpmod %d\n", sys.peaceful_exp_mod ); > fprintf( fp, "Deadlyexpmod %d\n", sys.deadly_exp_mod ); 6275a6740,6745 > fprintf( fp, "Pkchannels %d\n", sys.pk_channels ); > fprintf( fp, "Pksilence %d\n", sys.pk_silence ); > fprintf( fp, "SaveVersion %d\n", sys.save_version ); > fprintf( fp, "Wizlock %d\n", sys.wizlock ); > fprintf( fp, "Magichell %d\n", sys.magichell ); > fprintf( fp, "MaxNews %d\n", sys.max_html_news ); 6291a6762,6764 > sys->port_name = NULL; > sys->save_version = 0; /* default value */ > 6321a6795,6797 > KEY( "Dammobvsnonav", sys->dam_mob_vs_nonav, fread_number( fp ) ); > KEY( "Damnonavvsmob", sys->dam_nonav_vs_mob, fread_number( fp ) ); > KEY( "Deadlyexpmod", sys->deadly_exp_mod, fread_number( fp ) ); 6327a6804,6805 > extern bool wizlock; > 6331a6810,6813 > if ( !sys->port_name ) > sys->port_name = str_dup( "mud" ); > if ( sys->wizlock ) > wizlock = TRUE; 6361a6844,6845 > KEY( "Magichell", sys->magichell, fread_number( fp ) ); > KEY( "MaxNews", sys->max_html_news, fread_number( fp ) ); 6369a6854 > KEY( "NewsPath", sys->news_html_path, fread_string( fp ) ); 6377a6863 > KEY( "Peaceexpmod", sys->peaceful_exp_mod, fread_number( fp ) ); 6378a6865 > KEY( "Pkchannels", sys->pk_channels, fread_number( fp ) ); 6379a6867,6868 > KEY( "Pksilence", sys->pk_silence, fread_number( fp ) ); > KEY( "PortName", sys->port_name, fread_string_nohash( fp ) ); 6392a6882 > KEY( "SaveVersion", sys->save_version, fread_number( fp ) ); 6398a6889 > KEY( "Tumblepk", sys->tumble_pk, fread_number( fp ) ); 6403a6895 > KEY( "Wizlock", sys->wizlock, fread_number( fp ) ); 6587c7079 < if ( low_range < 1 || low_range > 32767 ) --- > if ( low_range < 1 || low_range > MAX_VNUM ) 6593c7085 < if ( high_range < 1 || high_range > 32767 ) --- > if ( high_range < 1 || high_range > MAX_VNUM ) 6881c7373 < if ( !neigh->address ) --- > if ( !neigh->address || str_cmp( neigh->name, neigh->address->name ) ) 7063c7555 < project->owner = STRALLOC( "" ); --- > project->owner = STRALLOC( "None" ); 7243a7736,8053 > > /* load_loginmsg, check_loginmsg, fread_loginmsg, etc.. all support the do_message */ > /* command - hugely modified from the orginal housing module by Edmond June 02 */ > void load_loginmsg( ) > { > FILE *fp; > char filename[MAX_INPUT_LENGTH]; > > first_lmsg = NULL; > last_lmsg = NULL; > > sprintf( filename, "%s%s", SYSTEM_DIR, LOGIN_MSG ); > if ( ( fp = fopen( filename, "r" ) ) == NULL ) > { > boot_log( "Load_loginmsg: Cannot open login message file." ); > return; > } > > for ( ;; ) > { > char letter; > char *word; > > letter = fread_letter( fp ); > > if ( letter == '*' ) > { > fread_to_eol( fp ); > continue; > } > > if ( letter != '#' ) > { > bug( "load_loginmsg: # not found. ", 0 ); > break; > } > > word = fread_word( fp ); > > if ( !str_cmp( word, "LOGINMSG" ) ) > { > fread_loginmsg( fp ); > continue; > } > else if ( !str_cmp( word, "END" ) ) > break; > else > { > boot_log( "Load_loginmsg: bad section." ); > continue; > } > } > > fclose( fp ); > fp = NULL; > } > > void fread_loginmsg( FILE * fp ) > { > LMSG_DATA *lmsg = NULL; > char buf[MAX_STRING_LENGTH]; > > CREATE( lmsg, LMSG_DATA, 1 ); > > #if defined(KEY) > #undef KEY > #endif > > #define KEY( literal, field, value ) \ > if ( !str_cmp( word, literal ) ) \ > { \ > field = value; \ > fMatch = TRUE; \ > break; \ > } \ > > for ( ;; ) > { > char *word; > bool fMatch; > > word = fread_word( fp ); > fMatch = FALSE; > > switch ( UPPER( word[0] ) ) > { > case '*': > fMatch = TRUE; > fread_to_eol( fp ); > break; > > case 'E': > if ( !str_cmp( word, "End" ) ) > { > char checkname[MAX_STRING_LENGTH]; > > > if ( !lmsg->name || lmsg->name[0] == '\0' ) > { > bug( "load_loginmsg: Login message with no name", 0 ); > STRFREE( lmsg->text ); > DISPOSE( lmsg ); > return; > } > else > { > sprintf( checkname, "%s%c/%s", PLAYER_DIR, tolower( lmsg->name[0] ), capitalize( lmsg->name ) ); > > if ( access( checkname, F_OK ) != 0 ) > { > bug( "load_loginmsg: Login message expired - %s no longer exists", lmsg->name ); > STRFREE( lmsg->name ); > STRFREE( lmsg->text ); > DISPOSE( lmsg ); > return; > } > } > > LINK( lmsg, first_lmsg, last_lmsg, next, prev ); > return; > } > break; > > case 'N': > KEY( "Name", lmsg->name, fread_string( fp ) ); > break; > > case 'T': > KEY( "Type", lmsg->type, fread_number( fp ) ); > KEY( "Text", lmsg->text, fread_string( fp ) ); > break; > > } > > if ( !fMatch ) > { > sprintf( buf, "Load_loginmsg: no match: %s", word ); > bug( buf, 0 ); > } > } > > } > > void save_loginmsg( ) > { > FILE *fp; > char filename[MAX_INPUT_LENGTH]; > LMSG_DATA *lmsg; > > sprintf( filename, "%s%s", SYSTEM_DIR, LOGIN_MSG ); > if ( ( fp = fopen( filename, "w" ) ) == NULL ) > { > bug( "Save_loginmsg: Cannot open login message file." ); > return; > } > > for ( lmsg = first_lmsg; lmsg; lmsg = lmsg->next ) > { > fprintf( fp, "#LOGINMSG\n" ); > fprintf( fp, "Name %s~\n", lmsg->name ); > if ( lmsg->text ) > fprintf( fp, "Text %s~\n", lmsg->text ); > fprintf( fp, "Type %d\n", lmsg->type ); > fprintf( fp, "End\n" ); > } > > fprintf( fp, "#END\n" ); > fclose( fp ); > fp = NULL; > } > > void add_loginmsg( char *name, sh_int type, char *argument ) > { > LMSG_DATA *lmsg; > > if ( type < 0 || !name || name[0] == '\0' ) > { > bug( "add_loginmsg: bad name or type", 0 ); > return; > } > > CREATE( lmsg, LMSG_DATA, 1 ); > > lmsg->type = type; > lmsg->name = STRALLOC( name ); > if ( argument && argument[0] != '\0' ) > lmsg->text = STRALLOC( argument ); > > LINK( lmsg, first_lmsg, last_lmsg, next, prev ); > save_loginmsg( ); > > return; > } > > char *const login_msg[] = { > /*0*/ "", > /*1*/ "\n\r&GYou did not have enough money for the residence you bid on.\n\r" > "It has been readded to the auction and you've been penalized.\n\r", > /*2*/ "\n\r>here was an error in looking up the seller for the residence\n\r" > "you had bid on. Residence removed and no interaction has taken place.\n\r", > /*3*/ "\n\r>here was no bidder on your residence. Your residence has been\n\r" > "removed from auction and you have been penalized.\n\r", > /*4*/ "\n\r&GYou have successfully received your new residence.\n\r", > /*5*/ "\n\r&GYou have successfully sold your residence.\n\r", > /*6*/ "\n\r&RYou have been outcast from your clan/order/guild. Contact a leader\n\r" > "of that organization if you have any questions.\n\r", > /*7*/ "\n\r&RYou have been silenced. Contact an immortal if you wish to discuss\n\r" > "your sentence.\n\r", > /*8*/ "\n\r&RYou have lost your ability to set your title. Contact an immortal if you\n\r" > "wish to discuss your sentence.\n\r", > /*9*/ "\n\r&RYou have lost your ability to set your biography. Contact an immortal if\n\r" > "you wish to discuss your sentence.\n\r", > /*10*/ "\n\r&RYou have been sent to hell. You will be automatically released when your\n\r" > "sentence is up. Contact an immortal if you wish to discuss your sentence.\n\r", > /*11*/ "\n\r&RYou have lost your ability to set your own description. Contact an\n\r" > "immortal if you wish to discuss your sentence.\n\r", > /*12*/ "\n\r&RYou have lost your ability to set your homepage address. Contact an\n\r" > "immortal if you wish to discuss your sentence.\n\r", > /*13*/ "\n\r&RYou have lost your ability to \"beckon\" other players. Contact an\n\r" > "immortal if you wish to discuss your sentence.\n\r", > /*14*/ "\n\r&RYou have lost your ability to send tells. Contact an immortal if\n\r" > "you wish to discuss your sentence.\n\r", > /*15*/ "\n\r&CYour character has been frozen. Contact an immortal if you wish\n\r" > "to discuss your sentence.\n\r", > /*16*/ "\n\r&RYou have lost your ability to emote. Contact an immortal if\n\r" > "you wish to discuss your sentence.\n\r", > /*17*/ "RESERVED FOR LINKDEAD DEATH MESSAGES", > /*18*/ "RESERVED FOR CODE-SENT MESSAGES" > }; > > /* MAX_MSG = 18 - IF ADDING MESSAGE TYPES, ENSURE YOU BUMP THIS VALUE IN MUD.H */ > > void check_loginmsg( CHAR_DATA * ch ) > { > char buf[MAX_STRING_LENGTH]; > LMSG_DATA *lmsg, *lmsg_next; > > if ( !ch || IS_NPC( ch ) ) > return; > > for ( lmsg = first_lmsg; lmsg; lmsg = lmsg_next ) > { > lmsg_next = lmsg->next; > > if ( !str_cmp( lmsg->name, ch->name ) ) > { > > if ( lmsg->type > MAX_MSG ) > { > sprintf( buf, "Error: Unknown login msg: %d for %s.", lmsg->type, ch->name ); > bug( buf, 0 ); > } > > switch ( lmsg->type ) > { > case 0: /* Imm sent message */ > { > if ( !lmsg->text || lmsg->text[0] == '\0' ) > { > bug( "check_loginmsg: NULL loginmsg text for type 0", 0 ); > STRFREE( lmsg->name ); > UNLINK( lmsg, first_lmsg, last_lmsg, next, prev ); > DISPOSE( lmsg ); > continue; > } > sprintf( buf, "\n\r&YThe game administrators have left you the following message:\n\r%s\n\r", > lmsg->text ); > send_to_char_color( buf, ch ); > break; > } > case 17: /* Death message */ > { > if ( !lmsg->text || lmsg->text[0] == '\0' ) > { > bug( "check_loginmsg: NULL loginmsg text for type 17", 0 ); > STRFREE( lmsg->name ); > UNLINK( lmsg, first_lmsg, last_lmsg, next, prev ); > DISPOSE( lmsg ); > continue; > } > sprintf( buf, "\n\r&RYou were killed by %s while your character was link-dead.\n\r", > lmsg->text ); > send_to_char_color( buf, ch ); > sprintf( buf, "You should look for your corpse immediately.\n\r" ); > send_to_char_color( buf, ch ); > break; > } > case 18: /* Code-sent message for 'World change' notice */ > { > if ( !lmsg->text || lmsg->text[0] == '\0' ) > { > bug( "check_loginmsg: NULL loginmsg text for type 18", 0 ); > STRFREE( lmsg->name ); > UNLINK( lmsg, first_lmsg, last_lmsg, next, prev ); > DISPOSE( lmsg ); > continue; > } > sprintf( buf, "\n\r&GA change in the Realms has affected you personally:\n\r%s\n\r", > lmsg->text ); > send_to_char_color( buf, ch ); > break; > } > default: > send_to_char_color( login_msg[lmsg->type], ch ); > break; > } > > STRFREE( lmsg->name ); > if ( lmsg->text ) > STRFREE( lmsg->text ); > UNLINK( lmsg, first_lmsg, last_lmsg, next, prev ); > DISPOSE( lmsg ); > save_loginmsg( ); > } > } > > return; > }