Exemplo n.º 1
0
        public IEnumerable <DirectOrder> GetMyOrders(bool bid = false)
        {
            //if (!DirectEve.HasSupportInstances())
            //{
            //    DirectEve.Log("DirectEve: Error: This method requires a support instance.");
            //    return null;
            //}

            var mq = DirectEve.GetLocalSvc("marketQuote");
            var mu = DirectEve.GetLocalSvc("marketutils");

            if (!IsReady)
            {
                return(null);
            }
            //IEnumerable<DirectOrder> orders = mq.Call("GetMyOrders").ToList().Select(o => new DirectOrder(this, o));
            if (!bid)
            {
                return
                    (PyWindow.Attribute("sr").Attribute("market").Attribute("sr").Attribute("myorders").Attribute("sr").Attribute("sellScroll").Attribute("sr").Attribute("entries").ToList().Select(o => new DirectOrder(DirectEve, o.Attribute("order"))));
            }
            else
            {
                return
                    (PyWindow.Attribute("sr").Attribute("market").Attribute("sr").Attribute("myorders").Attribute("sr").Attribute("buyScroll").Attribute("sr").Attribute("entries").ToList().Select(o => new DirectOrder(DirectEve, o.Attribute("order"))));
            }
        }
Exemplo n.º 2
0
        /// <summary>
        ///     Update quote information
        /// </summary>
        /// <returns></returns>
        public bool GetQuotes()
        {
            if (!NeedsQuote)
            {
                return(false);
            }

            return(DirectEve.ThreadedCall(PyWindow.Attribute("OnGetQoutes")));
        }
Exemplo n.º 3
0
        /// <summary>
        ///     Perform the actual reprocessing
        /// </summary>
        /// <returns></returns>
        public bool Reprocess()
        {
            if (NeedsQuote)
            {
                return(false);
            }

            return(DirectEve.ThreadedCall(PyWindow.Attribute("OnOK")));
        }
Exemplo n.º 4
0
 public bool RepairAll()
 {
     //if (!DirectEve.HasSupportInstances())
     //{
     //    DirectEve.Log("DirectEve: Error: This method requires a support instance.");
     //    return false;
     //}
     return(DirectEve.ThreadedCall(PyWindow.Attribute("RepairAll")));
 }
Exemplo n.º 5
0
        public bool Add(DirectItem item)
        {
            if (item.LocationId == -1)
            {
                return(false);
            }

            //This method instead of _AddItem to prevent quantity popup
            return(DirectEve.ThreadedCall(PyWindow.Attribute("sr").Attribute("my").Attribute("invController").Attribute("_BaseInvContainer__AddItem"), item.ItemId, item.LocationId, item.Quantity));
        }
Exemplo n.º 6
0
 internal DirectTradeWindow(DirectEve directEve, PyObject pyWindow)
     : base(directEve, pyWindow)
 {
     MyAccepted     = (int)PyWindow.Attribute("sr").Attribute("myAccept").Attribute("state") == 1;
     HerAccepted    = (int)PyWindow.Attribute("sr").Attribute("herAccept").Attribute("state") == 1;
     HerCharacterId = (int)PyWindow.Attribute("sr").Attribute("herinfo").Attribute("ownerID");
     HerName        = (string)PyWindow.Attribute("sr").Attribute("herinfo").Attribute("ownerName").ToUnicodeString();
     MyOfferedIsk   = (string)PyWindow.Attribute("sr").Attribute("myMoney").Attribute("text").ToUnicodeString();
     HerOfferedIsk  = (string)PyWindow.Attribute("sr").Attribute("herMoney").Attribute("text").ToUnicodeString();
 }
Exemplo n.º 7
0
        //private DirectEve DirectEve;

        internal DirectContainerWindow(DirectEve directEve, PyObject pyWindow)
            : base(directEve, pyWindow)
        {
            //IsReady = (bool) pyWindow.Attribute("startedUp");
            IsOneWay      = (bool)pyWindow.Attribute("oneWay");
            ItemId        = (long)pyWindow.Attribute("itemID");
            LocationFlag  = (int)pyWindow.Attribute("locationFlag");
            HasCapacity   = (bool)pyWindow.Attribute("hasCapacity");
            currInvIdName = (string)PyWindow.Attribute("currInvID").ToList().First();
            currInvIdItem = (long)PyWindow.Attribute("currInvID").ToList().Last();
        }
Exemplo n.º 8
0
        public bool RepairItems(List <DirectItem> items)
        {
            //if (!DirectEve.HasSupportInstances())
            //{
            //    DirectEve.Log("DirectEve: Error: This method requires a support instance.");
            //    return false;
            //}
            var PyItems = items.Select(i => i.PyItem);

            return(DirectEve.ThreadedCall(PyWindow.Attribute("DisplayRepairQuote"), PyItems));
        }
Exemplo n.º 9
0
        internal DirectScannerWindow(DirectEve directEve, PyObject pyWindow)
            : base(directEve, pyWindow)
        {
            var charId            = DirectEve.Session.CharacterId;
            var obj               = PyWindow.Attribute("busy");
            var analyseBtnEnabled = (bool)pyWindow.Attribute("sr").Attribute("analyzeBtn").Attribute("enabled");

            //Log("obj type = " + obj.GetPyType().ToString());
            //Log("obj value = " + ((bool) obj).ToString());
            IsReady = charId != null && obj.IsValid && (bool)obj == false && analyseBtnEnabled;
        }
Exemplo n.º 10
0
        /// <summary>
        ///     Start a system scan; i.e. click the Analyze button.
        /// </summary>
        /// <returns>false if scan already running.  true if new scan was started</returns>
        public bool Analyze()
        {
            // only perform a scan for paid users
            var scanningProbes = PySharp.Import("__builtin__").Attribute("sm").Attribute("services").DictionaryItem("scanSvc").Attribute("scanHandler").Attribute("scanningProbes");

            // Check for an active scan.  If we call Analyze while a scan is running Eve will throw an exception
            if (scanningProbes.IsValid == false)
            {
                _systemScanResults = null; // free old results
                return(DirectEve.ThreadedCall(PyWindow.Attribute("Analyze")));
            }


            return(false);
        }
Exemplo n.º 11
0
        /// <summary>
        ///     Select the tree entry with the given name and ID
        /// </summary>
        /// <param name="entryName"></param>
        /// <param name="entryID"></param>
        /// <returns></returns>
        public bool SelectTreeEntry(string entryName, long entryID)
        {
            var dict  = PyWindow.Attribute("treeEntryByID").ToDictionary();
            var entry = dict.Where(d => (string)d.Key.ToList().First() == entryName && (long)d.Key.ToList().Last() == entryID);

            if (entry == null)
            {
                return(false);
            }
            if (entry.Count() != 1)
            {
                return(false);
            }

            return(DirectEve.ThreadedCall(PyWindow.Attribute("OpenOrShow"), entry.First().Key));
        }
Exemplo n.º 12
0
        public string AvgDamage()
        {
            //if (!DirectEve.HasSupportInstances())
            //{
            //    DirectEve.Log("DirectEve: Error: This method requires a support instance.");
            //    return null;
            //}

            try
            {
                return((string)PyWindow.Attribute("sr").Attribute("avgDamage").Attribute("text"));
            }
            catch
            {
                return("");
            }
        }
Exemplo n.º 13
0
        public bool LoadOrders()
        {
            //if (!DirectEve.HasSupportInstances())
            //{
            //    DirectEve.Log("DirectEve: Error: This method requires a support instance.");
            //    return false;
            //}

            var mu = DirectEve.GetLocalSvc("marketutils");
            var mq = DirectEve.GetLocalSvc("marketQuote");

            if (!IsReady)
            {
                return(false);
            }
            return(DirectEve.ThreadedCall(PyWindow.Attribute("sr").Attribute("market").Attribute("LoadOrders")));
            //return ThreadedLocalSvcCall("marketQuote", "RefreshOrderCache");
        }
Exemplo n.º 14
0
        /// <summary>
        ///     Expand the tree entry with the given name and ID
        /// </summary>
        /// <param name="entryName"></param>
        /// <returns></returns>
        internal bool ExpandTreeEntry(string entryName)
        {
            var dict  = PyWindow.Attribute("treeEntryByID").ToDictionary();
            var entry = dict.Where(d => (string)d.Key.ToList().First() == entryName);

            if (entry == null)
            {
                return(false);
            }
            if (entry.Count() != 1)
            {
                return(false);
            }

            entry.First().Value.Call("ExpandFromRoot");
            PyWindow.Call("RefreshTree");

            return(true);
        }
Exemplo n.º 15
0
        /// <summary>
        ///     Close the tree entry with the given ID
        /// </summary>
        /// <param name="entryID"></param>
        /// <returns></returns>
        public bool CloseTreeEntry(long entryID)
        {
            var dict  = PyWindow.Attribute("treeEntryByID").ToDictionary();
            var entry = dict.Where(d => (long)d.Key.ToList().Last() == entryID);

            if (entry == null)
            {
                return(false);
            }
            if (entry.Count() != 1)
            {
                return(false);
            }


            //can NOT do threaded calls because these need to be executed in order
            PyWindow.Call("RemoveTreeEntry", entry.First().Value);
            PyWindow.Call("RefreshTree");
            return(true);
        }
