示例#1
0
        //

        /// <summary>
        /// Проверяем, есть ли предметы в уведомлениях, которые нужно добавить в покупки
        /// </summary>
        public void CheckNotifications()
        {
            try
            {
                int i   = 0;
                var ans = CLIENT1.GetNotifications(cfg.key);
                if (ans != null && ans.success)
                {
                    foreach (var itm in ans.Notifications)
                    {
                        var haveInItems = Items.Find(item => item.id == itm.i_classid + "_" + itm.i_instanceid);
                        if (haveInItems == null)
                        {
                            AddItem("https://market.csgo.com/item/" + itm.i_classid + "-" + itm.i_instanceid, Convert.ToInt32(itm.n_val) / 100, PriceCheck.Notification);
                            i++;
                        }
                    }
                    if (i != 0)
                    {
                        WriteMessage($"Добавлено {i} предметов", MessageType.Info);
                    }
                }
            }
            catch
            {
            }
        }
示例#2
0
        /// <summary>
        /// Говорим сайту что мы онлайн и проверям быстрые покупки
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void PingPongTimer(object sender, ElapsedEventArgs e)
        {
            CLIENT.Ping(cfg.key);
            //
            client.Send("PING");
            //проверка быстрых покупок
            QuickOrderAction.Invoke();

            if (autoConfirmTrades)
            {
                var info = CLIENT1.CountItemsToTransfer(cfg.key);
                if (info?.getCount > 0)
                {
                    tradeWorker.AcceptTrade(TypeTrade.OUT);
                }
                if (info?.outCount > 0)
                {
                    tradeWorker.AcceptTrade(TypeTrade.IN);
                }
            }
        }
示例#3
0
        /// <summary>
        /// Обновление цен и проверка обменов
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void PriceCorrectTimer(object sender, ElapsedEventArgs e)
        {
            WriteMessage("Таймер", MessageType.Timer);

            //выставитьToolStripMenuItem_Click(sender, e);
            UpdatePriceDelegateAction.BeginInvoke(CallbackUpdater, null);

            if (autoConfirmTrades)
            {
                var info = CLIENT1.CountItemsToTransfer(cfg.key);
                if (info?.getCount > 0)
                {
                    tradeWorker.AcceptTrade(TypeTrade.OUT);
                }
                if (info?.outCount > 0)
                {
                    tradeWorker.AcceptTrade(TypeTrade.IN);
                }
                //AcceptTradeAction.Invoke();
                //AcceptMobileOrdersAction.Invoke();
            }
        }
示例#4
0
        /// <summary>
        /// Обновление цен
        /// </summary>
        void CorrectPrice()
        {
            try
            {
                double Averange, MinPrice, Discount, Cost;
                Discount = 1 - Convert.ToDouble(cfg.discount / 100);
                foreach (Itm I in Items)
                {
                    //Если предмет добавлен с уведомлений, то его цену прверяем в списке уведомлений
                    if (I.priceCheck == PriceCheck.Notification)
                    {
                        var ans = CLIENT1.GetNotifications(cfg.key);
                        if (ans != null && ans.success)
                        {
                            var item = ans.Notifications.Find(fi => fi.i_classid + "_" + fi.i_instanceid == I.id);
                            if (item != null)
                            {
                                I.price = Convert.ToInt32(item.n_val) / 100.0;
                            }
                        }
                    }
                    else
                    {
                        //проверяем остальные вещи

                        Thread.Sleep(cfg.Itimer);
                        // new System.Action(() => Console.Write("\r{0}/{1} ", ++count, Items.Count)).BeginInvoke(null, null);

                        MinPrice = Convert.ToDouble(CLIENT.GetMinPrice(I, cfg.key));

                        if (MinPrice == -1)
                        {
                            MinPrice = Convert.ToDouble(CLIENT.GetMinPrice(I, cfg.key));
                            if (MinPrice == -1)
                            {
                                continue;
                            }
                        }

                        Averange = Convert.ToDouble(CLIENT.GetAverangePrice(I, cfg.key));

                        if (Averange < MinPrice)
                        {
                            Cost = Averange;
                        }
                        else
                        {
                            Cost = MinPrice;
                        }

                        //если у предмета выставлена персональная прибыль, то используем ее, а не общую
                        double profit;
                        if (I.profit != 0)
                        {
                            profit = I.profit;
                        }
                        else
                        {
                            profit = cfg.price;
                        }

                        if (Cost > 20000)
                        {
                            I.price = Math.Round((Cost * Discount - profit * 2) / 100.0, 2);
                            continue;
                        }
                        if (Cost > 10000)
                        {
                            I.price = Math.Round((Cost * Discount - profit) / 100.0, 2);
                            continue;
                        }
                        else
                        {
                            I.price = Math.Round((Cost * Discount - profit) / 100.0, 2);
                            continue;
                        }
                    }
                }

                WriteMessage("Обновлены цены", MessageType.Info);
            }
            catch (Exception ex)
            {
                WriteMessage(string.Format("[CorrectPrice] {0}", ex.Message), MessageType.Error);
            }
        }
示例#5
0
        public void MassUpdate()
        {
            try
            {
                string data = "";
                foreach (var itm in Items)
                {
                    data += itm.id + ",";
                }
                data = data.Remove(data.Length - 1);
                var ans = CLIENT1.MassInfo(cfg.key, data);

                if (ans?.Success == true)
                {
                    foreach (var itm in ans.Results)
                    {
                        double Averange, MinPrice, Discount, Cost;
                        Discount = 1 - Convert.ToDouble(cfg.discount / 100);

                        var id         = itm.Classid + "_" + itm.Instanceid;
                        var FindedItem = Items.Find(item => item.id == id);

                        MinPrice = itm.SellOffers.BestOffer;

                        Averange = Convert.ToDouble(CLIENT.GetAverangePrice(FindedItem, cfg.key));

                        if (Averange < MinPrice)
                        {
                            Cost = Averange;
                        }
                        else
                        {
                            Cost = MinPrice;
                        }

                        //если у предмета выставлена персональная прибыль, то используем ее, а не общую
                        double profit;
                        if (FindedItem.profit != 0)
                        {
                            profit = FindedItem.profit;
                        }
                        else
                        {
                            profit = cfg.price;
                        }

                        if (Cost > 20000)
                        {
                            FindedItem.price = Math.Round((Cost * Discount - profit * 2) / 100.0, 2);
                            continue;
                        }
                        if (Cost > 10000)
                        {
                            FindedItem.price = Math.Round((Cost * Discount - profit) / 100.0, 2);
                            continue;
                        }
                        else
                        {
                            FindedItem.price = Math.Round((Cost * Discount - profit) / 100.0, 2);
                            continue;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                WriteMessage("MassUpdate: " + ex.Message, MessageType.Error);
            }
        }