diff --git a/ECommons b/ECommons index 59d30a3f9..1ee7e6583 160000 --- a/ECommons +++ b/ECommons @@ -1 +1 @@ -Subproject commit 59d30a3f96006958d094cb969246ba59314299e5 +Subproject commit 1ee7e658387e70f21596f920cfdd74e943194db5 diff --git a/RotationSolver.Basic/Actions/BaseAction_Target.cs b/RotationSolver.Basic/Actions/BaseAction_Target.cs index 0cc81ddef..8e1aca1a7 100644 --- a/RotationSolver.Basic/Actions/BaseAction_Target.cs +++ b/RotationSolver.Basic/Actions/BaseAction_Target.cs @@ -547,7 +547,7 @@ internal bool CanGetTarget(BattleChara target, BattleChara subTarget) return dis <= EffectRange && dis >= 8; } - PluginLog.LogDebug(Name + "'s CastType is not valid! The value is " + _action.CastType.ToString()); + Svc.Log.Debug(Name + "'s CastType is not valid! The value is " + _action.CastType.ToString()); return false; } #endregion diff --git a/RotationSolver.Basic/Configuration/Configs.cs b/RotationSolver.Basic/Configuration/Configs.cs index 546206f71..a117dbb46 100644 --- a/RotationSolver.Basic/Configuration/Configs.cs +++ b/RotationSolver.Basic/Configuration/Configs.cs @@ -11,7 +11,7 @@ public class PluginConfig : IPluginConfiguration { public static PluginConfig Create() { - PluginLog.Warning("You created a new configuration!"); + Svc.Log.Warning("You created a new configuration!"); var result = new PluginConfig(); result.SetValue(Job.WAR, JobConfigInt.HostileType, 0); result.SetValue(Job.DRK, JobConfigInt.HostileType, 0); @@ -131,7 +131,7 @@ public JobConfig GetJobConfig(Job job) public void Save() { #if DEBUG - PluginLog.Information("Saved configurations."); + Svc.Log.Information("Saved configurations."); #endif File.WriteAllText(Svc.PluginInterface.ConfigFile.FullName, JsonConvert.SerializeObject(this, Formatting.Indented, new JsonSerializerSettings() diff --git a/RotationSolver.Basic/Configuration/MacroInfo.cs b/RotationSolver.Basic/Configuration/MacroInfo.cs index 06ddd4b09..86d337451 100644 --- a/RotationSolver.Basic/Configuration/MacroInfo.cs +++ b/RotationSolver.Basic/Configuration/MacroInfo.cs @@ -17,10 +17,10 @@ public unsafe bool AddMacro(GameObject tar = null) { if (MacroIndex < 0 || MacroIndex > 99) return false; - DataCenter.Macros.Enqueue(new MacroItem(tar, IsShared ? - RaptureMacroModule.Instance->Shared[MacroIndex] : - RaptureMacroModule.Instance->Individual[MacroIndex])); + var shared = RaptureMacroModule.Instance()->SharedSpan[MacroIndex]; + var individual = RaptureMacroModule.Instance()->IndividualSpan[MacroIndex]; + DataCenter.Macros.Enqueue(new MacroItem(tar, IsShared ? &shared : &individual)); return true; } } diff --git a/RotationSolver.Basic/Configuration/OtherConfiguration.cs b/RotationSolver.Basic/Configuration/OtherConfiguration.cs index 2985e2d02..729716648 100644 --- a/RotationSolver.Basic/Configuration/OtherConfiguration.cs +++ b/RotationSolver.Basic/Configuration/OtherConfiguration.cs @@ -208,7 +208,7 @@ private static void InitOne(ref T value, string name, bool download = true) } catch (Exception ex) { - PluginLog.Warning(ex, $"Failed to load {name}."); + Svc.Log.Warning(ex, $"Failed to load {name}."); } } else if(download) diff --git a/RotationSolver.Basic/Data/IconSet.cs b/RotationSolver.Basic/Data/IconSet.cs index 872f48927..94517823c 100644 --- a/RotationSolver.Basic/Data/IconSet.cs +++ b/RotationSolver.Basic/Data/IconSet.cs @@ -106,16 +106,6 @@ private static byte[] SvgToPng(byte[] data) /// public static bool GetTexture(this ITexture text, out IDalamudTextureWrap texture) => GetTexture(text?.IconID ?? 0, out texture); - /// - /// Get Texture from id. - /// - /// - /// - [Obsolete] - - public static TextureWrap GetTexture(uint id) - => ThreadLoadImageHandler.TryGetIconTextureWrap(id, false, out var texture) ? texture : - ThreadLoadImageHandler.TryGetIconTextureWrap(0, false, out texture) ? texture : null; /// /// diff --git a/RotationSolver.Basic/Data/MacroItem.cs b/RotationSolver.Basic/Data/MacroItem.cs index 6978ab39e..bb3654ca0 100644 --- a/RotationSolver.Basic/Data/MacroItem.cs +++ b/RotationSolver.Basic/Data/MacroItem.cs @@ -39,11 +39,11 @@ public MacroItem(GameObject target, RaptureMacroModule.Macro* macro) /// public bool StartUseMacro() { - if (RaptureShellModule.Instance->MacroCurrentLine > -1) return false; + if (RaptureShellModule.Instance()->MacroCurrentLine > -1) return false; _lastTarget = Svc.Targets.Target; Svc.Targets.Target = Target; - RaptureShellModule.Instance->ExecuteMacro(_macro); + RaptureShellModule.Instance()->ExecuteMacro(_macro); IsRunning = true; return true; @@ -55,7 +55,7 @@ public bool StartUseMacro() /// public bool EndUseMacro() { - if (RaptureShellModule.Instance->MacroCurrentLine > -1) return false; + if (RaptureShellModule.Instance()->MacroCurrentLine > -1) return false; Svc.Targets.Target = _lastTarget; diff --git a/RotationSolver.Basic/DataCenter.cs b/RotationSolver.Basic/DataCenter.cs index 3b31305b3..919d19569 100644 --- a/RotationSolver.Basic/DataCenter.cs +++ b/RotationSolver.Basic/DataCenter.cs @@ -136,7 +136,7 @@ public static unsafe ushort FateId } catch (Exception ex) { - PluginLog.Error(ex.StackTrace); + Svc.Log.Error(ex.StackTrace); } return 0; } diff --git a/RotationSolver.Basic/Rotations/Basic/BLU_Base.cs b/RotationSolver.Basic/Rotations/Basic/BLU_Base.cs index 0dd13067e..0f5f2880c 100644 --- a/RotationSolver.Basic/Rotations/Basic/BLU_Base.cs +++ b/RotationSolver.Basic/Rotations/Basic/BLU_Base.cs @@ -155,7 +155,7 @@ public bool RightType } catch (Exception ex) { - PluginLog.Warning(ex, "Failed for checking target status."); + Svc.Log.Warning(ex, "Failed for checking target status."); } return true; } diff --git a/RotationSolver.Basic/Rotations/CustomRotation_OtherInfo.cs b/RotationSolver.Basic/Rotations/CustomRotation_OtherInfo.cs index 9190ff745..ab74ee467 100644 --- a/RotationSolver.Basic/Rotations/CustomRotation_OtherInfo.cs +++ b/RotationSolver.Basic/Rotations/CustomRotation_OtherInfo.cs @@ -1,6 +1,7 @@ using Dalamud; using Dalamud.Game.ClientState.Conditions; using Dalamud.Game.ClientState.Objects.SubKinds; +using Dalamud.Plugin.Services; using ECommons.DalamudServices; namespace RotationSolver.Basic.Rotations; @@ -49,7 +50,7 @@ public abstract partial class CustomRotation /// /// Condition. /// - protected static Condition Condition => Svc.Condition; + protected static ICondition Condition => Svc.Condition; #endregion diff --git a/RotationSolver.Basic/Service.cs b/RotationSolver.Basic/Service.cs index 1e1bf38d4..994292325 100644 --- a/RotationSolver.Basic/Service.cs +++ b/RotationSolver.Basic/Service.cs @@ -1,4 +1,5 @@ -using Dalamud.Utility.Signatures; +using Dalamud.Plugin.Services; +using Dalamud.Utility.Signatures; using ECommons.DalamudServices; using FFXIVClientStructs.Attributes; using FFXIVClientStructs.FFXIV.Client.Game; @@ -42,7 +43,7 @@ internal static unsafe bool CanMove public Service() { - SignatureHelper.Initialise(this); + Svc.Hook.InitializeFromAttributes(this); } public static ActionID GetAdjustedActionId(ActionID id) => (ActionID)GetAdjustedActionId((uint)id); diff --git a/RotationSolver/ActionSequencer/BaseCondition.cs b/RotationSolver/ActionSequencer/BaseCondition.cs index 2d6dc33ed..d1dd51210 100644 --- a/RotationSolver/ActionSequencer/BaseCondition.cs +++ b/RotationSolver/ActionSequencer/BaseCondition.cs @@ -1,4 +1,5 @@ -using RotationSolver.Localization; +using Dalamud.Interface.Utility; +using RotationSolver.Localization; using RotationSolver.UI; namespace RotationSolver.ActionSequencer; diff --git a/RotationSolver/ActionSequencer/ConditionHelper.cs b/RotationSolver/ActionSequencer/ConditionHelper.cs index d73d320f8..71a289b7f 100644 --- a/RotationSolver/ActionSequencer/ConditionHelper.cs +++ b/RotationSolver/ActionSequencer/ConditionHelper.cs @@ -1,4 +1,5 @@ -using Dalamud.Logging; +using Dalamud.Interface.Utility; +using Dalamud.Logging; using ECommons.GameHelpers; using RotationSolver.Localization; using RotationSolver.UI; diff --git a/RotationSolver/ActionSequencer/TargetCondition.cs b/RotationSolver/ActionSequencer/TargetCondition.cs index c717ed845..0b5155881 100644 --- a/RotationSolver/ActionSequencer/TargetCondition.cs +++ b/RotationSolver/ActionSequencer/TargetCondition.cs @@ -1,4 +1,5 @@ -using ECommons.DalamudServices; +using Dalamud.Interface.Utility; +using ECommons.DalamudServices; using ECommons.GameHelpers; using Lumina.Excel.GeneratedSheets; using RotationSolver.Localization; diff --git a/RotationSolver/Commands/RSCommands_Actions.cs b/RotationSolver/Commands/RSCommands_Actions.cs index 6ddcf015f..fd751a24e 100644 --- a/RotationSolver/Commands/RSCommands_Actions.cs +++ b/RotationSolver/Commands/RSCommands_Actions.cs @@ -105,7 +105,7 @@ static async void PulseSimulation(uint id) } catch (Exception ex) { - PluginLog.Warning(ex, "Pulse Failed!"); + Svc.Log.Warning(ex, "Pulse Failed!"); } finally { started = false; } started = false; diff --git a/RotationSolver/Helpers/DownloadHelper.cs b/RotationSolver/Helpers/DownloadHelper.cs index e8956b367..c1694bfcf 100644 --- a/RotationSolver/Helpers/DownloadHelper.cs +++ b/RotationSolver/Helpers/DownloadHelper.cs @@ -1,4 +1,5 @@ using Dalamud.Logging; +using ECommons.DalamudServices; using RotationSolver.UI; using System.Text; @@ -31,7 +32,7 @@ private static async Task DownloadOneAsync(string url) } catch (Exception ex) { - PluginLog.Log(ex, "Failed to load downloading List."); + Svc.Log.Information(ex, "Failed to load downloading List."); return default; } } diff --git a/RotationSolver/Helpers/RotationLoadContext.cs b/RotationSolver/Helpers/RotationLoadContext.cs index f4f227724..88244c3df 100644 --- a/RotationSolver/Helpers/RotationLoadContext.cs +++ b/RotationSolver/Helpers/RotationLoadContext.cs @@ -1,6 +1,7 @@ using System.Runtime.Loader; using Dalamud.Logging; using Dalamud.Plugin; +using ECommons.DalamudServices; using FFXIVClientStructs.Interop; using Lumina.Excel; using Lumina.Excel.CustomSheets; @@ -65,7 +66,7 @@ internal Assembly LoadFromFile(string filePath) var pdbPath = Path.ChangeExtension(filePath, ".pdb"); if (!File.Exists(pdbPath)) { - PluginLog.Information($"Failed to find {pdbPath}"); + Svc.Log.Information($"Failed to find {pdbPath}"); return LoadFromStream(file); } using var pdbFile = File.Open(pdbPath, FileMode.Open, FileAccess.Read, FileShare.Read); diff --git a/RotationSolver/Helpers/UIHelper.cs b/RotationSolver/Helpers/UIHelper.cs index 862669e78..38909cdfa 100644 --- a/RotationSolver/Helpers/UIHelper.cs +++ b/RotationSolver/Helpers/UIHelper.cs @@ -39,7 +39,7 @@ public static void ShowWarning(this string message, int times = 3, DalamudLinkPa new TextPayload("(Hide Warning)"), RawPayload.LinkTerminator); - Svc.Chat.PrintChat(new Dalamud.Game.Text.XivChatEntry() + Svc.Chat.Print(new Dalamud.Game.Text.XivChatEntry() { Message = seString, Type = Dalamud.Game.Text.XivChatType.ErrorMessage, diff --git a/RotationSolver/Localization/LocalizationManager.cs b/RotationSolver/Localization/LocalizationManager.cs index 6147b9e48..929f8e126 100644 --- a/RotationSolver/Localization/LocalizationManager.cs +++ b/RotationSolver/Localization/LocalizationManager.cs @@ -64,12 +64,12 @@ private void OnLanguageChange(string languageCode) { try { - PluginLog.Information($"Loading Localization for {languageCode}"); + Svc.Log.Information($"Loading Localization for {languageCode}"); SetLanguage(languageCode); } catch (Exception ex) { - PluginLog.Error(ex, "Unable to Load Localization"); + Svc.Log.Error(ex, "Unable to Load Localization"); } } } diff --git a/RotationSolver/RotationSolver.yaml b/RotationSolver/RotationSolver.yaml index 3d8b91e26..597db7bbc 100644 --- a/RotationSolver/RotationSolver.yaml +++ b/RotationSolver/RotationSolver.yaml @@ -12,7 +12,7 @@ description: |- punchline: Analyses PvE combat information every frame and finds the best action. repo_url: https://github.com/ArchiDog1998/RotationSolver icon_url: https://raw.githubusercontent.com/ArchiDog1998/RotationSolver/main/Images/Logo.png -dalamud_api_level: 8 +dalamud_api_level: 9 tags: - combat - rotation diff --git a/RotationSolver/RotationSolverPlugin.cs b/RotationSolver/RotationSolverPlugin.cs index 4491c9b49..bcee98f27 100644 --- a/RotationSolver/RotationSolverPlugin.cs +++ b/RotationSolver/RotationSolverPlugin.cs @@ -58,7 +58,7 @@ public RotationSolverPlugin(DalamudPluginInterface pluginInterface) } catch(Exception ex) { - PluginLog.Warning(ex, "Failed to load config"); + Svc.Log.Warning(ex, "Failed to load config"); Service.Config = PluginConfig.Create(); ; } diff --git a/RotationSolver/SpeechHelper.cs b/RotationSolver/SpeechHelper.cs index 6f176f59e..5b9bbd00c 100644 --- a/RotationSolver/SpeechHelper.cs +++ b/RotationSolver/SpeechHelper.cs @@ -47,7 +47,7 @@ internal static void Speak(string text) } catch (Exception ex) { - PluginLog.Warning(ex, "Something wrong with TTT."); + Svc.Log.Warning(ex, "Something wrong with TTT."); } } } \ No newline at end of file diff --git a/RotationSolver/UI/CollapsingHeaderGroup.cs b/RotationSolver/UI/CollapsingHeaderGroup.cs index 3dd8b4358..a350c34a7 100644 --- a/RotationSolver/UI/CollapsingHeaderGroup.cs +++ b/RotationSolver/UI/CollapsingHeaderGroup.cs @@ -1,4 +1,5 @@ using Dalamud.Logging; +using ECommons.DalamudServices; namespace RotationSolver.UI; @@ -70,7 +71,7 @@ public void Draw() } catch (Exception ex) { - PluginLog.Warning(ex, "Something wrong with header drawing."); + Svc.Log.Warning(ex, "Something wrong with header drawing."); } } } diff --git a/RotationSolver/UI/ControlWindow.cs b/RotationSolver/UI/ControlWindow.cs index a8ad6f194..2d40411f2 100644 --- a/RotationSolver/UI/ControlWindow.cs +++ b/RotationSolver/UI/ControlWindow.cs @@ -1,4 +1,5 @@ using Dalamud.Interface.Colors; +using Dalamud.Interface.Internal; using ECommons.DalamudServices; using ImGuiScene; using RotationSolver.Basic.Configuration; @@ -270,7 +271,7 @@ static void DrawCommandAction(uint iconId, SpecialCommandType command, Vector4 c if (IconSet.GetTexture(iconId, out var texture)) DrawCommandAction(texture, command, color); } - static void DrawCommandAction(TextureWrap texture, SpecialCommandType command, Vector4 color) + static void DrawCommandAction(IDalamudTextureWrap texture, SpecialCommandType command, Vector4 color) { var abilityW = Service.Config.GetValue(PluginConfigFloat.ControlWindow0GCDSize); var width = abilityW + ImGui.GetStyle().ItemInnerSpacing.X * 2; diff --git a/RotationSolver/UI/ImguiTooltips.cs b/RotationSolver/UI/ImguiTooltips.cs index ab189a2fa..fe59633c0 100644 --- a/RotationSolver/UI/ImguiTooltips.cs +++ b/RotationSolver/UI/ImguiTooltips.cs @@ -1,4 +1,5 @@ using Dalamud.Interface.Colors; +using Dalamud.Interface.Utility; namespace RotationSolver.UI; diff --git a/RotationSolver/UI/RotationConfigWindow.cs b/RotationSolver/UI/RotationConfigWindow.cs index f5c99623e..13269abee 100644 --- a/RotationSolver/UI/RotationConfigWindow.cs +++ b/RotationSolver/UI/RotationConfigWindow.cs @@ -100,7 +100,7 @@ public override void Draw() } catch (Exception ex) { - PluginLog.Warning(ex, "Something wrong with sideBar"); + Svc.Log.Warning(ex, "Something wrong with sideBar"); } ImGui.TableNextColumn(); @@ -111,7 +111,7 @@ public override void Draw() } catch (Exception ex) { - PluginLog.Warning(ex, "Something wrong with body"); + Svc.Log.Warning(ex, "Something wrong with body"); } ImGui.EndTable(); @@ -119,7 +119,7 @@ public override void Draw() } catch(Exception ex) { - PluginLog.Warning(ex, "Something wrong with config window."); + Svc.Log.Warning(ex, "Something wrong with config window."); } } @@ -245,7 +245,7 @@ private static bool GetLocalImage(string name, out IDalamudTextureWrap texture) using var stream = typeof(RotationConfigWindow).Assembly.GetManifestResourceStream(url); if (stream == null) { - PluginLog.Warning($"Failed to load the pic: {url} when getting the stream from assembly."); + Svc.Log.Warning($"Failed to load the pic: {url} when getting the stream from assembly."); _textureWrapList[url] = null; return false; } @@ -255,7 +255,7 @@ private static bool GetLocalImage(string name, out IDalamudTextureWrap texture) texture = Svc.PluginInterface.UiBuilder.LoadImage(memory.ToArray()); if(texture == null) { - PluginLog.Warning($"Failed to load the pic: {url} when convert bytes to image."); + Svc.Log.Warning($"Failed to load the pic: {url} when convert bytes to image."); _textureWrapList[url] = null; return false; } diff --git a/RotationSolver/UI/SearchableConfigs/CheckBoxSearch.cs b/RotationSolver/UI/SearchableConfigs/CheckBoxSearch.cs index 2defce351..3b6f603c2 100644 --- a/RotationSolver/UI/SearchableConfigs/CheckBoxSearch.cs +++ b/RotationSolver/UI/SearchableConfigs/CheckBoxSearch.cs @@ -1,4 +1,6 @@ -using ECommons.ExcelServices; +using Dalamud.Interface.Internal; +using Dalamud.Interface.Utility; +using ECommons.ExcelServices; using ImGuiScene; using RotationSolver.Basic.Configuration; using RotationSolver.Localization; @@ -78,7 +80,7 @@ protected virtual void DrawChildren(Job job) protected override void DrawMain(Job job) { var hasChild = Children != null && Children.Length > 0; - TextureWrap texture = null; + IDalamudTextureWrap texture = null; var hasIcon = Action != ActionID.None && IconSet.GetTexture(Action, out texture); var enable = GetValue(job); diff --git a/RotationSolver/UI/SearchableConfigs/Searchable.cs b/RotationSolver/UI/SearchableConfigs/Searchable.cs index 3f68b6c06..eee7d7a36 100644 --- a/RotationSolver/UI/SearchableConfigs/Searchable.cs +++ b/RotationSolver/UI/SearchableConfigs/Searchable.cs @@ -1,4 +1,5 @@ -using ECommons.DalamudServices; +using Dalamud.Interface.Utility; +using ECommons.DalamudServices; using ECommons.ExcelServices; using Lumina.Excel.GeneratedSheets; using RotationSolver.Localization; diff --git a/RotationSolver/Updaters/ActionUpdater.cs b/RotationSolver/Updaters/ActionUpdater.cs index 603ddb1d2..5e0719191 100644 --- a/RotationSolver/Updaters/ActionUpdater.cs +++ b/RotationSolver/Updaters/ActionUpdater.cs @@ -69,7 +69,7 @@ internal static void UpdateNextAction() } catch (Exception ex) { - PluginLog.Error(ex, "Failed to update next action."); + Svc.Log.Error(ex, "Failed to update next action."); } WrongAction = NextAction = NextGCDAction = null; diff --git a/RotationSolver/Updaters/MajorUpdater.cs b/RotationSolver/Updaters/MajorUpdater.cs index b1d057c14..88e9ed467 100644 --- a/RotationSolver/Updaters/MajorUpdater.cs +++ b/RotationSolver/Updaters/MajorUpdater.cs @@ -2,6 +2,7 @@ using Dalamud.Game.ClientState.Conditions; using Dalamud.Game.ClientState.Objects.Enums; using Dalamud.Logging; +using Dalamud.Plugin.Services; using ECommons.DalamudServices; using ECommons.GameHelpers; using ECommons.ImGuiMethods; @@ -27,7 +28,7 @@ internal static class MajorUpdater static Exception _threadException; static DateTime _lastUpdatedWork = DateTime.Now; - private unsafe static void FrameworkUpdate(Framework framework) + private unsafe static void FrameworkUpdate(IFramework framework) { PainterManager.ActionIds.Clear(); RotationSolverPlugin.UpdateDisplayWindow(); @@ -77,7 +78,7 @@ private unsafe static void FrameworkUpdate(Framework framework) if(_threadException != ex) { _threadException = ex; - PluginLog.Error(ex, "Main Thread Exception"); + Svc.Log.Error(ex, "Main Thread Exception"); } } @@ -101,7 +102,7 @@ private unsafe static void FrameworkUpdate(Framework framework) } catch (Exception ex) { - PluginLog.Error(ex, "Worker Exception"); + Svc.Log.Error(ex, "Worker Exception"); } } @@ -119,7 +120,7 @@ private static void UpdateWork() var waitingTime = (DateTime.Now - _lastUpdatedWork).TotalMilliseconds; if (waitingTime > 100) { - PluginLog.Warning($"The time for completing a running cycle for RS is {waitingTime:F2} ms, try disabling the option \"{LocalizationManager.RightLang.ConfigWindow_Param_UseWorkTask}\" to get better performance or check your other running plugins for one of them using too many resources and try disabling that."); + Svc.Log.Warning($"The time for completing a running cycle for RS is {waitingTime:F2} ms, try disabling the option \"{LocalizationManager.RightLang.ConfigWindow_Param_UseWorkTask}\" to get better performance or check your other running plugins for one of them using too many resources and try disabling that."); } if (!IsValid) @@ -150,7 +151,7 @@ private static void UpdateWork() if(_innerException != ex) { _innerException = ex; - PluginLog.Error(ex, "Inner Worker Exception"); + Svc.Log.Error(ex, "Inner Worker Exception"); } } @@ -178,7 +179,7 @@ private unsafe static void CloseWindow() } catch (Exception ex) { - PluginLog.Warning(ex, "Failed to close the window!"); + Svc.Log.Warning(ex, "Failed to close the window!"); } finally { @@ -228,7 +229,7 @@ private unsafe static void OpenChest() } catch (Exception ex) { - PluginLog.Error(ex, "Failed to open the chest!"); + Svc.Log.Error(ex, "Failed to open the chest!"); } if (!Service.Config.GetValue(PluginConfigBool.AutoCloseChestWindow)) return; diff --git a/RotationSolver/Updaters/PreviewUpdater.cs b/RotationSolver/Updaters/PreviewUpdater.cs index d2583c4a3..e093af4b2 100644 --- a/RotationSolver/Updaters/PreviewUpdater.cs +++ b/RotationSolver/Updaters/PreviewUpdater.cs @@ -72,18 +72,18 @@ internal static unsafe void PulseActionBar(uint actionID) }); } - private unsafe static bool IsActionSlotRight(ActionBarSlot slot, HotBarSlot* hot, uint actionID) + private unsafe static bool IsActionSlotRight(ActionBarSlot slot, HotBarSlot? hot, uint actionID) { - if ((IntPtr)hot != IntPtr.Zero) + if (hot.HasValue) { - if (hot->IconTypeA != HotbarSlotType.CraftAction && hot->IconTypeA != HotbarSlotType.Action) return false; - if (hot->IconTypeB != HotbarSlotType.CraftAction && hot->IconTypeB != HotbarSlotType.Action) return false; + if (hot.Value.IconTypeA != HotbarSlotType.CraftAction && hot.Value.IconTypeA != HotbarSlotType.Action) return false; + if (hot.Value.IconTypeB != HotbarSlotType.CraftAction && hot.Value.IconTypeB != HotbarSlotType.Action) return false; } return Service.GetAdjustedActionId((uint)slot.ActionId) == actionID; } - unsafe delegate bool ActionBarAction(ActionBarSlot bar, HotBarSlot* hot, uint highLightID); + unsafe delegate bool ActionBarAction(ActionBarSlot bar, HotBarSlot? hot, uint highLightID); unsafe delegate bool ActionBarPredicate(ActionBarSlot bar, HotBarSlot* hot); private static unsafe void LoopAllSlotBar(ActionBarAction doingSomething) { @@ -96,13 +96,13 @@ private static unsafe void LoopAllSlotBar(ActionBarAction doingSomething) { if (intPtr == IntPtr.Zero) continue; var actionBar = (AddonActionBarBase*)intPtr; - var hotBar = Framework.Instance()->GetUiModule()->GetRaptureHotbarModule()->HotBar[hotBarIndex]; + var hotBar = Framework.Instance()->GetUiModule()->GetRaptureHotbarModule()->HotBarsSpan[hotBarIndex]; var slotIndex = 0; foreach (var slot in actionBar->Slot) { var highLightId = 0x53550000 + index; - if (doingSomething(slot, hotBarIndex > 9 ? null: hotBar->Slot[slotIndex], (uint)highLightId)) + if (doingSomething(slot, hotBarIndex > 9 ? null: hotBar.SlotsSpan[slotIndex], (uint)highLightId)) { var iconAddon = slot.Icon; if ((IntPtr)iconAddon == IntPtr.Zero) continue; diff --git a/RotationSolver/Updaters/RotationUpdater.cs b/RotationSolver/Updaters/RotationUpdater.cs index 094131c85..578a006a6 100644 --- a/RotationSolver/Updaters/RotationUpdater.cs +++ b/RotationSolver/Updaters/RotationUpdater.cs @@ -62,7 +62,7 @@ public static async Task GetAllCustomRotationsAsync(DownloadOption option) } catch (Exception ex) { - PluginLog.LogError(ex, "Failed to get custom rotations"); + Svc.Log.Error(ex, "Failed to get custom rotations"); } finally { @@ -122,7 +122,7 @@ private static void LoadRotationsFromLocal(string relayFolder) } catch (Exception ex) { - PluginLog.Warning(ex, "Failed to get author's hash"); + Svc.Log.Warning(ex, "Failed to get author's hash"); } } @@ -268,12 +268,12 @@ private static async Task DownloadOneUrlAsync(string url, string relayFold await response.Content.CopyToAsync(stream); } - PluginLog.Log($"Successfully download the {filePath}"); + Svc.Log.Information($"Successfully download the {filePath}"); return true; } catch (Exception ex) { - PluginLog.LogError(ex, $"failed to download from {url}"); + Svc.Log.Error(ex, $"failed to download from {url}"); } return false; } @@ -294,7 +294,7 @@ private static Assembly LoadOne(string filePath) } catch (Exception ex) { - PluginLog.Warning(ex, "Failed to load " + filePath); + Svc.Log.Warning(ex, "Failed to load " + filePath); } return null; } @@ -350,7 +350,7 @@ private static Type[] TryGetTypes(Assembly assembly) } catch(Exception ex) { - PluginLog.Warning(ex, $"Failed to load the types from {assembly.FullName}"); + Svc.Log.Warning(ex, $"Failed to load the types from {assembly.FullName}"); return Array.Empty(); } } @@ -363,7 +363,7 @@ private static ICustomRotation GetRotation(Type t) } catch (Exception ex) { - PluginLog.Error(ex, $"Failed to load the rotation: {t.Name}"); + Svc.Log.Error(ex, $"Failed to load the rotation: {t.Name}"); return null; } } diff --git a/RotationSolver/Updaters/SocialUpdater.cs b/RotationSolver/Updaters/SocialUpdater.cs index af13ecf95..7034ba814 100644 --- a/RotationSolver/Updaters/SocialUpdater.cs +++ b/RotationSolver/Updaters/SocialUpdater.cs @@ -65,7 +65,7 @@ internal static void Enable() Svc.DutyState.DutyWiped += DutyState_DutyWiped; Svc.DutyState.DutyCompleted += DutyState_DutyCompleted; Svc.ClientState.TerritoryChanged += ClientState_TerritoryChanged; - ClientState_TerritoryChanged(null, Svc.ClientState.TerritoryType); + ClientState_TerritoryChanged(Svc.ClientState.TerritoryType); HighEndDuties = Service.GetSheet() .Where(t => t?.ContentFinderCondition?.Value?.HighEndDuty ?? false) @@ -81,11 +81,11 @@ static async void DutyState_DutyCompleted(object sender, ushort e) Service.Config.GlobalConfig.DutyEnd.AddMacro(); } - static void ClientState_TerritoryChanged(object sender, ushort e) + static void ClientState_TerritoryChanged(ushort id) { DataCenter.ResetAllLastActions(); - var territory = Service.GetSheet().GetRow(e); + var territory = Service.GetSheet().GetRow(id); if (territory?.ContentFinderCondition?.Value?.RowId != 0) { _canSaying = true; @@ -101,7 +101,7 @@ static void ClientState_TerritoryChanged(object sender, ushort e) } catch(Exception ex) { - PluginLog.Error(ex, "Failed on Territory changed."); + Svc.Log.Error(ex, "Failed on Territory changed."); } } @@ -192,7 +192,7 @@ private static async void SayHelloToUsers() Svc.Targets.Target = entity.player; Chat.Instance.SendMessage($"/{_macroToAuthor[new Random().Next(_macroToAuthor.Count)]} "); #endif - Svc.Chat.PrintChat(new Dalamud.Game.Text.XivChatEntry() + Svc.Chat.Print(new Dalamud.Game.Text.XivChatEntry() { Message = entity.GetMessage(), Type = Dalamud.Game.Text.XivChatType.Notice, @@ -219,7 +219,7 @@ internal static string EncryptString(PlayerCharacter player) } catch (Exception ex) { - PluginLog.Warning(ex, "Failed to read the player's name and world."); + Svc.Log.Warning(ex, "Failed to read the player's name and world."); return string.Empty; } } diff --git a/RotationSolver/Watcher.cs b/RotationSolver/Watcher.cs index cddde656a..bec4f6091 100644 --- a/RotationSolver/Watcher.cs +++ b/RotationSolver/Watcher.cs @@ -34,7 +34,7 @@ public static void Disable() private static void UpdateRTTDetour(dynamic obj) { - PluginLog.LogDebug($"LastRTT:{obj.LastRTT}"); + Svc.Log.Debug($"LastRTT:{obj.LastRTT}"); DataCenter.RTT = (long)obj.LastRTT / 1000f; } diff --git a/XIVPainter b/XIVPainter index f53cb594e..1b388b56a 160000 --- a/XIVPainter +++ b/XIVPainter @@ -1 +1 @@ -Subproject commit f53cb594eb3763bcc89094251e766e7e831c0876 +Subproject commit 1b388b56ae5d162af2974c8481a6d9d8c464fe20 diff --git a/manifest.json b/manifest.json index 7d5d77fce..458207fce 100644 --- a/manifest.json +++ b/manifest.json @@ -11,7 +11,7 @@ "CategoryTags": [ "jobs" ], - "DalamudApiLevel": 8, + "DalamudApiLevel": 9, "LoadRequiredState": 0, "LoadSync": false, "CanUnloadAsync": false,