diff -BbuprN tbamud-3.58/src/act.wizard.c tbamud-3.58+crafts/src/act.wizard.c --- tbamud-3.58/src/act.wizard.c 2009-01-20 14:56:25.234375000 +0000 +++ tbamud-3.58+crafts/src/act.wizard.c 2009-03-21 08:41:49.250875000 +0000 @@ -31,6 +31,7 @@ #include "house.h" #include "modify.h" #include "quest.h" +#include "craft.h" /* local utility functions with file scope */ static int perform_set(struct char_data *ch, struct char_data *vict, int mode, char *val_arg); @@ -2413,6 +2414,7 @@ ACMD(do_show) { "shops", LVL_IMMORT }, { "houses", LVL_IMMORT }, { "snoop", LVL_IMMORT }, /* 10 */ + { "crafts", LVL_IMMORT }, { "\n", 0 } }; @@ -2632,6 +2634,11 @@ ACMD(do_show) send_to_char(ch, "No one is currently snooping.\r\n"); break; + /* show crafts */ + case 11: + show_crafts(ch, value); + break; + /* show what? */ default: send_to_char(ch, "Sorry, I don't understand that.\r\n"); diff -BbuprN tbamud-3.58/src/constants.c tbamud-3.58+crafts/src/constants.c --- tbamud-3.58/src/constants.c 2009-01-18 14:18:55.296875000 +0000 +++ tbamud-3.58+crafts/src/constants.c 2009-03-20 13:37:14.204000000 +0000 @@ -360,6 +360,7 @@ const char *item_types[] = { "PEN", "BOAT", "FOUNTAIN", + "CRAFT KIT", "\n" }; diff -BbuprN tbamud-3.58/src/db.c tbamud-3.58+crafts/src/db.c --- tbamud-3.58/src/db.c 2009-01-23 09:25:24.607000000 +0000 +++ tbamud-3.58+crafts/src/db.c 2009-03-21 07:51:40.532125000 +0000 @@ -36,6 +36,7 @@ #include "modify.h" #include "shop.h" #include "quest.h" +#include "craft.h" #include <sys/stat.h> /* declarations of most of the 'global' variables */ @@ -716,6 +717,9 @@ void boot_db(void) if (!mini_mud) { log("Booting houses."); House_boot(); + + log("Booting crafts."); + load_crafts(); } log("Cleaning up last log."); diff -BbuprN tbamud-3.58/src/db.h tbamud-3.58+crafts/src/db.h --- tbamud-3.58/src/db.h 2008-08-11 23:54:32.000000000 +0100 +++ tbamud-3.58+crafts/src/db.h 2009-03-19 09:48:33.313375000 +0000 @@ -136,6 +136,7 @@ #define BAN_FILE LIB_ETC"badsites" /* for the siteban system */ #define HCONTROL_FILE LIB_ETC"hcontrol" /* for the house system */ #define TIME_FILE LIB_ETC"time" /* for calendar system */ +#define CRAFT_FILE LIB_ETC"crafts" /* for crafting system */ #define CHANGE_LOG_FILE "../changelog" /* for the changelog */ /* new bitvector data for use in player_index_element */ diff -BbuprN tbamud-3.58/src/interpreter.c tbamud-3.58+crafts/src/interpreter.c --- tbamud-3.58/src/interpreter.c 2009-01-19 01:40:35.265625000 +0000 +++ tbamud-3.58+crafts/src/interpreter.c 2009-03-21 08:45:39.829000000 +0000 @@ -36,6 +36,7 @@ #include "modify.h" /* for do_skillset... */ #include "quest.h" #include "asciimap.h" +#include "craft.h" /* local (file scope) functions */ static int perform_dupe_check(struct descriptor_data *d); @@ -87,6 +88,7 @@ cpp_extern const struct command_info cmd { "ban" , "ban" , POS_DEAD , do_ban , LVL_GRGOD, 0 }, { "balance" , "bal" , POS_STANDING, do_not_here , 1, 0 }, { "bash" , "bas" , POS_FIGHTING, do_bash , 1, 0 }, + { "brew" , "brew" , POS_SITTING , do_gen_craft, 1, SCMD_BREW }, { "brief" , "br" , POS_DEAD , do_gen_tog , 0, SCMD_BRIEF }, { "buildwalk", "buildwalk", POS_STANDING, do_gen_tog , LVL_BUILDER, SCMD_BUILDWALK }, { "buy" , "bu" , POS_STANDING, do_not_here , 0, 0 }, @@ -101,9 +103,12 @@ cpp_extern const struct command_info cmd { "clear" , "cle" , POS_DEAD , do_gen_ps , 0, SCMD_CLEAR }, { "cls" , "cls" , POS_DEAD , do_gen_ps , 0, SCMD_CLEAR }, { "consider" , "con" , POS_RESTING , do_consider , 0, 0 }, + { "construct", "construct",POS_SITTING , do_gen_craft, 1, SCMD_CONSTRUCT }, { "commands" , "com" , POS_DEAD , do_commands , 0, SCMD_COMMANDS }, { "compact" , "comp" , POS_DEAD , do_gen_tog , 0, SCMD_COMPACT }, { "copyover" , "copyover", POS_DEAD , do_copyover , LVL_GRGOD, 0 }, + { "crafts" , "crafts" , POS_RESTING , do_crafts , 0, 0 }, + { "craftedit", "craftedit",POS_DEAD , do_oasis_craftedit, LVL_BUILDER, 0 }, { "credits" , "cred" , POS_DEAD , do_gen_ps , 0, SCMD_CREDITS }, { "date" , "da" , POS_DEAD , do_date , LVL_IMMORT, SCMD_DATE }, @@ -253,6 +258,7 @@ cpp_extern const struct command_info cmd { "say" , "s" , POS_RESTING , do_say , 0, 0 }, { "score" , "sc" , POS_DEAD , do_score , 0, 0 }, { "scopy" , "scopy" , POS_DEAD , do_oasis_copy, LVL_GOD, CON_SEDIT }, + { "scribe" , "scribe" , POS_SITTING , do_gen_craft, 1, SCMD_SCRIBE }, { "sit" , "si" , POS_RESTING , do_sit , 0, 0 }, { "'" , "'" , POS_RESTING , do_say , 0, 0 }, { "save" , "sav" , POS_SLEEPING, do_save , 0, 0 }, @@ -1204,6 +1210,7 @@ void nanny(struct descriptor_data *d, ch { CON_AEDIT, aedit_parse }, { CON_HEDIT, hedit_parse }, { CON_QEDIT, qedit_parse }, + { CON_CRAFTEDIT, craftedit_parse }, { -1, NULL } }; diff -BbuprN tbamud-3.58/src/oasis.c tbamud-3.58+crafts/src/oasis.c --- tbamud-3.58/src/oasis.c 2009-01-20 17:48:23.187500000 +0000 +++ tbamud-3.58+crafts/src/oasis.c 2009-03-21 09:21:41.000875000 +0000 @@ -25,6 +25,7 @@ #include "act.h" #include "handler.h" /* for is_name */ #include "quest.h" +#include "craft.h" /* Internal Data Structures */ @@ -186,6 +187,14 @@ void cleanup_olc(struct descriptor_data free_trigger(OLC_TRIG(d)); OLC_TRIG(d) = NULL; } + /* Free this one regardless. If we've left olc, we've either made a fresh * + * copy of it in the craft list, or we lost connection. Either way, we need * + * to get rid of this. */ + if (OLC_CRAFT(d)) { + free_craft(OLC_CRAFT(d)); + OLC_CRAFT(d) = NULL; + } + /* OLC_SCRIPT is always set as trig_proto of OLC_OBJ/MOB/ROOM. Therefore it * should not be free'd here. */ diff -BbuprN tbamud-3.58/src/oasis.h tbamud-3.58+crafts/src/oasis.h --- tbamud-3.58/src/oasis.h 2008-08-11 23:54:32.000000000 +0100 +++ tbamud-3.58+crafts/src/oasis.h 2009-03-21 09:01:07.750875000 +0000 @@ -50,6 +50,7 @@ #define MAX_OBJ_COST 2000000 #define MAX_OBJ_RENT 2000000 #define MAX_CONTAINER_SIZE 10000 +#define MAX_CRAFTKIT_SIZE 1000 #define MAX_MOB_GOLD 100000 #define MAX_MOB_EXP 150000 @@ -94,6 +95,7 @@ struct oasis_olc_data { struct aq_data *quest; /* used for 'qedit' */ struct extra_descr_data *desc; /* used in '[r|o|m]edit' */ struct social_messg *action; /* Aedit uses this one */ + struct craft_data *craft; /* used for 'craftedit' */ struct trig_data *trig; int script_mode; int trigger_position; @@ -122,6 +124,7 @@ extern const char *nrm, *grn, *cyn, *yel #define OLC_CONFIG(d) (OLC(d)->config) /**< Config structure. */ #define OLC_TRIG(d) (OLC(d)->trig) /**< Trigger structure. */ #define OLC_QUEST(d) (OLC(d)->quest) /**< Quest structure */ +#define OLC_CRAFT(d) (OLC(d)->craft) /**< Craft structure */ #define OLC_ACTION(d) (OLC(d)->action) /**< Action structure */ #define OLC_HELP(d) (OLC(d)->help) /**< Hedit structure */ @@ -360,6 +363,22 @@ extern const char *nrm, *grn, *cyn, *yel #define HEDIT_KEYWORDS 5 #define HEDIT_MIN_LEVEL 6 +/* Craftedit Submodes of connectedness. */ +#define CRAFTEDIT_MAIN_MENU 0 +#define CRAFTEDIT_REQ_MENU 1 +#define CRAFTEDIT_CLASS_MENU 2 +#define CRAFTEDIT_FLAG_MENU 3 +#define CRAFTEDIT_SKILL_MENU 4 +#define CRAFTEDIT_CONFIRM_SAVESTRING 5 +#define CRAFTEDIT_NAME 6 +#define CRAFTEDIT_RESULT 7 +#define CRAFTEDIT_MINSKILL 8 +#define CRAFTEDIT_MINLEVEL 9 +#define CRAFTEDIT_REQ_OBJECT 10 +#define CRAFTEDIT_REQ_NUMBER 11 +#define CRAFTEDIT_REQ_FLAGS 12 +#define CRAFTEDIT_REQ_DELETE 13 +#define CRAFTEDIT_DEL_CRAFT 14 +#define CRAFTEDIT_REQ_DELCONF 15 + int save_config( IDXTYPE nowhere ); /* Prototypes to keep. */ @@ -428,6 +447,10 @@ ACMD(do_tedit); /* public functions from qedit.c */ ACMD(do_oasis_qedit); +/* public functions from craft.c */ +void craftedit_parse(struct descriptor_data *d, char *arg); +ACMD(do_oasis_craftedit); + /* public functions from oasis_copy.c */ int buildwalk(struct char_data *ch, int dir); ACMD(do_dig); diff -BbuprN tbamud-3.58/src/oedit.c tbamud-3.58+crafts/src/oedit.c --- tbamud-3.58/src/oedit.c 2009-01-19 01:53:05.250000000 +0000 +++ tbamud-3.58+crafts/src/oedit.c 2009-03-20 13:48:43.625875000 +0000 @@ -450,6 +450,9 @@ static void oedit_disp_val1_menu(struct case ITEM_NOTE: oedit_disp_menu(d); break; + case ITEM_CRAFTKIT: + write_to_output(d, "Max number of contents (-1 for unlimited) : "); + break; default: mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: OLC: Reached default case in oedit_disp_val1_menu()!"); break; @@ -484,6 +487,9 @@ static void oedit_disp_val2_menu(struct case ITEM_FOUNTAIN: write_to_output(d, "Initial drink units : "); break; + case ITEM_CRAFTKIT: + write_to_output(d, "Initial number of contents : "); + break; default: oedit_disp_menu(d); } @@ -961,6 +967,9 @@ void oedit_parse(struct descriptor_data case ITEM_CONTAINER: GET_OBJ_VAL(OLC_OBJ(d), 0) = LIMIT(atoi(arg), -1, MAX_CONTAINER_SIZE); break; + case ITEM_CRAFTKIT: + GET_OBJ_VAL(OLC_OBJ(d), 0) = LIMIT(atoi(arg), -1, MAX_CRAFTKIT_SIZE); + break; default: GET_OBJ_VAL(OLC_OBJ(d), 0) = atoi(arg); } diff -BbuprN tbamud-3.58/src/spell_parser.c tbamud-3.58+crafts/src/spell_parser.c --- tbamud-3.58/src/spell_parser.c 2008-08-11 23:54:32.000000000 +0100 +++ tbamud-3.58+crafts/src/spell_parser.c 2009-03-19 18:41:12.422750000 +0000 @@ -684,6 +684,7 @@ void unused_spell(int spl) } #define skillo(skill, name) spello(skill, name, 0, 0, 0, 0, 0, 0, 0, NULL); +#define crafto(skill, name) spello(skill, name, 0, 0, 0, 0, 0, 0, SK_CRAFT, NULL); /* Arguments for spello calls: * spellnum, maxmana, minmana, manachng, minpos, targets, violent?, routines. * spellnum: Number of the spell. Usually the symbolic name as defined in @@ -938,5 +939,12 @@ void mag_assign_spells(void) skillo(SKILL_SNEAK, "sneak"); skillo(SKILL_STEAL, "steal"); skillo(SKILL_TRACK, "track"); + + /* Declaration of craft skills. This is the same as using skillo, but the * + * skill is flagged as a craft, which is then recognised in craftedit when * + * choosing a skill for the craft. */ + crafto(SKILL_BREW, "brew"); + crafto(SKILL_SCRIBE, "scribe"); + crafto(SKILL_CONSTRUCT, "construct"); } diff -BbuprN tbamud-3.58/src/spells.h tbamud-3.58+crafts/src/spells.h --- tbamud-3.58/src/spells.h 2008-08-11 23:54:32.000000000 +0100 +++ tbamud-3.58+crafts/src/spells.h 2009-03-19 18:34:53.782125000 +0000 @@ -34,6 +34,8 @@ #define MAG_CREATIONS (1 << 9) #define MAG_MANUAL (1 << 10) +#define SK_CRAFT (1 << 11) /* Flag to mark 'craft' skills */ + #define TYPE_UNDEFINED (-1) #define SPELL_RESERVED_DBC 0 /* SKILL NUMBER ZERO -- RESERVED */ @@ -106,6 +108,9 @@ #define SKILL_SNEAK 138 /* Reserved Skill[] DO NOT CHANGE */ #define SKILL_STEAL 139 /* Reserved Skill[] DO NOT CHANGE */ #define SKILL_TRACK 140 /* Reserved Skill[] DO NOT CHANGE */ +#define SKILL_BREW 141 /* Craft Skill */ +#define SKILL_SCRIBE 142 /* Craft Skill */ +#define SKILL_CONSTRUCT 143 /* Craft Skill */ /* New skills may be added here up to MAX_SKILLS (200) */ /* NON-PLAYER AND OBJECT SPELLS AND SKILLS: The practice levels for the spells diff -BbuprN tbamud-3.58/src/structs.h tbamud-3.58+crafts/src/structs.h --- tbamud-3.58/src/structs.h 2009-01-19 02:18:23.500000000 +0000 +++ tbamud-3.58+crafts/src/structs.h 2009-03-20 13:35:20.047750000 +0000 @@ -301,6 +301,7 @@ #define CON_TRIGEDIT 26 /**< OLC mode - trigger edit */ #define CON_HEDIT 27 /**< OLC mode - help edit */ #define CON_QEDIT 28 /**< OLC mode - quest edit */ +#define CON_CRAFTEDIT 29 /**< OLC mode - craft edit */ /* Character equipment positions: used as index for char_data.equipment[] */ /* NOTE: Don't confuse these constants with the ITEM_ bitvectors @@ -353,9 +354,10 @@ #define ITEM_PEN 21 /**< Item is a pen */ #define ITEM_BOAT 22 /**< Item is a boat */ #define ITEM_FOUNTAIN 23 /**< Item is a fountain */ +#define ITEM_CRAFTKIT 24 /**< Item is a kit used for crafting */ /** Total number of item types. - * @todo Should this be 23? */ -#define NUM_ITEM_TYPES 24 + * @todo Should this be 24? */ +#define NUM_ITEM_TYPES 25 /* Take/Wear flags: used by obj_data.obj_flags.wear_flags */ #define ITEM_WEAR_TAKE 0 /**< Item can be taken */ @@ -486,6 +488,7 @@ #define AF_ARRAY_MAX 4 /**< # Bytes in Bit vector - Affect flags */ #define TW_ARRAY_MAX 4 /**< # Bytes in Bit vector - Obj Wear Locations */ #define EF_ARRAY_MAX 4 /**< # Bytes in Bit vector - Obj Extra Flags */ +#define RQ_ARRAY_MAX 4 /**< # Bytes in Bit vector - Obj Extra Flags */ /* other #defined constants */ /* **DO**NOT** blindly change the number of levels in your MUD merely by @@ -602,6 +605,7 @@ typedef IDXTYPE zone_vnum; /**< vnum sp typedef IDXTYPE shop_vnum; /**< vnum specifically for shop */ typedef IDXTYPE trig_vnum; /**< vnum specifically for triggers */ typedef IDXTYPE qst_vnum; /**< vnum specifically for quests */ +typedef IDXTYPE craft_vnum; /**< vnum specifically for crafts */ /* Various real (array-reference) number types. */ typedef IDXTYPE room_rnum; /**< references an instance of a room */ @@ -611,6 +615,7 @@ typedef IDXTYPE zone_rnum; /**< referen typedef IDXTYPE shop_rnum; /**< references an instance of a shop */ typedef IDXTYPE trig_rnum; /**< references an instance of a trigger */ typedef IDXTYPE qst_rnum; /**< references an instance of a quest */ +typedef IDXTYPE craft_rnum; /**< references an instance of a craft */ /** Bitvector type for 32 bit unsigned long bitvectors. 'unsigned long long' * will give you at least 64 bits if you have GCC. You'll have to search