Beispiel #1
0
        private void BidOnItem(ItemRequest item)
        {
            if (EliteAPIInstance.Instance.Inventory.GetContainerMaxCount(0) == EliteAPIInstance.Instance.Inventory.GetContainerCount(0))
                StopBuying("Inventory Full");
            if (item.BoughtCount >= item.Quantity)
                return;
            {
                string strstack = ".";
                if (item.Stack)
                    strstack = " stack.";
                CampahStatus.Instance.Status = "Finding item: " + item.ItemData.Name + strstack;
            }
            if (!GotoMenu(item.ItemData.Address))
            {
                GotoBidMenu();
                return;
            }
            Thread.Sleep((int)CampahStatus.Instance.GlobalDelay);
            int[] ids = ReadAHItems();
            if (ids.Length < 3 || ids[0] == ids[2])
            {
                //StopBuying("Error! AH item array could not be read. Try zoning or logging out");
                CampahStatus.SetStatus("Error! AH item array could not be read. Try zoning or logging out\r\n\t\tSkipping to the next item.");
                return;
            }
            int index = Array.IndexOf(ids, item.ItemData.ID) + 1;
            int stack = 0;
            if (item.Stack && item.ItemData.Stackable)
            {
                stack = 1;
            }
            AuctionHouse.MenuIndex = index + stack;
            Thread.Sleep((int)CampahStatus.Instance.GlobalDelay);
            int bid;
            {
                var parselowball = new Regex("[^0-9]*([0-9]+)(%)?.*");
                Match matches = parselowball.Match(CampahStatus.Instance.LowballBid);
                int lowballamount;
                if (matches.Groups.Count > 1 && !string.IsNullOrEmpty(matches.Groups[1].Value) && int.TryParse(matches.Groups[1].Value, out lowballamount))
                {
                    //int lowballamount = int.Parse(matches.Groups[1].Value);
                    if (matches.Groups[2].Value == "%" && lowballamount < 100)
                        bid = item.Minimum * lowballamount / 100;
                    else
                        bid = lowballamount;
                    if (bid > item.Minimum)
                        bid = item.Minimum;
                }
                else
                    bid = item.Minimum;
            }
            if (bid < 1)  //safety check on bid
                bid = 1;
            bool firstbid = true;
            bool hasitems = false;
            Chatlog.Instance.ClearChatAlerts();

            while (bid <= item.Maximum && item.BoughtCount < item.Quantity)
            {
                if (EliteAPIInstance.Instance.Inventory.GetContainerMaxCount(0) == EliteAPIInstance.Instance.Inventory.GetContainerCount(0))
                    StopBuying("Inventory Full");
                if (AuctionHouse.MenuIndex != index + stack)
                {
                    CampahStatus.Instance.Status = "Error: Mismatch IDs, Skipping...";
                    break;
                }

                EliteAPIInstance.Instance.ThirdParty.KeyPress(Keys.RETURN);
                Thread.Sleep((int)CampahStatus.Instance.GlobalDelay);
                AuctionHouse.MenuIndex = 2;
                Thread.Sleep((int)CampahStatus.Instance.GlobalDelay);
                EliteAPIInstance.Instance.ThirdParty.KeyPress(Keys.RETURN);
                Thread.Sleep((int)CampahStatus.Instance.GlobalDelay * 2);
                if (!hasitems)
                {
                    if (EliteAPIInstance.Instance.Menu.HelpName != "Price Set")
                    {
                        CampahStatus.Instance.Status = item.ItemData.Name + " is unavailble on AH, Skipping...";
                        EliteAPIInstance.Instance.ThirdParty.KeyPress(Keys.ESCAPE);
                        Thread.Sleep((int)CampahStatus.Instance.GlobalDelay);
                        break;
                    }

                    hasitems = true;
                }
                while (EliteAPIInstance.Instance.Menu.HelpName != "Price Set")
                {
                    Thread.Sleep(250);
                }

                AuctionHouse.BidValue = bid;
                CampahStatus.Instance.Status = string.Format("Bidding {0}g on {1}{2}", bid, item.ItemData.Name, item.Stack ? " stack." : ".");

                Thread.Sleep((int)CampahStatus.Instance.GlobalDelay);
                EliteAPIInstance.Instance.ThirdParty.KeyPress(Keys.RETURN);
                Thread.Sleep((int)CampahStatus.Instance.GlobalDelay);
                AuctionHouse.MenuIndex = 1;
                Thread.Sleep((int)CampahStatus.Instance.GlobalDelay);
                var alert = new ChatAlert(new Regex(@".*You(.*)buy the .* for ([0-9,]*) gil\."));
                Chatlog.Instance.AddAlert(alert);
                EliteAPIInstance.Instance.ThirdParty.KeyPress(Keys.RETURN);
                Thread.Sleep((int)CampahStatus.Instance.GlobalDelay);
                //EliteAPIInstance.Instance.Item.GetInventoryItemCount((ushort)item.ItemData.ID);
                var overrideAlert = false;
                int time = 0;
                while (!overrideAlert && !alert.Completed)
                {
                    Thread.Sleep((int)CampahStatus.Instance.GlobalDelay);
                    time += (int)CampahStatus.Instance.GlobalDelay;
                    if (time >= 20000)
                        overrideAlert = true;
                }
                if (overrideAlert)
                {
                    CampahStatus.SetStatus("An error occurred while parsing bid results\r\n\t\tRemoving item from bid list");
                    item.BoughtCount = item.Quantity;
                    break;
                }

                if (alert.Result.Groups[1].Value.Contains("unable"))
                {
                    if (bid < item.Minimum)
                        bid = item.Minimum;
                    else
                        bid += item.Increment;
                    if (bid > item.Maximum && bid < (item.Maximum + item.Increment))
                        bid = item.Maximum;
                    firstbid = false;
                    if (bid <= item.Maximum)
                    {
                        CampahStatus.Instance.Status = "Bid rejected, increasing bid to " + bid + "g.";
                    }
                    else
                    {
                        CampahStatus.Instance.Status = "Bid rejected, skipping to the next item...";
                    }
                }

                else
                {
                    var strstack = "";
                    if (item.Stack)
                    {
                        strstack = " stack";
                    }
                    CampahStatus.Instance.Status = string.Format("You bought the {0}{1} for {2}g.", item.ItemData.Name, strstack, bid);
                    item.BoughtCount++;
                    item.BoughtCost += bid;
                    RunningData.Instance.TotalSpent += bid;
                    if (item.Minimum >= bid && firstbid && CampahStatus.Instance.CheapO)
                    {
                        bid -= item.Increment;
                        if (bid < 1)
                        {
                            bid = 1;
                        }
                    }
                }
                Chatlog.Instance.ClearChatAlerts();
            }
        }
