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 NoHostiles feature.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Apr 29, 2023
1 parent d6668ab commit 85950e7
Show file tree
Hide file tree
Showing 8 changed files with 151 additions and 123 deletions.
1 change: 1 addition & 0 deletions RotationSolver.Basic/Configuration/PluginConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ public class PluginConfiguration : IPluginConfiguration
public bool InDebug = false;
public bool AutoUpdateLibs = true;
public string[] OtherLibs = new string[0];
public string[] NoHostileNames = new string[0];

public List<TargetingType> TargetingTypes { get; set; } = new List<TargetingType>();
public int TargetingIndex { get; set; } = 0;
Expand Down
7 changes: 4 additions & 3 deletions RotationSolver/Localization/Localization.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"ConfigWindow_ActionItem": "Action",
"ConfigWindow_ControlItem": "Control",
"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.",
Expand All @@ -38,7 +37,6 @@
"ConfigWindow_Helper_CopyCommand": "Right-click to copy command",
"ConfigWindow_Helper_InsertCommand": "Insert \"{0}\" first in {1}s",
"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.",
Expand Down Expand Up @@ -173,7 +171,7 @@
"ConfigWindow_Param_MoveAreaActionFarthest": "Moving Area Ability to farthest",
"ConfigWindow_Param_MoveAreaActionFarthestDesc": "Move to the furthest position from character's face direction.",
"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_AddOne": "Add One",
"ConfigWindow_Param_HostileCondition": "Hostile target selection condition",
"ConfigWindow_Param_ConditionUp": "Up",
"ConfigWindow_Param_ConditionDown": "Down",
Expand Down Expand Up @@ -214,6 +212,9 @@
"ConfigWindow_List_InvincibilityDesc": "If target get one of this status, it'll never attack it.",
"ConfigWindow_List_DangerousStatus": "Dangerous Status",
"ConfigWindow_List_DangerousStatusDesc": "If one of your party member get this status, Esuna immediately.",
"ConfigWindow_List_Rotations": "Rotations",
"ConfigWindow_List_NoHostile": "No Hostile",
"ConfigWindow_List_NoHostileDesc": "Add a name of target that never be the hostile for you.",
"ActionSequencer_DragdropDescription": "Drag&drop to move,Ctrl+Alt+RightClick to delete.",
"ActionSequencer_SearchBar": "Search Bar",
"ActionSequencer_MustUse": "MustUse",
Expand Down
9 changes: 4 additions & 5 deletions RotationSolver/Localization/Strings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ internal partial class Strings
public string ConfigWindow_ActionItem { get; set; } = "Action";
public string ConfigWindow_ControlItem { get; set; } = "Control";
public string ConfigWindow_HelpItem { get; set; } = "Help";
public string ConfigWindow_RotationDev { get; set; } = "RotationDev";

public string ConfigWindow_ActionItem_Description { get; set; }
= "Modify the usage for each action.";

Expand Down Expand Up @@ -82,8 +80,6 @@ internal partial class Strings
public string ConfigWindow_Helper_InsertCommand { get; set; } = "Insert \"{0}\" first in {1}s";
public string ConfigWindow_Rotation_Description { get; set; } = "You can enable the function for each job you want and configure the setting about how to use actions.";

public string ConfigWindow_RotationDev_Description { get; set; } = "You can get some extra rotation development information here.";

public string ConfigWindow_Rotation_KeyName { get; set; } = "The key name is";
public string ConfigWindow_Events_AddEvent { get; set; } = "AddEvents";
public string ConfigWindow_Events_Description { get; set; } = "In this window, you can set what macro will be trigger after using an action.";
Expand Down Expand Up @@ -242,7 +238,7 @@ internal partial class Strings
public string ConfigWindow_Param_MoveAreaActionFarthestDesc { get; set; } = "Move to the furthest position from character's face direction.";

public string ConfigWindow_Param_HostileDesc { get; set; } = "You can set the logic of hostile target selection to allow flexibility in switching the logic of selecting hostile in battle.";
public string ConfigWindow_Param_AddHostileCondition { get; set; } = "Add selection condition";
public string ConfigWindow_Param_AddOne { get; set; } = "Add One";
public string ConfigWindow_Param_HostileCondition { get; set; } = "Hostile target selection condition";
public string ConfigWindow_Param_ConditionUp { get; set; } = "Up";
public string ConfigWindow_Param_ConditionDown { get; set; } = "Down";
Expand Down Expand Up @@ -291,6 +287,9 @@ internal partial class Strings
public string ConfigWindow_List_InvincibilityDesc { get; set; } = "If target get one of this status, it'll never attack it.";
public string ConfigWindow_List_DangerousStatus { get; set; } = "Dangerous Status";
public string ConfigWindow_List_DangerousStatusDesc { get; set; } = "If one of your party member get this status, Esuna immediately.";
public string ConfigWindow_List_Rotations { get; set; } = "Rotations";
public string ConfigWindow_List_NoHostile { get; set; } = "No Hostile";
public string ConfigWindow_List_NoHostileDesc { get; set; } = "Add a name of target that never be the hostile for you.";

