Cleanup some warnings.

This commit is contained in:
hondacrx
2021-11-15 16:11:20 -05:00
parent e0f344af25
commit 032f9a55f3
70 changed files with 233 additions and 234 deletions
+1 -1
View File
@@ -293,7 +293,7 @@ namespace System.Collections
public Object Clone()
{
BitSet bitArray = new BitSet(_mArray);
BitSet bitArray = new(_mArray);
bitArray._version = _version;
bitArray._mLength = _mLength;
return bitArray;
@@ -66,8 +66,8 @@ namespace Framework.Collections
public class LinkedListHead
{
LinkedListElement _iFirst = new LinkedListElement();
LinkedListElement _iLast = new LinkedListElement();
LinkedListElement _iFirst = new();
LinkedListElement _iLast = new();
uint _iSize;
public LinkedListHead()
+6 -6
View File
@@ -181,7 +181,7 @@ namespace System.Collections.Generic
{
get
{
List<TValue> retVal = new List<TValue>();
List<TValue> retVal = new();
foreach (var item in _interalStorage)
{
retVal.AddRange(item.Value);
@@ -194,7 +194,7 @@ namespace System.Collections.Generic
{
get
{
List<KeyValuePair<TKey, TValue>> retVal = new List<KeyValuePair<TKey, TValue>>();
List<KeyValuePair<TKey, TValue>> retVal = new();
foreach (var pair in _interalStorage)
{
foreach (var value in pair.Value)
@@ -259,7 +259,7 @@ namespace System.Collections.Generic
return new MultiMapEnumerator<TKey, TValue>(this);
}
private Dictionary<TKey, List<TValue>> _interalStorage = new Dictionary<TKey, List<TValue>>();
private Dictionary<TKey, List<TValue>> _interalStorage = new();
}
public sealed class SortedMultiMap<TKey, TValue> : IMultiMap<TKey, TValue>, IDictionary<TKey, TValue>
@@ -424,7 +424,7 @@ namespace System.Collections.Generic
{
get
{
List<TValue> retVal = new List<TValue>();
List<TValue> retVal = new();
foreach (var item in _interalStorage)
{
retVal.AddRange(item.Value);
@@ -437,7 +437,7 @@ namespace System.Collections.Generic
{
get
{
List<KeyValuePair<TKey, TValue>> retVal = new List<KeyValuePair<TKey, TValue>>();
List<KeyValuePair<TKey, TValue>> retVal = new();
foreach (var pair in _interalStorage)
{
foreach (var value in pair.Value)
@@ -502,6 +502,6 @@ namespace System.Collections.Generic
return new SortedMultiMapEnumerator<TKey, TValue>(this);
}
private SortedDictionary<TKey, List<TValue>> _interalStorage = new SortedDictionary<TKey, List<TValue>>();
private SortedDictionary<TKey, List<TValue>> _interalStorage = new();
}
}
@@ -79,6 +79,6 @@ namespace Framework.Configuration
return _configList.Where(p => p.Key.Contains(name)).Select(p => p.Key);
}
static Dictionary<string, string> _configList = new Dictionary<string, string>();
static Dictionary<string, string> _configList = new();
}
}
+1 -1
View File
@@ -31,7 +31,7 @@ namespace Framework.Cryptography
public class RsaStore
{
public static RSAParameters RSAParameters = new RSAParameters()
public static RSAParameters RSAParameters = new()
{
Modulus = new byte[] { 0xee, 0xb3, 0xdc, 0xd4, 0xd3, 0xc3, 0xb4, 0x54, 0x51, 0xce, 0x66, 0x5b, 0xcb, 0x32, 0xb8, 0xf0, 0xf7, 0x92, 0x53, 0xc6, 0x19, 0xf2, 0x0c, 0x85, 0x2f, 0x8a, 0x26, 0xa9, 0x7a, 0x45, 0x9f, 0x60, 0xc4, 0xeb, 0xcd, 0xea, 0x7f, 0x8d, 0x59, 0xd8, 0x57, 0xb2, 0x60, 0x7b, 0x09, 0x4c, 0x9b, 0x68, 0xb8, 0xc7, 0xed, 0xef, 0x1e, 0x80, 0x0d, 0xe6, 0x6b, 0x37, 0x5b, 0x53, 0x90, 0xeb, 0x18, 0x13, 0x0d, 0x7f, 0x43, 0x64, 0x83, 0xda, 0x98, 0xe6, 0xac, 0xc2, 0x30, 0xa2, 0x82, 0xa5, 0xc6, 0xcb, 0xc7, 0xfb, 0x86, 0x9f, 0x9f, 0xa9, 0x02, 0x6a, 0x03, 0x49, 0xc5, 0x38, 0xfb, 0xc0, 0xc8, 0x55, 0xcc, 0xc0, 0xce, 0x25, 0x91, 0xbe, 0x85, 0xcf, 0xd1, 0xd1, 0x37, 0xce, 0xcc, 0x83, 0xd2, 0xea, 0x30, 0x80, 0x07, 0x7b, 0x80, 0x9f, 0x9d, 0x44, 0x54, 0x22, 0x29, 0xbe, 0x86, 0xda, 0xdb, 0x48, 0xc5, 0xa9, 0xf9, 0x13, 0x36, 0x95, 0x23, 0x76, 0xf1, 0x0e, 0xdc, 0x84, 0x0d, 0x94, 0x02, 0x12, 0xa8, 0x97, 0xf3, 0x3b, 0x14, 0xee, 0xaa, 0x6f, 0x98, 0x05, 0x27, 0x4e, 0x1f, 0xa3, 0x60, 0xa5, 0xa9, 0xda, 0xd8, 0x17, 0xdf, 0x33, 0xcb, 0xe2, 0x13, 0x54, 0x8b, 0x18, 0xb0, 0xca, 0xb9, 0xbb, 0x88, 0x64, 0x06, 0xdf, 0x75, 0xa6, 0xd7, 0x61, 0x00, 0xbb, 0xb0, 0x5a, 0x0e, 0x7a, 0xd4, 0x77, 0x08, 0x4d, 0x15, 0xe2, 0x10, 0x83, 0xb0, 0x04, 0xaa, 0x9e, 0x8b, 0x77, 0xa9, 0x06, 0x89, 0x5d, 0x08, 0x5d, 0x0f, 0xb8, 0x2e, 0x6b, 0xc1, 0xcb, 0x64, 0xcf, 0x6e, 0x5c, 0xdb, 0x4f, 0x58, 0x65, 0x08, 0x51, 0xfb, 0x0d, 0x48, 0x1a, 0x6f, 0xb6, 0x3d, 0x1f, 0x0b, 0xdd, 0xfe, 0x1b, 0x1d, 0xf0, 0xbf, 0xb0, 0x27, 0x6b, 0xf5, 0x8e, 0xbc, 0xc7, 0x40, 0x01, 0xff, 0xa7, 0x0b, 0x80, 0xd6, 0x5f },
Exponent = new byte[] { 0x01, 0x00, 0x01 },
+1 -1
View File
@@ -30,7 +30,7 @@ namespace Framework.Cryptography
static SRP6()
{
_sha1 = new SHA1Managed();
_sha1 = SHA1.Create();
_g = new BigInteger(7);
_N = new BigInteger(new byte[]
{
+2 -2
View File
@@ -26,7 +26,7 @@ namespace Framework.Cryptography
{
public Sha256()
{
sha = new SHA256Managed();
sha = SHA256.Create();
sha.Initialize();
}
@@ -69,7 +69,7 @@ namespace Framework.Cryptography
public class HmacHash : HMACSHA1
{
public HmacHash(byte[] key) : base(key, true)
public HmacHash(byte[] key) : base(key)
{
Initialize();
}
@@ -26,7 +26,7 @@ namespace Framework.Database
public class AsyncCallbackProcessor<T> where T : ISqlCallback
{
List<T> _callbacks = new List<T>();
List<T> _callbacks = new();
public T AddCallback(T query)
{
+4 -4
View File
@@ -19,9 +19,9 @@ namespace Framework.Database
{
public static class DB
{
public static LoginDatabase Login = new LoginDatabase();
public static CharacterDatabase Characters = new CharacterDatabase();
public static WorldDatabase World = new WorldDatabase();
public static HotfixDatabase Hotfix = new HotfixDatabase();
public static LoginDatabase Login = new();
public static CharacterDatabase Characters = new();
public static WorldDatabase World = new();
public static HotfixDatabase Hotfix = new();
}
}
+5 -5
View File
@@ -35,7 +35,7 @@ namespace Framework.Database
bool updatesEnabled = database.IsAutoUpdateEnabled(_updateFlags);
_open.Add(() =>
{
MySqlConnectionInfo connectionObject = new MySqlConnectionInfo
MySqlConnectionInfo connectionObject = new()
{
Host = ConfigMgr.GetDefaultValue(baseDBName + "DatabaseInfo.Host", ""),
Port = ConfigMgr.GetDefaultValue(baseDBName + "DatabaseInfo.Port", ""),
@@ -161,10 +161,10 @@ namespace Framework.Database
bool _autoSetup;
DatabaseTypeFlags _updateFlags;
List<Func<bool>> _open = new List<Func<bool>>();
List<Func<bool>> _populate = new List<Func<bool>>();
List<Func<bool>> _update = new List<Func<bool>>();
List<Func<bool>> _prepare = new List<Func<bool>>();
List<Func<bool>> _open = new();
List<Func<bool>> _populate = new();
List<Func<bool>> _update = new();
List<Func<bool>> _prepare = new();
}
public enum DatabaseTypeFlags
+7 -7
View File
@@ -91,7 +91,7 @@ namespace Framework.Database
bool redundancyChecks = ConfigMgr.GetDefaultValue("Updates.Redundancy", true);
bool archivedRedundancy = ConfigMgr.GetDefaultValue("Updates.Redundancy", true);
UpdateResult result = new UpdateResult();
UpdateResult result = new();
// Count updates
foreach (var entry in appliedFiles)
@@ -193,7 +193,7 @@ namespace Framework.Database
}
uint speed = 0;
AppliedFileEntry file = new AppliedFileEntry(availableQuery.GetFileName(), hash, availableQuery.state, 0);
AppliedFileEntry file = new(availableQuery.GetFileName(), hash, availableQuery.state, 0);
switch (mode)
{
@@ -320,7 +320,7 @@ namespace Framework.Database
List<FileEntry> GetFileList()
{
List<FileEntry> fileList = new List<FileEntry>();
List<FileEntry> fileList = new();
SQLResult result = _database.Query("SELECT `path`, `state` FROM `updates_include`");
if (result.IsEmpty())
@@ -350,7 +350,7 @@ namespace Framework.Database
Dictionary<string, AppliedFileEntry> ReceiveAppliedFiles()
{
Dictionary<string, AppliedFileEntry> map = new Dictionary<string, AppliedFileEntry>();
Dictionary<string, AppliedFileEntry> map = new();
SQLResult result = _database.Query("SELECT `name`, `hash`, `state`, UNIX_TIMESTAMP(`timestamp`) FROM `updates` ORDER BY `name` ASC");
if (result.IsEmpty())
@@ -358,7 +358,7 @@ namespace Framework.Database
do
{
AppliedFileEntry entry = new AppliedFileEntry(result.Read<string>(0), result.Read<string>(1), result.Read<string>(2).ToEnum<State>(), result.Read<ulong>(3));
AppliedFileEntry entry = new(result.Read<string>(0), result.Read<string>(1), result.Read<string>(2).ToEnum<State>(), result.Read<ulong>(3));
map.Add(entry.Name, entry);
}
while (result.NextRow());
@@ -368,7 +368,7 @@ namespace Framework.Database
IEnumerable<FileEntry> GetFilesFromDirectory(string directory, State state)
{
Queue<string> queue = new Queue<string>();
Queue<string> queue = new();
queue.Enqueue(directory);
while (queue.Count > 0)
{
@@ -395,7 +395,7 @@ namespace Framework.Database
string CalculateHash(string fileName)
{
using (SHA1 sha1 = new SHA1Managed())
using (SHA1 sha1 = SHA1.Create())
{
string text = File.ReadAllText(fileName).Replace("\r", "");
return sha1.ComputeHash(Encoding.UTF8.GetBytes(text)).ToHexString();
+8 -8
View File
@@ -48,8 +48,8 @@ namespace Framework.Database
public abstract class MySqlBase<T>
{
Dictionary<T, string> _preparedQueries = new Dictionary<T, string>();
ProducerConsumerQueue<ISqlOperation> _queue = new ProducerConsumerQueue<ISqlOperation>();
Dictionary<T, string> _preparedQueries = new();
ProducerConsumerQueue<ISqlOperation> _queue = new();
MySqlConnectionInfo _connectionInfo;
DatabaseUpdater<T> _updater;
@@ -115,7 +115,7 @@ namespace Framework.Database
public void Execute(PreparedStatement stmt)
{
PreparedStatementTask task = new PreparedStatementTask(stmt);
PreparedStatementTask task = new(stmt);
_queue.Push(task);
}
@@ -155,7 +155,7 @@ namespace Framework.Database
public QueryCallback AsyncQuery(PreparedStatement stmt)
{
PreparedStatementTask task = new PreparedStatementTask(stmt, true);
PreparedStatementTask task = new(stmt, true);
// Store future result before enqueueing - task might get already processed and deleted before returning from this method
Task<SQLResult> result = task.GetFuture();
_queue.Push(task);
@@ -164,7 +164,7 @@ namespace Framework.Database
public Task<SQLQueryHolder<R>> DelayQueryHolder<R>(SQLQueryHolder<R> holder)
{
SQLQueryHolderTask<R> task = new SQLQueryHolderTask<R>(holder);
SQLQueryHolderTask<R> task = new(holder);
// Store future result before enqueueing - task might get already processed and deleted before returning from this method
Task<SQLQueryHolder<R>> result = task.GetFuture();
_queue.Push(task);
@@ -178,7 +178,7 @@ namespace Framework.Database
public void PrepareStatement(T statement, string sql)
{
StringBuilder sb = new StringBuilder();
StringBuilder sb = new();
int index = 0;
for (var i = 0; i < sql.Length; i++)
{
@@ -257,7 +257,7 @@ namespace Framework.Database
public TransactionCallback AsyncCommitTransaction(SQLTransaction transaction)
{
TransactionWithResultTask task = new TransactionWithResultTask(transaction);
TransactionWithResultTask task = new(transaction);
Task<bool> result = task.GetFuture();
_queue.Push(task);
return new TransactionCallback(result);
@@ -304,7 +304,7 @@ namespace Framework.Database
if (ex.InnerException is MySqlException)
code = (MySqlErrorCode)((MySqlException)ex.InnerException).Number;
StringBuilder stringBuilder = new StringBuilder($"SqlException: MySqlErrorCode: {code} Message: {ex.Message} SqlQuery: {query} ");
StringBuilder stringBuilder = new($"SqlException: MySqlErrorCode: {code} Message: {ex.Message} SqlQuery: {query} ");
if (parameters != null)
{
stringBuilder.Append("Parameters: ");
@@ -23,7 +23,7 @@ namespace Framework.Database
public class PreparedStatement
{
public string CommandText;
public Dictionary<int, object> Parameters = new Dictionary<int, object>();
public Dictionary<int, object> Parameters = new();
public PreparedStatement(string commandText)
{
+1 -1
View File
@@ -83,7 +83,7 @@ namespace Framework.Database
}
Task<SQLResult> _result;
Queue<QueryCallbackData> _callbacks = new Queue<QueryCallbackData>();
Queue<QueryCallbackData> _callbacks = new();
}
struct QueryCallbackData
+2 -2
View File
@@ -22,8 +22,8 @@ namespace Framework.Database
{
public class SQLQueryHolder<T>
{
public Dictionary<T, PreparedStatement> m_queries = new Dictionary<T, PreparedStatement>();
Dictionary<T, SQLResult> _results = new Dictionary<T, SQLResult>();
public Dictionary<T, PreparedStatement> m_queries = new();
Dictionary<T, SQLResult> _results = new();
public void SetQuery(T index, string sql, params object[] args)
{
+3 -3
View File
@@ -33,7 +33,7 @@ namespace Framework.Database
public void Append(PreparedStatement stmt)
{
MySqlCommand cmd = new MySqlCommand(stmt.CommandText);
MySqlCommand cmd = new(stmt.CommandText);
foreach (var parameter in stmt.Parameters)
cmd.Parameters.AddWithValue("@" + parameter.Key, parameter.Value);
@@ -80,7 +80,7 @@ namespace Framework.Database
}
SQLTransaction m_trans;
public static object _deadlockLock = new object();
public static object _deadlockLock = new();
}
class TransactionWithResultTask : TransactionTask
@@ -119,7 +119,7 @@ namespace Framework.Database
public Task<bool> GetFuture() { return m_result.Task; }
TaskCompletionSource<bool> m_result = new TaskCompletionSource<bool>();
TaskCompletionSource<bool> m_result = new();
}
public class TransactionCallback : ISqlCallback
+2 -2
View File
@@ -282,7 +282,7 @@ namespace Framework.Dynamic
{
if (group == 0 || group > 8 || Empty())
return;
MultiMap<uint, uint> delayed = new MultiMap<uint, uint>();
MultiMap<uint, uint> delayed = new();
foreach (var pair in _eventMap.KeyValueList)
{
@@ -411,6 +411,6 @@ namespace Framework.Dynamic
/// - Bit 24 - 31: Phase
/// - Pattern: 0xPPGGEEEE
/// </summary>
SortedMultiMap<uint, uint> _eventMap = new SortedMultiMap<uint, uint>();
SortedMultiMap<uint, uint> _eventMap = new();
}
}
+1 -1
View File
@@ -120,7 +120,7 @@ namespace Framework.Dynamic
public SortedMultiMap<ulong, BasicEvent> GetEvents() { return m_events; }
ulong m_time;
SortedMultiMap<ulong, BasicEvent> m_events = new SortedMultiMap<ulong, BasicEvent>();
SortedMultiMap<ulong, BasicEvent> m_events = new();
}
public class BasicEvent
+3 -3
View File
@@ -75,21 +75,21 @@ namespace Framework.Dynamic
public static FlagArray128 operator &(FlagArray128 left, FlagArray128 right)
{
FlagArray128 fl = new FlagArray128();
FlagArray128 fl = new();
for (var i = 0; i < left._values.Length; ++i)
fl[i] = left._values[i] & right._values[i];
return fl;
}
public static FlagArray128 operator |(FlagArray128 left, FlagArray128 right)
{
FlagArray128 fl = new FlagArray128();
FlagArray128 fl = new();
for (var i = 0; i < left._values.Length; ++i)
fl[i] = left._values[i] | right._values[i];
return fl;
}
public static FlagArray128 operator ^(FlagArray128 left, FlagArray128 right)
{
FlagArray128 fl = new FlagArray128();
FlagArray128 fl = new();
for (var i = 0; i < left._values.Length; ++i)
fl[i] = left._values[i] ^ right._values[i];
return fl;
+3 -3
View File
@@ -361,7 +361,7 @@ namespace Framework.Dynamic
// Perfect forward the context to the handler
// Use weak references to catch destruction before callbacks.
TaskContext context = new TaskContext(_task_holder.Pop(), this);
TaskContext context = new(_task_holder.Pop(), this);
// Invoke the context
context.Invoke();
@@ -479,7 +479,7 @@ namespace Framework.Dynamic
public void ModifyIf(Func<Task, bool> filter)
{
List<Task> cache = new List<Task>();
List<Task> cache = new();
foreach (var task in container.Where(filter))
{
if (filter(task))
@@ -498,7 +498,7 @@ namespace Framework.Dynamic
return container.Empty();
}
SortedSet<Task> container = new SortedSet<Task>();
SortedSet<Task> container = new();
}
public class TaskContext
-1
View File
@@ -7,7 +7,6 @@
<ItemGroup>
<PackageReference Include="Google.Protobuf" Version="4.0.0-rc2" />
<PackageReference Include="MySqlConnector" Version="1.3.9" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0-s390x.1.20553.1" />
</ItemGroup>
</Project>
+2 -2
View File
@@ -251,7 +251,7 @@ namespace Framework.GameMath
public Vector3 corner(int index)
{
// default constructor inits all components to 0
Vector3 v = new Vector3();
Vector3 v = new();
switch (index)
{
@@ -312,7 +312,7 @@ namespace Framework.GameMath
public static AxisAlignedBox operator +(AxisAlignedBox box, Vector3 v)
{
AxisAlignedBox outt = new AxisAlignedBox();
AxisAlignedBox outt = new();
outt.Lo = box.Lo + v;
outt.Hi = box.Hi + v;
return outt;
@@ -38,7 +38,7 @@ namespace Framework.GameMath
Inside = true;
Vector3 MinB = box.Lo;
Vector3 MaxB = box.Hi;
Vector3 MaxT = new Vector3(-1.0f, -1.0f, -1.0f);
Vector3 MaxT = new(-1.0f, -1.0f, -1.0f);
// Find candidate planes.
for (int i = 0; i < 3; ++i)
+5 -5
View File
@@ -95,11 +95,11 @@ namespace Framework.GameMath
/// <summary>
/// 4-dimentional single-precision floating point zero matrix.
/// </summary>
public static readonly Matrix2 Zero = new Matrix2(0, 0, 0, 0);
public static readonly Matrix2 Zero = new(0, 0, 0, 0);
/// <summary>
/// 4-dimentional single-precision floating point identity matrix.
/// </summary>
public static readonly Matrix2 Identity = new Matrix2(1, 0, 0, 1);
public static readonly Matrix2 Identity = new(1, 0, 0, 1);
#endregion
#region Public Properties
@@ -186,7 +186,7 @@ namespace Framework.GameMath
/// </remarks>
public static Matrix2 Parse(string value)
{
Regex r = new Regex(regularExp, RegexOptions.Singleline | RegexOptions.IgnorePatternWhitespace);
Regex r = new(regularExp, RegexOptions.Singleline | RegexOptions.IgnorePatternWhitespace);
Match m = r.Match(value);
if (m.Success)
{
@@ -219,7 +219,7 @@ namespace Framework.GameMath
/// </remarks>
public static bool TryParse(string value, out Matrix2 result)
{
Regex r = new Regex(regularExp, RegexOptions.Singleline);
Regex r = new(regularExp, RegexOptions.Singleline);
Match m = r.Match(value);
if (m.Success)
{
@@ -409,7 +409,7 @@ namespace Framework.GameMath
/// <returns>A new <see cref="Matrix2"/> instance containing the transposed matrix.</returns>
public static Matrix2 Transpose(Matrix2 m)
{
Matrix2 t = new Matrix2(m);
Matrix2 t = new(m);
t.Transpose();
return t;
}
+8 -8
View File
@@ -102,11 +102,11 @@ namespace Framework.GameMath
/// <summary>
/// 4-dimentional single-precision floating point zero matrix.
/// </summary>
public static readonly Matrix3 Zero = new Matrix3(0, 0, 0, 0, 0, 0, 0, 0, 0);
public static readonly Matrix3 Zero = new(0, 0, 0, 0, 0, 0, 0, 0, 0);
/// <summary>
/// 4-dimentional single-precision floating point identity matrix.
/// </summary>
public static readonly Matrix3 Identity = new Matrix3(1, 0, 0, 0, 1, 0, 0, 0, 1);
public static readonly Matrix3 Identity = new(1, 0, 0, 0, 1, 0, 0, 0, 1);
#endregion
#region Public Properties
@@ -241,7 +241,7 @@ namespace Framework.GameMath
/// </remarks>
public static Matrix3 Parse(string value)
{
Regex r = new Regex(regularExp, RegexOptions.Singleline | RegexOptions.IgnorePatternWhitespace);
Regex r = new(regularExp, RegexOptions.Singleline | RegexOptions.IgnorePatternWhitespace);
Match m = r.Match(value);
if (m.Success)
{
@@ -280,7 +280,7 @@ namespace Framework.GameMath
/// </remarks>
public static bool TryParse(string value, out Matrix3 result)
{
Regex r = new Regex(regularExp, RegexOptions.Singleline);
Regex r = new(regularExp, RegexOptions.Singleline);
Match m = r.Match(value);
if (m.Success)
{
@@ -519,7 +519,7 @@ namespace Framework.GameMath
/// <returns>A new <see cref="Matrix3"/> instance containing the transposed matrix.</returns>
public static Matrix3 Transpose(Matrix3 m)
{
Matrix3 t = new Matrix3(m);
Matrix3 t = new(m);
t.Transpose();
return t;
}
@@ -530,15 +530,15 @@ namespace Framework.GameMath
fCos = (float)Math.Cos(fYAngle);
fSin = (float)Math.Sin(fYAngle);
Matrix3 kZMat = new Matrix3(fCos, -fSin, 0.0f, fSin, fCos, 0.0f, 0.0f, 0.0f, 1.0f);
Matrix3 kZMat = new(fCos, -fSin, 0.0f, fSin, fCos, 0.0f, 0.0f, 0.0f, 1.0f);
fCos = (float)Math.Cos(fPAngle);
fSin = (float)Math.Sin(fPAngle);
Matrix3 kYMat = new Matrix3(fCos, 0.0f, fSin, 0.0f, 1.0f, 0.0f, -fSin, 0.0f, fCos);
Matrix3 kYMat = new(fCos, 0.0f, fSin, 0.0f, 1.0f, 0.0f, -fSin, 0.0f, fCos);
fCos = (float)Math.Cos(fRAngle);
fSin = (float)Math.Sin(fRAngle);
Matrix3 kXMat = new Matrix3(1.0f, 0.0f, 0.0f, 0.0f, fCos, -fSin, 0.0f, fSin, fCos);
Matrix3 kXMat = new(1.0f, 0.0f, 0.0f, 0.0f, fCos, -fSin, 0.0f, fSin, fCos);
return (kZMat * (kYMat * kXMat));
}
+6 -6
View File
@@ -109,11 +109,11 @@ namespace Framework.GameMath
/// <summary>
/// 4-dimentional single-precision floating point zero matrix.
/// </summary>
public static readonly Matrix4 Zero = new Matrix4(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
public static readonly Matrix4 Zero = new(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
/// <summary>
/// 4-dimentional single-precision floating point identity matrix.
/// </summary>
public static readonly Matrix4 Identity = new Matrix4(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
public static readonly Matrix4 Identity = new(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
#endregion
#region Public Properties
@@ -313,7 +313,7 @@ namespace Framework.GameMath
/// </remarks>
public static Matrix4 Parse(string value)
{
Regex r = new Regex(regularExp, RegexOptions.Singleline | RegexOptions.IgnorePatternWhitespace);
Regex r = new(regularExp, RegexOptions.Singleline | RegexOptions.IgnorePatternWhitespace);
Match m = r.Match(value);
if (m.Success)
{
@@ -360,7 +360,7 @@ namespace Framework.GameMath
/// </remarks>
public static bool TryParse(string value, out Matrix4 result)
{
Regex r = new Regex(regularExp, RegexOptions.Singleline);
Regex r = new(regularExp, RegexOptions.Singleline);
Match m = r.Match(value);
if (m.Success)
{
@@ -661,7 +661,7 @@ namespace Framework.GameMath
/// <returns>A new <see cref="Matrix4"/> instance containing the transposed matrix.</returns>
public static Matrix4 Transpose(Matrix4 m)
{
Matrix4 t = new Matrix4(m);
Matrix4 t = new(m);
t.Transpose();
return t;
}
@@ -840,7 +840,7 @@ namespace Framework.GameMath
/// <returns>A new <see cref="Vector4"/> instance containing the result.</returns>
public static Vector4 operator *(Matrix4 matrix, Vector4 vector)
{
Vector4 result = new Vector4();
Vector4 result = new();
for (int r = 0; r < 4; ++r)
{
for (int c = 0; c < 4; ++c)
+3 -3
View File
@@ -119,15 +119,15 @@ namespace Framework.GameMath
/// <summary>
/// Plane on the X axis.
/// </summary>
public static readonly Plane XPlane = new Plane(Vector3.XAxis, Vector3.Zero);
public static readonly Plane XPlane = new(Vector3.XAxis, Vector3.Zero);
/// <summary>
/// Plane on the Y axis.
/// </summary>
public static readonly Plane YPlane = new Plane(Vector3.YAxis, Vector3.Zero);
public static readonly Plane YPlane = new(Vector3.YAxis, Vector3.Zero);
/// <summary>
/// Plane on the Z axis.
/// </summary>
public static readonly Plane ZPlane = new Plane(Vector3.ZAxis, Vector3.Zero);
public static readonly Plane ZPlane = new(Vector3.ZAxis, Vector3.Zero);
#endregion
#region Public Properties
+13 -13
View File
@@ -134,27 +134,27 @@ namespace Framework.GameMath
/// <summary>
/// Double-precision floating point zero quaternion.
/// </summary>
public static readonly Quaternion Zero = new Quaternion(0, 0, 0, 0);
public static readonly Quaternion Zero = new(0, 0, 0, 0);
/// <summary>
/// Double-precision floating point identity quaternion.
/// </summary>
public static readonly Quaternion Identity = new Quaternion(0, 0, 0, 1);
public static readonly Quaternion Identity = new(0, 0, 0, 1);
/// <summary>
/// Double-precision floating point X-Axis quaternion.
/// </summary>
public static readonly Quaternion XAxis = new Quaternion(1, 0, 0, 0);
public static readonly Quaternion XAxis = new(1, 0, 0, 0);
/// <summary>
/// Double-precision floating point Y-Axis quaternion.
/// </summary>
public static readonly Quaternion YAxis = new Quaternion(0, 1, 0, 0);
public static readonly Quaternion YAxis = new(0, 1, 0, 0);
/// <summary>
/// Double-precision floating point Z-Axis quaternion.
/// </summary>
public static readonly Quaternion ZAxis = new Quaternion(0, 0, 1, 0);
public static readonly Quaternion ZAxis = new(0, 0, 1, 0);
/// <summary>
/// Double-precision floating point W-Axis quaternion.
/// </summary>
public static readonly Quaternion WAxis = new Quaternion(0, 0, 0, 1);
public static readonly Quaternion WAxis = new(0, 0, 0, 1);
#endregion
#region Public Properties
@@ -261,7 +261,7 @@ namespace Framework.GameMath
/// <returns>A <see cref="Quaternion"/> that represents the vector specified by the <paramref name="value"/> parameter.</returns>
public static Quaternion Parse(string value)
{
Regex r = new Regex(@"\((?<w>.*),(?<x>.*),(?<y>.*),(?<z>.*)\)", RegexOptions.None);
Regex r = new(@"\((?<w>.*),(?<x>.*),(?<y>.*),(?<z>.*)\)", RegexOptions.None);
Match m = r.Match(value);
if (m.Success)
{
@@ -289,7 +289,7 @@ namespace Framework.GameMath
/// <returns><see langword="true"/> if value was converted successfully; otherwise, <see langword="false"/>.</returns>
public static bool TryParse(string value, out Quaternion result)
{
Regex r = new Regex(@"\((?<x>.*),(?<y>.*),(?<z>.*),(?<w>.*)\)", RegexOptions.None);
Regex r = new(@"\((?<x>.*),(?<y>.*),(?<z>.*),(?<w>.*)\)", RegexOptions.None);
Match m = r.Match(value);
if (m.Success)
{
@@ -365,7 +365,7 @@ namespace Framework.GameMath
/// <returns>A new <see cref="Quaternion"/> containing the result.</returns>
public static Quaternion Multiply(Quaternion left, Quaternion right)
{
Quaternion result = new Quaternion();
Quaternion result = new();
result.X = left.W * right.X + left.X * right.W + left.Y * right.Z - left.Z * right.Y;
result.Y = left.W * right.Y + left.Y * right.W + left.Z * right.X - left.X * right.Z;
result.Z = left.W * right.Z + left.Z * right.W + left.X * right.Y - left.Y * right.X;
@@ -394,7 +394,7 @@ namespace Framework.GameMath
/// <returns>A <see cref="Quaternion"/> instance to hold the result.</returns>
public static Quaternion Multiply(Quaternion quaternion, float scalar)
{
Quaternion result = new Quaternion(quaternion);
Quaternion result = new(quaternion);
result.X *= scalar;
result.Y *= scalar;
result.Z *= scalar;
@@ -429,7 +429,7 @@ namespace Framework.GameMath
throw new DivideByZeroException("Dividing quaternion by zero");
}
Quaternion result = new Quaternion(quaternion);
Quaternion result = new(quaternion);
result.X /= scalar;
result.Y /= scalar;
result.Z /= scalar;
@@ -508,7 +508,7 @@ namespace Framework.GameMath
/// <returns>The quaternion's logarithm.</returns>
public static Quaternion Log(Quaternion quaternion)
{
Quaternion result = new Quaternion(0, 0, 0, 0);
Quaternion result = new(0, 0, 0, 0);
if (Math.Abs(quaternion.W) < 1.0)
{
@@ -539,7 +539,7 @@ namespace Framework.GameMath
/// <returns>The quaternion's exponent.</returns>
public Quaternion Exp(Quaternion quaternion)
{
Quaternion result = new Quaternion(0, 0, 0, 0);
Quaternion result = new(0, 0, 0, 0);
float angle = (float)System.Math.Sqrt(quaternion.X * quaternion.X + quaternion.Y * quaternion.Y + quaternion.Z * quaternion.Z);
float sin = (float)System.Math.Sin(angle);
+1 -1
View File
@@ -105,7 +105,7 @@ namespace Framework.GameMath
/// <returns>A <see cref="Ray"/> that represents the vector specified by the <paramref name="s"/> parameter.</returns>
public static Ray Parse(string s)
{
Regex r = new Regex(@"\((?<origin>\([^\)]*\)), (?<direction>\([^\)]*\))\)", RegexOptions.None);
Regex r = new(@"\((?<origin>\([^\)]*\)), (?<direction>\([^\)]*\))\)", RegexOptions.None);
Match m = r.Match(s);
if (m.Success)
{
+8 -8
View File
@@ -88,15 +88,15 @@ namespace Framework.GameMath
/// <summary>
/// 4-Dimentional single-precision floating point zero vector.
/// </summary>
public static readonly Vector2 Zero = new Vector2(0.0f, 0.0f);
public static readonly Vector2 Zero = new(0.0f, 0.0f);
/// <summary>
/// 4-Dimentional single-precision floating point X-Axis vector.
/// </summary>
public static readonly Vector2 XAxis = new Vector2(1.0f, 0.0f);
public static readonly Vector2 XAxis = new(1.0f, 0.0f);
/// <summary>
/// 4-Dimentional single-precision floating point Y-Axis vector.
/// </summary>
public static readonly Vector2 YAxis = new Vector2(0.0f, 1.0f);
public static readonly Vector2 YAxis = new(0.0f, 1.0f);
#endregion
#region Public properties
@@ -147,7 +147,7 @@ namespace Framework.GameMath
/// <returns>A <see cref="Vector2"/> that represents the vector specified by the <paramref name="value"/> parameter.</returns>
public static Vector2 Parse(string value)
{
Regex r = new Regex(@"\((?<x>.*),(?<y>.*)\)", RegexOptions.Singleline);
Regex r = new(@"\((?<x>.*),(?<y>.*)\)", RegexOptions.Singleline);
Match m = r.Match(value);
if (m.Success)
{
@@ -173,7 +173,7 @@ namespace Framework.GameMath
/// <returns><see langword="true"/> if value was converted successfully; otherwise, <see langword="false"/>.</returns>
public static bool TryParse(string value, out Vector2 result)
{
Regex r = new Regex(@"\((?<x>.*),(?<y>.*)\)", RegexOptions.Singleline);
Regex r = new(@"\((?<x>.*),(?<y>.*)\)", RegexOptions.Singleline);
Match m = r.Match(value);
if (m.Success)
{
@@ -831,7 +831,7 @@ namespace Framework.GameMath
/// <returns>A <see cref="System.Collections.Generic.List{T}"/> of single-precision floating point values.</returns>
public static explicit operator List<float>(Vector2 vector)
{
List<float> list = new List<float>();
List<float> list = new();
list.Add(vector.X);
list.Add(vector.Y);
@@ -844,7 +844,7 @@ namespace Framework.GameMath
/// <returns>A <see cref="System.Collections.Generic.LinkedList{T}"/> of single-precision floating point values.</returns>
public static explicit operator LinkedList<float>(Vector2 vector)
{
LinkedList<float> list = new LinkedList<float>();
LinkedList<float> list = new();
list.AddLast(vector.X);
list.AddLast(vector.Y);
@@ -938,7 +938,7 @@ namespace Framework.GameMath
public override System.ComponentModel.TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
{
StandardValuesCollection svc =
new StandardValuesCollection(new object[3] { Vector2.Zero, Vector2.XAxis, Vector2.YAxis });
new(new object[3] { Vector2.Zero, Vector2.XAxis, Vector2.YAxis });
return svc;
}
+11 -11
View File
@@ -88,23 +88,23 @@ namespace Framework.GameMath
/// <summary>
/// 4-Dimentional single-precision floating point zero vector.
/// </summary>
public static readonly Vector3 Zero = new Vector3(0.0f, 0.0f, 0.0f);
public static readonly Vector3 Zero = new(0.0f, 0.0f, 0.0f);
public static readonly Vector3 One = new Vector3(1.0f, 1.0f, 1.0f);
public static readonly Vector3 One = new(1.0f, 1.0f, 1.0f);
public static readonly Vector3 Inf = new Vector3(float.PositiveInfinity, float.PositiveInfinity, float.PositiveInfinity);
public static readonly Vector3 Inf = new(float.PositiveInfinity, float.PositiveInfinity, float.PositiveInfinity);
/// <summary>
/// 4-Dimentional single-precision floating point X-Axis vector.
/// </summary>
public static readonly Vector3 XAxis = new Vector3(1.0f, 0.0f, 0.0f);
public static readonly Vector3 XAxis = new(1.0f, 0.0f, 0.0f);
/// <summary>
/// 4-Dimentional single-precision floating point Y-Axis vector.
/// </summary>
public static readonly Vector3 YAxis = new Vector3(0.0f, 1.0f, 0.0f);
public static readonly Vector3 YAxis = new(0.0f, 1.0f, 0.0f);
/// <summary>
/// 4-Dimentional single-precision floating point Y-Axis vector.
/// </summary>
public static readonly Vector3 ZAxis = new Vector3(0.0f, 0.0f, 1.0f);
public static readonly Vector3 ZAxis = new(0.0f, 0.0f, 1.0f);
#endregion
#region Public properties
@@ -152,7 +152,7 @@ namespace Framework.GameMath
/// <returns>A <see cref="Vector3"/> that represents the vector specified by the <paramref name="value"/> parameter.</returns>
public static Vector3 Parse(string value)
{
Regex r = new Regex(@"\((?<x>.*),(?<y>.*),(?<z>.*)\)", RegexOptions.Singleline);
Regex r = new(@"\((?<x>.*),(?<y>.*),(?<z>.*)\)", RegexOptions.Singleline);
Match m = r.Match(value);
if (m.Success)
{
@@ -179,7 +179,7 @@ namespace Framework.GameMath
/// <returns><see langword="true"/> if value was converted successfully; otherwise, <see langword="false"/>.</returns>
public static bool TryParse(string value, out Vector3 result)
{
Regex r = new Regex(@"\((?<x>.*),(?<y>.*),(?<z>.*)\)", RegexOptions.Singleline);
Regex r = new(@"\((?<x>.*),(?<y>.*),(?<z>.*)\)", RegexOptions.Singleline);
Match m = r.Match(value);
if (m.Success)
{
@@ -901,7 +901,7 @@ namespace Framework.GameMath
/// <returns>A <see cref="System.Collections.Generic.List{T}"/> of single-precision floating point values.</returns>
public static explicit operator List<float>(Vector3 vector)
{
List<float> list = new List<float>(3);
List<float> list = new(3);
list.Add(vector.X);
list.Add(vector.Y);
list.Add(vector.Z);
@@ -915,7 +915,7 @@ namespace Framework.GameMath
/// <returns>A <see cref="System.Collections.Generic.LinkedList{T}"/> of single-precision floating point values.</returns>
public static explicit operator LinkedList<float>(Vector3 vector)
{
LinkedList<float> list = new LinkedList<float>();
LinkedList<float> list = new();
list.AddLast(vector.X);
list.AddLast(vector.Y);
list.AddLast(vector.Z);
@@ -1089,7 +1089,7 @@ namespace Framework.GameMath
public override System.ComponentModel.TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
{
StandardValuesCollection svc =
new StandardValuesCollection(new object[4] { Vector3.Zero, Vector3.XAxis, Vector3.YAxis, Vector3.ZAxis });
new(new object[4] { Vector3.Zero, Vector3.XAxis, Vector3.YAxis, Vector3.ZAxis });
return svc;
}
+11 -11
View File
@@ -100,23 +100,23 @@ namespace Framework.GameMath
/// <summary>
/// 4-Dimentional single-precision floating point zero vector.
/// </summary>
public static readonly Vector4 Zero = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
public static readonly Vector4 Zero = new(0.0f, 0.0f, 0.0f, 0.0f);
/// <summary>
/// 4-Dimentional single-precision floating point X-Axis vector.
/// </summary>
public static readonly Vector4 XAxis = new Vector4(1.0f, 0.0f, 0.0f, 0.0f);
public static readonly Vector4 XAxis = new(1.0f, 0.0f, 0.0f, 0.0f);
/// <summary>
/// 4-Dimentional single-precision floating point Y-Axis vector.
/// </summary>
public static readonly Vector4 YAxis = new Vector4(0.0f, 1.0f, 0.0f, 0.0f);
public static readonly Vector4 YAxis = new(0.0f, 1.0f, 0.0f, 0.0f);
/// <summary>
/// 4-Dimentional single-precision floating point Y-Axis vector.
/// </summary>
public static readonly Vector4 ZAxis = new Vector4(0.0f, 0.0f, 1.0f, 0.0f);
public static readonly Vector4 ZAxis = new(0.0f, 0.0f, 1.0f, 0.0f);
/// <summary>
/// 4-Dimentional single-precision floating point Y-Axis vector.
/// </summary>
public static readonly Vector4 WAxis = new Vector4(0.0f, 0.0f, 0.0f, 1.0f);
public static readonly Vector4 WAxis = new(0.0f, 0.0f, 0.0f, 1.0f);
#endregion
#region Public properties
@@ -185,7 +185,7 @@ namespace Framework.GameMath
/// <returns>A <see cref="Vector4"/> that represents the vector specified by the <paramref name="value"/> parameter.</returns>
public static Vector4 Parse(string value)
{
Regex r = new Regex(@"\((?<x>.*),(?<y>.*),(?<z>.*),(?<w>.*)\)", RegexOptions.Singleline);
Regex r = new(@"\((?<x>.*),(?<y>.*),(?<z>.*),(?<w>.*)\)", RegexOptions.Singleline);
Match m = r.Match(value);
if (m.Success)
{
@@ -213,7 +213,7 @@ namespace Framework.GameMath
/// <returns><see langword="true"/> if value was converted successfully; otherwise, <see langword="false"/>.</returns>
public static bool TryParse(string value, out Vector4 result)
{
Regex r = new Regex(@"\((?<x>.*),(?<y>.*),(?<z>.*),(?<w>.*)\)", RegexOptions.Singleline);
Regex r = new(@"\((?<x>.*),(?<y>.*),(?<z>.*),(?<w>.*)\)", RegexOptions.Singleline);
Match m = r.Match(value);
if (m.Success)
{
@@ -806,7 +806,7 @@ namespace Framework.GameMath
public static Vector4 operator *(Vector4 vector, Matrix4 M)
{
Vector4 result = new Vector4();
Vector4 result = new();
for (int i = 0; i < 4; ++i)
{
result[i] = 0.0f;
@@ -914,7 +914,7 @@ namespace Framework.GameMath
/// <returns>A <see cref="System.Collections.Generic.List{T}"/> of single-precision floating point values.</returns>
public static explicit operator List<float>(Vector4 vector)
{
List<float> list = new List<float>(4);
List<float> list = new(4);
list.Add(vector.X);
list.Add(vector.Y);
list.Add(vector.Z);
@@ -929,7 +929,7 @@ namespace Framework.GameMath
/// <returns>A <see cref="System.Collections.Generic.LinkedList{T}"/> of single-precision floating point values.</returns>
public static explicit operator LinkedList<float>(Vector4 vector)
{
LinkedList<float> list = new LinkedList<float>();
LinkedList<float> list = new();
list.AddLast(vector.X);
list.AddLast(vector.Y);
list.AddLast(vector.Z);
@@ -1025,7 +1025,7 @@ namespace Framework.GameMath
public override System.ComponentModel.TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
{
StandardValuesCollection svc =
new StandardValuesCollection(new object[5] { Vector4.Zero, Vector4.XAxis, Vector4.YAxis, Vector4.ZAxis, Vector4.WAxis });
new(new object[5] { Vector4.Zero, Vector4.XAxis, Vector4.YAxis, Vector4.ZAxis, Vector4.WAxis });
return svc;
}
+1 -1
View File
@@ -107,7 +107,7 @@ namespace Framework.IO
public string ReadCString()
{
ResetBitPos();
StringBuilder tmpString = new StringBuilder();
StringBuilder tmpString = new();
char tmpChar = readStream.ReadChar();
char tmpEndChar = Convert.ToChar(Encoding.UTF8.GetString(new byte[] { 0 }));
+1 -1
View File
@@ -263,7 +263,7 @@ namespace Framework.IO
bool Match(string pattern, out Match m)
{
Regex r = new Regex(pattern);
Regex r = new(pattern);
m = r.Match(activestring);
return m.Success;
}
+3 -3
View File
@@ -217,9 +217,9 @@ namespace Framework.IO
public ct_data[] dyn_dtree=new ct_data[2*D_CODES+1]; // distance tree
public ct_data[] bl_tree=new ct_data[2*BL_CODES+1]; // Huffman tree for bit lengths
public tree_desc l_desc=new tree_desc(); // desc. for literal tree
public tree_desc d_desc=new tree_desc(); // desc. for distance tree
public tree_desc bl_desc=new tree_desc(); // desc. for bit length tree
public tree_desc l_desc=new(); // desc. for literal tree
public tree_desc d_desc=new(); // desc. for distance tree
public tree_desc bl_desc=new(); // desc. for bit length tree
// number of codes at each bit length for an optimal tree
public ushort[] bl_count=new ushort[MAX_BITS+1];
+3 -3
View File
@@ -240,9 +240,9 @@ namespace Framework.IO
}
}
private static readonly static_tree_desc static_l_desc=new static_tree_desc(static_ltree, extra_lbits, LITERALS+1, L_CODES, MAX_BITS);
private static readonly static_tree_desc static_d_desc=new static_tree_desc(static_dtree, extra_dbits, 0, D_CODES, MAX_BITS);
private static readonly static_tree_desc static_bl_desc=new static_tree_desc(null, extra_blbits, 0, BL_CODES, MAX_BL_BITS);
private static readonly static_tree_desc static_l_desc=new(static_ltree, extra_lbits, LITERALS+1, L_CODES, MAX_BITS);
private static readonly static_tree_desc static_d_desc=new(static_dtree, extra_dbits, 0, D_CODES, MAX_BITS);
private static readonly static_tree_desc static_bl_desc=new(null, extra_blbits, 0, BL_CODES, MAX_BL_BITS);
// ===========================================================================
// Local (static) routines in this file.
+1 -1
View File
@@ -26,7 +26,7 @@ namespace Framework.IO
{
public static byte[] Compress(byte[] data)
{
ByteBuffer buffer = new ByteBuffer();
ByteBuffer buffer = new();
buffer.WriteUInt8(0x78);
buffer.WriteUInt8(0x9c);
+2 -2
View File
@@ -125,7 +125,7 @@ class FileAppender : Appender, IDisposable
string _logDir;
bool _dynamicName;
FileStream _logStream;
object locker = new object();
object locker = new();
}
class DBAppender : Appender
@@ -177,7 +177,7 @@ abstract class Appender
if (_level == LogLevel.Disabled || (_level != LogLevel.Fatal && _level > message.level))
return;
StringBuilder ss = new StringBuilder();
StringBuilder ss = new();
if (_flags.HasAnyFlag(AppenderFlags.PrefixTimestamp))
ss.AppendFormat("{0:MM/dd/yyyy HH:mm:ss} ", message.mtime);
+1 -1
View File
@@ -61,5 +61,5 @@ class Logger
string name;
LogLevel level;
Dictionary<byte, Appender> appenders = new Dictionary<byte, Appender>();
Dictionary<byte, Appender> appenders = new();
}
+2 -2
View File
@@ -27,8 +27,8 @@ namespace Framework.Networking
Thread _thread;
List<TSocketType> _Sockets = new List<TSocketType>();
List<TSocketType> _newSockets = new List<TSocketType>();
List<TSocketType> _Sockets = new();
List<TSocketType> _newSockets = new();
public void Stop()
{
+1 -1
View File
@@ -55,7 +55,7 @@ public class Realm : IEquatable<Realm>
realmIp = ExternalAddress;
}
IPEndPoint endpoint = new IPEndPoint(realmIp, Port);
IPEndPoint endpoint = new(realmIp, Port);
// Return external IP
return endpoint;
+10 -10
View File
@@ -51,7 +51,7 @@ public class RealmManager : Singleton<RealmManager>
{
do
{
RealmBuildInfo build = new RealmBuildInfo();
RealmBuildInfo build = new();
build.MajorVersion = result.Read<uint>(0);
build.MinorVersion = result.Read<uint>(1);
build.BugfixVersion = result.Read<uint>(2);
@@ -92,7 +92,7 @@ public class RealmManager : Singleton<RealmManager>
{
PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_REALMLIST);
SQLResult result = DB.Login.Query(stmt);
Dictionary<RealmId, string> existingRealms = new Dictionary<RealmId, string>();
Dictionary<RealmId, string> existingRealms = new();
foreach (var p in _realms)
existingRealms[p.Key] = p.Value.Name;
@@ -192,7 +192,7 @@ public class RealmManager : Singleton<RealmManager>
realmEntry.PopulationState = Math.Max((int)realm.PopulationLevel, 1);
realmEntry.CfgCategoriesID = realm.Timezone;
ClientVersion version = new ClientVersion();
ClientVersion version = new();
RealmBuildInfo buildInfo = GetBuildInfo(realm.Build);
if (buildInfo != null)
{
@@ -235,7 +235,7 @@ public class RealmManager : Singleton<RealmManager>
if (realm.Value.Build != build)
flag |= RealmFlags.VersionMismatch;
RealmListUpdate realmListUpdate = new RealmListUpdate();
RealmListUpdate realmListUpdate = new();
realmListUpdate.Update.WowRealmAddress = (int)realm.Value.Id.GetAddress();
realmListUpdate.Update.CfgTimezonesID = 1;
realmListUpdate.Update.PopulationState = (realm.Value.Flags.HasAnyFlag(RealmFlags.Offline) ? 0 : Math.Max((int)realm.Value.PopulationLevel, 1));
@@ -279,8 +279,8 @@ public class RealmManager : Singleton<RealmManager>
if (realm.Flags.HasAnyFlag(RealmFlags.Offline) || realm.Build != build)
return BattlenetRpcErrorCode.UserServerNotPermittedOnRealm;
RealmListServerIPAddresses serverAddresses = new RealmListServerIPAddresses();
AddressFamily addressFamily = new AddressFamily();
RealmListServerIPAddresses serverAddresses = new();
AddressFamily addressFamily = new();
addressFamily.Id = 1;
var address = new Address();
@@ -302,7 +302,7 @@ public class RealmManager : Singleton<RealmManager>
stmt.AddValue(4, accountName);
DB.Login.DirectExecute(stmt);
Bgs.Protocol.Attribute attribute = new Bgs.Protocol.Attribute();
Bgs.Protocol.Attribute attribute = new();
attribute.Name = "Param_RealmJoinTicket";
attribute.Value = new Bgs.Protocol.Variant();
attribute.Value.BlobValue = Google.Protobuf.ByteString.CopyFrom(accountName, System.Text.Encoding.UTF8);
@@ -328,9 +328,9 @@ public class RealmManager : Singleton<RealmManager>
public ICollection<Realm> GetRealms() { return _realms.Values; }
List<string> GetSubRegions() { return _subRegions; }
List<RealmBuildInfo> _builds = new List<RealmBuildInfo>();
ConcurrentDictionary<RealmId, Realm> _realms = new ConcurrentDictionary<RealmId, Realm>();
List<string> _subRegions = new List<string>();
List<RealmBuildInfo> _builds = new();
ConcurrentDictionary<RealmId, Realm> _realms = new();
List<string> _subRegions = new();
Timer _updateTimer;
}
@@ -354,7 +354,7 @@ public static partial class Detour
if (header.version != DT_NAVMESH_VERSION)
return DT_FAILURE | DT_WRONG_VERSION;
dtNavMeshParams navMeshParams = new dtNavMeshParams();
dtNavMeshParams navMeshParams = new();
dtVcopy(navMeshParams.orig, header.bmin);
navMeshParams.tileWidth = header.bmax[0] - header.bmin[0];
navMeshParams.tileHeight = header.bmax[2] - header.bmin[2];
@@ -133,7 +133,7 @@ public static partial class Detour
public byte[] ToBytes()
{
List<byte> bytes = new List<byte>();
List<byte> bytes = new();
bytes.AddRange(BitConverter.GetBytes(firstLink));
for (int i = 0; i < DT_VERTS_PER_POLYGON; ++i)
@@ -196,7 +196,7 @@ public static partial class Detour
public byte[] ToBytes()
{
List<byte> bytes = new List<byte>();
List<byte> bytes = new();
bytes.AddRange(BitConverter.GetBytes(vertBase));
bytes.AddRange(BitConverter.GetBytes(triBase));
@@ -232,7 +232,7 @@ public static partial class Detour
public byte[] ToBytes()
{
List<byte> bytes = new List<byte>();
List<byte> bytes = new();
bytes.AddRange(BitConverter.GetBytes(polyRef));
bytes.AddRange(BitConverter.GetBytes(next));
@@ -270,7 +270,7 @@ public static partial class Detour
public byte[] ToBytes()
{
List<byte> bytes = new List<byte>();
List<byte> bytes = new();
for (int j = 0; j < bmin.Length; ++j)
{
bytes.AddRange(BitConverter.GetBytes(bmin[j]));
@@ -326,7 +326,7 @@ public static partial class Detour
public byte[] ToBytes()
{
List<byte> bytes = new List<byte>();
List<byte> bytes = new();
for (int i = 0; i < 6; ++i)
{
bytes.AddRange(BitConverter.GetBytes(pos[i]));
@@ -412,7 +412,7 @@ public static partial class Detour
public byte[] ToBytes()
{
List<byte> bytes = new List<byte>();
List<byte> bytes = new();
bytes.AddRange(BitConverter.GetBytes(magic));
bytes.AddRange(BitConverter.GetBytes(version));
@@ -537,7 +537,7 @@ public static partial class Detour
public byte[] ToBytes()
{
List<byte> bytes = new List<byte>();
List<byte> bytes = new();
bytes.AddRange(header.ToBytes());
for (int i = 0; i < polys.Length; ++i)
@@ -645,7 +645,7 @@ public static partial class Detour
///
public dtNavMeshParams Clone()
{
dtNavMeshParams copy = new dtNavMeshParams();
dtNavMeshParams copy = new();
for (int i = 0; i < orig.Length; ++i)
{
copy.orig[i] = orig[i];
@@ -222,7 +222,7 @@ public static partial class Detour
raycastLimitSqr = 0f;
}
}
private dtQueryData m_query = new dtQueryData(); //< Sliced query state.
private dtQueryData m_query = new(); //< Sliced query state.
private dtNodePool m_tinyNodePool; //< Pointer to small node pool.
private dtNodePool m_nodePool; //< Pointer to node pool.
@@ -884,7 +884,7 @@ public static partial class Detour
nearestRef = 0;
dtFindNearestPolyQuery query = new dtFindNearestPolyQuery(this, center);
dtFindNearestPolyQuery query = new(this, center);
dtStatus status = queryPolygons(center, halfExtents, filter, query);
if (dtStatusFailed(status))
@@ -1430,7 +1430,7 @@ public static partial class Detour
return DT_FAILURE;
}
dtRaycastHit rayHit = new dtRaycastHit();
dtRaycastHit rayHit = new();
rayHit.maxPath = 0;
int iter = 0;
@@ -2579,7 +2579,7 @@ public static partial class Detour
public dtStatus raycast(dtPolyRef startRef, float[] startPos, float[] endPos, dtQueryFilter filter, ref float t, float[] hitNormal, dtPolyRef[] path, ref uint pathCount, int maxPath)
{
dtRaycastHit hit = new dtRaycastHit();
dtRaycastHit hit = new();
hit.path = path;
hit.maxPath = maxPath;
@@ -2670,16 +2670,16 @@ public static partial class Detour
dtStatus status = DT_SUCCESS;
dtMeshTile prevTile = new dtMeshTile();
dtMeshTile prevTile = new();
dtMeshTile nextTile;
dtPoly prevPoly = new dtPoly();
dtPoly prevPoly = new();
dtPoly nextPoly;
dtPolyRef curRef;
// The API input has been checked already, skip checking internal data.
curRef = startRef;
dtMeshTile tile = new dtMeshTile();
dtPoly poly = new dtPoly();
dtMeshTile tile = new();
dtPoly poly = new();
m_nav.getTileAndPolyByRefUnsafe(curRef, ref tile, ref poly);
nextTile = prevTile = tile;
nextPoly = prevPoly = poly;
+1 -1
View File
@@ -21,7 +21,7 @@ using System.Reflection;
public class Singleton<T> where T : class
{
private static volatile T instance;
private static object syncRoot = new object();
private static object syncRoot = new();
public static T Instance
{
@@ -22,8 +22,8 @@ namespace Framework.Threading
{
public class ProducerConsumerQueue<T>
{
object _queueLock = new object();
Queue<T> _queue = new Queue<T>();
object _queueLock = new();
Queue<T> _queue = new();
volatile bool _shutdown;
public ProducerConsumerQueue()
+2 -2
View File
@@ -157,7 +157,7 @@ namespace System
public static List<T> DeserializeObjects<T>(this ICollection<uint> data)
{
List<T> list = new List<T>();
List<T> list = new();
if (data.Count == 0)
return list;
@@ -261,7 +261,7 @@ namespace System
public static string ReadCString(this BinaryReader reader)
{
byte num;
List<byte> temp = new List<byte>();
List<byte> temp = new();
while ((num = reader.ReadByte()) != 0)
temp.Add(num);
+1 -1
View File
@@ -606,7 +606,7 @@ namespace Game.AI
if (spellInfo == null)
return;
Spell spell = new Spell(me, spellInfo, TriggerCastFlags.CastDirectly);
Spell spell = new(me, spellInfo, TriggerCastFlags.CastDirectly);
if (spell.CheckPetCast(victim) != SpellCastResult.SpellCastOk)
return;
+1 -1
View File
@@ -2232,7 +2232,7 @@ namespace Game.Entities
return;
}
Spell spell = new Spell(this, info, args.TriggerFlags, args.OriginalCaster, args.OriginalCastId);
Spell spell = new(this, info, args.TriggerFlags, args.OriginalCaster, args.OriginalCastId);
foreach (var pair in args.SpellValueOverrides)
spell.SetSpellValue(pair.Key, pair.Value);
+1 -1
View File
@@ -95,7 +95,7 @@ namespace Game.Entities
ulong lowGuid = creator.GetMap().GenerateLowGuid(HighGuid.SceneObject);
SceneObject sceneObject = new SceneObject();
SceneObject sceneObject = new();
if (!sceneObject.Create(lowGuid, SceneType.Normal, sceneId, sceneTemplate != null ? sceneTemplate.ScenePackageId : 0, creator.GetMap(), creator, pos, privateObjectOwner))
{
sceneObject.Dispose();
+6 -6
View File
@@ -625,14 +625,14 @@ namespace Game.Movement
if (_owner.IsTypeId(TypeId.Player))
{
PointMovementGenerator<Player> movement = new PointMovementGenerator<Player>(id, x, y, z, generatePath, speed, null, target, spellEffectExtraData);
PointMovementGenerator<Player> movement = new(id, x, y, z, generatePath, speed, null, target, spellEffectExtraData);
movement.Priority = MovementGeneratorPriority.Highest;
movement.BaseUnitState = UnitState.Charging;
Add(movement);
}
else
{
PointMovementGenerator<Creature> movement = new PointMovementGenerator<Creature>(id, x, y, z, generatePath, speed, null, target, spellEffectExtraData);
PointMovementGenerator<Creature> movement = new(id, x, y, z, generatePath, speed, null, target, spellEffectExtraData);
movement.Priority = MovementGeneratorPriority.Highest;
movement.BaseUnitState = UnitState.Charging;
Add(movement);
@@ -680,7 +680,7 @@ namespace Game.Movement
if (spellEffectExtraData != null)
init.SetSpellEffectExtraData(spellEffectExtraData);
GenericMovementGenerator movement = new GenericMovementGenerator(init, MovementGeneratorType.Effect, 0);
GenericMovementGenerator movement = new(init, MovementGeneratorType.Effect, 0);
movement.Priority = MovementGeneratorPriority.Highest;
Add(movement);
}
@@ -730,7 +730,7 @@ namespace Game.Movement
arrivalSpellTargetGuid = arrivalCast.Target;
}
GenericMovementGenerator movement = new GenericMovementGenerator(init, MovementGeneratorType.Effect, id, arrivalSpellId, arrivalSpellTargetGuid);
GenericMovementGenerator movement = new(init, MovementGeneratorType.Effect, id, arrivalSpellId, arrivalSpellTargetGuid);
movement.Priority = MovementGeneratorPriority.Highest;
movement.BaseUnitState = UnitState.Jumping;
Add(movement);
@@ -849,7 +849,7 @@ namespace Game.Movement
init.MoveTo(_owner.GetPositionX(), _owner.GetPositionY(), tz + _owner.GetHoverOffset(), false);
init.SetFall();
GenericMovementGenerator movement = new GenericMovementGenerator(init, MovementGeneratorType.Effect, id);
GenericMovementGenerator movement = new(init, MovementGeneratorType.Effect, id);
movement.Priority = MovementGeneratorPriority.Highest;
Add(movement);
}
@@ -943,7 +943,7 @@ namespace Game.Movement
return;
}
GenericMovementGenerator movement = new GenericMovementGenerator(init, type, id);
GenericMovementGenerator movement = new(init, type, id);
movement.Priority = priority;
Add(movement);
}
+3 -3
View File
@@ -256,7 +256,7 @@ namespace Game.Spells
case AuraType.AddPctModifier:
if (m_spellmod == null)
{
SpellModifierByClassMask spellmod = new SpellModifierByClassMask(GetBase());
SpellModifierByClassMask spellmod = new(GetBase());
spellmod.op = (SpellModOp)GetMiscValue();
spellmod.type = GetAuraType() == AuraType.AddPctModifier ? SpellModType.Pct : SpellModType.Flat;
@@ -269,7 +269,7 @@ namespace Game.Spells
case AuraType.AddFlatModifierBySpellLabel:
if (m_spellmod == null)
{
SpellFlatModifierByLabel spellmod = new SpellFlatModifierByLabel(GetBase());
SpellFlatModifierByLabel spellmod = new(GetBase());
spellmod.op = (SpellModOp)GetMiscValue();
spellmod.type = SpellModType.LabelFlat;
@@ -283,7 +283,7 @@ namespace Game.Spells
case AuraType.AddPctModifierBySpellLabel:
if (m_spellmod == null)
{
SpellPctModifierByLabel spellmod = new SpellPctModifierByLabel(GetBase());
SpellPctModifierByLabel spellmod = new(GetBase());
spellmod.op = (SpellModOp)GetMiscValue();
spellmod.type = SpellModType.LabelPct;
+1 -1
View File
@@ -694,7 +694,7 @@ namespace Game.Spells
}
// Init dest coordinates
WorldLocation targetDest = new WorldLocation(destTarget);
WorldLocation targetDest = new(destTarget);
if (targetDest.GetMapId() == 0xFFFFFFFF)
targetDest.SetMapId(unitTarget.GetMapId());
+1 -1
View File
@@ -49,7 +49,7 @@ namespace Scripts.Pets
return;
// Find victim of Summon Gargoyle spell
List<Unit> targets = new List<Unit>();
List<Unit> targets = new();
var u_check = new AnyUnfriendlyUnitInObjectRangeCheck(me, me, 30.0f);
var searcher = new UnitListSearcher(me, targets, u_check);
Cell.VisitAllObjects(me, searcher, 30.0f);
+7 -7
View File
@@ -35,7 +35,7 @@ namespace Scripts.Smart
return false;
Log.outDebug(LogFilter.ScriptsAi, "AreaTrigger {0} is using SmartTrigger script", trigger.Id);
SmartScript script = new SmartScript();
SmartScript script = new();
script.OnInitialize(trigger);
script.ProcessEventsFor(SmartEvents.AreatriggerOntrigger, player, trigger.Id);
return true;
@@ -60,28 +60,28 @@ namespace Scripts.Smart
public override void OnSceneStart(Player player, uint sceneInstanceID, SceneTemplate sceneTemplate)
{
SmartScript smartScript = new SmartScript();
SmartScript smartScript = new();
smartScript.OnInitialize(sceneTemplate);
smartScript.ProcessEventsFor(SmartEvents.SceneStart, player);
}
public override void OnSceneTriggerEvent(Player player, uint sceneInstanceID, SceneTemplate sceneTemplate, string triggerName)
{
SmartScript smartScript = new SmartScript();
SmartScript smartScript = new();
smartScript.OnInitialize(sceneTemplate);
smartScript.ProcessEventsFor(SmartEvents.SceneTrigger, player, 0, 0, false, null, null, triggerName);
}
public override void OnSceneCancel(Player player, uint sceneInstanceID, SceneTemplate sceneTemplate)
{
SmartScript smartScript = new SmartScript();
SmartScript smartScript = new();
smartScript.OnInitialize(sceneTemplate);
smartScript.ProcessEventsFor(SmartEvents.SceneCancel, player);
}
public override void OnSceneComplete(Player player, uint sceneInstanceID, SceneTemplate sceneTemplate)
{
SmartScript smartScript = new SmartScript();
SmartScript smartScript = new();
smartScript.OnInitialize(sceneTemplate);
smartScript.ProcessEventsFor(SmartEvents.SceneComplete, player);
}
@@ -95,7 +95,7 @@ namespace Scripts.Smart
// Called when a quest status change
public override void OnQuestStatusChange(Player player, Quest quest, QuestStatus oldStatus, QuestStatus newStatus)
{
SmartScript smartScript = new SmartScript();
SmartScript smartScript = new();
smartScript.OnInitialize(quest);
switch (newStatus)
{
@@ -123,7 +123,7 @@ namespace Scripts.Smart
ushort slot = player.FindQuestSlot(quest.Id);
if (slot < SharedConst.MaxQuestLogSize && player.IsQuestObjectiveComplete(slot, quest, objective))
{
SmartScript smartScript = new SmartScript();
SmartScript smartScript = new();
smartScript.OnInitialize(quest);
smartScript.ProcessEventsFor(SmartEvents.QuestObjCompletion, player, objective.Id);
}
+1 -1
View File
@@ -268,7 +268,7 @@ namespace Scripts.Spells.DeathKnight
return;
int amount = (int)damageInfo.GetDamage() / 2;
SpellNonMeleeDamage log = new SpellNonMeleeDamage(drw, drw.GetVictim(), spellInfo, new SpellCastVisual(spellInfo.GetSpellXSpellVisualId(drw), 0), spellInfo.GetSchoolMask());
SpellNonMeleeDamage log = new(drw, drw.GetVictim(), spellInfo, new SpellCastVisual(spellInfo.GetSpellXSpellVisualId(drw), 0), spellInfo.GetSchoolMask());
log.damage = (uint)amount;
Unit.DealDamage(drw, drw.GetVictim(), (uint)amount, null, DamageEffectType.SpellDirect, spellInfo.GetSchoolMask(), spellInfo, true);
drw.SendSpellNonMeleeDamageLog(log);
+3 -3
View File
@@ -2270,7 +2270,7 @@ namespace Scripts.Spells.Generic
if (player.GetLastPetNumber() != 0)
{
PetType newPetType = (player.GetClass() == Class.Hunter) ? PetType.Hunter : PetType.Summon;
Pet newPet = new Pet(player, newPetType);
Pet newPet = new(player, newPetType);
if (newPet.LoadPetFromDB(player, 0, player.GetLastPetNumber(), true))
{
// revive the pet if it is dead
@@ -2723,7 +2723,7 @@ namespace Scripts.Spells.Generic
Unit target = GetHitUnit();
if (target)
{
SpiritHealerConfirm spiritHealerConfirm = new SpiritHealerConfirm();
SpiritHealerConfirm spiritHealerConfirm = new();
spiritHealerConfirm.Unit = target.GetGUID();
originalCaster.SendPacket(spiritHealerConfirm);
}
@@ -2972,7 +2972,7 @@ namespace Scripts.Spells.Generic
[Script]
class spell_gen_turkey_marker : AuraScript
{
readonly List<uint> _applyTimes = new List<uint>();
readonly List<uint> _applyTimes = new();
void OnApply(AuraEffect aurEff, AuraEffectHandleModes mode)
{
+2 -2
View File
@@ -189,8 +189,8 @@ namespace Scripts.Spells.Holiday
bool foundSomeone = false;
// For nearby players, check if they have the same aura. If so, cast Romantic Picnic (45123)
// required by achievement and "hearts" visual
List<Unit> playerList = new List<Unit>();
AnyPlayerInObjectRangeCheck checker = new AnyPlayerInObjectRangeCheck(target, SharedConst.InteractionDistance * 2);
List<Unit> playerList = new();
AnyPlayerInObjectRangeCheck checker = new(target, SharedConst.InteractionDistance * 2);
var searcher = new PlayerListSearcher(target, playerList, checker);
Cell.VisitWorldObjects(target, searcher, SharedConst.InteractionDistance * 2);
foreach (Player player in playerList)
+4 -4
View File
@@ -1139,7 +1139,7 @@ namespace Scripts.Spells.Items
void HandleDummy(uint effIndex)
{
Unit caster = GetCaster();
List<uint> possibleSpells = new List<uint>();
List<uint> possibleSpells = new();
switch (caster.GetClass())
{
case Class.Warlock:
@@ -2165,7 +2165,7 @@ namespace Scripts.Spells.Items
{
SpellCastResult CheckRequirement()
{
List<TempSummon> ghouls = new List<TempSummon>();
List<TempSummon> ghouls = new();
GetCaster().GetAllMinionsByEntry(ghouls, CreatureIds.Ghoul);
if (ghouls.Count >= CreatureIds.MaxGhouls)
{
@@ -3530,7 +3530,7 @@ namespace Scripts.Spells.Items
{
void SecondaryEffect()
{
List<uint> availableElixirs = new List<uint>()
List<uint> availableElixirs = new()
{
// Battle Elixirs
33720, // Onslaught Elixir (28102)
@@ -3599,7 +3599,7 @@ namespace Scripts.Spells.Items
{
void SecondaryEffect()
{
List<uint> availableElixirs = new List<uint>()
List<uint> availableElixirs = new()
{
43185, // Runic Healing Potion (33447)
53750, // Crazy Alchemist's Potion (40077)
+2 -2
View File
@@ -524,7 +524,7 @@ namespace Scripts.Spells.Mage
[Script] // Ice Lance - 30455
class spell_mage_ice_lance : SpellScript
{
List<ObjectGuid> _orderedTargets = new List<ObjectGuid>();
List<ObjectGuid> _orderedTargets = new();
public override bool Validate(SpellInfo spellInfo)
{
@@ -788,7 +788,7 @@ namespace Scripts.Spells.Mage
void Apply(AuraEffect aurEff, AuraEffectHandleModes mode)
{
List<TempSummon> minions = new List<TempSummon>();
List<TempSummon> minions = new();
GetTarget().GetAllMinionsByEntry(minions, (uint)Global.SpellMgr.GetSpellInfo(SpellIds.RingOfFrostSummon, GetCastDifficulty()).GetEffect(0).MiscValue);
// Get the last summoned RoF, save it and despawn older ones
+3 -3
View File
@@ -111,7 +111,7 @@ namespace Scripts.Spells.Priest
[Script] // 81749 - Atonement
public class spell_pri_atonement : AuraScript
{
List<ObjectGuid> _appliedAtonements = new List<ObjectGuid>();
List<ObjectGuid> _appliedAtonements = new();
public override bool Validate(SpellInfo spellInfo)
{
@@ -372,7 +372,7 @@ namespace Scripts.Spells.Priest
{
Position destPos = GetHitDest().GetPosition();
SpellCastTargets targets = new SpellCastTargets();
SpellCastTargets targets = new();
targets.SetDst(destPos);
targets.SetUnitTarget(GetCaster());
GetHitUnit().CastSpell(targets, (uint)GetEffectValue(), new CastSpellExtraArgs(GetCastDifficulty()));
@@ -1002,7 +1002,7 @@ namespace Scripts.Spells.Priest
}
else
{
CastSpellExtraArgs args = new CastSpellExtraArgs(TriggerCastFlags.FullMask);
CastSpellExtraArgs args = new(TriggerCastFlags.FullMask);
args.CastDifficulty = GetCastDifficulty();
GetCaster().CastSpell(destPos, SpellIds.AngelicFeatherAreatrigger, args);
}
+6 -6
View File
@@ -1295,9 +1295,9 @@ namespace Scripts.Spells.Quest
{
Unit caster = GetCaster();
// Check for player that is in 65 y range
List<Unit> playerList = new List<Unit>();
AnyPlayerInObjectRangeCheck checker = new AnyPlayerInObjectRangeCheck(caster, 65.0f);
PlayerListSearcher searcher = new PlayerListSearcher(caster, playerList, checker);
List<Unit> playerList = new();
AnyPlayerInObjectRangeCheck checker = new(caster, 65.0f);
PlayerListSearcher searcher = new(caster, playerList, checker);
Cell.VisitWorldObjects(caster, searcher, 65.0f);
foreach (Player player in playerList)
{
@@ -1366,7 +1366,7 @@ namespace Scripts.Spells.Quest
void SetDest(ref SpellDestination dest)
{
// Adjust effect summon position
Position offset = new Position(0.0f, 0.0f, 20.0f, 0.0f);
Position offset = new(0.0f, 0.0f, 20.0f, 0.0f);
dest.RelocateOffset(offset);
}
@@ -1426,7 +1426,7 @@ namespace Scripts.Spells.Quest
void SetDest(ref SpellDestination dest)
{
// Adjust effect summon position
Position offset = new Position(0.0f, 0.0f, 20.0f, 0.0f);
Position offset = new(0.0f, 0.0f, 20.0f, 0.0f);
dest.RelocateOffset(offset);
}
@@ -1443,7 +1443,7 @@ namespace Scripts.Spells.Quest
void SetDest(ref SpellDestination dest)
{
// Adjust effect summon position
Position offset = new Position(0.0f, 0.0f, 2.5f, 0.0f);
Position offset = new(0.0f, 0.0f, 2.5f, 0.0f);
dest.RelocateOffset(offset);
}
+1 -1
View File
@@ -109,7 +109,7 @@ namespace Scripts.Spells.Rogue
_targets.Add(target.GetGUID());
}
List<ObjectGuid> _targets = new List<ObjectGuid>();
List<ObjectGuid> _targets = new();
}
[Script] // 2098 - Eviscerate
+4 -4
View File
@@ -278,7 +278,7 @@ namespace Scripts.Spells.Warlock
if (modOwner)
modOwner.ApplySpellMod(GetSpellInfo(), SpellModOp.PowerCost0, ref damage);
SpellNonMeleeDamage damageInfo = new SpellNonMeleeDamage(caster, caster, GetSpellInfo(), GetAura().GetSpellVisual(), GetSpellInfo().SchoolMask, GetAura().GetCastId());
SpellNonMeleeDamage damageInfo = new(caster, caster, GetSpellInfo(), GetAura().GetSpellVisual(), GetSpellInfo().SchoolMask, GetAura().GetCastId());
damageInfo.periodicLog = true;
damageInfo.damage = damage;
caster.DealSpellDamage(damageInfo, false);
@@ -473,7 +473,7 @@ namespace Scripts.Spells.Warlock
public List<uint> GetDotList() { return _dotList; }
public Unit GetOriginalSwapSource() { return _swapCaster; }
public void SetOriginalSwapSource(Unit victim) { _swapCaster = victim; }
List<uint> _dotList = new List<uint>();
List<uint> _dotList = new();
Unit _swapCaster;
}
@@ -547,7 +547,7 @@ namespace Scripts.Spells.Warlock
GetCaster().CastSpell(GetCaster(), SpellIds.SoulSwapModCost, true);
bool hasGlyph = GetCaster().HasAura(SpellIds.GlyphOfSoulSwap);
List<uint> dotList = new List<uint>();
List<uint> dotList = new();
Unit swapSource = null;
Aura swapOverride = GetCaster().GetAura(SpellIds.SoulSwapOverride);
if (swapOverride != null)
@@ -671,7 +671,7 @@ namespace Scripts.Spells.Warlock
void HandleDummyTick(AuraEffect aurEff)
{
List<AreaTrigger> rainOfFireAreaTriggers = GetTarget().GetAreaTriggers(SpellIds.RainOfFire);
List<ObjectGuid> targetsInRainOfFire = new List<ObjectGuid>();
List<ObjectGuid> targetsInRainOfFire = new();
foreach (AreaTrigger rainOfFireAreaTrigger in rainOfFireAreaTriggers)
{
+1 -1
View File
@@ -196,7 +196,7 @@ namespace Scripts.Spells.Warrior
{
float range = GetSpellInfo().GetMaxRange(true, GetCaster()) * 1.5f;
PathGenerator generatedPath = new PathGenerator(GetCaster());
PathGenerator generatedPath = new(GetCaster());
generatedPath.SetPathLengthLimit(range);
bool result = generatedPath.CalculatePath(dest.GetPositionX(), dest.GetPositionY(), dest.GetPositionZ(), false, true);
+2 -2
View File
@@ -139,8 +139,8 @@ namespace Scripts.World.Areatriggers
public const uint TypeWaypoint = 0;
public const uint DataStart = 0;
public static Position StormforgedMonitorPosition = new Position(6963.95f, 45.65f, 818.71f, 4.948f);
public static Position StormforgedEradictorPosition = new Position(6983.18f, 7.15f, 806.33f, 2.228f);
public static Position StormforgedMonitorPosition = new(6963.95f, 45.65f, 818.71f, 4.948f);
public static Position StormforgedEradictorPosition = new(6983.18f, 7.15f, 806.33f, 2.228f);
}
[Script]
+1 -1
View File
@@ -981,7 +981,7 @@ namespace Scripts.World.GameObjects
me.UseDoorOrButton();
if (player.GetQuestStatus(QuestIds.MissingFriends) == QuestStatus.Incomplete)
{
List<Creature> childrenList = new List<Creature>();
List<Creature> childrenList = new();
me.GetCreatureListWithEntryInGrid(childrenList, CreatureIds.CaptiveChild, SharedConst.InteractionDistance);
foreach (Creature creature in childrenList)
{
+2 -2
View File
@@ -188,7 +188,7 @@ namespace Scripts.World.ItemScripts
public override bool OnExpire(Player player, ItemTemplate pItemProto)
{
List<ItemPosCount> dest = new List<ItemPosCount>();
List<ItemPosCount> dest = new();
InventoryResult msg = player.CanStoreNewItem(ItemConst.NullBag, ItemConst.NullSlot, dest, 39883, 1); // Cracked Egg
if (msg == InventoryResult.Ok)
player.StoreNewItem(dest, 39883, true, ItemEnchantmentManager.GenerateItemRandomBonusListId(39883));
@@ -204,7 +204,7 @@ namespace Scripts.World.ItemScripts
public override bool OnExpire(Player player, ItemTemplate pItemProto)
{
List<ItemPosCount> dest = new List<ItemPosCount>();
List<ItemPosCount> dest = new();
InventoryResult msg = player.CanStoreNewItem(ItemConst.NullBag, ItemConst.NullSlot, dest, 44718, 1); // Ripe Disgusting Jar
if (msg == InventoryResult.Ok)
player.StoreNewItem(dest, 44718, true, ItemEnchantmentManager.GenerateItemRandomBonusListId(44718));
+9 -9
View File
@@ -234,7 +234,7 @@ namespace Scripts.World.NpcSpecial
public const uint StuffingServer = 61795;
public const uint TurkeyServer = 61796;
public const uint SweetPotatoesServer = 61797;
public static Dictionary<uint, uint> ChairSpells = new Dictionary<uint, uint>()
public static Dictionary<uint, uint> ChairSpells = new()
{
{ CreatureIds.TheCranberryChair, CranberryServer },
{ CreatureIds.ThePieChair, PieServer },
@@ -409,7 +409,7 @@ namespace Scripts.World.NpcSpecial
};
//alliance run to where
public static Position DoctorAllianceRunTo = new Position(-3742.96f, -4531.52f, 11.91f);
public static Position DoctorAllianceRunTo = new(-3742.96f, -4531.52f, 11.91f);
public static Position[] DoctorHordeCoords =
{
@@ -422,7 +422,7 @@ namespace Scripts.World.NpcSpecial
};
//horde run to where
public static Position DoctorHordeRunTo = new Position(-1016.44f, -3508.48f, 62.96f);
public static Position DoctorHordeRunTo = new(-1016.44f, -3508.48f, 62.96f);
public static uint[] AllianceSoldierId =
{
@@ -445,7 +445,7 @@ namespace Scripts.World.NpcSpecial
public const uint AnimGoLaunchFirework = 3;
public const uint ZoneMoonglade = 493;
public static Position omenSummonPos = new Position(7558.993f, -2839.999f, 450.0214f, 4.46f);
public static Position omenSummonPos = new(7558.993f, -2839.999f, 450.0214f, 4.46f);
public const uint AuraDurationTimeLeft = 5000;
@@ -761,7 +761,7 @@ namespace Scripts.World.NpcSpecial
ObjectGuid DoSearchForTargets(ObjectGuid lastTargetGUID)
{
List<Creature> targets = new List<Creature>();
List<Creature> targets = new();
me.GetCreatureListWithEntryInGrid(targets, CreatureIds.TorchTossingTargetBunny, 60.0f);
targets.RemoveAll(creature => creature.GetGUID() == lastTargetGUID);
@@ -854,7 +854,7 @@ namespace Scripts.World.NpcSpecial
bool checkNearbyPlayers()
{
// Returns true if no nearby player has aura "Test Ribbon Pole Channel".
List<Unit> players = new List<Unit>();
List<Unit> players = new();
var check = new UnitAuraCheck<Player>(true, SpellIds.RibbonDanceCosmetic);
var searcher = new PlayerListSearcher(me, players, check);
Cell.VisitWorldObjects(me, searcher, 10.0f);
@@ -1055,8 +1055,8 @@ namespace Scripts.World.NpcSpecial
bool Event;
List<ObjectGuid> Patients = new List<ObjectGuid>();
List<Position> Coordinates = new List<Position>();
List<ObjectGuid> Patients = new();
List<Position> Coordinates = new();
}
[Script]
@@ -2319,7 +2319,7 @@ namespace Scripts.World.NpcSpecial
break;
}
MoveSplineInit init = new MoveSplineInit(who);
MoveSplineInit init = new(who);
init.DisableTransportPathTransformations();
init.MoveTo(x, y, z, false);
init.SetFacing(o);