This repository has been archived by the owner on Aug 28, 2024. It is now read-only.
forked from Tischel/ActionTimeline
-
Notifications
You must be signed in to change notification settings - Fork 5
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
e66bbda
commit 187c65d
Showing
22 changed files
with
682 additions
and
96 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
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,124 @@ | ||
using ActionTimeline.Helpers; | ||
using Dalamud.Plugin.Services; | ||
using ECommons.DalamudServices; | ||
using FFXIVClientStructs.FFXIV.Common.Lua; | ||
using ImGuiNET; | ||
using System.Drawing; | ||
using System.Numerics; | ||
using System.Xml.Linq; | ||
using XIVConfigUI.Attributes; | ||
|
||
namespace ActionTimelineEx.Configurations; | ||
|
||
internal class ActionSettingAttribute() : ListUIAttribute(0) | ||
{ | ||
public override uint GetIcon(object obj) | ||
{ | ||
if (obj is not ActionSetting setting) | ||
return base.GetIcon(obj); | ||
return setting.IconId; | ||
} | ||
|
||
public override void OnClick(object obj) | ||
{ | ||
base.OnClick(obj); | ||
if (obj is not ActionSetting setting) return; | ||
|
||
//TODO: Change the acion ID... | ||
} | ||
} | ||
|
||
public enum ActionSettingType : byte | ||
{ | ||
Action, | ||
Item, | ||
} | ||
|
||
[ActionSetting] | ||
public class ActionSetting | ||
{ | ||
internal uint IconId { get; private set; } = 0; | ||
internal bool IsGCD { get; private set; } = false; | ||
|
||
[UI("Name")] | ||
internal string DisplayName { get; private set; } = ""; | ||
|
||
private uint _actionId; | ||
|
||
[UI("Id")] | ||
public uint ActionId | ||
{ | ||
get => _actionId; | ||
set | ||
{ | ||
if (value == _actionId) return; | ||
_actionId = value; | ||
|
||
Update(); | ||
} | ||
} | ||
|
||
private ActionSettingType _type; | ||
|
||
[UI("Type")] | ||
public ActionSettingType Type | ||
{ | ||
get => _type; | ||
set | ||
{ | ||
if (value == _type) return; | ||
_type = value; | ||
|
||
Update(); | ||
} | ||
} | ||
|
||
private void Update() | ||
{ | ||
ClearData(); | ||
|
||
switch (Type) | ||
{ | ||
case ActionSettingType.Action: | ||
UpdateAction(); | ||
return; | ||
|
||
case ActionSettingType.Item: | ||
UpdateItem(); | ||
return; | ||
} | ||
|
||
void UpdateItem() | ||
{ | ||
var item = Svc.Data.GetExcelSheet<Lumina.Excel.GeneratedSheets.Item>()?.GetRow(ActionId); | ||
if (item == null) return; | ||
|
||
IconId = item.Icon; | ||
DisplayName = item.Name; | ||
} | ||
|
||
void UpdateAction() | ||
{ | ||
var action = Svc.Data.GetExcelSheet<Lumina.Excel.GeneratedSheets.Action>()?.GetRow(ActionId); | ||
if (action == null) return; | ||
|
||
IsGCD = action.CooldownGroup == 58 || action.AdditionalCooldownGroup == 58; | ||
|
||
IconId = action.Icon; | ||
DisplayName = $"{action.Name} ({(IsGCD ? "GCD" : "Ability")})"; | ||
} | ||
|
||
void ClearData() | ||
{ | ||
IconId = 0; | ||
DisplayName = string.Empty; | ||
IsGCD = false; | ||
} | ||
} | ||
|
||
public void Draw(ImDrawListPtr drawList, Vector2 point, float size) | ||
{ | ||
drawList.DrawActionIcon(IconId, Type is ActionSettingType.Item, point, size); | ||
if (!string.IsNullOrEmpty(DisplayName) && DrawHelper.IsInRect(point, new Vector2(size))) ImGui.SetTooltip(DisplayName); | ||
} | ||
} |
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,10 @@ | ||
using XIVConfigUI.Attributes; | ||
|
||
namespace ActionTimelineEx.Configurations; | ||
public class RotationSetting | ||
{ | ||
[UI("Rotation Name")] | ||
public string Name { get; set; } = "Default"; | ||
|
||
public List<ActionSetting> Actions { get; set; } = []; | ||
} |
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 @@ | ||
using System.Text.Json.Serialization; | ||
|
||
namespace ActionTimelineEx.Configurations; | ||
|
||
public class RotationsSetting | ||
{ | ||
public string Choice { get; set; } = "Default"; | ||
public List<RotationSetting> RotationSettings { get; set; } = []; | ||
|
||
[JsonIgnore] | ||
public RotationSetting RotationSetting | ||
{ | ||
get | ||
{ | ||
var result = RotationSettings.FirstOrDefault(r => r.Name == Choice); | ||
if (result != null) return result; | ||
|
||
result = RotationSettings.FirstOrDefault(); | ||
if (result == null) | ||
{ | ||
result = new(); | ||
RotationSettings.Add(result); | ||
} | ||
|
||
Choice = result.Name; | ||
return result; | ||
} | ||
} | ||
} |
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.