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

@ -29,7 +29,7 @@ namespace Server.Items
public override void AddNameProperty( ObjectPropertyList list )
{
list.Add( 1075200, String.Format( "#{0}", (int) Form ) );
list.Add( 1075200, $"#{(int) Form}");
}
public override void Serialize( GenericWriter writer )

View file

@ -37,7 +37,7 @@ namespace Server.Items
{
base.GetProperties( list );
list.Add( 1070998, String.Format( "#{0}", 1076595 ) ); // Use this to redeem<br>Your Heritage Items
list.Add( 1070998, $"#{1076595}"); // Use this to redeem<br>Your Heritage Items
}
public override void Serialize( GenericWriter writer )

View file

@ -46,7 +46,7 @@ namespace Server.Items
set => m_Maker = value;
}
public override string DefaultName => String.Format("A Holiday Bell From {0}", Giver);
public override string DefaultName => $"A Holiday Bell From {Giver}";
private string m_Maker;
private int m_SoundID;

View file

@ -178,7 +178,7 @@ namespace Server.Items
if ( idx < 0 || idx >= m_PlaceNames.Length )
return "a snowy scene";
return String.Format( "a snowy scene of {0}", m_PlaceNames[idx] );
return $"a snowy scene of {m_PlaceNames[idx]}";
}
}

View file

@ -180,42 +180,25 @@ namespace Server.Items
if ( deed.IsExpired )
{
return String.Format(
"<bodytextblack>" +
"This deed once entitled the bearer to build a house on the plot of land " +
"located at {0} on the {1} facet.<br><br>" +
"The deed has expired, and now the indicated plot of land " +
"is subject to normal house construction rules.<br><br>" +
"This deed functions as a recall rune marked for the location of the plot it represents." +
"</bodytextblack>",
HouseRaffleStone.FormatLocation( deed.PlotLocation, deed.PlotFacet, false ),
deed.PlotFacet
);
return "<bodytextblack>" +
"This deed once entitled the bearer to build a house on the plot of land " +
$"located at {HouseRaffleStone.FormatLocation(deed.PlotLocation, deed.PlotFacet, false)} on the {deed.PlotFacet} facet.<br><br>" +
"The deed has expired, and now the indicated plot of land " +
"is subject to normal house construction rules.<br><br>" +
"This deed functions as a recall rune marked for the location of the plot it represents." +
"</bodytextblack>";
}
else
{
int daysLeft = (int)Math.Ceiling( ( deed.Stone.Started + deed.Stone.Duration + HouseRaffleStone.ExpirationTime - DateTime.UtcNow ).TotalDays );
return String.Format(
"<bodytextblack>" +
"This deed entitles the bearer to build a house on the plot of land " +
"located at {0} on the {1} facet.<br><br>" +
"The deed will expire after {2} more day{3} have passed, and at that time the right to place " +
"a house reverts to normal house construction rules.<br><br>" +
"This deed functions as a recall rune marked for the location of the plot it represents.<br><br>" +
"To place a house on the deeded plot, you must simply have this deed in your backpack " +
"or bank box when using a House Placement Tool there." +
"</bodytextblack>",
HouseRaffleStone.FormatLocation( deed.PlotLocation, deed.PlotFacet, false ),
deed.PlotFacet,
daysLeft,
( daysLeft == 1 ) ? "" : "s"
);
return "<bodytextblack>" + "This deed entitles the bearer to build a house on the plot of land " +
$"located at {HouseRaffleStone.FormatLocation(deed.PlotLocation, deed.PlotFacet, false)} on the {deed.PlotFacet} facet.<br><br>" +
$"The deed will expire after {daysLeft} more day{((daysLeft == 1) ? "" : "s")} have passed, and at that time the right to place " +
"a house reverts to normal house construction rules.<br><br>" +
"This deed functions as a recall rune marked for the location of the plot it represents.<br><br>" +
"To place a house on the deeded plot, you must simply have this deed in your backpack " +
"or bank box when using a House Placement Tool there." + "</bodytextblack>";
}
}
}

View file

@ -18,17 +18,17 @@ namespace Server.Gumps
public string Right( string text )
{
return String.Format( "<DIV ALIGN=RIGHT>{0}</DIV>", text );
return $"<DIV ALIGN=RIGHT>{text}</DIV>";
}
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 const int LabelColor = 0xFFFFFF;
@ -203,7 +203,7 @@ namespace Server.Gumps
if ( entry.From != null )
{
if ( entry.From.Account is Account acc )
name = String.Format( "{0} ({1})", entry.From.Name, acc );
name = $"{entry.From.Name} ({acc})";
else
name = entry.From.Name;
}

View file

