What's new
  • Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Visit Resources
  • Visit Downloads
  • Visit Portal

fredgsanford

Member
Joined
Jan 2, 2015
Messages
552
Reaction score
0
i added a few things to gajda's bot this is 99% his work so give credit to him not me.

Updated to only do iron and fortuna let me know if this part works as i haven't got to test it yet

I added some changeable variables near top and
added to stop at certain labor and goto an afk spot using an auto selected mount which you can edit as one of variables and also one to tell it when to restart
it will use a mount to get to start of mining route at start of the plugin and to go afk. But not while its mining it does not use dash etc either.
Also you can set the random delay between runs with those two variables near top.
still needs named points ie for mining starting at 1 to however many you use and you need to set that variable to but its set to the number of nodes to mine and other named point it needs is afk one.
Checks aggro now while its waiting for the random timer between runs which it didn't do before.
Also added support for a few other skills although that part is untested yet.
Also can set radius around you when your at the node it will mine veins at.
Can't remember what else i changed atm.


Code:
//start
// gajda mining bot to check out with a couple of modifications by fredgsanford
/// IMPORTANT set to use dif skills for agro but yours may not be in here so you can let me know and i can add them or you can
// 
/* things i added afk spot, 
a variable to set number of nodes near top of file so don't have to look for it. note
a variable to set start and stop labor amounts, 
detect mount and use it to goto start from afk spot and to also goto the afk spot
set amount of time for random delay between runs
checks for aggro while you are paused between runs
if anyone can tell me how to set it to it will check for aggro while on gps move that would rock and be appreciated.
all these settings are now near top of file to make it easier to find them.
a variable to set ming radius to mine around each point in your path
*/
using System;
using System.Drawing;
using System.Threading;
using System.Collections.Generic;
using System.Linq;
using ArcheBuddy.Bot.Classes;
using System.Windows.Forms;
using System.Threading.Tasks;
using System.Net;
using System.IO;
using System.Text;
using System.ComponentModel;

namespace DefaultNameSpace{
   public class DefaultClass : Core
   {
	  // editable variables set these to what you want them to be
	  // these 1st two are for a random timer that sets the minimum and maximum times to wait before doing each run to allow mining veins to repop.
	  // note that while its waiting it still checks for agro
		const int min_wait = 135; // this is a pause after each full run and this is the minimum time it will wait
		const int max_wait = 143; // this is pause after each run and this is the maximum time it will wait
		const string _MOUNT_NAME = ""; // if this is left empty ie = "" it will autodetect mount to use. Mount is used to go to and from afk spot only
		const int mineradius = 10; // radius around each mining point you want it to grab ore from. ie how far to look around you at each point to grab ore
		const int numberofnodes = 28;	// set this to the number of nodes in your route ie you you are mining
		const int labor_to_stop = 501; // set this to the amount of labor you want the bot to stop mining at it will prob do whatever nodes already seen before doing so.
		const int labor_to_restart_at = 1500;	// set this to the amount of labor you want the bot to restart mining at.
		// do not edit the ones below here
		const int nodes = numberofnodes + 1;
		string mountName;
		
		public static string GetPluginAuthor()
		{
           return "Gajda";
		}

       public static string GetPluginVersion()
       {
           return "1.3.0";
       }

       public static string GetPluginDescription()
       {
           return "mining bot";
       }
       private Gps gps; 
       //Call on plugin start
       public void PluginRun()
       {
           ClearLogs();
           Log(DateTime.Now.ToLongTimeString() + " : Start");
		   DetectMountName();
            Log("MOUNT SELECTED: " + mountName);
           gps = new Gps(this); 
           gps.LoadDataBase(Application.StartupPath + "\\Plugins\\Mining\\mine.db3");
		   if (me.laborPoints < labor_to_stop)
		   {
			   gotosafespot();
		   }
			movetostart();
			DoMineRun();
           
       }            
       
