tModLoader Shop Expander

DRKV

Duke Fishron
Like I said before, Shop Expander only gives 40 slots to every ModNPC/GlobalNPC to work with by default, so that mods that actually rely on the length of the shop don't freak out. You can override this, by doing something like this in your main mod class:
Code:
using TheCheatNpc.NPCs;
...
class TheCheatNpc : Mod
{
...
     public override void PostSetupContent()
     {
          Mod shopExpander = ModLoader.GetMod("ShopExpander");
          if (shopExpander != null)
          {
                shopExpander.Call("SetProvisionSize", GetNPC<Kimi>(), 100);
          }
     }
...
}
Replace "100" with the expected maximum number of slots you'll need. You can find more examples here: DRKV333/ShopExpander
 

AquaticChaos

Terrarian
Actually, it's a bug caused by one of the items in AlchemistNPC, but the modder himself doesn't seem to even bother with that.

EDIT: Tested, and it works. You got yourself a new client.

By any means, do you recall what the AlchemistNPC item was? Having that same issue myself, but the next/previous buttons in the Fargo shops don't even appear.
 

ZY10086

Terrarian
The mod may have some problem with AlchemistNPC, an error occurred when I talk to the Alchemist.
Here is the log:
Code:
[18:20:46] [1/INFO] [ShopExpander]: --- SHOP EXPANDER ERROR ---
[18:20:46] [1/INFO] [ShopExpander]: Shop Expander failed to load ModNPC from mod AlchemistNPC.
[18:20:46] [1/INFO] [ShopExpander]: System.TypeLoadException: Could not load type 'CalamityMod.World.CalamityWorld' from assembly 'CalamityMod_0, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.
   at AlchemistNPC.NPCs.Alchemist.get_CalamityModDownedGuardian()
   at AlchemistNPC.NPCs.Alchemist.SetupShop(Chest shop, Int32& nextSlot) in AlchemistNPC\NPCs\Alchemist.cs:line 573
   at ShopExpander.Patches.SetupShopPatch.Prefix(Int32 type, Chest shop)
[18:20:46] [1/INFO] [ShopExpander]: --- END SHOP EXPANDER ERROR ---

[18:20:46] [1/INFO] [ShopExpander]: --- SHOP EXPANDER ERROR ---
[18:20:46] [1/INFO] [ShopExpander]: Shop Expander failed to load GlobalNPC from mod AlchemistNPC.
[18:20:46] [1/INFO] [ShopExpander]: System.TypeLoadException: Could not load type 'CalamityMod.World.CalamityWorld' from assembly 'CalamityMod_0, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.
   at AlchemistNPC.NPCs.ModGlobalNPC.get_CalamityModRevengeance()
   at AlchemistNPC.NPCs.ModGlobalNPC.SetupShop(Int32 type, Chest shop, Int32& nextSlot) in AlchemistNPC\NPCs\ModGlobalNPC.cs:line 236
   at ShopExpander.Patches.SetupShopPatch.Prefix(Int32 type, Chest shop)
[18:20:46] [1/INFO] [ShopExpander]: --- END SHOP EXPANDER ERROR ---
 

DRKV

Duke Fishron
The mod may have some problem with AlchemistNPC, an error occurred when I talk to the Alchemist.
Here is the log:
Code:
[18:20:46] [1/INFO] [ShopExpander]: --- SHOP EXPANDER ERROR ---
[18:20:46] [1/INFO] [ShopExpander]: Shop Expander failed to load ModNPC from mod AlchemistNPC.
[18:20:46] [1/INFO] [ShopExpander]: System.TypeLoadException: Could not load type 'CalamityMod.World.CalamityWorld' from assembly 'CalamityMod_0, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.
   at AlchemistNPC.NPCs.Alchemist.get_CalamityModDownedGuardian()
   at AlchemistNPC.NPCs.Alchemist.SetupShop(Chest shop, Int32& nextSlot) in AlchemistNPC\NPCs\Alchemist.cs:line 573
   at ShopExpander.Patches.SetupShopPatch.Prefix(Int32 type, Chest shop)
