/*************************************************************************** * FALLEN ANGELS mud is protected by french law of intelectual * * property. we share freely all we have coded * * provided this message isn't removed from the * * files and you respect the name of all the * * coders,area builders, and all the Diku,Merc, * * Rom licences. * * * * Thank to : ROM consortium . * * Big thank to : Gary Gygax !!!!!!!!!!!!!! * * * * Fallen Angel project by : Loran ( laurent zilbert ) * * Silfen or * * Gwendoline ( jerome despret ) * * * * despret@ecoledoc.lip6.fr ... loran@hotmail.com * ***************************************************************************/ /*************************************************************************** * * * To use this snipet you must set the following line in the "fileident" * * help. * * * * Coded for Fallen Angels by : Zilber laurent,Despret jerome. * * * * And send a mail to say you use it ( feel free to comment ) at : * * * * [despret@ecoledoc.lip6.fr] or/and at [loran@hotmail.com] * ****************************************************************************/ /*************************************************************************** * * * If you want to put this snipet on your web site you are allowed to but * * the file must remain unchanged and you have to send us a mail at : * * * * [despret@ecoledoc.lip6.fr] or/and at [loran@hotmail.com] * * with the site URL. * * * ***************************************************************************/ /*************************************************************************** This snipet allow you to ident stuff rom area directly to a file with you imm. The wext version will allow ident rooms and mobs this one work only for objects. Syntax : fileident [mob/obj/room] [begin vnum] [end vnum] [file name] I recommand you to give it to MAW_LEVEL imp only because it write file to your account. Next version shoudl use a tmp file and mail the result to a specified email for imms that do not posses the account the mud is runing on. Jerome. ****************************************************************************/ #if defined(macintosh) #include <types.h> #include <time.h> #else #include <sys/types.h> #include <sys/time.h> #endif #include <stdio.h> #include <string.h> #include <stdlib.h> #include "merc.h" #include "db.h" #include "recycle.h" #include "magic.h" void do_fileident( CHAR_DATA *ch, char *argument ) { char buf[MAX_STRING_LENGTH]; char word[20]; char start[20]; char end[20]; char file[20]; int svnum; int evnum; int vnum; int i; FILE *fp; AFFECT_DATA *paf; int nMatch=0; extern int top_obj_index; OBJ_INDEX_DATA *pObjIndex; file[0] = '\0'; argument = one_argument( argument , word ); argument = one_argument( argument , start ); argument = one_argument( argument , end ); argument = one_argument( argument , file ); svnum = atoi(start); evnum = atoi(end); if(file[0] == '\0') { send_to_char("syntax : fileident [mob/obj/room] [begin vnum] [end vnum] [file name]\n",ch); return; } sprintf(buf,"ident/%s.id",file); if ( ( fp = fopen( buf, "w" ) ) == NULL ) { perror( buf ); return; } if( !str_cmp(word,"obj") || !str_cmp(word,"object") ) { for ( vnum = svnum; (nMatch < top_obj_index) && (vnum < evnum) ; vnum++ ) { if ( ( pObjIndex = get_obj_index( vnum ) ) != NULL ) { OBJ_DATA *obj=NULL; nMatch++; fprintf( fp, "Name(s): %s\n", pObjIndex->name ); fprintf( fp, "Vnum: %d Format: %s Type: %s Resets: %d\n", pObjIndex->vnum, pObjIndex->new_format ? "new" : "old", item_name(pObjIndex->item_type), pObjIndex->reset_num ); fprintf( fp, "Short description: %s\nLong description: %s\n", pObjIndex->short_descr, pObjIndex->description ); fprintf( fp, "Wear bits: %s\nExtra bits: %s\n", wear_bit_name(pObjIndex->wear_flags), extra_bit_name( pObjIndex->extra_flags ) ); fprintf( fp, "Weight : %d\n",pObjIndex->weight); fprintf( fp, "Values: %d %d %d %d %d\n", pObjIndex->value[0], pObjIndex->value[1], pObjIndex->value[2], pObjIndex->value[3], pObjIndex->value[4] ); fprintf( fp, "\nLevel: %d Cost: %d Condition: %d\n", pObjIndex->level, pObjIndex->cost, pObjIndex->condition ); switch ( pObjIndex->item_type ) { case ITEM_SCROLL: case ITEM_POTION: case ITEM_PILL: fprintf( fp, "Level %d spell(s) of:", pObjIndex->value[0] ); if(pObjIndex->value[1] >= 0 && pObjIndex->value[1] < MAX_SKILL ) { fprintf(fp ," '%s'", skill_table[pObjIndex->value[1]].name); } if(pObjIndex->value[2] >= 0 && pObjIndex->value[2] < MAX_SKILL ) { fprintf(fp ," '%s'", skill_table[pObjIndex->value[2]].name); } if(pObjIndex->value[3] >= 0 && pObjIndex->value[3] < MAX_SKILL ) { fprintf(fp ," '%s'", skill_table[pObjIndex->value[3]].name); } if(pObjIndex->value[4] >= 0 && pObjIndex->value[4] < MAX_SKILL ) { fprintf(fp ," '%s'", skill_table[pObjIndex->value[4]].name); } fprintf(fp ,"\n"); break; case ITEM_WAND: case ITEM_STAFF: fprintf( fp, "Has %d(%d) charges of level %d", pObjIndex->value[1], pObjIndex->value[2], pObjIndex->value[0] ); if ( pObjIndex->value[3] >= 0 && pObjIndex->value[3] < MAX_SKILL ) { fprintf(fp ," '%s'\n", skill_table[pObjIndex->value[3]].name); } break; case ITEM_DRINK_CON: fprintf(fp,"It holds %s-colored %s.\n", liq_table[pObjIndex->value[2]].liq_color, liq_table[pObjIndex->value[2]].liq_name); break; case ITEM_WEAPON: fprintf(fp,"Weapon type is "); switch (pObjIndex->value[0]) { case(WEAPON_EXOTIC): fprintf(fp,"exotic\n"); break; case(WEAPON_SWORD): fprintf(fp,"sword\n"); break; case(WEAPON_DAGGER): fprintf(fp,"dagger\n"); break; case(WEAPON_SPEAR): fprintf(fp,"spear/staff\n"); break; case(WEAPON_MACE): fprintf(fp,"mace/club\n"); break; case(WEAPON_AXE): fprintf(fp,"axe\n"); break; case(WEAPON_FLAIL): fprintf(fp,"flail\n"); break; case(WEAPON_WHIP): fprintf(fp,"whip\n"); break; case(WEAPON_POLEARM): fprintf(fp,"polearm\n"); break; default: fprintf(fp,"unknown\n"); break; } if (pObjIndex->new_format) fprintf(fp,"Damage is %dd%d (average %d)\n", pObjIndex->value[1],pObjIndex->value[2], (1 + pObjIndex->value[2]) * pObjIndex->value[1] / 2); else fprintf( fp, "Damage is %d to %d (average %d)\n", pObjIndex->value[1], pObjIndex->value[2], ( pObjIndex->value[1] + pObjIndex->value[2] ) / 2 ); fprintf(fp,"Damage noun is %s.\n", ( pObjIndex->value[3] > 0 && pObjIndex->value[3] < MAX_DAMAGE_MESSAGE) ? attack_table[pObjIndex->value[3]].noun : "undefined"); if (pObjIndex->value[4]) /* weapon flags */ { fprintf(fp,"Weapons flags: %s\n", weapon_bit_name(pObjIndex->value[4])); } break; case ITEM_ARMOR: fprintf( fp, "Armor class is %d pierce, %d bash, %d slash, and %d vs. magic\n", pObjIndex->value[0], pObjIndex->value[1], pObjIndex->value[2], pObjIndex->value[3] ); break; case ITEM_CONTAINER: fprintf(fp,"Capacity: %d# Maximum weight: %d# flags: %s\n", pObjIndex->value[0], pObjIndex->value[3], cont_bit_name(pObjIndex->value[1])); if (pObjIndex->value[4] != 100) { fprintf(fp,"Weight multiplier: %d%%\n", pObjIndex->value[4]); } break; default : break; } for ( paf = pObjIndex->affected; paf != NULL; paf = paf->next ) { fprintf( fp, "Affects %s by %d, level %d\n", affect_loc_name( paf->location ), paf->modifier,paf->level ); if (paf->bitvector) { switch(paf->where) { case TO_AFFECTS: fprintf(fp,"Adds %s affect.\n", affect_bit_name(paf->bitvector)); break; case TO_WEAPON: fprintf(fp,"Adds %s weapon flags.\n", weapon_bit_name(paf->bitvector)); break; case TO_OBJECT: fprintf(fp,"Adds %s object flag.\n", extra_bit_name(paf->bitvector)); break; case TO_IMMUNE: fprintf(fp,"Adds immunity to %s.\n", imm_bit_name(paf->bitvector)); break; case TO_RESIST: fprintf(fp,"Adds resistance to %s.\n\r", imm_bit_name(paf->bitvector)); break; case TO_VULN: fprintf(fp,"Adds vulnerability to %s.\n\r", imm_bit_name(paf->bitvector)); break; default: fprintf(fp,"Unknown bit %d: %d\n\r", paf->where,paf->bitvector); break; } } } if ( ( obj = get_obj_world( ch, pObjIndex->name ) ) == NULL ) { fprintf(fp, "\nNot loaded.\n" ); } else { fprintf( fp, "\nIn room: %d In object: %s Carried by: %s Wear_loc: %d\n", obj->in_room == NULL ? 0 : obj->in_room->vnum, obj->in_obj == NULL ? "(none)" : obj->in_obj->short_descr, obj->carried_by == NULL ? "(none)" : obj->carried_by->name , obj->wear_loc ); } fprintf(fp,"\n---------------------------------------\n\n"); } } } else { send_to_char("syntax : fileident [mob/obj/room] [begin vnum] [end vnum] [file name]",ch); } fclose(fp); return; }