Compare commits

...

7 Commits

Author SHA1 Message Date
Anna 1ab389256b
chore: bump version to 1.18.10 2023-10-17 22:11:24 -04:00
Anna 357bc2bb6f
refactor: use new plugin log 2023-10-14 19:32:10 -04:00
Anna 45fe83f1b0
fix: make dalamud link handlers work again 2023-10-14 19:32:01 -04:00
Anna 5094e70e7e
chore: bump version to 1.18.9 2023-10-03 17:34:22 -04:00
Anna a9a1570bc3
chore: update XivCommon 2023-10-03 17:34:10 -04:00
Anna 84a13e6972
fix: update signature 2023-10-03 03:47:54 -04:00
Anna c9cd28589b
refactor: update for api 9 2023-10-03 02:59:51 -04:00
20 changed files with 129 additions and 124 deletions

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Version>1.18.8</Version>
<Version>1.18.10</Version>
<TargetFramework>net7.0-windows</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
@ -39,10 +39,6 @@
<HintPath>$(DalamudLibPath)\ImGui.NET.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="ImGuiScene">
<HintPath>$(DalamudLibPath)\ImGuiScene.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="Lumina">
<HintPath>$(DalamudLibPath)\Lumina.dll</HintPath>
<Private>false</Private>
@ -54,11 +50,11 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="DalamudPackager" Version="2.1.10"/>
<PackageReference Include="LiteDB" Version="5.0.15"/>
<PackageReference Include="Pidgin" Version="3.2.1"/>
<PackageReference Include="DalamudPackager" Version="2.1.12"/>
<PackageReference Include="LiteDB" Version="5.0.17"/>
<PackageReference Include="Pidgin" Version="3.2.2"/>
<PackageReference Include="SharpDX.Direct2D1" Version="4.2.0"/>
<PackageReference Include="XivCommon" Version="7.0.0-alpha.1"/>
<PackageReference Include="XivCommon" Version="9.0.0"/>
</ItemGroup>
<ItemGroup>

View File

@ -1,4 +1,4 @@
using Dalamud.Data;
using Dalamud.Plugin.Services;
using Lumina.Excel.GeneratedSheets;
namespace ChatTwo.Code;
@ -82,7 +82,7 @@ internal static class InputChannelExt {
_ => "",
};
public static IEnumerable<TextCommand>? TextCommands(this InputChannel channel, DataManager data) {
public static IEnumerable<TextCommand>? TextCommands(this InputChannel channel, IDataManager data) {
var ids = channel switch {
InputChannel.Tell => new uint[] { 104, 118 },
InputChannel.Say => new uint[] { 102 },

View File

@ -1,5 +1,4 @@
using Dalamud.Game.Command;
using Dalamud.Logging;
namespace ChatTwo;
@ -45,14 +44,14 @@ internal sealed class Commands : IDisposable {
private void Invoke(string command, string arguments) {
if (!this.Registered.TryGetValue(command, out var wrapper)) {
PluginLog.Warning($"Missing registration for command {command}");
Plugin.Log.Warning($"Missing registration for command {command}");
return;
}
try {
wrapper.Invoke(command, arguments);
} catch (Exception ex) {
PluginLog.Error(ex, $"Error while executing command {command}");
Plugin.Log.Error(ex, $"Error while executing command {command}");
}
}
}

View File

@ -2,7 +2,6 @@ using ChatTwo.Code;
using ChatTwo.Resources;
using ChatTwo.Ui;
using Dalamud.Configuration;
using Dalamud.Logging;
using ImGuiNET;
namespace ChatTwo;
@ -124,7 +123,7 @@ internal class Configuration : IPluginConfiguration {
break;
default:
PluginLog.Warning($"Couldn't migrate config version {this.Version}");
Plugin.Log.Warning($"Couldn't migrate config version {this.Version}");
loop = false;
break;
}

View File

@ -3,10 +3,11 @@ using ChatTwo.Code;
using ChatTwo.GameFunctions.Types;
using ChatTwo.Util;
using Dalamud.Game.ClientState.Keys;
using Dalamud.Game.Config;
using Dalamud.Game.Text.SeStringHandling;
using Dalamud.Hooking;
using Dalamud.Logging;
using Dalamud.Memory;
using Dalamud.Plugin.Services;
using Dalamud.Utility.Signatures;
using FFXIVClientStructs.FFXIV.Client.System.Framework;
using FFXIVClientStructs.FFXIV.Client.System.Memory;
@ -142,7 +143,7 @@ internal sealed unsafe class Chat : IDisposable {
internal Chat(Plugin plugin) {
this.Plugin = plugin;
SignatureHelper.Initialise(this);
this.Plugin.GameInteropProvider.InitializeFromAttributes(this);
this.ChatLogRefreshHook?.Enable();
this.ChangeChannelNameHook?.Enable();
@ -151,7 +152,7 @@ internal sealed unsafe class Chat : IDisposable {
this.Plugin.Framework.Update += this.InterceptKeybinds;
this.Plugin.ClientState.Login += this.Login;
this.Login(null, null);
this.Login();
}
public void Dispose() {
@ -368,7 +369,7 @@ internal sealed unsafe class Chat : IDisposable {
}
}
private void InterceptKeybinds(Dalamud.Game.Framework framework) {
private void InterceptKeybinds(IFramework framework1) {
this.CheckFocus();
this.UpdateKeybinds();
@ -430,12 +431,12 @@ internal sealed unsafe class Chat : IDisposable {
TellReason = TellReason.Reply,
});
} catch (Exception ex) {
PluginLog.LogError(ex, "Error in chat Activated event");
Plugin.Log.Error(ex, "Error in chat Activated event");
}
}
}
private void Login(object? sender, EventArgs? e) {
private void Login() {
if (this.ChangeChannelNameHook == null) {
return;
}
@ -454,10 +455,8 @@ internal sealed unsafe class Chat : IDisposable {
}
string? input = null;
var option = Framework.Instance()->GetUiModule()->GetConfigModule()->GetValue(ConfigOption.DirectChat);
if (option != null) {
var directChat = option->Int > 0;
if (directChat && this._currentCharacter != null) {
if (this.Plugin.GameConfig.TryGet(UiControlOption.DirectChat, out bool option) && option) {
if (this._currentCharacter != null) {
// FIXME: this whole system sucks
var c = *this._currentCharacter;
if (c != '\0' && !char.IsControl(c)) {
@ -483,7 +482,7 @@ internal sealed unsafe class Chat : IDisposable {
};
this.Activated?.Invoke(args);
} catch (Exception ex) {
PluginLog.LogError(ex, "Error in chat Activated event");
Plugin.Log.Error(ex, "Error in chat Activated event");
}
// prevent the game from focusing the chat log
@ -566,7 +565,7 @@ internal sealed unsafe class Chat : IDisposable {
TellTarget = target,
});
} catch (Exception ex) {
PluginLog.LogError(ex, "Error in chat Activated event");
Plugin.Log.Error(ex, "Error in chat Activated event");
}
}
@ -592,7 +591,7 @@ internal sealed unsafe class Chat : IDisposable {
idx = 0;
}
this._changeChatChannel(RaptureShellModule.Instance, (int) channel, idx, target, 1);
this._changeChatChannel(RaptureShellModule.Instance(), (int) channel, idx, target, 1);
target->Dtor();
IMemorySpace.Free(target);
}

View File

@ -29,7 +29,7 @@ internal sealed unsafe class Context {
#region Offsets
[Signature(
"FF 90 ?? ?? ?? ?? 8B 93 ?? ?? ?? ?? 48 8B C8 E8 ?? ?? ?? ?? E9 ?? ?? ?? ?? 41 B4 01",
"FF 90 ?? ?? ?? ?? 8B 93 ?? ?? ?? ?? 48 8B C8 E8 ?? ?? ?? ?? 41 0F B6 D4 48 8B CB E8 ?? ?? ?? ?? E9 ?? ?? ?? ?? 48 81 FF ?? ?? ?? ?? 0F 85",
Offset = 2
)]
private readonly int? _searchForRecipesUsingItemVfunc;
@ -40,7 +40,7 @@ internal sealed unsafe class Context {
internal Context(Plugin plugin) {
this.Plugin = plugin;
SignatureHelper.Initialise(this);
this.Plugin.GameInteropProvider.InitializeFromAttributes(this);
}
internal void InviteToNoviceNetwork(string name, ushort world) {

View File

@ -71,7 +71,7 @@ internal unsafe class GameFunctions : IDisposable {
this.Chat = new Chat(this.Plugin);
this.Context = new Context(this.Plugin);
SignatureHelper.Initialise(this);
this.Plugin.GameInteropProvider.InitializeFromAttributes(this);
this.ResolveTextCommandPlaceholderHook?.Enable();
}
@ -207,7 +207,7 @@ internal unsafe class GameFunctions : IDisposable {
// hide addon first to prevent the "addon close" sound
var addon = AtkStage.GetSingleton()->RaptureAtkUnitManager->GetAddonByName("ItemDetail");
if (addon != null) {
addon->Hide(true);
addon->Hide(true, false, 0);
}
var agent = Framework.Instance()->GetUiModule()->GetAgentModule()->GetAgentByInternalId(AgentId.ItemDetail);

View File

@ -26,7 +26,7 @@ internal sealed unsafe class Party {
internal Party(Plugin plugin) {
this.Plugin = plugin;
SignatureHelper.Initialise(this);
this.Plugin.GameInteropProvider.InitializeFromAttributes(this);
}
internal void InviteSameWorld(string name, ushort world, ulong contentId) {

View File

@ -7,11 +7,10 @@ using ChatTwo.Util;
using Dalamud.Game.ClientState.Objects.SubKinds;
using Dalamud.Game.Text.SeStringHandling;
using Dalamud.Game.Text.SeStringHandling.Payloads;
using Dalamud.Interface;
using Dalamud.Logging;
using Dalamud.Interface.Internal;
using Dalamud.Interface.Utility;
using Dalamud.Utility;
using ImGuiNET;
using ImGuiScene;
using Lumina.Excel.GeneratedSheets;
using Action = System.Action;
using DalamudPartyFinderPayload = Dalamud.Game.Text.SeStringHandling.Payloads.PartyFinderPayload;
@ -101,7 +100,7 @@ internal sealed class PayloadHandler {
try {
this.Ui.Plugin.Ipc.Invoke(id, sender, contentId, payload, chunk.Message?.SenderSource, chunk.Message?.ContentSource);
} catch (Exception ex) {
PluginLog.Error(ex, "Error executing integration");
Plugin.Log.Error(ex, "Error executing integration");
}
}
@ -120,7 +119,7 @@ internal sealed class PayloadHandler {
ImGui.Separator();
}
if (!ImGui.BeginMenu(this.Ui.Plugin.Name)) {
if (!ImGui.BeginMenu(Plugin.Name)) {
return;
}
@ -216,7 +215,7 @@ internal sealed class PayloadHandler {
}
}
private static void InlineIcon(TextureWrap icon) {
private static void InlineIcon(IDalamudTextureWrap icon) {
var lineHeight = ImGui.CalcTextSize("A").Y;
var cursor = ImGui.GetCursorPos();
@ -336,16 +335,25 @@ internal sealed class PayloadHandler {
var payloads = source.Payloads.Skip(start).Take(end - start + 1).ToList();
var chatGui = this.Ui.Plugin.ChatGui;
var field = chatGui.GetType().GetField("dalamudLinkHandlers", BindingFlags.Instance | BindingFlags.NonPublic);
if (field == null || field.GetValue(chatGui) is not Dictionary<(string PluginName, uint CommandId), Action<uint, SeString>> dict || !dict.TryGetValue((link.Plugin, link.CommandId), out var action)) {
var chatGuiScoped = this.Ui.Plugin.ChatGui;
var chatGuiService = chatGuiScoped.GetType()
.GetField("chatGuiService", BindingFlags.Instance | BindingFlags.NonPublic)!
.GetValue(chatGuiScoped);
if (chatGuiService == null) {
Plugin.Log.Warning("could not find chatGuiService");
return;
}
var field = chatGuiService.GetType().GetField("dalamudLinkHandlers", BindingFlags.Instance | BindingFlags.NonPublic);
if (field == null || field.GetValue(chatGuiService) is not Dictionary<(string PluginName, uint CommandId), Action<uint, SeString>> dict || !dict.TryGetValue((link.Plugin, link.CommandId), out var action)) {
Plugin.Log.Warning("could not find dalamudLinkHandlers");
return;
}
try {
action(link.CommandId, new SeString(payloads));
} catch (Exception ex) {
PluginLog.LogError(ex, "Error executing DalamudLinkPayload handler");
Plugin.Log.Error(ex, "Error executing DalamudLinkPayload handler");
}
}
@ -531,7 +539,7 @@ internal sealed class PayloadHandler {
}
if (ImGui.Selectable(Language.Context_Target) && this.FindCharacterForPayload(player) is { } obj) {
this.Ui.Plugin.TargetManager.SetTarget(obj);
this.Ui.Plugin.TargetManager.Target = obj;
}
// View Party Finder 0x2E

View File

@ -3,17 +3,10 @@ using System.Globalization;
using ChatTwo.Ipc;
using ChatTwo.Resources;
using ChatTwo.Util;
using Dalamud.Data;
using Dalamud.Game;
using Dalamud.Game.ClientState;
using Dalamud.Game.ClientState.Conditions;
using Dalamud.Game.ClientState.Keys;
using Dalamud.Game.ClientState.Objects;
using Dalamud.Game.ClientState.Party;
using Dalamud.Game.Command;
using Dalamud.Game.Gui;
using Dalamud.IoC;
using Dalamud.Plugin;
using Dalamud.Plugin.Services;
using XivCommon;
namespace ChatTwo;
@ -22,43 +15,55 @@ namespace ChatTwo;
public sealed class Plugin : IDalamudPlugin {
internal const string PluginName = "Chat 2";
public string Name => PluginName;
internal static string Name => PluginName;
[PluginService]
internal static IPluginLog Log { get; private set; }
[PluginService]
internal DalamudPluginInterface Interface { get; init; }
[PluginService]
internal ChatGui ChatGui { get; init; }
internal IChatGui ChatGui { get; init; }
[PluginService]
internal ClientState ClientState { get; init; }
internal IClientState ClientState { get; init; }
[PluginService]
internal CommandManager CommandManager { get; init; }
internal ICommandManager CommandManager { get; init; }
[PluginService]
internal Condition Condition { get; init; }
internal ICondition Condition { get; init; }
[PluginService]
internal DataManager DataManager { get; init; }
internal IDataManager DataManager { get; init; }
[PluginService]
internal Framework Framework { get; init; }
internal IFramework Framework { get; init; }
[PluginService]
internal GameGui GameGui { get; init; }
internal IGameGui GameGui { get; init; }
[PluginService]
internal KeyState KeyState { get; init; }
internal IKeyState KeyState { get; init; }
[PluginService]
internal ObjectTable ObjectTable { get; init; }
internal IObjectTable ObjectTable { get; init; }
[PluginService]
internal PartyList PartyList { get; init; }
internal IPartyList PartyList { get; init; }
[PluginService]
internal TargetManager TargetManager { get; init; }
internal ITargetManager TargetManager { get; init; }
[PluginService]
internal ITextureProvider TextureProvider { get; init; }
[PluginService]
internal IGameInteropProvider GameInteropProvider { get; init; }
[PluginService]
internal IGameConfig GameConfig { get; init; }
internal Configuration Config { get; }
internal Commands Commands { get; }
@ -88,8 +93,8 @@ public sealed class Plugin : IDalamudPlugin {
this.LanguageChanged(this.Interface.UiLanguage);
this.Commands = new Commands(this);
this.Common = new XivCommonBase();
this.TextureCache = new TextureCache(this.DataManager!);
this.Common = new XivCommonBase(this.Interface);
this.TextureCache = new TextureCache(this.TextureProvider!);
this.Functions = new GameFunctions.GameFunctions(this);
this.Store = new Store(this);
this.Ipc = new IpcManager(this.Interface);
@ -143,7 +148,7 @@ public sealed class Plugin : IDalamudPlugin {
"ChatLogPanel_3",
};
private void FrameworkUpdate(Framework framework) {
private void FrameworkUpdate(IFramework framework) {
if (this.DeferredSaveFrames >= 0 && this.DeferredSaveFrames-- == 0) {
this.SaveConfig();
}

View File

@ -3,7 +3,6 @@ using System.Runtime.InteropServices;
using ChatTwo.Ui;
using Dalamud.Interface;
using Dalamud.Interface.GameFonts;
using Dalamud.Logging;
using ImGuiNET;
namespace ChatTwo;
@ -151,7 +150,7 @@ internal sealed class PluginUi : IDisposable {
try {
component.Draw();
} catch (Exception ex) {
PluginLog.LogError(ex, "Error drawing component");
Plugin.Log.Error(ex, "Error drawing component");
}
}

View File

@ -4,10 +4,9 @@ using System.Numerics;
using ChatTwo.Code;
using ChatTwo.Resources;
using ChatTwo.Util;
using Dalamud.Game;
using Dalamud.Game.Text;
using Dalamud.Game.Text.SeStringHandling;
using Dalamud.Logging;
using Dalamud.Plugin.Services;
using ImGuiNET;
using LiteDB;
using Lumina.Excel.GeneratedSheets;
@ -177,18 +176,18 @@ internal class Store : IDisposable {
this.Database = this.Connect();
}
private void Logout(object? sender, EventArgs eventArgs) {
private void Logout() {
this.LastContentId = 0;
}
private void UpdateReceiver(Framework framework) {
private void UpdateReceiver(IFramework framework) {
var contentId = this.Plugin.ClientState.LocalContentId;
if (contentId != 0) {
this.LastContentId = contentId;
}
}
private void GetMessageInfo(Framework framework) {
private void GetMessageInfo(IFramework framework) {
if (this.CheckpointTimer.Elapsed > TimeSpan.FromMinutes(5)) {
this.CheckpointTimer.Restart();
new Thread(() => this.Database.Checkpoint()).Start();
@ -210,7 +209,7 @@ internal class Store : IDisposable {
private void MigrateDraw() {
ImGui.SetNextWindowSizeConstraints(new Vector2(450, 0), new Vector2(450, float.MaxValue));
if (!ImGui.Begin($"{this.Plugin.Name}##migration-window", ImGuiWindowFlags.AlwaysAutoResize)) {
if (!ImGui.Begin($"{Plugin.Name}##migration-window", ImGuiWindowFlags.AlwaysAutoResize)) {
ImGui.End();
return;
}
@ -250,7 +249,7 @@ internal class Store : IDisposable {
var lastId = ObjectId.Empty;
for (var i = 0; i < rounds; i++) {
this._migrateCurrent = i + 1;
PluginLog.Log($"Update round {i + 1}/{rounds}");
Plugin.Log.Info($"Update round {i + 1}/{rounds}");
var messages = this.Messages.Query()
.OrderBy(msg => msg.Id)
.Where(msg => msg.Id > lastId)

View File

@ -1,22 +1,22 @@
using Dalamud.Data;
using ImGuiScene;
using Dalamud.Interface.Internal;
using Dalamud.Plugin.Services;
using Lumina.Excel.GeneratedSheets;
namespace ChatTwo;
internal class TextureCache : IDisposable {
private DataManager Data { get; }
private ITextureProvider TextureProvider { get; }
private readonly Dictionary<(uint, bool), TextureWrap> _itemIcons = new();
private readonly Dictionary<(uint, bool), TextureWrap> _statusIcons = new();
private readonly Dictionary<(uint, bool), TextureWrap> _eventItemIcons = new();
private readonly Dictionary<(uint, bool), IDalamudTextureWrap> _itemIcons = new();
private readonly Dictionary<(uint, bool), IDalamudTextureWrap> _statusIcons = new();
private readonly Dictionary<(uint, bool), IDalamudTextureWrap> _eventItemIcons = new();
internal IReadOnlyDictionary<(uint, bool), TextureWrap> ItemIcons => this._itemIcons;
internal IReadOnlyDictionary<(uint, bool), TextureWrap> StatusIcons => this._statusIcons;
internal IReadOnlyDictionary<(uint, bool), TextureWrap> EventItemIcons => this._eventItemIcons;
internal IReadOnlyDictionary<(uint, bool), IDalamudTextureWrap> ItemIcons => this._itemIcons;
internal IReadOnlyDictionary<(uint, bool), IDalamudTextureWrap> StatusIcons => this._statusIcons;
internal IReadOnlyDictionary<(uint, bool), IDalamudTextureWrap> EventItemIcons => this._eventItemIcons;
internal TextureCache(DataManager data) {
this.Data = data;
internal TextureCache(ITextureProvider textureProvider) {
this.TextureProvider = textureProvider;
}
public void Dispose() {
@ -28,14 +28,14 @@ internal class TextureCache : IDisposable {
}
}
private void AddIcon(IDictionary<(uint, bool), TextureWrap> dict, uint icon, bool hq = false) {
private void AddIcon(IDictionary<(uint, bool), IDalamudTextureWrap> dict, uint icon, bool hq = false) {
if (dict.ContainsKey((icon, hq))) {
return;
}
var tex = hq
? this.Data.GetImGuiTextureHqIcon(icon)
: this.Data.GetImGuiTextureIcon(icon);
? this.TextureProvider.GetIcon(icon, ITextureProvider.IconFlags.ItemHighQuality)
: this.TextureProvider.GetIcon(icon);
if (tex != null) {
dict[(icon, hq)] = tex;
}
@ -53,19 +53,19 @@ internal class TextureCache : IDisposable {
this.AddIcon(this._eventItemIcons, item.Icon);
}
internal TextureWrap? GetItem(Item item, bool hq = false) {
internal IDalamudTextureWrap? GetItem(Item item, bool hq = false) {
this.AddItem(item, hq);
this.ItemIcons.TryGetValue((item.Icon, hq), out var icon);
return icon;
}
internal TextureWrap? GetStatus(Status status) {
internal IDalamudTextureWrap? GetStatus(Status status) {
this.AddStatus(status);
this.StatusIcons.TryGetValue((status.Icon, false), out var icon);
return icon;
}
internal TextureWrap? GetEventItem(EventItem item) {
internal IDalamudTextureWrap? GetEventItem(EventItem item) {
this.AddEventItem(item);
this.EventItemIcons.TryGetValue((item.Icon, false), out var icon);
return icon;

View File

@ -11,10 +11,10 @@ using Dalamud.Game.ClientState.Keys;
using Dalamud.Game.Text.SeStringHandling;
using Dalamud.Game.Text.SeStringHandling.Payloads;
using Dalamud.Interface;
using Dalamud.Logging;
using Dalamud.Interface.Internal;
using Dalamud.Interface.Utility;
using Dalamud.Memory;
using ImGuiNET;
using ImGuiScene;
using Lumina.Excel.GeneratedSheets;
namespace ChatTwo.Ui;
@ -28,7 +28,7 @@ internal sealed class ChatLog : IUiComponent {
internal bool Activate;
private int _activatePos = -1;
internal string Chat = string.Empty;
private readonly TextureWrap? _fontIcon;
private readonly IDalamudTextureWrap? _fontIcon;
private readonly List<string> _inputBacklog = new();
private int _inputBacklogIdx = -1;
internal int LastTab { get; private set; }
@ -62,7 +62,7 @@ internal sealed class ChatLog : IUiComponent {
this.Ui.Plugin.Commands.Register("/clearlog2", "Clear the Chat 2 chat log").Execute += this.ClearLog;
this.Ui.Plugin.Commands.Register("/chat2").Execute += this.ToggleChat;
this._fontIcon = this.Ui.Plugin.DataManager.GetImGuiTexture("common/font/fonticon_ps5.tex");
this._fontIcon = this.Ui.Plugin.TextureProvider.GetTextureFromGame("common/font/fonticon_ps5.tex");
this.Ui.Plugin.Functions.Chat.Activated += this.Activated;
this.Ui.Plugin.ClientState.Login += this.Login;
@ -78,13 +78,13 @@ internal sealed class ChatLog : IUiComponent {
this.Ui.Plugin.Commands.Register("/clearlog2").Execute -= this.ClearLog;
}
private void Logout(object? sender, EventArgs e) {
private void Logout() {
foreach (var tab in this.Ui.Plugin.Config.Tabs) {
tab.Clear();
}
}
private void Login(object? sender, EventArgs e) {
private void Login() {
this.Ui.Plugin.Store.FilterAllTabs(false);
}
@ -327,7 +327,7 @@ internal sealed class ChatLog : IUiComponent {
TellReason = reason,
});
} catch (Exception ex) {
PluginLog.LogError(ex, "Error in chat Activated event");
Plugin.Log.Error(ex, "Error in chat Activated event");
}
}
}
@ -415,7 +415,7 @@ internal sealed class ChatLog : IUiComponent {
ImGui.SetNextWindowSize(new Vector2(500, 250) * ImGuiHelpers.GlobalScale, ImGuiCond.FirstUseEver);
if (!ImGui.Begin($"{this.Ui.Plugin.Name}###chat2", flags)) {
if (!ImGui.Begin($"{Plugin.Name}###chat2", flags)) {
this._lastViewport = ImGui.GetWindowViewport().NativePtr;
this._wasDocked = ImGui.IsWindowDocked();
ImGui.End();

View File

@ -1,6 +1,6 @@
using System.Numerics;
using ChatTwo.Util;
using Dalamud.Interface;
using Dalamud.Interface.Utility;
using Dalamud.Utility;
using ImGuiNET;
using Lumina.Excel.GeneratedSheets;

View File

@ -3,7 +3,7 @@ using System.Numerics;
using ChatTwo.Resources;
using ChatTwo.Ui.SettingsTabs;
using ChatTwo.Util;
using Dalamud.Interface;
using Dalamud.Interface.Utility;
using ImGuiNET;
namespace ChatTwo.Ui;
@ -61,7 +61,7 @@ internal sealed class Settings : IUiComponent {
ImGui.SetNextWindowSize(new Vector2(475, 600) * ImGuiHelpers.GlobalScale, ImGuiCond.FirstUseEver);
var name = string.Format(Language.Settings_Title, this.Ui.Plugin.Name);
var name = string.Format(Language.Settings_Title, Plugin.Name);
if (!ImGui.Begin($"{name}###chat2-settings", ref this.Ui.SettingsVisible, ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoScrollWithMouse)) {
ImGui.End();
return;
@ -117,7 +117,7 @@ internal sealed class Settings : IUiComponent {
this.Ui.SettingsVisible = false;
}
var buttonLabel = string.Format(Language.Settings_Kofi, this.Ui.Plugin.Name);
var buttonLabel = string.Format(Language.Settings_Kofi, Plugin.Name);
ImGui.PushStyleColor(ImGuiCol.Button, ColourUtil.RgbaToAbgr(0xFF5E5BFF));
ImGui.PushStyleColor(ImGuiCol.ButtonHovered, ColourUtil.RgbaToAbgr(0xFF7775FF));

View File

@ -23,10 +23,10 @@ internal sealed class ChatColours : ISettingsTab {
.ToHashSet();
var total = Enum.GetValues<ChatType>().Where(type => !type.IsGm()).ToHashSet();
if (sortable.Count != total.Count) {
Dalamud.Logging.PluginLog.Warning($"There are {sortable.Count} sortable channels, but there are {total.Count} total channels.");
Dalamud.Logging.Plugin.Log.Warning($"There are {sortable.Count} sortable channels, but there are {total.Count} total channels.");
total.ExceptWith(sortable);
foreach (var missing in total) {
Dalamud.Logging.PluginLog.Log($"Missing {missing}");
Dalamud.Logging.Plugin.Log.Log($"Missing {missing}");
}
}
#endif

View File

@ -1,9 +1,9 @@
using System.Runtime.InteropServices;
using System.Text;
using Dalamud;
using Dalamud.Data;
using Dalamud.Game.Text.SeStringHandling;
using Dalamud.Game.Text.SeStringHandling.Payloads;
using Dalamud.Plugin.Services;
using Dalamud.Utility;
using Lumina.Excel;
using Lumina.Excel.GeneratedSheets;
@ -89,7 +89,7 @@ internal static class AutoTranslate {
return string.Join("", payloads);
}
private static List<AutoTranslateEntry> AllEntries(DataManager data) {
private static List<AutoTranslateEntry> AllEntries(IDataManager data) {
if (Entries.TryGetValue(data.Language, out var entries)) {
return entries;
}
@ -197,7 +197,7 @@ internal static class AutoTranslate {
return list;
}
internal static List<AutoTranslateEntry> Matching(DataManager data, string prefix, bool sort) {
internal static List<AutoTranslateEntry> Matching(IDataManager data, string prefix, bool sort) {
var wholeMatches = new List<AutoTranslateEntry>();
var prefixMatches = new List<AutoTranslateEntry>();
var otherMatches = new List<AutoTranslateEntry>();
@ -227,7 +227,7 @@ internal static class AutoTranslate {
[DllImport("msvcrt.dll", CallingConvention = CallingConvention.Cdecl)]
private static extern int memcmp(byte[] b1, byte[] b2, UIntPtr count);
internal static void ReplaceWithPayload(DataManager data, ref byte[] bytes) {
internal static void ReplaceWithPayload(IDataManager data, ref byte[] bytes) {
var search = Encoding.UTF8.GetBytes("<at:");
if (bytes.Length <= search.Length) {
return;

View File

@ -4,6 +4,7 @@ using Dalamud.Game.ClientState.Keys;
using Dalamud.Game.Text.SeStringHandling;
using Dalamud.Interface;
using Dalamud.Interface.Style;
using Dalamud.Interface.Utility;
using ImGuiNET;
namespace ChatTwo.Util;

24
ChatTwo/packages.lock.json Executable file → Normal file
View File

@ -4,21 +4,21 @@
"net7.0-windows7.0": {
"DalamudPackager": {
"type": "Direct",
"requested": "[2.1.10, )",
"resolved": "2.1.10",
"contentHash": "S6NrvvOnLgT4GDdgwuKVJjbFo+8ZEj+JsEYk9ojjOR/MMfv1dIFpT8aRJQfI24rtDcw1uF+GnSSMN4WW1yt7fw=="
"requested": "[2.1.12, )",
"resolved": "2.1.12",
"contentHash": "Sc0PVxvgg4NQjcI8n10/VfUQBAS4O+Fw2pZrAqBdRMbthYGeogzu5+xmIGCGmsEZ/ukMOBuAqiNiB5qA3MRalg=="
},
"LiteDB": {
"type": "Direct",
"requested": "[5.0.15, )",
"resolved": "5.0.15",
"contentHash": "nucyfCOGSATH553BxplxExP3BOqEwmHt0B57426EIaQjD3CC1Odb52VVCGgTxyYaD2oe3B/cJk8jDo6XiBJqPg=="
"requested": "[5.0.17, )",
"resolved": "5.0.17",
"contentHash": "cKPvkdlzIts3ZKu/BzoIc/Y71e4VFKlij4LyioPFATZMot+wB7EAm1FFbZSJez6coJmQUoIg/3yHE1MMU+zOdg=="
},
"Pidgin": {
"type": "Direct",
"requested": "[3.2.1, )",
"resolved": "3.2.1",
"contentHash": "Jl7OaTEcyMxh4bCLTyh8Tnk0Efwd4hIYvszaLkFhU6oDIa7rdZF1s9f1MAvC4xyevzGwR8ZmVTQwoDyih6/66A=="
"requested": "[3.2.2, )",
"resolved": "3.2.2",
"contentHash": "imvuRt8fzxJCJs9kCk7s418NRyEdP6aDtz2qL9XYcn1ywTkpnrSq4IORVTQ879HNoTfJkyGkFadmEoCZEsebGg=="
},
"SharpDX.Direct2D1": {
"type": "Direct",
@ -33,9 +33,9 @@
},
"XivCommon": {
"type": "Direct",
"requested": "[7.0.0-alpha.1, )",
"resolved": "7.0.0-alpha.1",
"contentHash": "4Yy4Wg3bnI/g9BSEYAqOZALmVMJZS0wcP847VlUIThBqIS/47O6tw2BI84he4KuPSTfIsYOzrcz3vAia8+Pn3g=="
"requested": "[9.0.0, )",
"resolved": "9.0.0",
"contentHash": "avaBp3FmSCi/PiQhntCeBDYOHejdyTWmFtz4pRBVQQ8vHkmRx+YTk1la9dkYBMlXxRXKckEdH1iI1Fu61JlE7w=="
},
"Microsoft.NETCore.Platforms": {
"type": "Transitive",