       public List<DoodadObject> Sort(List<DoodadObject> tempitems)
       {    
           Log(DateTime.Now.ToLongTimeString() + " : I see " + tempitems.Count + " items");   
           List<DoodadObject> items = new List<DoodadObject>();
           for(int i=0;i<tempitems.Count;i++)
           {
                if(tempitems[i].name.Contains("ein") && (tempitems[i].dist(me)<mineradius) &! tempitems[i].name.Contains("Remnant") &! tempitems[i].name.Contains("nknown") &! tempitems[i].name.Contains("roken"))
				{
                      items.Add(tempitems[i]);
				}
           }
            Log(DateTime.Now.ToLongTimeString() + " : I see " + items.Count + " usable  item(s)");   
           bool needSort = true;
           if(items.Count<2)
               needSort = false;
           int loop      = 1;
           while(needSort)
           {   
               Log(DateTime.Now.ToLongTimeString() + " : sorting run " + loop);
               bool changed = false;
               for(int i=0;i<items.Count-1;i++)
               {                         
                   
                   if(items[i].dist(me)>items[i+1].dist(me))
                   {                          
                       var tempItem = items[i]; 
                       items[i]=items[i+1];
                       items[i+1]=tempItem;
                       changed = true;
                   }                   
               }
               if(changed==false)
               {
                   needSort = false;
               }
               loop++ ;
           }   
           return   items;
       }
       
       public void DoMineRun()
      {  
          for(int i=1;i<nodes;i++)
           {                   
                CheckAggro();
				if (me.laborPoints < labor_to_stop)
				{
					gotosafespot();
				}
                Log(DateTime.Now.ToLongTimeString() + " : moving to point " + i.ToString()); 
//               UseSkill("Dash");    
                while(!gps.GpsMove(i.ToString()))
                {
                    Thread.Sleep(100);
                }
                Log(DateTime.Now.ToLongTimeString() + " : at point " + i.ToString());     
                CheckAggro();
                while(Mine())
                {
                    Thread.Sleep(100);
                }
           }                    
           CheckAggro();
           Log(DateTime.Now.ToLongTimeString() + " : moving to start");
           gps.GpsMove("1");                                      
           CheckAggro();            
           Random rnd = new Random();
           int wait = rnd.Next(min_wait,max_wait);  
           wait = wait*1000;
           Log(DateTime.Now.ToLongTimeString() + " : wait " + wait.ToString());
		   Log(DateTime.Now.ToLongTimeString() + " : CheckAggro");
		   while (wait > 1000)
           {
		   Thread.Sleep(1000);           
           CheckAggro();
		   wait = wait - 1000;
		   }
			if (me.laborPoints < labor_to_stop)
			{
			   gotosafespot();
			}
           DoMineRun();
      }
       public bool Mine()
       {            
           Log(DateTime.Now.ToLongTimeString() + " : looking for veins");
           bool mined = false;
           List<DoodadObject> items = Sort(getDoodads());
           Log(DateTime.Now.ToLongTimeString() + " : founded " + items.Count);
           foreach(var doodad in items)
           {
               Log(DateTime.Now.ToLongTimeString() +  " :      " + doodad.name + "  " + doodad.dist(me));  
           }
           foreach(var doodad in items)
           {               
                if(doodad.name.Contains("ein") && (doodad.dist(me) < mineradius) &! doodad.name.Contains("Remnant") &! doodad.name.Contains("nknown") &! doodad.name.Contains("roken"))
               {             
                   mined = true;
				   checkfordailyquest();
                   Log(DateTime.Now.ToLongTimeString() +  " : " + doodad.name + " " + doodad.id.ToString() + "  " + doodad.dist(me));     
                   var skills = doodad.getUseSkills(); 
                   double doodadCastDist = 0;
                    if (skills.Count > 0)
                    {
                        if (doodadCastDist == 0)  
                        {
                            Thread.Sleep(500);
                            Log(DateTime.Now.ToLongTimeString() + " : mining");
                            TurnDirectly(doodad);
                            UseDoodadSkill(skills[0].id, doodad, true);
                        }
                        Thread.Sleep(1000);
                    }
                }     
            }
            return mined;
       }
  
