I suggest you read the comment above the function. It suggests that the comparison in the middle is there to prevent money making loopholes where you can sell something at a higher price than you can buy it for.
To make this still work, the alterations must happen
before that check.
So, you add the
same change as in the buy_price function (to calculate the correct buy factor) and then tweak the sell factor by
dividing by the HUMAN_FACTOR:
Code:
static int sell_price(struct obj_data *obj, int shop_nr, struct char_data *keeper, struct char_data *seller)
{
float HUMAN_FACTOR = .7;
float sell_cost_modifier = SHOP_SELLPROFIT(shop_nr) * (1 - (GET_CHA(keeper) - GET_CHA(seller)) / (float)70)
/ (!IS_NPC(seller) && GET_RACE(seller) == RACE_HUMAN ? HUMAN_FACTOR : 1);
float buy_cost_modifier = SHOP_BUYPROFIT(shop_nr) * (1 + (GET_CHA(keeper) - GET_CHA(seller)) / (float)70)
* (!IS_NPC(seller) && GET_RACE(seller) == RACE_HUMAN ? HUMAN_FACTOR : 1);
if (sell_cost_modifier > buy_cost_modifier)
sell_cost_modifier = buy_cost_modifier;
return (int) (GET_OBJ_COST(obj) * sell_cost_modifier);
}
as always, browser code, you may need to tweak it