FunkFrog / ShareSuite

Risk of Rain 2 Item, Money, & Equipment sharing mod build upon BepInEx
https://thunderstore.io/package/FunkFrog-and-Sipondo/ShareSuite/
GNU General Public License v3.0
39 stars 26 forks source link

Added option to randomize shared items #65

Closed Splamy closed 4 years ago

Splamy commented 4 years ago

This more or less implements #62; we wanted an option like this too so I went ahead to quickly implemented it.

I tried to follow your coding conventions as good as I can. If you think anything feels out of place or wrong, feel free to change it or contact me back (here or discord Splamy#0729)

The only thing I want to annotate maybe is this: https://github.com/FunkFrog/RoR2SharedItems/blob/382d2a32dd164df4e89ef633d7ba3c4b87bb9c32/ShareSuite/ItemSharingHooks.cs#L139-L140 If I understand the BlackList correctly it is there to prevent overpowered/global/team items to be given multiple times since the effects are added together in the world anyway. I skip this check in the randomized version since everybody gets an random item anyway. Theoretically such items can still be given multiple times with a single pickup but that would be the same as randomly getting it twice.

FunkFrog commented 4 years ago

@Splamy Thank you for the PR! I’ll take a look as soon as I can ❤️

Splamy commented 4 years ago

I've also appended a fix for the bug in #63. The call to PickupCatalog.GetPickupDef in IsValidItemPickup gives a PickupDef object back which may either contain an item (in itemIndex) or an equipment (in equipmentIndex). So it has to either call the ItemCatalog or EquipmentCatalog finder then. I've kept the else block commented out for now since I don't know if any checks are required for other options there. If you don't want this commit here I can also cut it and make a separate PR for that.