diff --git a/Splatoon/SplatoonScripting/ScriptingProcessor.cs b/Splatoon/SplatoonScripting/ScriptingProcessor.cs index c6ab5bfb..37f6d1a5 100644 --- a/Splatoon/SplatoonScripting/ScriptingProcessor.cs +++ b/Splatoon/SplatoonScripting/ScriptingProcessor.cs @@ -455,7 +455,7 @@ internal static void OnObjectEffect(uint Target, ushort Param1, ushort Param2) } } - internal static void OnStartingCast(uint target, uint castId) + internal static void OnStartingCast(uint source, uint castId) { for (var i = 0; i < Scripts.Count; i++) { @@ -463,7 +463,7 @@ internal static void OnStartingCast(uint target, uint castId) { try { - Scripts[i].OnStartingCast(target, castId); + Scripts[i].OnStartingCast(source, castId); } catch (Exception e) { Scripts[i].LogError(e, nameof(SplatoonScript.OnObjectEffect)); } } diff --git a/Splatoon/SplatoonScripting/SplatoonScript.cs b/Splatoon/SplatoonScripting/SplatoonScript.cs index 7a48477c..1f9a57d8 100644 --- a/Splatoon/SplatoonScripting/SplatoonScript.cs +++ b/Splatoon/SplatoonScripting/SplatoonScript.cs @@ -121,9 +121,9 @@ public virtual void OnVFXSpawn(uint target, string vfxPath) { } /// /// Will be called when a hostile object starts casting. These are the same messages which layout trigger system receives. This method will only be called if a script is enabled. /// - /// Object ID that is targeted by VFX. + /// Object ID that is source by VFX. /// ID of cast action. - public virtual void OnStartingCast(uint target, uint castId) { } + public virtual void OnStartingCast(uint source, uint castId) { } /// /// Will be called whenever plugin processes a message. These are the same messages which layout trigger system receives. This method will only be called if a script is enabled. diff --git a/SplatoonScripts/Duties/Dawntrail/R2S Venom Love Pair Split.cs b/SplatoonScripts/Duties/Dawntrail/R2S Venom Love Pair Split.cs index f8fce8e1..efe3403d 100644 --- a/SplatoonScripts/Duties/Dawntrail/R2S Venom Love Pair Split.cs +++ b/SplatoonScripts/Duties/Dawntrail/R2S Venom Love Pair Split.cs @@ -3,6 +3,7 @@ using ECommons.Hooks; using ECommons.Hooks.ActionEffectTypes; using ECommons.Logging; +using Splatoon; using Splatoon.SplatoonScripting; using System; using System.Collections.Generic; @@ -22,7 +23,7 @@ private enum PairSplit } public override HashSet? ValidTerritories { get; } = [1228]; - public override Metadata? Metadata => new(1, "Redmoon"); + public override Metadata? Metadata => new(2, "Redmoon"); const uint PoisonResistanceDownDebuffID = 3935; bool IsShow = false; @@ -35,71 +36,76 @@ public override void OnSetup() Controller.RegisterElementFromCode("split", "{\"Name\":\"split\",\"type\":1,\"Enabled\":false,\"radius\":6.0,\"color\":4278190335,\"Filled\":false,\"fillIntensity\":0.14,\"originFillColor\":587202815,\"endFillColor\":587202815,\"overlayTextColor\":4278190335,\"overlayVOffset\":1.0,\"overlayText\":\"<< Spread >>\",\"refActorComparisonType\":1,\"includeRotation\":true,\"FaceMe\":true,\"refActorTetherTimeMin\":0.0,\"refActorTetherTimeMax\":0.0}"); } - public override void OnUpdate() + public override void OnStartingCast(uint source, uint castId) { - if (Player.Object.StatusList.Any(x => x.StatusId == PoisonResistanceDownDebuffID) && IsShow && !IsAdd) + var sourceObj = source.GetObject(); + if (sourceObj == null) + return; + + if (sourceObj.DataId == 0 || sourceObj.DataId != 16941) + return; + + if ((castId == 37252) || (castId == 39688) ) { - IsAdd = true; - HideElement(); + LatchNextPairSplit = PairSplit.Split; } - if (IsAdd && !(Player.Object.StatusList.Any(x => x.StatusId == PoisonResistanceDownDebuffID))) + if ((castId == 37253) || (castId == 39689)) { - IsAdd = false; + LatchNextPairSplit = PairSplit.Pair; } - } - public override void OnVFXSpawn(uint target, string vfxPath) - { - if (IsShow && vfxPath.Contains("vfx/common/eff/m0906_stlp_ht4_03k2.avfx")) + if ((castId == 37254) || (castId == 37255) || (castId == 39692) || (castId == 39693)) { - HideElement(); + ShowElement(); } + } - public override void OnMessage(string Message) + public override void OnActionEffectEvent(ActionEffectSet set) { - if (Message.Contains("12685>37252") || (Message.Contains("12685>39688"))) - { - LatchNextPairSplit = PairSplit.Split; - } - else if (Message.Contains("12685>37253") || (Message.Contains("12685>39689"))) - { - LatchNextPairSplit = PairSplit.Pair; - } - else if (Message.Contains("12685>37254") || - (Message.Contains("12685>37255")) || - (Message.Contains("12685>39696")) || - (Message.Contains("12685>39697"))) + if (set.Action == null || (set.Source == null)) return; + if (set.Source.DataId == 0) return; + + if ((set.Action.RowId == 37256) && (set.Source.DataId == 16945)) { - ShowElement(); + HideElement(); } - else + + if ((set.Action.RowId == 39691) && (set.Source.DataId == 16943)) { - // NOP + HideElement(); } } private void ShowElement() { - if (LatchNextPairSplit == PairSplit.Pair) + Element? element = Controller.GetElementByName("Pair"); + if ((LatchNextPairSplit == PairSplit.Pair) && element != null && !element.Enabled) { Controller.GetElementByName("Pair")!.Enabled = true; } - else if (LatchNextPairSplit == PairSplit.Split) + + element = Controller.GetElementByName("split"); + if ((LatchNextPairSplit == PairSplit.Split) && element != null && !element.Enabled) { Controller.GetElementByName("split")!.Enabled = true; } - else - { - } - IsShow = true; } private void HideElement() { - Controller.GetRegisteredElements().Each(x => x.Value.Enabled = false); - IsShow = false; + Element? element = Controller.GetElementByName("Pair"); + if (element != null && element.Enabled) + { + Controller.GetElementByName("Pair")!.Enabled = false; + } + + element = Controller.GetElementByName("split"); + if (element != null && element.Enabled) + { + Controller.GetElementByName("split")!.Enabled = false; + } } public override void OnReset()