mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2025-12-18 23:40:30 +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;
|
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]
|
[PublicAPI]
|
||||||
public async Task<bool> RemoveFriend(ulong steamID) {
|
public async Task<bool> RemoveFriend(ulong steamID) {
|
||||||
if ((steamID == 0) || !new SteamID(steamID).IsIndividualAccount) {
|
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) {
|
public async Task<EResult> RedeemPoints(uint definitionID, bool forced = false) {
|
||||||
ArgumentOutOfRangeException.ThrowIfZero(definitionID);
|
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) {
|
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) {
|
if (definition.point_cost > 0) {
|
||||||
return EResult.InvalidState;
|
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]
|
[PublicAPI]
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<Project>
|
<Project>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Version>6.2.2.0</Version>
|
<Version>6.2.2.1</Version>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
|
|||||||
Reference in New Issue
Block a user