Open chromamods opened 4 years ago
Hi! I was messing up with the decompiled code too, and implemented it in another way.
I created an instance of public static Dictionary<string, int> equipmentLimits = new Dictionary<string, int>();
in Constants.cs
and filled it with values for every item from my config (like maxEmfs=5
, maxFlashlights=5
etc) with item names as keys.
Then I added following code to Awake()
method in InventoryItem.cs
:
int maxAmount;
if (Constants.equipmentLimits.TryGetValue(this.itemName, out maxAmount))
{
this.maxAmount = maxAmount;
}
I'm not really familiar with unity/.net, so it may be not the best solution, but it worked great for me.
Hi! I was messing up with the decompiled code too, and implemented it in another way.
I created an instance of
public static Dictionary<string, int> equipmentLimits = new Dictionary<string, int>();
inConstants.cs
and filled it with values for every item from my config (likemaxEmfs=5
,maxFlashlights=5
etc) with item names as keys. Then I added following code toAwake()
method inInventoryItem.cs
:int maxAmount; if (Constants.equipmentLimits.TryGetValue(this.itemName, out maxAmount)) { this.maxAmount = maxAmount; }
I'm not really familiar with unity/.net, so it may be not the best solution, but it worked great for me.
Out of curiosity, where did you find the list of all the item names in the game? Are they just names like "emf", "tripod", etc?
Out of curiosity, where did you find the list of all the item names in the game? Are they just names like "emf", "tripod", etc?
It took a little creativity :)
I replaced LocalisationSystem.GetLocalisedValue(this.items[i].localisedItemName),
with this.items[i].itemName
in InventoryManager::UpdateText.
Here they are: https://pastebin.com/rWWg9siw
Out of curiosity, where did you find the list of all the item names in the game? Are they just names like "emf", "tripod", etc?
It took a little creativity :) I replaced
LocalisationSystem.GetLocalisedValue(this.items[i].localisedItemName),
withthis.items[i].itemName
in InventoryManager::UpdateText. Here they are: https://pastebin.com/rWWg9siw
I actually was able to figure it out using Console.WriteLine(this.itemName); to output the item names as they were generated to the console log stored next to the saves. My solution seems to be working, however, for my solution, I decided to keep everything in the main dictionary as opposed to creating a new one for equipment changes (like you did).
Cheers! I'll give this a look
Hey Fisky, feel free to check out my fork. https://github.com/chromamods/phasmophobia-chroma-client Gonna be adding a bunch of stuff there as I work on it.
Thanks, I will. if you don't mind I'll probably merge your item stuff into v.104
Sure, though would appreciate you tossing my name in for credit. Would you like me to send you the actual code for it, and not the 'optimized' bs that dnSpy generated?
Actually even better if you could create a pull-request or something. Though I've never done one from a fork.
And yes, of course man. Credit where credit is due.
On source code -- not really a bid deal either way. It's going to end up as de-compiled code later anyway.
Might be easier if you just upload the Assembly-CSharp.dll directly, as my fork has a different file structure than yours. I'd hold off on it while I edit a few more things as right now, one of the features is currently bugged (default max items in the session, I think I set it visually and not as an actual item). I'm going to fix that, and if I can't, remove it, then i'll either submit the pull request or i'll just reply here or something.
Though with both these solutions, I can't get the items to actually spawn in game -- you can set the max value and it shows up in the UI, but the only thing that spawns is 2 EMF readers. Have you two run into this?
Yeah, actually. I think it's because although it IS setting the max amount of items that are ready to be spawned, it's not actually going through to spawn them. Perhaps something in LevelController.Awake() could do it? It's almost 3:30 AM here so i'll have to take a look at it in the morning, though if you want to add me on Discord to talk easier there, you're more than welcome to do so.
Chroma#1000
I'm thinking it's ItemSpawners -- which has a hard global limit.
Greetings,
This isn't really an issue report, but more of a bit of help/suggestion. I was poking around the Assembly-CSharp.dll file to try and find where items are handled. I found some interesting bits under InventoryItem.ChangeTotalAmountNetworked().
I made a change to it which should remove the limit. As for integration to your config file, since I do not know how you handled it, I didn't include the config for you.
https://pastebin.com/rHLfvi6A
I might disassemble your Assembly-CSharp.dll to see what you did for config and create a branch/reply here to share that code for a future implementation
Edit: Code looked bad, moved to pastebin Edit 2: Realized i messed up with the Mathf.Clamp function, still would adjust the max amount. Set it to 1000.