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.
- Loading branch information
1 parent
0ebc6b0
commit d9b08e6
Showing
21 changed files
with
306 additions
and
258 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"ClickingCount": 98903, | ||
"ClickingCount": 98904, | ||
"SayingHelloCount": 165, | ||
"SaidUsers": [] | ||
} |
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
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
29 changes: 29 additions & 0 deletions
29
RotationSolver.Basic/Configuration/Timeline/BaseTimelineItem.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,29 @@ | ||
namespace RotationSolver.Basic.Configuration.Timeline; | ||
|
||
internal abstract class BaseTimelineItem | ||
{ | ||
public float Time { get; set; } = 3; | ||
private bool _enable = false; | ||
internal bool Enable | ||
{ | ||
get => _enable; | ||
set | ||
{ | ||
if (_enable == value) return; | ||
_enable = value; | ||
|
||
if (_enable) | ||
{ | ||
OnEnable(); | ||
} | ||
else | ||
{ | ||
OnDisable(); | ||
} | ||
} | ||
} | ||
public abstract bool InPeriod(TimelineItem item); | ||
|
||
protected virtual void OnEnable() { } | ||
protected virtual void OnDisable() { } | ||
} |
3 changes: 1 addition & 2 deletions
3
.../Configuration/Omens/CastingOmenConfig.cs → ...nfiguration/Timeline/CastingOmenConfig.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 |
---|---|---|
@@ -1,9 +1,8 @@ | ||
namespace RotationSolver.Basic.Configuration.Omens; | ||
namespace RotationSolver.Basic.Configuration.Timeline; | ||
public struct CastingOmenConfig | ||
{ | ||
public string? OmenPath { get; set; } | ||
public float? X { get; set; } | ||
public float? Y { get; set; } | ||
|
||
public float? Rotation { get; set; } | ||
} |
195 changes: 195 additions & 0 deletions
195
RotationSolver.Basic/Configuration/Timeline/DrawingTimeline.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,195 @@ | ||
using ECommons.Configuration; | ||
using ECommons.DalamudServices; | ||
using ECommons.GameFunctions; | ||
using RotationSolver.Basic.Configuration.Timeline.TimelineCondition; | ||
using XIVPainter; | ||
using XIVPainter.Element; | ||
using XIVPainter.Vfx; | ||
using Action = Lumina.Excel.GeneratedSheets.Action; | ||
|
||
|
||
namespace RotationSolver.Basic.Configuration.Timeline; | ||
|
||
[Description("Drawing Timeline")] | ||
internal class DrawingTimeline : BaseTimelineItem | ||
{ | ||
private IDisposable[] _drawings = []; | ||
public ITimelineCondition Condition { get; set; } = new TrueTimelineCondition(); | ||
public StaticVfxConfig StaticVfxConfig { get; set; } | ||
public ObjectVfxConfig ObjectConfig { get; set; } | ||
public ActionVfxConfig ActionConfig { get; set; } | ||
public ObjectGetter ObjectGetter { get; set; } = new(); | ||
public DrawingType Type { get; set; } | ||
|
||
public uint ActionID { get; set; } | ||
public DrawingTimeline() | ||
{ | ||
Time = 5; | ||
} | ||
|
||
public override bool InPeriod(TimelineItem item) | ||
{ | ||
var time = item.Time - DataCenter.RaidTimeRaw; | ||
|
||
if (time < 0) return false; | ||
if (time > Time) return false; | ||
|
||
if (!Condition.IsTrue()) return false; | ||
|
||
return true; | ||
} | ||
|
||
protected override void OnEnable() | ||
{ | ||
foreach (var item in _drawings) | ||
{ | ||
item.Dispose(); | ||
} | ||
_drawings = CreateDrawing(); | ||
|
||
#if DEBUG | ||
//Svc.Log.Debug($"Added the state {item2.State} to timeline."); | ||
#endif | ||
base.OnEnable(); | ||
} | ||
|
||
protected override void OnDisable() | ||
{ | ||
foreach (var item in _drawings) | ||
{ | ||
item.Dispose(); | ||
} | ||
_drawings = []; | ||
base.OnDisable(); | ||
} | ||
|
||
private IDisposable[] CreateDrawing() | ||
{ | ||
switch (Type) | ||
{ | ||
case DrawingType.Ground: | ||
if (string.IsNullOrEmpty(StaticVfxConfig.Path)) break; | ||
|
||
return [new StaticVfx(StaticVfxConfig.Path, StaticVfxConfig.Position, StaticVfxConfig.Rotation, StaticVfxConfig.Scale)]; | ||
|
||
case DrawingType.Object: | ||
return [..ObjectGetter.GetObjects().Select(GetObjectDrawing)]; | ||
|
||
case DrawingType.Action: | ||
return [.. ObjectGetter.GetObjects().Select(GetActionDrawing)]; | ||
} | ||
return []; | ||
} | ||
|
||
private IDisposable? GetObjectDrawing(GameObject obj) | ||
{ | ||
switch (ObjectConfig.Type) | ||
{ | ||
case ObjectVfxConfig.ObjectType.Single: | ||
return new Single1(obj, ObjectConfig.Radius); | ||
|
||
case ObjectVfxConfig.ObjectType.Stack2: | ||
return new Share2(obj, ObjectConfig.Radius); | ||
|
||
case ObjectVfxConfig.ObjectType.Stack4: | ||
return new Share4(obj, ObjectConfig.Radius); | ||
|
||
case ObjectVfxConfig.ObjectType.General: | ||
if (string.IsNullOrEmpty(StaticVfxConfig.Path)) break; | ||
|
||
var result = new StaticVfx(StaticVfxConfig.Path, obj, StaticVfxConfig.Scale) | ||
{ | ||
LocationOffset = StaticVfxConfig.Position, | ||
RotateAddition = StaticVfxConfig.Rotation, | ||
}; | ||
if (ObjectConfig.TargetOnTarget) | ||
{ | ||
result.Target = obj.TargetObject; | ||
} | ||
return result; | ||
} | ||
return null; | ||
} | ||
|
||
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) ? StaticVfxConfig.Path : omen.Omen(); | ||
|
||
var x = ActionConfig.X ?? (action.XAxisModifier > 0 ? action.XAxisModifier / 2 : action.EffectRange); | ||
var y = ActionConfig.Y ?? action.EffectRange; | ||
var scale = new Vector3(x, XIVPainterMain.HeightScale, y); | ||
|
||
if (action.TargetArea) | ||
{ | ||
var location = StaticVfxConfig.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 | ||
{ | ||
return new StaticVfx(omen, obj, scale) | ||
{ | ||
RotateAddition = StaticVfxConfig.Rotation / 180 * MathF.PI, | ||
LocationOffset = StaticVfxConfig.Position, | ||
}; | ||
} | ||
} | ||
} | ||
|
||
public class ObjectGetter | ||
{ | ||
public GameObject[] GetObjects() | ||
{ | ||
return []; | ||
} | ||
} | ||
|
||
public struct ActionVfxConfig | ||
{ | ||
public float? X { get; set; } | ||
public float? Y { get; set; } | ||
} | ||
|
||
public struct ObjectVfxConfig | ||
{ | ||
public enum ObjectType | ||
{ | ||
Single, | ||
Stack2, | ||
Stack4, | ||
General, | ||
} | ||
|
||
public float Radius { get; set; } | ||
public bool TargetOnTarget { get; set; } | ||
public ObjectType Type { get; set; } | ||
} | ||
|
||
public struct StaticVfxConfig | ||
{ | ||
public string Path { get; set; } | ||
public Vector3 Position { get; set; } | ||
public float Rotation { get; set; } | ||
public Vector3 Scale { get; set; } | ||
} | ||
|
||
public enum DrawingType | ||
{ | ||
Ground, | ||
Object, | ||
Action, | ||
} |
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
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
5 changes: 5 additions & 0 deletions
5
RotationSolver.Basic/Configuration/Timeline/TimelineCondition/ITimelineCondition.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.TimelineCondition; | ||
public interface ITimelineCondition | ||
{ | ||
bool IsTrue(); | ||
} |
6 changes: 6 additions & 0 deletions
6
RotationSolver.Basic/Configuration/Timeline/TimelineCondition/TrueTimelineCondition.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,6 @@ | ||
namespace RotationSolver.Basic.Configuration.Timeline.TimelineCondition; | ||
|
||
public class TrueTimelineCondition : ITimelineCondition | ||
{ | ||
public bool IsTrue() => true; | ||
} |
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
Oops, something went wrong.