amazingnessn
New Member
- Joined
- May 23, 2014
- Messages
- 69
- Reaction score
- 0
[Plugin] Another auto farming plugin, now with farmID auto assignment and gui!
Code updated 18/8/15. Remade plugin and added gui.
Base of this is from several other farming plugins, specifically ones made by Voyager92 and xact.
This is my second attempt at a Windows Forms application, I've tested it myself to make sure it won't cause archebuddy to crash. May still be some smaller bugs.
Works for multiple farms.
Saves settings for quick startup.
Supports GPS from vendor to farm. MUST label vendor point "Vendor".
Buy Amount - Put how many seeds you want to buy for this plant, will buy enough to equal this number. For example, if number entered is 500 and you already have 250 in inventory, will only buy 250 more to equal the 500.
Note: GPS is off by default, check Gps box if you plan to use it.
Supports auto Farm Id gathering - Takes names entered for your farms (default examples are scarecrow farm, gazebo farm, etc.) Rename your farms in-game if you have multiple with different plants on each.
Original plugin code here - no gui and requires first-time setup.
I'll try to help with issues users might have.
Main reason I made this is for the auto farm ID support that other plugins lacked.
View attachment Farm.zip - Use dll included or compile 'Farm' in ArcheBuddy plugin editor.
Code updated 18/8/15. Remade plugin and added gui.
Base of this is from several other farming plugins, specifically ones made by Voyager92 and xact.
This is my second attempt at a Windows Forms application, I've tested it myself to make sure it won't cause archebuddy to crash. May still be some smaller bugs.
Works for multiple farms.
Saves settings for quick startup.
Supports GPS from vendor to farm. MUST label vendor point "Vendor".
Buy Amount - Put how many seeds you want to buy for this plant, will buy enough to equal this number. For example, if number entered is 500 and you already have 250 in inventory, will only buy 250 more to equal the 500.
Note: GPS is off by default, check Gps box if you plan to use it.
Supports auto Farm Id gathering - Takes names entered for your farms (default examples are scarecrow farm, gazebo farm, etc.) Rename your farms in-game if you have multiple with different plants on each.

