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

@ -209,7 +209,7 @@ namespace Server.Items
if ( se.Count == 1 )
PublicOverheadMessage( MessageType.Regular, 0x3B2, 1062719, se.Total.ToString() );
else
PublicOverheadMessage( MessageType.Regular, 0x3B2, 1042683, String.Format( "{0}\t{1}", se.Total, se.Count ) );
PublicOverheadMessage( MessageType.Regular, 0x3B2, 1042683, $"{se.Total}\t{se.Count}");
return;
}
@ -249,7 +249,8 @@ namespace Server.Items
if ( split )
{
PublicOverheadMessage( MessageType.Regular, 0x3B2, 1010027 + area, String.Format( "{0}\t{1}", from.Name, isArrow ? "arrow" : "bolt" ) );
PublicOverheadMessage( MessageType.Regular, 0x3B2, 1010027 + area,
$"{@from.Name}\t{(isArrow ? "arrow" : "bolt")}");
}
else
{
@ -266,7 +267,7 @@ namespace Server.Items
if ( se.Count == 1 )
PublicOverheadMessage( MessageType.Regular, 0x3B2, 1062719, se.Total.ToString() );
else
PublicOverheadMessage( MessageType.Regular, 0x3B2, 1042683, String.Format( "{0}\t{1}", se.Total, se.Count ) );
PublicOverheadMessage( MessageType.Regular, 0x3B2, 1042683, $"{se.Total}\t{se.Count}");
}
public override void Serialize( GenericWriter writer )

View file

@ -132,12 +132,12 @@ namespace Server.Items
if ( !isOwner )
AddButton( 20, 240, 0xFA5, 0xFA7, 3, GumpButtonType.Reply, 0 );
AddHtmlLocalized( 55, 242, 25, 35, 1011004, false, false ); // aye:
AddLabel( 78, 242, 0x0, String.Format( "[{0}]", yesCount ) );
AddLabel( 78, 242, 0x0, $"[{yesCount}]");
if ( !isOwner )
AddButton( 20, 275, 0xFA5, 0xFA7, 4, GumpButtonType.Reply, 0 );
AddHtmlLocalized( 55, 277, 25, 35, 1011005, false, false ); // nay:
AddLabel( 78, 277, 0x0, String.Format( "[{0}]", noCount ) );
AddLabel( 78, 277, 0x0, $"[{noCount}]");
if ( totalVotes > 0 )
{

View file

@ -21,7 +21,8 @@ namespace Server.Items
if ( map == Map.Trammel || map == Map.Felucca )
{
from.MoveToWorld( new Point3D( 5922, 2024, 0 ), map );
PublicOverheadMessage( MessageType.Regular, 0x3B2, true, String.Format( "* {0} dives into the hole and disappears!*", from.Name ) );
PublicOverheadMessage( MessageType.Regular, 0x3B2, true,
$"* {@from.Name} dives into the hole and disappears!*");
}
}
else

View file