        public void CheckAggro()
        {                     
            if(getAggroMobs().Count > 0)
            {         
                Log(DateTime.Now.ToLongTimeString() + " : " + getAggroMobs().Count.ToString());
                foreach(var obj in  getAggroMobs())
                {   
                    Log(DateTime.Now.ToLongTimeString() + " : " + obj.name);    
                    SetTarget(obj);
                    TurnDirectly(me.target);
                    Log(DateTime.Now.ToLongTimeString() + " : fighting");
                    while(obj.isAlive())
                    {   
// might put something in here later to check for hp and use potion or heal skill if have them and use them etc				
                        TurnDirectly(me.target);
						if(isSkillLearned("Enervate") && skillCooldown("Enervate")==0)
                        {
                            Log(DateTime.Now.ToLongTimeString() + " Enervate"); 
                            UseSkill("Enervate", false);
                            Thread.Sleep(100);
                        }
						else if(isSkillLearned("Charge") && skillCooldown("Charge")==0)
							{
								Log(DateTime.Now.ToLongTimeString() + " Charge"); 
								UseSkill("Charge", false);
								Thread.Sleep(100);
							}
						else if(isSkillLearned("Freezing Arrow") && skillCooldown("Freezing Arrow")==0)
							{
								Log(DateTime.Now.ToLongTimeString() + " Freezing Arrow");
								UseSkill("Freezing Arrow", false);
								Thread.Sleep(100);
							}
						else if(isSkillLearned("Stalker's Mark") && skillCooldown("Stalker's Mark")==0)
							{
								Log(DateTime.Now.ToLongTimeString() + " Stalker's Mark");
								UseSkill("Stalker's Mark", false);
								Thread.Sleep(100);
							}
						// need to find a few more for above for dif classes
						else
							{ 
                                if(isSkillLearned("Critical Discord") && skillCooldown("Critical Discord")==0)  
                                {    
                                    Log(DateTime.Now.ToLongTimeString() + " Critical Discord"); 
                                    UseSkill("Critical Discord",false);
                                    Thread.Sleep(100);
                                }
								else if(isSkillLearned("Flame Bolt") && skillCooldown("Flame Bolt")==0)  
                                {    
                                    Log(DateTime.Now.ToLongTimeString() + " Flame Bolt"); 
                                    UseSkill("Flame Bolt",false);
                                    Thread.Sleep(100);
                                }
								else if(isSkillLearned("Triple Slash") && skillCooldown("Triple Slash")==0)  
                                {    
                                    Log(DateTime.Now.ToLongTimeString() + " Triple Slash"); 
                                    UseSkill("Triple Slash",false);
                                    Thread.Sleep(100);
                                }
								else if(isSkillLearned("Endless Arrows") && skillCooldown("Endless Arrows")==0)  
                                {    
                                    Log(DateTime.Now.ToLongTimeString() + " Endless Arrows"); 
                                    UseSkill("Endless Arrows",false);
                                    Thread.Sleep(100);
                                }
								else
									{
										Log(DateTime.Now.ToLongTimeString() + " Shoot Arrow - using this as have no other skills");
										UseSkill("Shoot Arrow",false);
									}
							}
                        if(!obj.inFight)
                            return;
                    }
                    Log(DateTime.Now.ToLongTimeString() + " : fight is over");
                }
            } 
        }        

		public void gotosafespot()
		{
			Log(DateTime.Now.ToLongTimeString() + " : moving to afk because labor is below set amount");
			mountup();
			gps.GpsMove("afk");
			unmount();
			while (me.laborPoints < labor_to_restart_at)
			{
				Thread.Sleep(5000);
				CheckAggro();
			}
			Log(DateTime.Now.ToLongTimeString() + " : moving to start");
			mountup();
			gps.GpsMove("1");
			unmount();
			CheckAggro();
		return;
		}

// this one detects mount to use if you leave the _MOUNT_NAME blank in variables near top    
        public void DetectMountName()
        {
            mountName = _MOUNT_NAME;
            if (_MOUNT_NAME != "")
                return;
            
            int highestLevel = 0;
            List<Item> inventory = getAllInvItems();
            foreach (Item item in inventory)
            {
                if (item.mountLevel > 0 && item.db.useSkill.name == "Summon Mount")
                {
                    if (item.mountLevel > highestLevel)
                    {
                        mountName = item.name;
                        highestLevel = item.mountLevel;
                    }
                }
            }
        }
		
		public void unmount()
        {
            if (me.sitOnMount)
            {
                DespawnMount();
                Thread.Sleep(1500);
            }
        }
		public void mountup()
		{
		if (!me.sitOnMount)
            {
                if (getMount() == null)
                {
                    Log("Trying to summon our mount");
                    UseItem(mountName);
                    Thread.Sleep(1000);
                }

                if (getMount() != null)
                {
                    if (!getMount().isAlive())
                    {
                        Log("Trying to resurrect mount");
                        ComeTo(getMount(), 1, 1);
                        if (!RessurectMount(false))
                            Log("Failed rezzing mount: " + GetLastError());
                    }
                    SitToMount();
                }
                else
                    Log("Failed to summon or use the mount");
            }
		}
// adding movetoarea to move to start of mining area from somewhere on the gps route ie afk spot at start of run using mount
public void movetostart()
	{
		GpsPoint point = gps.GetPoint("1");
         // only teleport if we're somewhat far away from the area might need to edit this
            if (dist(point.x, point.y, point.z) > 100)
				{
					mountup();
				}
		gps.GpsMove("1");
		Thread.Sleep(500);
		unmount();
		Thread.Sleep(1000);
	}
public void checkfordailyquest()
	{
		// quest id for Blue Salt Request: Ore is 6779
		
	}
       public void PluginStop()
       {
       }
   }
}
// end
 
