mirror of
https://github.com/Hibiya615/TetoraKAScript.git
synced 2025-12-16 23:09:57 +08:00
260 lines
8.9 KiB
C#
260 lines
8.9 KiB
C#
using System;
|
||
using System.ComponentModel;
|
||
using System.Linq;
|
||
using System.Numerics;
|
||
using System.Collections.Generic;
|
||
// using Dalamud.Game.ClientState.Objects.Subkinds;
|
||
// using Dalamud.Game.ClientState.Objects.Types;
|
||
using Newtonsoft.Json;
|
||
using Dalamud.Utility.Numerics;
|
||
using KodakkuAssist.Script;
|
||
using KodakkuAssist.Module.GameEvent;
|
||
using KodakkuAssist.Module.Draw;
|
||
using KodakkuAssist.Data;
|
||
using KodakkuAssist.Extensions;
|
||
using System.Threading.Tasks;
|
||
|
||
namespace TheHead_theTail_theWholeDamnedThing;
|
||
|
||
[ScriptType(guid: "f11c3069-d163-41dd-904e-b016cfcf089c", name: "灾厄的古塔尼亚之深海讨伐战", territorys: [818],
|
||
version: "0.0.0.5", author: "Tetora", note: noteStr)]
|
||
|
||
public class Archaeotania
|
||
{
|
||
const string noteStr =
|
||
"""
|
||
v0.0.0.4:
|
||
LV80 特殊Fate 绘制
|
||
灾厄的古塔尼亚之深海讨伐战
|
||
""";
|
||
|
||
#region 基础控制
|
||
|
||
[UserSetting("TTS开关(TTS请二选一开启)")]
|
||
public bool isTTS { get; set; } = false;
|
||
|
||
[UserSetting("EdgeTTS开关(TTS请二选一开启)")]
|
||
public bool isEdgeTTS { get; set; } = true;
|
||
|
||
[UserSetting("弹窗文本提示开关")]
|
||
public bool isText { get; set; } = true;
|
||
|
||
#endregion
|
||
|
||
[ScriptMethod(name: "迷失连线", eventType: EventTypeEnum.AddCombatant, eventCondition: ["DataId:regex:^758[67]$"])]
|
||
public void 迷失连线(Event @event, ScriptAccessory accessory)
|
||
{
|
||
// Data ID 7586: 迷失少女 ;7587:迷失者
|
||
if(isText) accessory.Method.TextInfo("迷失出现", duration: 5000, true);
|
||
if(isTTS) accessory.Method.TTS("迷失出现");
|
||
if(isEdgeTTS) accessory.Method.EdgeTTS("迷失出现");
|
||
|
||
var dp = accessory.Data.GetDefaultDrawProperties();
|
||
dp.Name = "迷失连线";
|
||
dp.Owner = accessory.Data.Me;
|
||
dp.Color = accessory.Data.DefaultSafeColor;
|
||
dp.ScaleMode |= ScaleMode.YByDistance;
|
||
dp.TargetObject = @event.SourceId();
|
||
dp.Scale = new(1);
|
||
dp.DestoryAt = 60000;
|
||
accessory.Method.SendDraw(DrawModeEnum.Imgui, DrawTypeEnum.Displacement, dp);
|
||
}
|
||
|
||
[ScriptMethod(name: "迷失连线销毁", eventType: EventTypeEnum.Death, eventCondition: ["TargetDataId:regex:^758[67]$"],userControl: false)]
|
||
public void 迷失连线销毁(Event @event, ScriptAccessory accessory)
|
||
{
|
||
accessory.Method.RemoveDraw("迷失连线");
|
||
}
|
||
|
||
[ScriptMethod(name: "文明毁灭(直线)", eventType: EventTypeEnum.StartCasting, eventCondition: ["ActionId:regex:^(16441|17089)$"])]
|
||
public void 文明毁灭(Event @event, ScriptAccessory accessory)
|
||
{
|
||
var dp = accessory.Data.GetDefaultDrawProperties();
|
||
dp.Name = "文明毁灭";
|
||
dp.Scale = new (15, 62f);
|
||
dp.Owner = @event.SourceId();
|
||
dp.Color = accessory.Data.DefaultDangerColor;
|
||
dp.DestoryAt = 4000;
|
||
accessory.Method.SendDraw(DrawModeEnum.Default, DrawTypeEnum.Rect, dp);
|
||
}
|
||
|
||
[ScriptMethod(name: "巨浪 击退连线", eventType: EventTypeEnum.StartCasting, eventCondition: ["ActionId:16452"])]
|
||
public void 巨浪连线(Event @event, ScriptAccessory accessory)
|
||
{
|
||
if(isText) accessory.Method.TextInfo("靠近水柱击退(百分比真伤)", duration: 8200, true);
|
||
if(isTTS) accessory.Method.TTS("靠近水柱击退");
|
||
if(isEdgeTTS) accessory.Method.EdgeTTS("靠近水柱击退");
|
||
|
||
var dp = accessory.Data.GetDefaultDrawProperties();
|
||
dp.Name = "巨浪连线";
|
||
dp.Owner = accessory.Data.Me;
|
||
dp.Color = accessory.Data.DefaultSafeColor;
|
||
dp.ScaleMode |= ScaleMode.YByDistance;
|
||
dp.TargetObject = @event.SourceId();
|
||
dp.Scale = new(1);
|
||
dp.DestoryAt = 7600;
|
||
accessory.Method.SendDraw(DrawModeEnum.Imgui, DrawTypeEnum.Displacement, dp);
|
||
}
|
||
|
||
[ScriptMethod(name: "龙卷_暴风圈", eventType: EventTypeEnum.AddCombatant, eventCondition: ["DataId:10162"])]
|
||
public void 龙卷(Event @event, ScriptAccessory accessory)
|
||
{
|
||
var dp = accessory.Data.GetDefaultDrawProperties();
|
||
dp.Name = "龙卷";
|
||
dp.Color = new Vector4(1f, 0f, 0f, 1.2f);
|
||
dp.Owner = @event.SourceId();
|
||
dp.Scale = new Vector2(5f);
|
||
dp.DestoryAt = 42000; // 第一次上天阶段约为41.6s,之后战斗途中出现约为30s
|
||
accessory.Method.SendDraw(DrawModeEnum.Default, DrawTypeEnum.Circle, dp);
|
||
}
|
||
|
||
[ScriptMethod(name: "龙卷_前进方向线", eventType: EventTypeEnum.AddCombatant, eventCondition: ["DataId:10162"])]
|
||
public void 龙卷前进方向线(Event @event, ScriptAccessory accessory)
|
||
{
|
||
var dp = accessory.Data.GetDefaultDrawProperties();
|
||
dp.Name = $"龙卷前进方向线";
|
||
dp.Color = new Vector4(1f, 1f, 0f, 1f);
|
||
dp.Owner = @event.SourceId();
|
||
dp.Scale = new Vector2(1f, 5f);
|
||
dp.DestoryAt = 42000;
|
||
accessory.Method.SendDraw(DrawModeEnum.Imgui, DrawTypeEnum.Arrow, dp);
|
||
}
|
||
|
||
[ScriptMethod(name: "龙卷销毁", eventType: EventTypeEnum.RemoveCombatant, eventCondition: ["DataId:10162"], userControl: false)]
|
||
public void 龙卷销毁(Event @event, ScriptAccessory accessory)
|
||
{
|
||
accessory.Method.RemoveDraw("龙卷");
|
||
accessory.Method.RemoveDraw("龙卷前进方向线");
|
||
}
|
||
|
||
[ScriptMethod(name: "龙卷销毁备用", eventType: EventTypeEnum.StartCasting, eventCondition: ["ActionId:16442"], userControl: false)]
|
||
public void 龙卷销毁备用(Event @event, ScriptAccessory accessory)
|
||
{
|
||
// 在第一次上天时,当BOSS读条距离衰减 “空降” 时,销毁
|
||
accessory.Method.RemoveDraw("龙卷");
|
||
accessory.Method.RemoveDraw("龙卷前进方向线");
|
||
}
|
||
|
||
[ScriptMethod(name: "海呱死亡销毁", eventType: EventTypeEnum.Death, eventCondition: ["TargetDataId:10157"],userControl: false)]
|
||
public void 海呱死亡销毁(Event @event, ScriptAccessory accessory)
|
||
{
|
||
accessory.Method.RemoveDraw(".*");
|
||
}
|
||
|
||
}
|
||
|
||
|
||
|
||
public static class EventExtensions
|
||
{
|
||
private static bool ParseHexId(string? idStr, out uint id)
|
||
{
|
||
id = 0;
|
||
if (string.IsNullOrEmpty(idStr)) return false;
|
||
try
|
||
{
|
||
var idStr2 = idStr.Replace("0x", "");
|
||
id = uint.Parse(idStr2, System.Globalization.NumberStyles.HexNumber);
|
||
return true;
|
||
}
|
||
catch (Exception)
|
||
{
|
||
return false;
|
||
}
|
||
}
|
||
|
||
public static uint ActionId(this Event @event)
|
||
{
|
||
return JsonConvert.DeserializeObject<uint>(@event["ActionId"]);
|
||
}
|
||
|
||
public static uint SourceId(this Event @event)
|
||
{
|
||
return ParseHexId(@event["SourceId"], out var id) ? id : 0;
|
||
}
|
||
|
||
public static uint SourceDataId(this Event @event)
|
||
{
|
||
return JsonConvert.DeserializeObject<uint>(@event["SourceDataId"]);
|
||
}
|
||
|
||
public static uint Command(this Event @event)
|
||
{
|
||
return ParseHexId(@event["Command"], out var cid) ? cid : 0;
|
||
}
|
||
|
||
public static uint DurationMilliseconds(this Event @event)
|
||
{
|
||
return JsonConvert.DeserializeObject<uint>(@event["DurationMilliseconds"]);
|
||
}
|
||
|
||
public static float SourceRotation(this Event @event)
|
||
{
|
||
return JsonConvert.DeserializeObject<float>(@event["SourceRotation"]);
|
||
}
|
||
|
||
public static float TargetRotation(this Event @event)
|
||
{
|
||
return JsonConvert.DeserializeObject<float>(@event["TargetRotation"]);
|
||
}
|
||
|
||
public static byte Index(this Event @event)
|
||
{
|
||
return (byte)(ParseHexId(@event["Index"], out var index) ? index : 0);
|
||
}
|
||
|
||
public static uint State(this Event @event)
|
||
{
|
||
return ParseHexId(@event["State"], out var state) ? state : 0;
|
||
}
|
||
|
||
public static string SourceName(this Event @event)
|
||
{
|
||
return @event["SourceName"];
|
||
}
|
||
|
||
public static string TargetName(this Event @event)
|
||
{
|
||
return @event["TargetName"];
|
||
}
|
||
|
||
public static uint TargetId(this Event @event)
|
||
{
|
||
return ParseHexId(@event["TargetId"], out var id) ? id : 0;
|
||
}
|
||
|
||
public static Vector3 SourcePosition(this Event @event)
|
||
{
|
||
return JsonConvert.DeserializeObject<Vector3>(@event["SourcePosition"]);
|
||
}
|
||
|
||
public static Vector3 TargetPosition(this Event @event)
|
||
{
|
||
return JsonConvert.DeserializeObject<Vector3>(@event["TargetPosition"]);
|
||
}
|
||
|
||
public static Vector3 EffectPosition(this Event @event)
|
||
{
|
||
return JsonConvert.DeserializeObject<Vector3>(@event["EffectPosition"]);
|
||
}
|
||
|
||
public static uint DirectorId(this Event @event)
|
||
{
|
||
return ParseHexId(@event["DirectorId"], out var id) ? id : 0;
|
||
}
|
||
|
||
public static uint StatusId(this Event @event)
|
||
{
|
||
return JsonConvert.DeserializeObject<uint>(@event["StatusId"]);
|
||
}
|
||
|
||
public static uint StackCount(this Event @event)
|
||
{
|
||
return JsonConvert.DeserializeObject<uint>(@event["StackCount"]);
|
||
}
|
||
|
||
public static uint Param(this Event @event)
|
||
{
|
||
return JsonConvert.DeserializeObject<uint>(@event["Param"]);
|
||
}
|
||
} |