@ -300,7 +300,7 @@ namespace Server.Items
if ( m_RewardAvailable )
LabelTo( from, 1074362 ); // A reward is available!
LabelTo( from, 1074247, String.Format("{0}\t{1}", m_LiveCreatures, MaxLiveCreatures) ); // Live Creatures: ~1_NUM~ / ~2_MAX~
LabelTo( from, 1074247, $"{m_LiveCreatures}\t{MaxLiveCreatures}"); // Live Creatures: ~1_NUM~ / ~2_MAX~
if ( DeadCreatures > 0 )
LabelTo( from, 1074248, DeadCreatures.ToString() ); // Dead Creatures: ~1_NUM~
@ -314,18 +314,18 @@ namespace Server.Items
LabelTo( from, 1074251, "#" + WaterNumber() ); // Water state: ~1_STATE~
if ( m_Food.State == (int) FoodState.Dead )
LabelTo( from, 1074577, String.Format("{0}\t{1}", m_Food.Added, m_Food.Improve) ); // Food Added: ~1_CUR~ Needed: ~2_NEED~
LabelTo( from, 1074577, $"{m_Food.Added}\t{m_Food.Improve}"); // Food Added: ~1_CUR~ Needed: ~2_NEED~
else if ( m_Food.State == (int) FoodState.Overfed )
LabelTo( from, 1074577, String.Format("{0}\t{1}", m_Food.Added, m_Food.Maintain) ); // Food Added: ~1_CUR~ Needed: ~2_NEED~
LabelTo( from, 1074577, $"{m_Food.Added}\t{m_Food.Maintain}"); // Food Added: ~1_CUR~ Needed: ~2_NEED~
else
LabelTo( from, 1074253, String.Format("{0}\t{1}\t{2}", m_Food.Added, m_Food.Maintain, m_Food.Improve) ); // Food Added: ~1_CUR~ Feed: ~2_NEED~ Improve: ~3_GROW~
LabelTo( from, 1074253, $"{m_Food.Added}\t{m_Food.Maintain}\t{m_Food.Improve}"); // Food Added: ~1_CUR~ Feed: ~2_NEED~ Improve: ~3_GROW~
if ( m_Water.State == (int) WaterState.Dead )
LabelTo( from, 1074578, String.Format("{0}\t{1}", m_Water.Added, m_Water.Improve) ); // Water Added: ~1_CUR~ Needed: ~2_NEED~
LabelTo( from, 1074578, $"{m_Water.Added}\t{m_Water.Improve}"); // Water Added: ~1_CUR~ Needed: ~2_NEED~
else if ( m_Water.State == (int) WaterState.Strong )
LabelTo( from, 1074578, String.Format("{0}\t{1}", m_Water.Added, m_Water.Maintain) ); // Water Added: ~1_CUR~ Needed: ~2_NEED~
LabelTo( from, 1074578, $"{m_Water.Added}\t{m_Water.Maintain}"); // Water Added: ~1_CUR~ Needed: ~2_NEED~
else
LabelTo( from, 1074254, String.Format("{0}\t{1}\t{2}", m_Water.Added, m_Water.Maintain, m_Water.Improve) ); // Water Added: ~1_CUR~ Maintain: ~2_NEED~ Improve: ~3_GROW~
LabelTo( from, 1074254, $"{m_Water.Added}\t{m_Water.Maintain}\t{m_Water.Improve}"); // Water Added: ~1_CUR~ Maintain: ~2_NEED~ Improve: ~3_GROW~
}
public override void AddNameProperties( ObjectPropertyList list )
@ -702,7 +702,7 @@ namespace Server.Items
return;
}
to.SendLocalizedMessage( 1074360, String.Format( "#{0}", item.LabelNumber ) ); // You receive a reward: ~1_REWARD~
to.SendLocalizedMessage( 1074360, $"#{item.LabelNumber}"); // You receive a reward: ~1_REWARD~
to.PlaySound( 0x5A3 );
m_RewardAvailable = false;
@ -834,7 +834,7 @@ namespace Server.Items
m_LiveCreatures += 1;
if ( from != null )
from.SendLocalizedMessage( 1073632, String.Format( "#{0}", fish.LabelNumber ) ); // You add the following creature to your aquarium: ~1_FISH~
from.SendLocalizedMessage( 1073632, $"#{fish.LabelNumber}"); // You add the following creature to your aquarium: ~1_FISH~
InvalidateProperties();
return true;
@ -866,7 +866,7 @@ namespace Server.Items
AddItem( item );
from?.SendLocalizedMessage( 1073635, ( item.LabelNumber != 0 ) ? String.Format( "#{0}", item.LabelNumber ) : item.Name ); // You add the following decoration to your aquarium: ~1_NAME~
from?.SendLocalizedMessage( 1073635, ( item.LabelNumber != 0 ) ? $"#{item.LabelNumber}" : item.Name ); // You add the following decoration to your aquarium: ~1_NAME~
InvalidateProperties();
return true;

View file

@ -48,7 +48,7 @@ namespace Server.Items
AddItem( 150, 80, item.ItemID, item.Hue );
// item number / all items
AddHtml( 20, 195, 250, 20, String.Format( "<BASEFONT COLOR=#FFFFFF>{0}/{1}</BASEFONT>", page, m_Aquarium.Items.Count ), false, false );
AddHtml( 20, 195, 250, 20, $"<BASEFONT COLOR=#FFFFFF>{page}/{m_Aquarium.Items.Count}</BASEFONT>", false, false );
// remove item
if ( edit )

