private GNode FindNode()
        {
            GNode[] nodes = GObjectList.GetNodes();
            GNode   node  = null;

            double bestDistanceToLoc = double.MaxValue;

            foreach (GNode n in nodes)
            {
                if (n.Name == Object)
                {
                    if (location != null)                     //this is cause sometimes there are more than 1 object visible, like "Wanted: Poster", if there are more than one, choose the one closest to the location specified.
                    {
                        float distance = location.GetDistanceTo(new Location(n.Location));
                        if (distance < bestDistanceToLoc)
                        {
                            bestDistanceToLoc = distance;
                            node = n;
                        }
                    }
                    else
                    {
                        node = n;
                        break;
                    }
                }
            }
            return(node);
        }
Beispiel #2
0
 GNode FindMailbox()
 {
     // Find mailbox
     GNode[] nodes = GObjectList.GetNodes();
     foreach (GNode node in nodes)
     {
         if (node.IsMailBox)
         {
             if (mailbox == null || node.DistanceToSelf < mailbox.DistanceToSelf)
             {
                 mailbox = node;
             }
         }
     }
     return(mailbox);
 }
Beispiel #3
0
        GNode FindItemToHarvest()
        {
            // Find stuff to loot
            GNode closest = null;

            GNode[] nodes = GObjectList.GetNodes();
            foreach (GNode node in nodes)
            {
                if (ShouldHarvest(node))
                {
                    if (closest == null || node.DistanceToSelf < closest.DistanceToSelf)
                    {
                        closest = node;
                    }
                }
            }
            return(closest);
        }