From 1a6c5a3cff6804c36774d1e15e4c655173857e79 Mon Sep 17 00:00:00 2001 From: JustArchi Date: Fri, 10 Jun 2016 01:16:05 +0200 Subject: [PATCH] Fix trades with non-steam items --- ArchiSteamFarm/ArchiHandler.cs | 2 -- ArchiSteamFarm/ArchiWebHandler.cs | 21 +++++++++++++++++++-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/ArchiSteamFarm/ArchiHandler.cs b/ArchiSteamFarm/ArchiHandler.cs index 2313d2a80..0f1da730b 100644 --- a/ArchiSteamFarm/ArchiHandler.cs +++ b/ArchiSteamFarm/ArchiHandler.cs @@ -77,7 +77,6 @@ namespace ArchiSteamFarm { Notifications = new HashSet(); foreach (CMsgClientUserNotifications.Notification notification in msg.notifications) { - Logging.LogGenericDebug("Pushed new notification: " + notification.user_notification_type); Notifications.Add((ENotification) notification.user_notification_type); } } @@ -90,7 +89,6 @@ namespace ArchiSteamFarm { JobID = jobID; if (msg.count_new_items > 0) { - Logging.LogGenericDebug("Pushed new items notification"); Notifications = new HashSet { ENotification.Items }; } } diff --git a/ArchiSteamFarm/ArchiWebHandler.cs b/ArchiSteamFarm/ArchiWebHandler.cs index fbbfe6685..049c8c40a 100644 --- a/ArchiSteamFarm/ArchiWebHandler.cs +++ b/ArchiSteamFarm/ArchiWebHandler.cs @@ -62,7 +62,6 @@ namespace ArchiSteamFarm { int index = hashName.IndexOf('-'); if (index < 1) { - Logging.LogNullError(nameof(index)); return 0; } @@ -370,13 +369,18 @@ namespace ArchiSteamFarm { } uint appID = 0; - Steam.Item.EType type = Steam.Item.EType.Unknown; string hashName = description["market_hash_name"].Value; if (!string.IsNullOrEmpty(hashName)) { appID = GetAppIDFromMarketHashName(hashName); } + if (appID == 0) { + appID = (uint) description["appid"].AsUnsignedLong(); + } + + Steam.Item.EType type = Steam.Item.EType.Unknown; + string descriptionType = description["type"].Value; if (!string.IsNullOrEmpty(descriptionType)) { type = GetItemType(descriptionType); @@ -539,6 +543,19 @@ namespace ArchiSteamFarm { appID = GetAppIDFromMarketHashName(hashName); } + if (appID == 0) { + string appIDString = description["appid"].ToString(); + if (string.IsNullOrEmpty(appIDString)) { + Logging.LogNullError(nameof(appIDString), Bot.BotName); + continue; + } + + if (!uint.TryParse(appIDString, out appID)) { + Logging.LogNullError(nameof(appID), Bot.BotName); + continue; + } + } + Steam.Item.EType type = Steam.Item.EType.Unknown; string descriptionType = description["type"].ToString();