View file

@ -1314,7 +1314,7 @@ namespace Server.Items
string name = Name;
if ( name == null )
name = String.Format( "#{0}", LabelNumber );
name = $"#{LabelNumber}";
return name;
}

View file

@ -121,7 +121,7 @@ namespace Server.Items
base.OnSingleClick( from );
if ( IsArcane )
LabelTo( from, 1061837, String.Format( "{0}\t{1}", m_CurArcaneCharges, m_MaxArcaneCharges ) );
LabelTo( from, 1061837, $"{m_CurArcaneCharges}\t{m_MaxArcaneCharges}");
}
public void Flip()

View file

@ -120,7 +120,7 @@ namespace Server.Items
base.OnSingleClick( from );
if ( IsArcane )
LabelTo( from, 1061837, String.Format( "{0}\t{1}", m_CurArcaneCharges, m_MaxArcaneCharges ) );
LabelTo( from, 1061837, $"{m_CurArcaneCharges}\t{m_MaxArcaneCharges}");
}
public void Flip()

View file

@ -38,13 +38,13 @@ namespace Server.Items
switch ( m_HeadType )
{
default:
return String.Format( "the head of {0}", m_PlayerName );
return $"the head of {m_PlayerName}";
case HeadType.Duel:
return String.Format( "the head of {0}, taken in a duel", m_PlayerName );
return $"the head of {m_PlayerName}, taken in a duel";
case HeadType.Tournament:
return String.Format( "the head of {0}, taken in a tournament", m_PlayerName );
return $"the head of {m_PlayerName}, taken in a tournament";
}
}
}

View file

@ -501,7 +501,7 @@ namespace Server.Items
string name = Name;
if ( name == null )
name = String.Format( "#{0}", LabelNumber );
name = $"#{LabelNumber}";
return name;
}

View file

@ -79,7 +79,7 @@ namespace Server.Items
base.OnSingleClick( from );
if ( IsArcane )
LabelTo( from, 1061837, String.Format( "{0}\t{1}", m_CurArcaneCharges, m_MaxArcaneCharges ) );
LabelTo( from, 1061837, $"{m_CurArcaneCharges}\t{m_MaxArcaneCharges}");
}
public void Flip()

View file

@ -526,7 +526,7 @@ namespace Server.Items
base.OnSingleClick( from );
if ( IsArcane )
LabelTo( from, 1061837, String.Format( "{0}\t{1}", m_CurArcaneCharges, m_MaxArcaneCharges ) );
LabelTo( from, 1061837, $"{m_CurArcaneCharges}\t{m_MaxArcaneCharges}");
}
public void Flip()

View file

@ -151,7 +151,7 @@ namespace Server.Items
base.OnSingleClick( from );
if ( IsArcane )
LabelTo( from, 1061837, String.Format( "{0}\t{1}", m_CurArcaneCharges, m_MaxArcaneCharges ) );
LabelTo( from, 1061837, $"{m_CurArcaneCharges}\t{m_MaxArcaneCharges}");
}
public void Update()

View file