Beispiel #2
0
        private int BidOnItem(ItemRequest item)
        {
            if (FFACE_INSTANCE.Instance.Item.InventoryMax == FFACE_INSTANCE.Instance.Item.InventoryCount)
                StopBuying("Inventory Full");
            if (item.BoughtCount >= item.Quantity)
                return 0;
            {
                string strstack = ".";
                if (item.Stack)
                    strstack = " stack.";
                CampahStatus.Instance.Status = "Finding item: " + item.ItemData.Name + strstack;
            }
            if (!GotoMenu(item.ItemData.Address))
            {
                GotoBidMenu();
                return 0;
            }
            Thread.Sleep((int)CampahStatus.Instance.GlobalDelay);
            int[] ids = ReadAHItems();
            if (ids.Length < 3 || ids[0] == ids[2])
            {
                //StopBuying("Error! AH item array could not be read. Try zoning or logging out");
                CampahStatus.SetStatus("Error! AH item array could not be read. Try zoning or logging out\r\n\t\tSkipping to the next item.");
                return 0;
            }
            int index = Array.IndexOf(ids, item.ItemData.ID) + 1;
            int stack = 0;
            if (item.Stack && item.ItemData.Stackable)
                stack = 1;
            AuctionHouse.MenuIndex = index + stack;
            Thread.Sleep((int)CampahStatus.Instance.GlobalDelay);
            int bid;
            {
                Regex parselowball = new Regex("[^0-9]*([0-9]+)(%)?.*");
                Match matches = parselowball.Match(CampahStatus.Instance.LowballBid);
                int lowballamount;
                if (matches.Groups.Count > 1 && !string.IsNullOrEmpty(matches.Groups[1].Value) && int.TryParse(matches.Groups[1].Value, out lowballamount))
                {
                    //int lowballamount = int.Parse(matches.Groups[1].Value);
                    if (matches.Groups[2].Value == "%" && lowballamount < 100)
                        bid = item.Minimum * lowballamount / 100;
                    else
                        bid = lowballamount;
                    if (bid > item.Minimum)
                        bid = item.Minimum;
                }
                else
                    bid = item.Minimum;
            }
            if (bid < 1)  //safety check on bid
                bid = 1;
            bool firstbid = true;
            bool hasitems = false;
            Chatlog.Instance.ClearChatAlerts();

            while (bid <= item.Maximum && item.BoughtCount < item.Quantity)
            {
                if (FFACE_INSTANCE.Instance.Item.InventoryMax == FFACE_INSTANCE.Instance.Item.InventoryCount)
                    StopBuying("Inventory Full");
                if (AuctionHouse.MenuIndex != index + stack)
                {
                    CampahStatus.Instance.Status = "Error: Mismatch IDs, Skipping...";
                    break;
                }

                FFACE_INSTANCE.Instance.Windower.SendKeyPress(KeyCode.EnterKey);
                Thread.Sleep((int)CampahStatus.Instance.GlobalDelay);
                AuctionHouse.MenuIndex = 2;
                Thread.Sleep((int)CampahStatus.Instance.GlobalDelay);
                FFACE_INSTANCE.Instance.Windower.SendKeyPress(KeyCode.EnterKey);
                Thread.Sleep((int)CampahStatus.Instance.GlobalDelay * 2);
                if (!hasitems)
                {
                    if (FFACE_INSTANCE.Instance.Menu.Selection != "Price Set")
                    {
                        CampahStatus.Instance.Status = item.ItemData.Name + " is unavailble on AH, Skipping...";
                        FFACE_INSTANCE.Instance.Windower.SendKeyPress(KeyCode.EscapeKey);
                        Thread.Sleep((int)CampahStatus.Instance.GlobalDelay);
                        break;
                    }
                    else
                        hasitems = true;
                }
                while (FFACE_INSTANCE.Instance.Menu.Selection != "Price Set")
                    Thread.Sleep(250);
                /*                if (FFACE_INSTANCE.Instance.Item.SelectedItemName.ToLower() != item.ItemData.Name.ToLower() ||
                                    AuctionHouse.MenuIndex != index + stack)
                                {
                                    CampahStatus.Instance.Status = "Error: Mismatch IDs, Skipping...";
                                    break;
                                }
                  */
                AuctionHouse.BidValue = bid;
                {
                    string strstack = ".";
                    if (item.Stack)
                        strstack = " stack.";
                    CampahStatus.Instance.Status = "Bidding " + bid + "g on " + item.ItemData.Name + strstack;
                }
                Thread.Sleep((int)CampahStatus.Instance.GlobalDelay);
                FFACE_INSTANCE.Instance.Windower.SendKeyPress(KeyCode.EnterKey);
                Thread.Sleep((int)CampahStatus.Instance.GlobalDelay);
                AuctionHouse.MenuIndex = 1;
                Thread.Sleep((int)CampahStatus.Instance.GlobalDelay);
                ChatAlert alert = new ChatAlert(new Regex(@".*You(.*)buy the .* for ([0-9,]*) gil\."), ChatMode.SynthResult);
                Chatlog.Instance.addAlert(alert);
                FFACE_INSTANCE.Instance.Windower.SendKeyPress(KeyCode.EnterKey);
                Thread.Sleep((int)CampahStatus.Instance.GlobalDelay);
                uint prev_inv_amount = FFACE_INSTANCE.Instance.Item.GetInventoryItemCount((ushort)item.ItemData.ID);
                {
                    bool override_alert = false;
                    int time = 0;
                    while (!override_alert && !alert.Completed)
                    {
                        Thread.Sleep((int)CampahStatus.Instance.GlobalDelay);
                        time += (int)CampahStatus.Instance.GlobalDelay;
                        if (time >= 20000)
                            override_alert = true;
                    }
                    if (override_alert)
                    {
                        CampahStatus.SetStatus("An error occurred while parsing bid results\r\n\t\tRemoving item from bid list");
                        item.BoughtCount = item.Quantity;
                        break;
                    }
                }
                //                Chatlog.Instance.ClearChatAlerts();
                int curval = (int)FFACE_INSTANCE.Instance.Item.GetInventoryItemCount((ushort)item.ItemData.ID);
                //                if (alert.Result == null)
                //                    break;
                if (alert.Result.Groups[1].Value.Contains("unable"))
                {
                    if (bid < item.Minimum)
                        bid = item.Minimum;
                    else
                        bid += item.Increment;
                    if (bid > item.Maximum && bid < (item.Maximum + item.Increment))
                        bid = item.Maximum;
                    firstbid = false;
                    if (bid <= item.Maximum)
                        CampahStatus.Instance.Status = "Bid rejected, increasing bid to " + bid + "g.";
                    else
                        CampahStatus.Instance.Status = "Bid rejected, skipping to the next item...";
                }
                //                else if(FFACE_INSTANCE.Instance.Item.GetInventoryItemCount((ushort)item.ItemData.ID) == prev_inv_amount)
                //                {
                //                    CampahStatus.SetStatus("Error! Could not detect buy result.");
                //                    break;
                //                }
                else
                {
                    string strstack = "";
                    if (item.Stack)
                        strstack = " stack";
                    CampahStatus.Instance.Status = "You bought the " + item.ItemData.Name + strstack + " for " + bid + "g.";
                    item.BoughtCount++;
                    item.BoughtCost += bid;
                    RunningData.Instance.TotalSpent += bid;
                    if (item.Minimum >= bid && firstbid && CampahStatus.Instance.CheapO)
                    {
                        bid -= item.Increment;
                        if (bid < 1)
                            bid = 1;
                    }
                }
                Chatlog.Instance.ClearChatAlerts();
            }
            return item.BoughtCount;
        }
