diff options
Diffstat (limited to 'src/map/itemdb.h')
-rw-r--r-- | src/map/itemdb.h | 154 |
1 files changed, 80 insertions, 74 deletions
diff --git a/src/map/itemdb.h b/src/map/itemdb.h index 8a0ec389d..35cd154cb 100644 --- a/src/map/itemdb.h +++ b/src/map/itemdb.h @@ -2,7 +2,7 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2015 Hercules Dev Team + * Copyright (C) 2012-2016 Hercules Dev Team * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify @@ -23,10 +23,10 @@ /* #include "map/map.h" */ #include "common/hercules.h" -#include "common/conf.h" #include "common/db.h" #include "common/mmo.h" // ITEM_NAME_LENGTH +struct config_setting_t; struct script_code; struct hplugin_data_store; @@ -54,6 +54,7 @@ enum item_itemid { ITEMID_WHITE_POTION = 504, ITEMID_BLUE_POTION = 505, ITEMID_APPLE = 512, + ITEMID_CARROT = 515, ITEMID_HOLY_WATER = 523, ITEMID_PUMPKIN = 535, ITEMID_RED_SLIM_POTION = 545, @@ -64,7 +65,7 @@ enum item_itemid { ITEMID_BRANCH_OF_DEAD_TREE = 604, ITEMID_ANODYNE = 605, ITEMID_ALOEBERA = 606, - ITEMID_MAGNIFIER = 611, + ITEMID_SPECTACLES = 611, ITEMID_POISON_BOTTLE = 678, ITEMID_EMPTY_BOTTLE = 713, ITEMID_EMPERIUM = 714, @@ -92,15 +93,15 @@ enum item_itemid { ITEMID_IRON_ORE = 1002, ITEMID_PHRACON = 1010, ITEMID_EMVERETARCON = 1011, - ITEMID_TRAP = 1065, + ITEMID_BOOBY_TRAP = 1065, ITEMID_PILEBUNCKER = 1549, ITEMID_ANGRA_MANYU = 1599, ITEMID_STRANGE_EMBRYO = 6415, ITEMID_FACE_PAINT = 6120, - ITEMID_SCARLET_POINT = 6360, - ITEMID_INDIGO_POINT = 6361, - ITEMID_YELLOW_WISH_POINT = 6362, - ITEMID_LIME_GREEN_POINT = 6363, + ITEMID_SCARLET_PTS = 6360, + ITEMID_INDIGO_PTS = 6361, + ITEMID_YELLOW_WISH_PTS = 6362, + ITEMID_LIME_GREEN_PTS = 6363, ITEMID_STONE = 7049, ITEMID_FIRE_BOTTLE = 7135, ITEMID_ACID_BOTTLE = 7136, @@ -110,9 +111,8 @@ enum item_itemid { ITEMID_FRAGMENT_OF_CRYSTAL = 7321, ITEMID_SKULL_ = 7420, ITEMID_TOKEN_OF_SIEGFRIED = 7621, - ITEMID_GOLD_KEY77 = 7782, - ITEMID_SILVER_KEY77 = 7783, - ITEMID_TRAP_ALLOY = 7940, + ITEMID_SPECIAL_ALLOY_TRAP = 7940, + ITEMID_CATNIP_FRUIT = 11602, ITEMID_RED_POUCH_OF_SURPRISE = 12024, ITEMID_BLOODY_DEAD_BRANCH = 12103, ITEMID_PORING_BOX = 12109, @@ -137,14 +137,31 @@ enum item_itemid { ITEMID_MAGIC_CASTLE = 12308, ITEMID_BULGING_HEAD = 12309, ITEMID_THICK_MANUAL50 = 12312, - ITEMID_NOVICE_MAGNIFIER = 12325, - ITEMID_ANCILLA = 12333, - ITEMID_REPAIR_A = 12392, - ITEMID_REPAIR_B = 12393, - ITEMID_REPAIR_C = 12394, + ITEMID_N_MAGNIFIER = 12325, + ITEMID_ANSILA = 12333, + ITEMID_REPAIRA = 12392, + ITEMID_REPAIRB = 12393, + ITEMID_REPAIRC = 12394, ITEMID_BLACK_THING = 12435, - ITEMID_REINS_OF_MOUNT = 12622, + ITEMID_BOARDING_HALTER = 12622, ITEMID_NOBLE_NAMEPLATE = 12705, + ITEMID_POISON_PARALYSIS = 12717, + ITEMID_POISON_LEECH = 12718, + ITEMID_POISON_OBLIVION = 12719, + ITEMID_POISON_CONTAMINATION = 12720, + ITEMID_POISON_NUMB = 12721, + ITEMID_POISON_FEVER = 12722, + ITEMID_POISON_LAUGHING = 12723, + ITEMID_POISON_FATIGUE = 12724, + ITEMID_NAUTHIZ = 12725, + ITEMID_RAIDO = 12726, + ITEMID_BERKANA = 12727, + ITEMID_ISA = 12728, + ITEMID_OTHILA = 12729, + ITEMID_URUZ = 12730, + ITEMID_THURISAZ = 12731, + ITEMID_WYRD = 12732, + ITEMID_HAGALAZ = 12733, ITEMID_DUN_TELE_SCROLL1 = 14527, ITEMID_BATTLE_MANUAL25 = 14532, ITEMID_BATTLE_MANUAL100 = 14533, @@ -159,6 +176,7 @@ enum item_itemid { ITEMID_PILEBUNCKER_S = 16030, ITEMID_PILEBUNCKER_P = 16031, ITEMID_PILEBUNCKER_T = 16032, + ITEMID_LUX_ANIMA = 22540, }; enum cards_item_list { @@ -248,49 +266,6 @@ enum mercenary_scroll_item_list { }; /** - * Cash Food - */ -enum cash_food_item_list { - ITEMID_STR_DISH10_ = 12202, - ITEMID_AGI_DISH10_, // 12203 - ITEMID_INT_DISH10_, // 12204 - ITEMID_DEX_DISH10_, // 12205 - ITEMID_LUK_DISH10_, // 12206 - ITEMID_VIT_DISH10_, // 12207 -}; - -/** - * GC Poison - */ -enum poison_item_list { - ITEMID_POISON_PARALYSIS = 12717, - ITEMID_POISON_LEECH, // 12718 - ITEMID_POISON_OBLIVION, // 12719 - ITEMID_POISON_CONTAMINATION, // 12720 - ITEMID_POISON_NUMB, // 12721 - ITEMID_POISON_FEVER, // 12722 - ITEMID_POISON_LAUGHING, // 12723 - ITEMID_POISON_FATIGUE, // 12724 -}; - - -/** - * Rune Knight - **/ -enum rune_item_list { - ITEMID_NAUTHIZ = 12725, - ITEMID_RAIDO, // 12726 - ITEMID_BERKANA, // 12727 - ITEMID_ISA, // 12728 - ITEMID_OTHILA, // 12729 - ITEMID_URUZ, // 12730 - ITEMID_THURISAZ, // 12731 - ITEMID_WYRD, // 12732 - ITEMID_HAGALAZ, // 12733 - ITEMID_LUX_ANIMA = 22540, -}; - -/** * Geneticist */ enum geneticist_item_list { @@ -386,7 +361,7 @@ enum ItemTradeRestrictions { }; /** - * Iten No-use restrictions + * Item No-use restrictions */ enum ItemNouseRestrictions { INR_NONE = 0x0, ///< No restrictions @@ -395,6 +370,24 @@ enum ItemNouseRestrictions { INR_ALL = 0x1 ///< Sum of all the above values }; +/** + * Item Option Types + */ +enum ItemOptionTypes { + IT_OPT_INDEX = 0, + IT_OPT_VALUE, + IT_OPT_PARAM, + IT_OPT_MAX +}; + +/** Convenience item list (entry) used in various functions */ +struct itemlist_entry { + int id; ///< Item ID or (inventory) index + int16 amount; ///< Amount +}; +/** Convenience item list used in various functions */ +VECTOR_STRUCT_DECL(itemlist, struct itemlist_entry); + struct item_combo { struct script_code *script; unsigned short nameid[MAX_ITEMS_PER_COMBO];/* nameid array */ @@ -452,6 +445,11 @@ struct item_package { unsigned short must_qty; }; +struct item_option { + int16 index; + struct script_code *script; +}; + struct item_data { uint16 nameid; char name[ITEM_NAME_LENGTH],jname[ITEM_NAME_LENGTH]; @@ -478,7 +476,7 @@ struct item_data { int delay; //Lupus: I rearranged order of these fields due to compatibility with ITEMINFO script command // some script commands should be revised as well... - unsigned int class_base[3]; ///< Specifies if the base can wear this item (split in 3 indexes per type: 1-1, 2-1, 2-2) + uint64 class_base[3]; ///< Specifies if the base can wear this item (split in 3 indexes per type: 1-1, 2-1, 2-2) unsigned class_upper : 6; ///< Specifies if the upper-type can equip it (bitfield, 0x01: normal, 0x02: upper, 0x04: baby normal, 0x08: third normal, 0x10: third upper, 0x20: third baby) struct { unsigned short chance; @@ -497,6 +495,8 @@ struct item_data { unsigned bindonequip : 1; unsigned keepafteruse : 1; unsigned force_serial : 1; + unsigned no_options: 1; // < disallows use of item options on the item. (non-equippable items are automatically flagged) [Smokexyz] + unsigned drop_announce : 1; // Official Drop Announce [Jedzkie] } flag; struct {// item stacking limitation unsigned short amount; @@ -538,13 +538,12 @@ struct item_data { #define itemdb_value_buy(n) (itemdb->search(n)->value_buy) #define itemdb_value_sell(n) (itemdb->search(n)->value_sell) #define itemdb_canrefine(n) (!itemdb->search(n)->flag.no_refine) +#define itemdb_allowoption(n) (!itemdb->search(n)->flag.no_options) -#define itemdb_is_rune(n) (((n) >= ITEMID_NAUTHIZ && (n) <= ITEMID_HAGALAZ) || (n) == ITEMID_LUX_ANIMA) -#define itemdb_is_element(n) ((n) >= ITEMID_SCARLET_POINT && (n) <= ITEMID_LIME_GREEN_POINT) +#define itemdb_is_element(n) ((n) >= ITEMID_SCARLET_PTS && (n) <= ITEMID_LIME_GREEN_PTS) #define itemdb_is_spellbook(n) ((n) >= ITEMID_MAGIC_BOOK_FB && (n) <= ITEMID_MAGIC_BOOK_DL) #define itemdb_is_poison(n) ((n) >= ITEMID_POISON_PARALYSIS && (n) <= ITEMID_POISON_FATIGUE) #define itemid_isgemstone(n) ((n) >= ITEMID_YELLOW_GEMSTONE && (n) <= ITEMID_BLUE_GEMSTONE) -#define itemdb_iscashfood(n) ((n) >= ITEMID_STR_DISH10_ && (n) <= ITEMID_VIT_DISH10_) #define itemdb_is_GNbomb(n) ((n) >= ITEMID_APPLE_BOMB && (n) <= ITEMID_VERY_HARD_LUMP) #define itemdb_is_GNthrowable(n) ((n) >= ITEMID_MYSTERIOUS_POWDER && (n) <= ITEMID_BLACK_THING_TO_THROW) #define itemid_is_pilebunker(n) ((n) == ITEMID_PILEBUNCKER || (n) == ITEMID_PILEBUNCKER_P || (n) == ITEMID_PILEBUNCKER_S || (n) == ITEMID_PILEBUNCKER_T) @@ -581,15 +580,17 @@ struct itemdb_interface { struct item_combo **combos; unsigned short combo_count; /* */ - DBMap *names; + struct DBMap *names; /* */ struct item_data *array[MAX_ITEMDB]; - DBMap *other;// int nameid -> struct item_data* + struct DBMap *other;// int nameid -> struct item_data* + struct DBMap *options; // int opt_id -> struct item_option* struct item_data dummy; //This is the default dummy item used for non-existant items. [Skotlex] /* */ void (*read_groups) (void); void (*read_chains) (void); void (*read_packages) (void); + void (*read_options) (void); /* */ void (*write_cached_packages) (const char *config_filename); bool (*read_cached_packages) (const char *config_filename); @@ -600,15 +601,17 @@ struct itemdb_interface { struct item_data* (*load)(int nameid); struct item_data* (*search)(int nameid); struct item_data* (*exists) (int nameid); + struct item_option* (*option_exists) (int idx); bool (*in_group) (struct item_group *group, int nameid); int (*group_item) (struct item_group *group); int (*chain_item) (unsigned short chain_id, int *rate); void (*package_item) (struct map_session_data *sd, struct item_package *package); - int (*searchname_sub) (DBKey key, DBData *data, va_list ap); - int (*searchname_array_sub) (DBKey key, DBData data, va_list ap); + int (*searchname_sub) (union DBKey key, struct DBData *data, va_list ap); + int (*searchname_array_sub) (union DBKey key, struct DBData data, va_list ap); int (*searchrandomid) (struct item_group *group); const char* (*typename) (int type); - void (*jobid2mapid) (unsigned int *bclass, unsigned int jobmask); + void (*jobmask2mapid) (uint64 *bclass, uint64 jobmask); + void (*jobid2mapid) (uint64 *bclass, int job_class, bool enable); void (*create_dummy_data) (void); struct item_data* (*create_item_data) (int nameid); int (*isequip) (int nameid); @@ -631,17 +634,20 @@ struct itemdb_interface { void (*read_combos) (void); int (*gendercheck) (struct item_data *id); int (*validate_entry) (struct item_data *entry, int n, const char *source); - void (*readdb_additional_fields) (int itemid, config_setting_t *it, int n, const char *source); - int (*readdb_libconfig_sub) (config_setting_t *it, int n, const char *source); + void (*readdb_options_additional_fields) (struct item_option *ito, struct config_setting_t *t, const char *source); + void (*readdb_additional_fields) (int itemid, struct config_setting_t *it, int n, const char *source); + void (*readdb_job_sub) (struct item_data *id, struct config_setting_t *t); + int (*readdb_libconfig_sub) (struct config_setting_t *it, int n, const char *source); int (*readdb_libconfig) (const char *filename); uint64 (*unique_id) (struct map_session_data *sd); void (*read) (bool minimal); void (*destroy_item_data) (struct item_data *self, int free_self); - int (*final_sub) (DBKey key, DBData *data, va_list ap); + int (*final_sub) (union DBKey key, struct DBData *data, va_list ap); + int (*options_final_sub) (union DBKey key, struct DBData *data, va_list ap); void (*clear) (bool total); struct item_combo * (*id2combo) (unsigned short id); bool (*is_item_usable) (struct item_data *item); - bool (*lookup_const) (const config_setting_t *it, const char *name, int *value); + bool (*lookup_const) (const struct config_setting_t *it, const char *name, int *value); }; #ifdef HERCULES_CORE |