diff --git a/RotationSolver/Actions/BaseAction/BaseAction_BasicInfo.cs b/RotationSolver/Actions/BaseAction/BaseAction_BasicInfo.cs index 515a27ae9..aa49cc256 100644 --- a/RotationSolver/Actions/BaseAction/BaseAction_BasicInfo.cs +++ b/RotationSolver/Actions/BaseAction/BaseAction_BasicInfo.cs @@ -85,7 +85,7 @@ internal virtual EnemyPositional EnermyPositonal { get { - if (StatusHelper.ActionLocations.TryGetValue((ActionID)ID, out var location)) + if (ConfigurationHelper.ActionLocations.TryGetValue((ActionID)ID, out var location)) { return location.Loc; } diff --git a/RotationSolver/Actions/BaseAction/BaseAction_Display.cs b/RotationSolver/Actions/BaseAction/BaseAction_Display.cs index d522d7862..6a237d709 100644 --- a/RotationSolver/Actions/BaseAction/BaseAction_Display.cs +++ b/RotationSolver/Actions/BaseAction/BaseAction_Display.cs @@ -15,7 +15,10 @@ namespace RotationSolver.Actions.BaseAction { internal partial class BaseAction { - public unsafe void Display(bool IsActive) => this.DrawEnableTexture(IsActive, () => RotationConfigWindow.ActiveAction = this, otherThing: () => + public unsafe void Display(bool IsActive) => this.DrawEnableTexture(IsActive, () => + { + if (IsTimeline) RotationConfigWindow.ActiveAction = this; + }, otherThing: () => { if (IsTimeline) OtherCommandType.Actions.DisplayCommandHelp($"{this}-{5}", type => string.Format(LocalizationManager.RightLang.Configwindow_Helper_InsertCommand, this)); diff --git a/RotationSolver/Actions/BaseAction/BaseAction_Target.cs b/RotationSolver/Actions/BaseAction/BaseAction_Target.cs index 34942e1ae..3cacf47ee 100644 --- a/RotationSolver/Actions/BaseAction/BaseAction_Target.cs +++ b/RotationSolver/Actions/BaseAction/BaseAction_Target.cs @@ -265,7 +265,7 @@ private bool TargetDeath(out BattleChara target) private bool TargetHostile(float range, bool mustUse, int aoeCount, out BattleChara target) { //如果不用自动找目标,那就直接返回。 - if (RSCommands.StateType != StateCommandType.Manual) + if (RSCommands.StateType == StateCommandType.Manual) { if (Service.TargetManager.Target is BattleChara b && b.CanAttack() && b.DistanceToPlayer() <= range) { @@ -294,8 +294,11 @@ private bool TargetHostileManual(BattleChara b, bool mustUse, int aoeCount, out { target = b; - //目标已有充足的Debuff - if (!CheckStatus(b ?? Service.ClientState.LocalPlayer, mustUse)) return false; + //No need to dot. + if (TargetStatus != null && !ObjectHelper.CanDot(b)) return false; + + //Already has status. + if (!CheckStatus(b, mustUse)) return false; return true; } diff --git a/RotationSolver/Commands/RSCommands_Actions.cs b/RotationSolver/Commands/RSCommands_Actions.cs index 2409d465a..36884c08a 100644 --- a/RotationSolver/Commands/RSCommands_Actions.cs +++ b/RotationSolver/Commands/RSCommands_Actions.cs @@ -33,7 +33,6 @@ internal static unsafe void DoAnAction(bool isGCD) if (nextAction == null) return; if (!isGCD && nextAction is BaseAction act1 && act1.IsRealGCD) return; - if (nextAction.Use()) { if (Service.Configuration.KeyBoardNoise) PreviewUpdater.PulseAtionBar(nextAction.AdjustedID); diff --git a/RotationSolver/Commands/RSCommands_OtherCommand.cs b/RotationSolver/Commands/RSCommands_OtherCommand.cs index beee70d5f..02f478240 100644 --- a/RotationSolver/Commands/RSCommands_OtherCommand.cs +++ b/RotationSolver/Commands/RSCommands_OtherCommand.cs @@ -1,4 +1,5 @@ using RotationSolver.Actions.BaseAction; +using RotationSolver.Data; using RotationSolver.Helpers; using RotationSolver.Localization; using RotationSolver.Rotations.CustomRotation; @@ -92,7 +93,12 @@ private static void DoActionCommand(string str) } NextActs = NextActs.OrderBy(i => i.deadTime).ToList(); - Service.ChatGui.Print(string.Format(LocalizationManager.RightLang.Commands_InsertAction, time, act.Name)); + Service.ToastGui.ShowQuest(string.Format(LocalizationManager.RightLang.Commands_InsertAction, time), + new Dalamud.Game.Gui.Toast.QuestToastOptions() + { + IconId = act.IconID, + }); + return; } } diff --git a/RotationSolver/Commands/RSCommands_StateSpecialCommand.cs b/RotationSolver/Commands/RSCommands_StateSpecialCommand.cs index 3de15a6a2..e4c651521 100644 --- a/RotationSolver/Commands/RSCommands_StateSpecialCommand.cs +++ b/RotationSolver/Commands/RSCommands_StateSpecialCommand.cs @@ -36,7 +36,7 @@ private static void UpdateToast() }); } - internal static void ResetSpecial() => DoSpecialCommandType(SpecialCommandType.EndSpecial); + internal static void ResetSpecial() => DoSpecialCommandType(SpecialCommandType.EndSpecial, false); private static void DoStateCommandType(StateCommandType stateType) => DoOneCommandType(stateType, EnumTranslations.ToSayout, role => { @@ -53,13 +53,13 @@ private static void DoStateCommandType(StateCommandType stateType) => DoOneComma UpdateToast(); }); - private static void DoSpecialCommandType(SpecialCommandType specialType) => DoOneCommandType(specialType, EnumTranslations.ToSayout, role => + private static void DoSpecialCommandType(SpecialCommandType specialType, bool sayout = true) => DoOneCommandType(specialType, sayout ? EnumTranslations.ToSayout : (s, r) => string.Empty, role => { _specialType = specialType; _specialString = specialType.ToSpecialString(role); _specialStateStartTime = specialType == SpecialCommandType.EndSpecial ? DateTime.MinValue : DateTime.Now; - UpdateToast(); + if(sayout) UpdateToast(); }); private static void DoOneCommandType(T type, Func sayout, Action doingSomething) diff --git a/RotationSolver/Configuration/PluginConfiguration.cs b/RotationSolver/Configuration/PluginConfiguration.cs index c21745edf..1383624aa 100644 --- a/RotationSolver/Configuration/PluginConfiguration.cs +++ b/RotationSolver/Configuration/PluginConfiguration.cs @@ -13,7 +13,7 @@ public class PluginConfiguration : IPluginConfiguration { public int Version { get; set; } = 6; - public int VoiceVolume = 80; + public int VoiceVolume = 100; public SortedSet DisabledCombos { get; private set; } = new SortedSet(); public SortedSet DiabledActions { get; private set; } = new SortedSet(); public List Events { get; private set; } = new List(); diff --git a/RotationSolver/Helpers/ConditionHelper.cs b/RotationSolver/Helpers/ConditionHelper.cs index 34015e683..2afbbefbc 100644 --- a/RotationSolver/Helpers/ConditionHelper.cs +++ b/RotationSolver/Helpers/ConditionHelper.cs @@ -61,17 +61,24 @@ internal static bool DrawDragInt(string name, ref int value) return ImGui.DragInt(name, ref value); } - internal static bool DrawCheckBox(string name, ref int value) + internal static bool DrawCheckBox(string name, ref int value, string desc = "") { ImGui.SameLine(); var @bool = value != 0; + + var result = false; if (ImGui.Checkbox(name, ref @bool)) { value = @bool ? 1 : 0; - return true; + result = true; + } + if(!string.IsNullOrEmpty(desc) && ImGui.IsItemHovered()) + { + ImGui.SetTooltip(desc); } - return false; + + return result; } } } diff --git a/RotationSolver/Helpers/ConfigurationHelper.cs b/RotationSolver/Helpers/ConfigurationHelper.cs index 1f9f8f11e..f426f1a86 100644 --- a/RotationSolver/Helpers/ConfigurationHelper.cs +++ b/RotationSolver/Helpers/ConfigurationHelper.cs @@ -11,6 +11,26 @@ namespace RotationSolver.Helpers; internal static class ConfigurationHelper { + public record LocationInfo(EnemyPositional Loc, byte[] Tags); + public static readonly SortedList ActionLocations = new SortedList() + { + {ActionID.FangandClaw, new( EnemyPositional.Side, new byte[] { 13, 10 })}, + {ActionID.WheelingThrust, new(EnemyPositional.Back, new byte[] { 10, 13 }) }, + {ActionID.ChaosThrust, new(EnemyPositional.Back, new byte[] { 61, 28 }) }, + {ActionID.ChaoticSpring, new(EnemyPositional.Back, new byte[] { 66, 28 }) }, + {ActionID.Demolish, new(EnemyPositional.Back, new byte[] { 46, 60 }) }, + {ActionID.SnapPunch, new(EnemyPositional.Side, new byte[] { 19, 21 }) }, + {ActionID.TrickAttack, new(EnemyPositional.Back, new byte[] { 25 }) }, + {ActionID.AeolianEdge,new( EnemyPositional.Back, new byte[] { 30, 68 }) }, + {ActionID.ArmorCrush, new(EnemyPositional.Side, new byte[] { 30, 66 }) }, + {ActionID.Suiton, new(EnemyPositional.Back, new byte[] { }) }, + {ActionID.Gibbet, new(EnemyPositional.Side , new byte[] { 11 })}, + {ActionID.Gallows, new(EnemyPositional.Back, new byte[] { 11 }) }, + {ActionID.Gekko, new(EnemyPositional.Back , new byte[] { 68, 29, 72 })}, + {ActionID.Kasha, new(EnemyPositional.Side, new byte[] { 29, 68, 72 }) }, + }; + + public static readonly string[] AuthorKeys = new string[] { "Ig4lHXUohMZNIeheUtAtRg==", diff --git a/RotationSolver/Helpers/ImguiHelper.cs b/RotationSolver/Helpers/ImguiHelper.cs index 9e11f2151..922d8910d 100644 --- a/RotationSolver/Helpers/ImguiHelper.cs +++ b/RotationSolver/Helpers/ImguiHelper.cs @@ -49,7 +49,7 @@ public static void DrawEnableTexture(this T texture, bool isSelected, Action } if (isSelected) ImGui.PopStyleColor(); - HoveredString(desc, selected); + HoveredString(desc); } diff --git a/RotationSolver/Helpers/StatusHelper.cs b/RotationSolver/Helpers/StatusHelper.cs index 557ced716..91cddfce6 100644 --- a/RotationSolver/Helpers/StatusHelper.cs +++ b/RotationSolver/Helpers/StatusHelper.cs @@ -13,25 +13,6 @@ namespace RotationSolver.Helpers; internal static class StatusHelper { - public record LocationInfo(EnemyPositional Loc, byte[] Tags); - public static readonly SortedList ActionLocations = new SortedList() - { - {ActionID.FangandClaw, new( EnemyPositional.Side, new byte[] { 13, 10 })}, - {ActionID.WheelingThrust, new(EnemyPositional.Back, new byte[] { 10, 13 }) }, - {ActionID.ChaosThrust, new(EnemyPositional.Back, new byte[] { 61, 28 }) }, - {ActionID.ChaoticSpring, new(EnemyPositional.Back, new byte[] { 66, 28 }) }, - {ActionID.Demolish, new(EnemyPositional.Back, new byte[] { 46, 60 }) }, - {ActionID.SnapPunch, new(EnemyPositional.Side, new byte[] { 19, 21 }) }, - {ActionID.TrickAttack, new(EnemyPositional.Back, new byte[] { 25 }) }, - {ActionID.AeolianEdge,new( EnemyPositional.Back, new byte[] { 30, 68 }) }, - {ActionID.ArmorCrush, new(EnemyPositional.Side, new byte[] { 30, 66 }) }, - {ActionID.Suiton, new(EnemyPositional.Back, new byte[] { }) }, - {ActionID.Gibbet, new(EnemyPositional.Side , new byte[] { 11 })}, - {ActionID.Gallows, new(EnemyPositional.Back, new byte[] { 11 }) }, - {ActionID.Gekko, new(EnemyPositional.Back , new byte[] { 68, 29, 72 })}, - {ActionID.Kasha, new(EnemyPositional.Side, new byte[] { 29, 68, 72 }) }, - }; - public static StatusID[] SheildStatus { get; } = new StatusID[] { StatusID.Grit, StatusID.RoyalGuard, StatusID.IronWill, StatusID.Defiance diff --git a/RotationSolver/Localization/EnumTranslations.cs b/RotationSolver/Localization/EnumTranslations.cs index 74457ad30..82c5c147d 100644 --- a/RotationSolver/Localization/EnumTranslations.cs +++ b/RotationSolver/Localization/EnumTranslations.cs @@ -127,8 +127,8 @@ internal static class EnumTranslations internal static string ToSayout(this StateCommandType type, JobRole role) => type switch { - StateCommandType.Smart => "Start Smart " + RSCommands.TargetingType.ToName(), - StateCommandType.Manual => "Start Manual", + StateCommandType.Smart => "Smart " + RSCommands.TargetingType.ToName(), + StateCommandType.Manual => "Manual", StateCommandType.Cancel => "Cancel", _ => string.Empty, }; diff --git a/RotationSolver/Localization/Strings.cs b/RotationSolver/Localization/Strings.cs index c169602c9..90278bab1 100644 --- a/RotationSolver/Localization/Strings.cs +++ b/RotationSolver/Localization/Strings.cs @@ -12,7 +12,7 @@ internal class Strings public string Commands_ChangeRotationConfig { get; set; } = "Modify {0} to {1}"; public string Commands_CannotFindRotationConfig { get; set; } = "Failed to find the config in this rotation, please check it."; - public string Commands_InsertAction { get; set; } = "Will use skill \"{1}\" within {0}s"; + public string Commands_InsertAction { get; set; } = "Will use it within {0}s"; public string Commands_InsertActionFailure { get; set; } = "Can not find the action, please check the action name."; public string Commands_OpenSettings { get; set; } = "The settings interface has been opened"; @@ -184,17 +184,12 @@ internal class Strings #endregion #region ScriptWindow - public string Scriptwindow_Author { get; set; } = "Author"; - public string Scriptwindow_OpenSourceFile { get; set; } = "Open Source File"; - public string Scriptwindow_Save { get; set; } = "Save"; public string Scriptwindow_DragdropDescription { get; set; } = "Drag&drop to move,Ctrl+Alt+RightClick to delete."; public string Scriptwindow_SearchBar { get; set; } = "Search Bar"; public string Scriptwindow_MustUse { get; set; } = "MustUse"; public string Scriptwindow_MustUseDesc { get; set; } = "Skip AOE and Buff."; public string Scriptwindow_Empty { get; set; } = "UseUp"; public string Scriptwindow_EmptyDesc { get; set; } = "UseUp or Skip Combo"; - public string Scriptwindow_Return { get; set; } = "Return condition"; - public string Scriptwindow_ActionConditionsDescription { get; set; } = "Description"; public string Scriptwindow_AbilityRemain { get; set; } = "Ability Remains"; public string Scriptwindow_AbilityRemainDesc { get; set; } = "Use this action while how many abilities remain. Set it to zero to ignore."; public string Scriptwindow_AdjustID { get; set; } = "AdjustID"; @@ -204,9 +199,6 @@ internal class Strings public string Scriptwindow_AddActionDesc { get; set; } = "Add Action"; public string Scriptwindow_AddFunctionDesc { get; set; } = "Add Function,total {0}."; public string Scriptwindow_ComboSetAuthorDefault { get; set; } = "Unknown"; - public string Scriptwindow_CountDown { get; set; } = "CountDown"; - public string Scriptwindow_CountDownDesc { get; set; } = "The actions need to use in the countdown."; - public string Scriptwindow_CountDownSetDesc { get; set; } = "Input the actions need to use in the countdown into the box below."; public string Scriptwindow_Can { get; set; } = "Can"; public string Scriptwindow_Cannot { get; set; } = "Cannot"; public string Scriptwindow_Is { get; set; } = "Is"; @@ -229,7 +221,7 @@ internal class Strings #region Actions public string Action_Friendly { get; set; } = "Support"; public string Action_Attack { get; set; } = "Attack"; - public string Action_WrongLocation { get; set; } = "要打{0}!"; + public string Action_WrongLocation { get; set; } = "Positional {0}!"; #endregion diff --git a/RotationSolver/Rotations/CustomRotation/CustomRotation_Display.cs b/RotationSolver/Rotations/CustomRotation/CustomRotation_Display.cs index c4f749c6e..12dc11ab9 100644 --- a/RotationSolver/Rotations/CustomRotation/CustomRotation_Display.cs +++ b/RotationSolver/Rotations/CustomRotation/CustomRotation_Display.cs @@ -1,8 +1,10 @@ using Dalamud.Interface; using Dalamud.Utility; using ImGuiNET; +using Lumina.Data.Parsing; using RotationSolver.Helpers; using RotationSolver.Localization; +using RotationSolver.SigReplacers; using System; using System.Collections.Generic; using System.Linq; @@ -54,6 +56,21 @@ public unsafe void Display(ICustomRotation[] rotations, bool canAddButton) => th Util.OpenLink(url); } ImGuiHelper.HoveredString(LocalizationManager.RightLang.Configwindow_Helper_OpenSource); - }, () => Configs.Draw(canAddButton)); + }, () => + { + int isAllTargetAsHostile = (byte)IconReplacer.GetTargetHostileType(Job); + ImGui.SetNextItemWidth(300); + if (ImGui.Combo(LocalizationManager.RightLang.Configwindow_Params_RightNowTargetToHostileType + $"##HostileType{GetHashCode()}", ref isAllTargetAsHostile, new string[] + { + LocalizationManager.RightLang.Configwindow_Params_TargetToHostileType1, + LocalizationManager.RightLang.Configwindow_Params_TargetToHostileType2, + LocalizationManager.RightLang.Configwindow_Params_TargetToHostileType3, + }, 3)) + { + Service.Configuration.TargetToHostileTypes[Job.RowId] = (byte)isAllTargetAsHostile; + Service.Configuration.Save(); + } + Configs.Draw(canAddButton); + }); } } diff --git a/RotationSolver/Rotations/CustomRotation/CustomRotation_Invoke.cs b/RotationSolver/Rotations/CustomRotation/CustomRotation_Invoke.cs index 5e13b78ce..4d70c129b 100644 --- a/RotationSolver/Rotations/CustomRotation/CustomRotation_Invoke.cs +++ b/RotationSolver/Rotations/CustomRotation/CustomRotation_Invoke.cs @@ -64,8 +64,7 @@ private IAction Invoke() if (Service.Configuration.SayPotional) Watcher.Speak(positional); if (Service.Configuration.FlytextPositional) Service.ToastGui.ShowQuest(" " + positional, new Dalamud.Game.Gui.Toast.QuestToastOptions() { - IconId = Service.DataManager.GetExcelSheet().GetRow( - (uint)Service.IconReplacer.OriginalHook((ActionID)GcdAction.ID)).Icon, + IconId = GcdAction.IconID, }); OverlayWindow.EnemyLocationTarget = GcdAction.Target; OverlayWindow.ShouldPositional = GcdAction.EnermyPositonal; diff --git a/RotationSolver/Rotations/CustomRotation/CustomRotation_OtherInfo.cs b/RotationSolver/Rotations/CustomRotation/CustomRotation_OtherInfo.cs index bd2b3ddcd..b7b674472 100644 --- a/RotationSolver/Rotations/CustomRotation/CustomRotation_OtherInfo.cs +++ b/RotationSolver/Rotations/CustomRotation/CustomRotation_OtherInfo.cs @@ -162,11 +162,4 @@ protected static bool EndAfter(float remain, float remainNeed) && types[0].ParameterType == typeof(bool) && types[1].ParameterType == typeof(IAction[]); }); - - public MethodInfo[] AllOther => GetType().GetStaticBoolMethodInfo(m => - { - var types = m.GetParameters(); - return types.Length == 1 - && types[0].IsOut; - }); } diff --git a/RotationSolver/Rotations/CustomRotation/ICustomRotation.cs b/RotationSolver/Rotations/CustomRotation/ICustomRotation.cs index 50aedec82..7e80dcdd3 100644 --- a/RotationSolver/Rotations/CustomRotation/ICustomRotation.cs +++ b/RotationSolver/Rotations/CustomRotation/ICustomRotation.cs @@ -26,7 +26,6 @@ internal interface ICustomRotation : ITexture, IEnable MethodInfo[] AllTimes { get; } MethodInfo[] AllLast { get; } - MethodInfo[] AllOther { get; } MethodInfo[] AllGCDs { get; } bool TryInvoke(out IAction newAction); diff --git a/RotationSolver/SigReplacers/Watcher.cs b/RotationSolver/SigReplacers/Watcher.cs index 8b78732cf..175528e19 100644 --- a/RotationSolver/SigReplacers/Watcher.cs +++ b/RotationSolver/SigReplacers/Watcher.cs @@ -113,17 +113,21 @@ private static unsafe void RecordAction(GameObject tar, Action action, byte flag } #if DEBUG - if (flag != 0) Service.ChatGui.Print($"{action.Name}, {flag}"); + if (flag != 0) + { + Service.FlyTextGui.AddFlyText(Dalamud.Game.Gui.FlyText.FlyTextKind.NamedIcon, 0, 0, 0, "Flag:" + flag.ToString(), "", + ImGui.GetColorU32(new Vector4(0.4f, 0, 0, 1)), 0, action.Icon); + } #endif //事后骂人! if (Service.Configuration.PositionalFeedback - && StatusHelper.ActionLocations.TryGetValue(id, out var loc) + && ConfigurationHelper.ActionLocations.TryGetValue(id, out var loc) && loc.Tags.Length > 0 && !loc.Tags.Contains(flag)) { - //Todo: Damage Icon should be something intersting. - Service.FlyTextGui.AddFlyText(Dalamud.Game.Gui.FlyText.FlyTextKind.NamedIcon, 0, 0, 0, string.Format(LocalizationManager.RightLang.Action_WrongLocation, loc.Loc.ToName()), "", - ImGui.GetColorU32(new Vector4(0.4f, 0, 0, 1)), action.Icon, 0); + var str = string.Format(LocalizationManager.RightLang.Action_WrongLocation, loc.Loc.ToName()); + Service.FlyTextGui.AddFlyText(Dalamud.Game.Gui.FlyText.FlyTextKind.NamedIcon, 0, 0, 0, str, "", + ImGui.GetColorU32(new Vector4(0.4f, 0, 0, 1)), 0, action.Icon); if (!string.IsNullOrEmpty(Service.Configuration.PositionalErrorText)) { Speak(Service.Configuration.PositionalErrorText); diff --git a/RotationSolver/Timeline/ActionCondition.cs b/RotationSolver/Timeline/ActionCondition.cs index 12d14bb35..f6e697f13 100644 --- a/RotationSolver/Timeline/ActionCondition.cs +++ b/RotationSolver/Timeline/ActionCondition.cs @@ -163,8 +163,8 @@ public void Draw(ICustomRotation combo) case ActionConditonType.ShouldUse: - ConditionHelper.DrawCheckBox($"{LocalizationManager.RightLang.Scriptwindow_MustUse}##MustUse{GetHashCode()}", ref Param1); - ConditionHelper.DrawCheckBox($"{LocalizationManager.RightLang.Scriptwindow_Empty}##MustUse{GetHashCode()}", ref Param2); + ConditionHelper.DrawCheckBox($"{LocalizationManager.RightLang.Scriptwindow_MustUse}##MustUse{GetHashCode()}", ref Param1, LocalizationManager.RightLang.Scriptwindow_MustUseDesc); + ConditionHelper.DrawCheckBox($"{LocalizationManager.RightLang.Scriptwindow_Empty}##MustUse{GetHashCode()}", ref Param2, LocalizationManager.RightLang.Scriptwindow_EmptyDesc); break; case ActionConditonType.CurrentCharges: diff --git a/RotationSolver/Updaters/TargetUpdater_Hostile.cs b/RotationSolver/Updaters/TargetUpdater_Hostile.cs index b4f476dda..eab8b3e17 100644 --- a/RotationSolver/Updaters/TargetUpdater_Hostile.cs +++ b/RotationSolver/Updaters/TargetUpdater_Hostile.cs @@ -39,14 +39,18 @@ internal static partial class TargetUpdater internal unsafe static void UpdateHostileTargets() { + var hasFate = (IntPtr)FateManager.Instance() != IntPtr.Zero; + //能打的目标 AllTargets = TargetFilter.GetTargetable(TargetFilter.GetObjectInRadius(Service.ObjectTable, 30).Where(obj => { + if (obj is BattleChara c && c.CurrentHp != 0) { if (c.StatusList.Any(status => Service.DataManager.GetExcelSheet() .GetRow(status.StatusId).Icon == 15024)) return false; + try { var gameObj = (FFXIVClientStructs.FFXIV.Client.Game.Object.GameObject*)(void*)c.Address; @@ -55,7 +59,7 @@ internal unsafe static void UpdateHostileTargets() if (!gameObj->GetIsTargetable()) return false; //不在fate中,不打fate怪。 - if (FateManager.Instance()->FateJoined == 0 + if ((!hasFate ||FateManager.Instance()->FateJoined == 0) && gameObj->FateId > 0) return false; } catch @@ -69,19 +73,21 @@ internal unsafe static void UpdateHostileTargets() }).Cast()); //Filter the fate objects. - bool inFate = Service.Configuration.ChangeTargetForFate && FateManager.Instance()->FateJoined > 0; + bool inFate = Service.Configuration.ChangeTargetForFate && hasFate && FateManager.Instance()->FateJoined > 0; uint[] ids = GetEnemies() ?? new uint[0]; + if (AllTargets != null) { HostileTargets = CountDown.CountDownTime > 0 ? AllTargets : inFate ? AllTargets.Where(t => { + bool lowEnoughLevel = Service.ClientState.LocalPlayer.Level <= FateManager.Instance()->CurrentFate->MaxLevel; + try { return t.TargetObject == Service.ClientState.LocalPlayer || - ((FFXIVClientStructs.FFXIV.Client.Game.Object.GameObject*)(void*)t.Address)->FateId == FateManager.Instance()->CurrentFate->FateId - && Service.ClientState.LocalPlayer.Level <= FateManager.Instance()->CurrentFate->MaxLevel; + lowEnoughLevel && ((FFXIVClientStructs.FFXIV.Client.Game.Object.GameObject*)(void*)t.Address)->FateId == FateManager.Instance()->CurrentFate->FateId; } catch { @@ -90,19 +96,20 @@ internal unsafe static void UpdateHostileTargets() }) : AllTargets.Where(t => t.TargetObject is BattleChara || ids.Contains(t.ObjectId)); + switch (IconReplacer.RightNowTargetToHostileType) { - case TargetHostileType.AllTargetsCanAttack: + case TargetHostileType.AllTargetsCanAttack: HostileTargets = AllTargets; break; default: - case TargetHostileType.TargetsHaveTargetOrAllTargetsCanAttack: + case TargetHostileType.TargetsHaveTargetOrAllTargetsCanAttack: if (!HostileTargets.Any()) HostileTargets = AllTargets; break; - case TargetHostileType.TargetsHaveTarget: + case TargetHostileType.TargetsHaveTarget: break; } diff --git a/RotationSolver/Windows/RotationConfigWindow_Debug.cs b/RotationSolver/Windows/RotationConfigWindow_Debug.cs index 00285eb5d..34d9845dc 100644 --- a/RotationSolver/Windows/RotationConfigWindow_Debug.cs +++ b/RotationSolver/Windows/RotationConfigWindow_Debug.cs @@ -34,6 +34,9 @@ private void DrawDebugTab() if (ImGui.CollapsingHeader("Target Data")) { + var count = TargetUpdater.AllTargets?.Count() ?? 0; + ImGui.Text(count.ToString()); + if (Service.TargetManager.Target is BattleChara b) { ImGui.Text("Is Boss: " + b.IsBoss().ToString()); diff --git a/RotationSolver/Windows/RotationConfigWindow_Help.cs b/RotationSolver/Windows/RotationConfigWindow_Help.cs index 491a48563..fc9b221a0 100644 --- a/RotationSolver/Windows/RotationConfigWindow_Help.cs +++ b/RotationSolver/Windows/RotationConfigWindow_Help.cs @@ -63,16 +63,16 @@ private void DrawHelpTab() SpecialCommandType.DefenseSingle.DisplayCommandHelp(getHelp: EnumTranslations.ToHelp); ImGui.Separator(); - SpecialCommandType.EsunaShieldNorth.DisplayCommandHelp(getHelp: EnumTranslations.ToHelp); + SpecialCommandType.MoveForward.DisplayCommandHelp(getHelp: EnumTranslations.ToHelp); ImGui.Separator(); - SpecialCommandType.RaiseShirk.DisplayCommandHelp(getHelp: EnumTranslations.ToHelp); + SpecialCommandType.MoveBack.DisplayCommandHelp(getHelp: EnumTranslations.ToHelp); ImGui.Separator(); - SpecialCommandType.MoveForward.DisplayCommandHelp(getHelp: EnumTranslations.ToHelp); + SpecialCommandType.EsunaShieldNorth.DisplayCommandHelp(getHelp: EnumTranslations.ToHelp); ImGui.Separator(); - SpecialCommandType.MoveBack.DisplayCommandHelp(getHelp: EnumTranslations.ToHelp); + SpecialCommandType.RaiseShirk.DisplayCommandHelp(getHelp: EnumTranslations.ToHelp); ImGui.Separator(); SpecialCommandType.AntiRepulsion.DisplayCommandHelp(getHelp: EnumTranslations.ToHelp);