Help ArchiNet calculating previous asset IDs if possible

This commit is contained in:
Archi 2023-01-11 18:34:31 +01:00
parent 830fc982f7
commit 3cadcd16b4
No known key found for this signature in database
GPG key ID: 6B138B4C64555AEA
2 changed files with 18 additions and 5 deletions

View file

@ -4,7 +4,7 @@
// / ___ \ | | | (__ | | | || | ___) || |_| __/| (_| || | | | | || _|| (_| || | | | | | | |
// /_/ \_\|_| \___||_| |_||_||____/ \__|\___| \__,_||_| |_| |_||_| \__,_||_| |_| |_| |_|
// |
// Copyright 2015-2022 Łukasz "JustArchi" Domeradzki
// Copyright 2015-2023 Łukasz "JustArchi" Domeradzki
// Contact: JustArchi@JustArchi.net
// |
// Licensed under the Apache License, Version 2.0 (the "License");
@ -22,7 +22,6 @@
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using ArchiSteamFarm.Steam.Data;
using ArchiSteamFarm.Steam.Storage;
using JetBrains.Annotations;
@ -85,11 +84,21 @@ internal sealed class AnnouncementRequest {
}
uint index = 0;
ulong previousAssetID = 0;
Guid = guid;
SteamID = steamID;
TradeToken = tradeToken;
Inventory = inventory.Select(asset => new AssetForListing(asset, index++)).ToImmutableHashSet();
HashSet<AssetForListing> assetsForListing = new(inventory.Count);
foreach (Asset asset in inventory) {
assetsForListing.Add(new AssetForListing(asset, index++, previousAssetID));
previousAssetID = asset.AssetID;
}
Inventory = assetsForListing.ToImmutableHashSet();
MatchableTypes = matchableTypes.ToImmutableHashSet();
MatchEverything = matchEverything;
MaxTradeHoldDuration = maxTradeHoldDuration;

View file

@ -4,7 +4,7 @@
// / ___ \ | | | (__ | | | || | ___) || |_| __/| (_| || | | | | || _|| (_| || | | | | | | |
// /_/ \_\|_| \___||_| |_||_||____/ \__|\___| \__,_||_| |_| |_||_| \__,_||_| |_| |_| |_|
// |
// Copyright 2015-2022 Łukasz "JustArchi" Domeradzki
// Copyright 2015-2023 Łukasz "JustArchi" Domeradzki
// Contact: JustArchi@JustArchi.net
// |
// Licensed under the Apache License, Version 2.0 (the "License");
@ -29,9 +29,13 @@ internal sealed class AssetForListing : AssetInInventory {
[JsonProperty(Required = Required.Always)]
internal readonly uint Index;
internal AssetForListing(Asset asset, uint index) : base(asset) {
[JsonProperty(Required = Required.Always)]
internal readonly ulong PreviousAssetID;
internal AssetForListing(Asset asset, uint index, ulong previousAssetID) : base(asset) {
ArgumentNullException.ThrowIfNull(asset);
Index = index;
PreviousAssetID = previousAssetID;
}
}