tModLoader The Shop Market

MorningStar

Terrarian
The Shop Market is a mod that was created specifically for those large modpack runs with many town npcs. I was tired of running to each and every npc to see if they sold an item that I wanted. This mod takes every item that an npc sells and puts it into one place: The Shop Market. The market is accessed using The Trading Table, which can be purchased from the Travelling Merchant. He has a 33% chance to sell it when he appears. Your town npcs must NOT be homeless, or their items will not appear in the market.
Massive thanks to the TModLoader Discord server for their help and to jopojelly for letting me use some of his source code.

The main UI screen:
7NM9Crb.png

When the menu is brought up (by right clicking the tile) you will be able to see a wide array of information about the market.
The menu will show you your money, how much an item costs, and who sells it along with their name. Notice the slot where our defender medals are shown. This slot will show custom currency so if the item you want to buy has a custom currency, it will appear here if your character has any of that currency. The slot will appear empty if you are broke.

You can also search for items by their name, or by a word in their tooltip. You can even use the name or the career of the npc as a search method.
0x4aHLc.png
MHtZQxv.png

h7c8YG5.png

At the bottom of the menu we can search by category:
Hu0UmQU.png

Lastly, we have a buy amount field that we can enter a value into so we don't have to continuously spam click to get 999 green solution. The item price will also update depending on the value entered in the buy amount field. Leaving the field blank will assume a value of 1.
There is even a warning that displays if the amount you want to buy exceeds the max stack of said item so you don't end up spitting out 50,000 ice rods. The slots will also turn red if you cannot afford the item with the specified buy amount.
ibskuTP.png

This mod has a config so you can reset the buy amount each time an item is purchased and so you can have all text fields clear when the menu is closed.

IMPORTANT: Mods that add npcs with multiple shops will have only their "active" shop loaded into the market. You'll have to manually go over and change their shop. (i know it sucks but there isn't a way around that for now)
Mods that add custom currency SHOULD be supported. I've tested it with a couple mods and it has worked fine.

The download is on the mod browser. Texture for the Trading Table is a placeholder texture. Please let me know if you have any suggestions/bug reports, I'm terrible at balancing (and spriting).

Update History:
v1.0.3
Now compatible with Shop expander

v1.0.2
Some nice internal code cleanup
Now requires TModLoader v0.11.4
You can now sell items when the trading table is open using shift click
If you shift click an item you didn't want to sell, you can reclaim it by simply left clicking on it
 
Last edited:
This is simply brilliant man! Totally becoming what the above guy said: a permanent mod that I will always play with; like Boss Cursor and Magic Storage <3
Thanks a ton for making this! I always found trying to find the NPC in my mess of a base to be, well, a mess.
 
This is awesome!
I know a lot of mods add things to the Merchant, possibly overloading his regular shop, will this mod load everything he is *supposed* to be selling because of space limitations?
 
Is there a way to make it to where we can sell things using this mod?

Yes, I thought about it before the initial release but didn't put it in. I'll see what I can get together.

This is awesome!
I know a lot of mods add things to the Merchant, possibly overloading his regular shop, will this mod load everything he is *supposed* to be selling because of space limitations?

Not sure, I'll check it out.
 
Last edited:
New update:
v1.0.2
Some nice internal code cleanup
Now requires TModLoader v0.11.4
You can now sell items when the trading table is open using shift click
If you shift click an item you didn't want to sell, you can reclaim it by simply left clicking on it

Terraria Crashes as soon as I try to type in the NPC's name :(
qWBGpFX.png

qWBGpFX

I need to see the log file. Also, what did you type in?
 
Last edited:
I hope this is relevant bits, i grabbed everything mentioning the market at the end of that log right before i posted.

And it's done the same thing, once when I attempted to type "Trader" and the one i got the screen shot of is when I attempted to type "Merchant"
crashing as soon as I type the first letter.


Code:
[05:27:36] [1/WARN] [tML]: Silently Caught Exception:
System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at imkSushisMod.Items.imkSushisModGlobalNPCForCookies.SetupShop(Int32 type, Chest shop, Int32& nextSlot)
   at Terraria.ModLoader.NPCLoader.SetupShop(Int32 type, Chest shop, Int32& nextSlot)
   at Terraria.Chest.SetupShop(Int32 type)
   at OneStopNPCShop.TradingTableUI.LoadNPCShopItems(String initializer)
   at OneStopNPCShop.Tiles.TradingTableTile.RightClick(Int32 i, Int32 j)
   at Terraria.ModLoader.TileLoader.RightClick(Int32 i, Int32 j)
   at Terraria.Player.TileInteractionsUse(Int32 myX, Int32 myY)
   at Terraria.Player.TileInteractionsCheck(Int32 myX, Int32 myY)
   at Terraria.Player.LookForTileInteractions()
   at Terraria.Player.Update(Int32 i)
   at Terraria.Main.DoUpdate(GameTime gameTime)
   at Terraria.Main.Update(GameTime gameTime)
   at Microsoft.Xna.Framework.Game.Tick()
   at Microsoft.Xna.Framework.SDL2_FNAPlatform.RunLoop(Game game)
   at Microsoft.Xna.Framework.Game.Run()
   at Terraria.Program.LaunchGame_()
   at Terraria.Program.LaunchGame(String[] args, Boolean monoArgs)
   at Terraria.FNALaunch.Main(String[] args)

