Skip to content

Commit 13cf81f

Browse files
committed
Update script
1 parent add77c7 commit 13cf81f

1 file changed

Lines changed: 62 additions & 16 deletions

File tree

SplatoonScripts/Duties/Dawntrail/Dancing Mad/P4_Debuff_Reminder.cs

Lines changed: 62 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
11
using Dalamud.Bindings.ImGui;
2+
using Dalamud.Interface.Colors;
23
using ECommons;
34
using ECommons.DalamudServices;
45
using ECommons.ExcelServices;
56
using ECommons.GameFunctions;
67
using ECommons.GameHelpers;
78
using ECommons.Hooks.ActionEffectTypes;
89
using ECommons.ImGuiMethods;
10+
using ECommons.MathHelpers;
911
using Newtonsoft.Json;
12+
using Splatoon;
1013
using Splatoon.SplatoonScripting;
1114
using Splatoon.Utility;
1215
using System;
1316
using System.Collections.Generic;
1417
using System.Linq;
18+
using System.Numerics;
1519
using Status = Lumina.Excel.Sheets.Status;
1620

1721
namespace SplatoonScriptsOfficial.Duties.Dawntrail.Dancing_Mad;
@@ -103,31 +107,38 @@ public override void OnSetup()
103107
{"Name":"","type":3,"refY":40.0,"radius":12,"fillIntensity":0.6,"refActorNPCNameID":6055,"refActorRequireCast":true,"refActorCastId":[50068],"refActorComparisonType":6,"includeRotation":true}
104108
""");
105109
Controller.RegisterElementsFromMultilineCode("""
106-
{"Name":"LookAway","type":1,"radius":0.0,"fillIntensity":0.5,"overlayBGColor":2550136832,"overlayTextColor":4278190335,"thicc":3.0,"overlayText":"LOOK AWAY","refActorName":"*","refActorRequireBuff":true,"refActorBuffId":[5543],"refActorUseBuffTime":true,"refActorBuffTimeMax":15.0,"tether":true}
107-
{"Name":"LookAt","type":1,"radius":0.0,"color":3355508521,"fillIntensity":0.5,"overlayBGColor":2550136832,"overlayTextColor":4278255376,"thicc":3.0,"overlayText":"LOOK AT","refActorName":"*","refActorRequireBuff":true,"refActorBuffId":[5543],"refActorUseBuffTime":true,"refActorBuffTimeMax":15.0,"tether":true}
110+
{"Name":"LookAway","type":1,"radius":0.0,"fillIntensity":0.5,"overlayBGColor":2550136832,"overlayTextColor":4278190335,"thicc":3.0,"overlayText":"LOOK AWAY","refActorName":"*","refActorRequireBuff":true,"refActorBuffId":[5543],"refActorUseBuffTime":true,"refActorBuffTimeMax":15.0,"tether":true,"overlayVOffset":2.0}
111+
{"Name":"LookAt","type":1,"radius":0.0,"color":3355508521,"fillIntensity":0.5,"overlayBGColor":2550136832,"overlayTextColor":4278255376,"thicc":3.0,"overlayText":"LOOK AT","refActorName":"*","refActorRequireBuff":true,"refActorBuffId":[5543],"refActorUseBuffTime":true,"refActorBuffTimeMax":15.0,"tether":true,"overlayVOffset":2.0}
108112
{"Name":"EyeScope","type":4,"radius":15.0,"coneAngleMin":-45,"coneAngleMax":45,"color":3355506687,"fillIntensity":0.125,"thicc":3.0,"refActorType":1,"includeRotation":true,"FillStep":99.0,"RenderEngineKind":2}
109113
{"Name":"Hint","type":1,"radius":0.0,"Filled":false,"fillIntensity":0.5,"overlayTextColor":4292739327,"overlayVOffset":5.0,"thicc":0.0,"overlayText":"test","refActorType":1}
110114
{"Name":"StackSupport","refX":100.0,"refY":89.0,"radius":3.0,"Donut":0.5,"color":3355508521,"fillIntensity":0.5,"overlayBGColor":2650800128,"overlayTextColor":4280024832,"overlayVOffset":1.2,"thicc":4.0,"overlayText":"Stack support","tether":true}
111115
{"Name":"StackDPS","refX":100.0,"refY":111.0,"radius":3.0,"Donut":0.5,"color":3355508521,"fillIntensity":0.5,"overlayBGColor":2650800128,"overlayTextColor":4280024832,"overlayVOffset":1.2,"thicc":4.0,"overlayText":"stack dps","tether":true}
112116
{"Name":"SpreadSupport","refX":89.0,"refY":100.0,"radius":3.0,"Donut":0.5,"color":3355501823,"fillIntensity":0.5,"overlayBGColor":2650800128,"overlayTextColor":4278255605,"overlayVOffset":1.2,"thicc":4.0,"overlayText":"Spread support","tether":true}
113117
{"Name":"SpreadDPS","refX":111.0,"refY":100.0,"radius":3.0,"Donut":0.5,"color":3355501823,"fillIntensity":0.5,"overlayBGColor":2650800128,"overlayTextColor":4278255605,"overlayVOffset":1.2,"thicc":4.0,"overlayText":"Spread dps","tether":true}
114-
118+
{"Name":"StackSupport_2","refX":100.0,"refY":89.0,"radius":3.0,"Donut":0.5,"color":3355508521,"fillIntensity":0.5,"overlayBGColor":2650800128,"overlayTextColor":4280024832,"overlayVOffset":1.2,"thicc":4.0,"overlayText":"Stack support","tether":true}
119+
{"Name":"StackDPS_2","refX":100.0,"refY":111.0,"radius":3.0,"Donut":0.5,"color":3355508521,"fillIntensity":0.5,"overlayBGColor":2650800128,"overlayTextColor":4280024832,"overlayVOffset":1.2,"thicc":4.0,"overlayText":"stack dps","tether":true}
120+
{"Name":"SpreadSupport_2","refX":89.0,"refY":100.0,"radius":3.0,"Donut":0.5,"color":3355501823,"fillIntensity":0.5,"overlayBGColor":2650800128,"overlayTextColor":4278255605,"overlayVOffset":1.2,"thicc":4.0,"overlayText":"Spread support","tether":true}
121+
{"Name":"SpreadDPS_2","refX":111.0,"refY":100.0,"radius":3.0,"Donut":0.5,"color":3355501823,"fillIntensity":0.5,"overlayBGColor":2650800128,"overlayTextColor":4278255605,"overlayVOffset":1.2,"thicc":4.0,"overlayText":"Spread dps","tether":true}
122+
{"Name":"MiddleGaze","refX":99.61274,"refY":99.88139,"refZ":-1.9073486E-06,"radius":4.0,"Donut":0.5,"fillIntensity":0.5,"overlayVOffset":1.2,"thicc":6.0,"tether":true}
123+
124+
{"Name":"MiddleDrop","refX":99.61274,"refY":99.88139,"refZ":-1.9073486E-06,"radius":3.0,"Donut":0.5,"fillIntensity":0.5,"overlayTextColor":4278228223,"overlayVOffset":1.2,"thicc":6.0,"overlayText":"$ELEMENT","tether":true}
115125
116126
""");
117127
Controller.RegisterLayoutFromCode("""
118128
~Lv2~{"Enabled":false,"Name":"Language","ZoneLockH":[1363],"ElementsL":[{"Name":"LookAt","overlayText":"Look at in #","overlayTextIntl":{"Jp":"#秒後に視線"}},{"Name":"LookAway","overlayText":"Look AWAY in #","overlayTextIntl":{"Jp":"#秒後に視線外す"}},{"Name":"Spread","overlayText":"Spread in #","overlayTextIntl":{"Jp":"#秒後に散開"}},{"Name":"Stack","overlayText":"Stack in #","overlayTextIntl":{"Jp":"#秒後に頭割り"}},{"Name":"DontMove","overlayText":"Don't move in #","overlayTextIntl":{"Jp":"#秒後に動くな"}},{"Name":"Move","overlayText":"Move in #","overlayTextIntl":{"Jp":"#秒後に動け"}},{"Name":"DropDonut","overlayText":"Drop donut in #","overlayTextIntl":{"Jp":"#秒後にドーナツ"}},{"Name":"DropAOE","overlayText":"Drop AOE in #","overlayTextIntl":{"Jp":"#秒後に範囲"}}]}
119129
""");
120130
Controller.RegisterLayoutFromCode("""
121-
~Lv2~{"Enabled":false,"Name":"Move","ZoneLockH":[1363],"ElementsL":[{"Name":"","type":3,"refY":1.0,"offY":-1.0,"radius":0.0,"color":3357671168,"fillIntensity":0.345,"refActorType":1,"LineEndA":1,"LineEndB":1},{"Name":"","type":3,"refX":1.0,"offX":-1.0,"radius":0.0,"color":3357671168,"fillIntensity":0.345,"refActorType":1,"LineEndA":1,"LineEndB":1}]}
131+
~Lv2~{"Enabled":false,"Name":"Move","ZoneLockH":[1363],"ElementsL":[{"Name":"","type":3,"refY":3.0,"offY":-3.0,"radius":0.0,"color":3357671168,"fillIntensity":0.345,"refActorType":1,"LineEndA":1,"LineEndB":1,thicc:4.0},{"Name":"","type":3,"refX":3.0,"offX":-3.0,"radius":0.0,"color":3357671168,"fillIntensity":0.345,"refActorType":1,"LineEndA":1,"LineEndB":1,thicc:4.0}]}
122132
""");
123133
Controller.RegisterLayoutFromCode("""
124-
~Lv2~{"Enabled":false,"Name":"DontMove","ZoneLockH":[1363],"ElementsL":[{"Name":"","type":3,"offY":-1.0,"radius":0.0,"fillIntensity":0.345,"refActorType":1,"LineEndA":1},{"Name":"","type":3,"offY":1.0,"radius":0.0,"fillIntensity":0.345,"refActorType":1,"LineEndA":1},{"Name":"","type":3,"offX":1.0,"radius":0.0,"fillIntensity":0.345,"refActorType":1,"LineEndA":1},{"Name":"","type":3,"offX":-1.0,"radius":0.0,"fillIntensity":0.345,"refActorType":1,"LineEndA":1}]}
134+
~Lv2~{"Enabled":false,"Name":"DontMove","ZoneLockH":[1363],"ElementsL":[{"Name":"","type":3,"offY":-3.0,"radius":0.0,"fillIntensity":0.345,"refActorType":1,"LineEndA":1,thicc:4.0},{"Name":"","type":3,"offY":3.0,"radius":0.0,"fillIntensity":0.345,"refActorType":1,"LineEndA":1,thicc:4.0},{"Name":"","type":3,"offX":3.0,"radius":0.0,"fillIntensity":0.345,"refActorType":1,"LineEndA":1,thicc:4.0},{"Name":"","type":3,"offX":-3.0,"radius":0.0,"fillIntensity":0.345,"refActorType":1,"LineEndA":1,thicc:4.0}]}
125135
""");
126136
}
137+
127138

128139
void ShowSpread(float timer)
129140
{
130-
if(Controller.TryGetElementByName($"Spread{(BasePlayer.Job.IsDps() ? "DPS" : "Support")}", out var e))
141+
if(Controller.TryGetElementByName($"Spread{(BasePlayer.Job.IsDps() ? "DPS" : "Support")}{(C.DifferentiateFirstSecondStackSpread && !IsFirstStackSpread() ? "_2" : "")}", out var e))
131142
{
132143
e.Enabled = true;
133144
e.color = Controller.AttentionColor;
@@ -137,7 +148,7 @@ void ShowSpread(float timer)
137148

138149
void ShowStack(float timer)
139150
{
140-
if(Controller.TryGetElementByName($"Stack{(BasePlayer.Job.IsDps() ? "DPS" : "Support")}", out var e))
151+
if(Controller.TryGetElementByName($"Stack{(BasePlayer.Job.IsDps() ? "DPS" : "Support")}{(C.DifferentiateFirstSecondStackSpread && !IsFirstStackSpread()?"_2":"")}", out var e))
141152
{
142153
e.Enabled = true;
143154
e.color = Controller.AttentionColor;
@@ -176,10 +187,18 @@ public override void OnUpdate()
176187
if(x.HasStatus(Debuffs.DebuffLookAway, out var time, lessThan: C.LookDontlookTH))
177188
{
178189
var f = this.FakeStatuses.ContainsAny(Debuffs.DebuffLookAway.Select(s => new StatusInfo(x.ObjectId, s)));
179-
hints.Add((f ? Str_LookAt($"{time.SafeSelect(0).Time:F1}") : Str_LookAway($"{time.SafeSelect(0).Time:F1}"), time.SafeSelect(0).Time));
180-
Controller.GetElementByName(f ? "LookAt" : "LookAway").Enabled = true;
190+
var hint = (f ? Str_LookAt($"{time.SafeSelect(0).Time:F1}") : Str_LookAway($"{time.SafeSelect(0).Time:F1}"), time.SafeSelect(0).Time);
191+
var gaze = Controller.GetElementByName(f ? "LookAt" : "LookAway");
192+
gaze.Enabled = true;
193+
gaze.overlayText = hint.Item1;
181194
Controller.GetElementByName("EyeScope").Enabled = true;
182-
break;
195+
if(x.AddressEquals(BasePlayer))
196+
{
197+
var ca = Controller.GetElementByName("MiddleGaze");
198+
ca.Enabled = true;
199+
ca.color = Controller.AttentionColor;
200+
ca.tether = Vector2.Distance(BasePlayer.Position.ToVector2(), ca.RefPosition.ToVector2()) > ca.radius;
201+
}
183202
}
184203
}
185204
bool spread = false;
@@ -226,28 +245,32 @@ public override void OnUpdate()
226245
{
227246
if(Controller.TryGetLayoutByName("DontMove", out var l))
228247
{
229-
l.Enabled = true;
248+
l.Enabled = time.SafeSelect(0).Time > 3?Environment.TickCount64 % 500 > 250 : Environment.TickCount64 % 250 > 125;
230249
}
231250
}
232251
else
233252
{
234253
if(Controller.TryGetLayoutByName("Move", out var l))
235254
{
236-
l.Enabled = true;
255+
l.Enabled = time.SafeSelect(0).Time > 3 ? Environment.TickCount64 % 500 > 250 : Environment.TickCount64 % 250 > 125;
237256
}
238257
}
239258
}
240259
}
241260
{
242261
if(BasePlayer.HasStatus(Debuffs.DebuffDonut, out var time, lessThan: C.DonutAOETH))
243262
{
244-
hints.Add((!this.FakeStatuses.ContainsAny(Debuffs.DebuffDonut.Select(s => new StatusInfo(BasePlayer.ObjectId, s))) ? Str_DropDonut($"{time.SafeSelect(0).Time:F1}") : Str_DropAOE($"{time.SafeSelect(0).Time:F1}"), time.SafeSelect(0).Time));
263+
var h = !this.FakeStatuses.ContainsAny(Debuffs.DebuffDonut.Select(s => new StatusInfo(BasePlayer.ObjectId, s))) ? Str_DropDonut($"{time.SafeSelect(0).Time:F1}") : Str_DropAOE($"{time.SafeSelect(0).Time:F1}");
264+
//hints.Add((h, time.SafeSelect(0).Time));
265+
DisplayMiddleDropIfNeeded(h);
245266
}
246267
}
247268
{
248269
if(BasePlayer.HasStatus(Debuffs.DebuffFireSpread, out var time, lessThan: C.DonutAOETH))
249270
{
250-
hints.Add((!this.FakeStatuses.ContainsAny(Debuffs.DebuffFireSpread.Select(s => new StatusInfo(BasePlayer.ObjectId, s))) ? Str_DropAOE($"{time.SafeSelect(0).Time:F1}") : Str_DropDonut($"{time.SafeSelect(0).Time:F1}"), time.SafeSelect(0).Time));
271+
var h = !this.FakeStatuses.ContainsAny(Debuffs.DebuffFireSpread.Select(s => new StatusInfo(BasePlayer.ObjectId, s))) ? Str_DropAOE($"{time.SafeSelect(0).Time:F1}") : Str_DropDonut($"{time.SafeSelect(0).Time:F1}");
272+
//hints.Add((h, time.SafeSelect(0).Time));
273+
DisplayMiddleDropIfNeeded(h);
251274
}
252275
}
253276
if(Controller.TryGetElementByName("Hint", out var e))
@@ -257,6 +280,17 @@ public override void OnUpdate()
257280
}
258281
}
259282

283+
void DisplayMiddleDropIfNeeded(string t)
284+
{
285+
if(Controller.GetPartyMembers().All(x => !x.HasStatus(Debuffs.DebuffLookAway, 6.5f)))
286+
{
287+
var el = Controller.GetElementByName("MiddleDrop");
288+
el.Enabled = true;
289+
el.color = Controller.AttentionColor;
290+
el.overlayText = t;
291+
}
292+
}
293+
260294
string StrGetAndReplace(string element, string s)
261295
{
262296
var e = Controller.GetRegisteredLayouts().SafeSelect("Language")?.GetElement(element);
@@ -314,13 +348,24 @@ public override void OnGainBuffEffect(uint sourceId, FFXIVClientStructs.FFXIV.Cl
314348
}
315349
}
316350

351+
public bool IsFirstStackSpread()
352+
{
353+
return Controller.GetPartyMembers().Count(x => x.HasStatus([.. Debuffs.DebuffSpread, .. Debuffs.DebuffStack])) > 4;
354+
}
355+
317356
public override void OnSettingsDraw()
318357
{
358+
ImGui.Checkbox("Different positions for first and second stack/spread", ref C.DifferentiateFirstSecondStackSpread);
359+
if(C.DifferentiateFirstSecondStackSpread)
360+
{
361+
ImGuiEx.TextWrapped(ImGuiColors.DalamudRed, " Go to Registered elements and adjust positions of elements with \"_2\" prefix for second set of spreads/stacks!!!");
362+
}
363+
319364
ImGui.SetNextItemWidth(150f);
320365
ImGuiEx.SliderFloat($"Display stack/spread in advance, seconds", ref C.StackSpreadTH, 3, 20);
321366
ImGui.SetNextItemWidth(150f);
322367
ImGuiEx.SliderFloat($"Display move/don't move in advance, seconds", ref C.MoveDontmoveTH, 3, 20);
323-
ImGui.SetNextItemWidth(150f);
368+
ImGui.SetNextItemWidth(150f);
324369
ImGuiEx.SliderFloat($"Display look/don't look in advance, seconds", ref C.LookDontlookTH, 3, 20);
325370
ImGui.SetNextItemWidth(150f);
326371
ImGuiEx.SliderFloat($"Display donut/AOE placement in advance, seconds", ref C.LookDontlookTH, 3, 20);
@@ -336,11 +381,12 @@ public override void OnSettingsDraw()
336381
}
337382
}
338383

339-
public class Config
384+
public class Config
340385
{
341386
public float StackSpreadTH = 10f;
342387
public float MoveDontmoveTH = 8f;
343388
public float LookDontlookTH = 10f;
344389
public float DonutAOETH = 10f;
390+
public bool DifferentiateFirstSecondStackSpread = false;
345391
}
346392
}

0 commit comments

Comments
 (0)