コード例 #1
0
ファイル: Debug.cs プロジェクト: icaca/boogiebot
 public static void DumpBuffer(byte[] buffer, BoogieBot.Common.LogType lt)
 {
     //DumpBuffer(buffer, Length, Console.Out);
     StringWriter sw = new StringWriter();
     DumpBuffer(buffer, buffer.Length, sw);
     BoogieBot.Common.BoogieCore.Log(lt, "{0}", sw.ToString());
 }
コード例 #2
0
ファイル: UnitRadar.cs プロジェクト: icaca/boogiebot
 public double GetSpeed(BoogieBot.Common.Object u)
 {
     UnitData ud;
     if (dic.TryGetValue((long)u.GUID.GetOldGuid(), out ud))
     {
         return ud.movementSpeed;
     }
     return 0.0;
 }
コード例 #3
0
ファイル: PPather.cs プロジェクト: icaca/boogiebot
        public Coordinate PredictedLocation(BoogieBot.Common.Object mob)
        {
            Coordinate currentLocation = mob.GetCoordinates();
            double x = currentLocation.X;
            double y = currentLocation.Y;
            double z = currentLocation.Z;
            double heading = mob.GetOrientation();
            double dist = 4;

            x += Math.Cos(heading) * dist;
            y += Math.Sin(heading) * dist;

            Coordinate predictedLocation = new Coordinate((float)x, (float)y, (float)z);

            Coordinate closestLocatition = currentLocation;
            if (predictedLocation.DistanceTo(BoogieCore.world.getPlayerObject().GetCoordinates()) < closestLocatition.DistanceTo(BoogieCore.world.getPlayerObject().GetCoordinates()))
                closestLocatition = predictedLocation;
            return closestLocatition;
        }
コード例 #4
0
ファイル: PPather.cs プロジェクト: icaca/boogiebot
        public bool MoveToGetThemInFront(BoogieBot.Common.Object Target, BoogieBot.Common.Object Add)
        {
            double bearing = Add.GetOrientation();
            if (!IsInFrontOfMe(Add))
            {
                BoogieCore.Log(LogType.System, "Got the add " + Add.Name + " behind me");
                /*
                  hmm, just back up? or turn a bit too?
                */

                mover.Backwards(true);
                if (bearing < 0)
                {
                    BoogieCore.Log(LogType.System, "  back up left");
                    mover.RotateLeft(true);
                }
                else
                {
                    BoogieCore.Log(LogType.System, "  back up right");
                    mover.RotateRight(true);
                }
                Thread.Sleep(300);
                mover.RotateLeft(false);
                mover.RotateRight(false);
                Thread.Sleep(300);
                mover.Backwards(false);
                return true;
            }
            return false;
        }
コード例 #5
0
ファイル: PPather.cs プロジェクト: icaca/boogiebot
 public bool IsItSafeAt(BoogieBot.Common.Object ignore, Coordinate l)
 {
     return true;
 }
コード例 #6
0
ファイル: PPather.cs プロジェクト: icaca/boogiebot
 public bool IsItSafeAt(BoogieBot.Common.Object ignore, Location l)
 {
     return IsItSafeAt(ignore, new Coordinate(l.X, l.Y, l.Z));
 }
コード例 #7
0
ファイル: PPather.cs プロジェクト: icaca/boogiebot
 public static bool IsHordePlayerFaction(BoogieBot.Common.Object u)
 {
     int f = 0;// u.FactionID;
     if (f == 2 ||
         f == 5 ||
         f == 6 ||
         f == 116 ||
         f == 1610)
         return true;
     return false;
 }
コード例 #8
0
ファイル: PPather.cs プロジェクト: icaca/boogiebot
 public bool Face(BoogieBot.Common.Object monster, double tolerance)
 {
     BoogieBot.Common.Object player = BoogieCore.world.getPlayerObject();
     player.SetOrientation(player.CalculateAngle(monster.GetPositionX(), monster.GetPositionY()));
     return true;
 }