[05:28:04] [1/WARN] [tML]: Silently Caught Exception:
System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at imkSushisMod.Items.imkSushisModGlobalNPCForCookies.SetupShop(Int32 type, Chest shop, Int32& nextSlot)
   at Terraria.ModLoader.NPCLoader.SetupShop(Int32 type, Chest shop, Int32& nextSlot)
   at Terraria.Chest.SetupShop(Int32 type)
   at OneStopNPCShop.TradingTableUI.LoadNPCShopItems(String initializer)
   at OneStopNPCShop.NewUITextBox.DrawSelf(SpriteBatch spriteBatch)
   at Terraria.UI.UIElement.Draw(SpriteBatch spriteBatch)
   at Terraria.UI.UIElement.DrawChildren(SpriteBatch spriteBatch)
   at Terraria.UI.UIElement.Draw(SpriteBatch spriteBatch)
   at Terraria.UI.UIElement.DrawChildren(SpriteBatch spriteBatch)
   at Terraria.UI.UIElement.Draw(SpriteBatch spriteBatch)
   at Terraria.UI.UserInterface.Draw(SpriteBatch spriteBatch, GameTime time)
   at OneStopNPCShop.OneStopNPCShop.<ModifyInterfaceLayers>b__9_1()
   at Terraria.UI.LegacyGameInterfaceLayer.DrawSelf()
   at Terraria.UI.GameInterfaceLayer.Draw()
   at Terraria.Main.DrawInterface(GameTime gameTime)
   at Terraria.Main.DoDraw(GameTime gameTime)
   at Terraria.Main.Draw(GameTime gameTime)
   at Microsoft.Xna.Framework.Game.Tick()
   at Microsoft.Xna.Framework.SDL2_FNAPlatform.RunLoop(Game game)
   at Microsoft.Xna.Framework.Game.Run()
   at Terraria.Program.LaunchGame_()
   at Terraria.Program.LaunchGame(String[] args, Boolean monoArgs)
   at Terraria.FNALaunch.Main(String[] args)

[05:28:04] [1/WARN] [tML]: Silently Caught Exception:
System.InvalidOperationException: Begin has been called before calling End after the last call to Begin. Begin cannot be called again until End has been successfully called.
   at Microsoft.Xna.Framework.Graphics.SpriteBatch.Begin(SpriteSortMode sortMode, BlendState blendState, SamplerState samplerState, DepthStencilState depthStencilState, RasterizerState rasterizerState, Effect effect, Matrix transformationMatrix)
   at Terraria.Main.DoDraw(GameTime gameTime)
   at Terraria.Main.Draw(GameTime gameTime)
   at Microsoft.Xna.Framework.Game.Tick()
   at Microsoft.Xna.Framework.SDL2_FNAPlatform.RunLoop(Game game)
   at Microsoft.Xna.Framework.Game.Run()
   at Terraria.Program.LaunchGame_()
   at Terraria.Program.LaunchGame(String[] args, Boolean monoArgs)
   at Terraria.FNALaunch.Main(String[] args)

[05:28:04] [1/ERROR] [Terraria]: System.InvalidOperationException: Begin has been called before calling End after the last call to Begin. Begin cannot be called again until End has been successfully called.
   at Microsoft.Xna.Framework.Graphics.SpriteBatch.Begin(SpriteSortMode sortMode, BlendState blendState, SamplerState samplerState, DepthStencilState depthStencilState, RasterizerState rasterizerState, Effect effect, Matrix transformationMatrix)
   at Terraria.Main.DoDraw(GameTime gameTime)
   at Terraria.Main.Draw(GameTime gameTime)
