Don't throw on ActorTable error

This commit is contained in:
goat 2019-11-08 20:50:14 +09:00
parent 799f5ef634
commit e75841deb9
4 changed files with 22 additions and 6 deletions

View file

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup Label="Target"> <PropertyGroup Label="Target">
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
<TargetFramework>net471</TargetFramework> <TargetFramework>net471</TargetFramework>
@ -14,9 +14,9 @@
</PropertyGroup> </PropertyGroup>
<PropertyGroup Label="Feature"> <PropertyGroup Label="Feature">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AssemblyVersion>2.4.0.0</AssemblyVersion> <AssemblyVersion>2.5.0.0</AssemblyVersion>
<Version>2.4.0</Version> <Version>2.5.0</Version>
<FileVersion>2.4.0.0</FileVersion> <FileVersion>2.5.0.0</FileVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup Label="Resources"> <ItemGroup Label="Resources">
<None Include="$(SolutionDir)/Resources/**/*" CopyToOutputDirectory="PreserveNewest" Visible="false" /> <None Include="$(SolutionDir)/Resources/**/*" CopyToOutputDirectory="PreserveNewest" Visible="false" />

View file

@ -65,11 +65,17 @@ namespace Dalamud.Game {
private void ChatOnOnChatMessage(XivChatType type, uint senderId, string sender, ref string message, private void ChatOnOnChatMessage(XivChatType type, uint senderId, string sender, ref string message,
ref bool isHandled) { ref bool isHandled) {
if (type == XivChatType.Notice && !this.hasSeenLoadingMsg) { if (type == XivChatType.Notice && !this.hasSeenLoadingMsg) {
this.dalamud.Framework.Gui.Chat.Print("XIVLauncher in-game addon loaded."); this.dalamud.Framework.Gui.Chat.Print("XIVLauncher in-game addon loaded.");
this.hasSeenLoadingMsg = true; this.hasSeenLoadingMsg = true;
} }
#if !DEBUG
if (!this.hasSeenLoadingMsg)
return;
#endif
var matched = this.rmtRegex.IsMatch(message); var matched = this.rmtRegex.IsMatch(message);
if (matched) { if (matched) {
// This seems to be a RMT ad - let's not show it // This seems to be a RMT ad - let's not show it

View file

@ -40,7 +40,7 @@ namespace Dalamud.Game.ClientState.Actors {
//Log.Information("Actor at {0}", offset.ToString()); //Log.Information("Actor at {0}", offset.ToString());
if (offset == IntPtr.Zero) if (offset == IntPtr.Zero)
throw new Exception($"Actor slot at index {index} is invalid"); return null;
var actorStruct = Marshal.PtrToStructure<Structs.Actor>(offset); var actorStruct = Marshal.PtrToStructure<Structs.Actor>(offset);

View file

@ -33,7 +33,17 @@ namespace Dalamud.Game.ClientState
/// The local player character, if one is present. /// The local player character, if one is present.
/// </summary> /// </summary>
//public PlayerCharacter LocalPlayer { get; private set; } //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;
/// <summary> /// <summary>
/// The content ID of the local character. /// The content ID of the local character.