Make OtherSteamID64 less costly

This commit is contained in:
JustArchi
2015-10-31 03:50:08 +01:00
parent 411f796fab
commit 2545e7bbf3
5 changed files with 14 additions and 9 deletions

View File

@@ -74,13 +74,13 @@ namespace ArchiSteamFarm {
foreach (HtmlNode badgesPageNode in badgesPageNodes) {
string steamLink = badgesPageNode.GetAttributeValue("href", null);
if (steamLink == null) {
Logging.LogGenericWarning(Bot.BotName, "Couldn't get steamLink for one of the games: " + badgesPageNode.OuterHtml);
Logging.LogGenericError(Bot.BotName, "Couldn't get steamLink for one of the games: " + badgesPageNode.OuterHtml);
continue;
}
uint appID = (uint) Utilities.OnlyNumbers(steamLink);
if (appID == 0) {
Logging.LogGenericWarning(Bot.BotName, "Couldn't get appID for one of the games: " + badgesPageNode.OuterHtml);
Logging.LogGenericError(Bot.BotName, "Couldn't get appID for one of the games: " + badgesPageNode.OuterHtml);
continue;
}

View File

@@ -55,9 +55,14 @@ namespace ArchiSteamFarm {
internal bool from_real_time_trade { get; set; }
// Extra
private ulong _OtherSteamID64 = 0;
internal ulong OtherSteamID64 {
get { // This is quite costly, consider getting only once
return new SteamID((uint) accountid_other, EUniverse.Public, EAccountType.Individual).ConvertToUInt64();
get {
if (_OtherSteamID64 == 0 && accountid_other != 0) {
_OtherSteamID64 = new SteamID((uint) accountid_other, EUniverse.Public, EAccountType.Individual).ConvertToUInt64();
}
return _OtherSteamID64;
}
}
}

View File

@@ -75,11 +75,11 @@ namespace ArchiSteamFarm {
return;
}
ulong steamID = tradeOffer.OtherSteamID64;
ulong otherSteamID = tradeOffer.OtherSteamID64;
bool success = false;
bool tradeAccepted = false;
if (tradeOffer.items_to_give.Count == 0 || steamID == Bot.SteamMasterID) {
if (tradeOffer.items_to_give.Count == 0 || otherSteamID == Bot.SteamMasterID) {
tradeAccepted = true;
success = await Bot.ArchiWebHandler.AcceptTradeOffer(tradeID).ConfigureAwait(false);
} else {

View File

@@ -5,7 +5,7 @@
<!-- Master switch to turn account on and off, set to "true" after you're done -->
<!-- TIP: This bot instance won't run unless below switch is set to "true" -->
<Enabled type="bool" value="true"/>
<Enabled type="bool" value="false"/>
<!-- This is your steam login, the one you use for logging in to steam -->
<!-- TIP: You can use "null" if you wish to enter login on every startup -->