Skip to content

Commit

Permalink
- Fixed the accidental repeat of lotl
Browse files Browse the repository at this point in the history
  • Loading branch information
agilbert1412 committed Jan 8, 2025
1 parent 12b8fbf commit e6757cf
Showing 1 changed file with 16 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ internal class LivinOffTheLandInjections
private static Hint[] _myActiveHints;
private static List<string> _orderedTips;

private static uint _lastDayCheckedLotL;
private static int _currentEpisodeNumber;

public static void Initialize(ILogger logger, StardewArchipelagoClient archipelago)
{
_logger = logger;
Expand All @@ -29,6 +32,8 @@ public static void Initialize(ILogger logger, StardewArchipelagoClient archipela
var firstTip = ArchipelagoTips.First().Key;
_orderedTips = validTips.Shuffle(random);
_orderedTips.Insert(0, firstTip);
_lastDayCheckedLotL = 0;
_currentEpisodeNumber = 0;
}

// protected virtual string getTodaysTip()
Expand All @@ -44,14 +49,20 @@ public static bool GetTodaysTip_CustomLivinOffTheLand_Prefix(TV __instance, ref

_myActiveHints = _archipelago.GetMyActiveHints();

var episodeNumber = ModEntry.Instance.State.NumberOfLOTLEpisodesWatched;
var episode = _orderedTips[episodeNumber];
ModEntry.Instance.State.NumberOfLOTLEpisodesWatched += 1;

if (_lastDayCheckedLotL != Game1.stats.DaysPlayed)
{
_lastDayCheckedLotL = Game1.stats.DaysPlayed;
_currentEpisodeNumber = ModEntry.Instance.State.NumberOfLOTLEpisodesWatched;
ModEntry.Instance.State.NumberOfLOTLEpisodesWatched += 1;
}

var episode = _orderedTips[_currentEpisodeNumber % _orderedTips.Count];

while (episode.Contains("{0}") && !HasActiveHints())
{
episodeNumber = ModEntry.Instance.State.NumberOfLOTLEpisodesWatched;
episode = _orderedTips[episodeNumber];
_currentEpisodeNumber = ModEntry.Instance.State.NumberOfLOTLEpisodesWatched;
episode = _orderedTips[_currentEpisodeNumber % _orderedTips.Count];
ModEntry.Instance.State.NumberOfLOTLEpisodesWatched += 1;
}

Expand Down

0 comments on commit e6757cf

Please sign in to comment.