Beispiel #1
0
        //Will Not Work until MenuLength is restored and a resource parsing method restored.
        public bool TraverseMenu(String address)
        {
            GotoMenu(address);
            Thread.Sleep((int)CampahStatus.Instance.GlobalDelay);
            if (FFACEInstance.Instance.Menu.Selection == "Bid")
            {
                return(true);
            }
            int max = AuctionHouse.MenuLength;

            for (int i = 1; i <= max; i++)
            {
                if (TraverseMenu(address + "," + i))
                {
                    int[] ids = ReadAHItems();
                    foreach (int id in ids)
                    {
                        var item = new AhItem(id, id.ToString(CultureInfo.InvariantCulture), false, address + "," + i);
                        if ((item = AuctionHouse.Add(item)) != null)
                        {
                            item.Stackable = true;
                        }
                    }
                    AuctionHouse.MenuIndex = 1;
                }
            }
            return(false);
        }
Beispiel #2
0
 public bool LoadBidList(string file)
 {
     try
     {
         if (!File.Exists(file))
         {
             return(false);
         }
         var xDoc = new XmlDocument();
         xDoc.Load(file);
         XmlNodeList items;
         items = xDoc.GetElementsByTagName("item");
         RunningData.Instance.BidList.Clear();
         foreach (XmlNode item in items)
         {
             int    minimum;
             int    maximum;
             int    increment;
             int    quantity;
             bool   stack;
             string name = item.Attributes["name"].Value;
             if (!int.TryParse(item.Attributes["minimum"].Value, out minimum))
             {
                 return(false);
             }
             if (!int.TryParse(item.Attributes["maximum"].Value, out maximum))
             {
                 return(false);
             }
             if (!int.TryParse(item.Attributes["increment"].Value, out increment))
             {
                 return(false);
             }
             if (!int.TryParse(item.Attributes["quantity"].Value, out quantity))
             {
                 return(false);
             }
             if (!bool.TryParse(item.Attributes["stack"].Value, out stack))
             {
                 return(false);
             }
             AhItem reqitem = AuctionHouse.GetItem(name);//items[name.ToLower()];
             if (reqitem == null)
             {
                 return(false);
             }
             RunningData.Instance.BidList.Add(new ItemRequest(minimum, maximum, increment, quantity, stack, reqitem));
         }
         CampahStatus.Instance.CurrentPath = file;
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Beispiel #3
0
        private int[] ReadAHItems()
        {
            int loaded = -1;

            CampahStatus.SetStatus("Waiting for items to load...");
            Thread.Sleep((int)CampahStatus.Instance.GlobalDelay * 4);
            while (loaded != AuctionHouse.LoadedCount)
            {
                loaded = AuctionHouse.LoadedCount;
                Thread.Sleep((int)CampahStatus.Instance.GlobalDelay * 2);
            }
            CampahStatus.SetStatus("Reading item list...");
            return(AuctionHouse.ReadIDArray());
        }
Beispiel #4
0
 private void ButtonAddBuyItemClick(object sender, RoutedEventArgs e)
 {
     if (string.IsNullOrEmpty(TbBuyItemSelect.Text))
     {
         return;
     }
     if ((AuctionHouse.GetItem(TbBuyItemSelect.Text.Trim())) != null)
     {
         try
         {
             RunningData.Instance.BidList.Add(new ItemRequest((int)nb_minBid.Value, (int)nb_maxBid.Value, (int)nb_bidInc.Value, (int)nb_quantity.Value, cb_stackable.IsChecked != null && (bool)cb_stackable.IsChecked, AuctionHouse.GetItem(TbBuyItemSelect.Text)));
             RunningData.Instance.CalculateProjectedCost();
         }
         catch
         {
             CampahStatus.Instance.Status = "Invalid item selections, item not added.";
         }
     }
     else
     {
         CampahStatus.Instance.Status = "Invalid item name, item not added.";
     }
 }
Beispiel #5
0
        public void loadAHResourcesXML()
        {
            if (!File.Exists("ahresources.xml"))
            {
                MessageBox.Show("Error! The file ahresources.xml was not found.\r\nCreate a new ahresources by moving your character near an\r\nauction house and pressing the \"Create New AH Resources\" button in Campah Settings.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            XmlDocument xDoc = new XmlDocument();

            xDoc.Load("ahresources.xml");
            XmlNodeList items;

            items = xDoc.GetElementsByTagName("item");
            AuctionHouse.Items.Clear();
            foreach (XmlNode item in items)
            {
                AuctionHouse.Add(new AhItem(int.Parse(item.Attributes["id"].Value, NumberStyles.HexNumber),
                                            item.Attributes["name"].Value,
                                            bool.Parse(item.Attributes["stackable"].Value),
                                            item.Attributes["address"].Value));
            }
            populateAutoCompleteTB(AuctionHouse.Items.Keys.ToArray());
        }
Beispiel #6
0
        private void LookupPriceXiAh()
        {
            AhItem item;
            var    price = -1;

            if ((item = AuctionHouse.GetItem(RunningData.Instance.CurrentItemText.Trim())) != null)
            {
                CampahStatus.SetStatus("Looking up price for " + item.Name + "...");
                this.Dispatcher.BeginInvoke(new ChangeTagDelegate(SetMaxBidTag), new object[] { true });
                int sid;
                try
                {
                    sid = FFACEInstance.Instance.Player.GetSID;
                }
                catch
                {
                    CampahStatus.SetStatus("Unable to resolve player server, using default server. Requires FFACE v4.0.1.18");
                    sid = 0;
                }
                price = FFXIAH.LookupMedian(item.ID, sid + 1,
                                            (RunningData.Instance.CurrentItemStackable && item.Stackable), CampahStatus.Instance.WebTimeout);
            }
            if (price > -1)
            {
                if (_lastlookupitem.Key == item && _lastlookupitem.Value == RunningData.Instance.CurrentItemStackable)
                {
                    Dispatcher.BeginInvoke(new ChangeMinIncDelegate(SetMinInc), new object[] { price });
                }
                else
                {
                    CampahStatus.SetStatus("Current median price for " + item.Name + " is " + price + "g.");
                    Dispatcher.BeginInvoke(new ChangeMaxDelegate(SetMaxBid), new object[] { price });
                }
            }
            _lastlookupitem = new KeyValuePair <AhItem, bool>(item, RunningData.Instance.CurrentItemStackable);
            Dispatcher.BeginInvoke(new ChangeTagDelegate(SetMaxBidTag), new object[] { false });
        }