fix: Adds missing string interpolation handler for SetStringSlot (#2123)
This commit is contained in:
parent
899146dcb7
commit
6d7b1b8bee
6 changed files with 21 additions and 7 deletions
|
|
@ -71,6 +71,14 @@ public ref struct GumpStringsBuilder
|
|||
handler.Clear();
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void SetStringSlot(ref RawInterpolatedStringHandler slotKeyHandler, ref RawInterpolatedStringHandler handler)
|
||||
{
|
||||
SetStringSlot(slotKeyHandler.Text, handler.Text);
|
||||
slotKeyHandler.Clear();
|
||||
handler.Clear();
|
||||
}
|
||||
|
||||
public void SetStringSlot(ReadOnlySpan<char> slotKey, ReadOnlySpan<char> text)
|
||||
{
|
||||
var hash = HashUtility.ComputeHash64(slotKey);
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
using System;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
|
||||
|
|
@ -39,7 +40,8 @@ public class PetResurrectGump : StaticGump<PetResurrectGump>
|
|||
|
||||
protected override void BuildStrings(ref GumpStringsBuilder builder)
|
||||
{
|
||||
builder.SetStringSlot("petName", $"<CENTER>{_pet.Name}</CENTER>");
|
||||
var petNameText = _pet.Name.AsSpan().Center();
|
||||
builder.SetStringSlot("petName", ref petNameText);
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState state, in RelayInfo info)
|
||||
|
|
|
|||
|
|
@ -88,7 +88,8 @@ public abstract class StaticWarningGump<T> : StaticGump<T> where T : StaticWarni
|
|||
|
||||
protected sealed override void BuildStrings(ref GumpStringsBuilder builder)
|
||||
{
|
||||
builder.SetStringSlot("content", Content.Color(ContentColor));
|
||||
var contentText = Content.AsSpan().Color(ContentColor);
|
||||
builder.SetStringSlot("content", ref contentText);
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, in RelayInfo info) => _callback?.Invoke(info.ButtonID == 1);
|
||||
|
|
|
|||
|
|
@ -56,8 +56,8 @@ public class TithingGump : StaticGump<TithingGump>
|
|||
// Just in case
|
||||
_offer = Math.Clamp(_offer, 0, totalGold);
|
||||
|
||||
builder.SetStringSlot("goldOffer", (totalGold - _offer).ToString("N0"));
|
||||
builder.SetStringSlot("titheOffer", _offer.ToString("N0"));
|
||||
builder.SetStringSlot("goldOffer", $"{totalGold - _offer:N0}");
|
||||
builder.SetStringSlot("titheOffer", $"{_offer:N0}");
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, in RelayInfo info)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue