tModLoader Capitalism

Discussion in 'Released' started by hamstar, Dec 21, 2016.

  1. hamstar

    hamstar Steampunker

    [​IMG]
    Capitalism
    v1.4.2.3



    Note: Requires Mod Helpers


    This mod makes town NPCs stingy and adhere to the rule of supply & demand. As such, popular items will have their prices marked up. Also, don't let your vendor townsfolk die. Dying is expensive.

    If a tax collector is present, this price is further marked up by 2%.

    Config settings available in "My Documents/Terraria/ModLoader/Mod Configs/Capitalism Config.json".

    Source code available. API now available.


    Installation

    Requires tModLoader (0.10). Copy the above .tmod file to your 'Documents/My Games/Terraria/ModLoader/Mods' folder to play.


    Possible future additions
    • Selling items decreases their value (need to figure out how to implement this adequately).
    • Assorted favor or disfavor conditions for pricing.
    • Credit and loans! :merchantgrin:


    v1.4.2.3
    • Updated to MH v4.2.3.2 (with conventions)
    • Switched from snake case to camel case
    • Changed uses of WorldHelpers.GetUniqueIdWithSeed to GetUniqueId
    v1.4.2
    • Updated to Mod Helpers v2.0.2
    • Added MP player load bug failsafe
    v1.4.1
    • Added Mod.Call API
    • Added small bits of polish
    • Updated net code to use PacketProtocol
    • Possible fix for player issues
    • Set world ids to use new convention
    • Assorted internal freshness refactoring
    • Updated to HH v1.4.18
    v1.4.0.1
    • Added mod icon
    • Added support for Hamstar Helpers v1.2.0 issue report
    • Minor internal refactoring
    • Added API
    v1.3.3.3
    • Refactored internal code to newer standard
    v1.3.3
    • Updated for TML 0.10
    • Offloaded utility/helper code to Hamstar's Helpers mod (now a dependency)
    • Numerous fixes and tweaks
    v1.3.2.1
    • Added config setting 'Enabled' (allows disabling the mod instead of unloading it)
    • Added shop prices markup % indicators as item tooltips
    v1.3.1
    • (Minor?) logic correction for bulk purchase detection
    v1.3.0
    • New formula for item markup (b=base value, t=total purchases): b + ( (b * t)^0.8 ) / 50
    • Fixed semi-critical bulk purchases bug
    v1.2.2
    • Altered some default config values
    • Changed markup formula (b=base value, t=total purchases, s=total spendings):
      b + ( b * t * 0.02 * (0.996 ^ ((t/4) + (s/10000))) )
    v1.2.0
    • Updated config file location.
    • Cleaned up some code.
    • Smoothed out price markup decay for expensive items.
    • Added price markups for female townsfolk during a blood moon.
    • Added price reduction for lovestruck townsfolk of the opposite gender.
    • Added price markup for stinky players.
    v1.1.6
    • Fixed config reloading between game sessions.
    v1.1.5
    • Added failsafes.
    v1.1.2-4
    • Fixed multiplayer bug.
    v1.1.1
    • Modified the formula to the following (v=item's base value, t=total purchases):
      • v + (v * t * 0.1 * (0.996 ^ t))
    • More fixes.
    v1.0.8-9
    • Fixed possible crash.
    • Fixed item buybacks erroneously adding to item markup.
    v1.0.3-7
    • Fixed crashes.

    [​IMG]

     
    Last edited: Mar 7, 2019
  2. Le tromp du Jawa

    Le tromp du Jawa Eye of Cthulhu

    so it can only go up ? thats kinda bad
     
  3. hamstar

    hamstar Steampunker

    I added a decay factor per day, but if you're buying tons of a given type of item it won't help much. Let's just see how it works out for the amount it's currently at, for now.

    Also, fixed a (somewhat) major crash bug. Was a bit rushed to release this, but I think I'm back in control now.
     

    Attached Files:

    Le tromp du Jawa likes this.
  4. Le tromp du Jawa

    Le tromp du Jawa Eye of Cthulhu

    Ni
    Nice
     
  5. ZombieGenius

    ZombieGenius Skeletron Prime

    My goodness, these mods are awesome. Although, currently, a bit punishing.
     
  6. Le tromp du Jawa

    Le tromp du Jawa Eye of Cthulhu

    Your mod crashes the game

    Code:
    System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
       at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
       at Hamstar.Capitalism.VendorLogic.UpdateShop(Chest shop)
       at Hamstar.Capitalism.CapitalismPlayer.HookUpdateCurrentShop(Int32 type, Chest shop, Int32& nextSlot)
       at Hamstar.Capitalism.CapitalismNPC.SetupShop(Int32 type, Chest shop, Int32& nextSlot)
    System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
       at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
       at Hamstar.Capitalism.VendorLogic.UpdateShop(Chest shop)
       at Hamstar.Capitalism.CapitalismPlayer.HookUpdateCurrentShop(Int32 type, Chest shop, Int32& nextSlot)
       at Hamstar.Capitalism.CapitalismNPC.SetupShop(Int32 type, Chest shop, Int32& nextSlot)
    System.NullReferenceException: Object reference not set to an instance of an object.
       at Hamstar.Capitalism.CapitalismLogic.SaveVendors(TagCompound tags)
       at Hamstar.Capitalism.CapitalismPlayer.Save()
     
  7. ZombieGenius

    ZombieGenius Skeletron Prime

    I may not be a mod creator, but you should:
    1.) Say which mods you have.
    2.) Say when it crashed.
    3.) Put the crash report in a spoiler.
    This makes it more organized, easier to analyze and cleans up the page.
     
    000 and Lunatic Lobbyist like this.
  8. hamstar

    hamstar Steampunker

    What version of the mod? I believe I just recently fixed this very issue. I'm a bit surprised and confused to see it pop up again.
     
    Last edited: Dec 23, 2016
  9. Le tromp du Jawa

    Le tromp du Jawa Eye of Cthulhu

    latest version , and zombie it's not a mod conflict but a mod issue
     
  10. hamstar

    hamstar Steampunker

    This should fix the issue:
     

    Attached Files:

  11. tabookodak5

    tabookodak5 Terrarian

    Object reference not set to an instance of an object.
    at Capitalism.CapitalismPlayer.Load(TagCompound tag)
    at Terraria.ModLoader.IO.PlayerIO.LoadModData(Player player, IList`1 list)
     
  12. Iara

    Iara Official Terrarian

    Another amazing mod by yourself.

    Wanna knwo something? Before meeting you, I was agaisnt modding in Terraria, because most people do unbalanced trashy mods, or mods that just "look awesome" but don't "feel awesome" (Cough Thorium cough).

    I will give this mod a try. The only mod of yours that I haven't tried is wormholes, because I think that does more good to me than harm, lol.
     
  13. Le tromp du Jawa

    Le tromp du Jawa Eye of Cthulhu

    why your bashing mod devs
     
    Iara likes this.
  14. hamstar

    hamstar Steampunker

    Wormholes is more a convenience mod than a difficulty alleviating one. It's designed to shave off a big chunk of the usual back and forth traveling, but without completely eliminating the need for map traversing and adventure (especially to not encroach on the roles of teleporters, rails, asphalt roads, etc.).
     
    Last edited: Dec 25, 2016
    Iara likes this.
  15. Iara

    Iara Official Terrarian

    Not bashing. Just giving my opinion.
    I know that, in today's SJW culture that's not well looked at.

    I guess that's not just my cup of tea, but it could be grand for some people who want fun. Like a controllable Teleportation potion on the field.
    Anyway, a suggestion here: Don't you think you should make a megathread for all your mods? You have quite some good ones now.
    Also, explaining and expanding on them would help some people to understand more what they are about. There are lots of sellpoints you could mention about them.
     
    Lunatic Lobbyist likes this.
  16. Le tromp du Jawa

    Le tromp du Jawa Eye of Cthulhu

    What your starting with SJW for that is uncalled for and weak
     
    Iara likes this.
  17. Le tromp du Jawa

    Le tromp du Jawa Eye of Cthulhu

    idk man but when i download this mod from mod browser and reload i get : terraria has stopped working
     
  18. hamstar

    hamstar Steampunker

    Having installed the previous version might be to blame for this. I'll fix this soon.
     
  19. Le tromp du Jawa

    Le tromp du Jawa Eye of Cthulhu

    do i need to wipe my mod cache ..... i deleted the old json file
     
  20. hamstar

    hamstar Steampunker

    Let me know if this fixes it.
     

    Attached Files: