summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorshennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-02-11 17:11:56 +0000
committershennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-02-11 17:11:56 +0000
commitc6a57edb3cb1b89ba16fee291fb9344260826570 (patch)
tree3dc6ec6c67bbbea335127a91bb54240d376e5565 /src
parentdbcbf9c883a3bc85c2810dfc88b030a2aa505928 (diff)
downloadhercules-c6a57edb3cb1b89ba16fee291fb9344260826570.tar.gz
hercules-c6a57edb3cb1b89ba16fee291fb9344260826570.tar.bz2
hercules-c6a57edb3cb1b89ba16fee291fb9344260826570.tar.xz
hercules-c6a57edb3cb1b89ba16fee291fb9344260826570.zip
Added 2 new item_trade.txt flags as per kenpachi request:
- Item can't be attached to mail - Item can't be auctioned git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15564 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r--src/map/clif.c5
-rw-r--r--src/map/itemdb.c31
-rw-r--r--src/map/itemdb.h6
-rw-r--r--src/map/mail.c2
4 files changed, 25 insertions, 19 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index 7f706742a..f5a165fe2 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -14003,8 +14003,9 @@ void clif_parse_Auction_setitem(int fd, struct map_session_data *sd)
return;
}
- if( !pc_candrop(sd, &sd->status.inventory[idx]) || !sd->status.inventory[idx].identify )
- { // Quest Item or something else
+ if( !pc_candrop(sd, &sd->status.inventory[idx]) ||
+ !sd->status.inventory[idx].identify ||
+ !itemdb_canauction(&sd->status.inventory[idx],pc_isGM(sd)) ) { // Quest Item or something else
clif_Auction_setitem(sd->fd, idx, true);
return;
}
diff --git a/src/map/itemdb.c b/src/map/itemdb.c
index 3bb77ed34..7f9fedb6b 100644
--- a/src/map/itemdb.c
+++ b/src/map/itemdb.c
@@ -394,41 +394,42 @@ int itemdb_isstackable2(struct item_data *data)
/*==========================================
* Trade Restriction functions [Skotlex]
*------------------------------------------*/
-int itemdb_isdropable_sub(struct item_data *item, int gmlv, int unused)
-{
+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));
}
-int itemdb_cantrade_sub(struct item_data* item, int gmlv, int gmlv2)
-{
+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));
}
-int itemdb_canpartnertrade_sub(struct item_data* item, int gmlv, int gmlv2)
-{
+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));
}
-int itemdb_cansell_sub(struct item_data* item, int gmlv, int unused)
-{
+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));
}
-int itemdb_cancartstore_sub(struct item_data* item, int gmlv, int unused)
-{
+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));
}
-int itemdb_canstore_sub(struct item_data* item, int gmlv, int unused)
-{
+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));
}
-int itemdb_canguildstore_sub(struct item_data* item, int gmlv, int unused)
-{
+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));
}
+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));
+}
+
+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));
+}
+
int itemdb_isrestricted(struct item* item, int gmlv, int gmlv2, int (*func)(struct item_data*, int, int))
{
struct item_data* item_data = itemdb_search(item->nameid);
@@ -615,7 +616,7 @@ static bool itemdb_read_itemtrade(char* str[], int columns, int current)
flag = atoi(str[1]);
gmlv = atoi(str[2]);
- if( flag < 0 || flag >= 128 )
+ if( flag < 0 || flag > 256 )
{//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 52addfb39..9b9ee939f 100644
--- a/src/map/itemdb.h
+++ b/src/map/itemdb.h
@@ -92,7 +92,7 @@ struct item_data {
short no_equip;
unsigned no_refine : 1; // [celest]
unsigned delay_consume : 1; // Signifies items that are not consumed immediately upon double-click [Skotlex]
- unsigned trade_restriction : 7; //Item restrictions mask [Skotlex]
+ unsigned trade_restriction : 9; //Item restrictions mask [Skotlex]
unsigned autoequip: 1;
unsigned buyingstore : 1;
} flag;
@@ -141,6 +141,8 @@ int itemdb_cansell_sub(struct item_data*,int, int);
int itemdb_cancartstore_sub(struct item_data*, int, int);
int itemdb_canstore_sub(struct item_data*, int, int);
int itemdb_canguildstore_sub(struct item_data*, int, int);
+int itemdb_canmail_sub(struct item_data*, int, int);
+int itemdb_canauction_sub(struct item_data*, int, int);
int itemdb_isrestricted(struct item* item, int gmlv, int gmlv2, int (*func)(struct item_data*, int, int));
#define itemdb_isdropable(item, gmlv) itemdb_isrestricted(item, gmlv, 0, itemdb_isdropable_sub)
#define itemdb_cantrade(item, gmlv, gmlv2) itemdb_isrestricted(item, gmlv, gmlv2, itemdb_cantrade_sub)
@@ -149,6 +151,8 @@ int itemdb_isrestricted(struct item* item, int gmlv, int gmlv2, int (*func)(stru
#define itemdb_cancartstore(item, gmlv) itemdb_isrestricted(item, gmlv, 0, itemdb_cancartstore_sub)
#define itemdb_canstore(item, gmlv) itemdb_isrestricted(item, gmlv, 0, itemdb_canstore_sub)
#define itemdb_canguildstore(item, gmlv) itemdb_isrestricted(item , gmlv, 0, itemdb_canguildstore_sub)
+#define itemdb_canmail(item, gmlv) itemdb_isrestricted(item , gmlv, 0, itemdb_canmail_sub)
+#define itemdb_canauction(item, gmlv) itemdb_isrestricted(item , gmlv, 0, itemdb_canauction_sub)
int itemdb_isequip(int);
int itemdb_isequip2(struct item_data *);
diff --git a/src/map/mail.c b/src/map/mail.c
index 249f93abc..ad0b3c917 100644
--- a/src/map/mail.c
+++ b/src/map/mail.c
@@ -82,7 +82,7 @@ unsigned char mail_setitem(struct map_session_data *sd, int idx, int amount)
return 1;
if( amount < 0 || amount > sd->status.inventory[idx].amount )
return 1;
- if( !pc_candrop(sd, &sd->status.inventory[idx]) )
+ if( !pc_candrop(sd, &sd->status.inventory[idx]) || !itemdb_canmail(&sd->status.inventory[idx],pc_isGM(sd)) )
return 1;
sd->mail.index = idx;