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
635cf32
commit 4cda9b1
Showing
15 changed files
with
379 additions
and
20 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
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/ActionTimelineItem.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 @@ | ||
namespace RotationSolver.Basic.Configuration.Timeline; | ||
internal class ActionTimelineItem : ITimelineItem | ||
{ | ||
public ActionID ID { get; set; } = ActionID.None; | ||
public float Time { get; set; } = 3; | ||
public float Duration { get; set; } = 3; | ||
|
||
public bool InPeriod(TimelineItem item) | ||
{ | ||
var time = item.Time - DataCenter.RaidTimeRaw; | ||
|
||
if (time < 0) return false; | ||
|
||
if (time > Time || Time - time > 3) return false; | ||
return 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace RotationSolver.Basic.Configuration.Timeline; | ||
|
||
internal interface ITimelineItem | ||
{ | ||
public float Time { get; set; } | ||
public float Duration { get; set; } | ||
public bool InPeriod(TimelineItem item); | ||
} |
20 changes: 20 additions & 0 deletions
20
RotationSolver.Basic/Configuration/Timeline/ITimelineItemConverter.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,20 @@ | ||
using Newtonsoft.Json.Linq; | ||
using RotationSolver.Basic.Configuration.Conditions; | ||
|
||
namespace RotationSolver.Basic.Configuration.Timeline; | ||
|
||
internal class ITimelineItemConverter : JsonCreationConverter<ITimelineItem> | ||
{ | ||
protected override ITimelineItem? Create(JObject jObject) | ||
{ | ||
if (FieldExists(nameof(ActionTimelineItem.ID), jObject)) | ||
{ | ||
return new ActionTimelineItem(); | ||
} | ||
else if (FieldExists(nameof(StateTimelineItem.State), jObject)) | ||
{ | ||
return new StateTimelineItem(); | ||
} | ||
return null; | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
RotationSolver.Basic/Configuration/Timeline/StateTimelineItem.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,18 @@ | ||
namespace RotationSolver.Basic.Configuration.Timeline; | ||
|
||
internal class StateTimelineItem : ITimelineItem | ||
{ | ||
public AutoStatus State { get; set; } | ||
public float Time { get; set; } = 3; | ||
public float Duration { get; set; } = 3; | ||
|
||
public bool InPeriod(TimelineItem item) | ||
{ | ||
var time = item.Time - DataCenter.RaidTimeRaw; | ||
|
||
if (time < 0) return false; | ||
|
||
if (time > Time || Time - time > Duration) return false; | ||
return 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
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
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.