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

Commit

Permalink
fix: add a state display on player's name plate.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Feb 19, 2023
1 parent bd514da commit 77abc1e
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 5 deletions.
13 changes: 12 additions & 1 deletion RotationSolver/Commands/RSCommands_StateSpecialCommand.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Lumina.Excel.GeneratedSheets;
using RotationSolver.Data;
using RotationSolver.Helpers;
using RotationSolver.Localization;
using RotationSolver.SigReplacers;
using System;
Expand Down Expand Up @@ -32,7 +33,7 @@ private static void UpdateToast()
});
}

private static void DoStateCommandType(StateCommandType stateType) => DoOneCommandType(stateType, EnumTranslations.ToSayout, role =>
private static unsafe void DoStateCommandType(StateCommandType stateType) => DoOneCommandType(stateType, EnumTranslations.ToSayout, role =>
{
if (StateType == StateCommandType.Smart
&& stateType == StateCommandType.Smart)
Expand All @@ -43,10 +44,20 @@ private static void DoStateCommandType(StateCommandType stateType) => DoOneComma

StateType = stateType;

UpdateStateNamePlate();

_stateString = stateType.ToStateString(role);
UpdateToast();
});

public static unsafe void UpdateStateNamePlate()
{
Service.ClientState.LocalPlayer.GetAddress()->NamePlateIconId =
!Service.Configuration.ShowStateOnNamePlate ? 0u :
StateType == StateCommandType.Cancel
? 71214u : 71204u;
}

private static void DoSpecialCommandType(SpecialCommandType specialType, bool sayout = true) => DoOneCommandType(specialType, sayout ? EnumTranslations.ToSayout : (s, r) => string.Empty, role =>
{
_specialType = specialType;
Expand Down
1 change: 1 addition & 0 deletions RotationSolver/Configuration/PluginConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ public class PluginConfiguration : IPluginConfiguration
public bool UseStopCasting = false;
public bool EsunaAll = false;
public bool OnlyAttackInView = false;
public bool ShowStateOnNamePlate = true;

public string PositionalErrorText = string.Empty;
public float CountDownAhead = 0.6f;
Expand Down
6 changes: 4 additions & 2 deletions RotationSolver/Localization/Localization.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@
"Configwindow_Param_UseOverlayWindow": "Display top overlay",
"Configwindow_Param_UseOverlayWindowDesc": "This window is currently used to cue the body position in advance.",
"Configwindow_Param_Basic": "Basic",
"Configwindow_Param_WeaponFaster": "Set the time advance of use actions",
"Configwindow_Param_WeaponAhead": "Set the time advance of use actions",
"Configwindow_Param_WeaponInterval": "Set the interval between abilities using",
"Configwindow_Param_CountDownAhead": "Set the time advance of use casting actions on counting down.",
"Configwindow_Param_SpecialDuration": "Set the duration of special windows set by commands",
"Configwindow_Param_AddDotGCDCount": "Set GCD advance of DOT refresh",
"Configwindow_Param_AutoOffBetweenArea": "Turn off when player is between area.",
Expand Down Expand Up @@ -91,7 +92,8 @@
"Configwindow_Param_SayOutStateChanged": "Saying the state changes out",
"Configwindow_Param_ShowInfoOnDtr": "Display plugin state on dtrbar",
"Configwindow_Param_ShowWorkTaskFPS": "Display Task FPS on dtrbar",
"Configwindow_Param_ShowInfoOnToast": "Display plugin state changed on toast",
"Configwindow_Param_ShowInfoOnToast": "Display plugin state on toast",
"Configwindow_Param_ShowStateOnNamePlate": "Display plugin state on player's name plate.",
"Configwindow_Param_Action": "Action",
"Configwindow_Param_UseAOEWhenManual": "Use AOE actions in manual mode",
"Configwindow_Param_AutoBurst": "Automatic burst",
Expand Down
3 changes: 2 additions & 1 deletion RotationSolver/Localization/Strings_Major.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ internal partial class Strings

public string Configwindow_Param_ShowWorkTaskFPS { get; set; } = "Display Task FPS on dtrbar";

public string Configwindow_Param_ShowInfoOnToast { get; set; } = "Display plugin state changed on toast";
public string Configwindow_Param_ShowInfoOnToast { get; set; } = "Display plugin state on toast";
public string Configwindow_Param_ShowStateOnNamePlate { get; set; } = "Display plugin state on player's name plate.";
public string Configwindow_Param_Action { get; set; } = "Action";
public string Configwindow_Param_UseAOEWhenManual { get; set; } = "Use AOE actions in manual mode";
public string Configwindow_Param_AutoBurst { get; set; } = "Automatic burst";
Expand Down
6 changes: 5 additions & 1 deletion RotationSolver/Windows/RotationConfigWindow_Param.cs
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,9 @@ private void DrawParamDisplay()
ref Service.Configuration.ShowWorkTaskFPS);
}

DrawCheckBox(LocalizationManager.RightLang.Configwindow_Param_ShowStateOnNamePlate,
ref Service.Configuration.ShowStateOnNamePlate, otherThing: RSCommands.UpdateStateNamePlate);

ImGui.Spacing();

DrawCheckBox(LocalizationManager.RightLang.Configwindow_Param_CastingDisplay,
Expand Down Expand Up @@ -423,11 +426,12 @@ private void DrawParamHostile()
}
}

private static void DrawCheckBox(string name, ref bool value, string description = "")
private static void DrawCheckBox(string name, ref bool value, string description = "", Action otherThing = null)
{
if (ImGui.Checkbox(name, ref value))
{
Service.Configuration.Save();
otherThing?.Invoke();
}
if (!string.IsNullOrEmpty(description) && ImGui.IsItemHovered())
{
Expand Down

0 comments on commit 77abc1e

Please sign in to comment.