diff --git a/03-Heavensward/Trials/Sophia.cs b/03-Heavensward/Trials/Sophia.cs index 7e6b4fe..f16daad 100644 --- a/03-Heavensward/Trials/Sophia.cs +++ b/03-Heavensward/Trials/Sophia.cs @@ -1,6 +1,228 @@ -namespace The_Navel___EX._03_Heavensward.Trials; +using System; +using System.ComponentModel; +using System.Linq; +using System.Numerics; +using System.Collections.Generic; +// using Dalamud.Game.ClientState.Objects.Subkinds; +// using Dalamud.Game.ClientState.Objects.Types; +using Newtonsoft.Json; +using Dalamud.Utility.Numerics; +using KodakkuAssist.Script; +using KodakkuAssist.Module.GameEvent; +using KodakkuAssist.Module.Draw; +using KodakkuAssist.Data; +using KodakkuAssist.Extensions; +using ECommons; +using ECommons.DalamudServices; +using ECommons.GameFunctions; +using ECommons.MathHelpers; +using System.Threading.Tasks; + +namespace Sophia; + +[ScriptType(guid: "0909b7dc-2079-449a-97ca-f46204180bc0", name: "索菲娅歼灭战", territorys: [576], + version: "0.0.0.1", author: "Tetora", note: noteStr)] public class Sophia { + const string noteStr = + """ + v0.0.0.1: + LV60 索菲娅歼灭战 初版绘制 + TTS请在“用户设置”中二选一启用,请勿同时开启 + """; + [UserSetting("TTS开关(TTS请二选一开启)")] + public bool isTTS { get; set; } = false; + + [UserSetting("EdgeTTS开关(TTS请二选一开启)")] + public bool isEdgeTTS { get; set; } = true; + + [UserSetting("弹窗文本提示开关")] + public bool isText { get; set; } = true; + + + [ScriptMethod(name: "类星体(核爆)", eventType: EventTypeEnum.StartCasting, eventCondition: ["ActionId:6792"])] + public void 类星体_核爆(Event @event, ScriptAccessory accessory) + { + var dp = accessory.Data.GetDefaultDrawProperties(); + dp.Name = "类星体_核爆"; + dp.Color = accessory.Data.DefaultDangerColor.WithW(0.6f); + dp.Position = @event.EffectPosition(); + dp.Scale = new Vector2(15f); + dp.DestoryAt = 5000; + dp.ScaleMode = ScaleMode.ByTime; + accessory.Method.SendDraw(DrawModeEnum.Default, DrawTypeEnum.Circle, dp); + } + + /* + [ScriptMethod(name: "突袭(俯冲)", eventType: EventTypeEnum.PlayActionTimeline, eventCondition: ["Id:4572","SourceDataId:6026"],suppress:9000)] + public void 突袭(Event @event, ScriptAccessory accessory) + { + // 存在问题:其他时候瞬移时也会触发,如俯冲完恢复位置、转场瞬移至北侧时 + var dp = accessory.Data.GetDefaultDrawProperties(); + dp.Name = "突袭"; + dp.Scale = new (16f, 55f); // 特效像宽9m,待实证 + dp.Owner = @event.SourceId(); + dp.Color = accessory.Data.DefaultDangerColor; + dp.DestoryAt = 3100; + accessory.Method.SendDraw(DrawModeEnum.Default, DrawTypeEnum.Rect, dp); + } + */ + + [ScriptMethod(name: "信徒其一_反射提示", eventType: EventTypeEnum.StartCasting, eventCondition: ["ActionId:regex:^652[56]$"])] + public void 反射(Event @event, ScriptAccessory accessory) + { + // 招架:StatusID 680 + if (isText)accessory.Method.TextInfo("注意 <信徒其一> 反射", duration: 7000, true); + if (isTTS)accessory.Method.TTS("停止攻击信徒其一"); + if (isEdgeTTS)accessory.Method.EdgeTTS("停止攻击信徒其一"); + } + + [ScriptMethod(name: "信徒其二_灼热射线(背对)", eventType: EventTypeEnum.StartCasting, eventCondition: ["ActionId:6521"])] + public void 灼热射线(Event @event, ScriptAccessory accessory) + { + if (isTTS)accessory.Method.TTS("背对信徒其二"); + if (isEdgeTTS)accessory.Method.EdgeTTS("背对信徒其二"); + + var dp = accessory.Data.GetDefaultDrawProperties(); + dp.Name = "灼热射线"; + dp.Color = new Vector4(1f, 0f, 1f, 1f).WithW(2f); + dp.Owner = @event.SourceId(); + dp.Scale = new Vector2(1.8f); + dp.DestoryAt = 4000; + accessory.Method.SendDraw(DrawModeEnum.Default, DrawTypeEnum.Circle, dp); + } + + [ScriptMethod(name: "灼热射线销毁", eventType: EventTypeEnum.CancelAction, eventCondition: ["ActionId:6521"],userControl: false)] + public void 灼热射线销毁(Event @event, ScriptAccessory accessory) + { + accessory.Method.RemoveDraw("灼热射线"); + } + + // 转场天平击退 两次均为19m + // 类星体 差1条击退19m,差2条击退25m + + [ScriptMethod(name: "类星体 击退", eventType: EventTypeEnum.StartCasting, eventCondition: ["ActionId:6511"])] + public void 类星体_击退(Event @event, ScriptAccessory accessory) + { + if (isText)accessory.Method.TextInfo("击退", duration: 4200, true); + if (isTTS)accessory.Method.TTS("击退"); + if (isEdgeTTS)accessory.Method.EdgeTTS("击退"); + } + +} + +public static class EventExtensions +{ + private static bool ParseHexId(string? idStr, out uint id) + { + id = 0; + if (string.IsNullOrEmpty(idStr)) return false; + try + { + var idStr2 = idStr.Replace("0x", ""); + id = uint.Parse(idStr2, System.Globalization.NumberStyles.HexNumber); + return true; + } + catch (Exception) + { + return false; + } + } + + public static uint ActionId(this Event @event) + { + return JsonConvert.DeserializeObject(@event["ActionId"]); + } + + public static uint SourceId(this Event @event) + { + return ParseHexId(@event["SourceId"], out var id) ? id : 0; + } + + public static uint SourceDataId(this Event @event) + { + return JsonConvert.DeserializeObject(@event["SourceDataId"]); + } + + public static uint Command(this Event @event) + { + return ParseHexId(@event["Command"], out var cid) ? cid : 0; + } + + public static uint DurationMilliseconds(this Event @event) + { + return JsonConvert.DeserializeObject(@event["DurationMilliseconds"]); + } + + public static float SourceRotation(this Event @event) + { + return JsonConvert.DeserializeObject(@event["SourceRotation"]); + } + + public static float TargetRotation(this Event @event) + { + return JsonConvert.DeserializeObject(@event["TargetRotation"]); + } + + public static byte Index(this Event @event) + { + return (byte)(ParseHexId(@event["Index"], out var index) ? index : 0); + } + + public static uint State(this Event @event) + { + return ParseHexId(@event["State"], out var state) ? state : 0; + } + + public static string SourceName(this Event @event) + { + return @event["SourceName"]; + } + + public static string TargetName(this Event @event) + { + return @event["TargetName"]; + } + + public static uint TargetId(this Event @event) + { + return ParseHexId(@event["TargetId"], out var id) ? id : 0; + } + + public static Vector3 SourcePosition(this Event @event) + { + return JsonConvert.DeserializeObject(@event["SourcePosition"]); + } + + public static Vector3 TargetPosition(this Event @event) + { + return JsonConvert.DeserializeObject(@event["TargetPosition"]); + } + + public static Vector3 EffectPosition(this Event @event) + { + return JsonConvert.DeserializeObject(@event["EffectPosition"]); + } + + public static uint DirectorId(this Event @event) + { + return ParseHexId(@event["DirectorId"], out var id) ? id : 0; + } + + public static uint StatusId(this Event @event) + { + return JsonConvert.DeserializeObject(@event["StatusId"]); + } + + public static uint StackCount(this Event @event) + { + return JsonConvert.DeserializeObject(@event["StackCount"]); + } + + public static uint Param(this Event @event) + { + return JsonConvert.DeserializeObject(@event["Param"]); + } } \ No newline at end of file diff --git a/04-Stormblood/Raid-Omega_Quests/Normal/O7n.cs b/04-Stormblood/Raid-Omega_Quests/Normal/O7n.cs index a966eae..78c8b96 100644 --- a/04-Stormblood/Raid-Omega_Quests/Normal/O7n.cs +++ b/04-Stormblood/Raid-Omega_Quests/Normal/O7n.cs @@ -1,6 +1,161 @@ -namespace The_Navel___EX._04_Stormblood.Raid_Omega_Quests.Normal; +using System; +using System.ComponentModel; +using System.Linq; +using System.Numerics; +using System.Collections.Generic; +// using Dalamud.Game.ClientState.Objects.Subkinds; +// using Dalamud.Game.ClientState.Objects.Types; +using Newtonsoft.Json; +using Dalamud.Utility.Numerics; +using KodakkuAssist.Script; +using KodakkuAssist.Module.GameEvent; +using KodakkuAssist.Module.Draw; +using KodakkuAssist.Data; +using KodakkuAssist.Extensions; +using ECommons; +using ECommons.DalamudServices; +using ECommons.GameFunctions; +using ECommons.MathHelpers; +using System.Threading.Tasks; + +namespace O7n; + +[ScriptType(guid: "70419862-28f5-4ebb-b1b3-220419cd502f", name: "O7N", territorys: [750], + version: "0.0.0.1", author: "Tetora", note: noteStr)] public class O7n { + const string noteStr = + """ + v0.0.0.1: + LV70 欧米茄时空狭缝 西格玛幻境3(守护者) 初版绘制 + TTS请在“用户设置”中二选一启用,请勿同时开启 + """; + [UserSetting("TTS开关(TTS请二选一开启)")] + public bool isTTS { get; set; } = false; + + [UserSetting("EdgeTTS开关(TTS请二选一开启)")] + public bool isEdgeTTS { get; set; } = true; + + [UserSetting("弹窗文本提示开关")] + public bool isText { get; set; } = true; + + + + +} + +public static class EventExtensions +{ + private static bool ParseHexId(string? idStr, out uint id) + { + id = 0; + if (string.IsNullOrEmpty(idStr)) return false; + try + { + var idStr2 = idStr.Replace("0x", ""); + id = uint.Parse(idStr2, System.Globalization.NumberStyles.HexNumber); + return true; + } + catch (Exception) + { + return false; + } + } + + public static uint ActionId(this Event @event) + { + return JsonConvert.DeserializeObject(@event["ActionId"]); + } + + public static uint SourceId(this Event @event) + { + return ParseHexId(@event["SourceId"], out var id) ? id : 0; + } + + public static uint SourceDataId(this Event @event) + { + return JsonConvert.DeserializeObject(@event["SourceDataId"]); + } + + public static uint Command(this Event @event) + { + return ParseHexId(@event["Command"], out var cid) ? cid : 0; + } + + public static uint DurationMilliseconds(this Event @event) + { + return JsonConvert.DeserializeObject(@event["DurationMilliseconds"]); + } + + public static float SourceRotation(this Event @event) + { + return JsonConvert.DeserializeObject(@event["SourceRotation"]); + } + + public static float TargetRotation(this Event @event) + { + return JsonConvert.DeserializeObject(@event["TargetRotation"]); + } + + public static byte Index(this Event @event) + { + return (byte)(ParseHexId(@event["Index"], out var index) ? index : 0); + } + + public static uint State(this Event @event) + { + return ParseHexId(@event["State"], out var state) ? state : 0; + } + + public static string SourceName(this Event @event) + { + return @event["SourceName"]; + } + + public static string TargetName(this Event @event) + { + return @event["TargetName"]; + } + + public static uint TargetId(this Event @event) + { + return ParseHexId(@event["TargetId"], out var id) ? id : 0; + } + + public static Vector3 SourcePosition(this Event @event) + { + return JsonConvert.DeserializeObject(@event["SourcePosition"]); + } + + public static Vector3 TargetPosition(this Event @event) + { + return JsonConvert.DeserializeObject(@event["TargetPosition"]); + } + + public static Vector3 EffectPosition(this Event @event) + { + return JsonConvert.DeserializeObject(@event["EffectPosition"]); + } + + public static uint DirectorId(this Event @event) + { + return ParseHexId(@event["DirectorId"], out var id) ? id : 0; + } + + public static uint StatusId(this Event @event) + { + return JsonConvert.DeserializeObject(@event["StatusId"]); + } + + public static uint StackCount(this Event @event) + { + return JsonConvert.DeserializeObject(@event["StackCount"]); + } + + public static uint Param(this Event @event) + { + return JsonConvert.DeserializeObject(@event["Param"]); + } } \ No newline at end of file diff --git a/05-Shadowbringers/Raid-Eden/Savage/E12S.cs b/05-Shadowbringers/Raid-Eden/Savage/E12S.cs new file mode 100644 index 0000000..ce6f25d --- /dev/null +++ b/05-Shadowbringers/Raid-Eden/Savage/E12S.cs @@ -0,0 +1,161 @@ +using System; +using System.ComponentModel; +using System.Linq; +using System.Numerics; +using System.Collections.Generic; +// using Dalamud.Game.ClientState.Objects.Subkinds; +// using Dalamud.Game.ClientState.Objects.Types; +using Newtonsoft.Json; +using Dalamud.Utility.Numerics; +using KodakkuAssist.Script; +using KodakkuAssist.Module.GameEvent; +using KodakkuAssist.Module.Draw; +using KodakkuAssist.Data; +using KodakkuAssist.Extensions; +using ECommons; +using ECommons.DalamudServices; +using ECommons.GameFunctions; +using ECommons.MathHelpers; +using System.Threading.Tasks; + +namespace E12S; + +[ScriptType(guid: "f2ebc170-00af-415d-8dfe-30bc27f7fc06", name: "E12S", territorys: [949], + version: "0.0.0.1", author: "Tetora", note: noteStr)] + +public class E12S +{ + const string noteStr = + """ + v0.0.0.1: + LV80 伊甸零式希望乐园 再生之章4(伊甸之约) 初版绘制 + TTS请在“用户设置”中二选一启用,请勿同时开启 + """; + + [UserSetting("TTS开关(TTS请二选一开启)")] + public bool isTTS { get; set; } = false; + + [UserSetting("EdgeTTS开关(TTS请二选一开启)")] + public bool isEdgeTTS { get; set; } = true; + + [UserSetting("弹窗文本提示开关")] + public bool isText { get; set; } = true; + + + + +} + +public static class EventExtensions +{ + private static bool ParseHexId(string? idStr, out uint id) + { + id = 0; + if (string.IsNullOrEmpty(idStr)) return false; + try + { + var idStr2 = idStr.Replace("0x", ""); + id = uint.Parse(idStr2, System.Globalization.NumberStyles.HexNumber); + return true; + } + catch (Exception) + { + return false; + } + } + + public static uint ActionId(this Event @event) + { + return JsonConvert.DeserializeObject(@event["ActionId"]); + } + + public static uint SourceId(this Event @event) + { + return ParseHexId(@event["SourceId"], out var id) ? id : 0; + } + + public static uint SourceDataId(this Event @event) + { + return JsonConvert.DeserializeObject(@event["SourceDataId"]); + } + + public static uint Command(this Event @event) + { + return ParseHexId(@event["Command"], out var cid) ? cid : 0; + } + + public static uint DurationMilliseconds(this Event @event) + { + return JsonConvert.DeserializeObject(@event["DurationMilliseconds"]); + } + + public static float SourceRotation(this Event @event) + { + return JsonConvert.DeserializeObject(@event["SourceRotation"]); + } + + public static float TargetRotation(this Event @event) + { + return JsonConvert.DeserializeObject(@event["TargetRotation"]); + } + + public static byte Index(this Event @event) + { + return (byte)(ParseHexId(@event["Index"], out var index) ? index : 0); + } + + public static uint State(this Event @event) + { + return ParseHexId(@event["State"], out var state) ? state : 0; + } + + public static string SourceName(this Event @event) + { + return @event["SourceName"]; + } + + public static string TargetName(this Event @event) + { + return @event["TargetName"]; + } + + public static uint TargetId(this Event @event) + { + return ParseHexId(@event["TargetId"], out var id) ? id : 0; + } + + public static Vector3 SourcePosition(this Event @event) + { + return JsonConvert.DeserializeObject(@event["SourcePosition"]); + } + + public static Vector3 TargetPosition(this Event @event) + { + return JsonConvert.DeserializeObject(@event["TargetPosition"]); + } + + public static Vector3 EffectPosition(this Event @event) + { + return JsonConvert.DeserializeObject(@event["EffectPosition"]); + } + + public static uint DirectorId(this Event @event) + { + return ParseHexId(@event["DirectorId"], out var id) ? id : 0; + } + + public static uint StatusId(this Event @event) + { + return JsonConvert.DeserializeObject(@event["StatusId"]); + } + + public static uint StackCount(this Event @event) + { + return JsonConvert.DeserializeObject(@event["StackCount"]); + } + + public static uint Param(this Event @event) + { + return JsonConvert.DeserializeObject(@event["Param"]); + } +} \ No newline at end of file diff --git a/05-Shadowbringers/Raid-Eden/Savage/E7S.cs b/05-Shadowbringers/Raid-Eden/Savage/E7S.cs index 5a850ab..22409dd 100644 --- a/05-Shadowbringers/Raid-Eden/Savage/E7S.cs +++ b/05-Shadowbringers/Raid-Eden/Savage/E7S.cs @@ -1,6 +1,780 @@ -namespace The_Navel___EX._05_Shadowbringers.Raid_Eden.Savage; +using Dalamud.Game.ClientState.Objects.Types; +using ECommons.DalamudServices; +using System; +using System.Linq; +using System.Numerics; +using Newtonsoft.Json; +using Dalamud.Utility.Numerics; +using KodakkuAssist.Script; +using KodakkuAssist.Module.GameEvent; +using KodakkuAssist.Module.Draw; +using KodakkuAssist.Module.Draw.Manager; +using ECommons.ExcelServices.TerritoryEnumeration; +using System.Reflection.Metadata; +using System.Net; +using System.Threading.Tasks; +using System.Runtime.Intrinsics.Arm; +using System.Collections.Generic; +using System.ComponentModel; +using ECommons.Reflection; +using System.Windows; +using ECommons; +using ECommons.GameFunctions; +using FFXIVClientStructs; +using System; +using System.Runtime.InteropServices; +using System.Xml.Linq; +using FFXIVClientStructs.FFXIV.Client.UI; +using Lumina.Data.Structs; + +namespace E7S; + + +[ScriptType(name: "E7S", territorys: [908], guid: "edb1e7fd-79cf-4bff-b134-7c55a1d31b36", + version: "0.0.0.1", author: "Tetora", note: noteStr)] public class E7S { - -} \ No newline at end of file + const string noteStr = + """ + v0.0.0.1: + LV80 伊甸零式希望乐园 共鸣之章3 测试绘制 + 未完成 + """; + + [UserSetting("文字横幅提示开关")] + public bool isText { get; set; } = true; + + [UserSetting("TTS开关")] + public bool isTTS { get; set; } = false; + + [UserSetting("DR TTS开关")] + public bool isDRTTS { get; set; } = true; + + [UserSetting("Debug开关, 非开发用请关闭")] + public bool isDebug { get; set; } = false; + + public int LightsCourseCount; + public int StackCount; + + public List BallCheckList = new List + { + //From N (left to Right) + new Vector3(85.00f, 0.00f, 75.00f), //[0] yes + new Vector3(95.00f, 0.00f, 75.00f), //[1] yes + new Vector3(105.00f, 0.00f, 75.00f), //[2] yes + new Vector3(115.00f, 0.00f, 75.00f), //[3] yes + }; + + public List BallStartList = new List + { + //From N (left to Right) + new Vector3(85.00f, 0.00f, 80.00f), //[0] yes + new Vector3(95.00f, 0.00f, 80.00f), //[1] yes + new Vector3(105.00f, 0.00f, 80.00f), //[2] yes + new Vector3(115.00f, 0.00f, 80.00f), //[3] yes + + new Vector3(80.00f, 0.00f, 115.00f), //[4] + new Vector3(80.00f, 0.00f, 105.00f), //[5] + new Vector3(80.00f, 0.00f, 95.00f), //[6] + new Vector3(80.00f, 0.00f, 85.00f), //[7] + }; + + public List centerPoint = new List + { + //From N (left to Right) + new Vector3(85.00f, 0.00f, 100.00f), //[0] yes + new Vector3(95.00f, 0.00f, 100.00f), //[1] yes + new Vector3(105.00f, 0.00f, 100.00f), //[2] yes + new Vector3(115.00f, 0.00f, 100.00f), //[3] yes + + //From W (left to Right) + new Vector3(100.00f, 0.00f, 115.00f), //[4] + new Vector3(100.00f, 0.00f, 105.00f), //[5] + new Vector3(100.00f, 0.00f, 95.00f), //[6] + new Vector3(100.00f, 0.00f, 85.00f), //[7] + }; + + private readonly object LightsCourseLock = new object(); + + public void Init(ScriptAccessory accessory) + { + accessory.Method.RemoveDraw(".*"); + LightsCourseCount = 0; + StackCount = 0; + } + + public void DebugMsg(string str, ScriptAccessory accessory) + { + if (!isDebug) return; + accessory.Method.SendChat($"/e [DEBUG] {str}"); + } + + [ScriptMethod(name: "debug", eventType: EventTypeEnum.Chat, eventCondition: ["Message:debug"])] + public async void debug(Event @event, ScriptAccessory accessory) + { + var myself = IbcHelper.GetByEntityId(accessory.Data.Me); + if (myself == null) return; + var buffId = myself.HasStatus(2238) ? 2238 : 2239; + DebugMsg($"buffId: {buffId}", accessory); + } + + + [ScriptMethod(name: "虚无波动(AOE)", eventType: EventTypeEnum.StartCasting, eventCondition: ["ActionId:regex:^(19594|20052)$"])] + public void EmptyWave(Event @event, ScriptAccessory accessory) + { + if (@event.ActionId() == 19594) + { + if (isText) accessory.Method.TextInfo("AOE", duration: 3500, true); + accessory.TTS("AOE", isTTS, isDRTTS); + } else + { + if (isText) accessory.Method.TextInfo("大AOE", duration: 3500, true); + accessory.TTS("大AOE", isTTS, isDRTTS); + } + + } + + [ScriptMethod(name: "暗光钉(直线死刑)", eventType: EventTypeEnum.Tether, eventCondition: ["Id:0025"])] + public void UnshadowedStake(Event @event, ScriptAccessory accessory) + { + // 本体读条 19592 暗光钉,连线一名T职释放直线死刑 19508 黑暗之钉,随后对自身释放 15555 暗光钉,再对连线目标释放挡枪直线 19593 白光之钉(范围一致) + if (@event.TargetId() == accessory.Data.Me) + { + if (isText) accessory.Method.TextInfo($"引导激光至场外", duration: 4500, true); + accessory.TTS("引导激光至场外", isTTS, isDRTTS); + } else + { + if (isText) accessory.Method.TextInfo($"远离连线点名", duration: 4500, true); + accessory.TTS("远离连线点名", isTTS, isDRTTS); + } + + var dp = accessory.Data.GetDefaultDrawProperties(); + dp.Name = "暗光钉"; + dp.Color = accessory.Data.DefaultDangerColor; + dp.Owner = @event.SourceId(); + dp.TargetObject = @event.TargetId(); + dp.Scale = new Vector2(6, 100); + dp.DestoryAt = 5000; + accessory.Method.SendDraw(DrawModeEnum.Default, DrawTypeEnum.Rect, dp); + } + + [ScriptMethod(name: "白光&黑暗奔流", eventType: EventTypeEnum.StartCasting, eventCondition: ["ActionId:regex:^195(46|54)$"])] + public void LightsAndDarknessCourse(Event @event, ScriptAccessory accessory) + { + lock (LightsCourseLock) + { + DebugMsg($"LightsCourseCount: {LightsCourseCount}", accessory); + if (LightsCourseCount == 0 || LightsCourseCount == 1) + { + var index = FindExactPositionIndex(@event.SourcePosition(), BallCheckList); + DrawHelper.DrawRect(accessory, @event.SourcePosition(), centerPoint[index], new Vector2(10, 50), 4700, "Light's Course 0 & 1"); + DrawHelper.DrawRect(accessory, @event.SourcePosition(), centerPoint[index], new Vector2(10, 50), 4000, + "Light's Course 0 & 1 SAFE", new Vector4(0, 1, 0, 1), 6800); + } + + if (LightsCourseCount == 2 || LightsCourseCount == 3) + { + var index = FindExactPositionIndex(@event.SourcePosition(), BallCheckList); + DrawHelper.DrawRect(accessory, @event.SourcePosition(), centerPoint[index], new Vector2(10, 50), 4700, "Light's Course 2 & 3"); + } + + if (LightsCourseCount == 4 || LightsCourseCount == 5) + { + DebugMsg($"{LightsCourseCount}: {@event.ActionId()}", accessory); + if (@event["ActionId"] == "20067") + { + DebugMsg($"{LightsCourseCount}: In 20067", accessory); + var index0 = FindExactPositionIndex(@event.SourcePosition(), BallCheckList); + if (index0 == 1) + { + DrawHelper.DrawRect(accessory, BallStartList[4], centerPoint[4], new Vector2(10, 50), 4700, "Light's Course 4 & 5", delay: 4700); + } else if (index0 == 2) + { + DrawHelper.DrawRect(accessory, BallStartList[5], centerPoint[5], new Vector2(10, 50), 4700, "Light's Course 4 & 5", delay: 4700); + } + DebugMsg($"is drawing 20067", accessory); + DrawHelper.DrawRect(accessory, @event.SourcePosition(), centerPoint[index0], new Vector2(10, 25), 4700, "Light's Course 4 & 5"); + DrawHelper.DrawRect(accessory, @event.SourcePosition(), centerPoint[index0], new Vector2(10, 25), 4000, + "Light's Course 0 & 1 SAFE", new Vector4(0, 1, 0, 1), 6800); + } else + { + var index = FindExactPositionIndex(@event.SourcePosition(), BallCheckList); + DrawHelper.DrawRect(accessory, @event.SourcePosition(), centerPoint[index], new Vector2(10, 50), 4700, "Light's Course 4 & 5"); + DrawHelper.DrawRect(accessory, @event.SourcePosition(), centerPoint[index], new Vector2(10, 50), 4000, + "Light's Course 0 & 1 SAFE", new Vector4(0, 1, 0, 1), 6800); + } + } + + if (LightsCourseCount == 6 || LightsCourseCount == 7) + { + DebugMsg($"{LightsCourseCount}: {@event.ActionId()}", accessory); + if (@event["ActionId"] == "20067") + { + DebugMsg($"{LightsCourseCount}: In 20067", accessory); + var index0 = FindExactPositionIndex(@event.SourcePosition(), BallCheckList); + if (index0 == 1) + { + DrawHelper.DrawRect(accessory, BallStartList[4], centerPoint[4], new Vector2(10, 50), 4700, "Light's Course 6 & 7", delay: 4700); + } else if (index0 == 2) + { + DrawHelper.DrawRect(accessory, BallStartList[5], centerPoint[5], new Vector2(10, 50), 4700, "Light's Course 6 & 7", delay: 4700); + } + DebugMsg($"is drawing 20067", accessory); + DrawHelper.DrawRect(accessory, @event.SourcePosition(), centerPoint[index0], new Vector2(10, 25), 4700, "Light's Course 6 & 7"); + } else + { + var index = FindExactPositionIndex(@event.SourcePosition(), BallCheckList); + DrawHelper.DrawRect(accessory, @event.SourcePosition(), centerPoint[index], new Vector2(10, 50), 4700, "Light's Course 6 & 7"); + } + } + + if (LightsCourseCount == 8 || LightsCourseCount == 9 || LightsCourseCount == 10 || LightsCourseCount == 11) + { + DebugMsg($"{LightsCourseCount}: {@event.ActionId()}", accessory); + if (LightsCourseCount == 11) + { + accessory.Method.TextInfo("优先躲避红色", duration: 4700, true); + accessory.TTS("优先躲避红色", isTTS, isDRTTS); + } + if (@event["ActionId"] == "19518") + { + DebugMsg($"{LightsCourseCount}: In 19518", accessory); + var index0 = FindExactPositionIndex(@event.SourcePosition(), BallCheckList); + if (index0 == 1) + { + if (LightsCourseCount == 8 || LightsCourseCount == 9) + { + DrawHelper.DrawRect(accessory, BallStartList[5], centerPoint[5], new Vector2(10, 50), 4700, "Light's Course 8 & 9 & 10 & 11", new Vector4(1, 0, 0, 1), delay: 4700); + DrawHelper.DrawRect(accessory, BallStartList[7], centerPoint[7], new Vector2(10, 50), 4700, "Light's Course 8 & 9 & 10 & 11", new Vector4(1, 0, 0, 1), delay: 4700); + DrawHelper.DrawRect(accessory, BallStartList[5], centerPoint[5], new Vector2(10, 50), 2000, "Light's Course 8 & 9 & 10 & 11 SAFE", new Vector4(0, 1, 0, 1), delay: 9400); + DrawHelper.DrawRect(accessory, BallStartList[7], centerPoint[7], new Vector2(10, 50), 2000, "Light's Course 8 & 9 & 10 & 11 SAFE", new Vector4(0, 1, 0, 1), delay: 9400); + } else + { + DrawHelper.DrawRect(accessory, BallStartList[5], centerPoint[5], new Vector2(10, 50), 4700, "Light's Course 8 & 9 & 10 & 11", delay: 6700); + DrawHelper.DrawRect(accessory, BallStartList[7], centerPoint[7], new Vector2(10, 50), 4700, "Light's Course 8 & 9 & 10 & 11", delay: 6700); + } + } else if (index0 == 2) + { + if (LightsCourseCount == 8 || LightsCourseCount == 9) + { + DrawHelper.DrawRect(accessory, BallStartList[4], centerPoint[4], new Vector2(10, 50), 4700, "Light's Course 8 & 9 & 10 & 11", new Vector4(1, 0, 0, 1), delay: 4700); + DrawHelper.DrawRect(accessory, BallStartList[6], centerPoint[6], new Vector2(10, 50), 4700, "Light's Course 8 & 9 & 10 & 11", new Vector4(1, 0, 0, 1), delay: 4700); + DrawHelper.DrawRect(accessory, BallStartList[4], centerPoint[4], new Vector2(10, 50), 2000, "Light's Course 8 & 9 & 10 & 11 SAFE", new Vector4(0, 1, 0, 1), delay: 9400); + DrawHelper.DrawRect(accessory, BallStartList[6], centerPoint[6], new Vector2(10, 50), 2000, "Light's Course 8 & 9 & 10 & 11 SAFE", new Vector4(0, 1, 0, 1), delay: 9400); + } else + { + DrawHelper.DrawRect(accessory, BallStartList[5], centerPoint[5], new Vector2(10, 50), 4700, "Light's Course 8 & 9 & 10 & 11", delay: 4700); + DrawHelper.DrawRect(accessory, BallStartList[7], centerPoint[7], new Vector2(10, 50), 4700, "Light's Course 8 & 9 & 10 & 11", delay: 4700); + } + } + var index = FindExactPositionIndex(@event.SourcePosition(), BallCheckList); + DrawHelper.DrawRect(accessory, @event.SourcePosition(), centerPoint[index], new Vector2(10, 50), 4700, "Light's Course 8 & 9 & 10 & 11"); + if (LightsCourseCount == 8 || LightsCourseCount == 9) + { + DrawHelper.DrawRect(accessory, @event.SourcePosition(), centerPoint[index], new Vector2(10, 50), 2000, + "Light's Course 8 & 9 & 10 & 11 SAFE", new Vector4(0, 1, 0, 1), 4800); + } + } else + { + var index = FindExactPositionIndex(@event.SourcePosition(), BallCheckList); + DrawHelper.DrawRect(accessory, @event.SourcePosition(), centerPoint[index], new Vector2(10, 50), 4700, "Light's Course 8 & 9 & 10 & 11"); + if (LightsCourseCount == 8 || LightsCourseCount == 9) + { + DrawHelper.DrawRect(accessory, @event.SourcePosition(), centerPoint[index], new Vector2(10, 50), 2000, + "Light's Course 8 & 9 & 10 & 11 SAFE", new Vector4(0, 1, 0, 1), 4800); + } + } + } + + if (LightsCourseCount == 12 || LightsCourseCount == 13 || LightsCourseCount == 14 || + LightsCourseCount == 15 || LightsCourseCount == 16 || + LightsCourseCount == 17 || LightsCourseCount == 18 || LightsCourseCount == 19 || + LightsCourseCount == 20 || LightsCourseCount == 21 || LightsCourseCount == 22 || + LightsCourseCount == 23 || LightsCourseCount == 28 || LightsCourseCount == 29 || + LightsCourseCount == 30 || LightsCourseCount == 31) + { + // 2238 Light //19516 & 19490 // 0x8BE + // 2239 Darkness //19517 & 19491 // 0x8BF + DebugMsg($"{LightsCourseCount}: {@event.ActionId()}", accessory); + var myself = IbcHelper.GetByEntityId(accessory.Data.Me); + if (myself == null) return; + var buffId = myself.HasStatus(2238) ? 2238 : 2239; + DebugMsg($"buffId: {buffId}", accessory); + if (@event["ActionId"] == "19516" || @event["ActionId"] == "19490") + { + DebugMsg($"{LightsCourseCount}: In 19516", accessory); + if (buffId == 2238) + { + var index = FindExactPositionIndex(@event.SourcePosition(), BallCheckList); + DrawHelper.DrawRect(accessory, @event.SourcePosition(), centerPoint[index], new Vector2(10, 50), 5000, "Light's Course 12|3456789", new Vector4(1, 0, 0, 1)); + } else + { + var index = FindExactPositionIndex(@event.SourcePosition(), BallCheckList); + DrawHelper.DrawRect(accessory, @event.SourcePosition(), centerPoint[index], new Vector2(10, 50), 5000, "Light's Course 12|3456789", new Vector4(0, 1, 0, 1)); + } + } else if (@event["ActionId"] == "19517" || @event["ActionId"] == "19491") + { + DebugMsg($"{LightsCourseCount}: In 19517", accessory); + if (buffId == 2239) + { + var index = FindExactPositionIndex(@event.SourcePosition(), BallCheckList); + DrawHelper.DrawRect(accessory, @event.SourcePosition(), centerPoint[index], new Vector2(10, 50), 5000, "Light's Course 12|3456789", new Vector4(1, 0, 0, 1)); + } else + { + var index = FindExactPositionIndex(@event.SourcePosition(), BallCheckList); + DrawHelper.DrawRect(accessory, @event.SourcePosition(), centerPoint[index], new Vector2(10, 50), 5000, "Light's Course 12|3456789", new Vector4(0, 1, 0, 1)); + } + } + } + + if (LightsCourseCount == 24 || LightsCourseCount == 25 || LightsCourseCount == 26 || LightsCourseCount == 27) + { + // 2238 Light //19516 & 19490 // 0x8BE + // 2239 Darkness //19517 & 19491 & 19521 // 0x8BF + DebugMsg($"{LightsCourseCount}: {@event.ActionId()}", accessory); + var myself = IbcHelper.GetByEntityId(accessory.Data.Me); + if (myself == null) return; + var buffId = myself.HasStatus(2238) ? 2238 : 2239; + DebugMsg($"buffId: {buffId}", accessory); + if (@event["ActionId"] == "19521") + { + if (buffId == 2239) + { + var index = FindExactPositionIndex(@event.SourcePosition(), BallCheckList); + DrawHelper.DrawRect(accessory, @event.SourcePosition(), centerPoint[index], new Vector2(10, 50), 4700, "Light's Course 24, 25, 26, 27", new Vector4(1, 0, 0, 1)); + if (index == 1) + { + DrawHelper.DrawRect(accessory, BallStartList[5], centerPoint[5], new Vector2(10, 50), 4700, "Light's Course 24, 25, 26, 27", new Vector4(0, 1, 0, 1), delay: 4700); + DrawHelper.DrawRect(accessory, BallStartList[7], centerPoint[7], new Vector2(10, 50), 4700, "Light's Course 24, 25, 26, 27", new Vector4(0, 1, 0, 1), delay: 4700); + } else if (index == 2) + { + DrawHelper.DrawRect(accessory, BallStartList[4], centerPoint[4], new Vector2(10, 50), 4700, "Light's Course 24, 25, 26, 27", new Vector4(0, 1, 0, 1), delay: 4700); + DrawHelper.DrawRect(accessory, BallStartList[6], centerPoint[6], new Vector2(10, 50), 4700, "Light's Course 24, 25, 26, 27", new Vector4(0, 1, 0, 1), delay: 4700); + } + } else + { + var index = FindExactPositionIndex(@event.SourcePosition(), BallCheckList); + DrawHelper.DrawRect(accessory, @event.SourcePosition(), centerPoint[index], new Vector2(10, 50), 4700, "Light's Course 24, 25, 26, 27", new Vector4(0, 1, 0, 1)); + if (index == 1) + { + DrawHelper.DrawRect(accessory, BallStartList[5], centerPoint[5], new Vector2(10, 50), 4700, "Light's Course 24, 25, 26, 27", new Vector4(1, 0, 0, 1), delay: 4700); + DrawHelper.DrawRect(accessory, BallStartList[7], centerPoint[7], new Vector2(10, 50), 4700, "Light's Course 24, 25, 26, 27", new Vector4(1, 0, 0, 1), delay: 4700); + } else if (index == 2) + { + DrawHelper.DrawRect(accessory, BallStartList[4], centerPoint[4], new Vector2(10, 50), 4700, "Light's Course 24, 25, 26, 27", new Vector4(1, 0, 0, 1), delay: 4700); + DrawHelper.DrawRect(accessory, BallStartList[6], centerPoint[6], new Vector2(10, 50), 4700, "Light's Course 24, 25, 26, 27", new Vector4(1, 0, 0, 1), delay: 4700); + } + } + } else if (@event["ActionId"] == "19516") + { + if (buffId == 2238) + { + var index = FindExactPositionIndex(@event.SourcePosition(), BallCheckList); + DrawHelper.DrawRect(accessory, @event.SourcePosition(), centerPoint[index], new Vector2(10, 50), 4700, "Light's Course 24, 25, 26, 27", new Vector4(1, 0, 0, 1)); + if (index == 1) + { + DrawHelper.DrawRect(accessory, BallStartList[5], centerPoint[5], new Vector2(10, 50), 4700, "Light's Course 24, 25, 26, 27", new Vector4(0, 1, 0, 1), delay: 4700); + DrawHelper.DrawRect(accessory, BallStartList[7], centerPoint[7], new Vector2(10, 50), 4700, "Light's Course 24, 25, 26, 27", new Vector4(0, 1, 0, 1), delay: 4700); + } else if (index == 2) + { + DrawHelper.DrawRect(accessory, BallStartList[4], centerPoint[4], new Vector2(10, 50), 4700, "Light's Course 24, 25, 26, 27", new Vector4(0, 1, 0, 1), delay: 4700); + DrawHelper.DrawRect(accessory, BallStartList[6], centerPoint[6], new Vector2(10, 50), 4700, "Light's Course 24, 25, 26, 27", new Vector4(0, 1, 0, 1), delay: 4700); + } + } else + { + var index = FindExactPositionIndex(@event.SourcePosition(), BallCheckList); + DrawHelper.DrawRect(accessory, @event.SourcePosition(), centerPoint[index], new Vector2(10, 50), 4700, "Light's Course 24, 25, 26, 27", new Vector4(0, 1, 0, 1)); + if (index == 1) + { + DrawHelper.DrawRect(accessory, BallStartList[5], centerPoint[5], new Vector2(10, 50), 4700, "Light's Course 24, 25, 26, 27", new Vector4(1, 0, 0, 1), delay: 4700); + DrawHelper.DrawRect(accessory, BallStartList[7], centerPoint[7], new Vector2(10, 50), 4700, "Light's Course 24, 25, 26, 27", new Vector4(1, 0, 0, 1), delay: 4700); + } else if (index == 2) + { + DrawHelper.DrawRect(accessory, BallStartList[4], centerPoint[4], new Vector2(10, 50), 4700, "Light's Course 24, 25, 26, 27", new Vector4(1, 0, 0, 1), delay: 4700); + DrawHelper.DrawRect(accessory, BallStartList[6], centerPoint[6], new Vector2(10, 50), 4700, "Light's Course 24, 25, 26, 27", new Vector4(1, 0, 0, 1), delay: 4700); + } + } + } else + { + if (@event["ActionId"] == "19517") + { + if (buffId == 2239) + { + var index = FindExactPositionIndex(@event.SourcePosition(), BallCheckList); + DrawHelper.DrawRect(accessory, @event.SourcePosition(), centerPoint[index], new Vector2(10, 50), 4700, "Light's Course 24, 25, 26, 27", new Vector4(1, 0, 0, 1)); + } else + { + var index = FindExactPositionIndex(@event.SourcePosition(), BallCheckList); + DrawHelper.DrawRect(accessory, @event.SourcePosition(), centerPoint[index], new Vector2(10, 50), 4700, "Light's Course 24, 25, 26, 27", new Vector4(0, 1, 0, 1)); + } + } + if (@event["ActionId"] == "19518") + { + if (buffId == 2239) + { + var index = FindExactPositionIndex(@event.SourcePosition(), BallCheckList); + DrawHelper.DrawRect(accessory, @event.SourcePosition(), centerPoint[index], new Vector2(10, 50), 4700, "Light's Course 24, 25, 26, 27", new Vector4(0, 1, 0, 1)); + } else + { + var index = FindExactPositionIndex(@event.SourcePosition(), BallCheckList); + DrawHelper.DrawRect(accessory, @event.SourcePosition(), centerPoint[index], new Vector2(10, 50), 4700, "Light's Course 24, 25, 26, 27", new Vector4(1, 0, 0, 1)); + } + } + + } + } + + LightsCourseCount++; + DebugMsg($"LightsCourseCount increased to: {LightsCourseCount}", accessory); + } + } + + + + + + + [ScriptMethod(name: "强制传送", eventType: EventTypeEnum.StatusAdd, eventCondition: ["StatusID:regex:^(2242|2243|2240|2241)$"])] + public void ForcedTransfer(Event @event, ScriptAccessory accessory) + { + if (@event.TargetId() == accessory.Data.Me) + { + var dp = accessory.Data.GetDefaultDrawProperties(); + dp.Name = "Forced Transfer"; + dp.Color = accessory.Data.DefaultSafeColor; + dp.Owner = @event.TargetId(); + dp.Scale = new Vector2(1, 15); + switch (@event["StatusID"]) + { + case "2240": + dp.Rotation = 0; + break; + case "2241": + dp.Rotation = float.Pi; + break; + case "2242": + dp.Rotation = float.Pi / 180 * 90; + break; + case "2243": + dp.Rotation = float.Pi / 180 * 270; + break; + } + dp.DestoryAt = 10000; + accessory.Method.SendDraw(DrawModeEnum.Imgui, DrawTypeEnum.Arrow, dp); + } + } + + private int FindExactPositionIndex(Vector3 position, List positionList) + { + if (positionList == null || positionList.Count == 0) + return -1; + + for (int i = 0; i < positionList.Count; i++) + { + if (position.X == positionList[i].X && + position.Y == positionList[i].Y && + position.Z == positionList[i].Z) + { + return i; + } + } + return -1; + } + + [ScriptMethod(name: "分组分摊", eventType: EventTypeEnum.TargetIcon, eventCondition: ["Id:003E"])] + public async void Stack(Event @event, ScriptAccessory accessory) + { + await Task.Delay(50); + if (StackCount == 0) + { + accessory.Method.TextInfo("分组分摊", duration: 4700, true); + accessory.TTS("分组分摊", isTTS, isDRTTS); + } + var dp = accessory.Data.GetDefaultDrawProperties(); + dp.Name = "Stack"; + dp.Color = new Vector4(0, 1, 1, 1); + dp.Owner = @event.TargetId(); + dp.Scale = new Vector2(6); + dp.DestoryAt = 5000; + accessory.Method.SendDraw(DrawModeEnum.Default, DrawTypeEnum.Circle, dp); + StackCount++; + } +} + +public static class DrawHelper +{ + public static void DrawBeam(ScriptAccessory accessory, Vector3 sourcePosition, Vector3 targetPosition, string name = "Light's Course", int duration = 6700, Vector4? color = null, int delay = 0) + { + var dp = accessory.Data.GetDefaultDrawProperties(); + dp.Name = name; + dp.Color = color ?? accessory.Data.DefaultDangerColor; + dp.Position = sourcePosition; + dp.TargetPosition = targetPosition; + dp.Scale = new Vector2(10, 50); + dp.Delay = delay; + dp.DestoryAt = duration; + accessory.Method.SendDraw(DrawModeEnum.Default, DrawTypeEnum.Rect, dp); + } + + public static void DrawCircle(ScriptAccessory accessory, Vector3 position, Vector2 scale, int duration, string name, Vector4? color = null, bool scaleByTime = true, int delay = 0) + { + var dp = accessory.Data.GetDefaultDrawProperties(); + dp.Name = name; + dp.Color = color ?? accessory.Data.DefaultDangerColor; + dp.Position = position; + dp.Scale = scale; + dp.Delay = delay; + dp.DestoryAt = duration; + if (scaleByTime) dp.ScaleMode = ScaleMode.ByTime; + accessory.Method.SendDraw(DrawModeEnum.Default, DrawTypeEnum.Circle, dp); + } + + public static void DrawDisplacement(ScriptAccessory accessory, Vector3 target, Vector2 scale, int duration, string name, Vector4? color = null, int delay = 0) + { + var dp = accessory.Data.GetDefaultDrawProperties(); + dp.Name = name; + dp.Owner = accessory.Data.Me; + dp.Color = color ?? accessory.Data.DefaultSafeColor; + dp.ScaleMode |= ScaleMode.YByDistance; + dp.TargetPosition = target; + dp.Scale = scale; + dp.Delay = delay; + dp.DestoryAt = duration; + accessory.Method.SendDraw(DrawModeEnum.Imgui, DrawTypeEnum.Displacement, dp); + } + + public static void DrawRect(ScriptAccessory accessory, Vector3 position, Vector3 targetPos, Vector2 scale, int duration, string name, Vector4? color = null, int delay = 0) + { + var dp = accessory.Data.GetDefaultDrawProperties(); + dp.Name = name; + dp.Color = color ?? accessory.Data.DefaultDangerColor; + dp.Position = position; + dp.TargetPosition = targetPos; + dp.Scale = scale; + dp.Delay = delay; + dp.DestoryAt = duration; + accessory.Method.SendDraw(DrawModeEnum.Default, DrawTypeEnum.Rect, dp); + } + + public static void DrawFan(ScriptAccessory accessory, Vector3 position, float rotation, Vector2 scale, float angle, int duration, string name, Vector4? color = null, int delay = 0) + { + var dp = accessory.Data.GetDefaultDrawProperties(); + dp.Name = name; + dp.Color = color ?? accessory.Data.DefaultDangerColor; + dp.Position = position; + dp.Rotation = rotation; + dp.Scale = scale; + dp.Radian = angle; + dp.Delay = delay; + dp.DestoryAt = duration; + accessory.Method.SendDraw(DrawModeEnum.Default, DrawTypeEnum.Fan, dp); + } + + public static void DrawLine(ScriptAccessory accessory, Vector3 startPosition, Vector3 endPosition, float width, int duration, string name, Vector4? color = null, int delay = 0) + { + var dp = accessory.Data.GetDefaultDrawProperties(); + dp.Name = name; + dp.Color = color ?? accessory.Data.DefaultDangerColor; + dp.Position = startPosition; + dp.TargetPosition = endPosition; + dp.Scale = new Vector2(width, 1); + dp.Delay = delay; + dp.DestoryAt = duration; + accessory.Method.SendDraw(DrawModeEnum.Default, DrawTypeEnum.Line, dp); + } + + public static void DrawArrow(ScriptAccessory accessory, Vector3 startPosition, Vector3 endPosition, float width, int duration, string name, Vector4? color = null, int delay = 0) + { + var dp = accessory.Data.GetDefaultDrawProperties(); + dp.Name = name; + dp.Color = color ?? accessory.Data.DefaultDangerColor; + dp.Position = startPosition; + dp.TargetPosition = endPosition; + dp.Scale = new Vector2(width, 1); + dp.Delay = delay; + dp.DestoryAt = duration; + accessory.Method.SendDraw(DrawModeEnum.Default, DrawTypeEnum.Arrow, dp); + } +} + +public static class EventExtensions +{ + private static bool ParseHexId(string? idStr, out uint id) + { + id = 0; + if (string.IsNullOrEmpty(idStr)) return false; + try + { + var idStr2 = idStr.Replace("0x", ""); + id = uint.Parse(idStr2, System.Globalization.NumberStyles.HexNumber); + return true; + } + catch (Exception) + { + return false; + } + } + + public static uint Id(this Event @event) + { + return JsonConvert.DeserializeObject(@event["Id"]); + } + + public static uint ActionId(this Event @event) + { + return JsonConvert.DeserializeObject(@event["ActionId"]); + } + + public static uint SourceId(this Event @event) + { + return ParseHexId(@event["SourceId"], out var id) ? id : 0; + } + + public static uint SourceDataId(this Event @event) + { + return JsonConvert.DeserializeObject(@event["SourceDataId"]); + } + + public static uint DataId(this Event @event) + { + return JsonConvert.DeserializeObject(@event["DataId"]); + } + + public static uint Command(this Event @event) + { + return ParseHexId(@event["Command"], out var cid) ? cid : 0; + } + + public static string DurationMilliseconds(this Event @event) + { + return JsonConvert.DeserializeObject(@event["DurationMilliseconds"]) ?? string.Empty; + } + + public static float SourceRotation(this Event @event) + { + return JsonConvert.DeserializeObject(@event["SourceRotation"]); + } + + public static float TargetRotation(this Event @event) + { + return JsonConvert.DeserializeObject(@event["TargetRotation"]); + } + + public static byte Index(this Event @event) + { + return (byte)(ParseHexId(@event["Index"], out var index) ? index : 0); + } + + public static uint State(this Event @event) + { + return ParseHexId(@event["State"], out var state) ? state : 0; + } + + public static string SourceName(this Event @event) + { + return @event["SourceName"]; + } + + public static string TargetName(this Event @event) + { + return @event["TargetName"]; + } + + public static uint TargetId(this Event @event) + { + return ParseHexId(@event["TargetId"], out var id) ? id : 0; + } + + public static Vector3 SourcePosition(this Event @event) + { + return JsonConvert.DeserializeObject(@event["SourcePosition"]); + } + + public static Vector3 TargetPosition(this Event @event) + { + return JsonConvert.DeserializeObject(@event["TargetPosition"]); + } + + public static Vector3 EffectPosition(this Event @event) + { + return JsonConvert.DeserializeObject(@event["EffectPosition"]); + } + + public static uint DirectorId(this Event @event) + { + return ParseHexId(@event["DirectorId"], out var id) ? id : 0; + } + + public static uint StatusId(this Event @event) + { + return JsonConvert.DeserializeObject(@event["StatusId"]); + } + + public static uint StackCount(this Event @event) + { + return JsonConvert.DeserializeObject(@event["StackCount"]); + } + + public static uint Param(this Event @event) + { + return JsonConvert.DeserializeObject(@event["Param"]); + } + + public static string Operate(this Event @event) + { + return @event["Operate"]; + } +} + + +public static class Extensions +{ + public static void TTS(this ScriptAccessory accessory, string text, bool isTTS, bool isDRTTS) + { + if (isDRTTS) + { + accessory.Method.SendChat($"/pdr tts {text}"); + } + else if (isTTS) + { + accessory.Method.TTS(text); + } + } +} + +public static class IbcHelper +{ + public static IBattleChara? GetById(uint id) + { + return (IBattleChara?)Svc.Objects.SearchByEntityId(id); + } + + public static IBattleChara? GetMe() + { + return Svc.ClientState.LocalPlayer; + } + + public static IGameObject? GetFirstByDataId(uint dataId) + { + return Svc.Objects.Where(x => x.DataId == dataId).FirstOrDefault(); + } + + public static IEnumerable GetByDataId(uint dataId) + { + return Svc.Objects.Where(x => x.DataId == dataId); + } + public static IBattleChara? GetByEntityId(uint id) + { + return (IBattleChara?)Svc.Objects.SearchByEntityId(id); + } + public static bool HasStatus(this IBattleChara chara, uint statusId) + { + return chara.StatusList.Any(x => x.StatusId == statusId); + } + + public static bool HasStatus(this IBattleChara chara, uint[] statusIds) + { + return chara.StatusList.Any(x => statusIds.Contains(x.StatusId)); + } +} diff --git a/06-EndWalker/Dungeon/the_Lunar_Subterrane.cs b/06-EndWalker/Dungeon/the_Lunar_Subterrane.cs index 0d22579..c74709d 100644 --- a/06-EndWalker/Dungeon/the_Lunar_Subterrane.cs +++ b/06-EndWalker/Dungeon/the_Lunar_Subterrane.cs @@ -29,9 +29,10 @@ public class the_Lunar_Subterrane """ v0.0.0.1: LV90 异界深渊月面地下溪谷 初版绘制 + TTS请在“用户设置”中二选一启用,请勿同时开启 """; - [UserSetting("TTS开关")] + [UserSetting("TTS开关(TTS请二选一开启)")] public bool isTTS { get; set; } = false; [UserSetting("EdgeTTS开关(TTS请二选一开启)")]