[05:28:06] [1/FATAL] [Terraria]: Main engine crash
System.InvalidOperationException: Begin has been called before calling End after the last call to Begin. Begin cannot be called again until End has been successfully called.
   at Microsoft.Xna.Framework.Graphics.SpriteBatch.Begin(SpriteSortMode sortMode, BlendState blendState, SamplerState samplerState, DepthStencilState depthStencilState, RasterizerState rasterizerState, Effect effect, Matrix transformationMatrix)
   at Terraria.Main.DoDraw(GameTime gameTime)
   at Terraria.Main.Draw(GameTime gameTime)
   at Microsoft.Xna.Framework.Game.Tick()
   at Microsoft.Xna.Framework.SDL2_FNAPlatform.RunLoop(Game game)
   at Microsoft.Xna.Framework.Game.Run()
   at Terraria.Program.LaunchGame_()
 
Last edited:
It looks like "imkSushisMod" is probably the cause of the error. It also looks like the merchant's shop (or whoever) might be overloaded. Unload it and see if you still get the error, there may be a compatibility issue. Did you update the shop market to the latest version? That may also help. Meanwhile i downloaded imkSushisMod on my end was unable to replicate the error. You could also try downloading shop expander. It's a mod that gives town npcs pages to their shop so they don't get overloaded. Not sure if my mod works with this though, I'll be testing.

Also if you could post the mod list in your enabled.json file I should be able better solve a possible issue.
 
Last edited:
Yeah i noticed imksushis mentioned a few times which i thought was weird.
And a big part of why i wanted this Shop Market mod was BECAUSE Merchant and Dryad and Mechanic have overloaded shops because of my modlist (if there was a way to disable them selling certain things I would do it that way, there's no reason for Dryad to sell boss summons when I have Fargo's Mod lol)
I'll get Shop Expander and hope it helps.


ANyway here's my ENabld.json

Code:
[
  "AAMod",
  "AccessorySwapper",
  "AFKPETS",
  "AlchemistNPC",
  "AlcNPCButGood",
  "AlexsAssortedArsenal",
  "Antiaris",
  "Antisocial",
  "ArmorHairDye",
  "ArmorSocial",
  "AssortedCrazyThings",
  "BaitTackle",
  "BaseMod",
  "BetterBoneWelder",
  "BetterPaint",
  "beumersMod",
  "BlockarozArmor",
  "Bluemagic",
  "Boombastic",
  "Bor",
  "BossChecklist",
  "BossLootPlus",
  "BottleReuse",
  "Boxinator",
  "BuilderPlus",
  "BuildPlanner",
  "CalamityDLC",
  "CalamityMod",
  "CalamityModMusic",
  "CalamityResummonWorkaround",
  "chadsfurni",
  "CheatExtensions",
  "CheatSheet",
  "CheezeMod",
  "ClamExtraMusic",
  "CombinedPotions",
  "Completion",
  "Consolaria",
  "CorruCrimNPCs",
  "CosmeticArmor",
  "CosmeticVariety",
  "CraftableMusicBoxCalamity",
  "Critters",
  "CrystiliumMod",
  "DamageOverTimeDebuffsMod",
  "DartExpansion",
  "DBZMOD",
  "DictionaryOfPrefixes",
  "Disarray",
  "dropyourweapon",
  "duplicator",
  "DyeEasy",
  "DyeHard",
  "EAMusic",
  "EasierBossLoot",
  "EchoesoftheAncients",
  "ElementalBoots",
  "ElementsAwoken",
  "EAMusic",
  "EndlessCrafting",
  "EnduriumMod",
  "EnemyAccessories",
  "EnemyMods",
  "Events",
  "ExpandedSentries",
  "Expeditions",
  "ExpeditionsContent",
  "ExtensibleInventory",
  "ExtraGunGear",
  "Fargowiltas",
  "FargowiltasSouls",
  "Fernium",
  "FishandChips",
  "Fishing3",
  "FishingCrateAdditions",
  "FishingPlus",
  "FishingRewardRecipes",
  "FishofDreams",
  "FKBossHealthBar",
  "FluidLibrary",
  "FreshStart",
  "FullHealthRespawn",
  "FunctionalVanityAccessories",
  "GabeHasWonsMod",
  "GadgetBox",
  "GadgetGalore",
  "GemSet",
  "Gensokyo",
  "GoldensMisc",
  "GRealm",
  "Gunmod",
  "HamstarHelpers",
  "HelpfulNPCs",
  "HEROsMod",
  "HMPlus",
  "HuntingExpedition",
  "imkSushisDeathCountersMod",
  "imkSushisMod",
  "imkSushisModOldRecipesEnabler",
  "imkSushisNaturallyOccuringMoonsMod",
  "Infinity",
  "Intrinsics",
  "ItemCustomizer",
  "JMP",
  "JoostMod",
  "JPANsBagsOfHoldingMod",
  "Laugicality",
  "LightPets",
  "LithosArmory",
  "LootBags",
  "lootforall",
  "Luiafk",
  "MagicalThings",
  "MagicStorage",
  "MaskShop",
  "MaterialTraderNpc",
  "MaxStackPlus",
  "MechTransfer",
  "MinerNPC",
  "MinibossExpansion",
  "MiniBossNPC",
  "MiningLantern",
  "MinionCrits",
  "ModernFirearms",
  "MoreAccessories",
  "MoreAccessoriesTest",
  "MoreBiomeFishingCrates",
  "MoreChestLoot",
  "MoreCostumes",
  "MorePotions",
  "Mystic_Lands",
  "NecessaryAddons",
  "Necessories",
  "NEF",
  "NeoNGhost",
  "NewTerraWingsMod",
  "niceblocks",
  "NormalGelForMolotov",
  "Ocram",
  "OldSchoolRuneScape",
  "OneStopNPCShop",
  "OreSeeds",
  "Osmium",
  "PaladinArmorMod",
  "pinkymod",
  "PlatformHelper",
  "PrefixesPlus",
  "PufferfishMod",
  "Pumpking",
  "QLS_Updated",
  "QualityOfLifeRecipes",
  "RecipeBrowser",
  "Redemption",
  "ReducedRespawnTimer",
  "ReforgeArmor",
  "RegenFromBosses",
  "Rewards",
  "SacredTools",
  "SecretDyes",
  "Sh0gunMod",
  "ShaderLib",
  "Shapeshifter",
  "ShieldMod",
  "ShorterRespawn",
  "ShotgunExtensions",
  "SimpleAutoChests",
  "SolutionsMod",
  "SpectreHoodMod",
  "SpiritMod",
  "Split",
  "StatueMobsGiveDrops",
  "StatueNpc",
  "Statues",
  "StopDying",
  "SummonersAssociation",
  "SummonPack",
  "Tacklebox",
  "Thaumaturgy",
  "TheLuggage",
  "TheMetroidMod",
  "TheOneLibrary",
  "ThoriumMod",
  "TPUnchained",
  "TreeCutTime",
  "Tremor",
  "TrueEater",
  "UniverseOfBows",
  "UniverseOfSwordsMod",
  "UniverseOfWorms",
  "UnuBattleRods",
  "Upgradeable_Pickaxes",
  "UpgradedAccessories",
  "VeinMiner",
  "VipixToolBox",
  "W1KModRedux",
  "wcultnpc",
  "WeaponOut",
  "WeaponPlus",
  "WeaponsOfMassDecoration",
  "WheresMyItems",
  "Wildlife",
  "WingSlot",
  "Wireless",
  "WMITF",
  "WolfsAdditions",
  "WoodArmorBonuses",
  "Wormholes",
  "XItemStats",
  "YoshisIslandMod",
  "Yoyos2",
  "ZM",
  "ZoaklenMod"
]

