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

Commit

Permalink
fix: fixed casting icon.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Jul 21, 2023
1 parent ba4fe04 commit efa19b2
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 20 deletions.
39 changes: 23 additions & 16 deletions ActionTimelineEx/Timeline/TimelineManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -372,19 +372,8 @@ private async void AddStatusLine(TimelineItem? effectItem, ulong targetId)
}
}

private const string WarningOnActorControl = "Something wrong with OnActorControl!";
private async void OnActorControl(uint entityId, ActorControlCategory type, uint buffID, uint direct, uint actionId, uint sourceId, uint arg4, uint arg5, ulong targetId, byte a10)
{
byte stack = 0;
try
{
stack = Player.Object?.StatusList.FirstOrDefault(s => s.StatusId == buffID && s.SourceId == Player.Object.ObjectId)?.StackCount ?? 0;
}
catch(Exception ex)
{
PluginLog.Warning(ex, WarningOnActorControl);
}

_onActorControlHook?.Original(entityId, type, buffID, direct, actionId, sourceId, arg4, arg5, targetId, a10);

//#if DEBUG
Expand All @@ -405,7 +394,9 @@ private async void OnActorControl(uint entityId, ActorControlCategory type, uint
break;

case ActorControlCategory.LoseEffect:
var icon = GetStatusIcon((ushort)buffID, false, stack);
var stack = Player.Object?.StatusList.FirstOrDefault(s => s.StatusId == buffID && s.SourceId == Player.Object.ObjectId)?.StackCount ?? 0;

var icon = GetStatusIcon((ushort)buffID, false, ++stack);
if (icon == 0) break;
var now = DateTime.Now;

Expand Down Expand Up @@ -448,7 +439,7 @@ private async void OnActorControl(uint entityId, ActorControlCategory type, uint

catch (Exception ex)
{
PluginLog.Warning(ex, WarningOnActorControl);
PluginLog.Warning(ex, "Something wrong with OnActorControl!");
}
}

Expand All @@ -462,14 +453,30 @@ private unsafe void OnCast(uint sourceId, IntPtr ptr)

var actionId = *(ushort*)ptr;

string name = string.Empty;
ushort icon = 0;
var action = Svc.Data.GetExcelSheet<Action>()?.GetRow(actionId);

var icon = actionId == 4 ? (ushort)118 //Mount
: action?.Icon ?? 0;
if(action?.Cast100ms > 0)
{
name = action?.Name ?? string.Empty;
icon = actionId == 4 ? (ushort)118 //Mount
: action?.Icon ?? 0;
}
else
{
var item = Svc.Data.GetExcelSheet<Item>()?.GetRow(actionId);
if (item?.CastTimes > 0)
{
name = item?.Name ?? string.Empty;
icon = item?.Icon ?? 0;
}
}


AddItem(new TimelineItem()
{
Name = action?.Name ?? string.Empty,
Name = name,
Icon = icon,
StartTime = DateTime.Now,
GCDTime = GCD,
Expand Down
8 changes: 4 additions & 4 deletions ActionTimelineEx/Windows/SettingsWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ private bool DrawGeneralTab(DrawingSettings settings)
return result;
}

private void DrawIconsTab(DrawingSettings settings)
private static void DrawIconsTab(DrawingSettings settings)
{
ImGui.DragInt("Icon Size", ref settings.GCDIconSize);

Expand Down Expand Up @@ -383,7 +383,7 @@ private void DrawIconsTab(DrawingSettings settings)
}
}

private void DrawBarTab(DrawingSettings settings)
private static void DrawBarTab(DrawingSettings settings)
{
ImGui.ColorEdit4("Bar Background Color", ref settings.BackgroundColor, ImGuiColorEditFlags.NoInputs);
ImGui.ColorEdit4("GCD Border Color", ref settings.GCDBorderColor, ImGuiColorEditFlags.NoInputs);
Expand Down Expand Up @@ -419,7 +419,7 @@ private void DrawBarTab(DrawingSettings settings)
}
}

private void DrawGridTab(DrawingSettings settings)
private static void DrawGridTab(DrawingSettings settings)
{
ImGui.Checkbox("Enabled", ref settings.ShowGrid);

Expand Down Expand Up @@ -460,7 +460,7 @@ private void DrawGridTab(DrawingSettings settings)
ImGui.ColorEdit4("Sub-Division Line Color", ref settings.GridSubdivisionLineColor, ImGuiColorEditFlags.NoInputs);
}

private void DrawGCDClippingTab(DrawingSettings settings)
private static void DrawGCDClippingTab(DrawingSettings settings)
{
ImGui.Checkbox("Enabled", ref settings.ShowGCDClippingSetting);
DrawHelper.SetTooltip("This only shown when timeline is not rotation.");
Expand Down

0 comments on commit efa19b2

Please sign in to comment.