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

[Free Plugin] AFK Coinpurse Opener

remark

New Member
Joined
Nov 13, 2014
Messages
58
Reaction score
0
I always end up with a ton of coin purses that i forget to open, and when i want to open them i run out, or have no labor points.

so i created this:

Update : 1 Feb 2015 Added a small random movement, so it looks like you rummaging around your house.¨
Update : 2 Feb 2015 Fixed a small issuea with f2p coinpurse openings should now function properly
Update : 2 Feb 2015 Did a little clean up, and stuffs. should be more informative.¨
Update : 13 Feb 2015 Did some more clean up, as it wasnt working properly for f2p, but should work now, and open alot more bags, but at the cost of more labor. but still be generating a small surplus of labor
Update : 6 Mar 2015: updated a bit
PHP:
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Threading;
using System.Collections.Generic;
using System.Linq;
using ArcheBuddy.Bot.Classes;

namespace Coiny{
    public class CoinyClass : Core
    {
        public static string GetPluginAuthor(){return "Remark";}
        public static string GetPluginVersion(){return "1.0.0.0";}
        public static string GetPluginDescription(){return "For patrons will open a coin purse every 5 minutes, for f2p every 10 minutes";}
        
        double meX,meY,meZ = 0;
        private Random random = new Random();
        //   29203   29204   29205     29206  29207 //
        long farmer, priest, merchant, noble, jester = 0;
        int LP  = 0;
        
        
        
        void OpenPurses(int labor)
        {                          
            MoveTo(meX, meY, meZ);
            if(labor>0)
                Log(Time()+"Gained " +labor.ToString()+" Labor Point(s).(Total LP:"+me.laborPoints.ToString()+")"); 
            
            int currentLP = me.laborPoints;
            
            if((me.laborPoints - LP) >= 10 )
            {
                Log(Time()+"Trying to open coinpurses");
                Wait(5,10);
                bool allreadyopened = false;

                if(farmer > 0 && !allreadyopened)
                {   
                    int c = 0;
                    while(c < 9)
                    { 
                        UseItemAndWait(29203);
                        c++;
                        farmer--;
                        if(farmer < 1)
                            break;
                    }
                    Log(Time()+"Used "+(me.laborPoints-LP)+" Labor Point(s).(Total LP:"+me.laborPoints.ToString()+")");
                    Log("Used: "+c.ToString()+"x[Farmer's Coinpurses]");
                    allreadyopened = true;
                }

                if(priest > 0 && !allreadyopened)
                {   
                    int c = 0;
                    while(c < 4)
                    { 
                        UseItemAndWait(29204);
                        c++;
                        priest--;
                        if(priest < 1)
                            break;
                    }
                    Log(Time()+"Used "+(me.laborPoints-LP)+" Labor Point(s).(Total LP:"+me.laborPoints.ToString()+")");
                    Log("Used: "+c.ToString()+"x[Priest's Coinpurses]");
                    allreadyopened = true;
                }
                
                
                if(merchant > 0 && !allreadyopened)
                {   
                    int c = 0;
                    while(c < 3)
                    { 
                        UseItemAndWait(29205);
                        c++;
                        merchant--;
                        if(merchant < 1)
                            break;
                    }
                    Log(Time()+"Used "+(currentLP-me.laborPoints)+" Labor Point(s).(Total LP:"+me.laborPoints.ToString()+"Laborpoints)");
                    Log("Used: "+c.ToString()+"x[Merchant's Coinpurses]");                    
                    allreadyopened = true;
                }
                
                if(noble > 0 && !allreadyopened)
                {
                    int c = 0;
                    while(c < 2)
                    { 
                        UseItemAndWait(29206);
                        c++;
                        noble--;
                        if(noble < 1)
                            break;
                    }   
                    Log(Time()+"Used "+(me.laborPoints-LP)+" Labor Point(s).(Total LP:"+me.laborPoints.ToString()+")");
                    Log("Used: "+c.ToString()+"x[Noble's Coinpurse]");
                    allreadyopened = true;
                }

                
                if(jester > 0 && !allreadyopened)
                {
                    UseItemAndWait(29207);
                    jester--;
                    Log(Time()+"Used "+(me.laborPoints-LP)+" Labor Point(s).(Total LP:"+me.laborPoints.ToString()+")");
                    Log("Used: [Jesters's Coinpurse]");
                    allreadyopened = true;
                }

                
                LP = me.laborPoints;            
            }
            
            
            moveRandom();
        }
       
        //Call on plugin start
        public void PluginRun()
        {
            ClearLogs();
            Log(Time()+"-- Starting Coinpurse opener --");
            Log("Starting Labor : "+me.laborPoints.ToString());
            farmer   = itemCount(29203);
            priest   = itemCount(29204);
            merchant = itemCount(29205);
            noble    = itemCount(29206);
            jester   = itemCount(29207);
            if(farmer > 0) Log(farmer.ToString()+" : Farmer's Coinpurse");
            if(priest > 0) Log(priest.ToString()+" : Priest's Coinpurse");
            if(merchant > 0) Log(merchant.ToString()+" : Merchant's Coinpurse");
            if(noble > 0) Log(noble.ToString()+" : Noble's Coinpurse");
            if(jester > 0) Log(jester.ToString()+" : Jester's Coinpurse");
            
            meX = me.X;
            meY = me.Y;
            meZ = me.Z;
            onLaborAmountChanged += OpenPurses; 
            LP = me.laborPoints;
            while(gameState == GameState.Ingame)
            {
                Thread.Sleep(250);
            }
        }
        
        //Call on plugin stop
        public void PluginStop()
        {
        }    

        private void Wait(int min, int max)
        {
            int ran = random.Next(min*1000, max*1000) ;
            Log(Time()+"Waiting for "+(ran/1000).ToString()+" seconds");
            Thread.Sleep(ran);
        }
            
        
        public void moveRandom()
        {
            int ranX = random.Next(-3,3);
            int ranY = random.Next(-3,3);
            MoveTo(meX+ranX,meY+ranY,meZ);
        }
        public string Time() //- Get Time
        {
            string A = DateTime.Now.ToString("[HH:mm:ss] ");
            return A;
        }
        
        private bool UseItemAndWait(uint itemId, bool selfTarget = false)
        {
            while (me.isCasting || me.isGlobalCooldown)
                Thread.Sleep(50);

            UseItem(itemId, false);

            while (me.isCasting || me.isGlobalCooldown)
                Thread.Sleep(10);

            return true;
        }
        
   }
}

It will try and open coinpurses everytime you gain 10 or more labor.
then
if you have farmer purses open 5 of them
if you have priest purses open 3 of them
and so on.

this i leave running in my house, and i both open my purses and slowly regain some labor.

I put in a random wait before opening a purse, not sure if its needed or not. but figured why not do it.

the wait is between 5 and 10 seconds.

have had it running for a total of 10 hours so far, longest continous run was 5 hours.

so yeah. use it if you want, change and improve it if you can.
 
Last edited:
error CS0101: The namespace 'DefaultNameSpace' already contains a definition for 'DefaultClass'
 
Back
Top