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
2654937
commit 5a24eff
Showing
9 changed files
with
235 additions
and
162 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
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
75 changes: 73 additions & 2 deletions
75
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 |
---|---|---|
@@ -1,20 +1,91 @@ | ||
using Dalamud.Game.ClientState.Objects.SubKinds; | ||
using ECommons.GameHelpers; | ||
using System.Text.RegularExpressions; | ||
|
||
namespace RotationSolver.Basic.Configuration.Timeline.TimelineCondition; | ||
|
||
internal class ObjectGetter | ||
{ | ||
public bool IsPlayer { get; set; } = false; | ||
public ObjectType Type { get; set; } | ||
public string DataID { get; set; } = ""; | ||
public JobRole Role { get; set; } = JobRole.None; | ||
public uint Status { get; set; } | ||
public float StatusTime { get; set; } = 5; | ||
public Vector2 TimeDuration { get; set; } = new(0, 2); | ||
public string VfxPath { get; set; } = string.Empty; | ||
public ushort ObjectEffect1 { get; set; } = 0; | ||
public ushort ObjectEffect2 { get; set; } = 0; | ||
public bool CanGet(GameObject obj) | ||
{ | ||
if (IsPlayer && obj is not PlayerCharacter) return false; | ||
switch (Type) | ||
{ | ||
case ObjectType.BattleCharactor: | ||
if(obj is not BattleChara) return false; | ||
break; | ||
|
||
case ObjectType.PlayerCharactor: | ||
if (obj is not PlayerCharacter) return false; | ||
break; | ||
|
||
case ObjectType.Myself: | ||
return obj == Player.Object; | ||
} | ||
|
||
if (!string.IsNullOrEmpty(DataID) && !new Regex(DataID).IsMatch(obj.DataId.ToString("X"))) return false; | ||
|
||
if (Role != JobRole.None && !obj.IsJobCategory(Role)) return false; | ||
|
||
if (Status != 0) | ||
{ | ||
if (obj is not BattleChara b) return false; | ||
var status = b.StatusList.FirstOrDefault(s => s.StatusId == Status); | ||
if (status == null) return false; | ||
if (status.RemainingTime > StatusTime) return false; | ||
} | ||
|
||
if (!string.IsNullOrEmpty(VfxPath)) | ||
{ | ||
if (!DataCenter.VfxNewData.Reverse().Any(effect => | ||
{ | ||
if (effect.ObjectId != obj.ObjectId) return false; | ||
|
||
var time = effect.TimeDuration.TotalSeconds; | ||
|
||
if (time < TimeDuration.X) return false; | ||
if (time > TimeDuration.Y) return false; | ||
|
||
if (effect.Path != VfxPath) return false; | ||
|
||
return true; | ||
})) return false; | ||
} | ||
|
||
if (ObjectEffect1 != 0 || ObjectEffect2 != 0) | ||
{ | ||
if (!DataCenter.ObjectEffects.Reverse().Any(effect => | ||
{ | ||
if (effect.ObjectId != obj.ObjectId) return false; | ||
|
||
var time = effect.TimeDuration.TotalSeconds; | ||
|
||
if (time < TimeDuration.X) return false; | ||
if (time > TimeDuration.Y) return false; | ||
|
||
if (effect.Param1 != ObjectEffect1) return false; | ||
if (effect.Param2 != ObjectEffect2) return false; | ||
|
||
return true; | ||
})) return false; | ||
} | ||
|
||
return true; | ||
} | ||
} | ||
|
||
public enum ObjectType : byte | ||
{ | ||
GameObject, | ||
BattleCharactor, | ||
PlayerCharactor, | ||
Myself, | ||
} |
26 changes: 26 additions & 0 deletions
26
RotationSolver.Basic/Configuration/Timeline/TimelineCondition/TimelineConditionMapEffect.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,26 @@ | ||
namespace RotationSolver.Basic.Configuration.Timeline.TimelineCondition; | ||
|
||
[Description("Map Effect")] | ||
internal class TimelineConditionMapEffect : ITimelineCondition | ||
{ | ||
public Vector2 TimeDuration { get; set; } = new(0, 2); | ||
public int Position { get; set; } | ||
public int Param1 { get; set; } | ||
public int Param2 { get; set; } | ||
public bool IsTrue(TimelineItem item) | ||
{ | ||
return DataCenter.MapEffects.Reverse().Any(effect => | ||
{ | ||
var time = effect.TimeDuration.TotalSeconds; | ||
|
||
if (time < TimeDuration.X) return false; | ||
if (time > TimeDuration.Y) return false; | ||
|
||
if (effect.Position != Position) return false; | ||
if (effect.Param1 != Param1) return false; | ||
if (effect.Param2 != Param2) 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
6 changes: 0 additions & 6 deletions
6
RotationSolver.Basic/Configuration/Timeline/TimelineCondition/TrueTimelineCondition.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
Oops, something went wrong.