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

@ -155,7 +155,8 @@ namespace Server.Misc
* Please check your Journal for messages every few minutes.
*/
PageQueue.Enqueue( new PageEntry( from, String.Format( "[Automated: Change Password]<br>Desired password: {0}<br>Current IP address: {1}<br>Account IP address: {2}", pass, ipAddress, accessList[0] ), PageType.Account ) );
PageQueue.Enqueue( new PageEntry( from,
$"[Automated: Change Password]<br>Desired password: {pass}<br>Current IP address: {ipAddress}<br>Account IP address: {accessList[0]}", PageType.Account ) );
}
}
@ -207,7 +208,7 @@ namespace Server.Misc
{
Console.WriteLine( "Client: {0}: Deleting character {1} (0x{2:X})", state, index, m.Serial.Value );
acct.Comments.Add( new AccountComment( "System", String.Format( "Character #{0} {1} deleted by {2}", index + 1, m, state ) ) );
acct.Comments.Add( new AccountComment( "System", $"Character #{index + 1} {m} deleted by {state}") );
m.Delete();
state.Send( new CharacterListUpdate( acct ) );

View file

@ -74,7 +74,7 @@ namespace Server
public override string ToString()
{
return String.Format( "{0}/{1}", m_CIDRPrefix, m_CIDRLength );
return $"{m_CIDRPrefix}/{m_CIDRLength}";
}
public override bool Equals( object obj )

View file

@ -385,7 +385,7 @@ namespace Server.Commands
}
catch ( Exception e )
{
throw new Exception( String.Format( "Bad type: {0}", m_Type ), e );
throw new Exception($"Bad type: {m_Type}", e );
}
if ( item is BaseAddon addon )
@ -1061,7 +1061,7 @@ namespace Server.Commands
list.m_Type = ScriptCompiler.FindTypeByName( line.Substring( 0, indexOf++ ), true );
if ( list.m_Type == null )
throw new ArgumentException( String.Format( "Type not found for header: '{0}'", line ) );
throw new ArgumentException($"Type not found for header: '{line}'");
line = line.Substring( indexOf );
indexOf = line.IndexOf( '(' );

View file

@ -382,7 +382,7 @@ namespace Server.Commands
}
catch ( Exception e )
{
throw new Exception( String.Format( "Bad type: {0}", m_Type ), e );
throw new Exception($"Bad type: {m_Type}", e );
}
if ( item is BaseAddon addon )
@ -1058,7 +1058,7 @@ namespace Server.Commands
list.m_Type = ScriptCompiler.FindTypeByName( line.Substring( 0, indexOf++ ), true );
if ( list.m_Type == null )
throw new ArgumentException( String.Format( "Type not found for header: '{0}'", line ) );
throw new ArgumentException($"Type not found for header: '{line}'");
line = line.Substring( indexOf );
indexOf = line.IndexOf( '(' );

View file

@ -982,7 +982,7 @@ namespace Server.Commands
break;
}
html.WriteLine( " <td width=\"{0}\"{1} class=\"entry\">&nbsp;</td>", count*25, count==1?"":String.Format( " colspan=\"{0}\"", count ) );
html.WriteLine( " <td width=\"{0}\"{1} class=\"entry\">&nbsp;</td>", count*25, count==1?"": $" colspan=\"{count}\"");
}
}
@ -998,7 +998,7 @@ namespace Server.Commands
lbod.Entries = LargeBulkEntry.ConvertEntries( lbod, entries );
WriteSmithBODHeader( html, String.Format( "(Large) {0}: Normal", name ) );
WriteSmithBODHeader( html, $"(Large) {name}: Normal");
lbod.RequireExceptional = false;
for( BulkMaterialType mat = BulkMaterialType.None; mat <= BulkMaterialType.Valorite; ++mat )
@ -1012,7 +1012,7 @@ namespace Server.Commands
html.WriteLine( " <br><br>" );
WriteSmithBODHeader( html, String.Format( "(Large) {0}: Exceptional", name ) );
WriteSmithBODHeader( html, $"(Large) {name}: Exceptional");
lbod.RequireExceptional = true;
for( BulkMaterialType mat = BulkMaterialType.None; mat <= BulkMaterialType.Valorite; ++mat )
@ -1205,7 +1205,7 @@ namespace Server.Commands
break;
}
html.WriteLine( " <td width=\"{0}\"{1} class=\"entry\">&nbsp;</td>", count*25, count==1?"":String.Format( " colspan=\"{0}\"", count ) );
html.WriteLine( " <td width=\"{0}\"{1} class=\"entry\">&nbsp;</td>", count*25, count==1?"": $" colspan=\"{count}\"");
}
}

View file

@ -332,14 +332,14 @@ namespace Server.Commands
int start = text.IndexOf( '(' );
if ( start < 0 )
throw new FormatException( String.Format( "Input string not correctly formatted ('{0}')", text ) );
throw new FormatException($"Input string not correctly formatted ('{text}')");
m_Title = text.Substring( 0, start ).Trim();
int end = text.IndexOf( ')', ++start );
if ( end < start )
throw new FormatException( String.Format( "Input string not correctly formatted ('{0}')", text ) );
throw new FormatException($"Input string not correctly formatted ('{text}')");
text = text.Substring( start, end-start );
string[] split = text.Split( ';' );
@ -392,7 +392,7 @@ namespace Server.Commands
}
if ( index >= input.Length )
throw new FormatException( String.Format( "Input string not correctly formatted ('{0}')", input ) );
throw new FormatException($"Input string not correctly formatted ('{input}')");
m_Indentation = index;
m_Text = input.Substring( index );

View file

@ -116,7 +116,7 @@ namespace Server.Commands.Generic
public override string ToString()
{
if ( m_Count > 1 )
return String.Format( "{0} ({1})", m_Message, m_Count );
return $"{m_Message} ({m_Count})";
return m_Message;
}

View file

@ -190,7 +190,7 @@ namespace Server.Commands.Generic
if ( list.Count == 1 )
AddResponse( "There is one matching object." );
else
AddResponse( String.Format( "There are {0} matching objects.", list.Count ) );
AddResponse($"There are {list.Count} matching objects.");
}
}
@ -255,7 +255,8 @@ namespace Server.Commands.Generic
else
AddResponse( "Open web browser request sent." );
mob.SendGump( new WarningGump( 1060637, 30720, String.Format( "A game master is requesting to open your web browser to the following URL:<br>{0}", url ), 0xFFC000, 320, 240, new WarningGumpCallback( OpenBrowser_Callback ), new object[]{ from, url, echo } ) );
mob.SendGump( new WarningGump( 1060637, 30720,
$"A game master is requesting to open your web browser to the following URL:<br>{url}", 0xFFC000, 320, 240, new WarningGumpCallback( OpenBrowser_Callback ), new object[]{ from, url, echo } ) );
}
}
else
@ -636,9 +637,9 @@ namespace Server.Commands.Generic
Type type = obj.GetType();
if ( type.DeclaringType == null )
AddResponse( String.Format( "The type of that object is {0}.", type.Name ) );
AddResponse($"The type of that object is {type.Name}.");
else
AddResponse( String.Format( "The type of that object is {0}.", type.FullName ) );
AddResponse($"The type of that object is {type.FullName}.");
}
}
}
@ -698,7 +699,7 @@ namespace Server.Commands.Generic
Commands = new[]{ command };
ObjectTypes = objects;
Usage = command;
Description = String.Format( "Sets the {0} property to {1}.", name, value );
Description = $"Sets the {name} property to {value}.";
}
public override void Execute( CommandEventArgs e, object obj )
@ -796,7 +797,8 @@ namespace Server.Commands.Generic
{
if ( list.Count > 1 )
{
e.Mobile.SendGump( new WarningGump( 1060637, 30720, String.Format( "You are about to delete {0} objects. This cannot be undone without a full server revert.<br><br>Continue?", list.Count ), 0xFFC000, 420, 280, new WarningGumpCallback( OnConfirmCallback ), new object[]{ e, list } ) );
e.Mobile.SendGump( new WarningGump( 1060637, 30720,
$"You are about to delete {list.Count} objects. This cannot be undone without a full server revert.<br><br>Continue?", 0xFFC000, 420, 280, new WarningGumpCallback( OnConfirmCallback ), new object[]{ e, list } ) );
AddResponse( "Awaiting confirmation..." );
}
else
@ -1043,7 +1045,7 @@ namespace Server.Commands.Generic
targ.Say( "I've been {0}!", m_Ban ? "banned" : "kicked" );
AddResponse( String.Format( "They have been {0}.", m_Ban ? "banned" : "kicked" ) );
AddResponse($"They have been {(m_Ban ? "banned" : "kicked")}.");
targState.Dispose();

View file

@ -95,7 +95,8 @@ namespace Server.Commands.Generic
#region Area targeting mode
public override void ExecuteList( CommandEventArgs e, ArrayList list )
{
e.Mobile.SendGump( new WarningGump( 1060637, 30720, String.Format( "You are about to insert {0} objects. This cannot be undone without a full server revert.<br><br>Continue?", list.Count ), 0xFFC000, 420, 280, new WarningGumpCallback( OnConfirmCallback ), new object[] { e, list, ( e.Length < 1 || !e.GetBoolean( 0 ) ) } ) );
e.Mobile.SendGump( new WarningGump( 1060637, 30720,
$"You are about to insert {list.Count} objects. This cannot be undone without a full server revert.<br><br>Continue?", 0xFFC000, 420, 280, new WarningGumpCallback( OnConfirmCallback ), new object[] { e, list, ( e.Length < 1 || !e.GetBoolean( 0 ) ) } ) );
AddResponse( "Awaiting confirmation..." );
}

View file

@ -85,7 +85,8 @@ namespace Server.Commands.Generic
else
AddEntryHeader( 20 );
AddEntryHtml( 40 + ( m_Columns.Length * 130 ) - 20 + ( ( m_Columns.Length - 2 ) * OffsetSize ), Center( String.Format( "Page {0} of {1}", m_Page+1, (m_List.Count + EntriesPerPage - 1) / EntriesPerPage ) ) );
AddEntryHtml( 40 + ( m_Columns.Length * 130 ) - 20 + ( ( m_Columns.Length - 2 ) * OffsetSize ), Center(
$"Page {m_Page + 1} of {(m_List.Count + EntriesPerPage - 1) / EntriesPerPage}") );
if ( (m_Page + 1) * EntriesPerPage < m_List.Count )
AddEntryButton( 20, ArrowRightID1, ArrowRightID2, 2, ArrowRightWidth, ArrowRightHeight );
@ -297,7 +298,7 @@ namespace Server.Commands.Generic
private void InvokeCommand( string ip )
{
CommandSystem.Handle( m_From, String.Format( "{0}{1}", CommandSystem.Prefix, ip ) );
CommandSystem.Handle( m_From, $"{CommandSystem.Prefix}{ip}");
}
public override void OnResponse( NetState sender, RelayInfo info )
@ -338,7 +339,7 @@ namespace Server.Commands.Generic
case 4: // Go there
{
m_From.SendGump( new InterfaceItemGump( m_From, m_Columns, m_List, m_Page, m_Item ) );
InvokeCommand( String.Format( "Go {0}", m_Item.Serial.Value ) );
InvokeCommand($"Go {m_Item.Serial.Value}");
break;
}
case 5: // Move to target
@ -458,7 +459,7 @@ namespace Server.Commands.Generic
private void InvokeCommand( string ip )
{
CommandSystem.Handle( m_From, String.Format( "{0}{1}", CommandSystem.Prefix, ip ) );
CommandSystem.Handle( m_From, $"{CommandSystem.Prefix}{ip}");
}
public override void OnResponse( NetState sender, RelayInfo info )
@ -503,7 +504,7 @@ namespace Server.Commands.Generic
case 4: // Go there
{
m_From.SendGump( new InterfaceMobileGump( m_From, m_Columns, m_List, m_Page, m_Mobile ) );
InvokeCommand( String.Format( "Go {0}", m_Mobile.Serial.Value ) );
InvokeCommand($"Go {m_Mobile.Serial.Value}");
break;
}
case 5: // Bring them here

View file

@ -177,11 +177,7 @@ namespace Server.Commands.Generic
else
{
throw new InvalidOperationException(
String.Format(
"Unable to convert string \"{0}\" into type '{1}'.",
m_Value,
m_Type
)
$"Unable to convert string \"{m_Value}\" into type '{m_Type}'."
);
}
}

View file

@ -94,7 +94,7 @@ namespace Server.Commands.Generic
Type objectType = ScriptCompiler.FindTypeByName( args[offset + index], true );
if ( objectType == null )
throw new Exception( String.Format( "No type with that name ({0}) was found.", args[offset + index] ) );
throw new Exception($"No type with that name ({args[offset + index]}) was found.");
++index;
@ -231,7 +231,7 @@ namespace Server.Commands.Generic
}
if ( condition == null )
throw new InvalidOperationException( String.Format( "Unrecognized operator (\"{0}\").", oper ) );
throw new InvalidOperationException($"Unrecognized operator (\"{oper}\").");
current.Add( condition );
}

View file

