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

Commit

Permalink
fix: add reset fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Jul 12, 2024
1 parent a9c4402 commit 1c44a17
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
3 changes: 3 additions & 0 deletions ActionTimelineEx/Configurations/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,13 @@ public string RotationName
[JsonIgnore]
internal RotationsSetting? EditSetting { get; set; } = null;

private static readonly RotationsSetting EmptyHolder = new ();
public RotationsSetting GetSetting(uint territoryId)
{
if (!_rotationHelpers.TryGetValue(territoryId, out var dict)) _rotationHelpers[territoryId] = dict = [];

if(!Player.Available) return EmptyHolder;

var job = Player.Job;
if (!dict.TryGetValue(job, out var result)) dict[job] = result = new();

Expand Down
3 changes: 1 addition & 2 deletions ActionTimelineEx/Helpers/RotationHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,12 @@ public static void Dispose()

private static void ClientState_TerritoryChanged(ushort obj)
{
Clear();

var territory = Svc.Data.GetExcelSheet<TerritoryType>()?.GetRow(obj);
if (IsTerritoryTypeValid(territory))
{
RotationHelperItem._territoryId = obj;
}
Clear();
}

private static void DutyState_DutyWiped(object? sender, ushort e)
Expand Down
2 changes: 1 addition & 1 deletion ActionTimelineEx/Localization/Localization.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"ActionTimelineEx.DescriptionAboutCommand": "Opens the ActionTimelineEx configuration window.",
"ActionTimelineEx.DescriptionAboutCommand": "Opens the ActionTimelineEx configuration window.\n `/atle reset` to reset the rotation helper count.",
"ActionTimeline.SettingsName.Record": "Record Data",
"ActionTimeline.SettingsName.ShowTimelineOnlyInDuty": "Show Only In Duty",
"ActionTimeline.SettingsName.ShowTimelineOnlyInCombat": "Show Only In Combat",
Expand Down
9 changes: 7 additions & 2 deletions ActionTimelineEx/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public class Plugin : IDalamudPlugin
public Plugin(IDalamudPluginInterface pluginInterface)
{
ECommonsMain.Init(pluginInterface, this);
XIVConfigUIMain.Init(pluginInterface, "/atle", "Opens the ActionTimelineEx configuration window.", PluginCommand, typeof(Settings), typeof(DrawingSettings), typeof(GroupItem), typeof(UiString));
XIVConfigUIMain.Init(pluginInterface, "/atle", "Opens the ActionTimelineEx configuration window.\n `/atle reset` to reset the rotation helper count.", PluginCommand, typeof(Settings), typeof(DrawingSettings), typeof(GroupItem), typeof(UiString));
XIVDrawerMain.Init(pluginInterface, "ActionTimelineExOverlay");

Svc.PluginInterface.UiBuilder.Draw += Draw;
Expand Down Expand Up @@ -109,8 +109,13 @@ public void Dispose()
GC.SuppressFinalize(this);
}

public static void PluginCommand(string _)
public static void PluginCommand(string str)
{
if (str == "reset")
{
RotationHelper.Clear();
return;
}
_settingsWindow.Toggle();
}

Expand Down

0 comments on commit 1c44a17

Please sign in to comment.