Adds allow_bound_sell configuration. (#2401)

- It is possible to sell bound items, when allow_bound_sell is enabled.
- Fixes #2398.
- Changes made by @aleos89
- Thanks to @Everade
This commit is contained in:
Jeybla 2017-09-12 21:53:55 +02:00 committed by Aleos
parent cabb547164
commit 557cccac9c
4 changed files with 20 additions and 6 deletions

View File

@ -105,3 +105,8 @@ item_flooritem_check: yes
// 3 - Party
// 4 - Character
default_bind_on_equip: 4
// Allow selling of bound items as Itemshop currency?
// no = Bound items are unable to be sold at Itemshops
// yes = Bound items are able to be sold at Itemshops
allow_bound_sell: no

View File

@ -8429,6 +8429,7 @@ static const struct _battle_data {
{ "guild_leaderchange_woe", &battle_config.guild_leaderchange_woe, 0, 0, 1, },
{ "guild_alliance_onlygm", &battle_config.guild_alliance_onlygm, 0, 0, 1, },
{ "feature.achievement", &battle_config.feature_achievement, 1, 0, 1, },
{ "allow_bound_sell", &battle_config.allow_bound_sell, 1, 0, 1, },
#include "../custom/battle_config_init.inc"
};

View File

@ -631,6 +631,7 @@ extern struct Battle_Config
int guild_leaderchange_woe;
int guild_alliance_onlygm;
int feature_achievement;
int allow_bound_sell;
#include "../custom/battle_config_struct.inc"
} battle_config;

View File

@ -581,15 +581,19 @@ void pc_inventory_rental_add(struct map_session_data *sd, unsigned int seconds)
}
/**
* Check if the player can sell the current item
* @param sd map_session_data of the player
* @param item struct of the checking item.
* @return bool 'true' is sellable, 'false' otherwise
*/
bool pc_can_sell_item(struct map_session_data * sd, struct item * item) {
* Check if the player can sell the current item
* @param sd: map_session_data of the player
* @param item: struct of the checking item
* @return bool 'true' is sellable, 'false' otherwise
*/
bool pc_can_sell_item(struct map_session_data *sd, struct item *item) {
struct npc_data *nd;
if (sd == NULL || item == NULL)
return false;
nd = map_id2nd(sd->npc_shopid);
if (!itemdb_cansell(item, pc_get_group_level(sd)))
return false;
@ -599,6 +603,9 @@ bool pc_can_sell_item(struct map_session_data * sd, struct item * item) {
if (item->expire_time)
return false; // Cannot Sell Rental Items
if (nd && nd->subtype == NPCTYPE_ITEMSHOP && item->bound && battle_config.allow_bound_sell)
return true; // NPCTYPE_ITEMSHOP and bound item config is sellable
if (item->bound && !pc_can_give_bounded_items(sd))
return false; // Don't allow sale of bound items
return true;