Exemplo n.º 16
0
        /// <summary>
        ///     Open the current container view in a new window
        /// </summary>
        /// <returns></returns>
        public bool OpenAsSecondary()
        {
            var invID = PyWindow.Attribute("currInvID");
            //check if it's already open, in that case do nothing.
            var windows       = DirectEve.Windows.OfType <DirectContainerWindow>();
            var lookForInvID  = (string)invID.ToList().First();
            var alreadyOpened = windows.FirstOrDefault(w => w.Name.Contains(lookForInvID) && !w.IsPrimary());

            if (alreadyOpened != null)
            {
                return(true);
            }


            var form     = PySharp.Import("form");
            var keywords = new Dictionary <string, object>();

            keywords.Add("invID", invID);
            keywords.Add("usePrimary", false);
            return(DirectEve.ThreadedCallWithKeywords(form.Attribute("Inventory").Attribute("OpenOrShow"), keywords));
        }
Exemplo n.º 17
0
        /// <summary>
        ///     Get a list of IDs as longs associated with each entry of a inventory tree
        /// </summary>
        /// <param name="itemsOnly">only look for wrecks and containers</param>
        /// <returns>List of IDs of the inventory tree</returns>
        public List <long> GetIdsFromTree(bool itemsOnly = true)
        {
            var dict   = PyWindow.Attribute("treeEntryByID").ToDictionary();
            var result = new List <long>();

            foreach (var treeItem in dict.Keys)
            {
                var invIDName = (string)treeItem.ToList().First();
                var invID     = (long)treeItem.ToList().Last();
                if (itemsOnly)
                {
                    if (invIDName.Contains("Item"))
                    {
                        result.Add(invID);
                    }
                }
                else
                {
                    result.Add(invID);
                }
            }
            return(result);
        }
Exemplo n.º 18
0
 public bool Speak(string message)
 {
     PyWindow.Attribute("input").Call(("SetValue"), message);
     return(DirectEve.ThreadedCall(PyWindow.Attribute("InputKeyUp")));
 }
Exemplo n.º 19
0
 /// <summary>
 ///     Add bookmarks to this container window
 /// </summary>
 /// <param name="bookmarkIds"></param>
 /// <returns></returns>
 public bool AddBookmarks(IEnumerable <long> bookmarkIds)
 {
     return(DirectEve.ThreadedCall(PyWindow.Attribute("AddBookmarks"), bookmarkIds));
 }
Exemplo n.º 20
0
 /// <summary>
 ///     Selects the previous tab
 /// </summary>
 /// <returns>true if successful, false otherwise</returns>
 public bool PrevTab()
 {
     return(DirectEve.ThreadedCall(PyWindow.Attribute("sr").Attribute("tabs").Attribute("SelectPrev")));
 }
Exemplo n.º 21
0
 /// <summary>
 ///     Performs a directional scan
 /// </summary>
 /// <returns>true if successful, false otherwise</returns>
 public bool DirectionSearch()
 {
     _scanResults = null; // free old results
     return(DirectEve.ThreadedCall(PyWindow.Attribute("DirectionSearch")));
 }
Exemplo n.º 22
0
 public bool ToggleAccept()
 {
     return(DirectEve.ThreadedCall(PyWindow.Attribute("OnClickAccept")));
 }
Exemplo n.º 23
0
 /// <summary>
 ///     Cancel the action
 /// </summary>
 /// <returns></returns>
 public bool Cancel()
 {
     return(DirectEve.ThreadedCall(PyWindow.Attribute("Cancel")));
 }
Exemplo n.º 24
0
        /// <summary>
        ///     Accept the action
        /// </summary>
        /// <returns></returns>
        public bool Accept()
        {
            var call = IsBuyAction ? "Buy" : "Sell";

            return(DirectEve.ThreadedCall(PyWindow.Attribute(call)));
        }
Exemplo n.º 25
0
 /// <summary>
 ///     Returns the selected tab index
 /// </summary>
 /// <returns>the tab index</returns>
 public int GetSelectedIdx()
 {
     return((int)PyWindow.Attribute("sr").Attribute("tabs").Call("GetSelectedIdx"));
 }
Exemplo n.º 26
0
 public bool LoadTypeId(int typeId)
 {
     return(DirectEve.ThreadedCall(PyWindow.Attribute("LoadTypeID_Ext"), typeId));
 }
Exemplo n.º 27
0
 public bool OfferMoney(double amount)
 {
     return(DirectEve.ThreadedCall(PyWindow.Attribute("tradeSession").Attribute("OfferMoney"), amount));
 }
Exemplo n.º 28
0
 /// <summary>
 ///     Selects a tab by index
 /// </summary>
 /// <returns>true if successful, false otherwise</returns>
 public bool SelectByIdx(int tab)
 {
     return(DirectEve.ThreadedCall(PyWindow.Attribute("sr").Attribute("tabs").Attribute("SelectByIdx"), tab));
 }