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

Coder77

New Member
Joined
Sep 24, 2015
Messages
23
Reaction score
0
I eventually will release that for free cause I already have money, but its basically an XML config Hard Core - Auto Farmer. But I need some help, so if you're interested in what this can do, a little help goes a long way. Any missing code is just because hte problem is occuring when I try to do getDoodadskill on the doodad. I try to do a LINQ statement so that I only get skills that have gather in them. so that the xml config is super easy and not like "Gather Iris: Spend X Labor points to gather Iris". So the guy goes to a spot, uses a list of owners, and basically farms all the farms with family access by first farming the plant, and then replacing it if it dies.

Let me know.

Code:
class Plant
    {
        public Plant()
        {

        }

        public string ItemName { get; set; }
        public string SeedName { get; set; }
        public string MatureName { get; set; }
        public string Skill { get; set; }
        public string FarmGpsName { get; set; }
    }

Class hcFarmer
{
private void FarmArea(string farmGpsName)
        {
            try
            {
                foreach (Creature c in getCreatures().FindAll(c => c.type == BotTypes.Housing))
                {
                    Housing h = (Housing)c;
                    if(m_Owners.Contains(h.ownerName))
                    {
                        
                        foreach (DoodadObject doo in getDoodads().FindAll(d => d.plantZoneId == h.plantZoneId))
                        {
                            if (IsReadyForTending(doo))
                            {
                                double x = doo.X;
                                double y = doo.Y;
                                double z = doo.Z;



                                LogMessage(string.Format("Reviewing Doo - {0}", doo.name), "Debug");
                                if(m_Plants.Exists(p => p.MatureName == doo.name))
                                { 
                                    if (doo.getUseSkills().Exists(s => s.name.Contains(m_Plants.Find(p => p.MatureName == doo.name).Skill)))
                                    {
                                        LogMessage(string.Format("Reviewing Doo - {0}", doo.name), "Debug");

                                        /* I am getting an error on getting skill. It keeps saying null reference. on the return */
                                        Skill skill = doo.getUseSkills().Find(s => s.name.Contains(m_Plants.Find(p => p.MatureName == doo.name).Skill));
                                        if (skill != null)
                                        {
                                            LogMessage("Using skill - " + skill.desc, "Skill Use");
                                            MoveTo(doo);
                                            UseDoodadSkill(skill.id, doo, true);
                                            LogMessage(string.Format("Gathered {0}.", doo.name));

                                            // As you can see I used a lambda expression to query the list within the arguments.
                                            //   I feel like it saves variable space.
                                            TryToReplant(x, y, z, m_Plants.Find(p => p.MatureName == doo.name).SeedName);

                                            Thread.Sleep(50);
                                        }
                                    }

                                }
                                
                                
                                else
                                {
                                    string logMsg = string.Format("Unable to find the skill to use on doodad {0}.", doo.name);
                                    LogError(logMsg);
                                }
                            }
                        }

                    }


                    
                }

            }
            catch (Exception Ex)
            {
                LogException(Ex);
                LogError("Failed to farm the area.");
                throw;
            }
        }
        private void LoadPlants(XElement xPlants)
        {
            try
            {
                var qPlants = from p in xPlants.Elements("Plant")
                              select p;

                foreach (XElement xPlant in qPlants)
                {
                    Plant p = new Plant();
                    p.SeedName = xPlant.Element("SeedName").Value.ToString();
                    p.MatureName = xPlant.Element("MatureName").Value.ToString();
                    p.Skill = xPlant.Element("Skill").Value.ToString();
                    p.ItemName = xPlant.Element("ItemName").Value.ToString();

                    m_Plants.Add(p);
                }
            }
            catch(Exception ex)
            {
                LogException(ex);
                Log("Failed to load plants.");
                throw;
            }
        }
}


My Xml Config File as well.

HTML:
[CODE]<?xml version="1.0" encoding="utf-8" ?>
<myFarmer>
  <Owners>
    <Owner>Misfits</Owner>
    <Owner>Coder</Owner>
    <Owner>School</Owner>
    <Owner>Stealth</Owner>
    <Owner>Comefitemeillfkyouup</Owner>
    <Owner>Ganongoat</Owner>
  </Owners>
  <Plants>
    <Plant>
      <SeedName>Lemon Sapling</SeedName>
      <MatureName>Fruited Lemon Tree</MatureName>
      <Skill>Gather</Skill>
      <ItemName>Lemon</ItemName>
    </Plant>
    <Plant>
      <SeedName>Lotus</SeedName>
      <MatureName>Lotus</MatureName>
      <Skill>Gathering</Skill>
      <ItemName>Lemon</ItemName>
    </Plant>
    <Plant>
      <SeedName>Mint Seedling</SeedName>
      <MatureName>Mint</MatureName>
      <Skill>Gathering</Skill>
      <ItemName>Mint</ItemName>
    </Plant>
  </Plants>
  <Farms>
    <Farm>Farm</Farm>
    <Farm>Farm02</Farm>
  </Farms>
</myFarmer>[/CODE]
 
Last edited:
So you're just trying to find the skill 'description' for the doodad?

#edit

There's genuinely no reason at all for you to save the skill.
Try using this somewhere in your script.

Code:
public string GatherSkill(DoodadObject dood)
        {
            string skill = "";
            foreach (Skill sk in dood.getUseSkills())
            { skill = sk.desc; break; }
            return skill;
        }

// Now when you want to gather something, just use the GatherSkill() function to get the full string - you already have the DoodadObject.

UseDoodadSkill(GatherSkill(somedood), somedood, true, 1.5);

Good luck
 
Last edited:
guys like you are what makes the botting community great. looking forward to seeing the release!
 
Hey guys, will release soon, I have been off for a week. Real life hits hard sometimes, and you gotta drop the things you love for a split second. The only reason I play this game is for the programming aspect that Out was so generous to create for us through his API and Archebuddy.
 
Back
Top