コード例 #9
0
ファイル: PPather.cs プロジェクト: icaca/boogiebot
        public bool Approach(BoogieBot.Common.Object monster, bool AbortIfUnsafe, int timeout)
        {
            BoogieCore.Log(LogType.System, "[Approach] 1");
            Coordinate loc = monster.GetCoordinates();
            float DistTo = loc.DistanceTo(BoogieCore.world.getPlayerObject().GetCoordinates());
            BoogieCore.Log(LogType.System, "[Approach] Distance to object: {0}", DistTo);
            if (DistTo < 4.5f &&
                Math.Abs(loc.O) < PI / 8)
            {
                mover.Stop();
                return true;
            }

            GSpellTimer approachTimeout = new GSpellTimer(timeout, false);
            StuckDetecter sd = new StuckDetecter(this, 1, 2);
            GSpellTimer t = new GSpellTimer(0);
            bool doJump = random.Next(4) == 0;
            EasyMover em = null;
            GSpellTimer NewTargetUpdate = new GSpellTimer(1000);

            BoogieCore.Log(LogType.System, "[Approach] 2");
            do
            {
                BoogieCore.Log(LogType.System, "[Approach] 3");
                UpdateMyPos();
                BoogieCore.Log(LogType.System, "[Approach] 4");
                // Check for stuck
                if (sd.checkStuck())
                {
                    BoogieCore.Log(LogType.System, "[Approach] 5");
                    BoogieCore.Log(LogType.System, "Major stuck on approach. Giving up");
                    mover.Stop();
                    return false;
                }
                double distance = monster.GetCoordinates().DistanceTo(BoogieCore.world.getPlayerObject().GetCoordinates());
                BoogieCore.Log(LogType.System, "[Approach] 6 - Dist = {0}", distance);
                bool moved;

                if (distance < 8)
                {
                    loc = monster.GetCoordinates();
                    BoogieCore.Log(LogType.System, "[Approach] 7");
                    moved = mover.moveTowardsFacing(loc, 4.5f, loc);
                    BoogieCore.Log(LogType.System, "[Approach] 8 {0}", moved);
                }
                else
                {
                    BoogieCore.Log(LogType.System, "[Approach] 9");
                    if (em == null)
                    {
                        loc = monster.GetCoordinates();
                        em = new EasyMover(this, new Location(loc), false, AbortIfUnsafe);
                    }
                    BoogieCore.Log(LogType.System, "[Approach] 10");
                    EasyMover.MoveResult mr = em.move();
                    BoogieCore.Log(LogType.System, "[Approach] 11 {0}", mr);
                    moved = true;
                    if (mr != EasyMover.MoveResult.Moving)
                    {
                        moved = false;
                    }
                    BoogieCore.Log(LogType.System, "[Approach] 12");
                }
                BoogieCore.Log(LogType.System, "[Approach] 13");

                if (!moved)
                {
                    mover.Stop();
                    return true;
                }

            } while (!approachTimeout.IsReadySlow);
            mover.Stop();
            BoogieCore.Log(LogType.System, "Approach timed out");
            return false;
        }
コード例 #10
0
ファイル: PPather.cs プロジェクト: icaca/boogiebot
 public bool Face(BoogieBot.Common.Object monster)
 {
     return Face(monster, PI / 8);
 }
コード例 #11
0
ファイル: PPather.cs プロジェクト: icaca/boogiebot
 public bool Approach(BoogieBot.Common.Object monster, bool AbortIfUnsafe)
 {
     return Approach(monster, AbortIfUnsafe, 10000);
 }
コード例 #12
0
ファイル: PPather.cs プロジェクト: icaca/boogiebot
 public static bool IsStupidItem(BoogieBot.Common.Object unit)
 {
     //if (unit.CreatureType == GCreatureType.Totem) return true;
     // Filter out all stupid sting found in outland
     string name = unit.Name.ToLower();
     if (name.Contains("target") || name.Contains("trigger") ||
         name.Contains("flak cannon") || name.Contains("trip wire") ||
         name.Contains("infernal rain") || name.Contains("anilia") ||
         name.Contains("teleporter credit") || name.Contains("door fel cannon") ||
         name.Contains("ethereum glaive") || name.Contains("orb flight"))
         return true;
     return false;
 }
コード例 #13
0
ファイル: PPather.cs プロジェクト: icaca/boogiebot
 public static bool IsPlayerFaction(BoogieBot.Common.Object u)
 {
     return IsHordePlayerFaction(u) || IsAlliancePlayerFaction(u);
 }
