mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2025-12-16 06:20:34 +00:00
Fix rp command not working with badge upgrades
Of course volvo had to use different endpoint for that, it'd be too easy otherwise
This commit is contained in:
@@ -628,6 +628,36 @@ public sealed class ArchiHandler : ClientMsgHandler, IDisposable {
|
||||
return response.Result;
|
||||
}
|
||||
|
||||
[PublicAPI]
|
||||
public async Task<EResult> RedeemPointsForBadgeLevel(uint definitionID, byte levels = 1) {
|
||||
ArgumentOutOfRangeException.ThrowIfZero(definitionID);
|
||||
|
||||
if (Client == null) {
|
||||
throw new InvalidOperationException(nameof(Client));
|
||||
}
|
||||
|
||||
if (!Client.IsConnected) {
|
||||
return EResult.NoConnection;
|
||||
}
|
||||
|
||||
CLoyaltyRewards_RedeemPointsForBadgeLevel_Request request = new() {
|
||||
defid = definitionID,
|
||||
num_levels = levels
|
||||
};
|
||||
|
||||
SteamUnifiedMessages.ServiceMethodResponse<CLoyaltyRewards_RedeemPoints_Response> response;
|
||||
|
||||
try {
|
||||
response = await UnifiedLoyaltyRewards.RedeemPointsForBadgeLevel(request).ToLongRunningTask().ConfigureAwait(false);
|
||||
} catch (Exception e) {
|
||||
ArchiLogger.LogGenericWarningException(e);
|
||||
|
||||
return EResult.Timeout;
|
||||
}
|
||||
|
||||
return response.Result;
|
||||
}
|
||||
|
||||
[PublicAPI]
|
||||
public async Task<bool> RemoveFriend(ulong steamID) {
|
||||
if ((steamID == 0) || !new SteamID(steamID).IsIndividualAccount) {
|
||||
|
||||
@@ -354,23 +354,23 @@ public sealed class Actions : IAsyncDisposable, IDisposable {
|
||||
public async Task<EResult> RedeemPoints(uint definitionID, bool forced = false) {
|
||||
ArgumentOutOfRangeException.ThrowIfZero(definitionID);
|
||||
|
||||
Dictionary<uint, LoyaltyRewardDefinition>? definitions = await Bot.Actions.GetRewardItems(new HashSet<uint>(1) { definitionID }).ConfigureAwait(false);
|
||||
|
||||
if (definitions == null) {
|
||||
return EResult.Timeout;
|
||||
}
|
||||
|
||||
if (!definitions.TryGetValue(definitionID, out LoyaltyRewardDefinition? definition)) {
|
||||
return EResult.InvalidParam;
|
||||
}
|
||||
|
||||
if (!forced) {
|
||||
Dictionary<uint, LoyaltyRewardDefinition>? definitions = await Bot.Actions.GetRewardItems(new HashSet<uint>(1) { definitionID }).ConfigureAwait(false);
|
||||
|
||||
if (definitions == null) {
|
||||
return EResult.Timeout;
|
||||
}
|
||||
|
||||
if (!definitions.TryGetValue(definitionID, out LoyaltyRewardDefinition? definition)) {
|
||||
return EResult.InvalidParam;
|
||||
}
|
||||
|
||||
if (definition.point_cost > 0) {
|
||||
return EResult.InvalidState;
|
||||
}
|
||||
}
|
||||
|
||||
return await Bot.ArchiHandler.RedeemPoints(definitionID).ConfigureAwait(false);
|
||||
return definition.type == 2 ? await Bot.ArchiHandler.RedeemPointsForBadgeLevel(definitionID).ConfigureAwait(false) : await Bot.ArchiHandler.RedeemPoints(definitionID).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
[PublicAPI]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<Version>6.2.2.0</Version>
|
||||
<Version>6.2.2.1</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
|
||||
Reference in New Issue
Block a user