o From: "Sammy" To: Subject: re: snippet, inlay. This is the snippet itself, I had trouble with using attachments. Date: Tuesday, December 25, 2001 6:18 AM Inlay is a system in which we first take an object type "settable" and give players the ability to set these gemstones into a piece of armor or a weapon to add enchantments to that item. Before the process, I'm placing the helpfile I made. I stripped out any color references. Anything that starts with *** in this document is a note that you are changing active file. Anything that starts with an astrisk (*) indicates instructions, do not insert these instructions into your code, as they will not compile :) All I ask if you use this is that you leave my name credited in your interp.h file and that you email me any improvements you find, as I am always trying to make things better. Feel free to tweek actual modifying values to be appropriate to your game. These are appropriate to mine :) If you choose to use this in your game, please drop me an email so that I know my work wasn't in vain. Install at your own risk, I do not give tech support. It works fine with my game. Thank you! Samantha, Implementor of the Crucible. ***HELP FILE*** o->>=>>> INLAY GEMS GEMSTONES SAPPHIRE RUBY EMERALD DIAMOND TOPAZ SKULL <<<=<<-o Syntax: Inlay (gemstone) (target) The gemstone used MUST be a "settable" gemstone, as can be identified using various means. The target MUST be a weapon or a piece of armor. The type of gemstone used will determine the affect the inlay had upon the target item. Different Gem types do different things, and the closer to perfect the gem is the more it adds. Below is a table: Sapphire: chip: add 75 mana to the target item. flawed: add 105 mana to the target item. flawless: add 135 mana to the target item. perfect: add 165 mana to the target item. Rubies: chip: add 75 hit points to the target item. flawed: add 105 hit points to the target item. flawless: add 135 hit points to the target item. perfect: add 165 hit points to the target item. Emeralds: chip: add 75 moves to the target item. flawed: add 105 moves to the target item. flawless: add 135 moves to the target item. perfect: add 165 moves to the target item. Diamonds: chip: add 10 hitroll to the target item. flawed: add 15 hitroll to the target item. flawless: add 20 hitroll to the target item. perfect: add 25 hitroll to the target item. Topazes: chip: add -125 AC to the target item. flawed: add -175 AC to the target item. flawless: add -225 AC to the target item. perfect: add -275 AC to the target item. Skulls: chip: add 10 damroll to the target item. flawed: add 15 damroll to the target item. flawless: add 20 damroll to the target item. perfect: add 25 damroll to the target item. For now, an item may only be inlayed twice. ***END HELP FILE*** ***First, in merc.h.... *------------------------------------------------ *Under the heading "extra flags used for objects" *add these lines in, using whatever asignment values *you have available. This takes 2 seperate definitions. *------------------------------------------------ #define ITEM_INLAY1 (first open slot) #define ITEM_INLAY2 (second open slot) *------------------------------------------------ *Add this line to the end of your object type definitions, *and assign it a value appropriately. *------------------------------------------------ #define ITEM_SOCKETS value *------------------------------------------------ *Insert the following in merc.h after the section *for "values for containers used in #OBJECTS." *------------------------------------------------ /* * Values for socketing items (value[0]). * Used in #OBJECTS. */ #define SOC_SAPPHIRE 1 #define SOC_RUBY 2 #define SOC_EMERALD 3 #define SOC_DIAMOND 4 #define SOC_TOPAZ 5 #define SOC_SKULL 6 /* * Values for socketing items (value[1]). * used in #OBJECTS */ #define GEM_CHIPPED 0 #define GEM_FLAWED 1 #define GEM_FLAWLESS 2 #define GEM_PERFECT 3 ***Then in db.c... *------------------------------------------------ *You will find a list of object types in a case *statement, after 'CASE: ITEM_KEY:', add the folowing *line: *------------------------------------------------ CASE: ITEM_SOCKETS: ***Then in bit.c... *------------------------------------------------ *Add in the following line just before the last line *in the list under: *const struct flag_type type_flags[] = *------------------------------------------------ { "settable", ITEM_SOCKETS, TRUE }, //Samantha, Aug 2000 ***Then in interp.h... *------------------------------------------------ *Add in the following line into your declarations *listing, I added mine after motd. *------------------------------------------------ DECLARE_DO_FUN( do_inlay ); ***Then in interp.c... *------------------------------------------------ * Add the following line into your command table, * I added mine in after "inventory". *------------------------------------------------ { "inlay", do_inlay, POS_RESTING, 0, LOG_ALWAYS, 1, 1 }, ***Then in act_olc.c...ADD THIS PART ONLY IF YOU HAVE OLC *------------------------------------------------ *In void show_obj_values, tag this onto the end after *your last item type, but before closing the case *statment. *------------------------------------------------ case ITEM_SOCKETS: sprintf( buf, "[v0] Type: %s\n\r", flag_string( socket_flags, obj->value[0] ) ); send_to_char( buf, ch ); sprintf( buf, "[v1] Value: %s\n\r", flag_string( socket_values, obj->value[1] ) ); send_to_char( buf, ch ); break; *------------------------------------------------ *In bool set_obj_values, tag this onto the end after *your last item type, but before closing the case *statement. *------------------------------------------------ case ITEM_SOCKETS: switch( value_num ) { default: do_help( ch, "SOCKET_LIST" ); return FALSE; break; case 0: send_to_char( "INLAY TYPE SET.\n\r\n\r", ch ); pObj->value[0] = atoi( argument ); break; case 1: send_to_char( "GEM VALUE SET.\n\r\n\r", ch ); pObj->value[1] = atoi( argument ); break; } break; ***Then in magic.c...this part will allow you to identify ***settable objects. *----------------------------------------------- * Insert the following in the spell "identify" * at the end of the object types, but before closing * the case statement. *----------------------------------------------- case ITEM_SOCKETS: send_to_char("Gem type is: ",ch); switch (obj->value[0]) { case 0 : send_to_char("none. Tell an immortal.\n\r",ch); break; case 1 : send_to_char("sapphire.\n\r",ch); break; case 2 : send_to_char("ruby.\n\r",ch); break; case 3 : send_to_char("emerald.\n\r",ch); break; case 4 : send_to_char("diamond.\n\r",ch); break; case 5 : send_to_char("topaz.\n\r",ch); break; case 6 : send_to_char("skull.\n\r",ch); break; default : send_to_char("Unknown. Tell an immortal.\n\r",ch); break; } send_to_char("Gem value is: ",ch); switch (obj->value[1]) { case 0 : send_to_char("chip.\n\r",ch); break; case 1 : send_to_char("flawed.\n\r",ch); break; case 2 : send_to_char("flawless.\n\r",ch); break; case 3 : send_to_char("perfect.\n\r",ch); break; default : send_to_char("Unknown. Tell an immortal.\n\r",ch); break; } break; ***Then in act_wiz.c...this part will allow you to stat ***settable objects. *----------------------------------------------- * Insert the following into the case statement in * ostat at the end of the object types, but before closing * the case statement. *----------------------------------------------- case ITEM_SOCKETS: send_to_char("Gem type is: ",ch); switch (obj->value[0]) { case 0 : send_to_char("none. Tell an immortal.\n\r",ch); break; case 1 : send_to_char("sapphire.\n\r",ch); break; case 2 : send_to_char("ruby.\n\r",ch); break; case 3 : send_to_char("emerald.\n\r",ch); break; case 4 : send_to_char("diamond.\n\r",ch); break; case 5 : send_to_char("topaz.\n\r",ch); break; case 6 : send_to_char("skull.\n\r",ch); break; default : send_to_char("Unknown. Something is wrong, fix this object.\n\r",ch); break; } send_to_char("Gem value is: ",ch); switch (obj->value[1]) { case 0 : send_to_char("chip.\n\r",ch); break; case 1 : send_to_char("flawed.\n\r",ch); break; case 2 : send_to_char("flawless.\n\r",ch); break; case 3 : send_to_char("perfect.\n\r",ch); break; default : send_to_char("Unknown. Something is wrong, fix this object.\n\r",ch); break; } break; ***Then in act_obj.c...here's the actual inlay process. *------------------------------------------------- * Add the following routine. I added it after * void get_obj, but where you put it is up to you. *------------------------------------------------- void do_inlay( CHAR_DATA *ch, char *argument ) { CHAR_DATA *victim; OBJ_DATA *sockets; AFFECT_DATA *paf; OBJ_DATA *obj; char arg1[MAX_INPUT_LENGTH]; char arg2[MAX_INPUT_LENGTH]; int value; argument = one_argument( argument, arg1 ); argument = one_argument( argument, arg2 ); obj = get_obj_carry(ch, arg2); sockets = get_obj_carry(ch, arg1); if( sockets == '\0' ) { send_to_char( "The inlaid object must be a settable one.\n\r", ch ); return; } if( obj == '\0' ) { send_to_char( "What would you like to set this object into?\n\r", ch ); return; } if( sockets->item_type != ITEM_SOCKETS ) { send_to_char( "You can only use settable items to inlay.\n\r",ch); return; } if( (obj = get_obj_carry( ch, arg2 )) == NULL ) { send_to_char( "You don't have that.\n\r", ch ); return; } if( IS_SET(obj->extra_flags,ITEM_INLAY2) ) { send_to_char( "You cannot fit another item into that.\n\r", ch); return; } if( obj->item_type != ITEM_WEAPON && obj->item_type != ITEM_ARMOR) { send_to_char( "You may only set gems into weapons and armor.\n\r",ch); return; } value = sockets->value[1]; extract_obj( sockets, TRUE ); if( IS_SET(obj->extra_flags,ITEM_INLAY1) ) { REMOVE_BIT(obj->extra_flags,ITEM_INLAY1); SET_BIT(obj->extra_flags,ITEM_INLAY2); } else SET_BIT(obj->extra_flags,ITEM_INLAY1); switch ( sockets->value[0] ) { case 1: send_to_char( "You carefully set a sapphire into the spot " "provided and it stays nicely.\n\r",ch); if (affect_free == NULL) paf = alloc_perm(sizeof(*paf)); else { paf = affect_free; affect_free = affect_free->next; } paf = new_affect(); paf->where = TO_AFFECTS; paf->value[AFF_TYPE] = -1; paf->duration = -1; paf->value[AFF_LOCATION] = APPLY_MANA; paf->value[AFF_MODIFIER] = 75 + (value * 30); paf->value[AFF_BITVECTOR] = 0; paf->next = obj->affected; obj->affected = paf; break; case 2: send_to_char( "You carefully set a ruby into the spot " "provided and it stays nicely.\n\r",ch); if (affect_free == NULL) paf = alloc_perm(sizeof(*paf)); else { paf = affect_free; affect_free = affect_free->next; } paf = new_affect(); paf->where = TO_AFFECTS; paf->value[AFF_TYPE] = -1; paf->duration = -1; paf->value[AFF_LOCATION] = APPLY_HIT; paf->value[AFF_MODIFIER] = 75 + (value * 30); paf->value[AFF_BITVECTOR] = 0; paf->next = obj->affected; obj->affected = paf; break; case 3: send_to_char( "You carefully set an emerald into the " "spot provided and it stays nicely.\n\r",ch); if (affect_free == NULL) paf = alloc_perm(sizeof(*paf)); else { paf = affect_free; affect_free = affect_free->next; } paf = new_affect(); paf->where = TO_AFFECTS; paf->value[AFF_TYPE] = -1; paf->duration = -1; paf->value[AFF_LOCATION] = APPLY_MOVE; paf->value[AFF_MODIFIER] = 75 + (value * 30); paf->value[AFF_BITVECTOR] = 0; paf->next = obj->affected; obj->affected = paf; break; case 4: send_to_char( "You carefully set a diamond into the " "spot provided and it stays nicely.\n\r",ch); if (affect_free == NULL) paf = alloc_perm(sizeof(*paf)); else { paf = affect_free; affect_free = affect_free->next; } paf = new_affect(); paf->where = TO_AFFECTS; paf->value[AFF_TYPE] = -1; paf->duration = -1; paf->value[AFF_LOCATION] = APPLY_HITROLL; paf->value[AFF_MODIFIER] = 10 + (value * 5); paf->value[AFF_BITVECTOR] = 0; paf->next = obj->affected; obj->affected = paf; break; case 5: send_to_char( "You carefully set a topaz into the " "spot provied and it stays nicely.\n\r", ch); if (affect_free == NULL) paf = alloc_perm(sizeof(*paf)); else { paf = affect_free; affect_free = affect_free->next; } paf = new_affect(); paf->where = TO_AFFECTS; paf->value[AFF_TYPE] = -1; paf->duration = -1; paf->value[AFF_LOCATION] = APPLY_AC; paf->value[AFF_MODIFIER] = -125 - (value * 50); paf->value[AFF_BITVECTOR] = 0; paf->next = obj->affected; obj->affected = paf; break; case 6: send_to_char( "You manage to set the tiny skull into the " "spot provided and it stays nicely.\n\r", ch); if (affect_free == NULL ) paf = alloc_perm(sizeof(*paf)); else { paf = affect_free; affect_free = affect_free->next; } paf = new_affect(); paf->where = TO_AFFECTS; paf->value[AFF_TYPE] = -1; paf->duration = -1; paf->value[AFF_LOCATION] = APPLY_DAMROLL; paf->value[AFF_MODIFIER] = 10 + (value * 5); paf->value[AFF_BITVECTOR] = 0; paf->next = obj->affected; obj->affected = paf; break; default: send_to_char( "Are you sure that's something you can " "inset?.\n\r", ch ); return; } return; } -- ROM mailing list ROM@rom.org http://www.rom.org/cgi-bin/mailman/listinfo/rom