summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2014-05-31 02:55:46 +0200
committerHaru <haru@dotalux.com>2014-05-31 02:55:46 +0200
commit3dccf7e300f9868a98075e1863c88c38d3211f33 (patch)
treef21e1cccc81a5fde15627bbcea45c817599cab06
parentcadd6115604d80158fc532eb23209975cebf334a (diff)
downloadhercules-3dccf7e300f9868a98075e1863c88c38d3211f33.tar.gz
hercules-3dccf7e300f9868a98075e1863c88c38d3211f33.tar.bz2
hercules-3dccf7e300f9868a98075e1863c88c38d3211f33.tar.xz
hercules-3dccf7e300f9868a98075e1863c88c38d3211f33.zip
Added ItemTradeRestriction enum
- To be used in a follow-up item_db.conf edit. Signed-off-by: Haru <haru@dotalux.com>
-rw-r--r--src/map/itemdb.c20
-rw-r--r--src/map/itemdb.h20
-rw-r--r--src/map/pet.c2
3 files changed, 30 insertions, 12 deletions
diff --git a/src/map/itemdb.c b/src/map/itemdb.c
index 320c64402..a2b1f97ba 100644
--- a/src/map/itemdb.c
+++ b/src/map/itemdb.c
@@ -521,39 +521,39 @@ int itemdb_isstackable2(struct item_data *data)
* Trade Restriction functions [Skotlex]
*------------------------------------------*/
int itemdb_isdropable_sub(struct item_data *item, int gmlv, int unused) {
- return (item && (!(item->flag.trade_restriction&1) || gmlv >= item->gm_lv_trade_override));
+ return (item && (!(item->flag.trade_restriction&ITR_NODROP) || gmlv >= item->gm_lv_trade_override));
}
int itemdb_cantrade_sub(struct item_data* item, int gmlv, int gmlv2) {
- return (item && (!(item->flag.trade_restriction&2) || gmlv >= item->gm_lv_trade_override || gmlv2 >= item->gm_lv_trade_override));
+ return (item && (!(item->flag.trade_restriction&ITR_NOTRADE) || gmlv >= item->gm_lv_trade_override || gmlv2 >= item->gm_lv_trade_override));
}
int itemdb_canpartnertrade_sub(struct item_data* item, int gmlv, int gmlv2) {
- return (item && (item->flag.trade_restriction&4 || gmlv >= item->gm_lv_trade_override || gmlv2 >= item->gm_lv_trade_override));
+ return (item && (item->flag.trade_restriction&ITR_PARTNEROVERRIDE || gmlv >= item->gm_lv_trade_override || gmlv2 >= item->gm_lv_trade_override));
}
int itemdb_cansell_sub(struct item_data* item, int gmlv, int unused) {
- return (item && (!(item->flag.trade_restriction&8) || gmlv >= item->gm_lv_trade_override));
+ return (item && (!(item->flag.trade_restriction&ITR_NOSELLTONPC) || gmlv >= item->gm_lv_trade_override));
}
int itemdb_cancartstore_sub(struct item_data* item, int gmlv, int unused) {
- return (item && (!(item->flag.trade_restriction&16) || gmlv >= item->gm_lv_trade_override));
+ return (item && (!(item->flag.trade_restriction&ITR_NOCART) || gmlv >= item->gm_lv_trade_override));
}
int itemdb_canstore_sub(struct item_data* item, int gmlv, int unused) {
- return (item && (!(item->flag.trade_restriction&32) || gmlv >= item->gm_lv_trade_override));
+ return (item && (!(item->flag.trade_restriction&ITR_NOSTORAGE) || gmlv >= item->gm_lv_trade_override));
}
int itemdb_canguildstore_sub(struct item_data* item, int gmlv, int unused) {
- return (item && (!(item->flag.trade_restriction&64) || gmlv >= item->gm_lv_trade_override));
+ return (item && (!(item->flag.trade_restriction&ITR_NOGSTORAGE) || gmlv >= item->gm_lv_trade_override));
}
int itemdb_canmail_sub(struct item_data* item, int gmlv, int unused) {
- return (item && (!(item->flag.trade_restriction&128) || gmlv >= item->gm_lv_trade_override));
+ return (item && (!(item->flag.trade_restriction&ITR_NOMAIL) || gmlv >= item->gm_lv_trade_override));
}
int itemdb_canauction_sub(struct item_data* item, int gmlv, int unused) {
- return (item && (!(item->flag.trade_restriction&256) || gmlv >= item->gm_lv_trade_override));
+ return (item && (!(item->flag.trade_restriction&ITR_NOAUCTION) || gmlv >= item->gm_lv_trade_override));
}
int itemdb_isrestricted(struct item* item, int gmlv, int gmlv2, int (*func)(struct item_data*, int, int))
@@ -1240,7 +1240,7 @@ bool itemdb_read_itemtrade(char* str[], int columns, int current)
flag = atoi(str[1]);
gmlv = atoi(str[2]);
- if( flag < 0 || flag > 511 ) {//Check range
+ if( flag < 0 || flag > ITR_ALL ) {//Check range
ShowWarning("itemdb_read_itemtrade: Invalid trading mask %d for item id %d.\n", flag, nameid);
return false;
}
diff --git a/src/map/itemdb.h b/src/map/itemdb.h
index 12766b288..5aabdc5c2 100644
--- a/src/map/itemdb.h
+++ b/src/map/itemdb.h
@@ -341,6 +341,24 @@ enum item_class_upper {
ITEMUPPER_ALL = 0x3f, // Sum of all the above
};
+/**
+ * Item Trade restrictions
+ */
+enum ItemTradeRestrictions {
+ ITR_NONE = 0x000, ///< No restrictions
+ ITR_NODROP = 0x001, ///< Item can't be dropped
+ ITR_NOTRADE = 0x002, ///< Item can't be traded (nor vended)
+ ITR_PARTNEROVERRIDE = 0x004, ///< Wedded partner can override ITR_NOTRADE restriction
+ ITR_NOSELLTONPC = 0x008, ///< Item can't be sold to NPCs
+ ITR_NOCART = 0x010, ///< Item can't be placed in the cart
+ ITR_NOSTORAGE = 0x020, ///< Item can't be placed in the storage
+ ITR_NOGSTORAGE = 0x040, ///< Item can't be placed in the guild storage
+ ITR_NOMAIL = 0x080, ///< Item can't be attached to mail messages
+ ITR_NOAUCTION = 0x100, ///< Item can't be auctioned
+
+ ITR_ALL = 0x1ff ///< Sum of all the above values
+};
+
struct item_data {
uint16 nameid;
char name[ITEM_NAME_LENGTH],jname[ITEM_NAME_LENGTH];
@@ -380,7 +398,7 @@ struct item_data {
unsigned available : 1;
unsigned no_refine : 1; // [celest]
unsigned delay_consume : 1; // Signifies items that are not consumed immediately upon double-click [Skotlex]
- unsigned trade_restriction : 9; //Item restrictions mask [Skotlex]
+ unsigned trade_restriction : 9; ///< Item restrictions mask (@see enum ItemTradeRestrictions)
unsigned autoequip: 1;
unsigned buyingstore : 1;
unsigned bindonequip : 1;
diff --git a/src/map/pet.c b/src/map/pet.c
index 05bbfe7b3..e083e58d1 100644
--- a/src/map/pet.c
+++ b/src/map/pet.c
@@ -601,7 +601,7 @@ int pet_menu(struct map_session_data *sd,int menunum)
egg_id = itemdb->exists(sd->pd->petDB->EggID);
if (egg_id) {
- if ((egg_id->flag.trade_restriction&0x01) && !pc->inventoryblank(sd)) {
+ if ((egg_id->flag.trade_restriction&ITR_NODROP) && !pc->inventoryblank(sd)) {
clif->message(sd->fd, msg_txt(451)); // You can't return your pet because your inventory is full.
return 1;
}