Hi,
public static class AllianceGems
{
private static Dictionary<string, bool> Mains = new Dictionary<string, bool>
{
{ "Majestic Zircon", true},
};
public static void BuyingGems()
{
foreach (var item in Mains)
{
if (item.Value)
Vendor.BuyItem(item.Key, 20);
}
}
}
If you want use list with ammount to buy:
using System;
using System.Collections.Generic;
using wManager.Wow.Helpers;
public static class AllianceGems
{
private static List<System.Tuple<bool, string, int>> Mains = new List<System.Tuple<bool, string, int>>
{
// BuyOrNot, ItemName , BuyNumber
new Tuple<bool, string, int>(true, "Majestic Zircon", 20),
};
public static void BuyingGems()
{
foreach (var item in Mains)
{
if (item.Item1)
Vendor.BuyItem(item.Item2, item.Item3);
}
}
}
Final code look like:
using System.Collections.Generic;
using robotManager.Helpful;
using wManager.Wow.Helpers;
using Buy = System.Tuple<bool, string, int>;
public static class AllianceGems
{
private static List<Buy> Mains = new List<Buy>
{
// Item1, Item2 , Item3
// BuyOrNot, ItemName , BuyNumber
new Buy(true, "Majestic Zircon", 20),
};
public static void BuyingGems()
{
foreach (var item in Mains)
{
if (item.Item1)
{
var currentCount = ItemsManager.GetItemCountByNameLUA(item.Item2);
if (currentCount < item.Item3)
{
Logging.Write("Buy " + item.Item2);
Vendor.BuyItem(item.Item2, item.Item3 - currentCount);
}
}
}
}
}