From: stu <sprice@ihug.co.nz>
Subject: complete guide to adding new object flags :)

Warning long message :)


umm well i made my extra object flags called extra_flags2 :)
int extra_flags2 in the structure one object and object index data etc

define all the extra bits etc..

#define    ITEM_ANTI_NEWCLASS BV00

etc

add the stuff in act_obj.c i think it is to see whether a class can wear
this or not

in build.c

i added this

char *      const o_flags2    [] =
{
"antiwarlock","antipaladin","antininja","rare","antiaugurer","antiranger","a
ntimortal","r8","r9","r10"
,"r11","r12","r13","r14","r15","r16","r17","r18","r19","r20","r21","r22","r23"
,"r24","r25","r26","r27","r28","r29","r30","r31"
};

int get_oflag2( char *flag )
{
    int x;

    for ( x = 0; x < 32; x++ )
      if ( !str_cmp( flag, o_flags2[x] ) )
        return x;
    return -1;
}

in oset..

    if ( !str_cmp( arg2, "flags2" ) )
    {
	if ( !can_omodify( ch, obj ) )
	  return;
	if ( !argument || argument[0] == '\0' )
	{
	   send_to_char( "Usage: oset <object> flags <flag> [flag]...\n\r", ch );
	   return;
	}
	while ( argument[0] != '\0' )
	{
	   argument = one_argument( argument, arg3 );
	   value = get_oflag2( arg3 );
         value2 = get_oflag( arg3 );
	   if ( value < 0 || value > 31 )
         {
	     ch_printf( ch, "Unknown flag: %s\n\r", arg3 );
           return;
         }
	   else
	   {
	       TOGGLE_BIT(obj->extra_flags2, 1 << value);
	       if ( 1 << value2 == ITEM_PROTOTYPE )
	         obj->pIndexData->extra_flags2 = obj->extra_flags2;
	
	   }
	}
	if ( IS_OBJ_STAT( obj, ITEM_PROTOTYPE ) )
	  obj->pIndexData->extra_flags2 = obj->extra_flags2; 
	return;
    }

in... handler.c

char *extra_bit_name2( int extra_flags2 )
{
    static char buf[512];

    buf[0] = '\0';
    if ( extra_flags2 & ITEM_ANTI_WARLOCK ) strcat( buf, " anti-warlock"
);
    if ( extra_flags2 & ITEM_ANTI_PALADIN ) strcat( buf, " anti-paladin"
);
    if ( extra_flags2 & ITEM_ANTI_NINJA   ) strcat( buf, " anti-ninja" );
    if ( extra_flags2 & ITEM_RARE         ) strcat( buf, " rare"        );
    if ( extra_flags2 & ITEM_ANTI_AUGURER ) strcat( buf, " anti-augurer" );
    if ( extra_flags2 & ITEM_ANTI_RANGER  ) strcat( buf, " anti-ranger" );
    if ( extra_flags2 & ITEM_ANTI_MORTAL  ) strcat( buf, " anti-mortal");
    return ( buf[0] != '\0' ) ? buf+1 : "none";
}

in void clean_obj( OBJ_INDEX_DATA *obj )

      obj->extra_flags2  = 0;

in clone_object
    clone->extra_flags2 = obj->extra_flags2;

in group_object
    &&   obj1->extra_flags2   == obj2->extra_flags2

 in db.c

in create_object
    obj->extra_flags2   = pObjIndex->extra_flags2;
im make_object
        pObjIndex->extra_flags2     = 0;

in load_objects...

	x1=x2=x3=x4=x5=0;
	sscanf( ln, "%d %d %d %d %d",
		&x1, &x2, &x3, &x4 , &x5);
	pObjIndex->item_type		= x1;
	pObjIndex->extra_flags		= x2;
      pObjIndex->extra_flags2        = x3;
	pObjIndex->wear_flags		= x4;
	pObjIndex->layers		= x5;

ok but heres the thing...
dont change this loading part first.. cause if u do it will look for data in
the area files that dont exist..

so go back to build.c 
add something like this

	if ( pObjIndex->layers )
	  fprintf( fpout, "%d %d %d %d %d\n",	pObjIndex->item_type,
						pObjIndex->extra_flags,
                                                pObjIndex->extra_flags2,
						pObjIndex->wear_flags,
						pObjIndex->layers	);
	else
	  fprintf( fpout, "%d %d %d %d\n",	pObjIndex->item_type,
					pObjIndex->extra_flags,
                              pObjIndex->extra_flags2,
					pObjIndex->wear_flags		);

then compile it... compile it without changing db.c to read the extra data
field yet
ok now u wanna go thru and foldarea on every area u have..
this will write out the extra field for extra_flags2...
u may wanna backup the areas first incase

ok after u have resaved every area. halt the mud, edit db.c to above to read
in the new data

now it will be read and writing to the areas..

then u gotta edit save.c to write the new data to chrs, pretty easy..
umm and u prolly wanna add stuff to ostat in act_wiz.c so u can see the new
fields etc
i also added stuff to the identify spell so they could see the new flags..
I think i covered everything :)
umm hope that helped...
write back if u have any probs..
stu