Trading Mechanics

Overview

Trading is a live barter system, not a placeholder. You negotiate value-for-value exchanges with settlers, travelers, and caravans, where timing, reputation, and social mood directly change your prices.

How Trading Actually Works

Core Barter Rule

A deal is accepted only when your offered value is greater than or equal to requested value.

  • Offer value is calculated from your resources/items using ITEM_VALUES
  • Requested value is NPC item value multiplied by current trade multipliers
  • If short: trade is rejected with a warning

Price Multipliers (Settlement Traders)

Settlement reputation modifies prices first:

  • rep >= 50: 0.8x cost (discount)
  • rep <= -10: 1.5x cost (markup)
  • otherwise: base 1.0x

Then additional live modifiers apply:

  • NPC mood multiplier (getNPCPriceMultiplier)
  • settlement event multiplier (currentSettlementEffects.priceMultiplier)
  • collection bonus discount (tradePriceBonus, capped in code)

Final requested cost per unit is rounded up (Math.ceil).

Mood Matters

NPC mood is not cosmetic. Good mood improves prices; irritated mood raises them. The trade UI surfaces this directly in the header text.

Stock Is Validated at Confirm

Before completion, code re-checks NPC stock and your inventory/resources:

  • if NPC stock changed -> rejected
  • if you no longer have enough offered goods -> rejected
  • if selected inventory item vanished -> rejected

This prevents stale or desynced trades.

On Success

Successful trade flow:

  1. remove offered resources/items from player
  2. add them to NPC stock
  3. transfer requested NPC goods to player
  4. reduce/remove NPC stock rows
  5. increment tradesCompleted

If you overpay by more than 20%, NPC gives a positive reaction message.

Where You Can Trade

Friendly Encounters

Friendly NPC encounters can open direct barter (renderTradingPanel(null, npc)).

Settlements

Settlement trader prices are the most dynamic because they include reputation, mood, and settlement effects.

World Caravans

Caravans use the same trade panel, but add caravan-specific systems:

  • route/origin/destination context
  • travel option when available
  • trade goodwill cooldown before next reputation gain from caravan trading

Collection Trade Layer

Behind normal barter, some traders run a curated relic shelf: scarce pieces your archive still misses.

  • stock refreshes every 72 in-game hours (about 3 days)
  • offer count is role-driven (trader gets more than craftsman) and can expand from museum tier bonuses
  • rarity is weighted (common appears more often), but strong local reputation (250+) slightly improves uncommon/rare odds
  • base offer prices are rarity-based, then reduced by settlement reputation (up to ~22% inside offer generation)
  • checkout applies your collection trade discount again via getCollectionTradeBonusPercent (discount capped in code)
  • bought offers are flagged as sold for that cycle and removed from availability
  • when purchased in a settlement context, each relic buy gives +1 settlement reputation (collectionstockpurchase)

Item Value System (ITEM_VALUES)

Every deal runs through ITEM_VALUES: your field ledger of what survivors will actually honor in barter. Think of it as practical trust converted into numbers.

Item Value
medicine 20
gold_bar 92
kevlar_plate 68
master_rod 28
river_pearls 24
circuitBoard 12
chemSupplies 15
wood 2
stone 3
tinder 1

How to read this table in play:

  • emergency goods and strategic tech hold premium leverage (medicine, kevlar_plate, circuitBoard)
  • prestige and rarity spike value ceiling (goldbar, riverpearls)
  • route fuel and survival basics stay low but stable (wood, stone, tinder)

For long runs, carry dense value. For local stability, keep low-value essentials and trade only true surplus.

Practical Trade Playbook

Before Opening Trade

  • read the social weather first: rep >= 50 gives friend pricing, rep <= -10 triggers enemy markup
  • watch trader mood before you commit; mood multiplier can quietly swing the whole deal
  • pack negotiator cargo, not dead weight: a few flexible mid/high-value pieces let you pivot fast
  • if a settlement event is active, expect additional price pressure or relief on top of rep/mood

During Negotiation

  • anchor near parity, then climb only as needed; acceptance is strict value math (offer >= request)
  • remember requested NPC goods are recalculated with multiplier-adjusted cost (rounded up per unit)
  • overpaying by more than ~20% can trigger goodwill flavor text, but still costs real survival value
  • lock decisions quickly when a favorable event window appears

After Trade

  • re-check stock immediately; the game revalidates inventory/stock at confirm and can reject stale selections
  • on caravans, track trade-goodwill cooldown before expecting another reputation gain cycle
  • compress haul quality: turn bulky low-value surplus into compact, mission-useful resources

Common Mistakes

  • walking in blind to social pricing: reputation and mood can cost you more than the goods themselves
  • chasing value parity while ignoring multiplier reality (event pressure, mood swings, settlement trust bands)
  • filling the offer tray with survival lifelines (water, medicine) and leaving yourself no return buffer
  • expecting caravan trades to grant reputation every time instead of respecting goodwill cooldown rhythm
  • treating open UI stock as final; confirm-time validation can reject stale or changed inventory

Practical Rule

A "good" trade clears three checks at once: the value math passes, your survival reserve stays intact, and you strike when mood/reputation windows are on your side. If a deal solves today but empties tomorrow, it is not a win.