@ -380,7 +380,7 @@ namespace Server.Items
if ( m_TicketPrice == 0 )
return "FREE";
else
return String.Format( "{0} gold", m_TicketPrice );
return $"{m_TicketPrice} gold";
}
public override void GetProperties( ObjectPropertyList list )
@ -414,12 +414,12 @@ namespace Server.Items
{
case HouseRaffleState.Active:
{
LabelTo( from, 1060658, String.Format( "Ends\t{0}", m_Started + m_Duration ) ); // ~1_val~: ~2_val~
LabelTo( from, 1060658, $"Ends\t{m_Started + m_Duration}"); // ~1_val~: ~2_val~
break;
}
case HouseRaffleState.Completed:
{
LabelTo( from, 1060658, String.Format( "Winner\t{0}", ( m_Winner == null ) ? "Unknown" : m_Winner.Name ) ); // ~1_val~: ~2_val~
LabelTo( from, 1060658, $"Winner\t{((m_Winner == null) ? "Unknown" : m_Winner.Name)}"); // ~1_val~: ~2_val~
break;
}
}
@ -461,7 +461,8 @@ namespace Server.Items
}
else
{
from.SendGump( new WarningGump( 1150470, 0x7F00, String.Format( "You are about to purchase a raffle ticket for the house plot located at {0}. The ticket price is {1}. Tickets are non-refundable and you can only purchase one ticket per account. Do you wish to continue?", FormatLocation(), FormatPrice() ), 0xFFFFFF, 420, 280, new WarningGumpCallback( Purchase_Callback ), null ) ); // CONFIRM TICKET PURCHASE
from.SendGump( new WarningGump( 1150470, 0x7F00,
$"You are about to purchase a raffle ticket for the house plot located at {FormatLocation()}. The ticket price is {FormatPrice()}. Tickets are non-refundable and you can only purchase one ticket per account. Do you wish to continue?", 0xFFFFFF, 420, 280, new WarningGumpCallback( Purchase_Callback ), null ) ); // CONFIRM TICKET PURCHASE
}
}

View file

@ -134,7 +134,7 @@ namespace Server.Items
string name = LastUserName;
if ( name == null )
name = String.Format( "#{0}", 1074235 ); // Unknown
name = $"#{1074235}"; // Unknown
list.Add( 1041602, "{0}", name ); // Owner: ~1_val~
}

View file

@ -25,7 +25,7 @@ namespace Server.Items
}
}
public override string DefaultTitle => String.Format( "<basefont color=#FFFFFF>Power Scroll ({0} Skill):</basefont>", Value );
public override string DefaultTitle => $"<basefont color=#FFFFFF>Power Scroll ({Value} Skill):</basefont>";
private static SkillName[] m_Skills = new[]
{

View file

@ -11,7 +11,8 @@ namespace Server.Items
*level in that skill by the amount of points displayed on the scroll.
*As you may not gain skills beyond your maximum skill cap, any excess points will be lost.*/
public override string DefaultTitle => String.Format( "<basefont color=#FFFFFF>Scroll of Transcendence ({0} Skill):</basefont>", Value );
public override string DefaultTitle =>
$"<basefont color=#FFFFFF>Scroll of Transcendence ({Value} Skill):</basefont>";
public static ScrollofTranscendence CreateRandom( int min, int max )
{

View file

@ -26,7 +26,8 @@ namespace Server.Items
}
}
public override string DefaultTitle => String.Format( "<basefont color=#FFFFFF>Power Scroll ({0}{1} Maximum Stats):</basefont>", ( (int)Value - 225 ) >= 0 ? "+" : "", (int)Value - 225 );
public override string DefaultTitle =>
$"<basefont color=#FFFFFF>Power Scroll ({(((int) Value - 225) >= 0 ? "+" : "")}{(int) Value - 225} Maximum Stats):</basefont>";
public StatCapScroll() : this( 105 )
{

View file

@ -46,14 +46,15 @@ namespace Server.Items
public override void AddNameProperty(ObjectPropertyList list)
{
list.Add(m_LabelNumber, String.Format("{0}\t{1}", (m_To != null) ? m_To : Unsigned, (m_From != null) ? m_From : Unsigned));
list.Add(m_LabelNumber, $"{((m_To != null) ? m_To : Unsigned)}\t{((m_From != null) ? m_From : Unsigned)}");
}
public override void OnSingleClick( Mobile from )
{
base.OnSingleClick( from );
LabelTo( from, m_LabelNumber, String.Format( "{0}\t{1}", ( m_To != null ) ? m_To : Unsigned, ( m_From != null ) ? m_From : Unsigned ) );
LabelTo( from, m_LabelNumber,
$"{((m_To != null) ? m_To : Unsigned)}\t{((m_From != null) ? m_From : Unsigned)}");
}
public override void OnDoubleClick(Mobile from)