Core: SOme code cleanup, more to follow.

This commit is contained in:
hondacrx
2021-03-20 22:48:48 -04:00
parent 62f554f2e0
commit 62ec699ec6
318 changed files with 5080 additions and 5125 deletions
+4 -4
View File
@@ -51,7 +51,7 @@ namespace Game
uint burstSize;
while (sizeLeft > 0)
{
WardenModuleTransfer transfer = new WardenModuleTransfer();
WardenModuleTransfer transfer = new();
burstSize = sizeLeft < 500 ? sizeLeft : 500u;
transfer.Command = WardenOpcodes.Smsg_ModuleCache;
@@ -60,7 +60,7 @@ namespace Game
sizeLeft -= burstSize;
pos += (int)burstSize;
Warden3DataServer packet = new Warden3DataServer();
Warden3DataServer packet = new();
packet.Data = EncryptData(transfer.Write());
_session.SendPacket(packet);
}
@@ -71,14 +71,14 @@ namespace Game
Log.outDebug(LogFilter.Warden, "Request module");
// Create packet structure
WardenModuleUse request = new WardenModuleUse();
WardenModuleUse request = new();
request.Command = WardenOpcodes.Smsg_ModuleUse;
request.ModuleId = _module.Id;
request.ModuleKey = _module.Key;
request.Size = _module.CompressedSize;
Warden3DataServer packet = new Warden3DataServer();
Warden3DataServer packet = new();
packet.Data = EncryptData(request.Write());
_session.SendPacket(packet);
}
+6 -6
View File
@@ -58,7 +58,7 @@ namespace Game
string str = result.Read<string>(6);
string comment = result.Read<string>(7);
WardenCheck wardenCheck = new WardenCheck();
WardenCheck wardenCheck = new();
wardenCheck.Type = checkType;
wardenCheck.CheckId = id;
@@ -87,7 +87,7 @@ namespace Game
if (checkType == WardenCheckType.MPQ || checkType == WardenCheckType.Memory)
{
BigInteger Result = new BigInteger(checkResult.ToByteArray());
BigInteger Result = new(checkResult.ToByteArray());
CheckResultStore[id] = Result;
}
@@ -158,10 +158,10 @@ namespace Game
return CheckResultStore.LookupByKey(Id);
}
public List<ushort> MemChecksIdPool = new List<ushort>();
public List<ushort> OtherChecksIdPool = new List<ushort>();
List<WardenCheck> CheckStore = new List<WardenCheck>();
Dictionary<uint, BigInteger> CheckResultStore = new Dictionary<uint, BigInteger>();
public List<ushort> MemChecksIdPool = new();
public List<ushort> OtherChecksIdPool = new();
List<WardenCheck> CheckStore = new();
Dictionary<uint, BigInteger> CheckResultStore = new();
}
public enum WardenActions
+12 -12
View File
@@ -32,7 +32,7 @@ namespace Game
{
_session = session;
// Generate Warden Key
SHA1Randx WK = new SHA1Randx(k.ToByteArray());
SHA1Randx WK = new(k.ToByteArray());
WK.Generate(_inputKey, 16);
WK.Generate(_outputKey, 16);
@@ -55,7 +55,7 @@ namespace Game
public override ClientWardenModule GetModuleForClient()
{
ClientWardenModule mod = new ClientWardenModule();
ClientWardenModule mod = new();
uint length = (uint)WardenModuleWin.Module.Length;
@@ -78,7 +78,7 @@ namespace Game
Log.outDebug(LogFilter.Warden, "Initialize module");
// Create packet structure
WardenInitModuleRequest Request = new WardenInitModuleRequest();
WardenInitModuleRequest Request = new();
Request.Command1 = WardenOpcodes.Smsg_ModuleInitialize;
Request.Size1 = 20;
Request.Unk1 = 1;
@@ -109,7 +109,7 @@ namespace Game
Request.Function3_set = 1;
Request.CheckSumm3 = BuildChecksum(BitConverter.GetBytes(Request.Unk5), 8);
Warden3DataServer packet = new Warden3DataServer();
Warden3DataServer packet = new();
packet.Data = EncryptData(Request.Write());
_session.SendPacket(packet);
}
@@ -119,11 +119,11 @@ namespace Game
Log.outDebug(LogFilter.Warden, "Request hash");
// Create packet structure
WardenHashRequest Request = new WardenHashRequest();
WardenHashRequest Request = new();
Request.Command = WardenOpcodes.Smsg_HashRequest;
Request.Seed = _seed;
Warden3DataServer packet = new Warden3DataServer();
Warden3DataServer packet = new();
packet.Data = EncryptData(Request.Write());
_session.SendPacket(packet);
}
@@ -184,7 +184,7 @@ namespace Game
_currentChecks.Add(id);
}
ByteBuffer buffer = new ByteBuffer();
ByteBuffer buffer = new();
buffer.WriteUInt8((byte)WardenOpcodes.Smsg_CheatChecksRequest);
for (uint i = 0; i < WorldConfig.GetUIntValue(WorldCfg.WardenNumOtherChecks); ++i)
@@ -262,7 +262,7 @@ namespace Game
{
uint seed = RandomHelper.Rand32();
buffer.WriteUInt32(seed);
HmacHash hmac = new HmacHash(BitConverter.GetBytes(seed));
HmacHash hmac = new(BitConverter.GetBytes(seed));
hmac.Finish(wd.Str);
buffer.WriteBytes(hmac.Digest);
break;
@@ -282,7 +282,7 @@ namespace Game
}
buffer.WriteUInt8(xorByte);
Warden3DataServer packet = new Warden3DataServer();
Warden3DataServer packet = new();
packet.Data = EncryptData(buffer.GetData());
_session.SendPacket(packet);
@@ -448,8 +448,8 @@ namespace Game
}
uint _serverTicks;
List<ushort> _otherChecksTodo = new List<ushort>();
List<ushort> _memChecksTodo = new List<ushort>();
List<ushort> _currentChecks = new List<ushort>();
List<ushort> _otherChecksTodo = new();
List<ushort> _memChecksTodo = new();
List<ushort> _currentChecks = new();
}
}