mirror of
https://github.com/Hibiya615/TetoraKAScript.git
synced 2025-12-16 23:09:57 +08:00
253 lines
8.7 KiB
C#
253 lines
8.7 KiB
C#
using System;
|
||
using System.ComponentModel;
|
||
using System.Linq;
|
||
using System.Numerics;
|
||
using System.Collections.Generic;
|
||
using Newtonsoft.Json;
|
||
using Dalamud.Utility.Numerics;
|
||
using KodakkuAssist.Script;
|
||
using KodakkuAssist.Module.GameEvent;
|
||
using KodakkuAssist.Module.Draw;
|
||
using KodakkuAssist.Data;
|
||
using System.Threading.Tasks;
|
||
|
||
namespace Kugane_Ohashi;
|
||
|
||
[ScriptType(guid: "944c8879-0d4e-4182-87ea-c38769990f2d", name: "保镖歼灭战", territorys: [806],
|
||
version: "0.0.0.3", author: "Tetora", note: noteStr)]
|
||
public class Yojimbo
|
||
{
|
||
const string noteStr =
|
||
"""
|
||
v0.0.0.2:
|
||
LV70 保镖歼灭战 初版绘制
|
||
""";
|
||
|
||
[UserSetting("TTS开关(TTS请二选一开启)")]
|
||
public bool isTTS { get; set; } = false;
|
||
|
||
[UserSetting("EdgeTTS开关(TTS请二选一开启)")]
|
||
public bool isEdgeTTS { get; set; } = true;
|
||
|
||
[UserSetting("弹窗文本提示开关")]
|
||
public bool isText { get; set; } = true;
|
||
|
||
[ScriptMethod(name: "猪鹿蝶_人生短暂(钢铁)", eventType: EventTypeEnum.AddCombatant, eventCondition: ["DataId:9726"])]
|
||
public void 人生短暂(Event @event, ScriptAccessory accessory)
|
||
{
|
||
var dp = accessory.Data.GetDefaultDrawProperties();
|
||
dp.Name = "人生短暂";
|
||
dp.Color = accessory.Data.DefaultDangerColor.WithW(0.8f);
|
||
dp.Owner = @event.SourceId();
|
||
dp.Scale = new Vector2(8f);
|
||
dp.DestoryAt = 7500;
|
||
accessory.Method.SendDraw(DrawModeEnum.Default, DrawTypeEnum.Circle, dp);
|
||
}
|
||
|
||
[ScriptMethod(name: "居合多段斩(AOE)", eventType: EventTypeEnum.StartCasting, eventCondition: ["ActionId:14376"])]
|
||
public void 居合多段斩(Event @event, ScriptAccessory accessory)
|
||
{
|
||
if (isText)accessory.Method.TextInfo("AOE", duration: 2000, false);
|
||
if (isTTS)accessory.Method.TTS("AOE");
|
||
if (isEdgeTTS)accessory.Method.EdgeTTS("AOE");
|
||
}
|
||
|
||
[ScriptMethod(name: "月光(钢铁描边)", eventType: EventTypeEnum.TargetIcon, eventCondition: ["Id:0090"])]
|
||
public void 月光(Event @event, ScriptAccessory accessory)
|
||
{
|
||
var dp = accessory.Data.GetDefaultDrawProperties();
|
||
dp.Name = "月光";
|
||
dp.Color = accessory.Data.DefaultDangerColor;
|
||
dp.Owner = @event.TargetId();
|
||
dp.Scale = new Vector2(5.05f);
|
||
dp.InnerScale = new Vector2(5f);
|
||
dp.Radian = float.Pi * 2;
|
||
dp.DestoryAt = 4200;
|
||
accessory.Method.SendDraw(DrawModeEnum.Imgui, DrawTypeEnum.Donut, dp);
|
||
}
|
||
|
||
/* 太瞎了 废弃
|
||
[ScriptMethod(name: "花车(月环)", eventType: EventTypeEnum.StartCasting, eventCondition: ["ActionId:14388"])]
|
||
public void 花车(Event @event, ScriptAccessory accessory)
|
||
{
|
||
var dp = accessory.Data.GetDefaultDrawProperties();
|
||
dp.Name = "花车";
|
||
dp.Color = accessory.Data.DefaultDangerColor;
|
||
dp.Position = @event.EffectPosition();
|
||
dp.Scale = new Vector2(10f);
|
||
dp.InnerScale = new Vector2(3f);
|
||
dp.Radian = float.Pi * 2;
|
||
dp.DestoryAt = 3700;
|
||
accessory.Method.SendDraw(DrawModeEnum.Default, DrawTypeEnum.Donut, dp);
|
||
}
|
||
*/
|
||
|
||
[ScriptMethod(name: "缩小旋律(点名集合)", eventType: EventTypeEnum.StartCasting, eventCondition: ["ActionId:14389"])]
|
||
public void 缩小旋律(Event @event, ScriptAccessory accessory)
|
||
{
|
||
if (isText)accessory.Method.TextInfo("点名集合", duration: 4000, true);
|
||
// if (isTTS)accessory.Method.TTS("点名集合");
|
||
// if (isEdgeTTS)accessory.Method.EdgeTTS("点名集合");
|
||
}
|
||
|
||
[ScriptMethod(name: "龙头", eventType: EventTypeEnum.AddCombatant, eventCondition: ["DataId:9729"])]
|
||
public void 龙头(Event @event, ScriptAccessory accessory)
|
||
{
|
||
var dp = accessory.Data.GetDefaultDrawProperties();
|
||
dp.Name = "龙头";
|
||
dp.Owner = @event.SourceId();
|
||
dp.Color = accessory.Data.DefaultDangerColor;
|
||
dp.Scale = new(6f, 10f);
|
||
dp.DestoryAt = 15000;
|
||
accessory.Method.SendDraw(DrawModeEnum.Default, DrawTypeEnum.Straight, dp);
|
||
}
|
||
|
||
[ScriptMethod(name: "龙头销毁", eventType: EventTypeEnum.RemoveCombatant, eventCondition: ["DataId:9729"],userControl: false)]
|
||
public void 龙头销毁(Event @event, ScriptAccessory accessory)
|
||
{
|
||
accessory.Method.RemoveDraw("龙头");
|
||
}
|
||
|
||
[ScriptMethod(name: "天之丛云(AOE)", eventType: EventTypeEnum.StartCasting, eventCondition: ["ActionId:14397"])]
|
||
public void 天之丛云(Event @event, ScriptAccessory accessory)
|
||
{
|
||
if (isText)accessory.Method.TextInfo("AOE", duration: 3000, false);
|
||
if (isTTS)accessory.Method.TTS("AOE");
|
||
if (isEdgeTTS)accessory.Method.EdgeTTS("AOE");
|
||
}
|
||
|
||
[ScriptMethod(name: "电击_雷击(钢铁)", eventType: EventTypeEnum.AddCombatant, eventCondition: ["DataId:9731"])]
|
||
public void 雷击(Event @event, ScriptAccessory accessory)
|
||
{
|
||
var dp = accessory.Data.GetDefaultDrawProperties();
|
||
dp.Name = "雷击";
|
||
dp.Color = accessory.Data.DefaultDangerColor.WithW(0.8f);
|
||
dp.Owner = @event.SourceId();
|
||
dp.Scale = new Vector2(8f);
|
||
dp.DestoryAt = 6800;
|
||
accessory.Method.SendDraw(DrawModeEnum.Default, DrawTypeEnum.Circle, dp);
|
||
}
|
||
|
||
[ScriptMethod(name: "捕获 锁链点名", eventType: EventTypeEnum.TargetIcon, eventCondition: ["Id:0005"])]
|
||
public void 捕获(Event @event, ScriptAccessory accessory)
|
||
{
|
||
if (@event.TargetId() != accessory.Data.Me) return;
|
||
if (isText)accessory.Method.TextInfo("锁链点名,远离扯线", duration: 4000, true);
|
||
// if (isTTS)accessory.Method.TTS("锁链点名");
|
||
// if (isEdgeTTS)accessory.Method.EdgeTTS("锁链点名");
|
||
}
|
||
}
|
||
|
||
public static class EventExtensions
|
||
{
|
||
private static bool ParseHexId(string? idStr, out uint id)
|
||
{
|
||
id = 0;
|
||
if (string.IsNullOrEmpty(idStr)) return false;
|
||
try
|
||
{
|
||
var idStr2 = idStr.Replace("0x", "");
|
||
id = uint.Parse(idStr2, System.Globalization.NumberStyles.HexNumber);
|
||
return true;
|
||
}
|
||
catch (Exception)
|
||
{
|
||
return false;
|
||
}
|
||
}
|
||
|
||
public static uint ActionId(this Event @event)
|
||
{
|
||
return JsonConvert.DeserializeObject<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"]);
|
||
}
|
||
} |