Barter Trades 1.0.6

Please do not ask when mod authors will update their mods to 3.9.X
Bothering mod authors will lead to warnings and repeat offenses will lead to eventual bans.

Converts or removes all money trades from all traders (except Fence).

BarderTradeMod

Converts or removes all money trades from all traders (except Fence).

Conversion uses random barter trade items (see list below).

Also converts trades from modded traders when placed after in mod load order.

Edit the folder name "z-Lavax-BarterTrades" or order.json.


Inspired by ODT-Softcore and extends the idea that all items are valueable now.

Function:

Compares the cost of the item with all barter items.

Replaces the money trade with equally valued barter items.

If there is no barter item with a high enough value multiple items need to be traded in.

Sometimes a second item is needed for the barter trade if the value of the first is not enough.

Ammo trades are replaced with less valued ammo in a 2 for 1 or 4 for 1 exchange rate.

Watch out an ammo trade deletes 1 full ammo stack from your inventory, so put in the correct number.

Questitems and dogtags are excluded.

Regular barter trades are not changed.


Trades are randomed each server restart or generated via a seed number and stay the same.

If you change the seed and restart the server the trades will be different.

Install:

Extract folder into user/mods.

Remove folder and restart server to uninstall

Config:

Enable RemoveMoneyTrades or ReplaceMoneyTrades

  • "BarterBlacklist": exclude items to be used as barter
  • "BarterItemPriceLimit": exclude items to be used as barter with value > X
  • "NotAffectedTraders": exclude traders from being converted
  • "convertAmmo": default true, set to false if you want to keep trading ammo for money
  • "minCostToConvert": only item that cost more than this will be converted to barter trades
  • "exclusionList": items in this list will not be converted to barter trades.
  • "enableSeededRandomness": default true, set to false if you want to re-random at each server restart.
  • "seed": this is a value to control the random generation. The randomization for a specific value will always be the same.
  • BarterValueMultiplicator: with this you can set how much value your traded items need to have to get the item you want


    • "applyToItemsWithValueGreater": set a value in rubles to only apply this to expensive items, because the pool for a fair trade is very small
    • "mult": set a multiplier to reduce the needed value of items
    • example: 500000 and mult = 0.5
      reduces the value of items that cost more than 500k (e.g. Junkbox) by half so you only need to trade in less valueable items.



Random Trade Items:

Others = "5b47574386f77428ca22b2f4" -- Dogtags are excluded

Buildingmaterials = "5b47574386f77428ca22b2ee"

Electronics = "5b47574386f77428ca22b2ef"

Energyelements = "5b47574386f77428ca22b2ed"

Flammablematerials = "5b47574386f77428ca22b2f2"

Householdmaterials = "5b47574386f77428ca22b2f0"

Medicalsupplies = "5b47574386f77428ca22b2f3"

Tools = "5b47574386f77428ca22b2f6"

Valuables = "5b47574386f77428ca22b2f1"

