Ejemplo n.º 1
0
        private static void BuyItems(BuyItemsEventArgs args)
        {
            if (ItemToBuy == null)
            {
                return;
            }

            // Little hack here for just Honor and Justice points. Core fails to buy these 2
            if (ItemToBuy.ItemId == 392 || ItemToBuy.ItemId == 395)
            {
                var item = MerchantFrame.Instance.GetAllMerchantItems().FirstOrDefault(i => i.ItemId == ItemToBuy.ItemId);

                if (item == null)
                {
                    Slog("Oops! Something went wrong while trying to buy {0}[{1}]. Please consult to the profile writer", ItemToBuy.ItemName, ItemToBuy.ItemId);
                }
                else
                {
                    Lua.DoString("BuyMerchantItem(" + (item.Index + 1) + ")");
                    // Adding a sleep here to let WoW update itself with currencies. So we don't end up buying something wrong.
                    Thread.Sleep(1000);
                    _pulseTimer.Reset();
                }
            }
            else
            {
                args.BuyItemsIds.Add(ItemToBuy.ItemId, 1);
            }

            Slog("Bought item \"{0}\".", ItemToBuy.ItemName);

            if (!RemoveHPJPWhenCapped || (ItemToBuy.ItemId != 392 && ItemToBuy.ItemId != 395) || _forceAddedPoints)
            {
                Slog("Removing {0} from List Since we bought the Item", ItemToBuy.ItemName);
                BuyItemList.Remove(ItemToBuy);
                _forceAddedPoints = false;
            }
            else
            {
                if (ItemToBuy.ItemId == 392 && WoWCurrency.GetCurrencyByType(WoWCurrencyType.HonorPoints).Amount >= 3750)
                {
                    Slog("Removing Honor Points from List Since Capped");
                    BuyItemList.Remove(ItemToBuy);
                }
                else if (ItemToBuy.ItemId == 395 && WoWCurrency.GetCurrencyByType(WoWCurrencyType.JusticePoints).Amount >= 3750)
                {
                    Slog("Removing Justice Points from List Since Capped");
                    BuyItemList.Remove(ItemToBuy);
                }
            }

            ItemToBuy = null;
        }
Ejemplo n.º 2
0
        private static void BuyItems(BuyItemsEventArgs args)
        {
            if (ItemToBuy == null)
                return;

            // Little hack here for just Honor and Justice points. Core fails to buy these 2
            if (ItemToBuy.ItemId == 392 || ItemToBuy.ItemId == 395)
            {
                var item = MerchantFrame.Instance.GetAllMerchantItems().FirstOrDefault(i => i.ItemId == ItemToBuy.ItemId);

                if (item == null)
                {
                    Slog("Oops! Something went wrong while trying to buy {0}[{1}]. Please consult to the profile writer", ItemToBuy.ItemName, ItemToBuy.ItemId);
                }
                else
                {
                    Lua.DoString("BuyMerchantItem(" + (item.Index + 1) + ")");
                    // Adding a sleep here to let WoW update itself with currencies. So we don't end up buying something wrong.
                    Thread.Sleep(1000);
                    _pulseTimer.Reset();
                }
            }
            else
            {
                args.BuyItemsIds.Add(ItemToBuy.ItemId, 1);
            }

            Slog("Bought item \"{0}\".", ItemToBuy.ItemName);

            if (!RemoveHPJPWhenCapped || (ItemToBuy.ItemId != 392 && ItemToBuy.ItemId != 395) || _forceAddedPoints)
            {
                Slog("Removing {0} from List Since we bought the Item", ItemToBuy.ItemName);
                BuyItemList.Remove(ItemToBuy);
                _forceAddedPoints = false;
            }
            else
            {
                if (ItemToBuy.ItemId == 392 && WoWCurrency.GetCurrencyByType(WoWCurrencyType.HonorPoints).Amount >= 3750)
                {
                    Slog("Removing Honor Points from List Since Capped");
                    BuyItemList.Remove(ItemToBuy);
                }
                else if (ItemToBuy.ItemId == 395 && WoWCurrency.GetCurrencyByType(WoWCurrencyType.JusticePoints).Amount >= 3750)
                {
                    Slog("Removing Justice Points from List Since Capped");
                    BuyItemList.Remove(ItemToBuy);
                }
            }

            ItemToBuy = null;
        }