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

Commit

Permalink
fix: add an option to change the state name plate.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Feb 21, 2023
1 parent feed73d commit 36ce52b
Show file tree
Hide file tree
Showing 20 changed files with 88 additions and 74 deletions.
2 changes: 1 addition & 1 deletion RotationSolver/Attributes/RotationDescAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public bool Display(ICustomRotation rotation)

if (!hasDesc && !allActions.Any()) return false;

ImGui.Columns(2);
ImGui.Columns(2, this.GetHashCode().ToString(), false);
ImGui.SetColumnWidth(0, 150);
ImGui.Text(DescType.ToName());

Expand Down
3 changes: 1 addition & 2 deletions RotationSolver/Commands/RSCommands_StateSpecialCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ private static unsafe void DoStateCommandType(StateCommandType stateType) => DoO
public static unsafe void UpdateStateNamePlate()
{
Service.ClientState.LocalPlayer.GetAddress()->NamePlateIconId =
!Service.Configuration.ShowStateOnNamePlate
|| StateType == StateCommandType.Cancel ? 0u : 71204u;
StateType == StateCommandType.Cancel ? 0u : (uint)Service.Configuration.NamePlateIconId;
}

private static void DoSpecialCommandType(SpecialCommandType specialType, bool sayout = true) => DoOneCommandType(specialType, sayout ? EnumTranslations.ToSayout : (s, r) => string.Empty, role =>
Expand Down
3 changes: 2 additions & 1 deletion RotationSolver/Configuration/PluginConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,12 @@ 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;

public int NamePlateIconId = 71204;

public int MoveTargetAngle = 24;
public List<TargetingType> TargetingTypes { get; set; } = new List<TargetingType>();
public int TargetingIndex { get; set; } = 0;
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver/Helpers/ImguiHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public static void DrawEnableTexture<T>(this T texture, bool isSelected, Action
bool enable = false;
if (able != null)
{
if (isSelected) ImGui.PushStyleColor(ImGuiCol.Text, ImGui.ColorConvertFloat4ToU32(ImGuiColors.DalamudYellow));
if (isSelected) ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudYellow);
enable = able.IsEnabled;
if (ImGui.Checkbox($"{texture.Name}##{texture.Name}", ref enable))
{
Expand Down
22 changes: 11 additions & 11 deletions RotationSolver/Localization/Localization.json
Original file line number Diff line number Diff line change
Expand Up @@ -224,17 +224,17 @@
"TargetConditionType_StatusEndGCD": "Status End GCD",
"TargetConditionType_CastingAction": "Casting Action",
"DescType_BurstActions": "Burst Actions",
"DescType_MoveForwardGCD": "Move forward GCD",
"DescType_HealAreaGCD": "Range Healing GCD",
"DescType_HealSingleGCD": "Mono Healing GCD",
"DescType_DefenseAreaGCD": "Range Defense GCD",
"DescType_DefenseSingleGCD": "Mono Defense GCD",
"DescType_HealAreaAbility": "Range Healing Ability",
"DescType_HealSingleAbility": "Mono Healing Ability",
"DescType_DefenseAreaAbility": "Range Defense Ability",
"DescType_DefenseSingleAbility": "Mono Defense Ability",
"DescType_MoveForwardAbility": "Move forward Ability",
"DescType_MoveBackAbility": "Move back Ability",
"DescType_MoveForwardGCD": "Move Forward GCD",
"DescType_HealAreaGCD": "Area Healing GCD",
"DescType_HealSingleGCD": "Single Healing GCD",
"DescType_DefenseAreaGCD": "Area Defense GCD",
"DescType_DefenseSingleGCD": "Single Defense GCD",
"DescType_HealAreaAbility": "Area Healing Ability",
"DescType_HealSingleAbility": "Single Healing Ability",
"DescType_DefenseAreaAbility": "Area Defense Ability",
"DescType_DefenseSingleAbility": "Single Defense Ability",
"DescType_MoveForwardAbility": "Move Forward Ability",
"DescType_MoveBackAbility": "Move Back Ability",
"JobRole_None": "Gathering&Production",
"JobRole_Tank": "Tank",
"JobRole_Melee": "Melee",
Expand Down
26 changes: 13 additions & 13 deletions RotationSolver/Localization/Strings_Major.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ 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 on toast";
public string Configwindow_Param_ShowStateOnNamePlate { get; set; } = "Display plugin state on player's name plate.";
public string Configwindow_Param_NamePlateIconId { get; set; } = "Player's name plate icon id when state is on.";
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 Expand Up @@ -307,18 +307,18 @@ internal partial class Strings

#region DescType
public string DescType_BurstActions { get; set; } = "Burst Actions";
public string DescType_MoveForwardGCD { get; set; } = "Move forward GCD";
public string DescType_HealAreaGCD { get; set; } = "Range Healing GCD";
public string DescType_HealSingleGCD { get; set; } = "Mono Healing GCD";
public string DescType_DefenseAreaGCD { get; set; } = "Range Defense GCD";
public string DescType_DefenseSingleGCD { get; set; } = "Mono Defense GCD";

public string DescType_HealAreaAbility { get; set; } = "Range Healing Ability";
public string DescType_HealSingleAbility { get; set; } = "Mono Healing Ability";
public string DescType_DefenseAreaAbility { get; set; } = "Range Defense Ability";
public string DescType_DefenseSingleAbility { get; set; } = "Mono Defense Ability";
public string DescType_MoveForwardAbility { get; set; } = "Move forward Ability";
public string DescType_MoveBackAbility { get; set; } = "Move back Ability";
public string DescType_MoveForwardGCD { get; set; } = "Move Forward GCD";
public string DescType_HealAreaGCD { get; set; } = "Area Healing GCD";
public string DescType_HealSingleGCD { get; set; } = "Single Healing GCD";
public string DescType_DefenseAreaGCD { get; set; } = "Area Defense GCD";
public string DescType_DefenseSingleGCD { get; set; } = "Single Defense GCD";

public string DescType_HealAreaAbility { get; set; } = "Area Healing Ability";
public string DescType_HealSingleAbility { get; set; } = "Single Healing Ability";
public string DescType_DefenseAreaAbility { get; set; } = "Area Defense Ability";
public string DescType_DefenseSingleAbility { get; set; } = "Single Defense Ability";
public string DescType_MoveForwardAbility { get; set; } = "Move Forward Ability";
public string DescType_MoveBackAbility { get; set; } = "Move Back Ability";

#endregion

Expand Down
1 change: 1 addition & 0 deletions RotationSolver/Rotations/Basic/BLM_Base.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Dalamud.Game.ClientState.JobGauge.Types;
using RotationSolver.Actions;
using RotationSolver.Actions.BaseAction;
using RotationSolver.Attributes;
using RotationSolver.Data;
using RotationSolver.Helpers;
using RotationSolver.Updaters;
Expand Down
9 changes: 9 additions & 0 deletions RotationSolver/Rotations/Basic/DRG_Base.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Dalamud.Game.ClientState.JobGauge.Types;
using RotationSolver.Actions;
using RotationSolver.Actions.BaseAction;
using RotationSolver.Attributes;
using RotationSolver.Data;
using RotationSolver.Helpers;
using System.Linq;
Expand Down Expand Up @@ -185,4 +186,12 @@ internal abstract class DRG_Base : CustomRotation.CustomRotation
{
StatusNeed = new[] { StatusID.PowerSurge },
};


[RotationDesc(ActionID.Feint)]
private protected sealed override bool DefenceAreaAbility(byte abilitiesRemaining, out IAction act)
{
if (Feint.CanUse(out act)) return true;
return false;
}
}
9 changes: 9 additions & 0 deletions RotationSolver/Rotations/Basic/MNK_Base.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Dalamud.Game.ClientState.JobGauge.Types;
using RotationSolver.Actions;
using RotationSolver.Actions.BaseAction;
using RotationSolver.Attributes;
using RotationSolver.Data;
using RotationSolver.Helpers;

Expand Down Expand Up @@ -184,9 +185,17 @@ internal abstract class MNK_Base : CustomRotation.CustomRotation
/// </summary>
public static IBaseAction RiddleofWind { get; } = new BaseAction(ActionID.RiddleofWind, true);

[RotationDesc(ActionID.Thunderclap)]
private protected sealed override bool MoveForwardAbility(byte abilitiesRemaining, out IAction act)
{
if (Thunderclap.CanUse(out act, emptyOrSkipCombo: true)) return true;
return false;
}

[RotationDesc(ActionID.Feint)]
private protected sealed override bool DefenceAreaAbility(byte abilitiesRemaining, out IAction act)
{
if (Feint.CanUse(out act)) return true;
return false;
}
}
9 changes: 9 additions & 0 deletions RotationSolver/Rotations/Basic/NIN_Base.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Dalamud.Game.ClientState.JobGauge.Types;
using RotationSolver.Actions;
using RotationSolver.Actions.BaseAction;
using RotationSolver.Attributes;
using RotationSolver.Data;
using RotationSolver.Helpers;

Expand Down Expand Up @@ -306,10 +307,18 @@ internal NinAction(ActionID actionID, params IBaseAction[] ninjutsus)
/// </summary>
public static INinAction HyoshoRanryu { get; } = new NinAction(ActionID.HyoshoRanryu, Ten, Jin);

[RotationDesc(ActionID.Shukuchi)]
private protected sealed override bool MoveForwardAbility(byte abilitiesRemaining, out IAction act)
{
if (Shukuchi.CanUse(out act, emptyOrSkipCombo: true)) return true;

return false;
}

[RotationDesc(ActionID.Feint)]
private protected sealed override bool DefenceAreaAbility(byte abilitiesRemaining, out IAction act)
{
if (Feint.CanUse(out act)) return true;
return false;
}
}
15 changes: 14 additions & 1 deletion RotationSolver/Rotations/Basic/RPR_Base.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Dalamud.Game.ClientState.JobGauge.Types;
using RotationSolver.Actions;
using RotationSolver.Actions.BaseAction;
using RotationSolver.Attributes;
using RotationSolver.Data;
using RotationSolver.Helpers;

