diff --git a/MHServerEmu.sln b/MHServerEmu.sln
index 0c0d0bb4..3df9624a 100644
--- a/MHServerEmu.sln
+++ b/MHServerEmu.sln
@@ -7,33 +7,18 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MHServerEmu", "src\MHServer
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LibGazillion", "src\LibGazillion\LibGazillion.csproj", "{7D085437-F307-49D6-AF7A-C3B3DF4E4189}"
EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8BA4E9E9-EB5F-4B6A-B9AB-7782E88B9598}"
- ProjectSection(SolutionItems) = preProject
- .editorconfig = .editorconfig
- EndProjectSection
-EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
- Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {F7898A66-82D6-45C2-A20A-E4C390567C39}.Debug|Any CPU.ActiveCfg = Debug|x64
- {F7898A66-82D6-45C2-A20A-E4C390567C39}.Debug|Any CPU.Build.0 = Debug|x64
{F7898A66-82D6-45C2-A20A-E4C390567C39}.Debug|x64.ActiveCfg = Debug|x64
{F7898A66-82D6-45C2-A20A-E4C390567C39}.Debug|x64.Build.0 = Debug|x64
- {F7898A66-82D6-45C2-A20A-E4C390567C39}.Release|Any CPU.ActiveCfg = Release|x64
- {F7898A66-82D6-45C2-A20A-E4C390567C39}.Release|Any CPU.Build.0 = Release|x64
{F7898A66-82D6-45C2-A20A-E4C390567C39}.Release|x64.ActiveCfg = Release|x64
{F7898A66-82D6-45C2-A20A-E4C390567C39}.Release|x64.Build.0 = Release|x64
- {7D085437-F307-49D6-AF7A-C3B3DF4E4189}.Debug|Any CPU.ActiveCfg = Debug|x64
- {7D085437-F307-49D6-AF7A-C3B3DF4E4189}.Debug|Any CPU.Build.0 = Debug|x64
{7D085437-F307-49D6-AF7A-C3B3DF4E4189}.Debug|x64.ActiveCfg = Debug|x64
{7D085437-F307-49D6-AF7A-C3B3DF4E4189}.Debug|x64.Build.0 = Debug|x64
- {7D085437-F307-49D6-AF7A-C3B3DF4E4189}.Release|Any CPU.ActiveCfg = Release|x64
- {7D085437-F307-49D6-AF7A-C3B3DF4E4189}.Release|Any CPU.Build.0 = Release|x64
{7D085437-F307-49D6-AF7A-C3B3DF4E4189}.Release|x64.ActiveCfg = Release|x64
{7D085437-F307-49D6-AF7A-C3B3DF4E4189}.Release|x64.Build.0 = Release|x64
EndGlobalSection
diff --git a/src/MHServerEmu/Auth/AuthServer.cs b/src/MHServerEmu/Auth/AuthServer.cs
index 1075afcf..97b06553 100644
--- a/src/MHServerEmu/Auth/AuthServer.cs
+++ b/src/MHServerEmu/Auth/AuthServer.cs
@@ -99,16 +99,9 @@ namespace MHServerEmu.Auth
HandleMessage(request, response);
return;
}
-
- // For Unit Tests
- if (requestIsFromGameClient && request.Url.LocalPath == "/")
- {
- HandleMessage(request, response);
- return;
- }
// Web API post requests
- if (requestIsFromGameClient == false && ConfigManager.Auth.EnableWebApi)
+ if (requestIsFromGameClient == false && ConfigManager.Auth.EnableWebApi)
{
HandleWebApiRequest(request, response);
return;
diff --git a/src/MHServerEmu/Common/Cryptography.cs b/src/MHServerEmu/Common/Cryptography.cs
index 68d9c764..107dd3c2 100644
--- a/src/MHServerEmu/Common/Cryptography.cs
+++ b/src/MHServerEmu/Common/Cryptography.cs
@@ -44,21 +44,14 @@ namespace MHServerEmu.Common
aesAlgorithm.Key = key;
aesAlgorithm.GenerateIV();
iv = aesAlgorithm.IV;
-
ICryptoTransform encryptor = aesAlgorithm.CreateEncryptor();
- byte[] encryptedData;
-
using (MemoryStream memoryStream = new())
+ using (CryptoStream cryptoStream = new(memoryStream, encryptor, CryptoStreamMode.Write))
{
- using (CryptoStream cryptoStream = new(memoryStream, encryptor, CryptoStreamMode.Write))
- {
- cryptoStream.Write(tokenToEncrypt, 0, tokenToEncrypt.Length);
- }
- encryptedData = memoryStream.ToArray();
+ cryptoStream.Write(tokenToEncrypt, 0, tokenToEncrypt.Length);
+ return memoryStream.ToArray();
}
-
- return encryptedData;
}
}
diff --git a/src/MHServerEmu/Common/Extensions/ArrayExtensions.cs b/src/MHServerEmu/Common/Extensions/ArrayExtensions.cs
index dc51a7fd..f86b871a 100644
--- a/src/MHServerEmu/Common/Extensions/ArrayExtensions.cs
+++ b/src/MHServerEmu/Common/Extensions/ArrayExtensions.cs
@@ -87,7 +87,7 @@ namespace MHServerEmu.Common.Extensions
return BitConverter.ToUInt64(bytes);
}
-
+
#endregion
#region Misc
diff --git a/src/MHServerEmu/Common/GRandom.cs b/src/MHServerEmu/Common/GRandom.cs
index 32017097..461329ff 100644
--- a/src/MHServerEmu/Common/GRandom.cs
+++ b/src/MHServerEmu/Common/GRandom.cs
@@ -178,7 +178,6 @@
{
return (max < min ? max : GetDouble() * (max - min) + min);
}
-
}
// More info on MWC random: https://en.wikipedia.org/wiki/Multiply-with-carry_pseudorandom_number_generator
diff --git a/src/MHServerEmu/Data/Account.db b/src/MHServerEmu/Data/Account.db
index 89771603..2fa5383e 100644
Binary files a/src/MHServerEmu/Data/Account.db and b/src/MHServerEmu/Data/Account.db differ
diff --git a/src/MHServerEmu/Frontend/FrontendClient.cs b/src/MHServerEmu/Frontend/FrontendClient.cs
index 63fd3b4e..6baee732 100644
--- a/src/MHServerEmu/Frontend/FrontendClient.cs
+++ b/src/MHServerEmu/Frontend/FrontendClient.cs
@@ -79,14 +79,9 @@ namespace MHServerEmu.Frontend
public void AssignSession(ClientSession session)
{
if (Session == null)
- {
Session = session;
-
- }
else
- {
Logger.Warn($"Failed to assign sessionId {session.Id} to a client: sessionId {Session.Id} is already assigned to this client");
- }
}
public void SendMuxDisconnect(ushort muxId)
@@ -107,20 +102,5 @@ namespace MHServerEmu.Frontend
packet.AddMessages(messages);
Connection.Send(packet);
}
-
- public void SendPacketFromFile(string fileName)
- {
- string path = Path.Combine(FileHelper.DataDirectory, "Packets", fileName);
-
- if (File.Exists(path))
- {
- Logger.Info($"Sending {fileName}");
- Connection.Send(File.ReadAllBytes(path));
- }
- else
- {
- Logger.Warn($"{fileName} not found");
- }
- }
}
}
diff --git a/src/MHServerEmu/PlayerManagement/Accounts/AccountCommands.cs b/src/MHServerEmu/PlayerManagement/Accounts/AccountCommands.cs
index bb7246c1..502b5764 100644
--- a/src/MHServerEmu/PlayerManagement/Accounts/AccountCommands.cs
+++ b/src/MHServerEmu/PlayerManagement/Accounts/AccountCommands.cs
@@ -108,13 +108,13 @@ namespace MHServerEmu.PlayerManagement.Accounts
if (client == null) return "You can only invoke this command from the game.";
StringBuilder sb = new();
- sb.Append($"Account Info:\n");
- sb.Append($"Email: {client.Session.Account.Email}\n");
- sb.Append($"PlayerName: {client.Session.Account.PlayerName}\n");
- sb.Append($"UserLevel: {client.Session.Account.UserLevel}\n");
- sb.Append($"IsBanned: {client.Session.Account.IsArchived}\n");
- sb.Append($"IsArchived: {client.Session.Account.IsArchived}\n");
- sb.Append($"IsPasswordExpired: {client.Session.Account.IsPasswordExpired}\n");
+ sb.AppendLine($"Account Info:");
+ sb.AppendLine($"Email: {client.Session.Account.Email}");
+ sb.AppendLine($"PlayerName: {client.Session.Account.PlayerName}");
+ sb.AppendLine($"UserLevel: {client.Session.Account.UserLevel}");
+ sb.AppendLine($"IsBanned: {client.Session.Account.IsArchived}");
+ sb.AppendLine($"IsArchived: {client.Session.Account.IsArchived}");
+ sb.Append($"IsPasswordExpired: {client.Session.Account.IsPasswordExpired}");
return sb.ToString();
}
}
diff --git a/src/MHServerEmu/PlayerManagement/Accounts/DBManager.cs b/src/MHServerEmu/PlayerManagement/Accounts/DBManager.cs
index 7b0e4257..d67c68c0 100644
--- a/src/MHServerEmu/PlayerManagement/Accounts/DBManager.cs
+++ b/src/MHServerEmu/PlayerManagement/Accounts/DBManager.cs
@@ -6,6 +6,9 @@ using MHServerEmu.PlayerManagement.Accounts.DBModels;
namespace MHServerEmu.PlayerManagement.Accounts
{
+ ///
+ /// Provides access to the account database.
+ ///
public static class DBManager
{
private static readonly Logger Logger = LogManager.CreateLogger();
@@ -29,11 +32,8 @@ namespace MHServerEmu.PlayerManagement.Accounts
#region Queries
///
- /// Queries an account from the database by its email.
+ /// Queries a from the database by its email.
///
- /// Email to query.
- /// Account or null.
- /// IsSuccess
public static bool TryQueryAccountByEmail(string email, out DBAccount account)
{
using (SQLiteConnection connection = new(ConnectionString))
@@ -57,8 +57,6 @@ namespace MHServerEmu.PlayerManagement.Accounts
///
/// Queries if the specified player name is already taken.
///
- /// Name to check.
- /// IsTaken
public static bool QueryIsPlayerNameTaken(string playerName)
{
using (SQLiteConnection connection = new(ConnectionString))
@@ -74,10 +72,8 @@ namespace MHServerEmu.PlayerManagement.Accounts
#region Executes
///
- /// Inserts a new account with all of its data into the database.
+ /// Inserts a new with all of its data into the database.
///
- /// Account to insert.
- /// IsSuccess
public static bool InsertAccount(DBAccount account)
{
using (SQLiteConnection connection = new(ConnectionString))
@@ -92,8 +88,8 @@ namespace MHServerEmu.PlayerManagement.Accounts
connection.Execute(@"INSERT INTO Account (Id, Email, PlayerName, PasswordHash, Salt, UserLevel, IsBanned, IsArchived, IsPasswordExpired)
VALUES (@Id, @Email, @PlayerName, @PasswordHash, @Salt, @UserLevel, @IsBanned, @IsArchived, @IsPasswordExpired)", account, transaction);
- connection.Execute(@"INSERT INTO Player (AccountId, RawRegion, RawAvatar, RawWaypoint, RawAOIVolume)
- VALUES (@AccountId, @RawRegion, @RawAvatar, @RawWaypoint, @RawAOIVolume)", account.Player, transaction);
+ connection.Execute(@"INSERT INTO Player (AccountId, RawRegion, RawAvatar, RawWaypoint, AOIVolume)
+ VALUES (@AccountId, @RawRegion, @RawAvatar, @RawWaypoint, @AOIVolume)", account.Player, transaction);
connection.Execute(@"INSERT INTO Avatar (AccountId, RawPrototype, RawCostume)
VALUES (@AccountId, @RawPrototype, @RawCostume)", account.Avatars, transaction);
@@ -112,10 +108,8 @@ namespace MHServerEmu.PlayerManagement.Accounts
}
///
- /// Updates the Account table in the database with the provided account.
+ /// Updates the Account table in the database with the provided .
///
- /// Account to update.
- /// IsSuccess
public static bool UpdateAccount(DBAccount account)
{
using (SQLiteConnection connection = new(ConnectionString))
@@ -135,10 +129,8 @@ namespace MHServerEmu.PlayerManagement.Accounts
}
///
- /// Updates the Player and Avatar tables in the database with the data from the provided account.
+ /// Updates the Player and Avatar tables in the database with the data from the provided .
///
- ///
- /// IsSuccess
public static bool UpdateAccountData(DBAccount account)
{
using (SQLiteConnection connection = new(ConnectionString))
@@ -150,7 +142,7 @@ namespace MHServerEmu.PlayerManagement.Accounts
{
try
{
- connection.Execute(@"UPDATE Player SET RawRegion=@RawRegion, RawAvatar=@RawAvatar, RawWaypoint=@RawWaypoint, RawAOIVolume=@RawAOIVolume WHERE AccountId=@AccountId", account.Player, transaction);
+ connection.Execute(@"UPDATE Player SET RawRegion=@RawRegion, RawAvatar=@RawAvatar, RawWaypoint=@RawWaypoint, AOIVolume=@AOIVolume WHERE AccountId=@AccountId", account.Player, transaction);
connection.Execute(@"UPDATE Avatar SET RawCostume=@RawCostume WHERE AccountId=@AccountId AND RawPrototype=@RawPrototype", account.Avatars, transaction);
transaction.Commit();
@@ -186,10 +178,8 @@ namespace MHServerEmu.PlayerManagement.Accounts
#endregion
///
- /// Loads account data for the specified account and maps relations.
+ /// Loads account data for the specified and maps relations.
///
- /// Database connection for querying.
- /// Account to get data for.
private static void LoadAccountData(SQLiteConnection connection, DBAccount account)
{
var @params = new { AccountId = account.Id };
diff --git a/src/MHServerEmu/PlayerManagement/Accounts/DBModels/DBAccount.cs b/src/MHServerEmu/PlayerManagement/Accounts/DBModels/DBAccount.cs
index 9bdb1b4a..fc727ab6 100644
--- a/src/MHServerEmu/PlayerManagement/Accounts/DBModels/DBAccount.cs
+++ b/src/MHServerEmu/PlayerManagement/Accounts/DBModels/DBAccount.cs
@@ -5,6 +5,9 @@ using MHServerEmu.Games.Regions;
namespace MHServerEmu.PlayerManagement.Accounts.DBModels
{
+ ///
+ /// Represents an account stored in the account database.
+ ///
public class DBAccount
{
public ulong Id { get; set; }
diff --git a/src/MHServerEmu/PlayerManagement/Accounts/DBModels/DBAvatar.cs b/src/MHServerEmu/PlayerManagement/Accounts/DBModels/DBAvatar.cs
index 4cbaea04..974542c5 100644
--- a/src/MHServerEmu/PlayerManagement/Accounts/DBModels/DBAvatar.cs
+++ b/src/MHServerEmu/PlayerManagement/Accounts/DBModels/DBAvatar.cs
@@ -2,6 +2,9 @@
namespace MHServerEmu.PlayerManagement.Accounts.DBModels
{
+ ///
+ /// Represents an avatar entity stored in the account database.
+ ///
public class DBAvatar
{
// We are currently using System.Data.SQLite + Dapper for storing our persistent data.
diff --git a/src/MHServerEmu/PlayerManagement/Accounts/DBModels/DBPlayer.cs b/src/MHServerEmu/PlayerManagement/Accounts/DBModels/DBPlayer.cs
index e68ad9e3..2d16349b 100644
--- a/src/MHServerEmu/PlayerManagement/Accounts/DBModels/DBPlayer.cs
+++ b/src/MHServerEmu/PlayerManagement/Accounts/DBModels/DBPlayer.cs
@@ -4,6 +4,9 @@ using MHServerEmu.Games.Regions;
namespace MHServerEmu.PlayerManagement.Accounts.DBModels
{
+ ///
+ /// Represents a player entity stored in the account database.
+ ///
public class DBPlayer
{
// We are currently using System.Data.SQLite + Dapper for storing our persistent data.
@@ -24,8 +27,9 @@ namespace MHServerEmu.PlayerManagement.Accounts.DBModels
public long RawAvatar { get => (long)Avatar; private set => Avatar = (AvatarPrototypeId)value; }
public PrototypeId Waypoint { get; set; }
public long RawWaypoint { get => (long)Waypoint; private set => Waypoint = (PrototypeId)value; }
+
public int AOIVolume { get; set; }
- public int RawAOIVolume { get => AOIVolume; private set => AOIVolume = value; }
+
public DBPlayer(ulong accountId)
{
AccountId = accountId;