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:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user