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

Character cleaner pluggin.

edwinlodz

Member
Joined
Jan 28, 2015
Messages
90
Reaction score
1
Hello i am trying to make Pluggin that will :

1)Teleport .
2)Use warehouse to get items.
3)Craft 58 Gilda Stars into Dust .
4)Move to mail .

Unfortunately i am just starting C# Journey if anyone could take a look at it and help me connect the parts and finish it. Thanks in advance :)

That is what i collected still i cannot connect it right most parts works separately unfortunately i am still C# noob.

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
{
private Gps gps;
bool SprintActivated = false;
public static string GetPluginAuthor()
{
return "Clean";
}

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

public static string GetPluginDescription()
{
return "Clean";
}

//Call on plugin start
//1.TELEPORT
public void PluginRun()
{
if( HaveHereafterstones() == true)
{
UsePortalBook() ;
Thread.Sleep(5000);
return;
}
}

public void UsePortalBook()
{
foreach (var port in me.portalBook.getDistricts())
{
if (port.name == "Widesleeves")
{
port.OpenPortal();
Thread.Sleep(1000);
while (me.isCasting || me.isGlobalCooldown)
Thread.Sleep(100);
Thread.Sleep(2500);
UsePortal(getMyPortal());
break;
}
}
}

public Creature getMyPortal()
{
foreach (var creat in getCreatures())
{
if (creat.db.id == 3891 && creat.ownerUniqId == me.uniqId)
return creat;
}
return null;
}
public bool HaveHereafterstones()
{
List<Item> inventory = getAllInvItems() ;
foreach(Item myitem in inventory)
{
if( myitem.name == "Hereafter Stone")
{
return true;
}
}
return false;
}
//2.MOVING to warehouse
{
Gps gps = new Gps(this);
gps.LoadDataBase(Application.StartupPath + "\\plugins\\Clean\\path.db3");
while (gps.GpsMove("WH"))
Thread.Sleep(10220);
}
//3.WAREHOUSE
{
uint _itemid = 23633;
MoveItemFromWh(_itemid);
}
//4.MOVING to craft
{
Gps gps = new Gps(this);
gps.LoadDataBase(Application.StartupPath + "\\plugins\\Clean\\path.db3");
while (gps.GpsMove("Craft"))
Thread.Sleep(10220);
}
//5.Crafting 58 Gilda Stars into Dust


//Call on plugin stop
public void PluginStop()
{
}
}
}
}
 
I am also new to C#, but I looked at your code, and made a few modifications. There is still some methods to write and testing to perform, but I think this should work as a decent framework for what you are trying to do.

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
    {
        private Gps gps;
        bool SprintActivated = false;
        public static string GetPluginAuthor()
        {
            return "Clean";
        }

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

        public static string GetPluginDescription()
        {
            return "Clean";
        }
        bool running = true;
        bool porting = true;
        bool warehousing = false;
        bool movingCS = false;
        bool crafting = false;
        string destination = "Widesleeves";

        //Call on plugin start
        //1.TELEPORT
        public void PluginRun()
        {
            while (running)
            {
                while (porting)
                {
                    if (getCurrentTerritory().name != destination)
                    {
                        if (HaveHereafterstones() == true)
                        {
                            UsePortalBook();
                            Thread.Sleep(5000);
                        }
                        else
                        {
                            Log("Not Enough Hereafterstones");
                        }

                    }
                    else
                    {
                        porting = false;
                        warehousing = true;
                        Log("You have arrived at " + destination);
                    }
                }
                while (warehousing)
                {
                    bool retrieveItems = false;
                    if (!(retrieveItems))
                    {
                        moveToWH();
                        Thread.Sleep(1000);
                        getItemFromWH();
                        //See comment is getItemFromWH method;
                        retrieveItems = true;
                    }
                    else
                    {
                        warehousing = false;
                        movingCS = true;
                    }
                }
                while (movingCS)
                {
                    moveToCS();
                    movingCS = false;
                    crafting = true;
                }
                while (crafting)
                {
                    craftGildaDust(); //Unfinished method
                    crafting = false;
                }
                if (!porting && !warehousing && !movingCS && !crafting)
                {
                    running = false;
                }
                Thread.Sleep(1000);
            }
            Log("Plugin Ending");
        }

        public void UsePortalBook()
        {
            foreach (var port in me.portalBook.getDistricts())
            {
                if (port.name == destination)
                {
                    port.OpenPortal();
                    Thread.Sleep(1000);
                    while (me.isCasting || me.isGlobalCooldown)
                    {
                        Thread.Sleep(100);
                    }
                    Thread.Sleep(2500);
                    break;
                }
            }
            UsePortal(getMyPortal());
        }

        public Creature getMyPortal()
        {
            Creature myPortal = null;
            foreach (Creature creat in getCreatures())
            {
                if (creat.db.id == 3891 && creat.ownerUniqId == me.uniqId)
                {
                    myPortal = creat;
                }
            }
            return myPortal;
        }
        public bool HaveHereafterstones()
        {
            bool haveHS = false;
            List<Item> inventory = getAllInvItems();
            foreach (Item myitem in inventory)
            {
                if (myitem.name == "Hereafter Stone")
                {
                    haveHS = true;
                }
            }
            return haveHS;
        }


        //2.MOVING to warehouse
        public void moveToWH()
        {
            Gps gps = new Gps(this);
            gps.LoadDataBase(Application.StartupPath + "\\plugins\\Clean\\path.db3");
            while (gps.GpsMove("WH"))
                Thread.Sleep(10220);
        }
        //3.WAREHOUSE
        public void getItemFromWH()
        {
            //not sure if there is a requirement to open the warehouse first here or not
            //If not I would remove this method and call MoveItemFromWh(23633) directly 
            uint _itemid = 23633;
            MoveItemFromWh(_itemid);
        }
        //4.MOVING to craft
        public void moveToCS()
        {
            Gps gps = new Gps(this);
            gps.LoadDataBase(Application.StartupPath + "\\plugins\\Clean\\path.db3");
            while (gps.GpsMove("Craft"))
                Thread.Sleep(10220);
        }
        //5.Crafting 58 Gilda Stars into Dust 
        public void craftGildaDust()
        {
            //You need to write this method still
        }

        //Call on plugin stop
        public void PluginStop()
        {
        }
    }
}
 
Thanks for help UnknownUser but it seems to just Teleport over and over now:)
 
I found that getCurrrentTerritory had no relation to the Memory tomes. So I wrote a method to check if the memory tome you were trying to port to was near and then progresses the script if it is. See below for changes.

EDIT: Dont forget to change destination = "Anvilton" to where ever you want to port.

PHP:
using System;
using System.Windows.Forms;
using System.Threading;
using System.Collections.Generic;
using System.Linq;
using ArcheBuddy.Bot.Classes;


namespace DefaultNameSpace
{
    public class DefaultClass : Core
    {
        private Gps gps;
        bool SprintActivated = false;
        public static string GetPluginAuthor()
        {
            return "Clean";
        }

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

        public static string GetPluginDescription()
        {
            return "Clean";
        }
        bool running = true;
        bool porting = true;
        bool warehousing = false;
        bool movingCS = false;
        bool crafting = false;
        string destination = "Anvilton";

        //Call on plugin start
        //1.TELEPORT
        public void PluginRun()
        { 
            ClearLogs();
            while (running)
            {
                while (porting)
                {
                    if (!(isNearDestinationTome()))
                    {
                        
                        if (HaveHereafterstones() == true)
                        {
                            UsePortalBook();
                            Thread.Sleep(5000);
                        }
                        else
                        {
                            Log("Not Enough Hereafterstones");
                        }

                    }
                    else
                    {
                        porting = false;
                        warehousing = true;
                        Log("You have arrived at " + destination);
                    }
                }
                while (warehousing)
                {
                    bool retrieveItems = false;
                    if (!(retrieveItems))
                    {
                        moveToWH();
                        Thread.Sleep(1000);
                        getItemFromWH();
                        //See comment is getItemFromWH method;
                        retrieveItems = true;
                    }
                    else
                    {
                        warehousing = false;
                        movingCS = true;
                    }
                }
                while (movingCS)
                {
                    moveToCS();
                    movingCS = false;
                    crafting = true;
                }
                while (crafting)
                {
                    craftGildaDust(); //Unfinished method
                    crafting = false;
                }
                if (!porting && !warehousing && !movingCS && !crafting)
                {
                    running = false;
                }
                Thread.Sleep(1000);
            }
            Log("Plugin Ending");
        }

        private bool isNearDestinationTome()
        {
            bool isNear = false;
            List<DoodadObject> doodads = getDoodads();
            String memTome = destination + " Memory Tome";
            List<DoodadObject> tomes = new List<DoodadObject>();
            foreach (DoodadObject dood in doodads.Where(name => name.name.Contains(memTome)))
            {
                Log("Doodad Found: " + dood.name);
                tomes.Add(dood);
            }
            if (tomes.Count > 0)
            {
                isNear = true;
            }
            return isNear;

        }

        public void UsePortalBook()
        {
            foreach (var port in me.portalBook.getDistricts())
            {
                if (port.name == destination)
                {
                    port.OpenPortal();
                    Thread.Sleep(1000);
                    while (me.isCasting || me.isGlobalCooldown)
                    {
                        Thread.Sleep(100);
                    }
                    Thread.Sleep(2500);
                    break;
                }
            }
            UsePortal(getMyPortal());
        }

        public Creature getMyPortal()
        {
            Creature myPortal = null;
            foreach (Creature creat in getCreatures())
            {
                if (creat.db.id == 3891 && creat.ownerUniqId == me.uniqId)
                {
                    myPortal = creat;
                }
            }
            return myPortal;
        }
        public bool HaveHereafterstones()
        {
            bool haveHS = false;
            List<Item> inventory = getAllInvItems();
            foreach (Item myitem in inventory)
            {
                if (myitem.name == "Hereafter Stone")
                {
                    haveHS = true;
                }
            }
            return haveHS;
        }


        //2.MOVING to warehouse
        public void moveToWH()
        {
            Gps gps = new Gps(this);
            gps.LoadDataBase(Application.StartupPath + "\\plugins\\Clean\\path.db3");
            while (gps.GpsMove("WH"))
                Thread.Sleep(10220);
        }
        //3.WAREHOUSE
        public void getItemFromWH()
        {
            //not sure if there is a requirement to open the warehouse first here or not
            //If not I would remove this method and call MoveItemFromWh(23633) directly 
            uint _itemid = 23633;
            MoveItemFromWh(_itemid);
        }
        //4.MOVING to craft
        public void moveToCS()
        {
            Gps gps = new Gps(this);
            gps.LoadDataBase(Application.StartupPath + "\\plugins\\Clean\\path.db3");
            while (gps.GpsMove("Craft"))
                Thread.Sleep(10220);
        }
        //5.Crafting 58 Gilda Stars into Dust 
        public void craftGildaDust()
        {
            //You need to write this method still
        }

        //Call on plugin stop
        public void PluginStop()
        {
        }
    }
}
 
Sadly it teleports moves to WH and stops tried different methods Not sure if its possible but generaly i need to retrive alot of items or all doesnt matter.

Tried to create unit id list like in my Item Deletion pluggin :

For example like that :
{List<uint> item = new List<uint>() { 36108,36109};

Generaly think pluggin is close to finish but most problem with Warehouse
You sure we dont have to interact with Warehouse Manager 1st?

If you could test it somehow would really appreciate.
 
Sorry, but I am in the process of moving half way around the world. It will be several more days before I can look further into the problem.
As far as that warehouse, I think I commented that I was unsure if you had to interact with the warehouse. I would think that you would, but just like the port that AB activates without jumping, you may not. To test if it requires activation you could open a warehouse and run you code there. If it works then you know you need to programically open the warehouse first.
 
I did try to do this and nope i doesnt work i tried .

All i found is what Out posted :

foreach (var item in me.getItems())
{
if (item.place == ItemPlace.Warehouse)
{
.....
}
}
 
I've been fussing over the whole grinding of gilda and since I have sorted that time to hit the next task interacting with warehouse.

Code:
public void DustGrinder()
        {
            while(true){
                var _GildaCount = itemCount(23633);
                
                if(_GildaCount >= 1) {
                    CraftItems("Disintegration: Gilda Stars",1);
                    Log("[INFO] Grinding Gilda into Dust");
                    
                    } 
            }
        }
 
Cool for Gilda part :)

But our problems is still mostly Warehouse if anyone know how to fix it please post
 
BTW i fixed Warehouse part and even added items stacker as it just took them out unstacked and didnt solve the problem . Code is there if anyone interested :


uint _itemid = 25799;
MoveItemFromWh(_itemid);
Thread.Sleep(150);
Item item1 = null;
Item item2 = null;
foreach (var item in me.getItems())
{
if(item.place == ItemPlace.Bag)
{
if(item.id == _itemid && item.count ==1 | >=2)
item1 = item;
if(item.id == _itemid && item.count >=1 | <=99)
item2 = item;
}
}
if (item1 != null && item2 != null)
item1.Merge(item2);
 
Last edited:
Back
Top