@ -204,7 +204,7 @@ namespace Server.Items
m_Failure = false;
}
else
from.SendLocalizedMessage( 1079973, String.Format( "{0}\t{1}", salvaged, salvaged + notSalvaged ) ); // Salvaged: ~1_COUNT~/~2_NUM~ blacksmithed items
from.SendLocalizedMessage( 1079973, $"{salvaged}\t{salvaged + notSalvaged}"); // Salvaged: ~1_COUNT~/~2_NUM~ blacksmithed items
}
private void SalvageCloth( Mobile from )
@ -235,7 +235,7 @@ namespace Server.Items
++notSalvaged;
}
from.SendLocalizedMessage( 1079974, String.Format( "{0}\t{1}", salvaged, salvaged + notSalvaged ) ); // Salvaged: ~1_COUNT~/~2_NUM~ tailored items
from.SendLocalizedMessage( 1079974, $"{salvaged}\t{salvaged + notSalvaged}"); // Salvaged: ~1_COUNT~/~2_NUM~ tailored items
foreach (Item i in FindItemsByType(typeof(Item), true))
{

View file

@ -100,9 +100,10 @@ namespace Server.Items
string args;
if ( m_Commodity.Name == null )
args = String.Format( "#{0}\t{1}", ( m_Commodity is ICommodity commodity ) ? commodity.DescriptionNumber : m_Commodity.LabelNumber, m_Commodity.Amount );
args =
$"#{((m_Commodity is ICommodity commodity) ? commodity.DescriptionNumber : m_Commodity.LabelNumber)}\t{m_Commodity.Amount}";
else
args = String.Format( "{0}\t{1}", m_Commodity.Name, m_Commodity.Amount );
args = $"{m_Commodity.Name}\t{m_Commodity.Amount}";
list.Add( 1060658, args ); // ~1_val~: ~2_val~
}
@ -121,9 +122,10 @@ namespace Server.Items
string args;
if ( m_Commodity.Name == null )
args = String.Format( "#{0}\t{1}", ( m_Commodity is ICommodity commodity ) ? commodity.DescriptionNumber : m_Commodity.LabelNumber, m_Commodity.Amount );
args =
$"#{((m_Commodity is ICommodity commodity) ? commodity.DescriptionNumber : m_Commodity.LabelNumber)}\t{m_Commodity.Amount}";
else
args = String.Format( "{0}\t{1}", m_Commodity.Name, m_Commodity.Amount );
args = $"{m_Commodity.Name}\t{m_Commodity.Amount}";
LabelTo( from, 1060658, args ); // ~1_val~: ~2_val~
}

View file

@ -63,12 +63,12 @@ namespace Server.Items
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 AddButtonLabeled( int x, int y, int buttonID, string text )
@ -117,7 +117,7 @@ namespace Server.Items
{
m.RawName = newName;
m.SendMessage( "Your name has been changed!" );
m.SendMessage( String.Format( "You are now known as {0}", newName ) );
m.SendMessage($"You are now known as {newName}");
m_Sender.Delete();
}
}

View file

@ -1162,7 +1162,7 @@ namespace Server.Items
protected bool CheckType( string name )
{
return ( World.LoadingType == String.Format( "Server.Items.{0}", name ) );
return ( World.LoadingType == $"Server.Items.{name}");
}
public override void Deserialize( GenericReader reader )

View file

@ -32,7 +32,8 @@ namespace Server.Items
public void Roll( Mobile from )
{
PublicOverheadMessage( MessageType.Regular, 0, false, string.Format( "*{0} rolls {1}, {2}*", from.Name, Utility.Random( 1, 6 ), Utility.Random( 1, 6 ) ) );
PublicOverheadMessage( MessageType.Regular, 0, false,
$"*{@from.Name} rolls {Utility.Random(1, 6)}, {Utility.Random(1, 6)}*");
}
public override void Serialize( GenericWriter writer )

View file

@ -25,7 +25,7 @@ namespace Server.Engines.Mahjong
m_Game.Players.SendGeneralPacket( true, true );
if ( from != null )
m_Game.Players.SendLocalizedMessage( 1062695, string.Format( "{0}\t{1}\t{2}", from.Name, m_First, m_Second ) ); // ~1_name~ rolls the dice and gets a ~2_number~ and a ~3_number~!
m_Game.Players.SendLocalizedMessage( 1062695, $"{@from.Name}\t{m_First}\t{m_Second}"); // ~1_name~ rolls the dice and gets a ~2_number~ and a ~3_number~!
}
public void Save( GenericWriter writer )

View file

@ -378,7 +378,7 @@ namespace Server.Engines.Mahjong
to.Send( new MahjongPlayersInfo( m_Game, to ) );
}
SendLocalizedMessage( 1062774, string.Format( "{0}\t{1}\t{2}", from.Name, to.Name, amount ) ); // ~1_giver~ gives ~2_receiver~ ~3_number~ points.
SendLocalizedMessage( 1062774, $"{@from.Name}\t{to.Name}\t{amount}"); // ~1_giver~ gives ~2_receiver~ ~3_number~ points.
}
public void OpenSeat( int index )

View file

