From 149fadccab19ec9178012029be5dfe1d7862b9de Mon Sep 17 00:00:00 2001 From: hondacrx Date: Sat, 4 Feb 2023 20:55:14 -0500 Subject: [PATCH] Make PreparedStatements static for each database. --- Source/BNetServer/Networking/RestSession.cs | 12 +- .../Networking/Services/Authentication.cs | 8 +- .../Networking/Services/GameUtilities.cs | 2 +- Source/BNetServer/Networking/Session.cs | 4 +- Source/BNetServer/Server.cs | 6 +- Source/Framework/Database/MySqlBase.cs | 7 +- Source/Framework/Logging/Appender.cs | 2 +- Source/Framework/Realm/RealmManager.cs | 4 +- Source/Game/AI/SmartScripts/SmartAIManager.cs | 4 +- Source/Game/Accounts/AccountManager.cs | 58 +-- Source/Game/Accounts/BNetAccountManager.cs | 20 +- Source/Game/Accounts/RoleAccessControl.cs | 8 +- .../Game/Achievements/AchievementManager.cs | 30 +- Source/Game/Arenas/ArenaTeam.cs | 26 +- Source/Game/AuctionHouse/AuctionManager.cs | 24 +- Source/Game/BattleGrounds/BattleGround.cs | 6 +- Source/Game/BattlePets/BattlePetManager.cs | 18 +- Source/Game/BlackMarket/BlackMarketEntry.cs | 6 +- Source/Game/BlackMarket/BlackMarketManager.cs | 2 +- Source/Game/Calendar/CalendarManager.cs | 10 +- Source/Game/Chat/Channels/Channel.cs | 4 +- Source/Game/Chat/Channels/ChannelManager.cs | 4 +- Source/Game/Chat/CommandManager.cs | 2 +- Source/Game/Chat/Commands/AccountCommands.cs | 28 +- .../Game/Chat/Commands/BNetAccountCommands.cs | 4 +- Source/Game/Chat/Commands/BanCommands.cs | 20 +- .../Game/Chat/Commands/CharacterCommands.cs | 28 +- Source/Game/Chat/Commands/DisableCommands.cs | 8 +- Source/Game/Chat/Commands/GMCommands.cs | 2 +- .../Game/Chat/Commands/GameObjectCommands.cs | 2 +- Source/Game/Chat/Commands/GroupCommands.cs | 2 +- Source/Game/Chat/Commands/LFGCommands.cs | 2 +- Source/Game/Chat/Commands/ListCommands.cs | 22 +- Source/Game/Chat/Commands/LookupCommands.cs | 8 +- Source/Game/Chat/Commands/MessageCommands.cs | 4 +- Source/Game/Chat/Commands/MiscCommands.cs | 30 +- Source/Game/Chat/Commands/NPCCommands.cs | 16 +- Source/Game/Chat/Commands/ReloadCommand.cs | 2 +- Source/Game/Chat/Commands/ResetCommands.cs | 6 +- Source/Game/Chat/Commands/TeleCommands.cs | 2 +- Source/Game/Chat/Commands/WPCommands.cs | 70 ++-- .../DataStorage/ClientReader/DB6Storage.cs | 4 +- Source/Game/DungeonFinding/LFGManager.cs | 4 +- Source/Game/Entities/Corpse.cs | 12 +- Source/Game/Entities/Creature/Creature.cs | 22 +- Source/Game/Entities/GameObject/GameObject.cs | 18 +- .../Entities/Item/AzeriteEmpoweredItem.cs | 8 +- Source/Game/Entities/Item/AzeriteItem.cs | 20 +- Source/Game/Entities/Item/Item.cs | 62 ++-- Source/Game/Entities/Pet.cs | 48 +-- .../Game/Entities/Player/CollectionManager.cs | 14 +- .../Game/Entities/Player/PetitionManager.cs | 16 +- Source/Game/Entities/Player/Player.DB.cs | 340 +++++++++--------- Source/Game/Entities/Player/Player.Items.cs | 4 +- Source/Game/Entities/Player/Player.PvP.cs | 2 +- Source/Game/Entities/Player/Player.Talents.cs | 4 +- Source/Game/Entities/Player/Player.cs | 8 +- Source/Game/Entities/Player/SocialMgr.cs | 10 +- Source/Game/Events/GameEventManager.cs | 12 +- Source/Game/Garrisons/Garrisons.cs | 18 +- Source/Game/Globals/ObjectManager.cs | 42 +-- Source/Game/Groups/Group.cs | 36 +- Source/Game/Guilds/Guild.cs | 96 ++--- Source/Game/Guilds/GuildManager.cs | 10 +- Source/Game/Handlers/AuctionHandler.cs | 10 +- Source/Game/Handlers/CharacterHandler.cs | 242 ++++++------- Source/Game/Handlers/ItemHandler.cs | 2 +- Source/Game/Handlers/MailHandler.cs | 6 +- Source/Game/Handlers/NPCHandler.cs | 4 +- Source/Game/Handlers/PetHandler.cs | 6 +- Source/Game/Handlers/SocialHandler.cs | 2 +- Source/Game/Handlers/SpellHandler.cs | 4 +- Source/Game/Handlers/TicketHandler.cs | 2 +- Source/Game/Loot/LootItemStorage.cs | 20 +- Source/Game/Mails/MailDraft.cs | 6 +- .../Maps/Instances/InstanceLockManager.cs | 14 +- Source/Game/Maps/Map.cs | 16 +- Source/Game/Movement/WaypointManager.cs | 2 +- Source/Game/Networking/RASocket.cs | 6 +- Source/Game/Networking/WorldSocket.cs | 14 +- Source/Game/Pools/QuestPools.cs | 6 +- .../Quest/QuestObjectiveCriteriaManager.cs | 14 +- Source/Game/Reputation/ReputationManager.cs | 4 +- Source/Game/Server/WorldSession.cs | 30 +- Source/Game/Spells/SpellHistory.cs | 16 +- Source/Game/SupportSystem/SupportManager.cs | 16 +- Source/Game/SupportSystem/SupportTickets.cs | 16 +- Source/Game/Text/CreatureTextManager.cs | 2 +- Source/Game/World/WorldManager.cs | 50 +-- Source/Game/World/WorldStateManager.cs | 2 +- 90 files changed, 922 insertions(+), 923 deletions(-) diff --git a/Source/BNetServer/Networking/RestSession.cs b/Source/BNetServer/Networking/RestSession.cs index ba9b1ef4b..87d18d5ed 100644 --- a/Source/BNetServer/Networking/RestSession.cs +++ b/Source/BNetServer/Networking/RestSession.cs @@ -72,7 +72,7 @@ namespace BNetServer.Networking } } - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.SelBnetAuthentication); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.SelBnetAuthentication); stmt.AddValue(0, login); SQLResult result = DB.Login.Query(stmt); @@ -93,7 +93,7 @@ namespace BNetServer.Networking loginTicket = "TC-" + ticket.ToHexString(); } - stmt = DB.Login.GetPreparedStatement(LoginStatements.UpdBnetAuthentication); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.UpdBnetAuthentication); stmt.AddValue(0, loginTicket); stmt.AddValue(1, Time.UnixTime + 3600); stmt.AddValue(2, accountId); @@ -111,7 +111,7 @@ namespace BNetServer.Networking if (maxWrongPassword != 0) { SQLTransaction trans = new(); - stmt = DB.Login.GetPreparedStatement(LoginStatements.UpdBnetFailedLogins); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.UpdBnetFailedLogins); stmt.AddValue(0, accountId); trans.Append(stmt); @@ -126,19 +126,19 @@ namespace BNetServer.Networking if (banType == BanMode.Account) { - stmt = DB.Login.GetPreparedStatement(LoginStatements.InsBnetAccountAutoBanned); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.InsBnetAccountAutoBanned); stmt.AddValue(0, accountId); } else { - stmt = DB.Login.GetPreparedStatement(LoginStatements.InsIpAutoBanned); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.InsIpAutoBanned); stmt.AddValue(0, request.Host); } stmt.AddValue(1, banTime); trans.Append(stmt); - stmt = DB.Login.GetPreparedStatement(LoginStatements.UpdBnetResetFailedLogins); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.UpdBnetResetFailedLogins); stmt.AddValue(0, accountId); trans.Append(stmt); } diff --git a/Source/BNetServer/Networking/Services/Authentication.cs b/Source/BNetServer/Networking/Services/Authentication.cs index f2cb23c3b..8a84a8fae 100644 --- a/Source/BNetServer/Networking/Services/Authentication.cs +++ b/Source/BNetServer/Networking/Services/Authentication.cs @@ -55,7 +55,7 @@ namespace BNetServer.Networking if (verifyWebCredentialsRequest.WebCredentials.IsEmpty) return BattlenetRpcErrorCode.Denied; - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.SelBnetAccountInfo); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.SelBnetAccountInfo); stmt.AddValue(0, verifyWebCredentialsRequest.WebCredentials.ToStringUtf8()); SQLResult result = DB.Login.Query(stmt); @@ -67,7 +67,7 @@ namespace BNetServer.Networking if (accountInfo.LoginTicketExpiry < Time.UnixTime) return BattlenetRpcErrorCode.TimedOut; - stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_BNET_CHARACTER_COUNTS_BY_BNET_ID); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.SEL_BNET_CHARACTER_COUNTS_BY_BNET_ID); stmt.AddValue(0, accountInfo.Id); SQLResult characterCountsResult = DB.Login.Query(stmt); @@ -81,7 +81,7 @@ namespace BNetServer.Networking } while (characterCountsResult.NextRow()); } - stmt = DB.Login.GetPreparedStatement(LoginStatements.SelBnetLastPlayerCharacters); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.SelBnetLastPlayerCharacters); stmt.AddValue(0, accountInfo.Id); SQLResult lastPlayerCharactersResult = DB.Login.Query(stmt); @@ -177,7 +177,7 @@ namespace BNetServer.Networking return BattlenetRpcErrorCode.BadProgram; } - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_BNET_EXISTING_AUTHENTICATION_BY_ID); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.SEL_BNET_EXISTING_AUTHENTICATION_BY_ID); stmt.AddValue(0, accountInfo.Id); queryProcessor.AddCallback(DB.Login.AsyncQuery(stmt).WithCallback(result => diff --git a/Source/BNetServer/Networking/Services/GameUtilities.cs b/Source/BNetServer/Networking/Services/GameUtilities.cs index 3b0b131f0..dbb456814 100644 --- a/Source/BNetServer/Networking/Services/GameUtilities.cs +++ b/Source/BNetServer/Networking/Services/GameUtilities.cs @@ -108,7 +108,7 @@ namespace BNetServer.Networking if (!clientInfoOk) return BattlenetRpcErrorCode.WowServicesDeniedRealmListTicket; - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.UpdBnetLastLoginInfo); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.UpdBnetLastLoginInfo); stmt.AddValue(0, GetRemoteIpEndPoint().ToString()); stmt.AddValue(1, (byte)locale.ToEnum()); stmt.AddValue(2, os); diff --git a/Source/BNetServer/Networking/Session.cs b/Source/BNetServer/Networking/Session.cs index 3b848629f..0525dc75d 100644 --- a/Source/BNetServer/Networking/Session.cs +++ b/Source/BNetServer/Networking/Session.cs @@ -45,9 +45,9 @@ namespace BNetServer.Networking Log.outInfo(LogFilter.Network, $"{GetClientInfo()} Connection Accepted."); // Verify that this IP is not in the ip_banned table - DB.Login.Execute(DB.Login.GetPreparedStatement(LoginStatements.DelExpiredIpBans)); + DB.Login.Execute(LoginDatabase.GetPreparedStatement(LoginStatements.DelExpiredIpBans)); - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.SelIpInfo); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.SelIpInfo); stmt.AddValue(0, ipAddress); stmt.AddValue(1, BitConverter.ToUInt32(GetRemoteIpEndPoint().Address.GetAddressBytes(), 0)); diff --git a/Source/BNetServer/Server.cs b/Source/BNetServer/Server.cs index 4ced36d5d..28f169989 100644 --- a/Source/BNetServer/Server.cs +++ b/Source/BNetServer/Server.cs @@ -89,9 +89,9 @@ namespace BNetServer static void BanExpiryCheckTimer_Elapsed(object sender, ElapsedEventArgs e) { - DB.Login.Execute(DB.Login.GetPreparedStatement(LoginStatements.DelExpiredIpBans)); - DB.Login.Execute(DB.Login.GetPreparedStatement(LoginStatements.UpdExpiredAccountBans)); - DB.Login.Execute(DB.Login.GetPreparedStatement(LoginStatements.DelBnetExpiredAccountBanned)); + DB.Login.Execute(LoginDatabase.GetPreparedStatement(LoginStatements.DelExpiredIpBans)); + DB.Login.Execute(LoginDatabase.GetPreparedStatement(LoginStatements.UpdExpiredAccountBans)); + DB.Login.Execute(LoginDatabase.GetPreparedStatement(LoginStatements.DelBnetExpiredAccountBanned)); } static Timer _banExpiryCheckTimer; diff --git a/Source/Framework/Database/MySqlBase.cs b/Source/Framework/Database/MySqlBase.cs index 3c1f4037f..fffccaa92 100644 --- a/Source/Framework/Database/MySqlBase.cs +++ b/Source/Framework/Database/MySqlBase.cs @@ -80,13 +80,12 @@ namespace Framework.Database public abstract class MySqlBase { - Dictionary _preparedQueries = new(); - ProducerConsumerQueue _queue = new(); + static Dictionary _preparedQueries = new(); + ProducerConsumerQueue _queue = new(); MySqlConnectionInfo _connectionInfo; DatabaseUpdater _updater; DatabaseWorker _worker; - DBVersion version; public MySqlErrorCode Initialize(MySqlConnectionInfo connectionInfo) @@ -225,7 +224,7 @@ namespace Framework.Database _preparedQueries[statement] = sb.ToString(); } - public PreparedStatement GetPreparedStatement(T statement) + public static PreparedStatement GetPreparedStatement(T statement) { return new PreparedStatement(_preparedQueries[statement]); } diff --git a/Source/Framework/Logging/Appender.cs b/Source/Framework/Logging/Appender.cs index 866c29360..ccadcab55 100644 --- a/Source/Framework/Logging/Appender.cs +++ b/Source/Framework/Logging/Appender.cs @@ -124,7 +124,7 @@ class DBAppender : Appender if (!enabled || message.type == LogFilter.Sql) return; - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.INS_LOG); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.INS_LOG); stmt.AddValue(0, Time.DateTimeToUnixTime(message.mtime)); stmt.AddValue(1, realmId); stmt.AddValue(2, message.type.ToString()); diff --git a/Source/Framework/Realm/RealmManager.cs b/Source/Framework/Realm/RealmManager.cs index 36f1e4a1b..eacaafe34 100644 --- a/Source/Framework/Realm/RealmManager.cs +++ b/Source/Framework/Realm/RealmManager.cs @@ -76,7 +76,7 @@ public class RealmManager : Singleton void UpdateRealms(object source, ElapsedEventArgs e) { - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_REALMLIST); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.SEL_REALMLIST); SQLResult result = DB.Login.Query(stmt); Dictionary existingRealms = new(); foreach (var p in _realms) @@ -280,7 +280,7 @@ public class RealmManager : Singleton byte[] serverSecret = new byte[0].GenerateRandomKey(32); byte[] keyData = clientSecret.ToArray().Combine(serverSecret); - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.UPD_BNET_GAME_ACCOUNT_LOGIN_INFO); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.UPD_BNET_GAME_ACCOUNT_LOGIN_INFO); stmt.AddValue(0, keyData); stmt.AddValue(1, clientAddress.ToString()); stmt.AddValue(2, (byte)locale); diff --git a/Source/Game/AI/SmartScripts/SmartAIManager.cs b/Source/Game/AI/SmartScripts/SmartAIManager.cs index fa3a4d656..029cf6bb4 100644 --- a/Source/Game/AI/SmartScripts/SmartAIManager.cs +++ b/Source/Game/AI/SmartScripts/SmartAIManager.cs @@ -33,7 +33,7 @@ namespace Game.AI for (byte i = 0; i < (int)SmartScriptType.Max; i++) _eventMap[i].Clear(); //Drop Existing SmartAI List - PreparedStatement stmt = DB.World.GetPreparedStatement(WorldStatements.SEL_SMART_SCRIPTS); + PreparedStatement stmt = WorldDatabase.GetPreparedStatement(WorldStatements.SEL_SMART_SCRIPTS); SQLResult result = DB.World.Query(stmt); if (result.IsEmpty()) { @@ -318,7 +318,7 @@ namespace Game.AI _waypointStore.Clear(); - PreparedStatement stmt = DB.World.GetPreparedStatement(WorldStatements.SEL_SMARTAI_WP); + PreparedStatement stmt = WorldDatabase.GetPreparedStatement(WorldStatements.SEL_SMARTAI_WP); SQLResult result = DB.World.Query(stmt); if (result.IsEmpty()) diff --git a/Source/Game/Accounts/AccountManager.cs b/Source/Game/Accounts/AccountManager.cs index 2fc4dc352..d6f3f505c 100644 --- a/Source/Game/Accounts/AccountManager.cs +++ b/Source/Game/Accounts/AccountManager.cs @@ -36,7 +36,7 @@ namespace Game (byte[] salt, byte[] verifier) = SRP6.MakeRegistrationData(username, password); - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.INS_ACCOUNT); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.INS_ACCOUNT); stmt.AddValue(0, username); stmt.AddValue(1, salt); stmt.AddValue(2, verifier); @@ -54,7 +54,7 @@ namespace Game } DB.Login.DirectExecute(stmt); // Enforce saving, otherwise AddGroup can fail - stmt = DB.Login.GetPreparedStatement(LoginStatements.INS_REALM_CHARACTERS_INIT); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.INS_REALM_CHARACTERS_INIT); DB.Login.Execute(stmt); return AccountOpResult.Ok; @@ -63,14 +63,14 @@ namespace Game public AccountOpResult DeleteAccount(uint accountId) { // Check if accounts exists - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_ACCOUNT_BY_ID); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.SEL_ACCOUNT_BY_ID); stmt.AddValue(0, accountId); SQLResult result = DB.Login.Query(stmt); if (result.IsEmpty()) return AccountOpResult.NameNotExist; // Obtain accounts characters - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHARS_BY_ACCOUNT_ID); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHARS_BY_ACCOUNT_ID); stmt.AddValue(0, accountId); result = DB.Characters.Query(stmt); if (!result.IsEmpty()) @@ -93,37 +93,37 @@ namespace Game } // table realm specific but common for all characters of account for realm - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_TUTORIALS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_TUTORIALS); stmt.AddValue(0, accountId); DB.Characters.Execute(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ACCOUNT_DATA); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ACCOUNT_DATA); stmt.AddValue(0, accountId); DB.Characters.Execute(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHARACTER_BAN); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHARACTER_BAN); stmt.AddValue(0, accountId); DB.Characters.Execute(stmt); SQLTransaction trans = new(); - stmt = DB.Login.GetPreparedStatement(LoginStatements.DEL_ACCOUNT); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.DEL_ACCOUNT); stmt.AddValue(0, accountId); trans.Append(stmt); - stmt = DB.Login.GetPreparedStatement(LoginStatements.DEL_ACCOUNT_ACCESS); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.DEL_ACCOUNT_ACCESS); stmt.AddValue(0, accountId); trans.Append(stmt); - stmt = DB.Login.GetPreparedStatement(LoginStatements.DEL_REALM_CHARACTERS); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.DEL_REALM_CHARACTERS); stmt.AddValue(0, accountId); trans.Append(stmt); - stmt = DB.Login.GetPreparedStatement(LoginStatements.DEL_ACCOUNT_BANNED); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.DEL_ACCOUNT_BANNED); stmt.AddValue(0, accountId); trans.Append(stmt); - stmt = DB.Login.GetPreparedStatement(LoginStatements.DEL_ACCOUNT_MUTED); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.DEL_ACCOUNT_MUTED); stmt.AddValue(0, accountId); trans.Append(stmt); @@ -135,7 +135,7 @@ namespace Game public AccountOpResult ChangeUsername(uint accountId, string newUsername, string newPassword) { // Check if accounts exists - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_ACCOUNT_BY_ID); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.SEL_ACCOUNT_BY_ID); stmt.AddValue(0, accountId); SQLResult result = DB.Login.Query(stmt); if (result.IsEmpty()) @@ -147,13 +147,13 @@ namespace Game if (newPassword.Length > MaxAccountLength) return AccountOpResult.PassTooLong; - stmt = DB.Login.GetPreparedStatement(LoginStatements.UPD_USERNAME); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.UPD_USERNAME); stmt.AddValue(0, newUsername); stmt.AddValue(1, accountId); DB.Login.Execute(stmt); (byte[] salt, byte[] verifier) = SRP6.MakeRegistrationData(newUsername, newPassword); - stmt = DB.Login.GetPreparedStatement(LoginStatements.UPD_LOGON); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.UPD_LOGON); stmt.AddValue(0, salt); stmt.AddValue(1, verifier); stmt.AddValue(2, accountId); @@ -174,7 +174,7 @@ namespace Game (byte[] salt, byte[] verifier) = SRP6.MakeRegistrationData(username, newPassword); - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.UPD_LOGON); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.UPD_LOGON); stmt.AddValue(0, salt); stmt.AddValue(1, verifier); stmt.AddValue(2, accountId); @@ -191,7 +191,7 @@ namespace Game if (newEmail.Length > MaxEmailLength) return AccountOpResult.EmailTooLong; - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.UPD_EMAIL); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.UPD_EMAIL); stmt.AddValue(0, newEmail); stmt.AddValue(1, accountId); DB.Login.Execute(stmt); @@ -207,7 +207,7 @@ namespace Game if (newEmail.Length > MaxEmailLength) return AccountOpResult.EmailTooLong; - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.UPD_REG_EMAIL); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.UPD_REG_EMAIL); stmt.AddValue(0, newEmail); stmt.AddValue(1, accountId); DB.Login.Execute(stmt); @@ -217,7 +217,7 @@ namespace Game public uint GetId(string username) { - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.GET_ACCOUNT_ID_BY_USERNAME); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.GET_ACCOUNT_ID_BY_USERNAME); stmt.AddValue(0, username); SQLResult result = DB.Login.Query(stmt); return !result.IsEmpty() ? result.Read(0) : 0; @@ -225,7 +225,7 @@ namespace Game public AccountTypes GetSecurity(uint accountId, int realmId) { - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.GET_GMLEVEL_BY_REALMID); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.GET_GMLEVEL_BY_REALMID); stmt.AddValue(0, accountId); stmt.AddValue(1, realmId); SQLResult result = DB.Login.Query(stmt); @@ -234,7 +234,7 @@ namespace Game public QueryCallback GetSecurityAsync(uint accountId, int realmId, Action callback) { - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.GET_GMLEVEL_BY_REALMID); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.GET_GMLEVEL_BY_REALMID); stmt.AddValue(0, accountId); stmt.AddValue(1, realmId); return DB.Login.AsyncQuery(stmt).WithCallback(result => @@ -246,7 +246,7 @@ namespace Game public bool GetName(uint accountId, out string name) { name = ""; - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.GET_USERNAME_BY_ID); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.GET_USERNAME_BY_ID); stmt.AddValue(0, accountId); SQLResult result = DB.Login.Query(stmt); if (!result.IsEmpty()) @@ -261,7 +261,7 @@ namespace Game public bool GetEmail(uint accountId, out string email) { email = ""; - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.GET_EMAIL_BY_ID); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.GET_EMAIL_BY_ID); stmt.AddValue(0, accountId); SQLResult result = DB.Login.Query(stmt); if (!result.IsEmpty()) @@ -280,7 +280,7 @@ namespace Game if (!GetName(accountId, out username)) return false; - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_CHECK_PASSWORD); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.SEL_CHECK_PASSWORD); stmt.AddValue(0, accountId); SQLResult result = DB.Login.Query(stmt); if (!result.IsEmpty()) @@ -311,7 +311,7 @@ namespace Game public uint GetCharactersCount(uint accountId) { // check character count - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_SUM_CHARS); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_SUM_CHARS); stmt.AddValue(0, accountId); SQLResult result = DB.Characters.Query(stmt); return result.IsEmpty() ? 0 : (uint)result.Read(0); @@ -319,7 +319,7 @@ namespace Game public bool IsBannedAccount(string name) { - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_ACCOUNT_BANNED_BY_USERNAME); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.SEL_ACCOUNT_BANNED_BY_USERNAME); stmt.AddValue(0, name); SQLResult result = DB.Login.Query(stmt); return !result.IsEmpty(); @@ -431,13 +431,13 @@ namespace Game // Delete old security level from DB if (realmId == -1) { - stmt = DB.Login.GetPreparedStatement(LoginStatements.DEL_ACCOUNT_ACCESS); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.DEL_ACCOUNT_ACCESS); stmt.AddValue(0, accountId); trans.Append(stmt); } else { - stmt = DB.Login.GetPreparedStatement(LoginStatements.DEL_ACCOUNT_ACCESS_BY_REALM); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.DEL_ACCOUNT_ACCESS_BY_REALM); stmt.AddValue(0, accountId); stmt.AddValue(1, realmId); trans.Append(stmt); @@ -446,7 +446,7 @@ namespace Game // Add new security level if (securityLevel != 0) { - stmt = DB.Login.GetPreparedStatement(LoginStatements.INS_ACCOUNT_ACCESS); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.INS_ACCOUNT_ACCESS); stmt.AddValue(0, accountId); stmt.AddValue(1, securityLevel); stmt.AddValue(2, realmId); diff --git a/Source/Game/Accounts/BNetAccountManager.cs b/Source/Game/Accounts/BNetAccountManager.cs index 1e060af74..301e0dbb1 100644 --- a/Source/Game/Accounts/BNetAccountManager.cs +++ b/Source/Game/Accounts/BNetAccountManager.cs @@ -25,7 +25,7 @@ namespace Game if (GetId(email) != 0) return AccountOpResult.NameAlreadyExist; - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.INS_BNET_ACCOUNT); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.INS_BNET_ACCOUNT); stmt.AddValue(0, email); stmt.AddValue(1, CalculateShaPassHash(email.ToUpper(), password.ToUpper())); DB.Login.DirectExecute(stmt); @@ -51,7 +51,7 @@ namespace Game if (newPassword.Length > 16) return AccountOpResult.PassTooLong; - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.UPD_BNET_PASSWORD); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.UPD_BNET_PASSWORD); stmt.AddValue(0, CalculateShaPassHash(username, newPassword)); stmt.AddValue(1, accountId); DB.Login.Execute(stmt); @@ -65,7 +65,7 @@ namespace Game if (!GetName(accountId, out username)) return false; - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_BNET_CHECK_PASSWORD); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.SEL_BNET_CHECK_PASSWORD); stmt.AddValue(0, accountId); stmt.AddValue(1, CalculateShaPassHash(username, password)); @@ -85,7 +85,7 @@ namespace Game if (GetIdByGameAccount(gameAccountId) != 0) return AccountOpResult.BadLink; - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.UPD_BNET_GAME_ACCOUNT_LINK); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.UPD_BNET_GAME_ACCOUNT_LINK); stmt.AddValue(0, bnetAccountId); stmt.AddValue(1, GetMaxIndex(bnetAccountId) + 1); stmt.AddValue(2, gameAccountId); @@ -102,7 +102,7 @@ namespace Game if (GetIdByGameAccount(gameAccountId) == 0) return AccountOpResult.BadLink; - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.UPD_BNET_GAME_ACCOUNT_LINK); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.UPD_BNET_GAME_ACCOUNT_LINK); stmt.AddNull(0); stmt.AddNull(1); stmt.AddValue(2, gameAccountId); @@ -112,7 +112,7 @@ namespace Game public uint GetId(string username) { - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_BNET_ACCOUNT_ID_BY_EMAIL); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.SEL_BNET_ACCOUNT_ID_BY_EMAIL); stmt.AddValue(0, username); SQLResult result = DB.Login.Query(stmt); if (!result.IsEmpty()) @@ -124,7 +124,7 @@ namespace Game public bool GetName(uint accountId, out string name) { name = ""; - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_BNET_ACCOUNT_EMAIL_BY_ID); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.SEL_BNET_ACCOUNT_EMAIL_BY_ID); stmt.AddValue(0, accountId); SQLResult result = DB.Login.Query(stmt); if (!result.IsEmpty()) @@ -138,7 +138,7 @@ namespace Game public uint GetIdByGameAccount(uint gameAccountId) { - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_BNET_ACCOUNT_ID_BY_GAME_ACCOUNT); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.SEL_BNET_ACCOUNT_ID_BY_GAME_ACCOUNT); stmt.AddValue(0, gameAccountId); SQLResult result = DB.Login.Query(stmt); if (!result.IsEmpty()) @@ -149,14 +149,14 @@ namespace Game public QueryCallback GetIdByGameAccountAsync(uint gameAccountId) { - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_BNET_ACCOUNT_ID_BY_GAME_ACCOUNT); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.SEL_BNET_ACCOUNT_ID_BY_GAME_ACCOUNT); stmt.AddValue(0, gameAccountId); return DB.Login.AsyncQuery(stmt); } public byte GetMaxIndex(uint accountId) { - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_BNET_MAX_ACCOUNT_INDEX); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.SEL_BNET_MAX_ACCOUNT_INDEX); stmt.AddValue(0, accountId); SQLResult result = DB.Login.Query(stmt); if (!result.IsEmpty()) diff --git a/Source/Game/Accounts/RoleAccessControl.cs b/Source/Game/Accounts/RoleAccessControl.cs index 18ca15511..8fe38a08e 100644 --- a/Source/Game/Accounts/RoleAccessControl.cs +++ b/Source/Game/Accounts/RoleAccessControl.cs @@ -116,7 +116,7 @@ namespace Game.Accounts void SavePermission(uint permission, bool granted, int realmId) { - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.INS_RBAC_ACCOUNT_PERMISSION); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.INS_RBAC_ACCOUNT_PERMISSION); stmt.AddValue(0, GetId()); stmt.AddValue(1, permission); stmt.AddValue(2, granted); @@ -142,7 +142,7 @@ namespace Game.Accounts { Log.outDebug(LogFilter.Rbac, "RBACData.RevokePermission [Id: {0} Name: {1}] (Permission {2}, RealmId {3}). Ok and DB updated", GetId(), GetName(), permissionId, realmId); - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.DEL_RBAC_ACCOUNT_PERMISSION); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.DEL_RBAC_ACCOUNT_PERMISSION); stmt.AddValue(0, GetId()); stmt.AddValue(1, permissionId); stmt.AddValue(2, realmId); @@ -163,7 +163,7 @@ namespace Game.Accounts Log.outDebug(LogFilter.Rbac, "RBACData.LoadFromDB [Id: {0} Name: {1}]: Loading permissions", GetId(), GetName()); // Load account permissions (granted and denied) that affect current realm - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_RBAC_ACCOUNT_PERMISSIONS); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.SEL_RBAC_ACCOUNT_PERMISSIONS); stmt.AddValue(0, GetId()); stmt.AddValue(1, GetRealmId()); @@ -176,7 +176,7 @@ namespace Game.Accounts Log.outDebug(LogFilter.Rbac, "RBACData.LoadFromDB [Id: {0} Name: {1}]: Loading permissions", GetId(), GetName()); // Load account permissions (granted and denied) that affect current realm - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_RBAC_ACCOUNT_PERMISSIONS); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.SEL_RBAC_ACCOUNT_PERMISSIONS); stmt.AddValue(0, GetId()); stmt.AddValue(1, GetRealmId()); diff --git a/Source/Game/Achievements/AchievementManager.cs b/Source/Game/Achievements/AchievementManager.cs index cac01cb90..57a705c6b 100644 --- a/Source/Game/Achievements/AchievementManager.cs +++ b/Source/Game/Achievements/AchievementManager.cs @@ -226,11 +226,11 @@ namespace Game.Achievements { SQLTransaction trans = new(); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_ACHIEVEMENT); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_ACHIEVEMENT); stmt.AddValue(0, guid.GetCounter()); DB.Characters.Execute(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_ACHIEVEMENT_PROGRESS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_ACHIEVEMENT_PROGRESS); stmt.AddValue(0, guid.GetCounter()); DB.Characters.Execute(stmt); @@ -288,7 +288,7 @@ namespace Game.Achievements // Removing non-existing criteria data for all characters Log.outError(LogFilter.Achievement, "Non-existing achievement criteria {0} data removed from table `character_achievement_progress`.", id); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_INVALID_ACHIEV_PROGRESS_CRITERIA); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_INVALID_ACHIEV_PROGRESS_CRITERIA); stmt.AddValue(0, id); DB.Characters.Execute(stmt); continue; @@ -318,12 +318,12 @@ namespace Game.Achievements if (!pair.Value.Changed) continue; - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_ACHIEVEMENT_BY_ACHIEVEMENT); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_ACHIEVEMENT_BY_ACHIEVEMENT); stmt.AddValue(0, pair.Key); stmt.AddValue(1, _owner.GetGUID().GetCounter()); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_CHAR_ACHIEVEMENT); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_CHAR_ACHIEVEMENT); stmt.AddValue(0, _owner.GetGUID().GetCounter()); stmt.AddValue(1, pair.Key); stmt.AddValue(2, pair.Value.Date); @@ -340,14 +340,14 @@ namespace Game.Achievements if (!pair.Value.Changed) continue; - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_ACHIEVEMENT_PROGRESS_BY_CRITERIA); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_ACHIEVEMENT_PROGRESS_BY_CRITERIA); stmt.AddValue(0, _owner.GetGUID().GetCounter()); stmt.AddValue(1, pair.Key); trans.Append(stmt); if (pair.Value.Counter != 0) { - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_CHAR_ACHIEVEMENT_PROGRESS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_CHAR_ACHIEVEMENT_PROGRESS); stmt.AddValue(0, _owner.GetGUID().GetCounter()); stmt.AddValue(1, pair.Key); stmt.AddValue(2, pair.Value.Counter); @@ -741,11 +741,11 @@ namespace Game.Achievements { SQLTransaction trans = new(); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ALL_GUILD_ACHIEVEMENTS); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ALL_GUILD_ACHIEVEMENTS); stmt.AddValue(0, guid.GetCounter()); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ALL_GUILD_ACHIEVEMENT_CRITERIA); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ALL_GUILD_ACHIEVEMENT_CRITERIA); stmt.AddValue(0, guid.GetCounter()); trans.Append(stmt); @@ -799,7 +799,7 @@ namespace Game.Achievements // we will remove not existed criteria for all guilds Log.outError(LogFilter.Achievement, "Non-existing achievement criteria {0} data removed from table `guild_achievement_progress`.", id); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_INVALID_ACHIEV_PROGRESS_CRITERIA_GUILD); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_INVALID_ACHIEV_PROGRESS_CRITERIA_GUILD); stmt.AddValue(0, id); DB.Characters.Execute(stmt); continue; @@ -829,12 +829,12 @@ namespace Game.Achievements if (!pair.Value.Changed) continue; - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_GUILD_ACHIEVEMENT); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_GUILD_ACHIEVEMENT); stmt.AddValue(0, _owner.GetId()); stmt.AddValue(1, pair.Key); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_GUILD_ACHIEVEMENT); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_GUILD_ACHIEVEMENT); stmt.AddValue(0, _owner.GetId()); stmt.AddValue(1, pair.Key); stmt.AddValue(2, pair.Value.Date); @@ -852,12 +852,12 @@ namespace Game.Achievements if (!pair.Value.Changed) continue; - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_GUILD_ACHIEVEMENT_CRITERIA); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_GUILD_ACHIEVEMENT_CRITERIA); stmt.AddValue(0, _owner.GetId()); stmt.AddValue(1, pair.Key); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_GUILD_ACHIEVEMENT_CRITERIA); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_GUILD_ACHIEVEMENT_CRITERIA); stmt.AddValue(0, _owner.GetId()); stmt.AddValue(1, pair.Key); stmt.AddValue(2, pair.Value.Counter); @@ -1220,7 +1220,7 @@ namespace Game.Achievements // Remove non-existing achievements from all characters Log.outError(LogFilter.Achievement, "Non-existing achievement {0} data has been removed from the table `character_achievement`.", achievementId); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_INVALID_ACHIEVMENT); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_INVALID_ACHIEVMENT); stmt.AddValue(0, achievementId); DB.Characters.Execute(stmt); diff --git a/Source/Game/Arenas/ArenaTeam.cs b/Source/Game/Arenas/ArenaTeam.cs index 8e7e88e22..01e622f13 100644 --- a/Source/Game/Arenas/ArenaTeam.cs +++ b/Source/Game/Arenas/ArenaTeam.cs @@ -45,7 +45,7 @@ namespace Game.Arenas ulong captainLowGuid = captainGuid.GetCounter(); // Save arena team to db - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_ARENA_TEAM); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_ARENA_TEAM); stmt.AddValue(0, teamId); stmt.AddValue(1, TeamName); stmt.AddValue(2, captainLowGuid); @@ -106,7 +106,7 @@ namespace Game.Arenas personalRating = 1000; // Try to get player's match maker rating from db and fall back to config setting if not found - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_MATCH_MAKER_RATING); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_MATCH_MAKER_RATING); stmt.AddValue(0, playerGuid.GetCounter()); stmt.AddValue(1, GetSlot()); SQLResult result = DB.Characters.Query(stmt); @@ -137,7 +137,7 @@ namespace Game.Arenas Global.CharacterCacheStorage.UpdateCharacterArenaTeamId(playerGuid, GetSlot(), GetId()); // Save player's arena team membership to db - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_ARENA_TEAM_MEMBER); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_ARENA_TEAM_MEMBER); stmt.AddValue(0, teamId); stmt.AddValue(1, playerGuid.GetCounter()); stmt.AddValue(2, (ushort)personalRating); @@ -243,7 +243,7 @@ namespace Game.Arenas return false; TeamName = name; - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_ARENA_TEAM_NAME); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_ARENA_TEAM_NAME); stmt.AddValue(0, TeamName); stmt.AddValue(1, GetId()); DB.Characters.Execute(stmt); @@ -261,7 +261,7 @@ namespace Game.Arenas CaptainGuid = guid; // Update database - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_ARENA_TEAM_CAPTAIN); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_ARENA_TEAM_CAPTAIN); stmt.AddValue(0, guid.GetCounter()); stmt.AddValue(1, GetId()); DB.Characters.Execute(stmt); @@ -306,7 +306,7 @@ namespace Game.Arenas // Only used for single member deletion, for arena team disband we use a single query for more efficiency if (cleanDb) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ARENA_TEAM_MEMBER); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ARENA_TEAM_MEMBER); stmt.AddValue(0, GetId()); stmt.AddValue(1, guid.GetCounter()); DB.Characters.Execute(stmt); @@ -330,11 +330,11 @@ namespace Game.Arenas // Update database SQLTransaction trans = new(); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ARENA_TEAM); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ARENA_TEAM); stmt.AddValue(0, teamId); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ARENA_TEAM_MEMBERS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ARENA_TEAM_MEMBERS); stmt.AddValue(0, teamId); trans.Append(stmt); @@ -353,11 +353,11 @@ namespace Game.Arenas // Update database SQLTransaction trans = new(); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ARENA_TEAM); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ARENA_TEAM); stmt.AddValue(0, teamId); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ARENA_TEAM_MEMBERS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ARENA_TEAM_MEMBERS); stmt.AddValue(0, teamId); trans.Append(stmt); @@ -679,7 +679,7 @@ namespace Game.Arenas SQLTransaction trans = new(); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_ARENA_TEAM_STATS); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_ARENA_TEAM_STATS); stmt.AddValue(0, stats.Rating); stmt.AddValue(1, stats.WeekGames); stmt.AddValue(2, stats.WeekWins); @@ -695,7 +695,7 @@ namespace Game.Arenas if (member.WeekGames == 0) continue; - stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_ARENA_TEAM_MEMBER); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_ARENA_TEAM_MEMBER); stmt.AddValue(0, member.PersonalRating); stmt.AddValue(1, member.WeekGames); stmt.AddValue(2, member.WeekWins); @@ -705,7 +705,7 @@ namespace Game.Arenas stmt.AddValue(6, member.Guid.GetCounter()); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.REP_CHARACTER_ARENA_STATS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.REP_CHARACTER_ARENA_STATS); stmt.AddValue(0, member.Guid.GetCounter()); stmt.AddValue(1, GetSlot()); stmt.AddValue(2, member.MatchMakerRating); diff --git a/Source/Game/AuctionHouse/AuctionManager.cs b/Source/Game/AuctionHouse/AuctionManager.cs index 776f1423e..bef17f673 100644 --- a/Source/Game/AuctionHouse/AuctionManager.cs +++ b/Source/Game/AuctionHouse/AuctionManager.cs @@ -139,7 +139,7 @@ namespace Game // need to clear in case we are reloading _itemsByGuid.Clear(); - SQLResult result = DB.Characters.Query(DB.Characters.GetPreparedStatement(CharStatements.SEL_AUCTION_ITEMS)); + SQLResult result = DB.Characters.Query(CharacterDatabase.GetPreparedStatement(CharStatements.SEL_AUCTION_ITEMS)); if (result.IsEmpty()) { Log.outInfo(LogFilter.ServerLoading, "Loaded 0 auctions. DB table `auctionhouse` is empty."); @@ -181,7 +181,7 @@ namespace Game oldMSTime = Time.GetMSTime(); count = 0; - result = DB.Characters.Query(DB.Characters.GetPreparedStatement(CharStatements.SEL_AUCTION_BIDDERS)); + result = DB.Characters.Query(CharacterDatabase.GetPreparedStatement(CharStatements.SEL_AUCTION_BIDDERS)); if (!result.IsEmpty()) { do @@ -196,7 +196,7 @@ namespace Game oldMSTime = Time.GetMSTime(); count = 0; - result = DB.Characters.Query(DB.Characters.GetPreparedStatement(CharStatements.SEL_AUCTIONS)); + result = DB.Characters.Query(CharacterDatabase.GetPreparedStatement(CharStatements.SEL_AUCTIONS)); if (!result.IsEmpty()) { SQLTransaction trans = new(); @@ -210,7 +210,7 @@ namespace Game if (auctionHouse == null) { Log.outError(LogFilter.Misc, $"Auction {auction.Id} has wrong auctionHouseId {auctionHouseId}"); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_AUCTION); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_AUCTION); stmt.AddValue(0, auction.Id); trans.Append(stmt); continue; @@ -219,7 +219,7 @@ namespace Game if (!itemsByAuction.ContainsKey(auction.Id)) { Log.outError(LogFilter.Misc, $"Auction {auction.Id} has no items"); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_AUCTION); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_AUCTION); stmt.AddValue(0, auction.Id); trans.Append(stmt); continue; @@ -337,7 +337,7 @@ namespace Game if (auction != null) auction.EndTime = GameTime.GetSystemTime(); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_AUCTION_EXPIRATION); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_AUCTION_EXPIRATION); stmt.AddValue(0, (uint)GameTime.GetGameTime()); stmt.AddValue(1, pendingAuction.AuctionId); trans.Append(stmt); @@ -377,7 +377,7 @@ namespace Game if (auction != null) auction.EndTime = GameTime.GetSystemTime(); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_AUCTION_EXPIRATION); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_AUCTION_EXPIRATION); stmt.AddValue(0, (uint)GameTime.GetGameTime()); stmt.AddValue(1, pendingAuction.AuctionId); trans.Append(stmt); @@ -630,7 +630,7 @@ namespace Game if (trans != null) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_AUCTION); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_AUCTION); stmt.AddValue(0, auction.Id); stmt.AddValue(1, _auctionHouse.Id); stmt.AddValue(2, auction.Owner.GetCounter()); @@ -646,7 +646,7 @@ namespace Game foreach (Item item in auction.Items) { - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_AUCTION_ITEMS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_AUCTION_ITEMS); stmt.AddValue(0, auction.Id); stmt.AddValue(1, item.GetGUID().GetCounter()); trans.Append(stmt); @@ -738,7 +738,7 @@ namespace Game else _buckets.Remove(bucket.Key); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_AUCTION); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_AUCTION); stmt.AddValue(0, auction.Id); trans.Append(stmt); @@ -1325,7 +1325,7 @@ namespace Game for (int i = 0; i < batch.ItemsCount; ++i) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_AUCTION_ITEMS_BY_ITEM); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_AUCTION_ITEMS_BY_ITEM); stmt.AddValue(0, batch.Items[i].GetGUID().GetCounter()); trans.Append(stmt); @@ -1429,7 +1429,7 @@ namespace Game // owner in `data` will set at mail receive and item extracting foreach (Item item in auction.Items) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_ITEM_OWNER); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_ITEM_OWNER); stmt.AddValue(0, auction.Bidder.GetCounter()); stmt.AddValue(1, item.GetGUID().GetCounter()); trans.Append(stmt); diff --git a/Source/Game/BattleGrounds/BattleGround.cs b/Source/Game/BattleGrounds/BattleGround.cs index f2580cb4b..9b893f4ef 100644 --- a/Source/Game/BattleGrounds/BattleGround.cs +++ b/Source/Game/BattleGrounds/BattleGround.cs @@ -669,13 +669,13 @@ namespace Game.BattleGrounds ulong battlegroundId = 1; if (IsBattleground() && WorldConfig.GetBoolValue(WorldCfg.BattlegroundStoreStatisticsEnable)) { - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_PVPSTATS_MAXID); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_PVPSTATS_MAXID); SQLResult result = DB.Characters.Query(stmt); if (!result.IsEmpty()) battlegroundId = result.Read(0) + 1; - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_PVPSTATS_BATTLEGROUND); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_PVPSTATS_BATTLEGROUND); stmt.AddValue(0, battlegroundId); stmt.AddValue(1, (byte)GetWinner()); stmt.AddValue(2, GetUniqueBracketId()); @@ -725,7 +725,7 @@ namespace Game.BattleGrounds if (IsBattleground() && WorldConfig.GetBoolValue(WorldCfg.BattlegroundStoreStatisticsEnable)) { - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_PVPSTATS_PLAYER); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_PVPSTATS_PLAYER); var score = PlayerScores.LookupByKey(player.GetGUID()); stmt.AddValue(0, battlegroundId); diff --git a/Source/Game/BattlePets/BattlePetManager.cs b/Source/Game/BattlePets/BattlePetManager.cs index bbc4d75d8..45b184222 100644 --- a/Source/Game/BattlePets/BattlePetManager.cs +++ b/Source/Game/BattlePets/BattlePetManager.cs @@ -277,7 +277,7 @@ namespace Game.BattlePets switch (pair.Value.SaveInfo) { case BattlePetSaveInfo.New: - stmt = DB.Login.GetPreparedStatement(LoginStatements.INS_BATTLE_PETS); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.INS_BATTLE_PETS); stmt.AddValue(0, pair.Key); stmt.AddValue(1, _owner.GetBattlenetAccountId()); stmt.AddValue(2, pair.Value.PacketInfo.Species); @@ -305,7 +305,7 @@ namespace Game.BattlePets if (pair.Value.DeclinedName != null) { - stmt = DB.Login.GetPreparedStatement(LoginStatements.INS_BATTLE_PET_DECLINED_NAME); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.INS_BATTLE_PET_DECLINED_NAME); stmt.AddValue(0, pair.Key); for (byte i = 0; i < SharedConst.MaxDeclinedNameCases; i++) @@ -318,7 +318,7 @@ namespace Game.BattlePets pair.Value.SaveInfo = BattlePetSaveInfo.Unchanged; break; case BattlePetSaveInfo.Changed: - stmt = DB.Login.GetPreparedStatement(LoginStatements.UPD_BATTLE_PETS); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.UPD_BATTLE_PETS); stmt.AddValue(0, pair.Value.PacketInfo.Level); stmt.AddValue(1, pair.Value.PacketInfo.Exp); stmt.AddValue(2, pair.Value.PacketInfo.Health); @@ -330,13 +330,13 @@ namespace Game.BattlePets stmt.AddValue(8, pair.Key); trans.Append(stmt); - stmt = DB.Login.GetPreparedStatement(LoginStatements.DEL_BATTLE_PET_DECLINED_NAME); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.DEL_BATTLE_PET_DECLINED_NAME); stmt.AddValue(0, pair.Key); trans.Append(stmt); if (pair.Value.DeclinedName != null) { - stmt = DB.Login.GetPreparedStatement(LoginStatements.INS_BATTLE_PET_DECLINED_NAME); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.INS_BATTLE_PET_DECLINED_NAME); stmt.AddValue(0, pair.Key); for (byte i = 0; i < SharedConst.MaxDeclinedNameCases; i++) @@ -348,11 +348,11 @@ namespace Game.BattlePets pair.Value.SaveInfo = BattlePetSaveInfo.Unchanged; break; case BattlePetSaveInfo.Removed: - stmt = DB.Login.GetPreparedStatement(LoginStatements.DEL_BATTLE_PET_DECLINED_NAME); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.DEL_BATTLE_PET_DECLINED_NAME); stmt.AddValue(0, pair.Key); trans.Append(stmt); - stmt = DB.Login.GetPreparedStatement(LoginStatements.DEL_BATTLE_PETS); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.DEL_BATTLE_PETS); stmt.AddValue(0, _owner.GetBattlenetAccountId()); stmt.AddValue(1, pair.Key); trans.Append(stmt); @@ -361,13 +361,13 @@ namespace Game.BattlePets } } - stmt = DB.Login.GetPreparedStatement(LoginStatements.DEL_BATTLE_PET_SLOTS); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.DEL_BATTLE_PET_SLOTS); stmt.AddValue(0, _owner.GetBattlenetAccountId()); trans.Append(stmt); foreach (var slot in _slots) { - stmt = DB.Login.GetPreparedStatement(LoginStatements.INS_BATTLE_PET_SLOTS); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.INS_BATTLE_PET_SLOTS); stmt.AddValue(0, slot.Index); stmt.AddValue(1, _owner.GetBattlenetAccountId()); stmt.AddValue(2, slot.Pet.Guid.GetCounter()); diff --git a/Source/Game/BlackMarket/BlackMarketEntry.cs b/Source/Game/BlackMarket/BlackMarketEntry.cs index c94b56587..3c41c3a92 100644 --- a/Source/Game/BlackMarket/BlackMarketEntry.cs +++ b/Source/Game/BlackMarket/BlackMarketEntry.cs @@ -126,7 +126,7 @@ namespace Game.BlackMarket public void SaveToDB(SQLTransaction trans) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_BLACKMARKET_AUCTIONS); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_BLACKMARKET_AUCTIONS); stmt.AddValue(0, _marketId); stmt.AddValue(1, _currentBid); @@ -139,7 +139,7 @@ namespace Game.BlackMarket public void DeleteFromDB(SQLTransaction trans) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_BLACKMARKET_AUCTIONS); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_BLACKMARKET_AUCTIONS); stmt.AddValue(0, _marketId); trans.Append(stmt); } @@ -174,7 +174,7 @@ namespace Game.BlackMarket player.ModifyMoney(-(long)bid); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_BLACKMARKET_AUCTIONS); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_BLACKMARKET_AUCTIONS); stmt.AddValue(0, _currentBid); stmt.AddValue(1, GetExpirationTime()); diff --git a/Source/Game/BlackMarket/BlackMarketManager.cs b/Source/Game/BlackMarket/BlackMarketManager.cs index 23339c0a4..0fc554fa9 100644 --- a/Source/Game/BlackMarket/BlackMarketManager.cs +++ b/Source/Game/BlackMarket/BlackMarketManager.cs @@ -48,7 +48,7 @@ namespace Game.BlackMarket // Clear in case we are reloading _auctions.Clear(); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_BLACKMARKET_AUCTIONS); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_BLACKMARKET_AUCTIONS); SQLResult result = DB.Characters.Query(stmt); if (result.IsEmpty()) { diff --git a/Source/Game/Calendar/CalendarManager.cs b/Source/Game/Calendar/CalendarManager.cs index f00b591e6..0395f42c6 100644 --- a/Source/Game/Calendar/CalendarManager.cs +++ b/Source/Game/Calendar/CalendarManager.cs @@ -153,7 +153,7 @@ namespace Game for (int i = 0; i < eventInvites.Count; ++i) { CalendarInvite invite = eventInvites[i]; - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CALENDAR_INVITE); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CALENDAR_INVITE); stmt.AddValue(0, invite.InviteId); trans.Append(stmt); @@ -165,7 +165,7 @@ namespace Game _invites.Remove(calendarEvent.EventId); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CALENDAR_EVENT); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CALENDAR_EVENT); stmt.AddValue(0, calendarEvent.EventId); trans.Append(stmt); DB.Characters.CommitTransaction(trans); @@ -194,7 +194,7 @@ namespace Game return; SQLTransaction trans = new(); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CALENDAR_INVITE); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CALENDAR_INVITE); stmt.AddValue(0, calendarInvite.InviteId); trans.Append(stmt); DB.Characters.CommitTransaction(trans); @@ -215,7 +215,7 @@ namespace Game public void UpdateEvent(CalendarEvent calendarEvent) { SQLTransaction trans = new(); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.REP_CALENDAR_EVENT); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.REP_CALENDAR_EVENT); stmt.AddValue(0, calendarEvent.EventId); stmt.AddValue(1, calendarEvent.OwnerGuid.GetCounter()); stmt.AddValue(2, calendarEvent.Title); @@ -231,7 +231,7 @@ namespace Game public void UpdateInvite(CalendarInvite invite, SQLTransaction trans = null) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.REP_CALENDAR_INVITE); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.REP_CALENDAR_INVITE); stmt.AddValue(0, invite.InviteId); stmt.AddValue(1, invite.EventId); stmt.AddValue(2, invite.InviteeGuid.GetCounter()); diff --git a/Source/Game/Chat/Channels/Channel.cs b/Source/Game/Chat/Channels/Channel.cs index 9d3294ec6..e6158ff5f 100644 --- a/Source/Game/Chat/Channels/Channel.cs +++ b/Source/Game/Chat/Channels/Channel.cs @@ -95,7 +95,7 @@ namespace Game.Chat foreach (var iter in _bannedStore) banlist += iter.GetRawValue().ToHexString() + ' '; - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_CHANNEL); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_CHANNEL); stmt.AddValue(0, _channelName); stmt.AddValue(1, (uint)_channelTeam); stmt.AddValue(2, _announceEnabled); @@ -108,7 +108,7 @@ namespace Game.Chat { if (!_playersStore.Empty()) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_CHANNEL_USAGE); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_CHANNEL_USAGE); stmt.AddValue(0, _channelName); stmt.AddValue(1, (uint)_channelTeam); DB.Characters.Execute(stmt); diff --git a/Source/Game/Chat/Channels/ChannelManager.cs b/Source/Game/Chat/Channels/ChannelManager.cs index d6856349f..adcd2b96e 100644 --- a/Source/Game/Chat/Channels/ChannelManager.cs +++ b/Source/Game/Chat/Channels/ChannelManager.cs @@ -31,7 +31,7 @@ namespace Game.Chat uint days = WorldConfig.GetUIntValue(WorldCfg.PreserveCustomChannelDuration); if (days != 0) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_OLD_CHANNELS); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_OLD_CHANNELS); stmt.AddValue(0, days * Time.Day); DB.Characters.Execute(stmt); } @@ -73,7 +73,7 @@ namespace Game.Chat foreach (var (name, team) in toDelete) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHANNEL); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHANNEL); stmt.AddValue(0, name); stmt.AddValue(1, (uint)team); DB.Characters.Execute(stmt); diff --git a/Source/Game/Chat/CommandManager.cs b/Source/Game/Chat/CommandManager.cs index 434eef44e..9463ada09 100644 --- a/Source/Game/Chat/CommandManager.cs +++ b/Source/Game/Chat/CommandManager.cs @@ -40,7 +40,7 @@ namespace Game.Chat } } - PreparedStatement stmt = DB.World.GetPreparedStatement(WorldStatements.SEL_COMMANDS); + PreparedStatement stmt = WorldDatabase.GetPreparedStatement(WorldStatements.SEL_COMMANDS); SQLResult result = DB.World.Query(stmt); if (!result.IsEmpty()) { diff --git a/Source/Game/Chat/Commands/AccountCommands.cs b/Source/Game/Chat/Commands/AccountCommands.cs index 88dfc1aa3..ba6aee733 100644 --- a/Source/Game/Chat/Commands/AccountCommands.cs +++ b/Source/Game/Chat/Commands/AccountCommands.cs @@ -40,7 +40,7 @@ namespace Game.Chat string emailoutput; uint accountId = session.GetAccountId(); - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.GET_EMAIL_BY_ID); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.GET_EMAIL_BY_ID); stmt.AddValue(0, accountId); SQLResult result = DB.Login.Query(stmt); @@ -67,7 +67,7 @@ namespace Game.Chat uint accountId = handler.GetSession().GetAccountId(); byte[] secret; { // get current TOTP secret - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_ACCOUNT_TOTP_SECRET); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.SEL_ACCOUNT_TOTP_SECRET); stmt.AddValue(0, accountId); SQLResult result = DB.Login.Query(stmt); @@ -102,7 +102,7 @@ namespace Game.Chat if (TOTP.ValidateToken(secret, token.Value)) { - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.UPD_ACCOUNT_TOTP_SECRET); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.UPD_ACCOUNT_TOTP_SECRET); stmt.AddNull(0); stmt.AddValue(1, accountId); DB.Login.Execute(stmt); @@ -130,7 +130,7 @@ namespace Game.Chat uint accountId = handler.GetSession().GetAccountId(); { // check if 2FA already enabled - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_ACCOUNT_TOTP_SECRET); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.SEL_ACCOUNT_TOTP_SECRET); stmt.AddValue(0, accountId); SQLResult result = DB.Login.Query(stmt); @@ -161,7 +161,7 @@ namespace Game.Chat if (masterKey.IsValid()) AES.Encrypt(suggestions[accountId], masterKey.GetValue()); - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.UPD_ACCOUNT_TOTP_SECRET); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.UPD_ACCOUNT_TOTP_SECRET); stmt.AddValue(0, suggestions[accountId]); stmt.AddValue(1, accountId); DB.Login.Execute(stmt); @@ -187,7 +187,7 @@ namespace Game.Chat return false; } - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.UPD_EXPANSION); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.UPD_EXPANSION); stmt.AddValue(0, expansion); stmt.AddValue(1, handler.GetSession().GetAccountId()); DB.Login.Execute(stmt); @@ -398,14 +398,14 @@ namespace Game.Chat /*var ipBytes = System.Net.IPAddress.Parse(handler.GetSession().GetRemoteAddress()).GetAddressBytes(); Array.Reverse(ipBytes); - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_LOGON_COUNTRY); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.SEL_LOGON_COUNTRY); stmt.AddValue(0, BitConverter.ToUInt32(ipBytes, 0)); SQLResult result = DB.Login.Query(stmt); if (!result.IsEmpty()) { string country = result.Read(0); - stmt = DB.Login.GetPreparedStatement(LoginStatements.UPD_ACCOUNT_LOCK_COUNTRY); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.UPD_ACCOUNT_LOCK_COUNTRY); stmt.AddValue(0, country); stmt.AddValue(1, handler.GetSession().GetAccountId()); DB.Login.Execute(stmt); @@ -419,7 +419,7 @@ namespace Game.Chat } else { - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.UPD_ACCOUNT_LOCK_COUNTRY); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.UPD_ACCOUNT_LOCK_COUNTRY); stmt.AddValue(0, "00"); stmt.AddValue(1, handler.GetSession().GetAccountId()); DB.Login.Execute(stmt); @@ -431,7 +431,7 @@ namespace Game.Chat [Command("ip", CypherStrings.CommandAccLockIpHelp, RBACPermissions.CommandAccountLockIp)] static bool HandleAccountLockIpCommand(CommandHandler handler, bool state) { - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.UPD_ACCOUNT_LOCK); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.UPD_ACCOUNT_LOCK); if (state) { @@ -566,7 +566,7 @@ namespace Game.Chat PreparedStatement stmt; if (secret == "off") { - stmt = DB.Login.GetPreparedStatement(LoginStatements.UPD_ACCOUNT_TOTP_SECRET); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.UPD_ACCOUNT_TOTP_SECRET); stmt.AddNull(0); stmt.AddValue(1, targetAccountId); DB.Login.Execute(stmt); @@ -596,7 +596,7 @@ namespace Game.Chat if (masterKey.IsValid()) AES.Encrypt(decoded, masterKey.GetValue()); - stmt = DB.Login.GetPreparedStatement(LoginStatements.UPD_ACCOUNT_TOTP_SECRET); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.UPD_ACCOUNT_TOTP_SECRET); stmt.AddValue(0, decoded); stmt.AddValue(1, targetAccountId); DB.Login.Execute(stmt); @@ -639,7 +639,7 @@ namespace Game.Chat if (expansion > WorldConfig.GetIntValue(WorldCfg.Expansion)) return false; - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.UPD_EXPANSION); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.UPD_EXPANSION); stmt.AddValue(0, expansion); stmt.AddValue(1, accountId); @@ -743,7 +743,7 @@ namespace Game.Chat // Check and abort if the target gm has a higher rank on one of the realms and the new realm is -1 if (realmID == -1 && !Global.AccountMgr.IsConsoleAccount(playerSecurity)) { - stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_ACCOUNT_ACCESS_SECLEVEL_TEST); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.SEL_ACCOUNT_ACCESS_SECLEVEL_TEST); stmt.AddValue(0, accountId); stmt.AddValue(1, securityLevel); diff --git a/Source/Game/Chat/Commands/BNetAccountCommands.cs b/Source/Game/Chat/Commands/BNetAccountCommands.cs index cd665bccc..d85854d74 100644 --- a/Source/Game/Chat/Commands/BNetAccountCommands.cs +++ b/Source/Game/Chat/Commands/BNetAccountCommands.cs @@ -122,7 +122,7 @@ namespace Game.Chat.Commands [Command("listgameaccounts", RBACPermissions.CommandBnetAccountListGameAccounts, true)] static bool HandleListGameAccountsCommand(CommandHandler handler, string battlenetAccountName) { - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_BNET_GAME_ACCOUNT_LIST); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.SEL_BNET_GAME_ACCOUNT_LIST); stmt.AddValue(0, battlenetAccountName); SQLResult accountList = DB.Login.Query(stmt); @@ -250,7 +250,7 @@ namespace Game.Chat.Commands [Command("ip", RBACPermissions.CommandBnetAccountLockIp, true)] static bool HandleAccountLockIpCommand(CommandHandler handler, bool state) { - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.UPD_BNET_ACCOUNT_LOCK); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.UPD_BNET_ACCOUNT_LOCK); if (state) { diff --git a/Source/Game/Chat/Commands/BanCommands.cs b/Source/Game/Chat/Commands/BanCommands.cs index 0e8367630..e34235081 100644 --- a/Source/Game/Chat/Commands/BanCommands.cs +++ b/Source/Game/Chat/Commands/BanCommands.cs @@ -192,7 +192,7 @@ namespace Game.Chat.Commands else targetGuid = target.GetGUID(); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_BANINFO); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_BANINFO); stmt.AddValue(0, targetGuid.GetCounter()); SQLResult result = DB.Characters.Query(stmt); if (result.IsEmpty()) @@ -271,18 +271,18 @@ namespace Game.Chat.Commands [Command("account", RBACPermissions.CommandBanlistAccount, true)] static bool HandleBanListAccountCommand(CommandHandler handler, [OptionalArg] string filter) { - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.DelExpiredIpBans); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.DelExpiredIpBans); DB.Login.Execute(stmt); SQLResult result; if (filter.IsEmpty()) { - stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_ACCOUNT_BANNED_ALL); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.SEL_ACCOUNT_BANNED_ALL); result = DB.Login.Query(stmt); } else { - stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_ACCOUNT_BANNED_BY_FILTER); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.SEL_ACCOUNT_BANNED_BY_FILTER); stmt.AddValue(0, filter); result = DB.Login.Query(stmt); } @@ -302,7 +302,7 @@ namespace Game.Chat.Commands if (filter.IsEmpty()) return false; - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_GUID_BY_NAME_FILTER); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_GUID_BY_NAME_FILTER); stmt.AddValue(0, filter); SQLResult result = DB.Characters.Query(stmt); if (result.IsEmpty()) @@ -319,7 +319,7 @@ namespace Game.Chat.Commands do { - PreparedStatement stmt2 = DB.Characters.GetPreparedStatement(CharStatements.SEL_BANNED_NAME); + PreparedStatement stmt2 = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_BANNED_NAME); stmt2.AddValue(0, result.Read(0)); SQLResult banResult = DB.Characters.Query(stmt2); if (!banResult.IsEmpty()) @@ -339,7 +339,7 @@ namespace Game.Chat.Commands string char_name = result.Read(1); - PreparedStatement stmt2 = DB.Characters.GetPreparedStatement(CharStatements.SEL_BANINFO_LIST); + PreparedStatement stmt2 = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_BANINFO_LIST); stmt2.AddValue(0, result.Read(0)); SQLResult banInfo = DB.Characters.Query(stmt2); if (!banInfo.IsEmpty()) @@ -380,19 +380,19 @@ namespace Game.Chat.Commands [Command("ip", RBACPermissions.CommandBanlistIp, true)] static bool HandleBanListIPCommand(CommandHandler handler, [OptionalArg] string filter) { - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.DelExpiredIpBans); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.DelExpiredIpBans); DB.Login.Execute(stmt); SQLResult result; if (filter.IsEmpty()) { - stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_IP_BANNED_ALL); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.SEL_IP_BANNED_ALL); result = DB.Login.Query(stmt); } else { - stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_IP_BANNED_BY_IP); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.SEL_IP_BANNED_BY_IP); stmt.AddValue(0, filter); result = DB.Login.Query(stmt); } diff --git a/Source/Game/Chat/Commands/CharacterCommands.cs b/Source/Game/Chat/Commands/CharacterCommands.cs index fba7bc471..c5d6d7803 100644 --- a/Source/Game/Chat/Commands/CharacterCommands.cs +++ b/Source/Game/Chat/Commands/CharacterCommands.cs @@ -101,7 +101,7 @@ namespace Game.Chat } } - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHECK_NAME); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHECK_NAME); stmt.AddValue(0, newName); SQLResult result = DB.Characters.Query(stmt); if (!result.IsEmpty()) @@ -111,7 +111,7 @@ namespace Game.Chat } // Remove declined name from db - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_DECLINED_NAME); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_DECLINED_NAME); stmt.AddValue(0, player.GetGUID().GetCounter()); DB.Characters.Execute(stmt); @@ -125,7 +125,7 @@ namespace Game.Chat } else { - stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_NAME_BY_GUID); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_NAME_BY_GUID); stmt.AddValue(0, newName); stmt.AddValue(1, player.GetGUID().GetCounter()); DB.Characters.Execute(stmt); @@ -160,7 +160,7 @@ namespace Game.Chat handler.SendSysMessage(CypherStrings.RenamePlayerGuid, handler.PlayerLink(player.GetName()), player.GetGUID().ToString()); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_ADD_AT_LOGIN_FLAG); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_ADD_AT_LOGIN_FLAG); stmt.AddValue(0, (ushort)AtLoginFlags.Rename); stmt.AddValue(1, player.GetGUID().GetCounter()); DB.Characters.Execute(stmt); @@ -206,7 +206,7 @@ namespace Game.Chat else { // Update level and reset XP, everything else will be updated at login - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_LEVEL); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_LEVEL); stmt.AddValue(0, (byte)newlevel); stmt.AddValue(1, player.GetGUID().GetCounter()); DB.Characters.Execute(stmt); @@ -235,7 +235,7 @@ namespace Game.Chat else { handler.SendSysMessage(CypherStrings.CustomizePlayerGuid, handler.PlayerLink(player.GetName()), player.GetGUID().GetCounter()); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_ADD_AT_LOGIN_FLAG); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_ADD_AT_LOGIN_FLAG); stmt.AddValue(0, (ushort)AtLoginFlags.Customize); stmt.AddValue(1, player.GetGUID().GetCounter()); DB.Characters.Execute(stmt); @@ -279,7 +279,7 @@ namespace Game.Chat if (onlinePlayer != null) onlinePlayer.GetSession().KickPlayer("HandleCharacterChangeAccountCommand GM Command transferring character to another account"); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_ACCOUNT_BY_GUID); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_ACCOUNT_BY_GUID); stmt.AddValue(0, newAccount.GetID()); stmt.AddValue(1, player.GetGUID().GetCounter()); DB.Characters.DirectExecute(stmt); @@ -321,7 +321,7 @@ namespace Game.Chat else { handler.SendSysMessage(CypherStrings.CustomizePlayerGuid, handler.PlayerLink(player.GetName()), player.GetGUID().GetCounter()); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_ADD_AT_LOGIN_FLAG); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_ADD_AT_LOGIN_FLAG); stmt.AddValue(0, (ushort)AtLoginFlags.ChangeFaction); stmt.AddValue(1, player.GetGUID().GetCounter()); DB.Characters.Execute(stmt); @@ -347,7 +347,7 @@ namespace Game.Chat else { handler.SendSysMessage(CypherStrings.CustomizePlayerGuid, handler.PlayerLink(player.GetName()), player.GetGUID().GetCounter()); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_ADD_AT_LOGIN_FLAG); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_ADD_AT_LOGIN_FLAG); stmt.AddValue(0, (ushort)AtLoginFlags.ChangeRace); stmt.AddValue(1, player.GetGUID().GetCounter()); DB.Characters.Execute(stmt); @@ -547,7 +547,7 @@ namespace Game.Chat if (!ulong.TryParse(searchString, out ulong guid)) return false; - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHAR_DEL_INFO_BY_GUID); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHAR_DEL_INFO_BY_GUID); stmt.AddValue(0, guid); result = DB.Characters.Query(stmt); } @@ -557,14 +557,14 @@ namespace Game.Chat if (!ObjectManager.NormalizePlayerName(ref searchString)) return false; - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHAR_DEL_INFO_BY_NAME); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHAR_DEL_INFO_BY_NAME); stmt.AddValue(0, searchString); result = DB.Characters.Query(stmt); } } else { - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHAR_DEL_INFO); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHAR_DEL_INFO); result = DB.Characters.Query(stmt); } @@ -638,7 +638,7 @@ namespace Game.Chat return; } - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_RESTORE_DELETE_INFO); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_RESTORE_DELETE_INFO); stmt.AddValue(0, delInfo.name); stmt.AddValue(1, delInfo.accountId); stmt.AddValue(2, delInfo.guid.GetCounter()); @@ -694,7 +694,7 @@ namespace Game.Chat else { // Update level and reset XP, everything else will be updated at login - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_LEVEL); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_LEVEL); stmt.AddValue(0, newlevel); stmt.AddValue(1, player.GetGUID().GetCounter()); DB.Characters.Execute(stmt); diff --git a/Source/Game/Chat/Commands/DisableCommands.cs b/Source/Game/Chat/Commands/DisableCommands.cs index ab9c21a22..bf8837fa6 100644 --- a/Source/Game/Chat/Commands/DisableCommands.cs +++ b/Source/Game/Chat/Commands/DisableCommands.cs @@ -100,7 +100,7 @@ namespace Game.Chat.Commands break; } - PreparedStatement stmt = DB.World.GetPreparedStatement(WorldStatements.SEL_DISABLES); + PreparedStatement stmt = WorldDatabase.GetPreparedStatement(WorldStatements.SEL_DISABLES); stmt.AddValue(0, entry); stmt.AddValue(1, (byte)disableType); SQLResult result = DB.World.Query(stmt); @@ -110,7 +110,7 @@ namespace Game.Chat.Commands return false; } - stmt = DB.World.GetPreparedStatement(WorldStatements.INS_DISABLES); + stmt = WorldDatabase.GetPreparedStatement(WorldStatements.INS_DISABLES); stmt.AddValue(0, entry); stmt.AddValue(1, (byte)disableType); stmt.AddValue(2, flags); @@ -178,7 +178,7 @@ namespace Game.Chat.Commands if (entry == 0) return false; - PreparedStatement stmt = DB.World.GetPreparedStatement(WorldStatements.SEL_DISABLES); + PreparedStatement stmt = WorldDatabase.GetPreparedStatement(WorldStatements.SEL_DISABLES); stmt.AddValue(0, entry); stmt.AddValue(1, (byte)disableType); SQLResult result = DB.World.Query(stmt); @@ -188,7 +188,7 @@ namespace Game.Chat.Commands return false; } - stmt = DB.World.GetPreparedStatement(WorldStatements.DEL_DISABLES); + stmt = WorldDatabase.GetPreparedStatement(WorldStatements.DEL_DISABLES); stmt.AddValue(0, entry); stmt.AddValue(1, (byte)disableType); DB.World.Execute(stmt); diff --git a/Source/Game/Chat/Commands/GMCommands.cs b/Source/Game/Chat/Commands/GMCommands.cs index 2f017abd5..e8d6cef41 100644 --- a/Source/Game/Chat/Commands/GMCommands.cs +++ b/Source/Game/Chat/Commands/GMCommands.cs @@ -110,7 +110,7 @@ namespace Game.Chat static bool HandleGMListFullCommand(CommandHandler handler) { // Get the accounts with GM Level >0 - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_GM_ACCOUNTS); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.SEL_GM_ACCOUNTS); stmt.AddValue(0, (byte)AccountTypes.Moderator); stmt.AddValue(1, Global.WorldMgr.GetRealm().Id.Index); SQLResult result = DB.Login.Query(stmt); diff --git a/Source/Game/Chat/Commands/GameObjectCommands.cs b/Source/Game/Chat/Commands/GameObjectCommands.cs index 773491710..9e43ceb41 100644 --- a/Source/Game/Chat/Commands/GameObjectCommands.cs +++ b/Source/Game/Chat/Commands/GameObjectCommands.cs @@ -243,7 +243,7 @@ namespace Game.Chat Player player = handler.GetPlayer(); - PreparedStatement stmt = DB.World.GetPreparedStatement(WorldStatements.SEL_GAMEOBJECT_NEAREST); + PreparedStatement stmt = WorldDatabase.GetPreparedStatement(WorldStatements.SEL_GAMEOBJECT_NEAREST); stmt.AddValue(0, player.GetPositionX()); stmt.AddValue(1, player.GetPositionY()); stmt.AddValue(2, player.GetPositionZ()); diff --git a/Source/Game/Chat/Commands/GroupCommands.cs b/Source/Game/Chat/Commands/GroupCommands.cs index 75d41bee5..8058803a8 100644 --- a/Source/Game/Chat/Commands/GroupCommands.cs +++ b/Source/Game/Chat/Commands/GroupCommands.cs @@ -165,7 +165,7 @@ namespace Game.Chat // If not, we extract it from the SQL. if (!groupTarget) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_GROUP_MEMBER); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_GROUP_MEMBER); stmt.AddValue(0, guidTarget.GetCounter()); SQLResult resultGroup = DB.Characters.Query(stmt); if (!resultGroup.IsEmpty()) diff --git a/Source/Game/Chat/Commands/LFGCommands.cs b/Source/Game/Chat/Commands/LFGCommands.cs index b02535b50..8381e5390 100644 --- a/Source/Game/Chat/Commands/LFGCommands.cs +++ b/Source/Game/Chat/Commands/LFGCommands.cs @@ -45,7 +45,7 @@ namespace Game.Chat groupTarget = target.GetGroup(); else { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_GROUP_MEMBER); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_GROUP_MEMBER); stmt.AddValue(0, player.GetGUID().GetCounter()); SQLResult resultGroup = DB.Characters.Query(stmt); if (!resultGroup.IsEmpty()) diff --git a/Source/Game/Chat/Commands/ListCommands.cs b/Source/Game/Chat/Commands/ListCommands.cs index 8ad5f24b6..69b166a99 100644 --- a/Source/Game/Chat/Commands/ListCommands.cs +++ b/Source/Game/Chat/Commands/ListCommands.cs @@ -98,14 +98,14 @@ namespace Game.Chat.Commands // inventory case uint inventoryCount = 0; - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHAR_INVENTORY_COUNT_ITEM); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHAR_INVENTORY_COUNT_ITEM); stmt.AddValue(0, itemId); SQLResult result = DB.Characters.Query(stmt); if (!result.IsEmpty()) inventoryCount = result.Read(0); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHAR_INVENTORY_ITEM_BY_ENTRY); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHAR_INVENTORY_ITEM_BY_ENTRY); stmt.AddValue(0, itemId); stmt.AddValue(1, count); result = DB.Characters.Query(stmt); @@ -143,7 +143,7 @@ namespace Game.Chat.Commands // mail case uint mailCount = 0; - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_MAIL_COUNT_ITEM); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_MAIL_COUNT_ITEM); stmt.AddValue(0, itemId); result = DB.Characters.Query(stmt); @@ -152,7 +152,7 @@ namespace Game.Chat.Commands if (count > 0) { - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_MAIL_ITEMS_BY_ENTRY); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_MAIL_ITEMS_BY_ENTRY); stmt.AddValue(0, itemId); stmt.AddValue(1, count); result = DB.Characters.Query(stmt); @@ -184,7 +184,7 @@ namespace Game.Chat.Commands // auction case uint auctionCount = 0; - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_AUCTIONHOUSE_COUNT_ITEM); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_AUCTIONHOUSE_COUNT_ITEM); stmt.AddValue(0, itemId); result = DB.Characters.Query(stmt); @@ -193,7 +193,7 @@ namespace Game.Chat.Commands if (count > 0) { - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_AUCTIONHOUSE_ITEM_BY_ENTRY); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_AUCTIONHOUSE_ITEM_BY_ENTRY); stmt.AddValue(0, itemId); stmt.AddValue(1, count); result = DB.Characters.Query(stmt); @@ -220,14 +220,14 @@ namespace Game.Chat.Commands // guild bank case uint guildCount = 0; - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_GUILD_BANK_COUNT_ITEM); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_GUILD_BANK_COUNT_ITEM); stmt.AddValue(0, itemId); result = DB.Characters.Query(stmt); if (!result.IsEmpty()) guildCount = result.Read(0); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_GUILD_BANK_ITEM_BY_ENTRY); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_GUILD_BANK_ITEM_BY_ENTRY); stmt.AddValue(0, itemId); stmt.AddValue(1, count); result = DB.Characters.Query(stmt); @@ -267,7 +267,7 @@ namespace Game.Chat.Commands if (player == null) return false; - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_MAIL_LIST_COUNT); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_MAIL_LIST_COUNT); stmt.AddValue(0, player.GetGUID().GetCounter()); SQLResult result = DB.Characters.Query(stmt); if (!result.IsEmpty()) @@ -278,7 +278,7 @@ namespace Game.Chat.Commands handler.SendSysMessage(CypherStrings.ListMailHeader, countMail, nameLink, player.GetGUID().ToString()); handler.SendSysMessage(CypherStrings.AccountListBar); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_MAIL_LIST_INFO); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_MAIL_LIST_INFO); stmt.AddValue(0, player.GetGUID().GetCounter()); SQLResult result1 = DB.Characters.Query(stmt); @@ -313,7 +313,7 @@ namespace Game.Chat.Commands do { uint item_guid = result2.Read(0); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_MAIL_LIST_ITEMS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_MAIL_LIST_ITEMS); stmt.AddValue(0, item_guid); SQLResult result3 = DB.Characters.Query(stmt); if (!result3.IsEmpty()) diff --git a/Source/Game/Chat/Commands/LookupCommands.cs b/Source/Game/Chat/Commands/LookupCommands.cs index b605c4df9..618a906c6 100644 --- a/Source/Game/Chat/Commands/LookupCommands.cs +++ b/Source/Game/Chat/Commands/LookupCommands.cs @@ -897,7 +897,7 @@ namespace Game.Chat ip = target.GetSession().GetRemoteAddress(); } - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_ACCOUNT_BY_IP); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.SEL_ACCOUNT_BY_IP); stmt.AddValue(0, ip); return LookupPlayerSearchCommand(DB.Login.Query(stmt), limit, handler); } @@ -905,7 +905,7 @@ namespace Game.Chat [Command("account", RBACPermissions.CommandLookupPlayerAccount)] static bool HandleLookupPlayerAccountCommand(CommandHandler handler, string account, int limit = -1) { - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_ACCOUNT_LIST_BY_NAME); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.SEL_ACCOUNT_LIST_BY_NAME); stmt.AddValue(0, account); return LookupPlayerSearchCommand(DB.Login.Query(stmt), limit, handler); } @@ -913,7 +913,7 @@ namespace Game.Chat [Command("email", RBACPermissions.CommandLookupPlayerEmail)] static bool HandleLookupPlayerEmailCommand(CommandHandler handler, string email, int limit = -1) { - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_ACCOUNT_LIST_BY_EMAIL); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.SEL_ACCOUNT_LIST_BY_EMAIL); stmt.AddValue(0, email); return LookupPlayerSearchCommand(DB.Login.Query(stmt), limit, handler); } @@ -938,7 +938,7 @@ namespace Game.Chat uint accountId = result.Read(0); string accountName = result.Read(1); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHAR_GUID_NAME_BY_ACC); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHAR_GUID_NAME_BY_ACC); stmt.AddValue(0, accountId); SQLResult result2 = DB.Characters.Query(stmt); diff --git a/Source/Game/Chat/Commands/MessageCommands.cs b/Source/Game/Chat/Commands/MessageCommands.cs index e890fe597..b06161387 100644 --- a/Source/Game/Chat/Commands/MessageCommands.cs +++ b/Source/Game/Chat/Commands/MessageCommands.cs @@ -182,7 +182,7 @@ namespace Game.Chat { if (channel != null) channel.SetOwnership(true); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_CHANNEL_OWNERSHIP); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_CHANNEL_OWNERSHIP); stmt.AddValue(0, 1); stmt.AddValue(1, channelName); DB.Characters.Execute(stmt); @@ -192,7 +192,7 @@ namespace Game.Chat { if (channel != null) channel.SetOwnership(false); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_CHANNEL_OWNERSHIP); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_CHANNEL_OWNERSHIP); stmt.AddValue(0, 0); stmt.AddValue(1, channelName); DB.Characters.Execute(stmt); diff --git a/Source/Game/Chat/Commands/MiscCommands.cs b/Source/Game/Chat/Commands/MiscCommands.cs index 04807983f..6954a15a9 100644 --- a/Source/Game/Chat/Commands/MiscCommands.cs +++ b/Source/Game/Chat/Commands/MiscCommands.cs @@ -847,7 +847,7 @@ namespace Game.Chat static bool HandleListFreezeCommand(CommandHandler handler) { // Get names from DB - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHARACTER_AURA_FROZEN); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHARACTER_AURA_FROZEN); SQLResult result = DB.Characters.Query(stmt); if (result.IsEmpty()) { @@ -1004,7 +1004,7 @@ namespace Game.Chat if (handler.HasLowerSecurity(target, player.GetGUID(), true)) return false; - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.UPD_MUTE_TIME); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.UPD_MUTE_TIME); string muteBy; Player gmPlayer = handler.GetPlayer(); if (gmPlayer != null) @@ -1029,7 +1029,7 @@ namespace Game.Chat stmt.AddValue(3, accountId); DB.Login.Execute(stmt); - stmt = DB.Login.GetPreparedStatement(LoginStatements.INS_ACCOUNT_MUTE); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.INS_ACCOUNT_MUTE); stmt.AddValue(0, accountId); stmt.AddValue(1, muteTime); stmt.AddValue(2, muteBy); @@ -1064,7 +1064,7 @@ namespace Game.Chat return false; } - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_ACCOUNT_MUTE_INFO); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.SEL_ACCOUNT_MUTE_INFO); stmt.AddValue(0, accountId); SQLResult result = DB.Login.Query(stmt); @@ -1282,7 +1282,7 @@ namespace Game.Chat return false; // Query informations from the DB - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHAR_PINFO); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHAR_PINFO); stmt.AddValue(0, lowguid); SQLResult result = DB.Characters.Query(stmt); @@ -1308,7 +1308,7 @@ namespace Game.Chat } // Query the prepared statement for login data - stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_PINFO); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.SEL_PINFO); stmt.AddValue(0, Global.WorldMgr.GetRealm().Id.Index); stmt.AddValue(1, accId); SQLResult result0 = DB.Login.Query(stmt); @@ -1346,13 +1346,13 @@ namespace Game.Chat string nameLink = handler.PlayerLink(targetName); // Returns banType, banTime, bannedBy, banreason - PreparedStatement stmt2 = DB.Login.GetPreparedStatement(LoginStatements.SEL_PINFO_BANS); + PreparedStatement stmt2 = LoginDatabase.GetPreparedStatement(LoginStatements.SEL_PINFO_BANS); stmt2.AddValue(0, accId); SQLResult result2 = DB.Login.Query(stmt2); if (result2.IsEmpty()) { banType = handler.GetCypherString(CypherStrings.Character); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_PINFO_BANS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_PINFO_BANS); stmt.AddValue(0, lowguid); result2 = DB.Characters.Query(stmt); } @@ -1368,7 +1368,7 @@ namespace Game.Chat } // Can be used to query data from Characters database - stmt2 = DB.Characters.GetPreparedStatement(CharStatements.SEL_PINFO_XP); + stmt2 = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_PINFO_XP); stmt2.AddValue(0, lowguid); SQLResult result4 = DB.Characters.Query(stmt2); @@ -1381,7 +1381,7 @@ namespace Game.Chat if (gguid != 0) { // Guild Data - an own query, because it may not happen. - PreparedStatement stmt3 = DB.Characters.GetPreparedStatement(CharStatements.SEL_GUILD_MEMBER_EXTENDED); + PreparedStatement stmt3 = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_GUILD_MEMBER_EXTENDED); stmt3.AddValue(0, lowguid); SQLResult result5 = DB.Characters.Query(stmt3); if (!result5.IsEmpty()) @@ -1489,7 +1489,7 @@ namespace Game.Chat // Mail Data - an own query, because it may or may not be useful. // SQL: "SELECT SUM(CASE WHEN (checked & 1) THEN 1 ELSE 0 END) AS 'readmail', COUNT(*) AS 'totalmail' FROM mail WHERE `receiver` = ?" - PreparedStatement stmt4 = DB.Characters.GetPreparedStatement(CharStatements.SEL_PINFO_MAILS); + PreparedStatement stmt4 = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_PINFO_MAILS); stmt4.AddValue(0, lowguid); SQLResult result6 = DB.Characters.Query(stmt4); if (!result6.IsEmpty()) @@ -1536,7 +1536,7 @@ namespace Game.Chat { if (WorldConfig.GetBoolValue(WorldCfg.BattlegroundStoreStatisticsEnable)) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_PVPSTATS_FACTIONS_OVERALL); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_PVPSTATS_FACTIONS_OVERALL); SQLResult result = DB.Characters.Query(stmt); if (!result.IsEmpty()) @@ -1901,7 +1901,7 @@ namespace Game.Chat } // If player found: delete his freeze aura - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_AURA_FROZEN); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_AURA_FROZEN); stmt.AddValue(0, guid.GetCounter()); DB.Characters.Execute(stmt); @@ -1953,7 +1953,7 @@ namespace Game.Chat target.GetSession().m_muteTime = 0; } - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.UPD_MUTE_TIME); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.UPD_MUTE_TIME); stmt.AddValue(0, 0); stmt.AddValue(1, ""); stmt.AddValue(2, ""); @@ -2013,7 +2013,7 @@ namespace Game.Chat if (!player) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHAR_HOMEBIND); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHAR_HOMEBIND); stmt.AddValue(0, targetGUID.GetCounter()); SQLResult result = DB.Characters.Query(stmt); if (!result.IsEmpty()) diff --git a/Source/Game/Chat/Commands/NPCCommands.cs b/Source/Game/Chat/Commands/NPCCommands.cs index a509b3bc4..df33ae132 100644 --- a/Source/Game/Chat/Commands/NPCCommands.cs +++ b/Source/Game/Chat/Commands/NPCCommands.cs @@ -191,7 +191,7 @@ namespace Game.Chat Global.ObjectMgr.AddCreatureToGrid(data); // update position in DB - PreparedStatement stmt = DB.World.GetPreparedStatement(WorldStatements.UPD_CREATURE_POSITION); + PreparedStatement stmt = WorldDatabase.GetPreparedStatement(WorldStatements.UPD_CREATURE_POSITION); stmt.AddValue(0, player.GetPositionX()); stmt.AddValue(1, player.GetPositionY()); stmt.AddValue(2, player.GetPositionZ()); @@ -216,7 +216,7 @@ namespace Game.Chat Player player = handler.GetPlayer(); - PreparedStatement stmt = DB.World.GetPreparedStatement(WorldStatements.SEL_CREATURE_NEAREST); + PreparedStatement stmt = WorldDatabase.GetPreparedStatement(WorldStatements.SEL_CREATURE_NEAREST); stmt.AddValue(0, player.GetPositionX()); stmt.AddValue(1, player.GetPositionY()); stmt.AddValue(2, player.GetPositionZ()); @@ -658,7 +658,7 @@ namespace Game.Chat } // Update movement type - PreparedStatement stmt = DB.World.GetPreparedStatement(WorldStatements.UPD_CREATURE_MOVEMENT_TYPE); + PreparedStatement stmt = WorldDatabase.GetPreparedStatement(WorldStatements.UPD_CREATURE_MOVEMENT_TYPE); stmt.AddValue(0, (byte)MovementGeneratorType.Waypoint); stmt.AddValue(1, lowGuid); DB.World.Execute(stmt); @@ -695,7 +695,7 @@ namespace Game.Chat FormationMgr.AddFormationMember(lowguid, followAngle, followDist, leaderGUID, groupAI); creature.SearchFormation(); - PreparedStatement stmt = DB.World.GetPreparedStatement(WorldStatements.INS_CREATURE_FORMATION); + PreparedStatement stmt = WorldDatabase.GetPreparedStatement(WorldStatements.INS_CREATURE_FORMATION); stmt.AddValue(0, leaderGUID); stmt.AddValue(1, lowguid); stmt.AddValue(2, followAngle); @@ -936,7 +936,7 @@ namespace Game.Chat cinfo.Faction = factionId; // ..and DB - PreparedStatement stmt = DB.World.GetPreparedStatement(WorldStatements.UPD_CREATURE_FACTION); + PreparedStatement stmt = WorldDatabase.GetPreparedStatement(WorldStatements.UPD_CREATURE_FACTION); stmt.AddValue(0, factionId); stmt.AddValue(1, factionId); @@ -960,7 +960,7 @@ namespace Game.Chat creature.ReplaceAllNpcFlags(npcFlags); creature.ReplaceAllNpcFlags2(npcFlags2); - PreparedStatement stmt = DB.World.GetPreparedStatement(WorldStatements.UPD_CREATURE_NPCFLAG); + PreparedStatement stmt = WorldDatabase.GetPreparedStatement(WorldStatements.UPD_CREATURE_NPCFLAG); stmt.AddValue(0, (ulong)npcFlags | ((ulong)npcFlags2 << 32)); stmt.AddValue(1, creature.GetEntry()); DB.World.Execute(stmt); @@ -1216,7 +1216,7 @@ namespace Game.Chat creature.Respawn(); } - PreparedStatement stmt = DB.World.GetPreparedStatement(WorldStatements.UPD_CREATURE_WANDER_DISTANCE); + PreparedStatement stmt = WorldDatabase.GetPreparedStatement(WorldStatements.UPD_CREATURE_WANDER_DISTANCE); stmt.AddValue(0, option); stmt.AddValue(1, (byte)mtype); stmt.AddValue(2, guidLow); @@ -1234,7 +1234,7 @@ namespace Game.Chat if (!creature) return false; - PreparedStatement stmt = DB.World.GetPreparedStatement(WorldStatements.UPD_CREATURE_SPAWN_TIME_SECS); + PreparedStatement stmt = WorldDatabase.GetPreparedStatement(WorldStatements.UPD_CREATURE_SPAWN_TIME_SECS); stmt.AddValue(0, spawnTime); stmt.AddValue(1, creature.GetSpawnId()); DB.World.Execute(stmt); diff --git a/Source/Game/Chat/Commands/ReloadCommand.cs b/Source/Game/Chat/Commands/ReloadCommand.cs index 4c2a3ac7d..1bc7b1f3b 100644 --- a/Source/Game/Chat/Commands/ReloadCommand.cs +++ b/Source/Game/Chat/Commands/ReloadCommand.cs @@ -206,7 +206,7 @@ namespace Game.Chat uint entry; while ((entry = args.NextUInt32()) != 0) { - PreparedStatement stmt = DB.World.GetPreparedStatement(WorldStatements.SEL_CREATURE_TEMPLATE); + PreparedStatement stmt = WorldDatabase.GetPreparedStatement(WorldStatements.SEL_CREATURE_TEMPLATE); stmt.AddValue(0, entry); stmt.AddValue(1, 0); SQLResult result = DB.World.Query(stmt); diff --git a/Source/Game/Chat/Commands/ResetCommands.cs b/Source/Game/Chat/Commands/ResetCommands.cs index b106b337f..0536b7b7a 100644 --- a/Source/Game/Chat/Commands/ResetCommands.cs +++ b/Source/Game/Chat/Commands/ResetCommands.cs @@ -132,7 +132,7 @@ namespace Game.Chat } else { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_ADD_AT_LOGIN_FLAG); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_ADD_AT_LOGIN_FLAG); stmt.AddValue(0, (ushort)AtLoginFlags.ResetSpells); stmt.AddValue(1, player.GetGUID().GetCounter()); DB.Characters.Execute(stmt); @@ -192,7 +192,7 @@ namespace Game.Chat } else if (!player.GetGUID().IsEmpty()) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_ADD_AT_LOGIN_FLAG); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_ADD_AT_LOGIN_FLAG); stmt.AddValue(0, (ushort)(AtLoginFlags.None | AtLoginFlags.ResetPetTalents)); stmt.AddValue(1, player.GetGUID().GetCounter()); DB.Characters.Execute(stmt); @@ -232,7 +232,7 @@ namespace Game.Chat return false; } - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_ALL_AT_LOGIN_FLAGS); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_ALL_AT_LOGIN_FLAGS); stmt.AddValue(0, (ushort)atLogin); DB.Characters.Execute(stmt); diff --git a/Source/Game/Chat/Commands/TeleCommands.cs b/Source/Game/Chat/Commands/TeleCommands.cs index a5ab231f8..f2f9e54d7 100644 --- a/Source/Game/Chat/Commands/TeleCommands.cs +++ b/Source/Game/Chat/Commands/TeleCommands.cs @@ -238,7 +238,7 @@ namespace Game.Chat target.TeleportTo(target.GetHomebind()); else { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHAR_HOMEBIND); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHAR_HOMEBIND); stmt.AddValue(0, player.GetGUID().GetCounter()); SQLResult result = DB.Characters.Query(stmt); diff --git a/Source/Game/Chat/Commands/WPCommands.cs b/Source/Game/Chat/Commands/WPCommands.cs index ad7cb63b7..41bce7675 100644 --- a/Source/Game/Chat/Commands/WPCommands.cs +++ b/Source/Game/Chat/Commands/WPCommands.cs @@ -29,7 +29,7 @@ namespace Game.Chat.Commands pathId = target.GetWaypointPath(); else { - stmt = DB.World.GetPreparedStatement(WorldStatements.SEL_WAYPOINT_DATA_MAX_ID); + stmt = WorldDatabase.GetPreparedStatement(WorldStatements.SEL_WAYPOINT_DATA_MAX_ID); SQLResult result1 = DB.World.Query(stmt); uint maxpathid = result1.Read(0); @@ -49,7 +49,7 @@ namespace Game.Chat.Commands return true; } - stmt = DB.World.GetPreparedStatement(WorldStatements.SEL_WAYPOINT_DATA_MAX_POINT); + stmt = WorldDatabase.GetPreparedStatement(WorldStatements.SEL_WAYPOINT_DATA_MAX_POINT); stmt.AddValue(0, pathId); SQLResult result = DB.World.Query(stmt); @@ -58,7 +58,7 @@ namespace Game.Chat.Commands Player player = handler.GetSession().GetPlayer(); - stmt = DB.World.GetPreparedStatement(WorldStatements.INS_WAYPOINT_DATA); + stmt = WorldDatabase.GetPreparedStatement(WorldStatements.INS_WAYPOINT_DATA); stmt.AddValue(0, pathId); stmt.AddValue(1, point + 1); stmt.AddValue(2, player.GetPositionX()); @@ -85,13 +85,13 @@ namespace Game.Chat.Commands { if (id != 0) { - stmt = DB.World.GetPreparedStatement(WorldStatements.SEL_WAYPOINT_SCRIPT_ID_BY_GUID); + stmt = WorldDatabase.GetPreparedStatement(WorldStatements.SEL_WAYPOINT_SCRIPT_ID_BY_GUID); stmt.AddValue(0, id); SQLResult result = DB.World.Query(stmt); if (result.IsEmpty()) { - stmt = DB.World.GetPreparedStatement(WorldStatements.INS_WAYPOINT_SCRIPT); + stmt = WorldDatabase.GetPreparedStatement(WorldStatements.INS_WAYPOINT_SCRIPT); stmt.AddValue(0, id); DB.World.Execute(stmt); @@ -102,11 +102,11 @@ namespace Game.Chat.Commands } else { - stmt = DB.World.GetPreparedStatement(WorldStatements.SEL_WAYPOINT_SCRIPTS_MAX_ID); + stmt = WorldDatabase.GetPreparedStatement(WorldStatements.SEL_WAYPOINT_SCRIPTS_MAX_ID); SQLResult result = DB.World.Query(stmt); id = result.Read(0); - stmt = DB.World.GetPreparedStatement(WorldStatements.INS_WAYPOINT_SCRIPT); + stmt = WorldDatabase.GetPreparedStatement(WorldStatements.INS_WAYPOINT_SCRIPT); stmt.AddValue(0, id + 1); DB.World.Execute(stmt); @@ -128,7 +128,7 @@ namespace Game.Chat.Commands float a8, a9, a10, a11; string a7; - stmt = DB.World.GetPreparedStatement(WorldStatements.SEL_WAYPOINT_SCRIPT_BY_ID); + stmt = WorldDatabase.GetPreparedStatement(WorldStatements.SEL_WAYPOINT_SCRIPT_BY_ID); stmt.AddValue(0, id); SQLResult result = DB.World.Query(stmt); @@ -166,13 +166,13 @@ namespace Game.Chat.Commands return true; } - stmt = DB.World.GetPreparedStatement(WorldStatements.SEL_WAYPOINT_SCRIPT_ID_BY_GUID); + stmt = WorldDatabase.GetPreparedStatement(WorldStatements.SEL_WAYPOINT_SCRIPT_ID_BY_GUID); stmt.AddValue(0, id); SQLResult result = DB.World.Query(stmt); if (!result.IsEmpty()) { - stmt = DB.World.GetPreparedStatement(WorldStatements.DEL_WAYPOINT_SCRIPT); + stmt = WorldDatabase.GetPreparedStatement(WorldStatements.DEL_WAYPOINT_SCRIPT); stmt.AddValue(0, id); DB.World.Execute(stmt); @@ -218,7 +218,7 @@ namespace Game.Chat.Commands return false; handler.SendSysMessage("|cff00ff00Wp Event: Waypoint script guid: {0}|r|cff00ffff id changed: |r|cff00ff00{1}|r", newid, id); - stmt = DB.World.GetPreparedStatement(WorldStatements.UPD_WAYPOINT_SCRIPT_ID); + stmt = WorldDatabase.GetPreparedStatement(WorldStatements.UPD_WAYPOINT_SCRIPT_ID); stmt.AddValue(0, newid); stmt.AddValue(1, id); @@ -228,7 +228,7 @@ namespace Game.Chat.Commands } else { - stmt = DB.World.GetPreparedStatement(WorldStatements.SEL_WAYPOINT_SCRIPT_ID_BY_GUID); + stmt = WorldDatabase.GetPreparedStatement(WorldStatements.SEL_WAYPOINT_SCRIPT_ID_BY_GUID); stmt.AddValue(0, id); SQLResult result = DB.World.Query(stmt); @@ -243,7 +243,7 @@ namespace Game.Chat.Commands if (!float.TryParse(arg2, out float arg3)) return false; - stmt = DB.World.GetPreparedStatement(WorldStatements.UPD_WAYPOINT_SCRIPT_X); + stmt = WorldDatabase.GetPreparedStatement(WorldStatements.UPD_WAYPOINT_SCRIPT_X); stmt.AddValue(0, arg3); stmt.AddValue(1, id); DB.World.Execute(stmt); @@ -256,7 +256,7 @@ namespace Game.Chat.Commands if (!float.TryParse(arg2, out float arg3)) return false; - stmt = DB.World.GetPreparedStatement(WorldStatements.UPD_WAYPOINT_SCRIPT_Y); + stmt = WorldDatabase.GetPreparedStatement(WorldStatements.UPD_WAYPOINT_SCRIPT_Y); stmt.AddValue(0, arg3); stmt.AddValue(1, id); DB.World.Execute(stmt); @@ -269,7 +269,7 @@ namespace Game.Chat.Commands if (!float.TryParse(arg2, out float arg3)) return false; - stmt = DB.World.GetPreparedStatement(WorldStatements.UPD_WAYPOINT_SCRIPT_Z); + stmt = WorldDatabase.GetPreparedStatement(WorldStatements.UPD_WAYPOINT_SCRIPT_Z); stmt.AddValue(0, arg3); stmt.AddValue(1, id); DB.World.Execute(stmt); @@ -282,7 +282,7 @@ namespace Game.Chat.Commands if (!float.TryParse(arg2, out float arg3)) return false; - stmt = DB.World.GetPreparedStatement(WorldStatements.UPD_WAYPOINT_SCRIPT_O); + stmt = WorldDatabase.GetPreparedStatement(WorldStatements.UPD_WAYPOINT_SCRIPT_O); stmt.AddValue(0, arg3); stmt.AddValue(1, id); DB.World.Execute(stmt); @@ -341,26 +341,26 @@ namespace Game.Chat.Commands ulong guidLow = target.GetSpawnId(); - PreparedStatement stmt = DB.World.GetPreparedStatement(WorldStatements.SEL_CREATURE_ADDON_BY_GUID); + PreparedStatement stmt = WorldDatabase.GetPreparedStatement(WorldStatements.SEL_CREATURE_ADDON_BY_GUID); stmt.AddValue(0, guidLow); SQLResult result = DB.World.Query(stmt); if (!result.IsEmpty()) { - stmt = DB.World.GetPreparedStatement(WorldStatements.UPD_CREATURE_ADDON_PATH); + stmt = WorldDatabase.GetPreparedStatement(WorldStatements.UPD_CREATURE_ADDON_PATH); stmt.AddValue(0, pathId); stmt.AddValue(1, guidLow); } else { - stmt = DB.World.GetPreparedStatement(WorldStatements.INS_CREATURE_ADDON); + stmt = WorldDatabase.GetPreparedStatement(WorldStatements.INS_CREATURE_ADDON); stmt.AddValue(0, guidLow); stmt.AddValue(1, pathId); } DB.World.Execute(stmt); - stmt = DB.World.GetPreparedStatement(WorldStatements.UPD_CREATURE_MOVEMENT_TYPE); + stmt = WorldDatabase.GetPreparedStatement(WorldStatements.UPD_CREATURE_MOVEMENT_TYPE); stmt.AddValue(0, (byte)MovementGeneratorType.Waypoint); stmt.AddValue(1, guidLow); @@ -404,7 +404,7 @@ namespace Game.Chat.Commands } // Check the creature - PreparedStatement stmt = DB.World.GetPreparedStatement(WorldStatements.SEL_WAYPOINT_DATA_BY_WPGUID); + PreparedStatement stmt = WorldDatabase.GetPreparedStatement(WorldStatements.SEL_WAYPOINT_DATA_BY_WPGUID); stmt.AddValue(0, target.GetSpawnId()); SQLResult result = DB.World.Query(stmt); @@ -418,7 +418,7 @@ namespace Game.Chat.Commands // See also: http://dev.mysql.com/doc/refman/5.0/en/problems-with-float.html string maxDiff = "0.01"; - stmt = DB.World.GetPreparedStatement(WorldStatements.SEL_WAYPOINT_DATA_BY_POS); + stmt = WorldDatabase.GetPreparedStatement(WorldStatements.SEL_WAYPOINT_DATA_BY_POS); stmt.AddValue(0, target.GetPositionX()); stmt.AddValue(1, maxDiff); stmt.AddValue(2, target.GetPositionY()); @@ -458,12 +458,12 @@ namespace Game.Chat.Commands if (Creature.DeleteFromDB(target.GetSpawnId())) { - stmt = DB.World.GetPreparedStatement(WorldStatements.DEL_WAYPOINT_DATA); + stmt = WorldDatabase.GetPreparedStatement(WorldStatements.DEL_WAYPOINT_DATA); stmt.AddValue(0, pathid); stmt.AddValue(1, point); DB.World.Execute(stmt); - stmt = DB.World.GetPreparedStatement(WorldStatements.UPD_WAYPOINT_DATA_POINT); + stmt = WorldDatabase.GetPreparedStatement(WorldStatements.UPD_WAYPOINT_DATA_POINT); stmt.AddValue(0, pathid); stmt.AddValue(1, point); DB.World.Execute(stmt); @@ -518,7 +518,7 @@ namespace Game.Chat.Commands return false; } - stmt = DB.World.GetPreparedStatement(WorldStatements.UPD_WAYPOINT_DATA_POSITION); + stmt = WorldDatabase.GetPreparedStatement(WorldStatements.UPD_WAYPOINT_DATA_POSITION); stmt.AddValue(0, chr.GetPositionX()); stmt.AddValue(1, chr.GetPositionY()); stmt.AddValue(2, chr.GetPositionZ()); @@ -604,7 +604,7 @@ namespace Game.Chat.Commands return false; } - PreparedStatement stmt = DB.World.GetPreparedStatement(WorldStatements.SEL_WAYPOINT_DATA_ALL_BY_WPGUID); + PreparedStatement stmt = WorldDatabase.GetPreparedStatement(WorldStatements.SEL_WAYPOINT_DATA_ALL_BY_WPGUID); stmt.AddValue(0, target.GetSpawnId()); SQLResult result = DB.World.Query(stmt); @@ -637,7 +637,7 @@ namespace Game.Chat.Commands if (subCommand == "on") { - PreparedStatement stmt = DB.World.GetPreparedStatement(WorldStatements.SEL_WAYPOINT_DATA_POS_BY_ID); + PreparedStatement stmt = WorldDatabase.GetPreparedStatement(WorldStatements.SEL_WAYPOINT_DATA_POS_BY_ID); stmt.AddValue(0, pathId); SQLResult result = DB.World.Query(stmt); @@ -650,7 +650,7 @@ namespace Game.Chat.Commands handler.SendSysMessage("|cff00ff00DEBUG: wp on, PathID: |cff00ffff{0}|r", pathId); // Delete all visuals for this NPC - stmt = DB.World.GetPreparedStatement(WorldStatements.SEL_WAYPOINT_DATA_WPGUID_BY_ID); + stmt = WorldDatabase.GetPreparedStatement(WorldStatements.SEL_WAYPOINT_DATA_WPGUID_BY_ID); stmt.AddValue(0, pathId); SQLResult result2 = DB.World.Query(stmt); @@ -723,7 +723,7 @@ namespace Game.Chat.Commands } // Set "wpguid" column to the visual waypoint - stmt = DB.World.GetPreparedStatement(WorldStatements.UPD_WAYPOINT_DATA_WPGUID); + stmt = WorldDatabase.GetPreparedStatement(WorldStatements.UPD_WAYPOINT_DATA_WPGUID); stmt.AddValue(0, creature.GetSpawnId()); stmt.AddValue(1, pathId); stmt.AddValue(2, point); @@ -739,7 +739,7 @@ namespace Game.Chat.Commands { handler.SendSysMessage("|cff00ff00DEBUG: wp first, pathid: {0}|r", pathId); - PreparedStatement stmt = DB.World.GetPreparedStatement(WorldStatements.SEL_WAYPOINT_DATA_POS_FIRST_BY_ID); + PreparedStatement stmt = WorldDatabase.GetPreparedStatement(WorldStatements.SEL_WAYPOINT_DATA_POS_FIRST_BY_ID); stmt.AddValue(0, pathId); SQLResult result = DB.World.Query(stmt); @@ -793,7 +793,7 @@ namespace Game.Chat.Commands { handler.SendSysMessage("|cff00ff00DEBUG: wp last, PathID: |r|cff00ffff{0}|r", pathId); - PreparedStatement stmt = DB.World.GetPreparedStatement(WorldStatements.SEL_WAYPOINT_DATA_POS_LAST_BY_ID); + PreparedStatement stmt = WorldDatabase.GetPreparedStatement(WorldStatements.SEL_WAYPOINT_DATA_POS_LAST_BY_ID); stmt.AddValue(0, pathId); SQLResult result = DB.World.Query(stmt); @@ -846,7 +846,7 @@ namespace Game.Chat.Commands if (subCommand == "off") { - PreparedStatement stmt = DB.World.GetPreparedStatement(WorldStatements.SEL_CREATURE_BY_ID); + PreparedStatement stmt = WorldDatabase.GetPreparedStatement(WorldStatements.SEL_CREATURE_BY_ID); stmt.AddValue(0, 1); SQLResult result = DB.World.Query(stmt); @@ -868,7 +868,7 @@ namespace Game.Chat.Commands } while (result.NextRow()); // set "wpguid" column to "empty" - no visual waypoint spawned - stmt = DB.World.GetPreparedStatement(WorldStatements.UPD_WAYPOINT_DATA_ALL_WPGUID); + stmt = WorldDatabase.GetPreparedStatement(WorldStatements.UPD_WAYPOINT_DATA_ALL_WPGUID); DB.World.Execute(stmt); //DB.World.PExecute("UPDATE creature_movement SET wpguid = '0' WHERE wpguid <> '0'"); @@ -912,13 +912,13 @@ namespace Game.Chat.Commands return true; } - PreparedStatement stmt = DB.World.GetPreparedStatement(WorldStatements.DEL_CREATURE_ADDON); + PreparedStatement stmt = WorldDatabase.GetPreparedStatement(WorldStatements.DEL_CREATURE_ADDON); stmt.AddValue(0, guidLow); DB.World.Execute(stmt); target.UpdateCurrentWaypointInfo(0, 0); - stmt = DB.World.GetPreparedStatement(WorldStatements.UPD_CREATURE_MOVEMENT_TYPE); + stmt = WorldDatabase.GetPreparedStatement(WorldStatements.UPD_CREATURE_MOVEMENT_TYPE); stmt.AddValue(0, (byte)MovementGeneratorType.Idle); stmt.AddValue(1, guidLow); DB.World.Execute(stmt); diff --git a/Source/Game/DataStorage/ClientReader/DB6Storage.cs b/Source/Game/DataStorage/ClientReader/DB6Storage.cs index d33d3187a..06789d647 100644 --- a/Source/Game/DataStorage/ClientReader/DB6Storage.cs +++ b/Source/Game/DataStorage/ClientReader/DB6Storage.cs @@ -77,7 +77,7 @@ namespace Game.DataStorage void LoadFromDB(bool custom, HotfixStatements preparedStatement) { // Even though this query is executed only once, prepared statement is used to send data from mysql server in binary format - PreparedStatement stmt = DB.Hotfix.GetPreparedStatement(preparedStatement); + PreparedStatement stmt = HotfixDatabase.GetPreparedStatement(preparedStatement); stmt.AddValue(0, !custom); SQLResult result = DB.Hotfix.Query(stmt); if (result.IsEmpty()) @@ -230,7 +230,7 @@ namespace Game.DataStorage void LoadStringsFromDB(bool custom, Locale locale, HotfixStatements preparedStatement) { - PreparedStatement stmt = DB.Hotfix.GetPreparedStatement(preparedStatement); + PreparedStatement stmt = HotfixDatabase.GetPreparedStatement(preparedStatement); stmt.AddValue(0, !custom); stmt.AddValue(1, locale.ToString()); SQLResult result = DB.Hotfix.Query(stmt); diff --git a/Source/Game/DungeonFinding/LFGManager.cs b/Source/Game/DungeonFinding/LFGManager.cs index e5a98c4a0..a27e8ec80 100644 --- a/Source/Game/DungeonFinding/LFGManager.cs +++ b/Source/Game/DungeonFinding/LFGManager.cs @@ -79,11 +79,11 @@ namespace Game.DungeonFinding SQLTransaction trans = new(); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_LFG_DATA); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_LFG_DATA); stmt.AddValue(0, db_guid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_LFG_DATA); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_LFG_DATA); stmt.AddValue(0, db_guid); stmt.AddValue(1, GetDungeon(guid)); stmt.AddValue(2, (uint)GetState(guid)); diff --git a/Source/Game/Entities/Corpse.cs b/Source/Game/Entities/Corpse.cs index 024bb68dc..32cf0b192 100644 --- a/Source/Game/Entities/Corpse.cs +++ b/Source/Game/Entities/Corpse.cs @@ -96,7 +96,7 @@ namespace Game.Entities items.Append($"{m_corpseData.Items[i]} "); byte index = 0; - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_CORPSE); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_CORPSE); stmt.AddValue(index++, GetOwnerGUID().GetCounter()); // guid stmt.AddValue(index++, GetPositionX()); // posX stmt.AddValue(index++, GetPositionY()); // posY @@ -118,7 +118,7 @@ namespace Game.Entities foreach (var phaseId in GetPhaseShift().GetPhases().Keys) { index = 0; - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_CORPSE_PHASES); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_CORPSE_PHASES); stmt.AddValue(index++, GetOwnerGUID().GetCounter()); // OwnerGuid stmt.AddValue(index++, phaseId); // PhaseId trans.Append(stmt); @@ -127,7 +127,7 @@ namespace Game.Entities foreach (var customization in m_corpseData.Customizations) { index = 0; - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_CORPSE_CUSTOMIZATIONS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_CORPSE_CUSTOMIZATIONS); stmt.AddValue(index++, GetOwnerGUID().GetCounter()); // OwnerGuid stmt.AddValue(index++, customization.ChrCustomizationOptionID); stmt.AddValue(index++, customization.ChrCustomizationChoiceID); @@ -144,15 +144,15 @@ namespace Game.Entities public static void DeleteFromDB(ObjectGuid ownerGuid, SQLTransaction trans) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CORPSE); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CORPSE); stmt.AddValue(0, ownerGuid.GetCounter()); DB.Characters.ExecuteOrAppend(trans, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CORPSE_PHASES); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CORPSE_PHASES); stmt.AddValue(0, ownerGuid.GetCounter()); DB.Characters.ExecuteOrAppend(trans, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CORPSE_CUSTOMIZATIONS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CORPSE_CUSTOMIZATIONS); stmt.AddValue(0, ownerGuid.GetCounter()); DB.Characters.ExecuteOrAppend(trans, stmt); } diff --git a/Source/Game/Entities/Creature/Creature.cs b/Source/Game/Entities/Creature/Creature.cs index f197382e5..94bcaf374 100644 --- a/Source/Game/Entities/Creature/Creature.cs +++ b/Source/Game/Entities/Creature/Creature.cs @@ -1337,13 +1337,13 @@ namespace Game.Entities // update in DB SQLTransaction trans = new(); - PreparedStatement stmt = DB.World.GetPreparedStatement(WorldStatements.DEL_CREATURE); + PreparedStatement stmt = WorldDatabase.GetPreparedStatement(WorldStatements.DEL_CREATURE); stmt.AddValue(0, m_spawnId); trans.Append(stmt); byte index = 0; - stmt = DB.World.GetPreparedStatement(WorldStatements.INS_CREATURE); + stmt = WorldDatabase.GetPreparedStatement(WorldStatements.INS_CREATURE); stmt.AddValue(index++, m_spawnId); stmt.AddValue(index++, GetEntry()); stmt.AddValue(index++, mapid); @@ -1672,43 +1672,43 @@ namespace Game.Entities // ... and the database trans = new(); - PreparedStatement stmt = DB.World.GetPreparedStatement(WorldStatements.DEL_CREATURE); + PreparedStatement stmt = WorldDatabase.GetPreparedStatement(WorldStatements.DEL_CREATURE); stmt.AddValue(0, spawnId); trans.Append(stmt); - stmt = DB.World.GetPreparedStatement(WorldStatements.DEL_SPAWNGROUP_MEMBER); + stmt = WorldDatabase.GetPreparedStatement(WorldStatements.DEL_SPAWNGROUP_MEMBER); stmt.AddValue(0, (byte)SpawnObjectType.Creature); stmt.AddValue(1, spawnId); trans.Append(stmt); - stmt = DB.World.GetPreparedStatement(WorldStatements.DEL_CREATURE_ADDON); + stmt = WorldDatabase.GetPreparedStatement(WorldStatements.DEL_CREATURE_ADDON); stmt.AddValue(0, spawnId); trans.Append(stmt); - stmt = DB.World.GetPreparedStatement(WorldStatements.DEL_GAME_EVENT_CREATURE); + stmt = WorldDatabase.GetPreparedStatement(WorldStatements.DEL_GAME_EVENT_CREATURE); stmt.AddValue(0, spawnId); trans.Append(stmt); - stmt = DB.World.GetPreparedStatement(WorldStatements.DEL_GAME_EVENT_MODEL_EQUIP); + stmt = WorldDatabase.GetPreparedStatement(WorldStatements.DEL_GAME_EVENT_MODEL_EQUIP); stmt.AddValue(0, spawnId); trans.Append(stmt); - stmt = DB.World.GetPreparedStatement(WorldStatements.DEL_LINKED_RESPAWN); + stmt = WorldDatabase.GetPreparedStatement(WorldStatements.DEL_LINKED_RESPAWN); stmt.AddValue(0, spawnId); stmt.AddValue(1, (uint)CreatureLinkedRespawnType.CreatureToCreature); trans.Append(stmt); - stmt = DB.World.GetPreparedStatement(WorldStatements.DEL_LINKED_RESPAWN); + stmt = WorldDatabase.GetPreparedStatement(WorldStatements.DEL_LINKED_RESPAWN); stmt.AddValue(0, spawnId); stmt.AddValue(1, (uint)CreatureLinkedRespawnType.CreatureToGO); trans.Append(stmt); - stmt = DB.World.GetPreparedStatement(WorldStatements.DEL_LINKED_RESPAWN_MASTER); + stmt = WorldDatabase.GetPreparedStatement(WorldStatements.DEL_LINKED_RESPAWN_MASTER); stmt.AddValue(0, spawnId); stmt.AddValue(1, (uint)CreatureLinkedRespawnType.CreatureToCreature); trans.Append(stmt); - stmt = DB.World.GetPreparedStatement(WorldStatements.DEL_LINKED_RESPAWN_MASTER); + stmt = WorldDatabase.GetPreparedStatement(WorldStatements.DEL_LINKED_RESPAWN_MASTER); stmt.AddValue(0, spawnId); stmt.AddValue(1, (uint)CreatureLinkedRespawnType.GOToCreature); trans.Append(stmt); diff --git a/Source/Game/Entities/GameObject/GameObject.cs b/Source/Game/Entities/GameObject/GameObject.cs index 15e51e1a0..836d85c88 100644 --- a/Source/Game/Entities/GameObject/GameObject.cs +++ b/Source/Game/Entities/GameObject/GameObject.cs @@ -1075,11 +1075,11 @@ namespace Game.Entities // Update in DB byte index = 0; - PreparedStatement stmt = DB.World.GetPreparedStatement(WorldStatements.DEL_GAMEOBJECT); + PreparedStatement stmt = WorldDatabase.GetPreparedStatement(WorldStatements.DEL_GAMEOBJECT); stmt.AddValue(0, m_spawnId); DB.World.Execute(stmt); - stmt = DB.World.GetPreparedStatement(WorldStatements.INS_GAMEOBJECT); + stmt = WorldDatabase.GetPreparedStatement(WorldStatements.INS_GAMEOBJECT); stmt.AddValue(index++, m_spawnId); stmt.AddValue(index++, GetEntry()); stmt.AddValue(index++, mapid); @@ -1194,35 +1194,35 @@ namespace Game.Entities trans = new(); // ... and the database - PreparedStatement stmt = DB.World.GetPreparedStatement(WorldStatements.DEL_GAMEOBJECT); + PreparedStatement stmt = WorldDatabase.GetPreparedStatement(WorldStatements.DEL_GAMEOBJECT); stmt.AddValue(0, spawnId); trans.Append(stmt); - stmt = DB.World.GetPreparedStatement(WorldStatements.DEL_EVENT_GAMEOBJECT); + stmt = WorldDatabase.GetPreparedStatement(WorldStatements.DEL_EVENT_GAMEOBJECT); stmt.AddValue(0, spawnId); trans.Append(stmt); - stmt = DB.World.GetPreparedStatement(WorldStatements.DEL_LINKED_RESPAWN); + stmt = WorldDatabase.GetPreparedStatement(WorldStatements.DEL_LINKED_RESPAWN); stmt.AddValue(0, spawnId); stmt.AddValue(1, (uint)CreatureLinkedRespawnType.GOToGO); trans.Append(stmt); - stmt = DB.World.GetPreparedStatement(WorldStatements.DEL_LINKED_RESPAWN); + stmt = WorldDatabase.GetPreparedStatement(WorldStatements.DEL_LINKED_RESPAWN); stmt.AddValue(0, spawnId); stmt.AddValue(1, (uint)CreatureLinkedRespawnType.GOToCreature); trans.Append(stmt); - stmt = DB.World.GetPreparedStatement(WorldStatements.DEL_LINKED_RESPAWN_MASTER); + stmt = WorldDatabase.GetPreparedStatement(WorldStatements.DEL_LINKED_RESPAWN_MASTER); stmt.AddValue(0, spawnId); stmt.AddValue(1, (uint)CreatureLinkedRespawnType.GOToGO); trans.Append(stmt); - stmt = DB.World.GetPreparedStatement(WorldStatements.DEL_LINKED_RESPAWN_MASTER); + stmt = WorldDatabase.GetPreparedStatement(WorldStatements.DEL_LINKED_RESPAWN_MASTER); stmt.AddValue(0, spawnId); stmt.AddValue(1, (uint)CreatureLinkedRespawnType.CreatureToGO); trans.Append(stmt); - stmt = DB.World.GetPreparedStatement(WorldStatements.DEL_GAMEOBJECT_ADDON); + stmt = WorldDatabase.GetPreparedStatement(WorldStatements.DEL_GAMEOBJECT_ADDON); stmt.AddValue(0, spawnId); trans.Append(stmt); diff --git a/Source/Game/Entities/Item/AzeriteEmpoweredItem.cs b/Source/Game/Entities/Item/AzeriteEmpoweredItem.cs index 41cf84f05..3d53826f7 100644 --- a/Source/Game/Entities/Item/AzeriteEmpoweredItem.cs +++ b/Source/Game/Entities/Item/AzeriteEmpoweredItem.cs @@ -36,7 +36,7 @@ namespace Game.Entities public override void SaveToDB(SQLTransaction trans) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_AZERITE_EMPOWERED); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_AZERITE_EMPOWERED); stmt.AddValue(0, GetGUID().GetCounter()); trans.Append(stmt); @@ -44,7 +44,7 @@ namespace Game.Entities { case ItemUpdateState.New: case ItemUpdateState.Changed: - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_ITEM_INSTANCE_AZERITE_EMPOWERED); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_ITEM_INSTANCE_AZERITE_EMPOWERED); stmt.AddValue(0, GetGUID().GetCounter()); for (int i = 0; i < SharedConst.MaxAzeriteEmpoweredTier; ++i) stmt.AddValue(1 + i, m_azeriteEmpoweredItemData.Selections[i]); @@ -79,7 +79,7 @@ namespace Game.Entities if (needSave) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_ITEM_INSTANCE_AZERITE_EMPOWERED); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_ITEM_INSTANCE_AZERITE_EMPOWERED); for (int i = 0; i < SharedConst.MaxAzeriteEmpoweredTier; ++i) stmt.AddValue(i, m_azeriteEmpoweredItemData.Selections[i]); @@ -90,7 +90,7 @@ namespace Game.Entities public static new void DeleteFromDB(SQLTransaction trans, ulong itemGuid) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_AZERITE_EMPOWERED); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_AZERITE_EMPOWERED); stmt.AddValue(0, itemGuid); DB.Characters.ExecuteOrAppend(trans, stmt); } diff --git a/Source/Game/Entities/Item/AzeriteItem.cs b/Source/Game/Entities/Item/AzeriteItem.cs index c18c307bf..8480db28c 100644 --- a/Source/Game/Entities/Item/AzeriteItem.cs +++ b/Source/Game/Entities/Item/AzeriteItem.cs @@ -38,15 +38,15 @@ namespace Game.Entities public override void SaveToDB(SQLTransaction trans) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_AZERITE); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_AZERITE); stmt.AddValue(0, GetGUID().GetCounter()); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_AZERITE_MILESTONE_POWER); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_AZERITE_MILESTONE_POWER); stmt.AddValue(0, GetGUID().GetCounter()); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_AZERITE_UNLOCKED_ESSENCE); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_AZERITE_UNLOCKED_ESSENCE); stmt.AddValue(0, GetGUID().GetCounter()); trans.Append(stmt); @@ -54,7 +54,7 @@ namespace Game.Entities { case ItemUpdateState.New: case ItemUpdateState.Changed: - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_ITEM_INSTANCE_AZERITE); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_ITEM_INSTANCE_AZERITE); stmt.AddValue(0, GetGUID().GetCounter()); stmt.AddValue(1, m_azeriteItemData.Xp); stmt.AddValue(2, m_azeriteItemData.Level); @@ -78,7 +78,7 @@ namespace Game.Entities foreach (uint azeriteItemMilestonePowerId in m_azeriteItemData.UnlockedEssenceMilestones) { - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_ITEM_INSTANCE_AZERITE_MILESTONE_POWER); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_ITEM_INSTANCE_AZERITE_MILESTONE_POWER); stmt.AddValue(0, GetGUID().GetCounter()); stmt.AddValue(1, azeriteItemMilestonePowerId); trans.Append(stmt); @@ -86,7 +86,7 @@ namespace Game.Entities foreach (var azeriteEssence in m_azeriteItemData.UnlockedEssences) { - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_ITEM_INSTANCE_AZERITE_UNLOCKED_ESSENCE); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_ITEM_INSTANCE_AZERITE_UNLOCKED_ESSENCE); stmt.AddValue(0, GetGUID().GetCounter()); stmt.AddValue(1, azeriteEssence.AzeriteEssenceID); stmt.AddValue(2, azeriteEssence.Rank); @@ -171,7 +171,7 @@ namespace Game.Entities if (needSave) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_ITEM_INSTANCE_AZERITE_ON_LOAD); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_ITEM_INSTANCE_AZERITE_ON_LOAD); stmt.AddValue(0, azeriteData.Xp); stmt.AddValue(1, azeriteData.KnowledgeLevel); stmt.AddValue(2, GetGUID().GetCounter()); @@ -187,15 +187,15 @@ namespace Game.Entities public new static void DeleteFromDB(SQLTransaction trans, ulong itemGuid) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_AZERITE); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_AZERITE); stmt.AddValue(0, itemGuid); DB.Characters.ExecuteOrAppend(trans, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_AZERITE_MILESTONE_POWER); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_AZERITE_MILESTONE_POWER); stmt.AddValue(0, itemGuid); DB.Characters.ExecuteOrAppend(trans, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_AZERITE_UNLOCKED_ESSENCE); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_AZERITE_UNLOCKED_ESSENCE); stmt.AddValue(0, itemGuid); DB.Characters.ExecuteOrAppend(trans, stmt); } diff --git a/Source/Game/Entities/Item/Item.cs b/Source/Game/Entities/Item/Item.cs index 01e63781f..6dceaa960 100644 --- a/Source/Game/Entities/Item/Item.cs +++ b/Source/Game/Entities/Item/Item.cs @@ -135,7 +135,7 @@ namespace Game.Entities case ItemUpdateState.Changed: { byte index = 0; - stmt = DB.Characters.GetPreparedStatement(uState == ItemUpdateState.New ? CharStatements.REP_ITEM_INSTANCE : CharStatements.UPD_ITEM_INSTANCE); + stmt = CharacterDatabase.GetPreparedStatement(uState == ItemUpdateState.New ? CharStatements.REP_ITEM_INSTANCE : CharStatements.UPD_ITEM_INSTANCE); stmt.AddValue(index, GetEntry()); stmt.AddValue(++index, GetOwnerGUID().GetCounter()); stmt.AddValue(++index, GetCreator().GetCounter()); @@ -183,19 +183,19 @@ namespace Game.Entities if ((uState == ItemUpdateState.Changed) && IsWrapped()) { - stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_GIFT_OWNER); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_GIFT_OWNER); stmt.AddValue(0, GetOwnerGUID().GetCounter()); stmt.AddValue(1, GetGUID().GetCounter()); DB.Characters.Execute(stmt); } - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_GEMS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_GEMS); stmt.AddValue(0, GetGUID().GetCounter()); trans.Append(stmt); if (m_itemData.Gems.Size() != 0) { - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_ITEM_INSTANCE_GEMS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_ITEM_INSTANCE_GEMS); stmt.AddValue(0, GetGUID().GetCounter()); int i = 0; int gemFields = 4; @@ -260,13 +260,13 @@ namespace Game.Entities ItemModifier.TransmogSecondaryAppearanceSpec5 }; - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_TRANSMOG); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_TRANSMOG); stmt.AddValue(0, GetGUID().GetCounter()); trans.Append(stmt); if (transmogMods.Any(modifier => GetModifier(modifier) != 0)) { - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_ITEM_INSTANCE_TRANSMOG); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_ITEM_INSTANCE_TRANSMOG); stmt.AddValue(0, GetGUID().GetCounter()); stmt.AddValue(1, GetModifier(ItemModifier.TransmogAppearanceAllSpecs)); stmt.AddValue(2, GetModifier(ItemModifier.TransmogAppearanceSpec1)); @@ -289,17 +289,17 @@ namespace Game.Entities trans.Append(stmt); } - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_ARTIFACT); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_ARTIFACT); stmt.AddValue(0, GetGUID().GetCounter()); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_ARTIFACT_POWERS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_ARTIFACT_POWERS); stmt.AddValue(0, GetGUID().GetCounter()); trans.Append(stmt); if (GetTemplate().GetArtifactID() != 0) { - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_ITEM_INSTANCE_ARTIFACT); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_ITEM_INSTANCE_ARTIFACT); stmt.AddValue(0, GetGUID().GetCounter()); stmt.AddValue(1, (ulong)m_itemData.ArtifactXP); stmt.AddValue(2, GetModifier(ItemModifier.ArtifactAppearanceId)); @@ -308,7 +308,7 @@ namespace Game.Entities foreach (ArtifactPower artifactPower in m_itemData.ArtifactPowers) { - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_ITEM_INSTANCE_ARTIFACT_POWERS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_ITEM_INSTANCE_ARTIFACT_POWERS); stmt.AddValue(0, GetGUID().GetCounter()); stmt.AddValue(1, artifactPower.ArtifactPowerId); stmt.AddValue(2, artifactPower.PurchasedRank); @@ -322,13 +322,13 @@ namespace Game.Entities ItemModifier.ArtifactKnowledgeLevel }; - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_MODIFIERS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_MODIFIERS); stmt.AddValue(0, GetGUID().GetCounter()); trans.Append(stmt); if (modifiersTable.Any(modifier => GetModifier(modifier) != 0)) { - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_ITEM_INSTANCE_MODIFIERS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_ITEM_INSTANCE_MODIFIERS); stmt.AddValue(0, GetGUID().GetCounter()); stmt.AddValue(1, GetModifier(ItemModifier.TimewalkerLevel)); stmt.AddValue(2, GetModifier(ItemModifier.ArtifactKnowledgeLevel)); @@ -338,33 +338,33 @@ namespace Game.Entities } case ItemUpdateState.Removed: { - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE); stmt.AddValue(0, GetGUID().GetCounter()); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_GEMS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_GEMS); stmt.AddValue(0, GetGUID().GetCounter()); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_TRANSMOG); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_TRANSMOG); stmt.AddValue(0, GetGUID().GetCounter()); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_ARTIFACT); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_ARTIFACT); stmt.AddValue(0, GetGUID().GetCounter()); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_ARTIFACT_POWERS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_ARTIFACT_POWERS); stmt.AddValue(0, GetGUID().GetCounter()); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_MODIFIERS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_MODIFIERS); stmt.AddValue(0, GetGUID().GetCounter()); trans.Append(stmt); if (IsWrapped()) { - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_GIFT); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_GIFT); stmt.AddValue(0, GetGUID().GetCounter()); trans.Append(stmt); } @@ -540,7 +540,7 @@ namespace Game.Entities if (need_save) // normal item changed state set not work at loading { byte index = 0; - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_ITEM_INSTANCE_ON_LOAD); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_ITEM_INSTANCE_ON_LOAD); stmt.AddValue(index++, (uint)m_itemData.Expiration); stmt.AddValue(index++, (uint)m_itemData.DynamicFlags); stmt.AddValue(index++, (uint)m_itemData.Durability); @@ -639,31 +639,31 @@ namespace Game.Entities public static void DeleteFromDB(SQLTransaction trans, ulong itemGuid) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE); stmt.AddValue(0, itemGuid); DB.Characters.ExecuteOrAppend(trans, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_GEMS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_GEMS); stmt.AddValue(0, itemGuid); DB.Characters.ExecuteOrAppend(trans, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_TRANSMOG); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_TRANSMOG); stmt.AddValue(0, itemGuid); DB.Characters.ExecuteOrAppend(trans, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_ARTIFACT); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_ARTIFACT); stmt.AddValue(0, itemGuid); DB.Characters.ExecuteOrAppend(trans, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_ARTIFACT_POWERS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_ARTIFACT_POWERS); stmt.AddValue(0, itemGuid); DB.Characters.ExecuteOrAppend(trans, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_MODIFIERS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_MODIFIERS); stmt.AddValue(0, itemGuid); DB.Characters.ExecuteOrAppend(trans, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_GIFT); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_GIFT); stmt.AddValue(0, itemGuid); DB.Characters.ExecuteOrAppend(trans, stmt); } @@ -679,7 +679,7 @@ namespace Game.Entities public static void DeleteFromInventoryDB(SQLTransaction trans, ulong itemGuid) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_INVENTORY_BY_ITEM); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_INVENTORY_BY_ITEM); stmt.AddValue(0, itemGuid); trans.Append(stmt); } @@ -1374,7 +1374,7 @@ namespace Game.Entities { DeleteRefundDataFromDB(); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_ITEM_REFUND_INSTANCE); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_ITEM_REFUND_INSTANCE); stmt.AddValue(0, GetGUID().GetCounter()); stmt.AddValue(1, GetRefundRecipient().GetCounter()); stmt.AddValue(2, GetPaidMoney()); @@ -1384,7 +1384,7 @@ namespace Game.Entities public void DeleteRefundDataFromDB(SQLTransaction trans = null) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ITEM_REFUND_INSTANCE); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ITEM_REFUND_INSTANCE); stmt.AddValue(0, GetGUID().GetCounter()); if (trans != null) trans.Append(stmt); @@ -1467,7 +1467,7 @@ namespace Game.Entities currentOwner.GetSession().GetCollectionMgr().AddItemAppearance(this); allowedGUIDs.Clear(); SetState(ItemUpdateState.Changed, currentOwner); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ITEM_BOP_TRADE); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ITEM_BOP_TRADE); stmt.AddValue(0, GetGUID().GetCounter()); DB.Characters.Execute(stmt); } diff --git a/Source/Game/Entities/Pet.cs b/Source/Game/Entities/Pet.cs index 2ca7ff430..aef46bd0c 100644 --- a/Source/Game/Entities/Pet.cs +++ b/Source/Game/Entities/Pet.cs @@ -447,7 +447,7 @@ namespace Game.Entities trans = new SQLTransaction(); // remove current data - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_PET_BY_ID); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_PET_BY_ID); stmt.AddValue(0, GetCharmInfo().GetPetNumber()); trans.Append(stmt); @@ -457,7 +457,7 @@ namespace Game.Entities Cypher.Assert(owner.GetPetStable().GetCurrentPet() != null && owner.GetPetStable().GetCurrentPet().PetNumber == GetCharmInfo().GetPetNumber()); FillPetInfo(owner.GetPetStable().GetCurrentPet()); - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_PET); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_PET); stmt.AddValue(0, GetCharmInfo().GetPetNumber()); stmt.AddValue(1, GetEntry()); stmt.AddValue(2, ownerLowGUID); @@ -512,31 +512,31 @@ namespace Game.Entities { SQLTransaction trans = new(); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_PET_BY_ID); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_PET_BY_ID); stmt.AddValue(0, petNumber); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_PET_DECLINEDNAME); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_PET_DECLINEDNAME); stmt.AddValue(0, petNumber); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_PET_AURA_EFFECTS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_PET_AURA_EFFECTS); stmt.AddValue(0, petNumber); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_PET_AURAS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_PET_AURAS); stmt.AddValue(0, petNumber); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_PET_SPELLS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_PET_SPELLS); stmt.AddValue(0, petNumber); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_PET_SPELL_COOLDOWNS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_PET_SPELL_COOLDOWNS); stmt.AddValue(0, petNumber); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_PET_SPELL_CHARGES); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_PET_SPELL_CHARGES); stmt.AddValue(0, petNumber); trans.Append(stmt); @@ -815,7 +815,7 @@ namespace Game.Entities switch (pair.Value.state) { case PetSpellState.Removed: - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_PET_SPELL_BY_SPELL); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_PET_SPELL_BY_SPELL); stmt.AddValue(0, GetCharmInfo().GetPetNumber()); stmt.AddValue(1, pair.Key); trans.Append(stmt); @@ -823,19 +823,19 @@ namespace Game.Entities m_spells.Remove(pair.Key); continue; case PetSpellState.Changed: - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_PET_SPELL_BY_SPELL); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_PET_SPELL_BY_SPELL); stmt.AddValue(0, GetCharmInfo().GetPetNumber()); stmt.AddValue(1, pair.Key); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_PET_SPELL); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_PET_SPELL); stmt.AddValue(0, GetCharmInfo().GetPetNumber()); stmt.AddValue(1, pair.Key); stmt.AddValue(2, (byte)pair.Value.active); trans.Append(stmt); break; case PetSpellState.New: - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_PET_SPELL); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_PET_SPELL); stmt.AddValue(0, GetCharmInfo().GetPetNumber()); stmt.AddValue(1, pair.Key); stmt.AddValue(2, (byte)pair.Value.active); @@ -952,11 +952,11 @@ namespace Game.Entities void _SaveAuras(SQLTransaction trans) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_PET_AURA_EFFECTS); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_PET_AURA_EFFECTS); stmt.AddValue(0, GetCharmInfo().GetPetNumber()); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_PET_AURAS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_PET_AURAS); stmt.AddValue(0, GetCharmInfo().GetPetNumber()); trans.Append(stmt); @@ -977,7 +977,7 @@ namespace Game.Entities key.Caster.Clear(); index = 0; - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_PET_AURA); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_PET_AURA); stmt.AddValue(index++, GetCharmInfo().GetPetNumber()); stmt.AddValue(index++, key.Caster.GetRawValue()); stmt.AddValue(index++, key.SpellId); @@ -995,7 +995,7 @@ namespace Game.Entities if (effect != null) { index = 0; - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_PET_AURA_EFFECT); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_PET_AURA_EFFECT); stmt.AddValue(index++, GetCharmInfo().GetPetNumber()); stmt.AddValue(index++, key.Caster.GetRawValue()); stmt.AddValue(index++, key.SpellId); @@ -1019,7 +1019,7 @@ namespace Game.Entities { Log.outError(LogFilter.Pet, "addSpell: Non-existed in SpellStore spell #{0} request, deleting for all pets in `pet_spell`.", spellId); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_INVALID_PET_SPELL); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_INVALID_PET_SPELL); stmt.AddValue(0, spellId); @@ -1733,28 +1733,28 @@ namespace Game.Entities { public PetLoadQueryHolder(ulong ownerGuid, uint petNumber) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_PET_DECLINED_NAME); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_PET_DECLINED_NAME); stmt.AddValue(0, ownerGuid); stmt.AddValue(1, petNumber); SetQuery(PetLoginQueryLoad.DeclinedNames, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_PET_AURA); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_PET_AURA); stmt.AddValue(0, petNumber); SetQuery(PetLoginQueryLoad.Auras, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_PET_AURA_EFFECT); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_PET_AURA_EFFECT); stmt.AddValue(0, petNumber); SetQuery(PetLoginQueryLoad.AuraEffects, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_PET_SPELL); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_PET_SPELL); stmt.AddValue(0, petNumber); SetQuery(PetLoginQueryLoad.Spells, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_PET_SPELL_COOLDOWN); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_PET_SPELL_COOLDOWN); stmt.AddValue(0, petNumber); SetQuery(PetLoginQueryLoad.Cooldowns, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_PET_SPELL_CHARGES); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_PET_SPELL_CHARGES); stmt.AddValue(0, petNumber); SetQuery(PetLoginQueryLoad.Charges, stmt); } diff --git a/Source/Game/Entities/Player/CollectionManager.cs b/Source/Game/Entities/Player/CollectionManager.cs index 4766a26ac..443c5e8a8 100644 --- a/Source/Game/Entities/Player/CollectionManager.cs +++ b/Source/Game/Entities/Player/CollectionManager.cs @@ -100,7 +100,7 @@ namespace Game.Entities PreparedStatement stmt; foreach (var pair in _toys) { - stmt = DB.Login.GetPreparedStatement(LoginStatements.REP_ACCOUNT_TOYS); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.REP_ACCOUNT_TOYS); stmt.AddValue(0, _owner.GetBattlenetAccountId()); stmt.AddValue(1, pair.Key); stmt.AddValue(2, pair.Value.HasAnyFlag(ToyFlags.Favorite)); @@ -191,7 +191,7 @@ namespace Game.Entities PreparedStatement stmt; foreach (var heirloom in _heirlooms) { - stmt = DB.Login.GetPreparedStatement(LoginStatements.REP_ACCOUNT_HEIRLOOMS); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.REP_ACCOUNT_HEIRLOOMS); stmt.AddValue(0, _owner.GetBattlenetAccountId()); stmt.AddValue(1, heirloom.Key); stmt.AddValue(2, (uint)heirloom.Value.flags); @@ -356,7 +356,7 @@ namespace Game.Entities { foreach (var mount in _mounts) { - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.REP_ACCOUNT_MOUNTS); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.REP_ACCOUNT_MOUNTS); stmt.AddValue(0, _owner.GetBattlenetAccountId()); stmt.AddValue(1, mount.Key); stmt.AddValue(2, (byte)mount.Value); @@ -494,7 +494,7 @@ namespace Game.Entities { if (blockValue != 0) // this table is only appended/bits are set (never cleared) so don't save empty blocks { - stmt = DB.Login.GetPreparedStatement(LoginStatements.INS_BNET_ITEM_APPEARANCES); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.INS_BNET_ITEM_APPEARANCES); stmt.AddValue(0, _owner.GetBattlenetAccountId()); stmt.AddValue(1, blockIndex); stmt.AddValue(2, blockValue); @@ -510,14 +510,14 @@ namespace Game.Entities switch (appearanceState) { case FavoriteAppearanceState.New: - stmt = DB.Login.GetPreparedStatement(LoginStatements.INS_BNET_ITEM_FAVORITE_APPEARANCE); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.INS_BNET_ITEM_FAVORITE_APPEARANCE); stmt.AddValue(0, _owner.GetBattlenetAccountId()); stmt.AddValue(1, key); trans.Append(stmt); appearanceState = FavoriteAppearanceState.Unchanged; break; case FavoriteAppearanceState.Removed: - stmt = DB.Login.GetPreparedStatement(LoginStatements.DEL_BNET_ITEM_FAVORITE_APPEARANCE); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.DEL_BNET_ITEM_FAVORITE_APPEARANCE); stmt.AddValue(0, _owner.GetBattlenetAccountId()); stmt.AddValue(1, key); trans.Append(stmt); @@ -885,7 +885,7 @@ namespace Game.Entities { if (blockValue != 0) // this table is only appended/bits are set (never cleared) so don't save empty blocks { - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.INS_BNET_TRANSMOG_ILLUSIONS); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.INS_BNET_TRANSMOG_ILLUSIONS); stmt.AddValue(0, _owner.GetBattlenetAccountId()); stmt.AddValue(1, blockIndex); stmt.AddValue(2, blockValue); diff --git a/Source/Game/Entities/Player/PetitionManager.cs b/Source/Game/Entities/Player/PetitionManager.cs index 4386343df..50bed8fbe 100644 --- a/Source/Game/Entities/Player/PetitionManager.cs +++ b/Source/Game/Entities/Player/PetitionManager.cs @@ -74,7 +74,7 @@ namespace Game.Entities if (isLoading) return; - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_PETITION); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_PETITION); stmt.AddValue(0, ownerGuid.GetCounter()); stmt.AddValue(1, petitionGuid.GetCounter()); stmt.AddValue(2, name); @@ -88,11 +88,11 @@ namespace Game.Entities // Delete From DB SQLTransaction trans = new(); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_PETITION_BY_GUID); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_PETITION_BY_GUID); stmt.AddValue(0, petitionGuid.GetCounter()); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_PETITION_SIGNATURE_BY_GUID); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_PETITION_SIGNATURE_BY_GUID); stmt.AddValue(0, petitionGuid.GetCounter()); trans.Append(stmt); @@ -121,11 +121,11 @@ namespace Game.Entities } SQLTransaction trans = new(); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_PETITION_BY_OWNER); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_PETITION_BY_OWNER); stmt.AddValue(0, ownerGuid.GetCounter()); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_PETITION_SIGNATURE_BY_OWNER); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_PETITION_SIGNATURE_BY_OWNER); stmt.AddValue(0, ownerGuid.GetCounter()); trans.Append(stmt); DB.Characters.CommitTransaction(trans); @@ -136,7 +136,7 @@ namespace Game.Entities foreach (var petitionPair in _petitionStorage) petitionPair.Value.RemoveSignatureBySigner(signerGuid); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ALL_PETITION_SIGNATURES); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ALL_PETITION_SIGNATURES); stmt.AddValue(0, signerGuid.GetCounter()); DB.Characters.Execute(stmt); } @@ -165,7 +165,7 @@ namespace Game.Entities if (isLoading) return; - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_PETITION_SIGNATURE); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_PETITION_SIGNATURE); stmt.AddValue(0, ownerGuid.GetCounter()); stmt.AddValue(1, PetitionGuid.GetCounter()); stmt.AddValue(2, playerGuid.GetCounter()); @@ -178,7 +178,7 @@ namespace Game.Entities { PetitionName = newName; - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_PETITION_NAME); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_PETITION_NAME); stmt.AddValue(0, newName); stmt.AddValue(1, PetitionGuid.GetCounter()); DB.Characters.Execute(stmt); diff --git a/Source/Game/Entities/Player/Player.DB.cs b/Source/Game/Entities/Player/Player.DB.cs index 8f784ecab..db0b83240 100644 --- a/Source/Game/Entities/Player/Player.DB.cs +++ b/Source/Game/Entities/Player/Player.DB.cs @@ -231,7 +231,7 @@ namespace Game.Entities Log.outDebug(LogFilter.Player, "LoadInventory: player (GUID: {0}, name: {1}) has item (GUID: {2}, entry: {3}) with expired refund time ({4}). Deleting refund data and removing " + "efundable flag.", GetGUID().ToString(), GetName(), item.GetGUID().ToString(), item.GetEntry(), item.GetPlayedTime()); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ITEM_REFUND_INSTANCE); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ITEM_REFUND_INSTANCE); stmt.AddValue(0, item.GetGUID().ToString()); trans.Append(stmt); @@ -239,7 +239,7 @@ namespace Game.Entities } else { - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_ITEM_REFUNDS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_ITEM_REFUNDS); stmt.AddValue(0, item.GetGUID().GetCounter()); stmt.AddValue(1, GetGUID().GetCounter()); SQLResult result = DB.Characters.Query(stmt); @@ -260,7 +260,7 @@ namespace Game.Entities } else if (item.IsBOPTradeable()) { - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_ITEM_BOP_TRADE); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_ITEM_BOP_TRADE); stmt.AddValue(0, item.GetGUID().ToString()); SQLResult result = DB.Characters.Query(stmt); if (!result.IsEmpty()) @@ -584,7 +584,7 @@ namespace Game.Entities ok = true; else { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_PLAYER_HOMEBIND); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_PLAYER_HOMEBIND); stmt.AddValue(0, GetGUID().GetCounter()); DB.Characters.Execute(stmt); } @@ -592,7 +592,7 @@ namespace Game.Entities void saveHomebindToDb() { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_PLAYER_HOMEBIND); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_PLAYER_HOMEBIND); stmt.AddValue(0, GetGUID().GetCounter()); stmt.AddValue(1, homebind.GetMapId()); stmt.AddValue(2, homebindAreaId); @@ -949,7 +949,7 @@ namespace Game.Entities } void _LoadMonthlyQuestStatus() { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHARACTER_QUESTSTATUS_MONTHLY); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHARACTER_QUESTSTATUS_MONTHLY); stmt.AddValue(0, GetGUID().GetCounter()); SQLResult result = DB.Characters.Query(stmt); @@ -1310,7 +1310,7 @@ namespace Game.Entities SQLTransaction trans = new(); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_INVALID_MAIL_ITEM); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_INVALID_MAIL_ITEM); stmt.AddValue(0, itemGuid); trans.Append(stmt); @@ -1328,7 +1328,7 @@ namespace Game.Entities { Log.outError(LogFilter.Player, $"Player._LoadMailedItems: Item (GUID: {itemGuid}) in mail ({mailId}) doesn't exist, deleted from mail."); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_MAIL_ITEM); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_MAIL_ITEM); stmt.AddValue(0, itemGuid); DB.Characters.Execute(stmt); @@ -1721,7 +1721,7 @@ namespace Game.Entities Log.outError(LogFilter.Player, "Player(GUID: {0} Name: {1}).SaveInventory - the bag({2}) and slot({3}) values for the item with guid {4} (state {5}) are incorrect, " + "the player doesn't have an item at that position!", GetGUID().ToString(), GetName(), item.GetBagSlot(), item.GetSlot(), item.GetGUID().ToString(), item.GetState()); // according to the test that was just performed nothing should be in this slot, delete - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_INVENTORY_BY_BAG_SLOT); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_INVENTORY_BY_BAG_SLOT); stmt.AddValue(0, bagTestGUID); stmt.AddValue(1, item.GetSlot()); stmt.AddValue(2, GetGUID().GetCounter()); @@ -1751,7 +1751,7 @@ namespace Game.Entities { case ItemUpdateState.New: case ItemUpdateState.Changed: - stmt = DB.Characters.GetPreparedStatement(CharStatements.REP_INVENTORY_ITEM); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.REP_INVENTORY_ITEM); stmt.AddValue(0, GetGUID().GetCounter()); stmt.AddValue(1, container ? container.GetGUID().GetCounter() : 0); stmt.AddValue(2, item.GetSlot()); @@ -1759,7 +1759,7 @@ namespace Game.Entities trans.Append(stmt); break; case ItemUpdateState.Removed: - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_INVENTORY_BY_ITEM); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_INVENTORY_BY_ITEM); stmt.AddValue(0, item.GetGUID().GetCounter()); trans.Append(stmt); break; @@ -1788,7 +1788,7 @@ namespace Game.Entities switch (pair.Value.State) { case SkillState.New: - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_CHAR_SKILLS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_CHAR_SKILLS); stmt.AddValue(0, GetGUID().GetCounter()); stmt.AddValue(1, (ushort)pair.Key); stmt.AddValue(2, value); @@ -1796,7 +1796,7 @@ namespace Game.Entities trans.Append(stmt); break; case SkillState.Changed: - stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_CHAR_SKILLS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_CHAR_SKILLS); stmt.AddValue(0, value); stmt.AddValue(1, max); stmt.AddValue(2, GetGUID().GetCounter()); @@ -1804,7 +1804,7 @@ namespace Game.Entities trans.Append(stmt); break; case SkillState.Deleted: - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_SKILL_BY_SKILL); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_SKILL_BY_SKILL); stmt.AddValue(0, GetGUID().GetCounter()); stmt.AddValue(1, pair.Key); trans.Append(stmt); @@ -1823,7 +1823,7 @@ namespace Game.Entities { if (spell.State == PlayerSpellState.Removed || spell.State == PlayerSpellState.Changed) { - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_SPELL_BY_SPELL); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_SPELL_BY_SPELL); stmt.AddValue(0, id); stmt.AddValue(1, GetGUID().GetCounter()); trans.Append(stmt); @@ -1834,7 +1834,7 @@ namespace Game.Entities // add only changed/new not dependent spells if (!spell.Dependent) { - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_CHAR_SPELL); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_CHAR_SPELL); stmt.AddValue(0, GetGUID().GetCounter()); stmt.AddValue(1, id); stmt.AddValue(2, spell.Active); @@ -1842,14 +1842,14 @@ namespace Game.Entities trans.Append(stmt); } - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_SPELL_FAVORITE); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_SPELL_FAVORITE); stmt.AddValue(0, id); stmt.AddValue(1, GetGUID().GetCounter()); trans.Append(stmt); if (spell.Favorite) { - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_CHAR_SPELL_FAVORITE); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_CHAR_SPELL_FAVORITE); stmt.AddValue(0, GetGUID().GetCounter()); stmt.AddValue(1, id); trans.Append(stmt); @@ -1868,11 +1868,11 @@ namespace Game.Entities } void _SaveAuras(SQLTransaction trans) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_AURA_EFFECT); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_AURA_EFFECT); stmt.AddValue(0, GetGUID().GetCounter()); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_AURA); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_AURA); stmt.AddValue(0, GetGUID().GetCounter()); trans.Append(stmt); @@ -1887,7 +1887,7 @@ namespace Game.Entities AuraKey key = aura.GenerateKey(out recalculateMask); index = 0; - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_AURA); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_AURA); stmt.AddValue(index++, GetGUID().GetCounter()); stmt.AddValue(index++, key.Caster.GetRawValue()); stmt.AddValue(index++, key.Item.GetRawValue()); @@ -1908,7 +1908,7 @@ namespace Game.Entities if (effect != null) { index = 0; - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_AURA_EFFECT); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_AURA_EFFECT); stmt.AddValue(index++, GetGUID().GetCounter()); stmt.AddValue(index++, key.Caster.GetRawValue()); stmt.AddValue(index++, key.Item.GetRawValue()); @@ -1924,7 +1924,7 @@ namespace Game.Entities } void _SaveGlyphs(SQLTransaction trans) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_GLYPHS); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_GLYPHS); stmt.AddValue(0, GetGUID().GetCounter()); trans.Append(stmt); @@ -1934,7 +1934,7 @@ namespace Game.Entities { byte index = 0; - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_CHAR_GLYPHS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_CHAR_GLYPHS); stmt.AddValue(index++, GetGUID().GetCounter()); stmt.AddValue(index++, spec); stmt.AddValue(index++, glyphId); @@ -1955,7 +1955,7 @@ namespace Game.Entities switch (pair.Value.state) { case PlayerCurrencyState.New: - stmt = DB.Characters.GetPreparedStatement(CharStatements.REP_PLAYER_CURRENCY); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.REP_PLAYER_CURRENCY); stmt.AddValue(0, GetGUID().GetCounter()); stmt.AddValue(1, pair.Key); stmt.AddValue(2, pair.Value.Quantity); @@ -1965,7 +1965,7 @@ namespace Game.Entities trans.Append(stmt); break; case PlayerCurrencyState.Changed: - stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_PLAYER_CURRENCY); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_PLAYER_CURRENCY); stmt.AddValue(0, pair.Value.Quantity); stmt.AddValue(1, pair.Value.WeeklyQuantity); stmt.AddValue(2, pair.Value.TrackedQuantity); @@ -1984,13 +1984,13 @@ namespace Game.Entities public static void SavePlayerCustomizations(SQLTransaction trans, ulong guid, List customizations) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHARACTER_CUSTOMIZATIONS); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHARACTER_CUSTOMIZATIONS); stmt.AddValue(0, guid); trans.Append(stmt); foreach (var customization in customizations) { - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_CHARACTER_CUSTOMIZATION); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_CHARACTER_CUSTOMIZATION); stmt.AddValue(0, guid); stmt.AddValue(1, customization.ChrCustomizationOptionID); stmt.AddValue(2, customization.ChrCustomizationChoiceID); @@ -2039,7 +2039,7 @@ namespace Game.Entities switch (pair.Value.uState) { case ActionButtonUpdateState.New: - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_CHAR_ACTION); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_CHAR_ACTION); stmt.AddValue(0, GetGUID().GetCounter()); stmt.AddValue(1, GetActiveTalentGroup()); stmt.AddValue(2, traitConfigId); @@ -2051,7 +2051,7 @@ namespace Game.Entities pair.Value.uState = ActionButtonUpdateState.UnChanged; break; case ActionButtonUpdateState.Changed: - stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_CHAR_ACTION); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_CHAR_ACTION); stmt.AddValue(0, pair.Value.GetAction()); stmt.AddValue(1, (byte)pair.Value.GetButtonType()); stmt.AddValue(2, GetGUID().GetCounter()); @@ -2063,7 +2063,7 @@ namespace Game.Entities pair.Value.uState = ActionButtonUpdateState.UnChanged; break; case ActionButtonUpdateState.Deleted: - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_ACTION_BY_BUTTON_SPEC); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_ACTION_BY_BUTTON_SPEC); stmt.AddValue(0, GetGUID().GetCounter()); stmt.AddValue(1, pair.Key); stmt.AddValue(2, GetActiveTalentGroup()); @@ -2093,7 +2093,7 @@ namespace Game.Entities var data = m_QuestStatus.LookupByKey(save.Key); if (data != null && (keepAbandoned || data.Status != QuestStatus.None)) { - stmt = DB.Characters.GetPreparedStatement(CharStatements.REP_CHAR_QUESTSTATUS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.REP_CHAR_QUESTSTATUS); stmt.AddValue(0, GetGUID().GetCounter()); stmt.AddValue(1, save.Key); stmt.AddValue(2, (byte)data.Status); @@ -2103,7 +2103,7 @@ namespace Game.Entities trans.Append(stmt); // Save objectives - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_QUESTSTATUS_OBJECTIVES_BY_QUEST); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_QUESTSTATUS_OBJECTIVES_BY_QUEST); stmt.AddValue(0, GetGUID().GetCounter()); stmt.AddValue(1, save.Key); trans.Append(stmt); @@ -2112,7 +2112,7 @@ namespace Game.Entities foreach (QuestObjective obj in quest.Objectives) { - stmt = DB.Characters.GetPreparedStatement(CharStatements.REP_CHAR_QUESTSTATUS_OBJECTIVES); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.REP_CHAR_QUESTSTATUS_OBJECTIVES); stmt.AddValue(0, GetGUID().GetCounter()); stmt.AddValue(1, save.Key); stmt.AddValue(2, obj.StorageIndex); @@ -2124,12 +2124,12 @@ namespace Game.Entities else { // Delete - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_QUESTSTATUS_BY_QUEST); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_QUESTSTATUS_BY_QUEST); stmt.AddValue(0, GetGUID().GetCounter()); stmt.AddValue(1, save.Key); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_QUESTSTATUS_OBJECTIVES_BY_QUEST); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_QUESTSTATUS_OBJECTIVES_BY_QUEST); stmt.AddValue(0, GetGUID().GetCounter()); stmt.AddValue(1, save.Key); trans.Append(stmt); @@ -2142,7 +2142,7 @@ namespace Game.Entities { if (save.Value == QuestSaveType.Default) { - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_CHAR_QUESTSTATUS_REWARDED); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_CHAR_QUESTSTATUS_REWARDED); stmt.AddValue(0, GetGUID().GetCounter()); stmt.AddValue(1, save.Key); trans.Append(stmt); @@ -2150,7 +2150,7 @@ namespace Game.Entities } else if (save.Value == QuestSaveType.ForceDelete || !keepAbandoned) { - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_QUESTSTATUS_REWARDED_BY_QUEST); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_QUESTSTATUS_REWARDED_BY_QUEST); stmt.AddValue(0, GetGUID().GetCounter()); stmt.AddValue(1, save.Key); trans.Append(stmt); @@ -2172,12 +2172,12 @@ namespace Game.Entities // save last daily quest time for all quests: we need only mostly reset time for reset check anyway // we don't need transactions here. - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHARACTER_QUESTSTATUS_DAILY); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHARACTER_QUESTSTATUS_DAILY); stmt.AddValue(0, GetGUID().GetCounter()); foreach (int questId in m_activePlayerData.DailyQuestsCompleted) { - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_CHARACTER_QUESTSTATUS_DAILY); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_CHARACTER_QUESTSTATUS_DAILY); stmt.AddValue(0, GetGUID().GetCounter()); stmt.AddValue(1, questId); stmt.AddValue(2, m_lastDailyQuestTime); @@ -2189,7 +2189,7 @@ namespace Game.Entities { foreach (var id in m_DFQuests) { - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_CHARACTER_QUESTSTATUS_DAILY); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_CHARACTER_QUESTSTATUS_DAILY); stmt.AddValue(0, GetGUID().GetCounter()); stmt.AddValue(1, id); stmt.AddValue(2, m_lastDailyQuestTime); @@ -2203,13 +2203,13 @@ namespace Game.Entities return; // we don't need transactions here. - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHARACTER_QUESTSTATUS_WEEKLY); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHARACTER_QUESTSTATUS_WEEKLY); stmt.AddValue(0, GetGUID().GetCounter()); trans.Append(stmt); foreach (var quest_id in m_weeklyquests) { - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_CHARACTER_QUESTSTATUS_WEEKLY); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_CHARACTER_QUESTSTATUS_WEEKLY); stmt.AddValue(0, GetGUID().GetCounter()); stmt.AddValue(1, quest_id); trans.Append(stmt); @@ -2223,7 +2223,7 @@ namespace Game.Entities return; // we don't need transactions here. - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHARACTER_QUESTSTATUS_SEASONAL); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHARACTER_QUESTSTATUS_SEASONAL); stmt.AddValue(0, GetGUID().GetCounter()); trans.Append(stmt); @@ -2236,7 +2236,7 @@ namespace Game.Entities { foreach (var (questId, completedTime) in dictionary) { - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_CHARACTER_QUESTSTATUS_SEASONAL); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_CHARACTER_QUESTSTATUS_SEASONAL); stmt.AddValue(0, GetGUID().GetCounter()); stmt.AddValue(1, questId); stmt.AddValue(2, eventId); @@ -2251,13 +2251,13 @@ namespace Game.Entities return; // we don't need transactions here. - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHARACTER_QUESTSTATUS_MONTHLY); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHARACTER_QUESTSTATUS_MONTHLY); stmt.AddValue(0, GetGUID().GetCounter()); trans.Append(stmt); foreach (var questId in m_monthlyquests) { - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_CHARACTER_QUESTSTATUS_MONTHLY); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_CHARACTER_QUESTSTATUS_MONTHLY); stmt.AddValue(0, GetGUID().GetCounter()); stmt.AddValue(1, questId); trans.Append(stmt); @@ -2267,7 +2267,7 @@ namespace Game.Entities } void _SaveTalents(SQLTransaction trans) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_TALENT); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_TALENT); stmt.AddValue(0, GetGUID().GetCounter()); trans.Append(stmt); @@ -2282,7 +2282,7 @@ namespace Game.Entities continue; } - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_CHAR_TALENT); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_CHAR_TALENT); stmt.AddValue(0, GetGUID().GetCounter()); stmt.AddValue(1, pair.Key); stmt.AddValue(2, group); @@ -2290,14 +2290,14 @@ namespace Game.Entities } } - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_PVP_TALENT); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_PVP_TALENT); stmt.AddValue(0, GetGUID().GetCounter()); trans.Append(stmt); for (byte group = 0; group < PlayerConst.MaxSpecializations; ++group) { var talents = GetPvpTalentMap(group); - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_CHAR_PVP_TALENT); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_CHAR_PVP_TALENT); stmt.AddValue(0, GetGUID().GetCounter()); stmt.AddValue(1, talents[0]); stmt.AddValue(2, talents[1]); @@ -2316,12 +2316,12 @@ namespace Game.Entities switch (state) { case PlayerSpellState.Changed: - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_TRAIT_ENTRIES); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_TRAIT_ENTRIES); stmt.AddValue(0, GetGUID().GetCounter()); stmt.AddValue(1, traitConfigId); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_TRAIT_CONFIGS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_TRAIT_CONFIGS); stmt.AddValue(0, GetGUID().GetCounter()); stmt.AddValue(1, traitConfigId); trans.Append(stmt); @@ -2329,7 +2329,7 @@ namespace Game.Entities TraitConfig traitConfig = GetTraitConfig(traitConfigId); if (traitConfig != null) { - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_CHAR_TRAIT_CONFIGS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_CHAR_TRAIT_CONFIGS); stmt.AddValue(0, GetGUID().GetCounter()); stmt.AddValue(1, traitConfig.ID); stmt.AddValue(2, traitConfig.Type); @@ -2365,7 +2365,7 @@ namespace Game.Entities foreach (var traitEntry in traitConfig.Entries) { - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_CHAR_TRAIT_ENTRIES); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_CHAR_TRAIT_ENTRIES); stmt.AddValue(0, GetGUID().GetCounter()); stmt.AddValue(1, traitConfig.ID); stmt.AddValue(2, traitEntry.TraitNodeID); @@ -2377,17 +2377,17 @@ namespace Game.Entities } break; case PlayerSpellState.Removed: - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_TRAIT_ENTRIES); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_TRAIT_ENTRIES); stmt.AddValue(0, GetGUID().GetCounter()); stmt.AddValue(1, traitConfigId); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_TRAIT_CONFIGS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_TRAIT_CONFIGS); stmt.AddValue(0, GetGUID().GetCounter()); stmt.AddValue(1, traitConfigId); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_ACTION_BY_TRAIT_CONFIG); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_ACTION_BY_TRAIT_CONFIG); stmt.AddValue(0, GetGUID().GetCounter()); stmt.AddValue(1, traitConfigId); trans.Append(stmt); @@ -2408,7 +2408,7 @@ namespace Game.Entities { if (m.state == MailState.Changed) { - stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_MAIL); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_MAIL); stmt.AddValue(0, m.HasItems() ? 1 : 0); stmt.AddValue(1, m.expire_time); stmt.AddValue(2, m.deliver_time); @@ -2423,7 +2423,7 @@ namespace Game.Entities { foreach (var id in m.removedItems) { - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_MAIL_ITEM); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_MAIL_ITEM); stmt.AddValue(0, id); trans.Append(stmt); } @@ -2442,11 +2442,11 @@ namespace Game.Entities AzeriteEmpoweredItem.DeleteFromDB(trans, mailItemInfo.item_guid); } } - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_MAIL_BY_ID); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_MAIL_BY_ID); stmt.AddValue(0, m.messageID); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_MAIL_ITEM_BY_ID); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_MAIL_ITEM_BY_ID); stmt.AddValue(0, m.messageID); trans.Append(stmt); } @@ -2468,7 +2468,7 @@ namespace Game.Entities var storedLocation = pair.Value; if (storedLocation.CurrentState == StoredAuraTeleportLocation.State.Deleted) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHARACTER_AURA_STORED_LOCATION); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHARACTER_AURA_STORED_LOCATION); stmt.AddValue(0, GetGUID().GetCounter()); trans.Append(stmt); m_storedAuraTeleportLocations.Remove(pair.Key); @@ -2477,11 +2477,11 @@ namespace Game.Entities if (storedLocation.CurrentState == StoredAuraTeleportLocation.State.Changed) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHARACTER_AURA_STORED_LOCATION); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHARACTER_AURA_STORED_LOCATION); stmt.AddValue(0, GetGUID().GetCounter()); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_CHARACTER_AURA_STORED_LOCATION); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_CHARACTER_AURA_STORED_LOCATION); stmt.AddValue(0, GetGUID().GetCounter()); stmt.AddValue(1, pair.Key); stmt.AddValue(2, storedLocation.Loc.GetMapId()); @@ -2499,12 +2499,12 @@ namespace Game.Entities if (WorldConfig.GetIntValue(WorldCfg.MinLevelStatSave) == 0 || GetLevel() < WorldConfig.GetIntValue(WorldCfg.MinLevelStatSave)) return; - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_STATS); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_STATS); stmt.AddValue(0, GetGUID().GetCounter()); trans.Append(stmt); byte index = 0; - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_CHAR_STATS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_CHAR_STATS); stmt.AddValue(index++, GetGUID().GetCounter()); stmt.AddValue(index++, GetMaxHealth()); @@ -2532,7 +2532,7 @@ namespace Game.Entities } public void SaveGoldToDB(SQLTransaction trans) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_CHAR_MONEY); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_CHAR_MONEY); stmt.AddValue(0, GetMoney()); stmt.AddValue(1, GetGUID().GetCounter()); trans.Append(stmt); @@ -2557,7 +2557,7 @@ namespace Game.Entities case EquipmentSetUpdateState.Changed: if (eqSet.Data.Type == EquipmentSetInfo.EquipmentSetType.Equipment) { - stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_EQUIP_SET); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_EQUIP_SET); stmt.AddValue(j++, eqSet.Data.SetName); stmt.AddValue(j++, eqSet.Data.SetIcon); stmt.AddValue(j++, eqSet.Data.IgnoreMask); @@ -2572,7 +2572,7 @@ namespace Game.Entities } else { - stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_TRANSMOG_OUTFIT); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_TRANSMOG_OUTFIT); stmt.AddValue(j++, eqSet.Data.SetName); stmt.AddValue(j++, eqSet.Data.SetIcon); stmt.AddValue(j++, eqSet.Data.IgnoreMask); @@ -2594,7 +2594,7 @@ namespace Game.Entities case EquipmentSetUpdateState.New: if (eqSet.Data.Type == EquipmentSetInfo.EquipmentSetType.Equipment) { - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_EQUIP_SET); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_EQUIP_SET); stmt.AddValue(j++, GetGUID().GetCounter()); stmt.AddValue(j++, eqSet.Data.Guid); stmt.AddValue(j++, eqSet.Data.SetID); @@ -2608,7 +2608,7 @@ namespace Game.Entities } else { - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_TRANSMOG_OUTFIT); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_TRANSMOG_OUTFIT); stmt.AddValue(j++, GetGUID().GetCounter()); stmt.AddValue(j++, eqSet.Data.Guid); stmt.AddValue(j++, eqSet.Data.SetID); @@ -2627,9 +2627,9 @@ namespace Game.Entities break; case EquipmentSetUpdateState.Deleted: if (eqSet.Data.Type == EquipmentSetInfo.EquipmentSetType.Equipment) - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_EQUIP_SET); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_EQUIP_SET); else - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_TRANSMOG_OUTFIT); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_TRANSMOG_OUTFIT); stmt.AddValue(0, eqSet.Data.Guid); trans.Append(stmt); _equipmentSets.Remove(pair.Key); @@ -2645,7 +2645,7 @@ namespace Game.Entities if (_voidStorageItems[i] == null) // unused item { // DELETE FROM void_storage WHERE slot = ? AND playerGuid = ? - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_VOID_STORAGE_ITEM_BY_SLOT); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_VOID_STORAGE_ITEM_BY_SLOT); stmt.AddValue(0, i); stmt.AddValue(1, GetGUID().GetCounter()); } @@ -2653,7 +2653,7 @@ namespace Game.Entities else { // REPLACE INTO character_void_storage (itemId, playerGuid, itemEntry, slot, creatorGuid, randomPropertyType, randomProperty, upgradeId, fixedScalingLevel, artifactKnowledgeLevel, bonusListIDs) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) - stmt = DB.Characters.GetPreparedStatement(CharStatements.REP_CHAR_VOID_STORAGE_ITEM); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.REP_CHAR_VOID_STORAGE_ITEM); stmt.AddValue(0, _voidStorageItems[i].ItemId); stmt.AddValue(1, GetGUID().GetCounter()); stmt.AddValue(2, _voidStorageItems[i].ItemEntry); @@ -2683,14 +2683,14 @@ namespace Game.Entities if (_CUFProfiles[i] == null) // unused profile { // DELETE FROM character_cuf_profiles WHERE guid = ? and id = ? - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_CUF_PROFILES_BY_ID); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_CUF_PROFILES_BY_ID); stmt.AddValue(0, lowGuid); stmt.AddValue(1, i); } else { // REPLACE INTO character_cuf_profiles (guid, id, name, frameHeight, frameWidth, sortBy, healthText, boolOptions, unk146, unk147, unk148, unk150, unk152, unk154) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) - stmt = DB.Characters.GetPreparedStatement(CharStatements.REP_CHAR_CUF_PROFILES); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.REP_CHAR_CUF_PROFILES); stmt.AddValue(0, lowGuid); stmt.AddValue(1, i); stmt.AddValue(2, _CUFProfiles[i].ProfileName); @@ -2715,13 +2715,13 @@ namespace Game.Entities if (_instanceResetTimes.Empty()) return; - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ACCOUNT_INSTANCE_LOCK_TIMES); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ACCOUNT_INSTANCE_LOCK_TIMES); stmt.AddValue(0, GetSession().GetAccountId()); trans.Append(stmt); foreach (var pair in _instanceResetTimes) { - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_ACCOUNT_INSTANCE_LOCK_TIMES); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_ACCOUNT_INSTANCE_LOCK_TIMES); stmt.AddValue(0, GetSession().GetAccountId()); stmt.AddValue(1, pair.Key); stmt.AddValue(2, pair.Value); @@ -2730,11 +2730,11 @@ namespace Game.Entities } void _SaveBGData(SQLTransaction trans) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_PLAYER_BGDATA); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_PLAYER_BGDATA); stmt.AddValue(0, GetGUID().GetCounter()); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_PLAYER_BGDATA); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_PLAYER_BGDATA); stmt.AddValue(0, GetGUID().GetCounter()); stmt.AddValue(1, m_bgData.bgInstanceID); stmt.AddValue(2, m_bgData.bgTeam); @@ -2854,7 +2854,7 @@ namespace Game.Entities if (ObjectManager.CheckPlayerName(GetName(), GetSession().GetSessionDbcLocale()) != ResponseCodes.CharNameSuccess || (!GetSession().HasPermission(RBACPermissions.SkipCheckCharacterCreationReservedname) && Global.ObjectMgr.IsReservedName(GetName()))) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_ADD_AT_LOGIN_FLAG); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_ADD_AT_LOGIN_FLAG); stmt.AddValue(0, (ushort)AtLoginFlags.Rename); stmt.AddValue(1, guid.GetCounter()); DB.Characters.Execute(stmt); @@ -3586,7 +3586,7 @@ namespace Game.Entities PreparedStatement stmt; byte index = 0; - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_FISHINGSTEPS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_FISHINGSTEPS); stmt.AddValue(0, GetGUID().GetCounter()); characterTransaction.Append(stmt); @@ -3596,7 +3596,7 @@ namespace Game.Entities { //! Insert query /// @todo: Filter out more redundant fields that can take their default value at player create - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_CHARACTER); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_CHARACTER); stmt.AddValue(index++, GetGUID().GetCounter()); stmt.AddValue(index++, GetSession().GetAccountId()); stmt.AddValue(index++, GetName()); @@ -3723,7 +3723,7 @@ namespace Game.Entities else { // Update query - stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_CHARACTER); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_CHARACTER); stmt.AddValue(index++, GetName()); stmt.AddValue(index++, (byte)GetRace()); stmt.AddValue(index++, (byte)GetClass()); @@ -3879,7 +3879,7 @@ namespace Game.Entities if (m_fishingSteps != 0) { - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_CHAR_FISHINGSTEPS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_CHAR_FISHINGSTEPS); index = 0; stmt.AddValue(index++, GetGUID().GetCounter()); stmt.AddValue(index++, m_fishingSteps); @@ -3931,13 +3931,13 @@ namespace Game.Entities GetSession().GetCollectionMgr().SaveAccountItemAppearances(loginTransaction); GetSession().GetCollectionMgr().SaveAccountTransmogIllusions(loginTransaction); - stmt = DB.Login.GetPreparedStatement(LoginStatements.DEL_BNET_LAST_PLAYER_CHARACTERS); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.DEL_BNET_LAST_PLAYER_CHARACTERS); stmt.AddValue(0, GetSession().GetAccountId()); stmt.AddValue(1, Global.WorldMgr.GetRealmId().Region); stmt.AddValue(2, Global.WorldMgr.GetRealmId().Site); loginTransaction.Append(stmt); - stmt = DB.Login.GetPreparedStatement(LoginStatements.INS_BNET_LAST_PLAYER_CHARACTERS); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.INS_BNET_LAST_PLAYER_CHARACTERS); stmt.AddValue(0, GetSession().GetAccountId()); stmt.AddValue(1, Global.WorldMgr.GetRealmId().Region); stmt.AddValue(2, Global.WorldMgr.GetRealmId().Site); @@ -3954,7 +3954,7 @@ namespace Game.Entities } void DeleteSpellFromAllPlayers(uint spellId) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_INVALID_SPELL_SPELLS); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_INVALID_SPELL_SPELLS); stmt.AddValue(0, spellId); DB.Characters.Execute(stmt); } @@ -3962,7 +3962,7 @@ namespace Game.Entities public static uint GetZoneIdFromDB(ObjectGuid guid) { ulong guidLow = guid.GetCounter(); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHAR_ZONE); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHAR_ZONE); stmt.AddValue(0, guidLow); SQLResult result = DB.Characters.Query(stmt); @@ -3973,7 +3973,7 @@ namespace Game.Entities if (zone == 0) { // stored zone is zero, use generic and slow zone detection - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHAR_POSITION_XYZ); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHAR_POSITION_XYZ); stmt.AddValue(0, guidLow); result = DB.Characters.Query(stmt); @@ -3992,7 +3992,7 @@ namespace Game.Entities if (zone > 0) { - stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_ZONE); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_ZONE); stmt.AddValue(0, zone); stmt.AddValue(1, guidLow); @@ -4057,7 +4057,7 @@ namespace Game.Entities LeaveAllArenaTeams(playerGuid); // the player was uninvited already on logout so just remove from group - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_GROUP_MEMBER); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_GROUP_MEMBER); stmt.AddValue(0, guid); SQLResult resultGroup = DB.Characters.Query(stmt); @@ -4076,36 +4076,36 @@ namespace Game.Entities // Completely remove from the database case CharDeleteMethod.Remove: { - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHAR_COD_ITEM_MAIL); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHAR_COD_ITEM_MAIL); stmt.AddValue(0, guid); SQLResult resultMail = DB.Characters.Query(stmt); if (!resultMail.IsEmpty()) { MultiMap itemsByMail = new(); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_MAILITEMS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_MAILITEMS); stmt.AddValue(0, guid); SQLResult resultItems = DB.Characters.Query(stmt); if (!resultItems.IsEmpty()) { - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_MAILITEMS_ARTIFACT); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_MAILITEMS_ARTIFACT); stmt.AddValue(0, guid); SQLResult artifactResult = DB.Characters.Query(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_MAILITEMS_AZERITE); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_MAILITEMS_AZERITE); stmt.AddValue(0, guid); SQLResult azeriteResult = DB.Characters.Query(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_MAILITEMS_AZERITE_MILESTONE_POWER); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_MAILITEMS_AZERITE_MILESTONE_POWER); stmt.AddValue(0, guid); SQLResult azeriteItemMilestonePowersResult = DB.Characters.Query(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_MAILITEMS_AZERITE_UNLOCKED_ESSENCE); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_MAILITEMS_AZERITE_UNLOCKED_ESSENCE); stmt.AddValue(0, guid); SQLResult azeriteItemUnlockedEssencesResult = DB.Characters.Query(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_MAILITEMS_AZERITE_EMPOWERED); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_MAILITEMS_AZERITE_EMPOWERED); stmt.AddValue(0, guid); SQLResult azeriteEmpoweredItemResult = DB.Characters.Query(stmt); @@ -4135,7 +4135,7 @@ namespace Game.Entities // We can return mail now // So firstly delete the old one - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_MAIL_BY_ID); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_MAIL_BY_ID); stmt.AddValue(0, mail_id); trans.Append(stmt); @@ -4144,7 +4144,7 @@ namespace Game.Entities { if (has_items) { - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_MAIL_ITEM_BY_ID); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_MAIL_ITEM_BY_ID); stmt.AddValue(0, mail_id); trans.Append(stmt); } @@ -4164,7 +4164,7 @@ namespace Game.Entities itemsByMail.Remove(mail_id); } - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_MAIL_ITEM_BY_ID); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_MAIL_ITEM_BY_ID); stmt.AddValue(0, mail_id); trans.Append(stmt); @@ -4181,7 +4181,7 @@ namespace Game.Entities // Unsummon and delete for pets in world is not required: player deleted from CLI or character list with not loaded pet. // NOW we can finally clear other DB data related to character - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHAR_PET_IDS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHAR_PET_IDS); stmt.AddValue(0, guid); SQLResult resultPets = DB.Characters.Query(stmt); @@ -4195,7 +4195,7 @@ namespace Game.Entities } // Delete char from social list of online chars - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHAR_SOCIAL); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHAR_SOCIAL); stmt.AddValue(0, guid); SQLResult resultFriends = DB.Characters.Query(stmt); @@ -4212,237 +4212,237 @@ namespace Game.Entities } while (resultFriends.NextRow()); } - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHARACTER); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHARACTER); stmt.AddValue(0, guid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHARACTER_CUSTOMIZATIONS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHARACTER_CUSTOMIZATIONS); stmt.AddValue(0, guid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_PLAYER_ACCOUNT_DATA); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_PLAYER_ACCOUNT_DATA); stmt.AddValue(0, guid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_DECLINED_NAME); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_DECLINED_NAME); stmt.AddValue(0, guid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_ACTION); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_ACTION); stmt.AddValue(0, guid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHARACTER_ARENA_STATS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHARACTER_ARENA_STATS); stmt.AddValue(0, guid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_AURA_EFFECT); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_AURA_EFFECT); stmt.AddValue(0, guid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_AURA); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_AURA); stmt.AddValue(0, guid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_PLAYER_BGDATA); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_PLAYER_BGDATA); stmt.AddValue(0, guid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_BATTLEGROUND_RANDOM); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_BATTLEGROUND_RANDOM); stmt.AddValue(0, guid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_CUF_PROFILES); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_CUF_PROFILES); stmt.AddValue(0, guid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_PLAYER_CURRENCY); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_PLAYER_CURRENCY); stmt.AddValue(0, guid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_GIFT); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_GIFT); stmt.AddValue(0, guid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_PLAYER_HOMEBIND); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_PLAYER_HOMEBIND); stmt.AddValue(0, guid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHARACTER_INSTANCE_LOCK_BY_GUID); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHARACTER_INSTANCE_LOCK_BY_GUID); stmt.AddValue(0, guid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_INVENTORY); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_INVENTORY); stmt.AddValue(0, guid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_QUESTSTATUS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_QUESTSTATUS); stmt.AddValue(0, guid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_QUESTSTATUS_OBJECTIVES); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_QUESTSTATUS_OBJECTIVES); stmt.AddValue(0, guid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_QUESTSTATUS_REWARDED); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_QUESTSTATUS_REWARDED); stmt.AddValue(0, guid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_REPUTATION); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_REPUTATION); stmt.AddValue(0, guid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_SPELL); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_SPELL); stmt.AddValue(0, guid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_SPELL_COOLDOWNS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_SPELL_COOLDOWNS); stmt.AddValue(0, guid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_GEMS_BY_OWNER); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_GEMS_BY_OWNER); stmt.AddValue(0, guid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_TRANSMOG_BY_OWNER); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_TRANSMOG_BY_OWNER); stmt.AddValue(0, guid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_ARTIFACT_BY_OWNER); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_ARTIFACT_BY_OWNER); stmt.AddValue(0, guid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_ARTIFACT_POWERS_BY_OWNER); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_ARTIFACT_POWERS_BY_OWNER); stmt.AddValue(0, guid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_MODIFIERS_BY_OWNER); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_MODIFIERS_BY_OWNER); stmt.AddValue(0, guid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_AZERITE_BY_OWNER); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_AZERITE_BY_OWNER); stmt.AddValue(0, guid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_AZERITE_MILESTONE_POWER_BY_OWNER); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_AZERITE_MILESTONE_POWER_BY_OWNER); stmt.AddValue(0, guid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_AZERITE_UNLOCKED_ESSENCE_BY_OWNER); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_AZERITE_UNLOCKED_ESSENCE_BY_OWNER); stmt.AddValue(0, guid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_AZERITE_EMPOWERED_BY_OWNER); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_AZERITE_EMPOWERED_BY_OWNER); stmt.AddValue(0, guid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_BY_OWNER); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_BY_OWNER); stmt.AddValue(0, guid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_SOCIAL_BY_FRIEND); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_SOCIAL_BY_FRIEND); stmt.AddValue(0, guid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_SOCIAL_BY_GUID); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_SOCIAL_BY_GUID); stmt.AddValue(0, guid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_MAIL); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_MAIL); stmt.AddValue(0, guid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_MAIL_ITEMS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_MAIL_ITEMS); stmt.AddValue(0, guid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_PET_BY_OWNER); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_PET_BY_OWNER); stmt.AddValue(0, guid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_PET_DECLINEDNAME_BY_OWNER); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_PET_DECLINEDNAME_BY_OWNER); stmt.AddValue(0, guid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_ACHIEVEMENTS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_ACHIEVEMENTS); stmt.AddValue(0, guid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_ACHIEVEMENT_PROGRESS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_ACHIEVEMENT_PROGRESS); stmt.AddValue(0, guid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_EQUIPMENTSETS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_EQUIPMENTSETS); stmt.AddValue(0, guid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_TRANSMOG_OUTFITS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_TRANSMOG_OUTFITS); stmt.AddValue(0, guid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_GUILD_EVENTLOG_BY_PLAYER); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_GUILD_EVENTLOG_BY_PLAYER); stmt.AddValue(0, guid); stmt.AddValue(1, guid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_GUILD_BANK_EVENTLOG_BY_PLAYER); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_GUILD_BANK_EVENTLOG_BY_PLAYER); stmt.AddValue(0, guid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_GLYPHS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_GLYPHS); stmt.AddValue(0, guid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHARACTER_QUESTSTATUS_DAILY); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHARACTER_QUESTSTATUS_DAILY); stmt.AddValue(0, guid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHARACTER_QUESTSTATUS_WEEKLY); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHARACTER_QUESTSTATUS_WEEKLY); stmt.AddValue(0, guid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHARACTER_QUESTSTATUS_MONTHLY); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHARACTER_QUESTSTATUS_MONTHLY); stmt.AddValue(0, guid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHARACTER_QUESTSTATUS_SEASONAL); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHARACTER_QUESTSTATUS_SEASONAL); stmt.AddValue(0, guid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_TALENT); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_TALENT); stmt.AddValue(0, guid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_SKILLS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_SKILLS); stmt.AddValue(0, guid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_STATS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_STATS); stmt.AddValue(0, guid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_VOID_STORAGE_ITEM_BY_CHAR_GUID); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_VOID_STORAGE_ITEM_BY_CHAR_GUID); stmt.AddValue(0, guid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_FISHINGSTEPS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_FISHINGSTEPS); stmt.AddValue(0, guid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHARACTER_FAVORITE_AUCTIONS_BY_CHAR); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHARACTER_FAVORITE_AUCTIONS_BY_CHAR); stmt.AddValue(0, guid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHARACTER_AURA_STORED_LOCATIONS_BY_GUID); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHARACTER_AURA_STORED_LOCATIONS_BY_GUID); stmt.AddValue(0, guid); trans.Append(stmt); - stmt = DB.Login.GetPreparedStatement(LoginStatements.DEL_BATTLE_PET_DECLINED_NAME_BY_OWNER); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.DEL_BATTLE_PET_DECLINED_NAME_BY_OWNER); stmt.AddValue(0, guid); stmt.AddValue(1, Global.WorldMgr.GetRealmId().Index); loginTransaction.Append(stmt); - stmt = DB.Login.GetPreparedStatement(LoginStatements.DEL_BATTLE_PETS_BY_OWNER); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.DEL_BATTLE_PETS_BY_OWNER); stmt.AddValue(0, guid); stmt.AddValue(1, Global.WorldMgr.GetRealmId().Index); loginTransaction.Append(stmt); @@ -4451,11 +4451,11 @@ namespace Game.Entities Garrison.DeleteFromDB(guid, trans); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_TRAIT_ENTRIES_BY_CHAR); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_TRAIT_ENTRIES_BY_CHAR); stmt.AddValue(0, guid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_TRAIT_CONFIGS_BY_CHAR); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_TRAIT_CONFIGS_BY_CHAR); stmt.AddValue(0, guid); trans.Append(stmt); @@ -4465,7 +4465,7 @@ namespace Game.Entities // The character gets unlinked from the account, the name gets freed up and appears as deleted ingame case CharDeleteMethod.Unlink: { - stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_DELETE_INFO); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_DELETE_INFO); stmt.AddValue(0, guid); trans.Append(stmt); @@ -4500,7 +4500,7 @@ namespace Game.Entities { Log.outInfo(LogFilter.Player, "Player:DeleteOldChars: Deleting all characters which have been deleted {0} days before...", keepDays); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHAR_OLD_CHARS); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHAR_OLD_CHARS); stmt.AddValue(0, (uint)(GameTime.GetGameTime() - keepDays * Time.Day)); SQLResult result = DB.Characters.Query(stmt); @@ -4519,7 +4519,7 @@ namespace Game.Entities public static void SavePositionInDB(WorldLocation loc, uint zoneId, ObjectGuid guid, SQLTransaction trans = null) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_CHARACTER_POSITION); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_CHARACTER_POSITION); stmt.AddValue(0, loc.GetPositionX()); stmt.AddValue(1, loc.GetPositionY()); stmt.AddValue(2, loc.GetPositionZ()); @@ -4532,7 +4532,7 @@ namespace Game.Entities } public static bool LoadPositionFromDB(out WorldLocation loc, out bool inFlight, ObjectGuid guid) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHAR_POSITION); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHAR_POSITION); stmt.AddValue(0, guid.GetCounter()); SQLResult result = DB.Characters.Query(stmt); diff --git a/Source/Game/Entities/Player/Player.Items.cs b/Source/Game/Entities/Player/Player.Items.cs index 009474f3f..3df8c5b75 100644 --- a/Source/Game/Entities/Player/Player.Items.cs +++ b/Source/Game/Entities/Player/Player.Items.cs @@ -1275,7 +1275,7 @@ namespace Game.Entities foreach (var guid in allowedLooters) ss.AppendFormat("{0} ", guid); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_ITEM_BOP_TRADE); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_ITEM_BOP_TRADE); stmt.AddValue(0, item.GetGUID().GetCounter()); stmt.AddValue(1, ss.ToString()); DB.Characters.Execute(stmt); @@ -5524,7 +5524,7 @@ namespace Game.Entities if (pItem.IsWrapped()) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_GIFT); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_GIFT); stmt.AddValue(0, pItem.GetGUID().GetCounter()); DB.Characters.Execute(stmt); } diff --git a/Source/Game/Entities/Player/Player.PvP.cs b/Source/Game/Entities/Player/Player.PvP.cs index 179dd3b77..4525f32b3 100644 --- a/Source/Game/Entities/Player/Player.PvP.cs +++ b/Source/Game/Entities/Player/Player.PvP.cs @@ -678,7 +678,7 @@ namespace Game.Entities m_IsBGRandomWinner = isWinner; if (m_IsBGRandomWinner) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_BATTLEGROUND_RANDOM); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_BATTLEGROUND_RANDOM); stmt.AddValue(0, GetGUID().GetCounter()); DB.Characters.Execute(stmt); } diff --git a/Source/Game/Entities/Player/Player.Talents.cs b/Source/Game/Entities/Player/Player.Talents.cs index 97bd9ec08..ac8e5e4f4 100644 --- a/Source/Game/Entities/Player/Player.Talents.cs +++ b/Source/Game/Entities/Player/Player.Talents.cs @@ -486,7 +486,7 @@ namespace Game.Entities } // load them asynchronously - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHARACTER_ACTIONS_SPEC); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHARACTER_ACTIONS_SPEC); stmt.AddValue(0, GetGUID().GetCounter()); stmt.AddValue(1, GetActiveTalentGroup()); stmt.AddValue(2, traitConfigId); @@ -1166,7 +1166,7 @@ namespace Game.Entities { SetUpdateFieldFlagValue(traitConfig.ModifyValue(traitConfig.CombatConfigFlags), (int)TraitCombatConfigFlags.SharedActionBars); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_ACTION_BY_TRAIT_CONFIG); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_ACTION_BY_TRAIT_CONFIG); stmt.AddValue(0, GetGUID().GetCounter()); stmt.AddValue(1, traitConfigId); DB.Characters.Execute(stmt); diff --git a/Source/Game/Entities/Player/Player.cs b/Source/Game/Entities/Player/Player.cs index 858d6572d..1adee5286 100644 --- a/Source/Game/Entities/Player/Player.cs +++ b/Source/Game/Entities/Player/Player.cs @@ -388,7 +388,7 @@ namespace Game.Entities if (GetSession().m_muteTime != 0 && GetSession().m_muteTime < now) { GetSession().m_muteTime = 0; - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.UPD_MUTE_TIME); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.UPD_MUTE_TIME); stmt.AddValue(0, 0); // Set the mute time to 0 stmt.AddValue(1, ""); stmt.AddValue(2, ""); @@ -2886,7 +2886,7 @@ namespace Game.Entities homebindAreaId = areaId; // update sql homebind - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_PLAYER_HOMEBIND); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_PLAYER_HOMEBIND); stmt.AddValue(0, homebind.GetMapId()); stmt.AddValue(1, homebindAreaId); stmt.AddValue(2, homebind.GetPositionX()); @@ -3971,7 +3971,7 @@ namespace Game.Entities public static void OfflineResurrect(ObjectGuid guid, SQLTransaction trans) { Corpse.DeleteFromDB(guid, trans); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_ADD_AT_LOGIN_FLAG); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_ADD_AT_LOGIN_FLAG); stmt.AddValue(0, (ushort)AtLoginFlags.Resurrect); stmt.AddValue(1, guid.GetCounter()); DB.Characters.ExecuteOrAppend(trans, stmt); @@ -4797,7 +4797,7 @@ namespace Game.Entities atLoginFlags &= ~flags; if (persist) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_REM_AT_LOGIN_FLAG); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_REM_AT_LOGIN_FLAG); stmt.AddValue(0, (ushort)flags); stmt.AddValue(1, GetGUID().GetCounter()); diff --git a/Source/Game/Entities/Player/SocialMgr.cs b/Source/Game/Entities/Player/SocialMgr.cs index f690d6155..7f068c5d1 100644 --- a/Source/Game/Entities/Player/SocialMgr.cs +++ b/Source/Game/Entities/Player/SocialMgr.cs @@ -166,7 +166,7 @@ namespace Game.Entities friendInfo.Flags |= flag; friendInfo.WowAccountGuid = accountGuid; - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_CHARACTER_SOCIAL_FLAGS); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_CHARACTER_SOCIAL_FLAGS); stmt.AddValue(0, (byte)friendInfo.Flags); stmt.AddValue(1, GetPlayerGUID().GetCounter()); stmt.AddValue(2, friendGuid.GetCounter()); @@ -179,7 +179,7 @@ namespace Game.Entities fi.WowAccountGuid = accountGuid; PlayerSocialMap[friendGuid] = fi; - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_CHARACTER_SOCIAL); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_CHARACTER_SOCIAL); stmt.AddValue(0, GetPlayerGUID().GetCounter()); stmt.AddValue(1, friendGuid.GetCounter()); stmt.AddValue(2, (byte)flag); @@ -202,7 +202,7 @@ namespace Game.Entities if (friendInfo.Flags == 0) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHARACTER_SOCIAL); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHARACTER_SOCIAL); stmt.AddValue(0, GetPlayerGUID().GetCounter()); stmt.AddValue(1, friendGuid.GetCounter()); DB.Characters.Execute(stmt); @@ -220,7 +220,7 @@ namespace Game.Entities } else { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_CHARACTER_SOCIAL_FLAGS); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_CHARACTER_SOCIAL_FLAGS); stmt.AddValue(0, (byte)friendInfo.Flags); stmt.AddValue(1, GetPlayerGUID().GetCounter()); stmt.AddValue(2, friendGuid.GetCounter()); @@ -233,7 +233,7 @@ namespace Game.Entities if (!PlayerSocialMap.ContainsKey(friendGuid)) // not exist return; - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_CHARACTER_SOCIAL_NOTE); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_CHARACTER_SOCIAL_NOTE); stmt.AddValue(0, note); stmt.AddValue(1, GetPlayerGUID().GetCounter()); stmt.AddValue(2, friendGuid.GetCounter()); diff --git a/Source/Game/Events/GameEventManager.cs b/Source/Game/Events/GameEventManager.cs index 12a7c0a86..754c76b88 100644 --- a/Source/Game/Events/GameEventManager.cs +++ b/Source/Game/Events/GameEventManager.cs @@ -176,11 +176,11 @@ namespace Game pair.Value.done = 0; SQLTransaction trans = new(); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ALL_GAME_EVENT_CONDITION_SAVE); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ALL_GAME_EVENT_CONDITION_SAVE); stmt.AddValue(0, event_id); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_GAME_EVENT_SAVE); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_GAME_EVENT_SAVE); stmt.AddValue(0, event_id); trans.Append(stmt); @@ -1502,12 +1502,12 @@ namespace Game // save the change to db SQLTransaction trans = new(); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_GAME_EVENT_CONDITION_SAVE); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_GAME_EVENT_CONDITION_SAVE); stmt.AddValue(0, event_id); stmt.AddValue(1, condition); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_GAME_EVENT_CONDITION_SAVE); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_GAME_EVENT_CONDITION_SAVE); stmt.AddValue(0, event_id); stmt.AddValue(1, condition); stmt.AddValue(2, eventFinishCond.done); @@ -1547,11 +1547,11 @@ namespace Game { SQLTransaction trans = new(); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_GAME_EVENT_SAVE); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_GAME_EVENT_SAVE); stmt.AddValue(0, event_id); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_GAME_EVENT_SAVE); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_GAME_EVENT_SAVE); stmt.AddValue(0, event_id); stmt.AddValue(1, (byte)mGameEvent[event_id].state); stmt.AddValue(2, mGameEvent[event_id].nextstart != 0 ? mGameEvent[event_id].nextstart : 0L); diff --git a/Source/Game/Garrisons/Garrisons.cs b/Source/Game/Garrisons/Garrisons.cs index accde25b0..86fe8e6a9 100644 --- a/Source/Game/Garrisons/Garrisons.cs +++ b/Source/Game/Garrisons/Garrisons.cs @@ -128,7 +128,7 @@ namespace Game.Garrisons { DeleteFromDB(_owner.GetGUID().GetCounter(), trans); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_CHARACTER_GARRISON); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_CHARACTER_GARRISON); stmt.AddValue(0, _owner.GetGUID().GetCounter()); stmt.AddValue(1, _siteLevel.Id); stmt.AddValue(2, _followerActivationsRemainingToday); @@ -136,7 +136,7 @@ namespace Game.Garrisons foreach (uint building in _knownBuildings) { - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_CHARACTER_GARRISON_BLUEPRINTS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_CHARACTER_GARRISON_BLUEPRINTS); stmt.AddValue(0, _owner.GetGUID().GetCounter()); stmt.AddValue(1, building); trans.Append(stmt); @@ -146,7 +146,7 @@ namespace Game.Garrisons { if (plot.BuildingInfo.PacketInfo != null) { - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_CHARACTER_GARRISON_BUILDINGS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_CHARACTER_GARRISON_BUILDINGS); stmt.AddValue(0, _owner.GetGUID().GetCounter()); stmt.AddValue(1, plot.BuildingInfo.PacketInfo.GarrPlotInstanceID); stmt.AddValue(2, plot.BuildingInfo.PacketInfo.GarrBuildingID); @@ -159,7 +159,7 @@ namespace Game.Garrisons foreach (var follower in _followers.Values) { byte index = 0; - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_CHARACTER_GARRISON_FOLLOWERS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_CHARACTER_GARRISON_FOLLOWERS); stmt.AddValue(index++, follower.PacketInfo.DbID); stmt.AddValue(index++, _owner.GetGUID().GetCounter()); stmt.AddValue(index++, follower.PacketInfo.GarrFollowerID); @@ -176,7 +176,7 @@ namespace Game.Garrisons byte slot = 0; foreach (GarrAbilityRecord ability in follower.PacketInfo.AbilityID) { - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_CHARACTER_GARRISON_FOLLOWER_ABILITIES); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_CHARACTER_GARRISON_FOLLOWER_ABILITIES); stmt.AddValue(0, follower.PacketInfo.DbID); stmt.AddValue(1, ability.Id); stmt.AddValue(2, slot++); @@ -187,19 +187,19 @@ namespace Game.Garrisons public static void DeleteFromDB(ulong ownerGuid, SQLTransaction trans) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHARACTER_GARRISON); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHARACTER_GARRISON); stmt.AddValue(0, ownerGuid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHARACTER_GARRISON_BLUEPRINTS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHARACTER_GARRISON_BLUEPRINTS); stmt.AddValue(0, ownerGuid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHARACTER_GARRISON_BUILDINGS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHARACTER_GARRISON_BUILDINGS); stmt.AddValue(0, ownerGuid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHARACTER_GARRISON_FOLLOWERS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHARACTER_GARRISON_FOLLOWERS); stmt.AddValue(0, ownerGuid); trans.Append(stmt); } diff --git a/Source/Game/Globals/ObjectManager.cs b/Source/Game/Globals/ObjectManager.cs index 94527940f..10fc869ab 100644 --- a/Source/Game/Globals/ObjectManager.cs +++ b/Source/Game/Globals/ObjectManager.cs @@ -1056,7 +1056,7 @@ namespace Game // add link to DB if (persist) { - PreparedStatement stmt = DB.World.GetPreparedStatement(WorldStatements.INS_GRAVEYARD_ZONE); + PreparedStatement stmt = WorldDatabase.GetPreparedStatement(WorldStatements.INS_GRAVEYARD_ZONE); stmt.AddValue(0, id); stmt.AddValue(1, zoneId); @@ -1104,7 +1104,7 @@ namespace Game // remove link from DB if (persist) { - PreparedStatement stmt = DB.World.GetPreparedStatement(WorldStatements.DEL_GRAVEYARD_ZONE); + PreparedStatement stmt = WorldDatabase.GetPreparedStatement(WorldStatements.DEL_GRAVEYARD_ZONE); stmt.AddValue(0, id); stmt.AddValue(1, zoneId); @@ -1557,7 +1557,7 @@ namespace Game foreach (var script in sWaypointScripts) actionSet.Add(script.Key); - PreparedStatement stmt = DB.World.GetPreparedStatement(WorldStatements.SEL_WAYPOINT_DATA_ACTION); + PreparedStatement stmt = WorldDatabase.GetPreparedStatement(WorldStatements.SEL_WAYPOINT_DATA_ACTION); SQLResult result = DB.World.Query(stmt); if (!result.IsEmpty()) @@ -1774,7 +1774,7 @@ namespace Game { var time = Time.GetMSTime(); - PreparedStatement stmt = DB.World.GetPreparedStatement(WorldStatements.SEL_CREATURE_TEMPLATE); + PreparedStatement stmt = WorldDatabase.GetPreparedStatement(WorldStatements.SEL_CREATURE_TEMPLATE); stmt.AddValue(0, 0); stmt.AddValue(1, 1); @@ -3515,7 +3515,7 @@ namespace Game uint LoadReferenceVendor(int vendor, int item, List skip_vendors) { // find all items from the reference vendor - PreparedStatement stmt = DB.World.GetPreparedStatement(WorldStatements.SEL_NPC_VENDOR_REF); + PreparedStatement stmt = WorldDatabase.GetPreparedStatement(WorldStatements.SEL_NPC_VENDOR_REF); stmt.AddValue(0, item); SQLResult result = DB.World.Query(stmt); @@ -3788,7 +3788,7 @@ namespace Game PhasingHandler.InitDbVisibleMapId(phaseShift, data.terrainSwapMap); Global.TerrainMgr.GetZoneAndAreaId(phaseShift, out uint zoneId, out uint areaId, data.MapId, data.SpawnPoint); - PreparedStatement stmt = DB.World.GetPreparedStatement(WorldStatements.UPD_CREATURE_ZONE_AREA_DATA); + PreparedStatement stmt = WorldDatabase.GetPreparedStatement(WorldStatements.UPD_CREATURE_ZONE_AREA_DATA); stmt.AddValue(0, zoneId); stmt.AddValue(1, areaId); stmt.AddValue(2, guid); @@ -3945,7 +3945,7 @@ namespace Game if (linkedGuidLow == 0) // we're removing the linking { linkedRespawnStorage.Remove(guid); - stmt = DB.World.GetPreparedStatement(WorldStatements.DEL_LINKED_RESPAWN); + stmt = WorldDatabase.GetPreparedStatement(WorldStatements.DEL_LINKED_RESPAWN); stmt.AddValue(0, guidLow); stmt.AddValue(1, (uint)CreatureLinkedRespawnType.CreatureToCreature); DB.World.Execute(stmt); @@ -3976,7 +3976,7 @@ namespace Game ObjectGuid linkedGuid = ObjectGuid.Create(HighGuid.Creature, slave.MapId, slave.Id, linkedGuidLow); linkedRespawnStorage[guid] = linkedGuid; - stmt = DB.World.GetPreparedStatement(WorldStatements.REP_LINKED_RESPAWN); + stmt = WorldDatabase.GetPreparedStatement(WorldStatements.REP_LINKED_RESPAWN); stmt.AddValue(0, guidLow); stmt.AddValue(1, linkedGuidLow); stmt.AddValue(2, (uint)CreatureLinkedRespawnType.CreatureToCreature); @@ -4581,7 +4581,7 @@ namespace Game PhasingHandler.InitDbVisibleMapId(phaseShift, data.terrainSwapMap); Global.TerrainMgr.GetZoneAndAreaId(phaseShift, out uint zoneId, out uint areaId, data.MapId, data.SpawnPoint); - PreparedStatement stmt = DB.World.GetPreparedStatement(WorldStatements.UPD_GAMEOBJECT_ZONE_AREA_DATA); + PreparedStatement stmt = WorldDatabase.GetPreparedStatement(WorldStatements.UPD_GAMEOBJECT_ZONE_AREA_DATA); stmt.AddValue(0, zoneId); stmt.AddValue(1, areaId); stmt.AddValue(2, guid); @@ -5180,7 +5180,7 @@ namespace Game if (persist) { - PreparedStatement stmt = DB.World.GetPreparedStatement(WorldStatements.INS_NPC_VENDOR); + PreparedStatement stmt = WorldDatabase.GetPreparedStatement(WorldStatements.INS_NPC_VENDOR); stmt.AddValue(0, entry); stmt.AddValue(1, vItem.item); @@ -5203,7 +5203,7 @@ namespace Game if (persist) { - PreparedStatement stmt = DB.World.GetPreparedStatement(WorldStatements.DEL_NPC_VENDOR); + PreparedStatement stmt = WorldDatabase.GetPreparedStatement(WorldStatements.DEL_NPC_VENDOR); stmt.AddValue(0, entry); stmt.AddValue(1, item); @@ -5918,7 +5918,7 @@ namespace Game gameTeleStorage[newId] = tele; - PreparedStatement stmt = DB.World.GetPreparedStatement(WorldStatements.INS_GAME_TELE); + PreparedStatement stmt = WorldDatabase.GetPreparedStatement(WorldStatements.INS_GAME_TELE); stmt.AddValue(0, newId); stmt.AddValue(1, tele.posX); @@ -5940,7 +5940,7 @@ namespace Game { if (pair.Value.nameLow == name) { - PreparedStatement stmt = DB.World.GetPreparedStatement(WorldStatements.DEL_GAME_TELE); + PreparedStatement stmt = WorldDatabase.GetPreparedStatement(WorldStatements.DEL_GAME_TELE); stmt.AddValue(0, pair.Value.name); DB.World.Execute(stmt); @@ -9601,11 +9601,11 @@ namespace Game // Delete all old mails without item and without body immediately, if starting server if (!serverUp) { - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_EMPTY_EXPIRED_MAIL); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_EMPTY_EXPIRED_MAIL); stmt.AddValue(0, curTime); DB.Characters.Execute(stmt); } - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_EXPIRED_MAIL); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_EXPIRED_MAIL); stmt.AddValue(0, curTime); SQLResult result = DB.Characters.Query(stmt); if (result.IsEmpty()) @@ -9615,7 +9615,7 @@ namespace Game } MultiMap itemsCache = new(); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_EXPIRED_MAIL_ITEMS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_EXPIRED_MAIL_ITEMS); stmt.AddValue(0, curTime); SQLResult items = DB.Characters.Query(stmt); if (!items.IsEmpty()) @@ -9668,14 +9668,14 @@ namespace Game AzeriteEmpoweredItem.DeleteFromDB(null, itemInfo.item_guid); } - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_MAIL_ITEM_BY_ID); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_MAIL_ITEM_BY_ID); stmt.AddValue(0, m.messageID); DB.Characters.Execute(stmt); } else { // Mail will be returned - stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_MAIL_RETURNED); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_MAIL_RETURNED); stmt.AddValue(0, m.receiver); stmt.AddValue(1, m.sender); stmt.AddValue(2, curTime + 30 * Time.Day); @@ -9686,12 +9686,12 @@ namespace Game foreach (var itemInfo in m.items) { // Update receiver in mail items for its proper delivery, and in instance_item for avoid lost item at sender delete - stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_MAIL_ITEM_RECEIVER); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_MAIL_ITEM_RECEIVER); stmt.AddValue(0, m.sender); stmt.AddValue(1, itemInfo.item_guid); DB.Characters.Execute(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_ITEM_OWNER); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_ITEM_OWNER); stmt.AddValue(0, m.sender); stmt.AddValue(1, itemInfo.item_guid); DB.Characters.Execute(stmt); @@ -9701,7 +9701,7 @@ namespace Game } } - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_MAIL_BY_ID); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_MAIL_BY_ID); stmt.AddValue(0, m.messageID); DB.Characters.Execute(stmt); ++deletedCount; diff --git a/Source/Game/Groups/Group.cs b/Source/Game/Groups/Group.cs index 1447b1898..8412a423a 100644 --- a/Source/Game/Groups/Group.cs +++ b/Source/Game/Groups/Group.cs @@ -124,7 +124,7 @@ namespace Game.Groups Global.GroupMgr.RegisterGroupDbStoreId(m_dbStoreId, this); // Store group in database - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_GROUP); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_GROUP); byte index = 0; @@ -204,7 +204,7 @@ namespace Game.Groups var character = Global.CharacterCacheStorage.GetCharacterCacheByGuid(member.guid); if (character == null) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_GROUP_MEMBER); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_GROUP_MEMBER); stmt.AddValue(0, guidLow); DB.Characters.Execute(stmt); return; @@ -232,7 +232,7 @@ namespace Game.Groups m_lootMethod = LootMethod.PersonalLoot; if (!IsBGGroup() && !IsBFGroup()) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_GROUP_TYPE); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_GROUP_TYPE); stmt.AddValue(0, (byte)m_groupFlags); stmt.AddValue(1, m_dbStoreId); @@ -251,7 +251,7 @@ namespace Game.Groups if (!IsBGGroup() && !IsBFGroup()) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_GROUP_TYPE); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_GROUP_TYPE); stmt.AddValue(0, (byte)m_groupFlags); stmt.AddValue(1, m_dbStoreId); @@ -281,7 +281,7 @@ namespace Game.Groups if (!IsBGGroup() && !IsBFGroup()) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_GROUP_TYPE); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_GROUP_TYPE); stmt.AddValue(0, (byte)m_groupFlags); stmt.AddValue(1, m_dbStoreId); @@ -429,7 +429,7 @@ namespace Game.Groups // insert into the table if we're not a Battlegroundgroup if (!IsBGGroup() && !IsBFGroup()) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_GROUP_MEMBER); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_GROUP_MEMBER); stmt.AddValue(0, m_dbStoreId); stmt.AddValue(1, member.guid.GetCounter()); @@ -573,7 +573,7 @@ namespace Game.Groups // Remove player from group in DB if (!IsBGGroup() && !IsBFGroup()) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_GROUP_MEMBER); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_GROUP_MEMBER); stmt.AddValue(0, guid.GetCounter()); DB.Characters.Execute(stmt); DelinkMember(guid); @@ -651,7 +651,7 @@ namespace Game.Groups SQLTransaction trans = new(); // Update the group leader - stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_GROUP_LEADER); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_GROUP_LEADER); stmt.AddValue(0, newLeader.GetGUID().GetCounter()); stmt.AddValue(1, m_dbStoreId); @@ -723,15 +723,15 @@ namespace Game.Groups { SQLTransaction trans = new(); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_GROUP); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_GROUP); stmt.AddValue(0, m_dbStoreId); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_GROUP_MEMBER_ALL); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_GROUP_MEMBER_ALL); stmt.AddValue(0, m_dbStoreId); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_LFG_DATA); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_LFG_DATA); stmt.AddValue(0, m_dbStoreId); trans.Append(stmt); @@ -959,7 +959,7 @@ namespace Game.Groups if (!IsBGGroup() && !IsBFGroup()) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_GROUP_MEMBER_SUBGROUP); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_GROUP_MEMBER_SUBGROUP); stmt.AddValue(0, group); stmt.AddValue(1, guid.GetCounter()); @@ -1009,7 +1009,7 @@ namespace Game.Groups // Preserve new sub group in database for non-raid groups if (!IsBGGroup() && !IsBFGroup()) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_GROUP_MEMBER_SUBGROUP); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_GROUP_MEMBER_SUBGROUP); stmt.AddValue(0, group); stmt.AddValue(1, guid.GetCounter()); @@ -1058,7 +1058,7 @@ namespace Game.Groups // Preserve new sub group in database for non-raid groups if (!IsBGGroup() && !IsBFGroup()) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_GROUP_MEMBER_SUBGROUP); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_GROUP_MEMBER_SUBGROUP); stmt.AddValue(0, slots[i].group); stmt.AddValue(1, slots[i].guid.GetCounter()); @@ -1245,7 +1245,7 @@ namespace Game.Groups m_dungeonDifficulty = difficulty; if (!IsBGGroup() && !IsBFGroup()) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_GROUP_DIFFICULTY); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_GROUP_DIFFICULTY); stmt.AddValue(0, (byte)m_dungeonDifficulty); stmt.AddValue(1, m_dbStoreId); @@ -1269,7 +1269,7 @@ namespace Game.Groups m_raidDifficulty = difficulty; if (!IsBGGroup() && !IsBFGroup()) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_GROUP_RAID_DIFFICULTY); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_GROUP_RAID_DIFFICULTY); stmt.AddValue(0, (byte)m_raidDifficulty); stmt.AddValue(1, m_dbStoreId); @@ -1293,7 +1293,7 @@ namespace Game.Groups m_legacyRaidDifficulty = difficulty; if (!IsBGGroup() && !IsBFGroup()) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_GROUP_LEGACY_RAID_DIFFICULTY); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_GROUP_LEGACY_RAID_DIFFICULTY); stmt.AddValue(0, (byte)m_legacyRaidDifficulty); stmt.AddValue(1, m_dbStoreId); @@ -1746,7 +1746,7 @@ namespace Game.Groups ToggleGroupMemberFlag(slot, flag, apply); // Preserve the new setting in the db - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_GROUP_MEMBER_FLAG); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_GROUP_MEMBER_FLAG); stmt.AddValue(0, (byte)slot.flags); stmt.AddValue(1, guid.GetCounter()); diff --git a/Source/Game/Guilds/Guild.cs b/Source/Game/Guilds/Guild.cs index ec571f127..8dcfe11f9 100644 --- a/Source/Game/Guilds/Guild.cs +++ b/Source/Game/Guilds/Guild.cs @@ -48,12 +48,12 @@ namespace Game.Guilds SQLTransaction trans = new(); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_GUILD_MEMBERS); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_GUILD_MEMBERS); stmt.AddValue(0, m_id); trans.Append(stmt); byte index = 0; - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_GUILD); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_GUILD); stmt.AddValue(index, m_id); stmt.AddValue(++index, name); stmt.AddValue(++index, m_leaderGuid.GetCounter()); @@ -97,34 +97,34 @@ namespace Game.Guilds DeleteMember(trans, member.Value.GetGUID(), true); } - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_GUILD); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_GUILD); stmt.AddValue(0, m_id); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_GUILD_RANKS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_GUILD_RANKS); stmt.AddValue(0, m_id); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_GUILD_BANK_TABS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_GUILD_BANK_TABS); stmt.AddValue(0, m_id); trans.Append(stmt); // Free bank tab used memory and delete items stored in them _DeleteBankItems(trans, true); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_GUILD_BANK_ITEMS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_GUILD_BANK_ITEMS); stmt.AddValue(0, m_id); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_GUILD_BANK_RIGHTS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_GUILD_BANK_RIGHTS); stmt.AddValue(0, m_id); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_GUILD_BANK_EVENTLOGS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_GUILD_BANK_EVENTLOGS); stmt.AddValue(0, m_id); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_GUILD_EVENTLOGS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_GUILD_EVENTLOGS); stmt.AddValue(0, m_id); trans.Append(stmt); @@ -183,7 +183,7 @@ namespace Game.Guilds return false; m_name = name; - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_GUILD_NAME); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_GUILD_NAME); stmt.AddValue(0, m_name); stmt.AddValue(1, GetId()); DB.Characters.Execute(stmt); @@ -340,7 +340,7 @@ namespace Game.Guilds Global.ScriptMgr.OnGuildMOTDChanged(this, motd); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_GUILD_MOTD); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_GUILD_MOTD); stmt.AddValue(0, motd); stmt.AddValue(1, m_id); DB.Characters.Execute(stmt); @@ -361,7 +361,7 @@ namespace Game.Guilds Global.ScriptMgr.OnGuildInfoChanged(this, info); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_GUILD_INFO); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_GUILD_INFO); stmt.AddValue(0, info); stmt.AddValue(1, m_id); DB.Characters.Execute(stmt); @@ -804,13 +804,13 @@ namespace Game.Guilds SQLTransaction trans = new SQLTransaction(); // Delete bank rights for rank - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_GUILD_BANK_RIGHTS_FOR_RANK); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_GUILD_BANK_RIGHTS_FOR_RANK); stmt.AddValue(0, m_id); stmt.AddValue(1, (byte)rankInfo.GetId()); trans.Append(stmt); // Delete rank - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_GUILD_RANK); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_GUILD_RANK); stmt.AddValue(0, m_id); stmt.AddValue(1, (byte)rankInfo.GetId()); trans.Append(stmt); @@ -825,7 +825,7 @@ namespace Game.Guilds otherRank.SetOrder(otherRank.GetOrder() - 1); - stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_GUILD_RANK_ORDER); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_GUILD_RANK_ORDER); stmt.AddValue(0, (byte)otherRank.GetOrder()); stmt.AddValue(1, (byte)otherRank.GetId()); stmt.AddValue(2, m_id); @@ -859,13 +859,13 @@ namespace Game.Guilds SQLTransaction trans = new SQLTransaction(); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_GUILD_RANK_ORDER); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_GUILD_RANK_ORDER); stmt.AddValue(0, (byte)rankInfo.GetOrder()); stmt.AddValue(1, (byte)rankInfo.GetId()); stmt.AddValue(2, m_id); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_GUILD_RANK_ORDER); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_GUILD_RANK_ORDER); stmt.AddValue(0, (byte)otherRankInfo.GetOrder()); stmt.AddValue(1, (byte)otherRankInfo.GetId()); stmt.AddValue(2, m_id); @@ -1628,7 +1628,7 @@ namespace Game.Guilds bool ok = false; // Player must exist - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHAR_DATA_FOR_GUILD); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHAR_DATA_FOR_GUILD); stmt.AddValue(0, lowguid); SQLResult result = DB.Characters.Query(stmt); if (!result.IsEmpty()) @@ -1814,12 +1814,12 @@ namespace Game.Guilds SQLTransaction trans = new(); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_GUILD_BANK_TAB); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_GUILD_BANK_TAB); stmt.AddValue(0, m_id); stmt.AddValue(1, tabId); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_GUILD_BANK_TAB); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_GUILD_BANK_TAB); stmt.AddValue(0, m_id); stmt.AddValue(1, tabId); trans.Append(stmt); @@ -1833,11 +1833,11 @@ namespace Game.Guilds void _CreateDefaultGuildRanks(SQLTransaction trans, Locale loc = Locale.enUS) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_GUILD_RANKS); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_GUILD_RANKS); stmt.AddValue(0, m_id); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_GUILD_BANK_RIGHTS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_GUILD_BANK_RIGHTS); stmt.AddValue(0, m_id); trans.Append(stmt); @@ -1918,7 +1918,7 @@ namespace Game.Guilds m_bankMoney -= amount; } - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_GUILD_BANK_MONEY); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_GUILD_BANK_MONEY); stmt.AddValue(0, m_bankMoney); stmt.AddValue(1, m_id); trans.Append(stmt); @@ -1934,7 +1934,7 @@ namespace Game.Guilds m_leaderGuid = leader.GetGUID(); leader.ChangeRank(trans, GuildRankId.GuildMaster); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_GUILD_LEADER); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_GUILD_LEADER); stmt.AddValue(0, m_leaderGuid.GetCounter()); stmt.AddValue(1, m_id); trans.Append(stmt); @@ -2502,7 +2502,7 @@ namespace Game.Guilds void _DeleteMemberFromDB(SQLTransaction trans, ulong lowguid) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_GUILD_MEMBER); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_GUILD_MEMBER); stmt.AddValue(0, lowguid); DB.Characters.ExecuteOrAppend(trans, stmt); } @@ -2618,7 +2618,7 @@ namespace Game.Guilds m_publicNote = publicNote; - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_GUILD_MEMBER_PNOTE); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_GUILD_MEMBER_PNOTE); stmt.AddValue(0, publicNote); stmt.AddValue(1, m_guid.GetCounter()); DB.Characters.Execute(stmt); @@ -2631,7 +2631,7 @@ namespace Game.Guilds m_officerNote = officerNote; - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_GUILD_MEMBER_OFFNOTE); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_GUILD_MEMBER_OFFNOTE); stmt.AddValue(0, officerNote); stmt.AddValue(1, m_guid.GetCounter()); DB.Characters.Execute(stmt); @@ -2646,7 +2646,7 @@ namespace Game.Guilds if (player != null) player.SetGuildRank((byte)newRank); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_GUILD_MEMBER_RANK); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_GUILD_MEMBER_RANK); stmt.AddValue(0, (byte)newRank); stmt.AddValue(1, m_guid.GetCounter()); DB.Characters.ExecuteOrAppend(trans, stmt); @@ -2654,7 +2654,7 @@ namespace Game.Guilds public void SaveToDB(SQLTransaction trans) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_GUILD_MEMBER); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_GUILD_MEMBER); stmt.AddValue(0, m_guildId); stmt.AddValue(1, m_guid.GetCounter()); stmt.AddValue(2, (byte)m_rankId); @@ -2732,7 +2732,7 @@ namespace Game.Guilds { m_bankWithdraw[tabId] += amount; - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_GUILD_MEMBER_WITHDRAW_TABS); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_GUILD_MEMBER_WITHDRAW_TABS); stmt.AddValue(0, m_guid.GetCounter()); for (byte i = 0; i < GuildConst.MaxBankTabs;) { @@ -2748,7 +2748,7 @@ namespace Game.Guilds { m_bankWithdrawMoney += amount; - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_GUILD_MEMBER_WITHDRAW_MONEY); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_GUILD_MEMBER_WITHDRAW_MONEY); stmt.AddValue(0, m_guid.GetCounter()); stmt.AddValue(1, m_bankWithdrawMoney); DB.Characters.ExecuteOrAppend(trans, stmt); @@ -2890,13 +2890,13 @@ namespace Game.Guilds public override void SaveToDB(SQLTransaction trans) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_GUILD_EVENTLOG); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_GUILD_EVENTLOG); stmt.AddValue(0, m_guildId); stmt.AddValue(1, m_guid); trans.Append(stmt); byte index = 0; - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_GUILD_EVENTLOG); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_GUILD_EVENTLOG); stmt.AddValue(index, m_guildId); stmt.AddValue(++index, m_guid); stmt.AddValue(++index, (byte)m_eventType); @@ -2969,14 +2969,14 @@ namespace Game.Guilds { byte index = 0; - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_GUILD_BANK_EVENTLOG); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_GUILD_BANK_EVENTLOG); stmt.AddValue(index, m_guildId); stmt.AddValue(++index, m_guid); stmt.AddValue(++index, m_bankTabId); trans.Append(stmt); index = 0; - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_GUILD_BANK_EVENTLOG); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_GUILD_BANK_EVENTLOG); stmt.AddValue(index, m_guildId); stmt.AddValue(++index, m_guid); stmt.AddValue(++index, m_bankTabId); @@ -3067,7 +3067,7 @@ namespace Game.Guilds public override void SaveToDB(SQLTransaction trans) { byte index = 0; - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_GUILD_NEWS); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_GUILD_NEWS); stmt.AddValue(index, m_guildId); stmt.AddValue(++index, GetGUID()); stmt.AddValue(++index, (byte)GetNewsType()); @@ -3201,7 +3201,7 @@ namespace Game.Guilds public void SaveToDB(SQLTransaction trans) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_GUILD_RANK); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_GUILD_RANK); stmt.AddValue(0, m_guildId); stmt.AddValue(1, (byte)m_rankId); stmt.AddValue(2, (byte)m_rankOrder); @@ -3226,7 +3226,7 @@ namespace Game.Guilds if (logOnCreate) Log.outError(LogFilter.Guild, $"Guild {m_guildId} has broken Tab {i} for rank {m_rankId}. Created default tab."); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_GUILD_BANK_RIGHT); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_GUILD_BANK_RIGHT); stmt.AddValue(0, m_guildId); stmt.AddValue(1, i); stmt.AddValue(2, (byte)m_rankId); @@ -3243,7 +3243,7 @@ namespace Game.Guilds m_name = name; - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_GUILD_RANK_NAME); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_GUILD_RANK_NAME); stmt.AddValue(0, m_name); stmt.AddValue(1, (byte)m_rankId); stmt.AddValue(2, m_guildId); @@ -3260,7 +3260,7 @@ namespace Game.Guilds m_rights = rights; - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_GUILD_RANK_RIGHTS); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_GUILD_RANK_RIGHTS); stmt.AddValue(0, (uint)m_rights); stmt.AddValue(1, (byte)m_rankId); stmt.AddValue(2, m_guildId); @@ -3274,7 +3274,7 @@ namespace Game.Guilds m_bankMoneyPerDay = money; - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_GUILD_RANK_BANK_MONEY); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_GUILD_RANK_BANK_MONEY); stmt.AddValue(0, money); stmt.AddValue(1, (byte)m_rankId); stmt.AddValue(2, m_guildId); @@ -3290,7 +3290,7 @@ namespace Game.Guilds if (saveToDB) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_GUILD_BANK_RIGHT); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_GUILD_BANK_RIGHT); stmt.AddValue(0, m_guildId); stmt.AddValue(1, rightsAndSlots.GetTabId()); stmt.AddValue(2, (byte)m_rankId); @@ -3372,7 +3372,7 @@ namespace Game.Guilds { Log.outError(LogFilter.Guild, "Item (GUID {0}, id: {1}) not found in item_instance, deleting from guild bank!", itemGuid, itemEntry); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_NONEXISTENT_GUILD_BANK_ITEM); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_NONEXISTENT_GUILD_BANK_ITEM); stmt.AddValue(0, m_guildId); stmt.AddValue(1, m_tabId); stmt.AddValue(2, slotId); @@ -3407,7 +3407,7 @@ namespace Game.Guilds m_name = name; m_icon = icon; - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_GUILD_BANK_TAB_INFO); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_GUILD_BANK_TAB_INFO); stmt.AddValue(0, m_name); stmt.AddValue(1, m_icon); stmt.AddValue(2, m_guildId); @@ -3422,7 +3422,7 @@ namespace Game.Guilds m_text = text; - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_GUILD_BANK_TAB_TEXT); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_GUILD_BANK_TAB_TEXT); stmt.AddValue(0, m_text); stmt.AddValue(1, m_guildId); stmt.AddValue(2, m_tabId); @@ -3462,7 +3462,7 @@ namespace Game.Guilds m_items[slotId] = item; - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_GUILD_BANK_ITEM); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_GUILD_BANK_ITEM); stmt.AddValue(0, m_guildId); stmt.AddValue(1, m_tabId); stmt.AddValue(2, slotId); @@ -3470,7 +3470,7 @@ namespace Game.Guilds if (item != null) { - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_GUILD_BANK_ITEM); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_GUILD_BANK_ITEM); stmt.AddValue(0, m_guildId); stmt.AddValue(1, m_tabId); stmt.AddValue(2, slotId); @@ -3562,7 +3562,7 @@ namespace Game.Guilds public void SaveToDB(ulong guildId) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_GUILD_EMBLEM_INFO); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_GUILD_EMBLEM_INFO); stmt.AddValue(0, m_style); stmt.AddValue(1, m_color); stmt.AddValue(2, m_borderStyle); diff --git a/Source/Game/Guilds/GuildManager.cs b/Source/Game/Guilds/GuildManager.cs index 9f4666da3..66af3fb31 100644 --- a/Source/Game/Guilds/GuildManager.cs +++ b/Source/Game/Guilds/GuildManager.cs @@ -357,7 +357,7 @@ namespace Game // Delete orphan guild bank items DB.Characters.DirectExecute("DELETE gbi FROM guild_bank_item gbi LEFT JOIN guild g ON gbi.guildId = g.guildId WHERE g.guildId IS NULL"); - SQLResult result = DB.Characters.Query(DB.Characters.GetPreparedStatement(CharStatements.SEL_GUILD_BANK_ITEMS)); + SQLResult result = DB.Characters.Query(CharacterDatabase.GetPreparedStatement(CharStatements.SEL_GUILD_BANK_ITEMS)); if (result.IsEmpty()) { Log.outInfo(LogFilter.ServerLoading, "Loaded 0 guild bank tab items. DB table `guild_bank_item` or `item_instance` is empty."); @@ -387,11 +387,11 @@ namespace Game foreach (var pair in GuildStore) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_GUILD_ACHIEVEMENT); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_GUILD_ACHIEVEMENT); stmt.AddValue(0, pair.Key); SQLResult achievementResult = DB.Characters.Query(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_GUILD_ACHIEVEMENT_CRITERIA); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_GUILD_ACHIEVEMENT_CRITERIA); stmt.AddValue(0, pair.Key); SQLResult criteriaResult = DB.Characters.Query(stmt); @@ -451,7 +451,7 @@ namespace Game continue; } - PreparedStatement stmt = DB.World.GetPreparedStatement(WorldStatements.SEL_GUILD_REWARDS_REQ_ACHIEVEMENTS); + PreparedStatement stmt = WorldDatabase.GetPreparedStatement(WorldStatements.SEL_GUILD_REWARDS_REQ_ACHIEVEMENTS); stmt.AddValue(0, reward.ItemID); SQLResult reqAchievementResult = DB.World.Query(stmt); if (!reqAchievementResult.IsEmpty()) @@ -478,7 +478,7 @@ namespace Game public void ResetTimes(bool week) { - DB.Characters.Execute(DB.Characters.GetPreparedStatement(CharStatements.DEL_GUILD_MEMBER_WITHDRAW)); + DB.Characters.Execute(CharacterDatabase.GetPreparedStatement(CharStatements.DEL_GUILD_MEMBER_WITHDRAW)); foreach (var guild in GuildStore.Values) guild.ResetTimes(week); diff --git a/Source/Game/Handlers/AuctionHandler.cs b/Source/Game/Handlers/AuctionHandler.cs index 732dd7baf..39b244adf 100644 --- a/Source/Game/Handlers/AuctionHandler.cs +++ b/Source/Game/Handlers/AuctionHandler.cs @@ -398,7 +398,7 @@ namespace Game else { // place bid - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_AUCTION_BID); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_AUCTION_BID); stmt.AddValue(0, auction.Bidder.GetCounter()); stmt.AddValue(1, auction.BidAmount); stmt.AddValue(2, (byte)auction.ServerFlags); @@ -408,7 +408,7 @@ namespace Game auction.BidderHistory.Add(player.GetGUID()); if (auction.BidderHistory.Contains(player.GetGUID())) { - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_AUCTION_BIDDER); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_AUCTION_BIDDER); stmt.AddValue(0, auction.Id); stmt.AddValue(1, player.GetGUID().GetCounter()); trans.Append(stmt); @@ -531,7 +531,7 @@ namespace Game [WorldPacketHandler(ClientOpcodes.AuctionRequestFavoriteList)] void HandleAuctionRequestFavoriteList(AuctionRequestFavoriteList requestFavoriteList) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHARACTER_FAVORITE_AUCTIONS); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHARACTER_FAVORITE_AUCTIONS); stmt.AddValue(0, _player.GetGUID().GetCounter()); GetQueryProcessor().AddCallback(DB.Characters.AsyncQuery(stmt)).WithCallback(favoriteAuctionResult => { @@ -926,14 +926,14 @@ namespace Game SQLTransaction trans = new(); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHARACTER_FAVORITE_AUCTION); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHARACTER_FAVORITE_AUCTION); stmt.AddValue(0, _player.GetGUID().GetCounter()); stmt.AddValue(1, setFavoriteItem.Item.Order); trans.Append(stmt); if (!setFavoriteItem.IsNotFavorite) { - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_CHARACTER_FAVORITE_AUCTION); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_CHARACTER_FAVORITE_AUCTION); stmt.AddValue(0, _player.GetGUID().GetCounter()); stmt.AddValue(1, setFavoriteItem.Item.Order); stmt.AddValue(2, setFavoriteItem.Item.ItemID); diff --git a/Source/Game/Handlers/CharacterHandler.cs b/Source/Game/Handlers/CharacterHandler.cs index a1b570e40..bfe80bc73 100644 --- a/Source/Game/Handlers/CharacterHandler.cs +++ b/Source/Game/Handlers/CharacterHandler.cs @@ -25,7 +25,7 @@ namespace Game void HandleCharEnum(EnumCharacters charEnum) { // remove expired bans - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_EXPIRED_BANS); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_EXPIRED_BANS); DB.Characters.Execute(stmt); // get all the data necessary for loading all characters (along with their pets) on the account @@ -86,7 +86,7 @@ namespace Game if (charInfo.Flags2 != CharacterCustomizeFlags.Customize) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_ADD_AT_LOGIN_FLAG); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_ADD_AT_LOGIN_FLAG); stmt.AddValue(0, (ushort)AtLoginFlags.Customize); stmt.AddValue(1, charInfo.Guid.GetCounter()); DB.Characters.Execute(stmt); @@ -414,7 +414,7 @@ namespace Game } CharacterCreateInfo createInfo = charCreate.CreateInfo; - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHECK_NAME); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHECK_NAME); stmt.AddValue(0, charCreate.CreateInfo.Name); _queryProcessor.AddCallback(DB.Characters.AsyncQuery(stmt).WithChainingCallback((queryCallback, result) => @@ -425,7 +425,7 @@ namespace Game return; } - stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_SUM_REALM_CHARACTERS); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.SEL_SUM_REALM_CHARACTERS); stmt.AddValue(0, GetAccountId()); queryCallback.SetNextQuery(DB.Login.AsyncQuery(stmt)); @@ -441,7 +441,7 @@ namespace Game return; } - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_SUM_CHARS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_SUM_CHARS); stmt.AddValue(0, GetAccountId()); queryCallback.SetNextQuery(DB.Characters.AsyncQuery(stmt)); @@ -595,7 +595,7 @@ namespace Game newChar.SaveToDB(loginTransaction, characterTransaction, true); createInfo.CharCount += 1; - stmt = DB.Login.GetPreparedStatement(LoginStatements.REP_REALM_CHARACTERS); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.REP_REALM_CHARACTERS); stmt.AddValue(0, createInfo.CharCount); stmt.AddValue(1, GetAccountId()); stmt.AddValue(2, Global.WorldMgr.GetRealm().Id.Index); @@ -626,7 +626,7 @@ namespace Game return; } - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHAR_CREATE_INFO); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHAR_CREATE_INFO); stmt.AddValue(0, GetAccountId()); stmt.AddValue(1, (skipCinematics == 1 || createInfo.ClassId == Class.DemonHunter || createInfo.ClassId == Class.Evoker) ? 1200 : 1); // 200 (max chars per realm) + 1000 (max deleted chars per realm) queryCallback.WithCallback(finalizeCharacterCreation).SetNextQuery(DB.Characters.AsyncQuery(stmt)); @@ -722,7 +722,7 @@ namespace Game foreach (var reorderInfo in reorderChars.Entries) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_CHAR_LIST_SLOT); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_CHAR_LIST_SLOT); stmt.AddValue(0, reorderInfo.NewPosition); stmt.AddValue(1, reorderInfo.PlayerGUID.GetCounter()); stmt.AddValue(2, GetAccountId()); @@ -902,11 +902,11 @@ namespace Game pCurrChar.SendInitialPacketsAfterAddToMap(); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_CHAR_ONLINE); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_CHAR_ONLINE); stmt.AddValue(0, pCurrChar.GetGUID().GetCounter()); DB.Characters.Execute(stmt); - stmt = DB.Login.GetPreparedStatement(LoginStatements.UPD_ACCOUNT_ONLINE); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.UPD_ACCOUNT_ONLINE); stmt.AddValue(0, GetAccountId()); DB.Login.Execute(stmt); @@ -946,12 +946,12 @@ namespace Game if (pCurrChar.HasAtLoginFlag(AtLoginFlags.ResetPetTalents)) { // Delete all of the player's pet spells - PreparedStatement stmtSpells = DB.Characters.GetPreparedStatement(CharStatements.DEL_ALL_PET_SPELLS_BY_OWNER); + PreparedStatement stmtSpells = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ALL_PET_SPELLS_BY_OWNER); stmtSpells.AddValue(0, pCurrChar.GetGUID().GetCounter()); DB.Characters.Execute(stmtSpells); // Then reset all of the player's pet specualizations - PreparedStatement stmtSpec = DB.Characters.GetPreparedStatement(CharStatements.UPD_PET_SPECS_BY_OWNER); + PreparedStatement stmtSpec = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_PET_SPECS_BY_OWNER); stmtSpec.AddValue(0, pCurrChar.GetGUID().GetCounter()); DB.Characters.Execute(stmtSpec); } @@ -1228,7 +1228,7 @@ namespace Game } // Ensure that there is no character with the desired new name - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHECK_NAME); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHECK_NAME); stmt.AddValue(0, checkCharacterNameAvailability.Name); var sequenceIndex = checkCharacterNameAvailability.SequenceIndex; @@ -1276,7 +1276,7 @@ namespace Game } // Ensure that there is no character with the desired new name - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_FREE_NAME); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_FREE_NAME); stmt.AddValue(0, request.RenameInfo.Guid.GetCounter()); stmt.AddValue(1, request.RenameInfo.NewName); @@ -1305,13 +1305,13 @@ namespace Game ulong lowGuid = renameInfo.Guid.GetCounter(); // Update name and at_login flag in the db - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_CHAR_NAME_AT_LOGIN); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_CHAR_NAME_AT_LOGIN); stmt.AddValue(0, renameInfo.NewName); stmt.AddValue(1, (ushort)atLoginFlags); stmt.AddValue(2, lowGuid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_DECLINED_NAME); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_DECLINED_NAME); stmt.AddValue(0, lowGuid); trans.Append(stmt); @@ -1362,11 +1362,11 @@ namespace Game SQLTransaction trans = new(); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_DECLINED_NAME); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_DECLINED_NAME); stmt.AddValue(0, packet.Player.GetCounter()); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_CHAR_DECLINED_NAME); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_CHAR_DECLINED_NAME); stmt.AddValue(0, packet.Player.GetCounter()); for (byte i = 0; i < SharedConst.MaxDeclinedNameCases; i++) @@ -1437,7 +1437,7 @@ namespace Game return; } - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHAR_CUSTOMIZE_INFO); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHAR_CUSTOMIZE_INFO); stmt.AddValue(0, packet.CustomizeInfo.CharGUID.GetCounter()); _queryProcessor.AddCallback(DB.Characters.AsyncQuery(stmt).WithCallback(HandleCharCustomizeCallback, packet.CustomizeInfo)); @@ -1520,13 +1520,13 @@ namespace Game // Name Change and update atLogin flags { - stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_CHAR_NAME_AT_LOGIN); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_CHAR_NAME_AT_LOGIN); stmt.AddValue(0, customizeInfo.CharName); stmt.AddValue(1, (ushort)atLoginFlags); stmt.AddValue(2, lowGuid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_DECLINED_NAME); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_DECLINED_NAME); stmt.AddValue(0, lowGuid); trans.Append(stmt); @@ -1708,7 +1708,7 @@ namespace Game return; } - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHAR_RACE_OR_FACTION_CHANGE_INFOS); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHAR_RACE_OR_FACTION_CHANGE_INFOS); stmt.AddValue(0, packet.RaceOrFactionChangeInfo.Guid.GetCounter()); _queryProcessor.AddCallback(DB.Characters.AsyncQuery(stmt).WithCallback(HandleCharRaceOrFactionChangeCallback, packet.RaceOrFactionChangeInfo)); @@ -1830,14 +1830,14 @@ namespace Game // Name Change and update atLogin flags { - stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_CHAR_NAME_AT_LOGIN); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_CHAR_NAME_AT_LOGIN); stmt.AddValue(0, factionChangeInfo.Name); stmt.AddValue(1, (ushort)((atLoginFlags | AtLoginFlags.Resurrect) & ~usedLoginFlag)); stmt.AddValue(2, lowGuid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_DECLINED_NAME); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_DECLINED_NAME); stmt.AddValue(0, lowGuid); trans.Append(stmt); @@ -1848,7 +1848,7 @@ namespace Game // Race Change { - stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_CHAR_RACE); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_CHAR_RACE); stmt.AddValue(0, (byte)factionChangeInfo.RaceID); stmt.AddValue(1, (ushort)PlayerExtraFlags.HasRaceChanged); stmt.AddValue(2, lowGuid); @@ -1862,12 +1862,12 @@ namespace Game { // Switch Languages // delete all languages first - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_SKILL_LANGUAGES); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_SKILL_LANGUAGES); stmt.AddValue(0, lowGuid); trans.Append(stmt); // Now add them back - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_CHAR_SKILL_LANGUAGE); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_CHAR_SKILL_LANGUAGE); stmt.AddValue(0, lowGuid); // Faction specific languages @@ -1881,7 +1881,7 @@ namespace Game // Race specific languages if (factionChangeInfo.RaceID != Race.Orc && factionChangeInfo.RaceID != Race.Human) { - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_CHAR_SKILL_LANGUAGE); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_CHAR_SKILL_LANGUAGE); stmt.AddValue(0, lowGuid); switch (factionChangeInfo.RaceID) @@ -1935,7 +1935,7 @@ namespace Game if (factionChangeInfo.FactionChange) { // Delete all Flypaths - stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_CHAR_TAXI_PATH); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_CHAR_TAXI_PATH); stmt.AddValue(0, lowGuid); trans.Append(stmt); @@ -1955,7 +1955,7 @@ namespace Game taximaskstream += (uint)(factionMask[i] | deathKnightExtraNode) + ' '; } - stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_CHAR_TAXIMASK); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_CHAR_TAXIMASK); stmt.AddValue(0, taximaskstream); stmt.AddValue(1, lowGuid); trans.Append(stmt); @@ -1974,21 +1974,21 @@ namespace Game if (!HasPermission(RBACPermissions.TwoSideAddFriend)) { // Delete Friend List - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_SOCIAL_BY_GUID); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_SOCIAL_BY_GUID); stmt.AddValue(0, lowGuid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_SOCIAL_BY_FRIEND); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_SOCIAL_BY_FRIEND); stmt.AddValue(0, lowGuid); trans.Append(stmt); } // Reset homebind and position - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_PLAYER_HOMEBIND); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_PLAYER_HOMEBIND); stmt.AddValue(0, lowGuid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_PLAYER_HOMEBIND); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_PLAYER_HOMEBIND); stmt.AddValue(0, lowGuid); WorldLocation loc; @@ -2019,12 +2019,12 @@ namespace Game uint achiev_alliance = it.Key; uint achiev_horde = it.Value; - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_ACHIEVEMENT_BY_ACHIEVEMENT); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_ACHIEVEMENT_BY_ACHIEVEMENT); stmt.AddValue(0, (ushort)(newTeamId == TeamId.Alliance ? achiev_alliance : achiev_horde)); stmt.AddValue(1, lowGuid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_CHAR_ACHIEVEMENT); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_CHAR_ACHIEVEMENT); stmt.AddValue(0, (ushort)(newTeamId == TeamId.Alliance ? achiev_alliance : achiev_horde)); stmt.AddValue(1, (ushort)(newTeamId == TeamId.Alliance ? achiev_horde : achiev_alliance)); stmt.AddValue(2, lowGuid); @@ -2038,7 +2038,7 @@ namespace Game uint oldItemId = it.Key; uint newItemId = it.Value; - stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_CHAR_INVENTORY_FACTION_CHANGE); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_CHAR_INVENTORY_FACTION_CHANGE); stmt.AddValue(0, newItemId); stmt.AddValue(1, oldItemId); stmt.AddValue(2, lowGuid); @@ -2046,7 +2046,7 @@ namespace Game } // Delete all current quests - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_QUESTSTATUS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_QUESTSTATUS); stmt.AddValue(0, lowGuid); trans.Append(stmt); @@ -2056,12 +2056,12 @@ namespace Game uint quest_alliance = it.Key; uint quest_horde = it.Value; - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_QUESTSTATUS_REWARDED_BY_QUEST); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_QUESTSTATUS_REWARDED_BY_QUEST); stmt.AddValue(0, lowGuid); stmt.AddValue(1, (newTeamId == TeamId.Alliance ? quest_alliance : quest_horde)); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_CHAR_QUESTSTATUS_REWARDED_FACTION_CHANGE); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_CHAR_QUESTSTATUS_REWARDED_FACTION_CHANGE); stmt.AddValue(0, (newTeamId == TeamId.Alliance ? quest_alliance : quest_horde)); stmt.AddValue(1, (newTeamId == TeamId.Alliance ? quest_horde : quest_alliance)); stmt.AddValue(2, lowGuid); @@ -2069,7 +2069,7 @@ namespace Game } // Mark all rewarded quests as "active" (will count for completed quests achievements) - stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_CHAR_QUESTSTATUS_REWARDED_ACTIVE); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_CHAR_QUESTSTATUS_REWARDED_ACTIVE); stmt.AddValue(0, lowGuid); trans.Append(stmt); @@ -2081,7 +2081,7 @@ namespace Game long newRaceMask = (long)(newTeamId == TeamId.Alliance ? SharedConst.RaceMaskAlliance : SharedConst.RaceMaskHorde); if (quest.AllowableRaces != -1 && !Convert.ToBoolean(quest.AllowableRaces & newRaceMask)) { - stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_CHAR_QUESTSTATUS_REWARDED_ACTIVE_BY_QUEST); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_CHAR_QUESTSTATUS_REWARDED_ACTIVE_BY_QUEST); stmt.AddValue(0, lowGuid); stmt.AddValue(1, quest.Id); trans.Append(stmt); @@ -2095,12 +2095,12 @@ namespace Game uint spell_alliance = it.Key; uint spell_horde = it.Value; - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_SPELL_BY_SPELL); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_SPELL_BY_SPELL); stmt.AddValue(0, (newTeamId == TeamId.Alliance ? spell_alliance : spell_horde)); stmt.AddValue(1, lowGuid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_CHAR_SPELL_FACTION_CHANGE); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_CHAR_SPELL_FACTION_CHANGE); stmt.AddValue(0, (newTeamId == TeamId.Alliance ? spell_alliance : spell_horde)); stmt.AddValue(1, (newTeamId == TeamId.Alliance ? spell_horde : spell_alliance)); stmt.AddValue(2, lowGuid); @@ -2116,7 +2116,7 @@ namespace Game uint oldReputation = (newTeamId == TeamId.Alliance) ? reputation_horde : reputation_alliance; // select old standing set in db - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHAR_REP_BY_FACTION); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHAR_REP_BY_FACTION); stmt.AddValue(0, oldReputation); stmt.AddValue(1, lowGuid); @@ -2136,12 +2136,12 @@ namespace Game int FinalRep = oldDBRep + oldBaseRep; int newDBRep = FinalRep - newBaseRep; - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_REP_BY_FACTION); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_REP_BY_FACTION); stmt.AddValue(0, newReputation); stmt.AddValue(1, lowGuid); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_CHAR_REP_FACTION_CHANGE); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_CHAR_REP_FACTION_CHANGE); stmt.AddValue(0, (ushort)newReputation); stmt.AddValue(1, newDBRep); stmt.AddValue(2, (ushort)oldReputation); @@ -2207,13 +2207,13 @@ namespace Game for (int index = 0; index < knownTitles.Count; ++index) ss += knownTitles[index] + ' '; - stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_CHAR_TITLES_FACTION_CHANGE); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_CHAR_TITLES_FACTION_CHANGE); stmt.AddValue(0, ss); stmt.AddValue(1, lowGuid); trans.Append(stmt); // unset any currently chosen title - stmt = DB.Characters.GetPreparedStatement(CharStatements.RES_CHAR_TITLES_FACTION_CHANGE); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.RES_CHAR_TITLES_FACTION_CHANGE); stmt.AddValue(0, lowGuid); trans.Append(stmt); } @@ -2249,7 +2249,7 @@ namespace Game [WorldPacketHandler(ClientOpcodes.GetUndeleteCharacterCooldownStatus, Status = SessionStatus.Authed)] void HandleGetUndeleteCooldownStatus(GetUndeleteCharacterCooldownStatus getCooldown) { - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_LAST_CHAR_UNDELETE); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.SEL_LAST_CHAR_UNDELETE); stmt.AddValue(0, GetBattlenetAccountId()); _queryProcessor.AddCallback(DB.Login.AsyncQuery(stmt).WithCallback(HandleUndeleteCooldownStatusCallback)); @@ -2279,7 +2279,7 @@ namespace Game return; } - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_LAST_CHAR_UNDELETE); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.SEL_LAST_CHAR_UNDELETE); stmt.AddValue(0, GetBattlenetAccountId()); CharacterUndeleteInfo undeleteInfo = undeleteCharacter.UndeleteInfo; @@ -2296,7 +2296,7 @@ namespace Game } } - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHAR_DEL_INFO_BY_GUID); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHAR_DEL_INFO_BY_GUID); stmt.AddValue(0, undeleteInfo.CharacterGuid.GetCounter()); queryCallback.SetNextQuery(DB.Characters.AsyncQuery(stmt)); }).WithChainingCallback((queryCallback, result) => @@ -2315,7 +2315,7 @@ namespace Game return; } - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHECK_NAME); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHECK_NAME); stmt.AddValue(0, undeleteInfo.Name); queryCallback.SetNextQuery(DB.Characters.AsyncQuery(stmt)); }).WithChainingCallback((queryCallback, result) => @@ -2332,7 +2332,7 @@ namespace Game // * max demon hunter count // * team violation - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_SUM_CHARS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_SUM_CHARS); stmt.AddValue(0, GetAccountId()); queryCallback.SetNextQuery(DB.Characters.AsyncQuery(stmt)); }).WithCallback(result => @@ -2346,13 +2346,13 @@ namespace Game } } - stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_RESTORE_DELETE_INFO); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_RESTORE_DELETE_INFO); stmt.AddValue(0, undeleteInfo.Name); stmt.AddValue(1, GetAccountId()); stmt.AddValue(2, undeleteInfo.CharacterGuid.GetCounter()); DB.Characters.Execute(stmt); - stmt = DB.Login.GetPreparedStatement(LoginStatements.UPD_LAST_CHAR_UNDELETE); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.UPD_LAST_CHAR_UNDELETE); stmt.AddValue(0, GetBattlenetAccountId()); DB.Login.Execute(stmt); @@ -2615,258 +2615,258 @@ namespace Game { ulong lowGuid = m_guid.GetCounter(); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHARACTER); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHARACTER); stmt.AddValue(0, lowGuid); SetQuery(PlayerLoginQueryLoad.From, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHARACTER_CUSTOMIZATIONS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHARACTER_CUSTOMIZATIONS); stmt.AddValue(0, lowGuid); SetQuery(PlayerLoginQueryLoad.Customizations, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_GROUP_MEMBER); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_GROUP_MEMBER); stmt.AddValue(0, lowGuid); SetQuery(PlayerLoginQueryLoad.Group, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHARACTER_AURAS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHARACTER_AURAS); stmt.AddValue(0, lowGuid); SetQuery(PlayerLoginQueryLoad.Auras, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHARACTER_AURA_EFFECTS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHARACTER_AURA_EFFECTS); stmt.AddValue(0, lowGuid); SetQuery(PlayerLoginQueryLoad.AuraEffects, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHARACTER_AURA_STORED_LOCATIONS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHARACTER_AURA_STORED_LOCATIONS); stmt.AddValue(0, lowGuid); SetQuery(PlayerLoginQueryLoad.AuraStoredLocations, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHARACTER_SPELL); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHARACTER_SPELL); stmt.AddValue(0, lowGuid); SetQuery(PlayerLoginQueryLoad.Spells, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHARACTER_SPELL_FAVORITES); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHARACTER_SPELL_FAVORITES); stmt.AddValue(0, lowGuid); SetQuery(PlayerLoginQueryLoad.SpellFavorites, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHARACTER_QUESTSTATUS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHARACTER_QUESTSTATUS); stmt.AddValue(0, lowGuid); SetQuery(PlayerLoginQueryLoad.QuestStatus, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHARACTER_QUESTSTATUS_OBJECTIVES); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHARACTER_QUESTSTATUS_OBJECTIVES); stmt.AddValue(0, lowGuid); SetQuery(PlayerLoginQueryLoad.QuestStatusObjectives, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHARACTER_QUESTSTATUS_OBJECTIVES_CRITERIA); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHARACTER_QUESTSTATUS_OBJECTIVES_CRITERIA); stmt.AddValue(0, lowGuid); SetQuery(PlayerLoginQueryLoad.QuestStatusObjectivesCriteria, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHARACTER_QUESTSTATUS_OBJECTIVES_CRITERIA_PROGRESS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHARACTER_QUESTSTATUS_OBJECTIVES_CRITERIA_PROGRESS); stmt.AddValue(0, lowGuid); SetQuery(PlayerLoginQueryLoad.QuestStatusObjectivesCriteriaProgress, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHARACTER_QUESTSTATUS_DAILY); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHARACTER_QUESTSTATUS_DAILY); stmt.AddValue(0, lowGuid); SetQuery(PlayerLoginQueryLoad.DailyQuestStatus, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHARACTER_QUESTSTATUS_WEEKLY); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHARACTER_QUESTSTATUS_WEEKLY); stmt.AddValue(0, lowGuid); SetQuery(PlayerLoginQueryLoad.WeeklyQuestStatus, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHARACTER_QUESTSTATUS_MONTHLY); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHARACTER_QUESTSTATUS_MONTHLY); stmt.AddValue(0, lowGuid); SetQuery(PlayerLoginQueryLoad.MonthlyQuestStatus, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHARACTER_QUESTSTATUS_SEASONAL); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHARACTER_QUESTSTATUS_SEASONAL); stmt.AddValue(0, lowGuid); SetQuery(PlayerLoginQueryLoad.SeasonalQuestStatus, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHARACTER_REPUTATION); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHARACTER_REPUTATION); stmt.AddValue(0, lowGuid); SetQuery(PlayerLoginQueryLoad.Reputation, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHARACTER_INVENTORY); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHARACTER_INVENTORY); stmt.AddValue(0, lowGuid); SetQuery(PlayerLoginQueryLoad.Inventory, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_ITEM_INSTANCE_ARTIFACT); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_ITEM_INSTANCE_ARTIFACT); stmt.AddValue(0, lowGuid); SetQuery(PlayerLoginQueryLoad.Artifacts, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_ITEM_INSTANCE_AZERITE); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_ITEM_INSTANCE_AZERITE); stmt.AddValue(0, lowGuid); SetQuery(PlayerLoginQueryLoad.Azerite, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_ITEM_INSTANCE_AZERITE_MILESTONE_POWER); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_ITEM_INSTANCE_AZERITE_MILESTONE_POWER); stmt.AddValue(0, lowGuid); SetQuery(PlayerLoginQueryLoad.AzeriteMilestonePowers, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_ITEM_INSTANCE_AZERITE_UNLOCKED_ESSENCE); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_ITEM_INSTANCE_AZERITE_UNLOCKED_ESSENCE); stmt.AddValue(0, lowGuid); SetQuery(PlayerLoginQueryLoad.AzeriteUnlockedEssences, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_ITEM_INSTANCE_AZERITE_EMPOWERED); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_ITEM_INSTANCE_AZERITE_EMPOWERED); stmt.AddValue(0, lowGuid); SetQuery(PlayerLoginQueryLoad.AzeriteEmpowered, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHAR_VOID_STORAGE); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHAR_VOID_STORAGE); stmt.AddValue(0, lowGuid); SetQuery(PlayerLoginQueryLoad.VoidStorage, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_MAIL); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_MAIL); stmt.AddValue(0, lowGuid); SetQuery(PlayerLoginQueryLoad.Mails, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_MAILITEMS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_MAILITEMS); stmt.AddValue(0, lowGuid); SetQuery(PlayerLoginQueryLoad.MailItems, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_MAILITEMS_ARTIFACT); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_MAILITEMS_ARTIFACT); stmt.AddValue(0, lowGuid); SetQuery(PlayerLoginQueryLoad.MailItemsArtifact, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_MAILITEMS_AZERITE); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_MAILITEMS_AZERITE); stmt.AddValue(0, lowGuid); SetQuery(PlayerLoginQueryLoad.MailItemsAzerite, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_MAILITEMS_AZERITE_MILESTONE_POWER); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_MAILITEMS_AZERITE_MILESTONE_POWER); stmt.AddValue(0, lowGuid); SetQuery(PlayerLoginQueryLoad.MailItemsAzeriteMilestonePower, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_MAILITEMS_AZERITE_UNLOCKED_ESSENCE); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_MAILITEMS_AZERITE_UNLOCKED_ESSENCE); stmt.AddValue(0, lowGuid); SetQuery(PlayerLoginQueryLoad.MailItemsAzeriteUnlockedEssence, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_MAILITEMS_AZERITE_EMPOWERED); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_MAILITEMS_AZERITE_EMPOWERED); stmt.AddValue(0, lowGuid); SetQuery(PlayerLoginQueryLoad.MailItemsAzeriteEmpowered, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHARACTER_SOCIALLIST); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHARACTER_SOCIALLIST); stmt.AddValue(0, lowGuid); SetQuery(PlayerLoginQueryLoad.SocialList, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHARACTER_HOMEBIND); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHARACTER_HOMEBIND); stmt.AddValue(0, lowGuid); SetQuery(PlayerLoginQueryLoad.HomeBind, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHARACTER_SPELLCOOLDOWNS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHARACTER_SPELLCOOLDOWNS); stmt.AddValue(0, lowGuid); SetQuery(PlayerLoginQueryLoad.SpellCooldowns, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHARACTER_SPELL_CHARGES); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHARACTER_SPELL_CHARGES); stmt.AddValue(0, lowGuid); SetQuery(PlayerLoginQueryLoad.SpellCharges, stmt); if (WorldConfig.GetBoolValue(WorldCfg.DeclinedNamesUsed)) { - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHARACTER_DECLINEDNAMES); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHARACTER_DECLINEDNAMES); stmt.AddValue(0, lowGuid); SetQuery(PlayerLoginQueryLoad.DeclinedNames, stmt); } - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_GUILD_MEMBER); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_GUILD_MEMBER); stmt.AddValue(0, lowGuid); SetQuery(PlayerLoginQueryLoad.Guild, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHARACTER_ARENAINFO); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHARACTER_ARENAINFO); stmt.AddValue(0, lowGuid); SetQuery(PlayerLoginQueryLoad.ArenaInfo, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHARACTER_ACHIEVEMENTS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHARACTER_ACHIEVEMENTS); stmt.AddValue(0, lowGuid); SetQuery(PlayerLoginQueryLoad.Achievements, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHARACTER_CRITERIAPROGRESS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHARACTER_CRITERIAPROGRESS); stmt.AddValue(0, lowGuid); SetQuery(PlayerLoginQueryLoad.CriteriaProgress, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHARACTER_EQUIPMENTSETS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHARACTER_EQUIPMENTSETS); stmt.AddValue(0, lowGuid); SetQuery(PlayerLoginQueryLoad.EquipmentSets, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHARACTER_TRANSMOG_OUTFITS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHARACTER_TRANSMOG_OUTFITS); stmt.AddValue(0, lowGuid); SetQuery(PlayerLoginQueryLoad.TransmogOutfits, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHAR_CUF_PROFILES); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHAR_CUF_PROFILES); stmt.AddValue(0, lowGuid); SetQuery(PlayerLoginQueryLoad.CufProfiles, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHARACTER_BGDATA); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHARACTER_BGDATA); stmt.AddValue(0, lowGuid); SetQuery(PlayerLoginQueryLoad.BgData, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHARACTER_GLYPHS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHARACTER_GLYPHS); stmt.AddValue(0, lowGuid); SetQuery(PlayerLoginQueryLoad.Glyphs, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHARACTER_TALENTS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHARACTER_TALENTS); stmt.AddValue(0, lowGuid); SetQuery(PlayerLoginQueryLoad.Talents, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHARACTER_PVP_TALENTS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHARACTER_PVP_TALENTS); stmt.AddValue(0, lowGuid); SetQuery(PlayerLoginQueryLoad.PvpTalents, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_PLAYER_ACCOUNT_DATA); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_PLAYER_ACCOUNT_DATA); stmt.AddValue(0, lowGuid); SetQuery(PlayerLoginQueryLoad.AccountData, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHARACTER_SKILLS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHARACTER_SKILLS); stmt.AddValue(0, lowGuid); SetQuery(PlayerLoginQueryLoad.Skills, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHARACTER_RANDOMBG); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHARACTER_RANDOMBG); stmt.AddValue(0, lowGuid); SetQuery(PlayerLoginQueryLoad.RandomBg, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHARACTER_BANNED); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHARACTER_BANNED); stmt.AddValue(0, lowGuid); SetQuery(PlayerLoginQueryLoad.Banned, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHARACTER_QUESTSTATUSREW); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHARACTER_QUESTSTATUSREW); stmt.AddValue(0, lowGuid); SetQuery(PlayerLoginQueryLoad.QuestStatusRew, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_ACCOUNT_INSTANCELOCKTIMES); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_ACCOUNT_INSTANCELOCKTIMES); stmt.AddValue(0, m_accountId); SetQuery(PlayerLoginQueryLoad.InstanceLockTimes, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_PLAYER_CURRENCY); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_PLAYER_CURRENCY); stmt.AddValue(0, lowGuid); SetQuery(PlayerLoginQueryLoad.Currency, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CORPSE_LOCATION); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CORPSE_LOCATION); stmt.AddValue(0, lowGuid); SetQuery(PlayerLoginQueryLoad.CorpseLocation, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHAR_PETS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHAR_PETS); stmt.AddValue(0, lowGuid); SetQuery(PlayerLoginQueryLoad.PetSlots, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHARACTER_GARRISON); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHARACTER_GARRISON); stmt.AddValue(0, lowGuid); SetQuery(PlayerLoginQueryLoad.Garrison, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHARACTER_GARRISON_BLUEPRINTS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHARACTER_GARRISON_BLUEPRINTS); stmt.AddValue(0, lowGuid); SetQuery(PlayerLoginQueryLoad.GarrisonBlueprints, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHARACTER_GARRISON_BUILDINGS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHARACTER_GARRISON_BUILDINGS); stmt.AddValue(0, lowGuid); SetQuery(PlayerLoginQueryLoad.GarrisonBuildings, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHARACTER_GARRISON_FOLLOWERS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHARACTER_GARRISON_FOLLOWERS); stmt.AddValue(0, lowGuid); SetQuery(PlayerLoginQueryLoad.GarrisonFollowers, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHARACTER_GARRISON_FOLLOWER_ABILITIES); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHARACTER_GARRISON_FOLLOWER_ABILITIES); stmt.AddValue(0, lowGuid); SetQuery(PlayerLoginQueryLoad.GarrisonFollowerAbilities, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHAR_TRAIT_ENTRIES); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHAR_TRAIT_ENTRIES); stmt.AddValue(0, lowGuid); SetQuery(PlayerLoginQueryLoad.TraitEntries, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHAR_TRAIT_CONFIGS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHAR_TRAIT_CONFIGS); stmt.AddValue(0, lowGuid); SetQuery(PlayerLoginQueryLoad.TraitConfigs, stmt); } @@ -2892,11 +2892,11 @@ namespace Game }; bool result = true; - PreparedStatement stmt = DB.Characters.GetPreparedStatement(statements[isDeletedCharacters ? 1 : 0][withDeclinedNames ? 1 : 0]); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(statements[isDeletedCharacters ? 1 : 0][withDeclinedNames ? 1 : 0]); stmt.AddValue(0, accountId); SetQuery(EnumCharacterQueryLoad.Characters, stmt); - stmt = DB.Characters.GetPreparedStatement(statements[isDeletedCharacters ? 1 : 0][2]); + stmt = CharacterDatabase.GetPreparedStatement(statements[isDeletedCharacters ? 1 : 0][2]); stmt.AddValue(0, accountId); SetQuery(EnumCharacterQueryLoad.Customizations, stmt); diff --git a/Source/Game/Handlers/ItemHandler.cs b/Source/Game/Handlers/ItemHandler.cs index 35e076f3e..d17b677a9 100644 --- a/Source/Game/Handlers/ItemHandler.cs +++ b/Source/Game/Handlers/ItemHandler.cs @@ -711,7 +711,7 @@ namespace Game SQLTransaction trans = new(); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_CHAR_GIFT); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_CHAR_GIFT); stmt.AddValue(0, item.GetOwnerGUID().GetCounter()); stmt.AddValue(1, item.GetGUID().GetCounter()); stmt.AddValue(2, item.GetEntry()); diff --git a/Source/Game/Handlers/MailHandler.cs b/Source/Game/Handlers/MailHandler.cs index 9eb1494a3..d0775d329 100644 --- a/Source/Game/Handlers/MailHandler.cs +++ b/Source/Game/Handlers/MailHandler.cs @@ -294,7 +294,7 @@ namespace Game } else { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_MAIL_COUNT); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_MAIL_COUNT); stmt.AddValue(0, receiverGuid.GetCounter()); GetQueryProcessor().AddCallback(DB.Characters.AsyncQuery(stmt).WithChainingCallback((queryCallback, mailCountResult) => @@ -366,11 +366,11 @@ namespace Game //we can return mail now, so firstly delete the old one SQLTransaction trans = new(); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_MAIL_BY_ID); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_MAIL_BY_ID); stmt.AddValue(0, returnToSender.MailID); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_MAIL_ITEM_BY_ID); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_MAIL_ITEM_BY_ID); stmt.AddValue(0, returnToSender.MailID); trans.Append(stmt); diff --git a/Source/Game/Handlers/NPCHandler.cs b/Source/Game/Handlers/NPCHandler.cs index f2f528791..ca1e80243 100644 --- a/Source/Game/Handlers/NPCHandler.cs +++ b/Source/Game/Handlers/NPCHandler.cs @@ -502,7 +502,7 @@ namespace Game SQLTransaction trans = new(); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_CHAR_PET_SLOT_BY_ID); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_CHAR_PET_SLOT_BY_ID); stmt.AddValue(0, (short)dstPetSlot); stmt.AddValue(1, _player.GetGUID().GetCounter()); stmt.AddValue(2, srcPet.PetNumber); @@ -510,7 +510,7 @@ namespace Game if (dstPet != null) { - stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_CHAR_PET_SLOT_BY_ID); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_CHAR_PET_SLOT_BY_ID); stmt.AddValue(0, (short)srcPetSlot); stmt.AddValue(1, _player.GetGUID().GetCounter()); stmt.AddValue(2, dstPet.PetNumber); diff --git a/Source/Game/Handlers/PetHandler.cs b/Source/Game/Handlers/PetHandler.cs index 4050e0971..c9f189706 100644 --- a/Source/Game/Handlers/PetHandler.cs +++ b/Source/Game/Handlers/PetHandler.cs @@ -554,11 +554,11 @@ namespace Game SQLTransaction trans = new(); if (isdeclined) { - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_PET_DECLINEDNAME); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_PET_DECLINEDNAME); stmt.AddValue(0, pet.GetCharmInfo().GetPetNumber()); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_CHAR_PET_DECLINEDNAME); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_CHAR_PET_DECLINEDNAME); stmt.AddValue(0, pet.GetCharmInfo().GetPetNumber()); stmt.AddValue(1, GetPlayer().GetGUID().ToString()); @@ -568,7 +568,7 @@ namespace Game trans.Append(stmt); } - stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_CHAR_PET_NAME); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_CHAR_PET_NAME); stmt.AddValue(0, name); stmt.AddValue(1, GetPlayer().GetGUID().ToString()); stmt.AddValue(2, pet.GetCharmInfo().GetPetNumber()); diff --git a/Source/Game/Handlers/SocialHandler.cs b/Source/Game/Handlers/SocialHandler.cs index b1861ab59..15bc47302 100644 --- a/Source/Game/Handlers/SocialHandler.cs +++ b/Source/Game/Handlers/SocialHandler.cs @@ -169,7 +169,7 @@ namespace Game return; } - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_ACCOUNT_WHOIS); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.SEL_ACCOUNT_WHOIS); stmt.AddValue(0, player.GetSession().GetAccountId()); SQLResult result = DB.Login.Query(stmt); diff --git a/Source/Game/Handlers/SpellHandler.cs b/Source/Game/Handlers/SpellHandler.cs index acff72d78..d969fb339 100644 --- a/Source/Game/Handlers/SpellHandler.cs +++ b/Source/Game/Handlers/SpellHandler.cs @@ -174,7 +174,7 @@ namespace Game if (item.IsWrapped())// wrapped? { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHARACTER_GIFT_BY_ITEM); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHARACTER_GIFT_BY_ITEM); stmt.AddValue(0, item.GetGUID().GetCounter()); var pos = item.GetPos(); @@ -237,7 +237,7 @@ namespace Game GetPlayer().SaveInventoryAndGoldToDB(trans); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_GIFT); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_GIFT); stmt.AddValue(0, itemGuid.GetCounter()); trans.Append(stmt); diff --git a/Source/Game/Handlers/TicketHandler.cs b/Source/Game/Handlers/TicketHandler.cs index d9d1f4f88..71f396a60 100644 --- a/Source/Game/Handlers/TicketHandler.cs +++ b/Source/Game/Handlers/TicketHandler.cs @@ -84,7 +84,7 @@ namespace Game if (!Global.SupportMgr.GetBugSystemStatus()) return; - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_BUG_REPORT); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_BUG_REPORT); stmt.AddValue(0, bugReport.Text); stmt.AddValue(1, bugReport.DiagInfo); DB.Characters.Execute(stmt); diff --git a/Source/Game/Loot/LootItemStorage.cs b/Source/Game/Loot/LootItemStorage.cs index 880feea6a..5ccbadb30 100644 --- a/Source/Game/Loot/LootItemStorage.cs +++ b/Source/Game/Loot/LootItemStorage.cs @@ -21,7 +21,7 @@ namespace Game.Loots _lootItemStorage.Clear(); uint count = 0; - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_ITEMCONTAINER_ITEMS); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_ITEMCONTAINER_ITEMS); SQLResult result = DB.Characters.Query(stmt); if (!result.IsEmpty()) { @@ -60,7 +60,7 @@ namespace Game.Loots else Log.outInfo(LogFilter.ServerLoading, "Loaded 0 stored item loots"); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_ITEMCONTAINER_MONEY); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_ITEMCONTAINER_MONEY); result = DB.Characters.Query(stmt); if (!result.IsEmpty()) { @@ -146,11 +146,11 @@ namespace Game.Loots _lootItemStorage.TryRemove(containerId, out _); SQLTransaction trans = new(); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ITEMCONTAINER_ITEMS); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ITEMCONTAINER_ITEMS); stmt.AddValue(0, containerId); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ITEMCONTAINER_MONEY); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ITEMCONTAINER_MONEY); stmt.AddValue(0, containerId); trans.Append(stmt); @@ -183,7 +183,7 @@ namespace Game.Loots if (loot.gold != 0) container.AddMoney(loot.gold, trans); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ITEMCONTAINER_ITEMS); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ITEMCONTAINER_ITEMS); stmt.AddValue(0, containerId); trans.Append(stmt); @@ -226,7 +226,7 @@ namespace Game.Loots if (trans == null) return; - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_ITEMCONTAINER_ITEMS); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_ITEMCONTAINER_ITEMS); // container_id, item_id, item_count, follow_rules, ffa, blocked, counted, under_threshold, needs_quest, rnd_prop, rnd_suffix stmt.AddValue(0, _containerId); @@ -256,11 +256,11 @@ namespace Game.Loots if (trans == null) return; - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ITEMCONTAINER_MONEY); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ITEMCONTAINER_MONEY); stmt.AddValue(0, _containerId); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_ITEMCONTAINER_MONEY); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_ITEMCONTAINER_MONEY); stmt.AddValue(0, _containerId); stmt.AddValue(1, _money); trans.Append(stmt); @@ -270,7 +270,7 @@ namespace Game.Loots { _money = 0; - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ITEMCONTAINER_MONEY); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ITEMCONTAINER_MONEY); stmt.AddValue(0, _containerId); DB.Characters.Execute(stmt); } @@ -288,7 +288,7 @@ namespace Game.Loots } // Deletes a single item associated with an openable item from the DB - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ITEMCONTAINER_ITEM); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ITEMCONTAINER_ITEM); stmt.AddValue(0, _containerId); stmt.AddValue(1, itemId); stmt.AddValue(2, count); diff --git a/Source/Game/Mails/MailDraft.cs b/Source/Game/Mails/MailDraft.cs index bc7c3972a..63bcb94ad 100644 --- a/Source/Game/Mails/MailDraft.cs +++ b/Source/Game/Mails/MailDraft.cs @@ -105,7 +105,7 @@ namespace Game.Mails { item.SaveToDB(trans); // item not in inventory and can be save standalone // owner in data will set at mail receive and item extracting - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_ITEM_OWNER); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_ITEM_OWNER); stmt.AddValue(0, receiver_guid); stmt.AddValue(1, item.GetGUID().GetCounter()); trans.Append(stmt); @@ -152,7 +152,7 @@ namespace Game.Mails // Add to DB byte index = 0; - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_MAIL); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_MAIL); stmt.AddValue(index, mailId); stmt.AddValue(++index, (byte)sender.GetMailMessageType()); stmt.AddValue(++index, (sbyte)sender.GetStationery()); @@ -171,7 +171,7 @@ namespace Game.Mails foreach (var item in m_items.Values) { - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_MAIL_ITEM); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_MAIL_ITEM); stmt.AddValue(0, mailId); stmt.AddValue(1, item.GetGUID().GetCounter()); stmt.AddValue(2, receiver.GetPlayerGUIDLow()); diff --git a/Source/Game/Maps/Instances/InstanceLockManager.cs b/Source/Game/Maps/Instances/InstanceLockManager.cs index c660511c9..6e1dd43d7 100644 --- a/Source/Game/Maps/Instances/InstanceLockManager.cs +++ b/Source/Game/Maps/Instances/InstanceLockManager.cs @@ -270,13 +270,13 @@ namespace Game.Maps $"{entries.MapDifficulty.DifficultyID}-{CliDB.DifficultyStorage.LookupByKey(entries.MapDifficulty.DifficultyID).Name}] Expired instance lock for {playerGuid} in instance {updateEvent.InstanceId} is now active"); } - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHARACTER_INSTANCE_LOCK); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHARACTER_INSTANCE_LOCK); stmt.AddValue(0, playerGuid.GetCounter()); stmt.AddValue(1, entries.MapDifficulty.MapID); stmt.AddValue(2, entries.MapDifficulty.LockID); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_CHARACTER_INSTANCE_LOCK); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_CHARACTER_INSTANCE_LOCK); stmt.AddValue(0, playerGuid.GetCounter()); stmt.AddValue(1, entries.MapDifficulty.MapID); stmt.AddValue(2, entries.MapDifficulty.LockID); @@ -308,11 +308,11 @@ namespace Game.Maps if (updateEvent.EntranceWorldSafeLocId.HasValue) sharedData.EntranceWorldSafeLocId = updateEvent.EntranceWorldSafeLocId.Value; - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_INSTANCE); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_INSTANCE); stmt.AddValue(0, sharedData.InstanceId); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_INSTANCE); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_INSTANCE); stmt.AddValue(0, sharedData.InstanceId); stmt.AddValue(1, sharedData.Data); stmt.AddValue(2, sharedData.CompletedEncountersMask); @@ -326,7 +326,7 @@ namespace Game.Maps return; _instanceLockDataById.Remove(instanceId); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_INSTANCE); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_INSTANCE); stmt.AddValue(0, instanceId); DB.Characters.Execute(stmt); Log.outDebug(LogFilter.Instance, $"Deleting instance {instanceId} as it is no longer referenced by any player"); @@ -339,7 +339,7 @@ namespace Game.Maps { DateTime oldExpiryTime = instanceLock.GetEffectiveExpiryTime(); instanceLock.SetExtended(extended); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_CHARACTER_INSTANCE_LOCK_EXTENSION); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_CHARACTER_INSTANCE_LOCK_EXTENSION); stmt.AddValue(0, extended ? 1 : 0); stmt.AddValue(1, playerGuid.GetCounter()); stmt.AddValue(2, entries.MapDifficulty.MapID); @@ -395,7 +395,7 @@ namespace Game.Maps instanceLock.SetExpiryTime(newExpiryTime); instanceLock.SetExtended(false); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_CHARACTER_INSTANCE_LOCK_FORCE_EXPIRE); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_CHARACTER_INSTANCE_LOCK_FORCE_EXPIRE); stmt.AddValue(0, (ulong)Time.DateTimeToUnixTime(newExpiryTime)); stmt.AddValue(1, playerGuid.GetCounter()); stmt.AddValue(2, entries.MapDifficulty.MapID); diff --git a/Source/Game/Maps/Map.cs b/Source/Game/Maps/Map.cs index 45eac95f4..2141303c1 100644 --- a/Source/Game/Maps/Map.cs +++ b/Source/Game/Maps/Map.cs @@ -2052,7 +2052,7 @@ namespace Game.Maps if (Instanceable()) return; - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_RESPAWN); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_RESPAWN); stmt.AddValue(0, (ushort)type); stmt.AddValue(1, spawnId); stmt.AddValue(2, GetId()); @@ -2692,7 +2692,7 @@ namespace Game.Maps if (Instanceable()) return; - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.REP_RESPAWN); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.REP_RESPAWN); stmt.AddValue(0, (ushort)info.type); stmt.AddValue(1, info.spawnId); stmt.AddValue(2, info.respawnTime); @@ -2706,7 +2706,7 @@ namespace Game.Maps if (Instanceable()) return; - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_RESPAWNS); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_RESPAWNS); stmt.AddValue(0, GetId()); stmt.AddValue(1, GetInstanceId()); SQLResult result = DB.Characters.Query(stmt); @@ -2744,7 +2744,7 @@ namespace Game.Maps if (Instanceable()) return; - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ALL_RESPAWNS); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ALL_RESPAWNS); stmt.AddValue(0, GetId()); stmt.AddValue(1, GetInstanceId()); DB.Characters.Execute(stmt); @@ -2768,7 +2768,7 @@ namespace Game.Maps public void LoadCorpseData() { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CORPSES); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CORPSES); stmt.AddValue(0, GetId()); stmt.AddValue(1, GetInstanceId()); @@ -2781,7 +2781,7 @@ namespace Game.Maps MultiMap phases = new(); MultiMap customizations = new(); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CORPSE_PHASES); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CORPSE_PHASES); stmt.AddValue(0, GetId()); stmt.AddValue(1, GetInstanceId()); @@ -2800,7 +2800,7 @@ namespace Game.Maps } while (phaseResult.NextRow()); } - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CORPSE_CUSTOMIZATIONS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CORPSE_CUSTOMIZATIONS); stmt.AddValue(0, GetId()); stmt.AddValue(1, GetInstanceId()); @@ -2847,7 +2847,7 @@ namespace Game.Maps public void DeleteCorpseData() { // DELETE cp, c FROM corpse_phases cp INNER JOIN corpse c ON cp.OwnerGuid = c.guid WHERE c.mapId = ? AND c.instanceId = ? - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CORPSES_FROM_MAP); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CORPSES_FROM_MAP); stmt.AddValue(0, GetId()); stmt.AddValue(1, GetInstanceId()); DB.Characters.Execute(stmt); diff --git a/Source/Game/Movement/WaypointManager.cs b/Source/Game/Movement/WaypointManager.cs index a46e1205f..e4e17f680 100644 --- a/Source/Game/Movement/WaypointManager.cs +++ b/Source/Game/Movement/WaypointManager.cs @@ -75,7 +75,7 @@ namespace Game { _waypointStore.Remove(id); - PreparedStatement stmt = DB.World.GetPreparedStatement(WorldStatements.SEL_WAYPOINT_DATA_BY_ID); + PreparedStatement stmt = WorldDatabase.GetPreparedStatement(WorldStatements.SEL_WAYPOINT_DATA_BY_ID); stmt.AddValue(0, id); SQLResult result = DB.World.Query(stmt); diff --git a/Source/Game/Networking/RASocket.cs b/Source/Game/Networking/RASocket.cs index 2a24bb7a0..03736cf9a 100644 --- a/Source/Game/Networking/RASocket.cs +++ b/Source/Game/Networking/RASocket.cs @@ -132,7 +132,7 @@ namespace Game.Networking bool CheckAccessLevelAndPassword(string email, string password) { //"SELECT a.id, a.username FROM account a LEFT JOIN battlenet_accounts ba ON a.battlenet_account = ba.id WHERE ba.email = ?" - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_BNET_GAME_ACCOUNT_LIST); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.SEL_BNET_GAME_ACCOUNT_LIST); stmt.AddValue(0, email); SQLResult result = DB.Login.Query(stmt); if (result.IsEmpty()) @@ -144,7 +144,7 @@ namespace Game.Networking uint accountId = result.Read(0); string username = result.Read(1); - stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_ACCOUNT_ACCESS_BY_ID); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.SEL_ACCOUNT_ACCESS_BY_ID); stmt.AddValue(0, accountId); result = DB.Login.Query(stmt); if (result.IsEmpty()) @@ -165,7 +165,7 @@ namespace Game.Networking return false; } - stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_CHECK_PASSWORD); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.SEL_CHECK_PASSWORD); stmt.AddValue(0, accountId); result = DB.Login.Query(stmt); if (!result.IsEmpty()) diff --git a/Source/Game/Networking/WorldSocket.cs b/Source/Game/Networking/WorldSocket.cs index 0126cc2af..ebc5dffe9 100644 --- a/Source/Game/Networking/WorldSocket.cs +++ b/Source/Game/Networking/WorldSocket.cs @@ -73,7 +73,7 @@ namespace Game.Networking { string ip_address = GetRemoteIpAddress().ToString(); - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.SelIpInfo); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.SelIpInfo); stmt.AddValue(0, ip_address); stmt.AddValue(1, BitConverter.ToUInt32(GetRemoteIpAddress().Address.GetAddressBytes(), 0)); @@ -457,7 +457,7 @@ namespace Game.Networking void HandleAuthSession(AuthSession authSession) { // Get the account information from the realmd database - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_ACCOUNT_INFO_BY_NAME); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.SEL_ACCOUNT_INFO_BY_NAME); stmt.AddValue(0, Global.WorldMgr.GetRealm().Id.Index); stmt.AddValue(1, authSession.RealmJoinTicket); @@ -539,14 +539,14 @@ namespace Game.Networking if (WorldConfig.GetBoolValue(WorldCfg.AllowLogginIpAddressesInDatabase)) { // As we don't know if attempted login process by ip works, we update last_attempt_ip right away - stmt = DB.Login.GetPreparedStatement(LoginStatements.UPD_LAST_ATTEMPT_IP); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.UPD_LAST_ATTEMPT_IP); stmt.AddValue(0, address.Address.ToString()); stmt.AddValue(1, authSession.RealmJoinTicket); DB.Login.Execute(stmt); // This also allows to check for possible "hack" attempts on account } - stmt = DB.Login.GetPreparedStatement(LoginStatements.UPD_ACCOUNT_INFO_CONTINUED_SESSION); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.UPD_ACCOUNT_INFO_CONTINUED_SESSION); stmt.AddValue(0, _sessionKey); stmt.AddValue(1, account.game.Id); DB.Login.Execute(stmt); @@ -607,7 +607,7 @@ namespace Game.Networking { mutetime = GameTime.GetGameTime() + mutetime; - stmt = DB.Login.GetPreparedStatement(LoginStatements.UPD_MUTE_TIME_LOGIN); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.UPD_MUTE_TIME_LOGIN); stmt.AddValue(0, mutetime); stmt.AddValue(1, account.game.Id); DB.Login.Execute(stmt); @@ -636,7 +636,7 @@ namespace Game.Networking if (WorldConfig.GetBoolValue(WorldCfg.AllowLogginIpAddressesInDatabase)) { // Update the last_ip in the database - stmt = DB.Login.GetPreparedStatement(LoginStatements.UPD_LAST_IP); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.UPD_LAST_IP); stmt.AddValue(0, address.Address.ToString()); stmt.AddValue(1, authSession.RealmJoinTicket); DB.Login.Execute(stmt); @@ -675,7 +675,7 @@ namespace Game.Networking } uint accountId = key.AccountId; - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_ACCOUNT_INFO_CONTINUED_SESSION); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.SEL_ACCOUNT_INFO_CONTINUED_SESSION); stmt.AddValue(0, accountId); _queryProcessor.AddCallback(DB.Login.AsyncQuery(stmt).WithCallback(HandleAuthContinuedSessionCallback, authSession)); diff --git a/Source/Game/Pools/QuestPools.cs b/Source/Game/Pools/QuestPools.cs index a75141bc4..4b5e888b9 100644 --- a/Source/Game/Pools/QuestPools.cs +++ b/Source/Game/Pools/QuestPools.cs @@ -44,13 +44,13 @@ namespace Game public static void SaveToDB(QuestPool pool, SQLTransaction trans) { - PreparedStatement delStmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_POOL_QUEST_SAVE); + PreparedStatement delStmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_POOL_QUEST_SAVE); delStmt.AddValue(0, pool.poolId); trans.Append(delStmt); foreach (uint questId in pool.activeQuests) { - PreparedStatement insStmt = DB.Characters.GetPreparedStatement(CharStatements.INS_POOL_QUEST_SAVE); + PreparedStatement insStmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_POOL_QUEST_SAVE); insStmt.AddValue(0, pool.poolId); insStmt.AddValue(1, questId); trans.Append(insStmt); @@ -141,7 +141,7 @@ namespace Game SQLTransaction trans0 = new SQLTransaction(); foreach (uint poolId in unknownPoolIds) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_POOL_QUEST_SAVE); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_POOL_QUEST_SAVE); stmt.AddValue(0, poolId); trans0.Append(stmt); } diff --git a/Source/Game/Quest/QuestObjectiveCriteriaManager.cs b/Source/Game/Quest/QuestObjectiveCriteriaManager.cs index 0c1fec1f3..289da15e3 100644 --- a/Source/Game/Quest/QuestObjectiveCriteriaManager.cs +++ b/Source/Game/Quest/QuestObjectiveCriteriaManager.cs @@ -43,11 +43,11 @@ namespace Game { SQLTransaction trans = new(); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_QUESTSTATUS_OBJECTIVES_CRITERIA); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_QUESTSTATUS_OBJECTIVES_CRITERIA); stmt.AddValue(0, guid.GetCounter()); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_QUESTSTATUS_OBJECTIVES_CRITERIA_PROGRESS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_QUESTSTATUS_OBJECTIVES_CRITERIA_PROGRESS); stmt.AddValue(0, guid.GetCounter()); trans.Append(stmt); @@ -86,7 +86,7 @@ namespace Game // Removing non-existing criteria data for all characters Log.outError(LogFilter.Player, $"Non-existing quest objective criteria {criteriaId} data has been removed from the table `character_queststatus_objectives_criteria_progress`."); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_INVALID_QUEST_PROGRESS_CRITERIA); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_INVALID_QUEST_PROGRESS_CRITERIA); stmt.AddValue(0, criteriaId); DB.Characters.Execute(stmt); @@ -108,7 +108,7 @@ namespace Game public void SaveToDB(SQLTransaction trans) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_QUESTSTATUS_OBJECTIVES_CRITERIA); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_QUESTSTATUS_OBJECTIVES_CRITERIA); stmt.AddValue(0, _owner.GetGUID().GetCounter()); trans.Append(stmt); @@ -116,7 +116,7 @@ namespace Game { foreach (uint completedObjectiveId in _completedObjectives) { - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_CHAR_QUESTSTATUS_OBJECTIVES_CRITERIA); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_CHAR_QUESTSTATUS_OBJECTIVES_CRITERIA); stmt.AddValue(0, _owner.GetGUID().GetCounter()); stmt.AddValue(1, completedObjectiveId); trans.Append(stmt); @@ -130,14 +130,14 @@ namespace Game if (!pair.Value.Changed) continue; - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_QUESTSTATUS_OBJECTIVES_CRITERIA_PROGRESS_BY_CRITERIA); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_QUESTSTATUS_OBJECTIVES_CRITERIA_PROGRESS_BY_CRITERIA); stmt.AddValue(0, _owner.GetGUID().GetCounter()); stmt.AddValue(1, pair.Key); trans.Append(stmt); if (pair.Value.Counter != 0) { - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_CHAR_QUESTSTATUS_OBJECTIVES_CRITERIA_PROGRESS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_CHAR_QUESTSTATUS_OBJECTIVES_CRITERIA_PROGRESS); stmt.AddValue(0, _owner.GetGUID().GetCounter()); stmt.AddValue(1, pair.Key); stmt.AddValue(2, pair.Value.Counter); diff --git a/Source/Game/Reputation/ReputationManager.cs b/Source/Game/Reputation/ReputationManager.cs index 15c5257c5..adb678d72 100644 --- a/Source/Game/Reputation/ReputationManager.cs +++ b/Source/Game/Reputation/ReputationManager.cs @@ -758,12 +758,12 @@ namespace Game { if (factionState.needSave) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_REPUTATION_BY_FACTION); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_REPUTATION_BY_FACTION); stmt.AddValue(0, _player.GetGUID().GetCounter()); stmt.AddValue(1, factionState.Id); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_CHAR_REPUTATION_BY_FACTION); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_CHAR_REPUTATION_BY_FACTION); stmt.AddValue(0, _player.GetGUID().GetCounter()); stmt.AddValue(1, factionState.Id); stmt.AddValue(2, factionState.Standing); diff --git a/Source/Game/Server/WorldSession.cs b/Source/Game/Server/WorldSession.cs index dbb7db44f..9e3f4608a 100644 --- a/Source/Game/Server/WorldSession.cs +++ b/Source/Game/Server/WorldSession.cs @@ -209,7 +209,7 @@ namespace Game SendPacket(logoutComplete); //! Since each account can only have one online character at any given time, ensure all characters for active account are marked as offline - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_ACCOUNT_ONLINE); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_ACCOUNT_ONLINE); stmt.AddValue(0, GetAccountId()); DB.Characters.Execute(stmt); } @@ -459,7 +459,7 @@ namespace Game return; bool hasTutorialsInDB = tutorialsChanged.HasAnyFlag(TutorialsFlag.LoadedFromDB); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(hasTutorialsInDB ? CharStatements.UPD_TUTORIALS : CharStatements.INS_TUTORIALS); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(hasTutorialsInDB ? CharStatements.UPD_TUTORIALS : CharStatements.INS_TUTORIALS); for (var i = 0; i < SharedConst.MaxAccountTutorialValues; ++i) stmt.AddValue(i, tutorials[i]); stmt.AddValue(SharedConst.MaxAccountTutorialValues, GetAccountId()); @@ -538,7 +538,7 @@ namespace Game { if (Convert.ToBoolean((1 << (int)type) & (int)AccountDataTypes.GlobalCacheMask)) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.REP_ACCOUNT_DATA); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.REP_ACCOUNT_DATA); stmt.AddValue(0, GetAccountId()); stmt.AddValue(1, (byte)type); stmt.AddValue(2, time); @@ -551,7 +551,7 @@ namespace Game if (m_GUIDLow == 0) return; - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.REP_PLAYER_ACCOUNT_DATA); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.REP_PLAYER_ACCOUNT_DATA); stmt.AddValue(0, m_GUIDLow); stmt.AddValue(1, (byte)type); stmt.AddValue(2, time); @@ -1109,11 +1109,11 @@ namespace Game { public void Initialize(uint accountId, uint battlenetAccountId) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_ACCOUNT_DATA); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_ACCOUNT_DATA); stmt.AddValue(0, accountId); SetQuery(AccountInfoQueryLoad.GlobalAccountDataIndexPerRealm, stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_TUTORIALS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_TUTORIALS); stmt.AddValue(0, accountId); SetQuery(AccountInfoQueryLoad.TutorialsIndexPerRealm, stmt); } @@ -1123,40 +1123,40 @@ namespace Game { public void Initialize(uint accountId, uint battlenetAccountId) { - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_ACCOUNT_TOYS); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.SEL_ACCOUNT_TOYS); stmt.AddValue(0, battlenetAccountId); SetQuery(AccountInfoQueryLoad.GlobalAccountToys, stmt); - stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_BATTLE_PETS); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.SEL_BATTLE_PETS); stmt.AddValue(0, battlenetAccountId); stmt.AddValue(1, Global.WorldMgr.GetRealmId().Index); SetQuery(AccountInfoQueryLoad.BattlePets, stmt); - stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_BATTLE_PET_SLOTS); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.SEL_BATTLE_PET_SLOTS); stmt.AddValue(0, battlenetAccountId); SetQuery(AccountInfoQueryLoad.BattlePetSlot, stmt); - stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_ACCOUNT_HEIRLOOMS); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.SEL_ACCOUNT_HEIRLOOMS); stmt.AddValue(0, battlenetAccountId); SetQuery(AccountInfoQueryLoad.GlobalAccountHeirlooms, stmt); - stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_ACCOUNT_MOUNTS); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.SEL_ACCOUNT_MOUNTS); stmt.AddValue(0, battlenetAccountId); SetQuery(AccountInfoQueryLoad.Mounts, stmt); - stmt = DB.Login.GetPreparedStatement(LoginStatements.SelBnetCharacterCountsByAccountId); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.SelBnetCharacterCountsByAccountId); stmt.AddValue(0, accountId); SetQuery(AccountInfoQueryLoad.GlobalRealmCharacterCounts, stmt); - stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_BNET_ITEM_APPEARANCES); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.SEL_BNET_ITEM_APPEARANCES); stmt.AddValue(0, battlenetAccountId); SetQuery(AccountInfoQueryLoad.ItemAppearances, stmt); - stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_BNET_ITEM_FAVORITE_APPEARANCES); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.SEL_BNET_ITEM_FAVORITE_APPEARANCES); stmt.AddValue(0, battlenetAccountId); SetQuery(AccountInfoQueryLoad.ItemFavoriteAppearances, stmt); - stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_BNET_TRANSMOG_ILLUSIONS); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.SEL_BNET_TRANSMOG_ILLUSIONS); stmt.AddValue(0, battlenetAccountId); SetQuery(AccountInfoQueryLoad.TransmogIllusions, stmt); } diff --git a/Source/Game/Spells/SpellHistory.cs b/Source/Game/Spells/SpellHistory.cs index 466879123..4bb38e26c 100644 --- a/Source/Game/Spells/SpellHistory.cs +++ b/Source/Game/Spells/SpellHistory.cs @@ -75,11 +75,11 @@ namespace Game.Spells PreparedStatement stmt; if (typeof(T) == typeof(Pet)) { - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_PET_SPELL_COOLDOWNS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_PET_SPELL_COOLDOWNS); stmt.AddValue(0, _owner.GetCharmInfo().GetPetNumber()); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_PET_SPELL_CHARGES); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_PET_SPELL_CHARGES); stmt.AddValue(0, _owner.GetCharmInfo().GetPetNumber()); trans.Append(stmt); @@ -89,7 +89,7 @@ namespace Game.Spells if (!pair.Value.OnHold) { index = 0; - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_PET_SPELL_COOLDOWN); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_PET_SPELL_COOLDOWN); stmt.AddValue(index++, _owner.GetCharmInfo().GetPetNumber()); stmt.AddValue(index++, pair.Key); stmt.AddValue(index++, Time.DateTimeToUnixTime(pair.Value.CooldownEnd)); @@ -102,7 +102,7 @@ namespace Game.Spells foreach (var pair in _categoryCharges) { index = 0; - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_PET_SPELL_CHARGES); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_PET_SPELL_CHARGES); stmt.AddValue(index++, _owner.GetCharmInfo().GetPetNumber()); stmt.AddValue(index++, pair.Key); stmt.AddValue(index++, Time.DateTimeToUnixTime(pair.Value.RechargeStart)); @@ -112,11 +112,11 @@ namespace Game.Spells } else { - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_SPELL_COOLDOWNS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_SPELL_COOLDOWNS); stmt.AddValue(0, _owner.GetGUID().GetCounter()); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_SPELL_CHARGES); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_CHAR_SPELL_CHARGES); stmt.AddValue(0, _owner.GetGUID().GetCounter()); trans.Append(stmt); @@ -126,7 +126,7 @@ namespace Game.Spells if (!pair.Value.OnHold) { index = 0; - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_CHAR_SPELL_COOLDOWN); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_CHAR_SPELL_COOLDOWN); stmt.AddValue(index++, _owner.GetGUID().GetCounter()); stmt.AddValue(index++, pair.Key); stmt.AddValue(index++, pair.Value.ItemId); @@ -140,7 +140,7 @@ namespace Game.Spells foreach (var pair in _categoryCharges) { index = 0; - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_CHAR_SPELL_CHARGES); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_CHAR_SPELL_CHARGES); stmt.AddValue(index++, _owner.GetGUID().GetCounter()); stmt.AddValue(index++, pair.Key); stmt.AddValue(index++, Time.DateTimeToUnixTime(pair.Value.RechargeStart)); diff --git a/Source/Game/SupportSystem/SupportManager.cs b/Source/Game/SupportSystem/SupportManager.cs index 82001e282..a112b43aa 100644 --- a/Source/Game/SupportSystem/SupportManager.cs +++ b/Source/Game/SupportSystem/SupportManager.cs @@ -60,7 +60,7 @@ namespace Game.SupportSystem _lastBugId = 0; _openBugTicketCount = 0; - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_GM_BUGS); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_GM_BUGS); SQLResult result = DB.Characters.Query(stmt); if (result.IsEmpty()) { @@ -96,7 +96,7 @@ namespace Game.SupportSystem _lastComplaintId = 0; _openComplaintTicketCount = 0; - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_GM_COMPLAINTS); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_GM_COMPLAINTS); SQLResult result = DB.Characters.Query(stmt); if (result.IsEmpty()) { @@ -119,7 +119,7 @@ namespace Game.SupportSystem if (_lastComplaintId < id) _lastComplaintId = id; - chatLogStmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_GM_COMPLAINT_CHATLINES); + chatLogStmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_GM_COMPLAINT_CHATLINES); chatLogStmt.AddValue(0, id); chatLogResult = DB.Characters.Query(stmt); @@ -146,7 +146,7 @@ namespace Game.SupportSystem _lastSuggestionId = 0; _openSuggestionTicketCount = 0; - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_GM_SUGGESTIONS); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_GM_SUGGESTIONS); SQLResult result = DB.Characters.Query(stmt); if (result.IsEmpty()) { @@ -255,7 +255,7 @@ namespace Game.SupportSystem _lastBugId = 0; - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ALL_GM_BUGS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ALL_GM_BUGS); DB.Characters.Execute(stmt); break; case "ComplaintTicket": @@ -264,8 +264,8 @@ namespace Game.SupportSystem _lastComplaintId = 0; SQLTransaction trans = new(); - trans.Append(DB.Characters.GetPreparedStatement(CharStatements.DEL_ALL_GM_COMPLAINTS)); - trans.Append(DB.Characters.GetPreparedStatement(CharStatements.DEL_ALL_GM_COMPLAINT_CHATLOGS)); + trans.Append(CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ALL_GM_COMPLAINTS)); + trans.Append(CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ALL_GM_COMPLAINT_CHATLOGS)); DB.Characters.CommitTransaction(trans); break; case "SuggestionTicket": @@ -273,7 +273,7 @@ namespace Game.SupportSystem _lastSuggestionId = 0; - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ALL_GM_SUGGESTIONS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_ALL_GM_SUGGESTIONS); DB.Characters.Execute(stmt); break; } diff --git a/Source/Game/SupportSystem/SupportTickets.cs b/Source/Game/SupportSystem/SupportTickets.cs index e32c60668..bb63cff7c 100644 --- a/Source/Game/SupportSystem/SupportTickets.cs +++ b/Source/Game/SupportSystem/SupportTickets.cs @@ -144,7 +144,7 @@ namespace Game.SupportSystem public override void SaveToDB() { byte idx = 0; - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.REP_GM_BUG); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.REP_GM_BUG); stmt.AddValue(idx, _id); stmt.AddValue(++idx, _playerGuid.GetCounter()); stmt.AddValue(++idx, _note); @@ -163,7 +163,7 @@ namespace Game.SupportSystem public override void DeleteFromDB() { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_GM_BUG); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_GM_BUG); stmt.AddValue(0, _id); DB.Characters.Execute(stmt); } @@ -261,7 +261,7 @@ namespace Game.SupportSystem var trans = new SQLTransaction(); byte idx = 0; - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.REP_GM_COMPLAINT); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.REP_GM_COMPLAINT); stmt.AddValue(idx, _id); stmt.AddValue(++idx, _playerGuid.GetCounter()); stmt.AddValue(++idx, _note); @@ -288,7 +288,7 @@ namespace Game.SupportSystem foreach (var c in _chatLog.Lines) { idx = 0; - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_GM_COMPLAINT_CHATLINE); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_GM_COMPLAINT_CHATLINE); stmt.AddValue(idx, _id); stmt.AddValue(++idx, lineIndex); stmt.AddValue(++idx, c.Timestamp); @@ -303,11 +303,11 @@ namespace Game.SupportSystem public override void DeleteFromDB() { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_GM_COMPLAINT); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_GM_COMPLAINT); stmt.AddValue(0, _id); DB.Characters.Execute(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_GM_COMPLAINT_CHATLOG); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_GM_COMPLAINT_CHATLOG); stmt.AddValue(0, _id); DB.Characters.Execute(stmt); } @@ -398,7 +398,7 @@ namespace Game.SupportSystem public override void SaveToDB() { byte idx = 0; - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.REP_GM_SUGGESTION); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.REP_GM_SUGGESTION); stmt.AddValue(idx, _id); stmt.AddValue(++idx, _playerGuid.GetCounter()); stmt.AddValue(++idx, _note); @@ -417,7 +417,7 @@ namespace Game.SupportSystem public override void DeleteFromDB() { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_GM_SUGGESTION); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_GM_SUGGESTION); stmt.AddValue(0, _id); DB.Characters.Execute(stmt); } diff --git a/Source/Game/Text/CreatureTextManager.cs b/Source/Game/Text/CreatureTextManager.cs index 240ffbf2a..547dd250c 100644 --- a/Source/Game/Text/CreatureTextManager.cs +++ b/Source/Game/Text/CreatureTextManager.cs @@ -27,7 +27,7 @@ namespace Game mTextMap.Clear(); // for reload case //all currently used temp texts are NOT reset - PreparedStatement stmt = DB.World.GetPreparedStatement(WorldStatements.SEL_CREATURE_TEXT); + PreparedStatement stmt = WorldDatabase.GetPreparedStatement(WorldStatements.SEL_CREATURE_TEXT); SQLResult result = DB.World.Query(stmt); if (result.IsEmpty()) diff --git a/Source/Game/World/WorldManager.cs b/Source/Game/World/WorldManager.cs index f1e97985b..d34064045 100644 --- a/Source/Game/World/WorldManager.cs +++ b/Source/Game/World/WorldManager.cs @@ -78,7 +78,7 @@ namespace Game public void LoadDBAllowedSecurityLevel() { - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_REALMLIST_SECURITY_LEVEL); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.SEL_REALMLIST_SECURITY_LEVEL); stmt.AddValue(0, (int)_realm.Id.Index); SQLResult result = DB.Login.Query(stmt); @@ -1269,7 +1269,7 @@ namespace Game m_Autobroadcasts.Clear(); - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_AUTOBROADCAST); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.SEL_AUTOBROADCAST); stmt.AddValue(0, _realm.Id.Index); SQLResult result = DB.Login.Query(stmt); @@ -1398,7 +1398,7 @@ namespace Game m_timers[WorldTimers.UpTime].Reset(); - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.UPD_UPTIME_PLAYERS); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.UPD_UPTIME_PLAYERS); stmt.AddValue(0, tmpDiff); stmt.AddValue(1, maxOnlinePlayers); @@ -1415,7 +1415,7 @@ namespace Game { m_timers[WorldTimers.CleanDB].Reset(); - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.DEL_OLD_LOGS); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.DEL_OLD_LOGS); stmt.AddValue(0, WorldConfig.GetIntValue(WorldCfg.LogdbCleartime)); stmt.AddValue(1, 0); stmt.AddValue(2, GetRealm().Id.Index); @@ -1637,10 +1637,10 @@ namespace Game { case BanMode.IP: // No SQL injection with prepared statements - stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_ACCOUNT_BY_IP); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.SEL_ACCOUNT_BY_IP); stmt.AddValue(0, nameOrIP); resultAccounts = DB.Login.Query(stmt); - stmt = DB.Login.GetPreparedStatement(LoginStatements.INS_IP_BANNED); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.INS_IP_BANNED); stmt.AddValue(0, nameOrIP); stmt.AddValue(1, duration_secs); stmt.AddValue(2, author); @@ -1649,13 +1649,13 @@ namespace Game break; case BanMode.Account: // No SQL injection with prepared statements - stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_ACCOUNT_ID_BY_NAME); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.SEL_ACCOUNT_ID_BY_NAME); stmt.AddValue(0, nameOrIP); resultAccounts = DB.Login.Query(stmt); break; case BanMode.Character: // No SQL injection with prepared statements - stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_ACCOUNT_BY_NAME); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_ACCOUNT_BY_NAME); stmt.AddValue(0, nameOrIP); resultAccounts = DB.Characters.Query(stmt); break; @@ -1680,11 +1680,11 @@ namespace Game if (mode != BanMode.IP) { // make sure there is only one active ban - stmt = DB.Login.GetPreparedStatement(LoginStatements.UPD_ACCOUNT_NOT_BANNED); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.UPD_ACCOUNT_NOT_BANNED); stmt.AddValue(0, account); trans.Append(stmt); // No SQL injection with prepared statements - stmt = DB.Login.GetPreparedStatement(LoginStatements.INS_ACCOUNT_BANNED); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.INS_ACCOUNT_BANNED); stmt.AddValue(0, account); stmt.AddValue(1, duration_secs); stmt.AddValue(2, author); @@ -1711,7 +1711,7 @@ namespace Game PreparedStatement stmt; if (mode == BanMode.IP) { - stmt = DB.Login.GetPreparedStatement(LoginStatements.DEL_IP_NOT_BANNED); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.DEL_IP_NOT_BANNED); stmt.AddValue(0, nameOrIP); DB.Login.Execute(stmt); } @@ -1727,7 +1727,7 @@ namespace Game return false; //NO SQL injection as account is uint32 - stmt = DB.Login.GetPreparedStatement(LoginStatements.UPD_ACCOUNT_NOT_BANNED); + stmt = LoginDatabase.GetPreparedStatement(LoginStatements.UPD_ACCOUNT_NOT_BANNED); stmt.AddValue(0, account); DB.Login.Execute(stmt); } @@ -1760,11 +1760,11 @@ namespace Game SQLTransaction trans = new(); // make sure there is only one active ban - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_CHARACTER_BAN); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_CHARACTER_BAN); stmt.AddValue(0, guid.GetCounter()); trans.Append(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_CHARACTER_BAN); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.INS_CHARACTER_BAN); stmt.AddValue(0, guid.GetCounter()); stmt.AddValue(1, (long)durationSecs); stmt.AddValue(2, author); @@ -1794,7 +1794,7 @@ namespace Game else guid = pBanned.GetGUID(); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_CHARACTER_BAN); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_CHARACTER_BAN); stmt.AddValue(0, guid.GetCounter()); DB.Characters.Execute(stmt); return true; @@ -1962,7 +1962,7 @@ namespace Game public void UpdateRealmCharCount(uint accountId) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHARACTER_COUNT); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHARACTER_COUNT); stmt.AddValue(0, accountId); _queryProcessor.AddCallback(DB.Characters.AsyncQuery(stmt).WithCallback(UpdateRealmCharCount)); } @@ -1974,7 +1974,7 @@ namespace Game uint Id = result.Read(0); uint charCount = result.Read(1); - PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.REP_REALM_CHARACTERS); + PreparedStatement stmt = LoginDatabase.GetPreparedStatement(LoginStatements.REP_REALM_CHARACTERS); stmt.AddValue(0, charCount); stmt.AddValue(1, Id); stmt.AddValue(2, _realm.Id.Index); @@ -1997,10 +1997,10 @@ namespace Game public void DailyReset() { // reset all saved quest status - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_RESET_CHARACTER_QUESTSTATUS_DAILY); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_RESET_CHARACTER_QUESTSTATUS_DAILY); DB.Characters.Execute(stmt); - stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_CHARACTER_GARRISON_FOLLOWER_ACTIVATIONS); + stmt = CharacterDatabase.GetPreparedStatement(CharStatements.UPD_CHARACTER_GARRISON_FOLLOWER_ACTIVATIONS); stmt.AddValue(0, 1); DB.Characters.Execute(stmt); @@ -2044,7 +2044,7 @@ namespace Game public void ResetWeeklyQuests() { // reset all saved quest status - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_RESET_CHARACTER_QUESTSTATUS_WEEKLY); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_RESET_CHARACTER_QUESTSTATUS_WEEKLY); DB.Characters.Execute(stmt); // reset all quest status in memory foreach (var itr in m_sessions) @@ -2082,7 +2082,7 @@ namespace Game public void ResetMonthlyQuests() { // reset all saved quest status - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_RESET_CHARACTER_QUESTSTATUS_MONTHLY); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_RESET_CHARACTER_QUESTSTATUS_MONTHLY); DB.Characters.Execute(stmt); // reset all quest status in memory foreach (var itr in m_sessions) @@ -2212,7 +2212,7 @@ namespace Game public void ResetEventSeasonalQuests(ushort event_id, long eventStartTime) { - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_RESET_CHARACTER_QUESTSTATUS_SEASONAL_BY_EVENT); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_RESET_CHARACTER_QUESTSTATUS_SEASONAL_BY_EVENT); stmt.AddValue(0, event_id); stmt.AddValue(1, eventStartTime); DB.Characters.Execute(stmt); @@ -2225,7 +2225,7 @@ namespace Game { Log.outInfo(LogFilter.Server, "Random BG status reset for all characters."); - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_BATTLEGROUND_RANDOM_ALL); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.DEL_BATTLEGROUND_RANDOM_ALL); DB.Characters.Execute(stmt); foreach (var session in m_sessions.Values) @@ -2308,7 +2308,7 @@ namespace Game { m_worldVariables[var] = value; - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.REP_WORLD_VARIABLE); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.REP_WORLD_VARIABLE); stmt.AddValue(0, var); stmt.AddValue(1, value); DB.Characters.Execute(stmt); @@ -2446,7 +2446,7 @@ namespace Game long[] warModeEnabledFaction = new long[2]; // Search for characters that have war mode enabled and played during the last week - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_WAR_MODE_TUNING); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_WAR_MODE_TUNING); stmt.AddValue(0, (uint)PlayerFlags.WarModeDesired); stmt.AddValue(1, (uint)PlayerFlags.WarModeDesired); diff --git a/Source/Game/World/WorldStateManager.cs b/Source/Game/World/WorldStateManager.cs index 3eb3c831a..86fc08684 100644 --- a/Source/Game/World/WorldStateManager.cs +++ b/Source/Game/World/WorldStateManager.cs @@ -234,7 +234,7 @@ namespace Game if (GetWorldStateTemplate(worldStateId) == null) return; - PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.REP_WORLD_STATE); + PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.REP_WORLD_STATE); stmt.AddValue(0, worldStateId); stmt.AddValue(1, value); DB.Characters.Execute(stmt);