Last edited:
no comments? just trying to learn how to code a bit so any comments on how to improve any of what i did would be great as well thanks.
 
works ok but it tries to mine "unknown veins" which are for a quest anyway to blacklist it?
 
should be fixed hash so let me know if it is please and if not i will try again
should now not mine unknown or broken veins if there are any other quest ones besides them let me know
 
Last edited:
Oh so for that you are comment in all of other miner plugins that they are bad (like in ezminer or minerobot)... cause you want that yours be the best... please don't do it; ppl can use the plugin that they want so please don't make bad criticism of other plugins... we are not kids
 
Last edited:
Oh so for that you are comment in all of other miner plugins that they are bad (like in ezminer or minerobot)... cause you want that yours be the best... please don't do it; ppl can use the plugin that they want so please don't make bad criticism of other plugins... we are not kids

noe2611 i never said any of the other plugins where bad? where did you see that? I said i am trying to learn how to code so thought i would try adding a few things to this one.

I did comment earlier today about using the one that the guy wants to send you a dll and that is because it might not be safe and out would tell you not to as well without it being on the store to release is as as dll if that is what your referring to then i stand by that because no one should run a dll they have no idea what is in it really. Ie should be approved by OUT or released as code so people can make sure themselves and compile it to use. If thats not what your referring to then I am not sure what you mean.

Also no mine is probably not even close to being the best.

This is 99% gajda mining bot and i gave him all of the credit for it.
 
noe2611 i never said any of the other plugins where bad? where did you see that? I said i am trying to learn how to code so thought i would try adding a few things to this one.

I did comment earlier today about using the one that the guy wants to send you a dll and that is because it might not be safe and out would tell you not to as well without it being on the store to release is as as dll if that is what your referring to then i stand by that because no one should run a dll they have no idea what is in it really. Ie should be approved by OUT or released as code so people can make sure themselves and compile it to use. If thats not what your referring to then I am not sure what you mean.

Also no mine is probably not even close to being the best.

This is 99% gajda mining bot and i gave him all of the credit for it.

Yes, you said sth bad, but the .dll file will be in the store, i send a mail tu guy and he told me that he is very busy but he will try to be a community developer, and that he don´t want post the code cause is not perfect at all, cause he wants to add sth to the interface, but well, maybe if you talk with "FuelLoco" he can give you the code to use it on your own code.
 
Yes, you said sth bad, but the .dll file will be in the store, i send a mail tu guy and he told me that he is very busy but he will try to be a community developer, and that he don´t want post the code cause is not perfect at all, cause he wants to add sth to the interface, but well, maybe if you talk with "FuelLoco" he can give you the code to use it on your own code.

Ahh well thats great then if he is putting it on the store still best to wait for then to get the dll to make sure out gets to check it. I am not really a coder but would love to see his code for sure to help me learn but i doubt he would share it if he is working on it anyway. Hope he releases it soon as it did sound like it would be a good plugin etc.

This one does what i need so I am fine with it although would be nice to add a way to detect players etc and if they are mining a node and not try mine it and other stuff but not sure how to do that atm but if i do i will def add it and whatever else i can think of might make it less botlike. Pretty sure need some way to use some kind of random pathing so not always using same one all time which makes it look botlike. But thats a problem with any plugin that uses routes i would think although worse for mining and grinding etc since then your normally in smaller area then you would be for trade route and such.
 
trying to compile this script but i have this error
"20:38:29: c:\ARCHEBUDDY1\Plugins\Miner\minatoro.cs(173,153) : error CS0103: The name 'tempitems' does not exist in the current context
20:38:29: c:\ARCHEBUDDY1\Plugins\Miner\minatoro.cs(173,163) : error CS0103: The name 'i' does not exist in the current context
20:38:29: c:\ARCHEBUDDY1\Plugins\Miner\minatoro.cs(302,13) : warning CS0162: Unreachable code detected"
can you help me? (just copy paste on editor)
 
sorry about that forgot to fix that one. New fixed version up now that compiles let me know if any other problems
 
Anyway to limit the range it will mine veins per spot? I would like to set it to mine only very close, because I have issues sometimes with it going off random mountains if something spawns nearby below it.
 
yes its set to 10 by default but find this line
const int mineradius = 10;
and change it to what you want. that how far it will mine around you from each point on your route
All changeable settings are near top to make it easier to find and change them
 
Back
Top