Original plugin code here - no gui and requires first-time setup.
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Threading;
using System.Collections.Generic;
using System.Linq;
using ArcheBuddy.Bot.Classes;
namespace YourNamespace {
public class YourClass: Core {
public static string GetPluginAuthor()
{
return "amazingnessn";
}
public static string GetPluginVersion()
{
return "1.1";
}
public static string GetPluginDescription()
{
return "Farming Bot - Auto gather/plant your crops with auto farm ID";
}
// ----------------------------------------------- if you have more/less # of farms, add/comment out what you need --------------------------------
// ------------------------------------------------ Change Farm Names Here ---------------------------------------------------------
private string farm1name = "Gazebo Farm";
private string farm2name = "Thatched Farmhouse";
private string farm3name = "Scarecrow Farm";
//private string farm4name = "FARM NAME HERE";
//private string farm5name = "FARM NAME HERE";
private uint farm1id;
private uint farm2id;
private uint farm3id;
//private uint farm4id;
//private uint farm5id;
// -------------------- Gps Functions, add more functions if you have farms spread out and need gps to go between them --------------------//
private bool gps_on = false; //Set to true if using gps, false if not
private Gps gps;
string _gpsfile = "\\plugins\\Farms\\Farming.db3";
public void MoveToFarm()
{
gps = new Gps(this);
gps.LoadDataBase(Application.StartupPath + _gpsfile);
gps.GpsMove("Farms");
}
public void MoveToVendor()
{
gps = new Gps(this);
gps.LoadDataBase(Application.StartupPath + _gpsfile);
gps.GpsMove("Seed Merchant");
}
public void GetFarmIds()
{
// Don't edit this if you don't know what it does
int p = 0;
List<long> farmids = new List<long>();
List<string> farmnames = new List<string>();
List<Creature> farms = getCreatures().Where(x => x.type == BotTypes.Housing).ToList();
List<Creature> farms1 = farms.Where(x => x.ownerUniqId == me.uniqId).ToList();
List<Creature> farmsfam = farms.Where(x => x.ownerUniqId != me.uniqId).ToList();
foreach(var y in farms) {
if (farms1.Count > 0) {
Housing plnt = farms1.First() as Housing;
farmids.Add(plnt.uniqHousingId);
farmnames.Add(plnt.name);
farms1.RemoveAt(0);
}
if (farmsfam.Count > 0) {
Housing plnt1 = farmsfam.First() as Housing;
foreach(var d in me.family.getMembers()){
if (plnt1.ownerName == d.name) {
farmids.Add(plnt1.uniqHousingId);
farmnames.Add(plnt1.name);
farmsfam.RemoveAt(0);
}
}
}
}
foreach(var i in farmnames){
if (farmnames[p] == this.farm1name) { this.farm1id = (uint)farmids[p]; }
if (farmnames[p] == this.farm2name) { this.farm2id = (uint)farmids[p]; }
if (farmnames[p] == this.farm3name) { this.farm3id = (uint)farmids[p]; }
//if (farmnames[p] == this.farm4name) { this.farm4id = (uint)farmids[p]; }
//if (farmnames[p] == this.farm5name) { this.farm5id = (uint)farmids[p]; }
p++;
}
}
public void PluginRun() {
ClearLogs();
Log("Starting Farm Bot...");
// --------------------------------------- stops if under this much labor, change if desired---------------------------------------------------
int laborstop = 200;
// ------------------------------------- put farmID, seed, plant, collect strings here --------------------------------------
//FARM 1
var farm1seed = "SEED NAME HERE";
var farm1plant = "PLANT NAME HERE";
var farm1collect = "TOOLTIP STRING HERE";
//FARM 2
var farm2seed = "SEED NAME HERE";
var farm2plant = "PLANT NAME HERE";
var farm2collect = "TOOLTIP STRING HERE";
//FARM 3
var farm3seed = "SEED NAME HERE";
var farm3plant = "PLANT NAME HERE";
var farm3collect = "TOOLTIP STRING HERE";
/*//FARM 4
var farm4seed = "SEED NAME HERE";
var farm4plant = "PLANT NAME HERE";
var farm4collect = "TOOLTIP STRING HERE";
//FARM 5
var farm5seed = "SEED NAME HERE";
var farm5plant = "PLANT NAME HERE";
var farm5collect = "TOOLTIP STRING HERE"; */
// ----------------------------------------- how many seeds to buy when you get low -----------------------------------------
var farm1seedbuy = 1000;
var farm2seedbuy = 1000;
var farm3seedbuy = 1000;
//var farm4seedbuy = 1000;
//var farm5seedbuy = 1000;
while (true) {
var farm1seedcount = itemCount(farm1seed);
var farm2seedcount = itemCount(farm2seed);
var farm3seedcount = itemCount(farm3seed);
//var farm4seedcount = itemCount(farm4seed);
//var farm5seedcount = itemCount(farm5seed);
//Gather infos
if (gameState == GameState.Ingame){
GetFarmIds();
Log(farm1id.ToString());
Log(farm2id.ToString());
Log(farm3id.ToString());
//get Labor points
int labor = me.laborPoints;
//Start Doin Stuff
//if Labor > 200
if (labor > laborstop) {
if (gps_on == true){
if (farm1seedcount < (farm1seedbuy / 5) | farm2seedcount < (farm2seedbuy / 5) | farm3seedcount < (farm3seedbuy / 5)) {
MoveToVendor();
Thread.Sleep(2000);
if (farm1seedcount < (farm1seedbuy / 5)) {BuyItems(farm1seed, farm1seedbuy);}
if (farm2seedcount < (farm2seedbuy / 5)) {BuyItems(farm2seed, farm2seedbuy);}
if (farm3seedcount < (farm3seedbuy / 5)) {BuyItems(farm3seed, farm3seedbuy);}
//if (farm4seedcount < (farm4seedbuy / 10)) {BuyItems(farm4seed, farm4seedbuy);}
//if (farm5seedcount < (farm5seedbuy / 10)) {BuyItems(farm5seed, farm5seedbuy);}
Thread.Sleep(5000);
MoveToFarm();
}}
//add/remove farms here
//Plant farm 1
SetPlantMotionType(PlantMotionType.Standart); // change motion type if needed
CollectItemsAtFarm(farm1plant, farm1collect, farm1id);
CollectItemsAtFarm(farm1plant, farm1collect, farm1id);
CollectItemsAtFarm(farm1plant, farm1collect, farm1id);
PlantItemsAtFarm(farm1seed, farm1id);
//Plant farm 2
CollectItemsAtFarm(farm2plant, farm2collect, farm2id);
CollectItemsAtFarm(farm2plant, farm2collect, farm2id);
CollectItemsAtFarm(farm2plant, farm2collect, farm2id);
PlantItemsAtFarm(farm2seed, farm2id);
//Plant farm 3
CollectItemsAtFarm(farm3plant, farm3collect, farm3id);
CollectItemsAtFarm(farm3plant, farm3collect, farm3id);
CollectItemsAtFarm(farm3plant, farm3collect, farm3id);
PlantItemsAtFarm(farm3seed, farm3id);
/*//Plant farm 4
CollectItemsAtFarm(farm4plant, farm4collect, farm4id);
CollectItemsAtFarm(farm4plant, farm4collect, farm4id);
CollectItemsAtFarm(farm4plant, farm4collect, farm4id);
PlantItemsAtFarm(farm4seed, farm4id);
//Plant farm 5
CollectItemsAtFarm(farm5plant, farm5collect, farm5id);
CollectItemsAtFarm(farm5plant, farm5collect, farm5id);
CollectItemsAtFarm(farm5plant, farm5collect, farm5id);
PlantItemsAtFarm(farm5seed, farm5id); */
//if Labor < 200 wait
} else {
PlantItemsAtFarm(farm1seed, farm1id);
PlantItemsAtFarm(farm2seed, farm2id);
PlantItemsAtFarm(farm3seed, farm3id);
//PlantItemsAtFarm(farm4seed, farm4id);
//PlantItemsAtFarm(farm5seed, farm5id);
Log("Labor under 200, waiting to regen");
}
//Generate random time between 3-5 minutes
Random random = new Random();
decimal mseconds = random.Next(180, 300) * 1000;
decimal seconds = mseconds / 1000;
decimal minutes = seconds / 60;
Log("Waiting for " + minutes.ToString() + " minutes");
//sleep for random time
Thread.Sleep((int)mseconds);
}
}
}
//Call on plugin stop
public void PluginStop()
{
Log("Plugin Stopped...");
}
}
}
using System.Drawing;
using System.Windows.Forms;
using System.Threading;
using System.Collections.Generic;
using System.Linq;
using ArcheBuddy.Bot.Classes;
namespace YourNamespace {
public class YourClass: Core {
public static string GetPluginAuthor()
{
return "amazingnessn";
}
public static string GetPluginVersion()
{
return "1.1";
}
public static string GetPluginDescription()
{
return "Farming Bot - Auto gather/plant your crops with auto farm ID";
}
// ----------------------------------------------- if you have more/less # of farms, add/comment out what you need --------------------------------
// ------------------------------------------------ Change Farm Names Here ---------------------------------------------------------
private string farm1name = "Gazebo Farm";
private string farm2name = "Thatched Farmhouse";
private string farm3name = "Scarecrow Farm";
//private string farm4name = "FARM NAME HERE";
//private string farm5name = "FARM NAME HERE";
private uint farm1id;
private uint farm2id;
private uint farm3id;
//private uint farm4id;
//private uint farm5id;
// -------------------- Gps Functions, add more functions if you have farms spread out and need gps to go between them --------------------//
private bool gps_on = false; //Set to true if using gps, false if not
private Gps gps;
string _gpsfile = "\\plugins\\Farms\\Farming.db3";
public void MoveToFarm()
{
gps = new Gps(this);
gps.LoadDataBase(Application.StartupPath + _gpsfile);
gps.GpsMove("Farms");
}
public void MoveToVendor()
{
gps = new Gps(this);
gps.LoadDataBase(Application.StartupPath + _gpsfile);
gps.GpsMove("Seed Merchant");
}
public void GetFarmIds()
{
// Don't edit this if you don't know what it does

int p = 0;
List<long> farmids = new List<long>();
List<string> farmnames = new List<string>();
List<Creature> farms = getCreatures().Where(x => x.type == BotTypes.Housing).ToList();
List<Creature> farms1 = farms.Where(x => x.ownerUniqId == me.uniqId).ToList();
List<Creature> farmsfam = farms.Where(x => x.ownerUniqId != me.uniqId).ToList();
foreach(var y in farms) {
if (farms1.Count > 0) {
Housing plnt = farms1.First() as Housing;
farmids.Add(plnt.uniqHousingId);
farmnames.Add(plnt.name);
farms1.RemoveAt(0);
}
if (farmsfam.Count > 0) {
Housing plnt1 = farmsfam.First() as Housing;
foreach(var d in me.family.getMembers()){
if (plnt1.ownerName == d.name) {
farmids.Add(plnt1.uniqHousingId);
farmnames.Add(plnt1.name);
farmsfam.RemoveAt(0);
}
}
}
}
foreach(var i in farmnames){
if (farmnames[p] == this.farm1name) { this.farm1id = (uint)farmids[p]; }
if (farmnames[p] == this.farm2name) { this.farm2id = (uint)farmids[p]; }
if (farmnames[p] == this.farm3name) { this.farm3id = (uint)farmids[p]; }
//if (farmnames[p] == this.farm4name) { this.farm4id = (uint)farmids[p]; }
//if (farmnames[p] == this.farm5name) { this.farm5id = (uint)farmids[p]; }
p++;
}
}
public void PluginRun() {
ClearLogs();
Log("Starting Farm Bot...");
// --------------------------------------- stops if under this much labor, change if desired---------------------------------------------------
int laborstop = 200;
// ------------------------------------- put farmID, seed, plant, collect strings here --------------------------------------
//FARM 1
var farm1seed = "SEED NAME HERE";
var farm1plant = "PLANT NAME HERE";
var farm1collect = "TOOLTIP STRING HERE";
//FARM 2
var farm2seed = "SEED NAME HERE";
var farm2plant = "PLANT NAME HERE";
var farm2collect = "TOOLTIP STRING HERE";
//FARM 3
var farm3seed = "SEED NAME HERE";
var farm3plant = "PLANT NAME HERE";
var farm3collect = "TOOLTIP STRING HERE";
/*//FARM 4
var farm4seed = "SEED NAME HERE";
var farm4plant = "PLANT NAME HERE";
var farm4collect = "TOOLTIP STRING HERE";
//FARM 5
var farm5seed = "SEED NAME HERE";
var farm5plant = "PLANT NAME HERE";
var farm5collect = "TOOLTIP STRING HERE"; */
// ----------------------------------------- how many seeds to buy when you get low -----------------------------------------
var farm1seedbuy = 1000;
var farm2seedbuy = 1000;
var farm3seedbuy = 1000;
//var farm4seedbuy = 1000;
//var farm5seedbuy = 1000;
while (true) {
var farm1seedcount = itemCount(farm1seed);
var farm2seedcount = itemCount(farm2seed);
var farm3seedcount = itemCount(farm3seed);
//var farm4seedcount = itemCount(farm4seed);
//var farm5seedcount = itemCount(farm5seed);
//Gather infos
if (gameState == GameState.Ingame){
GetFarmIds();
Log(farm1id.ToString());
Log(farm2id.ToString());
Log(farm3id.ToString());
//get Labor points
int labor = me.laborPoints;
//Start Doin Stuff
//if Labor > 200
if (labor > laborstop) {
if (gps_on == true){
if (farm1seedcount < (farm1seedbuy / 5) | farm2seedcount < (farm2seedbuy / 5) | farm3seedcount < (farm3seedbuy / 5)) {
MoveToVendor();
Thread.Sleep(2000);
if (farm1seedcount < (farm1seedbuy / 5)) {BuyItems(farm1seed, farm1seedbuy);}
if (farm2seedcount < (farm2seedbuy / 5)) {BuyItems(farm2seed, farm2seedbuy);}
if (farm3seedcount < (farm3seedbuy / 5)) {BuyItems(farm3seed, farm3seedbuy);}
//if (farm4seedcount < (farm4seedbuy / 10)) {BuyItems(farm4seed, farm4seedbuy);}
//if (farm5seedcount < (farm5seedbuy / 10)) {BuyItems(farm5seed, farm5seedbuy);}
Thread.Sleep(5000);
MoveToFarm();
}}
//add/remove farms here
//Plant farm 1
SetPlantMotionType(PlantMotionType.Standart); // change motion type if needed
CollectItemsAtFarm(farm1plant, farm1collect, farm1id);
CollectItemsAtFarm(farm1plant, farm1collect, farm1id);
CollectItemsAtFarm(farm1plant, farm1collect, farm1id);
PlantItemsAtFarm(farm1seed, farm1id);
//Plant farm 2
CollectItemsAtFarm(farm2plant, farm2collect, farm2id);
CollectItemsAtFarm(farm2plant, farm2collect, farm2id);
CollectItemsAtFarm(farm2plant, farm2collect, farm2id);
PlantItemsAtFarm(farm2seed, farm2id);
//Plant farm 3
CollectItemsAtFarm(farm3plant, farm3collect, farm3id);
CollectItemsAtFarm(farm3plant, farm3collect, farm3id);
CollectItemsAtFarm(farm3plant, farm3collect, farm3id);
PlantItemsAtFarm(farm3seed, farm3id);
/*//Plant farm 4
CollectItemsAtFarm(farm4plant, farm4collect, farm4id);
CollectItemsAtFarm(farm4plant, farm4collect, farm4id);
CollectItemsAtFarm(farm4plant, farm4collect, farm4id);
PlantItemsAtFarm(farm4seed, farm4id);
//Plant farm 5
CollectItemsAtFarm(farm5plant, farm5collect, farm5id);
CollectItemsAtFarm(farm5plant, farm5collect, farm5id);
CollectItemsAtFarm(farm5plant, farm5collect, farm5id);
PlantItemsAtFarm(farm5seed, farm5id); */
//if Labor < 200 wait
} else {
PlantItemsAtFarm(farm1seed, farm1id);
PlantItemsAtFarm(farm2seed, farm2id);
PlantItemsAtFarm(farm3seed, farm3id);
//PlantItemsAtFarm(farm4seed, farm4id);
//PlantItemsAtFarm(farm5seed, farm5id);
Log("Labor under 200, waiting to regen");
}
//Generate random time between 3-5 minutes
Random random = new Random();
decimal mseconds = random.Next(180, 300) * 1000;
decimal seconds = mseconds / 1000;
decimal minutes = seconds / 60;
Log("Waiting for " + minutes.ToString() + " minutes");
//sleep for random time
Thread.Sleep((int)mseconds);
}
}
}
//Call on plugin stop
public void PluginStop()
{
Log("Plugin Stopped...");
}
}
}
I'll try to help with issues users might have.
Main reason I made this is for the auto farm ID support that other plugins lacked.
View attachment Farm.zip - Use dll included or compile 'Farm' in ArcheBuddy plugin editor.
Last edited: