Beispiel #1
0
        private void FetchClick(object sender, EventArgs e)
        {
            ObjectManager.Update();
            if (!MerchantFrame.Instance.IsVisible)
            {
                MrGearBuyer.Slog("No Vender Frame was Open, Talk to a Vender to see the goods, then try again");
            }
            if (MerchantFrame.Instance.IsVisible)
            {
                _venderList.Clear();
                using (new FrameLock())
                {
                    foreach (var vendorItem in MerchantFrame.Instance.GetAllMerchantItems())
                    {
                        var fixedIndex = vendorItem.Index + 1;

                        var name = vendorItem.Name;

                        var costTypeLua =
                            Lua.GetReturnVal<string>(
                                "return GetMerchantItemCostItem(" + fixedIndex + ", GetMerchantItemCostInfo(" + fixedIndex + "))", 0);

                        if (string.IsNullOrEmpty(costTypeLua))
                        {
                            MrGearBuyer.Dlog("Vender item is not bought with points, Skipping. [{0}]", name);
                            continue;
                        }

                        var costType = "";
                        if (costTypeLua.Contains("Honor"))
                            costType = "HonorPoints";
                        else if (costTypeLua.Contains("Justice"))
                            costType = "JusticePoints";
                        else if (costTypeLua.Contains("Conquest"))
                            costType = "ConquestPoints";

                        var honorCost =
                            Lua.GetReturnVal<int>(
                                "return GetMerchantItemCostItem(" + fixedIndex + ", GetMerchantItemCostInfo(" + fixedIndex + "))", 1);

                        // Sometimes name returns empty from lua. Do another one to make sure its valid
                        if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(costType) || honorCost == 0)
                        {
                            MrGearBuyer.Dlog("Vender item not usable, Skipping. [{0}]", name);
                            continue;
                        }
                        var item = new MrGearBuyer.BuyItemInfo
                        {
                            ItemCost = honorCost,
                            ItemName = name,
                            ItemSupplierId = StyxWoW.Me.CurrentTarget.Entry,
                            ItemId = vendorItem.ItemId,
                            ItemCostType = costType.Replace(" ", "")
                        };
                        _venderList.Add(item);
                    }
                }
            }
        }
Beispiel #2
0
        private void FetchClick(object sender, EventArgs e)
        {
            ObjectManager.Update();
            if (!MerchantFrame.Instance.IsVisible)
            {
                MrGearBuyer.Slog("No Vender Frame was Open, Talk to a Vender to see the goods, then try again");
            }
            if (MerchantFrame.Instance.IsVisible)
            {
                _venderList.Clear();
                using (new FrameLock())
                {
                    foreach (var vendorItem in MerchantFrame.Instance.GetAllMerchantItems())
                    {
                        var fixedIndex = vendorItem.Index + 1;

                        var name = vendorItem.Name;

                        var costTypeLua =
                            Lua.GetReturnVal <string>(
                                "return GetMerchantItemCostItem(" + fixedIndex + ", GetMerchantItemCostInfo(" + fixedIndex + "))", 0);

                        if (string.IsNullOrEmpty(costTypeLua))
                        {
                            MrGearBuyer.Dlog("Vender item is not bought with points, Skipping. [{0}]", name);
                            continue;
                        }

                        var costType = "";
                        if (costTypeLua.Contains("Honor"))
                        {
                            costType = "HonorPoints";
                        }
                        else if (costTypeLua.Contains("Justice"))
                        {
                            costType = "JusticePoints";
                        }
                        else if (costTypeLua.Contains("Conquest"))
                        {
                            costType = "ConquestPoints";
                        }

                        var honorCost =
                            Lua.GetReturnVal <int>(
                                "return GetMerchantItemCostItem(" + fixedIndex + ", GetMerchantItemCostInfo(" + fixedIndex + "))", 1);

                        // Sometimes name returns empty from lua. Do another one to make sure its valid
                        if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(costType) || honorCost == 0)
                        {
                            MrGearBuyer.Dlog("Vender item not usable, Skipping. [{0}]", name);
                            continue;
                        }
                        var item = new MrGearBuyer.BuyItemInfo
                        {
                            ItemCost       = honorCost,
                            ItemName       = name,
                            ItemSupplierId = StyxWoW.Me.CurrentTarget.Entry,
                            ItemId         = vendorItem.ItemId,
                            ItemCostType   = costType.Replace(" ", "")
                        };
                        _venderList.Add(item);
                    }
                }
            }
        }