EDIT: Ok I got Shop Extender and it works like an absolute miracle! Thank you for telling me about that!
 
Last edited:
I was honestly afraid to try it after seeing Shop Extender in action. :(
I'll check it out when I get home in the morning and post my findings.
 
Hello @MorningStar

I was happily finding this mod. Unfortunately I tried it and the Travelling Merchant has not offered me the item in more than 20 consecutive appearances. I know that it has been installed because recipe browser shows it in the item tab. I ever deleted it and reinstalled but but the Travel Merch still doesn't offer it to me.

Do you want me to provide some specific information? I don't know what else to say in helping you
 
Hello @MorningStar

I was happily finding this mod. Unfortunately I tried it and the Travelling Merchant has not offered me the item in more than 20 consecutive appearances. I know that it has been installed because recipe browser shows it in the item tab. I ever deleted it and reinstalled but but the Travel Merch still doesn't offer it to me.

Do you want me to provide some specific information? I don't know what else to say in helping you
it's a small chance that it appear, but it will appear eventually (it's a 33% chance that it will appear). Patience is the key here (it took me a while before I get it, RNG is alway against me).
 
Update v1.0.3:
Now compatible with shop expander

I did not have enough time to thoroughly test this compatibility, keep an eye out for any possible bugs that may occur.

If anything game breaking does occur, just disable shop expander for the time being until I can roll out a fix.
 
Last edited:
Hello. I use this mod, but unfortunately, it stopped working when 0.11.5 update hit. The mod loads, but the UI doesn't display items at all, and searching them crashes.
 
Hello. I use this mod, but unfortunately, it stopped working when 0.11.5 update hit. The mod loads, but the UI doesn't display items at all, and searching them crashes.

I have fixed this issue in the latest release. Just waiting for the mod browser to come back online and I will push the update.
 
Back
Top Bottom