using System.Collections.Generic;
using ArcheBuddy.Bot.Classes;
using System.Windows.Forms;
using System;
using System.Threading;
namespace DefaultNameSpace
{
public class DefaultClass : Core
{
public static string GetPluginAuthor()
{
return "PoepieDoopie";
}
public static string GetPluginVersion()
{
return "0.1";
}
public static string GetPluginDescription()
{
return "Mining bot";
}
// The objects generated in the world
public List<DoodadObject> objects;
// The minable objects
public List<DoodadObject> ores;
public bool running = true;
//Call on plugin start
public void PluginRun()
{
Log("Loaded the plugin");
while (this.running)
{
this.objects = new List<DoodadObject>();
this.ores = new List<DoodadObject>();
Log("Lets see how many nodes we have found");
this.objects = getDoodads();
Log("Total Nodes found : " + this.objects.Count.ToString());
if (this.objects.Count > 0)
{
if(me.opPoints < 10)
{
this.running = false;
Log("We do not have enough labor points");
return;
}
foreach (DoodadObject obj in this.objects)
{
if (obj.id == 1671 && obj.uniqOwnerId == 0)
{
this.ores.Add(obj);
}
}
Log("We have " + this.ores.Count + " Veins to be gathered");
if (this.ores.Count <= 0)
{
this.running = false;
Log("There are no veins to be mined");
return;
}
while (this.ores.Count > 0 && me.opPoints > 10)
{
double distance = double.MaxValue;
DoodadObject selected = null;
foreach (DoodadObject ore in this.ores)
{
if (me.dist(ore) < distance)
{
distance = me.dist(ore);
selected = ore;
}
}
Log("Current closest ore is at : " + distance.ToString());
ComeTo(selected);
foreach (var skill in selected.getUseSkills())
{
while(selected != null)
{
// Is the ore still available
if(selected.uniqOwnerId == 0)
{
if(UseDoodadSkill(skill.id, selected, true, 0))
{
Log("We have mined the vein there are still " + this.ores.Count + " veins left in the area");
this.ores.Remove(selected);
Thread.Sleep(1000);
}
else
{
Log("Error we didn't mine the vein");
}
}
else
{
Log("Someone beat us to the vein");
this.ores.Remove(selected);
selected = null;
Thread.Sleep(100);
}
Log("Loop");
}
}
}
}
}
}
//Call on plugin stop
public void PluginStop()
{
}
}
}