Make PreparedStatements static for each database.

This commit is contained in:
hondacrx
2023-02-04 20:55:14 -05:00
parent e0e20b6b1c
commit 149fadccab
90 changed files with 922 additions and 923 deletions
+2 -2
View File
@@ -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);
+2 -2
View File
@@ -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);
+1 -1
View File
@@ -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())
{
+14 -14
View File
@@ -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<string>(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);
@@ -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)
{
+10 -10
View File
@@ -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<ulong>(0));
SQLResult banResult = DB.Characters.Query(stmt2);
if (!banResult.IsEmpty())
@@ -339,7 +339,7 @@ namespace Game.Chat.Commands
string char_name = result.Read<string>(1);
PreparedStatement stmt2 = DB.Characters.GetPreparedStatement(CharStatements.SEL_BANINFO_LIST);
PreparedStatement stmt2 = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_BANINFO_LIST);
stmt2.AddValue(0, result.Read<ulong>(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);
}
+14 -14
View File
@@ -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);
+4 -4
View File
@@ -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);
+1 -1
View File
@@ -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);
@@ -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());
+1 -1
View File
@@ -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())
+1 -1
View File
@@ -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())
+11 -11
View File
@@ -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<uint>(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<uint>(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<uint>(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())
+4 -4
View File
@@ -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<uint>(0);
string accountName = result.Read<string>(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);
+2 -2
View File
@@ -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);
+15 -15
View File
@@ -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())
+8 -8
View File
@@ -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);
+1 -1
View File
@@ -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);
+3 -3
View File
@@ -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);
+1 -1
View File
@@ -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);
+35 -35
View File
@@ -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<uint>(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<uint>(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);