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

@ -12,7 +12,7 @@ namespace Server.Gumps
protected override void Design()
{
AddHtml( 20, 10, 500, 35, String.Format( "<center>{0}</center>", m_Guild.Name ), false, false );
AddHtml( 20, 10, 500, 35, $"<center>{m_Guild.Name}</center>", false, false );
AddButton( 20, 400, 4005, 4007, 1, GumpButtonType.Reply, 0 );
AddHtmlLocalized( 55, 400, 300, 35, 1011120, false, false ); // Return to the main menu.

View file

@ -136,7 +136,7 @@ namespace Server.Guilds
public static string Color( string text, int color )
{
return String.Format( "<BASEFONT COLOR=#{0:X6}>{1}</BASEFONT>", color, text );
return $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
}
}
}

View file

@ -21,7 +21,7 @@ namespace Server.Guilds
AddBackground( 0, 0, 350, 170, 0x2422 );
AddHtmlLocalized( 25, 20, 300, 45, 1062946, 0x0, true, false ); // <center>You have been invited to join a guild! (Warning: Accepting will make you attackable!)</center>
AddHtml( 25, 75, 300, 25, String.Format( "<center>{0}</center>", guild.Name ), true, false );
AddHtml( 25, 75, 300, 25, $"<center>{guild.Name}</center>", true, false );
AddButton( 265, 130, 0xF7, 0xF8, 1, GumpButtonType.Reply, 0 );
AddButton( 195, 130, 0xF2, 0xF1, 0, GumpButtonType.Reply, 0 );
AddButton( 20, 130, 0xD2, 0xD3, 2, GumpButtonType.Reply, 0 );
@ -38,14 +38,14 @@ namespace Server.Guilds
{
case 0:
{
m_Inviter.SendLocalizedMessage( 1063250, String.Format( "{0}\t{1}", player.Name, guild.Name ) ); // ~1_val~ has declined your invitation to join ~2_val~.
m_Inviter.SendLocalizedMessage( 1063250, $"{player.Name}\t{guild.Name}"); // ~1_val~ has declined your invitation to join ~2_val~.
break;
}
case 1:
{
guild.AddMember( player );
player.SendLocalizedMessage( 1063056, guild.Name ); // You have joined ~1_val~.
m_Inviter.SendLocalizedMessage( 1063249, String.Format( "{0}\t{1}", player.Name, guild.Name ) ); // ~1_val~ has accepted your invitation to join ~2_val~.
m_Inviter.SendLocalizedMessage( 1063249, $"{player.Name}\t{guild.Name}"); // ~1_val~ has accepted your invitation to join ~2_val~.
break;
}

View file

@ -142,7 +142,7 @@ namespace Server.Guilds
{
TextDefinition[] defs = new TextDefinition[aryLength];
string name = String.Format( "{0}{1}", pm.Name, ( player.GuildFealty == pm && player.GuildFealty != guild.Leader ) ? " *" : "" );
string name = $"{pm.Name}{((player.GuildFealty == pm && player.GuildFealty != guild.Leader) ? " *" : "")}";
if ( pm == player )
name = Color( name, 0x006600 );

View file

@ -77,7 +77,7 @@ namespace Server.Guilds
if ( ActiveWar )
{
kills = String.Format( "{0}/{1}", activeWar.Kills, activeWar.MaxKills );
kills = $"{activeWar.Kills}/{activeWar.MaxKills}";
TimeSpan timeRemaining = TimeSpan.Zero;
@ -85,21 +85,21 @@ namespace Server.Guilds
timeRemaining = (activeWar.WarBeginning + activeWar.WarLength) - DateTime.UtcNow;
//time = String.Format( "{0:D2}:{1:D2}", timeRemaining.Hours.ToString(), timeRemaining.Subtract( TimeSpan.FromHours( timeRemaining.Hours ) ).Minutes ); //Is there a formatter for htis? it's 2AM and I'm tired and can't find it
time = String.Format( "{0:D2}:{1:mm}", timeRemaining.Hours, DateTime.MinValue + timeRemaining );
time = $"{timeRemaining.Hours:D2}:{DateTime.MinValue + timeRemaining:mm}";
otherWar = m_Other.FindActiveWar( guild );
if ( otherWar != null )
otherKills = String.Format( "{0}/{1}", otherWar.Kills, otherWar.MaxKills );
otherKills = $"{otherWar.Kills}/{otherWar.MaxKills}";
}
else if ( PendingWar )
{
kills = Color( String.Format( "{0}/{1}", war.Kills, war.MaxKills ), 0x990000 );
kills = Color($"{war.Kills}/{war.MaxKills}", 0x990000 );
//time = Color( String.Format( "{0}:{1}", war.WarLength.Hours, ((TimeSpan)(war.WarLength - TimeSpan.FromHours( war.WarLength.Hours ))).Minutes ), 0xFF0000 );
time = Color( String.Format( "{0:D2}:{1:mm}", war.WarLength.Hours, DateTime.MinValue + war.WarLength ), 0x990000 );
time = Color($"{war.WarLength.Hours:D2}:{DateTime.MinValue + war.WarLength:mm}", 0x990000 );
otherWar = m_Other.FindPendingWar( guild );
if ( otherWar != null )
otherKills = Color( String.Format( "{0}/{1}", otherWar.Kills, otherWar.MaxKills ), 0x990000 );
otherKills = Color($"{otherWar.Kills}/{otherWar.MaxKills}", 0x990000 );
}
AddHtmlLocalized( 280, 110, 120, 26, 1062966, 0x0, true, false ); // <i>Your Kills</i>
@ -225,7 +225,7 @@ namespace Server.Guilds
}
else if ( alliance != null && alliance.Leader != guild )
{
pm.SendLocalizedMessage( 1063239, String.Format( "{0}\t{1}", guild.Name, alliance.Name ) ); // ~1_val~ is not the leader of the ~2_val~ alliance.
pm.SendLocalizedMessage( 1063239, $"{guild.Name}\t{alliance.Name}"); // ~1_val~ is not the leader of the ~2_val~ alliance.
pm.SendLocalizedMessage( 1070707, alliance.Leader.Name ); // You need to negotiate via ~1_val~ instead.
}
else
@ -276,7 +276,7 @@ namespace Server.Guilds
}
else if ( alliance != null && alliance.Leader != guild )
{
pm.SendLocalizedMessage( 1063239, String.Format( "{0}\t{1}", guild.Name, alliance.Name ) ); // ~1_val~ is not the leader of the ~2_val~ alliance.
pm.SendLocalizedMessage( 1063239, $"{guild.Name}\t{alliance.Name}"); // ~1_val~ is not the leader of the ~2_val~ alliance.
pm.SendLocalizedMessage( 1070707, alliance.Leader.Name ); // You need to negotiate via ~1_val~ instead.
}
else
@ -296,7 +296,7 @@ namespace Server.Guilds
}
else if ( alliance != null && alliance.Leader != guild )
{
pm.SendLocalizedMessage( 1063239, String.Format( "{0}\t{1}", guild.Name, alliance.Name ) ); // ~1_val~ is not the leader of the ~2_val~ alliance.
pm.SendLocalizedMessage( 1063239, $"{guild.Name}\t{alliance.Name}"); // ~1_val~ is not the leader of the ~2_val~ alliance.
pm.SendLocalizedMessage( 1070707, alliance.Leader.Name ); // You need to negotiate via ~1_val~ instead.
}
else
@ -318,7 +318,7 @@ namespace Server.Guilds
}
else if ( alliance != null && alliance.Leader != guild )
{
pm.SendLocalizedMessage( 1063239, String.Format( "{0}\t{1}", guild.Name, alliance.Name ) ); // ~1_val~ is not the leader of the ~2_val~ alliance.
pm.SendLocalizedMessage( 1063239, $"{guild.Name}\t{alliance.Name}"); // ~1_val~ is not the leader of the ~2_val~ alliance.
pm.SendLocalizedMessage( 1070707, alliance.Leader.Name ); // You need to negotiate via ~1_val~ instead.
}
else
@ -364,12 +364,12 @@ namespace Server.Guilds
}
else if ( alliance != null && alliance.Leader != guild )
{
pm.SendLocalizedMessage( 1063239, String.Format( "{0}\t{1}", guild.Name, alliance.Name ) ); // ~1_val~ is not the leader of the ~2_val~ alliance.
pm.SendLocalizedMessage( 1063239, $"{guild.Name}\t{alliance.Name}"); // ~1_val~ is not the leader of the ~2_val~ alliance.
pm.SendLocalizedMessage( 1070707, alliance.Leader.Name ); // You need to negotiate via ~1_val~ instead.
}
else if ( otherAlliance != null && otherAlliance.Leader != m_Other )
{
pm.SendLocalizedMessage( 1063239, String.Format( "{0}\t{1}", m_Other.Name, otherAlliance.Name ) ); // ~1_val~ is not the leader of the ~2_val~ alliance.
pm.SendLocalizedMessage( 1063239, $"{m_Other.Name}\t{otherAlliance.Name}"); // ~1_val~ is not the leader of the ~2_val~ alliance.
pm.SendLocalizedMessage( 1070707, otherAlliance.Leader.Name ); // You need to negotiate via ~1_val~ instead.
}
else
@ -424,7 +424,7 @@ namespace Server.Guilds
}
else if ( alliance.Leader != guild )
{
pm.SendLocalizedMessage( 1063239, String.Format( "{0}\t{1}", guild.Name, alliance.Name ) ); // ~1_val~ is not the leader of the ~2_val~ alliance.
pm.SendLocalizedMessage( 1063239, $"{guild.Name}\t{alliance.Name}"); // ~1_val~ is not the leader of the ~2_val~ alliance.
}
else if ( otherAlliance != null )
{
@ -494,7 +494,7 @@ namespace Server.Guilds
}
else if ( alliance != null && alliance.Leader != guild )
{
pm.SendLocalizedMessage( 1063239, String.Format( "{0}\t{1}", guild.Name, alliance.Name ) ); // ~1_val~ is not the leader of the ~2_val~ alliance.
pm.SendLocalizedMessage( 1063239, $"{guild.Name}\t{alliance.Name}"); // ~1_val~ is not the leader of the ~2_val~ alliance.
}
else if ( alliance != null && alliance.IsMember( guild ) && alliance.IsMember( m_Other ) )
{
@ -514,11 +514,11 @@ namespace Server.Guilds
}
else if ( alliance != null && alliance.Leader != guild )
{
pm.SendLocalizedMessage( 1063239, String.Format( "{0}\t{1}", guild.Name, alliance.Name ) ); // ~1_val~ is not the leader of the ~2_val~ alliance.
pm.SendLocalizedMessage( 1063239, $"{guild.Name}\t{alliance.Name}"); // ~1_val~ is not the leader of the ~2_val~ alliance.
}
else if ( alliance != null && alliance.IsMember( guild ) && alliance.IsMember( m_Other ) )
{
pm.SendLocalizedMessage( 1063434, String.Format( "{0}\t{1}", m_Other.Name, alliance.Name ) ); // ~1_val~ is now the leader of ~2_val~.
pm.SendLocalizedMessage( 1063434, $"{m_Other.Name}\t{alliance.Name}"); // ~1_val~ is now the leader of ~2_val~.
alliance.Leader = m_Other;
}

View file

@ -59,12 +59,12 @@ namespace Server.Guilds
}
else if ( alliance != null && alliance.Leader != guild )
{
pm.SendLocalizedMessage( 1063239, String.Format( "{0}\t{1}", guild.Name, alliance.Name ) ); // ~1_val~ is not the leader of the ~2_val~ alliance.
pm.SendLocalizedMessage( 1063239, $"{guild.Name}\t{alliance.Name}"); // ~1_val~ is not the leader of the ~2_val~ alliance.
pm.SendLocalizedMessage( 1070707, alliance.Leader.Name ); // You need to negotiate via ~1_val~ instead.
}
else if ( otherAlliance != null && otherAlliance.Leader != m_Other )
{
pm.SendLocalizedMessage( 1063239, String.Format( "{0}\t{1}", m_Other.Name, otherAlliance.Name ) ); // ~1_val~ is not the leader of the ~2_val~ alliance.
pm.SendLocalizedMessage( 1063239, $"{m_Other.Name}\t{otherAlliance.Name}"); // ~1_val~ is not the leader of the ~2_val~ alliance.
pm.SendLocalizedMessage( 1070707, otherAlliance.Leader.Name ); // You need to negotiate via ~1_val~ instead.
}
else