fix(core): Updates slice with range selectors (#583)
- [X] Replaces Span slicing with range selection - [X] Replaces string slicing with range selection
This commit is contained in:
parent
9f9d990f85
commit
a0893b68c0
62 changed files with 363 additions and 382 deletions
|
|
@ -34,11 +34,11 @@ namespace Server.Accounting.Security
|
|||
{
|
||||
Span<byte> output = stackalloc byte[m_OutputSize];
|
||||
var iterations = Utility.RandomMinMax(m_MinIterations, m_MaxIterations);
|
||||
BinaryPrimitives.WriteUInt16LittleEndian(output.SliceToLength(2), (ushort)iterations);
|
||||
BinaryPrimitives.WriteUInt16LittleEndian(output[..2], (ushort)iterations);
|
||||
|
||||
var rfc2898 = new Rfc2898DeriveBytes(plainPassword, m_SaltSize, iterations, HashAlgorithmName.SHA256);
|
||||
rfc2898.Salt.CopyTo(output.Slice(2, m_SaltSize));
|
||||
rfc2898.GetBytes(m_HashSize).CopyTo(output.Slice(m_SaltSize + 2));
|
||||
rfc2898.GetBytes(m_HashSize).CopyTo(output[(m_SaltSize + 2)..]);
|
||||
|
||||
return output.ToHexString();
|
||||
}
|
||||
|
|
@ -48,13 +48,13 @@ namespace Server.Accounting.Security
|
|||
Span<byte> encryptedBytes = stackalloc byte[m_OutputSize];
|
||||
encryptedPassword.GetBytes(encryptedBytes);
|
||||
|
||||
var iterations = BinaryPrimitives.ReadUInt16LittleEndian(encryptedBytes.SliceToLength(2));
|
||||
var iterations = BinaryPrimitives.ReadUInt16LittleEndian(encryptedBytes[..2]);
|
||||
var salt = encryptedBytes.Slice(2, m_SaltSize);
|
||||
|
||||
ReadOnlySpan<byte> hash =
|
||||
new Rfc2898DeriveBytes(plainPassword, salt.ToArray(), iterations, HashAlgorithmName.SHA256).GetBytes(m_HashSize);
|
||||
|
||||
return hash.SequenceEqual(encryptedBytes.Slice(m_SaltSize + 2));
|
||||
return hash.SequenceEqual(encryptedBytes[(m_SaltSize + 2)..]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -212,9 +212,9 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
argString = Command.Substring(indexOf + 1);
|
||||
argString = Command[(indexOf + 1)..];
|
||||
|
||||
command = Command.Substring(0, indexOf);
|
||||
command = Command[..indexOf];
|
||||
args = CommandSystem.Split(argString);
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ namespace Server.Commands.Generic
|
|||
if (toParse.InsensitiveStartsWith("0x"))
|
||||
{
|
||||
style = NumberStyles.HexNumber;
|
||||
toParse = toParse.Substring(2);
|
||||
toParse = toParse[2..];
|
||||
}
|
||||
|
||||
parseMethod = parseNumber;
|
||||
|
|
|
|||
|
|
@ -289,15 +289,15 @@ namespace Server.Commands
|
|||
{
|
||||
if (IsSignedNumeric(type))
|
||||
{
|
||||
obj = Convert.ToInt64(value.Substring(2), 16);
|
||||
obj = Convert.ToInt64(value[2..], 16);
|
||||
}
|
||||
else if (IsUnsignedNumeric(type))
|
||||
{
|
||||
obj = Convert.ToUInt64(value.Substring(2), 16);
|
||||
obj = Convert.ToUInt64(value[2..], 16);
|
||||
}
|
||||
else
|
||||
{
|
||||
obj = Convert.ToInt32(value.Substring(2), 16);
|
||||
obj = Convert.ToInt32(value[2..], 16);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
labelNumber = Utility.ToInt32(m_Params[i].Substring(++indexOf));
|
||||
labelNumber = Utility.ToInt32(m_Params[i].AsSpan()[++indexOf..]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -131,7 +131,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
labelNumber = Utility.ToInt32(m_Params[i].Substring(++indexOf));
|
||||
labelNumber = Utility.ToInt32(m_Params[i].AsSpan()[++indexOf..]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -179,7 +179,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
map = Map.Parse(m_Params[i].Substring(++indexOf));
|
||||
map = Map.Parse(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -208,7 +208,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
range = Utility.ToInt32(m_Params[i].Substring(++indexOf));
|
||||
range = Utility.ToInt32(m_Params[i].AsSpan()[++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("WarningString"))
|
||||
|
|
@ -217,7 +217,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
messageString = m_Params[i].Substring(++indexOf);
|
||||
messageString = m_Params[i][++indexOf..];
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("WarningNumber"))
|
||||
|
|
@ -226,7 +226,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
messageNumber = Utility.ToInt32(m_Params[i].Substring(++indexOf));
|
||||
messageNumber = Utility.ToInt32(m_Params[i].AsSpan()[++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("HintString"))
|
||||
|
|
@ -235,7 +235,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
hintString = m_Params[i].Substring(++indexOf);
|
||||
hintString = m_Params[i][++indexOf..];
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("HintNumber"))
|
||||
|
|
@ -244,7 +244,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
hintNumber = Utility.ToInt32(m_Params[i].Substring(++indexOf));
|
||||
hintNumber = Utility.ToInt32(m_Params[i].AsSpan()[++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("ResetDelay"))
|
||||
|
|
@ -253,7 +253,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
resetDelay = TimeSpan.Parse(m_Params[i].Substring(++indexOf));
|
||||
resetDelay = TimeSpan.Parse(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -281,7 +281,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
range = Utility.ToInt32(m_Params[i].Substring(++indexOf));
|
||||
range = Utility.ToInt32(m_Params[i].AsSpan()[++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("WarningString"))
|
||||
|
|
@ -290,7 +290,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
messageString = m_Params[i].Substring(++indexOf);
|
||||
messageString = m_Params[i][++indexOf..];
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("WarningNumber"))
|
||||
|
|
@ -299,7 +299,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
messageNumber = Utility.ToInt32(m_Params[i].Substring(++indexOf));
|
||||
messageNumber = Utility.ToInt32(m_Params[i].AsSpan()[++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("ResetDelay"))
|
||||
|
|
@ -308,7 +308,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
resetDelay = TimeSpan.Parse(m_Params[i].Substring(++indexOf));
|
||||
resetDelay = TimeSpan.Parse(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -334,7 +334,7 @@ namespace Server.Commands
|
|||
{
|
||||
direction = (CannonDirection)Enum.Parse(
|
||||
typeof(CannonDirection),
|
||||
m_Params[i].Substring(++indexOf),
|
||||
m_Params[i][++indexOf..],
|
||||
true
|
||||
);
|
||||
}
|
||||
|
|
@ -356,7 +356,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
word = m_Params[i].Substring(++indexOf);
|
||||
word = m_Params[i][++indexOf..];
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("DestStart"))
|
||||
|
|
@ -365,7 +365,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
destination.Start = Point2D.Parse(m_Params[i].Substring(++indexOf));
|
||||
destination.Start = Point2D.Parse(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("DestEnd"))
|
||||
|
|
@ -374,7 +374,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
destination.End = Point2D.Parse(m_Params[i].Substring(++indexOf));
|
||||
destination.End = Point2D.Parse(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -396,7 +396,7 @@ namespace Server.Commands
|
|||
{
|
||||
content = (BeverageType)Enum.Parse(
|
||||
typeof(BeverageType),
|
||||
m_Params[i].Substring(++indexOf),
|
||||
m_Params[i][++indexOf..],
|
||||
true
|
||||
);
|
||||
fill = true;
|
||||
|
|
@ -425,7 +425,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
facing = (DoorFacing)Enum.Parse(typeof(DoorFacing), m_Params[i].Substring(++indexOf), true);
|
||||
facing = (DoorFacing)Enum.Parse(typeof(DoorFacing), m_Params[i][++indexOf..], true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -455,7 +455,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
coffin.SpawnLocation = Point3D.Parse(m_Params[i].Substring(++indexOf));
|
||||
coffin.SpawnLocation = Point3D.Parse(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -523,7 +523,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
sp.AddEntry(m_Params[i].Substring(++indexOf));
|
||||
sp.AddEntry(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("MinDelay"))
|
||||
|
|
@ -532,7 +532,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
sp.MinDelay = TimeSpan.Parse(m_Params[i].Substring(++indexOf));
|
||||
sp.MinDelay = TimeSpan.Parse(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("MaxDelay"))
|
||||
|
|
@ -541,7 +541,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
sp.MaxDelay = TimeSpan.Parse(m_Params[i].Substring(++indexOf));
|
||||
sp.MaxDelay = TimeSpan.Parse(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("NextSpawn"))
|
||||
|
|
@ -550,7 +550,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
sp.NextSpawn = TimeSpan.Parse(m_Params[i].Substring(++indexOf));
|
||||
sp.NextSpawn = TimeSpan.Parse(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("Count"))
|
||||
|
|
@ -559,7 +559,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
sp.Count = Utility.ToInt32(m_Params[i].Substring(++indexOf));
|
||||
sp.Count = Utility.ToInt32(m_Params[i].AsSpan()[++indexOf..]);
|
||||
for (var se = 0; se < sp.Entries.Count; se++)
|
||||
{
|
||||
sp.Entries[se].SpawnedMaxCount = sp.Count;
|
||||
|
|
@ -572,7 +572,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
sp.Team = Utility.ToInt32(m_Params[i].Substring(++indexOf));
|
||||
sp.Team = Utility.ToInt32(m_Params[i].AsSpan()[++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("HomeRange"))
|
||||
|
|
@ -581,7 +581,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
sp.HomeRange = Utility.ToInt32(m_Params[i].Substring(++indexOf));
|
||||
sp.HomeRange = Utility.ToInt32(m_Params[i].AsSpan()[++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("Running"))
|
||||
|
|
@ -590,7 +590,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
sp.Running = Utility.ToBoolean(m_Params[i].Substring(++indexOf));
|
||||
sp.Running = Utility.ToBoolean(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("Group"))
|
||||
|
|
@ -599,7 +599,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
sp.Group = Utility.ToBoolean(m_Params[i].Substring(++indexOf));
|
||||
sp.Group = Utility.ToBoolean(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -614,7 +614,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
rune.Description = m_Params[i].Substring(++indexOf);
|
||||
rune.Description = m_Params[i][++indexOf..];
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("Marked"))
|
||||
|
|
@ -623,7 +623,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
rune.Marked = Utility.ToBoolean(m_Params[i].Substring(++indexOf));
|
||||
rune.Marked = Utility.ToBoolean(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("TargetMap"))
|
||||
|
|
@ -632,7 +632,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
rune.TargetMap = Map.Parse(m_Params[i].Substring(++indexOf));
|
||||
rune.TargetMap = Map.Parse(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("Target"))
|
||||
|
|
@ -641,7 +641,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
rune.Target = Point3D.Parse(m_Params[i].Substring(++indexOf));
|
||||
rune.Target = Point3D.Parse(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -656,7 +656,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
st.Skill = (SkillName)Enum.Parse(typeof(SkillName), m_Params[i].Substring(++indexOf), true);
|
||||
st.Skill = (SkillName)Enum.Parse(typeof(SkillName), m_Params[i][++indexOf..], true);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("RequiredFixedPoint"))
|
||||
|
|
@ -665,7 +665,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
st.Required = Utility.ToInt32(m_Params[i].Substring(++indexOf)) * 0.1;
|
||||
st.Required = Utility.ToInt32(m_Params[i].AsSpan()[++indexOf..]) * 0.1;
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("Required"))
|
||||
|
|
@ -674,7 +674,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
st.Required = Utility.ToDouble(m_Params[i].Substring(++indexOf));
|
||||
st.Required = Utility.ToDouble(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("MessageString"))
|
||||
|
|
@ -683,7 +683,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
st.MessageString = m_Params[i].Substring(++indexOf);
|
||||
st.MessageString = m_Params[i][++indexOf..];
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("MessageNumber"))
|
||||
|
|
@ -692,7 +692,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
st.MessageNumber = Utility.ToInt32(m_Params[i].Substring(++indexOf));
|
||||
st.MessageNumber = Utility.ToInt32(m_Params[i].AsSpan()[++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("PointDest"))
|
||||
|
|
@ -701,7 +701,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
st.PointDest = Point3D.Parse(m_Params[i].Substring(++indexOf));
|
||||
st.PointDest = Point3D.Parse(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("MapDest"))
|
||||
|
|
@ -710,7 +710,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
st.MapDest = Map.Parse(m_Params[i].Substring(++indexOf));
|
||||
st.MapDest = Map.Parse(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("Creatures"))
|
||||
|
|
@ -719,7 +719,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
st.Creatures = Utility.ToBoolean(m_Params[i].Substring(++indexOf));
|
||||
st.Creatures = Utility.ToBoolean(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("SourceEffect"))
|
||||
|
|
@ -728,7 +728,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
st.SourceEffect = Utility.ToBoolean(m_Params[i].Substring(++indexOf));
|
||||
st.SourceEffect = Utility.ToBoolean(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("DestEffect"))
|
||||
|
|
@ -737,7 +737,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
st.DestEffect = Utility.ToBoolean(m_Params[i].Substring(++indexOf));
|
||||
st.DestEffect = Utility.ToBoolean(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("SoundID"))
|
||||
|
|
@ -746,7 +746,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
st.SoundID = Utility.ToInt32(m_Params[i].Substring(++indexOf));
|
||||
st.SoundID = Utility.ToInt32(m_Params[i].AsSpan()[++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("Delay"))
|
||||
|
|
@ -755,7 +755,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
st.Delay = TimeSpan.Parse(m_Params[i].Substring(++indexOf));
|
||||
st.Delay = TimeSpan.Parse(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -775,7 +775,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
kt.Substring = m_Params[i].Substring(++indexOf);
|
||||
kt.Substring = m_Params[i][++indexOf..];
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("Keyword"))
|
||||
|
|
@ -784,7 +784,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
kt.Keyword = Utility.ToInt32(m_Params[i].Substring(++indexOf));
|
||||
kt.Keyword = Utility.ToInt32(m_Params[i].AsSpan()[++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("Range"))
|
||||
|
|
@ -793,7 +793,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
kt.Range = Utility.ToInt32(m_Params[i].Substring(++indexOf));
|
||||
kt.Range = Utility.ToInt32(m_Params[i].AsSpan()[++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("PointDest"))
|
||||
|
|
@ -802,7 +802,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
kt.PointDest = Point3D.Parse(m_Params[i].Substring(++indexOf));
|
||||
kt.PointDest = Point3D.Parse(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("MapDest"))
|
||||
|
|
@ -811,7 +811,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
kt.MapDest = Map.Parse(m_Params[i].Substring(++indexOf));
|
||||
kt.MapDest = Map.Parse(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("Creatures"))
|
||||
|
|
@ -820,7 +820,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
kt.Creatures = Utility.ToBoolean(m_Params[i].Substring(++indexOf));
|
||||
kt.Creatures = Utility.ToBoolean(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("SourceEffect"))
|
||||
|
|
@ -829,7 +829,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
kt.SourceEffect = Utility.ToBoolean(m_Params[i].Substring(++indexOf));
|
||||
kt.SourceEffect = Utility.ToBoolean(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("DestEffect"))
|
||||
|
|
@ -838,7 +838,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
kt.DestEffect = Utility.ToBoolean(m_Params[i].Substring(++indexOf));
|
||||
kt.DestEffect = Utility.ToBoolean(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("SoundID"))
|
||||
|
|
@ -847,7 +847,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
kt.SoundID = Utility.ToInt32(m_Params[i].Substring(++indexOf));
|
||||
kt.SoundID = Utility.ToInt32(m_Params[i].AsSpan()[++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("Delay"))
|
||||
|
|
@ -856,7 +856,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
kt.Delay = TimeSpan.Parse(m_Params[i].Substring(++indexOf));
|
||||
kt.Delay = TimeSpan.Parse(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -876,7 +876,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
tp.PointDest = Point3D.Parse(m_Params[i].Substring(++indexOf));
|
||||
tp.PointDest = Point3D.Parse(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("MapDest"))
|
||||
|
|
@ -885,7 +885,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
tp.MapDest = Map.Parse(m_Params[i].Substring(++indexOf));
|
||||
tp.MapDest = Map.Parse(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("Creatures"))
|
||||
|
|
@ -894,7 +894,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
tp.Creatures = Utility.ToBoolean(m_Params[i].Substring(++indexOf));
|
||||
tp.Creatures = Utility.ToBoolean(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("SourceEffect"))
|
||||
|
|
@ -903,7 +903,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
tp.SourceEffect = Utility.ToBoolean(m_Params[i].Substring(++indexOf));
|
||||
tp.SourceEffect = Utility.ToBoolean(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("DestEffect"))
|
||||
|
|
@ -912,7 +912,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
tp.DestEffect = Utility.ToBoolean(m_Params[i].Substring(++indexOf));
|
||||
tp.DestEffect = Utility.ToBoolean(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("SoundID"))
|
||||
|
|
@ -921,7 +921,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
tp.SoundID = Utility.ToInt32(m_Params[i].Substring(++indexOf));
|
||||
tp.SoundID = Utility.ToInt32(m_Params[i].AsSpan()[++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("Delay"))
|
||||
|
|
@ -930,7 +930,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
tp.Delay = TimeSpan.Parse(m_Params[i].Substring(++indexOf));
|
||||
tp.Delay = TimeSpan.Parse(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -952,7 +952,7 @@ namespace Server.Commands
|
|||
{
|
||||
cont.ContentType = (FillableContentType)Enum.Parse(
|
||||
typeof(FillableContentType),
|
||||
m_Params[i].Substring(++indexOf),
|
||||
m_Params[i][++indexOf..],
|
||||
true
|
||||
);
|
||||
}
|
||||
|
|
@ -979,7 +979,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
item.Light = (LightType)Enum.Parse(typeof(LightType), m_Params[i].Substring(++indexOf), true);
|
||||
item.Light = (LightType)Enum.Parse(typeof(LightType), m_Params[i][++indexOf..], true);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("Hue"))
|
||||
|
|
@ -988,7 +988,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
var hue = Utility.ToInt32(m_Params[i].Substring(++indexOf));
|
||||
var hue = Utility.ToInt32(m_Params[i].AsSpan()[++indexOf..]);
|
||||
|
||||
if (item is DyeTub tub)
|
||||
{
|
||||
|
|
@ -1006,7 +1006,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
item.Name = m_Params[i].Substring(++indexOf);
|
||||
item.Name = m_Params[i][++indexOf..];
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("Amount"))
|
||||
|
|
@ -1020,7 +1020,7 @@ namespace Server.Commands
|
|||
var wasStackable = item.Stackable;
|
||||
|
||||
item.Stackable = true;
|
||||
item.Amount = Utility.ToInt32(m_Params[i].Substring(++indexOf));
|
||||
item.Amount = Utility.ToInt32(m_Params[i].AsSpan()[++indexOf..]);
|
||||
item.Stackable = wasStackable;
|
||||
}
|
||||
}
|
||||
|
|
@ -1268,25 +1268,20 @@ namespace Server.Commands
|
|||
|
||||
var indexOf = line.IndexOfOrdinal(' ');
|
||||
|
||||
list.m_Type = AssemblyHandler.FindTypeByName(line.Substring(0, indexOf++));
|
||||
list.m_Type = AssemblyHandler.FindTypeByName(line[..indexOf++]);
|
||||
|
||||
if (list.m_Type == null)
|
||||
{
|
||||
throw new ArgumentException($"Type not found for header: '{line}'");
|
||||
}
|
||||
|
||||
line = line.Substring(indexOf);
|
||||
line = line[indexOf..];
|
||||
indexOf = line.IndexOfOrdinal('(');
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
list.m_ItemID = Utility.ToInt32(line.Substring(0, indexOf - 1));
|
||||
list.m_ItemID = Utility.ToInt32(line.AsSpan()[..(indexOf - 1)]);
|
||||
|
||||
var parms = line.Substring(++indexOf);
|
||||
|
||||
if (line.EndsWithOrdinal(")"))
|
||||
{
|
||||
parms = parms.Substring(0, parms.Length - 1);
|
||||
}
|
||||
var parms = line[++indexOf..^(line.EndsWithOrdinal(")") ? 1 : 0)];
|
||||
|
||||
list.m_Params = parms.Split(';');
|
||||
|
||||
|
|
@ -1346,8 +1341,8 @@ namespace Server.Commands
|
|||
|
||||
if (space >= 0)
|
||||
{
|
||||
v = line.Substring(0, space++);
|
||||
line = line.Substring(space);
|
||||
v = line[..space++];
|
||||
line = line[space..];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
labelNumber = Utility.ToInt32(m_Params[i].Substring(++indexOf));
|
||||
labelNumber = Utility.ToInt32(m_Params[i].AsSpan()[++indexOf..]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -128,7 +128,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
labelNumber = Utility.ToInt32(m_Params[i].Substring(++indexOf));
|
||||
labelNumber = Utility.ToInt32(m_Params[i].AsSpan()[++indexOf..]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -176,7 +176,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
map = Map.Parse(m_Params[i].Substring(++indexOf));
|
||||
map = Map.Parse(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -205,7 +205,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
range = Utility.ToInt32(m_Params[i].Substring(++indexOf));
|
||||
range = Utility.ToInt32(m_Params[i].AsSpan()[++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("WarningString"))
|
||||
|
|
@ -214,7 +214,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
messageString = m_Params[i].Substring(++indexOf);
|
||||
messageString = m_Params[i][++indexOf..];
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("WarningNumber"))
|
||||
|
|
@ -223,7 +223,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
messageNumber = Utility.ToInt32(m_Params[i].Substring(++indexOf));
|
||||
messageNumber = Utility.ToInt32(m_Params[i].AsSpan()[++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("HintString"))
|
||||
|
|
@ -232,7 +232,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
hintString = m_Params[i].Substring(++indexOf);
|
||||
hintString = m_Params[i][++indexOf..];
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("HintNumber"))
|
||||
|
|
@ -241,7 +241,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
hintNumber = Utility.ToInt32(m_Params[i].Substring(++indexOf));
|
||||
hintNumber = Utility.ToInt32(m_Params[i].AsSpan()[++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("ResetDelay"))
|
||||
|
|
@ -250,7 +250,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
resetDelay = TimeSpan.Parse(m_Params[i].Substring(++indexOf));
|
||||
resetDelay = TimeSpan.Parse(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -278,7 +278,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
range = Utility.ToInt32(m_Params[i].Substring(++indexOf));
|
||||
range = Utility.ToInt32(m_Params[i].AsSpan()[++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("WarningString"))
|
||||
|
|
@ -287,7 +287,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
messageString = m_Params[i].Substring(++indexOf);
|
||||
messageString = m_Params[i][++indexOf..];
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("WarningNumber"))
|
||||
|
|
@ -296,7 +296,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
messageNumber = Utility.ToInt32(m_Params[i].Substring(++indexOf));
|
||||
messageNumber = Utility.ToInt32(m_Params[i].AsSpan()[++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("ResetDelay"))
|
||||
|
|
@ -305,7 +305,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
resetDelay = TimeSpan.Parse(m_Params[i].Substring(++indexOf));
|
||||
resetDelay = TimeSpan.Parse(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -331,7 +331,7 @@ namespace Server.Commands
|
|||
{
|
||||
direction = (CannonDirection)Enum.Parse(
|
||||
typeof(CannonDirection),
|
||||
m_Params[i].Substring(++indexOf),
|
||||
m_Params[i][++indexOf..],
|
||||
true
|
||||
);
|
||||
}
|
||||
|
|
@ -353,7 +353,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
word = m_Params[i].Substring(++indexOf);
|
||||
word = m_Params[i][++indexOf..];
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("DestStart"))
|
||||
|
|
@ -362,7 +362,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
destination.Start = Point2D.Parse(m_Params[i].Substring(++indexOf));
|
||||
destination.Start = Point2D.Parse(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("DestEnd"))
|
||||
|
|
@ -371,7 +371,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
destination.End = Point2D.Parse(m_Params[i].Substring(++indexOf));
|
||||
destination.End = Point2D.Parse(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -393,7 +393,7 @@ namespace Server.Commands
|
|||
{
|
||||
content = (BeverageType)Enum.Parse(
|
||||
typeof(BeverageType),
|
||||
m_Params[i].Substring(++indexOf),
|
||||
m_Params[i][++indexOf..],
|
||||
true
|
||||
);
|
||||
fill = true;
|
||||
|
|
@ -422,7 +422,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
facing = (DoorFacing)Enum.Parse(typeof(DoorFacing), m_Params[i].Substring(++indexOf), true);
|
||||
facing = (DoorFacing)Enum.Parse(typeof(DoorFacing), m_Params[i][++indexOf..], true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -452,7 +452,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
coffin.SpawnLocation = Point3D.Parse(m_Params[i].Substring(++indexOf));
|
||||
coffin.SpawnLocation = Point3D.Parse(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -520,7 +520,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
sp.AddEntry(m_Params[i].Substring(++indexOf));
|
||||
sp.AddEntry(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("MinDelay"))
|
||||
|
|
@ -529,7 +529,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
sp.MinDelay = TimeSpan.Parse(m_Params[i].Substring(++indexOf));
|
||||
sp.MinDelay = TimeSpan.Parse(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("MaxDelay"))
|
||||
|
|
@ -538,7 +538,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
sp.MaxDelay = TimeSpan.Parse(m_Params[i].Substring(++indexOf));
|
||||
sp.MaxDelay = TimeSpan.Parse(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("NextSpawn"))
|
||||
|
|
@ -547,7 +547,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
sp.NextSpawn = TimeSpan.Parse(m_Params[i].Substring(++indexOf));
|
||||
sp.NextSpawn = TimeSpan.Parse(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("Count"))
|
||||
|
|
@ -556,7 +556,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
sp.Count = Utility.ToInt32(m_Params[i].Substring(++indexOf));
|
||||
sp.Count = Utility.ToInt32(m_Params[i].AsSpan()[++indexOf..]);
|
||||
for (var se = 0; se < sp.Entries.Count; se++)
|
||||
{
|
||||
sp.Entries[se].SpawnedMaxCount = sp.Count;
|
||||
|
|
@ -569,7 +569,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
sp.Team = Utility.ToInt32(m_Params[i].Substring(++indexOf));
|
||||
sp.Team = Utility.ToInt32(m_Params[i].AsSpan()[++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("HomeRange"))
|
||||
|
|
@ -578,7 +578,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
sp.HomeRange = Utility.ToInt32(m_Params[i].Substring(++indexOf));
|
||||
sp.HomeRange = Utility.ToInt32(m_Params[i].AsSpan()[++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("Running"))
|
||||
|
|
@ -587,7 +587,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
sp.Running = Utility.ToBoolean(m_Params[i].Substring(++indexOf));
|
||||
sp.Running = Utility.ToBoolean(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("Group"))
|
||||
|
|
@ -596,7 +596,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
sp.Group = Utility.ToBoolean(m_Params[i].Substring(++indexOf));
|
||||
sp.Group = Utility.ToBoolean(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -611,7 +611,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
rune.Description = m_Params[i].Substring(++indexOf);
|
||||
rune.Description = m_Params[i][++indexOf..];
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("Marked"))
|
||||
|
|
@ -620,7 +620,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
rune.Marked = Utility.ToBoolean(m_Params[i].Substring(++indexOf));
|
||||
rune.Marked = Utility.ToBoolean(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("TargetMap"))
|
||||
|
|
@ -629,7 +629,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
rune.TargetMap = Map.Parse(m_Params[i].Substring(++indexOf));
|
||||
rune.TargetMap = Map.Parse(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("Target"))
|
||||
|
|
@ -638,7 +638,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
rune.Target = Point3D.Parse(m_Params[i].Substring(++indexOf));
|
||||
rune.Target = Point3D.Parse(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -653,7 +653,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
st.Skill = (SkillName)Enum.Parse(typeof(SkillName), m_Params[i].Substring(++indexOf), true);
|
||||
st.Skill = (SkillName)Enum.Parse(typeof(SkillName), m_Params[i][++indexOf..], true);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("RequiredFixedPoint"))
|
||||
|
|
@ -662,7 +662,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
st.Required = Utility.ToInt32(m_Params[i].Substring(++indexOf)) * 0.1;
|
||||
st.Required = Utility.ToInt32(m_Params[i].AsSpan()[++indexOf..]) * 0.1;
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("Required"))
|
||||
|
|
@ -671,7 +671,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
st.Required = Utility.ToDouble(m_Params[i].Substring(++indexOf));
|
||||
st.Required = Utility.ToDouble(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("MessageString"))
|
||||
|
|
@ -680,7 +680,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
st.MessageString = m_Params[i].Substring(++indexOf);
|
||||
st.MessageString = m_Params[i][++indexOf..];
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("MessageNumber"))
|
||||
|
|
@ -689,7 +689,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
st.MessageNumber = Utility.ToInt32(m_Params[i].Substring(++indexOf));
|
||||
st.MessageNumber = Utility.ToInt32(m_Params[i].AsSpan()[++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("PointDest"))
|
||||
|
|
@ -698,7 +698,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
st.PointDest = Point3D.Parse(m_Params[i].Substring(++indexOf));
|
||||
st.PointDest = Point3D.Parse(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("MapDest"))
|
||||
|
|
@ -707,7 +707,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
st.MapDest = Map.Parse(m_Params[i].Substring(++indexOf));
|
||||
st.MapDest = Map.Parse(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("Creatures"))
|
||||
|
|
@ -716,7 +716,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
st.Creatures = Utility.ToBoolean(m_Params[i].Substring(++indexOf));
|
||||
st.Creatures = Utility.ToBoolean(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("SourceEffect"))
|
||||
|
|
@ -725,7 +725,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
st.SourceEffect = Utility.ToBoolean(m_Params[i].Substring(++indexOf));
|
||||
st.SourceEffect = Utility.ToBoolean(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("DestEffect"))
|
||||
|
|
@ -734,7 +734,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
st.DestEffect = Utility.ToBoolean(m_Params[i].Substring(++indexOf));
|
||||
st.DestEffect = Utility.ToBoolean(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("SoundID"))
|
||||
|
|
@ -743,7 +743,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
st.SoundID = Utility.ToInt32(m_Params[i].Substring(++indexOf));
|
||||
st.SoundID = Utility.ToInt32(m_Params[i].AsSpan()[++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("Delay"))
|
||||
|
|
@ -752,7 +752,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
st.Delay = TimeSpan.Parse(m_Params[i].Substring(++indexOf));
|
||||
st.Delay = TimeSpan.Parse(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -772,7 +772,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
kt.Substring = m_Params[i].Substring(++indexOf);
|
||||
kt.Substring = m_Params[i][++indexOf..];
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("Keyword"))
|
||||
|
|
@ -781,7 +781,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
kt.Keyword = Utility.ToInt32(m_Params[i].Substring(++indexOf));
|
||||
kt.Keyword = Utility.ToInt32(m_Params[i].AsSpan()[++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("Range"))
|
||||
|
|
@ -790,7 +790,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
kt.Range = Utility.ToInt32(m_Params[i].Substring(++indexOf));
|
||||
kt.Range = Utility.ToInt32(m_Params[i].AsSpan()[++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("PointDest"))
|
||||
|
|
@ -799,7 +799,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
kt.PointDest = Point3D.Parse(m_Params[i].Substring(++indexOf));
|
||||
kt.PointDest = Point3D.Parse(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("MapDest"))
|
||||
|
|
@ -808,7 +808,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
kt.MapDest = Map.Parse(m_Params[i].Substring(++indexOf));
|
||||
kt.MapDest = Map.Parse(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("Creatures"))
|
||||
|
|
@ -817,7 +817,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
kt.Creatures = Utility.ToBoolean(m_Params[i].Substring(++indexOf));
|
||||
kt.Creatures = Utility.ToBoolean(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("SourceEffect"))
|
||||
|
|
@ -826,7 +826,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
kt.SourceEffect = Utility.ToBoolean(m_Params[i].Substring(++indexOf));
|
||||
kt.SourceEffect = Utility.ToBoolean(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("DestEffect"))
|
||||
|
|
@ -835,7 +835,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
kt.DestEffect = Utility.ToBoolean(m_Params[i].Substring(++indexOf));
|
||||
kt.DestEffect = Utility.ToBoolean(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("SoundID"))
|
||||
|
|
@ -844,7 +844,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
kt.SoundID = Utility.ToInt32(m_Params[i].Substring(++indexOf));
|
||||
kt.SoundID = Utility.ToInt32(m_Params[i].AsSpan()[++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("Delay"))
|
||||
|
|
@ -853,7 +853,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
kt.Delay = TimeSpan.Parse(m_Params[i].Substring(++indexOf));
|
||||
kt.Delay = TimeSpan.Parse(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -873,7 +873,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
tp.PointDest = Point3D.Parse(m_Params[i].Substring(++indexOf));
|
||||
tp.PointDest = Point3D.Parse(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("MapDest"))
|
||||
|
|
@ -882,7 +882,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
tp.MapDest = Map.Parse(m_Params[i].Substring(++indexOf));
|
||||
tp.MapDest = Map.Parse(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("Creatures"))
|
||||
|
|
@ -891,7 +891,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
tp.Creatures = Utility.ToBoolean(m_Params[i].Substring(++indexOf));
|
||||
tp.Creatures = Utility.ToBoolean(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("SourceEffect"))
|
||||
|
|
@ -900,7 +900,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
tp.SourceEffect = Utility.ToBoolean(m_Params[i].Substring(++indexOf));
|
||||
tp.SourceEffect = Utility.ToBoolean(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("DestEffect"))
|
||||
|
|
@ -909,7 +909,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
tp.DestEffect = Utility.ToBoolean(m_Params[i].Substring(++indexOf));
|
||||
tp.DestEffect = Utility.ToBoolean(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("SoundID"))
|
||||
|
|
@ -918,7 +918,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
tp.SoundID = Utility.ToInt32(m_Params[i].Substring(++indexOf));
|
||||
tp.SoundID = Utility.ToInt32(m_Params[i].AsSpan()[++indexOf..]);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("Delay"))
|
||||
|
|
@ -927,7 +927,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
tp.Delay = TimeSpan.Parse(m_Params[i].Substring(++indexOf));
|
||||
tp.Delay = TimeSpan.Parse(m_Params[i][++indexOf..]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -949,7 +949,7 @@ namespace Server.Commands
|
|||
{
|
||||
cont.ContentType = (FillableContentType)Enum.Parse(
|
||||
typeof(FillableContentType),
|
||||
m_Params[i].Substring(++indexOf),
|
||||
m_Params[i][++indexOf..],
|
||||
true
|
||||
);
|
||||
}
|
||||
|
|
@ -976,7 +976,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
item.Light = (LightType)Enum.Parse(typeof(LightType), m_Params[i].Substring(++indexOf), true);
|
||||
item.Light = (LightType)Enum.Parse(typeof(LightType), m_Params[i][++indexOf..], true);
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("Hue"))
|
||||
|
|
@ -985,7 +985,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
var hue = Utility.ToInt32(m_Params[i].Substring(++indexOf));
|
||||
var hue = Utility.ToInt32(m_Params[i].AsSpan()[++indexOf..]);
|
||||
|
||||
if (item is DyeTub tub)
|
||||
{
|
||||
|
|
@ -1003,7 +1003,7 @@ namespace Server.Commands
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
item.Name = m_Params[i].Substring(++indexOf);
|
||||
item.Name = m_Params[i][++indexOf..];
|
||||
}
|
||||
}
|
||||
else if (m_Params[i].StartsWithOrdinal("Amount"))
|
||||
|
|
@ -1017,7 +1017,7 @@ namespace Server.Commands
|
|||
var wasStackable = item.Stackable;
|
||||
|
||||
item.Stackable = true;
|
||||
item.Amount = Utility.ToInt32(m_Params[i].Substring(++indexOf));
|
||||
item.Amount = Utility.ToInt32(m_Params[i].AsSpan()[++indexOf..]);
|
||||
item.Stackable = wasStackable;
|
||||
}
|
||||
}
|
||||
|
|
@ -1255,25 +1255,20 @@ namespace Server.Commands
|
|||
|
||||
var indexOf = line.IndexOfOrdinal(' ');
|
||||
|
||||
list.m_Type = AssemblyHandler.FindTypeByName(line.Substring(0, indexOf++));
|
||||
list.m_Type = AssemblyHandler.FindTypeByName(line[..indexOf++]);
|
||||
|
||||
if (list.m_Type == null)
|
||||
{
|
||||
throw new ArgumentException($"Type not found for header: '{line}'");
|
||||
}
|
||||
|
||||
line = line.Substring(indexOf);
|
||||
line = line[indexOf..];
|
||||
indexOf = line.IndexOfOrdinal('(');
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
list.m_ItemID = Utility.ToInt32(line.Substring(0, indexOf - 1));
|
||||
list.m_ItemID = Utility.ToInt32(line.AsSpan()[..(indexOf - 1)]);
|
||||
|
||||
var parms = line.Substring(++indexOf);
|
||||
|
||||
if (line.EndsWithOrdinal(")"))
|
||||
{
|
||||
parms = parms.Substring(0, parms.Length - 1);
|
||||
}
|
||||
var parms = line[++indexOf..^(line.EndsWithOrdinal(")") ? 1 : 0)];
|
||||
|
||||
list.m_Params = parms.Split(';');
|
||||
|
||||
|
|
@ -1333,8 +1328,8 @@ namespace Server.Commands
|
|||
|
||||
if (space >= 0)
|
||||
{
|
||||
v = line.Substring(0, space++);
|
||||
line = line.Substring(space);
|
||||
v = line[..space++];
|
||||
line = line[space..];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -223,7 +223,7 @@ namespace Server.Commands
|
|||
|
||||
if (valueString.StartsWithOrdinal("0x"))
|
||||
{
|
||||
realValues[i] = Convert.ToInt32(valueString.Substring(2), 16);
|
||||
realValues[i] = Convert.ToInt32(valueString[2..], 16);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -438,7 +438,7 @@ namespace Server.Commands
|
|||
{
|
||||
try
|
||||
{
|
||||
toSet = Convert.ChangeType(Convert.ToUInt64(value.Substring(2), 16), type);
|
||||
toSet = Convert.ChangeType(Convert.ToUInt64(value[2..], 16), type);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Server.Items;
|
||||
|
|
@ -40,10 +41,8 @@ namespace Server.Commands
|
|||
var split = line.Split(' ');
|
||||
|
||||
var e = new SignEntry(
|
||||
line.Substring(
|
||||
split[0].Length + 1 + split[1].Length + 1 + split[2].Length + 1 +
|
||||
split[3].Length + 1 + split[4].Length + 1
|
||||
),
|
||||
line[(split[0].Length + 1 + split[1].Length + 1 + split[2].Length + 1 +
|
||||
split[3].Length + 1 + split[4].Length + 1)..],
|
||||
new Point3D(Utility.ToInt32(split[2]), Utility.ToInt32(split[3]), Utility.ToInt32(split[4])),
|
||||
Utility.ToInt32(split[1]),
|
||||
Utility.ToInt32(split[0])
|
||||
|
|
@ -112,7 +111,7 @@ namespace Server.Commands
|
|||
|
||||
if (name.StartsWithOrdinal("#"))
|
||||
{
|
||||
sign = new LocalizedSign(itemID, Utility.ToInt32(name.Substring(1)));
|
||||
sign = new LocalizedSign(itemID, Utility.ToInt32(name.AsSpan()[1..]));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -121,14 +120,12 @@ namespace Server.Commands
|
|||
|
||||
if (map == Map.Malas)
|
||||
{
|
||||
if (location.X >= 965 && location.Y >= 502 && location.X <= 1012 && location.Y <= 537)
|
||||
sign.Hue = location.X switch
|
||||
{
|
||||
sign.Hue = 0x47E;
|
||||
}
|
||||
else if (location.X >= 1960 && location.Y >= 1278 && location.X < 2106 && location.Y < 1413)
|
||||
{
|
||||
sign.Hue = 0x44E;
|
||||
}
|
||||
>= 965 when location.Y >= 502 && location.X <= 1012 && location.Y <= 537 => 0x47E,
|
||||
>= 1960 when location.Y >= 1278 && location.X < 2106 && location.Y < 1413 => 0x44E,
|
||||
_ => sign.Hue
|
||||
};
|
||||
}
|
||||
|
||||
sign.MoveToWorld(location, map);
|
||||
|
|
|
|||
|
|
@ -325,7 +325,7 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
if (text.Length > 40)
|
||||
{
|
||||
text = text.Substring(0, 40);
|
||||
text = text[..40];
|
||||
}
|
||||
|
||||
if (from.CheckAlive() && m_Book.IsChildOf(from.Backpack))
|
||||
|
|
|
|||
|
|
@ -86,8 +86,8 @@ namespace Server.Engines.Chat
|
|||
{
|
||||
var indexOf = param.IndexOfOrdinal(' ');
|
||||
|
||||
var name = param.Substring(0, indexOf);
|
||||
var text = param.Substring(indexOf + 1);
|
||||
var name = param[..indexOf];
|
||||
var text = param[(indexOf + 1)..];
|
||||
|
||||
var target = ChatSystem.SearchForUser(from, name);
|
||||
|
||||
|
|
@ -180,11 +180,11 @@ namespace Server.Engines.Chat
|
|||
if (end >= 0)
|
||||
{
|
||||
name = param.Substring(start, end - start);
|
||||
password = param.Substring(++end);
|
||||
password = param[++end..];
|
||||
}
|
||||
else
|
||||
{
|
||||
name = param.Substring(start);
|
||||
name = param[start..];
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -193,8 +193,8 @@ namespace Server.Engines.Chat
|
|||
|
||||
if (indexOf >= 0)
|
||||
{
|
||||
name = param.Substring(0, indexOf++);
|
||||
password = param.Substring(indexOf);
|
||||
name = param[..indexOf++];
|
||||
password = param[indexOf..];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -230,7 +230,7 @@ namespace Server.Engines.Chat
|
|||
|
||||
if (start >= 0)
|
||||
{
|
||||
name = param.Substring(0, start++);
|
||||
name = param[..start++];
|
||||
|
||||
var end = param.IndexOf('}', start);
|
||||
|
||||
|
|
|
|||
|
|
@ -529,7 +529,7 @@ namespace Server.Engines.Doom
|
|||
|
||||
if (length != buffer.Length)
|
||||
{
|
||||
buffer = buffer.SliceToLength(length); // Adjust to the actual size
|
||||
buffer = buffer[..length]; // Adjust to the actual size
|
||||
}
|
||||
|
||||
state.Send(buffer);
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ namespace Server.Engines.MLQuests.Mobiles
|
|||
|
||||
if (length != buffer.Length)
|
||||
{
|
||||
buffer = buffer.SliceToLength(length);
|
||||
buffer = buffer[..length];
|
||||
}
|
||||
|
||||
state.Send(buffer);
|
||||
|
|
|
|||
|
|
@ -246,7 +246,7 @@ namespace Server.Engines.PartySystem
|
|||
);
|
||||
|
||||
// : joined the party.
|
||||
buffer = buffer.SliceToLength(length);
|
||||
buffer = buffer[..length];
|
||||
SendToAll(buffer);
|
||||
SendToAllListeners(buffer);
|
||||
|
||||
|
|
@ -388,7 +388,7 @@ namespace Server.Engines.PartySystem
|
|||
Serial.MinusOne, -1, MessageType.Regular, hue, 3, number, "System", args
|
||||
);
|
||||
|
||||
buffer = buffer.SliceToLength(length);
|
||||
buffer = buffer[..length];
|
||||
|
||||
SendToAll(buffer);
|
||||
SendToAllListeners(buffer);
|
||||
|
|
@ -438,7 +438,7 @@ namespace Server.Engines.PartySystem
|
|||
|
||||
if (length != buffer.Length)
|
||||
{
|
||||
buffer = buffer.SliceToLength(length); // Adjust to the actual size
|
||||
buffer = buffer[..length]; // Adjust to the actual size
|
||||
}
|
||||
|
||||
ns.Send(buffer);
|
||||
|
|
@ -528,7 +528,7 @@ namespace Server.Engines.PartySystem
|
|||
|
||||
if (length != buffer.Length)
|
||||
{
|
||||
buffer = buffer.SliceToLength(length); // Adjust to the actual size
|
||||
buffer = buffer[..length]; // Adjust to the actual size
|
||||
}
|
||||
|
||||
m.NetState?.Send(buffer);
|
||||
|
|
|
|||
|
|
@ -74,8 +74,8 @@ namespace Server.Engines.Spawners
|
|||
if (setIndex > -1)
|
||||
{
|
||||
var start = setIndex + 4;
|
||||
props = argSpan.Slice(start, argSpan.Length - start);
|
||||
argSpan = argSpan.SliceToLength(setIndex);
|
||||
props = argSpan[start..];
|
||||
argSpan = argSpan[..setIndex];
|
||||
}
|
||||
|
||||
var argStr = argSpan.ToString().DefaultIfNullOrEmpty(null);
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ namespace Server.Gumps
|
|||
|
||||
if (text.Length > 3)
|
||||
{
|
||||
text = text.Substring(0, 3);
|
||||
text = text[..3];
|
||||
}
|
||||
|
||||
if (text.Length > 0)
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ namespace Server.Gumps
|
|||
|
||||
if (text.Length > 50)
|
||||
{
|
||||
text = text.Substring(0, 50);
|
||||
text = text[..50];
|
||||
}
|
||||
|
||||
if (text.Length > 0)
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ namespace Server.Gumps
|
|||
|
||||
if (text.Length > 40)
|
||||
{
|
||||
text = text.Substring(0, 40);
|
||||
text = text[..40];
|
||||
}
|
||||
|
||||
if (text.Length > 0)
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ namespace Server.Gumps
|
|||
|
||||
if (text.Length > 20)
|
||||
{
|
||||
text = text.Substring(0, 20);
|
||||
text = text[..20];
|
||||
}
|
||||
|
||||
if (text.Length > 0)
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ namespace Server.Gumps
|
|||
|
||||
if (text.Length > 50)
|
||||
{
|
||||
text = text.Substring(0, 50);
|
||||
text = text[..50];
|
||||
}
|
||||
|
||||
if (text.Length > 0)
|
||||
|
|
|
|||
|
|
@ -678,10 +678,10 @@ namespace Server.Gumps
|
|||
{
|
||||
if (t == typeof(ulong) || t == typeof(uint) || t == typeof(ushort) || t == typeof(byte))
|
||||
{
|
||||
return Convert.ChangeType(Convert.ToUInt64(s.Substring(2), 16), t);
|
||||
return Convert.ChangeType(Convert.ToUInt64(s[2..], 16), t);
|
||||
}
|
||||
|
||||
return Convert.ChangeType(Convert.ToInt64(s.Substring(2), 16), t);
|
||||
return Convert.ChangeType(Convert.ToInt64(s[2..], 16), t);
|
||||
}
|
||||
|
||||
return Convert.ChangeType(s, t);
|
||||
|
|
|
|||
|
|
@ -354,7 +354,7 @@ namespace Server.Gumps
|
|||
{
|
||||
if (DisplayName.StartsWithOrdinal(m_GroupNames[i]))
|
||||
{
|
||||
DisplayName = DisplayName.Substring(m_GroupNames[i].Length);
|
||||
DisplayName = DisplayName[m_GroupNames[i].Length..];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,17 +81,17 @@ namespace Server.Items
|
|||
{
|
||||
if (format.StartsWithOrdinal("the head of "))
|
||||
{
|
||||
format = format.Substring(14); // "the head of|..."
|
||||
format = format[14..]; // "the head of|..."
|
||||
}
|
||||
|
||||
if (format.EndsWithOrdinal(", taken in a duel"))
|
||||
{
|
||||
format = format.Substring(0, format.Length - ", taken in a duel".Length);
|
||||
format = format[..^", taken in a duel".Length];
|
||||
HeadType = HeadType.Duel;
|
||||
}
|
||||
else if (format.EndsWithOrdinal(", taken in a tournament"))
|
||||
{
|
||||
format = format.Substring(0, format.Length - ", taken in a tournament".Length);
|
||||
format = format[..^", taken in a tournament".Length];
|
||||
HeadType = HeadType.Tournament;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -188,7 +188,7 @@ namespace Server.Network
|
|||
|
||||
// We are ok with the string being cut-off mid character. The alternative is very slow.
|
||||
var byteLength = Math.Min(29, TextEncoding.UTF8.GetBytes(textChars, textBuffer));
|
||||
writer.Write(textBuffer.SliceToLength(byteLength));
|
||||
writer.Write(textBuffer[..byteLength]);
|
||||
writer.Clear(30 - byteLength); // terminator
|
||||
|
||||
ns.Send(writer.Span);
|
||||
|
|
@ -281,7 +281,7 @@ namespace Server.Network
|
|||
var tail = pad ? 2 : 1;
|
||||
var length = Math.Min(pad ? 253 : 254, text.GetBytesUtf8(buffer));
|
||||
writer.Write((byte)(length + tail));
|
||||
writer.Write(buffer.SliceToLength(length));
|
||||
writer.Write(buffer[..length]);
|
||||
|
||||
if (pad)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ namespace Server.Items
|
|||
|
||||
if (text.Length > 40)
|
||||
{
|
||||
text = text.Substring(0, 40);
|
||||
text = text[..40];
|
||||
}
|
||||
|
||||
var guild = new Guild(from, text, "none");
|
||||
|
|
|
|||
|
|
@ -39,15 +39,15 @@ namespace Server.Items
|
|||
if (ns.StygianAbyss)
|
||||
{
|
||||
length = OutgoingEntityPackets.CreateWorldEntity(buffer, this, ns.HighSeas);
|
||||
BinaryPrimitives.WriteUInt16BigEndian(buffer.Slice(8, 2), GMItemId);
|
||||
BinaryPrimitives.WriteUInt16BigEndian(buffer[8..10], GMItemId);
|
||||
}
|
||||
else
|
||||
{
|
||||
length = OutgoingItemPackets.CreateWorldItem(buffer, this);
|
||||
BinaryPrimitives.WriteUInt16BigEndian(buffer.Slice(7, 2), GMItemId);
|
||||
BinaryPrimitives.WriteUInt16BigEndian(buffer[7..9], GMItemId);
|
||||
}
|
||||
|
||||
ns.Send(buffer.SliceToLength(length));
|
||||
ns.Send(buffer[..length]);
|
||||
}
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
|
|
|
|||
|
|
@ -45,15 +45,15 @@ namespace Server.Items
|
|||
if (ns.StygianAbyss)
|
||||
{
|
||||
length = OutgoingEntityPackets.CreateWorldEntity(buffer, this, ns.HighSeas);
|
||||
BinaryPrimitives.WriteUInt16BigEndian(buffer.Slice(8, 2), GMItemId);
|
||||
BinaryPrimitives.WriteUInt16BigEndian(buffer[8..10], GMItemId);
|
||||
}
|
||||
else
|
||||
{
|
||||
length = OutgoingItemPackets.CreateWorldItem(buffer, this);
|
||||
BinaryPrimitives.WriteUInt16BigEndian(buffer.Slice(7, 2), GMItemId);
|
||||
BinaryPrimitives.WriteUInt16BigEndian(buffer[7..2], GMItemId);
|
||||
}
|
||||
|
||||
ns.Send(buffer.SliceToLength(length));
|
||||
ns.Send(buffer[..length]);
|
||||
}
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
|
|
|
|||
|
|
@ -239,7 +239,7 @@ namespace Server.Items
|
|||
|
||||
if (text.Length > 255)
|
||||
{
|
||||
text = text.Substring(0, 255);
|
||||
text = text[..255];
|
||||
}
|
||||
|
||||
if (text.Length > 0)
|
||||
|
|
@ -316,7 +316,7 @@ namespace Server.Items
|
|||
|
||||
if (text.Length > 255)
|
||||
{
|
||||
text = text.Substring(0, 255);
|
||||
text = text[..255];
|
||||
}
|
||||
|
||||
if (text.Length > 0)
|
||||
|
|
|
|||
|
|
@ -302,7 +302,7 @@ namespace Server.Items
|
|||
else
|
||||
{
|
||||
m_Target.EngravedText =
|
||||
Utility.FixHtml(relay.Text.Length > 64 ? relay.Text.Substring(0, 64) : relay.Text);
|
||||
Utility.FixHtml(relay.Text.Length > 64 ? relay.Text[..64] : relay.Text);
|
||||
state.Mobile.SendLocalizedMessage(1072361); // You engraved the object.
|
||||
m_Target.InvalidateProperties();
|
||||
m_Tool.UsesRemaining -= 1;
|
||||
|
|
|
|||
|
|
@ -353,7 +353,7 @@ namespace Server.Guilds
|
|||
|
||||
if (length != buffer.Length)
|
||||
{
|
||||
buffer = buffer.SliceToLength(length); // Adjust to the actual size
|
||||
buffer = buffer[..length]; // Adjust to the actual size
|
||||
}
|
||||
|
||||
g.Members[j].NetState?.Send(buffer);
|
||||
|
|
@ -1530,7 +1530,7 @@ namespace Server.Guilds
|
|||
|
||||
if (length != buffer.Length)
|
||||
{
|
||||
buffer = buffer.SliceToLength(length); // Adjust to the actual size
|
||||
buffer = buffer[..length]; // Adjust to the actual size
|
||||
}
|
||||
|
||||
Members[i].NetState?.Send(buffer);
|
||||
|
|
|
|||
|
|
@ -1092,7 +1092,7 @@ namespace Server
|
|||
return;
|
||||
}
|
||||
|
||||
Count = Utility.ToInt32(str.Substring(start, index - start));
|
||||
Count = Utility.ToInt32(str.Substring(start, index));
|
||||
|
||||
start = index + 1;
|
||||
index = str.IndexOf('+', start);
|
||||
|
|
|
|||
|
|
@ -385,7 +385,7 @@ namespace Server.Misc
|
|||
|
||||
if (mob.Female && skillTitle.EndsWithOrdinal("man"))
|
||||
{
|
||||
skillTitle = $"{skillTitle.Substring(0, skillTitle.Length - 3)}woman";
|
||||
skillTitle = $"{skillTitle[..^3]}woman";
|
||||
}
|
||||
|
||||
return $"{skillLevel} {skillTitle}";
|
||||
|
|
|
|||
|
|
@ -2819,7 +2819,7 @@ namespace Server.Mobiles
|
|||
|
||||
if (length != buffer.Length)
|
||||
{
|
||||
buffer = buffer.SliceToLength(length); // Adjust to the actual size
|
||||
buffer = buffer[..length]; // Adjust to the actual size
|
||||
}
|
||||
|
||||
ns.Send(buffer);
|
||||
|
|
|
|||
|
|
@ -393,7 +393,7 @@ namespace Server.Mobiles
|
|||
|
||||
if (index != -1)
|
||||
{
|
||||
Claim(e.Mobile, e.Speech.Substring(index).Trim());
|
||||
Claim(e.Mobile, e.Speech[index..].Trim());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ namespace Server.Mobiles
|
|||
{
|
||||
if (text.Length > 130)
|
||||
{
|
||||
text = text.Substring(0, 130);
|
||||
text = text[..130];
|
||||
}
|
||||
|
||||
m_Barkeeper.EndChangeRumor(from, m_RumorIndex, text);
|
||||
|
|
@ -56,7 +56,7 @@ namespace Server.Mobiles
|
|||
{
|
||||
if (text.Length > 130)
|
||||
{
|
||||
text = text.Substring(0, 130);
|
||||
text = text[..130];
|
||||
}
|
||||
|
||||
m_Barkeeper.EndChangeKeyword(from, m_RumorIndex, text);
|
||||
|
|
@ -78,7 +78,7 @@ namespace Server.Mobiles
|
|||
{
|
||||
if (text.Length > 130)
|
||||
{
|
||||
text = text.Substring(0, 130);
|
||||
text = text[..130];
|
||||
}
|
||||
|
||||
m_Barkeeper.EndChangeTip(from, text);
|
||||
|
|
|
|||
|
|
@ -1443,13 +1443,13 @@ namespace Server.Mobiles
|
|||
string firstWord;
|
||||
|
||||
var sep = text.IndexOfAny(new[] { ' ', ',' });
|
||||
firstWord = sep >= 0 ? text.Substring(0, sep) : text;
|
||||
firstWord = sep >= 0 ? text[..sep] : text;
|
||||
|
||||
string description;
|
||||
|
||||
if (int.TryParse(firstWord, out var price))
|
||||
{
|
||||
description = sep >= 0 ? text.Substring(sep + 1).Trim() : "";
|
||||
description = sep >= 0 ? text[(sep + 1)..].Trim() : "";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -858,7 +858,7 @@ namespace Server.Multis
|
|||
|
||||
if (e.Speech.Length > 8)
|
||||
{
|
||||
Rename(e.Speech.Substring(8).Trim().DefaultIfNullOrEmpty(null));
|
||||
Rename(e.Speech[8..].Trim().DefaultIfNullOrEmpty(null));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -871,7 +871,7 @@ namespace Server.Multis
|
|||
|
||||
if (newName?.Length > 40)
|
||||
{
|
||||
newName = newName.Substring(0, 40);
|
||||
newName = newName[..40];
|
||||
}
|
||||
|
||||
if (m_ShipName == newName)
|
||||
|
|
@ -1005,7 +1005,7 @@ namespace Server.Multis
|
|||
|
||||
if (start != -1)
|
||||
{
|
||||
var sNumber = navPoint.Substring(start);
|
||||
var sNumber = navPoint[start..];
|
||||
|
||||
if (!int.TryParse(sNumber, out number))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -250,7 +250,7 @@ namespace Server.Multis
|
|||
private static void WritePacked(ReadOnlySpan<byte> source, ref SpanWriter writer, out int length)
|
||||
{
|
||||
var size = source.Length;
|
||||
var dest = writer.RawBuffer.Slice(writer.Position + 3);
|
||||
var dest = writer.RawBuffer[(writer.Position + 3)..];
|
||||
length = dest.Length;
|
||||
|
||||
var ce = Zlib.Pack(dest, ref length, source, ZlibQuality.Default);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue