v1.0.2: Suppress 'That player has already been invited' toast (QuestToast + broader match)
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||
|
||||
## [1.0.2] - 2025-02-03
|
||||
|
||||
### Added
|
||||
|
||||
- Suppress "That player has already been invited" toast (same window as other party errors). Also handle QuestToast; match "already" + "invited" for wording variants.
|
||||
|
||||
## [1.0.1] - 2025-02-03
|
||||
|
||||
### Fixed
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Dalamud.NET.Sdk/14.0.1">
|
||||
<PropertyGroup>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<Version>1.0.1.0</Version>
|
||||
<Version>1.0.2.0</Version>
|
||||
<Author>Knack117</Author>
|
||||
<Name>HSRTools</Name>
|
||||
<InternalName>HSRTools</InternalName>
|
||||
|
||||
@@ -59,25 +59,33 @@ public sealed class ChatMonitorService
|
||||
_chatGui.CheckMessageHandled += OnCheckMessageHandled;
|
||||
PluginServices.ToastGui.Toast += OnToast;
|
||||
PluginServices.ToastGui.ErrorToast += OnErrorToast;
|
||||
PluginServices.ToastGui.QuestToast += OnQuestToast;
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
PluginServices.ToastGui.QuestToast -= OnQuestToast;
|
||||
PluginServices.ToastGui.ErrorToast -= OnErrorToast;
|
||||
PluginServices.ToastGui.Toast -= OnToast;
|
||||
_chatGui.ChatMessage -= OnChatMessage;
|
||||
_chatGui.CheckMessageHandled -= OnCheckMessageHandled;
|
||||
}
|
||||
|
||||
private static bool IsPartyErrorToSuppress(string msg)
|
||||
{
|
||||
if (string.IsNullOrEmpty(msg)) return false;
|
||||
var ord = StringComparison.OrdinalIgnoreCase;
|
||||
return (msg.Contains("locate", ord) && msg.Contains("that name", ord)) ||
|
||||
msg.Contains("Unable to process party command", ord) ||
|
||||
(msg.Contains("already", ord) && msg.Contains("invited", ord));
|
||||
}
|
||||
|
||||
/// <summary>Suppress party-error toasts (big on-screen message) from our fallback invite. See BurntToast plugin.</summary>
|
||||
private void OnErrorToast(ref SeString message, ref bool isHandled)
|
||||
{
|
||||
if (DateTime.UtcNow >= _suppressPartyErrorUntil || isHandled)
|
||||
return;
|
||||
var msg = message.TextValue;
|
||||
var ord = StringComparison.OrdinalIgnoreCase;
|
||||
if ((msg.Contains("locate", ord) && msg.Contains("that name", ord)) ||
|
||||
msg.Contains("Unable to process party command", ord))
|
||||
if (IsPartyErrorToSuppress(message.TextValue))
|
||||
{
|
||||
isHandled = true;
|
||||
_suppressPartyErrorUntil = DateTime.MinValue;
|
||||
@@ -88,10 +96,18 @@ public sealed class ChatMonitorService
|
||||
{
|
||||
if (DateTime.UtcNow >= _suppressPartyErrorUntil || isHandled)
|
||||
return;
|
||||
var msg = message.TextValue;
|
||||
var ord = StringComparison.OrdinalIgnoreCase;
|
||||
if ((msg.Contains("locate", ord) && msg.Contains("that name", ord)) ||
|
||||
msg.Contains("Unable to process party command", ord))
|
||||
if (IsPartyErrorToSuppress(message.TextValue))
|
||||
{
|
||||
isHandled = true;
|
||||
_suppressPartyErrorUntil = DateTime.MinValue;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnQuestToast(ref SeString message, ref Dalamud.Game.Gui.Toast.QuestToastOptions options, ref bool isHandled)
|
||||
{
|
||||
if (DateTime.UtcNow >= _suppressPartyErrorUntil || isHandled)
|
||||
return;
|
||||
if (IsPartyErrorToSuppress(message.TextValue))
|
||||
{
|
||||
isHandled = true;
|
||||
_suppressPartyErrorUntil = DateTime.MinValue;
|
||||
@@ -106,9 +122,7 @@ public sealed class ChatMonitorService
|
||||
var msg = message.TextValue;
|
||||
if (msg.Length == 0)
|
||||
return;
|
||||
var ord = StringComparison.OrdinalIgnoreCase;
|
||||
if ((msg.Contains("locate", ord) && msg.Contains("that name", ord)) ||
|
||||
msg.Contains("Unable to process party command", ord))
|
||||
if (IsPartyErrorToSuppress(msg))
|
||||
{
|
||||
isHandled = true;
|
||||
_suppressPartyErrorUntil = DateTime.MinValue;
|
||||
@@ -119,16 +133,11 @@ public sealed class ChatMonitorService
|
||||
{
|
||||
var msg = message.TextValue;
|
||||
// Suppress party-error messages from our fallback invite (same-world CWLS tries ContentId then name+world; first can fail).
|
||||
if (DateTime.UtcNow < _suppressPartyErrorUntil)
|
||||
if (DateTime.UtcNow < _suppressPartyErrorUntil && IsPartyErrorToSuppress(msg))
|
||||
{
|
||||
var ord = StringComparison.OrdinalIgnoreCase;
|
||||
if ((msg.Contains("locate", ord) && msg.Contains("that name", ord)) ||
|
||||
msg.Contains("Unable to process party command", ord))
|
||||
{
|
||||
isHandled = true;
|
||||
_suppressPartyErrorUntil = DateTime.MinValue;
|
||||
return;
|
||||
}
|
||||
isHandled = true;
|
||||
_suppressPartyErrorUntil = DateTime.MinValue;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_config.Enabled || string.IsNullOrWhiteSpace(_config.TriggerText))
|
||||
|
||||
+4
-4
@@ -5,15 +5,15 @@
|
||||
"Punchline": "Auto-invite to party when a trigger word is said in FC, LS, CWLS, or tells.",
|
||||
"Description": "Detects a user-defined trigger word in Free Company, Link Shell, Cross-World Link Shell, and tell chat, then invites the sender to your party. Works for same-world and cross-world (CWLS).",
|
||||
"InternalName": "HSRTools",
|
||||
"AssemblyVersion": "1.0.1.0",
|
||||
"AssemblyVersion": "1.0.2.0",
|
||||
"RepoUrl": "https://github.com/Knack117/HSRTools",
|
||||
"ApplicableVersion": "any",
|
||||
"DalamudApiLevel": 14,
|
||||
"Tags": [ "chat", "party", "invite", "automation" ],
|
||||
"AcceptsFeedback": true,
|
||||
"DownloadCount": 0,
|
||||
"LastUpdate": "1738627200",
|
||||
"DownloadLinkInstall": "https://github.com/Knack117/HSRTools/releases/download/v1.0.1/HSRTools.zip",
|
||||
"DownloadLinkUpdate": "https://github.com/Knack117/HSRTools/releases/download/v1.0.1/HSRTools.zip"
|
||||
"LastUpdate": "1738713600",
|
||||
"DownloadLinkInstall": "https://github.com/Knack117/HSRTools/releases/download/v1.0.2/HSRTools.zip",
|
||||
"DownloadLinkUpdate": "https://github.com/Knack117/HSRTools/releases/download/v1.0.2/HSRTools.zip"
|
||||
}
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user