Added rental_item_novalue config (#3749)

* Added a config to always sell the rental items to NPC for 0

Thanks to @Lemongrass3110, @cydh, @aleos89, @Daegaladh for the review !
This commit is contained in:
Atemo 2020-05-21 21:13:45 +02:00 committed by GitHub
parent 43caf7cc0a
commit b8ee97b6a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 4 deletions

View File

@ -134,6 +134,9 @@ broadcast_hide_name: 2
// Enable to sell rental item to NPC shop? (Note 1)
rental_transaction: yes
// Sell rental item for 0 to NPC shop regardless of the item value in item_db? (Note 1)
rental_item_novalue: no
// Minimum purchase price of items at a normal Shop
// Officially items cannot be purchased for less than 1 Zeny
min_shop_buy: 1

View File

@ -8952,6 +8952,7 @@ static const struct _battle_data {
{ "devotion_standup_fix", &battle_config.devotion_standup_fix, 1, 0, 1, },
{ "feature.bgqueue", &battle_config.feature_bgqueue, 1, 0, 1, },
{ "homunculus_exp_gain", &battle_config.homunculus_exp_gain, 10, 0, 100, },
{ "rental_item_novalue", &battle_config.rental_item_novalue, 1, 0, 1, },
#include "../custom/battle_config_init.inc"
};

View File

@ -676,6 +676,7 @@ struct Battle_Config
int devotion_standup_fix;
int feature_bgqueue;
int homunculus_exp_gain;
int rental_item_novalue;
#include "../custom/battle_config_struct.inc"
};

View File

@ -2038,9 +2038,13 @@ void clif_selllist(struct map_session_data *sd)
if( !pc_can_sell_item(sd, &sd->inventory.u.items_inventory[i], nd->subtype))
continue;
val=sd->inventory_data[i]->value_sell;
if( val < 0 )
continue;
if (battle_config.rental_item_novalue && sd->inventory.u.items_inventory[i].expire_time)
val = 0;
else {
val = sd->inventory_data[i]->value_sell;
if( val < 0 )
continue;
}
WFIFOW(fd,4+c*10)=i+2;
WFIFOL(fd,6+c*10)=val;
WFIFOL(fd,10+c*10)=pc_modifysellvalue(sd,val);

View File

@ -2211,7 +2211,10 @@ uint8 npc_selllist(struct map_session_data* sd, int n, unsigned short *item_list
return 1; // In official server, this illegal attempt the player will be disconnected
}
value = pc_modifysellvalue(sd, sd->inventory_data[idx]->value_sell);
if (battle_config.rental_item_novalue && sd->inventory.u.items_inventory[idx].expire_time)
value = 0;
else
value = pc_modifysellvalue(sd, sd->inventory_data[idx]->value_sell);
z+= (double)value*amount;
}