Orlok
Member
- Joined
- Mar 3, 2013
- Messages
- 184
- Reaction score
- 4
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 Gatherer{ public class Gatherer : Core { public static string GetPluginAuthor() { return "2face"; } public static string GetPluginVersion() { return "1.0.0.0"; } public static string GetPluginDescription() { return "Gather Plugin"; } public List<DoodadObject> doodList = new List<DoodadObject>(); public List<String> gatherTypes = new List<String>(); public bool isRunning = false; public Thread mainThread; //Call on plugin start public void PluginRun() { Log("Done1"); //printDoods(); //Log("dooddist " + getClosestDood().dist(me)); //moveToDood(getClosestDood()); gatherTypes.Add("Chop Tree"); gatherTypes.Add("Mine Ore"); //printDoods(); isRunning = true; Start(); Log("Nope"); } public void Start(){ while(isRunning){ Thread.Sleep(500); try{ DoodadObject dood = getClosestDood(); if(dood != null){ Log("name " + dood.name ); UseSkill("Dash"); moveToDood(dood); } Log("Check"); }catch(Exception e){ Log(e.ToString()); } } } public void getDoodType(DoodadObject dood){ printDoodInfo(dood); Log("doodtype: " + dood.phaseId); } public void printDoodInfo(DoodadObject dood){ Log("name: " + dood.name + " dist: " + dood.dist(me)); } public void moveToDood(DoodadObject dood){ if(dood == null) return; Log("Move To: " + dood.name + " dist: " + me.dist(dood)); //printDoodInfo(dood); while(dood.dist(me) >= 3){ ComeTo(dood, 2); Thread.Sleep(50); } useDoodad(dood); } public Skill getDoodadSkill(DoodadObject dood){ Skill skill = null; if(dood != null){ foreach(var obj in dood.getUseSkills()){ skill = obj; } } return skill; } public void useDoodad(DoodadObject dood){ if(dood != null){ Skill skill = getDoodadSkill(dood); if(skill != null){ Log(skill.name + " " + dood.name); while(dood != null && dood.dist(me) <= 3){ if(UseDoodadSkill(skill.id, dood, true, 0) == true){ Log("Gathered: " + dood.name); dood.Dispose(); dood = null; } Thread.Sleep(50); } } } } public String hasGatherType(DoodadObject dood){ Skill skill = getDoodadSkill(dood); return ""; } public DoodadObject getClosestDood(){ DoodadObject dood = null; double dist = 9999999999; doodList = getDoodads(); Skill skill = null; if(doodList.Count > 0){ //printDoods(); foreach(var obj in doodList){ skill = getDoodadSkill(obj); if(skill != null ){ if(skill.name == "Chop Tree" || skill.name == "Mine Ore"){ if(me.dist(obj) < dist && obj.growthTime <= 0 && obj.uniqOwnerId == 0){ dood = obj; dist = me.dist(obj); } } } } } Log("TEST"); if(dood != null){ return dood; } return null; } public void printDoods(){ updateDoodads(); Skill skill = null; String sName = ""; foreach(var obj in doodList){ Log("---"); skill = getDoodadSkill(obj); if(skill != null){ sName = skill.name; }else{ sName = ""; } Log(obj.name + " Time: " + obj.growthTime + " skill: " + sName); Log("Type: " + obj.type + "dist: " + me.dist(obj)); Log("ownerId: " + obj.uniqOwnerId); } } public void updateDoodads(){ doodList = getDoodads(); } //Call on plugin stop public void PluginStop() { } } }
Added sprint skill to use when going to node mate, works for me so try it.
Thank you so much!!! You are an angel! Were you able to get it to stop by passing 'Fortuna' nodes by any chance?