diff --git a/SplatoonScripts/Duties/Dawntrail/The Futures Rewritten/P4 Darklit.cs b/SplatoonScripts/Duties/Dawntrail/The Futures Rewritten/P4 Darklit.cs index 046101c5..497c4e91 100644 --- a/SplatoonScripts/Duties/Dawntrail/The Futures Rewritten/P4 Darklit.cs +++ b/SplatoonScripts/Duties/Dawntrail/The Futures Rewritten/P4 Darklit.cs @@ -3,8 +3,10 @@ using System.Linq; using System.Numerics; using Dalamud.Game.ClientState.Objects.SubKinds; +using Dalamud.Game.ClientState.Objects.Types; using ECommons; using ECommons.Configuration; +using ECommons.DalamudServices; using ECommons.GameFunctions; using ECommons.GameHelpers; using ECommons.Hooks.ActionEffectTypes; @@ -24,18 +26,6 @@ public enum BoxSwapType NorthEastAndSouthEast } - private enum Direction - { - North = 0, - NorthEast = 45, - East = 90, - SouthEast = 135, - South = 180, - SouthWest = 225, - West = 270, - NorthWest = 315 - } - public enum HourglassSwapType { NorthWestAndSouthEast, @@ -50,30 +40,8 @@ public enum Mode Horizontal } - private enum MoveType - { - Straight, - Hourglass, - Box - } - - private enum Role - { - Dps, - TankAndHealer - } - - private enum State - { - None, - Start, - Tower, - Split, - Stack, - End - } + private const uint WaterId = 0x99D; - // 40228 : East private uint[] _holyWingIds = [40227, 40228]; private MoveType? _moveType; @@ -81,12 +49,13 @@ private enum State private Dictionary _players = new(); private State _state = State.None; - - private const uint WaterId = 0x99D; public override HashSet? ValidTerritories => [1238]; - public override Metadata? Metadata => new(3, "Garume"); + public override Metadata? Metadata => new(4, "Garume"); private Config C => Controller.GetConfig(); + private IBattleChara? DarkGirl => Svc.Objects.Where(o => o.IsTargetable) + .FirstOrDefault(o => o.DataId == 0x45AB) as IBattleChara; + public override void OnStartingCast(uint source, uint castId) { if (castId == 40239) _state = State.Start; @@ -95,10 +64,14 @@ public override void OnStartingCast(uint source, uint castId) var x = castId == _holyWingIds[0] ? 106.5f : 93.5f; if (Controller.TryGetElementByName("StackBaitNorth", out var northElement)) northElement.refX = x; - if (Controller.TryGetElementByName("StackBaitSouth", out var southElement)) southElement.refX = x; - if (Controller.TryGetElementByName("Split", out var splitElement)) splitElement.Enabled = false; + x = castId == _holyWingIds[0] ? 118f : 82f; + if (Controller.TryGetElementByName("TankBait", out var tankBaitElement)) + { + tankBaitElement.refX = x; + tankBaitElement.refY = 100f; + } } } @@ -167,11 +140,18 @@ public override void OnSetup() thicc = 6f, refY = 113f }); + + Controller.RegisterElement("TankBait", new Element(0) + { + radius = 1f, + thicc = 6f + }); } public override void OnActionEffectEvent(ActionEffectSet set) { - if (set.Action != null && _state == State.Tower && set.Action.Value.RowId == 40190) + if (set.Action is not { } action) return; + if (_state == State.Tower && action.RowId == 40190) { foreach (var direction in Enum.GetValues()) if (Controller.TryGetElementByName(direction.ToString(), out var element)) @@ -180,14 +160,17 @@ public override void OnActionEffectEvent(ActionEffectSet set) _state = State.Split; } - if (set.Action != null && _state == State.Split && set.Action.Value.RowId == 40289) + if (_state == State.Split && action.RowId == 40289) { if (Controller.TryGetElementByName("Split", out var splitElement)) splitElement.Enabled = false; if (Controller.TryGetElementByName("Stack", out var stackElement)) stackElement.Enabled = true; _state = State.Stack; } - if (set.Action != null && _state == State.Stack && _holyWingIds.Contains(set.Action.Value.RowId)) _state = State.End; + if (_state == State.Stack && _holyWingIds.Contains(action.RowId)) _state = State.FirstBait; + + if (_state == State.FirstBait && action.RowId == 40284) _state = State.SecondBait; + if (_state == State.SecondBait && action.RowId == 40285) _state = State.End; } public override void OnTetherCreate(uint source, uint target, uint data2, uint data3, uint data5) @@ -440,6 +423,28 @@ public override void OnUpdate() northElement.color = GradientColor.Get(C.BaitColor1, C.BaitColor2).ToUint(); } } + else if (_state is State.FirstBait) + { + if (Controller.TryGetElementByName("TankBait", out var tankBaitElement)) + { + tankBaitElement.Enabled = C.ShowTank1stBait; + tankBaitElement.tether = true; + tankBaitElement.color = GradientColor.Get(C.BaitColor1, C.BaitColor2).ToUint(); + } + } + + else if (_state is State.SecondBait) + { + var dirkGirl = DarkGirl; + if (Controller.TryGetElementByName("TankBait", out var tankBaitElement) && dirkGirl != null) + { + tankBaitElement.Enabled = C.ShowTank2ndBait; + tankBaitElement.tether = true; + tankBaitElement.refX = dirkGirl.Position.X; + tankBaitElement.refY = dirkGirl.Position.Z; + tankBaitElement.color = GradientColor.Get(C.BaitColor1, C.BaitColor2).ToUint(); + } + } } @@ -464,6 +469,12 @@ public override void OnSettingsDraw() ImGuiEx.EnumCombo("Box Swap Type", ref C.BoxSwapType); ImGuiEx.EnumCombo("Hourglass Swap Type", ref C.HourglassSwapType); ImGui.Checkbox("Show Other", ref C.ShowOther); + ImGui.Separator(); + ImGui.Text("Tank Settings"); + ImGui.Indent(); + ImGui.Checkbox("Show Tank 1st Bait Guide", ref C.ShowTank1stBait); + ImGui.Checkbox("Show Tank 2nd Bait Guide", ref C.ShowTank2ndBait); + ImGui.Unindent(); } if (ImGuiEx.CollapsingHeader("Debug")) @@ -485,6 +496,43 @@ public override void OnSettingsDraw() } } + private enum Direction + { + North = 0, + NorthEast = 45, + East = 90, + SouthEast = 135, + South = 180, + SouthWest = 225, + West = 270, + NorthWest = 315 + } + + private enum MoveType + { + Straight, + Hourglass, + Box + } + + private enum Role + { + Dps, + TankAndHealer + } + + private enum State + { + None, + Start, + Tower, + Split, + Stack, + FirstBait, + SecondBait, + End + } + private record PlayerData { public Direction Direction; @@ -507,5 +555,7 @@ public class Config : IEzConfig public Mode Mode = Mode.Vertical; public PriorityData PriorityData = new(); public bool ShowOther = true; + public bool ShowTank1stBait; + public bool ShowTank2ndBait; } -} +} \ No newline at end of file