5 Commits

Author SHA1 Message Date
75f88d5104 Potential fix for Honorific throwing away data. Still testing efficacy.
All checks were successful
Build and Update Repo / build-and-update-repo (push) Successful in 1m13s
2025-09-24 20:37:12 +01:00
51004f3017 Update syncshell chat.
All checks were successful
Build and Update Repo / build-and-update-repo (push) Successful in 1m12s
Update /ss to /ps
Remove whitespaces from sending in syncshell chat.
2025-09-21 17:39:40 +01:00
60c1668492 1.7.1.2
All checks were successful
Build and Update Repo / build-and-update-repo (push) Successful in 1m9s
2025-09-14 01:09:29 +01:00
4f07dba409 Update check for other clients to correctly find Snowcloak. 2025-09-12 19:42:13 +01:00
003fc77628 Update workflows. 2025-09-12 19:41:41 +01:00
10 changed files with 77 additions and 31 deletions

View File

@@ -1,4 +1,4 @@
name: Release name: Build and Update Repo
on: on:
push: push:
@@ -10,7 +10,7 @@ env:
DOTNET_VERSION: 9.x DOTNET_VERSION: 9.x
jobs: jobs:
tag-and-release: build-and-update-repo:
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
contents: write contents: write
@@ -79,7 +79,9 @@ jobs:
if .InternalName == $internalName if .InternalName == $internalName
then then
.DalamudApiLevel = $dalamudApiLevel .DalamudApiLevel = $dalamudApiLevel
| .TestingDalamudApiLevel = $dalamudApiLevel
| .AssemblyVersion = $version | .AssemblyVersion = $version
| .TestingAssemblyVersion = $version
| .DownloadLinkInstall = $downloadUrl | .DownloadLinkInstall = $downloadUrl
| .DownloadLinkTesting = $downloadUrl | .DownloadLinkTesting = $downloadUrl
| .DownloadLinkUpdate = $downloadUrl | .DownloadLinkUpdate = $downloadUrl

View File

@@ -3,6 +3,7 @@ using Dalamud.Game.Text.SeStringHandling.Payloads;
using Dalamud.Hooking; using Dalamud.Hooking;
using Dalamud.Memory; using Dalamud.Memory;
using Dalamud.Plugin.Services; using Dalamud.Plugin.Services;
using Dalamud.Utility;
using Dalamud.Utility.Signatures; using Dalamud.Utility.Signatures;
using FFXIVClientStructs.FFXIV.Client.System.String; using FFXIVClientStructs.FFXIV.Client.System.String;
using FFXIVClientStructs.FFXIV.Client.UI; using FFXIVClientStructs.FFXIV.Client.UI;
@@ -26,7 +27,7 @@ public unsafe sealed class GameChatHooks : IDisposable
// Based on https://git.anna.lgbt/anna/ExtraChat/src/branch/main/client/ExtraChat/GameFunctions.cs // Based on https://git.anna.lgbt/anna/ExtraChat/src/branch/main/client/ExtraChat/GameFunctions.cs
private readonly ILogger<GameChatHooks> _logger; private readonly ILogger<GameChatHooks> _logger;
private readonly Action<int, byte[]> _ssCommandHandler; private readonly Action<int, byte[]> _psCommandHandler;
#region signatures #region signatures
#pragma warning disable CS0649 #pragma warning disable CS0649
@@ -130,10 +131,10 @@ public unsafe sealed class GameChatHooks : IDisposable
} }
} }
public GameChatHooks(ILogger<GameChatHooks> logger, IGameInteropProvider gameInteropProvider, Action<int, byte[]> ssCommandHandler) public GameChatHooks(ILogger<GameChatHooks> logger, IGameInteropProvider gameInteropProvider, Action<int, byte[]> psCommandHandler)
{ {
_logger = logger; _logger = logger;
_ssCommandHandler = ssCommandHandler; _psCommandHandler = psCommandHandler;
logger.LogInformation("Initializing GameChatHooks"); logger.LogInformation("Initializing GameChatHooks");
gameInteropProvider.InitializeFromAttributes(this); gameInteropProvider.InitializeFromAttributes(this);
@@ -209,20 +210,42 @@ public unsafe sealed class GameChatHooks : IDisposable
if (isReply) if (isReply)
_nextMessageIsReply = utcNow + TimeSpan.FromMilliseconds(100); _nextMessageIsReply = utcNow + TimeSpan.FromMilliseconds(100);
// If it is a command, check if it begins with /ss first so we can handle the message directly // If it is a command, check if it begins with /ps first so we can handle the message directly
// Letting Dalamud handle the commands causes all of the special payloads to be dropped // Letting Dalamud handle the commands causes all of the special payloads to be dropped
if (isCommand && messageSpan.StartsWith(System.Text.Encoding.ASCII.GetBytes("/ss"))) if (isCommand && messageSpan.StartsWith(System.Text.Encoding.ASCII.GetBytes("/ps")))
{ {
for (int i = 1; i <= ChatService.CommandMaxNumber; ++i) for (int i = 1; i <= ChatService.CommandMaxNumber; ++i)
{ {
var cmdString = $"/ss{i} "; var cmdString = $"/ps{i} ";
if (messageSpan.StartsWith(System.Text.Encoding.ASCII.GetBytes(cmdString))) if (messageSpan.StartsWith(System.Text.Encoding.ASCII.GetBytes(cmdString)))
{ {
var ssChatBytes = ProcessChatMessage(message); var psChatBytes = ProcessChatMessage(message);
ssChatBytes = ssChatBytes.Skip(cmdString.Length).ToArray(); psChatBytes = psChatBytes.Skip(cmdString.Length).ToArray();
_ssCommandHandler?.Invoke(i, ssChatBytes); if (psChatBytes.Length > 0)
{
bool isBlank = true;
int j;
for (j = 0; j < psChatBytes.Length; j++)
{
if(!char.IsWhiteSpace((char)psChatBytes[j]))
{
isBlank = false;
break;
}
}
if (isBlank)
{
SendMessageHook!.OriginalDisposeSafe(thisPtr, message, uiModule);
return; return;
} }
_psCommandHandler?.Invoke(i, psChatBytes);
return;
}
}
} }
} }

View File

@@ -14,6 +14,7 @@ public sealed class IpcCallerHonorific : IIpcCaller
private readonly ICallGateSubscriber<int, object> _honorificClearCharacterTitle; private readonly ICallGateSubscriber<int, object> _honorificClearCharacterTitle;
private readonly ICallGateSubscriber<object> _honorificDisposing; private readonly ICallGateSubscriber<object> _honorificDisposing;
private readonly ICallGateSubscriber<string> _honorificGetLocalCharacterTitle; private readonly ICallGateSubscriber<string> _honorificGetLocalCharacterTitle;
private readonly ICallGateSubscriber<int, string> _honorificGetCharacterTitle;
private readonly ICallGateSubscriber<string, object> _honorificLocalCharacterTitleChanged; private readonly ICallGateSubscriber<string, object> _honorificLocalCharacterTitleChanged;
private readonly ICallGateSubscriber<object> _honorificReady; private readonly ICallGateSubscriber<object> _honorificReady;
private readonly ICallGateSubscriber<int, string, object> _honorificSetCharacterTitle; private readonly ICallGateSubscriber<int, string, object> _honorificSetCharacterTitle;
@@ -29,6 +30,7 @@ public sealed class IpcCallerHonorific : IIpcCaller
_dalamudUtil = dalamudUtil; _dalamudUtil = dalamudUtil;
_honorificApiVersion = pi.GetIpcSubscriber<(uint, uint)>("Honorific.ApiVersion"); _honorificApiVersion = pi.GetIpcSubscriber<(uint, uint)>("Honorific.ApiVersion");
_honorificGetLocalCharacterTitle = pi.GetIpcSubscriber<string>("Honorific.GetLocalCharacterTitle"); _honorificGetLocalCharacterTitle = pi.GetIpcSubscriber<string>("Honorific.GetLocalCharacterTitle");
_honorificGetCharacterTitle = pi.GetIpcSubscriber<int, string>("Honorific.GetCharacterTitle");
_honorificClearCharacterTitle = pi.GetIpcSubscriber<int, object>("Honorific.ClearCharacterTitle"); _honorificClearCharacterTitle = pi.GetIpcSubscriber<int, object>("Honorific.ClearCharacterTitle");
_honorificSetCharacterTitle = pi.GetIpcSubscriber<int, string, object>("Honorific.SetCharacterTitle"); _honorificSetCharacterTitle = pi.GetIpcSubscriber<int, string, object>("Honorific.SetCharacterTitle");
_honorificLocalCharacterTitleChanged = pi.GetIpcSubscriber<string, object>("Honorific.LocalCharacterTitleChanged"); _honorificLocalCharacterTitleChanged = pi.GetIpcSubscriber<string, object>("Honorific.LocalCharacterTitleChanged");
@@ -84,6 +86,23 @@ public sealed class IpcCallerHonorific : IIpcCaller
return string.IsNullOrEmpty(title) ? string.Empty : Convert.ToBase64String(Encoding.UTF8.GetBytes(title)); return string.IsNullOrEmpty(title) ? string.Empty : Convert.ToBase64String(Encoding.UTF8.GetBytes(title));
} }
public async Task<string> GetTitleForPlayer(IntPtr character)
{
if (!APIAvailable) return string.Empty;
string title = await _dalamudUtil.RunOnFrameworkThread(() =>
{
var gameObj = _dalamudUtil.CreateGameObject(character);
if (gameObj is IPlayerCharacter pc)
{
return _honorificGetCharacterTitle.InvokeFunc(pc.ObjectIndex);
}
return string.Empty;
}).ConfigureAwait(false);
return string.IsNullOrEmpty(title) ? string.Empty : Convert.ToBase64String(Encoding.UTF8.GetBytes(title));
}
public async Task SetTitleAsync(IntPtr character, string honorificDataB64) public async Task SetTitleAsync(IntPtr character, string honorificDataB64)
{ {
if (!APIAvailable) return; if (!APIAvailable) return;

View File

@@ -28,9 +28,9 @@ public sealed class IpcCallerOtherSync : DisposableMediatorSubscriberBase
_lightlessLoaded = msg.IsLoaded; _lightlessLoaded = msg.IsLoaded;
}); });
_snowcloakLoaded = PluginWatcherService.GetInitialPluginState(pi, "SnowcloakSync")?.IsLoaded ?? false; _snowcloakLoaded = PluginWatcherService.GetInitialPluginState(pi, "Snowcloak")?.IsLoaded ?? false;
Mediator.SubscribeKeyed<PluginChangeMessage>(this, "SnowcloakSync", (msg) => Mediator.SubscribeKeyed<PluginChangeMessage>(this, "Snowcloak", (msg) =>
{ {
_snowcloakLoaded = msg.IsLoaded; _snowcloakLoaded = msg.IsLoaded;
}); });

View File

@@ -2,7 +2,7 @@
<Project Sdk="Dalamud.NET.Sdk/13.1.0"> <Project Sdk="Dalamud.NET.Sdk/13.1.0">
<PropertyGroup> <PropertyGroup>
<AssemblyName>ClubPenguinSync</AssemblyName> <AssemblyName>ClubPenguinSync</AssemblyName>
<Version>1.7.1.1</Version> <Version>1.7.1.4</Version>
<PackageProjectUrl>https://github.com/Rawrington/ClubPenguinSync/</PackageProjectUrl> <PackageProjectUrl>https://github.com/Rawrington/ClubPenguinSync/</PackageProjectUrl>
</PropertyGroup> </PropertyGroup>

View File

@@ -149,7 +149,7 @@ public sealed class PairHandler : DisposableMediatorSubscriberBase
public string? PlayerName { get; private set; } public string? PlayerName { get; private set; }
public string PlayerNameHash => Pair.Ident; public string PlayerNameHash => Pair.Ident;
public void ApplyCharacterData(Guid applicationBase, CharacterData characterData, bool forceApplyCustomization = false) public async void ApplyCharacterData(Guid applicationBase, CharacterData characterData, bool forceApplyCustomization = false)
{ {
if (_configService.Current.HoldCombatApplication && _dalamudUtil.IsInCombatOrPerforming) if (_configService.Current.HoldCombatApplication && _dalamudUtil.IsInCombatOrPerforming)
{ {
@@ -175,7 +175,7 @@ public sealed class PairHandler : DisposableMediatorSubscriberBase
Logger.LogDebug("[BASE-{appBase}] Received data but player was in invalid state, charaHandlerIsNull: {charaIsNull}, playerPointerIsNull: {ptrIsNull}", Logger.LogDebug("[BASE-{appBase}] Received data but player was in invalid state, charaHandlerIsNull: {charaIsNull}, playerPointerIsNull: {ptrIsNull}",
applicationBase, _charaHandler == null, PlayerCharacter == IntPtr.Zero); applicationBase, _charaHandler == null, PlayerCharacter == IntPtr.Zero);
var hasDiffMods = characterData.CheckUpdatedData(applicationBase, _cachedData, Logger, var hasDiffMods = characterData.CheckUpdatedData(applicationBase, _cachedData, Logger,
this, forceApplyCustomization, forceApplyMods: false) this, forceApplyCustomization, forceApplyMods: false, string.Empty)
.Any(p => p.Value.Contains(PlayerChanges.ModManip) || p.Value.Contains(PlayerChanges.ModFiles)); .Any(p => p.Value.Contains(PlayerChanges.ModManip) || p.Value.Contains(PlayerChanges.ModFiles));
_forceApplyMods = hasDiffMods || _forceApplyMods || (PlayerCharacter == IntPtr.Zero && _cachedData == null); _forceApplyMods = hasDiffMods || _forceApplyMods || (PlayerCharacter == IntPtr.Zero && _cachedData == null);
_cachedData = characterData; _cachedData = characterData;
@@ -201,7 +201,7 @@ public sealed class PairHandler : DisposableMediatorSubscriberBase
$"Not applying character data: {reasons}"))); $"Not applying character data: {reasons}")));
Logger.LogDebug("[BASE-{appBase}] Not applying due to hold: {reasons}", applicationBase, reasons); Logger.LogDebug("[BASE-{appBase}] Not applying due to hold: {reasons}", applicationBase, reasons);
var hasDiffMods = characterData.CheckUpdatedData(applicationBase, _cachedData, Logger, var hasDiffMods = characterData.CheckUpdatedData(applicationBase, _cachedData, Logger,
this, forceApplyCustomization, forceApplyMods: false) this, forceApplyCustomization, forceApplyMods: false, _ipcManager.Honorific.GetTitleForPlayer(PlayerCharacter).GetAwaiter().GetResult())
.Any(p => p.Value.Contains(PlayerChanges.ModManip) || p.Value.Contains(PlayerChanges.ModFiles)); .Any(p => p.Value.Contains(PlayerChanges.ModManip) || p.Value.Contains(PlayerChanges.ModFiles));
_forceApplyMods = hasDiffMods || _forceApplyMods || (PlayerCharacter == IntPtr.Zero && _cachedData == null); _forceApplyMods = hasDiffMods || _forceApplyMods || (PlayerCharacter == IntPtr.Zero && _cachedData == null);
_cachedData = characterData; _cachedData = characterData;
@@ -228,7 +228,8 @@ public sealed class PairHandler : DisposableMediatorSubscriberBase
_forceApplyMods |= forceApplyCustomization; _forceApplyMods |= forceApplyCustomization;
var charaDataToUpdate = characterData.CheckUpdatedData(applicationBase, _cachedData?.DeepClone() ?? new(), Logger, this, forceApplyCustomization, _forceApplyMods); string oldHonorificTitle = _ipcManager.Honorific.GetTitleForPlayer(PlayerCharacter).GetAwaiter().GetResult();
var charaDataToUpdate = characterData.CheckUpdatedData(applicationBase, _cachedData?.DeepClone() ?? new(), Logger, this, forceApplyCustomization, _forceApplyMods, oldHonorificTitle);
if (_charaHandler != null && _forceApplyMods) if (_charaHandler != null && _forceApplyMods)
{ {

View File

@@ -72,7 +72,7 @@ public class ChatService : DisposableMediatorSubscriberBase
{ {
var chatMsg = message.ChatMsg; var chatMsg = message.ChatMsg;
var prefix = new SeStringBuilder(); var prefix = new SeStringBuilder();
prefix.AddText("[BnnuyChat] "); prefix.AddText("[PenguinChat] ");
_chatGui.Print(new XivChatEntry{ _chatGui.Print(new XivChatEntry{
MessageBytes = [..prefix.Build().Encode(), ..message.ChatMsg.PayloadContent], MessageBytes = [..prefix.Build().Encode(), ..message.ChatMsg.PayloadContent],
Name = chatMsg.SenderName, Name = chatMsg.SenderName,
@@ -121,7 +121,7 @@ public class ChatService : DisposableMediatorSubscriberBase
} }
if (color != 0) if (color != 0)
msg.AddUiForeground((ushort)color); msg.AddUiForeground((ushort)color);
msg.AddText($"[SS{shellNumber}]<"); msg.AddText($"[PS{shellNumber}]<");
if (message.ChatMsg.Sender.UID.Equals(_apiController.UID, StringComparison.Ordinal)) if (message.ChatMsg.Sender.UID.Equals(_apiController.UID, StringComparison.Ordinal))
{ {
// Don't link to your own character // Don't link to your own character
@@ -179,7 +179,7 @@ public class ChatService : DisposableMediatorSubscriberBase
if (_gameChatHooks.IsValueCreated && _gameChatHooks.Value.ChatChannelOverride != null) if (_gameChatHooks.IsValueCreated && _gameChatHooks.Value.ChatChannelOverride != null)
{ {
// Very dumb and won't handle re-numbering -- need to identify the active chat channel more reliably later // Very dumb and won't handle re-numbering -- need to identify the active chat channel more reliably later
if (_gameChatHooks.Value.ChatChannelOverride.ChannelName.StartsWith($"SS [{shellNumber}]", StringComparison.Ordinal)) if (_gameChatHooks.Value.ChatChannelOverride.ChannelName.StartsWith($"PS [{shellNumber}]", StringComparison.Ordinal))
SwitchChatShell(shellNumber); SwitchChatShell(shellNumber);
} }
} }
@@ -200,7 +200,7 @@ public class ChatService : DisposableMediatorSubscriberBase
// BUG: This doesn't always update the chat window e.g. when renaming a group // BUG: This doesn't always update the chat window e.g. when renaming a group
_gameChatHooks.Value.ChatChannelOverride = new() _gameChatHooks.Value.ChatChannelOverride = new()
{ {
ChannelName = $"SS [{shellNumber}]: {name}", ChannelName = $"PS [{shellNumber}]: {name}",
ChatMessageHandler = chatBytes => SendChatShell(shellNumber, chatBytes) ChatMessageHandler = chatBytes => SendChatShell(shellNumber, chatBytes)
}; };
return; return;

View File

@@ -1,5 +1,6 @@
using Dalamud.Game.Command; using Dalamud.Game.Command;
using Dalamud.Plugin.Services; using Dalamud.Plugin.Services;
using Dalamud.Utility;
using MareSynchronos.FileCache; using MareSynchronos.FileCache;
using MareSynchronos.MareConfiguration; using MareSynchronos.MareConfiguration;
using MareSynchronos.MareConfiguration.Models; using MareSynchronos.MareConfiguration.Models;
@@ -17,7 +18,7 @@ public sealed class CommandManagerService : IDisposable
private const string _commandName = "/sync"; private const string _commandName = "/sync";
private const string _commandName2 = "/clubpenguin"; private const string _commandName2 = "/clubpenguin";
private const string _ssCommandPrefix = "/ss"; private const string _psCommandPrefix = "/ps";
private readonly ApiController _apiController; private readonly ApiController _apiController;
private readonly ICommandManager _commandManager; private readonly ICommandManager _commandManager;
@@ -52,7 +53,7 @@ public sealed class CommandManagerService : IDisposable
// Lazy registration of all possible /ss# commands which tbf is what the game does for linkshells anyway // Lazy registration of all possible /ss# commands which tbf is what the game does for linkshells anyway
for (int i = 1; i <= ChatService.CommandMaxNumber; ++i) for (int i = 1; i <= ChatService.CommandMaxNumber; ++i)
{ {
_commandManager.AddHandler($"{_ssCommandPrefix}{i}", new CommandInfo(OnChatCommand) _commandManager.AddHandler($"{_psCommandPrefix}{i}", new CommandInfo(OnChatCommand)
{ {
ShowInHelp = false ShowInHelp = false
}); });
@@ -65,7 +66,7 @@ public sealed class CommandManagerService : IDisposable
_commandManager.RemoveHandler(_commandName2); _commandManager.RemoveHandler(_commandName2);
for (int i = 1; i <= ChatService.CommandMaxNumber; ++i) for (int i = 1; i <= ChatService.CommandMaxNumber; ++i)
_commandManager.RemoveHandler($"{_ssCommandPrefix}{i}"); _commandManager.RemoveHandler($"{_psCommandPrefix}{i}");
} }
private void OnCommand(string command, string args) private void OnCommand(string command, string args)
@@ -139,9 +140,9 @@ public sealed class CommandManagerService : IDisposable
if (_mareConfigService.Current.DisableSyncshellChat) if (_mareConfigService.Current.DisableSyncshellChat)
return; return;
int shellNumber = int.Parse(command[_ssCommandPrefix.Length..]); int shellNumber = int.Parse(command[_psCommandPrefix.Length..]);
if (args.Length == 0) if (args.Length == 0 || args.IsNullOrWhitespace())
{ {
_chatService.SwitchChatShell(shellNumber); _chatService.SwitchChatShell(shellNumber);
} }

View File

@@ -246,7 +246,7 @@ internal sealed class GroupPanel
if (!_mareConfig.Current.DisableSyncshellChat && shellConfig.Enabled) if (!_mareConfig.Current.DisableSyncshellChat && shellConfig.Enabled)
{ {
ImGui.TextUnformatted($"[{shellNumber}]"); ImGui.TextUnformatted($"[{shellNumber}]");
UiSharedService.AttachToolTip("Chat command prefix: /ss" + shellNumber); UiSharedService.AttachToolTip("Chat command prefix: /ps" + shellNumber);
} }
if (textIsGid) ImGui.PushFont(UiBuilder.MonoFont); if (textIsGid) ImGui.PushFont(UiBuilder.MonoFont);
ImGui.SameLine(); ImGui.SameLine();

View File

@@ -56,7 +56,7 @@ public static class VariousExtensions
} }
public static Dictionary<ObjectKind, HashSet<PlayerChanges>> CheckUpdatedData(this CharacterData newData, Guid applicationBase, public static Dictionary<ObjectKind, HashSet<PlayerChanges>> CheckUpdatedData(this CharacterData newData, Guid applicationBase,
CharacterData? oldData, ILogger logger, PairHandler cachedPlayer, bool forceApplyCustomization, bool forceApplyMods) CharacterData? oldData, ILogger logger, PairHandler cachedPlayer, bool forceApplyCustomization, bool forceApplyMods, string oldHonorificData)
{ {
oldData ??= new(); oldData ??= new();
var charaDataToUpdate = new Dictionary<ObjectKind, HashSet<PlayerChanges>>(); var charaDataToUpdate = new Dictionary<ObjectKind, HashSet<PlayerChanges>>();
@@ -182,7 +182,7 @@ public static class VariousExtensions
charaDataToUpdate[objectKind].Add(PlayerChanges.Heels); charaDataToUpdate[objectKind].Add(PlayerChanges.Heels);
} }
bool honorificDataDifferent = !string.Equals(oldData.HonorificData, newData.HonorificData, StringComparison.Ordinal); bool honorificDataDifferent = !string.Equals(oldHonorificData, newData.HonorificData, StringComparison.Ordinal);
if (honorificDataDifferent || (forceApplyCustomization && !string.IsNullOrEmpty(newData.HonorificData))) if (honorificDataDifferent || (forceApplyCustomization && !string.IsNullOrEmpty(newData.HonorificData)))
{ {
logger.LogDebug("[BASE-{appBase}] Updating {object}/{kind} (Diff honorific data) => {change}", applicationBase, cachedPlayer, objectKind, PlayerChanges.Honorific); logger.LogDebug("[BASE-{appBase}] Updating {object}/{kind} (Diff honorific data) => {change}", applicationBase, cachedPlayer, objectKind, PlayerChanges.Honorific);