@ -142,11 +142,11 @@ namespace Server.Items
abbr = "";
//list.Add( 1060802, Utility.FixHtml( name ) ); // Guild name: ~1_val~
list.Add( 1060802, String.Format( "{0} [{1}]", Utility.FixHtml( name ), Utility.FixHtml( abbr ) ) );
list.Add( 1060802, $"{Utility.FixHtml(name)} [{Utility.FixHtml(abbr)}]");
}
else if ( m_GuildName != null && m_GuildAbbrev != null )
{
list.Add( 1060802, String.Format( "{0} [{1}]", Utility.FixHtml( m_GuildName ), Utility.FixHtml( m_GuildAbbrev ) ) );
list.Add( 1060802, $"{Utility.FixHtml(m_GuildName)} [{Utility.FixHtml(m_GuildAbbrev)}]");
}
}
@ -365,11 +365,11 @@ namespace Server.Items
abbr = "";
//list.Add( 1060802, Utility.FixHtml( name ) ); // Guild name: ~1_val~
list.Add( 1060802, String.Format( "{0} [{1}]", Utility.FixHtml( name ), Utility.FixHtml( abbr ) ) );
list.Add( 1060802, $"{Utility.FixHtml(name)} [{Utility.FixHtml(abbr)}]");
}
else if ( m_GuildName != null && m_GuildAbbrev != null )
{
list.Add( 1060802, String.Format( "{0} [{1}]", Utility.FixHtml( m_GuildName ), Utility.FixHtml( m_GuildAbbrev ) ) );
list.Add( 1060802, $"{Utility.FixHtml(m_GuildName)} [{Utility.FixHtml(m_GuildAbbrev)}]");
}
}

View file

@ -830,7 +830,8 @@ namespace Server.Items
{
if ( m_Completed )
{
from.Send( new MessageLocalizedAffix( Serial, ItemID, MessageType.Label, 0x3B2, 3, 1048030, "", AffixType.Append, String.Format( " completed by {0}", m_CompletedBy == null ? "someone" : m_CompletedBy.Name ), "" ) );
from.Send( new MessageLocalizedAffix( Serial, ItemID, MessageType.Label, 0x3B2, 3, 1048030, "", AffixType.Append,
$" completed by {(m_CompletedBy == null ? "someone" : m_CompletedBy.Name)}", "" ) );
}
else if ( m_Decoder != null )
{
@ -842,9 +843,9 @@ namespace Server.Items
else
{
if ( m_Level == 6 )
LabelTo( from, 1041522, String.Format( "#{0}\t \t#{1}", 1063452, m_Map == Map.Felucca ? 1041502 : 1041503 ) );
LabelTo( from, 1041522, $"#{1063452}\t \t#{(m_Map == Map.Felucca ? 1041502 : 1041503)}");
else
LabelTo( from, 1041522, String.Format( "#{0}\t \t#{1}", 1041510 + m_Level, m_Map == Map.Felucca ? 1041502 : 1041503 ) );
LabelTo( from, 1041522, $"#{1041510 + m_Level}\t \t#{(m_Map == Map.Felucca ? 1041502 : 1041503)}");
}
}

View file

@ -69,11 +69,11 @@ namespace Server.Items
int minutes = totalSeconds / 60;
if ( minutes != 0 && seconds != 0 )
return String.Format( "{0} minute{1} and {2} second{3}", minutes, minutes==1?"":"s", seconds, seconds==1?"":"s" );
return $"{minutes} minute{(minutes == 1 ? "" : "s")} and {seconds} second{(seconds == 1 ? "" : "s")}";
else if ( minutes != 0 )
return String.Format( "{0} minute{1}", minutes, minutes==1?"":"s" );
return $"{minutes} minute{(minutes == 1 ? "" : "s")}";
else
return String.Format( "{0} second{1}", seconds, seconds==1?"":"s" );
return $"{seconds} second{(seconds == 1 ? "" : "s")}";
}
public virtual void Cleanup()

View file

