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

Commit

Permalink
fix: add link about incompatible plugins.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Jul 31, 2023
1 parent 4396020 commit 7422723
Show file tree
Hide file tree
Showing 8 changed files with 113 additions and 66 deletions.
44 changes: 44 additions & 0 deletions Resources/IncompatiblePlugins.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
[
{
"Name": "XIV Combo",
"Icon": "https://raw.githubusercontent.com/daemitus/XIVComboPlugin/master/res/icon.png",
"Url": "https://github.com/daemitus/XIVComboPlugin",
"Features": "",
"Type": 2
},
{
"Name": "XIV Sloth Combo",
"Icon": "https://raw.githubusercontent.com/Nik-Potokar/XIVSlothCombo/main/res/plugin/xivslothcombo.png",
"Url": "https://github.com/Nik-Potokar/XIVSlothCombo",
"Features": "",
"Type": 3
},
{
"Name": "BossMod",
"Icon": "https://raw.githubusercontent.com/awgil/ffxiv_bossmod/master/Data/icon.png",
"Url": "https://github.com/awgil/ffxiv_bossmod",
"Features": "Auto Rotation",
"Type": 3
},
{
"Name": "Redirect",
"Icon": "https://raw.githubusercontent.com/cairthenn/Redirect/main/Redirect/icon.png",
"Url": "https://github.com/cairthenn/Redirect",
"Features": "",
"Type": 1
},
{
"Name": "ReAction",
"Icon": "",
"Url": "https://github.com/UnknownX7/ReAction",
"Features": "",
"Type": 1
},
{
"Name": "Simple Tweaks",
"Icon": "https://raw.githubusercontent.com/Caraxi/SimpleTweaksPlugin/main/images/icon.png",
"Url": "https://github.com/Caraxi/SimpleTweaksPlugin/blob/main/Tweaks/TreasureHuntTargets.cs",
"Features": "Block Targeting Treasure Hunt Enemies",
"Type": 4
}
]
26 changes: 2 additions & 24 deletions RotationSolver.Basic/Configuration/OtherConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,8 @@ public class InputConfiguration
public Dictionary<StateCommandType, KeyRecord> KeyState { get; set; } = new Dictionary<StateCommandType, KeyRecord>();
public Dictionary<SpecialCommandType, KeyRecord> KeySpecial { get; set; } = new Dictionary<SpecialCommandType, KeyRecord>();
public KeyRecord KeyDoAction { get; set; } = null;
public Dictionary<StateCommandType, ButtonRecord> ButtonState { get; set; } = new Dictionary<StateCommandType, ButtonRecord>()
{
{StateCommandType.Auto, new ButtonRecord( GamepadButtons.East, false, true) },
{StateCommandType.Manual, new ButtonRecord( GamepadButtons.North, false, true) },
{StateCommandType.Cancel, new ButtonRecord( GamepadButtons.South, false, true) },
};
public Dictionary<SpecialCommandType, ButtonRecord> ButtonSpecial { get; set; } = new Dictionary<SpecialCommandType, ButtonRecord>()
{
{SpecialCommandType.EndSpecial, new ButtonRecord( GamepadButtons.West, false, true) },

{SpecialCommandType.EsunaStanceNorth, new ButtonRecord( GamepadButtons.DpadRight, false, true) },
{SpecialCommandType.MoveForward, new ButtonRecord( GamepadButtons.DpadUp, false, true) },
{SpecialCommandType.MoveBack, new ButtonRecord( GamepadButtons.DpadDown, false, true) },
{SpecialCommandType.RaiseShirk, new ButtonRecord( GamepadButtons.DpadLeft, false, true) },

{SpecialCommandType.DefenseArea, new ButtonRecord( GamepadButtons.North, true, false) },
{SpecialCommandType.DefenseSingle, new ButtonRecord( GamepadButtons.East, true, false) },
{SpecialCommandType.HealArea, new ButtonRecord( GamepadButtons.South, true, false) },
{SpecialCommandType.HealSingle, new ButtonRecord( GamepadButtons.West, true, false) },

{SpecialCommandType.Burst, new ButtonRecord( GamepadButtons.DpadDown, true, false) },
{SpecialCommandType.AntiKnockback, new ButtonRecord( GamepadButtons.DpadUp, true, false) },
};
public Dictionary<StateCommandType, ButtonRecord> ButtonState { get; set; } = new Dictionary<StateCommandType, ButtonRecord>();
public Dictionary<SpecialCommandType, ButtonRecord> ButtonSpecial { get; set; } = new Dictionary<SpecialCommandType, ButtonRecord>();

public ButtonRecord ButtonDoAction { get; set; } = null;
}
Expand All @@ -53,7 +32,6 @@ public class OtherConfiguration

public static void Init()
{

if (!Directory.Exists(Svc.PluginInterface.ConfigDirectory.FullName))
{
Directory.CreateDirectory(Svc.PluginInterface.ConfigDirectory.FullName);
Expand Down
3 changes: 1 addition & 2 deletions RotationSolver.Basic/Rotations/Basic/BLU_Base.cs
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,7 @@ public bool RightType
internal BLUAction(ActionID actionID, ActionOption option = ActionOption.None)
: base(actionID, option)
{
var attackType = _action.AttackType.Value?.RowId ?? 0;
Type = attackType != 5 ? BLUActionType.Physical : Aspect == Aspect.None ? BLUActionType.None : BLUActionType.Magical;
Type = AttackType != AttackType.Magic ? BLUActionType.Physical : Aspect == Aspect.None ? BLUActionType.None : BLUActionType.Magical;
ActionCheck = (t, m) => OnSlot && RightType;
}

Expand Down
32 changes: 32 additions & 0 deletions RotationSolver/Helpers/DownloadHelper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using Dalamud.Logging;
using RotationSolver.UI;
using System.Text;

namespace RotationSolver.Helpers;

public static class DownloadHelper
{
public static string[] LinkLibraries { get; private set; }
public static IncompatiblePlugin[] IncompatiblePlugins { get; private set; }

public static async Task DownloadAsync()
{
LinkLibraries = await DownloadOneAsync<string[]>("https://raw.githubusercontent.com/ArchiDog1998/RotationSolver/main/Resources/downloadList.json");
IncompatiblePlugins = await DownloadOneAsync<IncompatiblePlugin[]>("https://raw.githubusercontent.com/ArchiDog1998/RotationSolver/main/Resources/IncompatiblePlugins.json");
}

private static async Task<T> DownloadOneAsync<T>(string url)
{
using var client = new HttpClient();
try
{
var bts = await client.GetByteArrayAsync(url);
return JsonConvert.DeserializeObject<T>(Encoding.Default.GetString(bts));
}
catch (Exception ex)
{
PluginLog.Log(ex, "Failed to load downloading List.");
return default;
}
}
}
2 changes: 2 additions & 0 deletions RotationSolver/RotationSolverPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using RotationSolver.Basic.Configuration;
using RotationSolver.Commands;
using RotationSolver.Data;
using RotationSolver.Helpers;
using RotationSolver.Localization;
using RotationSolver.UI;
using RotationSolver.Updaters;
Expand Down Expand Up @@ -84,6 +85,7 @@ public RotationSolverPlugin(DalamudPluginInterface pluginInterface)

Task.Run(async () =>
{
await DownloadHelper.DownloadAsync();
await RotationUpdater.GetAllCustomRotationsAsync(DownloadOption.Download);
});
}
Expand Down
37 changes: 10 additions & 27 deletions RotationSolver/UI/RotationConfigWindowNew.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,8 @@ public class RotationConfigWindowNew : Window

private string _searchText = string.Empty;

[Flags]
public enum CompatibleType : byte
{
Skill_Usage = 1 << 0,
Skill_Selection = 1 << 1,
Crash = 1 << 2,
}

private static readonly (string name, string icon, string link, string features, CompatibleType type)[] _incompatiblePlugins = new[]
{
("XIV Combo", "https://raw.githubusercontent.com/daemitus/XIVComboPlugin/master/res/icon.png", "https://github.com/daemitus/XIVComboPlugin", string.Empty, CompatibleType.Skill_Selection),
("XIV Sloth Combo", "https://raw.githubusercontent.com/Nik-Potokar/XIVSlothCombo/main/res/plugin/xivslothcombo.png", "https://github.com/Nik-Potokar/XIVSlothCombo", string.Empty, CompatibleType.Skill_Selection | CompatibleType.Skill_Usage),
("Redirect", "https://raw.githubusercontent.com/cairthenn/Redirect/main/Redirect/icon.png", "https://github.com/cairthenn/Redirect", string.Empty, CompatibleType.Skill_Usage),
("ReAction", string.Empty, "https://github.com/UnknownX7/ReAction", string.Empty, CompatibleType.Skill_Usage),
("Simple Tweaks", "https://raw.githubusercontent.com/Caraxi/SimpleTweaksPlugin/main/images/icon.png", "https://github.com/Caraxi/SimpleTweaksPlugin/blob/main/Tweaks/TreasureHuntTargets.cs", "Block Targeting Treasure Hunt Enemies", CompatibleType.Crash),
};

public RotationConfigWindowNew()
: base(nameof(RotationConfigWindowNew), ImGuiWindowFlags.NoScrollbar, false)
public RotationConfigWindowNew()
: base(nameof(RotationConfigWindowNew), ImGuiWindowFlags.NoScrollbar, false)
{
SizeCondition = ImGuiCond.FirstUseEver;
Size = new Vector2(740f, 490f);
Expand Down Expand Up @@ -401,16 +384,16 @@ private void DrawBody()
ImGui.TableNextColumn();
ImGui.TableHeader("Type");

foreach (var item in _incompatiblePlugins)
foreach (var item in DownloadHelper.IncompatiblePlugins ?? Array.Empty<IncompatiblePlugin>())
{
ImGui.TableNextRow();
ImGui.TableNextColumn();

ImGui.Text(item.name);
ImGui.Text(item.Name);

ImGui.TableNextColumn();

var icon = item.icon;
var icon = item.Icon;
if(string.IsNullOrEmpty(icon)) icon = "https://raw.githubusercontent.com/goatcorp/DalamudAssets/master/UIRes/defaultIcon.png";

var texture = IconSet.GetTexture(icon);
Expand All @@ -419,26 +402,26 @@ private void DrawBody()
{
if(NoPaddingNoColorImageButton(texture.ImGuiHandle, Vector2.One * iconSize))
{
Util.OpenLink(item.link);
Util.OpenLink(item.Url);
}
}

ImGui.TableNextColumn();
ImGui.TextWrapped(item.features);
ImGui.TextWrapped(item.Features);

ImGui.TableNextColumn();

if (item.type.HasFlag(CompatibleType.Skill_Usage))
if (item.Type.HasFlag(CompatibleType.Skill_Usage))
{
ImGui.TextColored(ImGuiColors.DalamudYellow, CompatibleType.Skill_Usage.ToString().Replace('_', ' '));
ImguiTooltips.HoveredTooltip(LocalizationManager.RightLang.ConfigWindow_About_Compatibility_Mistake);
}
if (item.type.HasFlag(CompatibleType.Skill_Selection))
if (item.Type.HasFlag(CompatibleType.Skill_Selection))
{
ImGui.TextColored(ImGuiColors.DalamudOrange, CompatibleType.Skill_Selection.ToString().Replace('_', ' '));
ImguiTooltips.HoveredTooltip(LocalizationManager.RightLang.ConfigWindow_About_Compatibility_Mislead);
}
if (item.type.HasFlag(CompatibleType.Crash))
if (item.Type.HasFlag(CompatibleType.Crash))
{
ImGui.TextColored(ImGuiColors.DalamudRed, CompatibleType.Crash.ToString().Replace('_', ' '));
ImguiTooltips.HoveredTooltip(LocalizationManager.RightLang.ConfigWindow_About_Compatibility_Crash);
Expand Down
22 changes: 21 additions & 1 deletion RotationSolver/UI/RotationConfigWindowTab.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace RotationSolver.UI;
using static RotationSolver.UI.RotationConfigWindowNew;

namespace RotationSolver.UI;

[AttributeUsage(AttributeTargets.Field)]
internal class TabSkipAttribute : Attribute
Expand Down Expand Up @@ -27,3 +29,21 @@ internal enum RotationConfigWindowTab : byte
[TabIcon(Icon = 51)] Extra,
[TabIcon(Icon = 5)] Debug,
}

public struct IncompatiblePlugin
{
public string Name { get; set; }
public string Icon { get; set; }
public string Url { get; set; }
public string Features { get; set; }

public CompatibleType Type { get; set; }
}

[Flags]
public enum CompatibleType : byte
{
Skill_Usage = 1 << 0,
Skill_Selection = 1 << 1,
Crash = 1 << 2,
}
13 changes: 1 addition & 12 deletions RotationSolver/Updaters/RotationUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -183,18 +183,7 @@ private static async Task DownloadRotationsAsync(string relayFolder, bool mustDo
bool hasDownload = false;
using (var client = new HttpClient())
{
IEnumerable<string> libs = Service.Config.OtherLibs;
try
{
var bts = await client.GetByteArrayAsync("https://raw.githubusercontent.com/ArchiDog1998/RotationSolver/main/Resources/downloadList.json");
libs = libs.Union(JsonConvert.DeserializeObject<string[]>(Encoding.Default.GetString(bts)));
}
catch (Exception ex)
{
PluginLog.Log(ex, "Failed to load downloading List.");
}

foreach (var url in libs)
foreach (var url in Service.Config.OtherLibs.Union(DownloadHelper.LinkLibraries ?? Array.Empty<string>()))
{
hasDownload |= await DownloadOneUrlAsync(url, relayFolder, client, mustDownload);
var pdbUrl = Path.ChangeExtension(url, ".pdb");
Expand Down

0 comments on commit 7422723

Please sign in to comment.