コード例 #14
0
ファイル: PPather.cs プロジェクト: icaca/boogiebot
        public void TweakMelee(BoogieBot.Common.Object Monster)
        {
            double Distance = Monster.GetCoordinates().DistanceTo(BoogieCore.world.getPlayerObject().GetCoordinates());
            double sensitivity = 2.5; // default melee distance is 4.8 - 2.5 = 2.3, no monster will chase us at 2.3
            double min = 4.5 - sensitivity;
            if (min < 1.0) min = 1.0;

            if (Distance > 4.5)
            {
                // Too far
                //Spam("Tweak forwards. "+ Distance + " > " + Context.MeleeDistance);
                mover.Forwards(true);
                Thread.Sleep(100);
                mover.Forwards(false);
            }
            else if (Distance < min)
            {
                // Too close
                //Spam("Tweak backwards. "+ Distance + " < " + min);
                mover.Backwards(true);
                Thread.Sleep(200);
                mover.Backwards(false);
            }
        }
コード例 #15
0
ファイル: PPather.cs プロジェクト: icaca/boogiebot
        public Coordinate InFrontOf(BoogieBot.Common.Object unit, double d)
        {
            double x = unit.GetCoordinates().X;
            double y = unit.GetCoordinates().Y;
            double z = unit.GetCoordinates().Z;
            double heading = unit.GetOrientation();
            x += Math.Cos(heading) * d;
            y += Math.Sin(heading) * d;

            return new Coordinate((float)x, (float)y, (float)z);
        }
コード例 #16
0
ファイル: PPather.cs プロジェクト: icaca/boogiebot
 /*
  */
 // return value from -PI to PI
 //
 double BearingToMe(BoogieBot.Common.Object unit)
 {
     Coordinate MyLocation = BoogieCore.world.getPlayerObject().GetCoordinates();
     float bearing = 0;// fixme (float)unit.GetHeadingDelta(MyLocation);
     return bearing;
 }
コード例 #17
0
ファイル: PPather.cs プロジェクト: icaca/boogiebot
 public bool IsInFrontOfMe(BoogieBot.Common.Object unit)
 {
     double bearing = unit.GetOrientation();
     return bearing < PI / 2.0 && bearing > -PI / 2.0;
 }
コード例 #18
0
ファイル: UnitRadar.cs プロジェクト: icaca/boogiebot
 public UnitData(BoogieBot.Common.Object u)
 {
     unit = u;
     guid = (long)u.GUID.GetOldGuid();
     movementSpeed = 0.0;
     oldLocation = u.coord;
 }
コード例 #19
0
ファイル: PPather.cs プロジェクト: icaca/boogiebot
 public bool IsItSafeAt(BoogieBot.Common.Object ignore, BoogieBot.Common.Object u)
 {
     return IsItSafeAt(ignore, u.GetCoordinates());
 }
コード例 #20
0
ファイル: UnitRadar.cs プロジェクト: icaca/boogiebot
        public void Update(BoogieBot.Common.Object[] units)
        {
            int dt = (int)-updateTimer.TicksLeft;
            foreach (BoogieBot.Common.Object u in units)
            {
                if (!u.IsDead && !PPather.IsStupidItem(u))
                {
                    UnitData ud;
                    if (dic.TryGetValue((long)u.GUID.GetOldGuid(), out ud))
                    {
                        ud.Update((int)dt);
                    }
                    else
                    {
                        // new one
                        ud = new UnitData(u);
                        dic.Add((long)u.GUID.GetOldGuid(), ud);
                    }
                }
            }

            List<long> rem = new List<long>();
            foreach (UnitData ud in dic.Values)
            {
                if (!ud.unit.IsValid) rem.Add(ud.guid);
            }
            foreach (long guid in rem)
            {
                dic.Remove(guid);
            }
            updateTimer.Reset();
        }
コード例 #21
0
ファイル: PPather.cs プロジェクト: icaca/boogiebot
        public static bool IsAlliancePlayerFaction(BoogieBot.Common.Object u)
        {
            int f = 0;//u.FactionID;
            if (f == 1 ||
                f == 3 ||
                f == 4 ||
                f == 115 ||
                f == 1629)
                return true;

            return false;
        }