Skip to content

Commit

Permalink
minor fixes and installation instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
BoSen29 committed Aug 4, 2023
1 parent b24f44c commit dcf3a61
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build_release_tag.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: Logless Release
name: UnitTracker Release

on:
push:
tags:
- v*

env:
LIB_NAME: Logless
LIB_NAME: UnitTracker

jobs:
build-and-release:
Expand Down
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,18 @@
Forked from LogLess https://github.com/LegionTD2-Modding/Logless

Tracks the builds ingame, and posts the data to a specified url with the specified JWT.
See /BepInEx/config for a .json configuration file.

## Installation (Instructions stolen from https://github.com/LegionTD2-Modding/NarrowMasterMinded/ )
- Close the game
- If not already done, follow this guide to install [BepInEx](https://github.com/LegionTD2-Modding/.github/wiki/Installation-of-BepInEx)
- Download the latest [release](https://github.com/BoSen29/UnitTracker/releases/latest), and drop `UnitTracker.dll` inside your `Legion TD 2/BepInEx/plugins/` folder
- You are done, you can start the game and enjoy!

## Configuration

DM @bosen29 on Discord for a juicy JWT to identify your requests, and install the overlay in your stream (currently invite only).
After first launching the game a configuration file will be created at `Legion TD 2/BepInEx/config/UnitTracker.cfg`, add the JWT to the config path, and optionally the stream-delay for your stream.

Note: the Overlay in Twitch needs to be configured to match the identity provided by BoSen. BoSen will provide this information along with the JWT upon inqueries.

Note: current implementation might experience issues when two streamers are in the same game, without equal stream-delay. Fix in progress.
20 changes: 17 additions & 3 deletions UnitTracker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ private void fetchAndPostWaveStartedInfo()
mythium.Add(new MythiumRecceived(Snapshot.PlayerProperties[p].MythiumReceivedPerWave[this.waveNumber], p));
}


if (this.waveNumber > -1)
{
int leftPercentage = 100;
Expand Down Expand Up @@ -177,7 +176,19 @@ public void Update()
{
if (this._waveSet)
{
double treshold = (WaveInfo.GetWaveInfo(this.waveNumber).AmountSpawned * this.lTDPlayers.FindAll(l => l.player < 5).Count / 1.7);
int total = 0;
try
{
total = Assets.States.Components.MercenaryIconHandler.GetMercenaryIconsReceived(1, this.waveNumber).Count;
total += Assets.States.Components.MercenaryIconHandler.GetMercenaryIconsReceived(2, this.waveNumber).Count;
total += Assets.States.Components.MercenaryIconHandler.GetMercenaryIconsReceived(3, this.waveNumber).Count;
total += Assets.States.Components.MercenaryIconHandler.GetMercenaryIconsReceived(4, this.waveNumber).Count;
}
catch
{
Console.WriteLine("Issues fetching the mercenaries recceived, skipping for now.");
}
double treshold = (WaveInfo.GetWaveInfo(this.waveNumber).AmountSpawned * this.lTDPlayers.FindAll(l => l.player < 5).Count + total / 1.5);
if (treshold < i)
{
maxUnitsSeen = i;
Expand All @@ -192,6 +203,7 @@ public void Update()
maxUnitsSeen = 0;
this._waveSet = false;
this._shouldPost = false;
}
};

Expand Down Expand Up @@ -240,7 +252,9 @@ public void Update()
List<PostGameStatsPlayerBuilds> data = new List<PostGameStatsPlayerBuilds>();
Dictionary<int, int> indexToPlayer = new Dictionary<int, int>();
int n = 0;
this.lTDPlayers.ForEach((p) =>
// pray that the playernames is in order... ?
this.lTDPlayers.OrderBy(o => o.player).ToList().ForEach((p) =>
{
indexToPlayer.Add(n, p.player);
n++;
Expand Down

0 comments on commit dcf3a61

Please sign in to comment.