using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Documents;
using System.Windows.Forms.VisualStyles;
using Bots.DungeonBuddy.Attributes;
using Bots.DungeonBuddy.Helpers;
using Buddy.Coroutines;
using Styx;
using Styx.Common.Helpers;
using Styx.CommonBot;
using Styx.CommonBot.Coroutines;
using Styx.Helpers;
using Styx.Pathing;
using Styx.WoWInternals;
using Styx.WoWInternals.WoWObjects;
using Vector2 = Tripper.Tools.Math.Vector2;
// ReSharper disable CheckNamespace
namespace Bots.DungeonBuddy.Raids.WarlordsOfDraenor
// ReSharper restore CheckNamespace
{
// Class that contains common behavior for all WOD LFRs
public abstract class WoDLfr : Dungeon
{
protected static LocalPlayer Me
{
get { return StyxWoW.Me; }
}
[EncounterHandler(0, "Root Handler")]
public virtual Func<WoWUnit, Task<bool>> RootBehavior()
{
return async npc =>
{
if (await ScriptHelpers.CancelCinematicIfPlaying())
return true;
return false;
};
}
}
public abstract class HighMaulFirstAndSecondWings : WoDLfr
{
private static readonly WoWPoint TheButcherShortcutStart = new WoWPoint(3607.386, 7690.8, 49.68718);
private static readonly WoWPoint TheButcherShortcutEnd = new WoWPoint(3625.253, 7694.636, 24.75327);
private static readonly Vector2[] _butcherBrackensporeTectusArea =
{
new Vector2(3665.059f, 7702.031f),
new Vector2(3648.062f, 7721.875f), new Vector2(3635.858f, 7720.968f), new Vector2(3618.896f, 7699.576f),
new Vector2(3678.591f, 7598.532f), new Vector2(3746.321f, 7578.863f), new Vector2(4205.131f, 7639.263f),
new Vector2(4237.474f, 7889.901f), new Vector2(3821.84f, 7957.633f), new Vector2(3586.8f, 8124.939f),
new Vector2(3427.558f, 7955.679f), new Vector2(3589.751f, 7789.652f), new Vector2(3650.96f, 7858.167f),
new Vector2(3742.038f, 7750.912f),
};
private readonly WoWPoint[] _combatStuckTrashPackLocs =
{
new WoWPoint(3650.748, 7811.058, 45.69595),
new WoWPoint(3606.859, 7744.549, 49.52811),
};
private static bool IsAtAreaByFirstBoss(WoWPoint location)
{
return location.Z > 40 && WoWMathHelper.IsPointInPoly(location, AreaByFirstBoss);
}
private static readonly Vector2[] AreaByFirstBoss =
{
new Vector2(3649.214f, 7736.967f), new Vector2(3551.274f, 7466.804f),
new Vector2(3266.306f, 7510.375f), new Vector2(3564.712f, 7821.45f),
};
private static bool IsAtButcherBrackensporeTectusArea(WoWPoint location)
{
return WoWMathHelper.IsPointInPoly(location, _butcherBrackensporeTectusArea);
}
protected internal async Task<bool> HandleTheButcherShortcut(WoWPoint destination)
{
// See if we need to take shortcut.
if (!IsAtAreaByFirstBoss(Me.Location) || !IsAtButcherBrackensporeTectusArea(destination)
|| !_combatStuckTrashPackLocs.Any(loc => ScriptHelpers.GetUnfriendlyNpsAtLocation(loc, 20).Any()))
{
return false;
}
if (!Navigator.AtLocation(TheButcherShortcutStart))
return (await CommonCoroutines.MoveTo(TheButcherShortcutStart, "The Butcher shortcut")).IsSuccessful();
var timer = Stopwatch.StartNew();
while (timer.ElapsedMilliseconds < 5000 && !IsAtButcherBrackensporeTectusArea(Me.Location))
{
WoWMovement.ClickToMove(TheButcherShortcutEnd);
WoWMovement.Move(WoWMovement.MovementDirection.JumpAscend);
await Coroutine.Sleep(120);
WoWMovement.MoveStop(WoWMovement.MovementDirection.JumpAscend);
if (await Coroutine.Wait(1000, () => IsAtButcherBrackensporeTectusArea(Me.Location)))
break;
}
return false;
}
}
public class WalledCity : HighMaulFirstAndSecondWings
{
#region Overrides of Dungeon
public override uint DungeonId
{
get { return [COLOR="#FF0000"][B]849[/B][/COLOR]; }
...