Skip to content

Commit

Permalink
refactor: update for v9
Browse files Browse the repository at this point in the history
  • Loading branch information
kalilistic committed Sep 27, 2023
1 parent 483f310 commit eda420f
Show file tree
Hide file tree
Showing 19 changed files with 129 additions and 198 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
run: echo "VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV
- name: Download Dalamud
run: |
curl https://goatcorp.github.io/dalamud-distrib/latest.zip --output latest.zip
curl https://goatcorp.github.io/dalamud-distrib/v9/latest.zip --output latest.zip
mkdir -p ~/Dalamud
unzip latest.zip -d ~/Dalamud
- name: Build
Expand Down
6 changes: 3 additions & 3 deletions Dalamud.DrunkenToad/Caching/CacheService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Logging;
using Core;

/// <summary>
/// An abstract base class for cache services that manage thread-safe caching operations.
Expand Down Expand Up @@ -71,7 +71,7 @@ protected async Task ExecuteReloadCacheAsync(Func<Task> customAction)
{
if (this.isResettingCache)
{
PluginLog.LogVerbose("A cache reset is already in progress. Ignoring this request.");
DalamudContext.PluginLog.Verbose("A cache reset is already in progress. Ignoring this request.");
return;
}

Expand All @@ -94,7 +94,7 @@ protected void ExecuteReloadCache(Action customAction)
{
if (this.isResettingCache)
{
PluginLog.LogVerbose("A cache reset is already in progress. Ignoring this request.");
DalamudContext.PluginLog.Verbose("A cache reset is already in progress. Ignoring this request.");
return;
}

Expand Down
12 changes: 6 additions & 6 deletions Dalamud.DrunkenToad/Consumers/VisibilityConsumer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

using System;
using System.Collections.Generic;
using Logging;
using Core;
using Plugin;
using Plugin.Ipc;

Expand Down Expand Up @@ -67,7 +67,7 @@ public void Subscribe()
}
catch (Exception ex)
{
PluginLog.LogVerbose($"Failed to subscribe to Visibility.:\n{ex}");
DalamudContext.PluginLog.Verbose($"Failed to subscribe to Visibility.:\n{ex}");
}
}

Expand All @@ -85,7 +85,7 @@ public void Subscribe()
/// <param name="reason">Reason for adding.</param>
public void AddToVoidList(string name, uint worldId, string reason)
{
PluginLog.LogVerbose("Adding " + name);
DalamudContext.PluginLog.Verbose("Adding " + name);
this.consumerAddToVoidList.InvokeAction(name, worldId, reason);
}

Expand All @@ -96,7 +96,7 @@ public void AddToVoidList(string name, uint worldId, string reason)
/// <param name="worldId">World ID.</param>
public void RemoveFromVoidList(string name, uint worldId)
{
PluginLog.LogVerbose("Removing " + name);
DalamudContext.PluginLog.Verbose("Removing " + name);
this.consumerRemoveFromVoidList.InvokeAction(name, worldId);
}

Expand All @@ -114,7 +114,7 @@ public void RemoveFromVoidList(string name, uint worldId)
/// <param name="reason">Reason for adding.</param>
public void AddToWhiteList(string name, uint worldId, string reason)
{
PluginLog.LogVerbose("Adding " + name);
DalamudContext.PluginLog.Verbose("Adding " + name);
this.consumerAddToWhiteList.InvokeAction(name, worldId, reason);
}

Expand All @@ -125,7 +125,7 @@ public void AddToWhiteList(string name, uint worldId, string reason)
/// <param name="worldId">World ID.</param>
public void RemoveFromWhiteList(string name, uint worldId)
{
PluginLog.LogVerbose("Removing " + name);
DalamudContext.PluginLog.Verbose("Removing " + name);
this.consumerRemoveFromWhiteList.InvokeAction(name, worldId);
}

Expand Down
88 changes: 34 additions & 54 deletions Dalamud.DrunkenToad/Core/DalamudContext.cs
Original file line number Diff line number Diff line change
@@ -1,33 +1,13 @@
namespace Dalamud.DrunkenToad.Core;

