CSharpTradeOffers.Trading.EconServiceHandler.SendTradeOffer C# (CSharp) Метод

SendTradeOffer() публичный Метод

Sends a trade offer to the specified recipient.
public SendTradeOffer ( ulong partnerSid, string tradeoffermessage, string serverid, CSharpTradeOffers.Trading.TradeOffer offer, CookieContainer container ) : SendOfferResponse
partnerSid ulong The SteamId64 (ulong) of the person to send the offer to.
tradeoffermessage string An optional message to be sent with the offer. Can be null.
serverid string Almost always 1, not quite sure what other numbers do.
offer CSharpTradeOffers.Trading.TradeOffer A TradeOffer object containing the trade parameters.
container System.Net.CookieContainer Auth Cookies MUST be passed here, the function will fail if not.
Результат SendOfferResponse
        public SendOfferResponse SendTradeOffer(ulong partnerSid, string tradeoffermessage,
            string serverid, TradeOffer offer, CookieContainer container)
        {
            const string url = "https://steamcommunity.com/tradeoffer/new/send";
            container.Add(new Cookie("bCompletedTradeOfferTutorial", "true") { Domain = "steamcommunity.com" });
            string sessionid = (from Cookie cookie in container.GetCookies(new Uri("https://steamcommunity.com"))
                                where cookie.Name == "sessionid"
                                select cookie.Value).FirstOrDefault();

            var data = new Dictionary<string, string>
            {
                {"sessionid", sessionid},
                {"serverid", serverid},
                {"partner", partnerSid.ToString()},
                {"tradeoffermessage", tradeoffermessage},
                {"json_tradeoffer", JsonConvert.SerializeObject(offer)},
                {"captcha", string.Empty},
                {"trade_offer_create_params", "{}"}
            };
            return _web.Fetch(url, "POST", data, container, false,
                "https://steamcommunity.com/tradeoffer/new/?partner=" +
                IdConversions.UlongToAccountId(partnerSid), false, 10000, 20)
                .DeserializeJson<SendOfferResponse>();
        }