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

[plugin] Mining bot

gajda

New Member
Joined
Nov 6, 2014
Messages
8
Reaction score
0
Here are my script for mining. Script is using sorcecery for getting rid of agro, but it's easily changeable to any other class.

You have to provide path around mine. For best results path should be closed circle. You have to name every point where you want to check for veins (20m radius) by number starting at 1. Also you have change line 84 in script. For example:
If you have 10 named points in you mining path it should looks like:
Code:
for(int i=1;i<[COLOR="#FF0000"]11[/COLOR];i++)

Script:
Code:
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
   {
       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");
           gps = new Gps(this); 
           gps.LoadDataBase(Application.StartupPath + "\\Plugins\\Mining\\mine.db3");
           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)<20) &! tempitems[i].name.Contains("Remnant") )
                    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()
      {         
          // i<11 is for route with 10 mining spots
          for(int i=1;i<11;i++)
           {                   
                CheckAggro();
                Log(DateTime.Now.ToLongTimeString() + " : movint 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(150,210);  
           wait       = wait*1000;
           Log(DateTime.Now.ToLongTimeString() + " : wait " + wait.ToString());
           Thread.Sleep(wait);           
           CheckAggro();
           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)<20) &! doodad.name.Contains("Remnant") )
               {             
                   mined = true;
                   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()
        {                     
            Log(DateTime.Now.ToLongTimeString() + " : 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())
                    {        
                        TurnDirectly(me.target);
                        if(skillCooldown("Freezing Arrow")==0)
                        {
                            Log(DateTime.Now.ToLongTimeString() + " Freezing arrow"); 
                            UseSkill("Freezing Arrow", false);
                            Thread.Sleep(100);
                        }
                        else
                        {
                            if(skillCooldown("Crippling Mire")==0)
                            {
                                    Log(DateTime.Now.ToLongTimeString() + " Crippling Mire"); 
                                    UseSkill("Crippling Mire",false);
                                    Thread.Sleep(100);
                            }
                            else
                            { 
                                if(skillCooldown("Flamebolt")==0)  
                                {    
                                    Log(DateTime.Now.ToLongTimeString() + " Flame Bolt"); 
                                    UseSkill("Flamebolt",false);
                                    Thread.Sleep(100);
                                }
                            }
                        }
                        if(!obj.inFight)
                            return;
                    }
                    Log(DateTime.Now.ToLongTimeString() + " : fight is over");
                }
            } 
        }        
       
       public void PluginStop()
       {
       }
   }
}
 
Last edited:
Hey,

It's working quite well, and it's the only mining script so far that's worked fine for me.

A few things to consider:
1. Underwater mining, much safer since less crowded, and some places require a lot less running. The popular mining zones are crowded with botters, half the people I come accross have the "Botting buff".
2. The random wait time: 150-210 *1000. I personnally don't see the point since by the time you've come back to point 1, the veins have respawned. EDIT: I've replaced this with 15-21*1000
3. Fighting - You use Dash to run from one point to the other. When you aggro a mob, you can't fight if you have no mana :P You should add a check where you don't use Dash if mana < 1000. That way, you can always fight and not take a beating while waiting for mana to regen. It's ok vs shitty level mobs, if you are farming in high level zones, that's a problem (basically a safety mana pool "just in case").
4. Upon reaching the last point (by default point n° 10), you make the character run the path backwards to get back to point 1. I think it'd be a great improvment if the last point (i.e. point 10) was the beginning. Would save a lot of time and wouldn't make the character look like a bot.

I know I made a few comments but they are improvement suggestions.

Great work, and thank you for sharing.
 
Thank you for comments and sugestions.

2. The random wait time: 150-210 *1000. I personnally don't see the point since by the time you've come back to point 1, the veins have respawned. EDIT: I've replaced this with 15-21*1000
I probably mine in smaller area than you. I need that wait time to respawn. Feel free to change it or remove completely.
3. Fighting - You use Dash to run from one point to the other. When you aggro a mob, you can't fight if you have no mana :P You should add a check where you don't use Dash if mana < 1000. That way, you can always fight and not take a beating while waiting for mana to regen. It's ok vs shitty level mobs, if you are farming in high level zones, that's a problem (basically a safety mana pool "just in case").
Than again I mine in low level zone and mobs didn't means threat to me. I can stay a while in combat waiting to regenerate some mana. But good point, I will look into that. Meanwhile feel free to comment line 88.

4. Upon reaching the last point (by default point n° 10), you make the character run the path backwards to get back to point 1. I think it'd be a great improvment if the last point (i.e. point 10) was the beginning. Would save a lot of time and wouldn't make the character look like a bot.
Because of that I recommended to make route as a circle. Just connect first and last point with link and you are set.
 
Because of that I recommended to make route as a circle. Just connect first and last point with link and you are set.

Oh, I actually didn't know this could be done! I'll try doing that, thanks!

And yeah.. when I see how many people there are in the popular mining zones, I think I'll just stick to a place with 3-4 veins close to each other ^^
 
Will test tonight. I got the simple mining script working REALLY well. so i will see how this compares :P cheers though. Much appreciated
 
wow, fantastic man Great job!

-edit one issue some reason i cant stop the plugin in O_O. have to exit game lol
 
Last edited:
I've made a path but it just stands there at the beginning and uses dash. no movement at all
 
Last edited:
You have to assign names to few points on that path, where you want bot to check for veins. Use numbers starting at 1.
 
hi i am new on AA and on AB, if i want the plugin to work, i need and a gps root?
 
...? how do you even get this into your plugin manager?

http://i.imgur.com/kUiCr2A.png


Clearly one is different than the other so simply saving this in the plugin editor isn't how it works. pleaaase explain? don't see any noobfriendly threads.

edit: OMG lol all I had to do was press compile? Well hope it works, thanks so much OP.
 
Last edited:
no response? yea.. this doesnt work for me.. just turns on sprint and doesn't move at all.
 
no response? yea.. this doesnt work for me.. just turns on sprint and doesn't move at all.
You have to provide your own GPS route around mine. Use gps editor.exe and gps plugin. Name spots, where you want to mine, with numbers. As described in my first post.
 
Do you have to name the gps route anything specific as mine also stands there and just sprints. Although the GPS route works in another plugin, but that plugin skips most of the nodes :S

gps.LoadDataBase(Application.StartupPath + "\\Plugins\\Mining\\mine.db3");

Like that, does it mean the plugin folder has to be called Mining and the GPS route has to be named mine.db3

EDIT: the above I have posted is correct, if your directory isn't the same the plugin won't do anything other than try to sprint and not move.
 
Last edited:
Can someone tell me how to exclude a certain questvein? great work on his plugin, though. thank you
 
22:31:49 : looking for veins
22:31:49 : I see 108 items
22:31:49 : I see 3 usable item(s)
22:31:49 : sorting run 1
22:31:49 : sorting run 2
22:31:49 : founded 3
22:31:49 : Unknown Vein 1,24989281682485
22:31:49 : Broken Gold Vein 2,88338774487255
22:31:49 : Broken Copper Vein 7,00142116133106
22:31:49 : Unknown Vein 1451 1,24989281682485
22:31:49 : mining

Same, can some1 tell ys how to exclude certain questvein ? :)
 
Back
Top