Esempio n. 1
0
        public NodeHelper(DoodadObject node, Host host) : base(host)
        {
            Host      = host;
            this.node = node;

            BeginPhase = node.phaseId;
        }
        public NodeHelper FindNode()
        {
            var nodes = Host.getDoodads().Where(d => MiningNodes.Exists(d.phaseId)

                                                && !ignorePhases.Contains(d.phaseId) &&
                                                !skipNodes.Contains(d.GetHashCode()) &&
                                                !ignoreNodes.Contains(d.GetHashCode()) &&
                                                GetNavDist(d) <= 200 &&
                                                d != Host.me.castObject);

            int count = 0;

            if ((count = nodes.Count()) < 1)
            {
                return(null);
            }


            DoodadObject temp = null;

            if (count == 1)
            {
                temp = nodes.First();
            }
            else
            {
                temp = nodes.OrderBy(d => GetNavDist(d)).ThenBy(d => Host.dist(d)).First();
            }


            return(new NodeHelper(temp, Host));
        }
Esempio n. 3
0
 public static Skill GetFirstDoodadSkill(DoodadObject dood)
 {
     if (dood != null)
     {
         return(dood.getUseSkills().FirstOrDefault());
     }
     return(null);
 }
Esempio n. 4
0
 /// <summary>
 /// set props from Doodad object
 /// </summary>
 /// <param name="cre"></param>
 public void SetPoint(DoodadObject cre)
 {
     this.X      = cre.X;
     this.Y      = cre.Y;
     this.Z      = cre.Z;
     this.name   = cre.name;
     this.type   = 2;
     this.radius = cre.modelRadius;
 }
Esempio n. 5
0
        private DoodadObject GetNearestDoodad()
        {
            DoodadObject nearest = null;
            double       D2      = double.PositiveInfinity;

            foreach (DoodadObject d in ArcheBuddyCore.getDoodads())
            {
                double d2 = d.distNoZ(ArcheBuddyCore.me);
                if (d2 < D2)
                {
                    nearest = d;
                    D2      = d2;
                }
            }

            return(nearest);
        }
Esempio n. 6
0
 public void MoveToSafe()
 {
     gps = new Gps(this);
     Log(Time() + "Loading GPS File");
     gps.LoadDataBase(Application.StartupPath + _gpsfile);
     if (_enabledoor == true)
     {
         Log(Time() + "We need to Open / Close the Door");
         gps.GpsMove("Door0");
         // Time to Open the Door
         DoodadObject doors = getNearestDoodad("Door");
         Log(Time() + "INFO: " + string.Format("Name: {0} - ID: {1}", doors.name, doors.phaseId));
         if (doors != null && ComeTo(doors, 2))
         {
             if (doors.phaseId == 11163)
             {
                 UseDoodadSkill(16828, doors);
                 Thread.Sleep(1000);
                 gps.GpsMove("Door1");
             }
             else
             {
                 gps.GpsMove("Door1");
             }
             // Time to Close the Door
             if (doors.phaseId == 11165)
             {
                 UseDoodadSkill(16828, doors);
                 Thread.Sleep(1000);
             }
         }
         //
         Log(Time() + "Moving to Safe");
         gps.GpsMove("Safe");
         Log(Time() + "Safe Spot has been Reached");
         if (_enablerest == true)
         {
             Relax();
             Log(Time() + "Rest Time");
         }
     }
     else
     {
         Log(Time() + "INFO: _enabledoor Set to False");
     }
 }
Esempio n. 7
0
        private DoodadObject getNearestDoodadInZone(uint phaseId)
        {
            double       minDist    = 999999;
            DoodadObject bestDoodad = null;

            foreach (var doodad in host.getDoodads())
            {
                if (doodad.phaseId == phaseId && farmZone.ObjInZone(doodad))
                {
                    if (minDist > host.me.dist(doodad))
                    {
                        minDist    = host.me.dist(doodad);
                        bestDoodad = doodad;
                    }
                }
            }
            return(bestDoodad);
        }
Esempio n. 8
0
        protected DoodadObject getMyDoodadById(uint id)
        {
            double       dist   = 999999;
            DoodadObject doodad = null;

            foreach (var d in host.getDoodads())
            {
                if (d.uniqOwnerId == host.me.uniqId && host.me.dist(d) < dist && d.dbFuncGroup.id == id)
                {
                    dist   = host.me.dist(d);
                    doodad = d;
                }
            }
            if (doodad != null)
            {
                return(doodad);
            }
            return(null);
        }
Esempio n. 9
0
        private void DebugNearestDoodadClick(Object sender, EventArgs e)
        {
            //find the nearest visible object
            DoodadObject d = GetNearestDoodad();

            foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(d))
            {
                string name  = descriptor.Name;
                object value = descriptor.GetValue(d);
                ArcheBuddyCore.Log(string.Format("Debug({2}) : {0} = {1}", name, value, d.name));
            }

            foreach (Skill k in d.getUseSkills())
            {
                foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(k))
                {
                    string name  = descriptor.Name;
                    object value = descriptor.GetValue(k);
                    ArcheBuddyCore.Log(string.Format("Debug({2}) : Skill({3}) : {0} = {1}", name, value, d.name, k.name));
                }
            }
        }
Esempio n. 10
0
        private void UpdateShapeData(UIElement shape, ClassifiedObject obj)
        {
            if (shape is ITurnable)
            {
                ((ITurnable)shape).Turn(obj.obj.turnAngle);
            }

            //this is ugly, can there be a solution using WPF MVVM Databinding?
            if (obj.obj.type == BotTypes.Housing && shape is IHousing)
            {
                houseScanner.ParseHouse(shape, (Housing)obj.obj);
            }
            else if (obj.category == ObjectCategory.ThunderstruckTree && shape is Tree)
            {
                //this should rarely happen - if a tree turns Thunderstruck while it's on radar, it might keep the same objId
                //so we might need to redraw it
                ((Tree)shape).ThunderStrike();
            }
            else if (obj.category == ObjectCategory.HarvestableTree && shape is Tree)
            {
                //ensure that a fruited tree is not shown as harvestable
                ((Tree)shape).HideFruit();
            }
            else if (obj.obj.type == BotTypes.DoodadObject)
            {
                DoodadObject d = (DoodadObject)obj.obj;
                if (d.id == 1671)
                {
                    UIElement u = LookupText(obj.obj.objId);
                    if (u != null)
                    {
                        ((TextBlock)u).Text = d.name;
                    }
                }
            }
            else if (obj.obj.type == BotTypes.Player)
            {
                Player p = (Player)obj.obj;

                if (shape is IKillable)
                {
                    ((IKillable)shape).Kill(p.isAlive());
                }
                if (shape is IStealthable)
                {
                    bool IsStealthed = false;
                    foreach (Buff b in p.getBuffs())
                    {
                        if (b.name.StartsWith("Stealth"))
                        {
                            IsStealthed = true;
                            break;
                        }
                    }

                    //this player is stealthed, update their vector
                    ((IStealthable)shape).Stealth(IsStealthed);
                }

                //check for trade pack
                ((PlayerShape)shape).ShowTradePack(p.getAllEquipedItems().Any(item => item.equipCell == EquipItemPlace.Unknown && RadarScanner.TradePackNames.Any(item.name.Contains)));
            }
            else if (obj.obj.type == BotTypes.Npc && shape is IStealthable)
            {
                Npc  p           = (Npc)obj.obj;
                bool IsStealthed = false;
                foreach (Buff b in p.getBuffs())
                {
                    if (b.name.StartsWith("Stealth"))
                    {
                        IsStealthed = true;
                        break;
                    }
                }

                //this player is stealthed, update their vector
                ((IStealthable)shape).Stealth(IsStealthed);
            }
        }
Esempio n. 11
0
 /// <summary>Class constructor overload</summary><param name="d">Doodad object</param><seealso cref="Jungler.Bot.Classes.DoodadObject"/>
 public Point3D(DoodadObject d)
 {
     SetPoint(d);
 }
Esempio n. 12
0
 /// <summary>
 /// set props from Doodad object
 /// </summary>
 /// <param name="cre"></param>
 public void SetPoint(DoodadObject cre)
 {
     this.X = cre.X;
     this.Y = cre.Y;
     this.Z = cre.Z;
     this.name = cre.name;
     this.type = 2;
     this.radius = cre.modelRadius;
 }
Esempio n. 13
0
 /// <summary>Class constructor overload</summary><param name="d">Doodad object</param><seealso cref="Jungler.Bot.Classes.DoodadObject"/>
 public Point3D(DoodadObject d)
 {
     SetPoint(d);
 }