Skip to content

Commit

Permalink
Replaced the automate button with individual buttons for `card farm…
Browse files Browse the repository at this point in the history
…ing` and `achievement unlocker`

Ensure current SGI user and current Steam user match in certain situation to prevent errors and confusion
Now shows details about the account used for `card farming` in `settings > card farming` when credentials are validated
Added a `Reset all` button to the `achievements > statistics` tab
Fixed an issue where some elements weren't being displayed on the `card farming` screen
Fixed an issue with the login background video
  • Loading branch information
zevnda committed Dec 23, 2024
1 parent 8e8e505 commit f914881
Show file tree
Hide file tree
Showing 75 changed files with 1,508 additions and 902 deletions.
20 changes: 8 additions & 12 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
[![Downloads](https://img.shields.io/github/downloads/zevnda/steam-game-idler/1.6.0-beta.2/total?style=for-the-badge&logo=github&color=137eb5)](https://github.com/zevnda/steam-game-idler/releases/download/1.6.0-beta.2/Steam.Game.Idler_1.6.0.2_x64_en-US.msi)
[![Downloads](https://img.shields.io/github/downloads/zevnda/steam-game-idler/1.6.0-beta.3/total?style=for-the-badge&logo=github&color=137eb5)](https://github.com/zevnda/steam-game-idler/releases/download/1.6.0-beta.3/Steam.Game.Idler_1.6.0.3_x64_en-US.msi)

> [!Important]
> ### This is a beta release
> Consider using the stable version unless you specifically want to test new features.
> Consider using the [stable version](https://github.com/zevnda/steam-game-idler/releases/latest) unless you specifically want to test new features.
> The `.msi` installer is not fully compressed, hence the large file size. This is expected for a beta release.
> This release will not receive automatic updates. If a newer beta version becomes available you will need to install it manually.
## Changelog
- New login screen and login method for getting account information
- If you have multiple accounts saved on the Steam desktop app, the login screen will now display each account for you to choose from
- Logging in no longer requires Steam to be running
- Logging in no longer adds a `Spacewars` game to your recently played games
- The `achievements` and `statistics` pages no longer lag/freeze while scrolling when there are a lot of achievements or statistics to display
- The search bar for the `games list` is now hidden when not viewing the `games list`
- The search bar for the `achievements list` has moved to the `title bar`
- Fixed an error when searching in the `achievements list`
- Fixed some major prop drilling issues
- Other miscellaneous UI styling
- Replaced the `automate` button with individual buttons for `card farming` and `achievement unlocker`
- Ensure current SGI user and current Steam user match in certain situation to prevent errors and confusion
- Now shows details about the account used for `card farming` in `settings > card farming` when credentials are validated
- Added a `Reset all` button to the `achievements > statistics` tab
- Fixed an issue where some elements weren't being displayed on the `card farming` screen
- Fixed an issue with the login background video
4 changes: 2 additions & 2 deletions latest.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"version": "1.6.0-2",
"version": "1.6.0-3",
"major": true,
"platforms": {
"windows-x86_64": {
"signature": "dW50cnVzdGVkIGNvbW1lbnQ6IHNpZ25hdHVyZSBmcm9tIHRhdXJpIHNlY3JldCBrZXkKUlVUSDh2NGF3cDBSMHF6TE1wUzZmQUNhOHphUFR2b29IMkU0WlBuZms2UHhBUXdyenZ0VS9lNGNpeC9BcTYxeFNsRjVSaFFyVXV3bHc5Qm5IeGE5YUlUQm5Bcy9ZbGVHRUFNPQp0cnVzdGVkIGNvbW1lbnQ6IHRpbWVzdGFtcDoxNzM0NTgwNzc1CWZpbGU6U3RlYW0gR2FtZSBJZGxlcl8xLjUuMzFfeDY0X2VuLVVTLm1zaS56aXAKNWk5ZHp5Y1dDMlQyMGZIWU16bHk1UW5IdkZmUGR3VjI3WWkrem5nQUtaNnVtSVlaSVBNUkNRRUJDanJ0L09icGtQUHFzVncxSjQ4VDU0Mm5rTFdaQWc9PQo=",
"url": "https://github.com/zevnda/steam-game-idler/releases/download/1.6.0-beta.2/Steam.Game.Idler_1.6.0.2_x64_en-US.msi.zip"
"url": "https://github.com/zevnda/steam-game-idler/releases/download/1.6.0-beta.3/Steam.Game.Idler_1.6.0.3_x64_en-US.msi.zip"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace SteamUtility.Commands
{
public class IdleCommand : ICommand
public class Idle : ICommand
{
public void Execute(string[] args)
{
Expand Down Expand Up @@ -39,12 +39,6 @@ public void Execute(string[] args)
// Initialize the Steam API
if (!SteamAPI.Init())
{
MessageBox.Show(
"Failed to initialize the Steam API. Is Steam running?",
"Error",
MessageBoxButtons.OK,
MessageBoxIcon.Error
);
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace SteamUtility.Commands
{
public class LockAchievementCommand : ICommand
public class LockAchievement : ICommand
{
static bool statsReceived = false;
static Callback<UserStatsReceived_t> statsReceivedCallback;
Expand Down Expand Up @@ -44,12 +44,7 @@ public void Execute(string[] args)
// Initialize the Steam API
if (!SteamAPI.Init())
{
MessageBox.Show(
"Failed to initialize the Steam API. Is Steam running?",
"Error",
MessageBoxButtons.OK,
MessageBoxIcon.Error
);
Console.WriteLine("error");
return;
}

Expand Down
151 changes: 151 additions & 0 deletions libs/steam-utility/Commands/ResetStats.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
using System;
using System.Threading;
using System.Windows.Forms;
using Steamworks;

namespace SteamUtility.Commands
{
public class ResetStats : ICommand
{
static bool statsReceived = false;
static Callback<UserStatsReceived_t> statsReceivedCallback;

public void Execute(string[] args)
{
if (args.Length < 2)
{
MessageBox.Show(
"Usage: SteamUtility.exe reset_stats <AppID>",
"Error",
MessageBoxButtons.OK,
MessageBoxIcon.Error
);
return;
}

// Validate the AppID
uint appId;
if (!uint.TryParse(args[1], out appId))
{
MessageBox.Show(
"Invalid AppID. Please provide a valid Steam App ID (e.g. 221100).",
"Error",
MessageBoxButtons.OK,
MessageBoxIcon.Error
);
return;
}

// Set the Steam App ID environment variable
Environment.SetEnvironmentVariable("SteamAppId", appId.ToString());

// Initialize the Steam API
if (!SteamAPI.Init())
{
Console.WriteLine("error");
return;
}

try
{
// Get the Steam user ID and create a callback for receiving user stats
CSteamID steamId = SteamUser.GetSteamID();
statsReceivedCallback = Callback<UserStatsReceived_t>.Create(OnUserStatsReceived);
// Request user stats from Steam
SteamAPICall_t apiCall = SteamUserStats.RequestUserStats(steamId);

// Check if the API call is valid
if (apiCall == SteamAPICall_t.Invalid)
{
MessageBox.Show(
"Failed to request stats from Steam.",
"Error",
MessageBoxButtons.OK,
MessageBoxIcon.Error
);
return;
}

// Wait for the stats to be received
DateTime startTime = DateTime.Now;
while (!statsReceived)
{
SteamAPI.RunCallbacks();
if ((DateTime.Now - startTime).TotalSeconds > 10)
{
MessageBox.Show(
"Timed out waiting for stats from Steam.",
"Error",
MessageBoxButtons.OK,
MessageBoxIcon.Error
);
return;
}
Thread.Sleep(100);
}

// Reset all stats
if (SteamUserStats.ResetAllStats(true))
{
if (SteamUserStats.StoreStats())
{
Console.WriteLine("All stats reset successfully.");
}
else
{
MessageBox.Show(
"Failed to store reset stats.",
"Error",
MessageBoxButtons.OK,
MessageBoxIcon.Error
);
}
}
else
{
MessageBox.Show(
"Failed to reset stats.",
"Error",
MessageBoxButtons.OK,
MessageBoxIcon.Error
);
}
}
catch (Exception ex)
{
MessageBox.Show(
$"An error occurred: {ex.Message}",
"Error",
MessageBoxButtons.OK,
MessageBoxIcon.Error
);
}
finally
{
// Shutdown the Steam API
SteamAPI.Shutdown();
}
}

// Callback method for when user stats are received
static void OnUserStatsReceived(UserStatsReceived_t pCallback)
{
if (pCallback.m_nGameID == SteamUtils.GetAppID().m_AppId)
{
if (pCallback.m_eResult == EResult.k_EResultOK)
{
statsReceived = true;
}
else
{
MessageBox.Show(
$"Failed to receive stats from Steam. Error code: {pCallback.m_eResult}",
"Error",
MessageBoxButtons.OK,
MessageBoxIcon.Error
);
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace SteamUtility.Commands
{
public class ToggleAchievementCommand : ICommand
public class ToggleAchievement : ICommand
{
static bool statsReceived = false;

Expand Down Expand Up @@ -46,12 +46,7 @@ public void Execute(string[] args)
// Initialize the Steam API
if (!SteamAPI.Init())
{
MessageBox.Show(
"Failed to initialize the Steam API. Is Steam running?",
"Error",
MessageBoxButtons.OK,
MessageBoxIcon.Error
);
Console.WriteLine("error");
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace SteamUtility.Commands
{
public class UnlockAchievementCommand : ICommand
public class UnlockAchievement : ICommand
{
static bool statsReceived = false;

Expand Down Expand Up @@ -46,12 +46,7 @@ public void Execute(string[] args)
// Initialize the Steam API
if (!SteamAPI.Init())
{
MessageBox.Show(
"Failed to initialize the Steam API. Is Steam running?",
"Error",
MessageBoxButtons.OK,
MessageBoxIcon.Error
);
Console.WriteLine("error");
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace SteamUtility.Commands
{
public class StatsCommand : ICommand
public class UpdateStats : ICommand
{
static bool statsReceived = false;
static Callback<UserStatsReceived_t> statsReceivedCallback;
Expand All @@ -15,7 +15,7 @@ public void Execute(string[] args)
if (args.Length < 3)
{
MessageBox.Show(
"Usage: SteamUtility.exe update_stat <AppID> <StatName> <NewValue>",
"Usage: SteamUtility.exe s <AppID> <StatName> <NewValue>",
"Error",
MessageBoxButtons.OK,
MessageBoxIcon.Error
Expand Down Expand Up @@ -45,12 +45,7 @@ public void Execute(string[] args)
// Initialize the Steam API
if (!SteamAPI.Init())
{
MessageBox.Show(
"Failed to initialize the Steam API. Is Steam running?",
"Error",
MessageBoxButtons.OK,
MessageBoxIcon.Error
);
Console.WriteLine("error");
return;
}

Expand Down
13 changes: 7 additions & 6 deletions libs/steam-utility/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ static class Program
static Dictionary<string, ICommand> commands = new Dictionary<string, ICommand>
{
{ "get_steam_users", new GetSteamUsers() },
{ "idle", new IdleCommand() },
{ "update_stat", new StatsCommand() },
{ "toggle_achievement", new ToggleAchievementCommand() },
{ "unlock_achievement", new UnlockAchievementCommand() },
{ "lock_achievement", new LockAchievementCommand() },
{ "idle", new Idle() },
{ "update_stats", new UpdateStats() },
{ "reset_stats", new ResetStats() },
{ "toggle_achievement", new ToggleAchievement() },
{ "unlock_achievement", new UnlockAchievement() },
{ "lock_achievement", new LockAchievement() },
};

static void Main(string[] args)
Expand Down Expand Up @@ -44,7 +45,7 @@ static void ShowUsage()
+ "Commands:\n"
+ " check_steam\n"
+ " idle <AppID> <true|false>\n"
+ " update_stat <AppID> <StatName> <NewValue>\n"
+ " update_stats <AppID> <StatName> <NewValue>\n"
+ " toggle_achievement <AppID> <AchievementID>\n"
+ " lock_achievement <AppID> <AchievementID>\n"
+ " unlock_achievement <AppID> <AchievementID>";
Expand Down
11 changes: 6 additions & 5 deletions libs/steam-utility/SteamUtility.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,13 @@
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Commands\ICommand.cs" />
<Compile Include="Commands\IdleCommand.cs" />
<Compile Include="Commands\StatsCommand.cs" />
<Compile Include="Commands\ToggleAchievementCommand.cs" />
<Compile Include="Commands\LockAchievementCommand.cs" />
<Compile Include="Commands\UnlockAchievementCommand.cs" />
<Compile Include="Commands\GetSteamUsers.cs" />
<Compile Include="Commands\Idle.cs" />
<Compile Include="Commands\UpdateStats.cs" />
<Compile Include="Commands\ResetStats.cs" />
<Compile Include="Commands\ToggleAchievement.cs" />
<Compile Include="Commands\LockAchievement.cs" />
<Compile Include="Commands\UnlockAchievement.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<!-- Embedded Resources -->
Expand Down
Binary file modified public/setup_bg.mp4
Binary file not shown.
Loading

0 comments on commit f914881

Please sign in to comment.