Fixes string interpolation

This commit is contained in:
Kamron Batman 2018-09-14 13:07:43 -07:00
parent 42d0b6271f
commit 7d3a0ca265
233 changed files with 758 additions and 690 deletions

View file

@ -92,7 +92,8 @@ namespace Server.Engines.Help
string typeString = PageQueue.GetPageTypeName( e.Type );
string html = String.Format( "[{0}] {1} <basefont color=#{2:X6}>[<u>{3}</u>]</basefont>", typeString, e.Message, e.Handler == null ? 0xFF0000 : 0xFF, e.Handler == null ? "Unhandled" : "Handling" );
string html =
$"[{typeString}] {e.Message} <basefont color=#{(e.Handler == null ? 0xFF0000 : 0xFF):X6}>[<u>{(e.Handler == null ? "Unhandled" : "Handling")}</u>]</basefont>";
Add( new GumpHtml( 12, 44 + ((i % 5) * 80), 350, 70, html, true, true ) );
Add( new GumpButton( 370, 44 + ((i % 5) * 80) + 24, 0xFA5, 0xFA7, i + 1, GumpButtonType.Reply, 0 ) );
@ -242,12 +243,12 @@ namespace Server.Engines.Help
public string Center( string text )
{
return String.Format( "<CENTER>{0}</CENTER>", text );
return $"<CENTER>{text}</CENTER>";
}
public string Color( string text, int color )
{
return String.Format( "<BASEFONT COLOR=#{0:X6}>{1}</BASEFONT>", color, text );
return $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
}
public void AddTextInput( int x, int y, int w, int h, int id, string def )
@ -297,7 +298,7 @@ namespace Server.Engines.Help
PredefinedResponse resp = (PredefinedResponse)list[i];
string html = String.Format( "<u>{0}</u><br>{1}", resp.Title, resp.Message );
string html = $"<u>{resp.Title}</u><br>{resp.Message}";
AddHtml( 12, 44 + ((i % 5) * 80), 350, 70, html, true, true );
@ -501,7 +502,8 @@ namespace Server.Engines.Help
AddLabelCropped( 128, 18, 264, 20, 2100, entry.Sent.ToString() );
AddLabel( 18, 38, 2100, "Sender:" );
AddLabelCropped( 128, 38, 264, 20, 2100, String.Format( "{0} {1} [{2}]", entry.Sender.RawName, entry.Sender.Location, entry.Sender.Map ) );
AddLabelCropped( 128, 38, 264, 20, 2100,
$"{entry.Sender.RawName} {entry.Sender.Location} [{entry.Sender.Map}]");
AddButton( 18, bottom - (buttons * 22), 0xFAB, 0xFAD, 8, GumpButtonType.Reply, 0 );
AddImageTiled( 52, bottom - (buttons * 22) + 1, 340, 80, 0xA40/*0xBBC*//*0x2458*/ );
@ -549,7 +551,7 @@ namespace Server.Engines.Help
}
AddLabel( 18, 78, 2100, "Page Location:" );
AddLabelCropped( 128, 78, 264, 20, 2100, String.Format( "{0} [{1}]", entry.PageLocation, entry.PageMap ) );
AddLabelCropped( 128, 78, 264, 20, 2100, $"{entry.PageLocation} [{entry.PageMap}]");
AddButton( 18, bottom - (buttons * 22), 0xFA5, 0xFA7, 3, GumpButtonType.Reply, 0 );
AddLabel( 52, bottom - (buttons++ * 22), 2100, "Go to Page Location" );

View file

@ -21,7 +21,7 @@ namespace Server.Engines.Help
AddHtmlLocalized( 150, 40, 360, 40, 1062610, false, false ); // <CENTER><U>Ultima Online Help Response</U></CENTER>
AddHtml( 80, 90, 480, 290, String.Format( "{0} tells {1}: {2}", name, from.Name, text ), true, true );
AddHtml( 80, 90, 480, 290, $"{name} tells {@from.Name}: {text}", true, true );
AddHtmlLocalized( 80, 390, 480, 40, 1062611, false, false ); // Clicking the OKAY button will remove the reponse you have received.
AddButton( 400, 417, 2074, 2075, 1, GumpButtonType.Reply, 0 ); // OKAY

View file

@ -37,7 +37,8 @@ namespace Server.Engines.Help
string playerName = player.Name;
string playerAccount = player.Account is Account ? player.Account.Username : "???";
AddHtml( 10, 10, 280, 20, String.Format( "<basefont color=#A0A0FF><center>SPEECH LOG - {0} (<i>{1}</i>)</center></basefont>", playerName, Utility.FixHtml( playerAccount ) ), false, false );
AddHtml( 10, 10, 280, 20,
$"<basefont color=#A0A0FF><center>SPEECH LOG - {playerName} (<i>{Utility.FixHtml(playerAccount)}</i>)</center></basefont>", false, false );
int lastPage = ( log.Count - 1 ) / MaxEntriesPerPage;
@ -78,7 +79,7 @@ namespace Server.Engines.Help
if ( page > 0 )
AddButton( 10, 395, 0xFAE, 0xFB0, 1, GumpButtonType.Reply, 0 ); // Previous page
AddLabel( 45, 395, 0x481, String.Format( "Current page: {0}/{1}", page + 1, lastPage + 1 ) );
AddLabel( 45, 395, 0x481, $"Current page: {page + 1}/{lastPage + 1}");
if ( page < lastPage )
AddButton( 261, 395, 0xFA5, 0xFA7, 2, GumpButtonType.Reply, 0 ); // Next page