2019-02-16 17:34:17 +01:00
// _ _ _ ____ _ _____
2017-11-18 17:27:06 +01:00
// / \ _ __ ___ | |__ (_)/ ___| | |_ ___ __ _ _ __ ___ | ___|__ _ _ __ _ __ ___
// / _ \ | '__|/ __|| '_ \ | |\___ \ | __|/ _ \ / _` || '_ ` _ \ | |_ / _` || '__|| '_ ` _ \
// / ___ \ | | | (__ | | | || | ___) || |_| __/| (_| || | | | | || _|| (_| || | | | | | | |
// /_/ \_\|_| \___||_| |_||_||____/ \__|\___| \__,_||_| |_| |_||_| \__,_||_| |_| |_| |_|
2019-01-14 19:11:17 +01:00
// |
2021-01-03 22:24:22 +01:00
// Copyright 2015-2021 Łukasz "JustArchi" Domeradzki
2018-07-27 04:52:14 +02:00
// Contact: JustArchi@JustArchi.net
2019-01-14 19:11:17 +01:00
// |
2018-07-27 04:52:14 +02:00
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
2019-01-14 19:11:17 +01:00
// |
2018-07-27 04:52:14 +02:00
// http://www.apache.org/licenses/LICENSE-2.0
2019-01-14 19:11:17 +01:00
// |
2018-07-27 04:52:14 +02:00
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
2016-12-04 01:07:37 +01:00
using System ;
using System.Collections.Generic ;
2018-12-14 16:07:46 +01:00
using System.Collections.Immutable ;
2019-10-13 17:21:40 +02:00
using System.Diagnostics.CodeAnalysis ;
2020-11-14 22:37:00 +01:00
using System.Globalization ;
2018-02-21 17:44:06 +01:00
using System.Linq ;
Use IAsyncEnumerable for getting inventory (#1652)
* Use IAsyncEnumerable for getting inventory
* Don't suppress exceptions, catch them in ResponseUnpackBoosters
* Make sure we don't get duplicate assets during unpack
* Rewrite inventory filters to LINQ methods
* Add handling duplicate items, mark GetInventory as obsolete, catch exceptions from getting inventory errors
* Mark GetInventoryEnumerable as NotNull, don't check received inventory for null, use comparison with nullable values
* Use specific types of exceptions, log exceptions using LogGenericWarningException, handle IOException separately (without logging the exception), remove default null value
* Use old method signature for obsolete API
* Use error level for generic exceptions
* Fix wantedSets not being used
* Correct exception types, rename function
* Replace exception types
* Make SendTradeOfferAsync that accepts Func<Steam.Asset, bool> as a filter
* Fix missing targetSteamID in ResponseTransferByRealAppIDs
* Make parameter name readable
* Rename method
2020-02-22 20:03:22 +03:00
using System.Net.Http ;
2016-12-04 02:49:56 +01:00
using System.Threading ;
2016-12-04 01:07:37 +01:00
using System.Threading.Tasks ;
2017-12-14 08:23:17 +01:00
using ArchiSteamFarm.Json ;
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
using ArchiSteamFarm.Localization ;
2017-07-10 23:04:33 +02:00
using Newtonsoft.Json ;
2016-12-04 01:07:37 +01:00
namespace ArchiSteamFarm {
2020-04-18 17:52:11 +02:00
internal sealed class Statistics : IAsyncDisposable {
2020-06-21 00:44:24 +02:00
private const ushort MaxItemsForFairBots = ArchiWebHandler . MaxItemsInSingleInventoryRequest * WebBrowser . MaxTries ; // Determines which fair bots we'll deprioritize when matching due to excessive number of inventory requests they need to make, which are likely to fail in the process or cause excessive delays
2019-08-26 00:49:34 +02:00
private const byte MaxMatchedBotsHard = 40 ; // Determines how many bots we can attempt to match in total, where match attempt is equal to analyzing bot's inventory
private const byte MaxMatchingRounds = 10 ; // Determines maximum amount of matching rounds we're going to consider before leaving the rest of work for the next batch
2017-03-20 17:21:56 +01:00
private const byte MinAnnouncementCheckTTL = 6 ; // Minimum amount of hours we must wait before checking eligibility for Announcement, should be lower than MinPersonaStateTTL
2017-02-08 14:55:40 +01:00
private const byte MinHeartBeatTTL = 10 ; // Minimum amount of minutes we must wait before sending next HeartBeat
2017-07-10 23:04:33 +02:00
private const byte MinItemsCount = 100 ; // Minimum amount of items to be eligible for public listing
2017-03-20 17:21:56 +01:00
private const byte MinPersonaStateTTL = 8 ; // Minimum amount of hours we must wait before requesting persona state update
2017-06-26 03:36:51 +02:00
private const string URL = "https://" + SharedInfo . StatisticsServer ;
2016-12-19 04:45:30 +01:00
2018-12-14 16:07:46 +01:00
private static readonly ImmutableHashSet < Steam . Asset . EType > AcceptedMatchableTypes = ImmutableHashSet . Create (
2018-09-08 00:46:40 +02:00
Steam . Asset . EType . Emoticon ,
Steam . Asset . EType . FoilTradingCard ,
Steam . Asset . EType . ProfileBackground ,
Steam . Asset . EType . TradingCard
2018-12-14 16:07:46 +01:00
) ;
2018-03-24 17:14:01 +01:00
2016-12-04 02:08:45 +01:00
private readonly Bot Bot ;
2020-11-14 22:37:00 +01:00
private readonly SemaphoreSlim MatchActivelySemaphore = new ( 1 , 1 ) ;
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
private readonly Timer MatchActivelyTimer ;
2020-11-14 22:37:00 +01:00
private readonly SemaphoreSlim RequestsSemaphore = new ( 1 , 1 ) ;
2017-07-13 06:08:52 +02:00
2017-12-17 11:31:42 +01:00
private DateTime LastAnnouncementCheck ;
private DateTime LastHeartBeat ;
private DateTime LastPersonaStateRequest ;
2016-12-04 08:20:18 +01:00
private bool ShouldSendHeartBeats ;
2016-12-04 02:08:45 +01:00
2020-08-22 21:41:01 +02:00
internal Statistics ( Bot bot ) {
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
Bot = bot ? ? throw new ArgumentNullException ( nameof ( bot ) ) ;
2016-12-04 02:08:45 +01:00
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
MatchActivelyTimer = new Timer (
2020-11-14 22:37:00 +01:00
MatchActively ,
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
null ,
2020-08-22 21:41:01 +02:00
TimeSpan . FromHours ( 1 ) + TimeSpan . FromSeconds ( ASF . LoadBalancingDelay * Bot . Bots ? . Count ? ? 0 ) , // Delay
2018-12-03 00:59:01 +01:00
TimeSpan . FromHours ( 8 ) // Period
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
) ;
}
2020-04-18 17:52:11 +02:00
public async ValueTask DisposeAsync ( ) {
2018-11-29 21:05:40 +01:00
MatchActivelySemaphore . Dispose ( ) ;
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
RequestsSemaphore . Dispose ( ) ;
2020-04-18 17:52:11 +02:00
await MatchActivelyTimer . DisposeAsync ( ) . ConfigureAwait ( false ) ;
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
}
2016-12-04 02:49:56 +01:00
2016-12-04 02:08:45 +01:00
internal async Task OnHeartBeat ( ) {
2017-03-19 21:56:36 +01:00
// Request persona update if needed
if ( ( DateTime . UtcNow > LastPersonaStateRequest . AddHours ( MinPersonaStateTTL ) ) & & ( DateTime . UtcNow > LastAnnouncementCheck . AddHours ( MinAnnouncementCheckTTL ) ) ) {
LastPersonaStateRequest = DateTime . UtcNow ;
Bot . RequestPersonaStateUpdate ( ) ;
}
2017-01-23 00:46:44 +01:00
if ( ! ShouldSendHeartBeats | | ( DateTime . UtcNow < LastHeartBeat . AddMinutes ( MinHeartBeatTTL ) ) ) {
2016-12-04 01:07:37 +01:00
return ;
}
2017-08-04 19:26:37 +02:00
await RequestsSemaphore . WaitAsync ( ) . ConfigureAwait ( false ) ;
2016-12-04 02:49:56 +01:00
try {
2017-01-23 00:46:44 +01:00
if ( ! ShouldSendHeartBeats | | ( DateTime . UtcNow < LastHeartBeat . AddMinutes ( MinHeartBeatTTL ) ) ) {
2016-12-04 02:49:56 +01:00
return ;
}
2018-02-21 17:47:17 +01:00
const string request = URL + "/Api/HeartBeat" ;
2018-12-15 00:27:15 +01:00
2020-11-14 22:37:00 +01:00
Dictionary < string , string > data = new ( 2 , StringComparer . Ordinal ) {
{ "Guid" , ( ASF . GlobalDatabase ? . Identifier ? ? Guid . NewGuid ( ) ) . ToString ( "N" ) } ,
{ "SteamID" , Bot . SteamID . ToString ( CultureInfo . InvariantCulture ) }
2016-12-04 02:49:56 +01:00
} ;
2016-12-04 01:07:37 +01:00
2020-09-13 21:43:25 +02:00
WebBrowser . BasicResponse ? response = await Bot . ArchiWebHandler . WebBrowser . UrlPost ( request , data : data , requestOptions : WebBrowser . ERequestOptions . ReturnClientErrors ) . ConfigureAwait ( false ) ;
2019-04-05 16:24:02 +02:00
if ( response = = null ) {
return ;
}
if ( response . StatusCode . IsClientErrorCode ( ) ) {
LastHeartBeat = DateTime . MinValue ;
ShouldSendHeartBeats = false ;
2019-04-05 14:29:35 +02:00
return ;
2016-12-04 02:49:56 +01:00
}
2019-04-05 14:29:35 +02:00
LastHeartBeat = DateTime . UtcNow ;
2016-12-04 02:49:56 +01:00
} finally {
2017-08-04 19:26:37 +02:00
RequestsSemaphore . Release ( ) ;
2016-12-04 01:07:37 +01:00
}
2016-12-04 02:08:45 +01:00
}
2016-12-04 01:07:37 +01:00
2019-05-19 15:38:06 +02:00
internal async Task OnLoggedOn ( ) {
if ( ! await Bot . ArchiWebHandler . JoinGroup ( SharedInfo . ASFGroupSteamID ) . ConfigureAwait ( false ) ) {
2020-11-14 22:37:00 +01:00
Bot . ArchiLogger . LogGenericWarning ( string . Format ( CultureInfo . CurrentCulture , Strings . WarningFailedWithError , nameof ( ArchiWebHandler . JoinGroup ) ) ) ;
2019-05-19 15:38:06 +02:00
}
}
2017-11-26 19:08:48 +01:00
2020-08-22 21:41:01 +02:00
internal async Task OnPersonaState ( string? nickname = null , string? avatarHash = null ) {
2019-04-05 15:12:54 +02:00
if ( ( DateTime . UtcNow < LastAnnouncementCheck . AddHours ( MinAnnouncementCheckTTL ) ) & & ( ShouldSendHeartBeats | | ( LastHeartBeat = = DateTime . MinValue ) ) ) {
2017-03-19 21:56:36 +01:00
return ;
}
2017-08-04 19:26:37 +02:00
await RequestsSemaphore . WaitAsync ( ) . ConfigureAwait ( false ) ;
2016-12-04 02:49:56 +01:00
try {
2019-04-05 15:12:54 +02:00
if ( ( DateTime . UtcNow < LastAnnouncementCheck . AddHours ( MinAnnouncementCheckTTL ) ) & & ( ShouldSendHeartBeats | | ( LastHeartBeat = = DateTime . MinValue ) ) ) {
2017-02-08 14:35:01 +01:00
return ;
}
2018-03-24 17:14:01 +01:00
// Don't announce if we don't meet conditions
2019-06-19 18:50:26 +02:00
bool? eligible = await IsEligibleForListing ( ) . ConfigureAwait ( false ) ;
2018-12-15 00:27:15 +01:00
2019-04-05 15:12:54 +02:00
if ( ! eligible . HasValue ) {
// This is actually network failure, so we'll stop sending heartbeats but not record it as valid check
ShouldSendHeartBeats = false ;
return ;
}
if ( ! eligible . Value ) {
2018-03-24 17:14:01 +01:00
LastAnnouncementCheck = DateTime . UtcNow ;
ShouldSendHeartBeats = false ;
2018-12-15 00:27:15 +01:00
2018-03-24 17:14:01 +01:00
return ;
}
2020-08-22 21:41:01 +02:00
string? tradeToken = await Bot . ArchiHandler . GetTradeToken ( ) . ConfigureAwait ( false ) ;
2019-04-05 15:12:54 +02:00
if ( string . IsNullOrEmpty ( tradeToken ) ) {
// This is actually network failure, so we'll stop sending heartbeats but not record it as valid check
ShouldSendHeartBeats = false ;
return ;
}
2018-06-09 00:45:15 +02:00
HashSet < Steam . Asset . EType > acceptedMatchableTypes = Bot . BotConfig . MatchableTypes . Where ( type = > AcceptedMatchableTypes . Contains ( type ) ) . ToHashSet ( ) ;
2018-12-15 00:27:15 +01:00
2018-03-24 17:14:01 +01:00
if ( acceptedMatchableTypes . Count = = 0 ) {
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
Bot . ArchiLogger . LogNullError ( nameof ( acceptedMatchableTypes ) ) ;
2018-03-24 17:14:01 +01:00
LastAnnouncementCheck = DateTime . UtcNow ;
ShouldSendHeartBeats = false ;
2018-12-15 00:27:15 +01:00
2018-03-24 17:14:01 +01:00
return ;
}
Use IAsyncEnumerable for getting inventory (#1652)
* Use IAsyncEnumerable for getting inventory
* Don't suppress exceptions, catch them in ResponseUnpackBoosters
* Make sure we don't get duplicate assets during unpack
* Rewrite inventory filters to LINQ methods
* Add handling duplicate items, mark GetInventory as obsolete, catch exceptions from getting inventory errors
* Mark GetInventoryEnumerable as NotNull, don't check received inventory for null, use comparison with nullable values
* Use specific types of exceptions, log exceptions using LogGenericWarningException, handle IOException separately (without logging the exception), remove default null value
* Use old method signature for obsolete API
* Use error level for generic exceptions
* Fix wantedSets not being used
* Correct exception types, rename function
* Replace exception types
* Make SendTradeOfferAsync that accepts Func<Steam.Asset, bool> as a filter
* Fix missing targetSteamID in ResponseTransferByRealAppIDs
* Make parameter name readable
* Rename method
2020-02-22 20:03:22 +03:00
HashSet < Steam . Asset > inventory ;
try {
inventory = await Bot . ArchiWebHandler . GetInventoryAsync ( ) . Where ( item = > item . Tradable & & acceptedMatchableTypes . Contains ( item . Type ) ) . ToHashSetAsync ( ) . ConfigureAwait ( false ) ;
2020-08-11 11:34:32 +02:00
} catch ( HttpRequestException e ) {
Bot . ArchiLogger . LogGenericWarningException ( e ) ;
Use IAsyncEnumerable for getting inventory (#1652)
* Use IAsyncEnumerable for getting inventory
* Don't suppress exceptions, catch them in ResponseUnpackBoosters
* Make sure we don't get duplicate assets during unpack
* Rewrite inventory filters to LINQ methods
* Add handling duplicate items, mark GetInventory as obsolete, catch exceptions from getting inventory errors
* Mark GetInventoryEnumerable as NotNull, don't check received inventory for null, use comparison with nullable values
* Use specific types of exceptions, log exceptions using LogGenericWarningException, handle IOException separately (without logging the exception), remove default null value
* Use old method signature for obsolete API
* Use error level for generic exceptions
* Fix wantedSets not being used
* Correct exception types, rename function
* Replace exception types
* Make SendTradeOfferAsync that accepts Func<Steam.Asset, bool> as a filter
* Fix missing targetSteamID in ResponseTransferByRealAppIDs
* Make parameter name readable
* Rename method
2020-02-22 20:03:22 +03:00
// This is actually inventory failure, so we'll stop sending heartbeats but not record it as valid check
ShouldSendHeartBeats = false ;
return ;
} catch ( Exception e ) {
Bot . ArchiLogger . LogGenericException ( e ) ;
2017-02-08 14:35:01 +01:00
2019-04-05 15:12:54 +02:00
// This is actually inventory failure, so we'll stop sending heartbeats but not record it as valid check
2017-02-08 14:41:28 +01:00
ShouldSendHeartBeats = false ;
2018-12-15 00:27:15 +01:00
2016-12-04 02:49:56 +01:00
return ;
}
2018-12-20 17:40:51 +01:00
LastAnnouncementCheck = DateTime . UtcNow ;
2017-03-30 01:26:15 +02:00
// This is actual inventory
2017-07-10 23:04:33 +02:00
if ( inventory . Count < MinItemsCount ) {
2017-03-19 21:56:36 +01:00
ShouldSendHeartBeats = false ;
2018-12-15 00:27:15 +01:00
2017-03-19 21:56:36 +01:00
return ;
}
2016-12-17 02:27:14 +01:00
2018-02-21 17:47:17 +01:00
const string request = URL + "/Api/Announce" ;
2018-12-15 00:27:15 +01:00
2020-11-14 22:37:00 +01:00
Dictionary < string , string > data = new ( 9 , StringComparer . Ordinal ) {
2018-02-01 00:46:18 +01:00
{ "AvatarHash" , avatarHash ? ? "" } ,
2020-11-14 22:37:00 +01:00
{ "GamesCount" , inventory . Select ( item = > item . RealAppID ) . Distinct ( ) . Count ( ) . ToString ( CultureInfo . InvariantCulture ) } ,
{ "Guid" , ( ASF . GlobalDatabase ? . Identifier ? ? Guid . NewGuid ( ) ) . ToString ( "N" ) } ,
{ "ItemsCount" , inventory . Count . ToString ( CultureInfo . InvariantCulture ) } ,
2018-03-24 17:14:01 +01:00
{ "MatchableTypes" , JsonConvert . SerializeObject ( acceptedMatchableTypes ) } ,
{ "MatchEverything" , Bot . BotConfig . TradingPreferences . HasFlag ( BotConfig . ETradingPreferences . MatchEverything ) ? "1" : "0" } ,
2019-04-02 20:43:17 +02:00
{ "Nickname" , nickname ? ? "" } ,
2020-11-14 22:37:00 +01:00
{ "SteamID" , Bot . SteamID . ToString ( CultureInfo . InvariantCulture ) } ,
2020-08-22 21:41:01 +02:00
{ "TradeToken" , tradeToken ! }
2016-12-04 02:49:56 +01:00
} ;
2020-09-13 21:43:25 +02:00
WebBrowser . BasicResponse ? response = await Bot . ArchiWebHandler . WebBrowser . UrlPost ( request , data : data , requestOptions : WebBrowser . ERequestOptions . ReturnClientErrors ) . ConfigureAwait ( false ) ;
2019-04-05 16:24:02 +02:00
if ( response = = null ) {
return ;
}
if ( response . StatusCode . IsClientErrorCode ( ) ) {
LastHeartBeat = DateTime . MinValue ;
ShouldSendHeartBeats = false ;
2019-04-05 16:25:44 +02:00
return ;
2019-04-05 16:24:02 +02:00
}
2019-04-05 14:29:35 +02:00
2019-04-05 16:24:02 +02:00
LastHeartBeat = DateTime . UtcNow ;
ShouldSendHeartBeats = true ;
2016-12-04 02:49:56 +01:00
} finally {
2017-08-04 19:26:37 +02:00
RequestsSemaphore . Release ( ) ;
2016-12-04 02:49:56 +01:00
}
2016-12-04 01:07:37 +01:00
}
2018-03-24 17:14:01 +01:00
2020-08-22 21:41:01 +02:00
private async Task < ImmutableHashSet < ListedUser > ? > GetListedUsers ( ) {
2019-08-26 00:21:54 +02:00
const string request = URL + "/Api/Bots" ;
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
2021-01-04 17:42:31 +01:00
WebBrowser . ObjectResponse < ImmutableHashSet < ListedUser > > ? response = await Bot . ArchiWebHandler . WebBrowser . UrlGetToJsonObject < ImmutableHashSet < ListedUser > > ( request ) . ConfigureAwait ( false ) ;
2018-12-15 00:27:15 +01:00
2021-01-04 17:42:31 +01:00
return response ? . Content ;
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
}
2019-06-19 18:50:26 +02:00
private async Task < bool? > IsEligibleForListing ( ) {
bool? isEligibleForMatching = await IsEligibleForMatching ( ) . ConfigureAwait ( false ) ;
if ( isEligibleForMatching ! = true ) {
return isEligibleForMatching ;
}
// Bot must have public inventory
2020-07-04 23:43:49 +02:00
bool? hasPublicInventory = await Bot . HasPublicInventory ( ) . ConfigureAwait ( false ) ;
2019-06-19 18:50:26 +02:00
if ( hasPublicInventory ! = true ) {
2020-11-14 22:37:00 +01:00
Bot . ArchiLogger . LogGenericTrace ( string . Format ( CultureInfo . CurrentCulture , Strings . WarningFailedWithError , nameof ( Bot . HasPublicInventory ) + ": " + ( hasPublicInventory ? . ToString ( ) ? ? "null" ) ) ) ;
2019-06-19 18:50:26 +02:00
return hasPublicInventory ;
}
return true ;
}
2019-04-05 15:12:54 +02:00
private async Task < bool? > IsEligibleForMatching ( ) {
2018-03-24 17:14:01 +01:00
// Bot must have ASF 2FA
if ( ! Bot . HasMobileAuthenticator ) {
2020-11-14 22:37:00 +01:00
Bot . ArchiLogger . LogGenericTrace ( string . Format ( CultureInfo . CurrentCulture , Strings . WarningFailedWithError , nameof ( Bot . HasMobileAuthenticator ) + ": " + Bot . HasMobileAuthenticator ) ) ;
2018-12-15 00:27:15 +01:00
2018-03-24 17:14:01 +01:00
return false ;
}
// Bot must have STM enable in TradingPreferences
if ( ! Bot . BotConfig . TradingPreferences . HasFlag ( BotConfig . ETradingPreferences . SteamTradeMatcher ) ) {
2020-11-14 22:37:00 +01:00
Bot . ArchiLogger . LogGenericTrace ( string . Format ( CultureInfo . CurrentCulture , Strings . WarningFailedWithError , nameof ( Bot . BotConfig . TradingPreferences ) + ": " + Bot . BotConfig . TradingPreferences ) ) ;
2018-12-15 00:27:15 +01:00
2018-03-24 17:14:01 +01:00
return false ;
}
// Bot must have at least one accepted matchable type set
if ( ( Bot . BotConfig . MatchableTypes . Count = = 0 ) | | Bot . BotConfig . MatchableTypes . All ( type = > ! AcceptedMatchableTypes . Contains ( type ) ) ) {
2020-11-14 22:37:00 +01:00
Bot . ArchiLogger . LogGenericTrace ( string . Format ( CultureInfo . CurrentCulture , Strings . WarningFailedWithError , nameof ( Bot . BotConfig . MatchableTypes ) + ": " + string . Join ( ", " , Bot . BotConfig . MatchableTypes ) ) ) ;
2018-12-15 00:27:15 +01:00
2018-03-24 17:14:01 +01:00
return false ;
}
// Bot must have valid API key (e.g. not being restricted account)
2019-04-05 15:12:54 +02:00
bool? hasValidApiKey = await Bot . ArchiWebHandler . HasValidApiKey ( ) . ConfigureAwait ( false ) ;
2018-12-15 00:27:15 +01:00
2019-06-19 18:50:26 +02:00
if ( hasValidApiKey ! = true ) {
2020-11-14 22:37:00 +01:00
Bot . ArchiLogger . LogGenericTrace ( string . Format ( CultureInfo . CurrentCulture , Strings . WarningFailedWithError , nameof ( Bot . ArchiWebHandler . HasValidApiKey ) + ": " + ( hasValidApiKey ? . ToString ( ) ? ? "null" ) ) ) ;
2019-04-05 15:12:54 +02:00
return hasValidApiKey ;
2018-12-08 01:45:13 +01:00
}
return true ;
2018-03-24 17:14:01 +01:00
}
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
2020-11-14 22:37:00 +01:00
private async void MatchActively ( object? state ) {
2019-04-05 15:12:54 +02:00
if ( ! Bot . IsConnectedAndLoggedOn | | Bot . BotConfig . TradingPreferences . HasFlag ( BotConfig . ETradingPreferences . MatchEverything ) | | ! Bot . BotConfig . TradingPreferences . HasFlag ( BotConfig . ETradingPreferences . MatchActively ) | | ( await IsEligibleForMatching ( ) . ConfigureAwait ( false ) ! = true ) ) {
2018-12-02 06:24:36 +01:00
Bot . ArchiLogger . LogGenericTrace ( Strings . ErrorAborted ) ;
2018-12-15 00:27:15 +01:00
2018-12-02 06:24:36 +01:00
return ;
}
2019-06-19 18:52:30 +02:00
HashSet < Steam . Asset . EType > acceptedMatchableTypes = Bot . BotConfig . MatchableTypes . Where ( AcceptedMatchableTypes . Contains ) . ToHashSet ( ) ;
2018-12-15 00:27:15 +01:00
2018-12-02 06:24:36 +01:00
if ( acceptedMatchableTypes . Count = = 0 ) {
Bot . ArchiLogger . LogGenericTrace ( Strings . ErrorAborted ) ;
2018-12-15 00:27:15 +01:00
2018-12-02 06:24:36 +01:00
return ;
}
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
2018-11-29 21:05:40 +01:00
if ( ! await MatchActivelySemaphore . WaitAsync ( 0 ) . ConfigureAwait ( false ) ) {
2018-12-02 06:24:36 +01:00
Bot . ArchiLogger . LogGenericTrace ( Strings . ErrorAborted ) ;
2018-12-15 00:27:15 +01:00
2018-11-29 21:05:40 +01:00
return ;
}
try {
2018-12-02 06:24:36 +01:00
Bot . ArchiLogger . LogGenericTrace ( Strings . Starting ) ;
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
2020-11-14 22:37:00 +01:00
Dictionary < ulong , ( byte Tries , ISet < ulong > ? GivenAssetIDs , ISet < ulong > ? ReceivedAssetIDs ) > triedSteamIDs = new ( ) ;
2018-12-05 19:13:46 +01:00
2020-06-21 11:21:15 +02:00
bool shouldContinueMatching = true ;
bool tradedSomething = false ;
2018-11-29 21:05:40 +01:00
2020-06-21 11:21:15 +02:00
for ( byte i = 0 ; ( i < MaxMatchingRounds ) & & shouldContinueMatching ; i + + ) {
if ( ( i > 0 ) & & tradedSomething ) {
2018-11-29 21:05:40 +01:00
// After each round we wait at least 5 minutes for all bots to react
await Task . Delay ( 5 * 60 * 1000 ) . ConfigureAwait ( false ) ;
}
2019-04-05 15:12:54 +02:00
if ( ! Bot . IsConnectedAndLoggedOn | | Bot . BotConfig . TradingPreferences . HasFlag ( BotConfig . ETradingPreferences . MatchEverything ) | | ! Bot . BotConfig . TradingPreferences . HasFlag ( BotConfig . ETradingPreferences . MatchActively ) | | ( await IsEligibleForMatching ( ) . ConfigureAwait ( false ) ! = true ) ) {
2018-12-03 05:21:12 +01:00
Bot . ArchiLogger . LogGenericTrace ( Strings . ErrorAborted ) ;
2018-12-15 00:27:15 +01:00
2018-12-03 05:21:12 +01:00
break ;
}
2018-12-04 02:05:09 +01:00
using ( await Bot . Actions . GetTradingLock ( ) . ConfigureAwait ( false ) ) {
2020-11-14 22:37:00 +01:00
Bot . ArchiLogger . LogGenericInfo ( string . Format ( CultureInfo . CurrentCulture , Strings . ActivelyMatchingItems , i ) ) ;
2020-06-21 11:21:15 +02:00
( shouldContinueMatching , tradedSomething ) = await MatchActivelyRound ( acceptedMatchableTypes , triedSteamIDs ) . ConfigureAwait ( false ) ;
2020-11-14 22:37:00 +01:00
Bot . ArchiLogger . LogGenericInfo ( string . Format ( CultureInfo . CurrentCulture , Strings . DoneActivelyMatchingItems , i ) ) ;
2018-12-04 02:05:09 +01:00
}
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
}
2018-12-02 06:24:36 +01:00
Bot . ArchiLogger . LogGenericTrace ( Strings . Done ) ;
2018-11-29 21:05:40 +01:00
} finally {
MatchActivelySemaphore . Release ( ) ;
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
}
}
2020-08-22 21:41:01 +02:00
private async Task < ( bool ShouldContinueMatching , bool TradedSomething ) > MatchActivelyRound ( IReadOnlyCollection < Steam . Asset . EType > acceptedMatchableTypes , IDictionary < ulong , ( byte Tries , ISet < ulong > ? GivenAssetIDs , ISet < ulong > ? ReceivedAssetIDs ) > triedSteamIDs ) {
2020-11-14 22:37:00 +01:00
if ( ( acceptedMatchableTypes = = null ) | | ( acceptedMatchableTypes . Count = = 0 ) ) {
throw new ArgumentNullException ( nameof ( acceptedMatchableTypes ) ) ;
}
if ( triedSteamIDs = = null ) {
throw new ArgumentNullException ( nameof ( triedSteamIDs ) ) ;
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
}
Use IAsyncEnumerable for getting inventory (#1652)
* Use IAsyncEnumerable for getting inventory
* Don't suppress exceptions, catch them in ResponseUnpackBoosters
* Make sure we don't get duplicate assets during unpack
* Rewrite inventory filters to LINQ methods
* Add handling duplicate items, mark GetInventory as obsolete, catch exceptions from getting inventory errors
* Mark GetInventoryEnumerable as NotNull, don't check received inventory for null, use comparison with nullable values
* Use specific types of exceptions, log exceptions using LogGenericWarningException, handle IOException separately (without logging the exception), remove default null value
* Use old method signature for obsolete API
* Use error level for generic exceptions
* Fix wantedSets not being used
* Correct exception types, rename function
* Replace exception types
* Make SendTradeOfferAsync that accepts Func<Steam.Asset, bool> as a filter
* Fix missing targetSteamID in ResponseTransferByRealAppIDs
* Make parameter name readable
* Rename method
2020-02-22 20:03:22 +03:00
HashSet < Steam . Asset > ourInventory ;
try {
2021-02-16 21:30:16 +03:00
ourInventory = await Bot . ArchiWebHandler . GetInventoryAsync ( ) . Where ( item = > acceptedMatchableTypes . Contains ( item . Type ) & & ! Bot . BotDatabase . MatchActivelyBlacklistedAppIDs . Contains ( item . RealAppID ) ) . ToHashSetAsync ( ) . ConfigureAwait ( false ) ;
2020-08-11 11:34:32 +02:00
} catch ( HttpRequestException e ) {
Bot . ArchiLogger . LogGenericWarningException ( e ) ;
2020-06-21 11:21:15 +02:00
return ( false , false ) ;
Use IAsyncEnumerable for getting inventory (#1652)
* Use IAsyncEnumerable for getting inventory
* Don't suppress exceptions, catch them in ResponseUnpackBoosters
* Make sure we don't get duplicate assets during unpack
* Rewrite inventory filters to LINQ methods
* Add handling duplicate items, mark GetInventory as obsolete, catch exceptions from getting inventory errors
* Mark GetInventoryEnumerable as NotNull, don't check received inventory for null, use comparison with nullable values
* Use specific types of exceptions, log exceptions using LogGenericWarningException, handle IOException separately (without logging the exception), remove default null value
* Use old method signature for obsolete API
* Use error level for generic exceptions
* Fix wantedSets not being used
* Correct exception types, rename function
* Replace exception types
* Make SendTradeOfferAsync that accepts Func<Steam.Asset, bool> as a filter
* Fix missing targetSteamID in ResponseTransferByRealAppIDs
* Make parameter name readable
* Rename method
2020-02-22 20:03:22 +03:00
} catch ( Exception e ) {
Bot . ArchiLogger . LogGenericException ( e ) ;
2020-06-21 11:21:15 +02:00
return ( false , false ) ;
Use IAsyncEnumerable for getting inventory (#1652)
* Use IAsyncEnumerable for getting inventory
* Don't suppress exceptions, catch them in ResponseUnpackBoosters
* Make sure we don't get duplicate assets during unpack
* Rewrite inventory filters to LINQ methods
* Add handling duplicate items, mark GetInventory as obsolete, catch exceptions from getting inventory errors
* Mark GetInventoryEnumerable as NotNull, don't check received inventory for null, use comparison with nullable values
* Use specific types of exceptions, log exceptions using LogGenericWarningException, handle IOException separately (without logging the exception), remove default null value
* Use old method signature for obsolete API
* Use error level for generic exceptions
* Fix wantedSets not being used
* Correct exception types, rename function
* Replace exception types
* Make SendTradeOfferAsync that accepts Func<Steam.Asset, bool> as a filter
* Fix missing targetSteamID in ResponseTransferByRealAppIDs
* Make parameter name readable
* Rename method
2020-02-22 20:03:22 +03:00
}
2018-12-15 00:27:15 +01:00
Use IAsyncEnumerable for getting inventory (#1652)
* Use IAsyncEnumerable for getting inventory
* Don't suppress exceptions, catch them in ResponseUnpackBoosters
* Make sure we don't get duplicate assets during unpack
* Rewrite inventory filters to LINQ methods
* Add handling duplicate items, mark GetInventory as obsolete, catch exceptions from getting inventory errors
* Mark GetInventoryEnumerable as NotNull, don't check received inventory for null, use comparison with nullable values
* Use specific types of exceptions, log exceptions using LogGenericWarningException, handle IOException separately (without logging the exception), remove default null value
* Use old method signature for obsolete API
* Use error level for generic exceptions
* Fix wantedSets not being used
* Correct exception types, rename function
* Replace exception types
* Make SendTradeOfferAsync that accepts Func<Steam.Asset, bool> as a filter
* Fix missing targetSteamID in ResponseTransferByRealAppIDs
* Make parameter name readable
* Rename method
2020-02-22 20:03:22 +03:00
if ( ourInventory . Count = = 0 ) {
2020-11-14 22:37:00 +01:00
Bot . ArchiLogger . LogGenericTrace ( string . Format ( CultureInfo . CurrentCulture , Strings . ErrorIsEmpty , nameof ( ourInventory ) ) ) ;
2018-12-15 00:27:15 +01:00
2020-06-21 11:21:15 +02:00
return ( false , false ) ;
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
}
2019-08-26 00:21:54 +02:00
( Dictionary < ( uint RealAppID , Steam . Asset . EType Type , Steam . Asset . ERarity Rarity ) , Dictionary < ulong , uint > > ourFullState , Dictionary < ( uint RealAppID , Steam . Asset . EType Type , Steam . Asset . ERarity Rarity ) , Dictionary < ulong , uint > > ourTradableState ) = Trading . GetDividedInventoryState ( ourInventory ) ;
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
2019-08-26 00:21:54 +02:00
if ( Trading . IsEmptyForMatching ( ourFullState , ourTradableState ) ) {
2018-11-29 19:21:41 +01:00
// User doesn't have any more dupes in the inventory
2020-11-14 22:37:00 +01:00
Bot . ArchiLogger . LogGenericTrace ( string . Format ( CultureInfo . CurrentCulture , Strings . ErrorIsEmpty , nameof ( ourFullState ) + " || " + nameof ( ourTradableState ) ) ) ;
2018-12-15 00:27:15 +01:00
2020-06-21 11:21:15 +02:00
return ( false , false ) ;
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
}
2020-08-22 21:41:01 +02:00
ImmutableHashSet < ListedUser > ? listedUsers = await GetListedUsers ( ) . ConfigureAwait ( false ) ;
2018-12-15 00:27:15 +01:00
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
if ( ( listedUsers = = null ) | | ( listedUsers . Count = = 0 ) ) {
2020-11-14 22:37:00 +01:00
Bot . ArchiLogger . LogGenericTrace ( string . Format ( CultureInfo . CurrentCulture , Strings . ErrorIsEmpty , nameof ( listedUsers ) ) ) ;
2018-12-15 00:27:15 +01:00
2020-06-21 11:21:15 +02:00
return ( false , false ) ;
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
}
2020-08-22 21:41:01 +02:00
byte maxTradeHoldDuration = ASF . GlobalConfig ? . MaxTradeHoldDuration ? ? GlobalConfig . DefaultMaxTradeHoldDuration ;
2019-08-26 00:49:34 +02:00
byte totalMatches = 0 ;
2020-11-14 22:37:00 +01:00
HashSet < ( uint RealAppID , Steam . Asset . EType Type , Steam . Asset . ERarity Rarity ) > skippedSetsThisRound = new ( ) ;
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
2020-08-22 21:41:01 +02:00
foreach ( ListedUser listedUser in listedUsers . Where ( listedUser = > ( listedUser . SteamID ! = Bot . SteamID ) & & acceptedMatchableTypes . Any ( listedUser . MatchableTypes . Contains ) & & ( ! triedSteamIDs . TryGetValue ( listedUser . SteamID , out ( byte Tries , ISet < ulong > ? GivenAssetIDs , ISet < ulong > ? ReceivedAssetIDs ) attempt ) | | ( attempt . Tries < byte . MaxValue ) ) & & ! Bot . IsBlacklistedFromTrades ( listedUser . SteamID ) ) . OrderBy ( listedUser = > triedSteamIDs . TryGetValue ( listedUser . SteamID , out ( byte Tries , ISet < ulong > ? GivenAssetIDs , ISet < ulong > ? ReceivedAssetIDs ) attempt ) ? attempt . Tries : 0 ) . ThenByDescending ( listedUser = > listedUser . MatchEverything ) . ThenByDescending ( listedUser = > listedUser . MatchEverything | | ( listedUser . ItemsCount < MaxItemsForFairBots ) ) . ThenByDescending ( listedUser = > listedUser . Score ) ) {
2019-08-26 00:21:54 +02:00
HashSet < ( uint RealAppID , Steam . Asset . EType Type , Steam . Asset . ERarity Rarity ) > wantedSets = ourTradableState . Keys . Where ( set = > ! skippedSetsThisRound . Contains ( set ) & & listedUser . MatchableTypes . Contains ( set . Type ) ) . ToHashSet ( ) ;
2019-02-04 03:09:20 +01:00
if ( wantedSets . Count = = 0 ) {
continue ;
}
2019-08-26 00:49:34 +02:00
if ( + + totalMatches > MaxMatchedBotsHard ) {
break ;
}
2018-12-02 06:24:36 +01:00
Bot . ArchiLogger . LogGenericTrace ( listedUser . SteamID + "..." ) ;
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
2020-08-06 20:03:15 +03:00
byte? holdDuration = await Bot . ArchiWebHandler . GetTradeHoldDurationForUser ( listedUser . SteamID , listedUser . TradeToken ) . ConfigureAwait ( false ) ;
2020-11-14 22:37:00 +01:00
switch ( holdDuration ) {
case null :
Bot . ArchiLogger . LogGenericTrace ( string . Format ( CultureInfo . CurrentCulture , Strings . ErrorIsEmpty , nameof ( holdDuration ) ) ) ;
2020-08-06 20:03:15 +03:00
2020-11-14 22:37:00 +01:00
continue ;
case > 0 when holdDuration . Value > maxTradeHoldDuration :
2020-08-22 21:41:01 +02:00
Bot . ArchiLogger . LogGenericTrace ( holdDuration . Value + " > " + maxTradeHoldDuration ) ;
2020-08-06 20:03:15 +03:00
continue ;
}
Use IAsyncEnumerable for getting inventory (#1652)
* Use IAsyncEnumerable for getting inventory
* Don't suppress exceptions, catch them in ResponseUnpackBoosters
* Make sure we don't get duplicate assets during unpack
* Rewrite inventory filters to LINQ methods
* Add handling duplicate items, mark GetInventory as obsolete, catch exceptions from getting inventory errors
* Mark GetInventoryEnumerable as NotNull, don't check received inventory for null, use comparison with nullable values
* Use specific types of exceptions, log exceptions using LogGenericWarningException, handle IOException separately (without logging the exception), remove default null value
* Use old method signature for obsolete API
* Use error level for generic exceptions
* Fix wantedSets not being used
* Correct exception types, rename function
* Replace exception types
* Make SendTradeOfferAsync that accepts Func<Steam.Asset, bool> as a filter
* Fix missing targetSteamID in ResponseTransferByRealAppIDs
* Make parameter name readable
* Rename method
2020-02-22 20:03:22 +03:00
HashSet < Steam . Asset > theirInventory ;
try {
2021-04-11 00:33:32 +02:00
theirInventory = await Bot . ArchiWebHandler . GetInventoryAsync ( listedUser . SteamID ) . Where ( item = > ( ! listedUser . MatchEverything | | item . Tradable ) & & wantedSets . Contains ( ( item . RealAppID , item . Type , item . Rarity ) ) & & ( ( holdDuration . Value = = 0 ) | | ! ( item . Type is Steam . Asset . EType . FoilTradingCard or Steam . Asset . EType . TradingCard & & CardsFarmer . SalesBlacklist . Contains ( item . RealAppID ) ) ) ) . ToHashSetAsync ( ) . ConfigureAwait ( false ) ;
2020-08-11 11:34:32 +02:00
} catch ( HttpRequestException e ) {
Bot . ArchiLogger . LogGenericWarningException ( e ) ;
Use IAsyncEnumerable for getting inventory (#1652)
* Use IAsyncEnumerable for getting inventory
* Don't suppress exceptions, catch them in ResponseUnpackBoosters
* Make sure we don't get duplicate assets during unpack
* Rewrite inventory filters to LINQ methods
* Add handling duplicate items, mark GetInventory as obsolete, catch exceptions from getting inventory errors
* Mark GetInventoryEnumerable as NotNull, don't check received inventory for null, use comparison with nullable values
* Use specific types of exceptions, log exceptions using LogGenericWarningException, handle IOException separately (without logging the exception), remove default null value
* Use old method signature for obsolete API
* Use error level for generic exceptions
* Fix wantedSets not being used
* Correct exception types, rename function
* Replace exception types
* Make SendTradeOfferAsync that accepts Func<Steam.Asset, bool> as a filter
* Fix missing targetSteamID in ResponseTransferByRealAppIDs
* Make parameter name readable
* Rename method
2020-02-22 20:03:22 +03:00
continue ;
} catch ( Exception e ) {
Bot . ArchiLogger . LogGenericException ( e ) ;
continue ;
}
2018-12-15 00:27:15 +01:00
Use IAsyncEnumerable for getting inventory (#1652)
* Use IAsyncEnumerable for getting inventory
* Don't suppress exceptions, catch them in ResponseUnpackBoosters
* Make sure we don't get duplicate assets during unpack
* Rewrite inventory filters to LINQ methods
* Add handling duplicate items, mark GetInventory as obsolete, catch exceptions from getting inventory errors
* Mark GetInventoryEnumerable as NotNull, don't check received inventory for null, use comparison with nullable values
* Use specific types of exceptions, log exceptions using LogGenericWarningException, handle IOException separately (without logging the exception), remove default null value
* Use old method signature for obsolete API
* Use error level for generic exceptions
* Fix wantedSets not being used
* Correct exception types, rename function
* Replace exception types
* Make SendTradeOfferAsync that accepts Func<Steam.Asset, bool> as a filter
* Fix missing targetSteamID in ResponseTransferByRealAppIDs
* Make parameter name readable
* Rename method
2020-02-22 20:03:22 +03:00
if ( theirInventory . Count = = 0 ) {
2020-11-14 22:37:00 +01:00
Bot . ArchiLogger . LogGenericTrace ( string . Format ( CultureInfo . CurrentCulture , Strings . ErrorIsEmpty , nameof ( theirInventory ) ) ) ;
2018-12-15 00:27:15 +01:00
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
continue ;
}
2020-11-14 22:37:00 +01:00
HashSet < ( uint RealAppID , Steam . Asset . EType Type , Steam . Asset . ERarity Rarity ) > skippedSetsThisUser = new ( ) ;
2018-12-09 18:08:14 +01:00
2019-08-26 00:21:54 +02:00
Dictionary < ( uint RealAppID , Steam . Asset . EType Type , Steam . Asset . ERarity Rarity ) , Dictionary < ulong , uint > > theirTradableState = Trading . GetTradableInventoryState ( theirInventory ) ;
2020-11-14 22:37:00 +01:00
Dictionary < ( uint RealAppID , Steam . Asset . EType Type , Steam . Asset . ERarity Rarity ) , Dictionary < ulong , uint > > inventoryStateChanges = new ( ) ;
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
2018-12-02 19:04:53 +01:00
for ( byte i = 0 ; i < Trading . MaxTradesPerAccount ; i + + ) {
byte itemsInTrade = 0 ;
2020-11-14 22:37:00 +01:00
HashSet < ( uint RealAppID , Steam . Asset . EType Type , Steam . Asset . ERarity Rarity ) > skippedSetsThisTrade = new ( ) ;
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
2020-11-14 22:37:00 +01:00
Dictionary < ulong , uint > classIDsToGive = new ( ) ;
Dictionary < ulong , uint > classIDsToReceive = new ( ) ;
Dictionary < ulong , uint > fairClassIDsToGive = new ( ) ;
Dictionary < ulong , uint > fairClassIDsToReceive = new ( ) ;
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
2019-08-26 00:21:54 +02:00
foreach ( ( ( uint RealAppID , Steam . Asset . EType Type , Steam . Asset . ERarity Rarity ) set , Dictionary < ulong , uint > ourFullItems ) in ourFullState . Where ( set = > ! skippedSetsThisUser . Contains ( set . Key ) & & listedUser . MatchableTypes . Contains ( set . Key . Type ) & & set . Value . Values . Any ( count = > count > 1 ) ) ) {
2020-08-22 21:41:01 +02:00
if ( ! ourTradableState . TryGetValue ( set , out Dictionary < ulong , uint > ? ourTradableItems ) | | ( ourTradableItems . Count = = 0 ) ) {
2018-12-09 18:08:14 +01:00
continue ;
}
2020-08-22 21:41:01 +02:00
if ( ! theirTradableState . TryGetValue ( set , out Dictionary < ulong , uint > ? theirTradableItems ) | | ( theirTradableItems . Count = = 0 ) ) {
2018-12-02 19:04:53 +01:00
continue ;
}
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
2018-12-09 21:26:22 +01:00
// Those 2 collections are on user-basis since we can't be sure that the trade passes through (and therefore we need to keep original state in case of failure)
2020-11-14 22:37:00 +01:00
Dictionary < ulong , uint > ourFullSet = new ( ourFullItems ) ;
Dictionary < ulong , uint > ourTradableSet = new ( ourTradableItems ) ;
2018-12-09 21:26:22 +01:00
2019-08-26 00:21:54 +02:00
// We also have to take into account changes that happened in previous trades with this user, so this block will adapt to that
2020-08-22 21:41:01 +02:00
if ( inventoryStateChanges . TryGetValue ( set , out Dictionary < ulong , uint > ? pastChanges ) & & ( pastChanges . Count > 0 ) ) {
2019-01-11 00:16:20 +01:00
foreach ( ( ulong classID , uint amount ) in pastChanges ) {
if ( ! ourFullSet . TryGetValue ( classID , out uint fullAmount ) | | ( fullAmount = = 0 ) | | ( fullAmount < amount ) ) {
2018-12-09 21:26:22 +01:00
Bot . ArchiLogger . LogNullError ( nameof ( fullAmount ) ) ;
2018-12-15 00:27:15 +01:00
2020-06-21 11:21:15 +02:00
return ( false , skippedSetsThisRound . Count > 0 ) ;
2018-12-09 21:26:22 +01:00
}
2019-01-11 00:16:20 +01:00
if ( fullAmount > amount ) {
ourFullSet [ classID ] = fullAmount - amount ;
2018-12-09 21:26:22 +01:00
} else {
2019-01-11 00:16:20 +01:00
ourFullSet . Remove ( classID ) ;
2018-12-09 21:26:22 +01:00
}
2019-01-11 00:16:20 +01:00
if ( ! ourTradableSet . TryGetValue ( classID , out uint tradableAmount ) | | ( tradableAmount = = 0 ) | | ( tradableAmount < amount ) ) {
2018-12-09 21:26:22 +01:00
Bot . ArchiLogger . LogNullError ( nameof ( tradableAmount ) ) ;
2018-12-15 00:27:15 +01:00
2020-06-21 11:21:15 +02:00
return ( false , skippedSetsThisRound . Count > 0 ) ;
2018-12-09 21:26:22 +01:00
}
2019-01-11 00:16:20 +01:00
if ( fullAmount > amount ) {
ourTradableSet [ classID ] = fullAmount - amount ;
2018-12-09 21:26:22 +01:00
} else {
2019-01-11 00:16:20 +01:00
ourTradableSet . Remove ( classID ) ;
2018-12-09 21:26:22 +01:00
}
}
if ( Trading . IsEmptyForMatching ( ourFullSet , ourTradableSet ) ) {
continue ;
}
}
2018-12-09 18:08:14 +01:00
2018-12-02 19:04:53 +01:00
bool match ;
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
2018-12-02 19:04:53 +01:00
do {
match = false ;
2019-08-26 00:21:54 +02:00
foreach ( ( ulong ourItem , uint ourFullAmount ) in ourFullSet . Where ( item = > item . Value > 1 ) . OrderByDescending ( item = > item . Value ) ) {
if ( ! ourTradableSet . TryGetValue ( ourItem , out uint ourTradableAmount ) | | ( ourTradableAmount = = 0 ) ) {
2018-12-09 18:08:14 +01:00
continue ;
}
2019-08-26 00:21:54 +02:00
foreach ( ( ulong theirItem , uint theirTradableAmount ) in theirTradableItems . OrderBy ( item = > ourFullSet . TryGetValue ( item . Key , out uint ourAmountOfTheirItem ) ? ourAmountOfTheirItem : 0 ) ) {
if ( ourFullSet . TryGetValue ( theirItem , out uint ourAmountOfTheirItem ) & & ( ourFullAmount < = ourAmountOfTheirItem + 1 ) ) {
2018-12-02 19:04:53 +01:00
continue ;
}
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
2019-08-26 00:21:54 +02:00
if ( ! listedUser . MatchEverything ) {
// We have a potential match, let's check fairness for them
fairClassIDsToGive . TryGetValue ( ourItem , out uint fairGivenAmount ) ;
fairClassIDsToReceive . TryGetValue ( theirItem , out uint fairReceivedAmount ) ;
fairClassIDsToGive [ ourItem ] = + + fairGivenAmount ;
fairClassIDsToReceive [ theirItem ] = + + fairReceivedAmount ;
2019-08-26 00:30:00 +02:00
2019-08-26 00:21:54 +02:00
// Filter their inventory for the sets we're trading or have traded with this user
2019-08-26 13:18:04 +02:00
HashSet < Steam . Asset > fairFiltered = theirInventory . Where ( item = > ( ( item . RealAppID = = set . RealAppID ) & & ( item . Type = = set . Type ) & & ( item . Rarity = = set . Rarity ) ) | | skippedSetsThisTrade . Contains ( ( item . RealAppID , item . Type , item . Rarity ) ) ) . Select ( item = > item . CreateShallowCopy ( ) ) . ToHashSet ( ) ;
2019-08-26 00:21:54 +02:00
// Copy list to HashSet<Steam.Asset>
2019-08-26 13:18:04 +02:00
HashSet < Steam . Asset > fairItemsToGive = Trading . GetTradableItemsFromInventory ( ourInventory . Where ( item = > ( ( item . RealAppID = = set . RealAppID ) & & ( item . Type = = set . Type ) & & ( item . Rarity = = set . Rarity ) ) | | skippedSetsThisTrade . Contains ( ( item . RealAppID , item . Type , item . Rarity ) ) ) . Select ( item = > item . CreateShallowCopy ( ) ) . ToHashSet ( ) , fairClassIDsToGive . ToDictionary ( classID = > classID . Key , classID = > classID . Value ) ) ;
2019-08-26 00:21:54 +02:00
HashSet < Steam . Asset > fairItemsToReceive = Trading . GetTradableItemsFromInventory ( fairFiltered . Select ( item = > item . CreateShallowCopy ( ) ) . ToHashSet ( ) , fairClassIDsToReceive . ToDictionary ( classID = > classID . Key , classID = > classID . Value ) ) ;
// Actual check:
if ( ! Trading . IsTradeNeutralOrBetter ( fairFiltered , fairItemsToReceive , fairItemsToGive ) ) {
if ( fairGivenAmount > 1 ) {
fairClassIDsToGive [ ourItem ] = fairGivenAmount - 1 ;
} else {
fairClassIDsToGive . Remove ( ourItem ) ;
}
if ( fairReceivedAmount > 1 ) {
fairClassIDsToReceive [ theirItem ] = fairReceivedAmount - 1 ;
} else {
fairClassIDsToReceive . Remove ( theirItem ) ;
}
continue ;
}
}
2018-12-02 19:04:53 +01:00
// Skip this set from the remaining of this round
2019-01-11 00:16:20 +01:00
skippedSetsThisTrade . Add ( set ) ;
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
2018-12-02 19:04:53 +01:00
// Update our state based on given items
2019-08-26 00:21:54 +02:00
classIDsToGive [ ourItem ] = classIDsToGive . TryGetValue ( ourItem , out uint ourGivenAmount ) ? ourGivenAmount + 1 : 1 ;
ourFullSet [ ourItem ] = ourFullAmount - 1 ; // We don't need to remove anything here because we can guarantee that ourItem.Value is at least 2
2018-12-09 21:26:22 +01:00
2020-08-22 21:41:01 +02:00
if ( inventoryStateChanges . TryGetValue ( set , out Dictionary < ulong , uint > ? currentChanges ) ) {
2019-02-16 17:34:17 +01:00
currentChanges [ ourItem ] = currentChanges . TryGetValue ( ourItem , out uint amount ) ? amount + 1 : 1 ;
2018-12-09 21:26:22 +01:00
} else {
2019-01-11 00:16:20 +01:00
inventoryStateChanges [ set ] = new Dictionary < ulong , uint > {
{ ourItem , 1 }
2018-12-09 21:26:22 +01:00
} ;
}
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
2018-12-02 19:04:53 +01:00
// Update our state based on received items
2019-08-26 00:21:54 +02:00
classIDsToReceive [ theirItem ] = classIDsToReceive . TryGetValue ( theirItem , out uint ourReceivedAmount ) ? ourReceivedAmount + 1 : 1 ;
2019-01-11 00:16:20 +01:00
ourFullSet [ theirItem ] = ourAmountOfTheirItem + 1 ;
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
2019-08-26 00:21:54 +02:00
if ( ourTradableAmount > 1 ) {
ourTradableSet [ ourItem ] = ourTradableAmount - 1 ;
2018-12-09 18:08:14 +01:00
} else {
2019-01-11 00:16:20 +01:00
ourTradableSet . Remove ( ourItem ) ;
2018-12-09 18:08:14 +01:00
}
2018-12-09 21:26:22 +01:00
// Update their state based on taken items
2019-08-26 00:21:54 +02:00
if ( theirTradableAmount > 1 ) {
theirTradableItems [ theirItem ] = theirTradableAmount - 1 ;
2018-12-09 21:26:22 +01:00
} else {
2019-08-26 00:21:54 +02:00
theirTradableItems . Remove ( theirItem ) ;
2018-12-09 21:26:22 +01:00
}
2018-12-02 19:04:53 +01:00
itemsInTrade + = 2 ;
match = true ;
2018-12-15 00:27:15 +01:00
2018-12-02 19:04:53 +01:00
break ;
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
}
2018-12-02 19:04:53 +01:00
if ( match ) {
break ;
}
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
}
2018-12-02 19:04:53 +01:00
} while ( match & & ( itemsInTrade < Trading . MaxItemsPerTrade - 1 ) ) ;
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
2018-12-02 19:04:53 +01:00
if ( itemsInTrade > = Trading . MaxItemsPerTrade - 1 ) {
break ;
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
}
2018-12-02 19:04:53 +01:00
}
2018-12-05 23:13:55 +01:00
if ( skippedSetsThisTrade . Count = = 0 ) {
2020-11-14 22:37:00 +01:00
Bot . ArchiLogger . LogGenericTrace ( string . Format ( CultureInfo . CurrentCulture , Strings . ErrorIsEmpty , nameof ( skippedSetsThisTrade ) ) ) ;
2018-12-15 00:27:15 +01:00
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
break ;
}
2019-08-26 00:21:54 +02:00
// Remove the items from inventories
2018-12-09 18:08:14 +01:00
HashSet < Steam . Asset > itemsToGive = Trading . GetTradableItemsFromInventory ( ourInventory , classIDsToGive ) ;
HashSet < Steam . Asset > itemsToReceive = Trading . GetTradableItemsFromInventory ( theirInventory , classIDsToReceive ) ;
2019-02-02 22:54:23 +01:00
if ( ( itemsToGive . Count ! = itemsToReceive . Count ) | | ! Trading . IsFairExchange ( itemsToGive , itemsToReceive ) ) {
2018-12-09 18:08:14 +01:00
// Failsafe
2020-11-14 22:37:00 +01:00
Bot . ArchiLogger . LogGenericError ( string . Format ( CultureInfo . CurrentCulture , Strings . WarningFailedWithError , Strings . ErrorAborted ) ) ;
2018-12-15 00:27:15 +01:00
2020-06-21 11:21:15 +02:00
return ( false , skippedSetsThisRound . Count > 0 ) ;
2018-12-09 18:08:14 +01:00
}
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
2020-08-22 21:41:01 +02:00
if ( triedSteamIDs . TryGetValue ( listedUser . SteamID , out ( byte Tries , ISet < ulong > ? GivenAssetIDs , ISet < ulong > ? ReceivedAssetIDs ) previousAttempt ) ) {
if ( ( previousAttempt . GivenAssetIDs = = null ) | | ( previousAttempt . ReceivedAssetIDs = = null ) | | ( itemsToGive . Select ( item = > item . AssetID ) . All ( previousAttempt . GivenAssetIDs . Contains ) & & itemsToReceive . Select ( item = > item . AssetID ) . All ( previousAttempt . ReceivedAssetIDs . Contains ) ) ) {
2018-12-05 23:13:55 +01:00
// This user didn't respond in our previous round, avoid him for remaining ones
triedSteamIDs [ listedUser . SteamID ] = ( byte . MaxValue , previousAttempt . GivenAssetIDs , previousAttempt . ReceivedAssetIDs ) ;
2018-12-15 00:27:15 +01:00
2018-12-05 23:13:55 +01:00
break ;
}
previousAttempt . GivenAssetIDs . UnionWith ( itemsToGive . Select ( item = > item . AssetID ) ) ;
previousAttempt . ReceivedAssetIDs . UnionWith ( itemsToReceive . Select ( item = > item . AssetID ) ) ;
} else {
previousAttempt . GivenAssetIDs = new HashSet < ulong > ( itemsToGive . Select ( item = > item . AssetID ) ) ;
previousAttempt . ReceivedAssetIDs = new HashSet < ulong > ( itemsToReceive . Select ( item = > item . AssetID ) ) ;
}
triedSteamIDs [ listedUser . SteamID ] = ( + + previousAttempt . Tries , previousAttempt . GivenAssetIDs , previousAttempt . ReceivedAssetIDs ) ;
2018-12-02 19:04:53 +01:00
Bot . ArchiLogger . LogGenericTrace ( Bot . SteamID + " <- " + string . Join ( ", " , itemsToReceive . Select ( item = > item . RealAppID + "/" + item . Type + "-" + item . ClassID + " #" + item . Amount ) ) + " | " + string . Join ( ", " , itemsToGive . Select ( item = > item . RealAppID + "/" + item . Type + "-" + item . ClassID + " #" + item . Amount ) ) + " -> " + listedUser . SteamID ) ;
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
2020-08-22 21:41:01 +02:00
( bool success , HashSet < ulong > ? mobileTradeOfferIDs ) = await Bot . ArchiWebHandler . SendTradeOffer ( listedUser . SteamID , itemsToGive , itemsToReceive , listedUser . TradeToken , true ) . ConfigureAwait ( false ) ;
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
2020-11-14 22:37:00 +01:00
if ( ( mobileTradeOfferIDs ? . Count > 0 ) & & Bot . HasMobileAuthenticator ) {
2021-04-21 22:44:47 +02:00
( bool twoFactorSuccess , _ , _ ) = await Bot . Actions . HandleTwoFactorAuthenticationConfirmations ( true , MobileAuthenticator . Confirmation . EType . Trade , mobileTradeOfferIDs , true ) . ConfigureAwait ( false ) ;
2019-01-23 17:58:37 +01:00
if ( ! twoFactorSuccess ) {
2018-12-02 19:04:53 +01:00
Bot . ArchiLogger . LogGenericTrace ( Strings . WarningFailed ) ;
2018-12-15 00:27:15 +01:00
2020-06-21 11:21:15 +02:00
return ( false , skippedSetsThisRound . Count > 0 ) ;
2018-12-02 19:04:53 +01:00
}
}
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
2018-12-02 19:04:53 +01:00
if ( ! success ) {
Bot . ArchiLogger . LogGenericTrace ( Strings . WarningFailed ) ;
2018-12-15 00:27:15 +01:00
2018-12-05 19:13:46 +01:00
break ;
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
}
2018-12-02 19:04:53 +01:00
2019-08-26 00:21:54 +02:00
// Add itemsToGive to theirInventory to reflect their current state if we're over MaxItemsPerTrade
theirInventory . UnionWith ( itemsToGive ) ;
2018-12-05 23:13:55 +01:00
skippedSetsThisUser . UnionWith ( skippedSetsThisTrade ) ;
2018-12-02 19:04:53 +01:00
Bot . ArchiLogger . LogGenericTrace ( Strings . Success ) ;
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
}
2018-12-02 19:04:53 +01:00
if ( skippedSetsThisUser . Count = = 0 ) {
2018-12-05 19:13:46 +01:00
if ( skippedSetsThisRound . Count = = 0 ) {
// If we didn't find any match on clean round, this user isn't going to have anything interesting for us anytime soon
2018-12-05 23:13:55 +01:00
triedSteamIDs [ listedUser . SteamID ] = ( byte . MaxValue , null , null ) ;
2018-12-05 19:13:46 +01:00
}
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
continue ;
}
2018-12-02 19:04:53 +01:00
skippedSetsThisRound . UnionWith ( skippedSetsThisUser ) ;
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
2019-02-02 22:54:23 +01:00
foreach ( ( uint RealAppID , Steam . Asset . EType Type , Steam . Asset . ERarity Rarity ) skippedSet in skippedSetsThisUser ) {
2019-08-26 00:21:54 +02:00
ourFullState . Remove ( skippedSet ) ;
ourTradableState . Remove ( skippedSet ) ;
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
}
2019-08-26 00:21:54 +02:00
if ( Trading . IsEmptyForMatching ( ourFullState , ourTradableState ) ) {
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
// User doesn't have any more dupes in the inventory
2018-11-29 19:21:41 +01:00
break ;
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
}
2018-12-09 18:08:14 +01:00
2019-08-26 00:21:54 +02:00
ourFullState . TrimExcess ( ) ;
ourTradableState . TrimExcess ( ) ;
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
}
2020-11-14 22:37:00 +01:00
Bot . ArchiLogger . LogGenericInfo ( string . Format ( CultureInfo . CurrentCulture , Strings . ActivelyMatchingItemsRound , skippedSetsThisRound . Count ) ) ;
2018-12-15 00:27:15 +01:00
2020-06-21 00:44:24 +02:00
// Keep matching when we either traded something this round (so it makes sense for a refresh) or if we didn't try all available bots yet (so it makes sense to keep going)
2020-06-21 11:21:15 +02:00
return ( ( totalMatches > 0 ) & & ( ( skippedSetsThisRound . Count > 0 ) | | triedSteamIDs . Values . All ( data = > data . Tries < 2 ) ) , skippedSetsThisRound . Count > 0 ) ;
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
}
2019-10-13 17:21:40 +02:00
[SuppressMessage("ReSharper", "ClassCannotBeInstantiated")]
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
private sealed class ListedUser {
2020-12-05 21:53:18 +01:00
#pragma warning disable CS0649
2020-06-21 00:06:17 +02:00
[JsonProperty(PropertyName = "items_count", Required = Required.Always)]
internal readonly ushort ItemsCount ;
2020-12-05 21:53:18 +01:00
#pragma warning restore CS0649
2020-06-21 00:06:17 +02:00
2020-11-14 22:37:00 +01:00
internal readonly HashSet < Steam . Asset . EType > MatchableTypes = new ( ) ;
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
2020-12-05 21:53:18 +01:00
#pragma warning disable CS0649
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
[JsonProperty(PropertyName = "steam_id", Required = Required.Always)]
internal readonly ulong SteamID ;
2020-12-05 21:53:18 +01:00
#pragma warning restore CS0649
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
[JsonProperty(PropertyName = "trade_token", Required = Required.Always)]
2020-12-05 20:27:10 +01:00
internal readonly string TradeToken = "" ;
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
internal float Score = > GamesCount / ( float ) ItemsCount ;
2020-12-05 21:53:18 +01:00
#pragma warning disable CS0649
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
[JsonProperty(PropertyName = "games_count", Required = Required.Always)]
private readonly ushort GamesCount ;
2020-12-05 21:53:18 +01:00
#pragma warning restore CS0649
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
internal bool MatchEverything { get ; private set ; }
[JsonProperty(PropertyName = "matchable_backgrounds", Required = Required.Always)]
private byte MatchableBackgroundsNumber {
set {
switch ( value ) {
case 0 :
MatchableTypes . Remove ( Steam . Asset . EType . ProfileBackground ) ;
2018-12-15 00:27:15 +01:00
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
break ;
case 1 :
MatchableTypes . Add ( Steam . Asset . EType . ProfileBackground ) ;
2018-12-15 00:27:15 +01:00
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
break ;
default :
2020-11-14 22:37:00 +01:00
ASF . ArchiLogger . LogGenericError ( string . Format ( CultureInfo . CurrentCulture , Strings . WarningUnknownValuePleaseReport , nameof ( value ) , value ) ) ;
2018-12-15 00:27:15 +01:00
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
return ;
}
}
}
[JsonProperty(PropertyName = "matchable_cards", Required = Required.Always)]
private byte MatchableCardsNumber {
set {
switch ( value ) {
case 0 :
MatchableTypes . Remove ( Steam . Asset . EType . TradingCard ) ;
2018-12-15 00:27:15 +01:00
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
break ;
case 1 :
MatchableTypes . Add ( Steam . Asset . EType . TradingCard ) ;
2018-12-15 00:27:15 +01:00
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
break ;
default :
2020-11-14 22:37:00 +01:00
ASF . ArchiLogger . LogGenericError ( string . Format ( CultureInfo . CurrentCulture , Strings . WarningUnknownValuePleaseReport , nameof ( value ) , value ) ) ;
2018-12-15 00:27:15 +01:00
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
return ;
}
}
}
[JsonProperty(PropertyName = "matchable_emoticons", Required = Required.Always)]
private byte MatchableEmoticonsNumber {
set {
switch ( value ) {
case 0 :
MatchableTypes . Remove ( Steam . Asset . EType . Emoticon ) ;
2018-12-15 00:27:15 +01:00
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
break ;
case 1 :
MatchableTypes . Add ( Steam . Asset . EType . Emoticon ) ;
2018-12-15 00:27:15 +01:00
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
break ;
default :
2020-11-14 22:37:00 +01:00
ASF . ArchiLogger . LogGenericError ( string . Format ( CultureInfo . CurrentCulture , Strings . WarningUnknownValuePleaseReport , nameof ( value ) , value ) ) ;
2018-12-15 00:27:15 +01:00
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
return ;
}
}
}
[JsonProperty(PropertyName = "matchable_foil_cards", Required = Required.Always)]
private byte MatchableFoilCardsNumber {
set {
switch ( value ) {
case 0 :
MatchableTypes . Remove ( Steam . Asset . EType . FoilTradingCard ) ;
2018-12-15 00:27:15 +01:00
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
break ;
case 1 :
MatchableTypes . Add ( Steam . Asset . EType . FoilTradingCard ) ;
2018-12-15 00:27:15 +01:00
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
break ;
default :
2020-11-14 22:37:00 +01:00
ASF . ArchiLogger . LogGenericError ( string . Format ( CultureInfo . CurrentCulture , Strings . WarningUnknownValuePleaseReport , nameof ( value ) , value ) ) ;
2018-12-15 00:27:15 +01:00
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
return ;
}
}
}
[JsonProperty(PropertyName = "match_everything", Required = Required.Always)]
private byte MatchEverythingNumber {
set {
switch ( value ) {
case 0 :
MatchEverything = false ;
2018-12-15 00:27:15 +01:00
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
break ;
case 1 :
MatchEverything = true ;
2018-12-15 00:27:15 +01:00
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
break ;
default :
2020-11-14 22:37:00 +01:00
ASF . ArchiLogger . LogGenericError ( string . Format ( CultureInfo . CurrentCulture , Strings . WarningUnknownValuePleaseReport , nameof ( value ) , value ) ) ;
2018-12-15 00:27:15 +01:00
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
return ;
}
}
}
2019-04-04 17:56:38 +02:00
[JsonConstructor]
private ListedUser ( ) { }
Implement ETradingPreferences.MatchActively
This will probably need a lot more tests, tweaking and bugfixing, but basic logic is:
- MatchActively added to TradingPreferences with value of 16
- User must also use SteamTradeMatcher, can't use MatchEverything
- User must have statistics enabled and be eligible for being listed (no requirement of having 100 items minimum)
Once all requirements are passed, statistics module will communicate with the listing and fetch match everything bots:
- The matching will start in 1h since ASF start and will repeat every day (right now it starts in 1 minute to aid debugging).
- Each matching is composed of up to 10 rounds maximum.
- In each round ASF will fetch our inventory and inventory of listed bots in order to find MatchableTypes items to be matched. If match is found, offer is being sent and confirmed automatically.
- Each set (composition of item type + appID it's from) can be matched in a single round only once, this is to minimize "items no longer available" as much as possible and also avoid a need to wait for each bot to react before sending all trades.
- Round ends when we try to match a total of 20 bots, or we hit no items to match in consecutive 10 tries with 10 different bots.
- If last round resulted in at least a single trade being sent, next round starts within 5 minutes since last one, otherwise matching ends and repeats the next day.
We'll see how it works in practice, expect a lot of follow-up commits, unless I won't have anything to fix or improve.
2018-11-29 18:35:58 +01:00
}
2016-12-04 01:07:37 +01:00
}
2018-09-08 00:46:40 +02:00
}