A mod to make all items iridium quality.

KittyKatja

Newcomer
So, I posted about this in the mod updates thread, but didn't get any replies, so I figured I'd put it here and see if anyone was interested in helping me.

I've been a long-time user of the OnlyIridium mod, which has been marked as incompatible and no longer loads as of SMAPI update 4.0.8. The mod is not open source, and I haven't been able to get in touch with the mod author, so making an update is not really possible. However, there's another mod called Regular Quality that, among other things, does something very similar (alters the quality of every item that is put into your inventory). That mod IS open-source (source code is here), and the author has given permission to do whatever you want with their code, including using it to create new mods. I have no real coding or modding experience, but I think I've figured out what piece of code to copy and alter to create a mod to make all items iridium quality.

My first thought was to create such a mod myself, but unfortunately the integrated development environment suggested on the wiki says it doesn't work on my version of windows, and I can't actually update my windows version due to a BIOS issue. So, I was hoping that someone here could either recommend a suitable integrated development environment that runs on windows version 21H1 (build 19043.1466) OR that someone could cobble together an all iridium quality mod using the code from Regular Quality. I'm pretty sure the relevant code is this part:


/// <summary>Raised AFTER the player receives an item.</summary>
/// <param name="sender">The event sender.</param>
/// <param name="e">The event data.</param>
private void OnInventoryChanged(object sender, InventoryChangedEventArgs e)
{
// only update the inventory of the target player
if (!e.IsLocalPlayer) return;

IEnumerator<Item> enumerator = e.Added.GetEnumerator();
while (enumerator.MoveNext())
{
// not an item with a quality property, skip
if (!(enumerator.Current is StardewValley.Object item)) return;

// quality is already regular, nothing to do
// otherwise re-adding the item would "autosort" them to the first free slot when manually organizing the inventory
if (item.Quality == 0) return;

// remove quality
// because this happens only AFTER the item was added to the inventory,
// make a best effort to stack the item with an already existing stack
Game1.player.removeItemFromInventory(item);
item.Quality = 0;
Game1.player.addItemToInventory(item);
}
}


Where I figure one would have to change the "item.Quality == 0" parts to "item.Quality == 3" for Iridium quality. But again, no modding or coding experience, so there might be more to it than that...

Either way, would love some help, and if you make a mod using this code, be sure to credit JustToDownloadThings for it.
 

KittyKatja

Newcomer
Just wanted to make a quick update on this. There's a new mod called Easy Upgrade that has settings that allow it to do everything the old OnlyIridium mod did, so I consider this matter closed.
 

stardew_luv

Sodbuster
CBJ Item Spawner allows you to spawn any item in any quality, Iridium included. Things you didn’t know could be improved, like the stats on magic rock candy are in iridium quality. It’s fun,
 
Top