@ -359,7 +359,7 @@ namespace Server.Items
if ( !Active )
return;
string text = String.Format( "{0} says {1}", from.Name, message );
string text = $"{@from.Name} says {message}";
if ( RootParent is Mobile mobile )
{

View file

@ -441,7 +441,7 @@ namespace Server.Items
to.Send( new UnicodeMessage( Serial, ItemID, MessageType.Regular, 0x3B2, 3, "", "", "The generator shoots an arc of electricity at you!" ) );
to.BoltEffect( 0 );
to.LocalOverheadMessage( MessageType.Regular, 0xC9, true, "* Your body convulses from electric shock *" );
to.NonlocalOverheadMessage( MessageType.Regular, 0xC9, true, string.Format( "* {0} spasms from electric shock *", to.Name ) );
to.NonlocalOverheadMessage( MessageType.Regular, 0xC9, true, $"* {to.Name} spasms from electric shock *");
AOS.Damage( to, to, 60, 0, 0, 0, 0, 100 );
@ -485,7 +485,8 @@ namespace Server.Items
m_To.PlaySound( 0x28 );
m_To.LocalOverheadMessage( MessageType.Regular, 0xC9, true, "* Your body convulses from electric shock *" );
m_To.NonlocalOverheadMessage( MessageType.Regular, 0xC9, true, string.Format( "* {0} spasms from electric shock *", m_To.Name ) );
m_To.NonlocalOverheadMessage( MessageType.Regular, 0xC9, true,
$"* {m_To.Name} spasms from electric shock *");
AOS.Damage( m_To, m_To, 20, 0, 0, 0, 0, 100 );

View file

@ -72,7 +72,7 @@ namespace Server.Items
if ( weight <= 0.0 )
message += "It is lighter than a feather.";
else
message += String.Format( "It weighs {0} stones.", weight );
message += $"It weighs {weight} stones.";
}
else
{

View file

@ -615,16 +615,16 @@ namespace Server.Items
if (ts.TotalHours >= 1)
{
int h = (int)Math.Round(ts.TotalHours);
return String.Format("{0} hour{1}", h, (h == 1) ? "" : "s");
return $"{h} hour{((h == 1) ? "" : "s")}";
}
else if (ts.TotalMinutes >= 1)
{
int m = (int)Math.Round(ts.TotalMinutes);
return String.Format("{0} minute{1}", m, (m == 1) ? "" : "s");
return $"{m} minute{((m == 1) ? "" : "s")}";
}
int s = Math.Max((int)Math.Round(ts.TotalSeconds), 0);
return String.Format("{0} second{1}", s, (s == 1) ? "" : "s");
return $"{s} second{((s == 1) ? "" : "s")}";
}
private void EndLock(Mobile m)

View file

@ -274,7 +274,7 @@ namespace Server.Items
string fmt;
if ( Sextant.Format( loc, map, ref xLong, ref yLat, ref xMins, ref yMins, ref xEast, ref ySouth ) )
fmt = String.Format( "{0}°{1}'{2},{3}°{4}'{5}", yLat, yMins, ySouth ? "S" : "N", xLong, xMins, xEast ? "E" : "W" );
fmt = $"{yLat}°{yMins}'{(ySouth ? "S" : "N")},{xLong}°{xMins}'{(xEast ? "E" : "W")}";
else
fmt = "?????";

View file

@ -37,7 +37,7 @@ namespace Server.Items
if ( Format( from.Location, from.Map, ref xLong, ref yLat, ref xMins, ref yMins, ref xEast, ref ySouth ) )
{
string location = String.Format( "{0}<7D> {1}'{2}, {3}<7D> {4}'{5}", yLat, yMins, ySouth ? "S" : "N", xLong, xMins, xEast ? "E" : "W" );
string location = $"{yLat}<7D> {yMins}'{(ySouth ? "S" : "N")}, {xLong}<7D> {xMins}'{(xEast ? "E" : "W")}";
from.LocalOverheadMessage( MessageType.Regular, from.SpeechHue, false, location );
}
}

View file

@ -21,7 +21,7 @@ namespace Server.Items
public override void OnSingleClick( Mobile from )
{
LabelTo( from, 1050039, String.Format( "#{0}\t#1041645", LabelNumber ) );
LabelTo( from, 1050039, $"#{LabelNumber}\t#1041645");
}
public override void AddNameProperties( ObjectPropertyList list )

View file