Expand Down Expand Up @@ -305,11 +306,23 @@ internal PRPAction(ActionID actionID, bool isFriendly = false, bool shouldEndSpe
public static IBaseAction ArcaneCrest { get; } = new BaseAction(ActionID.ArcaneCrest, true, isTimeline: true);
#endregion


[RotationDesc(ActionID.HellsIngress)]
private protected sealed override bool MoveForwardAbility(byte abilitiesRemaining, out IAction act)
{
//E上去
if (HellsIngress.CanUse(out act, emptyOrSkipCombo: true)) return true;
return false;
}

[RotationDesc(ActionID.Feint)]
private protected sealed override bool DefenceAreaAbility(byte abilitiesRemaining, out IAction act)
{
if (!SoulReaver && !Enshrouded)
{
if (Feint.CanUse(out act)) return true;
}

act = null;
return false;
}
}
9 changes: 9 additions & 0 deletions RotationSolver/Rotations/Basic/SAM_Base.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Dalamud.Game.ClientState.JobGauge.Types;
using RotationSolver.Actions;
using RotationSolver.Actions.BaseAction;
using RotationSolver.Attributes;
using RotationSolver.Data;
using RotationSolver.Helpers;

Expand Down Expand Up @@ -281,9 +282,17 @@ internal abstract class SAM_Base : CustomRotation.CustomRotation
};
#endregion