using System;
using Data;
using Game;
using Game.ClientState;
using Game.ClientState.Aetherytes;
using Game.ClientState.Buddy;
using Game.ClientState.Conditions;
using Game.ClientState.Fates;
using Game.ClientState.GamePad;
using Game.ClientState.JobGauge;
using Game.ClientState.Keys;
using Game.ClientState.Objects;
using Game.ClientState.Party;
using Game.DutyState;
using Game.Gui;
using Game.Gui.Dtr;
using Game.Gui.FlyText;
using Game.Gui.PartyFinder;
using Game.Gui.Toast;
using Game.Libc;
using Game.Network;
using Gui;
using Interface;
using IoC;
using Logging;
using Plugin;
using Plugin.Services;
using Services;
using DalamudCommandManager = Game.Command.CommandManager;
using PluginLocalization = Loc.Localization;

/// <summary>
Expand Down Expand Up @@ -70,164 +50,164 @@ public class DalamudContext
/// Gets the collection of available Aetherytes in the Teleport window.
/// </summary>
[PluginService]
public static AetheryteList AetheryteCollection { get; private set; } = null!;
public static IAetheryteList AetheryteCollection { get; private set; } = null!;

/// <summary>
/// Gets the collection of buddies in your squadron or trust party.
/// </summary>
[PluginService]
public static BuddyList BuddyCollection { get; private set; } = null!;
public static IBuddyList BuddyCollection { get; private set; } = null!;

/// <summary>
/// Gets service that provides a wrapper around the Dalamud CommandManager for managing command states.
/// </summary>
[PluginService]
public static DalamudCommandManager CommandManager { get; private set; } = null!;
public static ICommandManager CommandManager { get; private set; } = null!;

/// <summary>
/// Gets service that provides access to player state conditions.
/// </summary>
[PluginService]
public static Condition ConditionHandler { get; private set; } = null!;
public static ICondition ConditionHandler { get; private set; } = null!;

/// <summary>
/// Gets the collection of currently available Fate events.
/// </summary>
[PluginService]
public static FateTable FateCollection { get; private set; } = null!;
public static IFateTable FateCollection { get; private set; } = null!;

/// <summary>
/// Gets service that provides access to the gamepad state.
/// </summary>
[PluginService]
public static GamepadState GamepadStateHandler { get; private set; } = null!;
public static IGamepadState GamepadStateHandler { get; private set; } = null!;

/// <summary>
/// Gets service that provides access to Job gauge data.
/// </summary>
[PluginService]
public static JobGauges JobGaugeHandler { get; private set; } = null!;
public static IJobGauges JobGaugeHandler { get; private set; } = null!;

/// <summary>
/// Gets service that provides a wrapper around the game's key state buffer, containing the pressed state for all
/// keyboard keys, indexed by virtual vkCode.
/// </summary>
[PluginService]
public static KeyState KeyStateHandler { get; private set; } = null!;
public static IKeyState KeyStateHandler { get; private set; } = null!;

/// <summary>
/// Gets the collection of currently spawned FFXIV game objects.
/// </summary>
[PluginService]
public static ObjectTable ObjectCollection { get; private set; } = null!;
public static IObjectTable ObjectCollection { get; private set; } = null!;

/// <summary>
/// Gets the collection of actors in your party or alliance.
/// </summary>
[PluginService]
public static PartyList PartyCollection { get; private set; } = null!;
public static IPartyList PartyCollection { get; private set; } = null!;

/// <summary>
/// Gets service that provides access to the current state of the game client at the time of access.
/// </summary>
[PluginService]
public static ClientState ClientStateHandler { get; private set; } = null!;
public static IClientState ClientStateHandler { get; private set; } = null!;

/// <summary>
/// Gets service that provides an interface for interacting with the server info bar.
/// </summary>
[PluginService]
public static DtrBar ServerInfoBarHandler { get; private set; } = null!;
public static IDtrBar ServerInfoBarHandler { get; private set; } = null!;

/// <summary>
/// Gets service that facilitates interaction with and creation of native in-game "fly text" windows.
/// </summary>
[PluginService]
public static FlyTextGui FlyTextGuiHandler { get; private set; } = null!;
public static IFlyTextGui FlyTextGuiHandler { get; private set; } = null!;

/// <summary>
/// Gets service that handles interaction with the native PartyFinder window.
/// </summary>
[PluginService]
public static PartyFinderGui PartyFinderGuiHandler { get; private set; } = null!;
public static IPartyFinderGui PartyFinderGuiHandler { get; private set; } = null!;

/// <summary>
/// Gets service that facilitates interaction with and creation of native toast windows.
/// </summary>
[PluginService]
public static ToastGui ToastGuiHandler { get; private set; } = null!;
public static IToastGui ToastGuiHandler { get; private set; } = null!;

/// <summary>
/// Gets service that handles interaction with the native chat UI.
/// </summary>
[PluginService]
public static ChatGui ChatGuiHandler { get; private set; } = null!;
public static IChatGui ChatGuiHandler { get; private set; } = null!;

/// <summary>
/// Gets service that handles various aspects of the in-game UI.
/// </summary>
[PluginService]
public static GameGui GameGuiHandler { get; private set; } = null!;
public static IGameGui GameGuiHandler { get; private set; } = null!;

/// <summary>
/// Gets service that provides functionality for creating C strings using native game methods.
/// </summary>
[PluginService]
public static LibcFunction LibcFunctionHandler { get; private set; } = null!;
public static ILibcFunction LibcFunctionHandler { get; private set; } = null!;

/// <summary>
/// Gets service that handles interaction with game network events.
/// </summary>
[PluginService]
public static GameNetwork GameNetworkHandler { get; private set; } = null!;

/// <summary>
/// Gets service that provides access to chat events and public helper functions.
/// </summary>
[PluginService]
public static ChatHandlers ChatHandler { get; private set; } = null!;
public static IGameNetwork GameNetworkHandler { get; private set; } = null!;

/// <summary>
/// Gets service that represents the game client's Framework, providing access to various subsystems.
/// </summary>
[PluginService]
public static Framework GameFramework { get; private set; } = null!;
public static IFramework GameFramework { get; private set; } = null!;

/// <summary>
/// Gets service that facilitates searching for memory signatures in a given ProcessModule.
/// </summary>
[PluginService]
public static SigScanner SignatureScanner { get; private set; } = null!;
public static ISigScanner SignatureScanner { get; private set; } = null!;

/// <summary>
/// Gets service that manages elements in the title screen menu.
/// </summary>
[PluginService]
public static TitleScreenMenu TitleScreenMenuHandler { get; private set; } = null!;
public static ITitleScreenMenu TitleScreenMenuHandler { get; private set; } = null!;

/// <summary>
/// Gets service that represents the state of the currently occupied duty.
/// </summary>
[PluginService]
public static DutyState DutyStateHandler { get; private set; } = null!;
public static IDutyState DutyStateHandler { get; private set; } = null!;

/// <summary>
/// Gets service that acts as an interface to various objects required for interaction with Dalamud and the game.
/// </summary>
[PluginService]
public static DalamudPluginInterface PluginInterface { get; private set; } = null!;

/// <summary>
/// Gets or sets service that provides access to the Dalamud plugin logger.
/// </summary>
[PluginService]
public static IPluginLog PluginLog { get; set; } = null!;

/// <summary>
/// Gets or sets service that provides access to game data for Dalamud and plugins.
/// </summary>
[PluginService]
private static DataManager DalamudDataManager { get; set; } = null!;
private static IDataManager DalamudDataManager { get; set; } = null!;

/// <summary>
/// Gets or sets the collection of player targets.
/// </summary>
[PluginService]
private static TargetManager DalamudTargetManager { get; set; } = null!;
private static ITargetManager DalamudTargetManager { get; set; } = null!;

/// <summary>
/// Initialize dalamud context with dalamud and custom services.
Expand All @@ -250,7 +230,7 @@ public static bool Initialize(DalamudPluginInterface pluginInterface)
}
catch (Exception ex)
{
PluginLog.LogError(ex, "Failed to initialize dalamud context");
PluginLog.Error(ex, "Failed to initialize dalamud context");
return false;
}
}
Expand All @@ -269,7 +249,7 @@ public static void Dispose()
}
catch (Exception ex)
{
PluginLog.LogError(ex, "Failed to dispose DalamudContext properly.");
PluginLog.Error(ex, "Failed to dispose DalamudContext properly.");
}
}
}
Loading

0 comments on commit eda420f

Please sign in to comment.