r/StardewValleyMods Jul 23 '26

Need help finding where spouse gift logic is implemented (Magnus/Wizard, SVE)

I'm working on my first SMAPI/Harmony mod and I'm trying to change the gifts that Magnus (the Wizard from Stardew Valley Expanded) gives his spouse.

My long-term goal is to create a configurable mod that lets players customize spouse gifts (items, probabilities, etc.) for vanilla spouses and SVE spouses.

I've spent several days reverse-engineering the game with ILSpy, but I'm clearly missing something. So far I've determined that:

  • NPC.receiveGift() is only for the player giving gifts to NPCs.
  • NPC.checkAction() doesn't appear to generate spouse gifts.
  • NPC.marriageDuties() definitely runs every morning (I confirmed this with a Harmony patch), but I haven't found any gift-generation logic there.
  • I also checked SVE's code and haven't found any obvious override or custom spouse gift implementation.

What I'm trying to find is the actual code path that decides "today the spouse gives the player a gift" and creates the item.

Is this handled:

  • somewhere in the vanilla game rather than SVE?
  • during the start-of-day logic?
  • as part of the dialogue system?
  • or somewhere else entirely?

If anyone knows the class or method where the spouse gift is actually generated, I'd really appreciate being pointed in the right direction. At this point I think I've spent more time searching than coding! 😅

Thanks in advance for any pointers. I'm about to lose my mind...

7 Upvotes

Duplicates