valheimPlus / ValheimPlus

A HarmonyX Mod aimed at improving the gameplay and quality of life of the game Valheim.
http://valheim.plus
GNU Affero General Public License v3.0
967 stars 236 forks source link

Adding LootDrop section with modifiers for loot amount and chance #772

Closed Grantapher closed 2 months ago

Grantapher commented 1 year ago

This adds a configuration which will change the amount of loot dropped by creatures/monsters when they are slain.

Grantapher commented 1 year ago

Related: #659

I'm not certain CharacterDrop.DropItems is the correct place to do this. Ragdoll may be better, but I did see there was issue taken in #175. I'm open to suggestions on this.

I couldn't attach dnSpy to debug, so I couldn't dive very deep into how Valheim drops items. I think the mono-2.0-bdwgc.dll may be out of date, or I made a mistake (from searching the discord, seems like other people have had issues with this recently as well).

It would be nice to break this down by category of creature/monster dropping the items, but I think in the meantime an overall drop modifier is good to have. Drop rate could also possibly be added, but I'm not sure the usefulness of that, nor where to start.

Grantapher commented 1 year ago

I ended up exporting the dnSpy assemblies to a visual studio solution and that made it much easier to trace usages of the code. With that, I found a better spot to inject changes to drop amount as well as the drop chance.

I don't see any good way to categorize creatures that aren't overly broad nor requiring a ton of configuration, so I left it as a global loot modifier.

Grantapher commented 1 year ago

One thing that I ran into with these changes (not sure 100% if related to loot drop or some other config), is that Oozers also "dropped" a multiplied amount of blobs when killed. I also have all Gathering and Pickables drop rates boosted, but it seems likely due to LootDrop. I'll have to test this some more.

Grantapher commented 1 year ago

Added to https://github.com/Grantapher/ValheimPlus/releases/tag/0.9.9.15-alpha6

The oozers dropping extra blobs issue is fixed there.