Embalmer code [by Mendar]
Snippet Posted Wednesday, August 12th @ 11:27:03 PM, by George Greer in the Specials dept.
Added Dec 3, 1996. Click the link below to read it or download it.

From: Paul Shinn <wombat@WPI.EDU>
Subject:  Embalmer

buy corpses for 1-2gp and make 1000gp trophy bags.  Because of how Merc
is set up, you also need to change the "level" of corpses to level 1
instead of level 0, shopkeepers don't buy level 0 stuff.

    Add this to the spell table in CONST.C

         "make bag",     { 37, 37, 37, 37 },
         spell_make_bag, TAR_OBJ_INV,            POS_STANDING,
         NULL,                   SLOT(50),       100,    24,
         "",                     "!Make Bag!"*/

    Put this in MAGIC.C

void spell_make_bag( int sn, int level, CHAR_DATA *ch, void *vo )
{
     static char *headers[] = { "corpse of the ", "corpse of The ",
                                "corpse of an ", "corpse of An ",
                                "corpse of a ", "corpse of A ",
                                "corpse of " }; // (This one must be last)
     OBJ_DATA *obj = (OBJ_DATA *) vo;
     char buf[MAX_STRING_LENGTH];
     int i;

     if ( obj->item_type != ITEM_CORPSE_NPC && obj->item_type != ITEM_CORPSE_PC
)
         return;

     for (i = 0; i < 7; i++)
        {
        int len = strlen(headers[i]);
        if ( memcmp(obj->short_descr, headers[i], len) == 0 )
           {
           sprintf( buf, "bag %s", obj->short_descr+len );
           free_string( obj->name );
           obj->name = str_dup(buf);

           sprintf( buf, "A bag of fine %s hide catches your eye.  ",
              obj->short_descr+len );
           free_string( obj->description );
           obj->description = str_dup( buf );

           sprintf( buf, "bag made from %s hide", obj->short_descr+len );
           free_string( obj->short_descr );
           obj->short_descr = str_dup( buf );

           break;
           }
        }

     obj->item_type = ITEM_CONTAINER;
     obj->wear_flags = ITEM_HOLD|ITEM_TAKE;
     obj->timer = 0;
     obj->weight = 5;
     obj->level = level/3;
     obj->cost = level * 50;
     obj->value[0] = level * 10;                 /* Weight capacity */
     obj->value[1] = 1;                          /* Closeable */
     obj->value[2] = -1;                         /* No key needed */
     obj->pIndexData = get_obj_index( 5660 );    /* So it's not a corpse */

     act( "Your new $p looks pretty snazzy.", ch, obj, NULL, TO_CHAR );
     act( "$n's new $p looks pretty snazzy.", ch, obj, NULL, TO_ROOM );

     send_to_char( "Ok.\n\r", ch );
     return;
}

/*

  Put this in a zone.  If you change the number change it in the code
  as well.

#5660
bag~
a generic bag~
A generic bag generates the VNUM for the 'make purse' spell.  ~
~
15 0 1
50 0 0 0
5 50 0
*/

Put this in SPECIAL.C.  Remember to add this to spec_lookup() as well.

bool spec_taxidermist( CHAR_DATA *ch )
{
    OBJ_DATA *inv;
    int sn;

    if ( ch->position != POS_STANDING )
        return FALSE;

    if ( ch->pIndexData->pShop == 0 ||
         time_info.hour < ch->pIndexData->pShop->open_hour ||
         time_info.hour > ch->pIndexData->pShop->close_hour )
       return FALSE;

    for ( inv = ch->carrying; inv != NULL; inv = inv->next_content )
    {
    if (inv->item_type == ITEM_CORPSE_NPC)
       {
       if ( ( sn = skill_lookup( "make bag" ) ) >= 0 )
          (*skill_table[sn].spell_fun) ( sn, ch->level, ch, inv );
       return TRUE;
       }
    else if (inv->wear_loc == WEAR_NONE && number_percent() < 5)
       {
       act( "$n suggests you buy $p.", ch, inv, NULL, TO_ROOM );
       return TRUE;
       }
    }

    return FALSE;
}



<< Elevator Special [by Chris Warren] | Reply | View as text | Threaded | Emblamer code [by Mendar] >>

 


Related Links
  download
Related Articles
More by greerga
 
 

CircleMUD Snippets
 
Note: Not all of these snippets will work perfectly with your version of code, so be prepared to fix one or two bugs that may arise, and please let me know what you needed to do to fix it. Sending a corrected version is always welcome.
Finally, if you wish to use any of the snippets from this page, you are more than welcome, just mention the authors in your credits. If you wish to release any of these snippets to the public on another site, contact me FIRST.
 
 


the embalmer spec
by Ashura (ashura@buffaloriver.com) on Friday, March 17th @ 11:15:32 AM
http://
Lovely idea, but it's a Merc snippet--it won't be usable on Circle without a major overhaul. Speaking of major overhauls... ;)
I've been working on it, and have gotten this close--but it still crashes. Any suggestions? --Ashura.

****CODE FOLLOWS****
ASPELL(spell_make_bag)
{
static char *headers[] = { "corpse of the ", "corpse of The ",
"corpse of an ", "corpse of An ",
"corpse of a ", "corpse of A ",
"corpse of " }; // (This one must be last)
struct obj_data *corpse, *bag;
char buf[MAX_STRING_LENGTH];
char tbuf[MAX_STRING_LENGTH];
int i;

if (!IS_CORPSE(corpse))
return;

for (i = 0; i 7; i++) {
int len = strlen(headers[i]);
if (memcmp(corpse->short_description, headers[i], len) == 0)
sprintf(tbuf, "%s", corpse->short_description+len);
break;
}
extract_obj(corpse);

sprintf(buf, "A fine bag of %s hide catches your eye.", tbuf);
bag->description = str_dup(buf);
sprintf(buf, "a bag of %s hide", tbuf);
bag->short_description = str_dup(buf);
bag->in_room = NOWHERE;
bag->name = str_dup("bag");
GET_OBJ_TYPE(bag) = ITEM_CONTAINER;
GET_OBJ_WEAR(bag) = ITEM_WEAR_HOLD + ITEM_WEAR_TAKE + ITEM_WEAR_WAIST;
GET_OBJ_EXTRA(bag) = ITEM_NOSELL + ITEM_GLOW;
obj->item_number = 12; /* vnum of the "generic bag" */
GET_OBJ_VAL(bag, 0) = 50;
GET_OBJ_VAL(bag, 1) = 5;
GET_OBJ_VAL(bag, 2) = -1;
GET_OBJ_VAL(bag, 3) = 0;
GET_OBJ_COST(bag) = 100;
obj_to_room(bag, ch->in_room);
send_to_char( "Ok. ", ch );
return;
}
[ Reply to this comment ]

Re: the embalmer spec
by Jake Turner (jakehturner@hotmail.com) on Sunday, September 16th @ 05:14:23 AM
http://mercator.mudhaven.com
for (i = 0; i 7; i++) {
int len = strlen(headers[i]);


Urhm, i 7 ? perhaps i 7, otherwise it'll crash it
[ Reply to this comment ]