Re: REQ/CODE: Autosplit

From: Ron Hensley (ron@peace.dmv.com)
Date: 07/11/96


> Does anyone have a code snippit that would set a flag that would
> automatically split coins gotten from a kill with the rest of the group?

* NOTE *  if you dont like using command_interpreter dont bother reading 
this or responding. for tiny simple things, i think it works. 
If you dont, do it yourself...

In act.other.c:
in:
ACMD(do_gen_tog)
add:
    {"AutoSplit disabled.\r\n",
    "AutoSplit enabled.\r\n"},
to your:
  char *tog_messages[][2] = {
list

add:
  case SCMD_AUTOSPLIT:
    result = PRF_TOG_CHK(ch, PRF_AUTOSPLIT);
    break;

to the:
  switch (subcmd) {
just below it

in constants.c
in:
  const char *preference_bits[] = {
add:
  "AUTOSPLIT",

in fight.c
in void damage(struct char_data * ch, struct char_data * victim, int dam,
            int attacktype)
add a var:
  long local_gold = 0;

down further in damage()
      if (MOB_FLAGGED(ch, MOB_MEMORY))
        forget(ch, victim);
    }
+    if (IS_NPC(victim)) {
+      local_gold = GET_GOLD(victim);
+      sprintf(local_buf,"split %ld", (long)local_gold);
+    }

    die(victim, ch);

+    if (IS_AFFECTED(ch, AFF_GROUP) && (local_gold > 0))
+      if (PRF_FLAGGED(ch, PRF_AUTOSPLIT))
+        command_interpreter(ch, local_buf);


add the command to toggle it to interpreter.c

  { "autosplit", POS_DEAD    , do_gen_tog  , 0, SCMD_AUTOSPLIT },

in interpreter.h
#define SCMD_AUTOSPLIT  17

note that SCMD_AUTOSPLIT is the 17th in my list, may be diff in yours

lastly in structs.h
#define PRF_AUTOSPLIT   (1 << 23) /* Auto Split loot with group 

add that to your PRF_ list

once again it might not be the 23rd in your list


Note this is NOT a patch. Just showing how i did it in my code.
Youd probably have to play a bit to make it work in yours, its just as a 
guideline, although i believe just following the steps given will work
    *******************************************************************
    *   Ron Hensley                     ron@dmv.com                   *
    *   Junior Systems Administrator    http://www.dmv.com/~ron       *
    *   DelMarVa OnLine                 749-1111 Ext. 403             *
    *******************************************************************



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