mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2025-12-16 22:40:30 +00:00
Add support for activated games names
This commit is contained in:
@@ -24,6 +24,8 @@
|
|||||||
|
|
||||||
using SteamKit2;
|
using SteamKit2;
|
||||||
using SteamKit2.Internal;
|
using SteamKit2.Internal;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
namespace ArchiSteamFarm {
|
namespace ArchiSteamFarm {
|
||||||
internal sealed class ArchiHandler : ClientMsgHandler {
|
internal sealed class ArchiHandler : ClientMsgHandler {
|
||||||
@@ -42,14 +44,21 @@ namespace ArchiSteamFarm {
|
|||||||
|
|
||||||
internal EResult Result { get; private set; }
|
internal EResult Result { get; private set; }
|
||||||
internal EPurchaseResult PurchaseResult { get; private set; }
|
internal EPurchaseResult PurchaseResult { get; private set; }
|
||||||
internal int ErrorCode { get; private set; }
|
internal KeyValue ReceiptInfo { get; private set; }
|
||||||
internal byte[] ReceiptInfo { get; private set; }
|
internal HashSet<string> Items { get; private set; } = new HashSet<string>();
|
||||||
|
|
||||||
internal PurchaseResponseCallback(CMsgClientPurchaseResponse body) {
|
internal PurchaseResponseCallback(CMsgClientPurchaseResponse body) {
|
||||||
Result = (EResult) body.eresult;
|
Result = (EResult) body.eresult;
|
||||||
ErrorCode = body.purchase_result_details;
|
PurchaseResult = (EPurchaseResult) body.purchase_result_details;
|
||||||
ReceiptInfo = body.purchase_receipt_info;
|
|
||||||
PurchaseResult = (EPurchaseResult) ErrorCode;
|
ReceiptInfo = new KeyValue();
|
||||||
|
using (MemoryStream ms = new MemoryStream(body.purchase_receipt_info)) {
|
||||||
|
if (ReceiptInfo.TryReadAsBinary(ms)) {
|
||||||
|
foreach (KeyValue lineItem in ReceiptInfo["lineitems"].Children) {
|
||||||
|
Items.Add(lineItem["ItemDescription"].AsString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -594,7 +594,8 @@ namespace ArchiSteamFarm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var purchaseResult = callback.PurchaseResult;
|
var purchaseResult = callback.PurchaseResult;
|
||||||
SendMessageToUser(SteamMasterID, "Status: " + purchaseResult);
|
var items = callback.Items;
|
||||||
|
SendMessageToUser(SteamMasterID, "Status: " + purchaseResult + " | Items: " + string.Join(", ", items));
|
||||||
|
|
||||||
if (purchaseResult == ArchiHandler.PurchaseResponseCallback.EPurchaseResult.OK) {
|
if (purchaseResult == ArchiHandler.PurchaseResponseCallback.EPurchaseResult.OK) {
|
||||||
await CardsFarmer.StartFarming().ConfigureAwait(false);
|
await CardsFarmer.StartFarming().ConfigureAwait(false);
|
||||||
|
|||||||
Reference in New Issue
Block a user