From 2992431e397df3bad837e3900e815290b8f1f406 Mon Sep 17 00:00:00 2001 From: Ethan Moffat Date: Mon, 1 May 2023 12:59:00 -0700 Subject: [PATCH] Fix clicking NPCs that don't have a sprite with visible pixels --- EndlessClient/Rendering/NPC/NPCRenderer.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/EndlessClient/Rendering/NPC/NPCRenderer.cs b/EndlessClient/Rendering/NPC/NPCRenderer.cs index ae6bc37be..66e4291ad 100644 --- a/EndlessClient/Rendering/NPC/NPCRenderer.cs +++ b/EndlessClient/Rendering/NPC/NPCRenderer.cs @@ -16,6 +16,8 @@ using Microsoft.Xna.Framework.Graphics; using Optional; using System; +using System.Linq; +using System.Windows.Markup; using XNAControls; namespace EndlessClient.Rendering.NPC @@ -129,6 +131,11 @@ public override void Initialize() _spriteBatch = new SpriteBatch(Game.GraphicsDevice); + var frameTexture = _npcSpriteSheet.GetNPCTexture(_enfFileProvider.ENFFile[NPC.ID].Graphic, NPC.Frame, NPC.Direction); + var data = new Color[frameTexture.Width * frameTexture.Height]; + frameTexture.GetData(data); + _isBlankSprite = data.All(x => x.A == 0); + base.Initialize(); }