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

Commit

Permalink
fix: separated the ui config and the main plugin.
Browse files Browse the repository at this point in the history
Issues: #566
  • Loading branch information
ArchiDog1998 committed Apr 7, 2024
1 parent ec9f1f8 commit 4ba845a
Show file tree
Hide file tree
Showing 15 changed files with 81 additions and 25 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<TargetFramework>net8.0-windows</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Authors>ArchiTed</Authors>
<Version>4.2.6.1</Version>
<Version>4.2.6.2</Version>
<PlatformTarget>x64</PlatformTarget>
<Platforms>AnyCPU</Platforms>
<LangVersion>latest</LangVersion>
Expand Down
2 changes: 1 addition & 1 deletion Resources/RotationSolverRecord.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"ClickingCount": 124242,
"ClickingCount": 124280,
"SayingHelloCount": 196,
"SaidUsers": []
}
13 changes: 10 additions & 3 deletions RotationSolver.Basic/Configuration/Configs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
using ECommons.DalamudServices;
using ECommons.ExcelServices;
using RotationSolver.Basic.Configuration.Timeline;
using Svg.FilterEffects;
using System.IO;
using XIVConfigUI;
using static System.Collections.Specialized.BitVector32;

namespace RotationSolver.Basic.Configuration;

Expand Down Expand Up @@ -808,7 +807,15 @@ public void Save()