#endregion

Expand Down
176 changes: 135 additions & 41 deletions RotationSolver/UI/RotationConfigWindow_List.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
using Lumina.Excel.GeneratedSheets;
using Dalamud.Utility;
using Lumina.Excel.GeneratedSheets;
using RotationSolver.ActionSequencer;
using RotationSolver.Basic.Data;
using RotationSolver.Localization;
using RotationSolver.Updaters;
using System;
using System.Collections.Generic;
using System.Linq;
Expand Down Expand Up @@ -53,57 +55,96 @@ private void DrawListTab()

if (ImGui.BeginTabBar("List Items"))
{
try
DrawParamTabItem(LocalizationManager.RightLang.ConfigWindow_List_Hostile, DrawParamHostile, () =>
{
DrawParamTabItem(LocalizationManager.RightLang.ConfigWindow_List_Hostile, DrawParamHostile, () =>
if (ImGui.Button(LocalizationManager.RightLang.ConfigWindow_Param_AddOne))
{
if (ImGui.Button(LocalizationManager.RightLang.ConfigWindow_Param_AddHostileCondition))
{
Service.Config.TargetingTypes.Add(TargetingType.Big);
}
ImGui.SameLine();
ImGuiHelper.Spacing();
ImGui.TextWrapped(LocalizationManager.RightLang.ConfigWindow_Param_HostileDesc);
});
Service.Config.TargetingTypes.Add(TargetingType.Big);
}
ImGui.SameLine();
ImGuiHelper.Spacing();
ImGui.TextWrapped(LocalizationManager.RightLang.ConfigWindow_Param_HostileDesc);
});

DrawParamTabItem(LocalizationManager.RightLang.ConfigWindow_List_Invincibility, DrawInvincibility, () =>
DrawParamTabItem(LocalizationManager.RightLang.ConfigWindow_List_NoHostile, DrawParamNoHostile, () =>
{
if (ImGui.Button(LocalizationManager.RightLang.ConfigWindow_Param_AddOne))
{
ImGui.SetNextItemWidth(200);
ImGuiHelper.SearchCombo("##AddInvincibleStatus",
"Add One",
ref searchText, AllInvStatus, s =>
{
StatusHelper.InvincibleStatus.Add((uint)s.ID);
StatusHelper.SaveInvincibleStatus();
Service.Config.NoHostileNames = Service.Config.NoHostileNames.Append(string.Empty).ToArray();
}
ImGui.SameLine();
ImGuiHelper.Spacing();
ImGui.TextWrapped(LocalizationManager.RightLang.ConfigWindow_List_NoHostileDesc);
});

});
DrawParamTabItem(LocalizationManager.RightLang.ConfigWindow_List_Invincibility, DrawInvincibility, () =>
{
ImGui.SetNextItemWidth(200);
ImGuiHelper.SearchCombo("##AddInvincibleStatus",
LocalizationManager.RightLang.ConfigWindow_Param_AddOne,
ref searchText, AllInvStatus, s =>
{
StatusHelper.InvincibleStatus.Add((uint)s.ID);
StatusHelper.SaveInvincibleStatus();

ImGui.SameLine();
ImGuiHelper.Spacing();
});

ImGui.SameLine();
ImGuiHelper.Spacing();

ImGui.TextWrapped(LocalizationManager.RightLang.ConfigWindow_List_InvincibilityDesc);
});

DrawParamTabItem(LocalizationManager.RightLang.ConfigWindow_List_DangerousStatus, DrawDangerousStatus, () =>
{
ImGui.SetNextItemWidth(200);
ImGuiHelper.SearchCombo("##AddDangerousStatus",
LocalizationManager.RightLang.ConfigWindow_Param_AddOne,
ref searchText, AllDispelStatus, s =>
{
StatusHelper.DangerousStatus.Add((uint)s.ID);
StatusHelper.SaveDangerousStatus();
});

ImGui.SameLine();
ImGuiHelper.Spacing();

ImGui.TextWrapped(LocalizationManager.RightLang.ConfigWindow_List_DangerousStatusDesc);
});

ImGui.TextWrapped(LocalizationManager.RightLang.ConfigWindow_List_InvincibilityDesc);
});