[RotationDesc(ActionID.HissatsuGyoten)]
private protected sealed override bool MoveForwardAbility(byte abilitiesRemaining, out IAction act)
{
if (HissatsuGyoten.CanUse(out act, emptyOrSkipCombo: true)) return true;
return false;
}

[RotationDesc(ActionID.Feint)]
private protected sealed override bool DefenceAreaAbility(byte abilitiesRemaining, out IAction act)
{
if (Feint.CanUse(out act)) return true;
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ public unsafe void Display(ICustomRotation[] rotations, bool canAddButton)
{
if (!string.IsNullOrEmpty(text))
{
ImGui.TextColored(ImGuiColors.DalamudYellow, text);
ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudYellow);
ImGui.TextWrapped(text);
ImGui.PopStyleColor();
}

var type = this.GetType();
Expand Down
1 change: 0 additions & 1 deletion RotationSolver/Rotations/CustomRotation/ICustomRotation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ internal interface ICustomRotation : ITexture, IEnable

BattleChara MoveTarget { get; }

//SortedList<DescType, string> DescriptionDict { get; }
IBaseAction[] AllActions { get; }
PropertyInfo[] AllBools { get; }
PropertyInfo[] AllBytes { get; }
Expand Down
7 changes: 1 addition & 6 deletions RotationSolver/Rotations/Melee/DRG/DRG_Default.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,5 @@ private protected override bool GeneralGCD(out IAction act)
#endregion
}

