Make chat messages/errors consistent
This commit is contained in:
parent
e3459a0182
commit
3d560fad7f
@ -82,7 +82,7 @@ namespace Pal.Client.Commands
|
|||||||
#if DEBUG
|
#if DEBUG
|
||||||
case "update-saves":
|
case "update-saves":
|
||||||
LocalState.UpdateAll();
|
LocalState.UpdateAll();
|
||||||
Service.Chat.Print(Localization.Command_pal_updatesaves);
|
_chatGui.PalMessage(Localization.Command_pal_updatesaves);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -124,7 +124,7 @@ namespace Pal.Client.Commands
|
|||||||
var playerPosition = _clientState.LocalPlayer?.Position;
|
var playerPosition = _clientState.LocalPlayer?.Position;
|
||||||
if (playerPosition == null)
|
if (playerPosition == null)
|
||||||
return;
|
return;
|
||||||
_chatGui.Print($"[Palace Pal] {playerPosition}");
|
_chatGui.PalMessage($"{playerPosition}");
|
||||||
|
|
||||||
var nearbyMarkers = state.Markers
|
var nearbyMarkers = state.Markers
|
||||||
.Where(m => predicate(m))
|
.Where(m => predicate(m))
|
||||||
|
@ -54,7 +54,7 @@ namespace Pal.Client.DependencyInjection
|
|||||||
}
|
}
|
||||||
catch (RpcException e) when (e.StatusCode == StatusCode.PermissionDenied)
|
catch (RpcException e) when (e.StatusCode == StatusCode.PermissionDenied)
|
||||||
{
|
{
|
||||||
_chatGui.Print(Localization.Command_pal_stats_CurrentFloor);
|
_chatGui.PalError(Localization.Command_pal_stats_CurrentFloor);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
using Dalamud.Game.Gui;
|
using Dalamud.Game.Gui;
|
||||||
|
using Dalamud.Game.Text;
|
||||||
|
using Dalamud.Game.Text.SeStringHandling;
|
||||||
using Pal.Client.Properties;
|
using Pal.Client.Properties;
|
||||||
|
|
||||||
namespace Pal.Client.Extensions
|
namespace Pal.Client.Extensions
|
||||||
@ -6,6 +8,21 @@ namespace Pal.Client.Extensions
|
|||||||
public static class ChatExtensions
|
public static class ChatExtensions
|
||||||
{
|
{
|
||||||
public static void PalError(this ChatGui chat, string e)
|
public static void PalError(this ChatGui chat, string e)
|
||||||
=> chat.PrintError($"[{Localization.Palace_Pal}] {e}");
|
{
|
||||||
|
chat.PrintChat(new XivChatEntry
|
||||||
|
{
|
||||||
|
Message = new SeStringBuilder()
|
||||||
|
.AddUiForeground($"[{Localization.Palace_Pal}] ", 16)
|
||||||
|
.AddText(e).Build(),
|
||||||
|
Type = XivChatType.Urgent
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void PalMessage(this ChatGui chat, string message)
|
||||||
|
{
|
||||||
|
chat.Print(new SeStringBuilder()
|
||||||
|
.AddUiForeground($"[{Localization.Palace_Pal}] ", 57)
|
||||||
|
.AddText(message).Build());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,7 @@ namespace Pal.Client
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
if (Service.Configuration.BetaKey == "VFX")
|
if (Service.Configuration.BetaKey == "VFX")
|
||||||
Service.Chat.Print($"{vfxPath} on {obj}");
|
_chatGui.PalPrint($"{vfxPath} on {obj}");
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (obj is BattleChara bc && (bc.NameId == /* potd */ 5042 || bc.NameId == /* hoh */ 7395))
|
if (obj is BattleChara bc && (bc.NameId == /* potd */ 5042 || bc.NameId == /* hoh */ 7395))
|
||||||
|
@ -14,6 +14,7 @@ using System.Reflection;
|
|||||||
using Dalamud.Game.ClientState;
|
using Dalamud.Game.ClientState;
|
||||||
using Dalamud.Game.Gui;
|
using Dalamud.Game.Gui;
|
||||||
using Pal.Client.DependencyInjection;
|
using Pal.Client.DependencyInjection;
|
||||||
|
using Pal.Client.Extensions;
|
||||||
|
|
||||||
namespace Pal.Client.Rendering
|
namespace Pal.Client.Rendering
|
||||||
{
|
{
|
||||||
@ -25,7 +26,8 @@ namespace Pal.Client.Rendering
|
|||||||
private readonly ClientState _clientState;
|
private readonly ClientState _clientState;
|
||||||
private readonly ChatGui _chatGui;
|
private readonly ChatGui _chatGui;
|
||||||
|
|
||||||
public SplatoonRenderer(DalamudPluginInterface pluginInterface, IDalamudPlugin dalamudPlugin, DebugState debugState,
|
public SplatoonRenderer(DalamudPluginInterface pluginInterface, IDalamudPlugin dalamudPlugin,
|
||||||
|
DebugState debugState,
|
||||||
ClientState clientState, ChatGui chatGui)
|
ClientState clientState, ChatGui chatGui)
|
||||||
{
|
{
|
||||||
_debugState = debugState;
|
_debugState = debugState;
|
||||||
@ -109,7 +111,7 @@ namespace Pal.Client.Rendering
|
|||||||
elements.Cast<SplatoonElement>().Select(x => x.Delegate).ToArray(),
|
elements.Cast<SplatoonElement>().Select(x => x.Delegate).ToArray(),
|
||||||
new[] { Environment.TickCount64 + 10000 }))
|
new[] { Environment.TickCount64 + 10000 }))
|
||||||
{
|
{
|
||||||
_chatGui.PrintError("Could not draw markers :(");
|
_chatGui.PalMessage("Could not draw markers :(");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -129,10 +131,10 @@ namespace Pal.Client.Rendering
|
|||||||
string? pluginName = (string?)t.GetType().GetProperty("Name")?.GetValue(t);
|
string? pluginName = (string?)t.GetType().GetProperty("Name")?.GetValue(t);
|
||||||
if (assemblyName?.Name == "Splatoon" && pluginName != "Splatoon")
|
if (assemblyName?.Name == "Splatoon" && pluginName != "Splatoon")
|
||||||
{
|
{
|
||||||
_chatGui.PrintError(
|
_chatGui.PalError(
|
||||||
$"[Palace Pal] Splatoon is installed under the plugin name '{pluginName}', which is incompatible with the Splatoon API.");
|
$"Splatoon is installed under the plugin name '{pluginName}', which is incompatible with the Splatoon API.");
|
||||||
_chatGui.Print(
|
_chatGui.PalMessage(
|
||||||
"[Palace Pal] You need to install Splatoon from the official repository at https://github.com/NightmareXIV/MyDalamudPlugins.");
|
"You need to install Splatoon from the official repository at https://github.com/NightmareXIV/MyDalamudPlugins.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -142,7 +144,7 @@ namespace Pal.Client.Rendering
|
|||||||
// not relevant
|
// not relevant
|
||||||
}
|
}
|
||||||
|
|
||||||
_chatGui.PrintError("Could not draw markers, is Splatoon installed and enabled?");
|
_chatGui.PalError("Could not draw markers, is Splatoon installed and enabled?");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ namespace Pal.Client.Scheduled
|
|||||||
});
|
});
|
||||||
_configurationManager.Save(_configuration);
|
_configurationManager.Save(_configuration);
|
||||||
|
|
||||||
_chatGui.Print(string.Format(Localization.ImportCompleteStatistics, import.ImportedTraps,
|
_chatGui.PalMessage(string.Format(Localization.ImportCompleteStatistics, import.ImportedTraps,
|
||||||
import.ImportedHoardCoffers));
|
import.ImportedHoardCoffers));
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
@ -95,13 +95,13 @@ namespace Pal.Client.Scheduled
|
|||||||
{
|
{
|
||||||
if (import.Export.ExportVersion != ExportConfig.ExportVersion)
|
if (import.Export.ExportVersion != ExportConfig.ExportVersion)
|
||||||
{
|
{
|
||||||
_chatGui.PrintError(Localization.Error_ImportFailed_IncompatibleVersion);
|
_chatGui.PalError(Localization.Error_ImportFailed_IncompatibleVersion);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Guid.TryParse(import.Export.ExportId, out Guid exportId) || import.ExportId == Guid.Empty)
|
if (!Guid.TryParse(import.Export.ExportId, out Guid exportId) || import.ExportId == Guid.Empty)
|
||||||
{
|
{
|
||||||
_chatGui.PrintError(Localization.Error_ImportFailed_InvalidFile);
|
_chatGui.PalError(Localization.Error_ImportFailed_InvalidFile);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,7 +110,7 @@ namespace Pal.Client.Scheduled
|
|||||||
if (string.IsNullOrEmpty(import.Export.ServerUrl))
|
if (string.IsNullOrEmpty(import.Export.ServerUrl))
|
||||||
{
|
{
|
||||||
// If we allow for backups as import/export, this should be removed
|
// If we allow for backups as import/export, this should be removed
|
||||||
_chatGui.PrintError(Localization.Error_ImportFailed_InvalidFile);
|
_chatGui.PalError(Localization.Error_ImportFailed_InvalidFile);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@ using Dalamud.Game.Gui;
|
|||||||
using Pal.Client.Properties;
|
using Pal.Client.Properties;
|
||||||
using Pal.Client.Configuration;
|
using Pal.Client.Configuration;
|
||||||
using Pal.Client.DependencyInjection;
|
using Pal.Client.DependencyInjection;
|
||||||
|
using Pal.Client.Extensions;
|
||||||
|
|
||||||
namespace Pal.Client.Windows
|
namespace Pal.Client.Windows
|
||||||
{
|
{
|
||||||
@ -351,7 +352,8 @@ namespace Pal.Client.Windows
|
|||||||
ImGui.Text(Localization.Config_Splatoon_Test);
|
ImGui.Text(Localization.Config_Splatoon_Test);
|
||||||
ImGui.BeginDisabled(!(_renderAdapter.Implementation is IDrawDebugItems));
|
ImGui.BeginDisabled(!(_renderAdapter.Implementation is IDrawDebugItems));
|
||||||
if (ImGui.Button(Localization.Config_Splatoon_DrawCircles))
|
if (ImGui.Button(Localization.Config_Splatoon_DrawCircles))
|
||||||
(_renderAdapter.Implementation as IDrawDebugItems)?.DrawDebugItems(_trapConfig.Color, _hoardConfig.Color);
|
(_renderAdapter.Implementation as IDrawDebugItems)?.DrawDebugItems(_trapConfig.Color,
|
||||||
|
_hoardConfig.Color);
|
||||||
ImGui.EndDisabled();
|
ImGui.EndDisabled();
|
||||||
|
|
||||||
ImGui.EndTabItem();
|
ImGui.EndTabItem();
|
||||||
@ -385,7 +387,8 @@ namespace Pal.Client.Windows
|
|||||||
|
|
||||||
if (_silverConfig.Show)
|
if (_silverConfig.Show)
|
||||||
{
|
{
|
||||||
int silverCoffers = _floorService.EphemeralMarkers.Count(x => x.Type == Marker.EType.SilverCoffer);
|
int silverCoffers =
|
||||||
|
_floorService.EphemeralMarkers.Count(x => x.Type == Marker.EType.SilverCoffer);
|
||||||
ImGui.Text(
|
ImGui.Text(
|
||||||
$"{silverCoffers} silver coffer{(silverCoffers == 1 ? "" : "s")} visible on current floor");
|
$"{silverCoffers} silver coffer{(silverCoffers == 1 ? "" : "s")} visible on current floor");
|
||||||
}
|
}
|
||||||
@ -475,17 +478,17 @@ namespace Pal.Client.Windows
|
|||||||
await using var output = File.Create(destinationPath);
|
await using var output = File.Create(destinationPath);
|
||||||
export.WriteTo(output);
|
export.WriteTo(output);
|
||||||
|
|
||||||
_chatGui.Print($"Export saved as {destinationPath}.");
|
_chatGui.PalMessage($"Export saved as {destinationPath}.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_chatGui.PrintError("Export failed due to server error.");
|
_chatGui.PalError("Export failed due to server error.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
PluginLog.Error(e, "Export failed");
|
PluginLog.Error(e, "Export failed");
|
||||||
_chatGui.PrintError($"Export failed: {e}");
|
_chatGui.PalError($"Export failed: {e}");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user