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

Get local housing / farms

Status
Not open for further replies.

czzplnm

Member
Joined
Jun 18, 2012
Messages
88
Reaction score
0
I want my bot to check nearby houses / farms, so far I have only got this code to show "Scarecrow" Gardens. I want it to check the expiration of all nearby housing / farms and log ones within a time frame.

I thought getAllTerritorys did it, but I was wrong.

PHP:
            List<DoodadObject> localDoodads = getDoodads();

            for (int i = 0; i < localDoodads.Count; i++)
            {
                if (!localDoodads[i].name.Contains("Scarecrow") && !localDoodads[i].name.Contains("Cottage"))
                    continue;

                Log("Name: " + localDoodads[i].name + " Owned ID: " + localDoodads[i].ownerObjId.ToString() + " Plant Time: " + localDoodads[i].plantTime.ToString() + " Farm ID: " + localDoodads[i].commonFarmId.ToString());
                Thread.Sleep(timerDelay);
                double theDistance = me.dist(localDoodads[i]);
                Log("Distance: " + theDistance.ToString());
                Thread.Sleep(timerDelay);
            }

Just point me to something please :(
 
get houses
loop over
update tax info
check weeksWithoutPay property
get date from taxPayedTime property (its a unix timestamp)

Code:
var houses = getCreatures().Where(creature => creature.type == BotTypes.Housing).Cast<Housing>().ToList();
foreach (var house in houses) 
{
     house.UpdateTaxInfo();
     if (house.weeksWithoutPay >= 1) {
          // expiring
     }
     Thread.Sleep(longSleep);
}

tip: use a long sleep between each interation
 
Status
Not open for further replies.
Back
Top