Algorithmic Barter Randomizer 1.4.0

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.

Randomize vanilla barters. Optionally randomizes after every raid/trader reset! Customizable seed for replayability! Share your seed/difficulty to get the same outcome with friends!

What this mod changes:

  • Randomizes all trader "barter" items

    The algorithm basically looks at the costs for the target item, and then randomly chooses items that are near to the same cost for the trade.

    In general, trades should be more sensical and require fewer items.
  • Configurable difficulty
  • Configurable seed, let no two play throughs feel the same!
  • Randomize barters after every raid/trader reset by setting the seed to 0 (zero)!
  • Share your favourite seed/difficulty multiplier with friends to have the same experience as them!

Compatibility:

  • PUT this AFTER ALGORITHMIC LEVEL PROGRESSION in the order.json load order!!!
  • Should be compatible with almost everything :/
  • There is a config option to support custom traders as well!

If you're really digging the mod, consider supporting my caffeine addiction ☕8):


Buy Me a Coffee at ko-fi.com



=== INSTALL STEPS ===


1. Drag and drop this folder into the user/mods folder.

2. Update your mods/order.json so that this is last on the list.

(this is likely only needed if you have custom quests you would like included)

3. Optionally change your configuration (see below configuration options).


4. ???????


5. Profit!!!!



Example order.json:

{

"order": [

"ServerValueModifier",

"zPOOP",

"Lua-CustomSpawnPoints",

"DewardianDev-XXXX",

"DewardianDev-AlgorithmicLevelProgression"
"DewardianDev-AlgorithmicBarterRandomizer",

]

}



==== Configuration Options ====


{

// Turn on/off the mod
"enable": true,


//Change this to change the randomizer, share seeds and difficulty with friends to get the same outcome!
"seed": 2023,


// This is the DIFFICULTY setting. For cheaper barters (0.2) is lower, more expensive barters is higher (1.5)

"barterCostMultiplier": 0.7,


//Turn this on to figure out the correct custom trader name to add to the below "customTradersToInclude"
"printUnkownTraders": false,


// This is to add custom traders (Experimental: will be dependent on other modders db changes)
"customTradersToInclude": [
"SteveTheExampleGuyThatHasSalewas",
"BobJustExampleBob"
],


// Turn these on/off to enable barters of these types

"MedBarterItems": true,
"MeleeBarterItems": true,
"GrenadeBarterItems": true,


//Will print out the changes for each cash change barter
  "debugCashItems": false,


//Will print out the changes for each barter
"debug": false
}


  • Version 1.4.0

    Major Update


    • Removed Hardcore mode
      It's broken right now and I don't have time to fix it. ;(
    • Updated barters to be updated when traders reset and after each raid.
  • Version 1.3.0

    Minor Update


    • Updated to 3.7.0/3.7.1 (previous versions were broken)
    • Fixed an issue with setting certain trader values on hardcore not staying after raid end.
  • Version 1.2.0

    Major update

    • The algorithm now runs on game start, and after raids.
    • You can set the barters to randomize after every raid by setting:
      "seed": 0,
    • Added a new setting to hardcoreSettings that makes it so you can turn on/off magazine barters for cash barters:
      "excludeMagBarters": true


    That's all for now, have fun!
    :):thumbup:

  • Version 1.1.2

    Compatibility Optimization:

    • Should help with compatibility with mods that implement items incorrectly with the DB.
  • Version 1.1.1

    Config change:


    • Fixed a bug with cash barters and custom items.
    • "Difficulty" has been replaced by two new values:
      "barterCostMultiplier": 0.7,

      "cashBarterCostMultiplier": 0.5,

    These values multiply the base items (to be traded for's) prices to figure the rough cost of the total barter items.


    For example, if the item costs 100, and the multiplier is 0.5, the traded item value would be 50.


  • Version 1.1.0

    Complete rewrite:


    • Completely rewrote the mod, balance feels much closer to live barters.


    NOTE: the hardcore mode may present trades that when combined are unbalanced, this is a known side effect of the random nature of this mod.

  • Version 1.4.0

    Major Update


    • Removed Hardcore mode
      It's broken right now and I don't have time to fix it. ;(
    • Updated barters to be updated when traders reset and after each raid.
  • 1. Does this turn all offers into barters? or have an option to do so?

    2. Is it compatible with Deadleaves' "Barter economy" which does do that

    2A. - if so, load this or BE first?

  • Hi, does this work for 3.7.6 or need an update ?

  • Hi, nice mod, could you please add seed randomization on first launch? :?::saint::whistling::);)^^:thumbup::cursing::thumbdown::evil:8o<3:S8)8)8)

  • Exactly the mod I was looking for. Unlike QDkivish my question is the total opposite of his :)
    I'm personally not a big fan of the random item assignment. In my case (with default seed settings, i.e. 2023), I get a certain item assignment. After the first raid a lot of barters then have newly assigned items. As long as I keep the SPT server running it will stay like this. Once I restart the server, I get again the initial assignment.
    That behavior ends up in initially e.g. 1x Firesteel for an M4A1 at Peacekeeper, after the reassignment it's 1x Meldonin injector.
    I'm currently using 1.3.0 (last version with hardcore mode). I guess when you deactivated the hc mode in latest 1.4.0 (because of being broken) it was most likely because much cheaper items are assigned for an expensive barter - and not because of that random assignment I explained above. Please correct me if I'm wrong.

    You wrote that you're currently busy with other stuff. So my question would be, could you please tell me, what I need to adjust/comment out (in the code) so I deactivate that randomizer? The behavior I'm looking for is always the same barters - no matter of raid-to-raid or server restart.

    I tried to use the version before the randomizer was integrated, i.e. 1.1.2 (which according to the package.json should work with 3.x.x), but if I use it with 3.7.1 I get a loading error at the server window.


    Would be great if you can give me a hint, what I need to adjust. Thanks a lot in advance.

    • Hiya, I'm looking for the same behaviour! Have you been able to make any progress on this?

    • Yeah, I adjusted parts of the mod. Now I have always constant items, even after server restart. Furthermore I found an awesome seed number so the super high tier items (like e.g. THICC Item container) still require rare spawn things like e.g. ledx.

      If you're at the Discord channel, search and pm me via the name IBlackMambaI so I can show you what I adjusted.

  • So I need to update this mod a bit, it's not in a good place right now.
    If you want to use it feel free, but I have to add the code to the refresh trader hook and just can't be bothered at the moment.

  • Some containers are not randomized using seed 0. Is this intended?

    • The most expensive trades may have less chance (per seed) of being different.
      This is known.

  • Just a notice to others using Realism this mod it seems to be incompatible with the realism's trader changes as it resets to the original barters after restocking.

    • Not related to realism it's a know issue I'm addressing

    • Great! Thank you so much for trying to fix it!

  • Noticed that with lower trader money requirements it will give peacekeeper 2 100k dollars (which is a lot more than it should be, oops!)

    • Oh lol. Derp, will fix

      Heart 1
    • Also going to look at the refresh mechanism and see if I can tie into that.

    • Just noticed that Dollars and Euros are turned into barters, not sure if this is intentional behaviour but on this seed a D battery = 1 Dollar. Bit difficult to gather alternative currency unless you grab it in raid instead.

    • Oh, that's not supposed to happen.

      Ugh.. this mod needs some love

      Heart 2
  • sorry for this strange question but is the debug/cashitem, setting relevant/important to turn on ? i dont really understand the reason of it.

    btw i dont use hardcore.

    • no, you can ignore those if not using hardcore.

      The only setting you may change if not using hardcore:


      seed,
      barterCostMultiplier,



      Read the documentation on the overview for what those do.


      Thumbs Up 1
  • I noticed that if traders refresh through time, they will sell everything for regular cash again. It will fix itself if you do a quick run. A fix I made for myself is just making the traders never refresh from time, which is fine since each raid randomizes their barters anyway.

    • Thanks for the callout, I'll look into it

  • Just wanted to say thanks for the mod - amazing for a scavenger no fleamarket playthrough!

  • Version 1.3.0

    Minor Update


    • Updated to 3.7.0/3.7.1 (previous versions were broken)
    • Fixed an issue with setting certain trader values on hardcore not staying after raid end.
    • The best news I could ever wake up to. Amazing!

  • I was hopeful this would work in 3.7.0, but it did not, unfortunately. Just letting people know.

    • Yup, I am aware.
      Working on getting my other mods up, this is last on the list of importance.

    • imho, one of the coolest mods on the site. Should be top prio. Nah mate, take your time. Love your mods.

      Heart 1
  • Any way to make this work with LPA? I've gotten it to work with every other custom trader mod I have minus LPA, when I add it to the list of custom traders to include I get


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

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

    at C:\Users\Niall\Desktop\spt\user\mods\DewardianDev-AlgorithmicBarterRandomizer\src\BarterChanger\GlobalValues.js:153:44

    at Array.forEach (<anonymous>)

    at C:\Users\Niall\Desktop\spt\user\mods\DewardianDev-AlgorithmicBarterRandomizer\src\BarterChanger\GlobalValues.js:147:34

    at Array.forEach (<anonymous>)

    at Function.updateBarters (C:\Users\Niall\Desktop\spt\user\mods\DewardianDev-AlgorithmicBarterRandomizer\src\BarterChanger\GlobalValues.js:115:30)

    at Object.action (C:\Users\Niall\Desktop\spt\user\mods\DewardianDev-AlgorithmicBarterRandomizer\src\BarterChanger\BarterChanger.js:10:45)

    at StaticRouterMod.handleStatic (C:\snapshot\project\obj\di\Router.js)

    at HttpRouter.handleRoute (C:\snapshot\project\obj\routers\HttpRouter.js)

    at HttpRouter.getResponse (C:\snapshot\project\obj\routers\HttpRouter.js)

    at AkiHttpListener.getResponse (C:\snapshot\project\obj\servers\http\AkiHttpListener.js)

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

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

    at C:\Users\Niall\Desktop\spt\user\mods\DewardianDev-AlgorithmicBarterRandomizer\src\BarterChanger\GlobalValues.js:153:44

    at Array.forEach (<anonymous>)

    at C:\Users\Niall\Desktop\spt\user\mods\DewardianDev-AlgorithmicBarterRandomizer\src\BarterChanger\GlobalValues.js:147:34

    at Array.forEach (<anonymous>)

    at Function.updateBarters (C:\Users\Niall\Desktop\spt\user\mods\DewardianDev-AlgorithmicBarterRandomizer\src\BarterChanger\GlobalValues.js:115:30)

    at Object.action (C:\Users\Niall\Desktop\spt\user\mods\DewardianDev-AlgorithmicBarterRandomizer\src\BarterChanger\BarterChanger.js:10:45)

    at StaticRouterMod.handleStatic (C:\snapshot\project\obj\di\Router.js)

    at HttpRouter.handleRoute (C:\snapshot\project\obj\routers\HttpRouter.js)

    at HttpRouter.getResponse (C:\snapshot\project\obj\routers\HttpRouter.js)

    at AkiHttpListener.getResponse (C:\snapshot\project\obj\servers\http\AkiHttpListener.js)

    • That's an error due to incorrectly set costs in the db, ie an issue caused by there mod. Nothing I can do from this side.

  • I encountered a problem today, "reduceTraderLoyaltySpendRequirement" just stopped working after I installed MoreCheckmarks mod, I play on hardcore and had most tradest on lvl 2 already. Now the money spent requirements went back to normal values. I deleted all files from the Checmarks mods but SpentRequirements are still basic. What do I do?

    • The checkmarks mod shouldn't alter those values, did you change the load order? Or SVM values?


      That seems very strange indeed.

      You could try loading the game once without my mod and then turn it back on and see if that helps.


      (Turn it on and off again... Lol)

    • Tried turning it on and off with and without the mod files, nothing changes, my load order is empty, and it worked fine until now, could that be it?

    • Ok, I fixed the order so that it fits the description on the mod page. Still nothing, weird

    • Is there a way to lower the required "spent" values by hand? If yes then I'd like to try that

    • You might be able to do that with SVM.

  • Version 1.2.0

    Major update

    • The algorithm now runs on game start, and after raids.
    • You can set the barters to randomize after every raid by setting:
      "seed": 0,

    • Added a new setting to hardcoreSettings that makes it so you can turn on/off magazine barters for cash barters:
      "excludeMagBarters": true

    That's all for now, have fun!

    Heart 2
    • The randomized barter option after every raid works flawlessly.. fantastic update, appreciate you getting the kinks worked out.


      EDIT: They still seem to reset when trader inventory restocks, but that doesn't bother me personally.. it's predictable so you know what to expect and when to expect it. The rest of the time.. it's a surprise!

      Heart 1
    • I'll look into this hmmm

  • Would it be possible to randomize barters after each raid?

  • any option to also make it so ammo/mags require barters? im doing a hardcore playthrough and its quite fun to be forced to use whatever you can salvage instead of just buying a kit

    • I would need to add something like BOOBs (bullet box mod) to accomplish that.


      I can look into it but magazines for example I can easily switch on.


      Maybe I'll add a config option for those

    • Added magazines

  • Version 1.1.2

    Compatibility Optimization:

    • Should help with compatibility with mods that implement items incorrectly with the DB.
  • TypeError: Cannot read properties of undefined (reading '_props')

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

    at getPrice (D:\SPT-AKI 3.6.1\user\mods\zzzzzDewardianDev-AlgorithmicBarterRandomizer\src\BarterChanger\BarterChanger.js:57:24)

    at D:\SPT-AKI 3.6.1\user\mods\zzzzzDewardianDev-AlgorithmicBarterRandomizer\src\BarterChanger\BarterChanger.js:152:70

    at Array.forEach (<anonymous>)

    at D:\SPT-AKI 3.6.1\user\mods\zzzzzDewardianDev-AlgorithmicBarterRandomizer\src\BarterChanger\BarterChanger.js:146:30

    at Array.forEach (<anonymous>)

    at BarterChanger (D:\SPT-AKI 3.6.1\user\mods\zzzzzDewardianDev-AlgorithmicBarterRandomizer\src\BarterChanger\BarterChanger.js:114:26)

    at AlgorithmicBarterRandomizer.postAkiLoad (D:\SPT-AKI 3.6.1\user\mods\zzzzzDewardianDev-AlgorithmicBarterRandomizer\src\mod.js:10:61)

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

    at PostAkiModLoader.load (C:\snapshot\project\obj\loaders\PostAkiModLoader.js)

    at ModCallbacks.onLoad (C:\snapshot\project\obj\callbacks\ModCallbacks.js)

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

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

    at getPrice (D:\SPT-AKI 3.6.1\user\mods\zzzzzDewardianDev-AlgorithmicBarterRandomizer\src\BarterChanger\BarterChanger.js:57:24)

    at D:\SPT-AKI 3.6.1\user\mods\zzzzzDewardianDev-AlgorithmicBarterRandomizer\src\BarterChanger\BarterChanger.js:152:70

    at Array.forEach (<anonymous>)

    at D:\SPT-AKI 3.6.1\user\mods\zzzzzDewardianDev-AlgorithmicBarterRandomizer\src\BarterChanger\BarterChanger.js:146:30

    at Array.forEach (<anonymous>)

    at BarterChanger (D:\SPT-AKI 3.6.1\user\mods\zzzzzDewardianDev-AlgorithmicBarterRandomizer\src\BarterChanger\BarterChanger.js:114:26)

    at AlgorithmicBarterRandomizer.postAkiLoad (D:\SPT-AKI 3.6.1\user\mods\zzzzzDewardianDev-AlgorithmicBarterRandomizer\src\mod.js:10:61)

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

    at PostAkiModLoader.load (C:\snapshot\project\obj\loaders\PostAkiModLoader.js)

    at ModCallbacks.onLoad (C:\snapshot\project\obj\callbacks\ModCallbacks.js)

    • getting the above error when loading the server, i have made sure that this mod is after your level progression mod

      i have tried to reinstall with no changes to the config but it still errors
      i took this mod out and no issues loading server

    • Use the load order.json, not zzzzzzz.


      But this is likely a bad custom item.

      I'll take a look

    • thanks, i have not added any custom traders in the config for this mod, and i removed the mod that added the items from current live version (like Armor and guns etc) but still got the error

    • What's your mod list?

    • I use the new content mods/sain/swag and have no issues.

      OH!.. I bet you have a custom trader..

      I didn't test extensively with them yet.

      I'll test with priscillu.

  • Version 1.1.1

    Config change:


    • Fixed a bug with cash barters and custom items.
    • "Difficulty" has been replaced by two new values:
      "barterCostMultiplier": 0.7,

      "cashBarterCostMultiplier": 0.5,

    These values multiply the base items (to be traded for's) prices to figure the rough cost of the total barter items.


    For example, if the item costs 100, and the multiplier is 0.5, the traded item value would be 50.

  • Version 1.1.0

    Complete rewrite:


    • Completely rewrote the mod, balance feels much closer to live barters.

    NOTE: Hardcore mode may present trades that when combined are unbalanced, this is a known side effect of the random nature of this mod.

  • I Don't know why, but the hardcore mode doesn't work for me. I put true on enableHardcore, I get a message that changed 600 cash items, but in game only change old barter items. ;(


    Am i doing something wrong? i'm new to modding sp-tarkov.

    • Three things:

      • Look at the install instructions around load order.
      • Make sure your "cashItemCutoff": 10000, << Isn't too high
      • I am pushing an update tonight dramatically improving this mod.
  • Hey ummm
    Downloaded latest version. Open up Therapist and look at the barters. I can exchange 1 Car Medikit for.... 1 Car Medikit?
    Would be funny if it wasn't that I can exchange a 1/220 condition medikit for a perfectly new one!

    • Yeah, I've fixed the like for like trading already.

      I'm working on a new balance algorithm.


      The fundamental problem is that the prices on the flea for items is linked to trades/quests in game. So when you change all of the trades, those values are no longer correct.


      This makes appraising bartered items values incredibly complex.
      I'm attempting to graph the rarity of items chance of loot against its value now in some meaningful way.


      TLDR: getting alternate items for trades isn't hard. Pricing the value of items and their barters is.

  • still not happy with the balance.


    Working on some changes

  • Any chance we get something to randomize the hideout upgrade items?


    few notes after a start on hardcore medium

    -It's not converting prices well on the modded trader Priscilu, his fully kitted guns are bartering for things like a single hose or beef stew when they normally cost 100-500k

    -feel like it needs some kind of rarity check or price multiplier based on rarity tier, kappa items aren't that expensive but there's near zero chance of me ever finding 3 stuffed bears. also things like SG-C10, M-2 swords.


    still fun.

    • Working on balancing weapons/ammoboxes now. That should help things.
      I may scrap melee/med trades.

    • Hey! Since I have, going to push up another version quick, try it out and give me some feedback.

  • Version 1.0.1

    • Major Update:


      • Balance completely rewritten.
      • Should see much more "fair" barters in general.


      Leave feedback in the comments!


      Have fun! :):thumbup:
    • Ughh.. just realized the bullet cases/weapons aren't being handled correctly.

  • Okay so I think I need to work on balance a bit.
    Changes incoming.

    • Got it!!


      There were a number of things not being handled that needed a balance:


      - Some items aren't available on flea.. meaning they are actually worth a lot more than they are listed for in the db.

      - Cash items converted to trades were using the same algorithm as the original trade items, when in reality, those original trades are meant to limit the availability and feasibility of those items.. in practice this means that in hardcore mode there needs to be two tiers of barter difficulty for it to be fair.


      This has now been handled and I'm much happier with the new balance changes.


      Release tomorrow.

  • Can you add a setting where each trader will trade for things relating to them


    Example:

    Prapor - more russian themed items

    Therapist - Medical items + food

    Skier- whatever the fuck skier does

    peacekeeper - god blessed american goods

    mechanic - weapon stuff

    ragman - cloth materials / armor repair kits

    jeager - food / drinks / whatever else idk


    also are all the trades equivalent in value to the item in roubles?

    • No.


      More or less, balance is being worked on and it is random.


      :)