|
Examine (for Objects) [by Andy Hubbard] |
|
|
|
Posted Wednesday, August 12th @ 11:27:24 PM, by George Greer in the Commands dept.
Added Dec 8, 1997. Click the link below to read it or download it.
From: Andy Hubbard <hub@LEICESTER.AC.UK>
Subject: Object damage code...
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
<< Events [by Skylar] | Reply | View as text | Flattened | EXP Needed Scale [by Nashak] >> |
|
Related Links |
|
|
|
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.
|
|
|
|
|
|
|