This repository has been archived by the owner on Aug 28, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: timeline drawing first commit.
- Loading branch information
1 parent
d9b08e6
commit df13743
Showing
16 changed files
with
415 additions
and
196 deletions.
There are no files selected for viewing
8 changes: 0 additions & 8 deletions
8
RotationSolver.Basic/Configuration/Timeline/CastingOmenConfig.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
RotationSolver.Basic/Configuration/Timeline/TimelineCondition/ITimelineConditionConverter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using Newtonsoft.Json.Linq; | ||
using RotationSolver.Basic.Configuration.Conditions; | ||
using RotationSolver.Basic.Configuration.Timeline.TimelineDrawing; | ||
|
||
namespace RotationSolver.Basic.Configuration.Timeline.TimelineCondition; | ||
internal class ITimelineConditionConverter : JsonCreationConverter<ITimelineCondition> | ||
{ | ||
protected override ITimelineCondition? Create(JObject jObject) | ||
{ | ||
if (FieldExists(nameof(ActionDrawingGetter.ActionID), jObject)) | ||
{ | ||
//return new ActionDrawingGetter(); | ||
} | ||
|
||
return new TrueTimelineCondition(); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
RotationSolver.Basic/Configuration/Timeline/TimelineCondition/ObjectGetter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
namespace RotationSolver.Basic.Configuration.Timeline.TimelineCondition; | ||
public class ObjectGetter | ||
{ | ||
public bool CanGet(GameObject obj) | ||
{ | ||
return true; | ||
} | ||
|
||
public GameObject[] TargetGetter(GameObject obj) | ||
{ | ||
return []; | ||
} | ||
} |
78 changes: 78 additions & 0 deletions
78
RotationSolver.Basic/Configuration/Timeline/TimelineDrawing/ActionDrawingGetter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
using ECommons.DalamudServices; | ||
using ECommons.GameFunctions; | ||
using RotationSolver.Basic.Configuration.Timeline.TimelineCondition; | ||
using XIVPainter; | ||
using XIVPainter.Vfx; | ||
using Action = Lumina.Excel.GeneratedSheets.Action; | ||
|
||
namespace RotationSolver.Basic.Configuration.Timeline.TimelineDrawing; | ||
|
||
[Description("Action Drawing")] | ||
internal class ActionDrawingGetter : IDrawingGetter | ||
{ | ||
public uint ActionID { get; set; } | ||
public string Path { get; set; } = ""; | ||
public float? X { get; set; } | ||
public float? Y { get; set; } | ||
public Vector3 Position { get; set; } | ||
public float Rotation { get; set; } | ||
public ObjectGetter ObjectGetter { get; set; } = new(); | ||
|
||
public IDisposable[] GetDrawing() | ||
{ | ||
var objs = Svc.Objects.Where(ObjectGetter.CanGet); | ||
if (objs.Any()) | ||
{ | ||
return [.. objs.Select(GetActionDrawing).OfType<IDisposable>()]; | ||
} | ||
|
||
var item = GetActionDrawing(null); | ||
if (item == null) return []; | ||
return [item]; | ||
} | ||
|
||
private IDisposable? GetActionDrawing(GameObject? obj) | ||
{ | ||
if (ActionID == 0) return null; | ||
var action = Svc.Data.GetExcelSheet<Action>()?.GetRow(ActionID); | ||
if (action == null) return null; | ||
var omen = action.Omen.Value?.Path?.RawString; | ||
omen = string.IsNullOrEmpty(omen) ? Path : omen.Omen(); | ||
|
||
var x = X ?? (action.XAxisModifier > 0 ? action.XAxisModifier / 2 : action.EffectRange); | ||
var y = Y ?? action.EffectRange; | ||
var scale = new Vector3(x, XIVPainterMain.HeightScale, y); | ||
|
||
if (action.TargetArea) | ||
{ | ||
var location = Position; | ||
if (obj is BattleChara battle) | ||
{ | ||
unsafe | ||
{ | ||
var info = battle.Struct()->GetCastInfo; | ||
if (info->IsCasting != 0) | ||
{ | ||
location = info->CastLocation; | ||
} | ||
} | ||
} | ||
return new StaticVfx(omen, location, 0, scale); | ||
} | ||
else | ||
{ | ||
if(obj != null) | ||
{ | ||
return new StaticVfx(omen, obj, scale) | ||
{ | ||
RotateAddition = Rotation / 180 * MathF.PI, | ||
LocationOffset = Position, | ||
}; | ||
} | ||
else | ||
{ | ||
return new StaticVfx(omen, Position, Rotation, scale); | ||
} | ||
} | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
RotationSolver.Basic/Configuration/Timeline/TimelineDrawing/IDrawingGetter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
namespace RotationSolver.Basic.Configuration.Timeline.TimelineDrawing; | ||
internal interface IDrawingGetter | ||
{ | ||
IDisposable[] GetDrawing(); | ||
} |
25 changes: 25 additions & 0 deletions
25
RotationSolver.Basic/Configuration/Timeline/TimelineDrawing/IDrawingGetterConverter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using Newtonsoft.Json.Linq; | ||
using RotationSolver.Basic.Configuration.Conditions; | ||
|
||
namespace RotationSolver.Basic.Configuration.Timeline.TimelineDrawing; | ||
|
||
internal class IDrawingGetterConverter : JsonCreationConverter<IDrawingGetter> | ||
{ | ||
protected override IDrawingGetter? Create(JObject jObject) | ||
{ | ||
if (FieldExists(nameof(ActionDrawingGetter.ActionID), jObject)) | ||
{ | ||
return new ActionDrawingGetter(); | ||
} | ||
else if (FieldExists(nameof(ObjectDrawingGetter.IsActorEffect), jObject)) | ||
{ | ||
return new ObjectDrawingGetter(); | ||
} | ||
else if (FieldExists(nameof(StaticDrawingGetter.Text), jObject)) | ||
{ | ||
return new StaticDrawingGetter(); | ||
} | ||
|
||
return null; | ||
} | ||
} |
Oops, something went wrong.