/* NOTICE: The use of all information in this file is limited by the following rules: 1: You must comply with all DIKU/Merc/ROM licensing as this is a work based off of it. 2: I request that I be given credit in a comment or header or something in the source code. 3: You may not, in any way, use this code for financial gain. By this I mean you cannot accept money in any way, shape, or form, for anything using or derived from this code. See, wasn't that much.*/ /*Coded by Samual, inspired by XaosMUD, a project of Ragnar. Note that I never did see his way of coding this... which is likely a lot cleaner. I'm an amature at this, so, be ware of bugs! :-) */ /*Ok, this is going to be a bunch of code and where-to-put it/change what's there to it guide to make all objects to be weapons and/or furniture. I suggest that you 1: Back up EVERYTHING first. 2: Make sure you either have method of version control or that you implement all the 'save' functions first, compile, load, asave world, shutdown, then take care of all the load functions. Also, note that you might want to update any form of identification spells/skills.*/ /*First Step: In merc.h, inside of obj_index_data, add the following after wear_flags, as well as in obj_data after wear_loc*/ /*Weapon Furniture stats to all items, Coded by Samual (webtv_1@yahoo.com).*/ int weapon_class; int attack_type; int weapon_type2; int damdice_number; int damdice_size; int furniture_flags; int max_people; int max_weight; int healrate; int manarate; /*Ok, the prototypes now have the data structures we need. Now for the headache of dealing with OLC. Note I did this without version controls, if you have them, I DO advise using them. :-P The next edits occur in olc.h, olc.c, olc_act.c, and olc_save.c Note that order is incredibly important in olc_save.c, because we'll be loading the files back in that it saves.*/ /*Weapon Furniture To All Changes by Samual (webtv_1@yahoo.com). These belong in olc.h, inside of the oedit command delcaring statements.*/ DECLARE_OLC_FUN( oedit_wclass ); DECLARE_OLC_FUN( oedit_wflag ); DECLARE_OLC_FUN( oedit_dtype ); DECLARE_OLC_FUN( oedit_furniture); DECLARE_OLC_FUN( oedit_damdice); DECLARE_OLC_FUN( oedit_maxpeople); DECLARE_OLC_FUN( oedit_maxweight); DECLARE_OLC_FUN( oedit_mana); DECLARE_OLC_FUN( oedit_heal); /*Now to olc.c, in the oedit_table, add the following*/ {"wtype", oedit_wclass}, {"dtype", oedit_dtype}, {"wflag", oedit_wflag}, {"damdice", oedit_damdice}, {"furniture", oedit_furniture}, {"maxpeople", oedit_maxpeople}, {"maxweight", oedit_maxweight}, {"heal", oedit_heal}, {"mana", oedit_mana}, /*olc_act.c: in oedit_show, add the following, preferably after the extra flags are printed*/ send_to_char ("\n\r", ch); sprintf (buf, "Weapon Class: [%s]\n\r", flag_string (weapon_class, pObj->weapon_class)); send_to_char (buf, ch); sprintf (buf, "Damage Type: [%s]\n\r", attack_table[pObj->attack_type].name);; send_to_char (buf, ch); sprintf (buf, "Weapon Flags: [%s]\n\r", flag_string (weapon_type2, pObj->weapon_type2)); send_to_char (buf, ch); sprintf (buf, "Damage Dice: [%1dD%d]\n\r", pObj->damdice_number, pObj->damdice_size); send_to_char (buf, ch); send_to_char ("\n\r", ch); sprintf (buf, "Furniture Flags: [%s]\n\r", flag_string (furniture_flags, pObj->furniture_flags)); send_to_char (buf, ch); sprintf (buf, "Max People [%d] Heal Rate [%d] \n\r", pObj->max_people, pObj->healrate); send_to_char (buf, ch); sprintf (buf, "Max Weight [%d] Mana Rate [%d]\n\r", pObj->max_weight, pObj->manarate); send_to_char (buf, ch); send_to_char ("\n\r", ch); /*olc_act.c: Put these after oedit_wear*/ OEDIT (oedit_wclass) { OBJ_INDEX_DATA *pObj; int value; if (argument[0] != '\0') { EDIT_OBJ (ch, pObj); if ((value = flag_value (weapon_class, argument)) != NO_FLAG) { pObj->weapon_class = value; send_to_char ("Weapon type toggled.\n\r", ch); return TRUE; } } send_to_char ("Syntax: wtype [type]\n\r" "Type '? weapon' for a list of flags.\n\r", ch); return FALSE; } OEDIT (oedit_dtype) { OBJ_INDEX_DATA *pObj; int value; if (argument[0] != '\0') { EDIT_OBJ (ch, pObj); if ((value = attack_lookup (argument) != NULL)) { pObj->attack_type = attack_lookup (argument); send_to_char ("damage type toggled.\n\r", ch); return TRUE; } } send_to_char ("Syntax: dtype [type]\n\r" "Type '? damtype' for a list of flags.\n\r", ch); return FALSE; } OEDIT (oedit_wflag) { OBJ_INDEX_DATA *pObj; int value; if (argument[0] != '\0') { EDIT_OBJ (ch, pObj); if ((value = flag_value (weapon_type2, argument)) != NO_FLAG) { TOGGLE_BIT (pObj->weapon_type2, value); send_to_char ("Weapon flag toggled.\n\r", ch); return TRUE; } } send_to_char ("Syntax: wflag [flag]\n\r" "Type '? wtype' for a list of flags.\n\r", ch); return FALSE; } OEDIT (oedit_damdice) { OBJ_INDEX_DATA *pObj; char arg1[MIL]; char arg2[MIL]; int value1; int value2; if (argument[0] != '\0') { EDIT_OBJ (ch, pObj); value1 = atoi (one_argument(argument, arg1)); value2 = atoi (one_argument(argument, arg2)); if (value1 == 0) { value1 = pObj->damdice_number; } if (value2 == 0) { value2 = pObj->damdice_size; } pObj->damdice_number = value1; pObj->damdice_size = value2; send_to_char ("All set!\n\r", ch); return TRUE; } send_to_char ("Syntax: Damdice /n/r", ch); return FALSE; } OEDIT (oedit_furniture) { OBJ_INDEX_DATA *pObj; int value; if (argument[0] != '\0') { EDIT_OBJ (ch, pObj); if ((value = flag_value (furniture_flags, argument)) != NO_FLAG) { TOGGLE_BIT (pObj->furniture_flags, value); send_to_char ("Furniture flag toggled.\n\r", ch); return TRUE; } } send_to_char ("Syntax: Furniture [flag]\n\r" "Type '? Furniture' for a list of flags.\n\r", ch); return FALSE; } OEDIT (oedit_maxpeople) { OBJ_INDEX_DATA *pObj; int value; if (argument[0] != '\0') { EDIT_OBJ (ch, pObj); value = atoi (argument); if (value == 0) { value = -1; } pObj->max_people = value; return TRUE; } send_to_char ("Syntax: maxpeople [number]\n\r", ch); return FALSE; } OEDIT (oedit_maxweight) { OBJ_INDEX_DATA *pObj; int value; if (argument[0] != '\0') { EDIT_OBJ (ch, pObj); value = atoi (argument); if (value == 0) { value = -1; } pObj->max_weight = value; return TRUE; } send_to_char ("Syntax: maxweight [number]\n\r", ch); return FALSE; } OEDIT (oedit_mana) { OBJ_INDEX_DATA *pObj; int value; if (argument[0] != '\0') { EDIT_OBJ (ch, pObj); value = atoi (argument); if (value == 0) { value = -1; } pObj->manarate = value; return TRUE; } send_to_char ("Syntax: mana [number]\n\r", ch); return FALSE; } OEDIT (oedit_heal) { OBJ_INDEX_DATA *pObj; int value; if (argument[0] != '\0') { EDIT_OBJ (ch, pObj); value = atoi (argument); if (value == 0) { value = -1; } pObj->healrate = value; return TRUE; } send_to_char ("Syntax: heal [number]\n\r", ch); return FALSE; } /*ok, now I'm going to include some of the surrounding lines so you can see where to put these lines into olc_save.c, which will be between a line saying start here, end here in comments.*/ fprintf (fp, "%s~\n", pObjIndex->material); fprintf (fp, "%s ", item_name (pObjIndex->item_type)); fprintf (fp, "%s ", fwrite_flag (pObjIndex->extra_flags, buf)); fprintf (fp, "%s\n", fwrite_flag (pObjIndex->wear_flags, buf)); /*start here*/ fprintf (fp, "%s\n", fwrite_flag (pObjIndex->weapon_class, buf)); fprintf (fp, "%s\n", fwrite_flag (pObjIndex->weapon_type2, buf)); fprintf (fp, "%d\n", pObjIndex->damdice_number); fprintf (fp, "%d\n", pObjIndex->damdice_size); fprintf (fp, "%s\n", attack_table[pObjIndex->attack_type].name, buf); fprintf (fp, "%s\n", fwrite_flag (pObjIndex->furniture_flags, buf)); fprintf (fp, "%d\n", pObjIndex->max_people); fprintf (fp, "%d\n", pObjIndex->max_weight); fprintf (fp, "%d\n", pObjIndex->healrate); fprintf (fp, "%d\n", pObjIndex->manarate); /*end here*/ /* * Using fwrite_flag to write most values gives a strange * looking area file, consider making a case for each * item type later. */ switch (pObjIndex->item_type) /* now, if you DON'T have version control, I highly suggest compiling NOW, then saving all your area files with asave world, then shutdown while you do the following changes to db.c and/or db2.c*/ /*db.c: in *create_object*/ obj->weapon_class = pObjIndex->furniture_flags; obj->weapon_type2 = pObjIndex->weapon_type2; obj->attack_type = pObjIndex->attack_type; obj->damdice_number = pObjIndex->damdice_number; obj->damdice_size = pObjIndex->damdice_size; obj->furniture_flags = pObjIndex->furniture_flags; obj->max_people = pObjIndex->max_people; obj->max_weight = pObjIndex->max_weight; obj->healrate = pObjIndex->healrate; obj->manarate = pObjIndex->manarate; /*db2.c: in load_objects, add the part between start here and end here*/ pObjIndex->extra_flags = fread_flag (fp); pObjIndex->wear_flags = fread_flag (fp); /*start here!*/ pObjIndex->weapon_class = fread_flag (fp); pObjIndex->weapon_type2 = fread_flag (fp); pObjIndex->damdice_number = fread_number (fp); pObjIndex->damdice_size = fread_number (fp); CHECK_POS (pObjIndex->attack_type, attack_lookup (fread_word (fp)), "attack_type"); pObjIndex->furniture_flags = fread_flag (fp); pObjIndex->max_people = fread_number (fp); pObjIndex->max_weight = fread_number (fp); pObjIndex->healrate = fread_number (fp); pObjIndex->manarate = fread_number (fp); /*end here!*/ /*ok, so now all of them have the flags, they save, they load, and are OLCable... Now to change the other bits of code that need altering. we'll start with fight.c.*/ /*fight.c: one_hit: find these lines: wield = get_eq_char (ch, WEAR_WIELD); if (dt == TYPE_UNDEFINED) { dt = TYPE_HIT; if (wield != NULL && wield->item_type == ITEM_WEAPON) dt += wield->value[3]; else dt += ch->dam_type; } if (dt < TYPE_HIT) if (wield != NULL) dam_type = attack_table[wield->value[3]].damage; else dam_type = attack_table[ch->dam_type].damage; else dam_type = attack_table[dt - TYPE_HIT].damage; and replace with:*/ wield = get_eq_char (ch, WEAR_WIELD); if (dt == TYPE_UNDEFINED) { dt = TYPE_HIT; if (wield != NULL) dt += wield->attack_type; else dt += ch->dam_type; } if (dt < TYPE_HIT) if (wield != NULL) dam_type = attack_table[wield->attack_type].damage; else dam_type = attack_table[ch->dam_type].damage; else dam_type = attack_table[dt - TYPE_HIT].damage; /*now find this set of lines: else { if (sn != -1) check_improve (ch, sn, TRUE, 5); if (wield != NULL) { if (wield->pIndexData->new_format) dam = dice (wield->value[1], wield->value[2]) * skill / 100; else dam = number_range (wield->value[1] * skill / 100, wield->value[2] * skill / 100); and replace with:*/ else { if (sn != -1) check_improve (ch, sn, TRUE, 5); if (wield != NULL) { if (wield->pIndexData->new_format) dam = dice (wield->damdice_number, wield->damdice_size) * skill / 100; else dam = number_range (wield->value[1] * skill / 100, wield->value[2] * skill / 100); /*ok, fight.c is done. Now for act_move.c, which I'm simply going to explain what you need to change. For all of the 'do_stand/rest/sit/sleep' commands, find the if statement that says "if ( ITEM_TYPE != ITEM_FURNITURE || ..." and remove everything up to the ||, then check your bracketing. I'm likey missing some things, but that is the majority of what I have worked out needing so far. :-P If I had a connection able to support it, I'd play test it to death, but dialup is dialup, and any bug fixes or things I missed would be apprecited.*/