Mark inventory after item drops, #130

Mark is untested yet
This commit is contained in:
JustArchi
2016-02-28 03:40:59 +01:00
parent 75ff6b4f11
commit 6a6232b655
3 changed files with 54 additions and 3 deletions

View File

@@ -41,9 +41,11 @@ namespace ArchiSteamFarm {
internal sealed class NotificationsCallback : CallbackMsg {
internal sealed class Notification {
internal enum ENotificationType {
internal enum ENotificationType : uint {
Unknown = 0,
Trading = 1,
// Only custom below, different than ones available as user_notification_type
Items = 514
}
internal ENotificationType NotificationType { get; set; }
@@ -65,6 +67,17 @@ namespace ArchiSteamFarm {
});
}
}
internal NotificationsCallback(JobID jobID, CMsgClientItemAnnouncements msg) {
JobID = jobID;
if (msg == null) {
return;
}
Notifications = new List<Notification>();
Notifications.Add(new Notification { NotificationType = Notification.ENotificationType.Items });
}
}
internal sealed class OfflineMessageCallback : CallbackMsg {
@@ -233,6 +246,9 @@ namespace ArchiSteamFarm {
case EMsg.ClientFSOfflineMessageNotification:
HandleFSOfflineMessageNotification(packetMsg);
break;
case EMsg.ClientItemAnnouncements:
HandleItemAnnouncements(packetMsg);
break;
case EMsg.ClientPurchaseResponse:
HandlePurchaseResponse(packetMsg);
break;
@@ -251,6 +267,15 @@ namespace ArchiSteamFarm {
Client.PostCallback(new OfflineMessageCallback(packetMsg.TargetJobID, response.Body));
}
private void HandleItemAnnouncements(IPacketMsg packetMsg) {
if (packetMsg == null) {
return;
}
var response = new ClientMsgProtobuf<CMsgClientItemAnnouncements>(packetMsg);
Client.PostCallback(new NotificationsCallback(packetMsg.TargetJobID, response.Body));
}
private void HandlePurchaseResponse(IPacketMsg packetMsg) {
if (packetMsg == null) {
return;