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

Commit

Permalink
fix: more updates for D9 API
Browse files Browse the repository at this point in the history
  • Loading branch information
cecilia-sanare committed Jun 6, 2024
1 parent 0f8abf2 commit 96992f1
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 17 deletions.
Binary file modified !Dist/latest.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion Puppets/Puppets.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</PropertyGroup>

<PropertyGroup>
<TargetFramework>net7.0-windows</TargetFramework>
<TargetFramework>net8.0-windows</TargetFramework>
<Platforms>x64</Platforms>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
Expand Down
4 changes: 2 additions & 2 deletions Puppets/Puppets.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"Punchline": "Simple emote syncing!",
"Tags": [ "Emote", "Syncing" ],
"InternalName": "Puppets",
"AssemblyVersion": "1.2.1.2",
"TestingAssemblyVersion": "1.2.1.2",
"AssemblyVersion": "1.2.1.3",
"TestingAssemblyVersion": "1.2.1.3",
"IconUrl": "https://raw.githubusercontent.com/ribbon-studios/Puppets/main/images/icon.png",
"RepoUrl": "https://github.com/ribbon-studios/Puppets",
"ApplicableVersion": "any",
Expand Down
41 changes: 31 additions & 10 deletions Puppets/PuppetsPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@
using Dalamud.Game.Gui;
using Dalamud.Game.Text;
using Dalamud.Game.Text.SeStringHandling;
using Dalamud.Interface.ImGuiNotification;
using Dalamud.Interface.Internal.Notifications;
using Dalamud.IoC;
using Dalamud.Plugin;
using Dalamud.Plugin.Services;
using Puppets.Constants;
using Puppets.Models;
using Puppets.SeFunctions;
Expand All @@ -27,13 +30,15 @@ public sealed class PuppetsPlugin : IDalamudPlugin
private const string PuppetMasterCommand = "/pm";

#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
[PluginService] public static DataManager Data { get; private set; }
[PluginService] public static ClientState ClientState { get; private set; }
[PluginService] public static PartyList PartyList { get; private set; }
[PluginService] public static IDataManager Data { get; private set; }
[PluginService] public static IClientState ClientState { get; private set; }
[PluginService] public static IPartyList PartyList { get; private set; }
[PluginService] public static DalamudPluginInterface PluginInterface { get; private set; }
[PluginService] public static CommandManager CommandManager { get; private set; }
[PluginService] public static ChatGui ChatGui { get; private set; }
[PluginService] public static ICommandManager CommandManager { get; private set; }
[PluginService] public static IChatGui ChatGui { get; private set; }
[PluginService] public static SigScanner TargetScanner { get; private set; }
[PluginService] public static IPluginLog PluginLog { get; private set; }
[PluginService] public static INotificationManager NotificationManager { get; private set; }
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.

private static Configuration? _configuration;
Expand All @@ -54,7 +59,7 @@ public static Configuration Configuration

public PuppetsPlugin()
{
this.Common = new XivCommonBase(Hooks.None);
this.Common = new XivCommonBase(PluginInterface, Hooks.None);

// you might normally want to embed resources and load them from the manifest stream
this.PluginUi = new PluginUI();
Expand Down Expand Up @@ -123,19 +128,35 @@ private void OnPuppetMasterCommand(string command, string args)

if (Configuration.GetDebugMode() is not DebugMode.Echo and not DebugMode.EchoNoEmote && CharacterUtils.IsNotOwner)
{
PuppetsPlugin.PluginInterface.UiBuilder.AddNotification("Only a puppet master may execute emotes!", "Puppets", Dalamud.Interface.Internal.Notifications.NotificationType.Warning);
NotificationManager.AddNotification(new Notification {
Title = "Puppets",
Content = "Only a puppet master may execute emotes!",
Type = NotificationType.Warning
});
}
else if (Emotes.isInvalidEmote(emote))
{
PuppetsPlugin.PluginInterface.UiBuilder.AddNotification("The provided emote does not exist (" + emote + ")", "Puppets", Dalamud.Interface.Internal.Notifications.NotificationType.Error);
NotificationManager.AddNotification(new Notification {
Title = "Puppets",
Content = $"The provided emote does not exist ({emote})",
Type = NotificationType.Error
});
}
else if (Emotes.isNotUnlockedEmote(emote))
{
PuppetsPlugin.PluginInterface.UiBuilder.AddNotification("The provided emote is not unlocked (" + emote + ")", "Puppets", Dalamud.Interface.Internal.Notifications.NotificationType.Warning);
NotificationManager.AddNotification(new Notification {
Title = "Puppets",
Content = $"The provided emote is not unlocked ({emote})",
Type = NotificationType.Warning
});
}
else if (Configuration.GetDebugMode() is not DebugMode.Echo and not DebugMode.EchoNoEmote && CharacterUtils.NotInParty)
{
PuppetsPlugin.PluginInterface.UiBuilder.AddNotification("You must be in a party to use puppets!", "Puppets", Dalamud.Interface.Internal.Notifications.NotificationType.Warning);
NotificationManager.AddNotification(new Notification {
Title = "Puppets",
Content = "You must be in a party to use puppets!",
Type = NotificationType.Warning
});
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion Puppets/Utils/Emotes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ private static IsEmoteUnlockedDelegate? _isEmoteUnlocked
{
if (PuppetsPlugin.TargetScanner.TryScanText("E8 ?? ?? ?? ?? 84 C0 74 A4", out var emoteUnlockedPtr))
{
PluginLog.Information($"emoteUnlockedPtr: {emoteUnlockedPtr:X}");
PuppetsPlugin.PluginLog.Information($"emoteUnlockedPtr: {emoteUnlockedPtr:X}");
Emotes.__isEmoteUnlocked = Marshal.GetDelegateForFunctionPointer<IsEmoteUnlockedDelegate>(emoteUnlockedPtr);
}
}
Expand Down
4 changes: 2 additions & 2 deletions repo.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"Punchline": "Simple emote syncing!",
"Tags": [ "Emote", "Syncing" ],
"InternalName": "Puppets",
"AssemblyVersion": "1.2.1.2",
"TestingAssemblyVersion": "1.2.1.2",
"AssemblyVersion": "1.2.1.3",
"TestingAssemblyVersion": "1.2.1.3",
"IconUrl": "https://raw.githubusercontent.com/ribbon-studios/Puppets/main/images/icon.png",
"RepoUrl": "https://github.com/ribbon-studios/Puppets",
"ApplicableVersion": "any",
Expand Down
2 changes: 1 addition & 1 deletion shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
default = pkgs.mkShell {
nativeBuildInputs = with pkgs.buildPackages; [
nodejs_18
dotnet-sdk_7
dotnet-sdk_8
];
};
}

0 comments on commit 96992f1

Please sign in to comment.