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

Commit

Permalink
fix: api 9.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Oct 2, 2023
1 parent d0e6439 commit 73db581
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 22 deletions.
16 changes: 7 additions & 9 deletions FakeName/Hooker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@
using Dalamud.Game.Text.SeStringHandling;
using Dalamud.Game.Text.SeStringHandling.Payloads;
using Dalamud.Hooking;
using Dalamud.Logging;
using Dalamud.Memory;
using Dalamud.Plugin.Services;
using Dalamud.Utility.Signatures;
using FFXIVClientStructs.FFXIV.Client.UI;
using FFXIVClientStructs.FFXIV.Client.UI.Info;
using FFXIVClientStructs.FFXIV.Component.GUI;
using Lumina.Excel.GeneratedSheets;
using System;
using System.Collections.Generic;
using System.Diagnostics;
Expand Down Expand Up @@ -42,7 +40,7 @@ private delegate void SetNamePlateDelegate(IntPtr addon, bool isPrefixTitle,

internal unsafe Hooker()
{
SignatureHelper.Initialise(this);
Service.Hook.InitializeFromAttributes(this);

AtkTextNodeSetTextHook.Enable();
SetNamePlateHook.Enable();
Expand All @@ -59,7 +57,7 @@ public unsafe void Dispose()
Service.ClientState.Login -= ClientState_Login;
}

private void ClientState_Login(object sender, EventArgs e)
private void ClientState_Login()
{
var player = Service.ClientState.LocalPlayer;
if (player == null) return;
Expand All @@ -83,7 +81,7 @@ private void ClientState_Login(object sender, EventArgs e)
{
"XSplit",
};
private unsafe void Framework_Update(Dalamud.Game.Framework framework)
private unsafe void Framework_Update(IFramework framework)
{
if (IsRunning) return;
IsRunning = true;
Expand Down Expand Up @@ -196,7 +194,7 @@ private unsafe void SetNamePlateDetour(IntPtr namePlateObjectPtr, bool isPrefixT
}
catch (Exception ex)
{
PluginLog.Error(ex, "Failed to change name plate");
Service.Log.Error(ex, "Failed to change name plate");
}

SetNamePlateHook.Original(namePlateObjectPtr, isPrefixTitle, displayTitle,
Expand Down Expand Up @@ -239,7 +237,7 @@ public static IntPtr ChangeName(IntPtr seStringPtr)
}
catch (Exception ex)
{
PluginLog.Error(ex, "Something wrong with change name!");
Service.Log.Error(ex, "Something wrong with change name!");
return seStringPtr;
}
}
Expand Down Expand Up @@ -275,7 +273,7 @@ public static bool ChangeSeString(SeString seString)
}
catch (Exception ex)
{
PluginLog.Error(ex, "Something wrong with replacement!");
Service.Log.Error(ex, "Something wrong with replacement!");
return false;
}
}
Expand Down
3 changes: 2 additions & 1 deletion FakeName/Plugin.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Dalamud.Game.Command;
using Dalamud.Plugin;
using Dalamud.Plugin.Services;
using FakeName.Windows;

namespace FakeName;
Expand All @@ -12,7 +13,7 @@ public class Plugin : IDalamudPlugin

internal WindowManager WindowManager { get; }

public Plugin(DalamudPluginInterface pluginInterface, CommandManager commandManager)
public Plugin(DalamudPluginInterface pluginInterface, ICommandManager commandManager)
{
pluginInterface.Create<Service>();
Service.Config = Service.Interface.GetPluginConfig() as Configuration ?? new Configuration();
Expand Down
24 changes: 12 additions & 12 deletions FakeName/Service.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
using Dalamud.Game;
using Dalamud.Game.ClientState;
using Dalamud.Game.ClientState.Conditions;
using Dalamud.Game.ClientState.Objects;
using Dalamud.Game.Command;
using Dalamud.Game.Gui;
using Dalamud.IoC;
using Dalamud.Plugin;
using Dalamud.Plugin.Services;

namespace FakeName;

Expand All @@ -17,21 +12,26 @@ internal class Service
internal static DalamudPluginInterface Interface { get; private set; }

[PluginService]
internal static ClientState ClientState { get; private set; }
internal static IClientState ClientState { get; private set; }

[PluginService]
internal static CommandManager CommandManager { get; private set; }
internal static ICommandManager CommandManager { get; private set; }

[PluginService]
internal static ObjectTable ObjectTable { get; private set; }
internal static IObjectTable ObjectTable { get; private set; }
[PluginService]
public static Framework Framework { get; private set; }
public static IFramework Framework { get; private set; }

[PluginService]
public static Condition Condition { get; private set; }
public static ICondition Condition { get; private set; }


[PluginService]
public static GameGui GameGui { get; private set; }
public static IGameGui GameGui { get; private set; }

[PluginService]
public static IGameInteropProvider Hook { get; private set; }

[PluginService]
public static IPluginLog Log { get; private set; }
}

0 comments on commit 73db581

Please sign in to comment.