private protected override bool DefenceAreaAbility(byte abilitiesRemaining, out IAction act)
{
//牵制
if (Feint.CanUse(out act)) return true;
return false;
}

}
7 changes: 0 additions & 7 deletions RotationSolver/Rotations/Melee/MNK/MNK_Default.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,6 @@ private protected override bool DefenceSingleAbility(byte abilitiesRemaining, ou
return false;
}

private protected override bool DefenceAreaAbility(byte abilitiesRemaining, out IAction act)
{
if (Feint.CanUse(out act)) return true;
return false;
}


private bool OpoOpoForm(out IAction act)
{
if (ArmoftheDestroyer.CanUse(out act)) return true;
Expand Down
7 changes: 0 additions & 7 deletions RotationSolver/Rotations/Melee/NIN/NIN_Default.cs
Original file line number Diff line number Diff line change
Expand Up @@ -333,11 +333,4 @@ private protected override bool AttackAbility(byte abilitiesRemaining, out IActi
}
return false;
}

private protected override bool DefenceAreaAbility(byte abilitiesRemaining, out IAction act)
{
//牵制
if (Feint.CanUse(out act)) return true;
return false;
}
}
13 changes: 0 additions & 13 deletions RotationSolver/Rotations/Melee/RPR/RPR_Default.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,19 +189,6 @@ private protected override bool AttackAbility(byte abilitiesRemaining, out IActi
return false;
}


private protected override bool DefenceAreaAbility(byte abilitiesRemaining, out IAction act)
{
//牵制
if (!SoulReaver && !Enshrouded)
{
if (Feint.CanUse(out act)) return true;
}

act = null;
return false;
}

private protected override bool DefenceSingleAbility(byte abilitiesRemaining, out IAction act)
{
//神秘纹
Expand Down
6 changes: 0 additions & 6 deletions RotationSolver/Rotations/Melee/SAM/SAM_Default.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,6 @@ private protected override bool DefenceSingleAbility(byte abilitiesRemaining, ou
if (ThirdEye.CanUse(out act)) return true;
return false;
}
private protected override bool DefenceAreaAbility(byte abilitiesRemaining, out IAction act)
{
if (ThirdEye.CanUse(out act)) return true;
if (Feint.CanUse(out act)) return true;
return false;
}

private protected override IAction CountDownAction(float remainTime)
{
Expand Down
7 changes: 4 additions & 3 deletions RotationSolver/Windows/RotationConfigWindow_Param.cs
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ private void DrawParamDisplay()
ref Service.Configuration.ShowWorkTaskFPS);
}

DrawCheckBox(LocalizationManager.RightLang.Configwindow_Param_ShowStateOnNamePlate,
ref Service.Configuration.ShowStateOnNamePlate, otherThing: RSCommands.UpdateStateNamePlate);
DrawIntNumber(LocalizationManager.RightLang.Configwindow_Param_NamePlateIconId,
ref Service.Configuration.NamePlateIconId, 5, 0, 150000, otherThing: RSCommands.UpdateStateNamePlate);

ImGui.Spacing();

Expand Down Expand Up @@ -465,12 +465,13 @@ private static void DrawFloatNumber(string name, ref float value, float speed =
}
}

private static void DrawIntNumber(string name, ref int value, float speed = 0.2f, int min = 0, int max = 1, string description = "")
private static void DrawIntNumber(string name, ref int value, float speed = 0.2f, int min = 0, int max = 1, string description = "", Action otherThing = null)
{
ImGui.SetNextItemWidth(100);
if (ImGui.DragInt(name, ref value, speed, min, max))
{
Service.Configuration.Save();
otherThing?.Invoke();
}
if (!string.IsNullOrEmpty(description) && ImGui.IsItemHovered())
{
Expand Down

0 comments on commit 36ce52b

Please sign in to comment.