@ -233,8 +233,7 @@ namespace Server.Commands
e.Mobile.SendGump(
new WarningGump( 1060635, 30720,
String.Format( "You are about to delete {0} object{1} from this facet. Do you really wish to continue?",
list.Count, list.Count == 1 ? "" : "s" ),
$"You are about to delete {list.Count} object{(list.Count == 1 ? "" : "s")} from this facet. Do you really wish to continue?",
0xFFC000, 360, 260, new WarningGumpCallback( DeleteList_Callback ), list ) );
}
else
@ -345,7 +344,7 @@ namespace Server.Commands
{
Item item = m.Items[i];
entries[i] = new ItemListEntry( String.Format( "{0}: {1}", item.Layer, item.GetType().Name ), item.ItemID, item.Hue );
entries[i] = new ItemListEntry($"{item.Layer}: {item.GetType().Name}", item.ItemID, item.Hue );
}
return entries;
@ -377,7 +376,7 @@ namespace Server.Commands
private Mobile m_Mobile;
private Item m_Item;
public EquipDetailsMenu( Mobile m, Item item ) : base( String.Format( "{0}: {1}", item.Layer, item.GetType().Name ), new[]{"Move","Delete","Props"})
public EquipDetailsMenu( Mobile m, Item item ) : base($"{item.Layer}: {item.GetType().Name}", new[]{"Move","Delete","Props"})
{
m_Mobile = m;
m_Item = item;
@ -828,7 +827,7 @@ namespace Server.Commands
[Description( "Broadcasts a message to all online staff." )]
public static void StaffMessage_OnCommand( CommandEventArgs e )
{
BroadcastMessage( AccessLevel.Counselor, e.Mobile.SpeechHue, String.Format( "[{0}] {1}", e.Mobile.Name, e.ArgString ) );
BroadcastMessage( AccessLevel.Counselor, e.Mobile.SpeechHue, $"[{e.Mobile.Name}] {e.ArgString}");
}
[Usage( "BCast <text>" )]
@ -836,7 +835,7 @@ namespace Server.Commands
[Description( "Broadcasts a message to everyone online." )]
public static void BroadcastMessage_OnCommand( CommandEventArgs e )
{
BroadcastMessage( AccessLevel.Player, 0x482, String.Format( "Staff message from {0}:", e.Mobile.Name ) );
BroadcastMessage( AccessLevel.Player, 0x482, $"Staff message from {e.Mobile.Name}:");
BroadcastMessage( AccessLevel.Player, 0x482, e.ArgString );
}

View file

@ -46,7 +46,7 @@ namespace Server.Commands
return;
}
else
e.Mobile.SendMessage( String.Format( "Command '{0}' not found!", arg ) );
e.Mobile.SendMessage($"Command '{arg}' not found!");
}
e.Mobile.SendGump( new CommandListGump( 0, e.Mobile, null ) );
@ -255,7 +255,8 @@ namespace Server.Commands
else
AddEntryHeader( 20 );
AddEntryHtml( 160, Center( String.Format( "Page {0} of {1}", m_Page+1, (m_List.Count + EntriesPerPage - 1) / EntriesPerPage ) ) );
AddEntryHtml( 160, Center(
$"Page {m_Page + 1} of {(m_List.Count + EntriesPerPage - 1) / EntriesPerPage}") );
if ( (m_Page + 1) * EntriesPerPage < m_List.Count )
AddEntryButton( 20, ArrowRightID1, ArrowRightID2, 2, ArrowRightWidth, ArrowRightHeight );
@ -346,12 +347,12 @@ namespace Server.Commands
{
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 string Center( string text )
{
return String.Format( "<CENTER>{0}</CENTER>", text );
return $"<CENTER>{text}</CENTER>";
}
public CommandInfoGump( CommandInfo info )
@ -384,7 +385,7 @@ namespace Server.Commands
if ( aliases != null && aliases.Length != 0 )
{
sb.Append( String.Format( "Alias{0}: ", aliases.Length == 1 ? "" : "es" ) );
sb.Append($"Alias{(aliases.Length == 1 ? "" : "es")}: ");
for( int i = 0; i < aliases.Length; ++i )
{

View file

@ -29,7 +29,7 @@ namespace Server.Commands
try
{
m_Output = new StreamWriter( Path.Combine( directory, String.Format( "{0}.log", DateTime.UtcNow.ToLongDateString() ) ), true );
m_Output = new StreamWriter( Path.Combine( directory, $"{DateTime.UtcNow.ToLongDateString()}.log"), true );
m_Output.AutoFlush = true;
@ -47,13 +47,13 @@ namespace Server.Commands
if ( o is Mobile m )
{
if ( m.Account == null )
return String.Format( "{0} (no account)", m );
return $"{m} (no account)";
return String.Format( "{0} ('{1}')", m, m.Account.Username );
return $"{m} ('{m.Account.Username}')";
}
if ( o is Item item )
{
return String.Format( "0x{0:X} ({1})", item.Serial.Value, item.GetType().Name );
return $"0x{item.Serial.Value:X} ({item.GetType().Name})";
}
return o;
@ -83,7 +83,7 @@ namespace Server.Commands
AppendPath( ref path, "Logs" );
AppendPath( ref path, "Commands" );
AppendPath( ref path, from.AccessLevel.ToString() );
path = Path.Combine( path, String.Format( "{0}.log", name ) );
path = Path.Combine( path, $"{name}.log");
using ( StreamWriter sw = new StreamWriter( path, true ) )
sw.WriteLine( "{0}: {1}: {2}", DateTime.UtcNow, from.NetState, text );

View file

@ -110,31 +110,31 @@ namespace Server.Commands
if ( attr == null )
{
failReason = String.Format( "Property '{0}' not found.", propertyName );
failReason = $"Property '{propertyName}' not found.";
return null;
}
else if ( (access & PropertyAccess.Read) != 0 && from.AccessLevel < attr.ReadLevel )
{
failReason = String.Format( "You must be at least {0} to get the property '{1}'.",
Mobile.GetAccessLevelName( attr.ReadLevel ), propertyName );
failReason =
$"You must be at least {Mobile.GetAccessLevelName(attr.ReadLevel)} to get the property '{propertyName}'.";
return null;
}
else if ( (access & PropertyAccess.Write) != 0 && from.AccessLevel < attr.WriteLevel )
{
failReason = String.Format( "You must be at least {0} to set the property '{1}'.",
Mobile.GetAccessLevelName( attr.WriteLevel ), propertyName );
failReason =
$"You must be at least {Mobile.GetAccessLevelName(attr.WriteLevel)} to set the property '{propertyName}'.";
return null;
}
else if ( (access & PropertyAccess.Read) != 0 && !p.CanRead )
{
failReason = String.Format( "Property '{0}' is write only.", propertyName );
failReason = $"Property '{propertyName}' is write only.";
return null;
}
else if ( (access & PropertyAccess.Write) != 0 && (!p.CanWrite || attr.ReadOnly) && isFinal )
{
failReason = String.Format( "Property '{0}' is read only.", propertyName );
failReason = $"Property '{propertyName}' is read only.";
return null;
}
@ -146,7 +146,7 @@ namespace Server.Commands
if ( info[i] == null )
{
failReason = String.Format( "Property '{0}' not found.", propertyName );
failReason = $"Property '{propertyName}' not found.";
return null;
}
}
@ -181,7 +181,7 @@ namespace Server.Commands
if ( obj == null )
{
failReason = String.Format( "Property '{0}' is null.", chain[i] );
failReason = $"Property '{chain[i]}' is null.";
return null;
}
}
@ -313,14 +313,14 @@ namespace Server.Commands
else if ( IsChar( type ) )
toString = String.Format( "'{0}' ({1} [0x{1:X}])", value, (int) value );
else if ( IsString( type ) )
toString = ( (string) value == "null" ? @"@""null""" : String.Format( "\"{0}\"", value ) );
toString = ( (string) value == "null" ? @"@""null""" : $"\"{value}\"");
else if ( IsText( type ) )
toString = ( (TextDefinition) value ).Format( false );
else
toString = value.ToString();
if ( chain == null )
return String.Format( "{0} = {1}", p.Name, toString );
return $"{p.Name} = {toString}";
string[] concat = new string[chain.Length*2+1];
@ -615,7 +615,7 @@ namespace Server
public sealed class UnknownPropertyException : BindingException
{
public UnknownPropertyException( Property property, string current )
: base( property, String.Format( "Property '{0}' not found.", current ) )
: base( property, $"Property '{current}' not found.")
{
}
}
@ -662,11 +662,8 @@ namespace Server
public AccessLevel NeededAccess => m_NeededAccess;
public ClearanceException( Property property, AccessLevel playerAccess, AccessLevel neededAccess, string accessType )
: base( property, string.Format(
"You must be at least {0} to {1} this property.",
Mobile.GetAccessLevelName( neededAccess ),
accessType
) )
: base( property,
$"You must be at least {Mobile.GetAccessLevelName(neededAccess)} to {accessType} this property.")
{
}
}

View file

@ -128,7 +128,7 @@ namespace Server.Commands
if ( m_Set )
{
skill.Base = m_Value;
CommandLogging.LogChangeProperty( from, targ, String.Format( "{0}.Base", m_Skill ), m_Value.ToString() );
CommandLogging.LogChangeProperty( from, targ, $"{m_Skill}.Base", m_Value.ToString() );
}
from.SendMessage( "{0} : {1} (Base: {2})", m_Skill, skill.Value, skill.Base );

View file

@ -272,7 +272,8 @@ namespace Server
if ( totalFrozen == 0 && badDataFile )
from.SendGump( new NoticeGump( 1060637, 30720, "Output data files could not be opened and the freeze operation has been aborted.<br><br>This probably means your server and client are using the same data files. Instructions on how to resolve this can be found in the first warning window.", 0xFFC000, 320, 240, null, null ) );
else
from.SendGump( new NoticeGump( 1060637, 30720, String.Format( "Freeze operation completed successfully.<br><br>{0} item{1} frozen.<br><br>You must restart your client and update it's data files to see the changes.", totalFrozen, totalFrozen != 1 ? "s were" : " was" ), 0xFFC000, 320, 240, null, null ) );
from.SendGump( new NoticeGump( 1060637, 30720,
$"Freeze operation completed successfully.<br><br>{totalFrozen} item{(totalFrozen != 1 ? "s were" : " was")} frozen.<br><br>You must restart your client and update it's data files to see the changes.", 0xFFC000, 320, 240, null, null ) );
}
private const string BaseUnfreezeWarning = "{0} " +
@ -470,7 +471,8 @@ namespace Server
if ( totalUnfrozen == 0 && badDataFile )
from.SendGump( new NoticeGump( 1060637, 30720, "Output data files could not be opened and the unfreeze operation has been aborted.<br><br>This probably means your server and client are using the same data files. Instructions on how to resolve this can be found in the first warning window.", 0xFFC000, 320, 240, null, null ) );
else
from.SendGump( new NoticeGump( 1060637, 30720, String.Format( "Unfreeze operation completed successfully.<br><br>{0} item{1} unfrozen.<br><br>You must restart your client and update it's data files to see the changes.", totalUnfrozen, totalUnfrozen != 1 ? "s were" : " was" ), 0xFFC000, 320, 240, null, null ) );
from.SendGump( new NoticeGump( 1060637, 30720,
$"Unfreeze operation completed successfully.<br><br>{totalUnfrozen} item{(totalUnfrozen != 1 ? "s were" : " was")} unfrozen.<br><br>You must restart your client and update it's data files to see the changes.", 0xFFC000, 320, 240, null, null ) );
}
private static FileStream OpenWrite( FileStream orig )

View file

@ -655,7 +655,7 @@ namespace Server.Engines.BulkOrders
else
AddLabel( 316, y, 1152, name.ToString() );
AddLabel( 421, y, 1152, String.Format( "{0} / {1}", sub.AmountCur, entry.AmountMax ) );
AddLabel( 421, y, 1152, $"{sub.AmountCur} / {entry.AmountMax}");
++tableIndex;
y += 32;
@ -692,7 +692,7 @@ namespace Server.Engines.BulkOrders
else
AddLabel( 316, y, 1152, name.ToString() );
AddLabel( 421, y, 1152, String.Format( "{0} / {1}", smallEntry.AmountCur, smallEntry.AmountMax ) );
AddLabel( 421, y, 1152, $"{smallEntry.AmountCur} / {smallEntry.AmountMax}");
}
}
}

View file

@ -47,7 +47,7 @@ namespace Server.Engines.BulkOrders
public static SmallBulkEntry[] LoadEntries( string type, string name )
{
return LoadEntries( String.Format( "Data/Bulk Orders/{0}/{1}.cfg", type, name ) );
return LoadEntries($"Data/Bulk Orders/{type}/{name}.cfg");
}
public static SmallBulkEntry[] LoadEntries( string path )

View file

@ -15,12 +15,12 @@ namespace Server.Engines.ConPVP
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>";
}
private const int LabelColor32 = 0xFFFFFF;

View file

@ -248,12 +248,12 @@ namespace Server.Engines.ConPVP
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>";
}
private void AddBorderedText( int x, int y, int width, string text, int color, int borderColor )

View file

@ -7,12 +7,12 @@ namespace Server.Engines.ConPVP
{
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>";
}
private const int LabelColor32 = 0xFFFFFF;

View file

@ -459,7 +459,8 @@ namespace Server.Engines.ConPVP
pl.Eliminated = true;
mob.LocalOverheadMessage( MessageType.Regular, 0x22, false, "You have forfeited your position in the duel." );
mob.NonlocalOverheadMessage( MessageType.Regular, 0x22, false, String.Format( "{0} has forfeited by leaving the dueling arena.", mob.Name ) );
mob.NonlocalOverheadMessage( MessageType.Regular, 0x22, false,
$"{mob.Name} has forfeited by leaving the dueling arena.");
Participant winner = CheckCompletion();
@ -498,7 +499,7 @@ namespace Server.Engines.ConPVP
else if ( !m_Yielding )
{
mob.LocalOverheadMessage( MessageType.Regular, 0x22, false, "You have been defeated." );
mob.NonlocalOverheadMessage( MessageType.Regular, 0x22, false, String.Format( "{0} has been defeated.", mob.Name ) );
mob.NonlocalOverheadMessage( MessageType.Regular, 0x22, false, $"{mob.Name} has been defeated.");
}
}
}
@ -1176,7 +1177,8 @@ namespace Server.Engines.ConPVP
if ( entry == null )
return; // sanity
string text = String.Format( "{{0}} are ranked {0} at level {1}.", LadderGump.Rank( entry.Index + 1 ), Ladder.GetLevel( entry.Experience ) );
string text =
$"{{0}} are ranked {LadderGump.Rank(entry.Index + 1)} at level {Ladder.GetLevel(entry.Experience)}.";
pm.PrivateOverheadMessage( MessageType.Regular, pm.SpeechHue, true, String.Format( text, from==pm?"You":"They" ), from.NetState );
}
@ -1267,7 +1269,8 @@ namespace Server.Engines.ConPVP
if ( entry == null )
return; // sanity
string text = String.Format( "{{0}} {{1}} ranked {0} at level {1}.", LadderGump.Rank( entry.Index + 1 ), Ladder.GetLevel( entry.Experience ) );
string text =
$"{{0}} {{1}} ranked {LadderGump.Rank(entry.Index + 1)} at level {Ladder.GetLevel(entry.Experience)}.";
pm.LocalOverheadMessage( MessageType.Regular, pm.SpeechHue, true, String.Format( text, "You", "are" ) );
pm.NonlocalOverheadMessage( MessageType.Regular, pm.SpeechHue, true, String.Format( text, pm.Name, "is" ) );
@ -1474,7 +1477,7 @@ namespace Server.Engines.ConPVP
else
{
pm.LocalOverheadMessage( MessageType.Regular, 0x22, false, "You have yielded." );
pm.NonlocalOverheadMessage( MessageType.Regular, 0x22, false, String.Format( "{0} has yielded.", pm.Name ) );
pm.NonlocalOverheadMessage( MessageType.Regular, 0x22, false, $"{pm.Name} has yielded.");
pm.DuelContext.m_Yielding=true;
pm.Kill();
@ -2325,21 +2328,21 @@ namespace Server.Engines.ConPVP
return "a slot is empty";
if ( dp.Mobile.Region.IsPartOf( typeof( Regions.Jail ) ) )
return String.Format( "{0} is in jail", dp.Mobile.Name );
return $"{dp.Mobile.Name} is in jail";
if ( Sigil.ExistsOn( dp.Mobile ) )
return String.Format( "{0} is holding a sigil", dp.Mobile.Name );
return $"{dp.Mobile.Name} is holding a sigil";
if ( !dp.Mobile.Alive )
{
if ( m_Tournament == null )
return String.Format( "{0} is dead", dp.Mobile.Name );
return $"{dp.Mobile.Name} is dead";
else
dp.Mobile.Resurrect();
}
if ( m_Tournament == null && CheckCombat( dp.Mobile ) )
return String.Format( "{0} is in combat", dp.Mobile.Name );
return $"{dp.Mobile.Name} is in combat";
if ( dp.Mobile.Mounted )
{
@ -2348,7 +2351,7 @@ namespace Server.Engines.ConPVP
if ( m_Tournament != null && mount != null )
mount.Rider = null;
else
return String.Format( "{0} is mounted", dp.Mobile.Name );
return $"{dp.Mobile.Name} is mounted";
}
}
}

View file

@ -14,7 +14,7 @@ namespace Server.Engines.ConPVP
public string Center( string text )
{
return String.Format( "<CENTER>{0}</CENTER>", text );
return $"<CENTER>{text}</CENTER>";
}
public void AddGoldenButton( int x, int y, int bid )

View file

@ -991,12 +991,12 @@ namespace Server.Engines.ConPVP
{
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>";
}
private void AddBorderedText( int x, int y, int width, int height, string text, int color, int borderColor )
@ -1137,7 +1137,7 @@ namespace Server.Engines.ConPVP
break;
}
AddBorderedText( 60, 65 + ( i * 75 ), 250, 20, String.Format( "{0}: {1}", LadderGump.Rank( 1 + i ), teamInfo.Name ), nameColor, borderColor );
AddBorderedText( 60, 65 + ( i * 75 ), 250, 20, $"{LadderGump.Rank(1 + i)}: {teamInfo.Name}", nameColor, borderColor );
AddBorderedText( 50 + 10, 85 + ( i * 75 ), 100, 20, "Score:", 0xFFC000, BlackColor32 );
AddBorderedText( 50 + 15, 105 + ( i * 75 ), 100, 20, teamInfo.Score.ToString( "N0" ), 0xFFC000, BlackColor32 );
@ -1266,7 +1266,7 @@ namespace Server.Engines.ConPVP
return res;
}
public string Name => String.Format( "{0} Team", m_Name );
public string Name => $"{m_Name} Team";
public BRGame Game { get => m_Game;
set => m_Game = value;
@ -1399,7 +1399,7 @@ namespace Server.Engines.ConPVP
public override string ToString()
{
if ( m_Name != null )
return String.Format( "({0}) ...", Name );
return $"({Name}) ...";
else
return "...";
}
@ -1848,7 +1848,7 @@ namespace Server.Engines.ConPVP
if ( pl == leader )
item.ItemID = 4810;
item.Name = String.Format( "{0}, {1} team", item.Name, ((BRTeamInfo)teams[i]).Name.ToLower() );
item.Name = $"{item.Name}, {((BRTeamInfo) teams[i]).Name.ToLower()} team";
if ( !mob.PlaceInBackpack( item ) )
mob.BankBox.DropItem( item );

View file

@ -55,12 +55,12 @@ namespace Server.Engines.ConPVP
{
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>";
}
private void AddBorderedText( int x, int y, int width, int height, string text, int color, int borderColor )
@ -199,7 +199,7 @@ namespace Server.Engines.ConPVP
break;
}
AddBorderedText( 60, 65 + ( i * 75 ), 250, 20, String.Format( "{0}: {1} Team", LadderGump.Rank( 1 + i ), teamInfo.Name ), nameColor, borderColor );
AddBorderedText( 60, 65 + ( i * 75 ), 250, 20, $"{LadderGump.Rank(1 + i)}: {teamInfo.Name} Team", nameColor, borderColor );
AddBorderedText( 50 + 10, 85 + ( i * 75 ), 100, 20, "Score:", 0xFFC000, BlackColor32 );
AddBorderedText( 50 + 15, 105 + ( i * 75 ), 100, 20, teamInfo.Score.ToString( "N0" ), 0xFFC000, BlackColor32 );
@ -451,7 +451,8 @@ namespace Server.Engines.ConPVP
}
else if ( passTeam == useTeam && passTo.PlaceInBackpack( this ) )
{
passTo.LocalOverheadMessage( MessageType.Regular, 0x59, false, String.Format( "{0} has passed you the cookies!", from.Name ) );
passTo.LocalOverheadMessage( MessageType.Regular, 0x59, false,
$"{@from.Name} has passed you the cookies!");
}
else
{
@ -605,7 +606,7 @@ namespace Server.Engines.ConPVP
private Dictionary<Mobile, CTFPlayerInfo> m_Players;
string IRankedCTF.Name => String.Format( "{0} Team", m_Name );
string IRankedCTF.Name => $"{m_Name} Team";
public CTFGame Game { get => m_Game;
set => m_Game = value;
@ -1231,7 +1232,7 @@ namespace Server.Engines.ConPVP
if ( pl == leader )
item.ItemID = 4810;
item.Name = String.Format( "{0}, {1} team", item.Name, teams[i].Name.ToLower() );
item.Name = $"{item.Name}, {teams[i].Name.ToLower()} team";
if ( !mob.PlaceInBackpack( item ) )
mob.BankBox.DropItem( item );

View file

@ -53,12 +53,12 @@ namespace Server.Engines.ConPVP
{
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>";
}
private void AddBorderedText( int x, int y, int width, int height, string text, int color, int borderColor )
@ -195,7 +195,7 @@ namespace Server.Engines.ConPVP
break;
}
AddBorderedText( 60, 65 + ( i * 75 ), 250, 20, String.Format( "{0}: {1}", LadderGump.Rank( 1 + i ), teamInfo.Name ), nameColor, borderColor );
AddBorderedText( 60, 65 + ( i * 75 ), 250, 20, $"{LadderGump.Rank(1 + i)}: {teamInfo.Name}", nameColor, borderColor );
AddBorderedText( 50 + 10, 85 + ( i * 75 ), 100, 20, "Score:", 0xFFC000, BlackColor32 );
AddBorderedText( 50 + 15, 105 + ( i * 75 ), 100, 20, teamInfo.Score.ToString( "N0" ), 0xFFC000, BlackColor32 );
@ -297,7 +297,7 @@ namespace Server.Engines.ConPVP
private Dictionary<Mobile, DDPlayerInfo> m_Players;
public string Name => String.Format( "{0} Team", m_Name );
public string Name => $"{m_Name} Team";
public DDGame Game { get => m_Game;
set => m_Game = value;
@ -840,7 +840,7 @@ namespace Server.Engines.ConPVP
if ( pl == leader )
item.ItemID = 4810;
item.Name = String.Format( "{0}, {1} team", item.Name, ((DDTeamInfo)teams[i]).Name.ToLower() );
item.Name = $"{item.Name}, {((DDTeamInfo) teams[i]).Name.ToLower()} team";
if ( !mob.PlaceInBackpack( item ) )
mob.BankBox.DropItem( item );

View file

@ -195,7 +195,7 @@ namespace Server.Engines.ConPVP
m_KingTimer.StartHillTicker();
if (m_King.Name != null)
PublicOverheadMessage(MessageType.Regular, 0x0481, false, String.Format("Taken by {0}!", m_King.Name));
PublicOverheadMessage(MessageType.Regular, 0x0481, false, $"Taken by {m_King.Name}!");
}
private class KingTimer : Timer
@ -365,12 +365,12 @@ namespace Server.Engines.ConPVP
{
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>";
}
private void AddBorderedText(int x, int y, int width, int height, string text, int color, int borderColor)
@ -490,7 +490,7 @@ namespace Server.Engines.ConPVP
break;
}
AddBorderedText(60, 65 + (i * 75), 250, 20, String.Format("{0}: {1}", LadderGump.Rank(1 + i), teamInfo.Name), nameColor, borderColor);
AddBorderedText(60, 65 + (i * 75), 250, 20, $"{LadderGump.Rank(1 + i)}: {teamInfo.Name}", nameColor, borderColor);
AddBorderedText(50 + 10, 85 + (i * 75), 100, 20, "Score:", 0xFFC000, BlackColor32);
AddBorderedText(50 + 15, 105 + (i * 75), 100, 20, teamInfo.Score.ToString("N0"), 0xFFC000, BlackColor32);
@ -627,7 +627,7 @@ namespace Server.Engines.ConPVP
{
if (m_Name == null)
return "(null) Team";
return String.Format("{0} Team", m_Name);
return $"{m_Name} Team";
}
}
@ -730,7 +730,7 @@ namespace Server.Engines.ConPVP
public override string ToString()
{
if (m_Name != null)
return String.Format("({0}) ...", Name);
return $"({Name}) ...";
else
return "...";
}
@ -1216,7 +1216,7 @@ namespace Server.Engines.ConPVP
if (pl == leader)
item.ItemID = 4810;
item.Name = String.Format("{0}, {1}", item.Name, ((KHTeamInfo)teams[i]).Name.ToLower());
item.Name = $"{item.Name}, {((KHTeamInfo) teams[i]).Name.ToLower()}";
if (!mob.PlaceInBackpack(item))
mob.BankBox.DropItem(item);

