Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
fix: add record feature for the rotation helper.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Jul 12, 2024
1 parent 3547acb commit 1b32d56
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 31 deletions.
4 changes: 4 additions & 0 deletions ActionTimelineEx/Configurations/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ public string RotationName
}
}

[JsonIgnore]
[UI("Record Rotation", 2)]
public bool RecordRotation { get; set; } = false;

[JsonProperty]
private Dictionary<uint, Dictionary<Job, RotationsSetting>> _rotationHelpers = [];

Expand Down
45 changes: 43 additions & 2 deletions ActionTimelineEx/Helpers/RotationHelper.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using ActionTimelineEx.Configurations;
using ActionTimelineEx.Timeline;
using ActionTimelineEx.Windows;
using ECommons.DalamudServices;
using ECommons.GameHelpers;
Expand Down Expand Up @@ -109,12 +110,26 @@ private static void ActionFromSelf(ActionEffectSet set)
{
if (!Player.Available) return;
if (set.Source.EntityId != Player.Object.EntityId || !Plugin.Settings.DrawRotation) return;
if (set.Action == null) return;
if ((ActionCate)(set.Action?.ActionCategory.Value?.RowId ?? 0) is ActionCate.AutoAttack) return; //Auto Attack.

if (Plugin.Settings.RecordRotation)
{
RecordRotation(set);
return;
}

var action = ActiveAction;
if (action == null) return;

var succeed = set.Action.RowId == action.ActionId;
bool succeed = set.Header.ActionID == action.ActionId;
switch (set.Header.ActionType)
{
case FFXIVClientStructs.FFXIV.Client.Game.ActionType.Action when action.Type != ActionSettingType.Action:
case FFXIVClientStructs.FFXIV.Client.Game.ActionType.Item when action.Type != ActionSettingType.Item:
succeed = false;
break;

}
if (succeed)
{
SuccessCount++;
Expand All @@ -126,6 +141,32 @@ private static void ActionFromSelf(ActionEffectSet set)
Count++;
}

private static void RecordRotation(in ActionEffectSet set)
{
ActionSettingType? type = null;

switch (set.Header.ActionType)
{
case FFXIVClientStructs.FFXIV.Client.Game.ActionType.Action:
type = ActionSettingType.Action;
break;

case FFXIVClientStructs.FFXIV.Client.Game.ActionType.Item:
type = ActionSettingType.Item;
break;
}

if (type != null)
{
RotationSetting.Actions.Add(new ActionSetting()
{
ActionId = set.Header.ActionID,
Type = type.Value,
});
}
}


public static void Clear()
{
Count = 0;
Expand Down
62 changes: 34 additions & 28 deletions ActionTimelineEx/Localization/Localization.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,24 @@
"XIVConfigUI.LocalString.Searching": "Search... ",
"ActionTimelineEx.Windows.RotationHelperItem": "Rotation Helper",
"ActionTimelineEx.Windows.ChangeLogItem": "ChangeLog",
"ActionTimelineEx.Description": "Configurable timeline display of all the actions you use.",
"XIVConfigUI.LocalString.SourceCode": "Click to see the source code!",
"XIVConfigUI.LocalString.Localization": "Click to open the crowdin for modifying localization!",
"ActionTimelineEx.Configurations.UiString.AddOne": "Add One Timeline",
"ActionTimelineEx.Configurations.UiString.Setting": "Setting",
"ActionTimelineEx.Configurations.UiString.ShowedStatuses": "Showed Statuses",
"ActionTimelineEx.Configurations.UiString.NotStatues": "Don't record these statuses",
"ActionTimelineEx.Configurations.SettingsName.Record": "Record Data",
"ActionTimelineEx.Configurations.SettingsName.ShowTimelineOnlyInDuty": "Show Only In Duty",
"ActionTimelineEx.Configurations.SettingsName.ShowTimelineOnlyInCombat": "Show Only In Combat",
"ActionTimelineEx.Configurations.SettingsName.HideTimelineInCutscene": "Hide In Cutscene",
"ActionTimelineEx.Configurations.SettingsName.HideTimelineInQuestEvent": "Hide In Quest Event",
"ActionTimelineEx.Configurations.SettingsName.SayClipping": "Say Clipping Time",
"ActionTimelineEx.Configurations.SettingsName.ClippintTime": "Clipping Range",
"ActionTimelineEx.Configurations.SettingsName.RecordTargetStatus": "Record Target Status",
"ActionTimelineEx.Configurations.SettingsName.ShowDonate": "Show the donate link.",
"ActionTimelineEx.Configurations.UiString.RotationSetting": "Rotation Setting",
"ActionTimelineEx.Configurations.UiString.Rotation": "Rotation",
"ActionTimelineEx.Configurations.UiString.RotationReset": "Reset Count",
"XIVConfigUI.LocalString.CopyToClipboard": "Copy to Clipboard",
"XIVConfigUI.LocalString.FromClipboard": "From Clipboard",
"ActionTimelineEx.Configurations.SettingsName.RotationChoice": "Rotation Choice",
"XIVConfigUI.LocalString.ResetToDefault": "Reset to Default Value.",
"ActionTimelineEx.Configurations.SettingsName.RotationName": "Rotation Name",
"XIVConfigUI.LocalString.List": "List",
"ActionTimelineEx.Configurations.ActionSetting": "ActionSetting",
"XIVConfigUI.LocalString.Remove": "Remove",
"XIVConfigUI.LocalString.MoveUp": "Move Up",
"XIVConfigUI.LocalString.MoveDown": "Move Down",
"ActionTimelineEx.Configurations.ActionSettingDescription": "Sentinel (Ability)",
"ActionTimelineEx.Configurations.ActionSettingName.Id": "Id",
"ActionTimelineEx.Configurations.ActionSettingType.Action": "Action",
"ActionTimelineEx.Configurations.ActionSettingType.Item": "Item",
"ActionTimelineEx.Configurations.ActionSettingName.Type": "Type",
"ActionTimelineEx.Configurations.SettingsName.DrawRotation": "Draw Rotation",
"ActionTimelineEx.Configurations.SettingsName.RotationLocked": "Locked",
"ActionTimelineEx.Configurations.SettingsName.RotationLockedBackgroundColor": "Locked Background Color",
Expand All @@ -29,8 +31,15 @@
"ActionTimelineEx.Configurations.SettingsName.OGCDIconSize": "Off GCD Icon Size",
"ActionTimelineEx.Configurations.SettingsName.IconSpacing": "Icon Spacing",
"ActionTimelineEx.Configurations.SettingsName.ShowWrongClick": "Show the wrong clicking",
"ActionTimelineEx.Configurations.SettingsName.RotationChoice": "Rotation Choice",
"ActionTimelineEx.Configurations.SettingsName.RotationName": "Rotation Name",
"ActionTimelineEx.Configurations.SettingsName.Record": "Record Data",
"ActionTimelineEx.Configurations.SettingsName.ShowTimelineOnlyInDuty": "Show Only In Duty",
"ActionTimelineEx.Configurations.SettingsName.ShowTimelineOnlyInCombat": "Show Only In Combat",
"ActionTimelineEx.Configurations.SettingsName.HideTimelineInCutscene": "Hide In Cutscene",
"ActionTimelineEx.Configurations.SettingsName.HideTimelineInQuestEvent": "Hide In Quest Event",
"ActionTimelineEx.Configurations.SettingsName.SayClipping": "Say Clipping Time",
"ActionTimelineEx.Configurations.SettingsName.ClippintTime": "Clipping Range",
"ActionTimelineEx.Configurations.SettingsName.RecordTargetStatus": "Record Target Status",
"ActionTimelineEx.Configurations.SettingsName.ShowDonate": "Show the donate link.",
"ActionTimelineEx.Configurations.DrawingSettingsName.Name": "The timeline Name",
"ActionTimelineEx.Configurations.DrawingSettingsName.Enable": "Enable",
"ActionTimelineEx.Configurations.DrawingSettingsName.IsRotation": "Is Rotation",
Expand Down Expand Up @@ -98,25 +107,22 @@
"ActionTimelineEx.Configurations.GroupItem.Bar": "Bar",
"ActionTimelineEx.Configurations.GroupItem.Grid": "Grid",
"ActionTimelineEx.Configurations.GroupItem.GcdClipping": "GCD Clipping",
"ActionTimelineEx.Configurations.UiString.Setting": "Setting",
"ActionTimelineEx.Configurations.UiString.ShowedStatuses": "Showed Statuses",
"ActionTimelineEx.Configurations.UiString.NotStatues": "Don't record these statuses",
"ActionTimelineEx.Configurations.UiString.Wait": "Please wait for a second.",
"ActionTimelineEx.Configurations.UiString.Confirm": "Are you sure to remove this timeline?",
"ActionTimelineEx.Configurations.UiString.Remove": "Click to remove this timeline.",
"ActionTimelineEx.Configurations.UiString.AddOne": "Add One Timeline",
"ActionTimelineEx.Configurations.UiString.RemoveDesc": "Remove this Item:",
"ActionTimelineEx.Configurations.UiString.RotationSetting": "Rotation Setting",
"ActionTimelineEx.Configurations.UiString.Rotation": "Rotation",
"ActionTimelineEx.Configurations.UiString.RotationReset": "Reset Count",
"XIVConfigUI.LocalString.Search_Result": "Search Result",
"XIVConfigUI.LocalString.Search": "Search",
"XIVConfigUI.LocalString.ResetToDefault": "Reset to Default Value.",
"XIVConfigUI.LocalString.ExecuteCommand": "Execute \"{0}\"",
"XIVConfigUI.LocalString.CopyCommand": "Copy \"{0}\"",
"XIVConfigUI.LocalString.Remove": "Remove",
"XIVConfigUI.LocalString.MoveUp": "Move Up",
"XIVConfigUI.LocalString.MoveDown": "Move Down",
"XIVConfigUI.LocalString.CopyToClipboard": "Copy to Clipboard",
"XIVConfigUI.LocalString.FromClipboard": "From Clipboard",
"XIVConfigUI.LocalString.List": "List",
"XIVConfigUI.LocalString.Localization": "Click to open the crowdin for modifying localization!",
"XIVConfigUI.LocalString.SourceCode": "Click to see the source code!",
"XIVConfigUI.LocalString.Nothing": "No items in Combo",
"XIVConfigUI.LocalString.None": "None",
"XIVConfigUI.Attributes.ConfigUnitType.Seconds": "Time Unit, in seconds.",
"XIVConfigUI.Attributes.ConfigUnitType.Degree": "Angle Unit, in degrees.",
"XIVConfigUI.Attributes.ConfigUnitType.Yalms": "Distance Unit, in yalms.",
Expand Down
1 change: 0 additions & 1 deletion ActionTimelineEx/Timeline/ActionCate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ public enum ActionCate : uint
/// </summary>
LimitBreak15 = 15,


/// <summary>
/// Artillery
/// </summary>
Expand Down
1 change: 1 addition & 0 deletions ActionTimelineEx/Windows/SettingsWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public SettingsWindow() : base(typeof(SettingsWindow).Assembly.GetName())

public override void OnClose()
{
Settings.RecordRotation = false;
Settings.Save();
base.OnClose();
}
Expand Down

0 comments on commit 1b32d56

Please sign in to comment.