foreach ((var id, var timeline) in dict)
{
File.WriteAllText(@$"E:\OneDrive - stu.zafu.edu.cn\PartTime\FFXIV\RotationSolver\Resources\Timelines\{id}.json", JsonConvert.SerializeObject(timeline, Formatting.Indented));
var dirInfo = Svc.PluginInterface.AssemblyLocation.Directory;
dirInfo = dirInfo?.Parent!.Parent!.Parent!.Parent!;
var dir = dirInfo.FullName + @"\Resources\Timelines";
if (Directory.Exists(dir))
{
Svc.Log.Error("Failed to save the resources: " + dir);
continue;
}
File.WriteAllText(dir + @$"\{id}.json", JsonConvert.SerializeObject(timeline, Formatting.Indented));
}
#endif
File.WriteAllText(Svc.PluginInterface.ConfigFile.FullName,
Expand Down
10 changes: 8 additions & 2 deletions RotationSolver.Basic/Configuration/OtherConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,14 @@ private static string GetFilePath(string name)
{
var directory = Svc.PluginInterface.ConfigDirectory.FullName;
#if DEBUG
var dir = @"E:\OneDrive - stu.zafu.edu.cn\PartTime\FFXIV\RotationSolver\Resources"; //TODO: relative repo.
if (Directory.Exists(dir)) directory = dir;
var dirInfo = Svc.PluginInterface.AssemblyLocation.Directory;
dirInfo = dirInfo?.Parent!.Parent!.Parent!.Parent!;
var dir = dirInfo.FullName + @"\Resources";
if (Directory.Exists(dir))
{
Svc.Log.Error("Failed to save the resources: " + dir);
directory = dir;
}
#endif

return directory + $"\\{name}.json";
Expand Down
15 changes: 9 additions & 6 deletions RotationSolver.Basic/RotationSolver.Basic.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,19 @@
<Using Include="Dalamud.Interface" />
<Using Include="ImGuiNET" />
<Using Include="Newtonsoft.Json" />

<ProjectReference Include="..\ECommons\ECommons\ECommons.csproj">
<ProjectReference Include="..\ECommons\ECommons\ECommons.csproj" >
<PrivateAssets>all</PrivateAssets>
</ProjectReference>

<ProjectReference Include="..\RotationSolver.SourceGenerators\RotationSolver.SourceGenerators.csproj" OutputItemType="Analyzer" ExcludeAssets="All" ReferenceOutputAssembly="false" />

<ProjectReference Include="..\XIVConfigUI\XIVConfigUI\XIVConfigUI.csproj" />
<ProjectReference Include="..\XIVConfigUI\XIVConfigUI\XIVConfigUI.csproj"/>

<ProjectReference Include="..\XIVPainter\XIVPainter\XIVPainter.csproj" />
<ProjectReference Include="..\XIVPainter\XIVPainter\XIVPainter.csproj">
<PrivateAssets>all</PrivateAssets>
</ProjectReference>

<PackageReference Include="Svg" Version="3.4.7" />

<None Include="..\COPYING.LESSER">
<Pack>True</Pack>
Expand All @@ -81,7 +84,7 @@
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
<PackageReference Include="Svg" Version="3.4.4" />

<None Update="README.md">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
Expand Down
1 change: 1 addition & 0 deletions RotationSolver/Helpers/RotationLoadContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ static RotationLoadContext()
typeof(DataCenter).Assembly,
typeof(SheetAttribute).Assembly,
typeof(QuestDialogueText).Assembly,
typeof(XIVConfigUI.XIVConfigUIMain).Assembly,
};

foreach (var assembly in assemblies)
Expand Down
4 changes: 2 additions & 2 deletions RotationSolver/Helpers/WarningHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using Dalamud.Game.Text.SeStringHandling.Payloads;
using ECommons.DalamudServices;

namespace RotationSolver.Basic.Helpers;
namespace RotationSolver.Helpers;

public static class WarningHelper
{
Expand All @@ -17,7 +17,7 @@ public static class WarningHelper
RawPayload.LinkTerminator,
new TextPayload(": "));

public static SeString Close_String => new (new IconPayload(BitmapFontIcon.DoNotDisturb), RotationSolverPlugin.HideWarningLinkPayload!,
public static SeString Close_String => new(new IconPayload(BitmapFontIcon.DoNotDisturb), RotationSolverPlugin.HideWarningLinkPayload!,
new UIForegroundPayload(2),
new TextPayload("(Hide Warning)"),
UIForegroundPayload.UIForegroundOff,
Expand Down
37 changes: 36 additions & 1 deletion RotationSolver/Localization/Localization.json
Original file line number Diff line number Diff line change
Expand Up @@ -377,5 +377,40 @@
"NoNewHostilesName": "Don't attack new mobs by AoE.",
"UseAoeWhenManualName": "Use AoE actions in manual mode.",
"NoNewHostilesDescription": "Avoids usage of AoE abilities when new enemies would be aggroed.",
"ActionAheadDescription": "This plugin helps you to use the right action during the combat. Here is a guide about the different options."
"ActionAheadDescription": "This plugin helps you to use the right action during the combat. Here is a guide about the different options.",
"RotationSolver.Basic.Configuration.ConfigsName.System.Numerics.Vector2 RaiseDelay": "Random delay for considering a ressurection type action.",
"RotationSolver.Basic.Configuration.ConfigsName.Int32 LessMPNoRaise": "Never ressurect players if MP is less than the set value",
"RotationSolver.Basic.Configuration.ConfigsName.RotationSolver.Basic.Configuration.ConditionBoolean AutoHeal": "Automatic Healing.",
"RotationSolver.Basic.Configuration.ConfigsName.Single MeleeRangeOffset": "Maximum melee range action usage before using offset setting",
"RotationSolver.Basic.Configuration.ConfigsName.System.Numerics.Vector2 InterruptDelay": "Random delay for interrupting hostile targets.",
"RotationSolver.Basic.Configuration.ConfigsName.Single HealthForGuard": "The HP for using Guard.",
"RotationSolver.Basic.Configuration.ConfigsName.Single HealthTankRatio": "Prioritize tank healing if its HP is lower than the selected percentage.",
"RotationSolver.Basic.Configuration.ConfigsName.Single HealthHealerRatio": "Prioritize healer healing if its HP is lower than the selected percentage",
"RotationSolver.Basic.Configuration.ConfigsName.RotationSolver.Basic.Configuration.ConditionBoolean RaisePlayerByCasting": "Raise player while swiftcast is on cooldown",
"RotationSolver.Basic.Configuration.ConfigsName.RotationSolver.Basic.Configuration.ConditionBoolean RaiseAll": "Raise any player in range (even if they are not in your party)",
"RotationSolver.Basic.Configuration.ConfigsName.RotationSolver.Basic.Configuration.ConditionBoolean RaiseBrinkOfDeath": "Raise players that have the Brink of Death debuff",
"RotationSolver.Basic.Configuration.ConfigsName.RotationSolver.Basic.Configuration.ConditionBoolean UseTinctures": "Use Tinctures.",
"RotationSolver.Basic.Configuration.ConfigsName.RotationSolver.Basic.Configuration.ConditionBoolean UseHpPotions": "Use HP Potions.",
"RotationSolver.Basic.Configuration.ConfigsName.RotationSolver.Basic.Configuration.ConditionBoolean UseMpPotions": "Use MP Potions.",
"RotationSolver.Basic.Configuration.ConfigsName.RotationSolver.Basic.Configuration.ConditionBoolean UseAoeAction": "Use AoE actions.",
"RotationSolver.Basic.Configuration.ConfigsName.RotationSolver.Basic.Configuration.ConditionBoolean UseAbility": "Automatic offensive ability use.",
"RotationSolver.Basic.Configuration.ConfigsName.RotationSolver.Basic.Configuration.ConditionBoolean UseDefenseAbility": "Automatically use defensive abilities.",
"RotationSolver.Basic.Configuration.ConfigsName.RotationSolver.Basic.Configuration.ConditionBoolean AutoTankStance": "Automatically activate tank stance.",
"RotationSolver.Basic.Configuration.ConfigsName.RotationSolver.Basic.Configuration.ConditionBoolean AutoProvokeForTank": "Auto provoke non-tank attacking targets.",
"RotationSolver.Basic.Configuration.ConfigsName.RotationSolver.Basic.Configuration.ConditionBoolean AutoUseTrueNorth": "Auto TrueNorth (Melee).",
"RotationSolver.Basic.Configuration.ConfigsName.RotationSolver.Basic.Configuration.ConditionBoolean RaisePlayerBySwift": "Raise player by using swiftcast if available",
"RotationSolver.Basic.Configuration.ConfigsName.RotationSolver.Basic.Configuration.ConditionBoolean AutoSpeedOutOfCombat": "Use movement speed increase abilities when out of combat.",
"RotationSolver.Basic.Configuration.ConfigsName.RotationSolver.Basic.Configuration.ConditionBoolean UseGroundBeneficialAbility": "Use beneficial ground-targeted actions.",
"RotationSolver.Basic.Configuration.ConfigsName.RotationSolver.Basic.Configuration.ConditionBoolean UseKnockback": "Use Anti-Knockback abilities",
"RotationSolver.Basic.Configuration.ConfigsDescription.RotationSolver.Basic.Configuration.ConditionBoolean UseDefenseAbility": "It is recommended to uncheck this option if you are playing high end content or if you can plan healing and defensive ability usage by yourself.",
"RotationSolver.Basic.Configuration.ConfigsName.System.Numerics.Vector2 DefenseSingleDelay": "The random delay between for the auto defense single.",
"RotationSolver.Basic.Configuration.ConfigsName.System.Numerics.Vector2 DefenseAreaDelay": "The random delay between for the auto defense area.",
"RotationSolver.Basic.Configuration.ConfigsName.Int32 AutoDefenseNumber": "Number of hostiles",
"RotationSolver.Basic.Configuration.ConfigsName.RotationSolver.Basic.Configuration.ConditionBoolean UseGroundBeneficialAbilityWhenMoving": "Use beneficial AoE actions while moving.",
"RotationSolver.Basic.Data.BeneficialAreaStrategy.OnLocations": "On predefined location",
"RotationSolver.Basic.Data.BeneficialAreaStrategy.OnlyOnLocations": "Only on predefined location",
"RotationSolver.Basic.Data.BeneficialAreaStrategy.OnTarget": "On target",
"RotationSolver.Basic.Data.BeneficialAreaStrategy.OnCalculated": "On the calculated location",
"RotationSolver.Basic.Configuration.ConfigsName.RotationSolver.Basic.Data.BeneficialAreaStrategy BeneficialAreaStrategy": "Beneficial AoE strategy",
"RotationSolver.Basic.Configuration.ConfigsName.System.Numerics.Vector2 AntiKnockbackDelay": "The random delay between for the auto anti-knockback."
}
2 changes: 2 additions & 0 deletions RotationSolver/RotationSolverPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ public RotationSolverPlugin(DalamudPluginInterface pluginInterface)

PainterManager.Init();
XIVConfigUIMain.Init(pluginInterface, Service.USERNAME, Service.REPO, Service.COMMAND + " " + OtherCommandType.Settings.ToString(), new SearchableConfigRS());
XIVConfigUIMain.GetTextureID = IconSet.GetTexture;
XIVConfigUIMain.GetTexturePath = IconSet.GetTexture;
MajorUpdater.Enable();
Watcher.Enable();
OtherConfiguration.Init();
Expand Down
7 changes: 5 additions & 2 deletions RotationSolver/UI/RotationConfigWindow_Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
using RotationSolver.Basic.Configuration.Conditions;
using RotationSolver.Data;
using RotationSolver.Helpers;
using XIVPainter;
using RotationSolver.UI.SearchableConfigs;
using XIVConfigUI;
using XIVConfigUI.SearchableConfigs;
using RotationSolver.UI.SearchableConfigs;
using XIVPainter;

namespace RotationSolver.UI;

Expand All @@ -22,6 +22,9 @@ public partial class RotationConfigWindow
internal static SearchableCollection _allSearchable = new(Service.Config, new()
{
{nameof(Configs.AutoHeal), p => new AutoHealCheckBox(p, Service.Config) }
}, new()
{
{typeof(ConditionBoolean), p => new CheckBoxSearchCondition(p, Service.Config) }
});

private void SearchingBox()
Expand Down
1 change: 0 additions & 1 deletion RotationSolver/UI/SearchableConfigs/AutoHealCheckBox.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using RotationSolver.Basic.Configuration;
using RotationSolver.Data;
using RotationSolver.Localization;
using RotationSolver.UI.SearchableSettings;
using System.Linq;
using XIVConfigUI;
using XIVConfigUI.SearchableConfigs;
Expand Down
8 changes: 4 additions & 4 deletions RotationSolver/UI/SearchableConfigs/CheckBoxSearch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
using XIVConfigUI;
using XIVConfigUI.SearchableConfigs;

namespace RotationSolver.UI.SearchableSettings;
namespace RotationSolver.UI.SearchableConfigs;

internal class CheckBoxSearchCondition(PropertyInfo property, object obj, params Searchable[] children)
internal class CheckBoxSearchCondition(PropertyInfo property, object obj, params Searchable[] children)
: CheckBoxSearch(property, obj,
[
new CheckBoxEnable(property, obj),
Expand Down Expand Up @@ -51,7 +51,7 @@ private class CheckBoxDisable(PropertyInfo property, object obj) : CheckBoxCondi
{
public override string Name => UiString.ForcedDisableCondition.Local();

public override string Description => UiString.ForcedDisableConditionDesc.Local();
public override string Description => UiString.ForcedDisableConditionDesc.Local();

protected override bool Value
{
Expand All @@ -72,7 +72,7 @@ private class CheckBoxEnable(PropertyInfo property, object obj) : CheckBoxCondit

public override string Description => UiString.ForcedEnableConditionDesc.Local();

protected override bool Value
protected override bool Value
{
get => _condition.Enable;
set => _condition.Enable = value;
Expand Down
1 change: 1 addition & 0 deletions RotationSolver/Updaters/MajorUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using FFXIVClientStructs.FFXIV.Component.GUI;
using RotationSolver.Commands;
using RotationSolver.Data;
using RotationSolver.Helpers;
using RotationSolver.Localization;
using RotationSolver.UI;
using System.Runtime.InteropServices;
Expand Down
1 change: 0 additions & 1 deletion RotationSolver/Updaters/RotationUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using RotationSolver.Basic.Rotations.Duties;
using RotationSolver.Data;
using RotationSolver.Helpers;
using RotationSolver.Localization;
using XIVConfigUI;

namespace RotationSolver.Updaters;
Expand Down
2 changes: 1 addition & 1 deletion XIVConfigUI

0 comments on commit 4ba845a

Please sign in to comment.