View file

@ -219,12 +219,12 @@ namespace Server.Engines.ConPVP
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>";
}
private void AddBorderedText( int x, int y, int width, string text, int color, int borderColor )

View file

@ -18,7 +18,7 @@ namespace Server.Engines.ConPVP
public string Center( string text )
{
return String.Format( "<CENTER>{0}</CENTER>", text );
return $"<CENTER>{text}</CENTER>";
}
public void AddGoldenButton( int x, int y, int bid )
@ -64,7 +64,7 @@ namespace Server.Engines.ConPVP
int x = 35;
int y = 47;
AddHtml( x, y, 200, 20, String.Format( "Team Size: {0}", p.Players.Length ), false, false ); y += 22;
AddHtml( x, y, 200, 20, $"Team Size: {p.Players.Length}", false, false ); y += 22;
AddGoldenButtonLabeled( x + 20, y, 1, "Increase" ); y += 22;
AddGoldenButtonLabeled( x + 20, y, 2, "Decrease" ); y += 30;
@ -75,7 +75,7 @@ namespace Server.Engines.ConPVP
{
DuelPlayer pl = p.Players[i];
AddGoldenButtonLabeled( x, y, 5 + i, String.Format( "{0}: {1}", 1 + i, pl == null ? "Empty" : pl.Mobile.Name ) ); y += 22;
AddGoldenButtonLabeled( x, y, 5 + i, $"{1 + i}: {(pl == null ? "Empty" : pl.Mobile.Name)}"); y += 22;
}
}

View file

@ -14,7 +14,7 @@ namespace Server.Engines.ConPVP
public string Center( string text )
{
return String.Format( "<CENTER>{0}</CENTER>", text );
return $"<CENTER>{text}</CENTER>";
}
public PickRulesetGump( Mobile from, DuelContext context, Ruleset ruleset ) : base( 50, 50 )

View file

@ -265,12 +265,12 @@ namespace Server.Engines.ConPVP
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>";
}
private void AddBorderedText( int x, int y, int width, string text, int color, int borderColor )

View file

@ -13,7 +13,7 @@ namespace Server.Engines.ConPVP
public string Center( string text )
{
return String.Format( "<CENTER>{0}</CENTER>", text );
return $"<CENTER>{text}</CENTER>";
}
public ReadyGump( Mobile from, DuelContext context, int count ) : base( 50, 50 )
@ -72,7 +72,7 @@ namespace Server.Engines.ConPVP
if ( p.Players.Length > 1 )
{
AddHtml( 35 + 14, y, 176, 20, String.Format( "Participant #{0}", i + 1 ), false, false );
AddHtml( 35 + 14, y, 176, 20, $"Participant #{i + 1}", false, false );
y += 22;
offset = 10;
}

View file

@ -13,7 +13,7 @@ namespace Server.Engines.ConPVP
public string Center( string text )
{
return String.Format( "<CENTER>{0}</CENTER>", text );
return $"<CENTER>{text}</CENTER>";
}
public void AddGoldenButton( int x, int y, int bid )
@ -82,7 +82,7 @@ namespace Server.Engines.ConPVP
if ( p.Players.Length > 1 )
{
AddHtml( 35, y, 176, 20, String.Format( "Team #{0}", i + 1 ), false, false );
AddHtml( 35, y, 176, 20, $"Team #{i + 1}", false, false );
y += 22;
offset = 10;
}
@ -152,12 +152,12 @@ namespace Server.Engines.ConPVP
AddHtml( 35, 25, 190, 20, Center( "Rules" ), false, false );
AddHtml( 35, 50, 190, 20, String.Format( "Set: {0}", basedef.Title ), false, false );
AddHtml( 35, 50, 190, 20, $"Set: {basedef.Title}", false, false );
y = 70;
for ( int i = 0; i < ruleset.Flavors.Count; ++i, y += 18 )
AddHtml( 35, y, 190, 20, String.Format( " + {0}", ((Ruleset)ruleset.Flavors[i]).Title ), false, false );
AddHtml( 35, y, 190, 20, $" + {((Ruleset) ruleset.Flavors[i]).Title}", false, false );
y += 4;

View file

@ -15,7 +15,7 @@ namespace Server.Engines.ConPVP
public string Center( string text )
{
return String.Format( "<CENTER>{0}</CENTER>", text );
return $"<CENTER>{text}</CENTER>";
}
public void AddGoldenButton( int x, int y, int bid )

View file

