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

XML Conditions in OrderBot Profiles

Djekkie

New Member
Joined
Jul 10, 2014
Messages
45
Reaction score
5
Hi,

Excuse me if this has been asked before, I tried searching and failed to find what I was looking for (though that could've been just me) but I'm trying to check for a condition during gathering.
Basically, I want to check if a current GatheringItem is present in the GatheringWindowItem list of GatheringItems and then perform gatheringskills.
I.e. only use a "Ward" gathering ability when Crystals are present instead of shards.

I was able to check whether or not an item was present with running the C# code in the console
if(GatheringWindow.GatheringWindowItems.Exists(x => x.ItemId == 11)
{ Log("Yes"); } else { Log("No"); }

Adding this as a XML condition however, didn't work (didn't expect it to, but tried anyway).
<If Condition="GatheringWindow.GatheringWindowItems.Exists(x => x.ItemId == 11)">gathering skills here</If>

So how do I check for this particular condition?

Also is there a list of conditions that the XML can read as a reference?

Thanks in advance! :)
 
All conditions are in the ff14bot.NeoProfiles.ConditionParser namespace.

There's no way to do what you want to without writing a custom tag, which would be a lot of work. You're more than welcome to, all the functions you need are exposed by the API, but I personally think the cost benefit ratio on that would not be great.
 
So far I've tried a few things, with writing a seperate behaviour class extending the GatherTag, but I felt i was doing that wrong as I had no idea what methods to call that interact with the gathering window.
At the moment I'm trying to accomplish something by attempting to extend the ConditionParser, as I looked at conditions like ItemCount(id) etc.
Or can we not use If statements nested inside the GatherTag?
 
So far I've tried a few things, with writing a seperate behaviour class extending the GatherTag, but I felt i was doing that wrong as I had no idea what methods to call that interact with the gathering window.
At the moment I'm trying to accomplish something by attempting to extend the ConditionParser, as I looked at conditions like ItemCount(id) etc.
Or can we not use If statements nested inside the GatherTag?

No if statements can be nested in the Gather tag. The Gather tag is one tag, and all "sub"-tags are attributes that modify it (not separate tags) and therefore don't support if statements modifying them. You'd be better served writing a tag from scratch than extending GatherTag, imo.
 
I'm starting to understand how much work this is going to be to get this configured, but since I'm more in it for the learning experience than the actual outcome, I'll take that as a neccessary evil.
I've been making some progress with it (not much, since trying to decipher the workings of the GatherTag when everything is set to private), but I keep running into the issue where my Poi is being reset after inserting the hook.
I'm not sure what I'm missing, though it's probably something that's staring me right in the face.

Here's the log, including some of the write messages I set while executing the code.

View attachment 4996 2015-02-01 20.05.txt

The main code I put together for this:

Code:
        private void _setPoi()
        {
            // Check if our list contains any entries.
            if (_gatheringPointList.Any())
            {
                // Log the count of entries.
                Logging.Write("There are {0} entries in the list of Gathering points.", _gatheringPointList.Count());
                // Loop through the entries.
                foreach (GatheringPointObject gatheringPointObject in _gatheringPointList)
                {
                    // If our object is valid and the name matches our set gatherobject.
                    if (gatheringPointObject.IsValid && gatheringPointObject.IsVisible)
                    {
                        // Log our current point info.
                        Logging.Write("Current point with Name {0} & Id {1} at location {2} is a valid Gathering point.", gatheringPointObject.Name, gatheringPointObject.ObjectId, gatheringPointObject.Location);
                        // Set our current point of interest.
                        Poi.Current = new Poi(gatheringPointObject, PoiType.Gather);
                        // Break out of the loop.
                        break;
                    }
                }
            }
        }

Code:
        protected Composite MoveToNode()
        {
            // Log our current poi location.
            Logging.Write("POI Current Location is {0}.", Poi.Current.Location);
            // Log our current player location.
            Logging.Write("Current player location is {0}.", Core.Me.Location);
            // Return the new Priority selector.
            return new PrioritySelector(
                CommonBehaviors.MoveAndStop(ret => Poi.Current.Location, 3, true),
                new ActionAlwaysSucceed()
            );
        }

Code:
        protected override void OnStart()
        {
            // Populate the Gathering pointlist with objects of type GatheringPointObject.
            _gatheringPointList = GameObjectManager.GetObjectsOfType<GatheringPointObject>().Where(x => x.Name == GatherObject);
            // Set the profile navigator.
            _profileNavigator = Navigator.NavigationProvider as GaiaNavigator;
            // Set the point of interest.
            _setPoi();
            // Log our current point of interest.
            Logging.Write(Poi.Current);
            _behavior = MoveToNode();
            // Set the hotspot to the first hotspot in our list.
            _hotSpot = HotSpots[0];
            // Enqueue the remaining hotspots to the hotspot queue.
            foreach (HotSpot hotSpot in HotSpots)
                _hotSpotQueue.Enqueue(hotSpot);

            TreeHooks.Instance.InsertHook("TreeStart", 0, _behavior);
        }

Code quality might not be the greatest, but I'm still trying to get the hang of how everything works together.
If you have any idea what might be the issue with it (in general or the reset poi part), I'd like to hear it.
 
Back
Top