From 899146dcb7c28b873f770aa8b4dc84c0608ebc63 Mon Sep 17 00:00:00 2001 From: Kamron Batman <3953314+kamronbatman@users.noreply.github.com> Date: Thu, 13 Feb 2025 19:12:28 -0800 Subject: [PATCH] fix: Fixes static gumps sending too much data. (#2122) --- Projects/UOContent/Gumps/Base/StaticGump.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Projects/UOContent/Gumps/Base/StaticGump.cs b/Projects/UOContent/Gumps/Base/StaticGump.cs index c0f5eb920..8b428ab0b 100644 --- a/Projects/UOContent/Gumps/Base/StaticGump.cs +++ b/Projects/UOContent/Gumps/Base/StaticGump.cs @@ -33,6 +33,9 @@ public abstract class StaticGump : BaseGump where TSelf : StaticGump true; + public override int Switches => _switches; public override int TextEntries => _textEntries; @@ -67,7 +70,7 @@ public abstract class StaticGump : BaseGump where TSelf : StaticGump : BaseGump where TSelf : StaticGump.Shared.Rent(_staticStrings.Length + stringsData.Length); + var stringsLength = _staticStrings.Length + stringsData.Length; + + var buffer = STArrayPool.Shared.Rent(stringsLength); _staticStrings.CopyTo(buffer.AsSpan()); stringsData.CopyTo(buffer.AsSpan(_staticStrings.Length)); - OutgoingGumpPackets.WritePacked(buffer, ref writer); + OutgoingGumpPackets.WritePacked(buffer.AsSpan(0, stringsLength), ref writer); STArrayPool.Shared.Return(buffer); } }