[18:20:46] [1/INFO] [ShopExpander]: --- END SHOP EXPANDER ERROR ---

[18:20:46] [1/INFO] [ShopExpander]: --- SHOP EXPANDER ERROR ---
[18:20:46] [1/INFO] [ShopExpander]: Shop Expander failed to load GlobalNPC from mod AlchemistNPC.
[18:20:46] [1/INFO] [ShopExpander]: System.TypeLoadException: Could not load type 'CalamityMod.World.CalamityWorld' from assembly 'CalamityMod_0, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.
   at AlchemistNPC.NPCs.ModGlobalNPC.get_CalamityModRevengeance()
   at AlchemistNPC.NPCs.ModGlobalNPC.SetupShop(Int32 type, Chest shop, Int32& nextSlot) in AlchemistNPC\NPCs\ModGlobalNPC.cs:line 236
   at ShopExpander.Patches.SetupShopPatch.Prefix(Int32 type, Chest shop)
[18:20:46] [1/INFO] [ShopExpander]: --- END SHOP EXPANDER ERROR ---
This is a problem with AlchemistNPC. It doesn't really have anything to do with Shop Expander. Looks like Calamity changed some stuff in an update again.
 

NebulaMagePlays

Official Terrarian
It appears Material Trader NPC and Fargo's Mutant Mod are causing issues. Some items won't be sold and I think that's due to multiple shops. Some items from Thorium cannot be sold and same for Calamity. I am not sure where I can find the full logs, because I literally looked at them but didn't see anything relating to the problem.
[doublepost=1565496504,1565496011][/doublepost]I am gonna disable the mods. Fargo's Mutant Mod and Material Trader NPC. Then I am gonna go into the world, and then re-enable them and see what happens.
 

DRKV

Duke Fishron
It appears Material Trader NPC and Fargo's Mutant Mod are causing issues. Some items won't be sold and I think that's due to multiple shops. Some items from Thorium cannot be sold and same for Calamity. I am not sure where I can find the full logs, because I literally looked at them but didn't see anything relating to the problem.
[doublepost=1565496504,1565496011][/doublepost]I am gonna disable the mods. Fargo's Mutant Mod and Material Trader NPC. Then I am gonna go into the world, and then re-enable them and see what happens.
That could happen if the same mod, in the same ModNPC class tries to add more than 40 items. Like I said before, unless the mod specifically tells Shop Expander to provide more space, those items will still get cut off. Though, I am planning to add a sort of failsafe to prevent that in the next version.
If these items were displayed correctly in previous versions, it's also possible that Thorium renamed them, but Gargo's/Material Trader are still looking for the old names.
 

DRKV

Duke Fishron
Hello! After tModLoader 0.11.5 happened, this mod stopped functioning properly. Please fix! Thank you.
Yeah, I was afraid this would happen, after I read the chagelog... I've already started work on a new version of this mod quite a while ago, but currently I don't have time to work on it, due to studies. But I'll finish it eventually.
 

Yvori

Terrarian
I hadn't noticed the mod not working... Odd.
That said, however, I did find a bug. It seems with Shop Expander enabled, the right-click-to-apply function of Box of Gadgets' Reforging Kits fails to happen. They don't get used, and the item you're holding the kits over when right-clicking isn't reforged. After a LOT of testing, I narrowed it down to specifically Shop Expander that was the issue. Not sure why, since I didn't have any shops open, but figured I'd mention it.
There's also a noticable "flicker" of the UI when shift-click selling items to vendors. Not sure if that one's an issue with Shop Expander or something else though.
 

DRKV

Duke Fishron
I hadn't noticed the mod not working... Odd.
Well, honestly I haven't tested it. I just know a lot of things have changed recently in TModLoader, that could potentially break my reflection. But it's possible it still works.

