diff --git a/02-A-Realm-Reborn/Dungeon/MainScenario_Roulette.cs b/02-A-Realm-Reborn/Dungeon/MainScenario_Roulette.cs index c908b08..0113b58 100644 --- a/02-A-Realm-Reborn/Dungeon/MainScenario_Roulette.cs +++ b/02-A-Realm-Reborn/Dungeon/MainScenario_Roulette.cs @@ -3,8 +3,6 @@ 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; @@ -12,16 +10,12 @@ 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 MainScenario_Roulette; [ScriptType(guid: "84c15eea-2a19-4477-ad21-cd43d1263cfa", name: "随机任务:主线任务", territorys: [1043, 1044, 1048], - version: "0.0.0.2", author: "Tetora", note: noteStr)] + version: "0.0.0.3", author: "Tetora", note: noteStr)] public class MainScenario_Roulette { diff --git a/02-A-Realm-Reborn/Raid-Bahamute/T03_T09_T13_for_BLU.cs b/02-A-Realm-Reborn/Raid-Bahamute/T03_T09_T13_for_BLU.cs index bb4f3d5..3beef63 100644 --- a/02-A-Realm-Reborn/Raid-Bahamute/T03_T09_T13_for_BLU.cs +++ b/02-A-Realm-Reborn/Raid-Bahamute/T03_T09_T13_for_BLU.cs @@ -3,24 +3,18 @@ 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 ECommons; -using ECommons.DalamudServices; -using ECommons.GameFunctions; -using ECommons.MathHelpers; using System.Threading.Tasks; namespace Bahamute_NormalRaid_for_BLU; [ScriptType(guid: "8d41b5f9-0ab6-404a-9572-aabb390023f0", name: "巴哈姆特大迷宫(青魔专用)", territorys: [196,245,358], - version: "0.0.0.2", author: "Tetora", note: noteStr)] + version: "0.0.0.3", author: "Tetora", note: noteStr)] public class Bahamute_NormalRaid_for_BLU { diff --git a/02-A-Realm-Reborn/Trials-Extreme/Garuda(Extreme).cs b/02-A-Realm-Reborn/Trials-Extreme/Garuda(Extreme).cs index d8a682b..f674ab0 100644 --- a/02-A-Realm-Reborn/Trials-Extreme/Garuda(Extreme).cs +++ b/02-A-Realm-Reborn/Trials-Extreme/Garuda(Extreme).cs @@ -3,8 +3,6 @@ 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; @@ -12,16 +10,12 @@ 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 Garuda_Extreme; [ScriptType(guid: "3e4685ed-1425-4ddc-8222-a2c15dcc9ad5", name: "迦楼罗歼殛战", territorys: [297], - version: "0.0.0.1", author: "Tetora", note: noteStr)] + version: "0.0.0.2", author: "Tetora", note: noteStr)] public class Garuda_Extreme { @@ -289,4 +283,112 @@ public static class EventExtensions { return JsonConvert.DeserializeObject(@event["Param"]); } -} \ No newline at end of file +} + +#region 计算函数 + +public static class MathTools +{ + public static float DegToRad(this float deg) => (deg + 360f) % 360f / 180f * float.Pi; + public static float RadToDeg(this float rad) => (rad + 2 * float.Pi) % (2 * float.Pi) / float.Pi * 180f; + + /// + /// 获得任意点与中心点的弧度值,以(0, 0, 1)方向为0,以(1, 0, 0)方向为pi/2。 + /// 即,逆时针方向增加。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetRadian(this Vector3 point, Vector3 center) + => MathF.Atan2(point.X - center.X, point.Z - center.Z); + + /// + /// 获得任意点与中心点的长度。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetLength(this Vector3 point, Vector3 center) + => new Vector2(point.X - center.X, point.Z - center.Z).Length(); + + /// + /// 将任意点以中心点为圆心,逆时针旋转并延长。 + /// + /// 任意点 + /// 中心点 + /// 旋转弧度 + /// 基于该点延伸长度 + /// + public static Vector3 RotateAndExtend(this Vector3 point, Vector3 center, float radian, float length) + { + var baseRad = point.GetRadian(center); + var baseLength = point.GetLength(center); + var rotRad = baseRad + radian; + return new Vector3( + center.X + MathF.Sin(rotRad) * (length + baseLength), + center.Y, + center.Z + MathF.Cos(rotRad) * (length + baseLength) + ); + } + + /// + /// 获得某角度所在划分区域 + /// + /// 输入弧度 + /// 区域划分数量 + /// 0度所在区域的初始Idx> + /// 是否为斜分割,默认为false + /// 是否顺时针增加,默认为false + /// + public static int RadianToRegion(this float radian, int regionNum, int baseRegionIdx = 0, bool isDiagDiv = false, bool isCw = false) + { + var sepRad = float.Pi * 2 / regionNum; + var inputAngle = radian * (isCw ? -1 : 1) + (isDiagDiv ? sepRad / 2 : 0); + var rad = (inputAngle + 4 * float.Pi) % (2 * float.Pi); + return ((int)Math.Floor(rad / sepRad) + baseRegionIdx + regionNum) % regionNum; + } + + /// + /// 将输入点左右折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointHorizon(this Vector3 point, float centerX) + => point with { X = 2 * centerX - point.X }; + + /// + /// 将输入点上下折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointVertical(this Vector3 point, float centerZ) + => point with { Z = 2 * centerZ - point.Z }; + + /// + /// 将输入点中心对称 + /// + /// 输入点 + /// 中心点 + /// + public static Vector3 PointCenterSymmetry(this Vector3 point, Vector3 center) + => point.RotateAndExtend(center, float.Pi, 0); + + /// + /// 获取给定数的指定位数 + /// + /// 给定数值 + /// 对应位数,个位为1 + /// + public static int GetDecimalDigit(this int val, int x) + { + var valStr = val.ToString(); + var length = valStr.Length; + if (x < 1 || x > length) return -1; + var digitChar = valStr[length - x]; // 从右往左取第x位 + return int.Parse(digitChar.ToString()); + } +} + +#endregion 计算函数 \ No newline at end of file diff --git a/02-A-Realm-Reborn/Trials-Extreme/Good_King_Moggle(Extreme).cs b/02-A-Realm-Reborn/Trials-Extreme/Good_King_Moggle(Extreme).cs index 82c1595..fb48232 100644 --- a/02-A-Realm-Reborn/Trials-Extreme/Good_King_Moggle(Extreme).cs +++ b/02-A-Realm-Reborn/Trials-Extreme/Good_King_Moggle(Extreme).cs @@ -3,25 +3,19 @@ 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 ECommons; -using ECommons.DalamudServices; -using ECommons.GameFunctions; -using ECommons.MathHelpers; using System.Threading.Tasks; using KodakkuAssist.Extensions; namespace Thornmarch_Extreme; [ScriptType(guid: "fc6a6125-4a1d-4669-be4c-9b375dc70ae0", name: "莫古力贤王歼殛战", territorys: [364], - version: "0.0.0.3", author: "Tetora", note: noteStr)] + version: "0.0.0.4", author: "Tetora", note: noteStr)] public class ThornmarchExtreme { @@ -693,3 +687,112 @@ public static class DirectionCalc return v2.Length(); } } + + +#region 计算函数 + +public static class MathTools +{ + public static float DegToRad(this float deg) => (deg + 360f) % 360f / 180f * float.Pi; + public static float RadToDeg(this float rad) => (rad + 2 * float.Pi) % (2 * float.Pi) / float.Pi * 180f; + + /// + /// 获得任意点与中心点的弧度值,以(0, 0, 1)方向为0,以(1, 0, 0)方向为pi/2。 + /// 即,逆时针方向增加。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetRadian(this Vector3 point, Vector3 center) + => MathF.Atan2(point.X - center.X, point.Z - center.Z); + + /// + /// 获得任意点与中心点的长度。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetLength(this Vector3 point, Vector3 center) + => new Vector2(point.X - center.X, point.Z - center.Z).Length(); + + /// + /// 将任意点以中心点为圆心,逆时针旋转并延长。 + /// + /// 任意点 + /// 中心点 + /// 旋转弧度 + /// 基于该点延伸长度 + /// + public static Vector3 RotateAndExtend(this Vector3 point, Vector3 center, float radian, float length) + { + var baseRad = point.GetRadian(center); + var baseLength = point.GetLength(center); + var rotRad = baseRad + radian; + return new Vector3( + center.X + MathF.Sin(rotRad) * (length + baseLength), + center.Y, + center.Z + MathF.Cos(rotRad) * (length + baseLength) + ); + } + + /// + /// 获得某角度所在划分区域 + /// + /// 输入弧度 + /// 区域划分数量 + /// 0度所在区域的初始Idx> + /// 是否为斜分割,默认为false + /// 是否顺时针增加,默认为false + /// + public static int RadianToRegion(this float radian, int regionNum, int baseRegionIdx = 0, bool isDiagDiv = false, bool isCw = false) + { + var sepRad = float.Pi * 2 / regionNum; + var inputAngle = radian * (isCw ? -1 : 1) + (isDiagDiv ? sepRad / 2 : 0); + var rad = (inputAngle + 4 * float.Pi) % (2 * float.Pi); + return ((int)Math.Floor(rad / sepRad) + baseRegionIdx + regionNum) % regionNum; + } + + /// + /// 将输入点左右折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointHorizon(this Vector3 point, float centerX) + => point with { X = 2 * centerX - point.X }; + + /// + /// 将输入点上下折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointVertical(this Vector3 point, float centerZ) + => point with { Z = 2 * centerZ - point.Z }; + + /// + /// 将输入点中心对称 + /// + /// 输入点 + /// 中心点 + /// + public static Vector3 PointCenterSymmetry(this Vector3 point, Vector3 center) + => point.RotateAndExtend(center, float.Pi, 0); + + /// + /// 获取给定数的指定位数 + /// + /// 给定数值 + /// 对应位数,个位为1 + /// + public static int GetDecimalDigit(this int val, int x) + { + var valStr = val.ToString(); + var length = valStr.Length; + if (x < 1 || x > length) return -1; + var digitChar = valStr[length - x]; // 从右往左取第x位 + return int.Parse(digitChar.ToString()); + } +} + +#endregion 计算函数 \ No newline at end of file diff --git a/02-A-Realm-Reborn/Trials-Extreme/Ifrit(Extreme).cs b/02-A-Realm-Reborn/Trials-Extreme/Ifrit(Extreme).cs index 5c5b306..0e60e88 100644 --- a/02-A-Realm-Reborn/Trials-Extreme/Ifrit(Extreme).cs +++ b/02-A-Realm-Reborn/Trials-Extreme/Ifrit(Extreme).cs @@ -3,25 +3,19 @@ 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 ECommons; -using ECommons.DalamudServices; -using ECommons.GameFunctions; -using ECommons.MathHelpers; using System.Threading.Tasks; using KodakkuAssist.Extensions; namespace Ifrit_Extreme; [ScriptType(guid: "dbb7983a-d2c4-4621-9734-76772e3f206a", name: "伊弗利特歼殛战", territorys: [295], - version: "0.0.0.3", author: "Tetora", note: noteStr)] + version: "0.0.0.4", author: "Tetora", note: noteStr)] public class Ifrit_Extreme { diff --git a/02-A-Realm-Reborn/Trials-Extreme/Leviathan(Extreme).cs b/02-A-Realm-Reborn/Trials-Extreme/Leviathan(Extreme).cs index cd55008..0045330 100644 --- a/02-A-Realm-Reborn/Trials-Extreme/Leviathan(Extreme).cs +++ b/02-A-Realm-Reborn/Trials-Extreme/Leviathan(Extreme).cs @@ -3,25 +3,19 @@ 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 ECommons; -using ECommons.DalamudServices; -using ECommons.GameFunctions; -using ECommons.MathHelpers; using System.Threading.Tasks; using KodakkuAssist.Extensions; namespace the_Whorleater_Extreme; [ScriptType(guid: "07f20e0e-9463-4a10-9dd1-956fde6a9c46", name: "利维亚桑歼殛战", territorys: [359], - version: "0.0.0.3", author: "Tetora", note: noteStr)] + version: "0.0.0.4", author: "Tetora", note: noteStr)] public class the_Whorleater_Extreme { diff --git a/02-A-Realm-Reborn/Trials/BattleInTheBigKeep.cs b/02-A-Realm-Reborn/Trials/BattleInTheBigKeep.cs index e09507e..e5dfd9c 100644 --- a/02-A-Realm-Reborn/Trials/BattleInTheBigKeep.cs +++ b/02-A-Realm-Reborn/Trials/BattleInTheBigKeep.cs @@ -3,8 +3,6 @@ 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; @@ -12,17 +10,13 @@ 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; using KodakkuAssist.Extensions; namespace Battle_in_the_Big_Keep; [ScriptType(guid: "90783a42-7947-4392-9c3e-f3162d52c248", name: "无限城的死斗", territorys: [396], - version: "0.0.0.2", author: "Tetora", note: noteStr)] + version: "0.0.0.3", author: "Tetora", note: noteStr)] public class Battle_in_the_Big_Keep { @@ -310,4 +304,114 @@ public static class EventExtensions { return JsonConvert.DeserializeObject(@event["Param"]); } -} \ No newline at end of file +} + + + +#region 计算函数 + +public static class MathTools +{ + public static float DegToRad(this float deg) => (deg + 360f) % 360f / 180f * float.Pi; + public static float RadToDeg(this float rad) => (rad + 2 * float.Pi) % (2 * float.Pi) / float.Pi * 180f; + + /// + /// 获得任意点与中心点的弧度值,以(0, 0, 1)方向为0,以(1, 0, 0)方向为pi/2。 + /// 即,逆时针方向增加。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetRadian(this Vector3 point, Vector3 center) + => MathF.Atan2(point.X - center.X, point.Z - center.Z); + + /// + /// 获得任意点与中心点的长度。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetLength(this Vector3 point, Vector3 center) + => new Vector2(point.X - center.X, point.Z - center.Z).Length(); + + /// + /// 将任意点以中心点为圆心,逆时针旋转并延长。 + /// + /// 任意点 + /// 中心点 + /// 旋转弧度 + /// 基于该点延伸长度 + /// + public static Vector3 RotateAndExtend(this Vector3 point, Vector3 center, float radian, float length) + { + var baseRad = point.GetRadian(center); + var baseLength = point.GetLength(center); + var rotRad = baseRad + radian; + return new Vector3( + center.X + MathF.Sin(rotRad) * (length + baseLength), + center.Y, + center.Z + MathF.Cos(rotRad) * (length + baseLength) + ); + } + + /// + /// 获得某角度所在划分区域 + /// + /// 输入弧度 + /// 区域划分数量 + /// 0度所在区域的初始Idx> + /// 是否为斜分割,默认为false + /// 是否顺时针增加,默认为false + /// + public static int RadianToRegion(this float radian, int regionNum, int baseRegionIdx = 0, bool isDiagDiv = false, bool isCw = false) + { + var sepRad = float.Pi * 2 / regionNum; + var inputAngle = radian * (isCw ? -1 : 1) + (isDiagDiv ? sepRad / 2 : 0); + var rad = (inputAngle + 4 * float.Pi) % (2 * float.Pi); + return ((int)Math.Floor(rad / sepRad) + baseRegionIdx + regionNum) % regionNum; + } + + /// + /// 将输入点左右折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointHorizon(this Vector3 point, float centerX) + => point with { X = 2 * centerX - point.X }; + + /// + /// 将输入点上下折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointVertical(this Vector3 point, float centerZ) + => point with { Z = 2 * centerZ - point.Z }; + + /// + /// 将输入点中心对称 + /// + /// 输入点 + /// 中心点 + /// + public static Vector3 PointCenterSymmetry(this Vector3 point, Vector3 center) + => point.RotateAndExtend(center, float.Pi, 0); + + /// + /// 获取给定数的指定位数 + /// + /// 给定数值 + /// 对应位数,个位为1 + /// + public static int GetDecimalDigit(this int val, int x) + { + var valStr = val.ToString(); + var length = valStr.Length; + if (x < 1 || x > length) return -1; + var digitChar = valStr[length - x]; // 从右往左取第x位 + return int.Parse(digitChar.ToString()); + } +} + +#endregion 计算函数 \ No newline at end of file diff --git a/02-A-Realm-Reborn/Trials/BattleOnTheBigBridge.cs b/02-A-Realm-Reborn/Trials/BattleOnTheBigBridge.cs index d042787..fae5cb8 100644 --- a/02-A-Realm-Reborn/Trials/BattleOnTheBigBridge.cs +++ b/02-A-Realm-Reborn/Trials/BattleOnTheBigBridge.cs @@ -3,25 +3,19 @@ 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 ECommons; -using ECommons.DalamudServices; -using ECommons.GameFunctions; -using ECommons.MathHelpers; using System.Threading.Tasks; using KodakkuAssist.Extensions; namespace BattleOnTheBigBridgen; [ScriptType(guid: "3e4102cb-9410-44fd-85e8-d43a3bc25737", name: "大桥上的决斗", territorys: [366], - version: "0.0.0.3", author: "Tetora", note: noteStr)] + version: "0.0.0.4", author: "Tetora", note: noteStr)] public class BattleOnTheBigBridge { diff --git a/02-A-Realm-Reborn/Trials/DhormeChimera.cs b/02-A-Realm-Reborn/Trials/DhormeChimera.cs index e6bf7b3..4d96dab 100644 --- a/02-A-Realm-Reborn/Trials/DhormeChimera.cs +++ b/02-A-Realm-Reborn/Trials/DhormeChimera.cs @@ -3,24 +3,18 @@ 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 ECommons; -// using ECommons.DalamudServices; -// using ECommons.GameFunctions; -// using ECommons.MathHelpers; using System.Threading.Tasks; namespace DhormeChimera; [ScriptType(guid: "e24bb311-704f-4f4c-8188-87eaa8da8b29", name: "死化奇美拉讨伐战", territorys: [368], - version: "0.0.0.3", author: "Tetora", note: noteStr)] + version: "0.0.0.4", author: "Tetora", note: noteStr)] public class DhormeChimera { diff --git a/02-A-Realm-Reborn/Trials/Garuda(Hard).cs b/02-A-Realm-Reborn/Trials/Garuda(Hard).cs index c180faa..19ba7de 100644 --- a/02-A-Realm-Reborn/Trials/Garuda(Hard).cs +++ b/02-A-Realm-Reborn/Trials/Garuda(Hard).cs @@ -3,25 +3,19 @@ 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 ECommons; -using ECommons.DalamudServices; -using ECommons.GameFunctions; -using ECommons.MathHelpers; using System.Threading.Tasks; using KodakkuAssist.Extensions; namespace Garuda_Hard; [ScriptType(guid: "ef230d41-5fbf-413d-b745-7227efebec48", name: "迦楼罗歼灭战", territorys: [294], - version: "0.0.0.1", author: "Tetora", note: noteStr)] + version: "0.0.0.2", author: "Tetora", note: noteStr)] public class Garuda_Hard_ { @@ -240,4 +234,114 @@ public static class EventExtensions { return JsonConvert.DeserializeObject(@event["Param"]); } -} \ No newline at end of file +} + + + +#region 计算函数 + +public static class MathTools +{ + public static float DegToRad(this float deg) => (deg + 360f) % 360f / 180f * float.Pi; + public static float RadToDeg(this float rad) => (rad + 2 * float.Pi) % (2 * float.Pi) / float.Pi * 180f; + + /// + /// 获得任意点与中心点的弧度值,以(0, 0, 1)方向为0,以(1, 0, 0)方向为pi/2。 + /// 即,逆时针方向增加。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetRadian(this Vector3 point, Vector3 center) + => MathF.Atan2(point.X - center.X, point.Z - center.Z); + + /// + /// 获得任意点与中心点的长度。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetLength(this Vector3 point, Vector3 center) + => new Vector2(point.X - center.X, point.Z - center.Z).Length(); + + /// + /// 将任意点以中心点为圆心,逆时针旋转并延长。 + /// + /// 任意点 + /// 中心点 + /// 旋转弧度 + /// 基于该点延伸长度 + /// + public static Vector3 RotateAndExtend(this Vector3 point, Vector3 center, float radian, float length) + { + var baseRad = point.GetRadian(center); + var baseLength = point.GetLength(center); + var rotRad = baseRad + radian; + return new Vector3( + center.X + MathF.Sin(rotRad) * (length + baseLength), + center.Y, + center.Z + MathF.Cos(rotRad) * (length + baseLength) + ); + } + + /// + /// 获得某角度所在划分区域 + /// + /// 输入弧度 + /// 区域划分数量 + /// 0度所在区域的初始Idx> + /// 是否为斜分割,默认为false + /// 是否顺时针增加,默认为false + /// + public static int RadianToRegion(this float radian, int regionNum, int baseRegionIdx = 0, bool isDiagDiv = false, bool isCw = false) + { + var sepRad = float.Pi * 2 / regionNum; + var inputAngle = radian * (isCw ? -1 : 1) + (isDiagDiv ? sepRad / 2 : 0); + var rad = (inputAngle + 4 * float.Pi) % (2 * float.Pi); + return ((int)Math.Floor(rad / sepRad) + baseRegionIdx + regionNum) % regionNum; + } + + /// + /// 将输入点左右折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointHorizon(this Vector3 point, float centerX) + => point with { X = 2 * centerX - point.X }; + + /// + /// 将输入点上下折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointVertical(this Vector3 point, float centerZ) + => point with { Z = 2 * centerZ - point.Z }; + + /// + /// 将输入点中心对称 + /// + /// 输入点 + /// 中心点 + /// + public static Vector3 PointCenterSymmetry(this Vector3 point, Vector3 center) + => point.RotateAndExtend(center, float.Pi, 0); + + /// + /// 获取给定数的指定位数 + /// + /// 给定数值 + /// 对应位数,个位为1 + /// + public static int GetDecimalDigit(this int val, int x) + { + var valStr = val.ToString(); + var length = valStr.Length; + if (x < 1 || x > length) return -1; + var digitChar = valStr[length - x]; // 从右往左取第x位 + return int.Parse(digitChar.ToString()); + } +} + +#endregion 计算函数 \ No newline at end of file diff --git a/02-A-Realm-Reborn/Trials/Garuda(Normal).cs b/02-A-Realm-Reborn/Trials/Garuda(Normal).cs index c7a6964..2e149fa 100644 --- a/02-A-Realm-Reborn/Trials/Garuda(Normal).cs +++ b/02-A-Realm-Reborn/Trials/Garuda(Normal).cs @@ -3,24 +3,18 @@ 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 ECommons; -using ECommons.DalamudServices; -using ECommons.GameFunctions; -using ECommons.MathHelpers; using System.Threading.Tasks; namespace Garuda_Normal; [ScriptType(guid: "0887dadc-e415-48c9-bab1-cb51554457a2", name: "迦楼罗讨伐战", territorys: [1047], - version: "0.0.0.1", author: "Tetora", note: noteStr)] + version: "0.0.0.2", author: "Tetora", note: noteStr)] public class Garuda_Normal { diff --git a/02-A-Realm-Reborn/Trials/Good_King_Moggle-Hard.cs b/02-A-Realm-Reborn/Trials/Good_King_Moggle-Hard.cs index cc79ee6..5b199f3 100644 --- a/02-A-Realm-Reborn/Trials/Good_King_Moggle-Hard.cs +++ b/02-A-Realm-Reborn/Trials/Good_King_Moggle-Hard.cs @@ -3,25 +3,19 @@ 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 ECommons; -using ECommons.DalamudServices; -using ECommons.GameFunctions; -using ECommons.MathHelpers; using System.Threading.Tasks; using KodakkuAssist.Extensions; namespace Thornmarch_Hard; [ScriptType(guid: "cd81e178-12e6-4e53-9b81-63002cc51ecb", name: "莫古力贤王歼灭战(整活版)", territorys: [1067], - version: "0.0.0.2", author: "Tetora", note: noteStr)] + version: "0.0.0.3", author: "Tetora", note: noteStr)] public class Thornmarch_Hard { @@ -687,4 +681,114 @@ public static class EventExtensions { return JsonConvert.DeserializeObject(@event["Param"]); } -} \ No newline at end of file +} + + + +#region 计算函数 + +public static class MathTools +{ + public static float DegToRad(this float deg) => (deg + 360f) % 360f / 180f * float.Pi; + public static float RadToDeg(this float rad) => (rad + 2 * float.Pi) % (2 * float.Pi) / float.Pi * 180f; + + /// + /// 获得任意点与中心点的弧度值,以(0, 0, 1)方向为0,以(1, 0, 0)方向为pi/2。 + /// 即,逆时针方向增加。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetRadian(this Vector3 point, Vector3 center) + => MathF.Atan2(point.X - center.X, point.Z - center.Z); + + /// + /// 获得任意点与中心点的长度。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetLength(this Vector3 point, Vector3 center) + => new Vector2(point.X - center.X, point.Z - center.Z).Length(); + + /// + /// 将任意点以中心点为圆心,逆时针旋转并延长。 + /// + /// 任意点 + /// 中心点 + /// 旋转弧度 + /// 基于该点延伸长度 + /// + public static Vector3 RotateAndExtend(this Vector3 point, Vector3 center, float radian, float length) + { + var baseRad = point.GetRadian(center); + var baseLength = point.GetLength(center); + var rotRad = baseRad + radian; + return new Vector3( + center.X + MathF.Sin(rotRad) * (length + baseLength), + center.Y, + center.Z + MathF.Cos(rotRad) * (length + baseLength) + ); + } + + /// + /// 获得某角度所在划分区域 + /// + /// 输入弧度 + /// 区域划分数量 + /// 0度所在区域的初始Idx> + /// 是否为斜分割,默认为false + /// 是否顺时针增加,默认为false + /// + public static int RadianToRegion(this float radian, int regionNum, int baseRegionIdx = 0, bool isDiagDiv = false, bool isCw = false) + { + var sepRad = float.Pi * 2 / regionNum; + var inputAngle = radian * (isCw ? -1 : 1) + (isDiagDiv ? sepRad / 2 : 0); + var rad = (inputAngle + 4 * float.Pi) % (2 * float.Pi); + return ((int)Math.Floor(rad / sepRad) + baseRegionIdx + regionNum) % regionNum; + } + + /// + /// 将输入点左右折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointHorizon(this Vector3 point, float centerX) + => point with { X = 2 * centerX - point.X }; + + /// + /// 将输入点上下折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointVertical(this Vector3 point, float centerZ) + => point with { Z = 2 * centerZ - point.Z }; + + /// + /// 将输入点中心对称 + /// + /// 输入点 + /// 中心点 + /// + public static Vector3 PointCenterSymmetry(this Vector3 point, Vector3 center) + => point.RotateAndExtend(center, float.Pi, 0); + + /// + /// 获取给定数的指定位数 + /// + /// 给定数值 + /// 对应位数,个位为1 + /// + public static int GetDecimalDigit(this int val, int x) + { + var valStr = val.ToString(); + var length = valStr.Length; + if (x < 1 || x > length) return -1; + var digitChar = valStr[length - x]; // 从右往左取第x位 + return int.Parse(digitChar.ToString()); + } +} + +#endregion 计算函数 \ No newline at end of file diff --git a/02-A-Realm-Reborn/Trials/Hydra.cs b/02-A-Realm-Reborn/Trials/Hydra.cs index 5410c8f..2f1c50d 100644 --- a/02-A-Realm-Reborn/Trials/Hydra.cs +++ b/02-A-Realm-Reborn/Trials/Hydra.cs @@ -3,24 +3,18 @@ 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 ECommons; -using ECommons.DalamudServices; -using ECommons.GameFunctions; -using ECommons.MathHelpers; using System.Threading.Tasks; namespace A_Relic_Reborn_the_Hydra; [ScriptType(guid: "d32d7489-a1bb-4117-98dd-ee895390804d", name: "海德拉讨伐战", territorys: [369], - version: "0.0.0.2", author: "Tetora", note: noteStr)] + version: "0.0.0.3", author: "Tetora", note: noteStr)] public class theBowlofEmbers_Hard { @@ -190,4 +184,114 @@ public static class Extensions accessory.Method.TTS(text); } } -} \ No newline at end of file +} + + + +#region 计算函数 + +public static class MathTools +{ + public static float DegToRad(this float deg) => (deg + 360f) % 360f / 180f * float.Pi; + public static float RadToDeg(this float rad) => (rad + 2 * float.Pi) % (2 * float.Pi) / float.Pi * 180f; + + /// + /// 获得任意点与中心点的弧度值,以(0, 0, 1)方向为0,以(1, 0, 0)方向为pi/2。 + /// 即,逆时针方向增加。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetRadian(this Vector3 point, Vector3 center) + => MathF.Atan2(point.X - center.X, point.Z - center.Z); + + /// + /// 获得任意点与中心点的长度。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetLength(this Vector3 point, Vector3 center) + => new Vector2(point.X - center.X, point.Z - center.Z).Length(); + + /// + /// 将任意点以中心点为圆心,逆时针旋转并延长。 + /// + /// 任意点 + /// 中心点 + /// 旋转弧度 + /// 基于该点延伸长度 + /// + public static Vector3 RotateAndExtend(this Vector3 point, Vector3 center, float radian, float length) + { + var baseRad = point.GetRadian(center); + var baseLength = point.GetLength(center); + var rotRad = baseRad + radian; + return new Vector3( + center.X + MathF.Sin(rotRad) * (length + baseLength), + center.Y, + center.Z + MathF.Cos(rotRad) * (length + baseLength) + ); + } + + /// + /// 获得某角度所在划分区域 + /// + /// 输入弧度 + /// 区域划分数量 + /// 0度所在区域的初始Idx> + /// 是否为斜分割,默认为false + /// 是否顺时针增加,默认为false + /// + public static int RadianToRegion(this float radian, int regionNum, int baseRegionIdx = 0, bool isDiagDiv = false, bool isCw = false) + { + var sepRad = float.Pi * 2 / regionNum; + var inputAngle = radian * (isCw ? -1 : 1) + (isDiagDiv ? sepRad / 2 : 0); + var rad = (inputAngle + 4 * float.Pi) % (2 * float.Pi); + return ((int)Math.Floor(rad / sepRad) + baseRegionIdx + regionNum) % regionNum; + } + + /// + /// 将输入点左右折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointHorizon(this Vector3 point, float centerX) + => point with { X = 2 * centerX - point.X }; + + /// + /// 将输入点上下折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointVertical(this Vector3 point, float centerZ) + => point with { Z = 2 * centerZ - point.Z }; + + /// + /// 将输入点中心对称 + /// + /// 输入点 + /// 中心点 + /// + public static Vector3 PointCenterSymmetry(this Vector3 point, Vector3 center) + => point.RotateAndExtend(center, float.Pi, 0); + + /// + /// 获取给定数的指定位数 + /// + /// 给定数值 + /// 对应位数,个位为1 + /// + public static int GetDecimalDigit(this int val, int x) + { + var valStr = val.ToString(); + var length = valStr.Length; + if (x < 1 || x > length) return -1; + var digitChar = valStr[length - x]; // 从右往左取第x位 + return int.Parse(digitChar.ToString()); + } +} + +#endregion 计算函数 \ No newline at end of file diff --git a/02-A-Realm-Reborn/Trials/Ifrit(Hard).cs b/02-A-Realm-Reborn/Trials/Ifrit(Hard).cs index ea4d987..26bfd06 100644 --- a/02-A-Realm-Reborn/Trials/Ifrit(Hard).cs +++ b/02-A-Realm-Reborn/Trials/Ifrit(Hard).cs @@ -3,24 +3,18 @@ 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 ECommons; -using ECommons.DalamudServices; -using ECommons.GameFunctions; -using ECommons.MathHelpers; using System.Threading.Tasks; namespace theBowlofEmbers_Hard; [ScriptType(guid: "d3d532f1-0707-427f-ac04-871a22022c11", name: "伊弗利特歼灭战", territorys: [292], - version: "0.0.0.2", author: "Tetora", note: noteStr)] + version: "0.0.0.3", author: "Tetora", note: noteStr)] public class theBowlofEmbers_Hard { @@ -38,7 +32,7 @@ public class theBowlofEmbers_Hard { if (!烈焰焚烧) return; var dp = accessory.Data.GetDefaultDrawProperties(); - var ifrits = Svc.Objects.Where(x => x.DataId == 209); + var ifrits = accessory.Data.Objects.Where(x => x.DataId == 209); foreach (var ifrit in ifrits) { if (ifrit.IsTargetable) @@ -62,7 +56,7 @@ public class theBowlofEmbers_Hard { if (!火神爆裂) return; var dp = accessory.Data.GetDefaultDrawProperties(); - var ifrits = Svc.Objects.Where(x => x.DataId == 209); + var ifrits = accessory.Data.Objects.Where(x => x.DataId == 209); foreach (var ifrit in ifrits) { if (ifrit.IsTargetable) @@ -232,4 +226,114 @@ public static class Extensions accessory.Method.TTS(text); } } -} \ No newline at end of file +} + + + +#region 计算函数 + +public static class MathTools +{ + public static float DegToRad(this float deg) => (deg + 360f) % 360f / 180f * float.Pi; + public static float RadToDeg(this float rad) => (rad + 2 * float.Pi) % (2 * float.Pi) / float.Pi * 180f; + + /// + /// 获得任意点与中心点的弧度值,以(0, 0, 1)方向为0,以(1, 0, 0)方向为pi/2。 + /// 即,逆时针方向增加。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetRadian(this Vector3 point, Vector3 center) + => MathF.Atan2(point.X - center.X, point.Z - center.Z); + + /// + /// 获得任意点与中心点的长度。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetLength(this Vector3 point, Vector3 center) + => new Vector2(point.X - center.X, point.Z - center.Z).Length(); + + /// + /// 将任意点以中心点为圆心,逆时针旋转并延长。 + /// + /// 任意点 + /// 中心点 + /// 旋转弧度 + /// 基于该点延伸长度 + /// + public static Vector3 RotateAndExtend(this Vector3 point, Vector3 center, float radian, float length) + { + var baseRad = point.GetRadian(center); + var baseLength = point.GetLength(center); + var rotRad = baseRad + radian; + return new Vector3( + center.X + MathF.Sin(rotRad) * (length + baseLength), + center.Y, + center.Z + MathF.Cos(rotRad) * (length + baseLength) + ); + } + + /// + /// 获得某角度所在划分区域 + /// + /// 输入弧度 + /// 区域划分数量 + /// 0度所在区域的初始Idx> + /// 是否为斜分割,默认为false + /// 是否顺时针增加,默认为false + /// + public static int RadianToRegion(this float radian, int regionNum, int baseRegionIdx = 0, bool isDiagDiv = false, bool isCw = false) + { + var sepRad = float.Pi * 2 / regionNum; + var inputAngle = radian * (isCw ? -1 : 1) + (isDiagDiv ? sepRad / 2 : 0); + var rad = (inputAngle + 4 * float.Pi) % (2 * float.Pi); + return ((int)Math.Floor(rad / sepRad) + baseRegionIdx + regionNum) % regionNum; + } + + /// + /// 将输入点左右折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointHorizon(this Vector3 point, float centerX) + => point with { X = 2 * centerX - point.X }; + + /// + /// 将输入点上下折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointVertical(this Vector3 point, float centerZ) + => point with { Z = 2 * centerZ - point.Z }; + + /// + /// 将输入点中心对称 + /// + /// 输入点 + /// 中心点 + /// + public static Vector3 PointCenterSymmetry(this Vector3 point, Vector3 center) + => point.RotateAndExtend(center, float.Pi, 0); + + /// + /// 获取给定数的指定位数 + /// + /// 给定数值 + /// 对应位数,个位为1 + /// + public static int GetDecimalDigit(this int val, int x) + { + var valStr = val.ToString(); + var length = valStr.Length; + if (x < 1 || x > length) return -1; + var digitChar = valStr[length - x]; // 从右往左取第x位 + return int.Parse(digitChar.ToString()); + } +} + +#endregion 计算函数 \ No newline at end of file diff --git a/02-A-Realm-Reborn/Trials/Nabriales.cs b/02-A-Realm-Reborn/Trials/Nabriales.cs index d889a87..b96a127 100644 --- a/02-A-Realm-Reborn/Trials/Nabriales.cs +++ b/02-A-Realm-Reborn/Trials/Nabriales.cs @@ -3,24 +3,18 @@ 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 ECommons; -using ECommons.DalamudServices; -using ECommons.GameFunctions; -using ECommons.MathHelpers; using System.Threading.Tasks; namespace Nabriales; [ScriptType(guid: "64206b9e-cd0a-47ec-960d-15f39a888f9e", name: "那布里亚勒斯讨伐战", territorys: [426], - version: "0.0.0.3", author: "Tetora", note: noteStr)] + version: "0.0.0.4", author: "Tetora", note: noteStr)] public class Nabriales { diff --git a/02-A-Realm-Reborn/Trials/Odin.cs b/02-A-Realm-Reborn/Trials/Odin.cs index b6c10cc..8637874 100644 --- a/02-A-Realm-Reborn/Trials/Odin.cs +++ b/02-A-Realm-Reborn/Trials/Odin.cs @@ -3,24 +3,18 @@ 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 ECommons; -using ECommons.DalamudServices; -using ECommons.GameFunctions; -using ECommons.MathHelpers; using System.Threading.Tasks; namespace Urths_Fount; [ScriptType(guid: "1a07440d-a7bd-4b67-b781-90d14087ee60", name: "奥丁歼灭战", territorys: [394], - version: "0.0.0.2", author: "Tetora", note: noteStr)] + version: "0.0.0.3", author: "Tetora", note: noteStr)] public class Urths_Fount { const string noteStr = @@ -207,3 +201,111 @@ public static class Extensions } } } + +#region 计算函数 + +public static class MathTools +{ + public static float DegToRad(this float deg) => (deg + 360f) % 360f / 180f * float.Pi; + public static float RadToDeg(this float rad) => (rad + 2 * float.Pi) % (2 * float.Pi) / float.Pi * 180f; + + /// + /// 获得任意点与中心点的弧度值,以(0, 0, 1)方向为0,以(1, 0, 0)方向为pi/2。 + /// 即,逆时针方向增加。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetRadian(this Vector3 point, Vector3 center) + => MathF.Atan2(point.X - center.X, point.Z - center.Z); + + /// + /// 获得任意点与中心点的长度。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetLength(this Vector3 point, Vector3 center) + => new Vector2(point.X - center.X, point.Z - center.Z).Length(); + + /// + /// 将任意点以中心点为圆心,逆时针旋转并延长。 + /// + /// 任意点 + /// 中心点 + /// 旋转弧度 + /// 基于该点延伸长度 + /// + public static Vector3 RotateAndExtend(this Vector3 point, Vector3 center, float radian, float length) + { + var baseRad = point.GetRadian(center); + var baseLength = point.GetLength(center); + var rotRad = baseRad + radian; + return new Vector3( + center.X + MathF.Sin(rotRad) * (length + baseLength), + center.Y, + center.Z + MathF.Cos(rotRad) * (length + baseLength) + ); + } + + /// + /// 获得某角度所在划分区域 + /// + /// 输入弧度 + /// 区域划分数量 + /// 0度所在区域的初始Idx> + /// 是否为斜分割,默认为false + /// 是否顺时针增加,默认为false + /// + public static int RadianToRegion(this float radian, int regionNum, int baseRegionIdx = 0, bool isDiagDiv = false, bool isCw = false) + { + var sepRad = float.Pi * 2 / regionNum; + var inputAngle = radian * (isCw ? -1 : 1) + (isDiagDiv ? sepRad / 2 : 0); + var rad = (inputAngle + 4 * float.Pi) % (2 * float.Pi); + return ((int)Math.Floor(rad / sepRad) + baseRegionIdx + regionNum) % regionNum; + } + + /// + /// 将输入点左右折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointHorizon(this Vector3 point, float centerX) + => point with { X = 2 * centerX - point.X }; + + /// + /// 将输入点上下折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointVertical(this Vector3 point, float centerZ) + => point with { Z = 2 * centerZ - point.Z }; + + /// + /// 将输入点中心对称 + /// + /// 输入点 + /// 中心点 + /// + public static Vector3 PointCenterSymmetry(this Vector3 point, Vector3 center) + => point.RotateAndExtend(center, float.Pi, 0); + + /// + /// 获取给定数的指定位数 + /// + /// 给定数值 + /// 对应位数,个位为1 + /// + public static int GetDecimalDigit(this int val, int x) + { + var valStr = val.ToString(); + var length = valStr.Length; + if (x < 1 || x > length) return -1; + var digitChar = valStr[length - x]; // 从右往左取第x位 + return int.Parse(digitChar.ToString()); + } +} + +#endregion 计算函数 \ No newline at end of file diff --git a/02-A-Realm-Reborn/Trials/Ramuh(Hard).cs b/02-A-Realm-Reborn/Trials/Ramuh(Hard).cs index f7f8be4..72c1fc5 100644 --- a/02-A-Realm-Reborn/Trials/Ramuh(Hard).cs +++ b/02-A-Realm-Reborn/Trials/Ramuh(Hard).cs @@ -3,24 +3,18 @@ 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 ECommons; -using ECommons.DalamudServices; -using ECommons.GameFunctions; -using ECommons.MathHelpers; using System.Threading.Tasks; namespace theStrikingTree_Hard; [ScriptType(guid: "de6d6f10-775d-4c45-91ec-2bd4ed6762c7", name: "拉姆歼灭战", territorys: [374], - version: "0.0.0.2", author: "Tetora", note: noteStr)] + version: "0.0.0.3", author: "Tetora", note: noteStr)] public class theStrikingTree_Hard_ { diff --git a/02-A-Realm-Reborn/Trials/Shiva.cs b/02-A-Realm-Reborn/Trials/Shiva.cs index 7af6336..4be0046 100644 --- a/02-A-Realm-Reborn/Trials/Shiva.cs +++ b/02-A-Realm-Reborn/Trials/Shiva.cs @@ -3,8 +3,6 @@ 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; @@ -12,16 +10,12 @@ 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 Shiva; [ScriptType(guid: "cddb93a8-e01e-40fe-989c-5153ad62bfbc", name: "希瓦歼灭战", territorys: [377], - version: "0.0.0.1", author: "Tetora", note: noteStr)] + version: "0.0.0.2", author: "Tetora", note: noteStr)] public class Shiva { @@ -285,4 +279,112 @@ public static class EventExtensions { return JsonConvert.DeserializeObject(@event["Param"]); } -} \ No newline at end of file +} + +#region 计算函数 + +public static class MathTools +{ + public static float DegToRad(this float deg) => (deg + 360f) % 360f / 180f * float.Pi; + public static float RadToDeg(this float rad) => (rad + 2 * float.Pi) % (2 * float.Pi) / float.Pi * 180f; + + /// + /// 获得任意点与中心点的弧度值,以(0, 0, 1)方向为0,以(1, 0, 0)方向为pi/2。 + /// 即,逆时针方向增加。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetRadian(this Vector3 point, Vector3 center) + => MathF.Atan2(point.X - center.X, point.Z - center.Z); + + /// + /// 获得任意点与中心点的长度。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetLength(this Vector3 point, Vector3 center) + => new Vector2(point.X - center.X, point.Z - center.Z).Length(); + + /// + /// 将任意点以中心点为圆心,逆时针旋转并延长。 + /// + /// 任意点 + /// 中心点 + /// 旋转弧度 + /// 基于该点延伸长度 + /// + public static Vector3 RotateAndExtend(this Vector3 point, Vector3 center, float radian, float length) + { + var baseRad = point.GetRadian(center); + var baseLength = point.GetLength(center); + var rotRad = baseRad + radian; + return new Vector3( + center.X + MathF.Sin(rotRad) * (length + baseLength), + center.Y, + center.Z + MathF.Cos(rotRad) * (length + baseLength) + ); + } + + /// + /// 获得某角度所在划分区域 + /// + /// 输入弧度 + /// 区域划分数量 + /// 0度所在区域的初始Idx> + /// 是否为斜分割,默认为false + /// 是否顺时针增加,默认为false + /// + public static int RadianToRegion(this float radian, int regionNum, int baseRegionIdx = 0, bool isDiagDiv = false, bool isCw = false) + { + var sepRad = float.Pi * 2 / regionNum; + var inputAngle = radian * (isCw ? -1 : 1) + (isDiagDiv ? sepRad / 2 : 0); + var rad = (inputAngle + 4 * float.Pi) % (2 * float.Pi); + return ((int)Math.Floor(rad / sepRad) + baseRegionIdx + regionNum) % regionNum; + } + + /// + /// 将输入点左右折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointHorizon(this Vector3 point, float centerX) + => point with { X = 2 * centerX - point.X }; + + /// + /// 将输入点上下折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointVertical(this Vector3 point, float centerZ) + => point with { Z = 2 * centerZ - point.Z }; + + /// + /// 将输入点中心对称 + /// + /// 输入点 + /// 中心点 + /// + public static Vector3 PointCenterSymmetry(this Vector3 point, Vector3 center) + => point.RotateAndExtend(center, float.Pi, 0); + + /// + /// 获取给定数的指定位数 + /// + /// 给定数值 + /// 对应位数,个位为1 + /// + public static int GetDecimalDigit(this int val, int x) + { + var valStr = val.ToString(); + var length = valStr.Length; + if (x < 1 || x > length) return -1; + var digitChar = valStr[length - x]; // 从右往左取第x位 + return int.Parse(digitChar.ToString()); + } +} + +#endregion 计算函数 \ No newline at end of file diff --git a/03-Heavensward/Dungeon/theAery.cs b/03-Heavensward/Dungeon/theAery.cs index 6d872a6..f21a0b7 100644 --- a/03-Heavensward/Dungeon/theAery.cs +++ b/03-Heavensward/Dungeon/theAery.cs @@ -3,8 +3,6 @@ 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; @@ -12,16 +10,12 @@ 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 the_Aery; [ScriptType(guid: "ac6caf4e-5eee-406c-8621-a5f3c5c7e9b0", name: "邪龙王座龙巢神殿", territorys: [1065], - version: "0.0.0.1", author: "Tetora", note: noteStr)] + version: "0.0.0.2", author: "Tetora", note: noteStr)] public class the_Aery { @@ -389,4 +383,112 @@ public static class EventExtensions { return JsonConvert.DeserializeObject(@event["Param"]); } -} \ No newline at end of file +} + +#region 计算函数 + +public static class MathTools +{ + public static float DegToRad(this float deg) => (deg + 360f) % 360f / 180f * float.Pi; + public static float RadToDeg(this float rad) => (rad + 2 * float.Pi) % (2 * float.Pi) / float.Pi * 180f; + + /// + /// 获得任意点与中心点的弧度值,以(0, 0, 1)方向为0,以(1, 0, 0)方向为pi/2。 + /// 即,逆时针方向增加。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetRadian(this Vector3 point, Vector3 center) + => MathF.Atan2(point.X - center.X, point.Z - center.Z); + + /// + /// 获得任意点与中心点的长度。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetLength(this Vector3 point, Vector3 center) + => new Vector2(point.X - center.X, point.Z - center.Z).Length(); + + /// + /// 将任意点以中心点为圆心,逆时针旋转并延长。 + /// + /// 任意点 + /// 中心点 + /// 旋转弧度 + /// 基于该点延伸长度 + /// + public static Vector3 RotateAndExtend(this Vector3 point, Vector3 center, float radian, float length) + { + var baseRad = point.GetRadian(center); + var baseLength = point.GetLength(center); + var rotRad = baseRad + radian; + return new Vector3( + center.X + MathF.Sin(rotRad) * (length + baseLength), + center.Y, + center.Z + MathF.Cos(rotRad) * (length + baseLength) + ); + } + + /// + /// 获得某角度所在划分区域 + /// + /// 输入弧度 + /// 区域划分数量 + /// 0度所在区域的初始Idx> + /// 是否为斜分割,默认为false + /// 是否顺时针增加,默认为false + /// + public static int RadianToRegion(this float radian, int regionNum, int baseRegionIdx = 0, bool isDiagDiv = false, bool isCw = false) + { + var sepRad = float.Pi * 2 / regionNum; + var inputAngle = radian * (isCw ? -1 : 1) + (isDiagDiv ? sepRad / 2 : 0); + var rad = (inputAngle + 4 * float.Pi) % (2 * float.Pi); + return ((int)Math.Floor(rad / sepRad) + baseRegionIdx + regionNum) % regionNum; + } + + /// + /// 将输入点左右折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointHorizon(this Vector3 point, float centerX) + => point with { X = 2 * centerX - point.X }; + + /// + /// 将输入点上下折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointVertical(this Vector3 point, float centerZ) + => point with { Z = 2 * centerZ - point.Z }; + + /// + /// 将输入点中心对称 + /// + /// 输入点 + /// 中心点 + /// + public static Vector3 PointCenterSymmetry(this Vector3 point, Vector3 center) + => point.RotateAndExtend(center, float.Pi, 0); + + /// + /// 获取给定数的指定位数 + /// + /// 给定数值 + /// 对应位数,个位为1 + /// + public static int GetDecimalDigit(this int val, int x) + { + var valStr = val.ToString(); + var length = valStr.Length; + if (x < 1 || x > length) return -1; + var digitChar = valStr[length - x]; // 从右往左取第x位 + return int.Parse(digitChar.ToString()); + } +} + +#endregion 计算函数 \ No newline at end of file diff --git a/03-Heavensward/Raid-Alexander/Normal/A3N.cs b/03-Heavensward/Raid-Alexander/Normal/A3N.cs index 14c93fe..ec4d4c4 100644 --- a/03-Heavensward/Raid-Alexander/Normal/A3N.cs +++ b/03-Heavensward/Raid-Alexander/Normal/A3N.cs @@ -3,8 +3,6 @@ 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; @@ -12,16 +10,12 @@ 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 A3N; [ScriptType(guid: "69712d1f-26c4-441f-97f0-e63f8baf98a6", name: "A3N", territorys: [444], - version: "0.0.0.2", author: "Tetora", note: noteStr)] + version: "0.0.0.3", author: "Tetora", note: noteStr)] public class A3N { diff --git a/03-Heavensward/Raid-Alexander/Normal/A5N.cs b/03-Heavensward/Raid-Alexander/Normal/A5N.cs index 4d2d583..2a65485 100644 --- a/03-Heavensward/Raid-Alexander/Normal/A5N.cs +++ b/03-Heavensward/Raid-Alexander/Normal/A5N.cs @@ -3,25 +3,19 @@ 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 ECommons; -using ECommons.DalamudServices; -using ECommons.GameFunctions; -using ECommons.MathHelpers; using System.Threading.Tasks; using KodakkuAssist.Extensions; namespace A5N; [ScriptType(guid: "1462516c-2bc2-4560-8244-387845cc098d", name: "A5N", territorys: [520], - version: "0.0.0.1", author: "Tetora", note: noteStr)] + version: "0.0.0.2", author: "Tetora", note: noteStr)] public class A5N { diff --git a/03-Heavensward/Raid-Alexander/Normal/A6N.cs b/03-Heavensward/Raid-Alexander/Normal/A6N.cs index 2973381..61db9da 100644 --- a/03-Heavensward/Raid-Alexander/Normal/A6N.cs +++ b/03-Heavensward/Raid-Alexander/Normal/A6N.cs @@ -3,8 +3,6 @@ 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; @@ -12,16 +10,12 @@ 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 A6N; [ScriptType(guid: "288f4f47-b94d-400a-bc07-ae244c2a432c", name: "A6N", territorys: [521], - version: "0.0.0.1", author: "Tetora", note: noteStr)] + version: "0.0.0.2", author: "Tetora", note: noteStr)] public class A6N { diff --git a/03-Heavensward/Trials-Extreme/Bismarck-Extreme.cs b/03-Heavensward/Trials-Extreme/Bismarck-Extreme.cs index d20b44a..6cf83b5 100644 --- a/03-Heavensward/Trials-Extreme/Bismarck-Extreme.cs +++ b/03-Heavensward/Trials-Extreme/Bismarck-Extreme.cs @@ -3,25 +3,19 @@ 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 ECommons; -using ECommons.DalamudServices; -using ECommons.GameFunctions; -using ECommons.MathHelpers; using System.Threading.Tasks; using KodakkuAssist.Extensions; namespace Bismarck_Extreme; [ScriptType(guid: "56751be8-113f-4496-8b46-982ff96d90c3", name: "俾斯麦歼殛战", territorys: [447], - version: "0.0.0.1", author: "Tetora", note: noteStr)] + version: "0.0.0.2", author: "Tetora", note: noteStr)] public class Bismarck_Extreme { diff --git a/03-Heavensward/Trials-Extreme/Ravana-Extreme.cs b/03-Heavensward/Trials-Extreme/Ravana-Extreme.cs index 616dac7..932c748 100644 --- a/03-Heavensward/Trials-Extreme/Ravana-Extreme.cs +++ b/03-Heavensward/Trials-Extreme/Ravana-Extreme.cs @@ -3,24 +3,18 @@ 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 ECommons; -using ECommons.DalamudServices; -using ECommons.GameFunctions; -using ECommons.MathHelpers; using System.Threading.Tasks; namespace Ravana_Extreme; [ScriptType(guid: "336990c6-8686-4691-8b7a-3ec8ffedfc19", name: "罗波那歼殛战", territorys: [446], - version: "0.0.0.1", author: "Tetora", note: noteStr)] + version: "0.0.0.2", author: "Tetora", note: noteStr)] public class Ravana_Extreme { @@ -179,4 +173,112 @@ public static class EventExtensions { return JsonConvert.DeserializeObject(@event["Param"]); } -} \ No newline at end of file +} + +#region 计算函数 + +public static class MathTools +{ + public static float DegToRad(this float deg) => (deg + 360f) % 360f / 180f * float.Pi; + public static float RadToDeg(this float rad) => (rad + 2 * float.Pi) % (2 * float.Pi) / float.Pi * 180f; + + /// + /// 获得任意点与中心点的弧度值,以(0, 0, 1)方向为0,以(1, 0, 0)方向为pi/2。 + /// 即,逆时针方向增加。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetRadian(this Vector3 point, Vector3 center) + => MathF.Atan2(point.X - center.X, point.Z - center.Z); + + /// + /// 获得任意点与中心点的长度。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetLength(this Vector3 point, Vector3 center) + => new Vector2(point.X - center.X, point.Z - center.Z).Length(); + + /// + /// 将任意点以中心点为圆心,逆时针旋转并延长。 + /// + /// 任意点 + /// 中心点 + /// 旋转弧度 + /// 基于该点延伸长度 + /// + public static Vector3 RotateAndExtend(this Vector3 point, Vector3 center, float radian, float length) + { + var baseRad = point.GetRadian(center); + var baseLength = point.GetLength(center); + var rotRad = baseRad + radian; + return new Vector3( + center.X + MathF.Sin(rotRad) * (length + baseLength), + center.Y, + center.Z + MathF.Cos(rotRad) * (length + baseLength) + ); + } + + /// + /// 获得某角度所在划分区域 + /// + /// 输入弧度 + /// 区域划分数量 + /// 0度所在区域的初始Idx> + /// 是否为斜分割,默认为false + /// 是否顺时针增加,默认为false + /// + public static int RadianToRegion(this float radian, int regionNum, int baseRegionIdx = 0, bool isDiagDiv = false, bool isCw = false) + { + var sepRad = float.Pi * 2 / regionNum; + var inputAngle = radian * (isCw ? -1 : 1) + (isDiagDiv ? sepRad / 2 : 0); + var rad = (inputAngle + 4 * float.Pi) % (2 * float.Pi); + return ((int)Math.Floor(rad / sepRad) + baseRegionIdx + regionNum) % regionNum; + } + + /// + /// 将输入点左右折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointHorizon(this Vector3 point, float centerX) + => point with { X = 2 * centerX - point.X }; + + /// + /// 将输入点上下折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointVertical(this Vector3 point, float centerZ) + => point with { Z = 2 * centerZ - point.Z }; + + /// + /// 将输入点中心对称 + /// + /// 输入点 + /// 中心点 + /// + public static Vector3 PointCenterSymmetry(this Vector3 point, Vector3 center) + => point.RotateAndExtend(center, float.Pi, 0); + + /// + /// 获取给定数的指定位数 + /// + /// 给定数值 + /// 对应位数,个位为1 + /// + public static int GetDecimalDigit(this int val, int x) + { + var valStr = val.ToString(); + var length = valStr.Length; + if (x < 1 || x > length) return -1; + var digitChar = valStr[length - x]; // 从右往左取第x位 + return int.Parse(digitChar.ToString()); + } +} + +#endregion 计算函数 \ No newline at end of file diff --git a/03-Heavensward/Trials/Nidhogg.cs b/03-Heavensward/Trials/Nidhogg.cs index ca0fc90..2a38a9a 100644 --- a/03-Heavensward/Trials/Nidhogg.cs +++ b/03-Heavensward/Trials/Nidhogg.cs @@ -3,8 +3,6 @@ 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; @@ -12,16 +10,12 @@ 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 Nidhogg; [ScriptType(guid: "dcfdb19e-0357-4214-b64e-205100f55822", name: "尼德霍格征龙战", territorys: [559], - version: "0.0.0.1", author: "Tetora", note: noteStr)] + version: "0.0.0.2", author: "Tetora", note: noteStr)] public class Nidhogg { @@ -205,4 +199,112 @@ public static class EventExtensions { return JsonConvert.DeserializeObject(@event["Param"]); } -} \ No newline at end of file +} + +#region 计算函数 + +public static class MathTools +{ + public static float DegToRad(this float deg) => (deg + 360f) % 360f / 180f * float.Pi; + public static float RadToDeg(this float rad) => (rad + 2 * float.Pi) % (2 * float.Pi) / float.Pi * 180f; + + /// + /// 获得任意点与中心点的弧度值,以(0, 0, 1)方向为0,以(1, 0, 0)方向为pi/2。 + /// 即,逆时针方向增加。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetRadian(this Vector3 point, Vector3 center) + => MathF.Atan2(point.X - center.X, point.Z - center.Z); + + /// + /// 获得任意点与中心点的长度。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetLength(this Vector3 point, Vector3 center) + => new Vector2(point.X - center.X, point.Z - center.Z).Length(); + + /// + /// 将任意点以中心点为圆心,逆时针旋转并延长。 + /// + /// 任意点 + /// 中心点 + /// 旋转弧度 + /// 基于该点延伸长度 + /// + public static Vector3 RotateAndExtend(this Vector3 point, Vector3 center, float radian, float length) + { + var baseRad = point.GetRadian(center); + var baseLength = point.GetLength(center); + var rotRad = baseRad + radian; + return new Vector3( + center.X + MathF.Sin(rotRad) * (length + baseLength), + center.Y, + center.Z + MathF.Cos(rotRad) * (length + baseLength) + ); + } + + /// + /// 获得某角度所在划分区域 + /// + /// 输入弧度 + /// 区域划分数量 + /// 0度所在区域的初始Idx> + /// 是否为斜分割,默认为false + /// 是否顺时针增加,默认为false + /// + public static int RadianToRegion(this float radian, int regionNum, int baseRegionIdx = 0, bool isDiagDiv = false, bool isCw = false) + { + var sepRad = float.Pi * 2 / regionNum; + var inputAngle = radian * (isCw ? -1 : 1) + (isDiagDiv ? sepRad / 2 : 0); + var rad = (inputAngle + 4 * float.Pi) % (2 * float.Pi); + return ((int)Math.Floor(rad / sepRad) + baseRegionIdx + regionNum) % regionNum; + } + + /// + /// 将输入点左右折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointHorizon(this Vector3 point, float centerX) + => point with { X = 2 * centerX - point.X }; + + /// + /// 将输入点上下折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointVertical(this Vector3 point, float centerZ) + => point with { Z = 2 * centerZ - point.Z }; + + /// + /// 将输入点中心对称 + /// + /// 输入点 + /// 中心点 + /// + public static Vector3 PointCenterSymmetry(this Vector3 point, Vector3 center) + => point.RotateAndExtend(center, float.Pi, 0); + + /// + /// 获取给定数的指定位数 + /// + /// 给定数值 + /// 对应位数,个位为1 + /// + public static int GetDecimalDigit(this int val, int x) + { + var valStr = val.ToString(); + var length = valStr.Length; + if (x < 1 || x > length) return -1; + var digitChar = valStr[length - x]; // 从右往左取第x位 + return int.Parse(digitChar.ToString()); + } +} + +#endregion 计算函数 \ No newline at end of file diff --git a/03-Heavensward/Trials/Sephirot.cs b/03-Heavensward/Trials/Sephirot.cs index a43df53..9380805 100644 --- a/03-Heavensward/Trials/Sephirot.cs +++ b/03-Heavensward/Trials/Sephirot.cs @@ -3,25 +3,19 @@ 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 ECommons; -using ECommons.DalamudServices; -using ECommons.GameFunctions; -using ECommons.MathHelpers; using System.Threading.Tasks; using KodakkuAssist.Extensions; namespace Sephirot; [ScriptType(guid: "6d0824b3-6d67-4450-8b4e-46857257579e", name: "萨菲洛特歼灭战", territorys: [517], - version: "0.0.0.1", author: "Tetora", note: noteStr)] + version: "0.0.0.2", author: "Tetora", note: noteStr)] public class Sephirot { @@ -309,3 +303,111 @@ public static class Extensions } } } + +#region 计算函数 + +public static class MathTools +{ + public static float DegToRad(this float deg) => (deg + 360f) % 360f / 180f * float.Pi; + public static float RadToDeg(this float rad) => (rad + 2 * float.Pi) % (2 * float.Pi) / float.Pi * 180f; + + /// + /// 获得任意点与中心点的弧度值,以(0, 0, 1)方向为0,以(1, 0, 0)方向为pi/2。 + /// 即,逆时针方向增加。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetRadian(this Vector3 point, Vector3 center) + => MathF.Atan2(point.X - center.X, point.Z - center.Z); + + /// + /// 获得任意点与中心点的长度。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetLength(this Vector3 point, Vector3 center) + => new Vector2(point.X - center.X, point.Z - center.Z).Length(); + + /// + /// 将任意点以中心点为圆心,逆时针旋转并延长。 + /// + /// 任意点 + /// 中心点 + /// 旋转弧度 + /// 基于该点延伸长度 + /// + public static Vector3 RotateAndExtend(this Vector3 point, Vector3 center, float radian, float length) + { + var baseRad = point.GetRadian(center); + var baseLength = point.GetLength(center); + var rotRad = baseRad + radian; + return new Vector3( + center.X + MathF.Sin(rotRad) * (length + baseLength), + center.Y, + center.Z + MathF.Cos(rotRad) * (length + baseLength) + ); + } + + /// + /// 获得某角度所在划分区域 + /// + /// 输入弧度 + /// 区域划分数量 + /// 0度所在区域的初始Idx> + /// 是否为斜分割,默认为false + /// 是否顺时针增加,默认为false + /// + public static int RadianToRegion(this float radian, int regionNum, int baseRegionIdx = 0, bool isDiagDiv = false, bool isCw = false) + { + var sepRad = float.Pi * 2 / regionNum; + var inputAngle = radian * (isCw ? -1 : 1) + (isDiagDiv ? sepRad / 2 : 0); + var rad = (inputAngle + 4 * float.Pi) % (2 * float.Pi); + return ((int)Math.Floor(rad / sepRad) + baseRegionIdx + regionNum) % regionNum; + } + + /// + /// 将输入点左右折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointHorizon(this Vector3 point, float centerX) + => point with { X = 2 * centerX - point.X }; + + /// + /// 将输入点上下折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointVertical(this Vector3 point, float centerZ) + => point with { Z = 2 * centerZ - point.Z }; + + /// + /// 将输入点中心对称 + /// + /// 输入点 + /// 中心点 + /// + public static Vector3 PointCenterSymmetry(this Vector3 point, Vector3 center) + => point.RotateAndExtend(center, float.Pi, 0); + + /// + /// 获取给定数的指定位数 + /// + /// 给定数值 + /// 对应位数,个位为1 + /// + public static int GetDecimalDigit(this int val, int x) + { + var valStr = val.ToString(); + var length = valStr.Length; + if (x < 1 || x > length) return -1; + var digitChar = valStr[length - x]; // 从右往左取第x位 + return int.Parse(digitChar.ToString()); + } +} + +#endregion 计算函数 \ No newline at end of file diff --git a/03-Heavensward/Trials/Sophia.cs b/03-Heavensward/Trials/Sophia.cs index f16daad..098781a 100644 --- a/03-Heavensward/Trials/Sophia.cs +++ b/03-Heavensward/Trials/Sophia.cs @@ -3,8 +3,6 @@ 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; @@ -12,16 +10,12 @@ 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)] + version: "0.0.0.2", author: "Tetora", note: noteStr)] public class Sophia { @@ -225,4 +219,112 @@ public static class EventExtensions { return JsonConvert.DeserializeObject(@event["Param"]); } -} \ No newline at end of file +} + +#region 计算函数 + +public static class MathTools +{ + public static float DegToRad(this float deg) => (deg + 360f) % 360f / 180f * float.Pi; + public static float RadToDeg(this float rad) => (rad + 2 * float.Pi) % (2 * float.Pi) / float.Pi * 180f; + + /// + /// 获得任意点与中心点的弧度值,以(0, 0, 1)方向为0,以(1, 0, 0)方向为pi/2。 + /// 即,逆时针方向增加。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetRadian(this Vector3 point, Vector3 center) + => MathF.Atan2(point.X - center.X, point.Z - center.Z); + + /// + /// 获得任意点与中心点的长度。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetLength(this Vector3 point, Vector3 center) + => new Vector2(point.X - center.X, point.Z - center.Z).Length(); + + /// + /// 将任意点以中心点为圆心,逆时针旋转并延长。 + /// + /// 任意点 + /// 中心点 + /// 旋转弧度 + /// 基于该点延伸长度 + /// + public static Vector3 RotateAndExtend(this Vector3 point, Vector3 center, float radian, float length) + { + var baseRad = point.GetRadian(center); + var baseLength = point.GetLength(center); + var rotRad = baseRad + radian; + return new Vector3( + center.X + MathF.Sin(rotRad) * (length + baseLength), + center.Y, + center.Z + MathF.Cos(rotRad) * (length + baseLength) + ); + } + + /// + /// 获得某角度所在划分区域 + /// + /// 输入弧度 + /// 区域划分数量 + /// 0度所在区域的初始Idx> + /// 是否为斜分割,默认为false + /// 是否顺时针增加,默认为false + /// + public static int RadianToRegion(this float radian, int regionNum, int baseRegionIdx = 0, bool isDiagDiv = false, bool isCw = false) + { + var sepRad = float.Pi * 2 / regionNum; + var inputAngle = radian * (isCw ? -1 : 1) + (isDiagDiv ? sepRad / 2 : 0); + var rad = (inputAngle + 4 * float.Pi) % (2 * float.Pi); + return ((int)Math.Floor(rad / sepRad) + baseRegionIdx + regionNum) % regionNum; + } + + /// + /// 将输入点左右折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointHorizon(this Vector3 point, float centerX) + => point with { X = 2 * centerX - point.X }; + + /// + /// 将输入点上下折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointVertical(this Vector3 point, float centerZ) + => point with { Z = 2 * centerZ - point.Z }; + + /// + /// 将输入点中心对称 + /// + /// 输入点 + /// 中心点 + /// + public static Vector3 PointCenterSymmetry(this Vector3 point, Vector3 center) + => point.RotateAndExtend(center, float.Pi, 0); + + /// + /// 获取给定数的指定位数 + /// + /// 给定数值 + /// 对应位数,个位为1 + /// + public static int GetDecimalDigit(this int val, int x) + { + var valStr = val.ToString(); + var length = valStr.Length; + if (x < 1 || x > length) return -1; + var digitChar = valStr[length - x]; // 从右往左取第x位 + return int.Parse(digitChar.ToString()); + } +} + +#endregion 计算函数 \ No newline at end of file diff --git a/03-Heavensward/Trials/Zurvan.cs b/03-Heavensward/Trials/Zurvan.cs index 27c3b6f..25443eb 100644 --- a/03-Heavensward/Trials/Zurvan.cs +++ b/03-Heavensward/Trials/Zurvan.cs @@ -3,8 +3,6 @@ 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; @@ -12,16 +10,12 @@ using KodakkuAssist.Module.GameEvent; using KodakkuAssist.Module.Draw; using KodakkuAssist.Extensions; using KodakkuAssist.Data; -using ECommons; -using ECommons.DalamudServices; -using ECommons.GameFunctions; -using ECommons.MathHelpers; using System.Threading.Tasks; namespace Zurvan; [ScriptType(guid: "214f8fbd-ad04-430f-8bba-fd7319581780", name: "祖尔宛歼灭战", territorys: [637], - version: "0.0.0.4", author: "Tetora", note: noteStr)] + version: "0.0.0.5", author: "Tetora", note: noteStr)] public class Zurvan { @@ -319,4 +313,5 @@ public static class EventExtensions { return JsonConvert.DeserializeObject(@event["Param"]); } -} \ No newline at end of file +} + diff --git a/04-Stormblood/Dungeon/AlaMhigo.cs b/04-Stormblood/Dungeon/AlaMhigo.cs index 5f49a95..a311053 100644 --- a/04-Stormblood/Dungeon/AlaMhigo.cs +++ b/04-Stormblood/Dungeon/AlaMhigo.cs @@ -12,16 +12,12 @@ 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 Ala_Mhigo; [ScriptType(guid: "aa0ae191-da3f-48f1-9340-46a56cfeeabf", name: "鏖战红莲阿拉米格", territorys: [1146], - version: "0.0.0.1", author: "Tetora", note: noteStr)] + version: "0.0.0.2", author: "Tetora", note: noteStr)] public class Ala_Mhigo { @@ -275,4 +271,112 @@ public static class EventExtensions { return JsonConvert.DeserializeObject(@event["Param"]); } -} \ No newline at end of file +} + +#region 计算函数 + +public static class MathTools +{ + public static float DegToRad(this float deg) => (deg + 360f) % 360f / 180f * float.Pi; + public static float RadToDeg(this float rad) => (rad + 2 * float.Pi) % (2 * float.Pi) / float.Pi * 180f; + + /// + /// 获得任意点与中心点的弧度值,以(0, 0, 1)方向为0,以(1, 0, 0)方向为pi/2。 + /// 即,逆时针方向增加。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetRadian(this Vector3 point, Vector3 center) + => MathF.Atan2(point.X - center.X, point.Z - center.Z); + + /// + /// 获得任意点与中心点的长度。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetLength(this Vector3 point, Vector3 center) + => new Vector2(point.X - center.X, point.Z - center.Z).Length(); + + /// + /// 将任意点以中心点为圆心,逆时针旋转并延长。 + /// + /// 任意点 + /// 中心点 + /// 旋转弧度 + /// 基于该点延伸长度 + /// + public static Vector3 RotateAndExtend(this Vector3 point, Vector3 center, float radian, float length) + { + var baseRad = point.GetRadian(center); + var baseLength = point.GetLength(center); + var rotRad = baseRad + radian; + return new Vector3( + center.X + MathF.Sin(rotRad) * (length + baseLength), + center.Y, + center.Z + MathF.Cos(rotRad) * (length + baseLength) + ); + } + + /// + /// 获得某角度所在划分区域 + /// + /// 输入弧度 + /// 区域划分数量 + /// 0度所在区域的初始Idx> + /// 是否为斜分割,默认为false + /// 是否顺时针增加,默认为false + /// + public static int RadianToRegion(this float radian, int regionNum, int baseRegionIdx = 0, bool isDiagDiv = false, bool isCw = false) + { + var sepRad = float.Pi * 2 / regionNum; + var inputAngle = radian * (isCw ? -1 : 1) + (isDiagDiv ? sepRad / 2 : 0); + var rad = (inputAngle + 4 * float.Pi) % (2 * float.Pi); + return ((int)Math.Floor(rad / sepRad) + baseRegionIdx + regionNum) % regionNum; + } + + /// + /// 将输入点左右折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointHorizon(this Vector3 point, float centerX) + => point with { X = 2 * centerX - point.X }; + + /// + /// 将输入点上下折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointVertical(this Vector3 point, float centerZ) + => point with { Z = 2 * centerZ - point.Z }; + + /// + /// 将输入点中心对称 + /// + /// 输入点 + /// 中心点 + /// + public static Vector3 PointCenterSymmetry(this Vector3 point, Vector3 center) + => point.RotateAndExtend(center, float.Pi, 0); + + /// + /// 获取给定数的指定位数 + /// + /// 给定数值 + /// 对应位数,个位为1 + /// + public static int GetDecimalDigit(this int val, int x) + { + var valStr = val.ToString(); + var length = valStr.Length; + if (x < 1 || x > length) return -1; + var digitChar = valStr[length - x]; // 从右往左取第x位 + return int.Parse(digitChar.ToString()); + } +} + +#endregion 计算函数 \ No newline at end of file diff --git a/04-Stormblood/Dungeon/SaintMocianne'sArboretum (Hard).cs b/04-Stormblood/Dungeon/SaintMocianne'sArboretum (Hard).cs index dd2fbd1..2b56efa 100644 --- a/04-Stormblood/Dungeon/SaintMocianne'sArboretum (Hard).cs +++ b/04-Stormblood/Dungeon/SaintMocianne'sArboretum (Hard).cs @@ -3,25 +3,19 @@ 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 ECommons; -using ECommons.DalamudServices; -using ECommons.GameFunctions; -using ECommons.MathHelpers; using System.Threading.Tasks; using KodakkuAssist.Extensions; namespace SaintMociannesArboretum_Hard; [ScriptType(guid: "7e87b5d1-ae21-4115-9483-d8dc0f1d1652", name: "污染庭园圣茉夏娜植物园", territorys: [788], - version: "0.0.0.3", author: "Tetora", note: noteStr)] + version: "0.0.0.4", author: "Tetora", note: noteStr)] public class SaintMociannesArboretum_Hard { @@ -411,4 +405,112 @@ public static class EventExtensions { return JsonConvert.DeserializeObject(@event["Param"]); } -} \ No newline at end of file +} + +#region 计算函数 + +public static class MathTools +{ + public static float DegToRad(this float deg) => (deg + 360f) % 360f / 180f * float.Pi; + public static float RadToDeg(this float rad) => (rad + 2 * float.Pi) % (2 * float.Pi) / float.Pi * 180f; + + /// + /// 获得任意点与中心点的弧度值,以(0, 0, 1)方向为0,以(1, 0, 0)方向为pi/2。 + /// 即,逆时针方向增加。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetRadian(this Vector3 point, Vector3 center) + => MathF.Atan2(point.X - center.X, point.Z - center.Z); + + /// + /// 获得任意点与中心点的长度。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetLength(this Vector3 point, Vector3 center) + => new Vector2(point.X - center.X, point.Z - center.Z).Length(); + + /// + /// 将任意点以中心点为圆心,逆时针旋转并延长。 + /// + /// 任意点 + /// 中心点 + /// 旋转弧度 + /// 基于该点延伸长度 + /// + public static Vector3 RotateAndExtend(this Vector3 point, Vector3 center, float radian, float length) + { + var baseRad = point.GetRadian(center); + var baseLength = point.GetLength(center); + var rotRad = baseRad + radian; + return new Vector3( + center.X + MathF.Sin(rotRad) * (length + baseLength), + center.Y, + center.Z + MathF.Cos(rotRad) * (length + baseLength) + ); + } + + /// + /// 获得某角度所在划分区域 + /// + /// 输入弧度 + /// 区域划分数量 + /// 0度所在区域的初始Idx> + /// 是否为斜分割,默认为false + /// 是否顺时针增加,默认为false + /// + public static int RadianToRegion(this float radian, int regionNum, int baseRegionIdx = 0, bool isDiagDiv = false, bool isCw = false) + { + var sepRad = float.Pi * 2 / regionNum; + var inputAngle = radian * (isCw ? -1 : 1) + (isDiagDiv ? sepRad / 2 : 0); + var rad = (inputAngle + 4 * float.Pi) % (2 * float.Pi); + return ((int)Math.Floor(rad / sepRad) + baseRegionIdx + regionNum) % regionNum; + } + + /// + /// 将输入点左右折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointHorizon(this Vector3 point, float centerX) + => point with { X = 2 * centerX - point.X }; + + /// + /// 将输入点上下折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointVertical(this Vector3 point, float centerZ) + => point with { Z = 2 * centerZ - point.Z }; + + /// + /// 将输入点中心对称 + /// + /// 输入点 + /// 中心点 + /// + public static Vector3 PointCenterSymmetry(this Vector3 point, Vector3 center) + => point.RotateAndExtend(center, float.Pi, 0); + + /// + /// 获取给定数的指定位数 + /// + /// 给定数值 + /// 对应位数,个位为1 + /// + public static int GetDecimalDigit(this int val, int x) + { + var valStr = val.ToString(); + var length = valStr.Length; + if (x < 1 || x > length) return -1; + var digitChar = valStr[length - x]; // 从右往左取第x位 + return int.Parse(digitChar.ToString()); + } +} + +#endregion 计算函数 \ No newline at end of file diff --git a/04-Stormblood/Dungeon/theFractalContinuum-Hard.cs b/04-Stormblood/Dungeon/theFractalContinuum-Hard.cs index 8b8eb53..b0abce9 100644 --- a/04-Stormblood/Dungeon/theFractalContinuum-Hard.cs +++ b/04-Stormblood/Dungeon/theFractalContinuum-Hard.cs @@ -3,25 +3,19 @@ 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 ECommons; -using ECommons.DalamudServices; -using ECommons.GameFunctions; -using ECommons.MathHelpers; using System.Threading.Tasks; namespace the_Fractal_Continuum_Hard; [ScriptType(guid: "c76136e1-1b5b-4cfb-a677-4cc0917fa050", name: "疯狂战舰无限回廊", territorys: [743], - version: "0.0.0.2", author: "Tetora", note: noteStr)] + version: "0.0.0.3", author: "Tetora", note: noteStr)] public class the_Fractal_Continuum_Hard { @@ -350,3 +344,111 @@ public static class Extensions } } } + +#region 计算函数 + +public static class MathTools +{ + public static float DegToRad(this float deg) => (deg + 360f) % 360f / 180f * float.Pi; + public static float RadToDeg(this float rad) => (rad + 2 * float.Pi) % (2 * float.Pi) / float.Pi * 180f; + + /// + /// 获得任意点与中心点的弧度值,以(0, 0, 1)方向为0,以(1, 0, 0)方向为pi/2。 + /// 即,逆时针方向增加。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetRadian(this Vector3 point, Vector3 center) + => MathF.Atan2(point.X - center.X, point.Z - center.Z); + + /// + /// 获得任意点与中心点的长度。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetLength(this Vector3 point, Vector3 center) + => new Vector2(point.X - center.X, point.Z - center.Z).Length(); + + /// + /// 将任意点以中心点为圆心,逆时针旋转并延长。 + /// + /// 任意点 + /// 中心点 + /// 旋转弧度 + /// 基于该点延伸长度 + /// + public static Vector3 RotateAndExtend(this Vector3 point, Vector3 center, float radian, float length) + { + var baseRad = point.GetRadian(center); + var baseLength = point.GetLength(center); + var rotRad = baseRad + radian; + return new Vector3( + center.X + MathF.Sin(rotRad) * (length + baseLength), + center.Y, + center.Z + MathF.Cos(rotRad) * (length + baseLength) + ); + } + + /// + /// 获得某角度所在划分区域 + /// + /// 输入弧度 + /// 区域划分数量 + /// 0度所在区域的初始Idx> + /// 是否为斜分割,默认为false + /// 是否顺时针增加,默认为false + /// + public static int RadianToRegion(this float radian, int regionNum, int baseRegionIdx = 0, bool isDiagDiv = false, bool isCw = false) + { + var sepRad = float.Pi * 2 / regionNum; + var inputAngle = radian * (isCw ? -1 : 1) + (isDiagDiv ? sepRad / 2 : 0); + var rad = (inputAngle + 4 * float.Pi) % (2 * float.Pi); + return ((int)Math.Floor(rad / sepRad) + baseRegionIdx + regionNum) % regionNum; + } + + /// + /// 将输入点左右折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointHorizon(this Vector3 point, float centerX) + => point with { X = 2 * centerX - point.X }; + + /// + /// 将输入点上下折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointVertical(this Vector3 point, float centerZ) + => point with { Z = 2 * centerZ - point.Z }; + + /// + /// 将输入点中心对称 + /// + /// 输入点 + /// 中心点 + /// + public static Vector3 PointCenterSymmetry(this Vector3 point, Vector3 center) + => point.RotateAndExtend(center, float.Pi, 0); + + /// + /// 获取给定数的指定位数 + /// + /// 给定数值 + /// 对应位数,个位为1 + /// + public static int GetDecimalDigit(this int val, int x) + { + var valStr = val.ToString(); + var length = valStr.Length; + if (x < 1 || x > length) return -1; + var digitChar = valStr[length - x]; // 从右往左取第x位 + return int.Parse(digitChar.ToString()); + } +} + +#endregion 计算函数 \ No newline at end of file diff --git a/04-Stormblood/Raid-Omega_Quests/Normal/O11n.cs b/04-Stormblood/Raid-Omega_Quests/Normal/O11n.cs index f51e04f..309f10a 100644 --- a/04-Stormblood/Raid-Omega_Quests/Normal/O11n.cs +++ b/04-Stormblood/Raid-Omega_Quests/Normal/O11n.cs @@ -3,24 +3,18 @@ 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 ECommons; -using ECommons.DalamudServices; -using ECommons.GameFunctions; -using ECommons.MathHelpers; using System.Threading.Tasks; namespace O11n; [ScriptType(guid: "2232ae84-c1e7-4382-88b4-d691887f27cf", name: "O11N", territorys: [800], - version: "0.0.0.3" , author: "Tetora", note: noteStr)] + version: "0.0.0.4" , author: "Tetora", note: noteStr)] public class O11n { @@ -308,3 +302,111 @@ public static class Extensions } } } + +#region 计算函数 + +public static class MathTools +{ + public static float DegToRad(this float deg) => (deg + 360f) % 360f / 180f * float.Pi; + public static float RadToDeg(this float rad) => (rad + 2 * float.Pi) % (2 * float.Pi) / float.Pi * 180f; + + /// + /// 获得任意点与中心点的弧度值,以(0, 0, 1)方向为0,以(1, 0, 0)方向为pi/2。 + /// 即,逆时针方向增加。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetRadian(this Vector3 point, Vector3 center) + => MathF.Atan2(point.X - center.X, point.Z - center.Z); + + /// + /// 获得任意点与中心点的长度。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetLength(this Vector3 point, Vector3 center) + => new Vector2(point.X - center.X, point.Z - center.Z).Length(); + + /// + /// 将任意点以中心点为圆心,逆时针旋转并延长。 + /// + /// 任意点 + /// 中心点 + /// 旋转弧度 + /// 基于该点延伸长度 + /// + public static Vector3 RotateAndExtend(this Vector3 point, Vector3 center, float radian, float length) + { + var baseRad = point.GetRadian(center); + var baseLength = point.GetLength(center); + var rotRad = baseRad + radian; + return new Vector3( + center.X + MathF.Sin(rotRad) * (length + baseLength), + center.Y, + center.Z + MathF.Cos(rotRad) * (length + baseLength) + ); + } + + /// + /// 获得某角度所在划分区域 + /// + /// 输入弧度 + /// 区域划分数量 + /// 0度所在区域的初始Idx> + /// 是否为斜分割,默认为false + /// 是否顺时针增加,默认为false + /// + public static int RadianToRegion(this float radian, int regionNum, int baseRegionIdx = 0, bool isDiagDiv = false, bool isCw = false) + { + var sepRad = float.Pi * 2 / regionNum; + var inputAngle = radian * (isCw ? -1 : 1) + (isDiagDiv ? sepRad / 2 : 0); + var rad = (inputAngle + 4 * float.Pi) % (2 * float.Pi); + return ((int)Math.Floor(rad / sepRad) + baseRegionIdx + regionNum) % regionNum; + } + + /// + /// 将输入点左右折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointHorizon(this Vector3 point, float centerX) + => point with { X = 2 * centerX - point.X }; + + /// + /// 将输入点上下折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointVertical(this Vector3 point, float centerZ) + => point with { Z = 2 * centerZ - point.Z }; + + /// + /// 将输入点中心对称 + /// + /// 输入点 + /// 中心点 + /// + public static Vector3 PointCenterSymmetry(this Vector3 point, Vector3 center) + => point.RotateAndExtend(center, float.Pi, 0); + + /// + /// 获取给定数的指定位数 + /// + /// 给定数值 + /// 对应位数,个位为1 + /// + public static int GetDecimalDigit(this int val, int x) + { + var valStr = val.ToString(); + var length = valStr.Length; + if (x < 1 || x > length) return -1; + var digitChar = valStr[length - x]; // 从右往左取第x位 + return int.Parse(digitChar.ToString()); + } +} + +#endregion 计算函数 \ No newline at end of file diff --git a/04-Stormblood/Raid-Omega_Quests/Normal/O4n.cs b/04-Stormblood/Raid-Omega_Quests/Normal/O4n.cs index 1fdee7d..cf57d59 100644 --- a/04-Stormblood/Raid-Omega_Quests/Normal/O4n.cs +++ b/04-Stormblood/Raid-Omega_Quests/Normal/O4n.cs @@ -3,24 +3,18 @@ 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 ECommons; -using ECommons.DalamudServices; -using ECommons.GameFunctions; -using ECommons.MathHelpers; using System.Threading.Tasks; namespace O4n; [ScriptType(guid: "f24f9cef-717e-4a2a-9616-d470443d6d8a", name: "O4N", territorys: [694], - version: "0.0.0.1", author: "Tetora", note: noteStr)] + version: "0.0.0.2", author: "Tetora", note: noteStr)] public class O4n { diff --git a/04-Stormblood/Raid-Omega_Quests/Normal/O5n.cs b/04-Stormblood/Raid-Omega_Quests/Normal/O5n.cs index bd654e1..d5547e6 100644 --- a/04-Stormblood/Raid-Omega_Quests/Normal/O5n.cs +++ b/04-Stormblood/Raid-Omega_Quests/Normal/O5n.cs @@ -11,16 +11,12 @@ using KodakkuAssist.Script; using KodakkuAssist.Module.GameEvent; using KodakkuAssist.Module.Draw; using KodakkuAssist.Data; -using ECommons; -using ECommons.DalamudServices; -using ECommons.GameFunctions; -using ECommons.MathHelpers; using System.Threading.Tasks; namespace O5n; [ScriptType(guid: "af11ce46-2c6a-46ba-b2bc-c542e5f5b7b5", name: "O5N", territorys: [748], - version: "0.0.0.1", author: "Tetora", note: noteStr)] + version: "0.0.0.2", author: "Tetora", note: noteStr)] public class O5n { diff --git a/04-Stormblood/Raid-Omega_Quests/Normal/O7n.cs b/04-Stormblood/Raid-Omega_Quests/Normal/O7n.cs index 78c8b96..8b2a693 100644 --- a/04-Stormblood/Raid-Omega_Quests/Normal/O7n.cs +++ b/04-Stormblood/Raid-Omega_Quests/Normal/O7n.cs @@ -12,16 +12,12 @@ 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)] + version: "0.0.0.2", author: "Tetora", note: noteStr)] public class O7n { diff --git a/04-Stormblood/Trial/Byakko.cs b/04-Stormblood/Trial/Byakko.cs index 6bc5ac4..128cedc 100644 --- a/04-Stormblood/Trial/Byakko.cs +++ b/04-Stormblood/Trial/Byakko.cs @@ -3,8 +3,6 @@ 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; @@ -12,16 +10,12 @@ 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 Byakko; [ScriptType(guid: "6a9e30e9-c58e-4f39-9f1e-ad26e5d49dc3", name: "白虎镇魂战", territorys: [746], - version: "0.0.0.11", author: "Tetora", note: noteStr)] + version: "0.0.0.12", author: "Tetora", note: noteStr)] public class Byakko { diff --git a/04-Stormblood/Trial/Lakshmi.cs b/04-Stormblood/Trial/Lakshmi.cs index dd682b0..a2093a0 100644 --- a/04-Stormblood/Trial/Lakshmi.cs +++ b/04-Stormblood/Trial/Lakshmi.cs @@ -12,16 +12,12 @@ 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 Emanation; [ScriptType(guid: "a7bacd3e-834f-41ba-a210-c66e2c12d208", name: "吉祥天女歼灭战", territorys: [719], - version: "0.0.0.3", author: "Tetora", note: noteStr)] + version: "0.0.0.4", author: "Tetora", note: noteStr)] public class Lakshmi { @@ -220,3 +216,112 @@ public static class Extensions } } } + + +#region 计算函数 + +public static class MathTools +{ + public static float DegToRad(this float deg) => (deg + 360f) % 360f / 180f * float.Pi; + public static float RadToDeg(this float rad) => (rad + 2 * float.Pi) % (2 * float.Pi) / float.Pi * 180f; + + /// + /// 获得任意点与中心点的弧度值,以(0, 0, 1)方向为0,以(1, 0, 0)方向为pi/2。 + /// 即,逆时针方向增加。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetRadian(this Vector3 point, Vector3 center) + => MathF.Atan2(point.X - center.X, point.Z - center.Z); + + /// + /// 获得任意点与中心点的长度。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetLength(this Vector3 point, Vector3 center) + => new Vector2(point.X - center.X, point.Z - center.Z).Length(); + + /// + /// 将任意点以中心点为圆心,逆时针旋转并延长。 + /// + /// 任意点 + /// 中心点 + /// 旋转弧度 + /// 基于该点延伸长度 + /// + public static Vector3 RotateAndExtend(this Vector3 point, Vector3 center, float radian, float length) + { + var baseRad = point.GetRadian(center); + var baseLength = point.GetLength(center); + var rotRad = baseRad + radian; + return new Vector3( + center.X + MathF.Sin(rotRad) * (length + baseLength), + center.Y, + center.Z + MathF.Cos(rotRad) * (length + baseLength) + ); + } + + /// + /// 获得某角度所在划分区域 + /// + /// 输入弧度 + /// 区域划分数量 + /// 0度所在区域的初始Idx> + /// 是否为斜分割,默认为false + /// 是否顺时针增加,默认为false + /// + public static int RadianToRegion(this float radian, int regionNum, int baseRegionIdx = 0, bool isDiagDiv = false, bool isCw = false) + { + var sepRad = float.Pi * 2 / regionNum; + var inputAngle = radian * (isCw ? -1 : 1) + (isDiagDiv ? sepRad / 2 : 0); + var rad = (inputAngle + 4 * float.Pi) % (2 * float.Pi); + return ((int)Math.Floor(rad / sepRad) + baseRegionIdx + regionNum) % regionNum; + } + + /// + /// 将输入点左右折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointHorizon(this Vector3 point, float centerX) + => point with { X = 2 * centerX - point.X }; + + /// + /// 将输入点上下折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointVertical(this Vector3 point, float centerZ) + => point with { Z = 2 * centerZ - point.Z }; + + /// + /// 将输入点中心对称 + /// + /// 输入点 + /// 中心点 + /// + public static Vector3 PointCenterSymmetry(this Vector3 point, Vector3 center) + => point.RotateAndExtend(center, float.Pi, 0); + + /// + /// 获取给定数的指定位数 + /// + /// 给定数值 + /// 对应位数,个位为1 + /// + public static int GetDecimalDigit(this int val, int x) + { + var valStr = val.ToString(); + var length = valStr.Length; + if (x < 1 || x > length) return -1; + var digitChar = valStr[length - x]; // 从右往左取第x位 + return int.Parse(digitChar.ToString()); + } +} + +#endregion 计算函数 \ No newline at end of file diff --git a/04-Stormblood/Trial/Shinryu.cs b/04-Stormblood/Trial/Shinryu.cs index d6dd4c9..39374b0 100644 --- a/04-Stormblood/Trial/Shinryu.cs +++ b/04-Stormblood/Trial/Shinryu.cs @@ -3,25 +3,19 @@ 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 ECommons; -using ECommons.DalamudServices; -using ECommons.GameFunctions; -using ECommons.MathHelpers; using System.Threading.Tasks; using KodakkuAssist.Extensions; namespace theRoyalMenagerie; [ScriptType(guid: "da23fd13-2d1f-41d3-b2c9-91fd8d948a98", name: "神龙歼灭战", territorys: [679], - version: "0.0.0.2", author: "Tetora", note: noteStr)] + version: "0.0.0.3", author: "Tetora", note: noteStr)] public class Shinryu { diff --git a/04-Stormblood/Trial/Susano.cs b/04-Stormblood/Trial/Susano.cs index 11b42b6..bd0a329 100644 --- a/04-Stormblood/Trial/Susano.cs +++ b/04-Stormblood/Trial/Susano.cs @@ -3,24 +3,18 @@ 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 ECommons; -using ECommons.DalamudServices; -using ECommons.GameFunctions; -using ECommons.MathHelpers; using System.Threading.Tasks; namespace Susano; [ScriptType(guid: "2c4b6205-6a77-4c89-b641-2c2359a43f25", name: "须佐之男歼灭战", territorys: [674], - version: "0.0.0.1", author: "Tetora", note: noteStr)] + version: "0.0.0.2", author: "Tetora", note: noteStr)] public class Susano { diff --git a/04-Stormblood/Trial/Suzaku.cs b/04-Stormblood/Trial/Suzaku.cs index e20cb1a..fa82a63 100644 --- a/04-Stormblood/Trial/Suzaku.cs +++ b/04-Stormblood/Trial/Suzaku.cs @@ -3,24 +3,18 @@ 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 ECommons; -using ECommons.DalamudServices; -using ECommons.GameFunctions; -using ECommons.MathHelpers; using System.Threading.Tasks; namespace Suzaku; [ScriptType(guid: "fc907987-bad9-4c70-97f6-b91e2e70544b", name: "朱雀镇魂战", territorys: [810], - version: "0.0.0.1", author: "Tetora", note: noteStr)] + version: "0.0.0.2", author: "Tetora", note: noteStr)] public class Suzaku { @@ -298,4 +292,112 @@ public static class EventExtensions { return JsonConvert.DeserializeObject(@event["Param"]); } -} \ No newline at end of file +} + +#region 计算函数 + +public static class MathTools +{ + public static float DegToRad(this float deg) => (deg + 360f) % 360f / 180f * float.Pi; + public static float RadToDeg(this float rad) => (rad + 2 * float.Pi) % (2 * float.Pi) / float.Pi * 180f; + + /// + /// 获得任意点与中心点的弧度值,以(0, 0, 1)方向为0,以(1, 0, 0)方向为pi/2。 + /// 即,逆时针方向增加。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetRadian(this Vector3 point, Vector3 center) + => MathF.Atan2(point.X - center.X, point.Z - center.Z); + + /// + /// 获得任意点与中心点的长度。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetLength(this Vector3 point, Vector3 center) + => new Vector2(point.X - center.X, point.Z - center.Z).Length(); + + /// + /// 将任意点以中心点为圆心,逆时针旋转并延长。 + /// + /// 任意点 + /// 中心点 + /// 旋转弧度 + /// 基于该点延伸长度 + /// + public static Vector3 RotateAndExtend(this Vector3 point, Vector3 center, float radian, float length) + { + var baseRad = point.GetRadian(center); + var baseLength = point.GetLength(center); + var rotRad = baseRad + radian; + return new Vector3( + center.X + MathF.Sin(rotRad) * (length + baseLength), + center.Y, + center.Z + MathF.Cos(rotRad) * (length + baseLength) + ); + } + + /// + /// 获得某角度所在划分区域 + /// + /// 输入弧度 + /// 区域划分数量 + /// 0度所在区域的初始Idx> + /// 是否为斜分割,默认为false + /// 是否顺时针增加,默认为false + /// + public static int RadianToRegion(this float radian, int regionNum, int baseRegionIdx = 0, bool isDiagDiv = false, bool isCw = false) + { + var sepRad = float.Pi * 2 / regionNum; + var inputAngle = radian * (isCw ? -1 : 1) + (isDiagDiv ? sepRad / 2 : 0); + var rad = (inputAngle + 4 * float.Pi) % (2 * float.Pi); + return ((int)Math.Floor(rad / sepRad) + baseRegionIdx + regionNum) % regionNum; + } + + /// + /// 将输入点左右折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointHorizon(this Vector3 point, float centerX) + => point with { X = 2 * centerX - point.X }; + + /// + /// 将输入点上下折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointVertical(this Vector3 point, float centerZ) + => point with { Z = 2 * centerZ - point.Z }; + + /// + /// 将输入点中心对称 + /// + /// 输入点 + /// 中心点 + /// + public static Vector3 PointCenterSymmetry(this Vector3 point, Vector3 center) + => point.RotateAndExtend(center, float.Pi, 0); + + /// + /// 获取给定数的指定位数 + /// + /// 给定数值 + /// 对应位数,个位为1 + /// + public static int GetDecimalDigit(this int val, int x) + { + var valStr = val.ToString(); + var length = valStr.Length; + if (x < 1 || x > length) return -1; + var digitChar = valStr[length - x]; // 从右往左取第x位 + return int.Parse(digitChar.ToString()); + } +} + +#endregion 计算函数 \ No newline at end of file diff --git a/04-Stormblood/Trial/Tsukuyomi.cs b/04-Stormblood/Trial/Tsukuyomi.cs index 181d8d2..4ece44d 100644 --- a/04-Stormblood/Trial/Tsukuyomi.cs +++ b/04-Stormblood/Trial/Tsukuyomi.cs @@ -3,25 +3,19 @@ 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 ECommons; -using ECommons.DalamudServices; -using ECommons.GameFunctions; -using ECommons.MathHelpers; using System.Threading.Tasks; using KodakkuAssist.Extensions; namespace Tsukuyomi; [ScriptType(guid: "97415dc8-cd16-4c9b-87be-026a297c3451", name: "月读歼灭战", territorys: [778], - version: "0.0.0.1", author: "Tetora", note: noteStr)] + version: "0.0.0.2", author: "Tetora", note: noteStr)] public class Tsukuyomi { @@ -253,3 +247,112 @@ public static class Extensions } } } + + +#region 计算函数 + +public static class MathTools +{ + public static float DegToRad(this float deg) => (deg + 360f) % 360f / 180f * float.Pi; + public static float RadToDeg(this float rad) => (rad + 2 * float.Pi) % (2 * float.Pi) / float.Pi * 180f; + + /// + /// 获得任意点与中心点的弧度值,以(0, 0, 1)方向为0,以(1, 0, 0)方向为pi/2。 + /// 即,逆时针方向增加。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetRadian(this Vector3 point, Vector3 center) + => MathF.Atan2(point.X - center.X, point.Z - center.Z); + + /// + /// 获得任意点与中心点的长度。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetLength(this Vector3 point, Vector3 center) + => new Vector2(point.X - center.X, point.Z - center.Z).Length(); + + /// + /// 将任意点以中心点为圆心,逆时针旋转并延长。 + /// + /// 任意点 + /// 中心点 + /// 旋转弧度 + /// 基于该点延伸长度 + /// + public static Vector3 RotateAndExtend(this Vector3 point, Vector3 center, float radian, float length) + { + var baseRad = point.GetRadian(center); + var baseLength = point.GetLength(center); + var rotRad = baseRad + radian; + return new Vector3( + center.X + MathF.Sin(rotRad) * (length + baseLength), + center.Y, + center.Z + MathF.Cos(rotRad) * (length + baseLength) + ); + } + + /// + /// 获得某角度所在划分区域 + /// + /// 输入弧度 + /// 区域划分数量 + /// 0度所在区域的初始Idx> + /// 是否为斜分割,默认为false + /// 是否顺时针增加,默认为false + /// + public static int RadianToRegion(this float radian, int regionNum, int baseRegionIdx = 0, bool isDiagDiv = false, bool isCw = false) + { + var sepRad = float.Pi * 2 / regionNum; + var inputAngle = radian * (isCw ? -1 : 1) + (isDiagDiv ? sepRad / 2 : 0); + var rad = (inputAngle + 4 * float.Pi) % (2 * float.Pi); + return ((int)Math.Floor(rad / sepRad) + baseRegionIdx + regionNum) % regionNum; + } + + /// + /// 将输入点左右折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointHorizon(this Vector3 point, float centerX) + => point with { X = 2 * centerX - point.X }; + + /// + /// 将输入点上下折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointVertical(this Vector3 point, float centerZ) + => point with { Z = 2 * centerZ - point.Z }; + + /// + /// 将输入点中心对称 + /// + /// 输入点 + /// 中心点 + /// + public static Vector3 PointCenterSymmetry(this Vector3 point, Vector3 center) + => point.RotateAndExtend(center, float.Pi, 0); + + /// + /// 获取给定数的指定位数 + /// + /// 给定数值 + /// 对应位数,个位为1 + /// + public static int GetDecimalDigit(this int val, int x) + { + var valStr = val.ToString(); + var length = valStr.Length; + if (x < 1 || x > length) return -1; + var digitChar = valStr[length - x]; // 从右往左取第x位 + return int.Parse(digitChar.ToString()); + } +} + +#endregion 计算函数 \ No newline at end of file diff --git a/04-Stormblood/Trial/Yojimbo.cs b/04-Stormblood/Trial/Yojimbo.cs index 77e797b..a977350 100644 --- a/04-Stormblood/Trial/Yojimbo.cs +++ b/04-Stormblood/Trial/Yojimbo.cs @@ -3,24 +3,18 @@ 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 ECommons; -using ECommons.DalamudServices; -using ECommons.GameFunctions; -using ECommons.MathHelpers; using System.Threading.Tasks; namespace Kugane_Ohashi; [ScriptType(guid: "944c8879-0d4e-4182-87ea-c38769990f2d", name: "保镖歼灭战", territorys: [806], - version: "0.0.0.2", author: "Tetora", note: noteStr)] + version: "0.0.0.3", author: "Tetora", note: noteStr)] public class Yojimbo { const string noteStr = diff --git a/05-Shadowbringers/Dungeon/theTwinning.cs b/05-Shadowbringers/Dungeon/theTwinning.cs index e742b76..0497155 100644 --- a/05-Shadowbringers/Dungeon/theTwinning.cs +++ b/05-Shadowbringers/Dungeon/theTwinning.cs @@ -3,8 +3,6 @@ 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; @@ -12,16 +10,12 @@ 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 theTwinning; [ScriptType(guid: "bfb00cd3-ccec-4b21-b3d7-e290f49e6a75", name: "异界遗构希尔科斯孪晶塔", territorys: [840], - version: "0.0.0.2", author: "Tetora", note: noteStr)] + version: "0.0.0.3", author: "Tetora", note: noteStr)] public class theTwinning { @@ -346,4 +340,112 @@ public static class EventExtensions { return JsonConvert.DeserializeObject(@event["Param"]); } -} \ No newline at end of file +} + +#region 计算函数 + +public static class MathTools +{ + public static float DegToRad(this float deg) => (deg + 360f) % 360f / 180f * float.Pi; + public static float RadToDeg(this float rad) => (rad + 2 * float.Pi) % (2 * float.Pi) / float.Pi * 180f; + + /// + /// 获得任意点与中心点的弧度值,以(0, 0, 1)方向为0,以(1, 0, 0)方向为pi/2。 + /// 即,逆时针方向增加。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetRadian(this Vector3 point, Vector3 center) + => MathF.Atan2(point.X - center.X, point.Z - center.Z); + + /// + /// 获得任意点与中心点的长度。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetLength(this Vector3 point, Vector3 center) + => new Vector2(point.X - center.X, point.Z - center.Z).Length(); + + /// + /// 将任意点以中心点为圆心,逆时针旋转并延长。 + /// + /// 任意点 + /// 中心点 + /// 旋转弧度 + /// 基于该点延伸长度 + /// + public static Vector3 RotateAndExtend(this Vector3 point, Vector3 center, float radian, float length) + { + var baseRad = point.GetRadian(center); + var baseLength = point.GetLength(center); + var rotRad = baseRad + radian; + return new Vector3( + center.X + MathF.Sin(rotRad) * (length + baseLength), + center.Y, + center.Z + MathF.Cos(rotRad) * (length + baseLength) + ); + } + + /// + /// 获得某角度所在划分区域 + /// + /// 输入弧度 + /// 区域划分数量 + /// 0度所在区域的初始Idx> + /// 是否为斜分割,默认为false + /// 是否顺时针增加,默认为false + /// + public static int RadianToRegion(this float radian, int regionNum, int baseRegionIdx = 0, bool isDiagDiv = false, bool isCw = false) + { + var sepRad = float.Pi * 2 / regionNum; + var inputAngle = radian * (isCw ? -1 : 1) + (isDiagDiv ? sepRad / 2 : 0); + var rad = (inputAngle + 4 * float.Pi) % (2 * float.Pi); + return ((int)Math.Floor(rad / sepRad) + baseRegionIdx + regionNum) % regionNum; + } + + /// + /// 将输入点左右折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointHorizon(this Vector3 point, float centerX) + => point with { X = 2 * centerX - point.X }; + + /// + /// 将输入点上下折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointVertical(this Vector3 point, float centerZ) + => point with { Z = 2 * centerZ - point.Z }; + + /// + /// 将输入点中心对称 + /// + /// 输入点 + /// 中心点 + /// + public static Vector3 PointCenterSymmetry(this Vector3 point, Vector3 center) + => point.RotateAndExtend(center, float.Pi, 0); + + /// + /// 获取给定数的指定位数 + /// + /// 给定数值 + /// 对应位数,个位为1 + /// + public static int GetDecimalDigit(this int val, int x) + { + var valStr = val.ToString(); + var length = valStr.Length; + if (x < 1 || x > length) return -1; + var digitChar = valStr[length - x]; // 从右往左取第x位 + return int.Parse(digitChar.ToString()); + } +} + +#endregion 计算函数 \ No newline at end of file diff --git a/05-Shadowbringers/Raid-Eden/Normal/E10n.cs b/05-Shadowbringers/Raid-Eden/Normal/E10n.cs index 7082db5..d5f0b4b 100644 --- a/05-Shadowbringers/Raid-Eden/Normal/E10n.cs +++ b/05-Shadowbringers/Raid-Eden/Normal/E10n.cs @@ -3,8 +3,6 @@ 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; @@ -12,16 +10,12 @@ 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 E10n; [ScriptType(guid: "038e00e8-d378-4f43-89ab-e27df5561d5a", name: "E10N", territorys: [943], - version: "0.0.0.2", author: "Tetora", note: noteStr)] + version: "0.0.0.3", author: "Tetora", note: noteStr)] public class E10n { @@ -413,4 +407,113 @@ public static class Extensions accessory.Method.TTS(text); } } -} \ No newline at end of file +} + + +#region 计算函数 + +public static class MathTools +{ + public static float DegToRad(this float deg) => (deg + 360f) % 360f / 180f * float.Pi; + public static float RadToDeg(this float rad) => (rad + 2 * float.Pi) % (2 * float.Pi) / float.Pi * 180f; + + /// + /// 获得任意点与中心点的弧度值,以(0, 0, 1)方向为0,以(1, 0, 0)方向为pi/2。 + /// 即,逆时针方向增加。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetRadian(this Vector3 point, Vector3 center) + => MathF.Atan2(point.X - center.X, point.Z - center.Z); + + /// + /// 获得任意点与中心点的长度。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetLength(this Vector3 point, Vector3 center) + => new Vector2(point.X - center.X, point.Z - center.Z).Length(); + + /// + /// 将任意点以中心点为圆心,逆时针旋转并延长。 + /// + /// 任意点 + /// 中心点 + /// 旋转弧度 + /// 基于该点延伸长度 + /// + public static Vector3 RotateAndExtend(this Vector3 point, Vector3 center, float radian, float length) + { + var baseRad = point.GetRadian(center); + var baseLength = point.GetLength(center); + var rotRad = baseRad + radian; + return new Vector3( + center.X + MathF.Sin(rotRad) * (length + baseLength), + center.Y, + center.Z + MathF.Cos(rotRad) * (length + baseLength) + ); + } + + /// + /// 获得某角度所在划分区域 + /// + /// 输入弧度 + /// 区域划分数量 + /// 0度所在区域的初始Idx> + /// 是否为斜分割,默认为false + /// 是否顺时针增加,默认为false + /// + public static int RadianToRegion(this float radian, int regionNum, int baseRegionIdx = 0, bool isDiagDiv = false, bool isCw = false) + { + var sepRad = float.Pi * 2 / regionNum; + var inputAngle = radian * (isCw ? -1 : 1) + (isDiagDiv ? sepRad / 2 : 0); + var rad = (inputAngle + 4 * float.Pi) % (2 * float.Pi); + return ((int)Math.Floor(rad / sepRad) + baseRegionIdx + regionNum) % regionNum; + } + + /// + /// 将输入点左右折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointHorizon(this Vector3 point, float centerX) + => point with { X = 2 * centerX - point.X }; + + /// + /// 将输入点上下折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointVertical(this Vector3 point, float centerZ) + => point with { Z = 2 * centerZ - point.Z }; + + /// + /// 将输入点中心对称 + /// + /// 输入点 + /// 中心点 + /// + public static Vector3 PointCenterSymmetry(this Vector3 point, Vector3 center) + => point.RotateAndExtend(center, float.Pi, 0); + + /// + /// 获取给定数的指定位数 + /// + /// 给定数值 + /// 对应位数,个位为1 + /// + public static int GetDecimalDigit(this int val, int x) + { + var valStr = val.ToString(); + var length = valStr.Length; + if (x < 1 || x > length) return -1; + var digitChar = valStr[length - x]; // 从右往左取第x位 + return int.Parse(digitChar.ToString()); + } +} + +#endregion 计算函数 \ No newline at end of file diff --git a/05-Shadowbringers/Raid-Eden/Normal/E12n.cs b/05-Shadowbringers/Raid-Eden/Normal/E12n.cs index c638c32..93081c4 100644 --- a/05-Shadowbringers/Raid-Eden/Normal/E12n.cs +++ b/05-Shadowbringers/Raid-Eden/Normal/E12n.cs @@ -3,8 +3,6 @@ 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; @@ -12,16 +10,12 @@ 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 E12n; [ScriptType(guid: "3f88ad9c-e7a7-4e00-b19e-546609b319ba", name: "E12N", territorys: [945], - version: "0.0.0.2" , author: "Tetora", note: noteStr)] + version: "0.0.0.3" , author: "Tetora", note: noteStr)] public class E12n { @@ -290,3 +284,111 @@ public static class Extensions } } } + +#region 计算函数 + +public static class MathTools +{ + public static float DegToRad(this float deg) => (deg + 360f) % 360f / 180f * float.Pi; + public static float RadToDeg(this float rad) => (rad + 2 * float.Pi) % (2 * float.Pi) / float.Pi * 180f; + + /// + /// 获得任意点与中心点的弧度值,以(0, 0, 1)方向为0,以(1, 0, 0)方向为pi/2。 + /// 即,逆时针方向增加。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetRadian(this Vector3 point, Vector3 center) + => MathF.Atan2(point.X - center.X, point.Z - center.Z); + + /// + /// 获得任意点与中心点的长度。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetLength(this Vector3 point, Vector3 center) + => new Vector2(point.X - center.X, point.Z - center.Z).Length(); + + /// + /// 将任意点以中心点为圆心,逆时针旋转并延长。 + /// + /// 任意点 + /// 中心点 + /// 旋转弧度 + /// 基于该点延伸长度 + /// + public static Vector3 RotateAndExtend(this Vector3 point, Vector3 center, float radian, float length) + { + var baseRad = point.GetRadian(center); + var baseLength = point.GetLength(center); + var rotRad = baseRad + radian; + return new Vector3( + center.X + MathF.Sin(rotRad) * (length + baseLength), + center.Y, + center.Z + MathF.Cos(rotRad) * (length + baseLength) + ); + } + + /// + /// 获得某角度所在划分区域 + /// + /// 输入弧度 + /// 区域划分数量 + /// 0度所在区域的初始Idx> + /// 是否为斜分割,默认为false + /// 是否顺时针增加,默认为false + /// + public static int RadianToRegion(this float radian, int regionNum, int baseRegionIdx = 0, bool isDiagDiv = false, bool isCw = false) + { + var sepRad = float.Pi * 2 / regionNum; + var inputAngle = radian * (isCw ? -1 : 1) + (isDiagDiv ? sepRad / 2 : 0); + var rad = (inputAngle + 4 * float.Pi) % (2 * float.Pi); + return ((int)Math.Floor(rad / sepRad) + baseRegionIdx + regionNum) % regionNum; + } + + /// + /// 将输入点左右折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointHorizon(this Vector3 point, float centerX) + => point with { X = 2 * centerX - point.X }; + + /// + /// 将输入点上下折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointVertical(this Vector3 point, float centerZ) + => point with { Z = 2 * centerZ - point.Z }; + + /// + /// 将输入点中心对称 + /// + /// 输入点 + /// 中心点 + /// + public static Vector3 PointCenterSymmetry(this Vector3 point, Vector3 center) + => point.RotateAndExtend(center, float.Pi, 0); + + /// + /// 获取给定数的指定位数 + /// + /// 给定数值 + /// 对应位数,个位为1 + /// + public static int GetDecimalDigit(this int val, int x) + { + var valStr = val.ToString(); + var length = valStr.Length; + if (x < 1 || x > length) return -1; + var digitChar = valStr[length - x]; // 从右往左取第x位 + return int.Parse(digitChar.ToString()); + } +} + +#endregion 计算函数 \ No newline at end of file diff --git a/05-Shadowbringers/Raid-Eden/Normal/E1n.cs b/05-Shadowbringers/Raid-Eden/Normal/E1n.cs index 44b8a4e..4971c1e 100644 --- a/05-Shadowbringers/Raid-Eden/Normal/E1n.cs +++ b/05-Shadowbringers/Raid-Eden/Normal/E1n.cs @@ -3,8 +3,6 @@ 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; @@ -12,16 +10,12 @@ using KodakkuAssist.Module.GameEvent; using KodakkuAssist.Module.Draw; using KodakkuAssist.Extensions; using KodakkuAssist.Data; -using ECommons; -using ECommons.DalamudServices; -using ECommons.GameFunctions; -using ECommons.MathHelpers; using System.Threading.Tasks; namespace E1n; [ScriptType(guid: "35c751e5-2958-4f55-b783-405b4acfde1b", name: "E1N", territorys: [849], - version: "0.0.0.2", author: "Tetora", note: noteStr)] + version: "0.0.0.3", author: "Tetora", note: noteStr)] public class E1n { @@ -240,3 +234,112 @@ public static class Extensions } } } + + +#region 计算函数 + +public static class MathTools +{ + public static float DegToRad(this float deg) => (deg + 360f) % 360f / 180f * float.Pi; + public static float RadToDeg(this float rad) => (rad + 2 * float.Pi) % (2 * float.Pi) / float.Pi * 180f; + + /// + /// 获得任意点与中心点的弧度值,以(0, 0, 1)方向为0,以(1, 0, 0)方向为pi/2。 + /// 即,逆时针方向增加。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetRadian(this Vector3 point, Vector3 center) + => MathF.Atan2(point.X - center.X, point.Z - center.Z); + + /// + /// 获得任意点与中心点的长度。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetLength(this Vector3 point, Vector3 center) + => new Vector2(point.X - center.X, point.Z - center.Z).Length(); + + /// + /// 将任意点以中心点为圆心,逆时针旋转并延长。 + /// + /// 任意点 + /// 中心点 + /// 旋转弧度 + /// 基于该点延伸长度 + /// + public static Vector3 RotateAndExtend(this Vector3 point, Vector3 center, float radian, float length) + { + var baseRad = point.GetRadian(center); + var baseLength = point.GetLength(center); + var rotRad = baseRad + radian; + return new Vector3( + center.X + MathF.Sin(rotRad) * (length + baseLength), + center.Y, + center.Z + MathF.Cos(rotRad) * (length + baseLength) + ); + } + + /// + /// 获得某角度所在划分区域 + /// + /// 输入弧度 + /// 区域划分数量 + /// 0度所在区域的初始Idx> + /// 是否为斜分割,默认为false + /// 是否顺时针增加,默认为false + /// + public static int RadianToRegion(this float radian, int regionNum, int baseRegionIdx = 0, bool isDiagDiv = false, bool isCw = false) + { + var sepRad = float.Pi * 2 / regionNum; + var inputAngle = radian * (isCw ? -1 : 1) + (isDiagDiv ? sepRad / 2 : 0); + var rad = (inputAngle + 4 * float.Pi) % (2 * float.Pi); + return ((int)Math.Floor(rad / sepRad) + baseRegionIdx + regionNum) % regionNum; + } + + /// + /// 将输入点左右折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointHorizon(this Vector3 point, float centerX) + => point with { X = 2 * centerX - point.X }; + + /// + /// 将输入点上下折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointVertical(this Vector3 point, float centerZ) + => point with { Z = 2 * centerZ - point.Z }; + + /// + /// 将输入点中心对称 + /// + /// 输入点 + /// 中心点 + /// + public static Vector3 PointCenterSymmetry(this Vector3 point, Vector3 center) + => point.RotateAndExtend(center, float.Pi, 0); + + /// + /// 获取给定数的指定位数 + /// + /// 给定数值 + /// 对应位数,个位为1 + /// + public static int GetDecimalDigit(this int val, int x) + { + var valStr = val.ToString(); + var length = valStr.Length; + if (x < 1 || x > length) return -1; + var digitChar = valStr[length - x]; // 从右往左取第x位 + return int.Parse(digitChar.ToString()); + } +} + +#endregion 计算函数 \ No newline at end of file diff --git a/05-Shadowbringers/Raid-Eden/Normal/E2n.cs b/05-Shadowbringers/Raid-Eden/Normal/E2n.cs index 08bde4d..7411a08 100644 --- a/05-Shadowbringers/Raid-Eden/Normal/E2n.cs +++ b/05-Shadowbringers/Raid-Eden/Normal/E2n.cs @@ -11,16 +11,12 @@ using KodakkuAssist.Script; using KodakkuAssist.Module.GameEvent; using KodakkuAssist.Module.Draw; using KodakkuAssist.Data; -using ECommons; -using ECommons.DalamudServices; -using ECommons.GameFunctions; -using ECommons.MathHelpers; using System.Threading.Tasks; namespace E2n; [ScriptType(guid: "b59c7db9-1fba-4476-8701-1e3043cb7dc8", name: "E2N", territorys: [850], - version: "0.0.0.1", author: "Tetora", note: noteStr)] + version: "0.0.0.2", author: "Tetora", note: noteStr)] public class E2n { diff --git a/05-Shadowbringers/Raid-Eden/Normal/E8n.cs b/05-Shadowbringers/Raid-Eden/Normal/E8n.cs index 9bc93d8..eb7ba05 100644 --- a/05-Shadowbringers/Raid-Eden/Normal/E8n.cs +++ b/05-Shadowbringers/Raid-Eden/Normal/E8n.cs @@ -3,8 +3,6 @@ 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; @@ -12,16 +10,12 @@ 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 E8n; [ScriptType(guid: "c4d533c8-8798-441d-b849-fc3cd5cf63d9", name: "E8N", territorys: [905], - version: "0.0.0.3" , author: "Tetora", note: noteStr)] + version: "0.0.0.4" , author: "Tetora", note: noteStr)] public class E8n { @@ -386,3 +380,112 @@ public static class Extensions } } } + + +#region 计算函数 + +public static class MathTools +{ + public static float DegToRad(this float deg) => (deg + 360f) % 360f / 180f * float.Pi; + public static float RadToDeg(this float rad) => (rad + 2 * float.Pi) % (2 * float.Pi) / float.Pi * 180f; + + /// + /// 获得任意点与中心点的弧度值,以(0, 0, 1)方向为0,以(1, 0, 0)方向为pi/2。 + /// 即,逆时针方向增加。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetRadian(this Vector3 point, Vector3 center) + => MathF.Atan2(point.X - center.X, point.Z - center.Z); + + /// + /// 获得任意点与中心点的长度。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetLength(this Vector3 point, Vector3 center) + => new Vector2(point.X - center.X, point.Z - center.Z).Length(); + + /// + /// 将任意点以中心点为圆心,逆时针旋转并延长。 + /// + /// 任意点 + /// 中心点 + /// 旋转弧度 + /// 基于该点延伸长度 + /// + public static Vector3 RotateAndExtend(this Vector3 point, Vector3 center, float radian, float length) + { + var baseRad = point.GetRadian(center); + var baseLength = point.GetLength(center); + var rotRad = baseRad + radian; + return new Vector3( + center.X + MathF.Sin(rotRad) * (length + baseLength), + center.Y, + center.Z + MathF.Cos(rotRad) * (length + baseLength) + ); + } + + /// + /// 获得某角度所在划分区域 + /// + /// 输入弧度 + /// 区域划分数量 + /// 0度所在区域的初始Idx> + /// 是否为斜分割,默认为false + /// 是否顺时针增加,默认为false + /// + public static int RadianToRegion(this float radian, int regionNum, int baseRegionIdx = 0, bool isDiagDiv = false, bool isCw = false) + { + var sepRad = float.Pi * 2 / regionNum; + var inputAngle = radian * (isCw ? -1 : 1) + (isDiagDiv ? sepRad / 2 : 0); + var rad = (inputAngle + 4 * float.Pi) % (2 * float.Pi); + return ((int)Math.Floor(rad / sepRad) + baseRegionIdx + regionNum) % regionNum; + } + + /// + /// 将输入点左右折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointHorizon(this Vector3 point, float centerX) + => point with { X = 2 * centerX - point.X }; + + /// + /// 将输入点上下折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointVertical(this Vector3 point, float centerZ) + => point with { Z = 2 * centerZ - point.Z }; + + /// + /// 将输入点中心对称 + /// + /// 输入点 + /// 中心点 + /// + public static Vector3 PointCenterSymmetry(this Vector3 point, Vector3 center) + => point.RotateAndExtend(center, float.Pi, 0); + + /// + /// 获取给定数的指定位数 + /// + /// 给定数值 + /// 对应位数,个位为1 + /// + public static int GetDecimalDigit(this int val, int x) + { + var valStr = val.ToString(); + var length = valStr.Length; + if (x < 1 || x > length) return -1; + var digitChar = valStr[length - x]; // 从右往左取第x位 + return int.Parse(digitChar.ToString()); + } +} + +#endregion 计算函数 \ No newline at end of file diff --git a/05-Shadowbringers/Raid-Eden/Normal/E9n.cs b/05-Shadowbringers/Raid-Eden/Normal/E9n.cs index 62b2705..1ca0877 100644 --- a/05-Shadowbringers/Raid-Eden/Normal/E9n.cs +++ b/05-Shadowbringers/Raid-Eden/Normal/E9n.cs @@ -11,16 +11,12 @@ using KodakkuAssist.Script; using KodakkuAssist.Module.GameEvent; using KodakkuAssist.Module.Draw; using KodakkuAssist.Data; -using ECommons; -using ECommons.DalamudServices; -using ECommons.GameFunctions; -using ECommons.MathHelpers; using System.Threading.Tasks; namespace E9n; [ScriptType(guid: "e4b80c15-7885-46b7-8e3d-201a6a248c89", name: "E9N", territorys: [942], - version: "0.0.0.1", author: "Tetora", note: noteStr)] + version: "0.0.0.2", author: "Tetora", note: noteStr)] public class E9n { @@ -218,4 +214,113 @@ public static class EventExtensions { return JsonConvert.DeserializeObject(@event["Param"]); } -} \ No newline at end of file +} + + +#region 计算函数 + +public static class MathTools +{ + public static float DegToRad(this float deg) => (deg + 360f) % 360f / 180f * float.Pi; + public static float RadToDeg(this float rad) => (rad + 2 * float.Pi) % (2 * float.Pi) / float.Pi * 180f; + + /// + /// 获得任意点与中心点的弧度值,以(0, 0, 1)方向为0,以(1, 0, 0)方向为pi/2。 + /// 即,逆时针方向增加。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetRadian(this Vector3 point, Vector3 center) + => MathF.Atan2(point.X - center.X, point.Z - center.Z); + + /// + /// 获得任意点与中心点的长度。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetLength(this Vector3 point, Vector3 center) + => new Vector2(point.X - center.X, point.Z - center.Z).Length(); + + /// + /// 将任意点以中心点为圆心,逆时针旋转并延长。 + /// + /// 任意点 + /// 中心点 + /// 旋转弧度 + /// 基于该点延伸长度 + /// + public static Vector3 RotateAndExtend(this Vector3 point, Vector3 center, float radian, float length) + { + var baseRad = point.GetRadian(center); + var baseLength = point.GetLength(center); + var rotRad = baseRad + radian; + return new Vector3( + center.X + MathF.Sin(rotRad) * (length + baseLength), + center.Y, + center.Z + MathF.Cos(rotRad) * (length + baseLength) + ); + } + + /// + /// 获得某角度所在划分区域 + /// + /// 输入弧度 + /// 区域划分数量 + /// 0度所在区域的初始Idx> + /// 是否为斜分割,默认为false + /// 是否顺时针增加,默认为false + /// + public static int RadianToRegion(this float radian, int regionNum, int baseRegionIdx = 0, bool isDiagDiv = false, bool isCw = false) + { + var sepRad = float.Pi * 2 / regionNum; + var inputAngle = radian * (isCw ? -1 : 1) + (isDiagDiv ? sepRad / 2 : 0); + var rad = (inputAngle + 4 * float.Pi) % (2 * float.Pi); + return ((int)Math.Floor(rad / sepRad) + baseRegionIdx + regionNum) % regionNum; + } + + /// + /// 将输入点左右折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointHorizon(this Vector3 point, float centerX) + => point with { X = 2 * centerX - point.X }; + + /// + /// 将输入点上下折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointVertical(this Vector3 point, float centerZ) + => point with { Z = 2 * centerZ - point.Z }; + + /// + /// 将输入点中心对称 + /// + /// 输入点 + /// 中心点 + /// + public static Vector3 PointCenterSymmetry(this Vector3 point, Vector3 center) + => point.RotateAndExtend(center, float.Pi, 0); + + /// + /// 获取给定数的指定位数 + /// + /// 给定数值 + /// 对应位数,个位为1 + /// + public static int GetDecimalDigit(this int val, int x) + { + var valStr = val.ToString(); + var length = valStr.Length; + if (x < 1 || x > length) return -1; + var digitChar = valStr[length - x]; // 从右往左取第x位 + return int.Parse(digitChar.ToString()); + } +} + +#endregion 计算函数 \ No newline at end of file diff --git a/05-Shadowbringers/Raid-Eden/Savage/E12S.cs b/05-Shadowbringers/Raid-Eden/Savage/E12S.cs index 2068a63..4e7d977 100644 --- a/05-Shadowbringers/Raid-Eden/Savage/E12S.cs +++ b/05-Shadowbringers/Raid-Eden/Savage/E12S.cs @@ -3,8 +3,6 @@ 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; @@ -12,16 +10,12 @@ 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)] + version: "0.0.0.2", author: "Tetora", note: noteStr)] public class E12S { @@ -420,4 +414,112 @@ public static class EventExtensions { return JsonConvert.DeserializeObject(@event["Param"]); } -} \ No newline at end of file +} + +#region 计算函数 + +public static class MathTools +{ + public static float DegToRad(this float deg) => (deg + 360f) % 360f / 180f * float.Pi; + public static float RadToDeg(this float rad) => (rad + 2 * float.Pi) % (2 * float.Pi) / float.Pi * 180f; + + /// + /// 获得任意点与中心点的弧度值,以(0, 0, 1)方向为0,以(1, 0, 0)方向为pi/2。 + /// 即,逆时针方向增加。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetRadian(this Vector3 point, Vector3 center) + => MathF.Atan2(point.X - center.X, point.Z - center.Z); + + /// + /// 获得任意点与中心点的长度。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetLength(this Vector3 point, Vector3 center) + => new Vector2(point.X - center.X, point.Z - center.Z).Length(); + + /// + /// 将任意点以中心点为圆心,逆时针旋转并延长。 + /// + /// 任意点 + /// 中心点 + /// 旋转弧度 + /// 基于该点延伸长度 + /// + public static Vector3 RotateAndExtend(this Vector3 point, Vector3 center, float radian, float length) + { + var baseRad = point.GetRadian(center); + var baseLength = point.GetLength(center); + var rotRad = baseRad + radian; + return new Vector3( + center.X + MathF.Sin(rotRad) * (length + baseLength), + center.Y, + center.Z + MathF.Cos(rotRad) * (length + baseLength) + ); + } + + /// + /// 获得某角度所在划分区域 + /// + /// 输入弧度 + /// 区域划分数量 + /// 0度所在区域的初始Idx> + /// 是否为斜分割,默认为false + /// 是否顺时针增加,默认为false + /// + public static int RadianToRegion(this float radian, int regionNum, int baseRegionIdx = 0, bool isDiagDiv = false, bool isCw = false) + { + var sepRad = float.Pi * 2 / regionNum; + var inputAngle = radian * (isCw ? -1 : 1) + (isDiagDiv ? sepRad / 2 : 0); + var rad = (inputAngle + 4 * float.Pi) % (2 * float.Pi); + return ((int)Math.Floor(rad / sepRad) + baseRegionIdx + regionNum) % regionNum; + } + + /// + /// 将输入点左右折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointHorizon(this Vector3 point, float centerX) + => point with { X = 2 * centerX - point.X }; + + /// + /// 将输入点上下折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointVertical(this Vector3 point, float centerZ) + => point with { Z = 2 * centerZ - point.Z }; + + /// + /// 将输入点中心对称 + /// + /// 输入点 + /// 中心点 + /// + public static Vector3 PointCenterSymmetry(this Vector3 point, Vector3 center) + => point.RotateAndExtend(center, float.Pi, 0); + + /// + /// 获取给定数的指定位数 + /// + /// 给定数值 + /// 对应位数,个位为1 + /// + public static int GetDecimalDigit(this int val, int x) + { + var valStr = val.ToString(); + var length = valStr.Length; + if (x < 1 || x > length) return -1; + var digitChar = valStr[length - x]; // 从右往左取第x位 + return int.Parse(digitChar.ToString()); + } +} + +#endregion 计算函数 \ 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 22409dd..796a586 100644 --- a/05-Shadowbringers/Raid-Eden/Savage/E7S.cs +++ b/05-Shadowbringers/Raid-Eden/Savage/E7S.cs @@ -1,37 +1,33 @@ 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 FFXIVClientStructs; +using FFXIVClientStructs.FFXIV.Client.Game.Character; +using FFXIVClientStructs.FFXIV.Client.UI; 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 KodakkuAssist.Module.GameEvent; +using KodakkuAssist.Script; +using Lumina.Data.Structs; +using Newtonsoft.Json; +using System; +using System; using System.Collections.Generic; using System.ComponentModel; -using ECommons.Reflection; -using System.Windows; -using ECommons; -using ECommons.GameFunctions; -using FFXIVClientStructs; -using System; +using System.Linq; +using System.Net; +using System.Numerics; +using System.Reflection.Metadata; using System.Runtime.InteropServices; +using System.Runtime.Intrinsics.Arm; +using System.Threading.Tasks; +using System.Windows; 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)] + version: "0.0.0.2", author: "Tetora", note: noteStr)] public class E7S { @@ -113,7 +109,7 @@ public class E7S [ScriptMethod(name: "debug", eventType: EventTypeEnum.Chat, eventCondition: ["Message:debug"])] public async void debug(Event @event, ScriptAccessory accessory) { - var myself = IbcHelper.GetByEntityId(accessory.Data.Me); + var myself = accessory.Data.Objects.SearchByEntityId(accessory.Data.Me) as IBattleChara; if (myself == null) return; var buffId = myself.HasStatus(2238) ? 2238 : 2239; DebugMsg($"buffId: {buffId}", accessory); @@ -297,7 +293,7 @@ public class E7S // 2238 Light //19516 & 19490 // 0x8BE // 2239 Darkness //19517 & 19491 // 0x8BF DebugMsg($"{LightsCourseCount}: {@event.ActionId()}", accessory); - var myself = IbcHelper.GetByEntityId(accessory.Data.Me); + var myself = accessory.Data.Objects.SearchByEntityId(accessory.Data.Me) as IBattleChara; if (myself == null) return; var buffId = myself.HasStatus(2238) ? 2238 : 2239; DebugMsg($"buffId: {buffId}", accessory); @@ -333,7 +329,7 @@ public class E7S // 2238 Light //19516 & 19490 // 0x8BE // 2239 Darkness //19517 & 19491 & 19521 // 0x8BF DebugMsg($"{LightsCourseCount}: {@event.ActionId()}", accessory); - var myself = IbcHelper.GetByEntityId(accessory.Data.Me); + var myself = accessory.Data.Objects.SearchByEntityId(accessory.Data.Me) as IBattleChara; if (myself == null) return; var buffId = myself.HasStatus(2238) ? 2238 : 2239; DebugMsg($"buffId: {buffId}", accessory); @@ -745,36 +741,47 @@ public static class Extensions public static class IbcHelper { - public static IBattleChara? GetById(uint id) + public static KodakkuAssist.Data.IGameObject? GetById(ScriptAccessory accessory, uint id) { - return (IBattleChara?)Svc.Objects.SearchByEntityId(id); + return accessory.Data.Objects.SearchByEntityId(id); } - public static IBattleChara? GetMe() + public static KodakkuAssist.Data.IGameObject? GetMe(ScriptAccessory accessory) { - return Svc.ClientState.LocalPlayer; + return accessory.Data.Objects.SearchByEntityId(accessory.Data.Me); } - public static IGameObject? GetFirstByDataId(uint dataId) + public static KodakkuAssist.Data.IGameObject? GetFirstByDataId(ScriptAccessory accessory, uint dataId) { - return Svc.Objects.Where(x => x.DataId == dataId).FirstOrDefault(); + return accessory.Data.Objects.Where(x => x.DataId == dataId).FirstOrDefault(); } - public static IEnumerable GetByDataId(uint dataId) + public static IEnumerable GetByDataId(ScriptAccessory accessory, 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); + return accessory.Data.Objects.Where(x => x.DataId == dataId); } - public static bool HasStatus(this IBattleChara chara, uint[] statusIds) + public static IEnumerable GetParty(ScriptAccessory accessory) { - return chara.StatusList.Any(x => statusIds.Contains(x.StatusId)); + foreach (var pid in accessory.Data.PartyList) + { + var obj = accessory.Data.Objects.SearchByEntityId(pid); + if (obj != null) yield return obj; + } } -} + + public static IEnumerable GetPartyEntities(ScriptAccessory accessory) + { + return accessory.Data.Objects.Where(obj => accessory.Data.PartyList.Contains(obj.EntityId)); + } + + public static bool HasStatus(this IBattleChara ibc, uint statusId) + { + return ibc.StatusList.Any(x => x.StatusId == statusId); + } + + public static bool HasStatusAny(this IBattleChara ibc, uint[] statusIds) + { + return ibc.StatusList.Any(x => statusIds.Contains(x.StatusId)); + } +} \ No newline at end of file diff --git a/05-Shadowbringers/Trials/Hades.cs b/05-Shadowbringers/Trials/Hades.cs index 1cbfd22..a62f9dd 100644 --- a/05-Shadowbringers/Trials/Hades.cs +++ b/05-Shadowbringers/Trials/Hades.cs @@ -3,25 +3,19 @@ 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 ECommons; -using ECommons.DalamudServices; -using ECommons.GameFunctions; -using ECommons.MathHelpers; using System.Threading.Tasks; using KodakkuAssist.Extensions; namespace Hades; [ScriptType(guid: "ebcac22b-8a1d-49c4-ae1f-1470be15f7e3", name: "哈迪斯歼灭战", territorys: [847], - version: "0.0.0.1", author: "Tetora", note: noteStr)] + version: "0.0.0.2", author: "Tetora", note: noteStr)] public class Hades { @@ -322,4 +316,115 @@ public static class EventExtensions { return JsonConvert.DeserializeObject(@event["Param"]); } -} \ No newline at end of file +} + + + + +#region 计算函数 + +public static class MathTools +{ + public static float DegToRad(this float deg) => (deg + 360f) % 360f / 180f * float.Pi; + public static float RadToDeg(this float rad) => (rad + 2 * float.Pi) % (2 * float.Pi) / float.Pi * 180f; + + /// + /// 获得任意点与中心点的弧度值,以(0, 0, 1)方向为0,以(1, 0, 0)方向为pi/2。 + /// 即,逆时针方向增加。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetRadian(this Vector3 point, Vector3 center) + => MathF.Atan2(point.X - center.X, point.Z - center.Z); + + /// + /// 获得任意点与中心点的长度。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetLength(this Vector3 point, Vector3 center) + => new Vector2(point.X - center.X, point.Z - center.Z).Length(); + + /// + /// 将任意点以中心点为圆心,逆时针旋转并延长。 + /// + /// 任意点 + /// 中心点 + /// 旋转弧度 + /// 基于该点延伸长度 + /// + public static Vector3 RotateAndExtend(this Vector3 point, Vector3 center, float radian, float length) + { + var baseRad = point.GetRadian(center); + var baseLength = point.GetLength(center); + var rotRad = baseRad + radian; + return new Vector3( + center.X + MathF.Sin(rotRad) * (length + baseLength), + center.Y, + center.Z + MathF.Cos(rotRad) * (length + baseLength) + ); + } + + /// + /// 获得某角度所在划分区域 + /// + /// 输入弧度 + /// 区域划分数量 + /// 0度所在区域的初始Idx> + /// 是否为斜分割,默认为false + /// 是否顺时针增加,默认为false + /// + public static int RadianToRegion(this float radian, int regionNum, int baseRegionIdx = 0, bool isDiagDiv = false, bool isCw = false) + { + var sepRad = float.Pi * 2 / regionNum; + var inputAngle = radian * (isCw ? -1 : 1) + (isDiagDiv ? sepRad / 2 : 0); + var rad = (inputAngle + 4 * float.Pi) % (2 * float.Pi); + return ((int)Math.Floor(rad / sepRad) + baseRegionIdx + regionNum) % regionNum; + } + + /// + /// 将输入点左右折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointHorizon(this Vector3 point, float centerX) + => point with { X = 2 * centerX - point.X }; + + /// + /// 将输入点上下折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointVertical(this Vector3 point, float centerZ) + => point with { Z = 2 * centerZ - point.Z }; + + /// + /// 将输入点中心对称 + /// + /// 输入点 + /// 中心点 + /// + public static Vector3 PointCenterSymmetry(this Vector3 point, Vector3 center) + => point.RotateAndExtend(center, float.Pi, 0); + + /// + /// 获取给定数的指定位数 + /// + /// 给定数值 + /// 对应位数,个位为1 + /// + public static int GetDecimalDigit(this int val, int x) + { + var valStr = val.ToString(); + var length = valStr.Length; + if (x < 1 || x > length) return -1; + var digitChar = valStr[length - x]; // 从右往左取第x位 + return int.Parse(digitChar.ToString()); + } +} + +#endregion 计算函数 \ No newline at end of file diff --git a/05-Shadowbringers/Trials/Titania.cs b/05-Shadowbringers/Trials/Titania.cs index cb30b1e..4f35092 100644 --- a/05-Shadowbringers/Trials/Titania.cs +++ b/05-Shadowbringers/Trials/Titania.cs @@ -3,8 +3,6 @@ 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; @@ -12,16 +10,12 @@ 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 Titania; [ScriptType(guid: "71a3a109-0ac3-4041-aa87-ff156f5aaeea", name: "缇坦妮雅歼灭战", territorys: [845], - version: "0.0.0.1", author: "Tetora", note: noteStr)] + version: "0.0.0.2", author: "Tetora", note: noteStr)] public class Titania { @@ -331,4 +325,114 @@ public static class EventExtensions { return JsonConvert.DeserializeObject(@event["Param"]); } -} \ No newline at end of file +} + + + +#region 计算函数 + +public static class MathTools +{ + public static float DegToRad(this float deg) => (deg + 360f) % 360f / 180f * float.Pi; + public static float RadToDeg(this float rad) => (rad + 2 * float.Pi) % (2 * float.Pi) / float.Pi * 180f; + + /// + /// 获得任意点与中心点的弧度值,以(0, 0, 1)方向为0,以(1, 0, 0)方向为pi/2。 + /// 即,逆时针方向增加。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetRadian(this Vector3 point, Vector3 center) + => MathF.Atan2(point.X - center.X, point.Z - center.Z); + + /// + /// 获得任意点与中心点的长度。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetLength(this Vector3 point, Vector3 center) + => new Vector2(point.X - center.X, point.Z - center.Z).Length(); + + /// + /// 将任意点以中心点为圆心,逆时针旋转并延长。 + /// + /// 任意点 + /// 中心点 + /// 旋转弧度 + /// 基于该点延伸长度 + /// + public static Vector3 RotateAndExtend(this Vector3 point, Vector3 center, float radian, float length) + { + var baseRad = point.GetRadian(center); + var baseLength = point.GetLength(center); + var rotRad = baseRad + radian; + return new Vector3( + center.X + MathF.Sin(rotRad) * (length + baseLength), + center.Y, + center.Z + MathF.Cos(rotRad) * (length + baseLength) + ); + } + + /// + /// 获得某角度所在划分区域 + /// + /// 输入弧度 + /// 区域划分数量 + /// 0度所在区域的初始Idx> + /// 是否为斜分割,默认为false + /// 是否顺时针增加,默认为false + /// + public static int RadianToRegion(this float radian, int regionNum, int baseRegionIdx = 0, bool isDiagDiv = false, bool isCw = false) + { + var sepRad = float.Pi * 2 / regionNum; + var inputAngle = radian * (isCw ? -1 : 1) + (isDiagDiv ? sepRad / 2 : 0); + var rad = (inputAngle + 4 * float.Pi) % (2 * float.Pi); + return ((int)Math.Floor(rad / sepRad) + baseRegionIdx + regionNum) % regionNum; + } + + /// + /// 将输入点左右折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointHorizon(this Vector3 point, float centerX) + => point with { X = 2 * centerX - point.X }; + + /// + /// 将输入点上下折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointVertical(this Vector3 point, float centerZ) + => point with { Z = 2 * centerZ - point.Z }; + + /// + /// 将输入点中心对称 + /// + /// 输入点 + /// 中心点 + /// + public static Vector3 PointCenterSymmetry(this Vector3 point, Vector3 center) + => point.RotateAndExtend(center, float.Pi, 0); + + /// + /// 获取给定数的指定位数 + /// + /// 给定数值 + /// 对应位数,个位为1 + /// + public static int GetDecimalDigit(this int val, int x) + { + var valStr = val.ToString(); + var length = valStr.Length; + if (x < 1 || x > length) return -1; + var digitChar = valStr[length - x]; // 从右往左取第x位 + return int.Parse(digitChar.ToString()); + } +} + +#endregion 计算函数 \ No newline at end of file diff --git a/06-EndWalker/Dungeon/the_Lunar_Subterrane.cs b/06-EndWalker/Dungeon/the_Lunar_Subterrane.cs index f91d42c..7a4d3fc 100644 --- a/06-EndWalker/Dungeon/the_Lunar_Subterrane.cs +++ b/06-EndWalker/Dungeon/the_Lunar_Subterrane.cs @@ -3,8 +3,6 @@ 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; @@ -12,16 +10,12 @@ 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 the_Lunar_Subterrane; [ScriptType(guid: "080d15f8-1663-45c4-8919-73c8dea22617", name: "异界深渊月面地下溪谷", territorys: [1164], - version: "0.0.0.1", author: "Tetora", note: noteStr)] + version: "0.0.0.2", author: "Tetora", note: noteStr)] public class the_Lunar_Subterrane { @@ -334,4 +328,114 @@ public static class EventExtensions { return JsonConvert.DeserializeObject(@event["Param"]); } -} \ No newline at end of file +} + + + +#region 计算函数 + +public static class MathTools +{ + public static float DegToRad(this float deg) => (deg + 360f) % 360f / 180f * float.Pi; + public static float RadToDeg(this float rad) => (rad + 2 * float.Pi) % (2 * float.Pi) / float.Pi * 180f; + + /// + /// 获得任意点与中心点的弧度值,以(0, 0, 1)方向为0,以(1, 0, 0)方向为pi/2。 + /// 即,逆时针方向增加。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetRadian(this Vector3 point, Vector3 center) + => MathF.Atan2(point.X - center.X, point.Z - center.Z); + + /// + /// 获得任意点与中心点的长度。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetLength(this Vector3 point, Vector3 center) + => new Vector2(point.X - center.X, point.Z - center.Z).Length(); + + /// + /// 将任意点以中心点为圆心,逆时针旋转并延长。 + /// + /// 任意点 + /// 中心点 + /// 旋转弧度 + /// 基于该点延伸长度 + /// + public static Vector3 RotateAndExtend(this Vector3 point, Vector3 center, float radian, float length) + { + var baseRad = point.GetRadian(center); + var baseLength = point.GetLength(center); + var rotRad = baseRad + radian; + return new Vector3( + center.X + MathF.Sin(rotRad) * (length + baseLength), + center.Y, + center.Z + MathF.Cos(rotRad) * (length + baseLength) + ); + } + + /// + /// 获得某角度所在划分区域 + /// + /// 输入弧度 + /// 区域划分数量 + /// 0度所在区域的初始Idx> + /// 是否为斜分割,默认为false + /// 是否顺时针增加,默认为false + /// + public static int RadianToRegion(this float radian, int regionNum, int baseRegionIdx = 0, bool isDiagDiv = false, bool isCw = false) + { + var sepRad = float.Pi * 2 / regionNum; + var inputAngle = radian * (isCw ? -1 : 1) + (isDiagDiv ? sepRad / 2 : 0); + var rad = (inputAngle + 4 * float.Pi) % (2 * float.Pi); + return ((int)Math.Floor(rad / sepRad) + baseRegionIdx + regionNum) % regionNum; + } + + /// + /// 将输入点左右折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointHorizon(this Vector3 point, float centerX) + => point with { X = 2 * centerX - point.X }; + + /// + /// 将输入点上下折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointVertical(this Vector3 point, float centerZ) + => point with { Z = 2 * centerZ - point.Z }; + + /// + /// 将输入点中心对称 + /// + /// 输入点 + /// 中心点 + /// + public static Vector3 PointCenterSymmetry(this Vector3 point, Vector3 center) + => point.RotateAndExtend(center, float.Pi, 0); + + /// + /// 获取给定数的指定位数 + /// + /// 给定数值 + /// 对应位数,个位为1 + /// + public static int GetDecimalDigit(this int val, int x) + { + var valStr = val.ToString(); + var length = valStr.Length; + if (x < 1 || x > length) return -1; + var digitChar = valStr[length - x]; // 从右往左取第x位 + return int.Parse(digitChar.ToString()); + } +} + +#endregion 计算函数 \ No newline at end of file diff --git a/06-EndWalker/Raid-Pandæmonium/Normal/P10n.cs b/06-EndWalker/Raid-Pandæmonium/Normal/P10n.cs index a921089..e1a0c30 100644 --- a/06-EndWalker/Raid-Pandæmonium/Normal/P10n.cs +++ b/06-EndWalker/Raid-Pandæmonium/Normal/P10n.cs @@ -3,8 +3,6 @@ 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; @@ -12,16 +10,12 @@ 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 Pandæmonium.Normal; [ScriptType(guid: "f28cc2f2-6ce2-4526-a303-56fe1c02dea8", name: "P10N", territorys: [1149], - version: "0.0.0.2", author: "Tetora", note: noteStr)] + version: "0.0.0.3", author: "Tetora", note: noteStr)] public class P10n { @@ -306,3 +300,113 @@ public static class Extensions } } } + + + +#region 计算函数 + +public static class MathTools +{ + public static float DegToRad(this float deg) => (deg + 360f) % 360f / 180f * float.Pi; + public static float RadToDeg(this float rad) => (rad + 2 * float.Pi) % (2 * float.Pi) / float.Pi * 180f; + + /// + /// 获得任意点与中心点的弧度值,以(0, 0, 1)方向为0,以(1, 0, 0)方向为pi/2。 + /// 即,逆时针方向增加。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetRadian(this Vector3 point, Vector3 center) + => MathF.Atan2(point.X - center.X, point.Z - center.Z); + + /// + /// 获得任意点与中心点的长度。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetLength(this Vector3 point, Vector3 center) + => new Vector2(point.X - center.X, point.Z - center.Z).Length(); + + /// + /// 将任意点以中心点为圆心,逆时针旋转并延长。 + /// + /// 任意点 + /// 中心点 + /// 旋转弧度 + /// 基于该点延伸长度 + /// + public static Vector3 RotateAndExtend(this Vector3 point, Vector3 center, float radian, float length) + { + var baseRad = point.GetRadian(center); + var baseLength = point.GetLength(center); + var rotRad = baseRad + radian; + return new Vector3( + center.X + MathF.Sin(rotRad) * (length + baseLength), + center.Y, + center.Z + MathF.Cos(rotRad) * (length + baseLength) + ); + } + + /// + /// 获得某角度所在划分区域 + /// + /// 输入弧度 + /// 区域划分数量 + /// 0度所在区域的初始Idx> + /// 是否为斜分割,默认为false + /// 是否顺时针增加,默认为false + /// + public static int RadianToRegion(this float radian, int regionNum, int baseRegionIdx = 0, bool isDiagDiv = false, bool isCw = false) + { + var sepRad = float.Pi * 2 / regionNum; + var inputAngle = radian * (isCw ? -1 : 1) + (isDiagDiv ? sepRad / 2 : 0); + var rad = (inputAngle + 4 * float.Pi) % (2 * float.Pi); + return ((int)Math.Floor(rad / sepRad) + baseRegionIdx + regionNum) % regionNum; + } + + /// + /// 将输入点左右折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointHorizon(this Vector3 point, float centerX) + => point with { X = 2 * centerX - point.X }; + + /// + /// 将输入点上下折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointVertical(this Vector3 point, float centerZ) + => point with { Z = 2 * centerZ - point.Z }; + + /// + /// 将输入点中心对称 + /// + /// 输入点 + /// 中心点 + /// + public static Vector3 PointCenterSymmetry(this Vector3 point, Vector3 center) + => point.RotateAndExtend(center, float.Pi, 0); + + /// + /// 获取给定数的指定位数 + /// + /// 给定数值 + /// 对应位数,个位为1 + /// + public static int GetDecimalDigit(this int val, int x) + { + var valStr = val.ToString(); + var length = valStr.Length; + if (x < 1 || x > length) return -1; + var digitChar = valStr[length - x]; // 从右往左取第x位 + return int.Parse(digitChar.ToString()); + } +} + +#endregion 计算函数 \ No newline at end of file diff --git a/06-EndWalker/Raid-Pandæmonium/Normal/P11n.cs b/06-EndWalker/Raid-Pandæmonium/Normal/P11n.cs index 906d61d..185ce1b 100644 --- a/06-EndWalker/Raid-Pandæmonium/Normal/P11n.cs +++ b/06-EndWalker/Raid-Pandæmonium/Normal/P11n.cs @@ -3,24 +3,18 @@ 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 ECommons; -using ECommons.DalamudServices; -using ECommons.GameFunctions; -using ECommons.MathHelpers; using System.Threading.Tasks; namespace P11n; [ScriptType(guid: "07be068a-65ea-4fd9-a324-9ec5326bb04b", name: "P11N", territorys: [1151], - version: "0.0.0.1", author: "Tetora", note: noteStr)] + version: "0.0.0.2", author: "Tetora", note: noteStr)] public class P11n { diff --git a/06-EndWalker/Trial/Golbez.cs b/06-EndWalker/Trial/Golbez.cs index 2f040a1..5dc5e0c 100644 --- a/06-EndWalker/Trial/Golbez.cs +++ b/06-EndWalker/Trial/Golbez.cs @@ -12,16 +12,12 @@ 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 the_Voidcast_Dais; [ScriptType(guid: "8a526afb-eefd-44ec-a105-7dc8fcd28e47", name: "高贝扎歼灭战", territorys: [1140], - version: "0.0.0.3", author: "Tetora", note: noteStr)] + version: "0.0.0.4", author: "Tetora", note: noteStr)] public class Golbez { @@ -262,3 +258,112 @@ public static class Extensions } } + + +#region 计算函数 + +public static class MathTools +{ + public static float DegToRad(this float deg) => (deg + 360f) % 360f / 180f * float.Pi; + public static float RadToDeg(this float rad) => (rad + 2 * float.Pi) % (2 * float.Pi) / float.Pi * 180f; + + /// + /// 获得任意点与中心点的弧度值,以(0, 0, 1)方向为0,以(1, 0, 0)方向为pi/2。 + /// 即,逆时针方向增加。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetRadian(this Vector3 point, Vector3 center) + => MathF.Atan2(point.X - center.X, point.Z - center.Z); + + /// + /// 获得任意点与中心点的长度。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetLength(this Vector3 point, Vector3 center) + => new Vector2(point.X - center.X, point.Z - center.Z).Length(); + + /// + /// 将任意点以中心点为圆心,逆时针旋转并延长。 + /// + /// 任意点 + /// 中心点 + /// 旋转弧度 + /// 基于该点延伸长度 + /// + public static Vector3 RotateAndExtend(this Vector3 point, Vector3 center, float radian, float length) + { + var baseRad = point.GetRadian(center); + var baseLength = point.GetLength(center); + var rotRad = baseRad + radian; + return new Vector3( + center.X + MathF.Sin(rotRad) * (length + baseLength), + center.Y, + center.Z + MathF.Cos(rotRad) * (length + baseLength) + ); + } + + /// + /// 获得某角度所在划分区域 + /// + /// 输入弧度 + /// 区域划分数量 + /// 0度所在区域的初始Idx> + /// 是否为斜分割,默认为false + /// 是否顺时针增加,默认为false + /// + public static int RadianToRegion(this float radian, int regionNum, int baseRegionIdx = 0, bool isDiagDiv = false, bool isCw = false) + { + var sepRad = float.Pi * 2 / regionNum; + var inputAngle = radian * (isCw ? -1 : 1) + (isDiagDiv ? sepRad / 2 : 0); + var rad = (inputAngle + 4 * float.Pi) % (2 * float.Pi); + return ((int)Math.Floor(rad / sepRad) + baseRegionIdx + regionNum) % regionNum; + } + + /// + /// 将输入点左右折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointHorizon(this Vector3 point, float centerX) + => point with { X = 2 * centerX - point.X }; + + /// + /// 将输入点上下折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointVertical(this Vector3 point, float centerZ) + => point with { Z = 2 * centerZ - point.Z }; + + /// + /// 将输入点中心对称 + /// + /// 输入点 + /// 中心点 + /// + public static Vector3 PointCenterSymmetry(this Vector3 point, Vector3 center) + => point.RotateAndExtend(center, float.Pi, 0); + + /// + /// 获取给定数的指定位数 + /// + /// 给定数值 + /// 对应位数,个位为1 + /// + public static int GetDecimalDigit(this int val, int x) + { + var valStr = val.ToString(); + var length = valStr.Length; + if (x < 1 || x > length) return -1; + var digitChar = valStr[length - x]; // 从右往左取第x位 + return int.Parse(digitChar.ToString()); + } +} + +#endregion 计算函数 \ No newline at end of file diff --git a/06-EndWalker/Trial/Hydaelyn.cs b/06-EndWalker/Trial/Hydaelyn.cs index 358eabb..799456c 100644 --- a/06-EndWalker/Trial/Hydaelyn.cs +++ b/06-EndWalker/Trial/Hydaelyn.cs @@ -11,16 +11,12 @@ using KodakkuAssist.Script; using KodakkuAssist.Module.GameEvent; using KodakkuAssist.Module.Draw; using KodakkuAssist.Data; -using ECommons; -using ECommons.DalamudServices; -using ECommons.GameFunctions; -using ECommons.MathHelpers; using System.Threading.Tasks; namespace Hydaelyn; [ScriptType(guid: "d9106d0c-3c5e-4feb-ae49-f27a70acf39f", name: "海德林歼灭战", territorys: [995], - version: "0.0.0.1", author: "Tetora", note: noteStr)] + version: "0.0.0.2", author: "Tetora", note: noteStr)] public class Hydaelyn { @@ -377,4 +373,114 @@ public static class Extensions } } } -#endregion \ No newline at end of file +#endregion + + + +#region 计算函数 + +public static class MathTools +{ + public static float DegToRad(this float deg) => (deg + 360f) % 360f / 180f * float.Pi; + public static float RadToDeg(this float rad) => (rad + 2 * float.Pi) % (2 * float.Pi) / float.Pi * 180f; + + /// + /// 获得任意点与中心点的弧度值,以(0, 0, 1)方向为0,以(1, 0, 0)方向为pi/2。 + /// 即,逆时针方向增加。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetRadian(this Vector3 point, Vector3 center) + => MathF.Atan2(point.X - center.X, point.Z - center.Z); + + /// + /// 获得任意点与中心点的长度。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetLength(this Vector3 point, Vector3 center) + => new Vector2(point.X - center.X, point.Z - center.Z).Length(); + + /// + /// 将任意点以中心点为圆心,逆时针旋转并延长。 + /// + /// 任意点 + /// 中心点 + /// 旋转弧度 + /// 基于该点延伸长度 + /// + public static Vector3 RotateAndExtend(this Vector3 point, Vector3 center, float radian, float length) + { + var baseRad = point.GetRadian(center); + var baseLength = point.GetLength(center); + var rotRad = baseRad + radian; + return new Vector3( + center.X + MathF.Sin(rotRad) * (length + baseLength), + center.Y, + center.Z + MathF.Cos(rotRad) * (length + baseLength) + ); + } + + /// + /// 获得某角度所在划分区域 + /// + /// 输入弧度 + /// 区域划分数量 + /// 0度所在区域的初始Idx> + /// 是否为斜分割,默认为false + /// 是否顺时针增加,默认为false + /// + public static int RadianToRegion(this float radian, int regionNum, int baseRegionIdx = 0, bool isDiagDiv = false, bool isCw = false) + { + var sepRad = float.Pi * 2 / regionNum; + var inputAngle = radian * (isCw ? -1 : 1) + (isDiagDiv ? sepRad / 2 : 0); + var rad = (inputAngle + 4 * float.Pi) % (2 * float.Pi); + return ((int)Math.Floor(rad / sepRad) + baseRegionIdx + regionNum) % regionNum; + } + + /// + /// 将输入点左右折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointHorizon(this Vector3 point, float centerX) + => point with { X = 2 * centerX - point.X }; + + /// + /// 将输入点上下折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointVertical(this Vector3 point, float centerZ) + => point with { Z = 2 * centerZ - point.Z }; + + /// + /// 将输入点中心对称 + /// + /// 输入点 + /// 中心点 + /// + public static Vector3 PointCenterSymmetry(this Vector3 point, Vector3 center) + => point.RotateAndExtend(center, float.Pi, 0); + + /// + /// 获取给定数的指定位数 + /// + /// 给定数值 + /// 对应位数,个位为1 + /// + public static int GetDecimalDigit(this int val, int x) + { + var valStr = val.ToString(); + var length = valStr.Length; + if (x < 1 || x > length) return -1; + var digitChar = valStr[length - x]; // 从右往左取第x位 + return int.Parse(digitChar.ToString()); + } +} + +#endregion 计算函数 \ No newline at end of file diff --git a/06-EndWalker/Trial/Zeromus.cs b/06-EndWalker/Trial/Zeromus.cs index 611bcf4..ac27b42 100644 --- a/06-EndWalker/Trial/Zeromus.cs +++ b/06-EndWalker/Trial/Zeromus.cs @@ -3,24 +3,18 @@ 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 ECommons; -using ECommons.DalamudServices; -using ECommons.GameFunctions; -using ECommons.MathHelpers; using System.Threading.Tasks; namespace Zeromus; [ScriptType(guid: "1d6d7238-e986-408c-9c25-b24955542ee0", name: "泽罗姆斯歼灭战", territorys: [1168], - version: "0.0.0.2", author: "Tetora", note: noteStr)] + version: "0.0.0.3", author: "Tetora", note: noteStr)] public class Zeromus { @@ -391,4 +385,114 @@ public static class EventExtensions { return JsonConvert.DeserializeObject(@event["Param"]); } -} \ No newline at end of file +} + + + +#region 计算函数 + +public static class MathTools +{ + public static float DegToRad(this float deg) => (deg + 360f) % 360f / 180f * float.Pi; + public static float RadToDeg(this float rad) => (rad + 2 * float.Pi) % (2 * float.Pi) / float.Pi * 180f; + + /// + /// 获得任意点与中心点的弧度值,以(0, 0, 1)方向为0,以(1, 0, 0)方向为pi/2。 + /// 即,逆时针方向增加。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetRadian(this Vector3 point, Vector3 center) + => MathF.Atan2(point.X - center.X, point.Z - center.Z); + + /// + /// 获得任意点与中心点的长度。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetLength(this Vector3 point, Vector3 center) + => new Vector2(point.X - center.X, point.Z - center.Z).Length(); + + /// + /// 将任意点以中心点为圆心,逆时针旋转并延长。 + /// + /// 任意点 + /// 中心点 + /// 旋转弧度 + /// 基于该点延伸长度 + /// + public static Vector3 RotateAndExtend(this Vector3 point, Vector3 center, float radian, float length) + { + var baseRad = point.GetRadian(center); + var baseLength = point.GetLength(center); + var rotRad = baseRad + radian; + return new Vector3( + center.X + MathF.Sin(rotRad) * (length + baseLength), + center.Y, + center.Z + MathF.Cos(rotRad) * (length + baseLength) + ); + } + + /// + /// 获得某角度所在划分区域 + /// + /// 输入弧度 + /// 区域划分数量 + /// 0度所在区域的初始Idx> + /// 是否为斜分割,默认为false + /// 是否顺时针增加,默认为false + /// + public static int RadianToRegion(this float radian, int regionNum, int baseRegionIdx = 0, bool isDiagDiv = false, bool isCw = false) + { + var sepRad = float.Pi * 2 / regionNum; + var inputAngle = radian * (isCw ? -1 : 1) + (isDiagDiv ? sepRad / 2 : 0); + var rad = (inputAngle + 4 * float.Pi) % (2 * float.Pi); + return ((int)Math.Floor(rad / sepRad) + baseRegionIdx + regionNum) % regionNum; + } + + /// + /// 将输入点左右折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointHorizon(this Vector3 point, float centerX) + => point with { X = 2 * centerX - point.X }; + + /// + /// 将输入点上下折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointVertical(this Vector3 point, float centerZ) + => point with { Z = 2 * centerZ - point.Z }; + + /// + /// 将输入点中心对称 + /// + /// 输入点 + /// 中心点 + /// + public static Vector3 PointCenterSymmetry(this Vector3 point, Vector3 center) + => point.RotateAndExtend(center, float.Pi, 0); + + /// + /// 获取给定数的指定位数 + /// + /// 给定数值 + /// 对应位数,个位为1 + /// + public static int GetDecimalDigit(this int val, int x) + { + var valStr = val.ToString(); + var length = valStr.Length; + if (x < 1 || x > length) return -1; + var digitChar = valStr[length - x]; // 从右往左取第x位 + return int.Parse(digitChar.ToString()); + } +} + +#endregion 计算函数 \ No newline at end of file diff --git a/06-EndWalker/Trials-Extreme/Golbez(Extreme).cs b/06-EndWalker/Trials-Extreme/Golbez(Extreme).cs index 4a59e6c..95243c7 100644 --- a/06-EndWalker/Trials-Extreme/Golbez(Extreme).cs +++ b/06-EndWalker/Trials-Extreme/Golbez(Extreme).cs @@ -3,8 +3,6 @@ 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; @@ -12,16 +10,12 @@ 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 the_Voidcast_Dais_Extreme; [ScriptType(guid: "ef5d2622-37eb-45ba-a40a-b93f494dd097", name: "高贝扎歼殛战", territorys: [1141], - version: "0.0.0.1", author: "Tetora", note: noteStr)] + version: "0.0.0.2", author: "Tetora", note: noteStr)] public class Golbez_Extreme { @@ -457,4 +451,114 @@ public static class EventExtensions { return JsonConvert.DeserializeObject(@event["Param"]); } -} \ No newline at end of file +} + + + +#region 计算函数 + +public static class MathTools +{ + public static float DegToRad(this float deg) => (deg + 360f) % 360f / 180f * float.Pi; + public static float RadToDeg(this float rad) => (rad + 2 * float.Pi) % (2 * float.Pi) / float.Pi * 180f; + + /// + /// 获得任意点与中心点的弧度值,以(0, 0, 1)方向为0,以(1, 0, 0)方向为pi/2。 + /// 即,逆时针方向增加。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetRadian(this Vector3 point, Vector3 center) + => MathF.Atan2(point.X - center.X, point.Z - center.Z); + + /// + /// 获得任意点与中心点的长度。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetLength(this Vector3 point, Vector3 center) + => new Vector2(point.X - center.X, point.Z - center.Z).Length(); + + /// + /// 将任意点以中心点为圆心,逆时针旋转并延长。 + /// + /// 任意点 + /// 中心点 + /// 旋转弧度 + /// 基于该点延伸长度 + /// + public static Vector3 RotateAndExtend(this Vector3 point, Vector3 center, float radian, float length) + { + var baseRad = point.GetRadian(center); + var baseLength = point.GetLength(center); + var rotRad = baseRad + radian; + return new Vector3( + center.X + MathF.Sin(rotRad) * (length + baseLength), + center.Y, + center.Z + MathF.Cos(rotRad) * (length + baseLength) + ); + } + + /// + /// 获得某角度所在划分区域 + /// + /// 输入弧度 + /// 区域划分数量 + /// 0度所在区域的初始Idx> + /// 是否为斜分割,默认为false + /// 是否顺时针增加,默认为false + /// + public static int RadianToRegion(this float radian, int regionNum, int baseRegionIdx = 0, bool isDiagDiv = false, bool isCw = false) + { + var sepRad = float.Pi * 2 / regionNum; + var inputAngle = radian * (isCw ? -1 : 1) + (isDiagDiv ? sepRad / 2 : 0); + var rad = (inputAngle + 4 * float.Pi) % (2 * float.Pi); + return ((int)Math.Floor(rad / sepRad) + baseRegionIdx + regionNum) % regionNum; + } + + /// + /// 将输入点左右折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointHorizon(this Vector3 point, float centerX) + => point with { X = 2 * centerX - point.X }; + + /// + /// 将输入点上下折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointVertical(this Vector3 point, float centerZ) + => point with { Z = 2 * centerZ - point.Z }; + + /// + /// 将输入点中心对称 + /// + /// 输入点 + /// 中心点 + /// + public static Vector3 PointCenterSymmetry(this Vector3 point, Vector3 center) + => point.RotateAndExtend(center, float.Pi, 0); + + /// + /// 获取给定数的指定位数 + /// + /// 给定数值 + /// 对应位数,个位为1 + /// + public static int GetDecimalDigit(this int val, int x) + { + var valStr = val.ToString(); + var length = valStr.Length; + if (x < 1 || x > length) return -1; + var digitChar = valStr[length - x]; // 从右往左取第x位 + return int.Parse(digitChar.ToString()); + } +} + +#endregion 计算函数 \ No newline at end of file diff --git a/07-Dawntrail/CosmicExploration/SinusArdorum.cs b/07-Dawntrail/CosmicExploration/SinusArdorum.cs index 7e46dd9..229c88c 100644 --- a/07-Dawntrail/CosmicExploration/SinusArdorum.cs +++ b/07-Dawntrail/CosmicExploration/SinusArdorum.cs @@ -12,16 +12,12 @@ 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 SinusArdorum; [ScriptType(guid: "8f9e094e-2aa2-4dfc-9020-ac9dac53e525", name: "宇宙探索小工具", territorys: [1237], - version: "0.0.0.1", author: "Tetora", note: noteStr)] + version: "0.0.0.2", author: "Tetora", note: noteStr)] public class SinusArdorum { @@ -413,4 +409,114 @@ public static class EventExtensions { return JsonConvert.DeserializeObject(@event["Param"]); } -} \ No newline at end of file +} + + + +#region 计算函数 + +public static class MathTools +{ + public static float DegToRad(this float deg) => (deg + 360f) % 360f / 180f * float.Pi; + public static float RadToDeg(this float rad) => (rad + 2 * float.Pi) % (2 * float.Pi) / float.Pi * 180f; + + /// + /// 获得任意点与中心点的弧度值,以(0, 0, 1)方向为0,以(1, 0, 0)方向为pi/2。 + /// 即,逆时针方向增加。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetRadian(this Vector3 point, Vector3 center) + => MathF.Atan2(point.X - center.X, point.Z - center.Z); + + /// + /// 获得任意点与中心点的长度。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetLength(this Vector3 point, Vector3 center) + => new Vector2(point.X - center.X, point.Z - center.Z).Length(); + + /// + /// 将任意点以中心点为圆心,逆时针旋转并延长。 + /// + /// 任意点 + /// 中心点 + /// 旋转弧度 + /// 基于该点延伸长度 + /// + public static Vector3 RotateAndExtend(this Vector3 point, Vector3 center, float radian, float length) + { + var baseRad = point.GetRadian(center); + var baseLength = point.GetLength(center); + var rotRad = baseRad + radian; + return new Vector3( + center.X + MathF.Sin(rotRad) * (length + baseLength), + center.Y, + center.Z + MathF.Cos(rotRad) * (length + baseLength) + ); + } + + /// + /// 获得某角度所在划分区域 + /// + /// 输入弧度 + /// 区域划分数量 + /// 0度所在区域的初始Idx> + /// 是否为斜分割,默认为false + /// 是否顺时针增加,默认为false + /// + public static int RadianToRegion(this float radian, int regionNum, int baseRegionIdx = 0, bool isDiagDiv = false, bool isCw = false) + { + var sepRad = float.Pi * 2 / regionNum; + var inputAngle = radian * (isCw ? -1 : 1) + (isDiagDiv ? sepRad / 2 : 0); + var rad = (inputAngle + 4 * float.Pi) % (2 * float.Pi); + return ((int)Math.Floor(rad / sepRad) + baseRegionIdx + regionNum) % regionNum; + } + + /// + /// 将输入点左右折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointHorizon(this Vector3 point, float centerX) + => point with { X = 2 * centerX - point.X }; + + /// + /// 将输入点上下折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointVertical(this Vector3 point, float centerZ) + => point with { Z = 2 * centerZ - point.Z }; + + /// + /// 将输入点中心对称 + /// + /// 输入点 + /// 中心点 + /// + public static Vector3 PointCenterSymmetry(this Vector3 point, Vector3 center) + => point.RotateAndExtend(center, float.Pi, 0); + + /// + /// 获取给定数的指定位数 + /// + /// 给定数值 + /// 对应位数,个位为1 + /// + public static int GetDecimalDigit(this int val, int x) + { + var valStr = val.ToString(); + var length = valStr.Length; + if (x < 1 || x > length) return -1; + var digitChar = valStr[length - x]; // 从右往左取第x位 + return int.Parse(digitChar.ToString()); + } +} + +#endregion 计算函数 \ No newline at end of file diff --git a/07-Dawntrail/FRU_DLC.cs b/07-Dawntrail/FRU_DLC.cs index 94bc3c1..8e05c48 100644 --- a/07-Dawntrail/FRU_DLC.cs +++ b/07-Dawntrail/FRU_DLC.cs @@ -3,8 +3,6 @@ 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; @@ -12,16 +10,12 @@ using KodakkuAssist.Module.GameEvent; using KodakkuAssist.Module.Draw; using KodakkuAssist.Data; using KodakkuAssist.Extensions; -// using ECommons; -// using ECommons.DalamudServices; -// ECommons.GameFunctions; -// using ECommons.MathHelpers; using System.Threading.Tasks; namespace FRU_DLC; [ScriptType(guid: "981e39b5-ea99-4b85-a4b1-0e698d4c4036", name: "FRU_DLC [光暗未来绝境战_额外补充]", territorys: [1238], - version: "0.0.0.3", author: "Tetora", note: noteStr)] + version: "0.0.0.4", author: "Tetora", note: noteStr)] public class FRU_DLC { diff --git a/Celestium/Celestium.cs b/Celestium/Celestium.cs index f31b4b3..ba55ed9 100644 --- a/Celestium/Celestium.cs +++ b/Celestium/Celestium.cs @@ -12,17 +12,13 @@ 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 Celestium; [ScriptType(guid: "7703f1a9-5698-4896-8908-bb8e415c1321", name: "天青斗场", territorys: [796], - version: "0.0.0.5", author: "Tetora", note: noteStr)] + version: "0.0.0.6", author: "Tetora", note: noteStr)] public class Celestium { const string noteStr = @@ -278,3 +274,112 @@ public static class EventExtensions } } + + +#region 计算函数 + +public static class MathTools +{ + public static float DegToRad(this float deg) => (deg + 360f) % 360f / 180f * float.Pi; + public static float RadToDeg(this float rad) => (rad + 2 * float.Pi) % (2 * float.Pi) / float.Pi * 180f; + + /// + /// 获得任意点与中心点的弧度值,以(0, 0, 1)方向为0,以(1, 0, 0)方向为pi/2。 + /// 即,逆时针方向增加。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetRadian(this Vector3 point, Vector3 center) + => MathF.Atan2(point.X - center.X, point.Z - center.Z); + + /// + /// 获得任意点与中心点的长度。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetLength(this Vector3 point, Vector3 center) + => new Vector2(point.X - center.X, point.Z - center.Z).Length(); + + /// + /// 将任意点以中心点为圆心,逆时针旋转并延长。 + /// + /// 任意点 + /// 中心点 + /// 旋转弧度 + /// 基于该点延伸长度 + /// + public static Vector3 RotateAndExtend(this Vector3 point, Vector3 center, float radian, float length) + { + var baseRad = point.GetRadian(center); + var baseLength = point.GetLength(center); + var rotRad = baseRad + radian; + return new Vector3( + center.X + MathF.Sin(rotRad) * (length + baseLength), + center.Y, + center.Z + MathF.Cos(rotRad) * (length + baseLength) + ); + } + + /// + /// 获得某角度所在划分区域 + /// + /// 输入弧度 + /// 区域划分数量 + /// 0度所在区域的初始Idx> + /// 是否为斜分割,默认为false + /// 是否顺时针增加,默认为false + /// + public static int RadianToRegion(this float radian, int regionNum, int baseRegionIdx = 0, bool isDiagDiv = false, bool isCw = false) + { + var sepRad = float.Pi * 2 / regionNum; + var inputAngle = radian * (isCw ? -1 : 1) + (isDiagDiv ? sepRad / 2 : 0); + var rad = (inputAngle + 4 * float.Pi) % (2 * float.Pi); + return ((int)Math.Floor(rad / sepRad) + baseRegionIdx + regionNum) % regionNum; + } + + /// + /// 将输入点左右折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointHorizon(this Vector3 point, float centerX) + => point with { X = 2 * centerX - point.X }; + + /// + /// 将输入点上下折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointVertical(this Vector3 point, float centerZ) + => point with { Z = 2 * centerZ - point.Z }; + + /// + /// 将输入点中心对称 + /// + /// 输入点 + /// 中心点 + /// + public static Vector3 PointCenterSymmetry(this Vector3 point, Vector3 center) + => point.RotateAndExtend(center, float.Pi, 0); + + /// + /// 获取给定数的指定位数 + /// + /// 给定数值 + /// 对应位数,个位为1 + /// + public static int GetDecimalDigit(this int val, int x) + { + var valStr = val.ToString(); + var length = valStr.Length; + if (x < 1 || x > length) return -1; + var digitChar = valStr[length - x]; // 从右往左取第x位 + return int.Parse(digitChar.ToString()); + } +} + +#endregion 计算函数 \ No newline at end of file diff --git a/Deep_Dungeon/Eureka_Orthos.cs b/Deep_Dungeon/Eureka_Orthos.cs index c479222..370684b 100644 --- a/Deep_Dungeon/Eureka_Orthos.cs +++ b/Deep_Dungeon/Eureka_Orthos.cs @@ -12,10 +12,6 @@ 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; @@ -23,7 +19,7 @@ namespace Eureka_Orthos; [ScriptType(guid: "5e8a4051-53f7-4eb3-bb32-b18df8b113aa", name: "正统优雷卡", territorys: [1099,1100,1101,1102,1103,1104,1105,1106,1107,1108], - version: "0.0.0.31", author: "Tetora", note: noteStr)] + version: "0.0.0.32", author: "Tetora", note: noteStr)] public class Eureka_Orthos { const string noteStr = @@ -1652,3 +1648,114 @@ public static class EventExtensions return JsonConvert.DeserializeObject(@event["Param"]); } } + + + + +#region 计算函数 + +public static class MathTools +{ + public static float DegToRad(this float deg) => (deg + 360f) % 360f / 180f * float.Pi; + public static float RadToDeg(this float rad) => (rad + 2 * float.Pi) % (2 * float.Pi) / float.Pi * 180f; + + /// + /// 获得任意点与中心点的弧度值,以(0, 0, 1)方向为0,以(1, 0, 0)方向为pi/2。 + /// 即,逆时针方向增加。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetRadian(this Vector3 point, Vector3 center) + => MathF.Atan2(point.X - center.X, point.Z - center.Z); + + /// + /// 获得任意点与中心点的长度。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetLength(this Vector3 point, Vector3 center) + => new Vector2(point.X - center.X, point.Z - center.Z).Length(); + + /// + /// 将任意点以中心点为圆心,逆时针旋转并延长。 + /// + /// 任意点 + /// 中心点 + /// 旋转弧度 + /// 基于该点延伸长度 + /// + public static Vector3 RotateAndExtend(this Vector3 point, Vector3 center, float radian, float length) + { + var baseRad = point.GetRadian(center); + var baseLength = point.GetLength(center); + var rotRad = baseRad + radian; + return new Vector3( + center.X + MathF.Sin(rotRad) * (length + baseLength), + center.Y, + center.Z + MathF.Cos(rotRad) * (length + baseLength) + ); + } + + /// + /// 获得某角度所在划分区域 + /// + /// 输入弧度 + /// 区域划分数量 + /// 0度所在区域的初始Idx> + /// 是否为斜分割,默认为false + /// 是否顺时针增加,默认为false + /// + public static int RadianToRegion(this float radian, int regionNum, int baseRegionIdx = 0, bool isDiagDiv = false, bool isCw = false) + { + var sepRad = float.Pi * 2 / regionNum; + var inputAngle = radian * (isCw ? -1 : 1) + (isDiagDiv ? sepRad / 2 : 0); + var rad = (inputAngle + 4 * float.Pi) % (2 * float.Pi); + return ((int)Math.Floor(rad / sepRad) + baseRegionIdx + regionNum) % regionNum; + } + + /// + /// 将输入点左右折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointHorizon(this Vector3 point, float centerX) + => point with { X = 2 * centerX - point.X }; + + /// + /// 将输入点上下折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointVertical(this Vector3 point, float centerZ) + => point with { Z = 2 * centerZ - point.Z }; + + /// + /// 将输入点中心对称 + /// + /// 输入点 + /// 中心点 + /// + public static Vector3 PointCenterSymmetry(this Vector3 point, Vector3 center) + => point.RotateAndExtend(center, float.Pi, 0); + + /// + /// 获取给定数的指定位数 + /// + /// 给定数值 + /// 对应位数,个位为1 + /// + public static int GetDecimalDigit(this int val, int x) + { + var valStr = val.ToString(); + var length = valStr.Length; + if (x < 1 || x > length) return -1; + var digitChar = valStr[length - x]; // 从右往左取第x位 + return int.Parse(digitChar.ToString()); + } +} + +#endregion 计算函数 \ No newline at end of file diff --git a/Deep_Dungeon/the_Palace_of_the_Dead.cs b/Deep_Dungeon/the_Palace_of_the_Dead.cs index dee06b3..724ee8b 100644 --- a/Deep_Dungeon/the_Palace_of_the_Dead.cs +++ b/Deep_Dungeon/the_Palace_of_the_Dead.cs @@ -3,8 +3,6 @@ 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; @@ -12,17 +10,13 @@ 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 the_Palace_of_the_Dead; [ScriptType(guid: "4210c323-eba4-4d67-a7e7-b90799494729", name: "死者宫殿", author: "Tetora", territorys: [561,562,563,564,565,593,594,595,596,597,598,599,600,601,602,603,604,605,606,607], - version: "0.0.0.6",note: noteStr)] + version: "0.0.0.7",note: noteStr)] public class the_Palace_of_the_Dead { @@ -1244,4 +1238,114 @@ public static class EventExtensions { return JsonConvert.DeserializeObject(@event["Param"]); } -} \ No newline at end of file +} + + + +#region 计算函数 + +public static class MathTools +{ + public static float DegToRad(this float deg) => (deg + 360f) % 360f / 180f * float.Pi; + public static float RadToDeg(this float rad) => (rad + 2 * float.Pi) % (2 * float.Pi) / float.Pi * 180f; + + /// + /// 获得任意点与中心点的弧度值,以(0, 0, 1)方向为0,以(1, 0, 0)方向为pi/2。 + /// 即,逆时针方向增加。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetRadian(this Vector3 point, Vector3 center) + => MathF.Atan2(point.X - center.X, point.Z - center.Z); + + /// + /// 获得任意点与中心点的长度。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetLength(this Vector3 point, Vector3 center) + => new Vector2(point.X - center.X, point.Z - center.Z).Length(); + + /// + /// 将任意点以中心点为圆心,逆时针旋转并延长。 + /// + /// 任意点 + /// 中心点 + /// 旋转弧度 + /// 基于该点延伸长度 + /// + public static Vector3 RotateAndExtend(this Vector3 point, Vector3 center, float radian, float length) + { + var baseRad = point.GetRadian(center); + var baseLength = point.GetLength(center); + var rotRad = baseRad + radian; + return new Vector3( + center.X + MathF.Sin(rotRad) * (length + baseLength), + center.Y, + center.Z + MathF.Cos(rotRad) * (length + baseLength) + ); + } + + /// + /// 获得某角度所在划分区域 + /// + /// 输入弧度 + /// 区域划分数量 + /// 0度所在区域的初始Idx> + /// 是否为斜分割,默认为false + /// 是否顺时针增加,默认为false + /// + public static int RadianToRegion(this float radian, int regionNum, int baseRegionIdx = 0, bool isDiagDiv = false, bool isCw = false) + { + var sepRad = float.Pi * 2 / regionNum; + var inputAngle = radian * (isCw ? -1 : 1) + (isDiagDiv ? sepRad / 2 : 0); + var rad = (inputAngle + 4 * float.Pi) % (2 * float.Pi); + return ((int)Math.Floor(rad / sepRad) + baseRegionIdx + regionNum) % regionNum; + } + + /// + /// 将输入点左右折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointHorizon(this Vector3 point, float centerX) + => point with { X = 2 * centerX - point.X }; + + /// + /// 将输入点上下折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointVertical(this Vector3 point, float centerZ) + => point with { Z = 2 * centerZ - point.Z }; + + /// + /// 将输入点中心对称 + /// + /// 输入点 + /// 中心点 + /// + public static Vector3 PointCenterSymmetry(this Vector3 point, Vector3 center) + => point.RotateAndExtend(center, float.Pi, 0); + + /// + /// 获取给定数的指定位数 + /// + /// 给定数值 + /// 对应位数,个位为1 + /// + public static int GetDecimalDigit(this int val, int x) + { + var valStr = val.ToString(); + var length = valStr.Length; + if (x < 1 || x > length) return -1; + var digitChar = valStr[length - x]; // 从右往左取第x位 + return int.Parse(digitChar.ToString()); + } +} + +#endregion 计算函数 \ No newline at end of file diff --git a/Fate/Archaeotania.cs b/Fate/Archaeotania.cs index 04756b1..785e269 100644 --- a/Fate/Archaeotania.cs +++ b/Fate/Archaeotania.cs @@ -12,16 +12,12 @@ 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 TheHead_theTail_theWholeDamnedThing; [ScriptType(guid: "f11c3069-d163-41dd-904e-b016cfcf089c", name: "灾厄的古塔尼亚之深海讨伐战", territorys: [818], - version: "0.0.0.4", author: "Tetora", note: noteStr)] + version: "0.0.0.5", author: "Tetora", note: noteStr)] public class Archaeotania { diff --git a/Fate/Chi.cs b/Fate/Chi.cs index 0bab32b..91557ef 100644 --- a/Fate/Chi.cs +++ b/Fate/Chi.cs @@ -12,16 +12,12 @@ 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 Omicron_Recall_Killing_Order; [ScriptType(guid: "b73d07ef-aa90-45a9-ab4b-fc3ccce8791b", name: "侵略兵器召回指令:破坏侵略兵器希", territorys: [960], - version: "0.0.0.2", author: "Tetora", note: noteStr)] + version: "0.0.0.3", author: "Tetora", note: noteStr)] public class Chi { @@ -335,3 +331,113 @@ public static class Extensions } } } + + + +#region 计算函数 + +public static class MathTools +{ + public static float DegToRad(this float deg) => (deg + 360f) % 360f / 180f * float.Pi; + public static float RadToDeg(this float rad) => (rad + 2 * float.Pi) % (2 * float.Pi) / float.Pi * 180f; + + /// + /// 获得任意点与中心点的弧度值,以(0, 0, 1)方向为0,以(1, 0, 0)方向为pi/2。 + /// 即,逆时针方向增加。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetRadian(this Vector3 point, Vector3 center) + => MathF.Atan2(point.X - center.X, point.Z - center.Z); + + /// + /// 获得任意点与中心点的长度。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetLength(this Vector3 point, Vector3 center) + => new Vector2(point.X - center.X, point.Z - center.Z).Length(); + + /// + /// 将任意点以中心点为圆心,逆时针旋转并延长。 + /// + /// 任意点 + /// 中心点 + /// 旋转弧度 + /// 基于该点延伸长度 + /// + public static Vector3 RotateAndExtend(this Vector3 point, Vector3 center, float radian, float length) + { + var baseRad = point.GetRadian(center); + var baseLength = point.GetLength(center); + var rotRad = baseRad + radian; + return new Vector3( + center.X + MathF.Sin(rotRad) * (length + baseLength), + center.Y, + center.Z + MathF.Cos(rotRad) * (length + baseLength) + ); + } + + /// + /// 获得某角度所在划分区域 + /// + /// 输入弧度 + /// 区域划分数量 + /// 0度所在区域的初始Idx> + /// 是否为斜分割,默认为false + /// 是否顺时针增加,默认为false + /// + public static int RadianToRegion(this float radian, int regionNum, int baseRegionIdx = 0, bool isDiagDiv = false, bool isCw = false) + { + var sepRad = float.Pi * 2 / regionNum; + var inputAngle = radian * (isCw ? -1 : 1) + (isDiagDiv ? sepRad / 2 : 0); + var rad = (inputAngle + 4 * float.Pi) % (2 * float.Pi); + return ((int)Math.Floor(rad / sepRad) + baseRegionIdx + regionNum) % regionNum; + } + + /// + /// 将输入点左右折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointHorizon(this Vector3 point, float centerX) + => point with { X = 2 * centerX - point.X }; + + /// + /// 将输入点上下折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointVertical(this Vector3 point, float centerZ) + => point with { Z = 2 * centerZ - point.Z }; + + /// + /// 将输入点中心对称 + /// + /// 输入点 + /// 中心点 + /// + public static Vector3 PointCenterSymmetry(this Vector3 point, Vector3 center) + => point.RotateAndExtend(center, float.Pi, 0); + + /// + /// 获取给定数的指定位数 + /// + /// 给定数值 + /// 对应位数,个位为1 + /// + public static int GetDecimalDigit(this int val, int x) + { + var valStr = val.ToString(); + var length = valStr.Length; + if (x < 1 || x > length) return -1; + var digitChar = valStr[length - x]; // 从右往左取第x位 + return int.Parse(digitChar.ToString()); + } +} + +#endregion 计算函数 \ No newline at end of file diff --git a/Fate/Daivadipa.cs b/Fate/Daivadipa.cs index 54ab238..5288c16 100644 --- a/Fate/Daivadipa.cs +++ b/Fate/Daivadipa.cs @@ -3,8 +3,6 @@ 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; @@ -12,16 +10,12 @@ 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 DevoutPilgrimsVSDaivadipa; [ScriptType(guid: "da82aeb0-9635-4f13-a1c1-39a0c859f596", name: "兽道诸神信仰:伪神降临", territorys: [957], - version: "0.0.0.4", author: "Tetora", note: noteStr)] + version: "0.0.0.5", author: "Tetora", note: noteStr)] public class Daivadipa { @@ -400,3 +394,113 @@ public static class EventExtensions return JsonConvert.DeserializeObject(@event["Param"]); } } + + + +#region 计算函数 + +public static class MathTools +{ + public static float DegToRad(this float deg) => (deg + 360f) % 360f / 180f * float.Pi; + public static float RadToDeg(this float rad) => (rad + 2 * float.Pi) % (2 * float.Pi) / float.Pi * 180f; + + /// + /// 获得任意点与中心点的弧度值,以(0, 0, 1)方向为0,以(1, 0, 0)方向为pi/2。 + /// 即,逆时针方向增加。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetRadian(this Vector3 point, Vector3 center) + => MathF.Atan2(point.X - center.X, point.Z - center.Z); + + /// + /// 获得任意点与中心点的长度。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetLength(this Vector3 point, Vector3 center) + => new Vector2(point.X - center.X, point.Z - center.Z).Length(); + + /// + /// 将任意点以中心点为圆心,逆时针旋转并延长。 + /// + /// 任意点 + /// 中心点 + /// 旋转弧度 + /// 基于该点延伸长度 + /// + public static Vector3 RotateAndExtend(this Vector3 point, Vector3 center, float radian, float length) + { + var baseRad = point.GetRadian(center); + var baseLength = point.GetLength(center); + var rotRad = baseRad + radian; + return new Vector3( + center.X + MathF.Sin(rotRad) * (length + baseLength), + center.Y, + center.Z + MathF.Cos(rotRad) * (length + baseLength) + ); + } + + /// + /// 获得某角度所在划分区域 + /// + /// 输入弧度 + /// 区域划分数量 + /// 0度所在区域的初始Idx> + /// 是否为斜分割,默认为false + /// 是否顺时针增加,默认为false + /// + public static int RadianToRegion(this float radian, int regionNum, int baseRegionIdx = 0, bool isDiagDiv = false, bool isCw = false) + { + var sepRad = float.Pi * 2 / regionNum; + var inputAngle = radian * (isCw ? -1 : 1) + (isDiagDiv ? sepRad / 2 : 0); + var rad = (inputAngle + 4 * float.Pi) % (2 * float.Pi); + return ((int)Math.Floor(rad / sepRad) + baseRegionIdx + regionNum) % regionNum; + } + + /// + /// 将输入点左右折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointHorizon(this Vector3 point, float centerX) + => point with { X = 2 * centerX - point.X }; + + /// + /// 将输入点上下折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointVertical(this Vector3 point, float centerZ) + => point with { Z = 2 * centerZ - point.Z }; + + /// + /// 将输入点中心对称 + /// + /// 输入点 + /// 中心点 + /// + public static Vector3 PointCenterSymmetry(this Vector3 point, Vector3 center) + => point.RotateAndExtend(center, float.Pi, 0); + + /// + /// 获取给定数的指定位数 + /// + /// 给定数值 + /// 对应位数,个位为1 + /// + public static int GetDecimalDigit(this int val, int x) + { + var valStr = val.ToString(); + var length = valStr.Length; + if (x < 1 || x > length) return -1; + var digitChar = valStr[length - x]; // 从右往左取第x位 + return int.Parse(digitChar.ToString()); + } +} + +#endregion 计算函数 \ No newline at end of file diff --git a/Fate/Formidable.cs b/Fate/Formidable.cs index 4941e93..3cbab2e 100644 --- a/Fate/Formidable.cs +++ b/Fate/Formidable.cs @@ -3,8 +3,6 @@ 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; @@ -12,16 +10,12 @@ 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 A_Finale_Most_Formidable; [ScriptType(guid: "5f55a121-1fcc-48ce-a0e8-b6fbd4ce8489", name: "激斗畏惧装甲之秘密武器", territorys: [814], - version: "0.0.0.3", author: "Tetora", note: noteStr)] + version: "0.0.0.4", author: "Tetora", note: noteStr)] public class Formidable { diff --git a/Fate/Mica_the_MagicalMu.cs b/Fate/Mica_the_MagicalMu.cs index 6a6c18b..1999bf7 100644 --- a/Fate/Mica_the_MagicalMu.cs +++ b/Fate/Mica_the_MagicalMu.cs @@ -3,8 +3,6 @@ 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; @@ -12,17 +10,13 @@ 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 Mascot_Murder; [ScriptType(guid: "22134617-0ca4-463e-a40d-675ef1c20cf2", name: "亩鼠米卡:盛装巡游皆大欢喜", territorys: [1192], - version: "0.0.0.2", author: "Tetora", note: noteStr)] + version: "0.0.0.3", author: "Tetora", note: noteStr)] public class Mica_the_Magical_Mu { @@ -315,3 +309,113 @@ public static class Extensions } } } + + + +#region 计算函数 + +public static class MathTools +{ + public static float DegToRad(this float deg) => (deg + 360f) % 360f / 180f * float.Pi; + public static float RadToDeg(this float rad) => (rad + 2 * float.Pi) % (2 * float.Pi) / float.Pi * 180f; + + /// + /// 获得任意点与中心点的弧度值,以(0, 0, 1)方向为0,以(1, 0, 0)方向为pi/2。 + /// 即,逆时针方向增加。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetRadian(this Vector3 point, Vector3 center) + => MathF.Atan2(point.X - center.X, point.Z - center.Z); + + /// + /// 获得任意点与中心点的长度。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetLength(this Vector3 point, Vector3 center) + => new Vector2(point.X - center.X, point.Z - center.Z).Length(); + + /// + /// 将任意点以中心点为圆心,逆时针旋转并延长。 + /// + /// 任意点 + /// 中心点 + /// 旋转弧度 + /// 基于该点延伸长度 + /// + public static Vector3 RotateAndExtend(this Vector3 point, Vector3 center, float radian, float length) + { + var baseRad = point.GetRadian(center); + var baseLength = point.GetLength(center); + var rotRad = baseRad + radian; + return new Vector3( + center.X + MathF.Sin(rotRad) * (length + baseLength), + center.Y, + center.Z + MathF.Cos(rotRad) * (length + baseLength) + ); + } + + /// + /// 获得某角度所在划分区域 + /// + /// 输入弧度 + /// 区域划分数量 + /// 0度所在区域的初始Idx> + /// 是否为斜分割,默认为false + /// 是否顺时针增加,默认为false + /// + public static int RadianToRegion(this float radian, int regionNum, int baseRegionIdx = 0, bool isDiagDiv = false, bool isCw = false) + { + var sepRad = float.Pi * 2 / regionNum; + var inputAngle = radian * (isCw ? -1 : 1) + (isDiagDiv ? sepRad / 2 : 0); + var rad = (inputAngle + 4 * float.Pi) % (2 * float.Pi); + return ((int)Math.Floor(rad / sepRad) + baseRegionIdx + regionNum) % regionNum; + } + + /// + /// 将输入点左右折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointHorizon(this Vector3 point, float centerX) + => point with { X = 2 * centerX - point.X }; + + /// + /// 将输入点上下折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointVertical(this Vector3 point, float centerZ) + => point with { Z = 2 * centerZ - point.Z }; + + /// + /// 将输入点中心对称 + /// + /// 输入点 + /// 中心点 + /// + public static Vector3 PointCenterSymmetry(this Vector3 point, Vector3 center) + => point.RotateAndExtend(center, float.Pi, 0); + + /// + /// 获取给定数的指定位数 + /// + /// 给定数值 + /// 对应位数,个位为1 + /// + public static int GetDecimalDigit(this int val, int x) + { + var valStr = val.ToString(); + var length = valStr.Length; + if (x < 1 || x > length) return -1; + var digitChar = valStr[length - x]; // 从右往左取第x位 + return int.Parse(digitChar.ToString()); + } +} + +#endregion 计算函数 \ No newline at end of file diff --git a/Fate/Ttokrrone.cs b/Fate/Ttokrrone.cs index ddb213d..ad19ff6 100644 --- a/Fate/Ttokrrone.cs +++ b/Fate/Ttokrrone.cs @@ -12,16 +12,12 @@ 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 The_Serpentlord_Seethes; [ScriptType(guid: "ab67129e-880f-48e8-852e-f92b4afa68e5", name: "蛇王得酷热涅:荒野的死斗", territorys: [1190], - version: "0.0.0.3", author: "Tetora", note: noteStr)] + version: "0.0.0.4", author: "Tetora", note: noteStr)] public class Ttokrrone { @@ -500,3 +496,113 @@ public static class Extensions } } } + + + +#region 计算函数 + +public static class MathTools +{ + public static float DegToRad(this float deg) => (deg + 360f) % 360f / 180f * float.Pi; + public static float RadToDeg(this float rad) => (rad + 2 * float.Pi) % (2 * float.Pi) / float.Pi * 180f; + + /// + /// 获得任意点与中心点的弧度值,以(0, 0, 1)方向为0,以(1, 0, 0)方向为pi/2。 + /// 即,逆时针方向增加。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetRadian(this Vector3 point, Vector3 center) + => MathF.Atan2(point.X - center.X, point.Z - center.Z); + + /// + /// 获得任意点与中心点的长度。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetLength(this Vector3 point, Vector3 center) + => new Vector2(point.X - center.X, point.Z - center.Z).Length(); + + /// + /// 将任意点以中心点为圆心,逆时针旋转并延长。 + /// + /// 任意点 + /// 中心点 + /// 旋转弧度 + /// 基于该点延伸长度 + /// + public static Vector3 RotateAndExtend(this Vector3 point, Vector3 center, float radian, float length) + { + var baseRad = point.GetRadian(center); + var baseLength = point.GetLength(center); + var rotRad = baseRad + radian; + return new Vector3( + center.X + MathF.Sin(rotRad) * (length + baseLength), + center.Y, + center.Z + MathF.Cos(rotRad) * (length + baseLength) + ); + } + + /// + /// 获得某角度所在划分区域 + /// + /// 输入弧度 + /// 区域划分数量 + /// 0度所在区域的初始Idx> + /// 是否为斜分割,默认为false + /// 是否顺时针增加,默认为false + /// + public static int RadianToRegion(this float radian, int regionNum, int baseRegionIdx = 0, bool isDiagDiv = false, bool isCw = false) + { + var sepRad = float.Pi * 2 / regionNum; + var inputAngle = radian * (isCw ? -1 : 1) + (isDiagDiv ? sepRad / 2 : 0); + var rad = (inputAngle + 4 * float.Pi) % (2 * float.Pi); + return ((int)Math.Floor(rad / sepRad) + baseRegionIdx + regionNum) % regionNum; + } + + /// + /// 将输入点左右折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointHorizon(this Vector3 point, float centerX) + => point with { X = 2 * centerX - point.X }; + + /// + /// 将输入点上下折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointVertical(this Vector3 point, float centerZ) + => point with { Z = 2 * centerZ - point.Z }; + + /// + /// 将输入点中心对称 + /// + /// 输入点 + /// 中心点 + /// + public static Vector3 PointCenterSymmetry(this Vector3 point, Vector3 center) + => point.RotateAndExtend(center, float.Pi, 0); + + /// + /// 获取给定数的指定位数 + /// + /// 给定数值 + /// 对应位数,个位为1 + /// + public static int GetDecimalDigit(this int val, int x) + { + var valStr = val.ToString(); + var length = valStr.Length; + if (x < 1 || x > length) return -1; + var digitChar = valStr[length - x]; // 从右往左取第x位 + return int.Parse(digitChar.ToString()); + } +} + +#endregion 计算函数 \ No newline at end of file diff --git a/Field_Operations/The_Forbidden_Land_Eureka/The_Baldesion_Arsenal.cs b/Field_Operations/The_Forbidden_Land_Eureka/The_Baldesion_Arsenal.cs index 879b5e5..92a1b9e 100644 --- a/Field_Operations/The_Forbidden_Land_Eureka/The_Baldesion_Arsenal.cs +++ b/Field_Operations/The_Forbidden_Land_Eureka/The_Baldesion_Arsenal.cs @@ -3,8 +3,6 @@ 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; @@ -12,17 +10,13 @@ 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 The_Baldesion_Arsenal_Eureka; [ScriptType(guid: "cb001385-81e0-4c16-8bb3-fb51fd70336a", name: "禁地优雷卡 - 巴尔德西昂兵武塔", territorys: [827], - version: "0.0.0.3", author: "Tetora", note: noteStr)] + version: "0.0.0.4", author: "Tetora", note: noteStr)] public class The_Baldesion_Arsenal { @@ -779,4 +773,113 @@ public static class IbcHelper { return chara.StatusList.Any(x => statusIds.Contains(x.StatusId)); } -} \ No newline at end of file +} + + +#region 计算函数 + +public static class MathTools +{ + public static float DegToRad(this float deg) => (deg + 360f) % 360f / 180f * float.Pi; + public static float RadToDeg(this float rad) => (rad + 2 * float.Pi) % (2 * float.Pi) / float.Pi * 180f; + + /// + /// 获得任意点与中心点的弧度值,以(0, 0, 1)方向为0,以(1, 0, 0)方向为pi/2。 + /// 即,逆时针方向增加。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetRadian(this Vector3 point, Vector3 center) + => MathF.Atan2(point.X - center.X, point.Z - center.Z); + + /// + /// 获得任意点与中心点的长度。 + /// + /// 任意点 + /// 中心点 + /// + public static float GetLength(this Vector3 point, Vector3 center) + => new Vector2(point.X - center.X, point.Z - center.Z).Length(); + + /// + /// 将任意点以中心点为圆心,逆时针旋转并延长。 + /// + /// 任意点 + /// 中心点 + /// 旋转弧度 + /// 基于该点延伸长度 + /// + public static Vector3 RotateAndExtend(this Vector3 point, Vector3 center, float radian, float length) + { + var baseRad = point.GetRadian(center); + var baseLength = point.GetLength(center); + var rotRad = baseRad + radian; + return new Vector3( + center.X + MathF.Sin(rotRad) * (length + baseLength), + center.Y, + center.Z + MathF.Cos(rotRad) * (length + baseLength) + ); + } + + /// + /// 获得某角度所在划分区域 + /// + /// 输入弧度 + /// 区域划分数量 + /// 0度所在区域的初始Idx> + /// 是否为斜分割,默认为false + /// 是否顺时针增加,默认为false + /// + public static int RadianToRegion(this float radian, int regionNum, int baseRegionIdx = 0, bool isDiagDiv = false, bool isCw = false) + { + var sepRad = float.Pi * 2 / regionNum; + var inputAngle = radian * (isCw ? -1 : 1) + (isDiagDiv ? sepRad / 2 : 0); + var rad = (inputAngle + 4 * float.Pi) % (2 * float.Pi); + return ((int)Math.Floor(rad / sepRad) + baseRegionIdx + regionNum) % regionNum; + } + + /// + /// 将输入点左右折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointHorizon(this Vector3 point, float centerX) + => point with { X = 2 * centerX - point.X }; + + /// + /// 将输入点上下折叠 + /// + /// 待折叠点 + /// 中心折线坐标点 + /// + public static Vector3 FoldPointVertical(this Vector3 point, float centerZ) + => point with { Z = 2 * centerZ - point.Z }; + + /// + /// 将输入点中心对称 + /// + /// 输入点 + /// 中心点 + /// + public static Vector3 PointCenterSymmetry(this Vector3 point, Vector3 center) + => point.RotateAndExtend(center, float.Pi, 0); + + /// + /// 获取给定数的指定位数 + /// + /// 给定数值 + /// 对应位数,个位为1 + /// + public static int GetDecimalDigit(this int val, int x) + { + var valStr = val.ToString(); + var length = valStr.Length; + if (x < 1 || x > length) return -1; + var digitChar = valStr[length - x]; // 从右往左取第x位 + return int.Parse(digitChar.ToString()); + } +} + +#endregion 计算函数 \ No newline at end of file diff --git a/OnlineRepo.json b/OnlineRepo.json index 5b85999..69dd694 100644 --- a/OnlineRepo.json +++ b/OnlineRepo.json @@ -2,7 +2,7 @@ { "Name": "随机任务:主线任务", "Guid": "84c15eea-2a19-4477-ad21-cd43d1263cfa", - "Version": "0.0.0.2", + "Version": "0.0.0.3", "Author": "Tetora", "Repo": "https://github.com/Hibiya615/TetoraKAScript/tree/main", "DownloadUrl": "https://raw.githubusercontent.com/Hibiya615/TetoraKAScript/refs/heads/main/02-A-Realm-Reborn/Dungeon/MainScenario_Roulette.cs", @@ -17,7 +17,7 @@ { "Name": "邪龙王座龙巢神殿", "Guid": "ac6caf4e-5eee-406c-8621-a5f3c5c7e9b0", - "Version": "0.0.0.1", + "Version": "0.0.0.2", "Author": "Tetora", "Repo": "https://github.com/Hibiya615/TetoraKAScript/tree/main", "DownloadUrl": "https://raw.githubusercontent.com/Hibiya615/TetoraKAScript/refs/heads/main/03-Heavensward/Dungeon/theAery.cs", @@ -30,7 +30,7 @@ { "Name": "鏖战红莲阿拉米格", "Guid": "aa0ae191-da3f-48f1-9340-46a56cfeeabf", - "Version": "0.0.0.1", + "Version": "0.0.0.2", "Author": "Tetora", "Repo": "https://github.com/Hibiya615/TetoraKAScript/tree/main", "DownloadUrl": "https://raw.githubusercontent.com/Hibiya615/TetoraKAScript/refs/heads/main/04-Stormblood/Dungeon/AlaMhigo.cs", @@ -43,7 +43,7 @@ { "Name": "疯狂战舰无限回廊", "Guid": "c76136e1-1b5b-4cfb-a677-4cc0917fa050", - "Version": "0.0.0.2", + "Version": "0.0.0.3", "Author": "Tetora", "Repo": "https://github.com/Hibiya615/TetoraKAScript", "DownloadUrl": "https://raw.githubusercontent.com/Hibiya615/TetoraKAScript/refs/heads/main/04-Stormblood/Dungeon/theFractalContinuum-Hard.cs", @@ -56,7 +56,7 @@ { "Name": "污染庭园圣茉夏娜植物园", "Guid": "7e87b5d1-ae21-4115-9483-d8dc0f1d1652", - "Version": "0.0.0.3", + "Version": "0.0.0.4", "Author": "Tetora", "Repo": "https://github.com/Hibiya615/TetoraKAScript/tree/main", "DownloadUrl": "https://raw.githubusercontent.com/Hibiya615/TetoraKAScript/refs/heads/main/04-Stormblood/Dungeon/SaintMocianne'sArboretum%20(Hard).cs", @@ -69,7 +69,7 @@ { "Name": "异界遗构希尔科斯孪晶塔", "Guid": "bfb00cd3-ccec-4b21-b3d7-e290f49e6a75", - "Version": "0.0.0.2", + "Version": "0.0.0.3", "Author": "Tetora", "Repo": "https://github.com/Hibiya615/TetoraKAScript/tree/main", "DownloadUrl": "https://raw.githubusercontent.com/Hibiya615/TetoraKAScript/refs/heads/main/05-Shadowbringers/Dungeon/theTwinning.cs", @@ -82,7 +82,7 @@ { "Name": "伊弗利特歼灭战", "Guid": "d3d532f1-0707-427f-ac04-871a22022c11", - "Version": "0.0.0.2", + "Version": "0.0.0.3", "Author": "Tetora", "Repo": "https://github.com/Hibiya615/TetoraKAScript", "DownloadUrl": "https://raw.githubusercontent.com/Hibiya615/TetoraKAScript/refs/heads/main/02-A-Realm-Reborn/Trials/Ifrit(Hard).cs", @@ -95,7 +95,7 @@ { "Name": "迦楼罗歼灭战", "Guid": "ef230d41-5fbf-413d-b745-7227efebec48", - "Version": "0.0.0.1", + "Version": "0.0.0.2", "Author": "Tetora", "Repo": "https://github.com/Hibiya615/TetoraKAScript/tree/main", "DownloadUrl": "https://raw.githubusercontent.com/Hibiya615/TetoraKAScript/refs/heads/main/02-A-Realm-Reborn/Trials/Garuda(Hard).cs", @@ -108,7 +108,7 @@ { "Name": "拉姆歼灭战", "Guid": "de6d6f10-775d-4c45-91ec-2bd4ed6762c7", - "Version": "0.0.0.2", + "Version": "0.0.0.3", "Author": "Tetora", "Repo": "https://github.com/Hibiya615/TetoraKAScript/tree/main", "DownloadUrl": "https://raw.githubusercontent.com/Hibiya615/TetoraKAScript/refs/heads/main/02-A-Realm-Reborn/Trials/Ramuh(Hard).cs", @@ -121,7 +121,7 @@ { "Name": "希瓦歼灭战", "Guid": "cddb93a8-e01e-40fe-989c-5153ad62bfbc", - "Version": "0.0.0.1", + "Version": "0.0.0.2", "Author": "Tetora", "Repo": "https://github.com/Hibiya615/TetoraKAScript/tree/main", "DownloadUrl": "https://raw.githubusercontent.com/Hibiya615/TetoraKAScript/refs/heads/main/02-A-Realm-Reborn/Trials/Shiva.cs", @@ -134,7 +134,7 @@ { "Name": "莫古力贤王歼灭战(整活版)", "Guid": "cd81e178-12e6-4e53-9b81-63002cc51ecb", - "Version": "0.0.0.2", + "Version": "0.0.0.3", "Author": "Tetora", "Repo": "https://github.com/Hibiya615/TetoraKAScript/tree/main", "DownloadUrl": "https://raw.githubusercontent.com/Hibiya615/TetoraKAScript/refs/heads/main/02-A-Realm-Reborn/Trials/Good_King_Moggle-Hard.cs", @@ -147,7 +147,7 @@ { "Name": "那布里亚勒斯讨伐战", "Guid": "64206b9e-cd0a-47ec-960d-15f39a888f9e", - "Version": "0.0.0.3", + "Version": "0.0.0.4", "Author": "Tetora", "Repo": "https://github.com/Hibiya615/TetoraKAScript/tree/main", "DownloadUrl": "https://raw.githubusercontent.com/Hibiya615/TetoraKAScript/refs/heads/main/02-A-Realm-Reborn/Trials/Nabriales.cs", @@ -160,7 +160,7 @@ { "Name": "海德拉讨伐战", "Guid": "d32d7489-a1bb-4117-98dd-ee895390804d", - "Version": "0.0.0.2", + "Version": "0.0.0.3", "Author": "Tetora", "Repo": "https://github.com/Hibiya615/TetoraKAScript", "DownloadUrl": "https://raw.githubusercontent.com/Hibiya615/TetoraKAScript/refs/heads/main/02-A-Realm-Reborn/Trials/Hydra.cs", @@ -173,7 +173,7 @@ { "Name": "死化奇美拉讨伐战", "Guid": "e24bb311-704f-4f4c-8188-87eaa8da8b29", - "Version": "0.0.0.3", + "Version": "0.0.0.4", "Author": "Tetora", "Repo": "https://github.com/Hibiya615/TetoraKAScript/tree/main", "DownloadUrl": "https://raw.githubusercontent.com/Hibiya615/TetoraKAScript/refs/heads/main/02-A-Realm-Reborn/Trials/DhormeChimera.cs", @@ -186,7 +186,7 @@ { "Name": "奥丁歼灭战", "Guid": "1a07440d-a7bd-4b67-b781-90d14087ee60", - "Version": "0.0.0.2", + "Version": "0.0.0.3", "Author": "Tetora", "Repo": "https://github.com/Hibiya615/TetoraKAScript", "DownloadUrl": "https://raw.githubusercontent.com/Hibiya615/TetoraKAScript/refs/heads/main/02-A-Realm-Reborn/Trials/Odin.cs", @@ -199,7 +199,7 @@ { "Name": "大桥上的决斗", "Guid": "3e4102cb-9410-44fd-85e8-d43a3bc25737", - "Version": "0.0.0.3", + "Version": "0.0.0.4", "Author": "Tetora", "Repo": "https://github.com/Hibiya615/TetoraKAScript/tree/main", "DownloadUrl": "https://raw.githubusercontent.com/Hibiya615/TetoraKAScript/refs/heads/main/02-A-Realm-Reborn/Trials/BattleOnTheBigBridge.cs", @@ -212,7 +212,7 @@ { "Name": "无限城的死斗", "Guid": "90783a42-7947-4392-9c3e-f3162d52c248", - "Version": "0.0.0.2", + "Version": "0.0.0.3", "Author": "Tetora", "Repo": "https://github.com/Hibiya615/TetoraKAScript/tree/main", "DownloadUrl": "https://raw.githubusercontent.com/Hibiya615/TetoraKAScript/refs/heads/main/02-A-Realm-Reborn/Trials/BattleInTheBigKeep.cs", @@ -225,7 +225,7 @@ { "Name": "尼德霍格征龙战", "Guid": "dcfdb19e-0357-4214-b64e-205100f55822", - "Version": "0.0.0.1", + "Version": "0.0.0.2", "Author": "Tetora", "Repo": "https://github.com/Hibiya615/TetoraKAScript/tree/main", "DownloadUrl": "https://raw.githubusercontent.com/Hibiya615/TetoraKAScript/refs/heads/main/03-Heavensward/Trials/Nidhogg.cs", @@ -238,7 +238,7 @@ { "Name": "萨菲洛特歼灭战", "Guid": "6d0824b3-6d67-4450-8b4e-46857257579e", - "Version": "0.0.0.1", + "Version": "0.0.0.2", "Author": "Tetora", "Repo": "https://github.com/Hibiya615/TetoraKAScript/tree/main", "DownloadUrl": "https://raw.githubusercontent.com/Hibiya615/TetoraKAScript/refs/heads/main/03-Heavensward/Trials/Sephirot.cs", @@ -251,7 +251,7 @@ { "Name": "祖尔宛歼灭战", "Guid": "214f8fbd-ad04-430f-8bba-fd7319581780", - "Version": "0.0.0.4", + "Version": "0.0.0.5", "Author": "Tetora", "Repo": "https://github.com/Hibiya615/TetoraKAScript/tree/main", "DownloadUrl": "https://raw.githubusercontent.com/Hibiya615/TetoraKAScript/refs/heads/main/03-Heavensward/Trials/Zurvan.cs", @@ -264,7 +264,7 @@ { "Name": "须佐之男歼灭战", "Guid": "2c4b6205-6a77-4c89-b641-2c2359a43f25", - "Version": "0.0.0.1", + "Version": "0.0.0.2", "Author": "Tetora", "Repo": "https://github.com/Hibiya615/TetoraKAScript/tree/main", "DownloadUrl": "https://raw.githubusercontent.com/Hibiya615/TetoraKAScript/refs/heads/main/04-Stormblood/Trial/Susano.cs", @@ -277,7 +277,7 @@ { "Name": "吉祥天女歼灭战", "Guid": "a7bacd3e-834f-41ba-a210-c66e2c12d208", - "Version": "0.0.0.3", + "Version": "0.0.0.4", "Author": "Tetora", "Repo": "https://github.com/Hibiya615/TetoraKAScript/tree/main", "DownloadUrl": "https://raw.githubusercontent.com/Hibiya615/TetoraKAScript/refs/heads/main/04-Stormblood/Trial/Lakshmi.cs", @@ -290,7 +290,7 @@ { "Name": "神龙歼灭战", "Guid": "da23fd13-2d1f-41d3-b2c9-91fd8d948a98", - "Version": "0.0.0.2", + "Version": "0.0.0.3", "Author": "Tetora", "Repo": "https://github.com/Hibiya615/TetoraKAScript/tree/main", "DownloadUrl": "https://raw.githubusercontent.com/Hibiya615/TetoraKAScript/refs/heads/main/04-Stormblood/Trial/Shinryu.cs", @@ -303,7 +303,7 @@ { "Name": "月读歼灭战", "Guid": "97415dc8-cd16-4c9b-87be-026a297c3451", - "Version": "0.0.0.1", + "Version": "0.0.0.2", "Author": "Tetora", "Repo": "https://github.com/Hibiya615/TetoraKAScript/tree/main", "DownloadUrl": "https://raw.githubusercontent.com/Hibiya615/TetoraKAScript/refs/heads/main/04-Stormblood/Trial/Tsukuyomi.cs", @@ -316,7 +316,7 @@ { "Name": "白虎镇魂战", "Guid": "6a9e30e9-c58e-4f39-9f1e-ad26e5d49dc3", - "Version": "0.0.0.11", + "Version": "0.0.0.12", "Author": "Tetora", "Repo": "https://github.com/Hibiya615/TetoraKAScript/tree/main ", "DownloadUrl": "https://raw.githubusercontent.com/Hibiya615/TetoraKAScript/refs/heads/main/04-Stormblood/Trial/Byakko.cs", @@ -329,7 +329,7 @@ { "Name": "朱雀镇魂战", "Guid": "fc907987-bad9-4c70-97f6-b91e2e70544b", - "Version": "0.0.0.1", + "Version": "0.0.0.2", "Author": "Tetora", "Repo": "https://github.com/Hibiya615/TetoraKAScript/tree/main", "DownloadUrl": "https://raw.githubusercontent.com/Hibiya615/TetoraKAScript/refs/heads/main/04-Stormblood/Trial/Suzaku.cs", @@ -342,7 +342,7 @@ { "Name": "保镖歼灭战", "Guid": "944c8879-0d4e-4182-87ea-c38769990f2d", - "Version": "0.0.0.2", + "Version": "0.0.0.3", "Author": "Tetora", "Repo": "https://github.com/Hibiya615/TetoraKAScript/tree/main", "DownloadUrl": "https://raw.githubusercontent.com/Hibiya615/TetoraKAScript/refs/heads/main/04-Stormblood/Trial/Yojimbo.cs", @@ -355,7 +355,7 @@ { "Name": "缇坦妮雅歼灭战", "Guid": "71a3a109-0ac3-4041-aa87-ff156f5aaeea", - "Version": "0.0.0.1", + "Version": "0.0.0.2", "Author": "Tetora", "Repo": "https://github.com/Hibiya615/TetoraKAScript/tree/main", "DownloadUrl": "https://raw.githubusercontent.com/Hibiya615/TetoraKAScript/refs/heads/main/05-Shadowbringers/Trials/Titania.cs", @@ -368,7 +368,7 @@ { "Name": "哈迪斯歼灭战", "Guid": "ebcac22b-8a1d-49c4-ae1f-1470be15f7e3", - "Version": "0.0.0.1", + "Version": "0.0.0.2", "Author": "Tetora", "Repo": "https://github.com/Hibiya615/TetoraKAScript/tree/main", "DownloadUrl": "https://raw.githubusercontent.com/Hibiya615/TetoraKAScript/refs/heads/main/05-Shadowbringers/Trials/Hades.cs", @@ -381,7 +381,7 @@ { "Name": "高贝扎歼灭战", "Guid": "8a526afb-eefd-44ec-a105-7dc8fcd28e47", - "Version": "0.0.0.3", + "Version": "0.0.0.4", "Author": "Tetora", "Repo": "https://github.com/Hibiya615/TetoraKAScript", "DownloadUrl": "https://raw.githubusercontent.com/Hibiya615/TetoraKAScript/refs/heads/main/06-EndWalker/Trial/Golbez.cs", @@ -394,7 +394,7 @@ { "Name": "泽罗姆斯歼灭战", "Guid": "1d6d7238-e986-408c-9c25-b24955542ee0", - "Version": "0.0.0.2", + "Version": "0.0.0.3", "Author": "Tetora", "Repo": "https://github.com/Hibiya615/TetoraKAScript/tree/main", "DownloadUrl": "https://raw.githubusercontent.com/Hibiya615/TetoraKAScript/refs/heads/main/06-EndWalker/Trial/Zeromus.cs", @@ -407,7 +407,7 @@ { "Name": "迦楼罗歼殛战", "Guid": "3e4685ed-1425-4ddc-8222-a2c15dcc9ad5", - "Version": "0.0.0.1", + "Version": "0.0.0.2", "Author": "Tetora", "Repo": "https://github.com/Hibiya615/TetoraKAScript/tree/main", "DownloadUrl": "https://raw.githubusercontent.com/Hibiya615/TetoraKAScript/refs/heads/main/02-A-Realm-Reborn/Trials-Extreme/Garuda(Extreme).cs", @@ -420,7 +420,7 @@ { "Name": "伊弗利特歼殛战", "Guid": "dbb7983a-d2c4-4621-9734-76772e3f206a", - "Version": "0.0.0.3", + "Version": "0.0.0.4", "Author": "Tetora", "Repo": "https://github.com/Hibiya615/TetoraKAScript/tree/main", "DownloadUrl": "https://raw.githubusercontent.com/Hibiya615/TetoraKAScript/refs/heads/main/02-A-Realm-Reborn/Trials-Extreme/Ifrit(Extreme).cs", @@ -433,7 +433,7 @@ { "Name": "莫古力贤王歼殛战", "Guid": "fc6a6125-4a1d-4669-be4c-9b375dc70ae0", - "Version": "0.0.0.3", + "Version": "0.0.0.4", "Author": "Tetora", "Repo": "https://github.com/Hibiya615/TetoraKAScript/tree/main", "DownloadUrl": "https://raw.githubusercontent.com/Hibiya615/TetoraKAScript/refs/heads/main/02-A-Realm-Reborn/Trials-Extreme/Good_King_Moggle(Extreme).cs", @@ -446,7 +446,7 @@ { "Name": "利维亚桑歼殛战", "Guid": "07f20e0e-9463-4a10-9dd1-956fde6a9c46", - "Version": "0.0.0.3", + "Version": "0.0.0.4", "Author": "Tetora", "Repo": "https://github.com/Hibiya615/TetoraKAScript/tree/main", "DownloadUrl": "https://raw.githubusercontent.com/Hibiya615/TetoraKAScript/refs/heads/main/02-A-Realm-Reborn/Trials-Extreme/Leviathan(Extreme).cs", @@ -459,7 +459,7 @@ { "Name": "俾斯麦歼殛战", "Guid": "56751be8-113f-4496-8b46-982ff96d90c3", - "Version": "0.0.0.1", + "Version": "0.0.0.2", "Author": "Tetora", "Repo": "https://github.com/Hibiya615/TetoraKAScript/tree/main", "DownloadUrl": "https://raw.githubusercontent.com/Hibiya615/TetoraKAScript/refs/heads/main/03-Heavensward/Trials-Extreme/Bismarck-Extreme.cs", @@ -472,7 +472,7 @@ { "Name": "A3N", "Guid": "69712d1f-26c4-441f-97f0-e63f8baf98a6", - "Version": "0.0.0.2", + "Version": "0.0.0.3", "Author": "Tetora", "Repo": "https://github.com/Hibiya615/TetoraKAScript/tree/main", "DownloadUrl": "https://raw.githubusercontent.com/Hibiya615/TetoraKAScript/refs/heads/main/03-Heavensward/Raid-Alexander/Normal/A3N.cs", @@ -485,7 +485,7 @@ { "Name": "A5N", "Guid": "1462516c-2bc2-4560-8244-387845cc098d", - "Version": "0.0.0.1", + "Version": "0.0.0.2", "Author": "Tetora", "Repo": "https://github.com/Hibiya615/TetoraKAScript/tree/main", "DownloadUrl": "https://raw.githubusercontent.com/Hibiya615/TetoraKAScript/refs/heads/main/03-Heavensward/Raid-Alexander/Normal/A5N.cs", @@ -498,7 +498,7 @@ { "Name": "O4N", "Guid": "f24f9cef-717e-4a2a-9616-d470443d6d8a", - "Version": "0.0.0.1", + "Version": "0.0.0.2", "Author": "Tetora", "Repo": "https://github.com/Hibiya615/TetoraKAScript/tree/main", "DownloadUrl": "https://raw.githubusercontent.com/Hibiya615/TetoraKAScript/refs/heads/main/04-Stormblood/Raid-Omega_Quests/Normal/O4n.cs", @@ -511,7 +511,7 @@ { "Name": "O5N", "Guid": "af11ce46-2c6a-46ba-b2bc-c542e5f5b7b5", - "Version": "0.0.0.1", + "Version": "0.0.0.2", "Author": "Tetora", "Repo": "https://github.com/Hibiya615/TetoraKAScript/tree/main", "DownloadUrl": "https://raw.githubusercontent.com/Hibiya615/TetoraKAScript/refs/heads/main/04-Stormblood/Raid-Omega_Quests/Normal/O5n.cs", @@ -524,7 +524,7 @@ { "Name": "O11N", "Guid": "2232ae84-c1e7-4382-88b4-d691887f27cf", - "Version": "0.0.0.3", + "Version": "0.0.0.4", "Author": "Tetora", "Repo": "https://github.com/Hibiya615/TetoraKAScript/tree/main", "DownloadUrl": "https://raw.githubusercontent.com/Hibiya615/TetoraKAScript/refs/heads/main/04-Stormblood/Raid-Omega_Quests/Normal/O11n.cs", @@ -537,7 +537,7 @@ { "Name": "E1N", "Guid": "35c751e5-2958-4f55-b783-405b4acfde1b", - "Version": "0.0.0.2", + "Version": "0.0.0.3", "Author": "Tetora", "Repo": "https://github.com/Hibiya615/TetoraKAScript/tree/main", "DownloadUrl": "https://raw.githubusercontent.com/Hibiya615/TetoraKAScript/refs/heads/main/05-Shadowbringers/Raid-Eden/Normal/E1n.cs", @@ -550,7 +550,7 @@ { "Name": "E2N", "Guid": "b59c7db9-1fba-4476-8701-1e3043cb7dc8", - "Version": "0.0.0.1", + "Version": "0.0.0.2", "Author": "Tetora", "Repo": "https://github.com/Hibiya615/TetoraKAScript/tree/main", "DownloadUrl": "https://raw.githubusercontent.com/Hibiya615/TetoraKAScript/refs/heads/main/05-Shadowbringers/Raid-Eden/Normal/E2n.cs", @@ -563,7 +563,7 @@ { "Name": "E8N", "Guid": "c4d533c8-8798-441d-b849-fc3cd5cf63d9", - "Version": "0.0.0.3", + "Version": "0.0.0.4", "Author": "Tetora", "Repo": "https://github.com/Hibiya615/TetoraKAScript/tree/main", "DownloadUrl": "https://raw.githubusercontent.com/Hibiya615/TetoraKAScript/refs/heads/main/05-Shadowbringers/Raid-Eden/Normal/E8n.cs", @@ -576,7 +576,7 @@ { "Name": "E9N", "Guid": "e4b80c15-7885-46b7-8e3d-201a6a248c89", - "Version": "0.0.0.1", + "Version": "0.0.0.2", "Author": "Tetora", "Repo": "https://github.com/Hibiya615/TetoraKAScript/tree/main", "DownloadUrl": "https://raw.githubusercontent.com/Hibiya615/TetoraKAScript/refs/heads/main/05-Shadowbringers/Raid-Eden/Normal/E9n.cs", @@ -589,7 +589,7 @@ { "Name": "E10N", "Guid": "038e00e8-d378-4f43-89ab-e27df5561d5a", - "Version": "0.0.0.2", + "Version": "0.0.0.3", "Author": "Tetora", "Repo": "https://github.com/Hibiya615/TetoraKAScript", "DownloadUrl": "https://raw.githubusercontent.com/Hibiya615/TetoraKAScript/refs/heads/main/05-Shadowbringers/Raid-Eden/Normal/E10n.cs", @@ -602,7 +602,7 @@ { "Name": "E12N", "Guid": "3f88ad9c-e7a7-4e00-b19e-546609b319ba", - "Version": "0.0.0.2", + "Version": "0.0.0.3", "Author": "Tetora", "Repo": "https://github.com/Hibiya615/TetoraKAScript/tree/main", "DownloadUrl": "https://raw.githubusercontent.com/Hibiya615/TetoraKAScript/refs/heads/main/05-Shadowbringers/Raid-Eden/Normal/E12n.cs", @@ -615,7 +615,7 @@ { "Name": "P10N", "Guid": "f28cc2f2-6ce2-4526-a303-56fe1c02dea8", - "Version": "0.0.0.2", + "Version": "0.0.0.3", "Author": "Tetora", "Repo": "https://github.com/Hibiya615/TetoraKAScript/tree/main", "DownloadUrl": "https://raw.githubusercontent.com/Hibiya615/TetoraKAScript/refs/heads/main/06-EndWalker/Raid-Pand%C3%A6monium/Normal/P10n.cs", @@ -628,7 +628,7 @@ { "Name": "P11N", "Guid": "07be068a-65ea-4fd9-a324-9ec5326bb04b", - "Version": "0.0.0.1", + "Version": "0.0.0.2", "Author": "Tetora", "Repo": "https://github.com/Hibiya615/TetoraKAScript/tree/main", "DownloadUrl": "https://raw.githubusercontent.com/Hibiya615/TetoraKAScript/refs/heads/main/06-EndWalker/Raid-Pand%C3%A6monium/Normal/P11n.cs", @@ -641,7 +641,7 @@ { "Name": "死者宫殿", "Guid": "4210c323-eba4-4d67-a7e7-b90799494729", - "Version": "0.0.0.6", + "Version": "0.0.0.7", "Author": "Tetora", "Repo": "https://github.com/Hibiya615/TetoraKAScript", "DownloadUrl": "https://raw.githubusercontent.com/Hibiya615/TetoraKAScript/refs/heads/main/Deep_Dungeon/the_Palace_of_the_Dead.cs", @@ -673,7 +673,7 @@ { "Name": "天青斗场", "Guid": "7703f1a9-5698-4896-8908-bb8e415c1321", - "Version": "0.0.0.5", + "Version": "0.0.0.6", "Author": "Tetora", "Repo": "https://github.com/Hibiya615/TetoraKAScript", "DownloadUrl": "https://raw.githubusercontent.com/Hibiya615/TetoraKAScript/refs/heads/main/Celestium/Celestium.cs", @@ -686,7 +686,7 @@ { "Name": "激斗畏惧装甲之秘密武器", "Guid": "5f55a121-1fcc-48ce-a0e8-b6fbd4ce8489", - "Version": "0.0.0.3", + "Version": "0.0.0.4", "Author": "Tetora", "Repo": "https://github.com/Hibiya615/TetoraKAScript/tree/main", "DownloadUrl": "https://raw.githubusercontent.com/Hibiya615/TetoraKAScript/refs/heads/main/Fate/Formidable.cs", @@ -699,7 +699,7 @@ { "Name": "灾厄的古塔尼亚之深海讨伐战", "Guid": "f11c3069-d163-41dd-904e-b016cfcf089c", - "Version": "0.0.0.4", + "Version": "0.0.0.5", "Author": "Tetora", "Repo": "https://github.com/Hibiya615/TetoraKAScript/tree/main", "DownloadUrl": "https://raw.githubusercontent.com/Hibiya615/TetoraKAScript/refs/heads/main/Fate/Archaeotania.cs", @@ -712,7 +712,7 @@ { "Name": "兽道诸神信仰:伪神降临", "Guid": "da82aeb0-9635-4f13-a1c1-39a0c859f596", - "Version": "0.0.0.4", + "Version": "0.0.0.5", "Author": "Tetora", "Repo": "https://github.com/Hibiya615/TetoraKAScript/tree/main", "DownloadUrl": "https://raw.githubusercontent.com/Hibiya615/TetoraKAScript/refs/heads/main/Fate/Daivadipa.cs", @@ -725,7 +725,7 @@ { "Name": "侵略兵器召回指令:破坏侵略兵器希", "Guid": "b73d07ef-aa90-45a9-ab4b-fc3ccce8791b", - "Version": "0.0.0.2", + "Version": "0.0.0.3", "Author": "Tetora", "Repo": "https://github.com/Hibiya615/TetoraKAScript/tree/main", "DownloadUrl": "https://raw.githubusercontent.com/Hibiya615/TetoraKAScript/refs/heads/main/Fate/Chi.cs", @@ -738,7 +738,7 @@ { "Name": "蛇王得酷热涅:荒野的死斗", "Guid": "ab67129e-880f-48e8-852e-f92b4afa68e5", - "Version": "0.0.0.3", + "Version": "0.0.0.4", "Author": "Tetora", "Repo": "https://github.com/Hibiya615/TetoraKAScript/tree/main", "DownloadUrl": "https://raw.githubusercontent.com/Hibiya615/TetoraKAScript/refs/heads/main/Fate/Ttokrrone.cs", @@ -751,7 +751,7 @@ { "Name": "亩鼠米卡:盛装巡游皆大欢喜", "Guid": "22134617-0ca4-463e-a40d-675ef1c20cf2", - "Version": "0.0.0.2", + "Version": "0.0.0.3", "Author": "Tetora", "Repo": "https://github.com/Hibiya615/TetoraKAScript/tree/main", "DownloadUrl": "https://raw.githubusercontent.com/Hibiya615/TetoraKAScript/refs/heads/main/Fate/Mica_the_MagicalMu.cs", @@ -764,7 +764,7 @@ { "Name": "FRU_DLC [光暗未来绝境战_额外补充]", "Guid": "981e39b5-ea99-4b85-a4b1-0e698d4c4036", - "Version": "0.0.0.3", + "Version": "0.0.0.4", "Author": "Tetora", "Repo": "https://github.com/Hibiya615/TetoraKAScript/tree/main", "DownloadUrl": "https://raw.githubusercontent.com/Hibiya615/TetoraKAScript/refs/heads/main/07-Dawntrail/FRU_DLC.cs", diff --git a/PVP/PVPToy.cs b/PVP/PVPToy.cs index 20c7e17..6d53d16 100644 --- a/PVP/PVPToy.cs +++ b/PVP/PVPToy.cs @@ -3,8 +3,6 @@ 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; @@ -12,16 +10,12 @@ 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 PVPToy; [ScriptType(guid: "2312052e-6575-4a91-9e3d-b84699dca8fe", name: "PVP小玩具", territorys: [250, 431, 554, 888, 1273], - version: "0.0.0.1", author: "Tetora", note: noteStr)] + version: "0.0.0.2", author: "Tetora", note: noteStr)] public class PVPToy { diff --git a/PVP/The_Borderland_Ruins.cs b/PVP/The_Borderland_Ruins.cs index 7706d16..26f9de3 100644 --- a/PVP/The_Borderland_Ruins.cs +++ b/PVP/The_Borderland_Ruins.cs @@ -3,8 +3,6 @@ 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; @@ -12,16 +10,12 @@ 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 The_Borderland_Ruins; [ScriptType(guid: "ec9c9f7d-be48-4974-82cf-396b0fc29261", name: "周边遗迹群(阵地战)", territorys: [1273], - version: "0.0.0.1", author: "Tetora", note: noteStr)] + version: "0.0.0.2", author: "Tetora", note: noteStr)] public class The_Borderland_Ruins {