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:
parent
cabb547164
commit
557cccac9c
@ -105,3 +105,8 @@ item_flooritem_check: yes
|
|||||||
// 3 - Party
|
// 3 - Party
|
||||||
// 4 - Character
|
// 4 - Character
|
||||||
default_bind_on_equip: 4
|
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
|
||||||
|
@ -8429,6 +8429,7 @@ static const struct _battle_data {
|
|||||||
{ "guild_leaderchange_woe", &battle_config.guild_leaderchange_woe, 0, 0, 1, },
|
{ "guild_leaderchange_woe", &battle_config.guild_leaderchange_woe, 0, 0, 1, },
|
||||||
{ "guild_alliance_onlygm", &battle_config.guild_alliance_onlygm, 0, 0, 1, },
|
{ "guild_alliance_onlygm", &battle_config.guild_alliance_onlygm, 0, 0, 1, },
|
||||||
{ "feature.achievement", &battle_config.feature_achievement, 1, 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"
|
#include "../custom/battle_config_init.inc"
|
||||||
};
|
};
|
||||||
|
@ -631,6 +631,7 @@ extern struct Battle_Config
|
|||||||
int guild_leaderchange_woe;
|
int guild_leaderchange_woe;
|
||||||
int guild_alliance_onlygm;
|
int guild_alliance_onlygm;
|
||||||
int feature_achievement;
|
int feature_achievement;
|
||||||
|
int allow_bound_sell;
|
||||||
|
|
||||||
#include "../custom/battle_config_struct.inc"
|
#include "../custom/battle_config_struct.inc"
|
||||||
} battle_config;
|
} battle_config;
|
||||||
|
11
src/map/pc.c
11
src/map/pc.c
@ -582,14 +582,18 @@ void pc_inventory_rental_add(struct map_session_data *sd, unsigned int seconds)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the player can sell the current item
|
* Check if the player can sell the current item
|
||||||
* @param sd map_session_data of the player
|
* @param sd: map_session_data of the player
|
||||||
* @param item struct of the checking item.
|
* @param item: struct of the checking item
|
||||||
* @return bool 'true' is sellable, 'false' otherwise
|
* @return bool 'true' is sellable, 'false' otherwise
|
||||||
*/
|
*/
|
||||||
bool pc_can_sell_item(struct map_session_data *sd, struct item *item) {
|
bool pc_can_sell_item(struct map_session_data *sd, struct item *item) {
|
||||||
|
struct npc_data *nd;
|
||||||
|
|
||||||
if (sd == NULL || item == NULL)
|
if (sd == NULL || item == NULL)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
nd = map_id2nd(sd->npc_shopid);
|
||||||
|
|
||||||
if (!itemdb_cansell(item, pc_get_group_level(sd)))
|
if (!itemdb_cansell(item, pc_get_group_level(sd)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -599,6 +603,9 @@ bool pc_can_sell_item(struct map_session_data * sd, struct item * item) {
|
|||||||
if (item->expire_time)
|
if (item->expire_time)
|
||||||
return false; // Cannot Sell Rental Items
|
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))
|
if (item->bound && !pc_can_give_bounded_items(sd))
|
||||||
return false; // Don't allow sale of bound items
|
return false; // Don't allow sale of bound items
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user