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://svn.code.sf.net/p/rathena/svn/trunk@15564 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
shennetsind 2012-02-11 17:11:56 +00:00
parent dd3fb2a2d3
commit 70352fc918
6 changed files with 31 additions and 21 deletions

View File

@ -2,13 +2,15 @@
//Specify here special rules for item trading. //Specify here special rules for item trading.
//Item ID, TradeMask, GM-Level Override //Item ID, TradeMask, GM-Level Override
//Trading mask values: //Trading mask values:
//1:Item can't be drop //1:Item can't be drop (nor mailed/auctioned)
//2:Item can't be traded (nor vended) //2:Item can't be traded (nor vended)
//4:Wedded partner can override restriction 2. //4:Wedded partner can override restriction 2.
//8:Item can't be sold to npcs //8:Item can't be sold to npcs
//16:Item can't be placed in the cart //16:Item can't be placed in the cart
//32:Item can't be placed in the storage //32:Item can't be placed in the storage
//64:Item can't be placed in the guild storage //64:Item can't be placed in the guild storage
//128:Item can't be attached to mail
//256:Item can't be auctioned
//Example: //Example:
//1161,67,50 //Balmung: No drop, No trade, No Guild Store (1+2+64 =67), //1161,67,50 //Balmung: No drop, No trade, No Guild Store (1+2+64 =67),
//only GMs of GM-level 50 and up can override the setting. //only GMs of GM-level 50 and up can override the setting.

View File

@ -2,13 +2,15 @@
//Specify here special rules for item trading. //Specify here special rules for item trading.
//Item ID, TradeMask, GM-Level Override //Item ID, TradeMask, GM-Level Override
//Trading mask values: //Trading mask values:
//1:Item can't be drop //1:Item can't be drop (nor mailed/auctioned)
//2:Item can't be traded (nor vended) //2:Item can't be traded (nor vended)
//4:Wedded partner can override restriction 2. //4:Wedded partner can override restriction 2.
//8:Item can't be sold to npcs //8:Item can't be sold to npcs
//16:Item can't be placed in the cart //16:Item can't be placed in the cart
//32:Item can't be placed in the storage //32:Item can't be placed in the storage
//64:Item can't be placed in the guild storage //64:Item can't be placed in the guild storage
//128:Item can't be attached to mail
//256:Item can't be auctioned
//Example: //Example:
//1161,67,50 //Balmung: No drop, No trade, No Guild Store (1+2+64 =67), //1161,67,50 //Balmung: No drop, No trade, No Guild Store (1+2+64 =67),
//only GMs of GM-level 50 and up can override the setting. //only GMs of GM-level 50 and up can override the setting.

View File

@ -14003,8 +14003,9 @@ void clif_parse_Auction_setitem(int fd, struct map_session_data *sd)
return; return;
} }
if( !pc_candrop(sd, &sd->status.inventory[idx]) || !sd->status.inventory[idx].identify ) if( !pc_candrop(sd, &sd->status.inventory[idx]) ||
{ // Quest Item or something else !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); clif_Auction_setitem(sd->fd, idx, true);
return; return;
} }

View File

@ -394,41 +394,42 @@ int itemdb_isstackable2(struct item_data *data)
/*========================================== /*==========================================
* Trade Restriction functions [Skotlex] * 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)); 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)); 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)); 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)); 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)); 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)); 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)); 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)) 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); 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]); flag = atoi(str[1]);
gmlv = atoi(str[2]); gmlv = atoi(str[2]);
if( flag < 0 || flag >= 128 ) if( flag < 0 || flag > 256 )
{//Check range {//Check range
ShowWarning("itemdb_read_itemtrade: Invalid trading mask %d for item id %d.\n", flag, nameid); ShowWarning("itemdb_read_itemtrade: Invalid trading mask %d for item id %d.\n", flag, nameid);
return false; return false;

View File

@ -92,7 +92,7 @@ struct item_data {
short no_equip; short no_equip;
unsigned no_refine : 1; // [celest] unsigned no_refine : 1; // [celest]
unsigned delay_consume : 1; // Signifies items that are not consumed immediately upon double-click [Skotlex] 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 autoequip: 1;
unsigned buyingstore : 1; unsigned buyingstore : 1;
} flag; } 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_cancartstore_sub(struct item_data*, int, int);
int itemdb_canstore_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_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)); 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_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) #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_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_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_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_isequip(int);
int itemdb_isequip2(struct item_data *); int itemdb_isequip2(struct item_data *);

View File

@ -82,7 +82,7 @@ unsigned char mail_setitem(struct map_session_data *sd, int idx, int amount)
return 1; return 1;
if( amount < 0 || amount > sd->status.inventory[idx].amount ) if( amount < 0 || amount > sd->status.inventory[idx].amount )
return 1; 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; return 1;
sd->mail.index = idx; sd->mail.index = idx;