Re: Object damage code...

From: Andy Hubbard (hub@LEICESTER.AC.UK)
Date: 08/26/97


> Ok, after a week I am starting to become angry.
>
> I added som enice object damage code, but the portion that deals
> with the examine does not work. (Code to follow). It is nearly
> identicaly to code added to the identify spell, and that part works
> just dandy. Someone, please, what am I overlooking?
>
eek!!

I know I shoulda posted the fixes!  But George seems to be keepin me
rather busy!!! :)

The first problem with the original is that you don't see a condition
if the item has no extra description, the second is that examining a
corpse crashes the mud ... there are probably more, but this was a
long time ago .... Also my latest does include Georges idea for a
'const char *mesg', I'll try to dig it out ...

OK, the fixes ....

rip out the do_examine fluffed code!

act.informative.c

###

 } else if (GET_OBJ_TYPE(object) != ITEM_DRINKCON) {
   strcpy(buf, "You see nothing special..");

   condition = ((GET_OBJ_CSLOTS(object) * 100) / GET_OBJ_TSLOTS(object));
   condition = condition / 10;
   condition = MAX(0, MIN(9, condition));
   strcat(buf, "\r\nThis looks " );
   sprinttype(condition, obj_quality, buf2);
   strcat(buf, buf2);

    } else      /* ITEM_TYPE == ITEM_DRINKCON||FOUNTAIN */
      strcpy(buf, "It looks like a drink container.");

###

 /* Does the argument match an extra desc in the char's equipment? */
 for (j = 0; j < NUM_WEARS && !found; j++)
   if (GET_EQ(ch, j) && CAN_SEE_OBJ(ch, GET_EQ(ch, j)))
     if ((desc = find_exdesc(arg, GET_EQ(ch, j)->ex_description)) != NULL) {
 send_to_char(desc, ch);

  condition = ((GET_OBJ_CSLOTS(GET_EQ(ch, j)) * 100) / GET_OBJ_TSLOTS(GET_EQ(ch, j)));
  condition = condition / 10;
  condition = MAX(0, MIN(9, condition));
  sprintf(buf, "\r\nThis looks " );
  sprinttype(condition, obj_quality, buf2);
  strcat(buf, buf2);
  send_to_char(buf, ch);

 found = 1;
      }
  /* Does the argument match an extra desc in the char's inventory? */
  for (obj = ch->carrying; obj && !found; obj = obj->next_content) {
    if (CAN_SEE_OBJ(ch, obj))
 if ((desc = find_exdesc(arg, obj->ex_description)) != NULL) {
 send_to_char(desc, ch);

 condition = ((GET_OBJ_CSLOTS(obj) * 100) / GET_OBJ_TSLOTS(obj));
 condition = condition / 10;
 condition = MAX(0, MIN(9, condition));
 sprintf(buf, "\r\nThis looks " );
 sprinttype(condition, obj_quality, buf2);
 strcat(buf, buf2);
 send_to_char(buf, ch);

 found = 1;
      }
  }

  /* Does the argument match an extra desc of an object in the room? */
for (obj = world[ch->in_room].contents; obj && !found; obj =
  obj->next_content)
    if (CAN_SEE_OBJ(ch, obj))
 if ((desc = find_exdesc(arg, obj->ex_description)) != NULL) {
 send_to_char(desc, ch);

 condition = ((GET_OBJ_CSLOTS(obj) * 100) / GET_OBJ_TSLOTS(obj));
 condition = condition / 10;
 condition = MAX(0, MIN(9, condition));
 sprintf(buf, "\r\nThis looks " );
 sprinttype(condition, obj_quality, buf2);
 strcat(buf, buf2);
 send_to_char(buf, ch);

 found = 1;
      }
  if (bits) {                   /* If an object was found back in

###

fight.c

  GET_OBJ_TYPE(corpse) = ITEM_CONTAINER;
  GET_OBJ_EXTRA(corpse) = ITEM_NODONATE;
  GET_OBJ_VAL(corpse, 0) = 0;   /* You can't store stuff in a corpse */
  GET_OBJ_VAL(corpse, 3) = 1;   /* corpse identifier */
  GET_OBJ_WEIGHT(corpse) = GET_WEIGHT(ch) + IS_CARRYING_W(ch);
  GET_OBJ_RENT(corpse) = 100000;
/* make a corpse have extremely poor condition!! */
  GET_OBJ_TSLOTS(corpse) = 15;
  GET_OBJ_CSLOTS(corpse) = 1;
  if (IS_NPC(ch)) {

###

constants.c

/* object damage */
const char *obj_quality[] =
{/* 0..10% */   "in extremley poor condition.",
                "in poor condition.",
                "in fair condition.",
                "in moderate condition.",
/* 40..50% */   "in good condition.",
                "in very good condition.",
                "in excellent condition.",
                "in superior condition.",
                "nearly flawless.",
/* 90..100% */  "flawless!",
                "\n"
};

###

I think that was all :(

Andy


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/08/00 PST