fix: Fixes incorrect interpolation in legacy gumps (#1800)
This commit is contained in:
parent
b3a817ee2d
commit
96a398784f
2 changed files with 42 additions and 21 deletions
|
|
@ -103,18 +103,30 @@ public class GumpHtmlLocalized : GumpEntry
|
|||
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedSet<string> strings, ref int entries, ref int switches)
|
||||
{
|
||||
var background = Background ? "1" : "0";
|
||||
var scrollbar = Scrollbar ? "1" : "0";
|
||||
writer.WriteAscii(
|
||||
Type switch
|
||||
{
|
||||
GumpHtmlLocalizedType.Plain =>
|
||||
$"{{ xmfhtmlgump {X} {Y} {Width} {Height} {Number} {background} {scrollbar} }}",
|
||||
GumpHtmlLocalizedType.Color =>
|
||||
$"{{ xmfhtmlgumpcolor {X} {Y} {Width} {Height} {Number} {background} {scrollbar} {Color} }}",
|
||||
_ =>
|
||||
$"{{ xmfhtmltok {X} {Y} {Width} {Height} {background} {scrollbar} {Color} {Number} @{Args}@ }}"
|
||||
}
|
||||
);
|
||||
switch (Type)
|
||||
{
|
||||
default:
|
||||
case GumpHtmlLocalizedType.Plain:
|
||||
{
|
||||
writer.WriteAscii(
|
||||
$"{{ xmfhtmlgump {X} {Y} {Width} {Height} {Number} {(Background ? "1" : "0")} {(Scrollbar ? "1" : "0")} }}"
|
||||
);
|
||||
break;
|
||||
}
|
||||
case GumpHtmlLocalizedType.Color:
|
||||
{
|
||||
writer.WriteAscii(
|
||||
$"{{ xmfhtmlgumpcolor {X} {Y} {Width} {Height} {Number} {(Background ? "1" : "0")} {(Scrollbar ? "1" : "0")} {Color} }}"
|
||||
);
|
||||
break;
|
||||
}
|
||||
case GumpHtmlLocalizedType.Args:
|
||||
{
|
||||
writer.WriteAscii(
|
||||
$"{{ xmfhtmltok {X} {Y} {Width} {Height} {(Background ? "1" : "0")} {(Scrollbar ? "1" : "0")} {Color} {Number} @{Args}@ }}"
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,16 +41,25 @@ public class GumpImage : GumpEntry
|
|||
|
||||
public override void AppendTo(ref SpanWriter writer, OrderedSet<string> strings, ref int entries, ref int switches)
|
||||
{
|
||||
var hasHue = Hue != 0;
|
||||
var hasClass = !string.IsNullOrEmpty(Class);
|
||||
writer.WriteAscii(
|
||||
hasHue switch
|
||||
if (Hue != 0)
|
||||
{
|
||||
if (hasClass)
|
||||
{
|
||||
true when hasClass => $"{{ gumppic {X} {Y} {GumpID} hue={Hue} class={Class} }}",
|
||||
true => $"{{ gumppic {X} {Y} {GumpID} hue={Hue} }}",
|
||||
false when hasClass => $"{{ gumppic {X} {Y} {GumpID} class={Class} }}",
|
||||
false => $"{{ gumppic {X} {Y} {GumpID} }}",
|
||||
writer.WriteAscii($"{{ gumppic {X} {Y} {GumpID} hue={Hue} class={Class} }}");
|
||||
}
|
||||
);
|
||||
else
|
||||
{
|
||||
writer.WriteAscii($"{{ gumppic {X} {Y} {GumpID} hue={Hue} }}");
|
||||
}
|
||||
}
|
||||
else if (hasClass)
|
||||
{
|
||||
writer.WriteAscii($"{{ gumppic {X} {Y} {GumpID} class={Class} }}");
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteAscii($"{{ gumppic {X} {Y} {GumpID} }}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue