From e75841deb914250e61181ef76f58f3e7ce39a781 Mon Sep 17 00:00:00 2001 From: goat Date: Fri, 8 Nov 2019 20:50:14 +0900 Subject: [PATCH] Don't throw on ActorTable error --- Dalamud/Dalamud.csproj | 8 ++++---- Dalamud/Game/ChatHandlers.cs | 6 ++++++ Dalamud/Game/ClientState/Actors/ActorTable.cs | 2 +- Dalamud/Game/ClientState/ClientState.cs | 12 +++++++++++- 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/Dalamud/Dalamud.csproj b/Dalamud/Dalamud.csproj index 09cb2fe89..56911b73e 100644 --- a/Dalamud/Dalamud.csproj +++ b/Dalamud/Dalamud.csproj @@ -1,4 +1,4 @@ - + AnyCPU net471 @@ -14,9 +14,9 @@ true - 2.4.0.0 - 2.4.0 - 2.4.0.0 + 2.5.0.0 + 2.5.0 + 2.5.0.0 diff --git a/Dalamud/Game/ChatHandlers.cs b/Dalamud/Game/ChatHandlers.cs index 4005107a4..ce9834571 100644 --- a/Dalamud/Game/ChatHandlers.cs +++ b/Dalamud/Game/ChatHandlers.cs @@ -65,11 +65,17 @@ namespace Dalamud.Game { private void ChatOnOnChatMessage(XivChatType type, uint senderId, string sender, ref string message, ref bool isHandled) { + if (type == XivChatType.Notice && !this.hasSeenLoadingMsg) { this.dalamud.Framework.Gui.Chat.Print("XIVLauncher in-game addon loaded."); this.hasSeenLoadingMsg = true; } +#if !DEBUG + if (!this.hasSeenLoadingMsg) + return; +#endif + var matched = this.rmtRegex.IsMatch(message); if (matched) { // This seems to be a RMT ad - let's not show it diff --git a/Dalamud/Game/ClientState/Actors/ActorTable.cs b/Dalamud/Game/ClientState/Actors/ActorTable.cs index 5a48c58ff..e9b6e7278 100644 --- a/Dalamud/Game/ClientState/Actors/ActorTable.cs +++ b/Dalamud/Game/ClientState/Actors/ActorTable.cs @@ -40,7 +40,7 @@ namespace Dalamud.Game.ClientState.Actors { //Log.Information("Actor at {0}", offset.ToString()); if (offset == IntPtr.Zero) - throw new Exception($"Actor slot at index {index} is invalid"); + return null; var actorStruct = Marshal.PtrToStructure(offset); diff --git a/Dalamud/Game/ClientState/ClientState.cs b/Dalamud/Game/ClientState/ClientState.cs index 547e49ae0..ade048517 100644 --- a/Dalamud/Game/ClientState/ClientState.cs +++ b/Dalamud/Game/ClientState/ClientState.cs @@ -33,7 +33,17 @@ namespace Dalamud.Game.ClientState /// The local player character, if one is present. /// //public PlayerCharacter LocalPlayer { get; private set; } - public PlayerCharacter LocalPlayer => (PlayerCharacter) this.Actors[0]; + public PlayerCharacter LocalPlayer { + get { + var actor = this.Actors[0]; + + if (actor is PlayerCharacter pc) + return pc; + + return null; + } + } + //public PlayerCharacter LocalPlayer => null; /// /// The content ID of the local character.