@ -91,7 +91,8 @@ namespace Server.Engines.ConPVP
if ( tourny.HasParticipant( m ) )
return;
PrivateOverheadMessage( MessageType.Regular, 0x35, false, String.Format( "Hello m'{0}. Dost thou wish to enter this tournament? You need only to write your name in this book.", m.Female ? "Lady" : "Lord" ), m.NetState );
PrivateOverheadMessage( MessageType.Regular, 0x35, false,
$"Hello m'{(m.Female ? "Lady" : "Lord")}. Dost thou wish to enter this tournament? You need only to write your name in this book.", m.NetState );
m.BeginAction( this );
Timer.DelayCall( TimeSpan.FromSeconds( 10.0 ), new TimerStateCallback( ReleaseLock_Callback ), m );
}
@ -299,12 +300,12 @@ namespace Server.Engines.ConPVP
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>";
}
private void AddBorderedText( int x, int y, int width, int height, string text, int color, int borderColor )
@ -450,7 +451,7 @@ namespace Server.Engines.ConPVP
case GroupingType.Random: groupText = "Random"; break;
}
AddBorderedText( 35, y, 190, 20, String.Format( "Grouping: {0}", groupText ), LabelColor32, BlackColor32 );
AddBorderedText( 35, y, 190, 20, $"Grouping: {groupText}", LabelColor32, BlackColor32 );
y += 20;
string tieText = null;
@ -464,22 +465,22 @@ namespace Server.Engines.ConPVP
case TieType.FullElimination: tieText = ( tourny.ParticipantsPerMatch == 2 ? "Both eliminated" : "Everyone eliminated" ); break;
}
AddBorderedText( 35, y, 190, 20, String.Format( "Tiebreaker: {0}", tieText ), LabelColor32, BlackColor32 );
AddBorderedText( 35, y, 190, 20, $"Tiebreaker: {tieText}", LabelColor32, BlackColor32 );
y += 20;
string sdText = "Off";
if ( tourny.SuddenDeath > TimeSpan.Zero )
{
sdText = String.Format( "{0}:{1:D2}", (int) tourny.SuddenDeath.TotalMinutes, tourny.SuddenDeath.Seconds );
sdText = $"{(int) tourny.SuddenDeath.TotalMinutes}:{tourny.SuddenDeath.Seconds:D2}";
if ( tourny.SuddenDeathRounds > 0 )
sdText = String.Format( "{0} (first {1} rounds)", sdText, tourny.SuddenDeathRounds );
sdText = $"{sdText} (first {tourny.SuddenDeathRounds} rounds)";
else
sdText = String.Format( "{0} (all rounds)", sdText );
sdText = $"{sdText} (all rounds)";
}
AddBorderedText( 35, y, 240, 20, String.Format( "Sudden Death: {0}", sdText ), LabelColor32, BlackColor32 );
AddBorderedText( 35, y, 240, 20, $"Sudden Death: {sdText}", LabelColor32, BlackColor32 );
y += 20;
y += 6;
@ -487,11 +488,11 @@ namespace Server.Engines.ConPVP
AddImageTiled( 42, y+1, 264, 1, 9157 );
y += 6;
AddBorderedText( 35, y, 190, 20, String.Format( "Ruleset: {0}", basedef.Title ), LabelColor32, BlackColor32 );
AddBorderedText( 35, y, 190, 20, $"Ruleset: {basedef.Title}", LabelColor32, BlackColor32 );
y += 20;
for ( int i = 0; i < ruleset.Flavors.Count; ++i, y += 18 )
AddBorderedText( 35, y, 190, 20, String.Format( " + {0}", ((Ruleset)ruleset.Flavors[i]).Title ), LabelColor32, BlackColor32 );
AddBorderedText( 35, y, 190, 20, $" + {((Ruleset) ruleset.Flavors[i]).Title}", LabelColor32, BlackColor32 );
y += 4;
@ -642,7 +643,7 @@ namespace Server.Engines.ConPVP
else
{
m_Registrar.PrivateOverheadMessage( MessageType.Regular,
0x35, false, String.Format( "{0} has not yet proven themselves a worthy dueler.", mob.Name ), from.NetState );
0x35, false, $"{mob.Name} has not yet proven themselves a worthy dueler.", from.NetState );
}
}
@ -669,7 +670,7 @@ namespace Server.Engines.ConPVP
else
{
m_Registrar.PrivateOverheadMessage( MessageType.Regular,
0x35, false, String.Format( "{0} has already entered this tournament.", mob.Name ), from.NetState );
0x35, false, $"{mob.Name} has already entered this tournament.", from.NetState );
}
}
@ -686,7 +687,8 @@ namespace Server.Engines.ConPVP
else
{
m_Registrar?.PrivateOverheadMessage( MessageType.Regular,
0x35, false, String.Format( "{0} is already assigned to a duel. They must yield it before joining this tournament.", mobile.Name ), from.NetState );
0x35, false,
$"{mobile.Name} is already assigned to a duel. They must yield it before joining this tournament.", from.NetState );
}
m_From.SendGump( new ConfirmSignupGump( m_From, m_Registrar, m_Tournament, m_Players ) );
@ -711,7 +713,7 @@ namespace Server.Engines.ConPVP
if ( minutesUntil == 0 )
timeUntil = "momentarily";
else
timeUntil = String.Format( "in {0} minute{1}", minutesUntil, minutesUntil == 1 ? "" : "s" );
timeUntil = $"in {minutesUntil} minute{(minutesUntil == 1 ? "" : "s")}";
m_Registrar.PrivateOverheadMessage( MessageType.Regular,
0x35, false, String.Format( fmt, from.Female ? "Lady" : "Lord", timeUntil ), from.NetState );
@ -822,7 +824,8 @@ namespace Server.Engines.ConPVP
mob.SendGump( new AcceptTeamGump( from, mob, m_Tournament, m_Registrar, m_Players ) );
m_Registrar?.PrivateOverheadMessage( MessageType.Regular,
0x59, false, String.Format( "As you command m'{0}. I've given your offer to {1}.", from.Female ? "Lady" : "Lord", mob.Name ), from.NetState );
0x59, false,
$"As you command m'{(@from.Female ? "Lady" : "Lord")}. I've given your offer to {mob.Name}.", from.NetState );
}
}
}
@ -843,12 +846,12 @@ namespace Server.Engines.ConPVP
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>";
}
private void AddBorderedText( int x, int y, int width, int height, string text, int color, int borderColor )
@ -965,7 +968,7 @@ namespace Server.Engines.ConPVP
AddBorderedText( 22, 22, 294, 20, Center( sb.ToString() ), LabelColor32, BlackColor32 );
AddBorderedText( 22, 50, 294, 40,
String.Format( "You have been asked to partner with {0} in a tournament. Do you accept?", from.Name ),
$"You have been asked to partner with {@from.Name} in a tournament. Do you accept?",
0xB0C868, BlackColor32 );
AddImageTiled( 32, 88, 264, 1, 9107 );
@ -983,7 +986,7 @@ namespace Server.Engines.ConPVP
case GroupingType.Random: groupText = "Random"; break;
}
AddBorderedText( 35, y, 190, 20, String.Format( "Grouping: {0}", groupText ), LabelColor32, BlackColor32 );
AddBorderedText( 35, y, 190, 20, $"Grouping: {groupText}", LabelColor32, BlackColor32 );
y += 20;
string tieText = null;
@ -997,22 +1000,22 @@ namespace Server.Engines.ConPVP
case TieType.FullElimination: tieText = ( tourny.ParticipantsPerMatch == 2 ? "Both eliminated" : "Everyone eliminated" ); break;
}
AddBorderedText( 35, y, 190, 20, String.Format( "Tiebreaker: {0}", tieText ), LabelColor32, BlackColor32 );
AddBorderedText( 35, y, 190, 20, $"Tiebreaker: {tieText}", LabelColor32, BlackColor32 );
y += 20;
string sdText = "Off";
if ( tourny.SuddenDeath > TimeSpan.Zero )
{
sdText = String.Format( "{0}:{1:D2}", (int) tourny.SuddenDeath.TotalMinutes, tourny.SuddenDeath.Seconds );
sdText = $"{(int) tourny.SuddenDeath.TotalMinutes}:{tourny.SuddenDeath.Seconds:D2}";
if ( tourny.SuddenDeathRounds > 0 )
sdText = String.Format( "{0} (first {1} rounds)", sdText, tourny.SuddenDeathRounds );
sdText = $"{sdText} (first {tourny.SuddenDeathRounds} rounds)";
else
sdText = String.Format( "{0} (all rounds)", sdText );
sdText = $"{sdText} (all rounds)";
}
AddBorderedText( 35, y, 240, 20, String.Format( "Sudden Death: {0}", sdText ), LabelColor32, BlackColor32 );
AddBorderedText( 35, y, 240, 20, $"Sudden Death: {sdText}", LabelColor32, BlackColor32 );
y += 20;
y += 6;
@ -1020,11 +1023,11 @@ namespace Server.Engines.ConPVP
AddImageTiled( 42, y+1, 264, 1, 9157 );
y += 6;
AddBorderedText( 35, y, 190, 20, String.Format( "Ruleset: {0}", basedef.Title ), LabelColor32, BlackColor32 );
AddBorderedText( 35, y, 190, 20, $"Ruleset: {basedef.Title}", LabelColor32, BlackColor32 );
y += 20;
for ( int i = 0; i < ruleset.Flavors.Count; ++i, y += 18 )
AddBorderedText( 35, y, 190, 20, String.Format( " + {0}", ((Ruleset)ruleset.Flavors[i]).Title ), LabelColor32, BlackColor32 );
AddBorderedText( 35, y, 190, 20, $" + {((Ruleset) ruleset.Flavors[i]).Title}", LabelColor32, BlackColor32 );
y += 4;
@ -1092,10 +1095,10 @@ namespace Server.Engines.ConPVP
if ( m_Registrar != null )
{
m_Registrar.PrivateOverheadMessage( MessageType.Regular,
0x22, false, String.Format( "{0} seems unresponsive.", m_Requested.Name ), m_From.NetState );
0x22, false, $"{m_Requested.Name} seems unresponsive.", m_From.NetState );
m_Registrar.PrivateOverheadMessage( MessageType.Regular,
0x22, false, String.Format( "You have declined the partnership with {0}.", m_From.Name ), m_Requested.NetState );
0x22, false, $"You have declined the partnership with {m_From.Name}.", m_Requested.NetState );
}
}
@ -1158,10 +1161,10 @@ namespace Server.Engines.ConPVP
if ( m_Registrar != null )
{
m_Registrar.PrivateOverheadMessage( MessageType.Regular,
0x59, false, String.Format( "{0} has accepted your offer of partnership.", mob.Name ), from.NetState );
0x59, false, $"{mob.Name} has accepted your offer of partnership.", from.NetState );
m_Registrar.PrivateOverheadMessage( MessageType.Regular,
0x59, false, String.Format( "You have accepted the partnership with {0}.", from.Name ), mob.NetState );
0x59, false, $"You have accepted the partnership with {@from.Name}.", mob.NetState );
}
}
}
@ -1175,10 +1178,10 @@ namespace Server.Engines.ConPVP
if ( m_Registrar != null )
{
m_Registrar.PrivateOverheadMessage( MessageType.Regular,
0x22, false, String.Format( "{0} has declined your offer of partnership.", mob.Name ), from.NetState );
0x22, false, $"{mob.Name} has declined your offer of partnership.", from.NetState );
m_Registrar.PrivateOverheadMessage( MessageType.Regular,
0x22, false, String.Format( "You have declined the partnership with {0}.", from.Name ), mob.NetState );
0x22, false, $"You have declined the partnership with {@from.Name}.", mob.NetState );
}
}
}
@ -2041,9 +2044,11 @@ namespace Server.Engines.ConPVP
try
{
if ( m_EventController != null )
Alert( "The tournament has completed!", String.Format( "Team {0} has won!", m_EventController.GetTeamName( ((TournyMatch)((PyramidLevel)m_Pyramid.Levels[0]).Matches[0]).Participants.IndexOf( winner ) ) ) );
Alert( "The tournament has completed!",
$"Team {m_EventController.GetTeamName(((TournyMatch) ((PyramidLevel) m_Pyramid.Levels[0]).Matches[0]).Participants.IndexOf(winner))} has won!");
else if ( m_TournyType == TournyType.RandomTeam )
Alert( "The tournament has completed!", String.Format( "Team {0} has won!", ((TournyMatch)((PyramidLevel)m_Pyramid.Levels[0]).Matches[0]).Participants.IndexOf( winner ) + 1 ) );
Alert( "The tournament has completed!",
$"Team {((TournyMatch) ((PyramidLevel) m_Pyramid.Levels[0]).Matches[0]).Participants.IndexOf(winner) + 1} has won!");
else if ( m_TournyType == TournyType.Faction ) {
if ( m_ParticipantsPerMatch == 4 )
{
@ -2069,21 +2074,25 @@ namespace Server.Engines.ConPVP
}
}
Alert( "The tournament has completed!", String.Format( "The {0} team has won!", name ) );
Alert( "The tournament has completed!", $"The {name} team has won!");
}
else if ( m_ParticipantsPerMatch == 2 )
{
Alert( "The tournament has completed!", String.Format( "The {0} team has won!", ((TournyMatch)((PyramidLevel)m_Pyramid.Levels[0]).Matches[0]).Participants.IndexOf( winner ) == 0 ? "Evil" : "Hero" ) );
Alert( "The tournament has completed!",
$"The {(((TournyMatch) ((PyramidLevel) m_Pyramid.Levels[0]).Matches[0]).Participants.IndexOf(winner) == 0 ? "Evil" : "Hero")} team has won!");
}
else
{
Alert( "The tournament has completed!", String.Format( "Team {0} has won!", ((TournyMatch)((PyramidLevel)m_Pyramid.Levels[0]).Matches[0]).Participants.IndexOf( winner ) + 1 ) );
Alert( "The tournament has completed!",
$"Team {((TournyMatch) ((PyramidLevel) m_Pyramid.Levels[0]).Matches[0]).Participants.IndexOf(winner) + 1} has won!");
}
}
else if ( m_TournyType == TournyType.RedVsBlue )
Alert( "The tournament has completed!", String.Format( "Team {0} has won!", ((TournyMatch)((PyramidLevel)m_Pyramid.Levels[0]).Matches[0]).Participants.IndexOf( winner ) == 0 ? "Red" : "Blue" ) );
Alert( "The tournament has completed!",
$"Team {(((TournyMatch) ((PyramidLevel) m_Pyramid.Levels[0]).Matches[0]).Participants.IndexOf(winner) == 0 ? "Red" : "Blue")} has won!");
else
Alert( "The tournament has completed!", String.Format( "{0} {1} the champion{2}.", winner.NameList, winner.Players.Count > 1 ? "are" : "is", winner.Players.Count == 1 ? "" : "s" ) );
Alert( "The tournament has completed!",
$"{winner.NameList} {(winner.Players.Count > 1 ? "are" : "is")} the champion{(winner.Players.Count == 1 ? "" : "s")}.");
}
catch
{
@ -2155,9 +2164,11 @@ namespace Server.Engines.ConPVP
try
{
if ( m_EventController != null )
Alert( "The tournament has completed!", String.Format( "Team {0} has won", m_EventController.GetTeamName( ( (TournyMatch) ( (PyramidLevel) m_Pyramid.Levels[0] ).Matches[0] ).Participants.IndexOf( winner ) ) ) );
Alert( "The tournament has completed!",
$"Team {m_EventController.GetTeamName(((TournyMatch) ((PyramidLevel) m_Pyramid.Levels[0]).Matches[0]).Participants.IndexOf(winner))} has won");
else if ( m_TournyType == TournyType.RandomTeam )
Alert( "The tournament has completed!", String.Format( "Team {0} has won!", ((TournyMatch)((PyramidLevel)m_Pyramid.Levels[0]).Matches[0]).Participants.IndexOf( winner ) + 1 ) );
Alert( "The tournament has completed!",
$"Team {((TournyMatch) ((PyramidLevel) m_Pyramid.Levels[0]).Matches[0]).Participants.IndexOf(winner) + 1} has won!");
else if ( m_TournyType == TournyType.Faction ) {
if ( m_ParticipantsPerMatch == 4 )
{
@ -2183,21 +2194,25 @@ namespace Server.Engines.ConPVP
}
}
Alert( "The tournament has completed!", String.Format( "The {0} team has won!", name ) );
Alert( "The tournament has completed!", $"The {name} team has won!");
}
else if ( m_ParticipantsPerMatch == 2 )
{
Alert( "The tournament has completed!", String.Format( "The {0} team has won!", ((TournyMatch)((PyramidLevel)m_Pyramid.Levels[0]).Matches[0]).Participants.IndexOf( winner ) == 0 ? "Evil" : "Hero" ) );
Alert( "The tournament has completed!",
$"The {(((TournyMatch) ((PyramidLevel) m_Pyramid.Levels[0]).Matches[0]).Participants.IndexOf(winner) == 0 ? "Evil" : "Hero")} team has won!");
}
else
{
Alert( "The tournament has completed!", String.Format( "Team {0} has won!", ((TournyMatch)((PyramidLevel)m_Pyramid.Levels[0]).Matches[0]).Participants.IndexOf( winner ) + 1 ) );
Alert( "The tournament has completed!",
$"Team {((TournyMatch) ((PyramidLevel) m_Pyramid.Levels[0]).Matches[0]).Participants.IndexOf(winner) + 1} has won!");
}
}
else if ( m_TournyType == TournyType.RedVsBlue )
Alert( "The tournament has completed!", String.Format( "Team {0} has won!", ((TournyMatch)((PyramidLevel)m_Pyramid.Levels[0]).Matches[0]).Participants.IndexOf( winner ) == 0 ? "Red" : "Blue" ) );
Alert( "The tournament has completed!",
$"Team {(((TournyMatch) ((PyramidLevel) m_Pyramid.Levels[0]).Matches[0]).Participants.IndexOf(winner) == 0 ? "Red" : "Blue")} has won!");
else
Alert( "The tournament has completed!", String.Format( "{0} {1} the champion{2}.", winner.NameList, winner.Players.Count > 1 ? "are" : "is", winner.Players.Count == 1 ? "" : "s" ) );
Alert( "The tournament has completed!",
$"{winner.NameList} {(winner.Players.Count > 1 ? "are" : "is")} the champion{(winner.Players.Count == 1 ? "" : "s")}.");
}
catch
{
@ -2733,12 +2748,12 @@ namespace Server.Engines.ConPVP
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>";
}
private void AddBorderedText( int x, int y, int width, int height, string text, int color, int borderColor )
@ -2882,11 +2897,12 @@ namespace Server.Engines.ConPVP
secs %= 60;
if ( mins > 0 && secs > 0 )
text = String.Format( "The tournament will begin in {0} minute{1} and {2} second{3}.", mins, mins==1?"":"s", secs, secs==1?"":"s" );
text =
$"The tournament will begin in {mins} minute{(mins == 1 ? "" : "s")} and {secs} second{(secs == 1 ? "" : "s")}.";
else if ( mins > 0 )
text = String.Format( "The tournament will begin in {0} minute{1}.", mins, mins==1?"":"s" );
text = $"The tournament will begin in {mins} minute{(mins == 1 ? "" : "s")}.";
else if ( secs > 0 )
text = String.Format( "The tournament will begin in {0} second{1}.", secs, secs==1?"":"s" );
text = $"The tournament will begin in {secs} second{(secs == 1 ? "" : "s")}.";
else
text = "The tournament will begin shortly.";
}
@ -2950,7 +2966,7 @@ namespace Server.Engines.ConPVP
case GroupingType.Random: groupText = "Random"; break;
}
AddHtml( 35, y, 190, 20, String.Format( "Grouping: {0}", groupText ), false, false );
AddHtml( 35, y, 190, 20, $"Grouping: {groupText}", false, false );
y += 20;
string tieText = null;
@ -2964,31 +2980,31 @@ namespace Server.Engines.ConPVP
case TieType.FullElimination: tieText = ( tourny.ParticipantsPerMatch == 2 ? "Both eliminated" : "Everyone eliminated" ); break;
}
AddHtml( 35, y, 190, 20, String.Format( "Tiebreaker: {0}", tieText ), false, false );
AddHtml( 35, y, 190, 20, $"Tiebreaker: {tieText}", false, false );
y += 20;
string sdText = "Off";
if ( tourny.SuddenDeath > TimeSpan.Zero )
{
sdText = String.Format( "{0}:{1:D2}", (int) tourny.SuddenDeath.TotalMinutes, tourny.SuddenDeath.Seconds );
sdText = $"{(int) tourny.SuddenDeath.TotalMinutes}:{tourny.SuddenDeath.Seconds:D2}";
if ( tourny.SuddenDeathRounds > 0 )
sdText = String.Format( "{0} (first {1} rounds)", sdText, tourny.SuddenDeathRounds );
sdText = $"{sdText} (first {tourny.SuddenDeathRounds} rounds)";
else
sdText = String.Format( "{0} (all rounds)", sdText );
sdText = $"{sdText} (all rounds)";
}
AddHtml( 35, y, 240, 20, String.Format( "Sudden Death: {0}", sdText ), false, false );
AddHtml( 35, y, 240, 20, $"Sudden Death: {sdText}", false, false );
y += 20;
y += 8;
AddHtml( 35, y, 190, 20, String.Format( "Ruleset: {0}", basedef.Title ), false, false );
AddHtml( 35, y, 190, 20, $"Ruleset: {basedef.Title}", false, false );
y += 20;
for ( int i = 0; i < ruleset.Flavors.Count; ++i, y += 18 )
AddHtml( 35, y, 190, 20, String.Format( " + {0}", ((Ruleset)ruleset.Flavors[i]).Title ), false, false );
AddHtml( 35, y, 190, 20, $" + {((Ruleset) ruleset.Flavors[i]).Title}", false, false );
y += 4;
@ -3030,7 +3046,7 @@ namespace Server.Engines.ConPVP
m_List = new ArrayList( tourny.Participants );
AddLeftArrow( 25, 11, ToButtonID( 0, 0 ) );
AddHtml( 25, 35, 250, 20, Center( String.Format( "{0} Participant{1}", m_List.Count, m_List.Count == 1 ? "" : "s" ) ), false, false );
AddHtml( 25, 35, 250, 20, Center($"{m_List.Count} Participant{(m_List.Count == 1 ? "" : "s")}"), false, false );
int index, count, y;
StartPage( out index, out count, out y, 12 );
@ -3082,7 +3098,8 @@ namespace Server.Engines.ConPVP
y += 18;
}
AddHtml( 25, y, 200, 20, String.Format( "Free Advances: {0}", part.FreeAdvances == 0 ? "None" : part.FreeAdvances.ToString() ), false, false );
AddHtml( 25, y, 200, 20,
$"Free Advances: {(part.FreeAdvances == 0 ? "None" : part.FreeAdvances.ToString())}", false, false );
y += 20;
AddHtml( 25, y, 200, 20, "Log:", false, false );
@ -3119,12 +3136,13 @@ namespace Server.Engines.ConPVP
Ladder ladder = Ladder.Instance;
LadderEntry entry = ladder?.Find( mob );
AddHtml( 25, 53, 250, 20, String.Format( "Name: {0}", mob.Name ), false, false );
AddHtml( 25, 73, 250, 20, String.Format( "Guild: {0}", mob.Guild == null ? "None" : mob.Guild.Name + " [" + mob.Guild.Abbreviation + "]" ), false, false );
AddHtml( 25, 93, 250, 20, String.Format( "Rank: {0}", entry == null ? "N/A" : LadderGump.Rank( entry.Index + 1 ) ), false, false );
AddHtml( 25, 113, 250, 20, String.Format( "Level: {0}", entry == null ? 0 : Ladder.GetLevel( entry.Experience ) ), false, false );
AddHtml( 25, 133, 250, 20, String.Format( "Wins: {0:N0}", entry == null ? 0 : entry.Wins ), false, false );
AddHtml( 25, 153, 250, 20, String.Format( "Losses: {0:N0}", entry == null ? 0 : entry.Losses ), false, false );
AddHtml( 25, 53, 250, 20, $"Name: {mob.Name}", false, false );
AddHtml( 25, 73, 250, 20,
$"Guild: {(mob.Guild == null ? "None" : mob.Guild.Name + " [" + mob.Guild.Abbreviation + "]")}", false, false );
AddHtml( 25, 93, 250, 20, $"Rank: {(entry == null ? "N/A" : LadderGump.Rank(entry.Index + 1))}", false, false );
AddHtml( 25, 113, 250, 20, $"Level: {(entry == null ? 0 : Ladder.GetLevel(entry.Experience))}", false, false );
AddHtml( 25, 133, 250, 20, $"Wins: {(entry == null ? 0 : entry.Wins):N0}", false, false );
AddHtml( 25, 153, 250, 20, $"Losses: {(entry == null ? 0 : entry.Losses):N0}", false, false );
break;
}
@ -3165,9 +3183,10 @@ namespace Server.Engines.ConPVP
if ( m_List == null )
m_List = new ArrayList( level.Matches );
AddRightArrow( 25, 53, ToButtonID( 5, 0 ), String.Format( "Free Advance: {0}", level.FreeAdvance == null ? "None" : level.FreeAdvance.NameList ) );
AddRightArrow( 25, 53, ToButtonID( 5, 0 ),
$"Free Advance: {(level.FreeAdvance == null ? "None" : level.FreeAdvance.NameList)}");
AddHtml( 25, 73, 200, 20, String.Format( "{0} Match{1}", m_List.Count, m_List.Count == 1 ? "" : "es" ), false, false );
AddHtml( 25, 73, 200, 20, $"{m_List.Count} Match{(m_List.Count == 1 ? "" : "es")}", false, false );
int index, count, y;
StartPage( out index, out count, out y, 10 );
@ -3214,9 +3233,9 @@ namespace Server.Engines.ConPVP
string txt;
if ( m_Tournament.EventController != null )
txt = String.Format( "Team {0} ({1})", m_Tournament.EventController.GetTeamName( j ), part.Players.Count );
txt = $"Team {m_Tournament.EventController.GetTeamName(j)} ({part.Players.Count})";
else if ( m_Tournament.TournyType == TournyType.RandomTeam )
txt = String.Format( "Team {0} ({1})", j + 1, part.Players.Count );
txt = $"Team {j + 1} ({part.Players.Count})";
else if ( m_Tournament.TournyType == TournyType.Faction ) {
if ( m_Tournament.ParticipantsPerMatch == 4 )
{
@ -3242,19 +3261,19 @@ namespace Server.Engines.ConPVP
}
}
txt = String.Format( "{0} ({1})", name, part.Players.Count );
txt = $"{name} ({part.Players.Count})";
}
else if ( m_Tournament.ParticipantsPerMatch == 2 )
{
txt = String.Format( "{0} Team ({1})", j==0?"Evil":"Hero", part.Players.Count );
txt = $"{(j == 0 ? "Evil" : "Hero")} Team ({part.Players.Count})";
}
else
{
txt = String.Format( "Team {0} ({1})", j + 1, part.Players.Count );
txt = $"Team {j + 1} ({part.Players.Count})";
}
}
else
txt = String.Format( "Team {0} ({1})", j == 0 ? "Red" : "Blue", part.Players.Count );
txt = $"Team {(j == 0 ? "Red" : "Blue")} ({part.Players.Count})";
if ( color == -1 && match.Context != null && match.Winner == part )
txt = Color( txt, 0x336633 );
@ -3292,8 +3311,9 @@ namespace Server.Engines.ConPVP
AddLeftArrow( 25, 11, ToButtonID( 0, 5 ) );
AddHtml( 25, 35, 250, 20, Center( "Rounds" ), false, false );
AddHtml( 25, 53, 250, 20, String.Format( "Winner: {0}", match.Winner == null ? "N/A" : match.Winner.NameList ), false, false );
AddHtml( 25, 73, 250, 20, String.Format( "State: {0}", match.InProgress ? "In progress" : match.Context != null ? "Complete" : "Waiting" ), false, false );
AddHtml( 25, 53, 250, 20, $"Winner: {(match.Winner == null ? "N/A" : match.Winner.NameList)}", false, false );
AddHtml( 25, 73, 250, 20,
$"State: {(match.InProgress ? "In progress" : match.Context != null ? "Complete" : "Waiting")}", false, false );
AddHtml( 25, 93, 250, 20, "Participants:", false, false );
if ( m_Tournament.TournyType == TournyType.Standard )
@ -3312,9 +3332,11 @@ namespace Server.Engines.ConPVP
TournyParticipant part = (TournyParticipant)match.Participants[i];
if ( m_Tournament.EventController != null )
AddRightArrow( 25, 113 + (i * 18), ToButtonID( 6, i ), String.Format( "Team {0} ({1})", m_Tournament.EventController.GetTeamName( i ), part.Players.Count ) );
AddRightArrow( 25, 113 + (i * 18), ToButtonID( 6, i ),
$"Team {m_Tournament.EventController.GetTeamName(i)} ({part.Players.Count})");
else if ( m_Tournament.TournyType == TournyType.RandomTeam )
AddRightArrow( 25, 113 + (i * 18), ToButtonID( 6, i ), String.Format( "Team {0} ({1})", i+1, part.Players.Count ) );
AddRightArrow( 25, 113 + (i * 18), ToButtonID( 6, i ),
$"Team {i + 1} ({part.Players.Count})");
else if ( m_Tournament.TournyType == TournyType.Faction ) {
if ( m_Tournament.ParticipantsPerMatch == 4 )
{
@ -3340,19 +3362,23 @@ namespace Server.Engines.ConPVP
}
}
AddRightArrow( 25, 113 + (i * 18), ToButtonID( 6, i ), String.Format( "{0} ({1})", name, part.Players.Count ) );
AddRightArrow( 25, 113 + (i * 18), ToButtonID( 6, i ),
$"{name} ({part.Players.Count})");
}
else if ( m_Tournament.ParticipantsPerMatch == 2 )
{
AddRightArrow( 25, 113 + (i * 18), ToButtonID( 6, i ), String.Format( "{0} Team ({1})", i==0?"Evil":"Hero", part.Players.Count ) );
AddRightArrow( 25, 113 + (i * 18), ToButtonID( 6, i ),
$"{(i == 0 ? "Evil" : "Hero")} Team ({part.Players.Count})");
}
else
{
AddRightArrow( 25, 113 + (i * 18), ToButtonID( 6, i ), String.Format( "Team {0} ({1})", i+1, part.Players.Count ) );
AddRightArrow( 25, 113 + (i * 18), ToButtonID( 6, i ),
$"Team {i + 1} ({part.Players.Count})");
}
}
else
AddRightArrow( 25, 113 + (i * 18), ToButtonID( 6, i ), String.Format( "Team {0} ({1})", i==0?"Red":"Blue", part.Players.Count ) );
AddRightArrow( 25, 113 + (i * 18), ToButtonID( 6, i ),
$"Team {(i == 0 ? "Red" : "Blue")} ({part.Players.Count})");
}
}
else if ( m_Tournament.TournyType == TournyType.FreeForAll )

View file

@ -100,7 +100,7 @@ namespace Server.Items
public void UpdateStyle()
{
Name = String.Format( "{0} trophy", m_Rank.ToString().ToLower() );
Name = $"{m_Rank.ToString().ToLower()} trophy";
switch ( m_Rank )
{

View file

@ -106,7 +106,7 @@ namespace Server.Engines.Craft
if ( notice is int noticeInt && noticeInt > 0 )
AddHtmlLocalized( 170, 295, 350, 40, noticeInt, LabelColor, false, false );
else if ( notice is string )
AddHtml( 170, 295, 350, 40, String.Format( "<BASEFONT COLOR=#{0:X6}>{1}</BASEFONT>", FontColor, notice ), false, false );
AddHtml( 170, 295, 350, 40, $"<BASEFONT COLOR=#{FontColor:X6}>{notice}</BASEFONT>", false, false );
// If the system has more than one resource
if ( craftSystem.CraftSubRes.Init )
@ -142,7 +142,7 @@ namespace Server.Engines.Craft
if ( nameNumber > 0 )
AddHtmlLocalized( 50, 365, 250, 18, nameNumber, resourceCount.ToString(), LabelColor, false, false );
else
AddLabel( 50, 362, LabelHue, String.Format( "{0} ({1} Available)", nameString, resourceCount ) );
AddLabel( 50, 362, LabelHue, $"{nameString} ({resourceCount} Available)");
}
// ****************************************
@ -180,7 +180,7 @@ namespace Server.Engines.Craft
if ( nameNumber > 0 )
AddHtmlLocalized( 50, 385, 250, 18, nameNumber, resourceCount.ToString(), LabelColor, false, false );
else
AddLabel( 50, 385, LabelHue, String.Format( "{0} ({1} Available)", nameString, resourceCount ) );
AddLabel( 50, 385, LabelHue, $"{nameString} ({resourceCount} Available)");
}
// ****************************************
@ -235,7 +235,7 @@ namespace Server.Engines.Craft
if ( subResource.NameNumber > 0 )
AddHtmlLocalized( 255, 63 + (index * 20), 250, 18, subResource.NameNumber, resourceCount.ToString(), LabelColor, false, false );
else
AddLabel( 255, 60 + ( index * 20 ), LabelHue, String.Format( "{0} ({1})", subResource.NameString, resourceCount ) );
AddLabel( 255, 60 + ( index * 20 ), LabelHue, $"{subResource.NameString} ({resourceCount})");
}
}

View file

@ -112,7 +112,7 @@ namespace Server.Engines.Craft
case Expansion.ML:
return 1072651; // * Requires the "Mondain's Legacy" expansion
default:
return String.Format( "* Requires the \"{0}\" expansion", ExpansionInfo.GetInfo( expansion ).Name );
return $"* Requires the \"{ExpansionInfo.GetInfo(expansion).Name}\" expansion";
}
}
@ -142,7 +142,7 @@ namespace Server.Engines.Craft
minSkill = 0;
AddHtmlLocalized( 170, 132 + (i * 20), 200, 18, AosSkillBonuses.GetLabel( skill.SkillToMake ), LabelColor, false, false );
AddLabel( 430, 132 + (i * 20), LabelHue, String.Format( "{0:F1}", minSkill ) );
AddLabel( 430, 132 + (i * 20), LabelHue, $"{minSkill:F1}");
}
CraftSubResCol res = ( m_CraftItem.UseSubRes2 ? m_CraftSystem.CraftSubRes2 : m_CraftSystem.CraftSubRes );
@ -163,7 +163,7 @@ namespace Server.Engines.Craft
chance = 1.0;
AddHtmlLocalized( 170, 80, 250, 18, 1044057, LabelColor, false, false ); // Success Chance:
AddLabel( 430, 80, LabelHue, String.Format( "{0:F1}%", chance * 100 ) );
AddLabel( 430, 80, LabelHue, $"{chance * 100:F1}%");
if ( m_ShowExceptionalChance )
{
@ -173,7 +173,7 @@ namespace Server.Engines.Craft
excepChance = 1.0;
AddHtmlLocalized( 170, 100, 250, 18, 1044058, 32767, false, false ); // Exceptional Chance:
AddLabel( 430, 100, LabelHue, String.Format( "{0:F1}%", excepChance * 100 ) );
AddLabel( 430, 100, LabelHue, $"{excepChance * 100:F1}%");
}
}

View file

@ -1016,7 +1016,8 @@ namespace Server.Engines.Craft
case Expansion.ML:
return 1072650; // The "Mondain's Legacy" expansion is required to attempt this item.
default:
return String.Format( "The \"{0}\" expansion is required to attempt this item.", ExpansionInfo.GetInfo( expansion ).Name );
return
$"The \"{ExpansionInfo.GetInfo(expansion).Name}\" expansion is required to attempt this item.";
}
}

View file

@ -1141,7 +1141,7 @@ namespace Server.Factions
silver = killerState.Faction.AwardSilver( killer, award * 40 );
if ( silver > 0 )
killer.SendLocalizedMessage( 1042736, String.Format( "{0:N0} silver\t{1}", silver, victim.Name ) ); // You have earned ~1_SILVER_AMOUNT~ pieces for vanquishing ~2_PLAYER_NAME~!
killer.SendLocalizedMessage( 1042736, $"{silver:N0} silver\t{victim.Name}"); // You have earned ~1_SILVER_AMOUNT~ pieces for vanquishing ~2_PLAYER_NAME~!
}
victimState.KillPoints -= award;
@ -1149,7 +1149,7 @@ namespace Server.Factions
int offset = ( award != 1 ? 0 : 2 ); // for pluralization
string args = String.Format( "{0}\t{1}\t{2}", award, victim.Name, killer.Name );
string args = $"{award}\t{victim.Name}\t{killer.Name}";
killer.SendLocalizedMessage( 1042737 + offset, args ); // Thou hast been honored with ~1_KILL_POINTS~ kill point(s) for vanquishing ~2_DEAD_PLAYER~!
victim.SendLocalizedMessage( 1042738 + offset, args ); // Thou has lost ~1_KILL_POINTS~ kill point(s) to ~3_ATTACKER_NAME~ for being vanquished!

View file

@ -8,22 +8,22 @@ namespace Server.Factions
{
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 static string FormatTimeSpan( TimeSpan ts )
{
return String.Format( "{0:D2}:{1:D2}:{2:D2}:{3:D2}", ts.Days, ts.Hours % 24, ts.Minutes % 60, ts.Seconds % 60 );
return $"{ts.Days:D2}:{ts.Hours % 24:D2}:{ts.Minutes % 60:D2}:{ts.Seconds % 60:D2}";
}
public const int LabelColor = 0xFFFFFF;

View file

@ -93,7 +93,7 @@ namespace Server.Factions
if ( from.Alive )
m_Placer.SendMessage( "You have earned {0} silver pieces because {1} fell for your trap.", silverGiven, from.Name );
else
m_Placer.SendLocalizedMessage( 1042736, String.Format( "{0} silver\t{1}", silverGiven, from.Name ) ); // You have earned ~1_SILVER_AMOUNT~ pieces for vanquishing ~2_PLAYER_NAME~!
m_Placer.SendLocalizedMessage( 1042736, $"{silverGiven} silver\t{@from.Name}"); // You have earned ~1_SILVER_AMOUNT~ pieces for vanquishing ~2_PLAYER_NAME~!
}
victimState.OnGivenSilverTo( m_Placer );

View file

@ -215,7 +215,7 @@ namespace Server.Factions
public int GetStatMod( Mobile mob, StatType type )
{
StatMod mod = mob.GetStatMod( String.Format( "[Magic] {0} Offset", type ) );
StatMod mod = mob.GetStatMod($"[Magic] {type} Offset");
if ( mod == null )
return 0;

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

View file

@ -204,7 +204,7 @@ namespace Server.Commands
sw.RaisableItem = stone;
lv.RaisableItem = door;
e.Mobile.SendMessage( String.Format( "{0} dynamic Khaldun item{1} generated.", m_Count, m_Count == 1 ? "" : "s" ) );
e.Mobile.SendMessage($"{m_Count} dynamic Khaldun item{(m_Count == 1 ? "" : "s")} generated.");
}
}
}

View file

@ -164,7 +164,7 @@ namespace Server.Engines.MLQuests.Gumps
public void SetTitle( TextDefinition def )
{
if ( def.Number > 0 )
m_Title = String.Format( "#{0}", def.Number ); // OSI does "@@#{0}" instead, why? KR client related?
m_Title = $"#{def.Number}"; // OSI does "@@#{0}" instead, why? KR client related?
else
m_Title = def.String;
}

View file

@ -42,7 +42,7 @@ namespace Server.Engines.MLQuests.Gumps
else if ( targetRace == Race.Elf )
AddHtmlLocalized( 15, 15, 210, 75, 1073642, 0, false, false ); // Are you sure you want to follow the elven ways?
else
AddHtml( 15, 15, 210, 75, String.Format( "Are you sure you want to change your race to {0}?", targetRace.Name ), false, false );
AddHtml( 15, 15, 210, 75, $"Are you sure you want to change your race to {targetRace.Name}?", false, false );
AddButton( 160, 95, 0xF7, 0xF8, 1, GumpButtonType.Reply, 0 );
AddButton( 90, 95, 0xF2, 0xF1, 0, GumpButtonType.Reply, 0 );

View file

@ -68,7 +68,7 @@ namespace Server.Engines.MLQuests.Items
base.GetProperties(list);
if (m_QuestType != null)
list.Add(String.Format("Required quest: {0}", m_QuestType.Name));
list.Add($"Required quest: {m_QuestType.Name}");
}
public MLQuestTeleporter(Serial serial)
@ -187,7 +187,7 @@ namespace Server.Engines.MLQuests.Items
base.GetProperties(list);
if (m_TicketType != null)
list.Add(String.Format("Required ticket: {0}", m_TicketType.Name));
list.Add($"Required ticket: {m_TicketType.Name}");
}
public TicketTeleporter(Serial serial)

View file

@ -159,7 +159,7 @@ namespace Server.Engines.MLQuests
public void PutSpawner( Spawner s, Point3D loc, Map map )
{
string name = String.Format( "MLQS-{0}", GetType().Name );
string name = $"MLQS-{GetType().Name}";
// Auto cleanup on regeneration
List<Item> toDelete = new List<Item>();

View file

@ -218,7 +218,7 @@ namespace Server.Engines.MLQuests.Mobiles
if ( m_Index == 0 )
{
if ( m_Target.ShowFameTitle && m_Target.Fame >= 10000 )
m_Owner.Say( true, String.Format( "{0} {1}", m_Target.Female ? "Lady" : "Lord", m_Target.Name ) );
m_Owner.Say( true, $"{(m_Target.Female ? "Lady" : "Lord")} {m_Target.Name}");
else
m_Owner.Say( true, m_Target.Name );
}

View file

@ -212,7 +212,7 @@ namespace Server.Engines.MLQuests.Objectives
if ( total < desired )
{
pm.SendLocalizedMessage( 1074861 ); // You do not have everything you need!
pm.SendLocalizedMessage( 1074885, String.Format( "{0}\t{1}", total, desired ) ); // You have ~1_val~ item(s) but require ~2_val~
pm.SendLocalizedMessage( 1074885, $"{total}\t{desired}"); // You have ~1_val~ item(s) but require ~2_val~
return false;
}

View file

@ -85,9 +85,9 @@ namespace Server.Engines.MLQuests.Objectives
string args;
if ( m_ThresholdFixed % 10 == 0 )
args = String.Format( "#{0}\t{1}", skillLabel, m_ThresholdFixed / 10 ); // as seen on OSI
args = $"#{skillLabel}\t{m_ThresholdFixed / 10}"; // as seen on OSI
else
args = String.Format( "#{0}\t{1:0.0}", skillLabel, (double)m_ThresholdFixed / 10 ); // for non-integer skill levels
args = $"#{skillLabel}\t{(double) m_ThresholdFixed / 10:0.0}"; // for non-integer skill levels
g.AddHtmlLocalized( 98, y, 312, 16, 1077485, args, 0x15F90, false, false ); // Increase ~1_SKILL~ to ~2_VALUE~
y += 16;

View file

@ -42,8 +42,8 @@ namespace Server.Engines.MyRunUO
public static string CompileConnectionString()
{
string connectionString = String.Format( "DRIVER={0};SERVER={1};DATABASE={2};UID={3};PASSWORD={4};",
DatabaseDriver, DatabaseServer, DatabaseName, DatabaseUserID, DatabasePassword );
string connectionString =
$"DRIVER={DatabaseDriver};SERVER={DatabaseServer};DATABASE={DatabaseName};UID={DatabaseUserID};PASSWORD={DatabasePassword};";
return connectionString;
}

View file

@ -532,7 +532,7 @@ namespace Server.Engines.MyRunUO
public StreamWriter GetUniqueWriter( string type, out string filePath )
{
filePath = Path.Combine( Core.BaseDirectory, String.Format( "myrunuodb_{0}.txt", type ) ).Replace( Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar );
filePath = Path.Combine( Core.BaseDirectory, $"myrunuodb_{type}.txt").Replace( Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar );
try
{
@ -544,7 +544,7 @@ namespace Server.Engines.MyRunUO
{
try
{
filePath = Path.Combine( Core.BaseDirectory, String.Format( "myrunuodb_{0}_{1}.txt", type, i ) ).Replace( Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar );
filePath = Path.Combine( Core.BaseDirectory, $"myrunuodb_{type}_{i}.txt").Replace( Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar );
return new StreamWriter( filePath );
}
catch
@ -639,7 +639,7 @@ namespace Server.Engines.MyRunUO
ExecuteNonQueryIfNull(
String.Format( "SELECT guild_1 FROM myrunuo_guilds_wars WHERE (guild_1={0} AND guild_2={1}) OR (guild_1={1} AND guild_2={0})", ourId, theirId ),
String.Format( "INSERT INTO myrunuo_guilds_wars (guild_1, guild_2) VALUES ({0}, {1})", ourId, theirId ) );
$"INSERT INTO myrunuo_guilds_wars (guild_1, guild_2) VALUES ({ourId}, {theirId})");
}
}

View file

@ -56,7 +56,8 @@ namespace Server.Engines.MyRunUO
Mobile mob = ns.Mobile;
if ( mob != null )
m_Command.Enqueue( String.Format( "INSERT INTO myrunuo_status (char_id) VALUES ({0})", mob.Serial.Value.ToString() ) );
m_Command.Enqueue(
$"INSERT INTO myrunuo_status (char_id) VALUES ({mob.Serial.Value.ToString()})");
}
}
catch ( Exception e )

