amazingnessn
New Member
- Joined
- May 23, 2014
- Messages
- 69
- Reaction score
- 0
delay value = seconds to wait between checks, & # of plants to wait for before moving.
Code:
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Threading;
using System.Collections.Generic;
using System.Linq;
using ArcheBuddy.Bot.Classes;
namespace DefaultNameSpace{
public class DefaultClass : Core
{
public static string GetPluginAuthor()
{
return "amazingnessn";
}
public static string GetPluginVersion()
{
return "1.0.0.0";
}
public static string GetPluginDescription()
{
return "Ghetto Plant Move - quicky & dirty method of moving between plants as your bot plants.";
}
public void PluginRun()
{
int delay = 2;
int maths = delay - 1;
ClearLogs();
List<long> last4 = new List<long>();
while (true) {
List<long> lastplanted = new List<long>();
foreach (var d in getDoodads()) {
if (d.uniqOwnerId == me.uniqId){
var derp = d.plantTime;
lastplanted.Add(derp);
}
}
long max = lastplanted.Max();
last4.Add(max);
if (last4.Count > delay) { last4.Clear(); }
if (last4.Count < delay || last4[0] == last4[maths]) { Log(DateTime.Now.ToString("h:mm:ss tt") + " - Waiting for more plants."); }
else {
foreach (var d in getDoodads()) {
if (d.uniqOwnerId == me.uniqId && d.plantTime == max) {
Log("Moving to next plant.");
MoveTo(d.X, d.Y, d.Z);
}
}
}
Thread.Sleep(delay * 1000);
}
}
public void PluginStop()
{
Log("Plugin Stopped");
}
}
}