mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-17 10:55:43 +00:00
feat(Core/Database): port TrinityCore database API (#5611)
This commit is contained in:
@@ -254,7 +254,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_EXPANSION);
|
||||
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_EXPANSION);
|
||||
|
||||
stmt->setUInt8(0, uint8(expansion));
|
||||
stmt->setUInt32(1, accountId);
|
||||
@@ -375,7 +375,7 @@ public:
|
||||
static bool HandleAccountOnlineListCommand(ChatHandler* handler, char const* /*args*/)
|
||||
{
|
||||
///- Get the list of accounts ID logged to the realm
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_ONLINE);
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_ONLINE);
|
||||
|
||||
PreparedQueryResult result = CharacterDatabase.Query(stmt);
|
||||
|
||||
@@ -399,9 +399,9 @@ public:
|
||||
|
||||
///- Get the username, last IP and GM level of each account
|
||||
// No SQL injection. account is uint32.
|
||||
stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_INFO);
|
||||
stmt->setUInt32(0, account);
|
||||
PreparedQueryResult resultLogin = LoginDatabase.Query(stmt);
|
||||
LoginDatabasePreparedStatement* loginStmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_INFO);
|
||||
loginStmt->setUInt32(0, account);
|
||||
PreparedQueryResult resultLogin = LoginDatabase.Query(loginStmt);
|
||||
|
||||
if (resultLogin)
|
||||
{
|
||||
@@ -517,7 +517,7 @@ public:
|
||||
|
||||
if (!param.empty())
|
||||
{
|
||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_ACCOUNT_LOCK);
|
||||
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_ACCOUNT_LOCK);
|
||||
|
||||
if (param == "on")
|
||||
{
|
||||
@@ -743,7 +743,7 @@ public:
|
||||
if (expansion < 0 || uint8(expansion) > sWorld->getIntConfig(CONFIG_EXPANSION))
|
||||
return false;
|
||||
|
||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_EXPANSION);
|
||||
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_EXPANSION);
|
||||
|
||||
stmt->setUInt8(0, expansion);
|
||||
stmt->setUInt32(1, accountId);
|
||||
@@ -822,7 +822,7 @@ public:
|
||||
// Check and abort if the target gm has a higher rank on one of the realms and the new realm is -1
|
||||
if (gmRealmID == -1 && !AccountMgr::IsConsoleAccount(playerSecurity))
|
||||
{
|
||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_ACCESS_GMLEVEL_TEST);
|
||||
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_ACCESS_GMLEVEL_TEST);
|
||||
|
||||
stmt->setUInt32(0, targetAccountId);
|
||||
stmt->setUInt8(1, uint8(gm));
|
||||
@@ -846,18 +846,16 @@ public:
|
||||
}
|
||||
|
||||
// If gmRealmID is -1, delete all values for the account id, else, insert values for the specific realm.Id.Realm
|
||||
PreparedStatement* stmt;
|
||||
LoginDatabasePreparedStatement* stmt;
|
||||
|
||||
if (gmRealmID == -1)
|
||||
{
|
||||
stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_ACCOUNT_ACCESS);
|
||||
|
||||
stmt->setUInt32(0, targetAccountId);
|
||||
}
|
||||
else
|
||||
{
|
||||
stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_ACCOUNT_ACCESS_BY_REALM);
|
||||
|
||||
stmt->setUInt32(0, targetAccountId);
|
||||
stmt->setUInt32(1, realm.Id.Realm);
|
||||
}
|
||||
|
||||
@@ -319,8 +319,9 @@ public:
|
||||
else
|
||||
targetGuid = target->GetGUID();
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_BANINFO);
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_BANINFO);
|
||||
stmt->setUInt32(0, targetGuid.GetCounter());
|
||||
|
||||
PreparedQueryResult result = CharacterDatabase.Query(stmt);
|
||||
if (!result)
|
||||
{
|
||||
@@ -378,7 +379,7 @@ public:
|
||||
|
||||
static bool HandleBanListAccountCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_EXPIRED_IP_BANS);
|
||||
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_EXPIRED_IP_BANS);
|
||||
LoginDatabase.Execute(stmt);
|
||||
|
||||
char* filterStr = strtok((char*)args, " ");
|
||||
@@ -388,12 +389,12 @@ public:
|
||||
|
||||
if (filter.empty())
|
||||
{
|
||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_BANNED_ALL);
|
||||
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_BANNED_ALL);
|
||||
result = LoginDatabase.Query(stmt);
|
||||
}
|
||||
else
|
||||
{
|
||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_BANNED_BY_USERNAME);
|
||||
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_BANNED_BY_USERNAME);
|
||||
stmt->setString(0, filter);
|
||||
result = LoginDatabase.Query(stmt);
|
||||
}
|
||||
@@ -495,7 +496,7 @@ public:
|
||||
return false;
|
||||
|
||||
std::string filter(filterStr);
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUID_BY_NAME_FILTER);
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUID_BY_NAME_FILTER);
|
||||
stmt->setString(0, filter);
|
||||
PreparedQueryResult result = CharacterDatabase.Query(stmt);
|
||||
if (!result)
|
||||
@@ -512,8 +513,9 @@ public:
|
||||
do
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
PreparedStatement* stmt2 = CharacterDatabase.GetPreparedStatement(CHAR_SEL_BANNED_NAME);
|
||||
CharacterDatabasePreparedStatement* stmt2 = CharacterDatabase.GetPreparedStatement(CHAR_SEL_BANNED_NAME);
|
||||
stmt2->setUInt32(0, fields[0].GetUInt32());
|
||||
|
||||
PreparedQueryResult banResult = CharacterDatabase.Query(stmt2);
|
||||
if (banResult)
|
||||
handler->PSendSysMessage("%s", (*banResult)[0].GetCString());
|
||||
@@ -533,8 +535,9 @@ public:
|
||||
|
||||
std::string char_name = fields[1].GetString();
|
||||
|
||||
PreparedStatement* stmt2 = CharacterDatabase.GetPreparedStatement(CHAR_SEL_BANINFO_LIST);
|
||||
CharacterDatabasePreparedStatement* stmt2 = CharacterDatabase.GetPreparedStatement(CHAR_SEL_BANINFO_LIST);
|
||||
stmt2->setUInt32(0, fields[0].GetUInt32());
|
||||
|
||||
PreparedQueryResult banInfo = CharacterDatabase.Query(stmt2);
|
||||
if (banInfo)
|
||||
{
|
||||
@@ -572,7 +575,7 @@ public:
|
||||
|
||||
static bool HandleBanListIPCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_EXPIRED_IP_BANS);
|
||||
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_EXPIRED_IP_BANS);
|
||||
LoginDatabase.Execute(stmt);
|
||||
|
||||
char* filterStr = strtok((char*)args, " ");
|
||||
@@ -583,12 +586,12 @@ public:
|
||||
|
||||
if (filter.empty())
|
||||
{
|
||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_IP_BANNED_ALL);
|
||||
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_IP_BANNED_ALL);
|
||||
result = LoginDatabase.Query(stmt);
|
||||
}
|
||||
else
|
||||
{
|
||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_IP_BANNED_BY_IP);
|
||||
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_IP_BANNED_BY_IP);
|
||||
stmt->setString(0, filter);
|
||||
result = LoginDatabase.Query(stmt);
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ public:
|
||||
static bool GetDeletedCharacterInfoList(DeletedInfoList& foundList, std::string searchString)
|
||||
{
|
||||
PreparedQueryResult result;
|
||||
PreparedStatement* stmt;
|
||||
CharacterDatabasePreparedStatement* stmt = nullptr;
|
||||
if (!searchString.empty())
|
||||
{
|
||||
// search by GUID
|
||||
@@ -211,7 +211,7 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UDP_RESTORE_DELETE_INFO);
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UDP_RESTORE_DELETE_INFO);
|
||||
stmt->setString(0, delInfo.name);
|
||||
stmt->setUInt32(1, delInfo.accountId);
|
||||
stmt->setUInt32(2, delInfo.lowGuid);
|
||||
@@ -244,7 +244,7 @@ public:
|
||||
else
|
||||
{
|
||||
// Update level and reset XP, everything else will be updated at login
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_LEVEL);
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_LEVEL);
|
||||
stmt->setUInt8(0, uint8(newLevel));
|
||||
stmt->setUInt32(1, playerGuid.GetCounter());
|
||||
CharacterDatabase.Execute(stmt);
|
||||
@@ -336,7 +336,7 @@ public:
|
||||
std::string oldNameLink = handler->playerLink(targetName);
|
||||
handler->PSendSysMessage(LANG_RENAME_PLAYER_GUID, oldNameLink.c_str(), targetGuid.GetCounter());
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG);
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG);
|
||||
stmt->setUInt16(0, uint16(AT_LOGIN_RENAME));
|
||||
stmt->setUInt32(1, targetGuid.GetCounter());
|
||||
CharacterDatabase.Execute(stmt);
|
||||
@@ -399,7 +399,7 @@ public:
|
||||
if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
|
||||
return false;
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG);
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG);
|
||||
stmt->setUInt16(0, uint16(AT_LOGIN_CUSTOMIZE));
|
||||
if (target)
|
||||
{
|
||||
@@ -427,7 +427,7 @@ public:
|
||||
if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
|
||||
return false;
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG);
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG);
|
||||
stmt->setUInt16(0, uint16(AT_LOGIN_CHANGE_FACTION));
|
||||
if (target)
|
||||
{
|
||||
@@ -454,7 +454,7 @@ public:
|
||||
if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
|
||||
return false;
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG);
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG);
|
||||
stmt->setUInt16(0, uint16(AT_LOGIN_CHANGE_RACE));
|
||||
if (target)
|
||||
{
|
||||
|
||||
@@ -148,7 +148,7 @@ public:
|
||||
break;
|
||||
}
|
||||
|
||||
PreparedStatement* stmt = nullptr;
|
||||
WorldDatabasePreparedStatement* stmt = nullptr;
|
||||
stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_DISABLES);
|
||||
stmt->setUInt32(0, entry);
|
||||
stmt->setUInt8(1, disableType);
|
||||
@@ -263,7 +263,7 @@ public:
|
||||
break;
|
||||
}
|
||||
|
||||
PreparedStatement* stmt = nullptr;
|
||||
WorldDatabasePreparedStatement* stmt = nullptr;
|
||||
stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_DISABLES);
|
||||
stmt->setUInt32(0, entry);
|
||||
stmt->setUInt8(1, disableType);
|
||||
|
||||
@@ -155,7 +155,7 @@ public:
|
||||
static bool HandleGMListFullCommand(ChatHandler* handler, char const* /*args*/)
|
||||
{
|
||||
///- Get the accounts with GM Level >0
|
||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_GM_ACCOUNTS);
|
||||
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_GM_ACCOUNTS);
|
||||
stmt->setUInt8(0, uint8(SEC_MODERATOR));
|
||||
stmt->setInt32(1, int32(realm.Id.Realm));
|
||||
PreparedQueryResult result = LoginDatabase.Query(stmt);
|
||||
|
||||
@@ -101,7 +101,7 @@ public:
|
||||
{
|
||||
std::string name = param1;
|
||||
WorldDatabase.EscapeString(name);
|
||||
whereClause << ", creature_template WHERE creature.id = creature_template.entry AND creature_template.name " _LIKE_ " '" << name << '\'';
|
||||
whereClause << ", creature_template WHERE creature.id = creature_template.entry AND creature_template.name LIKE '" << name << '\'';
|
||||
}
|
||||
else
|
||||
whereClause << "WHERE guid = '" << guid << '\'';
|
||||
|
||||
@@ -224,9 +224,9 @@ public:
|
||||
std::string name = id;
|
||||
WorldDatabase.EscapeString(name);
|
||||
result = WorldDatabase.PQuery(
|
||||
"SELECT guid, id, position_x, position_y, position_z, orientation, map, phaseMask, (POW(position_x - %f, 2) + POW(position_y - %f, 2) + POW(position_z - %f, 2)) AS order_ "
|
||||
"FROM gameobject, gameobject_template WHERE gameobject_template.entry = gameobject.id AND map = %i AND name " _LIKE_ " " _CONCAT3_("'%%'", "'%s'", "'%%'") " ORDER BY order_ ASC LIMIT 1",
|
||||
player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(), name.c_str());
|
||||
"SELECT guid, id, position_x, position_y, position_z, orientation, map, phaseMask, (POW(position_x - %f, 2) + POW(position_y - %f, 2) + POW(position_z - %f, 2)) AS order_ "
|
||||
"FROM gameobject, gameobject_template WHERE gameobject_template.entry = gameobject.id AND map = %i AND name LIKE '%%%s%%' ORDER BY order_ ASC LIMIT 1",
|
||||
player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(), name.c_str());
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -545,7 +545,7 @@ public:
|
||||
|
||||
Player* player = handler->GetSession()->GetPlayer();
|
||||
|
||||
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_GAMEOBJECT_NEAREST);
|
||||
WorldDatabasePreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_GAMEOBJECT_NEAREST);
|
||||
stmt->setFloat(0, player->GetPositionX());
|
||||
stmt->setFloat(1, player->GetPositionY());
|
||||
stmt->setFloat(2, player->GetPositionZ());
|
||||
@@ -555,8 +555,8 @@ public:
|
||||
stmt->setFloat(6, player->GetPositionZ());
|
||||
stmt->setFloat(7, distance * distance);
|
||||
stmt->setUInt32(8, player->GetPhaseMask());
|
||||
PreparedQueryResult result = WorldDatabase.Query(stmt);
|
||||
|
||||
PreparedQueryResult result = WorldDatabase.Query(stmt);
|
||||
if (result)
|
||||
{
|
||||
do
|
||||
|
||||
@@ -149,7 +149,7 @@ public:
|
||||
// inventory case
|
||||
uint32 inventoryCount = 0;
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_INVENTORY_COUNT_ITEM);
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_INVENTORY_COUNT_ITEM);
|
||||
stmt->setUInt32(0, itemId);
|
||||
result = CharacterDatabase.Query(stmt);
|
||||
|
||||
|
||||
@@ -1333,7 +1333,7 @@ public:
|
||||
limit = limitStr ? atoi(limitStr) : -1;
|
||||
}
|
||||
|
||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_BY_IP);
|
||||
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_BY_IP);
|
||||
stmt->setString(0, ip);
|
||||
PreparedQueryResult result = LoginDatabase.Query(stmt);
|
||||
|
||||
@@ -1353,7 +1353,7 @@ public:
|
||||
(account))
|
||||
return false;
|
||||
|
||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_LIST_BY_NAME);
|
||||
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_LIST_BY_NAME);
|
||||
stmt->setString(0, account);
|
||||
PreparedQueryResult result = LoginDatabase.Query(stmt);
|
||||
|
||||
@@ -1369,7 +1369,7 @@ public:
|
||||
char* limitStr = strtok(nullptr, " ");
|
||||
int32 limit = limitStr ? atoi(limitStr) : -1;
|
||||
|
||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_LIST_BY_EMAIL);
|
||||
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_LIST_BY_EMAIL);
|
||||
stmt->setString(0, email);
|
||||
PreparedQueryResult result = LoginDatabase.Query(stmt);
|
||||
|
||||
@@ -1404,7 +1404,7 @@ public:
|
||||
uint32 accountId = fields[0].GetUInt32();
|
||||
std::string accountName = fields[1].GetString();
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_GUID_NAME_BY_ACC);
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_GUID_NAME_BY_ACC);
|
||||
stmt->setUInt32(0, accountId);
|
||||
PreparedQueryResult result2 = CharacterDatabase.Query(stmt);
|
||||
|
||||
|
||||
@@ -927,7 +927,7 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
SQLTransaction trans(nullptr);
|
||||
CharacterDatabaseTransaction trans(nullptr);
|
||||
Player::OfflineResurrect(targetGuid, trans);
|
||||
}
|
||||
|
||||
@@ -1491,7 +1491,7 @@ public:
|
||||
{
|
||||
std::string itemName = itemNameStr + 1;
|
||||
|
||||
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_ITEM_TEMPLATE_BY_NAME);
|
||||
WorldDatabasePreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_ITEM_TEMPLATE_BY_NAME);
|
||||
stmt->setString(0, itemName);
|
||||
PreparedQueryResult result = WorldDatabase.Query(stmt);
|
||||
|
||||
@@ -1787,7 +1787,8 @@ public:
|
||||
Player* target;
|
||||
ObjectGuid targetGuid;
|
||||
std::string targetName;
|
||||
PreparedStatement* stmt = nullptr;
|
||||
CharacterDatabasePreparedStatement* stmt = nullptr;
|
||||
LoginDatabasePreparedStatement* loginStmt = nullptr;
|
||||
|
||||
ObjectGuid parseGUID = ObjectGuid::Create<HighGuid::Player>(atol((char*)args));
|
||||
|
||||
@@ -1907,11 +1908,11 @@ public:
|
||||
}
|
||||
|
||||
// Query the prepared statement for login data
|
||||
stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_PINFO);
|
||||
stmt->setInt32(0, int32(realm.Id.Realm));
|
||||
stmt->setUInt32(1, accId);
|
||||
PreparedQueryResult accInfoResult = LoginDatabase.Query(stmt);
|
||||
loginStmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_PINFO);
|
||||
loginStmt->setInt32(0, int32(realm.Id.Realm));
|
||||
loginStmt->setUInt32(1, accId);
|
||||
|
||||
PreparedQueryResult accInfoResult = LoginDatabase.Query(loginStmt);
|
||||
if (accInfoResult)
|
||||
{
|
||||
Field* fields = accInfoResult->Fetch();
|
||||
@@ -1952,8 +1953,9 @@ public:
|
||||
std::string nameLink = handler->playerLink(targetName);
|
||||
|
||||
// Returns banType, banTime, bannedBy, banreason
|
||||
PreparedStatement* banQuery = LoginDatabase.GetPreparedStatement(LOGIN_SEL_PINFO_BANS);
|
||||
LoginDatabasePreparedStatement* banQuery = LoginDatabase.GetPreparedStatement(LOGIN_SEL_PINFO_BANS);
|
||||
banQuery->setUInt32(0, accId);
|
||||
|
||||
PreparedQueryResult accBannedResult = LoginDatabase.Query(banQuery);
|
||||
if (!accBannedResult)
|
||||
{
|
||||
@@ -1972,10 +1974,10 @@ public:
|
||||
}
|
||||
|
||||
// Can be used to query data from World database
|
||||
PreparedStatement* xpQuery = WorldDatabase.GetPreparedStatement(WORLD_SEL_REQ_XP);
|
||||
WorldDatabasePreparedStatement* xpQuery = WorldDatabase.GetPreparedStatement(WORLD_SEL_REQ_XP);
|
||||
xpQuery->setUInt8(0, level);
|
||||
PreparedQueryResult xpResult = WorldDatabase.Query(xpQuery);
|
||||
|
||||
PreparedQueryResult xpResult = WorldDatabase.Query(xpQuery);
|
||||
if (xpResult)
|
||||
{
|
||||
Field* fields = xpResult->Fetch();
|
||||
@@ -1983,10 +1985,10 @@ public:
|
||||
}
|
||||
|
||||
// Can be used to query data from Characters database
|
||||
PreparedStatement* charXpQuery = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PINFO_XP);
|
||||
CharacterDatabasePreparedStatement* charXpQuery = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PINFO_XP);
|
||||
charXpQuery->setUInt32(0, lowguid);
|
||||
PreparedQueryResult charXpResult = CharacterDatabase.Query(charXpQuery);
|
||||
|
||||
PreparedQueryResult charXpResult = CharacterDatabase.Query(charXpQuery);
|
||||
if (charXpResult)
|
||||
{
|
||||
Field* fields = charXpResult->Fetch();
|
||||
@@ -1995,8 +1997,9 @@ public:
|
||||
|
||||
if (gguid != 0)
|
||||
{
|
||||
PreparedStatement* guildQuery = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUILD_MEMBER_EXTENDED);
|
||||
CharacterDatabasePreparedStatement* guildQuery = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUILD_MEMBER_EXTENDED);
|
||||
guildQuery->setUInt32(0, lowguid);
|
||||
|
||||
PreparedQueryResult guildInfoResult = CharacterDatabase.Query(guildQuery);
|
||||
if (guildInfoResult)
|
||||
{
|
||||
@@ -2170,8 +2173,9 @@ public:
|
||||
|
||||
// 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* mailQuery = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PINFO_MAILS);
|
||||
CharacterDatabasePreparedStatement* mailQuery = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PINFO_MAILS);
|
||||
mailQuery->setUInt32(0, lowguid);
|
||||
|
||||
PreparedQueryResult mailInfoResult = CharacterDatabase.Query(mailQuery);
|
||||
if (mailInfoResult)
|
||||
{
|
||||
@@ -2250,7 +2254,7 @@ public:
|
||||
if (handler->HasLowerSecurity (target, targetGuid, true))
|
||||
return false;
|
||||
|
||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_MUTE_TIME);
|
||||
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_MUTE_TIME);
|
||||
std::string muteBy = "";
|
||||
if (handler->GetSession())
|
||||
muteBy = handler->GetSession()->GetPlayerName();
|
||||
@@ -2336,7 +2340,7 @@ public:
|
||||
target->GetSession()->m_muteTime = 0;
|
||||
}
|
||||
|
||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_MUTE_TIME);
|
||||
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_MUTE_TIME);
|
||||
stmt->setInt64(0, 0);
|
||||
stmt->setString(1, "");
|
||||
stmt->setString(2, "");
|
||||
@@ -2384,7 +2388,7 @@ public:
|
||||
// helper for mutehistory
|
||||
static bool HandleMuteInfoHelper(uint32 accountId, char const* accountName, ChatHandler* handler)
|
||||
{
|
||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_MUTE_INFO);
|
||||
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_MUTE_INFO);
|
||||
stmt->setUInt16(0, accountId);
|
||||
PreparedQueryResult result = LoginDatabase.Query(stmt);
|
||||
|
||||
@@ -2671,7 +2675,7 @@ public:
|
||||
MailSender sender(MAIL_NORMAL, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetGUID().GetCounter() : 0, MAIL_STATIONERY_GM);
|
||||
|
||||
//- TODO: Fix poor design
|
||||
SQLTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
MailDraft(subject, text)
|
||||
.SendMailTo(trans, MailReceiver(target, targetGuid.GetCounter()), sender);
|
||||
|
||||
@@ -2771,7 +2775,7 @@ public:
|
||||
// fill mail
|
||||
MailDraft draft(subject, text);
|
||||
|
||||
SQLTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
|
||||
for (ItemPairs::const_iterator itr = items.begin(); itr != items.end(); ++itr)
|
||||
{
|
||||
@@ -2828,7 +2832,7 @@ public:
|
||||
// from console show not existed sender
|
||||
MailSender sender(MAIL_NORMAL, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetGUID().GetCounter() : 0, MAIL_STATIONERY_GM);
|
||||
|
||||
SQLTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
|
||||
MailDraft(subject, text)
|
||||
.AddMoney(money)
|
||||
@@ -3092,7 +3096,7 @@ public:
|
||||
{
|
||||
if (ObjectGuid playerGUID = sWorld->GetGlobalPlayerGUID(name))
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_AURA_FROZEN);
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_AURA_FROZEN);
|
||||
stmt->setUInt32(0, playerGUID.GetCounter());
|
||||
CharacterDatabase.Execute(stmt);
|
||||
handler->PSendSysMessage(LANG_COMMAND_UNFREEZE, name.c_str());
|
||||
|
||||
@@ -354,8 +354,7 @@ public:
|
||||
wait = 0;
|
||||
|
||||
// Update movement type
|
||||
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_CREATURE_MOVEMENT_TYPE);
|
||||
|
||||
WorldDatabasePreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_CREATURE_MOVEMENT_TYPE);
|
||||
stmt->setUInt8(0, uint8(WAYPOINT_MOTION_TYPE));
|
||||
stmt->setUInt32(1, spawnId);
|
||||
|
||||
@@ -569,8 +568,7 @@ public:
|
||||
}
|
||||
|
||||
// ..and DB
|
||||
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_CREATURE_FACTION);
|
||||
|
||||
WorldDatabasePreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_CREATURE_FACTION);
|
||||
stmt->setUInt16(0, uint16(factionId));
|
||||
stmt->setUInt32(1, creature->GetEntry());
|
||||
|
||||
@@ -639,8 +637,7 @@ public:
|
||||
|
||||
creature->SetUInt32Value(UNIT_NPC_FLAGS, npcFlags);
|
||||
|
||||
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_CREATURE_NPCFLAG);
|
||||
|
||||
WorldDatabasePreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_CREATURE_NPCFLAG);
|
||||
stmt->setUInt32(0, npcFlags);
|
||||
stmt->setUInt32(1, creature->GetEntry());
|
||||
|
||||
@@ -761,7 +758,7 @@ public:
|
||||
|
||||
Player* player = handler->GetSession()->GetPlayer();
|
||||
|
||||
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_CREATURE_NEAREST);
|
||||
WorldDatabasePreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_CREATURE_NEAREST);
|
||||
stmt->setFloat(0, player->GetPositionX());
|
||||
stmt->setFloat(1, player->GetPositionY());
|
||||
stmt->setFloat(2, player->GetPositionZ());
|
||||
@@ -771,8 +768,8 @@ public:
|
||||
stmt->setFloat(6, player->GetPositionZ());
|
||||
stmt->setFloat(7, distance * distance);
|
||||
stmt->setUInt32(8, player->GetPhaseMask());
|
||||
PreparedQueryResult result = WorldDatabase.Query(stmt);
|
||||
|
||||
PreparedQueryResult result = WorldDatabase.Query(stmt);
|
||||
if (result)
|
||||
{
|
||||
do
|
||||
@@ -874,8 +871,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_CREATURE_POSITION);
|
||||
|
||||
WorldDatabasePreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_CREATURE_POSITION);
|
||||
stmt->setFloat(0, x);
|
||||
stmt->setFloat(1, y);
|
||||
stmt->setFloat(2, z);
|
||||
@@ -1143,8 +1139,7 @@ public:
|
||||
creature->Respawn();
|
||||
}
|
||||
|
||||
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_CREATURE_WANDER_DISTANCE);
|
||||
|
||||
WorldDatabasePreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_CREATURE_WANDER_DISTANCE);
|
||||
stmt->setFloat(0, option);
|
||||
stmt->setUInt8(1, uint8(mtype));
|
||||
stmt->setUInt32(2, guidLow);
|
||||
@@ -1183,8 +1178,7 @@ public:
|
||||
else
|
||||
return false;
|
||||
|
||||
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_CREATURE_SPAWN_TIME_SECS);
|
||||
|
||||
WorldDatabasePreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_CREATURE_SPAWN_TIME_SECS);
|
||||
stmt->setUInt32(0, uint32(spawnTime));
|
||||
stmt->setUInt32(1, guidLow);
|
||||
|
||||
@@ -1456,8 +1450,7 @@ public:
|
||||
sFormationMgr->CreatureGroupMap[lowguid] = group_member;
|
||||
creature->SearchFormation();
|
||||
|
||||
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_INS_CREATURE_FORMATION);
|
||||
|
||||
WorldDatabasePreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_INS_CREATURE_FORMATION);
|
||||
stmt->setUInt32(0, leaderGUID);
|
||||
stmt->setUInt32(1, lowguid);
|
||||
stmt->setFloat(2, group_member->follow_dist);
|
||||
|
||||
@@ -30,6 +30,8 @@ EndScriptData */
|
||||
#include "TicketMgr.h"
|
||||
#include "WardenCheckMgr.h"
|
||||
#include "WaypointManager.h"
|
||||
#include "StringConvert.h"
|
||||
#include "Tokenize.h"
|
||||
|
||||
class reload_commandscript : public CommandScript
|
||||
{
|
||||
@@ -410,13 +412,11 @@ public:
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
Tokenizer entries(std::string(args), ' ');
|
||||
|
||||
for (Tokenizer::const_iterator itr = entries.begin(); itr != entries.end(); ++itr)
|
||||
for (std::string_view entryStr : Acore::Tokenize(args, ' ', false))
|
||||
{
|
||||
uint32 entry = uint32(atoi(*itr));
|
||||
uint32 entry = Acore::StringTo<uint32>(entryStr).value_or(0);
|
||||
|
||||
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_CREATURE_TEMPLATE);
|
||||
WorldDatabasePreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_CREATURE_TEMPLATE);
|
||||
stmt->setUInt32(0, entry);
|
||||
PreparedQueryResult result = WorldDatabase.Query(stmt);
|
||||
|
||||
|
||||
@@ -160,7 +160,7 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG);
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG);
|
||||
stmt->setUInt16(0, uint16(AT_LOGIN_RESET_SPELLS));
|
||||
stmt->setUInt32(1, targetGuid.GetCounter());
|
||||
CharacterDatabase.Execute(stmt);
|
||||
@@ -234,7 +234,7 @@ public:
|
||||
}
|
||||
else if (targetGuid)
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG);
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG);
|
||||
stmt->setUInt16(0, uint16(AT_LOGIN_NONE | AT_LOGIN_RESET_PET_TALENTS));
|
||||
stmt->setUInt32(1, targetGuid.GetCounter());
|
||||
CharacterDatabase.Execute(stmt);
|
||||
@@ -280,7 +280,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ALL_AT_LOGIN_FLAGS);
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ALL_AT_LOGIN_FLAGS);
|
||||
stmt->setUInt16(0, uint16(atLogin));
|
||||
CharacterDatabase.Execute(stmt);
|
||||
|
||||
|
||||
@@ -121,7 +121,7 @@ public:
|
||||
target->TeleportTo(target->m_homebindMapId, target->m_homebindX, target->m_homebindY, target->m_homebindZ, target->GetOrientation());
|
||||
else
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_HOMEBIND);
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_HOMEBIND);
|
||||
stmt->setUInt32(0, target_guid.GetCounter());
|
||||
PreparedQueryResult resultDB = CharacterDatabase.Query(stmt);
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ public:
|
||||
}
|
||||
|
||||
// Assign ticket
|
||||
SQLTransaction trans = SQLTransaction(nullptr);
|
||||
CharacterDatabaseTransaction trans = CharacterDatabaseTransaction(nullptr);
|
||||
ticket->SetAssignedTo(targetGuid, AccountMgr::IsAdminAccount(targetGmLevel));
|
||||
ticket->SaveToDB(trans);
|
||||
sTicketMgr->UpdateLastChange();
|
||||
@@ -187,7 +187,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
SQLTransaction trans = SQLTransaction(nullptr);
|
||||
CharacterDatabaseTransaction trans = CharacterDatabaseTransaction(nullptr);
|
||||
ticket->SetComment(comment);
|
||||
ticket->SaveToDB(trans);
|
||||
sTicketMgr->UpdateLastChange();
|
||||
@@ -243,7 +243,7 @@ public:
|
||||
|
||||
Player* gm = handler->GetSession() ? handler->GetSession()->GetPlayer() : nullptr;
|
||||
|
||||
SQLTransaction trans = SQLTransaction(nullptr);
|
||||
CharacterDatabaseTransaction trans = CharacterDatabaseTransaction(nullptr);
|
||||
ticket->SetCompleted();
|
||||
ticket->SetResolvedBy(gm ? gm->GetGUID() : ObjectGuid::Empty);
|
||||
ticket->SaveToDB(trans);
|
||||
@@ -396,7 +396,7 @@ public:
|
||||
}
|
||||
|
||||
std::string assignedTo = ticket->GetAssignedToName(); // copy assignedto name because we need it after the ticket has been unnassigned
|
||||
SQLTransaction trans = SQLTransaction(nullptr);
|
||||
CharacterDatabaseTransaction trans = CharacterDatabaseTransaction(nullptr);
|
||||
ticket->SetUnassigned();
|
||||
ticket->SaveToDB(trans);
|
||||
sTicketMgr->UpdateLastChange();
|
||||
@@ -421,7 +421,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
SQLTransaction trans = SQLTransaction(nullptr);
|
||||
CharacterDatabaseTransaction trans = CharacterDatabaseTransaction(nullptr);
|
||||
ticket->SetViewed();
|
||||
ticket->SaveToDB(trans);
|
||||
|
||||
@@ -460,7 +460,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
SQLTransaction trans = SQLTransaction(nullptr);
|
||||
CharacterDatabaseTransaction trans = CharacterDatabaseTransaction(nullptr);
|
||||
ticket->SetViewed();
|
||||
ticket->SaveToDB(trans);
|
||||
|
||||
@@ -496,7 +496,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
SQLTransaction trans = SQLTransaction(nullptr);
|
||||
CharacterDatabaseTransaction trans = CharacterDatabaseTransaction(nullptr);
|
||||
ticket->AppendResponse(response);
|
||||
if (newLine)
|
||||
ticket->AppendResponse("\n");
|
||||
|
||||
@@ -80,7 +80,7 @@ public:
|
||||
pathid = target->GetWaypointPath();
|
||||
else
|
||||
{
|
||||
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_DATA_MAX_ID);
|
||||
WorldDatabasePreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_DATA_MAX_ID);
|
||||
|
||||
PreparedQueryResult result = WorldDatabase.Query(stmt);
|
||||
|
||||
@@ -101,7 +101,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_DATA_MAX_POINT);
|
||||
WorldDatabasePreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_DATA_MAX_POINT);
|
||||
stmt->setUInt32(0, pathid);
|
||||
PreparedQueryResult result = WorldDatabase.Query(stmt);
|
||||
|
||||
@@ -168,7 +168,7 @@ public:
|
||||
|
||||
guidLow = target->GetSpawnId();
|
||||
|
||||
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_CREATURE_ADDON_BY_GUID);
|
||||
WorldDatabasePreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_CREATURE_ADDON_BY_GUID);
|
||||
|
||||
stmt->setUInt32(0, guidLow);
|
||||
|
||||
@@ -237,8 +237,7 @@ public:
|
||||
{
|
||||
if (target->GetCreatureAddon()->path_id != 0)
|
||||
{
|
||||
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_CREATURE_ADDON);
|
||||
|
||||
WorldDatabasePreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_CREATURE_ADDON);
|
||||
stmt->setUInt32(0, guildLow);
|
||||
|
||||
WorldDatabase.Execute(stmt);
|
||||
@@ -246,7 +245,6 @@ public:
|
||||
target->UpdateWaypointID(0);
|
||||
|
||||
stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_CREATURE_MOVEMENT_TYPE);
|
||||
|
||||
stmt->setUInt8(0, uint8(IDLE_MOTION_TYPE));
|
||||
stmt->setUInt32(1, guildLow);
|
||||
|
||||
@@ -286,13 +284,13 @@ public:
|
||||
|
||||
if (id)
|
||||
{
|
||||
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_SCRIPT_ID_BY_GUID);
|
||||
WorldDatabasePreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_SCRIPT_ID_BY_GUID);
|
||||
stmt->setUInt32(0, id);
|
||||
PreparedQueryResult result = WorldDatabase.Query(stmt);
|
||||
|
||||
if (!result)
|
||||
{
|
||||
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_INS_WAYPOINT_SCRIPT);
|
||||
WorldDatabasePreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_INS_WAYPOINT_SCRIPT);
|
||||
|
||||
stmt->setUInt32(0, id);
|
||||
|
||||
@@ -305,7 +303,7 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_SCRIPTS_MAX_ID);
|
||||
WorldDatabasePreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_SCRIPTS_MAX_ID);
|
||||
|
||||
PreparedQueryResult result = WorldDatabase.Query(stmt);
|
||||
|
||||
@@ -337,7 +335,7 @@ public:
|
||||
float a8, a9, a10, a11;
|
||||
char const* a7;
|
||||
|
||||
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_SCRIPT_BY_ID);
|
||||
WorldDatabasePreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_SCRIPT_BY_ID);
|
||||
stmt->setUInt32(0, id);
|
||||
PreparedQueryResult result = WorldDatabase.Query(stmt);
|
||||
|
||||
@@ -377,7 +375,7 @@ public:
|
||||
|
||||
id = atoi(arg_id);
|
||||
|
||||
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_SCRIPT_ID_BY_GUID);
|
||||
WorldDatabasePreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_SCRIPT_ID_BY_GUID);
|
||||
|
||||
stmt->setUInt32(0, id);
|
||||
|
||||
@@ -385,7 +383,7 @@ public:
|
||||
|
||||
if (result)
|
||||
{
|
||||
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_WAYPOINT_SCRIPT);
|
||||
WorldDatabasePreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_WAYPOINT_SCRIPT);
|
||||
|
||||
stmt->setUInt32(0, id);
|
||||
|
||||
@@ -448,7 +446,7 @@ public:
|
||||
uint32 newid = atoi(arg_3);
|
||||
handler->PSendSysMessage("%s%s|r|cff00ffff%u|r|cff00ff00%s|r|cff00ffff%u|r", "|cff00ff00", "Wp Event: Wypoint scipt guid: ", newid, " id changed: ", id);
|
||||
|
||||
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_WAYPOINT_SCRIPT_ID);
|
||||
WorldDatabasePreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_WAYPOINT_SCRIPT_ID);
|
||||
|
||||
stmt->setUInt32(0, newid);
|
||||
stmt->setUInt32(1, id);
|
||||
@@ -459,7 +457,7 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_SCRIPT_ID_BY_GUID);
|
||||
WorldDatabasePreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_SCRIPT_ID_BY_GUID);
|
||||
stmt->setUInt32(0, id);
|
||||
PreparedQueryResult result = WorldDatabase.Query(stmt);
|
||||
|
||||
@@ -471,7 +469,7 @@ public:
|
||||
|
||||
if (arg_str_2 == "posx")
|
||||
{
|
||||
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_WAYPOINT_SCRIPT_X);
|
||||
WorldDatabasePreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_WAYPOINT_SCRIPT_X);
|
||||
|
||||
stmt->setFloat(0, float(atof(arg_3)));
|
||||
stmt->setUInt32(1, id);
|
||||
@@ -483,7 +481,7 @@ public:
|
||||
}
|
||||
else if (arg_str_2 == "posy")
|
||||
{
|
||||
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_WAYPOINT_SCRIPT_Y);
|
||||
WorldDatabasePreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_WAYPOINT_SCRIPT_Y);
|
||||
|
||||
stmt->setFloat(0, float(atof(arg_3)));
|
||||
stmt->setUInt32(1, id);
|
||||
@@ -495,7 +493,7 @@ public:
|
||||
}
|
||||
else if (arg_str_2 == "posz")
|
||||
{
|
||||
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_WAYPOINT_SCRIPT_Z);
|
||||
WorldDatabasePreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_WAYPOINT_SCRIPT_Z);
|
||||
|
||||
stmt->setFloat(0, float(atof(arg_3)));
|
||||
stmt->setUInt32(1, id);
|
||||
@@ -507,7 +505,7 @@ public:
|
||||
}
|
||||
else if (arg_str_2 == "orientation")
|
||||
{
|
||||
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_WAYPOINT_SCRIPT_O);
|
||||
WorldDatabasePreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_WAYPOINT_SCRIPT_O);
|
||||
|
||||
stmt->setFloat(0, float(atof(arg_3)));
|
||||
stmt->setUInt32(1, id);
|
||||
@@ -580,7 +578,7 @@ public:
|
||||
// User did select a visual waypoint?
|
||||
|
||||
// Check the creature
|
||||
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_DATA_BY_WPGUID);
|
||||
WorldDatabasePreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_DATA_BY_WPGUID);
|
||||
stmt->setUInt32(0, wpSpawnId);
|
||||
PreparedQueryResult result = WorldDatabase.Query(stmt);
|
||||
|
||||
@@ -595,7 +593,7 @@ public:
|
||||
// See also: http://dev.mysql.com/doc/refman/5.0/en/problems-with-float.html
|
||||
std::string maxDiff = "0.01";
|
||||
|
||||
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_DATA_BY_POS);
|
||||
WorldDatabasePreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_DATA_BY_POS);
|
||||
stmt->setFloat(0, target->GetPositionX());
|
||||
stmt->setString(1, maxDiff);
|
||||
stmt->setFloat(2, target->GetPositionY());
|
||||
@@ -641,15 +639,13 @@ public:
|
||||
wpCreature->AddObjectToRemoveList();
|
||||
}
|
||||
|
||||
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_WAYPOINT_DATA);
|
||||
|
||||
WorldDatabasePreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_WAYPOINT_DATA);
|
||||
stmt->setUInt32(0, pathid);
|
||||
stmt->setUInt32(1, point);
|
||||
|
||||
WorldDatabase.Execute(stmt);
|
||||
|
||||
stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_WAYPOINT_DATA_POINT);
|
||||
|
||||
stmt->setUInt32(0, pathid);
|
||||
stmt->setUInt32(1, point);
|
||||
|
||||
@@ -700,7 +696,7 @@ public:
|
||||
//sMapMgr->GetMap(npcCreature->GetMapId())->Add(wpCreature2);
|
||||
}
|
||||
|
||||
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_WAYPOINT_DATA_POSITION);
|
||||
WorldDatabasePreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_WAYPOINT_DATA_POSITION);
|
||||
|
||||
stmt->setFloat(0, chr->GetPositionX());
|
||||
stmt->setFloat(1, chr->GetPositionY());
|
||||
@@ -792,7 +788,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_DATA_ALL_BY_WPGUID);
|
||||
WorldDatabasePreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_DATA_ALL_BY_WPGUID);
|
||||
|
||||
stmt->setUInt32(0, target->GetSpawnId());
|
||||
|
||||
@@ -827,7 +823,7 @@ public:
|
||||
|
||||
if (show == "on")
|
||||
{
|
||||
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_DATA_POS_BY_ID);
|
||||
WorldDatabasePreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_DATA_POS_BY_ID);
|
||||
|
||||
stmt->setUInt32(0, pathid);
|
||||
|
||||
@@ -863,8 +859,7 @@ public:
|
||||
handler->PSendSysMessage(LANG_WAYPOINT_NOTREMOVED, wpguid);
|
||||
hasError = true;
|
||||
|
||||
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_CREATURE);
|
||||
|
||||
WorldDatabasePreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_CREATURE);
|
||||
stmt->setUInt32(0, wpguid);
|
||||
|
||||
WorldDatabase.Execute(stmt);
|
||||
@@ -908,8 +903,7 @@ public:
|
||||
}
|
||||
|
||||
// Set "wpguid" column to the visual waypoint
|
||||
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_WAYPOINT_DATA_WPGUID);
|
||||
|
||||
WorldDatabasePreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_WAYPOINT_DATA_WPGUID);
|
||||
stmt->setInt32(0, int32(wpCreature->GetSpawnId()));
|
||||
stmt->setUInt32(1, pathid);
|
||||
stmt->setUInt32(2, point);
|
||||
@@ -941,10 +935,10 @@ public:
|
||||
{
|
||||
handler->PSendSysMessage("|cff00ff00DEBUG: wp first, GUID: %u|r", pathid);
|
||||
|
||||
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_DATA_POS_FIRST_BY_ID);
|
||||
WorldDatabasePreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_DATA_POS_FIRST_BY_ID);
|
||||
stmt->setUInt32(0, pathid);
|
||||
PreparedQueryResult result = WorldDatabase.Query(stmt);
|
||||
|
||||
PreparedQueryResult result = WorldDatabase.Query(stmt);
|
||||
if (!result)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_WAYPOINT_NOTFOUND, pathid);
|
||||
@@ -991,16 +985,17 @@ public:
|
||||
{
|
||||
handler->PSendSysMessage("|cff00ff00DEBUG: wp last, PathID: |r|cff00ffff%u|r", pathid);
|
||||
|
||||
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_DATA_POS_LAST_BY_ID);
|
||||
WorldDatabasePreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_DATA_POS_LAST_BY_ID);
|
||||
stmt->setUInt32(0, pathid);
|
||||
PreparedQueryResult result = WorldDatabase.Query(stmt);
|
||||
|
||||
PreparedQueryResult result = WorldDatabase.Query(stmt);
|
||||
if (!result)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_WAYPOINT_NOTFOUNDLAST, pathid);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
Field* fields = result->Fetch();
|
||||
float x = fields[0].GetFloat();
|
||||
float y = fields[1].GetFloat();
|
||||
@@ -1038,17 +1033,19 @@ public:
|
||||
|
||||
if (show == "off")
|
||||
{
|
||||
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_CREATURE_BY_ID);
|
||||
WorldDatabasePreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_CREATURE_BY_ID);
|
||||
stmt->setUInt32(0, 1);
|
||||
PreparedQueryResult result = WorldDatabase.Query(stmt);
|
||||
|
||||
PreparedQueryResult result = WorldDatabase.Query(stmt);
|
||||
if (!result)
|
||||
{
|
||||
handler->SendSysMessage(LANG_WAYPOINT_VP_NOTFOUND);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool hasError = false;
|
||||
|
||||
do
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
@@ -1059,7 +1056,7 @@ public:
|
||||
handler->PSendSysMessage(LANG_WAYPOINT_NOTREMOVED, guid);
|
||||
hasError = true;
|
||||
|
||||
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_CREATURE);
|
||||
WorldDatabasePreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_CREATURE);
|
||||
|
||||
stmt->setUInt32(0, guid);
|
||||
|
||||
@@ -1072,11 +1069,11 @@ public:
|
||||
creature->AddObjectToRemoveList();
|
||||
}
|
||||
} while (result->NextRow());
|
||||
|
||||
// set "wpguid" column to "empty" - no visual waypoint spawned
|
||||
stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_WAYPOINT_DATA_ALL_WPGUID);
|
||||
|
||||
WorldDatabase.Execute(stmt);
|
||||
//WorldDatabase.PExecute("UPDATE creature_movement SET wpguid = '0' WHERE wpguid <> '0'");
|
||||
|
||||
if (hasError)
|
||||
{
|
||||
|
||||
@@ -4,8 +4,6 @@
|
||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
||||
*/
|
||||
|
||||
#include "CreatureAIImpl.h"
|
||||
|
||||
#ifndef DEF_BLACKROCK_SPIRE_H
|
||||
#define DEF_BLACKROCK_SPIRE_H
|
||||
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "CreatureAIImpl.h"
|
||||
|
||||
#ifndef DEF_KARAZHAN_H
|
||||
#define DEF_KARAZHAN_H
|
||||
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
* Originally written by Xinef - Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
|
||||
*/
|
||||
|
||||
#include "CreatureAIImpl.h"
|
||||
|
||||
#ifndef DEF_CULLING_OF_STRATHOLME_H
|
||||
#define DEF_CULLING_OF_STRATHOLME_H
|
||||
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
* Originally written by Xinef - Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
|
||||
*/
|
||||
|
||||
#include "CreatureAIImpl.h"
|
||||
|
||||
#ifndef DEF_OBSIDIAN_SANCTUM_H
|
||||
#define DEF_OBSIDIAN_SANCTUM_H
|
||||
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
|
||||
#include "CreatureAIImpl.h"
|
||||
#include "GameEventMgr.h"
|
||||
#include "GameEventMgr.h"
|
||||
#include "GridNotifiers.h"
|
||||
#include "GridNotifiers.h"
|
||||
#include "PassiveAI.h"
|
||||
#include "Player.h"
|
||||
|
||||
@@ -545,7 +545,7 @@ public:
|
||||
|
||||
void SendMailToPlayer(Player* player)
|
||||
{
|
||||
SQLTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
int16 deliverDelay = irand(MAIL_DELIVER_DELAY_MIN, MAIL_DELIVER_DELAY_MAX);
|
||||
MailDraft(MAIL_MINIGOB_ENTRY, true).SendMailTo(trans, MailReceiver(player), MailSender(MAIL_CREATURE, me->GetEntry()), MAIL_CHECK_MASK_NONE, deliverDelay);
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
|
||||
@@ -128,7 +128,7 @@ public:
|
||||
{
|
||||
// As we can assume most account actions are NOT failed login, so this is the more accurate check.
|
||||
// For those, we need last_ip...
|
||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_ALDL_IP_LOGGING);
|
||||
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_ALDL_IP_LOGGING);
|
||||
|
||||
stmt->setUInt32(0, playerGuid);
|
||||
stmt->setUInt32(1, characterGuid);
|
||||
@@ -139,7 +139,7 @@ public:
|
||||
}
|
||||
else // ... but for failed login, we query last_attempt_ip from account table. Which we do with an unique query
|
||||
{
|
||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_FACL_IP_LOGGING);
|
||||
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_FACL_IP_LOGGING);
|
||||
|
||||
stmt->setUInt32(0, playerGuid);
|
||||
stmt->setUInt32(1, characterGuid);
|
||||
@@ -224,7 +224,7 @@ public:
|
||||
}
|
||||
|
||||
// Once we have done everything, we can insert the new log.
|
||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_CHAR_IP_LOGGING);
|
||||
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_CHAR_IP_LOGGING);
|
||||
|
||||
stmt->setUInt32(0, playerGuid);
|
||||
stmt->setUInt32(1, characterGuid);
|
||||
@@ -287,8 +287,7 @@ public:
|
||||
}
|
||||
|
||||
// Once we have done everything, we can insert the new log.
|
||||
PreparedStatement* stmt2 = LoginDatabase.GetPreparedStatement(LOGIN_INS_ALDL_IP_LOGGING);
|
||||
|
||||
LoginDatabasePreparedStatement* stmt2 = LoginDatabase.GetPreparedStatement(LOGIN_INS_ALDL_IP_LOGGING);
|
||||
stmt2->setUInt32(0, playerGuid);
|
||||
stmt2->setUInt32(1, characterGuid);
|
||||
stmt2->setUInt8(2, aType);
|
||||
|
||||
Reference in New Issue
Block a user