From 8083daec0d94f78510411c9b225abcfa7e829e95 Mon Sep 17 00:00:00 2001 From: shennetsind Date: Thu, 7 Nov 2013 17:05:56 -0200 Subject: Further item bind adjustments Thanks to Haruna! Signed-off-by: shennetsind --- src/map/atcommand.c | 4 ++-- src/map/buyingstore.c | 2 +- src/map/clif.c | 6 +++--- src/map/intif.c | 6 +++++- src/map/mail.c | 2 +- src/map/pc.c | 8 ++++---- src/map/pc.h | 2 +- src/map/storage.c | 4 ++-- src/map/trade.c | 2 +- src/map/vending.c | 2 +- 10 files changed, 21 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/map/atcommand.c b/src/map/atcommand.c index e19428d36..316e5a39b 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -1123,7 +1123,7 @@ ACMD(item) return false; } - if( bound < IBT_MIN || bound > IBT_MAX ) { + if(!strcmpi(command+1,"itembound") && !(bound >= IBT_MIN && bound <= IBT_MAX) ) { clif->message(fd, msg_txt(298)); // Invalid bound type return false; } @@ -1189,7 +1189,7 @@ ACMD(item2) if (number <= 0) number = 1; - if( bound < IBT_MIN || bound > IBT_MAX ) { + if( !strcmpi(command+1,"itembound2") && !(bound >= IBT_MIN && bound <= IBT_MAX) ) { clif->message(fd, msg_txt(298)); // Invalid bound type return false; } diff --git a/src/map/buyingstore.c b/src/map/buyingstore.c index 44ece49c6..a9f1412ed 100644 --- a/src/map/buyingstore.c +++ b/src/map/buyingstore.c @@ -290,7 +290,7 @@ void buyingstore_trade(struct map_session_data* sd, int account_id, unsigned int return; } - if( sd->status.inventory[index].expire_time || (sd->status.inventory[index].bound && !pc->can_give_bounded_items(sd)) || !itemdb_cantrade(&sd->status.inventory[index], pc->get_group_level(sd), pc->get_group_level(pl_sd)) || memcmp(sd->status.inventory[index].card, buyingstore->blankslots, sizeof(buyingstore->blankslots)) ) + if( sd->status.inventory[index].expire_time || (sd->status.inventory[index].bound && !pc->can_give_bound_items(sd)) || !itemdb_cantrade(&sd->status.inventory[index], pc->get_group_level(sd), pc->get_group_level(pl_sd)) || memcmp(sd->status.inventory[index].card, buyingstore->blankslots, sizeof(buyingstore->blankslots)) ) {// non-tradable item clif->buyingstore_trade_failed_seller(sd, BUYINGSTORE_TRADE_SELLER_FAILED, nameid); return; diff --git a/src/map/clif.c b/src/map/clif.c index fecf0be0e..70b81ffab 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -1805,7 +1805,7 @@ void clif_selllist(struct map_session_data *sd) if( sd->status.inventory[i].expire_time ) continue; // Cannot Sell Rental Items - if( sd->status.inventory[i].bound && !pc->can_give_bounded_items(sd)) + if( sd->status.inventory[i].bound && !pc->can_give_bound_items(sd)) continue; // Don't allow sale of bound items val=sd->inventory_data[i]->value_sell; @@ -15070,7 +15070,7 @@ void clif_parse_Auction_setitem(int fd, struct map_session_data *sd) if( !pc->can_give_items(sd) || sd->status.inventory[idx].expire_time || !sd->status.inventory[idx].identify || !itemdb_canauction(&sd->status.inventory[idx],pc->get_group_level(sd)) || // Quest Item or something else - (sd->status.inventory[idx].bound && !pc->can_give_bounded_items(sd)) ) { + (sd->status.inventory[idx].bound && !pc->can_give_bound_items(sd)) ) { clif->auction_setitem(sd->fd, idx, true); return; } @@ -15178,7 +15178,7 @@ void clif_parse_Auction_register(int fd, struct map_session_data *sd) } // Auction checks... - if( sd->status.inventory[sd->auction.index].bound && !pc->can_give_bounded_items(sd) ) { + if( sd->status.inventory[sd->auction.index].bound && !pc->can_give_bound_items(sd) ) { clif->message(sd->fd, msg_txt(293)); clif->auction_message(fd, 2); // The auction has been canceled return; diff --git a/src/map/intif.c b/src/map/intif.c index 5cf385fe4..e6ff91af7 100644 --- a/src/map/intif.c +++ b/src/map/intif.c @@ -2120,9 +2120,13 @@ int intif_parse(int fd) case 0x3854: intif->pAuctionMessage(fd); break; case 0x3855: intif->pAuctionBid(fd); break; //Bound items + case 0x3856: #ifdef GP_BOUND_ITEMS - case 0x3856: intif->pItembound_ack(fd); break; + intif->pItembound_ack(fd); +#else + ShowWarning("intif_parse: Received 0x3856 with GP_BOUND_ITEMS disabled !!!\n") #endif + break; // Mercenary System case 0x3870: intif->pMercenaryReceived(fd); break; case 0x3871: intif->pMercenaryDeleted(fd); break; diff --git a/src/map/mail.c b/src/map/mail.c index 76c94879b..007f7592d 100644 --- a/src/map/mail.c +++ b/src/map/mail.c @@ -83,7 +83,7 @@ unsigned char mail_setitem(struct map_session_data *sd, int idx, int amount) { return 1; if( !pc->can_give_items(sd) || sd->status.inventory[idx].expire_time || !itemdb_canmail(&sd->status.inventory[idx],pc->get_group_level(sd)) || - (sd->status.inventory[idx].bound && !pc->can_give_bounded_items(sd)) ) + (sd->status.inventory[idx].bound && !pc->can_give_bound_items(sd)) ) return 1; sd->mail.index = idx; diff --git a/src/map/pc.c b/src/map/pc.c index 752151888..07fba6e57 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -571,7 +571,7 @@ bool pc_can_give_items(struct map_session_data *sd) /** * Determines if player can give / drop / trade / vend bounded items */ -bool pc_can_give_bounded_items(struct map_session_data *sd) +bool pc_can_give_bound_items(struct map_session_data *sd) { return pc->has_permission(sd, PC_PERM_TRADE_BOUND); } @@ -4535,7 +4535,7 @@ int pc_cart_additem(struct map_session_data *sd,struct item *item_data,int amoun return 1; } - if( !itemdb_cancartstore(item_data, pc->get_group_level(sd)) || (item_data->bound > IBT_ACCOUNT && !pc->can_give_bounded_items(sd))) + if( !itemdb_cancartstore(item_data, pc->get_group_level(sd)) || (item_data->bound > IBT_ACCOUNT && !pc->can_give_bound_items(sd))) { // Check item trade restrictions [Skotlex] clif->message (sd->fd, msg_txt(264)); return 1;/* TODO: there is no official response to this? */ @@ -8058,7 +8058,7 @@ int pc_setmadogear(TBL_PC* sd, int flag) *------------------------------------------*/ int pc_candrop(struct map_session_data *sd, struct item *item) { - if( item && (item->expire_time || (item->bound && !pc->can_give_bounded_items(sd))) ) + if( item && (item->expire_time || (item->bound && !pc->can_give_bound_items(sd))) ) return 0; if( !pc->can_give_items(sd) ) //check if this GM level can drop items return 0; @@ -10395,7 +10395,7 @@ void pc_defaults(void) { pc->class2idx = pc_class2idx; pc->get_group_level = pc_get_group_level; pc->can_give_items = pc_can_give_items; - pc->can_give_bounded_items = pc_can_give_bounded_items; + pc->can_give_bound_items = pc_can_give_bound_items; pc->can_use_command = pc_can_use_command; pc->has_permission = pc_has_permission; diff --git a/src/map/pc.h b/src/map/pc.h index 93463d19b..32ca214c0 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -750,7 +750,7 @@ struct pc_interface { int (*get_group_level) (struct map_session_data *sd); //int (*getrefinebonus) (int lv,int type); FIXME: This function does not exist, nor it is ever called bool (*can_give_items) (struct map_session_data *sd); - bool (*can_give_bounded_items) (struct map_session_data *sd); + bool (*can_give_bound_items) (struct map_session_data *sd); bool (*can_use_command) (struct map_session_data *sd, const char *command); bool (*has_permission) (struct map_session_data *sd, unsigned int permission); diff --git a/src/map/storage.c b/src/map/storage.c index 0a2e6d118..db85b3c98 100644 --- a/src/map/storage.c +++ b/src/map/storage.c @@ -141,7 +141,7 @@ int storage_additem(struct map_session_data* sd, struct item* item_data, int amo return 1; } - if( item_data->bound > IBT_ACCOUNT && !pc->can_give_bounded_items(sd) ) { + if( item_data->bound > IBT_ACCOUNT && !pc->can_give_bound_items(sd) ) { clif->message(sd->fd, msg_txt(294)); return 1; } @@ -441,7 +441,7 @@ int guild_storage_additem(struct map_session_data* sd, struct guild_storage* sto return 1; } - if( item_data->bound && item_data->bound != IBT_GUILD && !pc->can_give_bounded_items(sd) ) { + if( item_data->bound && item_data->bound != IBT_GUILD && !pc->can_give_bound_items(sd) ) { clif->message(sd->fd, msg_txt(294)); return 1; } diff --git a/src/map/trade.c b/src/map/trade.c index 327d19880..ffd1336f5 100644 --- a/src/map/trade.c +++ b/src/map/trade.c @@ -368,7 +368,7 @@ void trade_tradeadditem(struct map_session_data *sd, short index, short amount) if( item->bound && !( item->bound == IBT_GUILD && sd->status.guild_id == target_sd->status.guild_id ) && !( item->bound == IBT_PARTY && sd->status.party_id == target_sd->status.party_id ) - && !pc->can_give_bounded_items(sd) ) { + && !pc->can_give_bound_items(sd) ) { clif->message(sd->fd, msg_txt(293)); clif->tradeitemok(sd, index+2, TIO_INDROCKS); return; diff --git a/src/map/vending.c b/src/map/vending.c index d5e5d1804..f16a208e4 100644 --- a/src/map/vending.c +++ b/src/map/vending.c @@ -257,7 +257,7 @@ void vending_openvending(struct map_session_data* sd, const char* message, const || !sd->status.cart[index].identify // unidentified item || sd->status.cart[index].attribute == 1 // broken item || sd->status.cart[index].expire_time // It should not be in the cart but just in case - || (sd->status.cart[index].bound && !pc->can_give_bounded_items(sd)) // can't trade bound items w/o permission + || (sd->status.cart[index].bound && !pc->can_give_bound_items(sd)) // can't trade bound items w/o permission || !itemdb_cantrade(&sd->status.cart[index], pc->get_group_level(sd), pc->get_group_level(sd)) ) // untradeable item continue; -- cgit v1.2.3-60-g2f50