0 of 0

File information

Last updated

Original upload

Created by

BlackJack

Uploaded by

BlackJack69666

Virus scan

Safe to use

About this mod

Fixes a bug which occurs if your first betting win for the day is escargo.

Permissions and credits
This mod patches OnRaceWon using a harmony prefix to ensure all winner keys exist in the dictionary, which is skipped the first time you win with escargo. This prevents the bug occuring when you collect your prize.

Full details:

In the function OnRaceWon it iterates through the guesses and checks in order:
  • Was the guess correct
  • Is this the first winning bet on Escargo of the day for that player
  • Does the entry in the collection rewardsToCollect exist for this player (and if not creates it set to 0)
And then increments the rewards to collect and adds to the winning farmersImportantly, if the check for the first winning bet for Escargo succeeds, it will move onto the next guess skipping the creation of the entry in the rewardsToCollect collection.

Then, when you go to collect your race prize in the function CollectRacePrizes, it tries to get the value of the non-existent entry in the collection rewardsToCollect, which causes a crash without mods, or an error message to appear in the console on SMAPI and no rewards to be given.

In order for this bug to occur, the win with Escargo must be the first win of the day, otherwise the entry will already exist due to a prior win.
This mod fixes this by patching the OnRaceWon method to ensure the entry in rewardsToCollect exists for all winners.