DrawParamTabItem(LocalizationManager.RightLang.ConfigWindow_List_DangerousStatus, DrawDangerousStatus, () =>
DrawParamTabItem(LocalizationManager.RightLang.ConfigWindow_List_Rotations, DrawRotationDevTab, () =>
{
if (ImGui.Button(LocalizationManager.RightLang.ConfigWindow_Rotation_DownloadRotationsButton))
{
ImGui.SetNextItemWidth(200);
ImGuiHelper.SearchCombo("##AddDangerousStatus",
"Add One",
ref searchText, AllDispelStatus, s =>
{
StatusHelper.DangerousStatus.Add((uint)s.ID);
StatusHelper.SaveDangerousStatus();
});
RotationUpdater.GetAllCustomRotations(RotationUpdater.DownloadOption.MustDownload | RotationUpdater.DownloadOption.ShowList);
}

ImGui.SameLine();
ImGuiHelper.Spacing();
ImGui.SameLine();
ImGuiHelper.Spacing();

ImGui.TextWrapped(LocalizationManager.RightLang.ConfigWindow_List_DangerousStatusDesc);
if (ImGui.Button("Load Rotations Local"))
{
RotationUpdater.GetAllCustomRotations(RotationUpdater.DownloadOption.ShowList);
}

});
}
catch { }
ImGui.SameLine();
ImGuiHelper.Spacing();

if (ImGui.Button("Dev Wiki"))
{
Util.OpenLink("https://archidog1998.github.io/RotationSolver/#/RotationDev/");
}

if (ImGui.Button(LocalizationManager.RightLang.ConfigWindow_Param_AddOne))
{
Service.Config.OtherLibs = Service.Config.OtherLibs.Append(string.Empty).ToArray();
}
ImGui.SameLine();
ImGuiHelper.Spacing();

ImGui.TextWrapped("Third-party Rotation Libraries");
});

ImGui.EndTabBar();
}
Expand Down Expand Up @@ -185,7 +226,7 @@ private void DrawDangerousStatus()
ImGuiHelper.Spacing();


if (ImGuiHelper.IconButton(FontAwesomeIcon.SquareXmark, $"RemoveDangerous{statusId}"))
if (ImGui.Button($"X##RemoveDangerous{statusId}"))
{
removeId = statusId;
}
Expand Down Expand Up @@ -228,7 +269,7 @@ private void DrawInvincibility()
ImGui.SameLine();
ImGuiHelper.Spacing();

if (ImGuiHelper.IconButton(FontAwesomeIcon.SquareXmark, $"InvincibleStatus{statusId}"))
if (ImGui.Button($"X##InvincibleStatus{statusId}"))
{
removeId = statusId;
}
Expand All @@ -245,4 +286,57 @@ private void DrawInvincibility()
StatusHelper.SaveInvincibleStatus();
}
}

private void DrawRotationDevTab()
{
int removeIndex = -1;
for (int i = 0; i < Service.Config.OtherLibs.Length; i++)
{
if (ImGui.InputText($"##OtherLib{i}", ref Service.Config.OtherLibs[i], 1024))
{
Service.Config.Save();
}
ImGui.SameLine();
ImGuiHelper.Spacing();

if (ImGui.Button($"X##RemoveOtherLibs{i}"))
{
removeIndex = i;
}
}
if (removeIndex > -1)
{
var list = Service.Config.OtherLibs.ToList();
list.RemoveAt(removeIndex);
Service.Config.OtherLibs = list.ToArray();
Service.Config.Save();
}
}

private void DrawParamNoHostile()
{
int removeIndex = -1;
for (int i = 0; i < Service.Config.NoHostileNames.Length; i++)
{
if (ImGui.InputText($"##NoHostileNames{i}", ref Service.Config.NoHostileNames[i], 1024))
{
Service.Config.Save();
}
ImGui.SameLine();
ImGuiHelper.Spacing();

if (ImGui.Button($"X##RemoveNoHostileNames{i}"))
{
removeIndex = i;
}
}
if (removeIndex > -1)
{
var list = Service.Config.NoHostileNames.ToList();
list.RemoveAt(removeIndex);
Service.Config.NoHostileNames = list.ToArray();
Service.Config.Save();
}
}

}
6 changes: 0 additions & 6 deletions RotationSolver/UI/RotationConfigWindow_Major.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,6 @@ public override unsafe void Draw()
ImGui.EndTabItem();
}

if (ImGui.BeginTabItem(LocalizationManager.RightLang.ConfigWindow_RotationDev))
{
DrawRotationDevTab();
ImGui.EndTabItem();
}

if (Service.Config.InDebug && ImGui.BeginTabItem("Debug"))
{
DrawDebugTab();
Expand Down
5 changes: 5 additions & 0 deletions RotationSolver/UI/RotationConfigWindow_Param.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,11 @@ private void DrawParamAdvanced()

DrawCheckBox(LocalizationManager.RightLang.ConfigWindow_Param_ShowActionFlag,
ref Service.Config.ShowActionFlag, Service.Default.ShowActionFlag);

ImGui.Separator();

DrawCheckBox(LocalizationManager.RightLang.ConfigWindow_Param_InDebug,
ref Service.Config.InDebug, Service.Default.InDebug);
}

private void DrawParamDisplay()
Expand Down
68 changes: 0 additions & 68 deletions RotationSolver/UI/RotationConfigWindow_RotationDev.cs

This file was deleted.

Loading

0 comments on commit 85950e7

Please sign in to comment.