Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Traders have trading standards #57660

Closed
wants to merge 12 commits into from

Conversation

stubkan
Copy link
Contributor

@stubkan stubkan commented May 13, 2022

Traders have better trading standards - Pay less for filthy, damaged items, wont sell stuff for free and barter more sensibly.

Summary

Balance "Traders have better trading standards - Pay less for filthy, damaged items, wont sell stuff for free and barter more sensibly."

Purpose of change

It is really easy to cheese the trading system by just mass-selling filthy trash you get from corpses - especially soldier zombies. And no sensible shopkeeper wants to fill their store up with torn apart filthy bloodsoaked broken shoes and gloves. Or give away their stock for nothing. Or let you sell something to them for more than you just bought it from them for.

So the changes proposed will make that harder to do, making traders behave more sensibly, closing exploits.

Minimum price fixes
Fixes #55444

Barter adjustment and caps fixes
Fixes #47569
Fixes #55368
Fixes #46081

Describe the solution

Traders will behave differently, with their own welfare in mind and with the intention of making a profit.

The price penalty for damage is now doubled, so you no longer get a little 30-40% price reduction for an almost destroyed item. It is now 60-80% reduction for almost destroyed items.

Added low cost threshold for npc selling - They will no longer sell stuff to you for free, but for 1c minimum. A trader gotta make a living. They will also refuse to buy items from you that cost 1c or less.

Filthy items will be sold to them at half price.

Barter price adjustment is reworked - they get a trade advantage - which depends on their INT/social and your INT/social. Your selling prices are unaffected, but their stock, they will sell to you at a higher cost, a markup - like real shops do. There is a cap in place - so they can't get too high, and the cap prevents buy/sell prices ever overlapping.

Player sell price adjustment can range from 50% to 140% and NPC price adjustment can range from 160% to 220%.

You can barter them down and your items value up to counteract, but you should not be able to sell them items for more than they sell to you anymore.

Currency items that were getting price adjusted (merch strap for example) leading to money exploits will not be adjusted anymore. You can still trade other faction currency at adjusted rates as normal though.

Describe alternatives you've considered

Considered #57706 for barter solution, but that PR is not conductive to a good barter system at this stage.

I implemented some of their code as it was better and is working with the same code as this PR, but implementing it better. I hope this is okay, I dont know how to add a co-author. Thanks andrei8l

Testing

Filled up on filthy and damaged pants / socks from debug killing some zombies and then tried to trade to an evac center npc to see the changes are working. The pricing and trade refusal are working better.

Additional context

Cheaper damaged items.
image

Minimum cost of sold items now 1cent
image

Halved generous pricing reduction for damaged items
@github-actions github-actions bot added Game: Balance Balancing of (existing) in-game features. [C++] Changes (can be) made in C++. Previously named `Code` Info / User Interface Game - player communication, menus, etc. astyled astyled PR, label is assigned by github actions json-styled JSON lint passed, label assigned by github actions labels May 13, 2022
@andrei8l
Copy link
Contributor

Cleaning filthy items is trivial so why would faction traders refuse them? It would make sense for NPCs with the squeamish trait to refuse them though.

