Skip to content

Commit

Permalink
another day, another attempt at fixing it lol
Browse files Browse the repository at this point in the history
  • Loading branch information
BoSen29 committed Aug 6, 2023
1 parent 8848a39 commit 0cc1051
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ Note: the Overlay in Twitch needs to be configured to match the identity provide
Note: current implementation might experience issues when two streamers are in the same game, without equal stream-delay. Fix in progress.

## Changelog
1.1.4 - Another attempted fix at solving the issue of missing data from scoreboard. Now with forced exceptions @ 0.
1.1.3 - Fixed issues fetching Scoreboard-data during high-density mercenary spawning on west side.
25 changes: 20 additions & 5 deletions UnitTracker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ private void ConfigStreamDelay_SettingChanged(object sender, EventArgs e)
throw new NotImplementedException();
}

private bool fetchAndPostWaveStartedInfo()
private bool fetchAndPostWaveStartedInfo(bool force = false)
{
List<MythiumRecceived> mythium = new List<MythiumRecceived>();
try
Expand All @@ -109,6 +109,12 @@ private bool fetchAndPostWaveStartedInfo()

Dictionary<IntVector2, Scoreboard.ScoreboardGridData> data = Scoreboard.GetGridData(p);



if(data.Count < 1)
{
throw new Exception("Nope, no units for this bad boi");
}
Console.WriteLine("Found " + data.Count + "Entries... adding them to the list");
foreach (IntVector2 key in data.Keys)
{
Expand Down Expand Up @@ -140,8 +146,16 @@ private bool fetchAndPostWaveStartedInfo()
}
catch
{
Console.WriteLine("Error fetching scoreboard, reattempting next update.");
return false;

if (!force)
{
Console.WriteLine("Error fetching scoreboard, reattempting next update.");
return false;
}
else
{
Console.WriteLine("Error fetching data, but proceeding since the treshold is reached.");
}
}


Expand Down Expand Up @@ -212,14 +226,15 @@ public void Update()
if (this._shouldPost && (maxUnitsSeen > i || (WaveInfo.GetWaveInfo(this.waveNumber).AmountSpawned * this.lTDPlayers.FindAll(l => l.player < 5).Count) <= i))
{
// indicates that more than 75% of the wave has spawned, and that the number of creeps is decreasing or that mercs equal or greater than the entire wave has spawned.
if (this.retries > 3)
if (this.retries > 5)
{
fetchAndPostWaveStartedInfo(true);
maxUnitsSeen = 0;
this._waveSet = true;
this._shouldPost = true;
this.retries = 0;
}
if (fetchAndPostWaveStartedInfo())
if (fetchAndPostWaveStartedInfo(false))
{
maxUnitsSeen = 0;
this._waveSet = false;
Expand Down

0 comments on commit 0cc1051

Please sign in to comment.