View file

@ -68,7 +68,7 @@ namespace Server.Engines.PartySystem
else if ( m == null )
p.SendPublicMessage( from, "I was killed !!" );
else
p.SendPublicMessage( from, String.Format( "I was killed by {0} !!", m.Name ) );
p.SendPublicMessage( from, $"I was killed by {m.Name} !!");
}
}

View file

@ -258,9 +258,9 @@ namespace Server.Engines.Plants
string args;
if ( ShowContainerType )
args = String.Format( "#{0}\t#{1}", GetLocalizedContainerType(), m_PlantSystem.GetLocalizedDirtStatus() );
args = $"#{GetLocalizedContainerType()}\t#{m_PlantSystem.GetLocalizedDirtStatus()}";
else
args = String.Format( "#{0}", m_PlantSystem.GetLocalizedDirtStatus() );
args = $"#{m_PlantSystem.GetLocalizedDirtStatus()}";
list.Add( 1060830, args ); // a ~1_val~ of ~2_val~ dirt
}
@ -271,24 +271,26 @@ namespace Server.Engines.Plants
if ( m_PlantStatus >= PlantStatus.DecorativePlant )
{
list.Add( typeInfo.GetPlantLabelDecorative( hueInfo ), String.Format( "#{0}\t#{1}", hueInfo.Name, typeInfo.Name ) );
list.Add( typeInfo.GetPlantLabelDecorative( hueInfo ), $"#{hueInfo.Name}\t#{typeInfo.Name}");
}
else if ( m_PlantStatus >= PlantStatus.FullGrownPlant )
{
list.Add( typeInfo.GetPlantLabelFullGrown( hueInfo ), String.Format( "#{0}\t#{1}\t#{2}", m_PlantSystem.GetLocalizedHealth(), hueInfo.Name, typeInfo.Name ) );
list.Add( typeInfo.GetPlantLabelFullGrown( hueInfo ),
$"#{m_PlantSystem.GetLocalizedHealth()}\t#{hueInfo.Name}\t#{typeInfo.Name}");
}
else
{
string args;
if ( ShowContainerType )
args = String.Format( "#{0}\t#{1}\t#{2}", GetLocalizedContainerType(), m_PlantSystem.GetLocalizedDirtStatus(), m_PlantSystem.GetLocalizedHealth() );
args =
$"#{GetLocalizedContainerType()}\t#{m_PlantSystem.GetLocalizedDirtStatus()}\t#{m_PlantSystem.GetLocalizedHealth()}";
else
args = String.Format( "#{0}\t#{1}", m_PlantSystem.GetLocalizedDirtStatus(), m_PlantSystem.GetLocalizedHealth() );
args = $"#{m_PlantSystem.GetLocalizedDirtStatus()}\t#{m_PlantSystem.GetLocalizedHealth()}";
if ( m_ShowType )
{
args += String.Format( "\t#{0}\t#{1}\t#{2}", hueInfo.Name, typeInfo.Name, GetLocalizedPlantStatus() );
args += $"\t#{hueInfo.Name}\t#{typeInfo.Name}\t#{GetLocalizedPlantStatus()}";
if ( m_PlantStatus == PlantStatus.Plant )
list.Add( typeInfo.GetPlantLabelPlant( hueInfo ), args );
@ -297,7 +299,8 @@ namespace Server.Engines.Plants
}
else
{
args += String.Format( "\t#{0}\t#{1}", ( typeInfo.PlantCategory == PlantCategory.Default ) ? hueInfo.Name : (int)typeInfo.PlantCategory, GetLocalizedPlantStatus() );
args +=
$"\t#{((typeInfo.PlantCategory == PlantCategory.Default) ? hueInfo.Name : (int) typeInfo.PlantCategory)}\t#{GetLocalizedPlantStatus()}";
list.Add( hueInfo.IsBright() ? 1060832 : 1060831, args ); // a ~1_val~ of ~2_val~ dirt with a ~3_val~ [bright] ~4_val~ ~5_val~
}

View file

@ -90,7 +90,7 @@ namespace Server.Engines.Plants
else
{
AddLabel( x, y, PlantHueInfo.GetInfo( m_Plant.PlantHue ).GumpHue,
string.Format( "{0}/{1}", system.AvailableResources, totalResources ) );
$"{system.AvailableResources}/{totalResources}");
}
}
@ -106,7 +106,7 @@ namespace Server.Engines.Plants
else
{
AddLabel( x, y, PlantHueInfo.GetInfo( system.SeedHue ).GumpHue,
string.Format( "{0}/{1}", system.AvailableSeeds, totalSeeds ) );
$"{system.AvailableSeeds}/{totalSeeds}");
}
}

View file

@ -106,12 +106,12 @@ namespace Server.Engines.Plants
{
if ( m_ShowType )
{
args = String.Format( "#{0}\t#{1}", title, typeInfo.Name );
args = $"#{title}\t#{typeInfo.Name}";
return typeInfo.GetSeedLabel( hueInfo );
}
else
{
args = String.Format( "#{0}", title );
args = $"#{title}";
return hueInfo.IsBright() ? 1060839 : 1060838; // [bright] ~1_val~ seed
}
}
@ -119,12 +119,12 @@ namespace Server.Engines.Plants
{
if ( m_ShowType )
{
args = String.Format( "{0}\t#{1}\t#{2}", Amount, title, typeInfo.Name );
args = $"{Amount}\t#{title}\t#{typeInfo.Name}";
return typeInfo.GetSeedLabelPlural( hueInfo );
}
else
{
args = String.Format( "{0}\t#{1}", Amount, title );
args = $"{Amount}\t#{title}";
return hueInfo.IsBright() ? 1113491 : 1113490; // ~1_amount~ [bright] ~2_val~ seeds
}
}

View file

@ -647,7 +647,7 @@ namespace Server.Engines.Quests
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>";
}
public static ArrayList BuildList( object obj )

View file

@ -31,7 +31,7 @@ namespace Server.RemoteAdmin
string outStr;
if ( m_NewLine )
{
outStr = String.Format( "[{0}]: {1}", DateTime.UtcNow.ToString( DateFormat ), str );
outStr = $"[{DateTime.UtcNow.ToString(DateFormat)}]: {str}";
m_NewLine = false;
}
else
@ -50,7 +50,7 @@ namespace Server.RemoteAdmin
if ( m_NewLine )
{
string outStr;
outStr = String.Format( "[{0}]: {1}", DateTime.UtcNow.ToString( DateFormat ), ch );
outStr = $"[{DateTime.UtcNow.ToString(DateFormat)}]: {ch}";
m_ConsoleData.Append( outStr );
SendToAll( outStr );
@ -70,9 +70,9 @@ namespace Server.RemoteAdmin
{
string outStr;
if ( m_NewLine )
outStr = String.Format( "[{0}]: {1}{2}", DateTime.UtcNow.ToString( DateFormat ), line, Console.Out.NewLine );
outStr = $"[{DateTime.UtcNow.ToString(DateFormat)}]: {line}{Console.Out.NewLine}";
else
outStr = String.Format( "{0}{1}", line, Console.Out.NewLine );
outStr = $"{line}{Console.Out.NewLine}";
m_ConsoleData.Append( outStr );
RoughTrimConsoleData();
@ -126,7 +126,8 @@ namespace Server.RemoteAdmin
}
else if ( cmd == 0xFF )
{
string statStr = String.Format( ", Name={0}, Age={1}, Clients={2}, Items={3}, Chars={4}, Mem={5}K, Ver={6}", Misc.ServerList.ServerName, (int)(DateTime.UtcNow - Items.Clock.ServerStart).TotalHours, NetState.Instances.Count, World.Items.Count, World.Mobiles.Count, (int)(GC.GetTotalMemory( false ) / 1024), ProtocolVersion );
string statStr =
$", Name={Misc.ServerList.ServerName}, Age={(int) (DateTime.UtcNow - Items.Clock.ServerStart).TotalHours}, Clients={NetState.Instances.Count}, Items={World.Items.Count}, Chars={World.Mobiles.Count}, Mem={(int) (GC.GetTotalMemory(false) / 1024)}K, Ver={ProtocolVersion}";
state.Send( new UOGInfo( statStr ) );
state.Dispose();
}

View file

@ -225,7 +225,8 @@ namespace Server.RemoteAdmin
{
string changes = string.Empty;
if ( UpdatedPass ) changes += " Password Changed.";
if ( oldAcessLevel != a.AccessLevel ) changes = string.Format( "{0} Access level changed from {1} to {2}.", changes, oldAcessLevel, a.AccessLevel );
if ( oldAcessLevel != a.AccessLevel ) changes =
$"{changes} Access level changed from {oldAcessLevel} to {a.AccessLevel}.";
if ( oldbanned != a.Banned ) changes += a.Banned ? " Banned." : " Unbanned.";
RemoteAdminLogging.WriteLine( state, "Updated account {0}:{1}", a.Username, changes );
}

View file

@ -89,7 +89,7 @@ namespace Server.RemoteAdmin
Commands.CommandLogging.AppendPath( ref path, LogBaseDirectory );
Commands.CommandLogging.AppendPath( ref path, LogSubDirectory );
Commands.CommandLogging.AppendPath( ref path, accesslevel );
path = Path.Combine( path, String.Format( "{0}.log", name ) );
path = Path.Combine( path, $"{name}.log");
using ( StreamWriter sw = new StreamWriter( path, true ) )
sw.WriteLine( "{0}: {1}: {2}", DateTime.UtcNow, statestr, text );

View file

@ -105,7 +105,7 @@ namespace Server.Engines.Reports
ProcessStartInfo psi = new ProcessStartInfo();
psi.FileName = "ftp";
psi.Arguments = String.Format( "-i -s:\"{0}\"", filePath );
psi.Arguments = $"-i -s:\"{filePath}\"";
psi.CreateNoWindow = true;
psi.WindowStyle = ProcessWindowStyle.Hidden;
@ -298,7 +298,8 @@ namespace Server.Engines.Reports
html.Write( "<!-- " );
html.AddAttribute( HtmlAttr.Href, "#" );
html.AddAttribute( HtmlAttr.Onclick, String.Format( "javascript:window.open('{0}.html','ChildWindow','width={1},height={2},resizable=no,status=no,toolbar=no')", SafeFileName( FindNameFrom( chart ) ), bmp.Width+30,bmp.Height+80 ) );
html.AddAttribute( HtmlAttr.Onclick,
$"javascript:window.open('{SafeFileName(FindNameFrom(chart))}.html','ChildWindow','width={bmp.Width + 30},height={bmp.Height + 80},resizable=no,status=no,toolbar=no')");
html.RenderBeginTag( HtmlTag.A );
html.Write( chart.Name );
html.RenderEndTag();
@ -393,7 +394,8 @@ namespace Server.Engines.Reports
html.Write( "<!-- " );
html.AddAttribute( HtmlAttr.Href, "#" );
html.AddAttribute( HtmlAttr.Onclick, String.Format( "javascript:window.open('{0}.html','ChildWindow','width={1},height={2},resizable=no,status=no,toolbar=no')", SafeFileName( FindNameFrom( graph ) ), bmp.Width+30,bmp.Height+80 ) );
html.AddAttribute( HtmlAttr.Onclick,
$"javascript:window.open('{SafeFileName(FindNameFrom(graph))}.html','ChildWindow','width={bmp.Width + 30},height={bmp.Height + 80},resizable=no,status=no,toolbar=no')");
html.RenderBeginTag( HtmlTag.A );
html.Write( graph.Name );
html.RenderEndTag();

View file

@ -141,7 +141,7 @@ namespace Server.Engines.Reports
}
float perc = (item.SweepSize * 100.0f) / 360.0f;
string percString = String.Format( "{0:F0}%", perc );
string percString = $"{perc:F0}%";
float px = pieRect.X+(pieRect.Width/2);
float py = pieRect.Y+(pieRect.Height/2);

View file

@ -404,9 +404,9 @@ namespace Server.Engines.Reports
if ( pl.Faction.Commander == pl.Mobile )
office = "Commanding Lord";
else if ( pl.Finance != null )
office = String.Format( "{0} Finance Minister", pl.Finance.Definition.FriendlyName );
office = $"{pl.Finance.Definition.FriendlyName} Finance Minister";
else if ( pl.Sheriff != null )
office = String.Format( "{0} Sheriff", pl.Sheriff.Definition.FriendlyName );
office = $"{pl.Sheriff.Definition.FriendlyName} Sheriff";
else
office = "";

View file