src/trade_ui.cpp Outdated
@@ -69,6 +70,8 @@ std::string trade_preset::get_denial( const item_location &loc ) const
npc const &np = *_trader.as_npc();
if( !np.wants_to_buy( *loc, price, market_price ) ) {
return string_format( _( "%s does not want to buy this" ), np.get_name() );
} else if( loc->has_flag( flag_FILTHY ) ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put this in with the rest of the refusal logic in npc::wants_to_buy()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah, thats a better spot for it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It loses the "doesnt want filthy items" message, but I guess people will figure that part out
image

Copy link
Contributor

@andrei8l andrei8l May 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could change the return value of wants_to_buy() to ret_val<bool> which can store a string for additional context

Now checks in the npc::wants_to_buy() section
@github-actions github-actions bot added NPC / Factions NPCs, AI, Speech, Factions, Ownership BasicBuildPassed This PR builds correctly, label assigned by github actions labels May 13, 2022
@github-actions github-actions bot removed astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions labels May 13, 2022
@stubkan stubkan changed the title Traders won't buy filthy items and pay less for damaged/broken items Traders have trading standards May 13, 2022
@stubkan
Copy link
Contributor Author

stubkan commented May 13, 2022

Added cost threshold - since you could buy 1000 thread, 500 solder, 500 rags from refugee center for nothing.

Now if an item costs less than 1c it will revert its price to 1c minimum.

image

Only applies to buying, not selling. Since traders will refuse to buy items that cost less than 5c.

image

It was a little hard chasing down this bug. It seems the cost calculation was being done in a few different places. Especially for ammo type items such as solder or thread, they were being calculated down to below 1. So I added sanity checks that forced them to revert to 1 if they were calculated lower.

@github-actions github-actions bot added the astyled astyled PR, label is assigned by github actions label May 13, 2022
@stubkan stubkan marked this pull request as draft May 13, 2022 16:53
@Nebnis
Copy link
Contributor

Nebnis commented May 13, 2022

I would also lower the value of rigid kevlar sheets, they are really easy to get from soldier zombies and sell for an overwhelming 150. You can get like over 15+ from their vests

@stubkan
Copy link
Contributor Author

stubkan commented May 13, 2022

I would also lower the value of rigid kevlar sheets, they are really easy to get from soldier zombies and sell for an overwhelming 150. You can get like over 15+ from their vests

Oh yeah. Im sure there are other items like that too - But that is a json item level problem so youd need to edit item jsons themselves to balance. This PR is a merchant c++ code PR, it might be better for a separate PR for json item rebalance stuff

@stubkan
Copy link
Contributor Author

stubkan commented May 13, 2022

Working on fixing another problem with traders - which is #47569

To fix you being able to cheese the barter system by selling objects back for more than you bought them for - npcs have a selling advantage. You can still make deals and adjust the pricing if your INT and social are higher, but it is harder.

Observe the pricing difference with a pocket knife here

This is with both npc and you having default INT/social of 8/0

image

When my player gets an INT of 12 and social 4 the pricing becomes thus

image

This is when the NPC has an INT of 12 and social of 4 (and player INT 8, social 0)

image

Can still change the numbers here... Id like to be able to bring the npc pricing down more

@andrei8l
Copy link
Contributor

You're doubling the NPC's prices at no stat/skill difference. 5 points of skill advantage then double it again. That seems a little extreme.

@stubkan
Copy link
Contributor Author

stubkan commented May 14, 2022

You're doubling the NPC's prices at no stat/skill difference. 5 points of skill advantage then double it again. That seems a little extreme.

Just trying things out. Though, Kevin said that npc buy and sell prices should not be anywhere near the same and I agree - its typical for game trading mechanics to have the prices nowhere near each other and shops irl are the same. Ever try to buy something you sold at the pawn shop back?

I'll have a look at your pr in a while though and play test it out ... Though Id like to combine your PR with mine if its better - because the other changes Im doing here may conflict and cause unpredictable results so Ive been testing it all together

implemented andrei8ls code for;
filthy item price reductions (changed to half price)
removed redundant visit_items code
@dseguin dseguin removed Translation I18n [JSON] Changes (can be) made in JSON Mods Issues related to mods or modding Items: Magazines Ammo holding items and objects. Items: Gunmod / Toolmod Weapon and tool attachments, and add-ons Missions Quests and missions Map / Mapgen Overmap, Mapgen, Map extras, Map display Crafting / Construction / Recipes Includes: Uncrafting / Disassembling Spawn Creatures, items, vehicles, locations appearing on map Mutations / Traits / Professions/ Hobbies Mutations / Traits / Professions/ Hobbies Code: Tests Measurement, self-control, statistics, balancing. Monsters Monsters both friendly and unfriendly. Fields / Furniture / Terrain / Traps Objects that are part of the map or its features. [Markdown] Markdown issues and PRs Items: Ammo / Guns Ammunition for all kinds of weapons and these weapons themselves Melee Melee weapons, tactics, techniques, reach attack Scenarios New Scenarios, balancing, bugs with scenarios Mods: Magiclysm Anything to do with the Magiclysm mod Mods: Aftershock Anything to do with the Aftershock mod Items: Containers Things that hold other things Code: Tooling Tooling that is not part of the main game but is part of the repo. Martial Arts Arts, Techniques, weapons and anything touching martial arts. Items: Armor / Clothing Armor and clothing Mods: MMA Mythical Martial Arts mod EOC: Effects On Condition Anything concerning Effects On Condition labels May 17, 2022
@Night-Pryanik
Copy link
Contributor

Could you please resolve conflicts?

@Fris0uman
Copy link
Contributor

Looks like all the issue that this was supposed to solved have already been solved, also stale

@Fris0uman Fris0uman closed this Aug 4, 2022
@Fris0uman Fris0uman added the stale Closed for lack of activity, but still valid. label Aug 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions [C++] Changes (can be) made in C++. Previously named `Code` json-styled JSON lint passed, label assigned by github actions NPC / Factions NPCs, AI, Speech, Factions, Ownership stale Closed for lack of activity, but still valid.
Projects
None yet
6 participants