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

Commit

Permalink
feat: add an option for only attacking the targets in enemy list.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Nov 9, 2023
1 parent d510f2d commit 8903546
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions RotationSolver.Basic/Configuration/Configs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ public enum PluginConfigBool : byte
[Default(true)] RaisePlayerByCasting,
[Default(true)] RaiseBrinkOfDeath,
[Default(true)] AddEnemyListToHostile,
[Default(false)] OnlyAttackInEnemyList,
[Default(false)] UseTinctures,
[Default(false)] UseHealPotions,

Expand Down
1 change: 1 addition & 0 deletions RotationSolver/Localization/ConfigTranslation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ internal static class ConfigTranslation

// target
PluginConfigBool.AddEnemyListToHostile => LocalizationManager.RightLang.ConfigWindow_Param_AddEnemyListToHostile,
PluginConfigBool.OnlyAttackInEnemyList => LocalizationManager.RightLang.ConfigWindow_Param_OnlyAttackInEnemyList,
PluginConfigBool.ChooseAttackMark => LocalizationManager.RightLang.ConfigWindow_Param_ChooseAttackMark,
PluginConfigBool.CanAttackMarkAOE => LocalizationManager.RightLang.ConfigWindow_Param_CanAttackMarkAOE,
PluginConfigBool.FilterStopMark => LocalizationManager.RightLang.ConfigWindow_Param_FilterStopMark,
Expand Down
3 changes: 2 additions & 1 deletion RotationSolver/Localization/Strings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,8 @@ internal class Strings
public string ConfigWindow_Param_TargetToHostileType1 { get; set; } = "All targets that are in range for any abilities";
public string ConfigWindow_Param_TargetToHostileType2 { get; set; } = "Previously engaged targets or all targets that are in range\n(engages on countdown timer and resets when out of combat)";
public string ConfigWindow_Param_TargetToHostileType3 { get; set; } = "Previously engaged targets (engages on countdown timer)";
public string ConfigWindow_Param_AddEnemyListToHostile { get; set; } = "Add enemies list to the hostile targets.";
public string ConfigWindow_Param_AddEnemyListToHostile { get; set; } = "Add enemy list to the hostile targets.";
public string ConfigWindow_Param_OnlyAttackInEnemyList { get; set; } = "Only attack the targets in enemy list.";
public string ConfigWindow_Param_ChooseAttackMark { get; set; } = "Priority attack targets with attack markers";
public string ConfigWindow_Param_CanAttackMarkAOE { get; set; } = "Allowed use of AoE to attack more mobs.";
public string ConfigWindow_Param_AttackMarkAOEDesc { get; set; } = "Attention: Checking this option , AA will attack as many hostile targets as possible, while ignoring whether the attack will reach the marked target.";
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver/UI/RotationConfigWindow_Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,7 @@ private static void DrawTargetConfig()
PvPFilter = JobFilter.NoJob,
},

new CheckBoxSearchPlugin(PluginConfigBool.AddEnemyListToHostile),
new CheckBoxSearchPlugin(PluginConfigBool.AddEnemyListToHostile, new CheckBoxSearchPlugin(PluginConfigBool.OnlyAttackInEnemyList)),
new CheckBoxSearchPlugin(PluginConfigBool.FilterStopMark),
new CheckBoxSearchPlugin(PluginConfigBool.ChooseAttackMark, new ISearchable[]
{
Expand Down
10 changes: 7 additions & 3 deletions RotationSolver/Updaters/TargetUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,13 @@ private static IEnumerable<BattleChara> GetHostileTargets(IEnumerable<BattleChar
uint[] ids = GetEnemies();
var hostiles = allAttackableTargets.Where(t =>
{
if (ids.Contains(t.ObjectId)) return true;
if (Service.Config.GetValue(PluginConfigBool.AddEnemyListToHostile))
{
if (ids.Contains(t.ObjectId)) return true;
//Only attack
if (Service.Config.GetValue(PluginConfigBool.OnlyAttackInEnemyList)) return false;
}

if (t.TargetObject == Player.Object
|| t.TargetObject?.OwnerId == Player.Object.ObjectId) return true;

Expand All @@ -213,8 +219,6 @@ private static IEnumerable<BattleChara> GetHostileTargets(IEnumerable<BattleChar

private static unsafe uint[] GetEnemies()
{
if (!Service.Config.GetValue(PluginConfigBool.AddEnemyListToHostile)) return Array.Empty<uint>();

var addons = Service.GetAddons<AddonEnemyList>();

if (!addons.Any()) return Array.Empty<uint>();
Expand Down

0 comments on commit 8903546

Please sign in to comment.