From e34f5cc4c0c86a7fe681adfc4f985ce9dc4d3cb3 Mon Sep 17 00:00:00 2001 From: Limiana <5073202+Limiana@users.noreply.github.com> Date: Sat, 3 Aug 2024 10:12:08 +0300 Subject: [PATCH] normal witch hunt --- .../Duties/Dawntrail/R4S Witch Hunt.cs | 59 ++++++++++++++++++- 1 file changed, 56 insertions(+), 3 deletions(-) diff --git a/SplatoonScripts/Duties/Dawntrail/R4S Witch Hunt.cs b/SplatoonScripts/Duties/Dawntrail/R4S Witch Hunt.cs index 95e5726e..68752934 100644 --- a/SplatoonScripts/Duties/Dawntrail/R4S Witch Hunt.cs +++ b/SplatoonScripts/Duties/Dawntrail/R4S Witch Hunt.cs @@ -3,6 +3,8 @@ using ECommons; using ECommons.Configuration; using ECommons.DalamudServices; +using ECommons.GameFunctions; +using ECommons.GameHelpers; using ECommons.Hooks; using ECommons.Hooks.ActionEffectTypes; using ECommons.ImGuiMethods; @@ -20,7 +22,7 @@ namespace SplatoonScriptsOfficial.Duties.Dawntrail; public class R4S_Witch_Hunt : SplatoonScript { public override HashSet? ValidTerritories { get; } = [1232]; - public override Metadata? Metadata => new(2, "NightmareXIV"); + public override Metadata? Metadata => new(3, "NightmareXIV"); uint CastNarrowing = 38369; uint CastWidening = 38368; @@ -32,6 +34,7 @@ public class R4S_Witch_Hunt : SplatoonScript bool? IsInitialClose = null; int NumSwitches = 0; long ForceResetAt = long.MaxValue; + uint CastStandard = 38366; IBattleNpc? WickedThunder => Svc.Objects.OfType().FirstOrDefault(x => x.NameId == 13057 && x.IsTargetable); @@ -42,7 +45,7 @@ public override void OnSetup() for(int i = 0; i < 4; i++) { - Controller.RegisterElementFromCode($"Target{i}", "{\"Name\":\"Hunted\",\"type\":1,\"radius\":6.0,\"color\":3355508712,\"fillIntensity\":0.05,\"originFillColor\":1677721855,\"endFillColor\":1677721855,\"thicc\":5.0,\"refActorComparisonType\":2,\"refActorTetherTimeMin\":0.0,\"refActorTetherTimeMax\":0.0,\"refActorTetherConnectedWithPlayer\":[]}"); + Controller.RegisterElementFromCode($"Target{i}", "{\"Name\":\"Hunted\",\"type\":1,\"radius\":6.0,\"color\":3355508712,\"fillIntensity\":0.05,\"originFillColor\":1677721855,\"endFillColor\":1677721855,\"thicc\":3.0,\"refActorComparisonType\":2,\"refActorTetherTimeMin\":0.0,\"refActorTetherTimeMax\":0.0,\"refActorTetherConnectedWithPlayer\":[]}"); } Controller.RegisterElementFromCode("InClose", "{\"Name\":\"BaitersAreaInClose\",\"type\":1,\"Enabled\":false,\"radius\":7.0,\"color\":3355508490,\"fillIntensity\":0.4,\"originFillColor\":1677721855,\"endFillColor\":1677721855,\"refActorNPCNameID\":13057,\"refActorComparisonType\":6,\"onlyTargetable\":true,\"refActorTetherTimeMin\":0.0,\"refActorTetherTimeMax\":0.0,\"refActorTetherConnectedWithPlayer\":[]}"); @@ -53,10 +56,18 @@ public override void OnSetup() Controller.RegisterElementFromCode("Warning", "{\"Name\":\"\",\"type\":1,\"Enabled\":false,\"overlayBGColor\":4278190080,\"overlayTextColor\":4278255360,\"overlayFScale\":2.0,\"overlayVOffset\":1.5,\"radius\":0,\"thicc\":0,\"overlayText\":\"GO GREEN\",\"refActorType\":1,\"refActorTetherTimeMin\":0.0,\"refActorTetherTimeMax\":0.0,\"refActorTetherConnectedWithPlayer\":[]}"); Controller.RegisterElementFromCode("Prepare", "{\"Name\":\"\",\"type\":1,\"Enabled\":false,\"overlayBGColor\":4278190080,\"overlayTextColor\":4278255360,\"overlayFScale\":1.0,\"overlayVOffset\":1.5,\"radius\":0,\"thicc\":0,\"overlayText\":\"Prepare...\",\"refActorType\":1,\"refActorTetherTimeMin\":0.0,\"refActorTetherTimeMax\":0.0,\"refActorTetherConnectedWithPlayer\":[]}"); + + Controller.RegisterElementFromCode("NormalMid", "{\"Name\":\"\",\"type\":2,\"refX\":120.0,\"refY\":100.0,\"offX\":80.0,\"offY\":100.0,\"radius\":12.0,\"color\":3355508223,\"fillIntensity\":0.2,\"originFillColor\":1157628159,\"endFillColor\":1157628159,\"refActorTetherTimeMin\":0.0,\"refActorTetherTimeMax\":0.0}"); + Controller.RegisterElementFromCode("NormalSide1", "{\"Name\":\"\",\"type\":2,\"refX\":120.0,\"refY\":85.0,\"offX\":80.0,\"offY\":85.0,\"radius\":7.0,\"color\":3355508223,\"fillIntensity\":0.2,\"originFillColor\":1157628159,\"endFillColor\":1157628159,\"refActorTetherTimeMin\":0.0,\"refActorTetherTimeMax\":0.0}"); + Controller.RegisterElementFromCode("NormalSide2", "{\"Name\":\"\",\"type\":2,\"refX\":120.0,\"refY\":115.0,\"offX\":80.0,\"offY\":115.0,\"radius\":7.0,\"color\":3355508223,\"fillIntensity\":0.2,\"originFillColor\":1157628159,\"endFillColor\":1157628159,\"refActorTetherTimeMin\":0.0,\"refActorTetherTimeMax\":0.0}"); } public override void OnSettingsDraw() { + ImGui.Checkbox("Resolve normal witch hunt", ref C.Normal); + ImGui.Separator(); + ImGui.Checkbox("Always show baits", ref C.Uncond); + ImGui.SetNextItemWidth(150f); ImGui.InputInt("Your turn to bait (close first or both if far first isn't set)", ref C.MyTurn.ValidateRange(1, 4)); @@ -96,6 +107,42 @@ public override void OnUpdate() } ForceResetAt = Environment.TickCount64 + 30 * 1000; } + if(C.Normal && w.IsCasting && w.CastActionId.EqualsAny(this.CastStandard)) + { + var players = Svc.Objects.OfType().OrderBy(x => Vector3.Distance(x.Position, this.WickedThunder!.Position)).ToList(); + if(w.StatusList.Any(x => x.StatusId == this.StatusCloseFar && x.Param == this.StatusParamClose)) + { + if(Player.Object.StatusList.Any(x => x.StatusId == 587)) + { + Controller.GetElementByName("NormalMid")!.Enabled = true; + } + else + { + Controller.GetElementByName("NormalSide1")!.Enabled = true; + Controller.GetElementByName("NormalSide2")!.Enabled = true; + } + } + else + { + players.Reverse(); + if(Player.Object.StatusList.Any(x => x.StatusId == 587)) + { + + Controller.GetElementByName("NormalSide1")!.Enabled = true; + Controller.GetElementByName("NormalSide2")!.Enabled = true; + } + else + { + Controller.GetElementByName("NormalMid")!.Enabled = true; + } + } + for(int i = 0; i < 4; i++) + { + var e = Controller.GetElementByName($"Target{i}"); + e.Enabled = true; + e.refActorObjectID = players[i].EntityId; + } + } } var myTurn = IsInitialClose == false ? C.MyTurn : (C.MyTurnFarFirst ?? C.MyTurn); if(IsUnsafeMiddle != null) @@ -109,7 +156,7 @@ public override void OnUpdate() baiterZone.Enabled = true; - if(myTurn - 1 == this.NumSwitches) + if(C.Uncond || myTurn - 1 == this.NumSwitches) { var players = Svc.Objects.OfType().OrderBy(x => Vector3.Distance(x.Position, this.WickedThunder!.Position)).ToList(); if(!baitsClose) players.Reverse(); @@ -119,6 +166,10 @@ public override void OnUpdate() e.Enabled = true; e.refActorObjectID = players[i].EntityId; } + } + + if(myTurn - 1 == this.NumSwitches) + { var warning = Controller.GetElementByName("Warning")!; warning.Enabled = true; warning.color = GradientColor.Get(EColor.GreenBright, EColor.White, 500).ToUint(); @@ -161,6 +212,8 @@ void Reset() Config C => Controller.GetConfig(); public class Config : IEzConfig { + public bool Uncond = false; + public bool Normal = true; public int MyTurn = 1; public int? MyTurnFarFirst = null; }