If this code is useful, I think there are things that need to be completed. I didn't check this. I don't know much about coding, can anyone with knowledge help me? Can you edit this code exactly?
using wManager.Wow.Enums;
using wManager.Wow.Helpers;
using wManager.Wow.ObjectManager;
public static void CheckAndProcessOre()
{
string oreName = "Copper Ore";
int requiredAmount = 10;
if (IsBagFull())
{
WoWGameObject smeltingNPC = FindNearestSmeltingNPC();
if (smeltingNPC != null)
{
Navigator.GoTo(smeltingNPC.Position);
}
}
else
{
MineOre(oreName, requiredAmount);
}
}
public static bool IsBagFull()
{
List<WoWItem> bags = Bag.GetBagItem();
foreach (WoWItem bag in bags)
{
if (bag != null && bag.IsValid && bag.ItemInfo != null)
{
int freeSlots = bag.ItemInfo.MaxCount - bag.StackCount;
if (freeSlots == 0)
{
return true;
}
}
}
return false;
}
public static void MineOre(string oreName, int requiredAmount)
{
WoWGameObject oreNode = FindNearestOreNode(oreName);
if (oreNode != null)
{
Navigator.GoTo(oreNode.Position);
oreNode.Interact();
wManager.wManagerSetting.WaitLocalPlayerIsIdleMS = 2000;
int currentAmount = GetItemCount(oreName);
if (currentAmount >= requiredAmount)
{
WoWGameObject smeltingNPC = FindNearestSmeltingNPC();
if (smeltingNPC != null)
{
Navigator.GoTo(smeltingNPC.Position);
}
}
}
}
public static WoWGameObject FindNearestOreNode(string oreName)
{
return ObjectManager.GetNearestWoWGameObject(ObjectManager.GetWoWGameObjectByEntryList(Mining.OreEntryList).FindAll(node => node.Name == oreName && !node.InUse && node.IsValid && node.IsAlive));
}
public static int GetItemCount(string itemName)
{
WoWItem[] items = Bag.GetBagItem().ToArray();
return items.Sum(item => item.ItemInfo.Name == itemName ? item.StackCount : 0);
}
public static WoWGameObject FindNearestSmeltingNPC()
{
return ObjectManager.GetNearestWoWGameObject(ObjectManager.GetWoWGameObjectByEntryList(Mining.SmeltingEntryList).FindAll(npc => npc.IsValid && npc.Is
Alive));
}
public static int[] SmeltingEntryList = { /* Smelting NPC'ID */ };