@ -259,7 +259,7 @@ namespace Server.Mobiles
if ( pm.ToTItemsTurnedIn == 0 )
SayTo( pm, 1071013 ); // Bring me 10 of the lost treasures of Tokuno and I will reward you with a valuable item.
else
SayTo( pm, 1070981, String.Format( "{0}\t{1}", pm.ToTItemsTurnedIn, TreasuresOfTokuno.ItemsPerReward ) ); // You have turned in ~1_COUNT~ minor artifacts. Turn in ~2_NUM~ to receive a reward.
SayTo( pm, 1070981, $"{pm.ToTItemsTurnedIn}\t{TreasuresOfTokuno.ItemsPerReward}"); // You have turned in ~1_COUNT~ minor artifacts. Turn in ~2_NUM~ to receive a reward.
ArrayList buttons = ToTTurnInGump.FindRedeemableItems( pm );
@ -363,7 +363,7 @@ namespace Server.Gumps
}
else
{
m_Collector.SayTo( pm, 1070981, String.Format( "{0}\t{1}", pm.ToTItemsTurnedIn, TreasuresOfTokuno.ItemsPerReward ) ); // You have turned in ~1_COUNT~ minor artifacts. Turn in ~2_NUM~ to receive a reward.
m_Collector.SayTo( pm, 1070981, $"{pm.ToTItemsTurnedIn}\t{TreasuresOfTokuno.ItemsPerReward}"); // You have turned in ~1_COUNT~ minor artifacts. Turn in ~2_NUM~ to receive a reward.
ArrayList buttons = FindRedeemableItems( pm );
@ -382,7 +382,7 @@ namespace Server.Gumps
if ( pm.ToTItemsTurnedIn == 0 )
m_Collector.SayTo( pm, 1071013 ); // Bring me 10 of the lost treasures of Tokuno and I will reward you with a valuable item.
else if ( pm.ToTItemsTurnedIn < TreasuresOfTokuno.ItemsPerReward ) //This case should ALWAYS be true with this gump, jsut a sanity check
m_Collector.SayTo( pm, 1070981, String.Format( "{0}\t{1}", pm.ToTItemsTurnedIn, TreasuresOfTokuno.ItemsPerReward ) ); // You have turned in ~1_COUNT~ minor artifacts. Turn in ~2_NUM~ to receive a reward.
m_Collector.SayTo( pm, 1070981, $"{pm.ToTItemsTurnedIn}\t{TreasuresOfTokuno.ItemsPerReward}"); // You have turned in ~1_COUNT~ minor artifacts. Turn in ~2_NUM~ to receive a reward.
else
m_Collector.SayTo( pm, 1070982 ); // When you wish to choose your reward, you have but to approach me again.
}
@ -572,7 +572,7 @@ namespace Server.Gumps
if ( pm.AddToBackpack( item ) )
{
pm.ToTItemsTurnedIn -= TreasuresOfTokuno.ItemsPerReward;
m_Collector.SayTo( pm, 1070984, (item.Name == null || item.Name.Length <= 0)? String.Format( "#{0}", item.LabelNumber ) : item.Name ); // You have earned the gratitude of the Empire. I have placed the ~1_OBJTYPE~ in your backpack.
m_Collector.SayTo( pm, 1070984, (item.Name == null || item.Name.Length <= 0)? $"#{item.LabelNumber}" : item.Name ); // You have earned the gratitude of the Empire. I have placed the ~1_OBJTYPE~ in your backpack.
}
else
{
@ -591,7 +591,7 @@ namespace Server.Gumps
if ( pm.ToTItemsTurnedIn == 0 )
m_Collector.SayTo( pm, 1071013 ); // Bring me 10 of the lost treasures of Tokuno and I will reward you with a valuable item.
else if ( pm.ToTItemsTurnedIn < TreasuresOfTokuno.ItemsPerReward ) //This and above case should ALWAYS be FALSE with this gump, jsut a sanity check
m_Collector.SayTo( pm, 1070981, String.Format( "{0}\t{1}", pm.ToTItemsTurnedIn, TreasuresOfTokuno.ItemsPerReward ) ); // You have turned in ~1_COUNT~ minor artifacts. Turn in ~2_NUM~ to receive a reward.
m_Collector.SayTo( pm, 1070981, $"{pm.ToTItemsTurnedIn}\t{TreasuresOfTokuno.ItemsPerReward}"); // You have turned in ~1_COUNT~ minor artifacts. Turn in ~2_NUM~ to receive a reward.
else
m_Collector.SayTo( pm, 1070982 ); // When you wish to choose your reward, you have but to approach me again.

View file

@ -132,7 +132,7 @@ namespace Server.Mobiles
if ( m_SculptedBy != null )
{
if ( m_SculptedBy.ShowFameTitle && ( m_SculptedBy.Player || m_SculptedBy.Body.IsHuman ) && m_SculptedBy.Fame >= 10000 )
list.Add( 1076202, String.Format( "{0} {1}", m_SculptedBy.Female ? "Lady" : "Lord", m_SculptedBy.Name ) ); // Sculpted by ~1_Name~
list.Add( 1076202, $"{(m_SculptedBy.Female ? "Lady" : "Lord")} {m_SculptedBy.Name}"); // Sculpted by ~1_Name~
else
list.Add( 1076202, m_SculptedBy.Name ); // Sculpted by ~1_Name~
}

View file

@ -36,7 +36,7 @@ namespace Server.Engines.VeteranRewards
else if ( rewardInterval == TimeSpan.FromDays( 365.0 ) )
intervalAsString = "year";
else
intervalAsString = String.Format( "{0} day{1}", rewardInterval.TotalDays, rewardInterval.TotalDays == 1 ? "" : "s" );
intervalAsString = $"{rewardInterval.TotalDays} day{(rewardInterval.TotalDays == 1 ? "" : "s")}";
AddPage( 1 );

View file

@ -134,7 +134,7 @@ namespace Server
{
protectee.JusticeProtectors.Add( protector );
string args = String.Format( "{0}\t{1}", protector.Name, protectee.Name );
string args = $"{protector.Name}\t{protectee.Name}";
protectee.SendLocalizedMessage( 1049451, args ); // You are now being protected by ~1_NAME~.
protector.SendLocalizedMessage( 1049452, args ); // You are now protecting ~2_NAME~.
@ -143,7 +143,7 @@ namespace Server
public static void OnVirtueRejected( PlayerMobile protector, PlayerMobile protectee )
{
string args = String.Format( "{0}\t{1}", protector.Name, protectee.Name );
string args = $"{protector.Name}\t{protectee.Name}";
protectee.SendLocalizedMessage( 1049453, args ); // You have declined protection from ~1_NAME~.
protector.SendLocalizedMessage( 1049454, args ); // ~2_NAME~ has declined your protection.

View file

@ -160,7 +160,7 @@ namespace Server
public override string Compile( NetState ns )
{
return String.Format( "{{ gumppic {0} {1} {2} hue={3} class=VirtueGumpItem }}", X, Y, GumpID, Hue );
return $"{{ gumppic {X} {Y} {GumpID} hue={Hue} class=VirtueGumpItem }}";
}
private static byte[] m_Class = StringToBuffer( " class=VirtueGumpItem" );

View file

@ -74,12 +74,13 @@ namespace Server.Gumps
if ( button >= 0 && button < 8 )
{
from.SendGump( new AddDoorGump( m_Type ) );
CommandSystem.Handle( from, String.Format( "{0}Add {1} {2}", CommandSystem.Prefix, m_Types[m_Type].m_Type.Name, (DoorFacing) button ) );
CommandSystem.Handle( from,
$"{CommandSystem.Prefix}Add {m_Types[m_Type].m_Type.Name} {(DoorFacing) button}");
}
else if ( button == 8 )
{
from.SendGump( new AddDoorGump( m_Type ) );
CommandSystem.Handle( from, String.Format( "{0}Link", CommandSystem.Prefix ) );
CommandSystem.Handle( from, $"{CommandSystem.Prefix}Link");
}
else
{

View file

@ -85,12 +85,12 @@ namespace Server.Gumps
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 AddBlackAlpha( int x, int y, int width, int height )
@ -106,21 +106,21 @@ namespace Server.Gumps
public static string FormatTimeSpan( TimeSpan ts )
{
return String.Format( "{0:D2}:{1:D2}:{2:D2}:{3:D2}", ts.Days, ts.Hours % 24, ts.Minutes % 60, ts.Seconds % 60 );
return $"{ts.Days:D2}:{ts.Hours % 24:D2}:{ts.Minutes % 60:D2}:{ts.Seconds % 60:D2}";
}
public static string FormatByteAmount( long totalBytes )
{
if ( totalBytes > 1000000000 )
return String.Format( "{0:F1} GB", (double)totalBytes / 1073741824 );
return $"{(double) totalBytes / 1073741824:F1} GB";
if ( totalBytes > 1000000 )
return String.Format( "{0:F1} MB", (double)totalBytes / 1048576 );
return $"{(double) totalBytes / 1048576:F1} MB";
if ( totalBytes > 1000 )
return String.Format( "{0:F1} KB", (double)totalBytes / 1024 );
return $"{(double) totalBytes / 1024:F1} KB";
return String.Format( "{0} Bytes", totalBytes );
return $"{totalBytes} Bytes";
}
public static void Initialize()
@ -600,7 +600,7 @@ namespace Server.Gumps
y += 20;
AddLabel( 20, y, LabelHue, "Location:" );
AddLabel( 200, y, LabelHue, String.Format( "{0} [{1}]", m.Location, m.Map ) );
AddLabel( 200, y, LabelHue, $"{m.Location} [{m.Map}]");
y += 44;
}
else
@ -616,7 +616,7 @@ namespace Server.Gumps
y += 20;
AddLabel( 20, y, LabelHue, "Location:" );
AddLabel( 200, y, LabelHue, String.Format( "{0} [{1}]", m.Location, m.Map ) );
AddLabel( 200, y, LabelHue, $"{m.Location} [{m.Map}]");
y += 24;
}
@ -899,7 +899,7 @@ namespace Server.Gumps
double perc = remMinutes / totMinutes;
AddLabel( 250, 190, LabelHue, String.Format( "{0} [{1:F0}%]", FormatTimeSpan( banDuration ), perc*100 ) );
AddLabel( 250, 190, LabelHue, $"{FormatTimeSpan(banDuration)} [{perc * 100:F0}%]");
}
}
else if ( a.Banned )
@ -1443,7 +1443,8 @@ namespace Server.Gumps
CommandLogging.WriteLine( from, "{0} {1} deleting account {2}", from.AccessLevel, CommandLogging.Format( from ), a.Username );
a.Delete();
from.SendGump( new AdminGump( from, AdminGumpPage.Accounts, 0, null, String.Format( "{0} : The account has been deleted.", a.Username ), null ) );
from.SendGump( new AdminGump( from, AdminGumpPage.Accounts, 0, null,
$"{a.Username} : The account has been deleted.", null ) );
}
else
{
@ -1502,14 +1503,16 @@ namespace Server.Gumps
if ( !ban )
NetState.Resume();
from.SendGump( new NoticeGump( 1060637, 30720, String.Format( "You have {0} the account{1}.", ban ? "banned" : "deleted", rads.Count == 1 ? "" : "s" ), 0xFFC000, 420, 280, new NoticeGumpCallback( ResendGump_Callback ), new object[]{ list, rads, ban ? page : 0 } ) );
from.SendGump( new NoticeGump( 1060637, 30720,
$"You have {(ban ? "banned" : "deleted")} the account{(rads.Count == 1 ? "" : "s")}.", 0xFFC000, 420, 280, new NoticeGumpCallback( ResendGump_Callback ), new object[]{ list, rads, ban ? page : 0 } ) );
if ( ban )
from.SendGump( new BanDurationGump( rads ) );
}
else
{
from.SendGump( new NoticeGump( 1060637, 30720, String.Format( "You have chosen not to {0} the account{1}.", ban ? "ban" : "delete", rads.Count == 1 ? "" : "s" ), 0xFFC000, 420, 280, new NoticeGumpCallback( ResendGump_Callback ), new object[]{ list, rads, page } ) );
from.SendGump( new NoticeGump( 1060637, 30720,
$"You have chosen not to {(ban ? "ban" : "delete")} the account{(rads.Count == 1 ? "" : "s")}.", 0xFFC000, 420, 280, new NoticeGumpCallback( ResendGump_Callback ), new object[]{ list, rads, page } ) );
}
}
@ -1553,7 +1556,7 @@ namespace Server.Gumps
{
Firewall.Add( toFirewall );
notice = String.Format( "{0} : Added to firewall.", toFirewall );
notice = $"{toFirewall} : Added to firewall.";
}
else
{
@ -1586,7 +1589,7 @@ namespace Server.Gumps
newList.Remove( ip );
a.LoginIPs = newList.ToArray();
notice = String.Format( "{0} : Removed address.", ip );
notice = $"{ip} : Removed address.";
}
else
{
@ -1756,7 +1759,7 @@ namespace Server.Gumps
else
{
notice = "Your message has been broadcasted.";
InvokeCommand( String.Format( "{0} {1}", index == 210 ? "BC" : "SM", text ) );
InvokeCommand($"{(index == 210 ? "BC" : "SM")} {text}");
}
break;
@ -1887,7 +1890,7 @@ namespace Server.Gumps
if ( count == 0 )
notice = "Nobody without access was found to disconnect.";
else
notice = String.Format( "Number of players disconnected: {0}", count );
notice = $"Number of players disconnected: {count}";
}
else
{
@ -1927,7 +1930,7 @@ namespace Server.Gumps
if ( string.IsNullOrEmpty(match) )
{
notice = String.Format( "You must enter {0} to search.", forName ? "a name" : "an ip address" );
notice = $"You must enter {(forName ? "a name" : "an ip address")} to search.";
}
else
{
@ -2045,7 +2048,7 @@ namespace Server.Gumps
else
{
dispAccount = new Account( un, pw );
notice = String.Format( "{0} : Account added.", un );
notice = $"{un} : Account added.";
CommandLogging.WriteLine( from, "{0} {1} adding new account: {2}", from.AccessLevel, CommandLogging.Format( from ), un );
}
}
@ -2096,7 +2099,8 @@ namespace Server.Gumps
a.SetUnspecifiedBan( from );
a.Banned = ( index == 10 );
CommandLogging.WriteLine( from, "{0} {1} {3} account {2}", from.AccessLevel, CommandLogging.Format( from ), a.Username, a.Banned ? "banning" : "unbanning" );
from.SendGump( new AdminGump( from, m_PageType, m_ListPage, m_List, String.Format( "The account has been {0}.", a.Banned ? "banned" : "unbanned" ), m_State ) );
from.SendGump( new AdminGump( from, m_PageType, m_ListPage, m_List,
$"The account has been {(a.Banned ? "banned" : "unbanned")}.", m_State ) );
if ( index == 10 )
from.SendGump( new BanDurationGump( a ) );
@ -2195,7 +2199,8 @@ namespace Server.Gumps
if ( a.LoginIPs.Length > 0 )
{
from.SendGump( new WarningGump( 1060635, 30720, String.Format( "You are about to firewall {0} address{1}. Do you wish to continue?", a.LoginIPs.Length, a.LoginIPs.Length != 1 ? "s" : "" ), 0xFFC000, 420, 400, new WarningGumpCallback( FirewallShared_Callback ), a ) );
from.SendGump( new WarningGump( 1060635, 30720,
$"You are about to firewall {a.LoginIPs.Length} address{(a.LoginIPs.Length != 1 ? "s" : "")}. Do you wish to continue?", 0xFFC000, 420, 400, new WarningGumpCallback( FirewallShared_Callback ), a ) );
}
else
{
@ -2241,7 +2246,7 @@ namespace Server.Gumps
a.IPRestrictions = newList;
notice = String.Format( "{0} : Added to restriction list.", ip );
notice = $"{ip} : Added to restriction list.";
}
}
@ -2287,7 +2292,8 @@ namespace Server.Gumps
if ( !(m_State is Account a) )
break;
from.SendGump( new WarningGump( 1060635, 30720, String.Format( "<center>Account of {0}</center><br>You are about to <em><basefont color=red>permanently delete</basefont></em> the account. Likewise, all characters on the account will be deleted, including equipped, inventory, and banked items. Any houses tied to the account will be demolished.<br><br>Do you wish to continue?", a.Username ), 0xFFC000, 420, 280, new WarningGumpCallback( AccountDelete_Callback ), m_State ) );
from.SendGump( new WarningGump( 1060635, 30720,
$"<center>Account of {a.Username}</center><br>You are about to <em><basefont color=red>permanently delete</basefont></em> the account. Likewise, all characters on the account will be deleted, including equipped, inventory, and banked items. Any houses tied to the account will be demolished.<br><br>Do you wish to continue?", 0xFFC000, 420, 280, new WarningGumpCallback( AccountDelete_Callback ), m_State ) );
break;
}
case 26: // View all shared accounts
@ -2303,7 +2309,8 @@ namespace Server.Gumps
break;
if ( rads.Count > 0 )
from.SendGump( new WarningGump( 1060635, 30720, String.Format( "You are about to ban {0} marked account{1}. Be cautioned, the only way to reverse this is by hand--manually unbanning each account.<br><br>Do you wish to continue?", rads.Count, rads.Count == 1 ? "" : "s" ), 0xFFC000, 420, 280, new WarningGumpCallback( Marked_Callback ), new object[]{ true, list, rads, m_ListPage } ) );
from.SendGump( new WarningGump( 1060635, 30720,
$"You are about to ban {rads.Count} marked account{(rads.Count == 1 ? "" : "s")}. Be cautioned, the only way to reverse this is by hand--manually unbanning each account.<br><br>Do you wish to continue?", 0xFFC000, 420, 280, new WarningGumpCallback( Marked_Callback ), new object[]{ true, list, rads, m_ListPage } ) );
else
from.SendGump( new NoticeGump( 1060637, 30720, "You have not yet marked any accounts. Place a check mark next to the accounts you wish to ban and then try again.", 0xFFC000, 420, 280, new NoticeGumpCallback( ResendGump_Callback ), new object[]{ list, rads, m_ListPage } ) );
@ -2433,7 +2440,8 @@ namespace Server.Gumps
if ( ips.Length == 0 )
from.SendGump( new AdminGump( from, AdminGumpPage.AccountDetails_Access_ClientIPs, 0, null, "This account has not yet been accessed.", m_State ) );
else
from.SendGump( new WarningGump( 1060635, 30720, String.Format( "You are about to clear the address list for account {0} containing {1} {2}. Do you wish to continue?", a, ips.Length, ( ips.Length == 1 ) ? "entry" : "entries" ), 0xFFC000, 420, 280, new WarningGumpCallback( RemoveLoginIPs_Callback ), a ) );
from.SendGump( new WarningGump( 1060635, 30720,
$"You are about to clear the address list for account {a} containing {ips.Length} {((ips.Length == 1) ? "entry" : "entries")}. Do you wish to continue?", 0xFFC000, 420, 280, new WarningGumpCallback( RemoveLoginIPs_Callback ), a ) );
break;
}
@ -2497,7 +2505,8 @@ namespace Server.Gumps
if ( results.Count == 1 )
from.SendGump( new AdminGump( from, AdminGumpPage.FirewallInfo, 0, null, "One match found.", results[0] ) );
else if ( results.Count > 1 )
from.SendGump( new AdminGump( from, AdminGumpPage.Firewall, 0, results, String.Format( "Search results for : {0}", match ), m_State ) );
from.SendGump( new AdminGump( from, AdminGumpPage.Firewall, 0, results,
$"Search results for : {match}", m_State ) );
else
from.SendGump( new AdminGump( from, m_PageType, m_ListPage, m_List, notice == null ? "Nothing matched your search terms." : notice, m_State ) );
@ -2523,7 +2532,8 @@ namespace Server.Gumps
CommandLogging.WriteLine( from, "{0} {1} firewalling {2}", from.AccessLevel, CommandLogging.Format( from ), toAdd );
Firewall.Add( toAdd );
from.SendGump( new AdminGump( from, AdminGumpPage.FirewallInfo, 0, null, String.Format( "{0} : Added to firewall.", toAdd ), toAdd ) );
from.SendGump( new AdminGump( from, AdminGumpPage.FirewallInfo, 0, null,
$"{toAdd} : Added to firewall.", toAdd ) );
}
break;
@ -2541,7 +2551,8 @@ namespace Server.Gumps
CommandLogging.WriteLine( from, "{0} {1} removing {2} from firewall list", from.AccessLevel, CommandLogging.Format( from ), m_State );
Firewall.Remove( m_State );
from.SendGump( new AdminGump( from, AdminGumpPage.Firewall, 0, null, String.Format( "{0} : Removed from firewall.", m_State ), null ) );
from.SendGump( new AdminGump( from, AdminGumpPage.Firewall, 0, null,
$"{m_State} : Removed from firewall.", null ) );
}
break;
@ -2724,7 +2735,8 @@ namespace Server.Gumps
if ( m_PageType == AdminGumpPage.AccountDetails_Access_ClientIPs )
{
from.SendGump( new WarningGump( 1060635, 30720, String.Format( "You are about to firewall {0}. All connection attempts from a matching IP will be refused. Are you sure?", m_List[index] ), 0xFFC000, 420, 280, new WarningGumpCallback( Firewall_Callback ), new[]{ a, m_List[index] } ) );
from.SendGump( new WarningGump( 1060635, 30720,
$"You are about to firewall {m_List[index]}. All connection attempts from a matching IP will be refused. Are you sure?", 0xFFC000, 420, 280, new WarningGumpCallback( Firewall_Callback ), new[]{ a, m_List[index] } ) );
}
else if ( m_PageType == AdminGumpPage.AccountDetails_Access_Restrictions )
{
@ -2734,7 +2746,8 @@ namespace Server.Gumps
a.IPRestrictions = (string[])list.ToArray( typeof( string ) );
from.SendGump( new AdminGump( from, AdminGumpPage.AccountDetails_Access_Restrictions, 0, null, String.Format( "{0} : Removed from list.", m_List[index] ), a ) );
from.SendGump( new AdminGump( from, AdminGumpPage.AccountDetails_Access_Restrictions, 0, null,
$"{m_List[index]} : Removed from list.", a ) );
}
}
@ -2783,7 +2796,8 @@ namespace Server.Gumps
if ( a == null )
break;
from.SendGump( new WarningGump( 1060635, 30720, String.Format( "You are about to remove address {0} from account {1}. Do you wish to continue?", ip, a ), 0xFFC000, 420, 280, new WarningGumpCallback( RemoveLoginIP_Callback ), new object[] { a, ip } ) );
from.SendGump( new WarningGump( 1060635, 30720,
$"You are about to remove address {ip} from account {a}. Do you wish to continue?", 0xFFC000, 420, 280, new WarningGumpCallback( RemoveLoginIP_Callback ), new object[] { a, ip } ) );
}
}
@ -2804,7 +2818,7 @@ namespace Server.Gumps
private void InvokeCommand( string c )
{
CommandSystem.Handle( m_From, String.Format( "{0}{1}", CommandSystem.Prefix, c ) );
CommandSystem.Handle( m_From, $"{CommandSystem.Prefix}{c}");
}
public static void GetAccountInfo( Account a, out AccessLevel accessLevel, out bool online )

