diff --git a/RotationSolver.Basic/Attributes/LinkDescriptionAttribute.cs b/RotationSolver.Basic/Attributes/LinkDescriptionAttribute.cs index 726fb8c30..bbbe7db4d 100644 --- a/RotationSolver.Basic/Attributes/LinkDescriptionAttribute.cs +++ b/RotationSolver.Basic/Attributes/LinkDescriptionAttribute.cs @@ -9,6 +9,10 @@ namespace RotationSolver.Basic.Attributes; [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)] public class LinkDescriptionAttribute : Attribute { + static readonly SortedDictionary _TextureCache = new SortedDictionary(); + + static readonly List _loadingTexture = new List(); + public TextureWrap Texture { get; private set; } public string Path { get; } public LinkDescriptionAttribute(string path) @@ -19,19 +23,28 @@ public LinkDescriptionAttribute(string path) private void LoadTexture(string path) { + if(_TextureCache.TryGetValue(path,out var t)) + { + Texture = t; + return; + } + if (_loadingTexture.Contains(path)) + { + return; + } + _loadingTexture.Add(path); + try { Task.Run(async () => { var bytes = await LoadBytes(path); - Texture = TryLoadImage(bytes); + _TextureCache[path] = Texture = TryLoadImage(bytes); }); } catch { - } - } private static async Task LoadBytes(string url) diff --git a/RotationSolver.Basic/Configuration/JsonCreationConverter.cs b/RotationSolver.Basic/Configuration/JsonCreationConverter.cs new file mode 100644 index 000000000..d2c29088b --- /dev/null +++ b/RotationSolver.Basic/Configuration/JsonCreationConverter.cs @@ -0,0 +1,6 @@ +namespace RotationSolver.Basic.Configuration +{ + internal class JsonCreationConverter + { + } +} \ No newline at end of file diff --git a/RotationSolver.Basic/Configuration/PluginConfiguration.cs b/RotationSolver.Basic/Configuration/PluginConfiguration.cs index 7a6f22c47..2692d2d5b 100644 --- a/RotationSolver.Basic/Configuration/PluginConfiguration.cs +++ b/RotationSolver.Basic/Configuration/PluginConfiguration.cs @@ -1,4 +1,5 @@ using Dalamud.Configuration; +using Newtonsoft.Json; using RotationSolver.Basic.Data; using System.Numerics; diff --git a/RotationSolver/Localization/Localization.json b/RotationSolver/Localization/Localization.json index 7b4ff53c1..020ea8ace 100644 --- a/RotationSolver/Localization/Localization.json +++ b/RotationSolver/Localization/Localization.json @@ -12,158 +12,161 @@ "ConfigWindow_EventItem": "Event", "ConfigWindow_ActionItem": "Action", "ConfigWindow_HelpItem": "Help", + "ConfigWindow_RotationDev": "RotationDev", "ConfigWindow_ActionItem_Description": "Modify the usage for each action.", "ConfigWindow_HelpItem_Description": "In this window, you can see all Rotation Solver built-in commands for combat. ", - "Configwindow_HelpItem_AttackSmart": "Start attacking in smart mode(auto-targeting) when out of combat, otherwise switch the target according to the conditions.", - "Configwindow_HelpItem_AttackManual": "Start attacking in manual mode. You need to choose the target manually.", - "Configwindow_HelpItem_AttackCancel": "Stop attacking. Remember to turn it off when not in use!", - "Configwindow_HelpItem_HealArea": "Open a window to use AoE heal.", - "Configwindow_HelpItem_HealSingle": "Open a window to use single heal.", - "Configwindow_HelpItem_DefenseArea": "Open a window to use AoE defense.", - "Configwindow_HelpItem_DefenseSingle": "Open a window to use single defense.", - "Configwindow_HelpItem_Esuna": "Open a window to use Esuna,tank stance actions or True North.", - "Configwindow_HelpItem_RaiseShirk": "Open a window to use Raise or Shirk.", - "Configwindow_HelpItem_AntiKnockback": "Open a window to use knockback-penalty actions.", - "Configwindow_HelpItem_Burst": "Open a window to burst.", - "Configwindow_HelpItem_MoveForward": "Open a window to move forward.", - "Configwindow_HelpItem_MoveBack": "Open a window to move back.", - "Configwindow_HelpItem_EndSpecial": "Close special window.", - "Configwindow_Helper_SwitchRotation": "Click to switch authors", - "Configwindow_Helper_GameVersion": "Game Version", - "Configwindow_Helper_OpenSource": "Open the source code URL", - "Configwindow_Helper_RunCommand": "Click to execute the command", - "Configwindow_Helper_CopyCommand": "Right-click to copy command", - "Configwindow_Helper_InsertCommand": "Insert \"{0}\" first in 5s", - "Configwindow_Rotation_Description": "You can enable the function for each job you want and configure the setting about how to use actions.", - "Configwindow_Rotation_KeyName": "The key name is", - "Configwindow_Events_AddEvent": "AddEvents", - "Configwindow_Events_Description": "In this window, you can set what macro will be trigger after using an action.", - "Configwindow_Events_ActionName": "Action Name", - "Configwindow_Events_MacroIndex": "Macro No.", - "Configwindow_Events_ShareMacro": "Is Shared", - "Configwindow_Events_RemoveEvent": "Delete Event", - "Configwindow_Events_DutyStart": "Duty Start: ", - "Configwindow_Events_DutyEnd": "Duty End: ", - "Configwindow_Params_Description": "In this window, you can set the parameters about the using way of actions.", - "Configwindow_Param_NeverReplaceIcon": "Never Replace Icons", - "Configwindow_Param_NeverReplaceIconDesc": "Icon replacement: Repose is automatically displayed as the next action to be used", - "Configwindow_Param_UseOverlayWindow": "Display Top Overlay", - "Configwindow_Param_UseOverlayWindowDesc": "This top window is used to display some extra information on your game window, such as target's positional, target and sub-target, etc.", - "Configwindow_Param_Basic": "Basic", - "Configwindow_Param_ActionAhead": "Set the time advance of using actions", - "Configwindow_Param_AbilitiesInterval": "Set the interval between 0GCD using", - "Configwindow_Param_CountDownAhead": "Set the time advance of using 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.", - "Configwindow_Param_UseWorkTask": "Use work task for acceleration.", - "Configwindow_Param_Delay": "Delay", - "Configwindow_Param_WeaponDelay": "Set the range of random delay for GCD in second.", - "Configwindow_Param_DeathDelay": "Set the range of random delay for raising deaths in second.", - "Configwindow_Param_HostileDelay": "Set the range of random delay for finding hostile targets in second.", - "Configwindow_Param_InterruptDelay": "Set the range of random delay for interrupting hostile targets in second.", - "Configwindow_Param_WeakenDelay": "Set the range of random delay for esuna weakens in second.", - "Configwindow_Param_HealDelay": "Set the range of random delay for healing people in second.", - "Configwindow_Param_NotInCombatDelay": "Set the range of random delay for Not In Combat in second.", - "Configwindow_Param_StopCastingDelay": "Set the range of random delay for stoping casting when target is no need to cast in second.", - "Configwindow_Param_Display": "Display", - "Configwindow_Param_Advanced": "Advanced", - "Configwindow_Param_PoslockCasting": "Lock the movement when casting.", - "Configwindow_Param_UseStopCasting": "Use stopping casting when target is dead.", - "Configwindow_Param_ShowActionFlag": "Show action flag.", - "Configwindow_Param_ShowHealthRatio": "Show the health ratio for the check of Boss, Dying, Dot.", - "Configwindow_Param_HealthRatioBoss": "If target's max health ratio is higher than this, regard it as Boss.", - "Configwindow_Param_HealthRatioDying": "If target's current health ratio is lower than this, regard it is dying.", - "Configwindow_Param_HealthRatioDot": "If target's current health ratio is higher than this, regard it can be dot.", - "Configwindow_Param_PoslockModifier": "Set the modifier key to unlock the movement temporary", - "Configwindow_Param_PoslockDescription": "LT is for gamepad player", - "Configwindow_Param_CastingDisplay": "Enhance castbar with casting status", - "Configwindow_Param_TeachingMode": "Teaching mode", - "Configwindow_Param_TeachingModeColor": "Prompt box color of teaching mode", - "Configwindow_Param_MovingTargetColor": "Prompt box color of moving target", - "Configwindow_Param_TargetColor": "Target color", - "Configwindow_Params_SubTargetColor": "Sub-target color", - "Configwindow_Param_KeyBoardNoise": "Simulate the effect of pressing", - "Configwindow_Params_VoiceVolume": "Voice volume", - "Configwindow_Param_FlytextPositional": "Hint positional anticipation by flytext", - "Configwindow_Param_SayPositional": "Hint positional anticipation by shouting", - "Configwindow_Param_PositionalFeedback": "Positional error feedback", - "Configwindow_Param_DrawPositional": "Draw Positional on the screen", - "Configwindow_Param_DrawMeleeRange": "Draw the range of melee on the screen", - "Configwindow_Param_ShowMoveTarget": "Show the pointing target of the move skill", - "Configwindow_Param_ShowTarget": "Show Target", - "Configwindow_Param_PositionalFeedbackDesc": "Attention: Positional anticipation is experimental, just for reference only.", - "Configwindow_Param_PositionaErrorText": "Positional error prompt", - "Configwindow_Params_LocationWrongTextDesc": "How do you want to be scolded if you have a positional error ?!", - "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 on toast", - "Configwindow_Param_NamePlateIconId": "Player's name plate icon id when state is on. Recommand 61435, 61437", - "Configwindow_Param_Action": "Action", - "Configwindow_Param_UseAOEAction": "Use AOE actions", - "Configwindow_Param_UseAOEWhenManual": "Use AOE actions in manual mode", - "Configwindow_Param_AutoBurst": "Automatic burst", - "Configwindow_Param_UseAbility": "Auto-use abilities", - "Configwindow_Param_NoNewHostiles": "Don't attack new mobs by aoe", - "Configwindow_Params_NoNewHostilesDesc": "Nerver use any AOE action when this action may attack the mobs that not is a hostile target.", - "Configwindow_Param_UseDefenceAbility": "Use defence abilities", - "Configwindow_Param_UseDefenceAbilityDesc": "It is recommended to check this option if you are playing Raids./nPlan the heal and defense by yourself.???", - "Configwindow_Param_AutoShield": "Auto tank stance", - "Configwindow_Param_AutoProvokeForTank": "Auto Provoke (Tank)", - "Configwindow_Param_AutoProvokeForTankDesc": "When a hostile is hitting the non-Tank member of party, it will automatically use the Provoke.", - "Configwindow_Param_AutoUseTrueNorth": "Auto TrueNorth (Melee)", - "Configwindow_Param_RaisePlayerBySwift": "Raise player by swift", - "Configwindow_Param_UseGroundBeneficialAbility": "Use beneficaial ground-targeted actions", - "Configwindow_Param_RaisePlayerByCasting": "Raise player by casting when swift is in cooldown", - "Configwindow_Param_UseHealWhenNotAHealer": "Use heal when not-healer", - "Configwindow_Param_LessMPNoRaise": "Nerver raise player if MP is less than the set value", - "Configwindow_Param_UseItem": "Use items", - "Configwindow_Param_UseItemDesc": "Use poison, WIP", - "Configwindow_Param_Conditon": "Condition", - "Configwindow_Param_StartOnCountdown": "Turn on auto-rotation on countdown", - "Configwindow_Param_EsunaAll": "Esuna All Statuses.", - "Configwindow_Param_InterruptibleMoreCheck": "Interrupt the action with action type check.", - "Configwindow_Param_HealOutOfCombat": "Heal party members outside of combat.", - "Configwindow_Param_HealthDifference": "Set the HP standard deviation threshold for using AOE heal (ability & spell)", - "Configwindow_Param_HealthAreaAbility": "Set the HP threshold for using AOE healing ability", - "Configwindow_Param_HealthAreaSpell": "Set the HP threshold for using AOE healing spell", - "Configwindow_Param_HealingOfTimeSubtractArea": "Set the HP threshold reduce with hot effect(AOE)", - "Configwindow_Param_HealthSingleAbility": "Set the HP threshold for using single healing ability", - "Configwindow_Param_HealthSingleSpell": "Set the HP threshold for using single healing spell", - "Configwindow_Param_HealingOfTimeSubtractSingle": "Set the HP threshold reduce with hot effect(single)", - "Configwindow_Param_HealthForDyingTank": "Set the HP threshold for tank to use invincibility", - "Configwindow_Param_MeleeRangeOffset": "Melee Range action using offset", - "Configwindow_Param_Target": "Target", - "Configwindow_Param_RightNowTargetToHostileType": "Hostile target filtering condition", - "Configwindow_Param_TargetToHostileType1": "All targets can attack", - "Configwindow_Param_TargetToHostileType2": "Targets have a target or all targets can attack", - "Configwindow_Param_TargetToHostileType3": "Targets have a target", - "Configwindow_Param_NoticeUnexpectedCombat": "NOTICE: You are not turn the auto off between area on. It may start a combat unexpectedly.", - "Configwindow_Param_AddEnemyListToHostile": "Add Enemies list to the hostile target.", - "Configwindow_Param_ChooseAttackMark": "Priority attack targets with attack markers", - "Configwindow_Param_CanAttackMarkAOE": "Forced use of AOE", - "Configwindow_Param_AttackMarkAOEDesc": "Attention: Checking this option , AA will attack as many hostile targets as possible, while ignoring whether the attack will cover the marked target.", - "Configwindow_Param_FilterStopMark": "Never attack targets with stop markers", - "Configwindow_Param_ObjectMinRadius": "Set the minimum target circle threshold possessed by the attack target", - "Configwindow_Param_MoveTargetAngle": "The size of the sector angle that can be selected as the moveable target", - "Configwindow_Param_MoveTargetAngleDesc": "If the selection mode is based on character facing, i.e., targets within the character's viewpoint are movable targets. \nIf the selection mode is screen-centered, i.e., targets within a sector drawn upward from the character's point are movable targets.", - "Configwindow_Param_ChangeTargetForFate": "Select only Fate targets in Fate", - "Configwindow_Param_OnlyAttackInView": "Only attack the target in view.", - "Configwindow_Param_MoveTowardsScreen": "Using movement actions towards the object in the center of the screen", - "Configwindow_Param_MoveTowardsScreenDesc": "Using movement actions towards the object in the center of the screen, otherwise toward the facing object.", - "Configwindow_Param_RaiseAll": "Raise all (include passerby)", - "Configwindow_Param_TargetFriendly": "Target all for friendly actions(include passerby)", - "Configwindow_Param_RaiseBrinkofDeath": "Raise player even has Brink of Death", - "Configwindow_Param_MoveAreaActionFarthest": "Moving Area Ability to farthest", - "Configwindow_Param_MoveAreaActionFarthestDesc": "Move to the furthest position from character's face direction.", - "Configwindow_Param_Hostile": "Hostile", - "Configwindow_Param_HostileDesc": "You can set the logic of hostile target selection to allow flexibility in switching the logic of selecting hostile in battle.", - "Configwindow_Param_AddHostileCondition": "Add selection condition", - "Configwindow_Param_HostileCondition": "Hostile target selection condition", - "Configwindow_Param_ConditionUp": "Up", - "Configwindow_Param_ConditionDown": "Down", - "Configwindow_Param_ConditionDelete": "Delete", + "ConfigWindow_HelpItem_AttackSmart": "Start attacking in smart mode(auto-targeting) when out of combat, otherwise switch the target according to the conditions.", + "ConfigWindow_HelpItem_AttackManual": "Start attacking in manual mode. You need to choose the target manually.", + "ConfigWindow_HelpItem_AttackCancel": "Stop attacking. Remember to turn it off when not in use!", + "ConfigWindow_HelpItem_HealArea": "Open a window to use AoE heal.", + "ConfigWindow_HelpItem_HealSingle": "Open a window to use single heal.", + "ConfigWindow_HelpItem_DefenseArea": "Open a window to use AoE defense.", + "ConfigWindow_HelpItem_DefenseSingle": "Open a window to use single defense.", + "ConfigWindow_HelpItem_Esuna": "Open a window to use Esuna,tank stance actions or True North.", + "ConfigWindow_HelpItem_RaiseShirk": "Open a window to use Raise or Shirk.", + "ConfigWindow_HelpItem_AntiKnockback": "Open a window to use knockback-penalty actions.", + "ConfigWindow_HelpItem_Burst": "Open a window to burst.", + "ConfigWindow_HelpItem_MoveForward": "Open a window to move forward.", + "ConfigWindow_HelpItem_MoveBack": "Open a window to move back.", + "ConfigWindow_HelpItem_EndSpecial": "Close special window.", + "ConfigWindow_Helper_SwitchRotation": "Click to switch authors", + "ConfigWindow_Helper_GameVersion": "Game Version", + "ConfigWindow_Helper_OpenSource": "Open the source code URL", + "ConfigWindow_Helper_RunCommand": "Click to execute the command", + "ConfigWindow_Helper_CopyCommand": "Right-click to copy command", + "ConfigWindow_Helper_InsertCommand": "Insert \"{0}\" first in 5s", + "ConfigWindow_Rotation_Description": "You can enable the function for each job you want and configure the setting about how to use actions.", + "ConfigWindow_RotationDev_Description": "You can get some extra rotation development information here.", + "ConfigWindow_Rotation_KeyName": "The key name is", + "ConfigWindow_Events_AddEvent": "AddEvents", + "ConfigWindow_Events_Description": "In this window, you can set what macro will be trigger after using an action.", + "ConfigWindow_Events_ActionName": "Action Name", + "ConfigWindow_Events_MacroIndex": "Macro No.", + "ConfigWindow_Events_ShareMacro": "Is Shared", + "ConfigWindow_Events_RemoveEvent": "Delete Event", + "ConfigWindow_Events_DutyStart": "Duty Start: ", + "ConfigWindow_Events_DutyEnd": "Duty End: ", + "ConfigWindow_Params_Description": "In this window, you can set the parameters about the using way of actions.", + "ConfigWindow_Param_NeverReplaceIcon": "Never Replace Icons", + "ConfigWindow_Param_NeverReplaceIconDesc": "Icon replacement: Repose is automatically displayed as the next action to be used", + "ConfigWindow_Param_UseOverlayWindow": "Display Top Overlay", + "ConfigWindow_Param_UseOverlayWindowDesc": "This top window is used to display some extra information on your game window, such as target's positional, target and sub-target, etc.", + "ConfigWindow_Param_Basic": "Basic", + "ConfigWindow_Param_ActionAhead": "Set the time advance of using actions", + "ConfigWindow_Param_AbilitiesInterval": "Set the interval between 0GCD using", + "ConfigWindow_Param_CountDownAhead": "Set the time advance of using 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.", + "ConfigWindow_Param_UseWorkTask": "Use work task for acceleration.", + "ConfigWindow_Param_Delay": "Delay", + "ConfigWindow_Param_WeaponDelay": "Set the range of random delay for GCD in second.", + "ConfigWindow_Param_DeathDelay": "Set the range of random delay for raising deaths in second.", + "ConfigWindow_Param_HostileDelay": "Set the range of random delay for finding hostile targets in second.", + "ConfigWindow_Param_InterruptDelay": "Set the range of random delay for interrupting hostile targets in second.", + "ConfigWindow_Param_WeakenDelay": "Set the range of random delay for esuna weakens in second.", + "ConfigWindow_Param_HealDelay": "Set the range of random delay for healing people in second.", + "ConfigWindow_Param_NotInCombatDelay": "Set the range of random delay for Not In Combat in second.", + "ConfigWindow_Param_StopCastingDelay": "Set the range of random delay for stoping casting when target is no need to cast in second.", + "ConfigWindow_Param_Display": "Display", + "ConfigWindow_Param_Advanced": "Advanced", + "ConfigWindow_Param_PoslockCasting": "Lock the movement when casting.", + "ConfigWindow_Param_UseStopCasting": "Use stopping casting when target is dead.", + "ConfigWindow_Param_ShowActionFlag": "Show action flag.", + "ConfigWindow_Param_InDebug": "Debug Mode", + "ConfigWindow_Param_ShowHealthRatio": "Show the health ratio for the check of Boss, Dying, Dot.", + "ConfigWindow_Param_HealthRatioBoss": "If target's max health ratio is higher than this, regard it as Boss.", + "ConfigWindow_Param_HealthRatioDying": "If target's current health ratio is lower than this, regard it is dying.", + "ConfigWindow_Param_HealthRatioDot": "If target's current health ratio is higher than this, regard it can be dot.", + "ConfigWindow_Param_PoslockModifier": "Set the modifier key to unlock the movement temporary", + "ConfigWindow_Param_PoslockDescription": "LT is for gamepad player", + "ConfigWindow_Param_CastingDisplay": "Enhance castbar with casting status", + "ConfigWindow_Param_TeachingMode": "Teaching mode", + "ConfigWindow_Param_TeachingModeColor": "Prompt box color of teaching mode", + "ConfigWindow_Param_MovingTargetColor": "Prompt box color of moving target", + "ConfigWindow_Param_TargetColor": "Target color", + "ConfigWindow_Params_SubTargetColor": "Sub-target color", + "ConfigWindow_Param_KeyBoardNoise": "Simulate the effect of pressing", + "ConfigWindow_Params_VoiceVolume": "Voice volume", + "ConfigWindow_Param_FlytextPositional": "Hint positional anticipation by flytext", + "ConfigWindow_Param_SayPositional": "Hint positional anticipation by shouting", + "ConfigWindow_Param_PositionalFeedback": "Positional error feedback", + "ConfigWindow_Param_DrawPositional": "Draw Positional on the screen", + "ConfigWindow_Param_DrawMeleeRange": "Draw the range of melee on the screen", + "ConfigWindow_Param_ShowMoveTarget": "Show the pointing target of the move skill", + "ConfigWindow_Param_ShowTarget": "Show Target", + "ConfigWindow_Param_PositionalFeedbackDesc": "Attention: Positional anticipation is experimental, just for reference only.", + "ConfigWindow_Param_PositionaErrorText": "Positional error prompt", + "ConfigWindow_Params_LocationWrongTextDesc": "How do you want to be scolded if you have a positional error ?!", + "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 on toast", + "ConfigWindow_Param_NamePlateIconId": "Player's name plate icon id when state is on. Recommand 61435, 61437", + "ConfigWindow_Param_Action": "Action", + "ConfigWindow_Param_UseAOEAction": "Use AOE actions", + "ConfigWindow_Param_UseAOEWhenManual": "Use AOE actions in manual mode", + "ConfigWindow_Param_AutoBurst": "Automatic burst", + "ConfigWindow_Param_UseAbility": "Auto-use abilities", + "ConfigWindow_Param_NoNewHostiles": "Don't attack new mobs by aoe", + "ConfigWindow_Params_NoNewHostilesDesc": "Nerver use any AOE action when this action may attack the mobs that not is a hostile target.", + "ConfigWindow_Param_UseDefenceAbility": "Use defence abilities", + "ConfigWindow_Param_UseDefenceAbilityDesc": "It is recommended to check this option if you are playing Raids./nPlan the heal and defense by yourself.???", + "ConfigWindow_Param_AutoShield": "Auto tank stance", + "ConfigWindow_Param_AutoProvokeForTank": "Auto Provoke (Tank)", + "ConfigWindow_Param_AutoProvokeForTankDesc": "When a hostile is hitting the non-Tank member of party, it will automatically use the Provoke.", + "ConfigWindow_Param_AutoUseTrueNorth": "Auto TrueNorth (Melee)", + "ConfigWindow_Param_RaisePlayerBySwift": "Raise player by swift", + "ConfigWindow_Param_UseGroundBeneficialAbility": "Use beneficaial ground-targeted actions", + "ConfigWindow_Param_RaisePlayerByCasting": "Raise player by casting when swift is in cooldown", + "ConfigWindow_Param_UseHealWhenNotAHealer": "Use heal when not-healer", + "ConfigWindow_Param_LessMPNoRaise": "Nerver raise player if MP is less than the set value", + "ConfigWindow_Param_UseItem": "Use items", + "ConfigWindow_Param_UseItemDesc": "Use poison, WIP", + "ConfigWindow_Param_Conditon": "Condition", + "ConfigWindow_Param_StartOnCountdown": "Turn on auto-rotation on countdown", + "ConfigWindow_Param_EsunaAll": "Esuna All Statuses.", + "ConfigWindow_Param_InterruptibleMoreCheck": "Interrupt the action with action type check.", + "ConfigWindow_Param_HealOutOfCombat": "Heal party members outside of combat.", + "ConfigWindow_Param_HealthDifference": "Set the HP standard deviation threshold for using AOE heal (ability & spell)", + "ConfigWindow_Param_HealthAreaAbility": "Set the HP threshold for using AOE healing ability", + "ConfigWindow_Param_HealthAreaSpell": "Set the HP threshold for using AOE healing spell", + "ConfigWindow_Param_HealingOfTimeSubtractArea": "Set the HP threshold reduce with hot effect(AOE)", + "ConfigWindow_Param_HealthSingleAbility": "Set the HP threshold for using single healing ability", + "ConfigWindow_Param_HealthSingleSpell": "Set the HP threshold for using single healing spell", + "ConfigWindow_Param_HealingOfTimeSubtractSingle": "Set the HP threshold reduce with hot effect(single)", + "ConfigWindow_Param_HealthForDyingTank": "Set the HP threshold for tank to use invincibility", + "ConfigWindow_Param_MeleeRangeOffset": "Melee Range action using offset", + "ConfigWindow_Param_Target": "Target", + "ConfigWindow_Param_RightNowTargetToHostileType": "Hostile target filtering condition", + "ConfigWindow_Param_TargetToHostileType1": "All targets can attack", + "ConfigWindow_Param_TargetToHostileType2": "Targets have a target or all targets can attack", + "ConfigWindow_Param_TargetToHostileType3": "Targets have a target", + "ConfigWindow_Param_NoticeUnexpectedCombat": "NOTICE: You are not turn the auto off between area on. It may start a combat unexpectedly.", + "ConfigWindow_Param_AddEnemyListToHostile": "Add Enemies list to the hostile target.", + "ConfigWindow_Param_ChooseAttackMark": "Priority attack targets with attack markers", + "ConfigWindow_Param_CanAttackMarkAOE": "Forced use of AOE", + "ConfigWindow_Param_AttackMarkAOEDesc": "Attention: Checking this option , AA will attack as many hostile targets as possible, while ignoring whether the attack will cover the marked target.", + "ConfigWindow_Param_FilterStopMark": "Never attack targets with stop markers", + "ConfigWindow_Param_ObjectMinRadius": "Set the minimum target circle threshold possessed by the attack target", + "ConfigWindow_Param_MoveTargetAngle": "The size of the sector angle that can be selected as the moveable target", + "ConfigWindow_Param_MoveTargetAngleDesc": "If the selection mode is based on character facing, i.e., targets within the character's viewpoint are movable targets. \nIf the selection mode is screen-centered, i.e., targets within a sector drawn upward from the character's point are movable targets.", + "ConfigWindow_Param_ChangeTargetForFate": "Select only Fate targets in Fate", + "ConfigWindow_Param_OnlyAttackInView": "Only attack the target in view.", + "ConfigWindow_Param_MoveTowardsScreen": "Using movement actions towards the object in the center of the screen", + "ConfigWindow_Param_MoveTowardsScreenDesc": "Using movement actions towards the object in the center of the screen, otherwise toward the facing object.", + "ConfigWindow_Param_RaiseAll": "Raise all (include passerby)", + "ConfigWindow_Param_TargetFriendly": "Target all for friendly actions(include passerby)", + "ConfigWindow_Param_RaiseBrinkofDeath": "Raise player even has Brink of Death", + "ConfigWindow_Param_MoveAreaActionFarthest": "Moving Area Ability to farthest", + "ConfigWindow_Param_MoveAreaActionFarthestDesc": "Move to the furthest position from character's face direction.", + "ConfigWindow_Param_Hostile": "Hostile", + "ConfigWindow_Param_HostileDesc": "You can set the logic of hostile target selection to allow flexibility in switching the logic of selecting hostile in battle.", + "ConfigWindow_Param_AddHostileCondition": "Add selection condition", + "ConfigWindow_Param_HostileCondition": "Hostile target selection condition", + "ConfigWindow_Param_ConditionUp": "Up", + "ConfigWindow_Param_ConditionDown": "Down", + "ConfigWindow_Param_ConditionDelete": "Delete", "Timeline_DragdropDescription": "Drag&drop to move,Ctrl+Alt+RightClick to delete.", "Timeline_SearchBar": "Search Bar", "Timeline_MustUse": "MustUse", diff --git a/RotationSolver/Localization/Strings_Major.cs b/RotationSolver/Localization/Strings_Major.cs index 993bde3cc..1980d3f53 100644 --- a/RotationSolver/Localization/Strings_Major.cs +++ b/RotationSolver/Localization/Strings_Major.cs @@ -125,7 +125,6 @@ internal partial class Strings public string ConfigWindow_Param_UseStopCasting { get; set; } = "Use stopping casting when target is dead."; public string ConfigWindow_Param_ShowActionFlag { get; set; } = "Show action flag."; public string ConfigWindow_Param_InDebug { get; set; } = "Debug Mode"; - public string ConfigWindow_Param_InDebugWarning { get; set; } = "Debug Mode"; public string ConfigWindow_Param_ShowHealthRatio { get; set; } = "Show the health ratio for the check of Boss, Dying, Dot."; public string ConfigWindow_Param_HealthRatioBoss { get; set; } = "If target's max health ratio is higher than this, regard it as Boss."; diff --git a/RotationSolver/RotationSolverPlugin.cs b/RotationSolver/RotationSolverPlugin.cs index e2b2fcc04..db4a4097b 100644 --- a/RotationSolver/RotationSolverPlugin.cs +++ b/RotationSolver/RotationSolverPlugin.cs @@ -1,5 +1,8 @@ using Dalamud.Interface.Windowing; using Dalamud.Plugin; +using Dalamud.Utility; +using ImGuiScene; +using Newtonsoft.Json; using RotationSolver.Basic; using RotationSolver.Basic.Configuration; using RotationSolver.Basic.Data; @@ -8,6 +11,7 @@ using RotationSolver.SigReplacers; using RotationSolver.UI; using RotationSolver.Updaters; +using System.Net; namespace RotationSolver; @@ -19,16 +23,17 @@ public sealed class RotationSolverPlugin : IDalamudPlugin, IDisposable static readonly List _dis = new List(); public string Name => "Rotation Solver"; - public unsafe RotationSolverPlugin(DalamudPluginInterface pluginInterface) { pluginInterface.Create(); try { - Service.Config = pluginInterface.GetPluginConfig() as PluginConfiguration ?? new PluginConfiguration(); + Service.Config = JsonConvert.DeserializeObject( + File.ReadAllText(Service.Interface.ConfigFile.FullName)) + ?? new PluginConfiguration(); } - catch + catch(Exception ex) { Service.Config = new PluginConfiguration(); } @@ -58,6 +63,7 @@ public unsafe RotationSolverPlugin(DalamudPluginInterface pluginInterface) RotationUpdater.GetAllCustomRotations(); } + internal static void ChangeUITranslation() { _comboConfigWindow.WindowName = LocalizationManager.RightLang.ConfigWindow_Header diff --git a/RotationSolver/UI/ImGuiHelper.cs b/RotationSolver/UI/ImGuiHelper.cs index b468e4a32..0c1d63271 100644 --- a/RotationSolver/UI/ImGuiHelper.cs +++ b/RotationSolver/UI/ImGuiHelper.cs @@ -15,6 +15,7 @@ using RotationSolver.Basic.Helpers; using RotationSolver.Basic.Rotations; using RotationSolver.Localization; +using RotationSolver.Updaters; using System.ComponentModel; using System.Numerics; using System.Reflection; @@ -443,7 +444,17 @@ public unsafe static void Display(this ICustomRotation rotation, ICustomRotation ImGui.TextColored(isAllowed ? ImGuiColors.DalamudWhite : ImGuiColors.DalamudViolet, rotation.GetAuthor()); if (!isAllowed) - HoveredString("This rotation is not allowed to be used in High-end Duty!"); + { + var allHighEnds = string.Join('\n', SocialUpdater.HighEndDuties.Select(x => x.PlaceName?.Value?.Name.ToString()) + .Where(s => !string.IsNullOrEmpty(s))); + + var showStr = "This rotation is not allowed to be used in High-end Duty!"; + if(!string.IsNullOrEmpty(allHighEnds)) + { + showStr += "\n" + allHighEnds; + } + HoveredString(showStr); + } ImGui.SameLine(); ImGui.TextDisabled(" - " + LocalizationManager.RightLang.ConfigWindow_Helper_GameVersion + ": "); @@ -482,7 +493,7 @@ public unsafe static void Display(this ICustomRotation rotation, ICustomRotation { DrawTooltip(() => { - var ratio = Math.Min(1, 1000f / texture.Texture.Width); + var ratio = Math.Min(1, 1500f / texture.Texture.Width); var size = new Vector2(texture.Texture.Width * ratio, texture.Texture.Height * ratio); ImGui.Image(texture.Texture.ImGuiHandle, size); diff --git a/RotationSolver/UI/RotationConfigWindow_Help.cs b/RotationSolver/UI/RotationConfigWindow_Help.cs index 369524faa..e60bad3eb 100644 --- a/RotationSolver/UI/RotationConfigWindow_Help.cs +++ b/RotationSolver/UI/RotationConfigWindow_Help.cs @@ -51,7 +51,7 @@ private void DrawHelpTab() ImGui.TextWrapped(LocalizationManager.RightLang.ConfigWindow_HelpItem_Description); - if (ImGui.BeginChild("Help Infomation", new Vector2(0f, -1f), true)) + if (ImGui.BeginChild("Help Information", new Vector2(0f, -1f), true)) { ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, new Vector2(0f, 5f)); @@ -86,6 +86,8 @@ private void DrawHelpTab() SpecialCommandType.Burst.DisplayCommandHelp(getHelp: EnumTranslations.ToHelp); ImGui.PopStyleVar(); + + ImGui.EndChild(); } } } diff --git a/RotationSolver/UI/RotationConfigWindow_Major.cs b/RotationSolver/UI/RotationConfigWindow_Major.cs index e9a7c3381..bba29cbb2 100644 --- a/RotationSolver/UI/RotationConfigWindow_Major.cs +++ b/RotationSolver/UI/RotationConfigWindow_Major.cs @@ -1,13 +1,17 @@ using Dalamud.Interface.Windowing; using Dalamud.Plugin; +using Dalamud.Utility; using FFXIVClientStructs.Interop; using ImGuiNET; +using ImGuiScene; using Lumina.Excel; using RotationSolver.Basic; using RotationSolver.Basic.Actions; using RotationSolver.Basic.Rotations; using RotationSolver.Basic.Rotations.Basic; using RotationSolver.Localization; +using System.IO; +using System.Net; using System.Numerics; using System.Reflection; using System.Runtime.Serialization; diff --git a/RotationSolver/UI/RotationConfigWindow_RotationDev.cs b/RotationSolver/UI/RotationConfigWindow_RotationDev.cs index 84d5dec69..8293e1f55 100644 --- a/RotationSolver/UI/RotationConfigWindow_RotationDev.cs +++ b/RotationSolver/UI/RotationConfigWindow_RotationDev.cs @@ -4,6 +4,7 @@ using RotationSolver.Basic; using RotationSolver.Localization; using RotationSolver.Updaters; +using System.Numerics; namespace RotationSolver.UI; internal partial class RotationConfigWindow @@ -28,33 +29,37 @@ private void DrawRotationDevTab() DrawCheckBox(LocalizationManager.RightLang.ConfigWindow_Param_InDebug, ref Service.Config.InDebug); - if (Service.Config.InDebug) + if (ImGui.BeginChild("Third-party Libs", new Vector2(0f, -1f), true)) { - ImGui.TextColored(ImGuiColors.DalamudRed, - LocalizationManager.RightLang.ConfigWindow_Param_InDebugWarning); - } - - int removeIndex = -1; - for (int i = 0; i < Service.Config.OtherLibs.Length; i++) - { - ImGui.InputText($"##OtherLib{i}", ref Service.Config.OtherLibs[i], 1024); + if (ImGui.Button("AddOne")) + { + Service.Config.OtherLibs = Service.Config.OtherLibs.Append(string.Empty).ToArray(); + } ImGui.SameLine(); - if (ImGui.Button($"X##Remove{i}")) + ImGui.Text("Third-party Rotation Libraries"); + + int removeIndex = -1; + for (int i = 0; i < Service.Config.OtherLibs.Length; i++) { - removeIndex = i; + if (ImGui.InputText($"##OtherLib{i}", ref Service.Config.OtherLibs[i], 1024)) + { + Service.Config.Save(); + } + ImGui.SameLine(); + if (ImGui.Button($"X##Remove{i}")) + { + removeIndex = i; + } + } + if (removeIndex > -1) + { + var list = Service.Config.OtherLibs.ToList(); + list.RemoveAt(removeIndex); + Service.Config.OtherLibs = list.ToArray(); } - } - if(removeIndex > -1) - { - var list = Service.Config.OtherLibs.ToList(); - list.RemoveAt(removeIndex); - Service.Config.OtherLibs = list.ToArray(); - } - string str = string.Empty; - if(ImGui.InputText($"##OtherLibExtra", ref str, 1024)) - { - Service.Config.OtherLibs = Service.Config.OtherLibs.Append(str).ToArray(); + ImGui.EndChild(); + } } } diff --git a/RotationSolver/Updaters/SocialUpdater.cs b/RotationSolver/Updaters/SocialUpdater.cs index 6df39d615..266f1ba70 100644 --- a/RotationSolver/Updaters/SocialUpdater.cs +++ b/RotationSolver/Updaters/SocialUpdater.cs @@ -26,6 +26,7 @@ internal class SocialUpdater static bool _canSaying = false; public static bool InHighEndDuty { get; private set; } = false; + public static TerritoryType[] HighEndDuties { get; private set; } = new TerritoryType[0]; static bool CanSocial { @@ -50,6 +51,10 @@ internal static void Enable() Service.DutyState.DutyStarted += DutyState_DutyStarted; Service.DutyState.DutyCompleted += DutyState_DutyCompleted; Service.ClientState.TerritoryChanged += ClientState_TerritoryChanged; + + HighEndDuties = Service.GetSheet() + .Where(t => t?.ContentFinderCondition?.Value?.HighEndDuty ?? false) + .ToArray(); } static async void DutyState_DutyCompleted(object sender, ushort e) @@ -71,13 +76,13 @@ static void ClientState_TerritoryChanged(object sender, ushort e) { _canSaying = true; } - InHighEndDuty = territory?.ContentFinderCondition?.Value?.HighEndDuty ?? false; + InHighEndDuty = HighEndDuties.Any(t => t.RowId == territory.RowId); } static void DutyState_DutyStarted(object sender, ushort e) { var territory = Service.GetSheet().GetRow(e); - if (territory?.ContentFinderCondition?.Value?.HighEndDuty ?? false) + if (HighEndDuties.Any(t => t.RowId == territory.RowId)) { var str = territory.PlaceName?.Value?.Name.ToString() ?? "High-end Duty"; Service.ToastGui.ShowError(string.Format(LocalizationManager.RightLang.HighEndWarning, str));