That said, however, I did find a bug. It seems with Shop Expander enabled, the right-click-to-apply function of Box of Gadgets' Reforging Kits fails to happen. They don't get used, and the item you're holding the kits over when right-clicking isn't reforged. After a LOT of testing, I narrowed it down to specifically Shop Expander that was the issue. Not sure why, since I didn't have any shops open, but figured I'd mention it.
That could be down to the fact that Shop Expander still uses Harmony for patching instead of tModLoader's Mono Mod. I'm pretty sure there's no built in hook for right clicking stuff into the inventory, so Box of Gadgets probably also uses a patch to do this. Then, when Shop Expander loads, Harmony overrides all the existing Mono Mod patches. I believe Mono Mod has some kind of compatibility mode, to make it work with Harmony, but that probably needs some extra setup. Anyways, migrating to Mono Mod is on my todo list.


There's also a noticable "flicker" of the UI when shift-click selling items to vendors. Not sure if that one's an issue with Shop Expander or something else though.
So, like, the whole UI just starts flickering? Yeah, I'm not sure about this one...
 

Yvori

Terrarian
Well, honestly I haven't tested it. I just know a lot of things have changed recently in TModLoader, that could potentially break my reflection. But it's possible it still works.

That could be down to the fact that Shop Expander still uses Harmony for patching instead of tModLoader's Mono Mod. I'm pretty sure there's no built in hook for right clicking stuff into the inventory, so Box of Gadgets probably also uses a patch to do this. Then, when Shop Expander loads, Harmony overrides all the existing Mono Mod patches. I believe Mono Mod has some kind of compatibility mode, to make it work with Harmony, but that probably needs some extra setup. Anyways, migrating to Mono Mod is on my todo list.

So, like, the whole UI just starts flickering? Yeah, I'm not sure about this one...
Thanks for the quick response!
But yeah I'd definitely get if stuff was breaking due to tModLoader updates, and the conflicting patches certainly explains why that wouldn't be working.
I actually should probably set up another instance to test more thoroughly, as I'm using the 64 bit unofficial branch of tModLoader, which could be affecting things (though so far it seemingly hasn't affected other mods) but... that'll wait for a bit I think, since setting up new Terraria instances is a bit slow.
The flicker isn't a big deal, it just disappears and instantly reappears each time an item is shift-click sold. Visually a bit annoying to see but it's not game-breaking or anything.
 

Waterghosteus

Terrarian
Do you think you could add a config to disable certain npcs from the list? the one I want to disable is the tavernkeep, because it is so messy with this mod where it all makes sense without it.
 

Fury

Lunatic Cultist
20200215030258_1.jpg


I get this error when accessing NPC inventories for the first time in a world after starting up. I reported it to the Survivaria team as well.
 

JustGuy

Terrarian
Every time? It should really only show up once per game startup. Could you also post the relevant parts of your log file?
Yes, sorry, once per game startup. I dont really know where is the error log, so the first thing i did is reporting it here.
Can you tell me where is that log?
Edit: I found a crashlog, but it doesnt seem to have any information about the ShopExpander mod.
[16.03.2020 14:23:33
System.InvalidOperationException: The operation is not allowed on non-connected sockets.
at System.Net.Sockets.TcpClient.GetStream()
at Terraria.Net.Sockets.TcpSocket.Terraria.Net.Sockets.ISocket.IsDataAvailable()
at Terraria.Netplay.InnerClientLoop()]
 
Last edited:

DRKV

Duke Fishron
Yes, sorry, once per game startup. I dont really know where is the error log, so the first thing i did is reporting it here.
Can you tell me where is that log?
Edit: I found a crashlog, but it doesnt seem to have any information about the ShopExpander mod.
[16.03.2020 14:23:33
System.InvalidOperationException: The operation is not allowed on non-connected sockets.
at System.Net.Sockets.TcpClient.GetStream()
at Terraria.Net.Sockets.TcpSocket.Terraria.Net.Sockets.ISocket.IsDataAvailable()
at Terraria.Netplay.InnerClientLoop()]
It in "Documents/My Games/Terraria/ModLoader/Logs". There should be an area labelled "--- BEGIN SHOP EXPANDER ERROR ---", or something like that. Pretty hard to miss. I'm almost positive this is actually a problem with the mentioned "Mini-Boss Mod". Maybe it's trying to load an item that doesn't exist. That's a pretty common issue, vanilla TModLoader doesn't really complain about it, but I added a message for this sort of things to Shop Expander.
 
Top Bottom