@ -34,7 +34,7 @@ namespace Server.Items
if ( delay > 0 )
{
from.SendLocalizedMessage( 1072529, String.Format( "{0}\t{1}", delay, delay > 1 ? "seconds." : "second." ) ); // You cannot use that for another ~1_NUM~ ~2_TIMEUNITS~
from.SendLocalizedMessage( 1072529, $"{delay}\t{(delay > 1 ? "seconds." : "second.")}"); // You cannot use that for another ~1_NUM~ ~2_TIMEUNITS~
return;
}

View file

@ -35,7 +35,7 @@ namespace Server.Items
if ( delay > 0 )
{
from.SendLocalizedMessage( 1072529, String.Format( "{0}\t{1}", delay, delay > 1 ? "seconds." : "second." ) ); // You cannot use that for another ~1_NUM~ ~2_TIMEUNITS~
from.SendLocalizedMessage( 1072529, $"{delay}\t{(delay > 1 ? "seconds." : "second.")}"); // You cannot use that for another ~1_NUM~ ~2_TIMEUNITS~
return;
}

View file

@ -92,7 +92,7 @@ namespace Server.Items
public override void AddNameProperty( ObjectPropertyList list )
{
list.Add( 1061133, String.Format( "{0}\t{1}", GetSkillTitle( m_SkillLevel ).ToString(), RepairSkillInfo.GetInfo( m_Skill ).Name ) ); // A repair service contract from ~1_SKILL_TITLE~ ~2_SKILL_NAME~.
list.Add( 1061133, $"{GetSkillTitle(m_SkillLevel).ToString()}\t{RepairSkillInfo.GetInfo(m_Skill).Name}"); // A repair service contract from ~1_SKILL_TITLE~ ~2_SKILL_NAME~.
}
public override void GetProperties( ObjectPropertyList list )
@ -110,7 +110,8 @@ namespace Server.Items
if ( Deleted || !from.CanSee( this ) )
return;
LabelTo( from, 1061133, String.Format( "{0}\t{1}", GetSkillTitle( m_SkillLevel ).ToString(), RepairSkillInfo.GetInfo( m_Skill ).Name ) ); // A repair service contract from ~1_SKILL_TITLE~ ~2_SKILL_NAME~.
LabelTo( from, 1061133,
$"{GetSkillTitle(m_SkillLevel).ToString()}\t{RepairSkillInfo.GetInfo(m_Skill).Name}"); // A repair service contract from ~1_SKILL_TITLE~ ~2_SKILL_NAME~.
if ( m_Crafter != null )
LabelTo( from, 1050043, m_Crafter.Name ); // crafted by ~1_NAME~

View file

@ -128,7 +128,7 @@ namespace Server.Items
if ( hours == 0 )
hours = 12;
exactTime = String.Format( "{0}:{1:D2}", hours, minutes );
exactTime = $"{hours}:{minutes:D2}";
}
public override void OnDoubleClick( Mobile from )

View file

@ -16,7 +16,7 @@ namespace Server.Items
int num = CraftResources.GetLocalizationNumber( Resource );
if ( num > 0 )
v = String.Format( "#{0}", num );
v = $"#{num}";
else
v = CraftResources.GetName( Resource );
}
@ -33,7 +33,7 @@ namespace Server.Items
int num = CraftResources.GetLocalizationNumber( Resource );
if ( num > 0 )
v = String.Format( "#{0}", num );
v = $"#{num}";
else
v = CraftResources.GetName( Resource );
}

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)

View file

@ -2915,7 +2915,7 @@ namespace Server.Items
string name = Name;
if ( name == null )
name = String.Format( "#{0}", LabelNumber );
name = $"#{LabelNumber}";
return name;
}
@ -3249,7 +3249,7 @@ namespace Server.Items
list.Add( 1061168, "{0}\t{1}", MinDamage.ToString(), MaxDamage.ToString() ); // weapon damage ~1_val~ - ~2_val~
if ( Core.ML )
list.Add( 1061167, String.Format( "{0}s", Speed ) ); // weapon speed ~1_val~
list.Add( 1061167, $"{Speed}s"); // weapon speed ~1_val~
else
list.Add( 1061167, Speed.ToString() );