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()); }
public double GetSpeed(BoogieBot.Common.Object u) { UnitData ud; if (dic.TryGetValue((long)u.GUID.GetOldGuid(), out ud)) { return ud.movementSpeed; } return 0.0; }
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; }
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; }
public bool IsItSafeAt(BoogieBot.Common.Object ignore, Coordinate l) { return true; }
public bool IsItSafeAt(BoogieBot.Common.Object ignore, Location l) { return IsItSafeAt(ignore, new Coordinate(l.X, l.Y, l.Z)); }
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; }
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; }
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; }
public bool Face(BoogieBot.Common.Object monster) { return Face(monster, PI / 8); }
public bool Approach(BoogieBot.Common.Object monster, bool AbortIfUnsafe) { return Approach(monster, AbortIfUnsafe, 10000); }
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; }
public static bool IsPlayerFaction(BoogieBot.Common.Object u) { return IsHordePlayerFaction(u) || IsAlliancePlayerFaction(u); }
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); } }
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); }
/* */ // 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; }
public bool IsInFrontOfMe(BoogieBot.Common.Object unit) { double bearing = unit.GetOrientation(); return bearing < PI / 2.0 && bearing > -PI / 2.0; }
public UnitData(BoogieBot.Common.Object u) { unit = u; guid = (long)u.GUID.GetOldGuid(); movementSpeed = 0.0; oldLocation = u.coord; }
public bool IsItSafeAt(BoogieBot.Common.Object ignore, BoogieBot.Common.Object u) { return IsItSafeAt(ignore, u.GetCoordinates()); }
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(); }
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; }