[CharacterSwitch] Don't print error in chat when building DTR on unknown character

master
Liza 2024-05-11 18:45:57 +02:00
parent 0fe6450ab1
commit ee9e43c707
Signed by: liza
GPG Key ID: 7199F8D727D55F67
1 changed files with 7 additions and 5 deletions

View File

@ -75,7 +75,7 @@ internal sealed class CharacterSwitch : IDisposable
UpdateDtrBar();
}
private Target? FindCharacter(int direction)
private Target? FindCharacter(int direction, bool showError = true)
{
_pluginLog.Verbose($"Switching characters ({direction})");
@ -83,6 +83,7 @@ internal sealed class CharacterSwitch : IDisposable
int index = characterIds.IndexOf(_clientState.LocalContentId);
if (index < 0)
{
if (showError)
_chatGui.PrintError("[KitchenSink] Current character not known.");
return null;
}
@ -94,6 +95,7 @@ internal sealed class CharacterSwitch : IDisposable
target = _autoRetainerApi.GetOfflineCharacterData(characterIds[index]);
if (target?.CID == _clientState.LocalContentId)
{
if (showError)
_chatGui.PrintError("[KitchenSink] No character to switch to found.");
return null;
}
@ -184,8 +186,8 @@ internal sealed class CharacterSwitch : IDisposable
{
_dtrBarEntry.Text = seIconChar.ToIconString();
var previous = FindCharacter(-1);
var next = FindCharacter(1);
var previous = FindCharacter(-1, showError: false);
var next = FindCharacter(1, showError: false);
if (previous != null && next != null)
_dtrBarEntry.Tooltip = $"Prev: {previous.Name}\nNext: {next.Name}";
else if (previous != null)