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

[ request ] minning plugin

Skulls4UTD

New Member
Joined
Sep 13, 2014
Messages
18
Reaction score
0
hi guys how r u

i serch alot about minning plugin but didn't fine if any one can make something for us i'll be thankfull for him ...


ty alot ...
 
Currently im working to hard on my tradepack plugin so here is a start

It will just detect ores in your area and mine them accordingly without pathfinding, so do check/monitor your bot while running this.
Also you need to relocate when there are no more ores left. Oh and don't run this near housing area's you CPU will blow up xD

PHP:
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()
        {

        }
    }
}
 
Last edited:
Housing areas are render monstrosities and eat alot of cpu.
One thing I keep seeing in plugins is use of this. so much when it's entirely unneeded, it just looks silly stop doing it you're making kittens cry D:
 
PHP:
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()
        {

        }
    }
}

can we combine this metode with gps?
example: goint to point A and scan the area then lot... move to next point and scan again
can we??
 
It runs to the nearest vein mines it, then returns error, "Failed to mine vein." Then it stops
 
Back
Top