[code] corpse ownership

lsdinc@ELKNET.NET
Date: 07/12/97


At 05:31 PM 7/11/97 -0600, you wrote:
>On Fri, 11 Jul 1997 lsdinc@ELKNET.NET wrote:
>
>> I have taken care of that one by checking if the corpse had an owner and if
>> so, was it theirs... if not, then display a small note saying something like
>> "that's not your corpse"...
>> my code may be a bit sloppy but it works just fine, if you would like it,
>> let me know and i will send it.
>
>If possible I'd like to take a look at it, I have been looking to make
>corpses owned by their former selves (owned, in short), to implement other
>things (like ghosts and recovery of items in a shop) and I am missing
>precisely this...


here is how i have imped sacrifice/autosac with anti-player corpse looting
and anti-player corpse sacrifice. only some of this code is mine. parts
have been obtained from other members of this list.

in act.item.c

search for:

int can_take_obj(struct char_data * ch, struct obj_data * obj)
{

add right after: (can't 'get' another player's corpse)

if (GET_OBJ_TYPE(obj) == ITEM_CONTAINER && GET_OBJ_VAL(obj, 3) == 1){
  if (GET_OBJ_OWNER(obj) != GET_IDNUM(ch) && GET_OBJ_OWNER(obj) != 0){
    send_to_char("&WThat is not &rYOUR &Wcorpse! Corpse looting is not
allowed\r\n", ch);
    return 0;}}


search for:
void perform_get_from_container(struct char_data * ch, struct obj_data * obj,
                                     struct obj_data * cont, int mode)
{

add right after: (can't 'get' from another player's corpse)

if (GET_OBJ_TYPE(cont) == ITEM_CONTAINER && GET_OBJ_VAL(cont, 3) == 1){
  if (GET_OBJ_OWNER(cont) != GET_IDNUM(ch) && GET_OBJ_OWNER(cont) != 0){
    send_to_char("&WThat is not &rYOUR &Wcorpse! Corpse looting is not
allowed\r\n", ch);
    return;}}


search for:

void get_from_container(struct char_data * ch, struct obj_data * cont,
                             char *arg, int mode)
{
  struct obj_data *obj, *next_obj;
  int obj_dotmode, found = 0;

  obj_dotmode = find_all_dots(arg);

add right after: (can't get from another player's corpse)

 if (GET_OBJ_TYPE(cont) == ITEM_CONTAINER && GET_OBJ_VAL(cont, 3) == 1){
  if (GET_OBJ_OWNER(cont) != GET_IDNUM(ch) && GET_OBJ_OWNER(cont) != 0){
    send_to_char("&WThat is not &rYOUR &Wcorpse! Corpse looting is not
allowed\r\n", ch);
    return;}}


search for:

int perform_get_from_room(struct char_data * ch, struct obj_data * obj)
{

add right after: (can't 'get' another player's corpse)
if (GET_OBJ_TYPE(obj) == ITEM_CONTAINER && GET_OBJ_VAL(obj, 3) == 1){
  if (GET_OBJ_OWNER(obj) != GET_IDNUM(ch) && GET_OBJ_OWNER(obj) != 0){
    send_to_char("&WThat is not &rYOUR &Wcorpse! Corpse looting is not
allowed\r\n", ch);
    return 0;}}
------------------------------------------------------------------------------
in act.other.c

here my do_sac command w/ that does not allow someone to sac another
player's corpse



ACMD(do_sac)
{
   struct obj_data *obj;

   one_argument(argument, arg);

   if (!*arg)
   {
     send_to_char("What do you want to sacrifice?\n\r",ch);
     return;
   }

   if (!(obj = get_obj_in_list_vis(ch, arg, world[ch->in_room].contents)))
   {
     send_to_char("That object can not be found\n\r",ch);
     return;
   }
if (GET_OBJ_TYPE(obj) == ITEM_CONTAINER && GET_OBJ_VAL(obj, 3) == 1){
  if (GET_OBJ_OWNER(obj) != GET_IDNUM(ch) && GET_OBJ_OWNER(obj) != 0){
    send_to_char("&WYou can't sacrifice a player's corpse!\r\n", ch);
    return;}}

   if (!CAN_WEAR(obj, ITEM_WEAR_TAKE))
   {
     send_to_char("That object can not be sacrificed!\n\r",ch);
     return;
   }

   act("$n sacrifices $p.", FALSE, ch, obj, 0, TO_ROOM);
   act("You sacrifice $p to your god.\r\nYou have been rewarded by your deity.",
        FALSE, ch, obj, 0, TO_CHAR);
   extract_obj(obj);
}


-------------------------------------------------------------------------
in fight.c



search for:

  GET_OBJ_TYPE(corpse) = ITEM_CONTAINER;
  GET_OBJ_WEAR(corpse) = ITEM_WEAR_TAKE;
  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;

add right after: (assigns corpse owner if not a npc)
  if (!IS_NPC(ch))
     GET_OBJ_OWNER(corpse) = GET_IDNUM(ch);
  else
     GET_OBJ_OWNER(corpse) = 0;


-------------------------------------------------------------------------
in spells.c
this section is only there to allow someone to also get an items owner via
the do_identify


  if (GET_OBJ_OWNER(obj) == 0)
    sprintf(buf, "&WOwner: &gNONE\r\n");
  if (GET_OBJ_OWNER(obj) >= 1)
    sprintf(buf, "&WOwner:&g %s\r\n",get_name_by_id((obj)->obj_flags.owner));
    send_to_char(buf, ch);

---------------------------------------------------------------------------
in utils.h


#define GET_OBJ_OWNER(obj) ((obj)->obj_flags.owner)

--------------------------------------------------------------------------
in db.c



search for:

clear_object(obj_proto + i);
  obj_proto[i].in_room = NOWHERE;
  obj_proto[i].item_number = i;

add right after: (defaults item/corpse owner to 0/noone
  obj_proto[i].obj_flags.owner=0;


--------------------------------------------------------------------------

that should be it, but i may have missed a section as this is also mixed
in with my item ownership stuff. I hope you or someone else can get some
use out of this...

let me know how it goes...


Phillip Ahrens
"Taste.  You cannot buy such a rare and wonderful thing.  You can't send
away for it in a catalogue, and I'm afraid it's becoming obsolete."

                                        -Rosalind Russell-
                                           (1911-1976)


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



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