Beispiel #3
0
        private void BidOnItem(ItemRequest item)
        {
            if (FFACEInstance.Instance.Item.InventoryMax == FFACEInstance.Instance.Item.InventoryCount)
            {
                StopBuying("Inventory Full");
            }
            if (item.BoughtCount >= item.Quantity)
            {
                return;
            }
            {
                string strstack = ".";
                if (item.Stack)
                {
                    strstack = " stack.";
                }
                CampahStatus.Instance.Status = "Finding item: " + item.ItemData.Name + strstack;
            }
            if (!GotoMenu(item.ItemData.Address))
            {
                GotoBidMenu();
                return;
            }
            Thread.Sleep((int)CampahStatus.Instance.GlobalDelay);
            int[] ids = ReadAHItems();
            if (ids.Length < 3 || ids[0] == ids[2])
            {
                //StopBuying("Error! AH item array could not be read. Try zoning or logging out");
                CampahStatus.SetStatus("Error! AH item array could not be read. Try zoning or logging out\r\n\t\tSkipping to the next item.");
                return;
            }
            int index = Array.IndexOf(ids, item.ItemData.ID) + 1;
            int stack = 0;

            if (item.Stack && item.ItemData.Stackable)
            {
                stack = 1;
            }
            AuctionHouse.MenuIndex = index + stack;
            Thread.Sleep((int)CampahStatus.Instance.GlobalDelay);
            int bid;

            {
                var   parselowball = new Regex("[^0-9]*([0-9]+)(%)?.*");
                Match matches      = parselowball.Match(CampahStatus.Instance.LowballBid);
                int   lowballamount;
                if (matches.Groups.Count > 1 && !string.IsNullOrEmpty(matches.Groups[1].Value) && int.TryParse(matches.Groups[1].Value, out lowballamount))
                {
                    //int lowballamount = int.Parse(matches.Groups[1].Value);
                    if (matches.Groups[2].Value == "%" && lowballamount < 100)
                    {
                        bid = item.Minimum * lowballamount / 100;
                    }
                    else
                    {
                        bid = lowballamount;
                    }
                    if (bid > item.Minimum)
                    {
                        bid = item.Minimum;
                    }
                }
                else
                {
                    bid = item.Minimum;
                }
            }
            if (bid < 1)  //safety check on bid
            {
                bid = 1;
            }
            bool firstbid = true;
            bool hasitems = false;

            Chatlog.Instance.ClearChatAlerts();

            while (bid <= item.Maximum && item.BoughtCount < item.Quantity)
            {
                if (FFACEInstance.Instance.Item.InventoryMax == FFACEInstance.Instance.Item.InventoryCount)
                {
                    StopBuying("Inventory Full");
                }
                if (AuctionHouse.MenuIndex != index + stack)
                {
                    CampahStatus.Instance.Status = "Error: Mismatch IDs, Skipping...";
                    break;
                }

                FFACEInstance.Instance.Windower.SendKeyPress(KeyCode.EnterKey);
                Thread.Sleep((int)CampahStatus.Instance.GlobalDelay);
                AuctionHouse.MenuIndex = 2;
                Thread.Sleep((int)CampahStatus.Instance.GlobalDelay);
                FFACEInstance.Instance.Windower.SendKeyPress(KeyCode.EnterKey);
                Thread.Sleep((int)CampahStatus.Instance.GlobalDelay * 2);
                if (!hasitems)
                {
                    if (FFACEInstance.Instance.Menu.Selection != "Price Set")
                    {
                        CampahStatus.Instance.Status = item.ItemData.Name + " is unavailble on AH, Skipping...";
                        FFACEInstance.Instance.Windower.SendKeyPress(KeyCode.EscapeKey);
                        Thread.Sleep((int)CampahStatus.Instance.GlobalDelay);
                        break;
                    }

                    hasitems = true;
                }
                while (FFACEInstance.Instance.Menu.Selection != "Price Set")
                {
                    Thread.Sleep(250);
                }

                AuctionHouse.BidValue        = bid;
                CampahStatus.Instance.Status = string.Format("Bidding {0}g on {1}{2}", bid, item.ItemData.Name, item.Stack ? " stack." : ".");

                Thread.Sleep((int)CampahStatus.Instance.GlobalDelay);
                FFACEInstance.Instance.Windower.SendKeyPress(KeyCode.EnterKey);
                Thread.Sleep((int)CampahStatus.Instance.GlobalDelay);
                AuctionHouse.MenuIndex = 1;
                Thread.Sleep((int)CampahStatus.Instance.GlobalDelay);
                var alert = new ChatAlert(new Regex(@".*You(.*)buy the .* for ([0-9,]*) gil\."));
                Chatlog.Instance.AddAlert(alert);
                FFACEInstance.Instance.Windower.SendKeyPress(KeyCode.EnterKey);
                Thread.Sleep((int)CampahStatus.Instance.GlobalDelay);
                FFACEInstance.Instance.Item.GetInventoryItemCount((ushort)item.ItemData.ID);
                var overrideAlert = false;
                int time          = 0;
                while (!overrideAlert && !alert.Completed)
                {
                    Thread.Sleep((int)CampahStatus.Instance.GlobalDelay);
                    time += (int)CampahStatus.Instance.GlobalDelay;
                    if (time >= 20000)
                    {
                        overrideAlert = true;
                    }
                }
                if (overrideAlert)
                {
                    CampahStatus.SetStatus("An error occurred while parsing bid results\r\n\t\tRemoving item from bid list");
                    item.BoughtCount = item.Quantity;
                    break;
                }


                if (alert.Result.Groups[1].Value.Contains("unable"))
                {
                    if (bid < item.Minimum)
                    {
                        bid = item.Minimum;
                    }
                    else
                    {
                        bid += item.Increment;
                    }
                    if (bid > item.Maximum && bid < (item.Maximum + item.Increment))
                    {
                        bid = item.Maximum;
                    }
                    firstbid = false;
                    if (bid <= item.Maximum)
                    {
                        CampahStatus.Instance.Status = "Bid rejected, increasing bid to " + bid + "g.";
                    }
                    else
                    {
                        CampahStatus.Instance.Status = "Bid rejected, skipping to the next item...";
                    }
                }

                else
                {
                    var strstack = "";
                    if (item.Stack)
                    {
                        strstack = " stack";
                    }
                    CampahStatus.Instance.Status = string.Format("You bought the {0}{1} for {2}g.", item.ItemData.Name, strstack, bid);
                    item.BoughtCount++;
                    item.BoughtCost += bid;
                    RunningData.Instance.TotalSpent += bid;
                    if (item.Minimum >= bid && firstbid && CampahStatus.Instance.CheapO)
                    {
                        bid -= item.Increment;
                        if (bid < 1)
                        {
                            bid = 1;
                        }
                    }
                }
                Chatlog.Instance.ClearChatAlerts();
            }
        }