View file

@ -234,7 +234,8 @@ namespace Server.Gumps
a.SetBanTags( from, DateTime.UtcNow, duration );
if ( comment != null )
a.Comments.Add( new AccountComment( from.RawName, String.Format( "Duration: {0}, Comment: {1}", (( duration == TimeSpan.MaxValue )? "Infinite" : duration.ToString()), comment ) ) );
a.Comments.Add( new AccountComment( from.RawName,
$"Duration: {((duration == TimeSpan.MaxValue) ? "Infinite" : duration.ToString())}, Comment: {comment}") );
}
if ( duration == TimeSpan.MaxValue )

View file

@ -45,12 +45,12 @@ namespace Server.Gumps
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 int GetButtonID( int typeCount, int type, int index )

View file

@ -35,7 +35,7 @@ namespace Server.Gumps
}
else
{
CommandSystem.Handle( from, String.Format( "{0}Add {1}", CommandSystem.Prefix, m_Type.Name ) );
CommandSystem.Handle( from, $"{CommandSystem.Prefix}Add {m_Type.Name}");
from.SendGump( new CategorizedAddGump( from, m_Parent, page ) );
}
@ -268,7 +268,8 @@ namespace Server.Gumps
if ( !OldStyle )
AddImageTiled( x - (OldStyle ? OffsetSize : 0), y, emptyWidth + (OldStyle ? OffsetSize * 2 : 0), EntryHeight, EntryGumpID );
AddHtml( x + TextOffsetX, y + ((EntryHeight - 20) / 2), emptyWidth - TextOffsetX, EntryHeight, String.Format( "<center>{0}</center>", m_Category.Caption ), false, false );
AddHtml( x + TextOffsetX, y + ((EntryHeight - 20) / 2), emptyWidth - TextOffsetX, EntryHeight,
$"<center>{m_Category.Caption}</center>", false, false );
x += emptyWidth + OffsetSize;

View file

@ -178,12 +178,12 @@ namespace Server.Gumps
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 ClientGump( Mobile from, NetState state, string initialText ) : base( 30, 20 )
@ -232,10 +232,10 @@ namespace Server.Gumps
if ( m != null )
{
AddHtml( 14, 36 + (line * 20), 200, 20, Color( "Mobile:", LabelColor32 ), false, false );
AddHtml( 70, 36 + (line++ * 20), 200, 20, Color( String.Format( "{0} (0x{1:X})", m.Name, m.Serial.Value ), LabelColor32 ), false, false );
AddHtml( 70, 36 + (line++ * 20), 200, 20, Color($"{m.Name} (0x{m.Serial.Value:X})", LabelColor32 ), false, false );
AddHtml( 14, 36 + (line * 20), 200, 20, Color( "Location:", LabelColor32 ), false, false );
AddHtml( 70, 36 + (line++ * 20), 200, 20, Color( String.Format( "{0} [{1}]", m.Location, m.Map ), LabelColor32 ), false, false );
AddHtml( 70, 36 + (line++ * 20), 200, 20, Color($"{m.Location} [{m.Map}]", LabelColor32 ), false, false );
AddButton( 13, 157, 0xFAB, 0xFAD, 1, GumpButtonType.Reply, 0 );
AddHtml( 48, 158, 200, 20, Color( "Send Message", LabelColor32 ), false, false );

View file

@ -46,7 +46,7 @@ namespace Server.Gumps
AddImageTiled( 0, 0, 410, 448, 0xA40 );
AddAlphaRegion( 1, 1, 408, 446 );
string title = String.Format( "Comments for '{0}'", acct.Username );
string title = $"Comments for '{acct.Username}'";
int x = 205 - ((title.Length / 2) * 7);
if ( x < 120 )
x = 120;
@ -72,7 +72,8 @@ namespace Server.Gumps
AddLabel( 48, 12, 2100, "Prev Page" );
}
string html = String.Format( "[Added By: {0} on {1}]<br>{2}", comment.AddedBy, comment.LastModified.ToString( "H:mm M/d/yy" ), comment.Content );
string html =
$"[Added By: {comment.AddedBy} on {comment.LastModified.ToString("H:mm M/d/yy")}]<br>{comment.Content}";
AddHtml( 12, 44 + ((i % 5) * 80), 386, 70, html, true, true );
}
}

View file

@ -137,7 +137,7 @@ namespace Server.Gumps
if ( !OldStyle )
AddImageTiled( x - (OldStyle ? OffsetSize : 0), y, emptyWidth + (OldStyle ? OffsetSize * 2 : 0), EntryHeight, EntryGumpID );
AddHtml( x + TextOffsetX, y, emptyWidth - TextOffsetX, EntryHeight, String.Format( "<center>{0}</center>", node.Name ), false, false );
AddHtml( x + TextOffsetX, y, emptyWidth - TextOffsetX, EntryHeight, $"<center>{node.Name}</center>", false, false );
x += emptyWidth + OffsetSize;

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

View file

@ -55,7 +55,8 @@ namespace Server.Gumps
if ( m == null || (name = m.Name) == null || (name = name.Trim()).Length <= 0 )
continue;
AddLabel( 55, 55 + ((i % 16) * 20), 0, accountOf && m.Player && m.Account != null ? String.Format( "Account of {0}", name ) : name );
AddLabel( 55, 55 + ((i % 16) * 20), 0, accountOf && m.Player && m.Account != null ? $"Account of {name}"
: name );
}
}
}
@ -132,7 +133,8 @@ namespace Server.Gumps
continue;
AddCheck( 34, 52 + ((i % 15) * 20), 0xD2, 0xD3, false, i );
AddLabel( 55, 52 + ((i % 15) * 20), 0, accountOf && m.Player && m.Account != null ? String.Format( "Account of {0}", name ) : name );
AddLabel( 55, 52 + ((i % 15) * 20), 0, accountOf && m.Player && m.Account != null ? $"Account of {name}"
: name );
}
}
}

View file

@ -381,7 +381,7 @@ namespace Server.Gumps
if ( bonusStorage > 0 )
{
AddHtmlLocalized( 10, 150, 300, 20, 1072519, LabelColor, false, false ); // Increased Storage
AddLabel( 310, 150, LabelHue, String.Format( "{0}%", bonusStorage ) );
AddLabel( 310, 150, LabelHue, $"{bonusStorage}%");
}
AddHtmlLocalized( 10, 170, 300, 20, 1060683, LabelColor, false, false ); // Maximum Secure Storage

View file

@ -30,7 +30,7 @@ namespace Server.Gumps
if ( content is int i )
AddHtmlLocalized( 10, 40, width - 20, height - 80, i, contentColor, false, true );
else if ( content is string )
AddHtml( 10, 40, width - 20, height - 80, String.Format( "<BASEFONT COLOR=#{0:X6}>{1}</BASEFONT>", contentColor, content ), false, true );
AddHtml( 10, 40, width - 20, height - 80, $"<BASEFONT COLOR=#{contentColor:X6}>{content}</BASEFONT>", false, true );
AddImageTiled( 10, height - 30, width - 20, 20, 2624 );
AddAlphaRegion( 10, height - 30, width - 20, 20 );

View file

@ -33,7 +33,7 @@ namespace Server.Gumps
AddItem( 218, 95, 0xCB0 );
AddHtmlLocalized( 30, 30, 150, 75, 1049665, false, false ); // <div align=center>Wilt thou sanctify the resurrection of:</div>
AddHtml( 30, 70, 150, 25, String.Format( "<div align=CENTER>{0}</div>", pet.Name ), true, false );
AddHtml( 30, 70, 150, 25, $"<div align=CENTER>{pet.Name}</div>", true, false );
AddButton( 40, 105, 0x81A, 0x81B, 0x1, GumpButtonType.Reply, 0 ); // Okay
AddButton( 110, 105, 0x819, 0x818, 0x2, GumpButtonType.Reply, 0 ); // Cancel

View file

@ -209,7 +209,8 @@ namespace Server.Gumps
{
rentedVendor.ComputeRentalExpireDelay( out var days, out var hours );
AddLabel( 38, 132, 0x480, String.Format( "Location rental will expire in {0} day{1} and {2} hour{3}.", days, days != 1 ? "s" : "", hours, hours != 1 ? "s" : "" ) );
AddLabel( 38, 132, 0x480,
$"Location rental will expire in {days} day{(days != 1 ? "s" : "")} and {hours} hour{(hours != 1 ? "s" : "")}.");
}
AddButton( 390, 24, 0x15E1, 0x15E5, 1, GumpButtonType.Reply, 0 );

View file

@ -175,7 +175,8 @@ namespace Server.Gumps
AddImageTiled( x, y, emptyWidth, EntryHeight, HeaderGumpID );
if ( TypeLabel && m_Type != null )
AddHtml( x, y, emptyWidth, EntryHeight, String.Format( "<BASEFONT COLOR=#FAFAFA><CENTER>{0}</CENTER></BASEFONT>", m_Type.Name ), false, false );
AddHtml( x, y, emptyWidth, EntryHeight,
$"<BASEFONT COLOR=#FAFAFA><CENTER>{m_Type.Name}</CENTER></BASEFONT>", false, false );
x += emptyWidth + OffsetSize;
@ -445,7 +446,7 @@ namespace Server.Gumps
}
catch ( Exception e )
{
return String.Format( "!{0}!", e.GetType() );
return $"!{e.GetType()}!";
}
}
@ -457,7 +458,7 @@ namespace Server.Gumps
}
if ( o is string s )
{
return String.Format( "\"{0}\"", s );
return $"\"{s}\"";
}
if ( o is bool )
{
@ -465,7 +466,7 @@ namespace Server.Gumps
}
if ( o is char c )
{
return String.Format( "0x{0:X} '{1}'", (int)c, c );
return $"0x{(int) c:X} '{c}'";
}
if ( o is Serial serial )
{
@ -473,15 +474,15 @@ namespace Server.Gumps
{
if ( serial.IsItem )
{
return String.Format( "(I) 0x{0:X}", serial.Value );
return $"(I) 0x{serial.Value:X}";
}
if ( serial.IsMobile )
{
return String.Format( "(M) 0x{0:X}", serial.Value );
return $"(M) 0x{serial.Value:X}";
}
}
return String.Format( "(?) 0x{0:X}", serial.Value );
return $"(?) 0x{serial.Value:X}";
}
if ( o is byte || o is sbyte || o is short || o is ushort || o is int || o is uint || o is long || o is ulong )
{
@ -489,11 +490,11 @@ namespace Server.Gumps
}
if ( o is Mobile mobile )
{
return String.Format( "(M) 0x{0:X} \"{1}\"", mobile.Serial.Value, mobile.Name );
return $"(M) 0x{mobile.Serial.Value:X} \"{mobile.Name}\"";
}
if ( o is Item item )
{
return String.Format( "(I) 0x{0:X}", item.Serial.Value );
return $"(I) 0x{item.Serial.Value:X}";
}
if ( o is Type type )
{
@ -641,7 +642,7 @@ namespace Server.Gumps
}
if ( o is string s )
{
return String.Format( "\"{0}\"", s );
return $"\"{s}\"";
}
if ( o is bool )
{
@ -649,7 +650,7 @@ namespace Server.Gumps
}
if ( o is char c )
{
return String.Format( "0x{0:X} '{1}'", (int)c, c );
return $"0x{(int) c:X} '{c}'";
}
if ( o is Serial serial )
{
@ -657,15 +658,15 @@ namespace Server.Gumps
{
if ( serial.IsItem )
{
return String.Format( "(I) 0x{0:X}", serial.Value );
return $"(I) 0x{serial.Value:X}";
}
if ( serial.IsMobile )
{
return String.Format( "(M) 0x{0:X}", serial.Value );
return $"(M) 0x{serial.Value:X}";
}
}
return String.Format( "(?) 0x{0:X}", serial.Value );
return $"(?) 0x{serial.Value:X}";
}
if ( o is byte || o is sbyte || o is short || o is ushort || o is int || o is uint || o is long || o is ulong )
{
@ -673,11 +674,11 @@ namespace Server.Gumps
}
if ( o is Mobile mobile )
{
return String.Format( "(M) 0x{0:X} \"{1}\"", mobile.Serial.Value, mobile.Name );
return $"(M) 0x{mobile.Serial.Value:X} \"{mobile.Name}\"";
}
if ( o is Item item )
{
return String.Format( "(I) 0x{0:X}", item.Serial.Value );
return $"(I) 0x{item.Serial.Value:X}";
}
if ( o is Type type )
{

View file

@ -30,12 +30,12 @@ namespace Server.Gumps
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 AddTypeButton( int x, int y, int buttonID, string text, ModelBodyType type )

View file

@ -138,8 +138,8 @@ namespace Server.Gumps
if ( Sextant.Format( e.Location, e.Map, ref xLong, ref yLat, ref xMins, ref yMins, ref xEast, ref ySouth ) )
{
AddLabel( 135 + (half * 160), 80, 0, String.Format( "{0}<7D> {1}'{2}", yLat, yMins, ySouth ? "S" : "N" ) );
AddLabel( 135 + (half * 160), 95, 0, String.Format( "{0}<7D> {1}'{2}", xLong, xMins, xEast ? "E" : "W" ) );
AddLabel( 135 + (half * 160), 80, 0, $"{yLat}<7D> {yMins}'{(ySouth ? "S" : "N")}");
AddLabel( 135 + (half * 160), 95, 0, $"{xLong}<7D> {xMins}'{(xEast ? "E" : "W")}");
}
// Drop rune button
@ -309,7 +309,8 @@ namespace Server.Gumps
if ( Sextant.Format( e.Location, e.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.SendMessage( location );
}
@ -364,7 +365,8 @@ namespace Server.Gumps
if ( Sextant.Format( e.Location, e.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.SendMessage( location );
}
@ -390,7 +392,8 @@ namespace Server.Gumps
if ( Sextant.Format( e.Location, e.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.SendMessage( location );
}
@ -418,7 +421,8 @@ namespace Server.Gumps
if ( Sextant.Format( e.Location, e.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.SendMessage( location );
}

View file

@ -68,7 +68,7 @@ namespace Server.Gumps
if ( text != null )
{
m_Skill.Base = Convert.ToDouble( text.Text );
CommandLogging.LogChangeProperty( m_From, m_Target, String.Format( "{0}.Base", m_Skill ), m_Skill.Base.ToString() );
CommandLogging.LogChangeProperty( m_From, m_Target, $"{m_Skill}.Base", m_Skill.Base.ToString() );
}
}
else

View file

@ -33,7 +33,7 @@ namespace Server.Gumps
if ( inventory.Owner == from )
AddButton( 10, y, 0xFA5, 0xFA7, i + 1, GumpButtonType.Reply, 0 );
AddLabel( 45, y, 0x481, String.Format( "{0} ({1})", inventory.ShopName, inventory.VendorName ) );
AddLabel( 45, y, 0x481, $"{inventory.ShopName} ({inventory.VendorName})");
TimeSpan expire = inventory.ExpireTime - DateTime.UtcNow;
int hours = (int) expire.TotalHours;

View file

@ -108,7 +108,7 @@ namespace Server.Gumps
object name = FindHouseName( list[i] );
AddHtml( 15, 40 + ((i % 15) * 20), 20, 20, Color( String.Format( "{0}.", i+1 ), White ), false, false );
AddHtml( 15, 40 + ((i % 15) * 20), 20, 20, Color($"{i + 1}.", White ), false, false );
if ( name is int nameInt )
AddHtmlLocalized( 35, 40 + ((i % 15) * 20), 160, 20, nameInt, White16, false, false );
@ -132,7 +132,7 @@ namespace Server.Gumps
bool valid = Sextant.Format( sel.Location, map, ref xLong, ref yLat, ref xMins, ref yMins, ref xEast, ref ySouth );
if ( valid )
location = String.Format( "{0}° {1}'{2}, {3}° {4}'{5}", yLat, yMins, ySouth ? "S" : "N", xLong, xMins, xEast ? "E" : "W" );
location = $"{yLat}° {yMins}'{(ySouth ? "S" : "N")}, {xLong}° {xMins}'{(xEast ? "E" : "W")}";
else
location = "unknown";
@ -277,17 +277,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 void AddBlackAlpha( int x, int y, int width, int height )

Some files were not shown because too many files have changed in this diff Show more