On Mon, 7 Jan 2002 [EMAIL PROTECTED] wrote:

>i have seen many questions about gary's clan system on the archive and i
>have a question :)
>
>I have totally redone his clan system, separated commands added many
>commands and reworked some stuff, IS he still active with ROM?  and is gary
>is reading this would you like to see the changes?

I'd like to see your changes :)

Have had a few discussions lately with folks about clan equipment, felt
like posting here just in case anyone is interested.

Here's my quick start towards clan equipment.  Eventually develop further.
Using QuickMUD for base code, Gary's clan system v2.1 as clan base.  Adjust
fire as needed on your end.

#include "disclaimer.h"
 - I don't give a rip about getting credit.  small snippet anyway.
 - No warranty expressed or implied.
 - I might have forgotten something important in this posting.
 - All values need rebalancing.
 - Void where prohibited by law.
 - Deal with area file conversion, OLC integration, etc. on your own.  It's
   not hard.  My method is bad -- compile w/ new save, restart MUD, asave
   world, compile w/ new load, restart MUD.  Backups are good ;-)
 - Etc etc etc.

<---- in act_obj.c ---->

void wear_obj(CHAR_DATA * ch, OBJ_DATA * obj, bool fReplace)
{
    char buf[MAX_STRING_LENGTH];
+   int clan = obj->pIndexData->clan;
+   int oid = obj->owner_id;

+   if (clan != 0) {
+       if (oid != 0 && ch->id != oid) {
+           act("You cannot use $p, it is bonded to someone else.", ch, obj, 
NULL, TO_CHAR);
+           act("$n tries to use $p, but can't, as it is bonded to someone 
else.", ch, obj, NULL, TO_ROOM);
+           return;
+       }
+       if (ch->clan != clan && oid == 0) {
+           act("You can't figure out how to bond with $p.", ch, obj, NULL, 
TO_CHAR);
+           act("$n tries to use $p, but can't figure out how to bond with 
it.", ch, obj, NULL, TO_ROOM);
+           return;
+       }
+   }

    if (ch->level < obj->level) {
        sprintf(buf, "You must be level %d to use this object.\n\r",
                obj->level);
        send_to_char(buf, ch);
        act("$n tries to use $p, but is too inexperienced.",
            ch, obj, NULL, TO_ROOM);
        return;
    }
+   if (clan != 0) bond_obj (ch, obj);

.... somewhere in act_obj.c add this function ....

void bond_obj(CHAR_DATA * ch, OBJ_DATA * obj)
{
    bool recalc = FALSE;

    if (obj->item_type != ITEM_WEAPON && obj->item_type != ITEM_ARMOR)
        return;

    if (obj->owner_id == 0) {
        act("You bond with $p.", ch, obj, NULL, TO_CHAR);
        act("$n bonds with $p.", ch, obj, NULL, TO_ROOM);
        obj->owner_id = ch->id;
        obj->level = ch->level;
        recalc = TRUE;
    }
    else if (obj->level != ch->level) {
        act("You adjust your bond with $p.", ch, obj, NULL, TO_CHAR);
        act("$n adjusts $s bond with $p.", ch, obj, NULL, TO_ROOM);
        obj->owner_id = ch->id;
        obj->level = ch->level;
        recalc = TRUE;
    }

    if (recalc == FALSE) return;

    switch (obj->item_type) {
        case ITEM_ARMOR:
            obj->value[0] = 1+ ch->level/2;  /* pierce */
            obj->value[1] = 1+ ch->level/2;  /* slash */
            obj->value[2] = 1+ ch->level/2;  /* bash */
            obj->value[3] = 1+ ch->level/3;  /* exotic */
            break;
        case ITEM_WEAPON:
            obj->value[1] = 1 + ch->level/10;   /* damage dice count */
            obj->value[2] = 1 + ch->level/5;    /* damage dice sides */
            break;
        default:
            /* insert bug warning here */
            break;
    }
    return;
}

<---- in merc.h ---->

somewhere in "struct obj_index_data" add
    sh_int clan;

somewhere in "struct obj_data" add
    long owner_id;

<---- in db2.c, function load_objects() ---->

        pObjIndex->cost = fread_number(fp);
+       pObjIndex->clan = fread_number(fp);

<---- in olc_save.c, function save_object() ---->

    fprintf(fp, "%d ", pObjIndex->cost);
+   fprintf(fp, "%d ", pObjIndex->clan);

<---- in save.c ---->

.... somewhere in fwrite_obj() ....

+    if (obj->owner_id != 0 )
+        fprintf(fp, "Oid %ld\n", obj->owner_id);

.... in fread_obj() ....

        case 'O':
+            KEY("Oid", obj->owner_id, fread_number(fp));


| dwight a campbell - [EMAIL PROTECTED] - http://rats.darktech.org - KD7KJG |
| yet another linux guru in training & reality avoidance therapist at large |
| tired of voting for the lesser evil?  vote kthulhu & yog-sothoth in 2004! |
| "When you live in a sick society, just about everything you do is wrong." |


Reply via email to