Ammo = "5485a8684bdc2da71d8b4567"

  • Version 1.0.6

    Added a few config options:


    "convertAmmo": default true, set to false if you want to keep trading ammo for money

    "minCostToConvert": only item that cost more than this will be converted to barter trades

    "exclusionList": items in this list will not be converted to barter trades.

    "enableSeededRandomness": default true, set to false if you want to re-random at each server restart.

    "seed": this is a value to control the random generation. The randomization for a specific value will always be the same.

  • Version 1.0.5

    Added a config option to set a value multiplier for items above a certain cost.

    For example:


    "applyToItemsWithValueGreater": 500000,

    "mult": 0.5


    reduces the value of items that cost more than 500k (e.g. Junkbox) by half.

    So you only have to trade in less valueable items.


    But you can also make it harder by setting the mult >1

  • Version 1.0.4

    Fixed error with remove money trades

  • Version 1.0.3

    Updated the formula for how barter items are picked.


    Now more different barter goods are used for items of the same value, however, it is more likely that a second barter item is necessary.

    Before more expensive items almost always needed LedX, Tank Battery or MCC.


    Added some quest items to the exclusion list (Motor Controller, Gyroscope and Tree Ornaments)

  • Version 1.0.2

    New

    Config Options:

    BarterBlacklist: exclude items to be used as barter

    BarterItemPriceLimit: exclude items to be used as barter with value > X

    (this may result in high amounts of less valued items)

    NotAffectedTraders: exclude traders from being converted

  • Version 1.0.1

    added checks for undefined to prevent errors

  • Is there a way to wait for other mods that use async postDBLoadAsync

    to run my code after they are done?


    Would be great if another modder could anwser, I did not find any info on this.

  • Hey mate, I know it's (likely) a lot of work, but I was wondering if you have any plans to update this mod for 3.8?


    It looks like the perfect mod for my 3.8 pseduo-hardcore run.


    Thanks in advance for any response!

  • Can it work in 3.7.X?

  • about the ammo barter. If you don't ajust the quantity of rounds you want, they will trade just one bullet for all of your ammo.


    If you move the ammo in your inventory while on trader screen, They will not recognize the ammo anymore.

  • Love the idea of this mod. Just wondering if there is a way, besides from manually changing the seed, to have the seed change every week or couple of weeks? I like the idea of checking the market for what trades are available, hunting for the items I want but knowing that the current deals aren’t going to last forever. This way you can target farm a bit. Thanks for the work on the mod!

  • Great mod dude, but please add option to blacklist items to convert , maybe even in categories such as ammo, mags, rigs, etc. and it will be cool to have a botom line value after wich items got converted to barter <3<3<3

    • Added a config option for ammo and a blacklist.

  • is there a possibility to make it not refresh on every server restart so that each time the trades are the same?

    • I added a config option for seeded random generation. Now trades are tied to the seed and will stay the same.

  • Hmm, so the only way to fill the spent requirement is selling items to traders now?

    • yes, unfortunately barter trades do not count towards the sum

  • Im new and just curious so how exactly do i bring back dogtags barter trades? i find it fitting and would like to add it into the mod

  • Ho and I have a question, is it possible to disable all currency trades exept for container ?

    • You can modify the mod a little bit to achieve that.

      mod.ts In line 245++


      exclusion.push(dollars)


      you can add:

      exclusion.push("item_id_of_container")


      just add all ids of the containers you want to be tradeable for money

    • thanks a lot man !

    • Is this good ?

    • yea just put a comma after the id to separate the inputs, like


      "5b7c710788a4506dec015957", // Scav Box

    • Okay thanks, did you find the issue btw ? If you tell me I could fixe it for myself

  • Hey Your mod is exactly what I need, I want to disable all money trade, but I have this error:


    Code
    Lavax-BarterTradesMod activated!
    ReferenceError: dollars is not defined
        at removeMoneyTrades (C:\Jeux\SPT 3.6.1\user\mods\z-Lavax-BarterTrades\src\mod.js:216:28)
        at Mod.postDBLoad (C:\Jeux\SPT 3.6.1\user\mods\z-Lavax-BarterTrades\src\mod.js:20:21)
        at PostDBModLoader.executeMods (C:\snapshot\project\obj\loaders\PostDBModLoader.js)
        at PostDBModLoader.onLoad (C:\snapshot\project\obj\loaders\PostDBModLoader.js)
        at App.load (C:\snapshot\project\obj\utils\App.js)


    Replace Money trade works well.

    • Ah sorry, I fixed the error and uploaded it again.

    • The man, you are a legend ! I can't wait to start my new Hardcore account

    • Again this error


      Code
      Lavax-BarterTradesMod activated!
      ReferenceError: dollars is not defined
          at removeMoneyTrades (C:\Jeux\SPT 3.6.1\user\mods\z-Lavax-BarterTrades\src\mod.js:218:28)
          at Mod.postDBLoad (C:\Jeux\SPT 3.6.1\user\mods\z-Lavax-BarterTrades\src\mod.js:20:21)
          at PostDBModLoader.executeMods (C:\snapshot\project\obj\loaders\PostDBModLoader.js)
          at PostDBModLoader.onLoad (C:\snapshot\project\obj\loaders\PostDBModLoader.js)
          at App.load (C:\snapshot\project\obj\utils\App.js)
    • I really want to make it work, but it's not very cooperative

      Do you think it's a conflict ?

      Everything works, exept for Kawaii custom trader and tupitsa from DRIP

      Code
      Lavax-BarterTradesMod activated!
      TypeError: Cannot read properties of undefined (reading '_id')
          at removeMoneyTrades (C:\Jeux\SPT 3.6.1\user\mods\z-Lavax-BarterTrades\src\mod.js:244:34)
          at Mod.postDBLoad (C:\Jeux\SPT 3.6.1\user\mods\z-Lavax-BarterTrades\src\mod.js:23:21)
          at PostDBModLoader.executeMods (C:\snapshot\project\obj\loaders\PostDBModLoader.js)
          at PostDBModLoader.onLoad (C:\snapshot\project\obj\loaders\PostDBModLoader.js)
          at App.load (C:\snapshot\project\obj\utils\App.js)
    • I use DRIP with the convert mode and it works (except for the async added hats).

      Will test it with the remove mode.

      With the "reading _id" error it looks like an item from one of the mods was not added correctly.

      I assume its the Kawaii Trader

  • Is there any way you could have it generate trades that use 3-4 different items?

    Alternatively, a config option that multiplies barter strength (i.e. barter strength 2 would double the value of barter items, making things "cheaper")?
    Alternative 2: let certain barter items have higher strength with certain traders, i.e. mechanic values tech items 3x more, etc.
    Alternative 3: let some "bulky" items be worth more based on size/weight, so tank batteries, car batteries, fuel canisters, etc could have multipliers.

    Just asking because I've been playing with the config trying to get a reasonable trade for a junk box, and the best I can muster either requires a LEDX, or 8 AESA. Something like 1 tank battery per junkbox, or 2-3 car batteries and an AESA would be better imo.

    If not, that's cool, the mod's already great as it is. Being able to tweak things a bit deeper would be a treat, though!

    • I was thinking about a more sophisticated algorithm to find more random trades but it is not that easy. There are only a few expensive barter items.

      I dont want to have trades like 10+ Lions for a scav box.

      Maybe the multiplier is enough to make it more configurable.

    • Maybe adding a whitelist for barter items, and a multiplier that affects their value, could do the trick to make it very configurable, I think. If the whitelist + multiplier are limited to only affecting "big" 1,000,000+ value items, and all smaller barters are left as they already are, it would work nicely.


      A simple option would be to multiply the value of all rare tech items (VPX, MCB, RFIDR, MGT, etc) by some random number between 3 and 7. At the very least, it would increase the high-end barter pool substantially.


      (Also, I've noticed a bug with ammo trades. No matter what number I enter, the entire stack of barter ammo is deleted, rather than the chosen number being subtracted from the stack.)

    • I put in a multiplier.
      The scav junkbox trade looks better now.

      But everyone can tweak it to the preferred value.


      For the ammo trade, no idea how to fix this.

    • You rock!

      Also, the ammo thing isn't really a problem. It just means I have to occasionally count numbers. My caveman brain should be able to handle it without overheating. :thumbup:

  • have a trade with Prapor where one 7.62x54 LPS round can be purchased with two LPS Rounds.

    • SCAM! :D


      I will add a check to prevent that

  • I like this mod alot. Give what i want to play hardcore.

    Also i looked at one ammo trade and the barter was a m67 grenade but the icon of the grenade is a "question mark" and one ammo type 9x18 PM P is sold in rubbles

    • The PM P ammo is the cheapest, so there is nothing to trade in for.

      It is such an unimportant ammo that I did not bother to make an exception for it.

  • Is this compatible with softcore? Resulting in both flea and traders that only do barters?

    And if so, doesn't that mean money becomes pretty useless?

    • Yes it compatible.

      Money is less valuable, thats true, but you still need it for hideout, repairs, insurance

  • Fantastic mod that, in conjunction with some others, has replaced the Hardcore Rules mod for me.

    That being said, it would be fantastic to have some more config options like blacklisting specific traders from being affected or having more control over what gets generated as a trade. For example, blacklisting LEDXs from being included or preventing any individual item over x value being included in the barter.

    • I added some config options.


      Exluding LEDX or other high value items results in some crazy trades like 8 PGW for a SCAV Box

  • i love this mod

  • Is it possible to have the barters update on the trader timer and have an option to adjust the timers by a relative percentage? I’d like to use this but have the barter deals stick around for a while.

    • If they have to persist between server restarts, it would be necessary to write the trades to a file.

      And I do not know how to trigger a method when the restock timer hits.


      Isnt a restock always triggered at a server restart?

  • What's the difference between this and SoftCore's barter trading?

    • Softcore creates flea market entries for barter trades.

      But only for barter items, no ammo, modifications or weapons.


      This modifies the trader deals to be barter trades instead of money deals.

      Also the barters do not require FIR items

  • I've been hoping to see a mod like this eventually. Can't wait to give it a go. Fantastic!


    Edit: Just as a heads up, this mod seems to not like either Goblin King or Punisher mod (not sure which as they're interdependent, but taking them all out cleared the error). The console spits this out: TypeError: Cannot read properties of undefined (reading '_id')

    I have lots of other modded guns and armor, and they all seem to be working fine. The drum mags from Little Drummer Boy mod are still selling for roubles even though it's before your mod in the load order, but everything else is a barter now. Good stuff!

    • Hey thanks for the info.


      Do you have the line number in which this error is happening? Should be in the error message.


      I also have the DrummerBoy mod and it does not work because the trades are created async (async postDBLoadAsync) and they are not present at the time I do the conversion.

    • Here you go:


      TypeError: Cannot read properties of undefined (reading '_id')

      TypeError: Cannot read properties of undefined (reading '_id')

      at convertMoneyTradesToBarterTrades (G:\SPTAKI 3.6.0\user\mods\zzz-Lavax-BarterTrades\src\mod.js:85:59)

      at Mod.postDBLoad (G:\SPTAKI 3.6.0\user\mods\zzz-Lavax-BarterTrades\src\mod.js:23:17)

      at PostDBModLoader.executeMods (C:\snapshot\project\obj\loaders\PostDBModLoader.js)

      at PostDBModLoader.onLoad (C:\snapshot\project\obj\loaders\PostDBModLoader.js)

      at App.load (C:\snapshot\project\obj\utils\App.js)

      TypeError: Cannot read properties of undefined (reading '_id')

      TypeError: Cannot read properties of undefined (reading '_id')

      at convertMoneyTradesToBarterTrades (G:\SPTAKI 3.6.0\user\mods\zzz-Lavax-BarterTrades\src\mod.js:85:59)

      at Mod.postDBLoad (G:\SPTAKI 3.6.0\user\mods\zzz-Lavax-BarterTrades\src\mod.js:23:17)

      at PostDBModLoader.executeMods (C:\snapshot\project\obj\loaders\PostDBModLoader.js)

      at PostDBModLoader.onLoad (C:\snapshot\project\obj\loaders\PostDBModLoader.js)

      at App.load (C:\snapshot\project\obj\utils\App.js)



      (The path says 3.6.0, but it's running 3.6.1. I just didn't bother renaming the folder.)

    • I added some checks to prevent this error but could not test it

    • Try loading the mod after Goblin King, Punisher, and drummer boy. Also reminder - all the prices of Goblin's items can be made into barters via his config. Let me know if this helps.

    • It loads now, and runs just fine with Goblin King installed. The checks you added worked, thanks! The trades are still cash, so maybe it's the same case as Drummer Boy. Not a big deal.


      @rockahorse

      I have Barter Trades loading very last in the load order.
      I didn't see a setting for changing things to barters in the Goblin King config, and I didn't see info about it in the readme. Is it as simple as manually adding each cash item to the config and assigning a barter price?