mirror of
https://github.com/mangosfour/server.git
synced 2025-12-17 16:37:00 +00:00
Make Mangos Four compatible with newer MySQL. Based by work by @leprasmurf
* Delimite SQL queries for MySQL 8 compatibility * Fix database name for PlayerDump
This commit is contained in:
parent
96e645a61d
commit
fbdc248ed1
57 changed files with 1017 additions and 972 deletions
|
|
@ -1188,7 +1188,7 @@ bool AuctionBotSeller::Initialize()
|
||||||
sLog.outString();
|
sLog.outString();
|
||||||
|
|
||||||
sLog.outString("Loading npc vendor items for filter..");
|
sLog.outString("Loading npc vendor items for filter..");
|
||||||
if (QueryResult* result = WorldDatabase.Query("SELECT DISTINCT item FROM npc_vendor"))
|
if (QueryResult* result = WorldDatabase.Query("SELECT DISTINCT `item` FROM `npc_vendor`"))
|
||||||
{
|
{
|
||||||
BarGoLink bar(result->GetRowCount());
|
BarGoLink bar(result->GetRowCount());
|
||||||
do
|
do
|
||||||
|
|
@ -1210,16 +1210,16 @@ bool AuctionBotSeller::Initialize()
|
||||||
|
|
||||||
sLog.outString("Loading loot items for filter..");
|
sLog.outString("Loading loot items for filter..");
|
||||||
if (QueryResult* result = WorldDatabase.PQuery(
|
if (QueryResult* result = WorldDatabase.PQuery(
|
||||||
"SELECT item FROM creature_loot_template UNION "
|
"SELECT `item` FROM `creature_loot_template` UNION "
|
||||||
"SELECT item FROM disenchant_loot_template UNION "
|
"SELECT `item` FROM `disenchant_loot_template` UNION "
|
||||||
"SELECT item FROM fishing_loot_template UNION "
|
"SELECT `item` FROM `fishing_loot_template` UNION "
|
||||||
"SELECT item FROM gameobject_loot_template UNION "
|
"SELECT `item` FROM `gameobject_loot_template` UNION "
|
||||||
"SELECT item FROM item_loot_template UNION "
|
"SELECT `item` FROM `item_loot_template` UNION "
|
||||||
"SELECT item FROM milling_loot_template UNION "
|
"SELECT `item` FROM `milling_loot_template` UNION "
|
||||||
"SELECT item FROM pickpocketing_loot_template UNION "
|
"SELECT `item` FROM `pickpocketing_loot_template` UNION "
|
||||||
"SELECT item FROM prospecting_loot_template UNION "
|
"SELECT `item` FROM `prospecting_loot_template` UNION "
|
||||||
"SELECT item FROM skinning_loot_template UNION "
|
"SELECT `item` FROM `skinning_loot_template` UNION "
|
||||||
"SELECT item FROM spell_loot_template"))
|
"SELECT `item` FROM `spell_loot_template`"))
|
||||||
{
|
{
|
||||||
BarGoLink bar(result->GetRowCount());
|
BarGoLink bar(result->GetRowCount());
|
||||||
do
|
do
|
||||||
|
|
|
||||||
|
|
@ -1961,7 +1961,7 @@ void BattleGroundMgr::CreateInitialBattleGrounds()
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
|
|
||||||
// 0 1 2 3 4 5 6
|
// 0 1 2 3 4 5 6
|
||||||
QueryResult* result = WorldDatabase.Query("SELECT id, MinPlayersPerTeam,MaxPlayersPerTeam,AllianceStartLoc,AllianceStartO,HordeStartLoc,HordeStartO FROM battleground_template");
|
QueryResult* result = WorldDatabase.Query("SELECT `id`, `MinPlayersPerTeam`,`MaxPlayersPerTeam`,`AllianceStartLoc`,`AllianceStartO`,`HordeStartLoc`,`HordeStartO` FROM `battleground_template`");
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
|
|
@ -2396,7 +2396,7 @@ void BattleGroundMgr::LoadBattleMastersEntry()
|
||||||
{
|
{
|
||||||
mBattleMastersMap.clear(); // need for reload case
|
mBattleMastersMap.clear(); // need for reload case
|
||||||
|
|
||||||
QueryResult* result = WorldDatabase.Query("SELECT entry,bg_template FROM battlemaster_entry");
|
QueryResult* result = WorldDatabase.Query("SELECT `entry`,`bg_template` FROM `battlemaster_entry`");
|
||||||
|
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
|
|
||||||
|
|
@ -2487,36 +2487,36 @@ void BattleGroundMgr::LoadBattleEventIndexes()
|
||||||
|
|
||||||
QueryResult* result =
|
QueryResult* result =
|
||||||
// 0 1 2 3 4 5 6
|
// 0 1 2 3 4 5 6
|
||||||
WorldDatabase.Query("SELECT data.typ, data.guid1, data.ev1 AS ev1, data.ev2 AS ev2, data.map AS m, data.guid2, description.map, "
|
WorldDatabase.Query("SELECT `data`.`typ`, `data`.`guid1`, `data`.`ev1` AS `ev1`, `data`.`ev2` AS ev2, `data`.`map` AS m, `data`.`guid2`, `description`.`map`, "
|
||||||
// 7 8 9
|
// 7 8 9
|
||||||
"description.event1, description.event2, description.description "
|
"`description`.`event1`, `description`.`event2`, `description`.`description` "
|
||||||
"FROM "
|
"FROM "
|
||||||
"(SELECT '1' AS typ, a.guid AS guid1, a.event1 AS ev1, a.event2 AS ev2, b.map AS map, b.guid AS guid2 "
|
"(SELECT '1' AS typ, `a`.`guid` AS `guid1`, `a`.`event1` AS ev1, `a`.`event2` AS ev2, `b`.`map` AS map, `b`.`guid` AS guid2 "
|
||||||
"FROM gameobject_battleground AS a "
|
"FROM `gameobject_battleground` AS a "
|
||||||
"LEFT OUTER JOIN gameobject AS b ON a.guid = b.guid "
|
"LEFT OUTER JOIN `gameobject` AS b ON `a`.`guid` = `b`.`guid` "
|
||||||
"UNION "
|
"UNION "
|
||||||
"SELECT '2' AS typ, a.guid AS guid1, a.event1 AS ev1, a.event2 AS ev2, b.map AS map, b.guid AS guid2 "
|
"SELECT '2' AS typ, `a`.`guid` AS guid1, `a`.`event1` AS ev1, `a`.`event2` AS ev2, `b`.`map` AS map, `b`.`guid` AS guid2 "
|
||||||
"FROM creature_battleground AS a "
|
"FROM `creature_battleground` AS a "
|
||||||
"LEFT OUTER JOIN creature AS b ON a.guid = b.guid "
|
"LEFT OUTER JOIN `creature` AS b ON `a`.`guid` = `b`.`guid` "
|
||||||
") data "
|
") data "
|
||||||
"RIGHT OUTER JOIN battleground_events AS description ON data.map = description.map "
|
"RIGHT OUTER JOIN `battleground_events` AS `description` ON `data`.`map` = `description`.`map` "
|
||||||
"AND data.ev1 = description.event1 AND data.ev2 = description.event2 "
|
"AND `data`.`ev1` = `description`.`event1` AND `data`.`ev2` = `description`.`event2` "
|
||||||
// full outer join doesn't work in mysql :-/ so just UNION-select the same again and add a left outer join
|
// full outer join doesn't work in mysql :-/ so just UNION-select the same again and add a left outer join
|
||||||
"UNION "
|
"UNION "
|
||||||
"SELECT data.typ, data.guid1, data.ev1, data.ev2, data.map, data.guid2, description.map, "
|
"SELECT `data`.`typ`, `data`.`guid1`, `data`.`ev1`, `data`.`ev2`, `data`.`map`, `data`.`guid2`, `description`.`map`, "
|
||||||
"description.event1, description.event2, description.description "
|
"`description`.`event1`, `description`.`event2`, `description`.`description` "
|
||||||
"FROM "
|
"FROM "
|
||||||
"(SELECT '1' AS typ, a.guid AS guid1, a.event1 AS ev1, a.event2 AS ev2, b.map AS map, b.guid AS guid2 "
|
"(SELECT '1' AS typ, `a`.`guid` AS guid1, `a`.`event1` AS ev1, `a`.`event2` AS ev2, `b`.`map` AS map, `b`.`guid` AS guid2 "
|
||||||
"FROM gameobject_battleground AS a "
|
"FROM `gameobject_battleground` AS a "
|
||||||
"LEFT OUTER JOIN gameobject AS b ON a.guid = b.guid "
|
"LEFT OUTER JOIN `gameobject` AS b ON `a`.`guid` = `b`.`guid` "
|
||||||
"UNION "
|
"UNION "
|
||||||
"SELECT '2' AS typ, a.guid AS guid1, a.event1 AS ev1, a.event2 AS ev2, b.map AS map, b.guid AS guid2 "
|
"SELECT '2' AS typ, `a`.`guid` AS guid1, `a`.`event1` AS ev1, `a`.`event2` AS ev2, `b`.`map` AS map, `b`.`guid` AS guid2 "
|
||||||
"FROM creature_battleground AS a "
|
"FROM `creature_battleground` AS a "
|
||||||
"LEFT OUTER JOIN creature AS b ON a.guid = b.guid "
|
"LEFT OUTER JOIN `creature` AS b ON `a`.`guid` = `b`.`guid` "
|
||||||
") data "
|
") data "
|
||||||
"LEFT OUTER JOIN battleground_events AS description ON data.map = description.map "
|
"LEFT OUTER JOIN `battleground_events` AS `description` ON `data`.`map` = `description`.`map` "
|
||||||
"AND data.ev1 = description.event1 AND data.ev2 = description.event2 "
|
"AND `data`.`ev1` = `description`.`event1` AND `data`.`ev2` = `description`.`event2` "
|
||||||
"ORDER BY m, ev1, ev2");
|
"ORDER BY `m`, `ev1`, `ev2`");
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
BarGoLink bar(1);
|
BarGoLink bar(1);
|
||||||
|
|
|
||||||
|
|
@ -296,12 +296,12 @@ bool ChatHandler::HandleAccountLockCommand(char* args)
|
||||||
|
|
||||||
if (value)
|
if (value)
|
||||||
{
|
{
|
||||||
LoginDatabase.PExecute("UPDATE account SET locked = '1' WHERE id = '%u'", GetAccountId());
|
LoginDatabase.PExecute("UPDATE `account` SET `locked` = '1' WHERE `id` = '%u'", GetAccountId());
|
||||||
PSendSysMessage(LANG_COMMAND_ACCLOCKLOCKED);
|
PSendSysMessage(LANG_COMMAND_ACCLOCKLOCKED);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LoginDatabase.PExecute("UPDATE account SET locked = '0' WHERE id = '%u'", GetAccountId());
|
LoginDatabase.PExecute("UPDATE `account` SET `locked` = '0' WHERE `id` = '%u'", GetAccountId());
|
||||||
PSendSysMessage(LANG_COMMAND_ACCLOCKUNLOCKED);
|
PSendSysMessage(LANG_COMMAND_ACCLOCKUNLOCKED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -112,7 +112,7 @@ bool ChatHandler::HandleMuteCommand(char* args)
|
||||||
target->GetSession()->m_muteTime = mutetime;
|
target->GetSession()->m_muteTime = mutetime;
|
||||||
}
|
}
|
||||||
|
|
||||||
LoginDatabase.PExecute("UPDATE account SET mutetime = " UI64FMTD " WHERE id = '%u'", uint64(mutetime), account_id);
|
LoginDatabase.PExecute("UPDATE `account` SET `mutetime` = " UI64FMTD " WHERE `id` = '%u'", uint64(mutetime), account_id);
|
||||||
|
|
||||||
if (target)
|
if (target)
|
||||||
{
|
{
|
||||||
|
|
@ -165,7 +165,7 @@ bool ChatHandler::HandleUnmuteCommand(char* args)
|
||||||
target->GetSession()->m_muteTime = 0;
|
target->GetSession()->m_muteTime = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
LoginDatabase.PExecute("UPDATE account SET mutetime = '0' WHERE id = '%u'", account_id);
|
LoginDatabase.PExecute("UPDATE `account` SET `mutetime` = '0' WHERE `id` = '%u'", account_id);
|
||||||
|
|
||||||
if (target)
|
if (target)
|
||||||
{
|
{
|
||||||
|
|
@ -683,7 +683,7 @@ bool ChatHandler::HandleGoCreatureCommand(char* args)
|
||||||
{
|
{
|
||||||
std::string name = pParam1;
|
std::string name = pParam1;
|
||||||
WorldDatabase.escape_string(name);
|
WorldDatabase.escape_string(name);
|
||||||
QueryResult* result = WorldDatabase.PQuery("SELECT guid FROM creature, creature_template WHERE creature.id = creature_template.entry AND creature_template.name " _LIKE_ " " _CONCAT3_("'%%'", "'%s'", "'%%'"), name.c_str());
|
QueryResult* result = WorldDatabase.PQuery("SELECT `guid` FROM `creature`, `creature_template` WHERE `creature`.`id` = `creature_template`.`entry` AND `creature_template`.`name` " _LIKE_ " " _CONCAT3_("'%%'", "'%s'", "'%%'"), name.c_str());
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
SendSysMessage(LANG_COMMAND_GOCREATNOTFOUND);
|
SendSysMessage(LANG_COMMAND_GOCREATNOTFOUND);
|
||||||
|
|
@ -843,7 +843,7 @@ bool ChatHandler::HandleGoObjectCommand(char* args)
|
||||||
{
|
{
|
||||||
std::string name = pParam1;
|
std::string name = pParam1;
|
||||||
WorldDatabase.escape_string(name);
|
WorldDatabase.escape_string(name);
|
||||||
QueryResult* result = WorldDatabase.PQuery("SELECT guid FROM gameobject, gameobject_template WHERE gameobject.id = gameobject_template.entry AND gameobject_template.name " _LIKE_ " " _CONCAT3_("'%%'", "'%s'", "'%%'"), name.c_str());
|
QueryResult* result = WorldDatabase.PQuery("SELECT `guid` FROM `gameobject`, `gameobject_template` WHERE `gameobject`.`id` = `gameobject_template`.`entry` AND `gameobject_template`.`name `" _LIKE_ " " _CONCAT3_("'%%'", "'%s'", "'%%'"), name.c_str());
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
SendSysMessage(LANG_COMMAND_GOOBJNOTFOUND);
|
SendSysMessage(LANG_COMMAND_GOOBJNOTFOUND);
|
||||||
|
|
@ -904,7 +904,7 @@ bool ChatHandler::HandleGameObjectTargetCommand(char* args)
|
||||||
uint32 id;
|
uint32 id;
|
||||||
if (ExtractUInt32(&cId, id))
|
if (ExtractUInt32(&cId, id))
|
||||||
{
|
{
|
||||||
result = WorldDatabase.PQuery("SELECT guid, id, position_x, position_y, position_z, orientation, map, (POW(position_x - '%f', 2) + POW(position_y - '%f', 2) + POW(position_z - '%f', 2)) AS order_ FROM gameobject WHERE map = '%i' AND id = '%u' ORDER BY order_ ASC LIMIT 1",
|
result = WorldDatabase.PQuery("SELECT `guid`, `id`, `position_x`, `position_y`, `position_z`, `orientation`, `map`, (POW(`position_x` - '%f', 2) + POW(`position_y` - '%f', 2) + POW(`position_z` - '%f', 2)) AS order_ FROM `gameobject` WHERE `map` = '%i' AND `id` = '%u' ORDER BY order_ ASC LIMIT 1",
|
||||||
pl->GetPositionX(), pl->GetPositionY(), pl->GetPositionZ(), pl->GetMapId(), id);
|
pl->GetPositionX(), pl->GetPositionY(), pl->GetPositionZ(), pl->GetMapId(), id);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -912,8 +912,8 @@ bool ChatHandler::HandleGameObjectTargetCommand(char* args)
|
||||||
std::string name = cId;
|
std::string name = cId;
|
||||||
WorldDatabase.escape_string(name);
|
WorldDatabase.escape_string(name);
|
||||||
result = WorldDatabase.PQuery(
|
result = WorldDatabase.PQuery(
|
||||||
"SELECT guid, id, position_x, position_y, position_z, orientation, map, (POW(position_x - %f, 2) + POW(position_y - %f, 2) + POW(position_z - %f, 2)) AS order_ "
|
"SELECT `guid`, `id`, `position_x`, `position_y`, `position_z`, `orientation`, `map`, (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",
|
"FROM `gameobject`,`gameobject_template` WHERE `gameobject_template`.`entry` = `gameobject`.`id` AND `map` = %i AND `name` " _LIKE_ " " _CONCAT3_("'%%'", "'%s'", "'%%'")" ORDER BY order_ ASC LIMIT 1",
|
||||||
pl->GetPositionX(), pl->GetPositionY(), pl->GetPositionZ(), pl->GetMapId(), name.c_str());
|
pl->GetPositionX(), pl->GetPositionY(), pl->GetPositionZ(), pl->GetMapId(), name.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -945,9 +945,9 @@ bool ChatHandler::HandleGameObjectTargetCommand(char* args)
|
||||||
eventFilter << ")";
|
eventFilter << ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
result = WorldDatabase.PQuery("SELECT gameobject.guid, id, position_x, position_y, position_z, orientation, map, "
|
result = WorldDatabase.PQuery("SELECT `gameobject`.`guid`, `id`, `position_x`, `position_y`, `position_z`, `orientation`, `map`, "
|
||||||
"(POW(position_x - %f, 2) + POW(position_y - %f, 2) + POW(position_z - %f, 2)) AS order_ FROM gameobject "
|
"(POW(`position_x` - %f, 2) + POW(`position_y` - %f, 2) + POW(`position_z` - %f, 2)) AS order_ FROM `gameobject` "
|
||||||
"LEFT OUTER JOIN game_event_gameobject on gameobject.guid=game_event_gameobject.guid WHERE map = '%i' %s ORDER BY order_ ASC LIMIT 10",
|
"LEFT OUTER JOIN `game_event_gameobject` on `gameobject`.`guid`=`game_event_gameobject`.`guid` WHERE `map` = '%i' %s ORDER BY order_ ASC LIMIT 10",
|
||||||
pl->GetPositionX(), pl->GetPositionY(), pl->GetPositionZ(), pl->GetMapId(), eventFilter.str().c_str());
|
pl->GetPositionX(), pl->GetPositionY(), pl->GetPositionZ(), pl->GetMapId(), eventFilter.str().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1344,9 +1344,9 @@ bool ChatHandler::HandleGameObjectNearCommand(char* args)
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
|
|
||||||
Player* pl = m_session->GetPlayer();
|
Player* pl = m_session->GetPlayer();
|
||||||
QueryResult* result = WorldDatabase.PQuery("SELECT guid, id, position_x, position_y, position_z, map, "
|
QueryResult* result = WorldDatabase.PQuery("SELECT `guid`, `id`, `position_x`, `position_y`, `position_z`, `map`, "
|
||||||
"(POW(position_x - '%f', 2) + POW(position_y - '%f', 2) + POW(position_z - '%f', 2)) AS order_ "
|
"(POW(`position_x` - '%f', 2) + POW(`position_y` - '%f', 2) + POW(`position_z` - '%f', 2)) AS order_ "
|
||||||
"FROM gameobject WHERE map='%u' AND (POW(position_x - '%f', 2) + POW(position_y - '%f', 2) + POW(position_z - '%f', 2)) <= '%f' ORDER BY order_",
|
"FROM `gameobject` WHERE `map`='%u' AND (POW(`position_x` - '%f', 2) + POW(`position_y` - '%f', 2) + POW(`position_z` - '%f', 2)) <= '%f' ORDER BY order_",
|
||||||
pl->GetPositionX(), pl->GetPositionY(), pl->GetPositionZ(),
|
pl->GetPositionX(), pl->GetPositionY(), pl->GetPositionZ(),
|
||||||
pl->GetMapId(), pl->GetPositionX(), pl->GetPositionY(), pl->GetPositionZ(), distance * distance);
|
pl->GetMapId(), pl->GetPositionX(), pl->GetPositionY(), pl->GetPositionZ(), distance * distance);
|
||||||
|
|
||||||
|
|
@ -2097,7 +2097,7 @@ bool ChatHandler::HandleNpcFlagCommand(char* args)
|
||||||
|
|
||||||
pCreature->SetUInt32Value(UNIT_NPC_FLAGS, npcFlags);
|
pCreature->SetUInt32Value(UNIT_NPC_FLAGS, npcFlags);
|
||||||
|
|
||||||
WorldDatabase.PExecuteLog("UPDATE creature_template SET NpcFlags = '%u' WHERE entry = '%u'", npcFlags, pCreature->GetEntry());
|
WorldDatabase.PExecuteLog("UPDATE `creature_template` SET `NpcFlags` = '%u' WHERE `entry` = '%u'", npcFlags, pCreature->GetEntry());
|
||||||
|
|
||||||
SendSysMessage(LANG_VALUE_SAVED_REJOIN);
|
SendSysMessage(LANG_VALUE_SAVED_REJOIN);
|
||||||
|
|
||||||
|
|
@ -2234,7 +2234,7 @@ bool ChatHandler::HandleNpcMoveCommand(char* args)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
WorldDatabase.PExecuteLog("UPDATE creature SET position_x = '%f', position_y = '%f', position_z = '%f', orientation = '%f' WHERE guid = '%u'", x, y, z, o, lowguid);
|
WorldDatabase.PExecuteLog("UPDATE `creature` SET `position_x` = '%f', `position_y` = '%f', `position_z` = '%f', `orientation` = '%f' WHERE `guid` = '%u'", x, y, z, o, lowguid);
|
||||||
PSendSysMessage(LANG_COMMAND_CREATUREMOVED);
|
PSendSysMessage(LANG_COMMAND_CREATUREMOVED);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -2424,7 +2424,7 @@ bool ChatHandler::HandleNpcFactionIdCommand(char* args)
|
||||||
}
|
}
|
||||||
|
|
||||||
// and DB
|
// and DB
|
||||||
WorldDatabase.PExecuteLog("UPDATE creature_template SET FactionAlliance = '%u', FactionHorde = '%u' WHERE entry = '%u'", factionId, factionId, pCreature->GetEntry());
|
WorldDatabase.PExecuteLog("UPDATE `creature_template` SET `FactionAlliance` = '%u', `FactionHorde` = '%u' WHERE `entry` = '%u'", factionId, factionId, pCreature->GetEntry());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -2470,7 +2470,7 @@ bool ChatHandler::HandleNpcSpawnDistCommand(char* args)
|
||||||
pCreature->Respawn();
|
pCreature->Respawn();
|
||||||
}
|
}
|
||||||
|
|
||||||
WorldDatabase.PExecuteLog("UPDATE creature SET spawndist=%f, MovementType=%i WHERE guid=%u", option, mtype, u_guidlow);
|
WorldDatabase.PExecuteLog("UPDATE `creature` SET `spawndist`=%f, `MovementType`=%i WHERE `guid`=%u", option, mtype, u_guidlow);
|
||||||
PSendSysMessage(LANG_COMMAND_SPAWNDIST, option);
|
PSendSysMessage(LANG_COMMAND_SPAWNDIST, option);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -2493,7 +2493,7 @@ bool ChatHandler::HandleNpcSpawnTimeCommand(char* args)
|
||||||
|
|
||||||
uint32 u_guidlow = pCreature->GetGUIDLow();
|
uint32 u_guidlow = pCreature->GetGUIDLow();
|
||||||
|
|
||||||
WorldDatabase.PExecuteLog("UPDATE creature SET spawntimesecs=%i WHERE guid=%u", stime, u_guidlow);
|
WorldDatabase.PExecuteLog("UPDATE `creature` SET `spawntimesecs`=%i WHERE `guid`=%u", stime, u_guidlow);
|
||||||
pCreature->SetRespawnDelay(stime);
|
pCreature->SetRespawnDelay(stime);
|
||||||
PSendSysMessage(LANG_COMMAND_SPAWNTIME, stime);
|
PSendSysMessage(LANG_COMMAND_SPAWNTIME, stime);
|
||||||
|
|
||||||
|
|
@ -2939,7 +2939,7 @@ bool ChatHandler::HandlePInfoCommand(char* args)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 0 1 2 3
|
// 0 1 2 3
|
||||||
QueryResult* result = CharacterDatabase.PQuery("SELECT totaltime, level, money, account FROM characters WHERE guid = '%u'", target_guid.GetCounter());
|
QueryResult* result = CharacterDatabase.PQuery("SELECT `totaltime`, `level`, `money`, `account` FROM `characters` WHERE `guid` = '%u'", target_guid.GetCounter());
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -2958,7 +2958,7 @@ bool ChatHandler::HandlePInfoCommand(char* args)
|
||||||
AccountTypes security = SEC_PLAYER;
|
AccountTypes security = SEC_PLAYER;
|
||||||
std::string last_login = GetMangosString(LANG_ERROR);
|
std::string last_login = GetMangosString(LANG_ERROR);
|
||||||
|
|
||||||
QueryResult* result = LoginDatabase.PQuery("SELECT username,gmlevel,last_ip,last_login FROM account WHERE id = '%u'", accId);
|
QueryResult* result = LoginDatabase.PQuery("SELECT `username`,`gmlevel`,`email`,`last_ip`,`last_login` FROM `account` WHERE `id` = '%u'", accId);
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
Field* fields = result->Fetch();
|
Field* fields = result->Fetch();
|
||||||
|
|
@ -2967,8 +2967,8 @@ bool ChatHandler::HandlePInfoCommand(char* args)
|
||||||
|
|
||||||
if (GetAccessLevel() >= security)
|
if (GetAccessLevel() >= security)
|
||||||
{
|
{
|
||||||
last_ip = fields[2].GetCppString();
|
last_ip = fields[3].GetCppString();
|
||||||
last_login = fields[3].GetCppString();
|
last_login = fields[4].GetCppString();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -3406,7 +3406,7 @@ bool ChatHandler::HandleWpAddCommand(char* args)
|
||||||
wpDestination = PATH_FROM_ENTRY; // Default place to store paths
|
wpDestination = PATH_FROM_ENTRY; // Default place to store paths
|
||||||
if (wpOwner->HasStaticDBSpawnData())
|
if (wpOwner->HasStaticDBSpawnData())
|
||||||
{
|
{
|
||||||
QueryResult* result = WorldDatabase.PQuery("SELECT COUNT(id) FROM creature WHERE id = %u", wpOwner->GetEntry());
|
QueryResult* result = WorldDatabase.PQuery("SELECT COUNT(`id`) FROM `creature` WHERE `id` = %u", wpOwner->GetEntry());
|
||||||
if (result && result->Fetch()[0].GetUInt32() != 1)
|
if (result && result->Fetch()[0].GetUInt32() != 1)
|
||||||
wpDestination = PATH_FROM_GUID;
|
wpDestination = PATH_FROM_GUID;
|
||||||
delete result;
|
delete result;
|
||||||
|
|
@ -4053,11 +4053,15 @@ bool ChatHandler::HandleWpExportCommand(char* args)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
outfile << "DELETE FROM " << table << " WHERE " << key_field << "=" << key << ";\n";
|
outfile << "DELETE FROM `" << table << "` WHERE `" << key_field << "`=" << key << ";\n";
|
||||||
if (wpOrigin != PATH_FROM_EXTERNAL)
|
if (wpOrigin != PATH_FROM_EXTERNAL)
|
||||||
outfile << "INSERT INTO " << table << " (" << key_field << ", point, position_x, position_y, position_z, orientation, waittime, script_id) VALUES\n";
|
{
|
||||||
|
outfile << "INSERT INTO `" << table << "` (`" << key_field << "`, `point`, `position_x`, `position_y`, `position_z`, `orientation`, `waittime`, `script_id`) VALUES\n";
|
||||||
|
}
|
||||||
else
|
else
|
||||||
outfile << "INSERT INTO " << table << " (" << key_field << ", point, position_x, position_y, position_z, orientation, waittime) VALUES\n";
|
{
|
||||||
|
outfile << "INSERT INTO `" << table << "` (`" << key_field << "`, `point`, `position_x`, `position_y`, `position_z`, `orientation`, `waittime`) VALUES\n";
|
||||||
|
}
|
||||||
|
|
||||||
WaypointPath::const_iterator itr = wpPath->begin();
|
WaypointPath::const_iterator itr = wpPath->begin();
|
||||||
uint32 countDown = wpPath->size();
|
uint32 countDown = wpPath->size();
|
||||||
|
|
@ -4105,7 +4109,7 @@ bool ChatHandler::HandleCharacterRenameCommand(char* args)
|
||||||
|
|
||||||
PSendSysMessage(LANG_RENAME_PLAYER, GetNameLink(target).c_str());
|
PSendSysMessage(LANG_RENAME_PLAYER, GetNameLink(target).c_str());
|
||||||
target->SetAtLoginFlag(AT_LOGIN_RENAME);
|
target->SetAtLoginFlag(AT_LOGIN_RENAME);
|
||||||
CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '1' WHERE guid = '%u'", target->GetGUIDLow());
|
CharacterDatabase.PExecute("UPDATE `characters` SET `at_login` = `at_login` | '1' WHERE `guid` = '%u'", target->GetGUIDLow());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -4118,7 +4122,7 @@ bool ChatHandler::HandleCharacterRenameCommand(char* args)
|
||||||
std::string oldNameLink = playerLink(target_name);
|
std::string oldNameLink = playerLink(target_name);
|
||||||
|
|
||||||
PSendSysMessage(LANG_RENAME_PLAYER_GUID, oldNameLink.c_str(), target_guid.GetCounter());
|
PSendSysMessage(LANG_RENAME_PLAYER_GUID, oldNameLink.c_str(), target_guid.GetCounter());
|
||||||
CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '1' WHERE guid = '%u'", target_guid.GetCounter());
|
CharacterDatabase.PExecute("UPDATE `characters` SET `at_login` = `at_login` | '1' WHERE `guid` = '%u'", target_guid.GetCounter());
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -4702,7 +4706,7 @@ bool ChatHandler::HandleLookupAccountEmailCommand(char* args)
|
||||||
std::string email = emailStr;
|
std::string email = emailStr;
|
||||||
LoginDatabase.escape_string(email);
|
LoginDatabase.escape_string(email);
|
||||||
// 0 1 2 3 4
|
// 0 1 2 3 4
|
||||||
QueryResult* result = LoginDatabase.PQuery("SELECT id, username, last_ip, gmlevel, expansion FROM account WHERE email " _LIKE_ " " _CONCAT3_("'%%'", "'%s'", "'%%'"), email.c_str());
|
QueryResult* result = LoginDatabase.PQuery("SELECT `id`, `username`, `last_ip`, `gmlevel`, `expansion` FROM `account` WHERE `email` " _LIKE_ " " _CONCAT3_("'%%'", "'%s'", "'%%'"), email.c_str());
|
||||||
|
|
||||||
return ShowAccountListHelper(result, &limit);
|
return ShowAccountListHelper(result, &limit);
|
||||||
}
|
}
|
||||||
|
|
@ -4725,7 +4729,7 @@ bool ChatHandler::HandleLookupAccountIpCommand(char* args)
|
||||||
LoginDatabase.escape_string(ip);
|
LoginDatabase.escape_string(ip);
|
||||||
|
|
||||||
// 0 1 2 3 4
|
// 0 1 2 3 4
|
||||||
QueryResult* result = LoginDatabase.PQuery("SELECT id, username, last_ip, gmlevel, expansion FROM account WHERE last_ip " _LIKE_ " " _CONCAT3_("'%%'", "'%s'", "'%%'"), ip.c_str());
|
QueryResult* result = LoginDatabase.PQuery("SELECT `id`, `username`, `last_ip`, `gmlevel`, `expansion` FROM `account` WHERE `last_ip` " _LIKE_ " " _CONCAT3_("'%%'", "'%s'", "'%%'"), ip.c_str());
|
||||||
|
|
||||||
return ShowAccountListHelper(result, &limit);
|
return ShowAccountListHelper(result, &limit);
|
||||||
}
|
}
|
||||||
|
|
@ -4752,7 +4756,7 @@ bool ChatHandler::HandleLookupAccountNameCommand(char* args)
|
||||||
|
|
||||||
LoginDatabase.escape_string(account);
|
LoginDatabase.escape_string(account);
|
||||||
// 0 1 2 3 4
|
// 0 1 2 3 4
|
||||||
QueryResult* result = LoginDatabase.PQuery("SELECT id, username, last_ip, gmlevel, expansion FROM account WHERE username " _LIKE_ " " _CONCAT3_("'%%'", "'%s'", "'%%'"), account.c_str());
|
QueryResult* result = LoginDatabase.PQuery("SELECT `id`, `username`, `last_ip`, `gmlevel`, `expansion` FROM `account` WHERE `username` " _LIKE_ " " _CONCAT3_("'%%'", "'%s'", "'%%'"), account.c_str());
|
||||||
|
|
||||||
return ShowAccountListHelper(result, &limit);
|
return ShowAccountListHelper(result, &limit);
|
||||||
}
|
}
|
||||||
|
|
@ -4832,7 +4836,7 @@ bool ChatHandler::HandleLookupPlayerIpCommand(char* args)
|
||||||
std::string ip = ipStr;
|
std::string ip = ipStr;
|
||||||
LoginDatabase.escape_string(ip);
|
LoginDatabase.escape_string(ip);
|
||||||
|
|
||||||
QueryResult* result = LoginDatabase.PQuery("SELECT id,username FROM account WHERE last_ip " _LIKE_ " " _CONCAT3_("'%%'", "'%s'", "'%%'"), ip.c_str());
|
QueryResult* result = LoginDatabase.PQuery("SELECT `id`,`username` FROM `account` WHERE `last_ip` " _LIKE_ " " _CONCAT3_("'%%'", "'%s'", "'%%'"), ip.c_str());
|
||||||
|
|
||||||
return LookupPlayerSearchCommand(result, &limit);
|
return LookupPlayerSearchCommand(result, &limit);
|
||||||
}
|
}
|
||||||
|
|
@ -4859,7 +4863,7 @@ bool ChatHandler::HandleLookupPlayerAccountCommand(char* args)
|
||||||
|
|
||||||
LoginDatabase.escape_string(account);
|
LoginDatabase.escape_string(account);
|
||||||
|
|
||||||
QueryResult* result = LoginDatabase.PQuery("SELECT id,username FROM account WHERE username " _LIKE_ " " _CONCAT3_("'%%'", "'%s'", "'%%'"), account.c_str());
|
QueryResult* result = LoginDatabase.PQuery("SELECT `id`,`username` FROM `account` WHERE `username` " _LIKE_ " " _CONCAT3_("'%%'", "'%s'", "'%%'"), account.c_str());
|
||||||
|
|
||||||
return LookupPlayerSearchCommand(result, &limit);
|
return LookupPlayerSearchCommand(result, &limit);
|
||||||
}
|
}
|
||||||
|
|
@ -4881,7 +4885,7 @@ bool ChatHandler::HandleLookupPlayerEmailCommand(char* args)
|
||||||
std::string email = emailStr;
|
std::string email = emailStr;
|
||||||
LoginDatabase.escape_string(email);
|
LoginDatabase.escape_string(email);
|
||||||
|
|
||||||
QueryResult* result = LoginDatabase.PQuery("SELECT id,username FROM account WHERE email " _LIKE_ " " _CONCAT3_("'%%'", "'%s'", "'%%'"), email.c_str());
|
QueryResult* result = LoginDatabase.PQuery("SELECT `id`,`username` FROM `account` WHERE `email` " _LIKE_ " " _CONCAT3_("'%%'", "'%s'", "'%%'"), email.c_str());
|
||||||
|
|
||||||
return LookupPlayerSearchCommand(result, &limit);
|
return LookupPlayerSearchCommand(result, &limit);
|
||||||
}
|
}
|
||||||
|
|
@ -4916,7 +4920,7 @@ bool ChatHandler::LookupPlayerSearchCommand(QueryResult* result, uint32* limit)
|
||||||
std::string acc_name = fields[1].GetCppString();
|
std::string acc_name = fields[1].GetCppString();
|
||||||
|
|
||||||
///- Get the characters for account id
|
///- Get the characters for account id
|
||||||
QueryResult* chars = CharacterDatabase.PQuery("SELECT guid, name, race, class, level FROM characters WHERE account = %u", acc_id);
|
QueryResult* chars = CharacterDatabase.PQuery("SELECT `guid`, `name`, `race`, `class`, `level` FROM `characters` WHERE `account` = %u", acc_id);
|
||||||
if (chars)
|
if (chars)
|
||||||
{
|
{
|
||||||
if (chars->GetRowCount())
|
if (chars->GetRowCount())
|
||||||
|
|
|
||||||
|
|
@ -1273,7 +1273,7 @@ bool ChatHandler::HandleAccountSetGmLevelCommand(char* args)
|
||||||
}
|
}
|
||||||
|
|
||||||
PSendSysMessage(LANG_YOU_CHANGE_SECURITY, targetAccountName.c_str(), gm);
|
PSendSysMessage(LANG_YOU_CHANGE_SECURITY, targetAccountName.c_str(), gm);
|
||||||
LoginDatabase.PExecute("UPDATE account SET gmlevel = '%i' WHERE id = '%u'", gm, targetAccountId);
|
LoginDatabase.PExecute("UPDATE `account` SET `gmlevel` = '%i' WHERE `id` = '%u'", gm, targetAccountId);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -2789,7 +2789,7 @@ bool ChatHandler::HandleAddItemCommand(char* args)
|
||||||
{
|
{
|
||||||
std::string itemName = cId;
|
std::string itemName = cId;
|
||||||
WorldDatabase.escape_string(itemName);
|
WorldDatabase.escape_string(itemName);
|
||||||
QueryResult* result = WorldDatabase.PQuery("SELECT entry FROM item_template WHERE name = '%s'", itemName.c_str());
|
QueryResult* result = WorldDatabase.PQuery("SELECT `entry` FROM `item_template` WHERE `name` = '%s'", itemName.c_str());
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
PSendSysMessage(LANG_COMMAND_COULDNOTFIND, cId);
|
PSendSysMessage(LANG_COMMAND_COULDNOTFIND, cId);
|
||||||
|
|
@ -2983,7 +2983,7 @@ bool ChatHandler::HandleListItemCommand(char* args)
|
||||||
|
|
||||||
// inventory case
|
// inventory case
|
||||||
uint32 inv_count = 0;
|
uint32 inv_count = 0;
|
||||||
result = CharacterDatabase.PQuery("SELECT COUNT(item_template) FROM character_inventory WHERE item_template='%u'", item_id);
|
result = CharacterDatabase.PQuery("SELECT COUNT(`item_template`) FROM `character_inventory` WHERE `item_template`='%u'", item_id);
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
inv_count = (*result)[0].GetUInt32();
|
inv_count = (*result)[0].GetUInt32();
|
||||||
|
|
@ -2992,9 +2992,9 @@ bool ChatHandler::HandleListItemCommand(char* args)
|
||||||
|
|
||||||
result = CharacterDatabase.PQuery(
|
result = CharacterDatabase.PQuery(
|
||||||
// 0 1 2 3 4 5
|
// 0 1 2 3 4 5
|
||||||
"SELECT ci.item, cibag.slot AS bag, ci.slot, ci.guid, characters.account,characters.name "
|
"SELECT `ci`.`item`, `cibag`.`slot` AS bag, `ci`.`slot`, `ci`.`guid`, `characters`.`account`,`characters`.`name` "
|
||||||
"FROM character_inventory AS ci LEFT JOIN character_inventory AS cibag ON (cibag.item=ci.bag),characters "
|
"FROM `character_inventory` AS `ci` LEFT JOIN `character_inventory` AS cibag ON (`cibag`.`item`=`ci`.`bag`),`characters` "
|
||||||
"WHERE ci.item_template='%u' AND ci.guid = characters.guid LIMIT %u ",
|
"WHERE `ci`.`item_template`='%u' AND `ci`.`guid` = `characters`.`guid` LIMIT %u ",
|
||||||
item_id, uint32(count));
|
item_id, uint32(count));
|
||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
|
|
@ -3048,7 +3048,7 @@ bool ChatHandler::HandleListItemCommand(char* args)
|
||||||
|
|
||||||
// mail case
|
// mail case
|
||||||
uint32 mail_count = 0;
|
uint32 mail_count = 0;
|
||||||
result = CharacterDatabase.PQuery("SELECT COUNT(item_template) FROM mail_items WHERE item_template='%u'", item_id);
|
result = CharacterDatabase.PQuery("SELECT COUNT(`item_template`) FROM `mail_items` WHERE `item_template`='%u'", item_id);
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
mail_count = (*result)[0].GetUInt32();
|
mail_count = (*result)[0].GetUInt32();
|
||||||
|
|
@ -3059,9 +3059,9 @@ bool ChatHandler::HandleListItemCommand(char* args)
|
||||||
{
|
{
|
||||||
result = CharacterDatabase.PQuery(
|
result = CharacterDatabase.PQuery(
|
||||||
// 0 1 2 3 4 5 6
|
// 0 1 2 3 4 5 6
|
||||||
"SELECT mail_items.item_guid, mail.sender, mail.receiver, char_s.account, char_s.name, char_r.account, char_r.name "
|
"SELECT `mail_items`.`item_guid`, `mail`.`sender`, `mail`.`receiver`, `char_s`.`account`, `char_s`.`name`, `char_r`.`account`, `char_r`.`name` "
|
||||||
"FROM mail,mail_items,characters as char_s,characters as char_r "
|
"FROM `mail`,`mail_items`,`characters` as char_s,`characters` as char_r "
|
||||||
"WHERE mail_items.item_template='%u' AND char_s.guid = mail.sender AND char_r.guid = mail.receiver AND mail.id=mail_items.mail_id LIMIT %u",
|
"WHERE `mail_items`.`item_template`='%u' AND `char_s`.`guid` = `mail`.`sender` AND `char_r`.`guid` = `mail`.`receiver` AND `mail`.`id`=`mail_items`.`mail_id` LIMIT %u",
|
||||||
item_id, uint32(count));
|
item_id, uint32(count));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -3105,7 +3105,7 @@ bool ChatHandler::HandleListItemCommand(char* args)
|
||||||
|
|
||||||
// auction case
|
// auction case
|
||||||
uint32 auc_count = 0;
|
uint32 auc_count = 0;
|
||||||
result = CharacterDatabase.PQuery("SELECT COUNT(item_template) FROM auction WHERE item_template='%u'", item_id);
|
result = CharacterDatabase.PQuery("SELECT COUNT(`item_template`) FROM `auction` WHERE `item_template`='%u'", item_id);
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
auc_count = (*result)[0].GetUInt32();
|
auc_count = (*result)[0].GetUInt32();
|
||||||
|
|
@ -3116,8 +3116,8 @@ bool ChatHandler::HandleListItemCommand(char* args)
|
||||||
{
|
{
|
||||||
result = CharacterDatabase.PQuery(
|
result = CharacterDatabase.PQuery(
|
||||||
// 0 1 2 3
|
// 0 1 2 3
|
||||||
"SELECT auction.itemguid, auction.itemowner, characters.account, characters.name "
|
"SELECT `auction`.`itemguid`, `auction`.`itemowner`, `characters`.`account`, `characters`.`name` "
|
||||||
"FROM auction,characters WHERE auction.item_template='%u' AND characters.guid = auction.itemowner LIMIT %u",
|
"FROM `auction`,`characters` WHERE `auction`.`item_template`='%u' AND `characters`.`guid` = `auction`.`itemowner` LIMIT %u",
|
||||||
item_id, uint32(count));
|
item_id, uint32(count));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -3229,7 +3229,7 @@ bool ChatHandler::HandleListObjectCommand(char* args)
|
||||||
QueryResult* result;
|
QueryResult* result;
|
||||||
|
|
||||||
uint32 obj_count = 0;
|
uint32 obj_count = 0;
|
||||||
result = WorldDatabase.PQuery("SELECT COUNT(guid) FROM gameobject WHERE id='%u'", go_id);
|
result = WorldDatabase.PQuery("SELECT COUNT(`guid`) FROM `gameobject` WHERE `id`='%u'", go_id);
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
obj_count = (*result)[0].GetUInt32();
|
obj_count = (*result)[0].GetUInt32();
|
||||||
|
|
@ -3239,11 +3239,11 @@ bool ChatHandler::HandleListObjectCommand(char* args)
|
||||||
if (m_session)
|
if (m_session)
|
||||||
{
|
{
|
||||||
Player* pl = m_session->GetPlayer();
|
Player* pl = m_session->GetPlayer();
|
||||||
result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map, (POW(position_x - '%f', 2) + POW(position_y - '%f', 2) + POW(position_z - '%f', 2)) AS order_ FROM gameobject WHERE id = '%u' ORDER BY order_ ASC LIMIT %u",
|
result = WorldDatabase.PQuery("SELECT `guid`, `position_x`, `position_y`, `position_z`, `map`, (POW(`position_x` - '%f', 2) + POW(`position_y` - '%f', 2) + POW(`position_z` - '%f', 2)) AS order_ FROM `gameobject` WHERE `id` = '%u' ORDER BY `order_` ASC LIMIT %u",
|
||||||
pl->GetPositionX(), pl->GetPositionY(), pl->GetPositionZ(), go_id, uint32(count));
|
pl->GetPositionX(), pl->GetPositionY(), pl->GetPositionZ(), go_id, uint32(count));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map FROM gameobject WHERE id = '%u' LIMIT %u",
|
result = WorldDatabase.PQuery("SELECT `guid`, `position_x`, `position_y`, `position_z`, `map` FROM `gameobject` WHERE `id` = '%u' LIMIT %u",
|
||||||
go_id, uint32(count));
|
go_id, uint32(count));
|
||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
|
|
@ -3308,7 +3308,7 @@ bool ChatHandler::HandleListCreatureCommand(char* args)
|
||||||
QueryResult* result;
|
QueryResult* result;
|
||||||
|
|
||||||
uint32 cr_count = 0;
|
uint32 cr_count = 0;
|
||||||
result = WorldDatabase.PQuery("SELECT COUNT(guid) FROM creature WHERE id='%u'", cr_id);
|
result = WorldDatabase.PQuery("SELECT COUNT(`guid`) FROM `creature` WHERE `id`='%u'", cr_id);
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
cr_count = (*result)[0].GetUInt32();
|
cr_count = (*result)[0].GetUInt32();
|
||||||
|
|
@ -3318,11 +3318,11 @@ bool ChatHandler::HandleListCreatureCommand(char* args)
|
||||||
if (m_session)
|
if (m_session)
|
||||||
{
|
{
|
||||||
Player* pl = m_session->GetPlayer();
|
Player* pl = m_session->GetPlayer();
|
||||||
result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map, (POW(position_x - '%f', 2) + POW(position_y - '%f', 2) + POW(position_z - '%f', 2)) AS order_ FROM creature WHERE id = '%u' ORDER BY order_ ASC LIMIT %u",
|
result = WorldDatabase.PQuery("SELECT `guid`, `position_x`, `position_y`, `position_z`, `map`, (POW(`position_x` - '%f', 2) + POW(`position_y` - '%f', 2) + POW(`position_z` - '%f', 2)) AS order_ FROM `creature` WHERE `id` = '%u' ORDER BY `order_` ASC LIMIT %u",
|
||||||
pl->GetPositionX(), pl->GetPositionY(), pl->GetPositionZ(), cr_id, uint32(count));
|
pl->GetPositionX(), pl->GetPositionY(), pl->GetPositionZ(), cr_id, uint32(count));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map FROM creature WHERE id = '%u' LIMIT %u",
|
result = WorldDatabase.PQuery("SELECT `guid`, `position_x`, `position_y`, `position_z`, `map` FROM `creature` WHERE `id` = '%u' LIMIT %u",
|
||||||
cr_id, uint32(count));
|
cr_id, uint32(count));
|
||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
|
|
@ -5076,7 +5076,7 @@ void ChatHandler::HandleCharacterLevel(Player* player, ObjectGuid player_guid, u
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// update level and XP at level, all other will be updated at loading
|
// update level and XP at level, all other will be updated at loading
|
||||||
CharacterDatabase.PExecute("UPDATE characters SET level = '%u', xp = 0 WHERE guid = '%u'", newlevel, player_guid.GetCounter());
|
CharacterDatabase.PExecute("UPDATE `characters` SET `level` = '%u', `xp` = 0 WHERE `guid` = '%u'", newlevel, player_guid.GetCounter());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -5845,7 +5845,7 @@ bool ChatHandler::HandleResetSpellsCommand(char* args)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '%u' WHERE guid = '%u'", uint32(AT_LOGIN_RESET_SPELLS), target_guid.GetCounter());
|
CharacterDatabase.PExecute("UPDATE `characters` SET `at_login` = `at_login` | '%u' WHERE `guid` = '%u'", uint32(AT_LOGIN_RESET_SPELLS), target_guid.GetCounter());
|
||||||
PSendSysMessage(LANG_RESET_SPELLS_OFFLINE, target_name.c_str());
|
PSendSysMessage(LANG_RESET_SPELLS_OFFLINE, target_name.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -5882,7 +5882,7 @@ bool ChatHandler::HandleResetSpecsCommand(char* args)
|
||||||
else if (target_guid)
|
else if (target_guid)
|
||||||
{
|
{
|
||||||
uint32 at_flags = AT_LOGIN_RESET_TALENTS | AT_LOGIN_RESET_PET_TALENTS;
|
uint32 at_flags = AT_LOGIN_RESET_TALENTS | AT_LOGIN_RESET_PET_TALENTS;
|
||||||
CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '%u' WHERE guid = '%u'", at_flags, target_guid.GetCounter());
|
CharacterDatabase.PExecute("UPDATE `characters` SET `at_login` = `at_login` | '%u' WHERE `guid` = '%u'", at_flags, target_guid.GetCounter());
|
||||||
std::string nameLink = playerLink(target_name);
|
std::string nameLink = playerLink(target_name);
|
||||||
PSendSysMessage(LANG_RESET_TALENTS_OFFLINE, nameLink.c_str());
|
PSendSysMessage(LANG_RESET_TALENTS_OFFLINE, nameLink.c_str());
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -5978,7 +5978,7 @@ bool ChatHandler::HandleResetAllCommand(char* args)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '%u' WHERE (at_login & '%u') = '0'", atLogin, atLogin);
|
CharacterDatabase.PExecute("UPDATE `characters` SET `at_login` = `at_login` | '%u' WHERE (`at_login` & '%u') = '0'", atLogin, atLogin);
|
||||||
HashMapHolder<Player>::MapType const& plist = sObjectAccessor.GetPlayers();
|
HashMapHolder<Player>::MapType const& plist = sObjectAccessor.GetPlayers();
|
||||||
for (HashMapHolder<Player>::MapType::const_iterator itr = plist.begin(); itr != plist.end(); ++itr)
|
for (HashMapHolder<Player>::MapType::const_iterator itr = plist.begin(); itr != plist.end(); ++itr)
|
||||||
{
|
{
|
||||||
|
|
@ -6528,7 +6528,7 @@ bool ChatHandler::HandleBanInfoCharacterCommand(char* args)
|
||||||
|
|
||||||
bool ChatHandler::HandleBanInfoHelper(uint32 accountid, char const* accountname)
|
bool ChatHandler::HandleBanInfoHelper(uint32 accountid, char const* accountname)
|
||||||
{
|
{
|
||||||
QueryResult* result = LoginDatabase.PQuery("SELECT FROM_UNIXTIME(bandate), unbandate-bandate, active, unbandate,banreason,bannedby FROM account_banned WHERE id = '%u' ORDER BY bandate ASC", accountid);
|
QueryResult* result = LoginDatabase.PQuery("SELECT FROM_UNIXTIME(`bandate`), `unbandate`-`bandate`, `active`, `unbandate`,`banreason`,`bannedby` FROM `account_banned` WHERE `id` = '%u' ORDER BY `bandate` ASC", accountid);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
PSendSysMessage(LANG_BANINFO_NOACCOUNTBAN, accountname);
|
PSendSysMessage(LANG_BANINFO_NOACCOUNTBAN, accountname);
|
||||||
|
|
@ -6578,7 +6578,7 @@ bool ChatHandler::HandleBanInfoIPCommand(char* args)
|
||||||
std::string IP = cIP;
|
std::string IP = cIP;
|
||||||
|
|
||||||
LoginDatabase.escape_string(IP);
|
LoginDatabase.escape_string(IP);
|
||||||
QueryResult* result = LoginDatabase.PQuery("SELECT ip, FROM_UNIXTIME(bandate), FROM_UNIXTIME(unbandate), unbandate-UNIX_TIMESTAMP(), banreason,bannedby,unbandate-bandate FROM ip_banned WHERE ip = '%s'", IP.c_str());
|
QueryResult* result = LoginDatabase.PQuery("SELECT `ip`, FROM_UNIXTIME(`bandate`), FROM_UNIXTIME(`unbandate`), `unbandate`-UNIX_TIMESTAMP(), `banreason`,`bannedby`,`unbandate`-`bandate` FROM `ip_banned` WHERE `ip` = '%s'", IP.c_str());
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
PSendSysMessage(LANG_BANINFO_NOIP);
|
PSendSysMessage(LANG_BANINFO_NOIP);
|
||||||
|
|
@ -6596,7 +6596,7 @@ bool ChatHandler::HandleBanInfoIPCommand(char* args)
|
||||||
|
|
||||||
bool ChatHandler::HandleBanListCharacterCommand(char* args)
|
bool ChatHandler::HandleBanListCharacterCommand(char* args)
|
||||||
{
|
{
|
||||||
LoginDatabase.Execute("DELETE FROM ip_banned WHERE unbandate<=UNIX_TIMESTAMP() AND unbandate<>bandate");
|
LoginDatabase.Execute("DELETE FROM `ip_banned` WHERE `unbandate`<=UNIX_TIMESTAMP() AND `unbandate`<>`bandate`");
|
||||||
|
|
||||||
char* cFilter = ExtractLiteralArg(&args);
|
char* cFilter = ExtractLiteralArg(&args);
|
||||||
if (!cFilter)
|
if (!cFilter)
|
||||||
|
|
@ -6606,7 +6606,7 @@ bool ChatHandler::HandleBanListCharacterCommand(char* args)
|
||||||
|
|
||||||
std::string filter = cFilter;
|
std::string filter = cFilter;
|
||||||
LoginDatabase.escape_string(filter);
|
LoginDatabase.escape_string(filter);
|
||||||
QueryResult* result = CharacterDatabase.PQuery("SELECT account FROM characters WHERE name " _LIKE_ " " _CONCAT3_("'%%'", "'%s'", "'%%'"), filter.c_str());
|
QueryResult* result = CharacterDatabase.PQuery("SELECT `account` FROM `characters` WHERE `name` " _LIKE_ " " _CONCAT3_("'%%'", "'%s'", "'%%'"), filter.c_str());
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
PSendSysMessage(LANG_BANLIST_NOCHARACTER);
|
PSendSysMessage(LANG_BANLIST_NOCHARACTER);
|
||||||
|
|
@ -6618,7 +6618,7 @@ bool ChatHandler::HandleBanListCharacterCommand(char* args)
|
||||||
|
|
||||||
bool ChatHandler::HandleBanListAccountCommand(char* args)
|
bool ChatHandler::HandleBanListAccountCommand(char* args)
|
||||||
{
|
{
|
||||||
LoginDatabase.Execute("DELETE FROM ip_banned WHERE unbandate<=UNIX_TIMESTAMP() AND unbandate<>bandate");
|
LoginDatabase.Execute("DELETE FROM `ip_banned` WHERE `unbandate`<=UNIX_TIMESTAMP() AND `unbandate`<>`bandate`");
|
||||||
|
|
||||||
char* cFilter = ExtractLiteralArg(&args);
|
char* cFilter = ExtractLiteralArg(&args);
|
||||||
std::string filter = cFilter ? cFilter : "";
|
std::string filter = cFilter ? cFilter : "";
|
||||||
|
|
@ -6628,13 +6628,13 @@ bool ChatHandler::HandleBanListAccountCommand(char* args)
|
||||||
|
|
||||||
if (filter.empty())
|
if (filter.empty())
|
||||||
{
|
{
|
||||||
result = LoginDatabase.Query("SELECT account.id, username FROM account, account_banned"
|
result = LoginDatabase.Query("SELECT `account`.`id`, `username` FROM `account`, `account_banned`"
|
||||||
" WHERE account.id = account_banned.id AND active = 1 GROUP BY account.id");
|
" WHERE `account`.`id` = `account_banned`.`id` AND `active` = 1 GROUP BY `account`.`id`");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
result = LoginDatabase.PQuery("SELECT account.id, username FROM account, account_banned"
|
result = LoginDatabase.PQuery("SELECT `account`.`id`, `username` FROM `account`, `account_banned`"
|
||||||
" WHERE account.id = account_banned.id AND active = 1 AND username " _LIKE_ " " _CONCAT3_("'%%'", "'%s'", "'%%'")" GROUP BY account.id",
|
" WHERE `account`.`id` = `account_banned`.`id` AND `active` = 1 AND `username` " _LIKE_ " " _CONCAT3_("'%%'", "'%s'", "'%%'")" GROUP BY `account`.`id`",
|
||||||
filter.c_str());
|
filter.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -6659,7 +6659,7 @@ bool ChatHandler::HandleBanListHelper(QueryResult* result)
|
||||||
Field* fields = result->Fetch();
|
Field* fields = result->Fetch();
|
||||||
uint32 accountid = fields[0].GetUInt32();
|
uint32 accountid = fields[0].GetUInt32();
|
||||||
|
|
||||||
QueryResult* banresult = LoginDatabase.PQuery("SELECT account.username FROM account,account_banned WHERE account_banned.id='%u' AND account_banned.id=account.id", accountid);
|
QueryResult* banresult = LoginDatabase.PQuery("SELECT `account`.`username` FROM `account`,`account_banned` WHERE `account_banned`.`id`='%u' AND `account_banned`.`id`=`account`.`id`", accountid);
|
||||||
if (banresult)
|
if (banresult)
|
||||||
{
|
{
|
||||||
Field* fields2 = banresult->Fetch();
|
Field* fields2 = banresult->Fetch();
|
||||||
|
|
@ -6695,7 +6695,7 @@ bool ChatHandler::HandleBanListHelper(QueryResult* result)
|
||||||
}
|
}
|
||||||
|
|
||||||
// No SQL injection. id is uint32.
|
// No SQL injection. id is uint32.
|
||||||
QueryResult* banInfo = LoginDatabase.PQuery("SELECT bandate,unbandate,bannedby,banreason FROM account_banned WHERE id = %u ORDER BY unbandate", account_id);
|
QueryResult* banInfo = LoginDatabase.PQuery("SELECT `bandate`,`unbandate`,`bannedby`,`banreason` FROM `account_banned` WHERE `id` = %u ORDER BY `unbandate`", account_id);
|
||||||
if (banInfo)
|
if (banInfo)
|
||||||
{
|
{
|
||||||
Field* fields2 = banInfo->Fetch();
|
Field* fields2 = banInfo->Fetch();
|
||||||
|
|
@ -6734,7 +6734,7 @@ bool ChatHandler::HandleBanListHelper(QueryResult* result)
|
||||||
|
|
||||||
bool ChatHandler::HandleBanListIPCommand(char* args)
|
bool ChatHandler::HandleBanListIPCommand(char* args)
|
||||||
{
|
{
|
||||||
LoginDatabase.Execute("DELETE FROM ip_banned WHERE unbandate<=UNIX_TIMESTAMP() AND unbandate<>bandate");
|
LoginDatabase.Execute("DELETE FROM `ip_banned` WHERE `unbandate`<=UNIX_TIMESTAMP() AND `unbandate`<>`bandate`");
|
||||||
|
|
||||||
char* cFilter = ExtractLiteralArg(&args);
|
char* cFilter = ExtractLiteralArg(&args);
|
||||||
std::string filter = cFilter ? cFilter : "";
|
std::string filter = cFilter ? cFilter : "";
|
||||||
|
|
@ -6744,15 +6744,15 @@ bool ChatHandler::HandleBanListIPCommand(char* args)
|
||||||
|
|
||||||
if (filter.empty())
|
if (filter.empty())
|
||||||
{
|
{
|
||||||
result = LoginDatabase.Query("SELECT ip,bandate,unbandate,bannedby,banreason FROM ip_banned"
|
result = LoginDatabase.Query("SELECT `ip`,`bandate`,`unbandate`,`bannedby`,`banreason` FROM `ip_banned`"
|
||||||
" WHERE (bandate=unbandate OR unbandate>UNIX_TIMESTAMP())"
|
" WHERE (`bandate`=`unbandate` OR `unbandate`>UNIX_TIMESTAMP())"
|
||||||
" ORDER BY unbandate");
|
" ORDER BY `unbandate`");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
result = LoginDatabase.PQuery("SELECT ip,bandate,unbandate,bannedby,banreason FROM ip_banned"
|
result = LoginDatabase.PQuery("SELECT `ip`,`bandate`,`unbandate`,`bannedby`,`banreason` FROM `ip_banned`"
|
||||||
" WHERE (bandate=unbandate OR unbandate>UNIX_TIMESTAMP()) AND ip " _LIKE_ " " _CONCAT3_("'%%'", "'%s'", "'%%'")
|
" WHERE (`bandate`=`unbandate` OR `unbandate`>UNIX_TIMESTAMP()) AND `ip` " _LIKE_ " " _CONCAT3_("'%%'", "'%s'", "'%%'")
|
||||||
" ORDER BY unbandate", filter.c_str());
|
" ORDER BY `unbandate`", filter.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
|
|
@ -7572,7 +7572,7 @@ bool ChatHandler::HandleInstanceSaveDataCommand(char* /*args*/)
|
||||||
bool ChatHandler::HandleGMListFullCommand(char* /*args*/)
|
bool ChatHandler::HandleGMListFullCommand(char* /*args*/)
|
||||||
{
|
{
|
||||||
///- Get the accounts with GM Level >0
|
///- Get the accounts with GM Level >0
|
||||||
QueryResult* result = LoginDatabase.Query("SELECT username,gmlevel FROM account WHERE gmlevel > 0");
|
QueryResult* result = LoginDatabase.Query("SELECT `username`,`gmlevel` FROM `account` WHERE `gmlevel` > 0");
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
SendSysMessage(LANG_GMLIST);
|
SendSysMessage(LANG_GMLIST);
|
||||||
|
|
@ -7689,7 +7689,7 @@ bool ChatHandler::HandleAccountCharactersCommand(char* args)
|
||||||
}
|
}
|
||||||
|
|
||||||
///- Get the characters for account id
|
///- Get the characters for account id
|
||||||
QueryResult* result = CharacterDatabase.PQuery("SELECT guid, name, race, class, level FROM characters WHERE account = %u", account_id);
|
QueryResult* result = CharacterDatabase.PQuery("SELECT `guid`, `name`, `race`, `class`, `level` FROM `characters` WHERE `account` = %u", account_id);
|
||||||
|
|
||||||
return ShowPlayerListHelper(result);
|
return ShowPlayerListHelper(result);
|
||||||
}
|
}
|
||||||
|
|
@ -7720,7 +7720,7 @@ bool ChatHandler::HandleAccountSetAddonCommand(char* args)
|
||||||
}
|
}
|
||||||
|
|
||||||
// No SQL injection
|
// No SQL injection
|
||||||
LoginDatabase.PExecute("UPDATE account SET expansion = '%u' WHERE id = '%u'", lev, account_id);
|
LoginDatabase.PExecute("UPDATE `account` SET `expansion` = '%u' WHERE `id` = '%u'", lev, account_id);
|
||||||
PSendSysMessage(LANG_ACCOUNT_SETADDON, account_name.c_str(), account_id, lev);
|
PSendSysMessage(LANG_ACCOUNT_SETADDON, account_name.c_str(), account_id, lev);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,7 @@ bool ChatHandler::GetDeletedCharacterInfoList(DeletedInfoList& foundList, std::s
|
||||||
// search by GUID
|
// search by GUID
|
||||||
if (isNumeric(searchString))
|
if (isNumeric(searchString))
|
||||||
{
|
{
|
||||||
resultChar = CharacterDatabase.PQuery("SELECT guid, deleteInfos_Name, deleteInfos_Account, deleteDate FROM characters WHERE deleteDate IS NOT NULL AND guid = %u", uint32(atoi(searchString.c_str())));
|
resultChar = CharacterDatabase.PQuery("SELECT `guid`, `deleteInfos_Name`, `deleteInfos_Account`, `deleteDate` FROM `characters` WHERE `deleteDate` IS NOT NULL AND `guid` = %u", uint32(atoi(searchString.c_str())));
|
||||||
}
|
}
|
||||||
// search by name
|
// search by name
|
||||||
else
|
else
|
||||||
|
|
@ -111,12 +111,12 @@ bool ChatHandler::GetDeletedCharacterInfoList(DeletedInfoList& foundList, std::s
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
resultChar = CharacterDatabase.PQuery("SELECT guid, deleteInfos_Name, deleteInfos_Account, deleteDate FROM characters WHERE deleteDate IS NOT NULL AND deleteInfos_Name " _LIKE_ " " _CONCAT3_("'%%'", "'%s'", "'%%'"), searchString.c_str());
|
resultChar = CharacterDatabase.PQuery("SELECT `guid`, `deleteInfos_Name`, `deleteInfos_Account`, `deleteDate` FROM `characters` WHERE `deleteDate` IS NOT NULL AND `deleteInfos_Name` " _LIKE_ " " _CONCAT3_("'%%'", "'%s'", "'%%'"), searchString.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
resultChar = CharacterDatabase.Query("SELECT guid, deleteInfos_Name, deleteInfos_Account, deleteDate FROM characters WHERE deleteDate IS NOT NULL");
|
resultChar = CharacterDatabase.Query("SELECT `guid`, `deleteInfos_Name`, `deleteInfos_Account`, `deleteDate` FROM `characters` WHERE `deleteDate` IS NOT NULL");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (resultChar)
|
if (resultChar)
|
||||||
|
|
@ -277,7 +277,7 @@ void ChatHandler::HandleCharacterDeletedRestoreHelper(DeletedInfo const& delInfo
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CharacterDatabase.PExecute("UPDATE characters SET name='%s', account='%u', deleteDate=NULL, deleteInfos_Name=NULL, deleteInfos_Account=NULL WHERE deleteDate IS NOT NULL AND guid = %u",
|
CharacterDatabase.PExecute("UPDATE `characters` SET `name`='%s', `account`='%u', `deleteDate`=NULL, `deleteInfos_Name`=NULL, `deleteInfos_Account`=NULL WHERE `deleteDate` IS NOT NULL AND `guid` = %u",
|
||||||
delInfo.name.c_str(), delInfo.accountId, delInfo.lowguid);
|
delInfo.name.c_str(), delInfo.accountId, delInfo.lowguid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -489,7 +489,7 @@ bool ChatHandler::HandleAccountOnlineListCommand(char* args)
|
||||||
|
|
||||||
///- Get the list of accounts ID logged to the realm
|
///- Get the list of accounts ID logged to the realm
|
||||||
// 0 1 2 3 4
|
// 0 1 2 3 4
|
||||||
QueryResult* result = LoginDatabase.PQuery("SELECT id, username, last_ip, gmlevel, expansion FROM account WHERE active_realm_id = %u", realmID);
|
QueryResult* result = LoginDatabase.PQuery("SELECT `id`, `username`, `last_ip`, `gmlevel`, `expansion` FROM `account` WHERE `active_realm_id` = %u", realmID);
|
||||||
|
|
||||||
return ShowAccountListHelper(result, &limit);
|
return ShowAccountListHelper(result, &limit);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -175,7 +175,7 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction)
|
||||||
|
|
||||||
// set owner to bidder (to prevent delete item with sender char deleting)
|
// set owner to bidder (to prevent delete item with sender char deleting)
|
||||||
// owner in `data` will set at mail receive and item extracting
|
// owner in `data` will set at mail receive and item extracting
|
||||||
CharacterDatabase.PExecute("UPDATE item_instance SET owner_guid = '%u' WHERE guid='%u'", auction->bidder, auction->itemGuidLow);
|
CharacterDatabase.PExecute("UPDATE `item_instance` SET `owner_guid` = '%u' WHERE `guid`='%u'", auction->bidder, auction->itemGuidLow);
|
||||||
|
|
||||||
if (bidder)
|
if (bidder)
|
||||||
{
|
{
|
||||||
|
|
@ -195,7 +195,7 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction)
|
||||||
// receiver not exist
|
// receiver not exist
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CharacterDatabase.PExecute("DELETE FROM item_instance WHERE guid='%u'", auction->itemGuidLow);
|
CharacterDatabase.PExecute("DELETE FROM `item_instance` WHERE `guid`='%u'", auction->itemGuidLow);
|
||||||
RemoveAItem(auction->itemGuidLow); // we have to remove the item, before we delete it !!
|
RemoveAItem(auction->itemGuidLow); // we have to remove the item, before we delete it !!
|
||||||
auction->itemGuidLow = 0;
|
auction->itemGuidLow = 0;
|
||||||
delete pItem;
|
delete pItem;
|
||||||
|
|
@ -285,7 +285,7 @@ void AuctionHouseMgr::SendAuctionExpiredMail(AuctionEntry* auction)
|
||||||
// owner not found
|
// owner not found
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CharacterDatabase.PExecute("DELETE FROM item_instance WHERE guid='%u'", auction->itemGuidLow);
|
CharacterDatabase.PExecute("DELETE FROM `item_instance` WHERE `guid`='%u'", auction->itemGuidLow);
|
||||||
RemoveAItem(auction->itemGuidLow); // we have to remove the item, before we delete it !!
|
RemoveAItem(auction->itemGuidLow); // we have to remove the item, before we delete it !!
|
||||||
auction->itemGuidLow = 0;
|
auction->itemGuidLow = 0;
|
||||||
delete pItem;
|
delete pItem;
|
||||||
|
|
@ -295,7 +295,7 @@ void AuctionHouseMgr::SendAuctionExpiredMail(AuctionEntry* auction)
|
||||||
void AuctionHouseMgr::LoadAuctionItems()
|
void AuctionHouseMgr::LoadAuctionItems()
|
||||||
{
|
{
|
||||||
// data needs to be at first place for Item::LoadFromDB 0 1 2 3
|
// data needs to be at first place for Item::LoadFromDB 0 1 2 3
|
||||||
QueryResult* result = CharacterDatabase.Query("SELECT data,text,itemguid,item_template FROM auction JOIN item_instance ON itemguid = guid");
|
QueryResult* result = CharacterDatabase.Query("SELECT `data`,`text`,`itemguid`,`item_template` FROM `auction` JOIN `item_instance` ON `itemguid` = `guid`");
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
|
|
@ -347,7 +347,7 @@ void AuctionHouseMgr::LoadAuctionItems()
|
||||||
|
|
||||||
void AuctionHouseMgr::LoadAuctions()
|
void AuctionHouseMgr::LoadAuctions()
|
||||||
{
|
{
|
||||||
QueryResult* result = CharacterDatabase.Query("SELECT COUNT(*) FROM auction");
|
QueryResult* result = CharacterDatabase.Query("SELECT COUNT(*) FROM `auction`");
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
BarGoLink bar(1);
|
BarGoLink bar(1);
|
||||||
|
|
@ -370,7 +370,8 @@ void AuctionHouseMgr::LoadAuctions()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = CharacterDatabase.Query("SELECT id,houseid,itemguid,item_template,item_count,item_randompropertyid,itemowner,buyoutprice,time,moneyTime,buyguid,lastbid,startbid,deposit FROM auction");
|
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13
|
||||||
|
result = CharacterDatabase.Query("SELECT `id`,`houseid`,`itemguid`,`item_template`,`item_count`,`item_randompropertyid`,`itemowner`,`buyoutprice`,`time`,`moneyTime`,`buyguid`,`lastbid`,`startbid`,`deposit` FROM `auction`");
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
BarGoLink bar(1);
|
BarGoLink bar(1);
|
||||||
|
|
@ -449,7 +450,7 @@ void AuctionHouseMgr::LoadAuctions()
|
||||||
auction->itemRandomPropertyId = pItem->GetItemRandomPropertyId();
|
auction->itemRandomPropertyId = pItem->GetItemRandomPropertyId();
|
||||||
|
|
||||||
// No SQL injection (no strings)
|
// No SQL injection (no strings)
|
||||||
CharacterDatabase.PExecute("UPDATE auction SET item_template = %u, item_count = %u, item_randompropertyid = %i WHERE itemguid = %u",
|
CharacterDatabase.PExecute("UPDATE `auction` SET `item_template` = %u, `item_count` = %u, `item_randompropertyid` = %i WHERE `itemguid` = %u",
|
||||||
auction->itemTemplate, auction->itemCount, auction->itemRandomPropertyId, auction->itemGuidLow);
|
auction->itemTemplate, auction->itemCount, auction->itemRandomPropertyId, auction->itemGuidLow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1098,13 +1099,13 @@ uint64 AuctionEntry::GetAuctionOutBid() const
|
||||||
void AuctionEntry::DeleteFromDB() const
|
void AuctionEntry::DeleteFromDB() const
|
||||||
{
|
{
|
||||||
// No SQL injection (Id is integer)
|
// No SQL injection (Id is integer)
|
||||||
CharacterDatabase.PExecute("DELETE FROM auction WHERE id = '%u'", Id);
|
CharacterDatabase.PExecute("DELETE FROM `auction` WHERE `id` = '%u'", Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AuctionEntry::SaveToDB() const
|
void AuctionEntry::SaveToDB() const
|
||||||
{
|
{
|
||||||
// No SQL injection (no strings)
|
// No SQL injection (no strings)
|
||||||
CharacterDatabase.PExecute("INSERT INTO auction (id,houseid,itemguid,item_template,item_count,item_randompropertyid,itemowner,buyoutprice,time,moneyTime,buyguid,lastbid,startbid,deposit) "
|
CharacterDatabase.PExecute("INSERT INTO `auction` (`id`,`houseid`,`itemguid`,`item_template`,`item_count`,`item_randompropertyid`,`itemowner`,`buyoutprice`,`time`,`moneyTime`,`buyguid`,`lastbid`,`startbid`,`deposit`) "
|
||||||
"VALUES ('%u', '%u', '%u', '%u', '%u', '%i', '%u', '" UI64FMTD "', '" UI64FMTD "', '" UI64FMTD "', '%u', '" UI64FMTD "', '" UI64FMTD "', '" UI64FMTD "')",
|
"VALUES ('%u', '%u', '%u', '%u', '%u', '%i', '%u', '" UI64FMTD "', '" UI64FMTD "', '" UI64FMTD "', '%u', '" UI64FMTD "', '" UI64FMTD "', '" UI64FMTD "')",
|
||||||
Id, auctionHouseEntry->houseId, itemGuidLow, itemTemplate, itemCount, itemRandomPropertyId, owner, buyout, (uint64)expireTime, (uint64)moneyDeliveryTime, bidder, bid, startbid, deposit);
|
Id, auctionHouseEntry->houseId, itemGuidLow, itemTemplate, itemCount, itemRandomPropertyId, owner, buyout, (uint64)expireTime, (uint64)moneyDeliveryTime, bidder, bid, startbid, deposit);
|
||||||
}
|
}
|
||||||
|
|
@ -1159,7 +1160,7 @@ bool AuctionEntry::UpdateBid(uint64 newbid, Player* newbidder /*=NULL*/)
|
||||||
|
|
||||||
// after this update we should save player's money ...
|
// after this update we should save player's money ...
|
||||||
CharacterDatabase.BeginTransaction();
|
CharacterDatabase.BeginTransaction();
|
||||||
CharacterDatabase.PExecute("UPDATE auction SET buyguid = '%u', lastbid = '" UI64FMTD "' WHERE id = '%u'", bidder, bid, Id);
|
CharacterDatabase.PExecute("UPDATE `auction` SET `buyguid` = '%u', `lastbid` = '" UI64FMTD "' WHERE `id` = '%u'", bidder, bid, Id);
|
||||||
if (newbidder)
|
if (newbidder)
|
||||||
{
|
{
|
||||||
newbidder->SaveInventoryAndGoldToDB();
|
newbidder->SaveInventoryAndGoldToDB();
|
||||||
|
|
|
||||||
|
|
@ -115,7 +115,7 @@ void Corpse::SaveToDB()
|
||||||
DeleteFromDB();
|
DeleteFromDB();
|
||||||
|
|
||||||
std::ostringstream ss;
|
std::ostringstream ss;
|
||||||
ss << "INSERT INTO corpse (guid,player,position_x,position_y,position_z,orientation,map,time,corpse_type,instance,phaseMask) VALUES ("
|
ss << "INSERT INTO `corpse` (`guid`,`player`,`position_x`,`position_y`,`position_z`,`orientation`,`map`,`time`,`corpse_type`,`instance`,`phaseMask`) VALUES ("
|
||||||
<< GetGUIDLow() << ", "
|
<< GetGUIDLow() << ", "
|
||||||
<< GetOwnerGuid().GetCounter() << ", "
|
<< GetOwnerGuid().GetCounter() << ", "
|
||||||
<< GetPositionX() << ", "
|
<< GetPositionX() << ", "
|
||||||
|
|
@ -153,7 +153,7 @@ void Corpse::DeleteFromDB()
|
||||||
// all corpses (not bones)
|
// all corpses (not bones)
|
||||||
static SqlStatementID id;
|
static SqlStatementID id;
|
||||||
|
|
||||||
SqlStatement stmt = CharacterDatabase.CreateStatement(id, "DELETE FROM corpse WHERE player = ? AND corpse_type <> '0'");
|
SqlStatement stmt = CharacterDatabase.CreateStatement(id, "DELETE FROM `corpse` WHERE `player` = ? AND `corpse_type` <> '0'");
|
||||||
stmt.PExecute(GetOwnerGuid().GetCounter());
|
stmt.PExecute(GetOwnerGuid().GetCounter());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1365,10 +1365,10 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)
|
||||||
// updated in DB
|
// updated in DB
|
||||||
WorldDatabase.BeginTransaction();
|
WorldDatabase.BeginTransaction();
|
||||||
|
|
||||||
WorldDatabase.PExecuteLog("DELETE FROM creature WHERE guid=%u", GetGUIDLow());
|
WorldDatabase.PExecuteLog("DELETE FROM `creature` WHERE `guid`=%u", GetGUIDLow());
|
||||||
|
|
||||||
std::ostringstream ss;
|
std::ostringstream ss;
|
||||||
ss << "INSERT INTO creature VALUES ("
|
ss << "INSERT INTO `creature` VALUES ("
|
||||||
<< GetGUIDLow() << ","
|
<< GetGUIDLow() << ","
|
||||||
<< data.id << ","
|
<< data.id << ","
|
||||||
<< data.mapid << ","
|
<< data.mapid << ","
|
||||||
|
|
@ -1907,13 +1907,13 @@ void Creature::DeleteFromDB(uint32 lowguid, CreatureData const* data)
|
||||||
sObjectMgr.DeleteCreatureData(lowguid);
|
sObjectMgr.DeleteCreatureData(lowguid);
|
||||||
|
|
||||||
WorldDatabase.BeginTransaction();
|
WorldDatabase.BeginTransaction();
|
||||||
WorldDatabase.PExecuteLog("DELETE FROM creature WHERE guid=%u", lowguid);
|
WorldDatabase.PExecuteLog("DELETE FROM `creature` WHERE `guid`=%u", lowguid);
|
||||||
WorldDatabase.PExecuteLog("DELETE FROM creature_addon WHERE guid=%u", lowguid);
|
WorldDatabase.PExecuteLog("DELETE FROM `creature_addon` WHERE `guid`=%u", lowguid);
|
||||||
WorldDatabase.PExecuteLog("DELETE FROM creature_movement WHERE id=%u", lowguid);
|
WorldDatabase.PExecuteLog("DELETE FROM `creature_movement` WHERE `id`=%u", lowguid);
|
||||||
WorldDatabase.PExecuteLog("DELETE FROM game_event_creature WHERE guid=%u", lowguid);
|
WorldDatabase.PExecuteLog("DELETE FROM `game_event_creature` WHERE `guid`=%u", lowguid);
|
||||||
WorldDatabase.PExecuteLog("DELETE FROM game_event_creature_data WHERE guid=%u", lowguid);
|
WorldDatabase.PExecuteLog("DELETE FROM `game_event_creature_data` WHERE `guid`=%u", lowguid);
|
||||||
WorldDatabase.PExecuteLog("DELETE FROM creature_battleground WHERE guid=%u", lowguid);
|
WorldDatabase.PExecuteLog("DELETE FROM `creature_battleground` WHERE `guid`=%u", lowguid);
|
||||||
WorldDatabase.PExecuteLog("DELETE FROM creature_linking WHERE guid=%u OR master_guid=%u", lowguid, lowguid);
|
WorldDatabase.PExecuteLog("DELETE FROM `creature_linking` WHERE `guid`=%u OR `master_guid`=%u", lowguid, lowguid);
|
||||||
WorldDatabase.CommitTransaction();
|
WorldDatabase.CommitTransaction();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -177,7 +177,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Summons(bool check_entry_use)
|
||||||
m_CreatureEventAI_Summon_Map.clear();
|
m_CreatureEventAI_Summon_Map.clear();
|
||||||
|
|
||||||
// Gather additional data for EventAI
|
// Gather additional data for EventAI
|
||||||
QueryResult* result = WorldDatabase.Query("SELECT id, position_x, position_y, position_z, orientation, spawntimesecs FROM creature_ai_summons");
|
QueryResult* result = WorldDatabase.Query("SELECT `id`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs` FROM `creature_ai_summons`");
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
BarGoLink bar(result->GetRowCount());
|
BarGoLink bar(result->GetRowCount());
|
||||||
|
|
@ -272,12 +272,12 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
|
||||||
std::set<int32> usedTextIds;
|
std::set<int32> usedTextIds;
|
||||||
|
|
||||||
// Gather event data
|
// Gather event data
|
||||||
QueryResult* result = WorldDatabase.Query("SELECT id, creature_id, event_type, event_inverse_phase_mask, event_chance, event_flags, "
|
QueryResult* result = WorldDatabase.Query("SELECT `id`, `creature_id`, `event_type`, `event_inverse_phase_mask`, `event_chance`, `event_flags`, "
|
||||||
"event_param1, event_param2, event_param3, event_param4, "
|
"`event_param1`, `event_param2`, `event_param3`, `event_param4`, "
|
||||||
"action1_type, action1_param1, action1_param2, action1_param3, "
|
"`action1_type`, `action1_param1`, `action1_param2`, `action1_param3`, "
|
||||||
"action2_type, action2_param1, action2_param2, action2_param3, "
|
"`action2_type`, `action2_param1`, `action2_param2`, `action2_param3`, "
|
||||||
"action3_type, action3_param1, action3_param2, action3_param3 "
|
"`action3_type`, `action3_param1`, `action3_param2`, `action3_param3` "
|
||||||
"FROM creature_ai_scripts");
|
"FROM `creature_ai_scripts`");
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
BarGoLink bar(result->GetRowCount());
|
BarGoLink bar(result->GetRowCount());
|
||||||
|
|
|
||||||
|
|
@ -40,9 +40,9 @@ void GMTicketMgr::LoadGMTickets()
|
||||||
|
|
||||||
QueryResult* result = CharacterDatabase.Query(
|
QueryResult* result = CharacterDatabase.Query(
|
||||||
// 0 1 2 3 4
|
// 0 1 2 3 4
|
||||||
"SELECT guid, ticket_text, response_text, UNIX_TIMESTAMP(ticket_lastchange), ticket_id "
|
"SELECT `guid`, `ticket_text`, `response_text`, UNIX_TIMESTAMP(`ticket_lastchange`), `ticket_id` "
|
||||||
"FROM character_ticket "
|
"FROM `character_ticket` "
|
||||||
"ORDER BY ticket_id ASC");
|
"ORDER BY `ticket_id` ASC");
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
|
|
@ -95,7 +95,7 @@ void GMTicketMgr::DeleteAll()
|
||||||
owner->GetSession()->SendGMTicketGetTicket(0x0A);
|
owner->GetSession()->SendGMTicketGetTicket(0x0A);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CharacterDatabase.Execute("DELETE FROM character_ticket");
|
CharacterDatabase.Execute("DELETE FROM `character_ticket`");
|
||||||
m_GMTicketListByCreatingOrder.clear();
|
m_GMTicketListByCreatingOrder.clear();
|
||||||
m_GMTicketMap.clear();
|
m_GMTicketMap.clear();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -669,7 +669,7 @@ void GameObject::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)
|
||||||
|
|
||||||
// updated in DB
|
// updated in DB
|
||||||
std::ostringstream ss;
|
std::ostringstream ss;
|
||||||
ss << "INSERT INTO gameobject VALUES ( "
|
ss << "INSERT INTO `gameobject` VALUES ( "
|
||||||
<< GetGUIDLow() << ", "
|
<< GetGUIDLow() << ", "
|
||||||
<< GetEntry() << ", "
|
<< GetEntry() << ", "
|
||||||
<< mapid << ", "
|
<< mapid << ", "
|
||||||
|
|
@ -688,7 +688,7 @@ void GameObject::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)
|
||||||
<< uint32(GetGoState()) << ")";
|
<< uint32(GetGoState()) << ")";
|
||||||
|
|
||||||
WorldDatabase.BeginTransaction();
|
WorldDatabase.BeginTransaction();
|
||||||
WorldDatabase.PExecuteLog("DELETE FROM gameobject WHERE guid = '%u'", GetGUIDLow());
|
WorldDatabase.PExecuteLog("DELETE FROM `gameobject` WHERE `guid` = '%u'", GetGUIDLow());
|
||||||
WorldDatabase.PExecuteLog("%s", ss.str().c_str());
|
WorldDatabase.PExecuteLog("%s", ss.str().c_str());
|
||||||
WorldDatabase.CommitTransaction();
|
WorldDatabase.CommitTransaction();
|
||||||
}
|
}
|
||||||
|
|
@ -778,9 +778,9 @@ void GameObject::DeleteFromDB()
|
||||||
sMapPersistentStateMgr.DoForAllStatesWithMapId(GetMapId(), worker);
|
sMapPersistentStateMgr.DoForAllStatesWithMapId(GetMapId(), worker);
|
||||||
|
|
||||||
sObjectMgr.DeleteGOData(GetGUIDLow());
|
sObjectMgr.DeleteGOData(GetGUIDLow());
|
||||||
WorldDatabase.PExecuteLog("DELETE FROM gameobject WHERE guid = '%u'", GetGUIDLow());
|
WorldDatabase.PExecuteLog("DELETE FROM `gameobject` WHERE `guid` = '%u'", GetGUIDLow());
|
||||||
WorldDatabase.PExecuteLog("DELETE FROM game_event_gameobject WHERE guid = '%u'", GetGUIDLow());
|
WorldDatabase.PExecuteLog("DELETE FROM `game_event_gameobject` WHERE `guid` = '%u'", GetGUIDLow());
|
||||||
WorldDatabase.PExecuteLog("DELETE FROM gameobject_battleground WHERE guid = '%u'", GetGUIDLow());
|
WorldDatabase.PExecuteLog("DELETE FROM `gameobject_battleground` WHERE `guid` = '%u'", GetGUIDLow());
|
||||||
}
|
}
|
||||||
|
|
||||||
GameObjectInfo const* GameObject::GetGOInfo() const
|
GameObjectInfo const* GameObject::GetGOInfo() const
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ void MemberSlot::SetPNOTE(std::string pnote)
|
||||||
|
|
||||||
// pnote now can be used for encoding to DB
|
// pnote now can be used for encoding to DB
|
||||||
CharacterDatabase.escape_string(pnote);
|
CharacterDatabase.escape_string(pnote);
|
||||||
CharacterDatabase.PExecute("UPDATE guild_member SET pnote = '%s' WHERE guid = '%u'", pnote.c_str(), guid.GetCounter());
|
CharacterDatabase.PExecute("UPDATE `guild_member` SET `pnote` = '%s' WHERE `guid` = '%u'", pnote.c_str(), guid.GetCounter());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MemberSlot::SetOFFNOTE(std::string offnote)
|
void MemberSlot::SetOFFNOTE(std::string offnote)
|
||||||
|
|
@ -69,7 +69,7 @@ void MemberSlot::SetOFFNOTE(std::string offnote)
|
||||||
|
|
||||||
// offnote now can be used for encoding to DB
|
// offnote now can be used for encoding to DB
|
||||||
CharacterDatabase.escape_string(offnote);
|
CharacterDatabase.escape_string(offnote);
|
||||||
CharacterDatabase.PExecute("UPDATE guild_member SET offnote = '%s' WHERE guid = '%u'", offnote.c_str(), guid.GetCounter());
|
CharacterDatabase.PExecute("UPDATE `guild_member` SET `offnote` = '%s' WHERE `guid` = '%u'", offnote.c_str(), guid.GetCounter());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MemberSlot::ChangeRank(uint32 newRank)
|
void MemberSlot::ChangeRank(uint32 newRank)
|
||||||
|
|
@ -83,7 +83,7 @@ void MemberSlot::ChangeRank(uint32 newRank)
|
||||||
player->SetRank(newRank);
|
player->SetRank(newRank);
|
||||||
}
|
}
|
||||||
|
|
||||||
CharacterDatabase.PExecute("UPDATE guild_member SET rank='%u' WHERE guid='%u'", newRank, guid.GetCounter());
|
CharacterDatabase.PExecute("UPDATE `guild_member` SET `rank`='%u' WHERE `guid`='%u'", newRank, guid.GetCounter());
|
||||||
}
|
}
|
||||||
|
|
||||||
//// Guild /////////////////////////////////////////////////
|
//// Guild /////////////////////////////////////////////////
|
||||||
|
|
@ -150,9 +150,9 @@ bool Guild::Create(Player* leader, std::string gname)
|
||||||
CharacterDatabase.escape_string(dbMOTD);
|
CharacterDatabase.escape_string(dbMOTD);
|
||||||
|
|
||||||
CharacterDatabase.BeginTransaction();
|
CharacterDatabase.BeginTransaction();
|
||||||
// CharacterDatabase.PExecute("DELETE FROM guild WHERE guildid='%u'", Id); - MAX(guildid)+1 not exist
|
// CharacterDatabase.PExecute("DELETE FROM `guild` WHERE `guildid`='%u'", Id); - MAX(guildid)+1 not exist
|
||||||
CharacterDatabase.PExecute("DELETE FROM guild_member WHERE guildid='%u'", m_Id);
|
CharacterDatabase.PExecute("DELETE FROM `guild_member` WHERE `guildid`='%u'", m_Id);
|
||||||
CharacterDatabase.PExecute("INSERT INTO guild (guildid,name,leaderguid,info,motd,createdate,EmblemStyle,EmblemColor,BorderStyle,BorderColor,BackgroundColor,BankMoney) "
|
CharacterDatabase.PExecute("INSERT INTO `guild` (`guildid`,`name`,`leaderguid`,`info`,`motd`,`createdate`,`EmblemStyle`,`EmblemColor`,`BorderStyle`,`BorderColor`,`BackgroundColor`,`BankMoney`) "
|
||||||
"VALUES('%u','%s','%u', '%s', '%s','" UI64FMTD "','%u','%u','%u','%u','%u','" UI64FMTD "')",
|
"VALUES('%u','%s','%u', '%s', '%s','" UI64FMTD "','%u','%u','%u','%u','%u','" UI64FMTD "')",
|
||||||
m_Id, gname.c_str(), m_LeaderGuid.GetCounter(), dbGINFO.c_str(), dbMOTD.c_str(), uint64(m_CreatedDate), m_EmblemStyle, m_EmblemColor, m_BorderStyle, m_BorderColor, m_BackgroundColor, m_GuildBankMoney);
|
m_Id, gname.c_str(), m_LeaderGuid.GetCounter(), dbGINFO.c_str(), dbMOTD.c_str(), uint64(m_CreatedDate), m_EmblemStyle, m_EmblemColor, m_BorderStyle, m_BorderColor, m_BackgroundColor, m_GuildBankMoney);
|
||||||
CharacterDatabase.CommitTransaction();
|
CharacterDatabase.CommitTransaction();
|
||||||
|
|
@ -169,8 +169,8 @@ bool Guild::Create(Player* leader, std::string gname)
|
||||||
|
|
||||||
void Guild::CreateDefaultGuildRanks(int locale_idx)
|
void Guild::CreateDefaultGuildRanks(int locale_idx)
|
||||||
{
|
{
|
||||||
CharacterDatabase.PExecute("DELETE FROM guild_rank WHERE guildid='%u'", m_Id);
|
CharacterDatabase.PExecute("DELETE FROM `guild_rank` WHERE `guildid`='%u'", m_Id);
|
||||||
CharacterDatabase.PExecute("DELETE FROM guild_bank_right WHERE guildid = '%u'", m_Id);
|
CharacterDatabase.PExecute("DELETE FROM `guild_bank_right` WHERE `guildid` = '%u'", m_Id);
|
||||||
|
|
||||||
CreateRank(sObjectMgr.GetMangosString(LANG_GUILD_MASTER, locale_idx), GR_RIGHT_ALL);
|
CreateRank(sObjectMgr.GetMangosString(LANG_GUILD_MASTER, locale_idx), GR_RIGHT_ALL);
|
||||||
CreateRank(sObjectMgr.GetMangosString(LANG_GUILD_OFFICER, locale_idx), GR_RIGHT_ALL);
|
CreateRank(sObjectMgr.GetMangosString(LANG_GUILD_OFFICER, locale_idx), GR_RIGHT_ALL);
|
||||||
|
|
@ -221,7 +221,7 @@ bool Guild::AddMember(ObjectGuid plGuid, uint32 plRank)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// 0 1 2 3 4
|
// 0 1 2 3 4
|
||||||
QueryResult* result = CharacterDatabase.PQuery("SELECT name,level,class,zone,account FROM characters WHERE guid = '%u'", lowguid);
|
QueryResult* result = CharacterDatabase.PQuery("SELECT `name`,`level`,`class`,`zone`,`account` FROM `characters` WHERE `guid` = '%u'", lowguid);
|
||||||
if (!result)
|
if (!result)
|
||||||
{ return false; } // player doesn't exist
|
{ return false; } // player doesn't exist
|
||||||
|
|
||||||
|
|
@ -257,7 +257,7 @@ bool Guild::AddMember(ObjectGuid plGuid, uint32 plRank)
|
||||||
CharacterDatabase.escape_string(dbPnote);
|
CharacterDatabase.escape_string(dbPnote);
|
||||||
CharacterDatabase.escape_string(dbOFFnote);
|
CharacterDatabase.escape_string(dbOFFnote);
|
||||||
|
|
||||||
CharacterDatabase.PExecute("INSERT INTO guild_member (guildid,guid,rank,pnote,offnote) VALUES ('%u', '%u', '%u','%s','%s')",
|
CharacterDatabase.PExecute("INSERT INTO `guild_member` (`guildid`,`guid`,`rank`,`pnote`,`offnote`) VALUES ('%u', '%u', '%u','%s','%s')",
|
||||||
m_Id, lowguid, newmember.RankId, dbPnote.c_str(), dbOFFnote.c_str());
|
m_Id, lowguid, newmember.RankId, dbPnote.c_str(), dbOFFnote.c_str());
|
||||||
|
|
||||||
// If player not in game data in data field will be loaded from guild tables, no need to update it!!
|
// If player not in game data in data field will be loaded from guild tables, no need to update it!!
|
||||||
|
|
@ -285,7 +285,7 @@ void Guild::SetMOTD(std::string motd)
|
||||||
|
|
||||||
// motd now can be used for encoding to DB
|
// motd now can be used for encoding to DB
|
||||||
CharacterDatabase.escape_string(motd);
|
CharacterDatabase.escape_string(motd);
|
||||||
CharacterDatabase.PExecute("UPDATE guild SET motd='%s' WHERE guildid='%u'", motd.c_str(), m_Id);
|
CharacterDatabase.PExecute("UPDATE `guild` SET `motd`='%s' WHERE `guildid`='%u'", motd.c_str(), m_Id);
|
||||||
|
|
||||||
// Used by Eluna
|
// Used by Eluna
|
||||||
#ifdef ENABLE_ELUNA
|
#ifdef ENABLE_ELUNA
|
||||||
|
|
@ -299,7 +299,7 @@ void Guild::SetGINFO(std::string ginfo)
|
||||||
|
|
||||||
// ginfo now can be used for encoding to DB
|
// ginfo now can be used for encoding to DB
|
||||||
CharacterDatabase.escape_string(ginfo);
|
CharacterDatabase.escape_string(ginfo);
|
||||||
CharacterDatabase.PExecute("UPDATE guild SET info='%s' WHERE guildid='%u'", ginfo.c_str(), m_Id);
|
CharacterDatabase.PExecute("UPDATE `guild` SET `info`='%s' WHERE `guildid`='%u'", ginfo.c_str(), m_Id);
|
||||||
|
|
||||||
// Used by Eluna
|
// Used by Eluna
|
||||||
#ifdef ENABLE_ELUNA
|
#ifdef ENABLE_ELUNA
|
||||||
|
|
@ -404,7 +404,7 @@ bool Guild::LoadRanksFromDB(QueryResult* guildRanksResult)
|
||||||
{
|
{
|
||||||
// there is in table guild_rank record which doesn't have guildid in guild table, report error
|
// there is in table guild_rank record which doesn't have guildid in guild table, report error
|
||||||
sLog.outErrorDb("Guild %u does not exist but it has a record in guild_rank table, deleting it!", guildId);
|
sLog.outErrorDb("Guild %u does not exist but it has a record in guild_rank table, deleting it!", guildId);
|
||||||
CharacterDatabase.PExecute("DELETE FROM guild_rank WHERE guildid = '%u'", guildId);
|
CharacterDatabase.PExecute("DELETE FROM `guild_rank` WHERE `guildid` = '%u'", guildId);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -445,13 +445,13 @@ bool Guild::LoadRanksFromDB(QueryResult* guildRanksResult)
|
||||||
{
|
{
|
||||||
sLog.outError("Guild %u has broken `guild_rank` data, repairing...", m_Id);
|
sLog.outError("Guild %u has broken `guild_rank` data, repairing...", m_Id);
|
||||||
CharacterDatabase.BeginTransaction();
|
CharacterDatabase.BeginTransaction();
|
||||||
CharacterDatabase.PExecute("DELETE FROM guild_rank WHERE guildid='%u'", m_Id);
|
CharacterDatabase.PExecute("DELETE FROM `guild_rank` WHERE `guildid`='%u'", m_Id);
|
||||||
for (size_t i = 0; i < m_Ranks.size(); ++i)
|
for (size_t i = 0; i < m_Ranks.size(); ++i)
|
||||||
{
|
{
|
||||||
std::string name = m_Ranks[i].Name;
|
std::string name = m_Ranks[i].Name;
|
||||||
uint32 rights = m_Ranks[i].Rights;
|
uint32 rights = m_Ranks[i].Rights;
|
||||||
CharacterDatabase.escape_string(name);
|
CharacterDatabase.escape_string(name);
|
||||||
CharacterDatabase.PExecute("INSERT INTO guild_rank (guildid,rid,rname,rights) VALUES ('%u', '%u', '%s', '%u')", m_Id, uint32(i), name.c_str(), rights);
|
CharacterDatabase.PExecute("INSERT INTO `guild_rank` (`guildid`,`rid`,`rname`,`rights`) VALUES ('%u', '%u', '%s', '%u')", m_Id, uint32(i), name.c_str(), rights);
|
||||||
}
|
}
|
||||||
CharacterDatabase.CommitTransaction();
|
CharacterDatabase.CommitTransaction();
|
||||||
}
|
}
|
||||||
|
|
@ -479,7 +479,7 @@ bool Guild::LoadMembersFromDB(QueryResult* guildMembersResult)
|
||||||
{
|
{
|
||||||
// there is in table guild_member record which doesn't have guildid in guild table, report error
|
// there is in table guild_member record which doesn't have guildid in guild table, report error
|
||||||
sLog.outErrorDb("Guild %u does not exist but it has a record in guild_member table, deleting it!", guildId);
|
sLog.outErrorDb("Guild %u does not exist but it has a record in guild_member table, deleting it!", guildId);
|
||||||
CharacterDatabase.PExecute("DELETE FROM guild_member WHERE guildid = '%u'", guildId);
|
CharacterDatabase.PExecute("DELETE FROM `guild_member` WHERE `guildid` = '%u'", guildId);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -518,7 +518,7 @@ bool Guild::LoadMembersFromDB(QueryResult* guildMembersResult)
|
||||||
if (newmember.Level < 1 || newmember.Level > STRONG_MAX_LEVEL) // can be at broken `data` field
|
if (newmember.Level < 1 || newmember.Level > STRONG_MAX_LEVEL) // can be at broken `data` field
|
||||||
{
|
{
|
||||||
sLog.outError("%s has a broken data in field `characters`.`data`, deleting him from guild!", newmember.guid.GetString().c_str());
|
sLog.outError("%s has a broken data in field `characters`.`data`, deleting him from guild!", newmember.guid.GetString().c_str());
|
||||||
CharacterDatabase.PExecute("DELETE FROM guild_member WHERE guid = '%u'", lowguid);
|
CharacterDatabase.PExecute("DELETE FROM `guild_member` WHERE `guid` = '%u'", lowguid);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!newmember.ZoneId)
|
if (!newmember.ZoneId)
|
||||||
|
|
@ -531,7 +531,7 @@ bool Guild::LoadMembersFromDB(QueryResult* guildMembersResult)
|
||||||
if (!((1 << (newmember.Class - 1)) & CLASSMASK_ALL_PLAYABLE)) // can be at broken `class` field
|
if (!((1 << (newmember.Class - 1)) & CLASSMASK_ALL_PLAYABLE)) // can be at broken `class` field
|
||||||
{
|
{
|
||||||
sLog.outError("%s has a broken data in field `characters`.`class`, deleting him from guild!", newmember.guid.GetString().c_str());
|
sLog.outError("%s has a broken data in field `characters`.`class`, deleting him from guild!", newmember.guid.GetString().c_str());
|
||||||
CharacterDatabase.PExecute("DELETE FROM guild_member WHERE guid = '%u'", lowguid);
|
CharacterDatabase.PExecute("DELETE FROM `guild_member` WHERE `guid` = '%u'", lowguid);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -560,7 +560,7 @@ void Guild::SetLeader(ObjectGuid guid)
|
||||||
m_LeaderGuid = guid;
|
m_LeaderGuid = guid;
|
||||||
slot->ChangeRank(GR_GUILDMASTER);
|
slot->ChangeRank(GR_GUILDMASTER);
|
||||||
|
|
||||||
CharacterDatabase.PExecute("UPDATE guild SET leaderguid='%u' WHERE guildid='%u'", guid.GetCounter(), m_Id);
|
CharacterDatabase.PExecute("UPDATE `guild` SET `leaderguid`='%u' WHERE `guildid`='%u'", guid.GetCounter(), m_Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -629,7 +629,7 @@ bool Guild::DelMember(ObjectGuid guid, bool isDisbanding)
|
||||||
player->SetRank(0);
|
player->SetRank(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
CharacterDatabase.PExecute("DELETE FROM guild_member WHERE guid = '%u'", lowguid);
|
CharacterDatabase.PExecute("DELETE FROM `guild_member` WHERE `guid` = '%u'", lowguid);
|
||||||
|
|
||||||
if (!isDisbanding)
|
if (!isDisbanding)
|
||||||
{
|
{
|
||||||
|
|
@ -822,7 +822,7 @@ void Guild::CreateRank(std::string name_, uint32 rights)
|
||||||
}
|
}
|
||||||
// name now can be used for encoding to DB
|
// name now can be used for encoding to DB
|
||||||
CharacterDatabase.escape_string(name_);
|
CharacterDatabase.escape_string(name_);
|
||||||
CharacterDatabase.PExecute("INSERT INTO guild_rank (guildid,rid,rname,rights) VALUES ('%u', '%u', '%s', '%u')", m_Id, new_rank_id, name_.c_str(), rights);
|
CharacterDatabase.PExecute("INSERT INTO `guild_rank` (`guildid`,`rid`,`rname`,`rights`) VALUES ('%u', '%u', '%s', '%u')", m_Id, new_rank_id, name_.c_str(), rights);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Guild::AddRank(const std::string& name_, uint32 rights, uint32 money)
|
void Guild::AddRank(const std::string& name_, uint32 rights, uint32 money)
|
||||||
|
|
@ -846,10 +846,10 @@ void Guild::DelRank(uint32 rankId)
|
||||||
RankList::iterator itr = m_Ranks.erase(m_Ranks.begin() + rankId);
|
RankList::iterator itr = m_Ranks.erase(m_Ranks.begin() + rankId);
|
||||||
// delete lowest guild_rank
|
// delete lowest guild_rank
|
||||||
CharacterDatabase.BeginTransaction();
|
CharacterDatabase.BeginTransaction();
|
||||||
CharacterDatabase.PExecute("DELETE FROM guild_rank WHERE rid ='%u' AND guildid='%u'", rankId, m_Id);
|
CharacterDatabase.PExecute("DELETE FROM `guild_rank` WHERE `rid` ='%u' AND `guildid` ='%u'", rankId, m_Id);
|
||||||
CharacterDatabase.PExecute("DELETE FROM guild_bank_right WHERE rid ='%u' AND guildid='%u'", rankId, m_Id);
|
CharacterDatabase.PExecute("DELETE FROM `guild_bank_right` WHERE `rid` ='%u' AND `guildid` ='%u'", rankId, m_Id);
|
||||||
CharacterDatabase.PExecute("UPDATE guild_rank SET rid = rid - 1 WHERE rid > '%u' AND guildid='%u'", rankId, m_Id);
|
CharacterDatabase.PExecute("UPDATE `guild_rank` SET `rid` = `rid` - 1 WHERE `rid` > '%u' AND `guildid` ='%u'", rankId, m_Id);
|
||||||
CharacterDatabase.PExecute("UPDATE guild_bank_right SET rid = rid - 1 WHERE rid > '%u' AND guildid='%u'", rankId, m_Id);
|
CharacterDatabase.PExecute("UPDATE `guild_bank_right` SET `rid` = `rid` - 1 WHERE `rid` > '%u' AND `guildid` ='%u'", rankId, m_Id);
|
||||||
CharacterDatabase.CommitTransaction();
|
CharacterDatabase.CommitTransaction();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -924,7 +924,7 @@ void Guild::SetRankName(uint32 rankId, std::string name_)
|
||||||
|
|
||||||
// name now can be used for encoding to DB
|
// name now can be used for encoding to DB
|
||||||
CharacterDatabase.escape_string(name_);
|
CharacterDatabase.escape_string(name_);
|
||||||
CharacterDatabase.PExecute("UPDATE guild_rank SET rname='%s' WHERE rid='%u' AND guildid='%u'", name_.c_str(), rankId, m_Id);
|
CharacterDatabase.PExecute("UPDATE `guild_rank` SET `rname`='%s' WHERE `rid`='%u' AND `guildid`='%u'", name_.c_str(), rankId, m_Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Guild::SetRankRights(uint32 rankId, uint32 rights)
|
void Guild::SetRankRights(uint32 rankId, uint32 rights)
|
||||||
|
|
@ -936,7 +936,7 @@ void Guild::SetRankRights(uint32 rankId, uint32 rights)
|
||||||
|
|
||||||
m_Ranks[rankId].Rights = rights;
|
m_Ranks[rankId].Rights = rights;
|
||||||
|
|
||||||
CharacterDatabase.PExecute("UPDATE guild_rank SET rights='%u' WHERE rid='%u' AND guildid='%u'", rights, rankId, m_Id);
|
CharacterDatabase.PExecute("UPDATE `guild_rank` SET `rights`='%u' WHERE `rid`='%u' AND `guildid`='%u'", rights, rankId, m_Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -955,17 +955,17 @@ void Guild::Disband()
|
||||||
}
|
}
|
||||||
|
|
||||||
CharacterDatabase.BeginTransaction();
|
CharacterDatabase.BeginTransaction();
|
||||||
CharacterDatabase.PExecute("DELETE FROM guild WHERE guildid = '%u'", m_Id);
|
CharacterDatabase.PExecute("DELETE FROM `guild` WHERE `guildid` = '%u'", m_Id);
|
||||||
CharacterDatabase.PExecute("DELETE FROM guild_rank WHERE guildid = '%u'", m_Id);
|
CharacterDatabase.PExecute("DELETE FROM `guild_rank` WHERE `guildid` = '%u'", m_Id);
|
||||||
CharacterDatabase.PExecute("DELETE FROM guild_bank_tab WHERE guildid = '%u'", m_Id);
|
CharacterDatabase.PExecute("DELETE FROM `guild_bank_tab` WHERE `guildid` = '%u'", m_Id);
|
||||||
|
|
||||||
// Free bank tab used memory and delete items stored in them
|
// Free bank tab used memory and delete items stored in them
|
||||||
DeleteGuildBankItems(true);
|
DeleteGuildBankItems(true);
|
||||||
|
|
||||||
CharacterDatabase.PExecute("DELETE FROM guild_bank_item WHERE guildid = '%u'", m_Id);
|
CharacterDatabase.PExecute("DELETE FROM `guild_bank_item` WHERE `guildid` = '%u'", m_Id);
|
||||||
CharacterDatabase.PExecute("DELETE FROM guild_bank_right WHERE guildid = '%u'", m_Id);
|
CharacterDatabase.PExecute("DELETE FROM `guild_bank_right` WHERE `guildid` = '%u'", m_Id);
|
||||||
CharacterDatabase.PExecute("DELETE FROM guild_bank_eventlog WHERE guildid = '%u'", m_Id);
|
CharacterDatabase.PExecute("DELETE FROM `guild_bank_eventlog` WHERE `guildid` = '%u'", m_Id);
|
||||||
CharacterDatabase.PExecute("DELETE FROM guild_eventlog WHERE guildid = '%u'", m_Id);
|
CharacterDatabase.PExecute("DELETE FROM `guild_eventlog` WHERE `guildid` = '%u'", m_Id);
|
||||||
CharacterDatabase.CommitTransaction();
|
CharacterDatabase.CommitTransaction();
|
||||||
|
|
||||||
// Used by Eluna
|
// Used by Eluna
|
||||||
|
|
@ -1154,7 +1154,7 @@ void Guild::SetEmblem(uint32 emblemStyle, uint32 emblemColor, uint32 borderStyle
|
||||||
m_BorderColor = borderColor;
|
m_BorderColor = borderColor;
|
||||||
m_BackgroundColor = backgroundColor;
|
m_BackgroundColor = backgroundColor;
|
||||||
|
|
||||||
CharacterDatabase.PExecute("UPDATE guild SET EmblemStyle=%u, EmblemColor=%u, BorderStyle=%u, BorderColor=%u, BackgroundColor=%u WHERE guildid = %u", m_EmblemStyle, m_EmblemColor, m_BorderStyle, m_BorderColor, m_BackgroundColor, m_Id);
|
CharacterDatabase.PExecute("UPDATE `guild` SET `EmblemStyle`=%u, `EmblemColor`=%u, `BorderStyle`=%u, `BorderColor`=%u, `BackgroundColor`=%u WHERE `guildid` = %u", m_EmblemStyle, m_EmblemColor, m_BorderStyle, m_BorderColor, m_BackgroundColor, m_Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -1209,7 +1209,7 @@ void Guild::DisplayGuildEventLog(WorldSession* session)
|
||||||
void Guild::LoadGuildEventLogFromDB()
|
void Guild::LoadGuildEventLogFromDB()
|
||||||
{
|
{
|
||||||
// 0 1 2 3 4 5
|
// 0 1 2 3 4 5
|
||||||
QueryResult* result = CharacterDatabase.PQuery("SELECT LogGuid, EventType, PlayerGuid1, PlayerGuid2, NewRank, TimeStamp FROM guild_eventlog WHERE guildid=%u ORDER BY TimeStamp DESC,LogGuid DESC LIMIT %u", m_Id, GUILD_EVENTLOG_MAX_RECORDS);
|
QueryResult* result = CharacterDatabase.PQuery("SELECT `LogGuid`, `EventType`, `PlayerGuid1`, `PlayerGuid2`, `NewRank`, `TimeStamp` FROM `guild_eventlog` WHERE `guildid`=%u ORDER BY `TimeStamp` DESC,`LogGuid` DESC LIMIT %u", m_Id, GUILD_EVENTLOG_MAX_RECORDS);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|
@ -1264,8 +1264,8 @@ void Guild::LogGuildEvent(uint8 EventType, ObjectGuid playerGuid1, ObjectGuid pl
|
||||||
// Add event to list
|
// Add event to list
|
||||||
m_GuildEventLog.push_back(NewEvent);
|
m_GuildEventLog.push_back(NewEvent);
|
||||||
// Save event to DB
|
// Save event to DB
|
||||||
CharacterDatabase.PExecute("DELETE FROM guild_eventlog WHERE guildid='%u' AND LogGuid='%u'", m_Id, m_GuildEventLogNextGuid);
|
CharacterDatabase.PExecute("DELETE FROM `guild_eventlog` WHERE `guildid`='%u' AND `LogGuid`='%u'", m_Id, m_GuildEventLogNextGuid);
|
||||||
CharacterDatabase.PExecute("INSERT INTO guild_eventlog (guildid, LogGuid, EventType, PlayerGuid1, PlayerGuid2, NewRank, TimeStamp) VALUES ('%u','%u','%u','%u','%u','%u','" UI64FMTD "')",
|
CharacterDatabase.PExecute("INSERT INTO `guild_eventlog` (`guildid`, `LogGuid`, `EventType`, `PlayerGuid1`, `PlayerGuid2`, `NewRank`, `TimeStamp`) VALUES ('%u','%u','%u','%u','%u','%u','" UI64FMTD "')",
|
||||||
m_Id, m_GuildEventLogNextGuid, uint32(NewEvent.EventType), NewEvent.PlayerGuid1, NewEvent.PlayerGuid2, uint32(NewEvent.NewRank), NewEvent.TimeStamp);
|
m_Id, m_GuildEventLogNextGuid, uint32(NewEvent.EventType), NewEvent.PlayerGuid1, NewEvent.PlayerGuid2, uint32(NewEvent.NewRank), NewEvent.TimeStamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -522,7 +522,7 @@ void Item::SaveToDB()
|
||||||
static SqlStatementID delItem ;
|
static SqlStatementID delItem ;
|
||||||
static SqlStatementID insItem ;
|
static SqlStatementID insItem ;
|
||||||
|
|
||||||
SqlStatement stmt = CharacterDatabase.CreateStatement(delItem, "DELETE FROM item_instance WHERE guid = ?");
|
SqlStatement stmt = CharacterDatabase.CreateStatement(delItem, "DELETE FROM `item_instance` WHERE `guid` = ?");
|
||||||
stmt.PExecute(guid);
|
stmt.PExecute(guid);
|
||||||
|
|
||||||
std::ostringstream ss;
|
std::ostringstream ss;
|
||||||
|
|
@ -531,7 +531,7 @@ void Item::SaveToDB()
|
||||||
ss << GetUInt32Value(i) << " ";
|
ss << GetUInt32Value(i) << " ";
|
||||||
}
|
}
|
||||||
|
|
||||||
stmt = CharacterDatabase.CreateStatement(insItem, "INSERT INTO item_instance (guid,owner_guid,data,text) VALUES (?, ?, ?, ?)");
|
stmt = CharacterDatabase.CreateStatement(insItem, "INSERT INTO `item_instance` (`guid`,`owner_guid`,`data`,`text`) VALUES (?, ?, ?, ?)");
|
||||||
stmt.PExecute(guid, GetOwnerGuid().GetCounter(), ss.str().c_str(), m_text.c_str());
|
stmt.PExecute(guid, GetOwnerGuid().GetCounter(), ss.str().c_str(), m_text.c_str());
|
||||||
} break;
|
} break;
|
||||||
case ITEM_CHANGED:
|
case ITEM_CHANGED:
|
||||||
|
|
@ -539,7 +539,7 @@ void Item::SaveToDB()
|
||||||
static SqlStatementID updInstance ;
|
static SqlStatementID updInstance ;
|
||||||
static SqlStatementID updGifts ;
|
static SqlStatementID updGifts ;
|
||||||
|
|
||||||
SqlStatement stmt = CharacterDatabase.CreateStatement(updInstance, "UPDATE item_instance SET data = ?, owner_guid = ?, text = ? WHERE guid = ?");
|
SqlStatement stmt = CharacterDatabase.CreateStatement(updInstance, "UPDATE `item_instance` SET `data` = ?, `owner_guid` = ?, `text` = ? WHERE `guid` = ?");
|
||||||
|
|
||||||
std::ostringstream ss;
|
std::ostringstream ss;
|
||||||
for (uint16 i = 0; i < m_valuesCount; ++i)
|
for (uint16 i = 0; i < m_valuesCount; ++i)
|
||||||
|
|
@ -551,7 +551,7 @@ void Item::SaveToDB()
|
||||||
|
|
||||||
if (HasFlag(ITEM_FIELD_FLAGS, ITEM_DYNFLAG_WRAPPED))
|
if (HasFlag(ITEM_FIELD_FLAGS, ITEM_DYNFLAG_WRAPPED))
|
||||||
{
|
{
|
||||||
stmt = CharacterDatabase.CreateStatement(updGifts, "UPDATE character_gifts SET guid = ? WHERE item_guid = ?");
|
stmt = CharacterDatabase.CreateStatement(updGifts, "UPDATE `character_gifts` SET `guid` = ? WHERE `item_guid` = ?");
|
||||||
stmt.PExecute(GetOwnerGuid().GetCounter(), GetGUIDLow());
|
stmt.PExecute(GetOwnerGuid().GetCounter(), GetGUIDLow());
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
@ -561,18 +561,18 @@ void Item::SaveToDB()
|
||||||
static SqlStatementID delGifts ;
|
static SqlStatementID delGifts ;
|
||||||
static SqlStatementID delLoot ;
|
static SqlStatementID delLoot ;
|
||||||
|
|
||||||
SqlStatement stmt = CharacterDatabase.CreateStatement(delInst, "DELETE FROM item_instance WHERE guid = ?");
|
SqlStatement stmt = CharacterDatabase.CreateStatement(delInst, "DELETE FROM `item_instance` WHERE `guid` = ?");
|
||||||
stmt.PExecute(guid);
|
stmt.PExecute(guid);
|
||||||
|
|
||||||
if (HasFlag(ITEM_FIELD_FLAGS, ITEM_DYNFLAG_WRAPPED))
|
if (HasFlag(ITEM_FIELD_FLAGS, ITEM_DYNFLAG_WRAPPED))
|
||||||
{
|
{
|
||||||
stmt = CharacterDatabase.CreateStatement(delGifts, "DELETE FROM character_gifts WHERE item_guid = ?");
|
stmt = CharacterDatabase.CreateStatement(delGifts, "DELETE FROM `character_gifts` WHERE `item_guid` = ?");
|
||||||
stmt.PExecute(GetGUIDLow());
|
stmt.PExecute(GetGUIDLow());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (HasSavedLoot())
|
if (HasSavedLoot())
|
||||||
{
|
{
|
||||||
stmt = CharacterDatabase.CreateStatement(delLoot, "DELETE FROM item_loot WHERE guid = ?");
|
stmt = CharacterDatabase.CreateStatement(delLoot, "DELETE FROM `item_loot` WHERE `guid` = ?");
|
||||||
stmt.PExecute(GetGUIDLow());
|
stmt.PExecute(GetGUIDLow());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -587,7 +587,7 @@ void Item::SaveToDB()
|
||||||
{
|
{
|
||||||
static SqlStatementID delLoot ;
|
static SqlStatementID delLoot ;
|
||||||
|
|
||||||
SqlStatement stmt = CharacterDatabase.CreateStatement(delLoot, "DELETE FROM item_loot WHERE guid = ?");
|
SqlStatement stmt = CharacterDatabase.CreateStatement(delLoot, "DELETE FROM `item_loot` WHERE `guid` = ?");
|
||||||
stmt.PExecute(GetGUIDLow());
|
stmt.PExecute(GetGUIDLow());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -601,11 +601,11 @@ void Item::SaveToDB()
|
||||||
// save money as 0 itemid data
|
// save money as 0 itemid data
|
||||||
if (loot.gold)
|
if (loot.gold)
|
||||||
{
|
{
|
||||||
SqlStatement stmt = CharacterDatabase.CreateStatement(saveGold, "INSERT INTO item_loot (guid,owner_guid,itemid,amount,suffix,property) VALUES (?, ?, 0, ?, 0, 0)");
|
SqlStatement stmt = CharacterDatabase.CreateStatement(saveGold, "INSERT INTO `item_loot` (`guid`,`owner_guid`,`itemid`,`amount`,`suffix`,`property`) VALUES (?, ?, 0, ?, 0, 0)");
|
||||||
stmt.PExecute(GetGUIDLow(), owner->GetGUIDLow(), loot.gold);
|
stmt.PExecute(GetGUIDLow(), owner->GetGUIDLow(), loot.gold);
|
||||||
}
|
}
|
||||||
|
|
||||||
SqlStatement stmt = CharacterDatabase.CreateStatement(saveLoot, "INSERT INTO item_loot (guid,owner_guid,itemid,amount,suffix,property) VALUES (?, ?, ?, ?, ?, ?)");
|
SqlStatement stmt = CharacterDatabase.CreateStatement(saveLoot, "INSERT INTO `item_loot` (`guid`,`owner_guid`,`itemid`,`amount`,`suffix`,`property`) VALUES (?, ?, ?, ?, ?, ?)");
|
||||||
|
|
||||||
// save items and quest items (at load its all will added as normal, but this not important for item loot case)
|
// save items and quest items (at load its all will added as normal, but this not important for item loot case)
|
||||||
for (size_t i = 0; i < loot.GetMaxSlotInLootFor(owner); ++i)
|
for (size_t i = 0; i < loot.GetMaxSlotInLootFor(owner); ++i)
|
||||||
|
|
@ -726,7 +726,7 @@ bool Item::LoadFromDB(uint32 guidLow, Field* fields, ObjectGuid ownerGuid)
|
||||||
static SqlStatementID delGifts ;
|
static SqlStatementID delGifts ;
|
||||||
|
|
||||||
// also cleanup for sure gift table
|
// also cleanup for sure gift table
|
||||||
SqlStatement stmt = CharacterDatabase.CreateStatement(delGifts, "DELETE FROM character_gifts WHERE item_guid = ?");
|
SqlStatement stmt = CharacterDatabase.CreateStatement(delGifts, "DELETE FROM `character_gifts` WHERE `item_guid` = ?");
|
||||||
stmt.PExecute(GetGUIDLow());
|
stmt.PExecute(GetGUIDLow());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -735,7 +735,7 @@ bool Item::LoadFromDB(uint32 guidLow, Field* fields, ObjectGuid ownerGuid)
|
||||||
{
|
{
|
||||||
static SqlStatementID updItem ;
|
static SqlStatementID updItem ;
|
||||||
|
|
||||||
SqlStatement stmt = CharacterDatabase.CreateStatement(updItem, "UPDATE item_instance SET data = ?, owner_guid = ? WHERE guid = ?");
|
SqlStatement stmt = CharacterDatabase.CreateStatement(updItem, "UPDATE `item_instance` SET `data` = ?, `owner_guid` = ? WHERE `guid` = ?");
|
||||||
|
|
||||||
std::ostringstream ss;
|
std::ostringstream ss;
|
||||||
for (uint16 i = 0; i < m_valuesCount; ++i)
|
for (uint16 i = 0; i < m_valuesCount; ++i)
|
||||||
|
|
@ -787,7 +787,7 @@ void Item::LoadLootFromDB(Field* fields)
|
||||||
CurrencyTypesEntry const* currencyEntry = sCurrencyTypesStore.LookupEntry(item_id);
|
CurrencyTypesEntry const* currencyEntry = sCurrencyTypesStore.LookupEntry(item_id);
|
||||||
if (!currencyEntry)
|
if (!currencyEntry)
|
||||||
{
|
{
|
||||||
CharacterDatabase.PExecute("DELETE FROM item_loot WHERE guid = '%u' AND itemid = '%i'", GetGUIDLow(), -int32(item_id));
|
CharacterDatabase.PExecute("DELETE FROM `item_loot` WHERE `guid` = '%u' AND `itemid` = '%i'", GetGUIDLow(), -int32(item_id));
|
||||||
sLog.outError("Item::LoadLootFromDB: %s has an unknown currency (id: #%u) in item_loot, deleted.", GetOwnerGuid().GetString().c_str(), item_id);
|
sLog.outError("Item::LoadLootFromDB: %s has an unknown currency (id: #%u) in item_loot, deleted.", GetOwnerGuid().GetString().c_str(), item_id);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -804,7 +804,7 @@ void Item::DeleteFromDB()
|
||||||
{
|
{
|
||||||
static SqlStatementID delItem ;
|
static SqlStatementID delItem ;
|
||||||
|
|
||||||
SqlStatement stmt = CharacterDatabase.CreateStatement(delItem, "DELETE FROM item_instance WHERE guid = ?");
|
SqlStatement stmt = CharacterDatabase.CreateStatement(delItem, "DELETE FROM `item_instance` WHERE `guid` = ?");
|
||||||
stmt.PExecute(GetGUIDLow());
|
stmt.PExecute(GetGUIDLow());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -812,7 +812,7 @@ void Item::DeleteFromInventoryDB()
|
||||||
{
|
{
|
||||||
static SqlStatementID delInv ;
|
static SqlStatementID delInv ;
|
||||||
|
|
||||||
SqlStatement stmt = CharacterDatabase.CreateStatement(delInv, "DELETE FROM character_inventory WHERE item = ?");
|
SqlStatement stmt = CharacterDatabase.CreateStatement(delInv, "DELETE FROM `character_inventory` WHERE `item` = ?");
|
||||||
stmt.PExecute(GetGUIDLow());
|
stmt.PExecute(GetGUIDLow());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ void LoadRandomEnchantmentsTable()
|
||||||
RandomItemSuffixEnch.clear(); // for reload case
|
RandomItemSuffixEnch.clear(); // for reload case
|
||||||
|
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
QueryResult* result = WorldDatabase.Query("SELECT entry, ench, chance FROM item_enchantment_template");
|
QueryResult* result = WorldDatabase.Query("SELECT `entry`, `ench`, `chance` FROM `item_enchantment_template`");
|
||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,7 @@ void LootStore::LoadLootTable()
|
||||||
Clear();
|
Clear();
|
||||||
|
|
||||||
// 0 1 2 3 4 5 6
|
// 0 1 2 3 4 5 6
|
||||||
QueryResult* result = WorldDatabase.PQuery("SELECT entry, item, ChanceOrQuestChance, groupid, mincountOrRef, maxcount, condition_id FROM %s", GetName());
|
QueryResult* result = WorldDatabase.PQuery("SELECT `entry`, `item`, `ChanceOrQuestChance`, `groupid`, `mincountOrRef`, `maxcount`, `condition_id` FROM `%s`", GetName());
|
||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -281,7 +281,7 @@ void ObjectMgr::LoadCreatureLocales()
|
||||||
{
|
{
|
||||||
mCreatureLocaleMap.clear(); // need for reload case
|
mCreatureLocaleMap.clear(); // need for reload case
|
||||||
|
|
||||||
QueryResult* result = WorldDatabase.Query("SELECT entry,name_loc1,subname_loc1,name_loc2,subname_loc2,name_loc3,subname_loc3,name_loc4,subname_loc4,name_loc5,subname_loc5,name_loc6,subname_loc6,name_loc7,subname_loc7,name_loc8,subname_loc8 FROM locales_creature");
|
QueryResult* result = WorldDatabase.Query("SELECT `entry`,`name_loc1`,`subname_loc1`,`name_loc2`,`subname_loc2`,`name_loc3`,`subname_loc3`,`name_loc4`,`subname_loc4`,`name_loc5`,`subname_loc5`,`name_loc6`,`subname_loc6`,`name_loc7`,`subname_loc7`,`name_loc8`,`subname_loc8` FROM `locales_creature`");
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
|
|
@ -355,12 +355,12 @@ void ObjectMgr::LoadGossipMenuItemsLocales()
|
||||||
{
|
{
|
||||||
mGossipMenuItemsLocaleMap.clear(); // need for reload case
|
mGossipMenuItemsLocaleMap.clear(); // need for reload case
|
||||||
|
|
||||||
QueryResult* result = WorldDatabase.Query("SELECT menu_id,id,"
|
QueryResult* result = WorldDatabase.Query("SELECT `menu_id`,`id`,"
|
||||||
"option_text_loc1,box_text_loc1,option_text_loc2,box_text_loc2,"
|
"`option_text_loc1`,`box_text_loc1`,`option_text_loc2`,`box_text_loc2`,"
|
||||||
"option_text_loc3,box_text_loc3,option_text_loc4,box_text_loc4,"
|
"`option_text_loc3`,`box_text_loc3`,`option_text_loc4`,`box_text_loc4`,"
|
||||||
"option_text_loc5,box_text_loc5,option_text_loc6,box_text_loc6,"
|
"`option_text_loc5`,`box_text_loc5`,`option_text_loc6`,`box_text_loc6`,"
|
||||||
"option_text_loc7,box_text_loc7,option_text_loc8,box_text_loc8 "
|
"`option_text_loc7`,`box_text_loc7`,`option_text_loc8`,`box_text_loc8` "
|
||||||
"FROM locales_gossip_menu_option");
|
"FROM `locales_gossip_menu_option`");
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
|
|
@ -450,7 +450,7 @@ void ObjectMgr::LoadPointOfInterestLocales()
|
||||||
{
|
{
|
||||||
mPointOfInterestLocaleMap.clear(); // need for reload case
|
mPointOfInterestLocaleMap.clear(); // need for reload case
|
||||||
|
|
||||||
QueryResult* result = WorldDatabase.Query("SELECT entry,icon_name_loc1,icon_name_loc2,icon_name_loc3,icon_name_loc4,icon_name_loc5,icon_name_loc6,icon_name_loc7,icon_name_loc8 FROM locales_points_of_interest");
|
QueryResult* result = WorldDatabase.Query("SELECT `entry`,`icon_name_loc1`,`icon_name_loc2`,`icon_name_loc3`,`icon_name_loc4`,`icon_name_loc5`,`icon_name_loc6`,`icon_name_loc7`,`icon_name_loc8` FROM `locales_points_of_interest`");
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
|
|
@ -984,7 +984,7 @@ void ObjectMgr::LoadCreatureClassLvlStats()
|
||||||
// initialize data array
|
// initialize data array
|
||||||
memset(&m_creatureClassLvlStats, 0, sizeof(m_creatureClassLvlStats));
|
memset(&m_creatureClassLvlStats, 0, sizeof(m_creatureClassLvlStats));
|
||||||
|
|
||||||
std::string queryStr = "SELECT Class, Level, BaseMana, BaseMeleeAttackPower, BaseRangedAttackPower, BaseArmor";
|
std::string queryStr = "SELECT `Class`, `Level`, `BaseMana`, `BaseMeleeAttackPower`, `BaseRangedAttackPower`, `BaseArmor`";
|
||||||
|
|
||||||
for (int i = 0; i <= MAX_EXPANSION; i++)
|
for (int i = 0; i <= MAX_EXPANSION; i++)
|
||||||
{
|
{
|
||||||
|
|
@ -1439,17 +1439,17 @@ void ObjectMgr::LoadCreatures()
|
||||||
{
|
{
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
// 0 1 2 3
|
// 0 1 2 3
|
||||||
QueryResult* result = WorldDatabase.Query("SELECT creature.guid, creature.id, map, modelid,"
|
QueryResult* result = WorldDatabase.Query("SELECT `creature`.`guid`, `creature`.`id`, `map`, `modelid`,"
|
||||||
// 4 5 6 7 8 9 10 11
|
// 4 5 6 7 8 9 10 11
|
||||||
"equipment_id, position_x, position_y, position_z, orientation, spawntimesecs, spawndist, currentwaypoint,"
|
"`equipment_id`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `spawndist`, `currentwaypoint`,"
|
||||||
// 12 13 14 15 16 17 18
|
// 12 13 14 15 16 17 18
|
||||||
"curhealth, curmana, DeathState, MovementType, spawnMask, phaseMask, event,"
|
"`curhealth`, `curmana`, `DeathState`, `MovementType`, `spawnMask`, `phaseMask`, `event`,"
|
||||||
// 19 20
|
// 19 20
|
||||||
"pool_creature.pool_entry, pool_creature_template.pool_entry "
|
"`pool_creature`.`pool_entry`, `pool_creature_template`.`pool_entry` "
|
||||||
"FROM creature "
|
"FROM `creature` "
|
||||||
"LEFT OUTER JOIN game_event_creature ON creature.guid = game_event_creature.guid "
|
"LEFT OUTER JOIN `game_event_creature` ON `creature`.`guid` = `game_event_creature`.`guid` "
|
||||||
"LEFT OUTER JOIN pool_creature ON creature.guid = pool_creature.guid "
|
"LEFT OUTER JOIN `pool_creature` ON `creature`.`guid` = `pool_creature`.`guid` "
|
||||||
"LEFT OUTER JOIN pool_creature_template ON creature.id = pool_creature_template.id");
|
"LEFT OUTER JOIN `pool_creature_template` ON `creature`.`id` = `pool_creature_template`.`id`");
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
|
|
@ -1673,15 +1673,15 @@ void ObjectMgr::LoadGameObjects()
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
|
|
||||||
// 0 1 2 3 4 5 6
|
// 0 1 2 3 4 5 6
|
||||||
QueryResult* result = WorldDatabase.Query("SELECT gameobject.guid, gameobject.id, map, position_x, position_y, position_z, orientation,"
|
QueryResult* result = WorldDatabase.Query("SELECT `gameobject`.`guid`, `gameobject`.`id`, `gameobject`.`map`, `gameobject`.`position_x`, `gameobject`.`position_y`, `gameobject`.`position_z`, `gameobject`.`orientation`, "
|
||||||
// 7 8 9 10 11 12 13 14 15 16
|
// 7 8 9 10 11 12 13 14 15
|
||||||
"rotation0, rotation1, rotation2, rotation3, spawntimesecs, animprogress, state, spawnMask, phaseMask, event,"
|
"`gameobject`.`rotation0`, `gameobject`.`rotation1`, `gameobject`.`rotation2`, `gameobject`.`rotation3`, `gameobject`.`spawntimesecs`, `gameobject`.`animprogress`, `gameobject`.`state`, `gameobject`.`spawnMask`, `gameobject`.`phaseMask`, "
|
||||||
// 17 18
|
// 16 17 18
|
||||||
"pool_gameobject.pool_entry, pool_gameobject_template.pool_entry "
|
"`gameobject`.`event`, `pool_gameobject`.`pool_entry`, `pool_gameobject_template`.`pool_entry` "
|
||||||
"FROM gameobject "
|
"FROM `gameobject` "
|
||||||
"LEFT OUTER JOIN game_event_gameobject ON gameobject.guid = game_event_gameobject.guid "
|
"LEFT OUTER JOIN `game_event_gameobject` ON `gameobject`.`guid` = `game_event_gameobject`.`guid` "
|
||||||
"LEFT OUTER JOIN pool_gameobject ON gameobject.guid = pool_gameobject.guid "
|
"LEFT OUTER JOIN `pool_gameobject` ON `gameobject`.`guid` = `pool_gameobject`.`guid` "
|
||||||
"LEFT OUTER JOIN pool_gameobject_template ON gameobject.id = pool_gameobject_template.id");
|
"LEFT OUTER JOIN `pool_gameobject_template` ON `gameobject`.`id` = `pool_gameobject_template`.`id`");
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
|
|
@ -1909,7 +1909,7 @@ ObjectGuid ObjectMgr::GetPlayerGuidByName(std::string name) const
|
||||||
CharacterDatabase.escape_string(name);
|
CharacterDatabase.escape_string(name);
|
||||||
|
|
||||||
// Player name safe to sending to DB (checked at login) and this function using
|
// Player name safe to sending to DB (checked at login) and this function using
|
||||||
QueryResult* result = CharacterDatabase.PQuery("SELECT guid FROM characters WHERE name = '%s'", name.c_str());
|
QueryResult* result = CharacterDatabase.PQuery("SELECT `guid` FROM `characters` WHERE `name` = '%s'", name.c_str());
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
guid = ObjectGuid(HIGHGUID_PLAYER, (*result)[0].GetUInt32());
|
guid = ObjectGuid(HIGHGUID_PLAYER, (*result)[0].GetUInt32());
|
||||||
|
|
@ -1931,7 +1931,7 @@ bool ObjectMgr::GetPlayerNameByGUID(ObjectGuid guid, std::string& name) const
|
||||||
|
|
||||||
uint32 lowguid = guid.GetCounter();
|
uint32 lowguid = guid.GetCounter();
|
||||||
|
|
||||||
QueryResult* result = CharacterDatabase.PQuery("SELECT name FROM characters WHERE guid = '%u'", lowguid);
|
QueryResult* result = CharacterDatabase.PQuery("SELECT `name` FROM `characters` WHERE `guid` = '%u'", lowguid);
|
||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
|
|
@ -1953,7 +1953,7 @@ Team ObjectMgr::GetPlayerTeamByGUID(ObjectGuid guid) const
|
||||||
|
|
||||||
uint32 lowguid = guid.GetCounter();
|
uint32 lowguid = guid.GetCounter();
|
||||||
|
|
||||||
QueryResult* result = CharacterDatabase.PQuery("SELECT race FROM characters WHERE guid = '%u'", lowguid);
|
QueryResult* result = CharacterDatabase.PQuery("SELECT `race` FROM `characters` WHERE `guid` = '%u'", lowguid);
|
||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
|
|
@ -1980,7 +1980,7 @@ uint32 ObjectMgr::GetPlayerAccountIdByGUID(ObjectGuid guid) const
|
||||||
|
|
||||||
uint32 lowguid = guid.GetCounter();
|
uint32 lowguid = guid.GetCounter();
|
||||||
|
|
||||||
QueryResult* result = CharacterDatabase.PQuery("SELECT account FROM characters WHERE guid = '%u'", lowguid);
|
QueryResult* result = CharacterDatabase.PQuery("SELECT `account` FROM `characters` WHERE `guid` = '%u'", lowguid);
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
uint32 acc = (*result)[0].GetUInt32();
|
uint32 acc = (*result)[0].GetUInt32();
|
||||||
|
|
@ -1993,7 +1993,7 @@ uint32 ObjectMgr::GetPlayerAccountIdByGUID(ObjectGuid guid) const
|
||||||
|
|
||||||
uint32 ObjectMgr::GetPlayerAccountIdByPlayerName(const std::string& name) const
|
uint32 ObjectMgr::GetPlayerAccountIdByPlayerName(const std::string& name) const
|
||||||
{
|
{
|
||||||
QueryResult* result = CharacterDatabase.PQuery("SELECT account FROM characters WHERE name = '%s'", name.c_str());
|
QueryResult* result = CharacterDatabase.PQuery("SELECT `account` FROM `characters` WHERE `name` = '%s'", name.c_str());
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
uint32 acc = (*result)[0].GetUInt32();
|
uint32 acc = (*result)[0].GetUInt32();
|
||||||
|
|
@ -2008,7 +2008,7 @@ void ObjectMgr::LoadItemLocales()
|
||||||
{
|
{
|
||||||
mItemLocaleMap.clear(); // need for reload case
|
mItemLocaleMap.clear(); // need for reload case
|
||||||
|
|
||||||
QueryResult* result = WorldDatabase.Query("SELECT entry,name_loc1,description_loc1,name_loc2,description_loc2,name_loc3,description_loc3,name_loc4,description_loc4,name_loc5,description_loc5,name_loc6,description_loc6,name_loc7,description_loc7,name_loc8,description_loc8 FROM locales_item");
|
QueryResult* result = WorldDatabase.Query("SELECT `entry`,`name_loc1`,`description_loc1`,`name_loc2`,`description_loc2`,`name_loc3`,`description_loc3`,`name_loc4`,`description_loc4`,`name_loc5`,`description_loc5`,`name_loc6`,`description_loc6`,`name_loc7`,`description_loc7`,`name_loc8`,`description_loc8` FROM `locales_item`");
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
|
|
@ -2730,7 +2730,7 @@ void ObjectMgr::LoadItemConverts()
|
||||||
|
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
|
|
||||||
QueryResult* result = WorldDatabase.Query("SELECT entry,item FROM item_convert");
|
QueryResult* result = WorldDatabase.Query("SELECT `entry`,`item` FROM `item_convert`");
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
|
|
@ -2967,7 +2967,7 @@ void ObjectMgr::LoadPetLevelInfo()
|
||||||
// Loading levels data
|
// Loading levels data
|
||||||
{
|
{
|
||||||
// 0 1 2 3 4 5 6 7 8 9
|
// 0 1 2 3 4 5 6 7 8 9
|
||||||
QueryResult* result = WorldDatabase.Query("SELECT creature_entry, level, hp, mana, str, agi, sta, inte, spi, armor FROM pet_levelstats");
|
QueryResult* result = WorldDatabase.Query("SELECT `creature_entry`, `level`, `hp`, `mana`, `str`, `agi`, `sta`, `inte`, `spi`, `armor` FROM `pet_levelstats`");
|
||||||
|
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
|
|
||||||
|
|
@ -3091,7 +3091,7 @@ void ObjectMgr::LoadPlayerInfo()
|
||||||
// Load playercreate
|
// Load playercreate
|
||||||
{
|
{
|
||||||
// 0 1 2 3 4 5 6 7 8
|
// 0 1 2 3 4 5 6 7 8
|
||||||
QueryResult* result = WorldDatabase.Query("SELECT race, class, map, zone, position_x, position_y, position_z, orientation, phaseMap FROM playercreateinfo");
|
QueryResult* result = WorldDatabase.Query("SELECT `race`, `class`, `map`, `zone`, `position_x`, `position_y`, `position_z`, `orientation`, `phaseMap` FROM `playercreateinfo`");
|
||||||
|
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
|
|
||||||
|
|
@ -3176,7 +3176,7 @@ void ObjectMgr::LoadPlayerInfo()
|
||||||
// Load playercreate items
|
// Load playercreate items
|
||||||
{
|
{
|
||||||
// 0 1 2 3
|
// 0 1 2 3
|
||||||
QueryResult* result = WorldDatabase.Query("SELECT race, class, itemid, amount FROM playercreateinfo_item");
|
QueryResult* result = WorldDatabase.Query("SELECT `race`, `class`, `itemid`, `amount` FROM `playercreateinfo_item`");
|
||||||
|
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
|
|
||||||
|
|
@ -3249,7 +3249,7 @@ void ObjectMgr::LoadPlayerInfo()
|
||||||
// Load playercreate spells
|
// Load playercreate spells
|
||||||
{
|
{
|
||||||
// 0 1 2
|
// 0 1 2
|
||||||
QueryResult* result = WorldDatabase.Query("SELECT race, class, Spell FROM playercreateinfo_spell");
|
QueryResult* result = WorldDatabase.Query("SELECT `race`, `class`, `Spell` FROM `playercreateinfo_spell`");
|
||||||
|
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
|
|
||||||
|
|
@ -3311,7 +3311,7 @@ void ObjectMgr::LoadPlayerInfo()
|
||||||
// Load playercreate actions
|
// Load playercreate actions
|
||||||
{
|
{
|
||||||
// 0 1 2 3 4
|
// 0 1 2 3 4
|
||||||
QueryResult* result = WorldDatabase.Query("SELECT race, class, button, action, type FROM playercreateinfo_action");
|
QueryResult* result = WorldDatabase.Query("SELECT `race`, `class`, `button`, `action`, `type` FROM `playercreateinfo_action`");
|
||||||
|
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
|
|
||||||
|
|
@ -3375,7 +3375,7 @@ void ObjectMgr::LoadPlayerInfo()
|
||||||
// Loading levels data (class/race dependent)
|
// Loading levels data (class/race dependent)
|
||||||
{
|
{
|
||||||
// 0 1 2 3 4 5 6 7
|
// 0 1 2 3 4 5 6 7
|
||||||
QueryResult* result = WorldDatabase.Query("SELECT race, class, level, str, agi, sta, inte, spi FROM player_levelstats");
|
QueryResult* result = WorldDatabase.Query("SELECT `race`, `class`, `level`, `str`, `agi`, `sta`, `inte`, `spi` FROM `player_levelstats`");
|
||||||
|
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
|
|
||||||
|
|
@ -3523,7 +3523,7 @@ void ObjectMgr::LoadPlayerInfo()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 0 1
|
// 0 1
|
||||||
QueryResult* result = WorldDatabase.Query("SELECT lvl, xp_for_next_level FROM player_xp_for_level");
|
QueryResult* result = WorldDatabase.Query("SELECT `lvl`, `xp_for_next_level` FROM `player_xp_for_level`");
|
||||||
|
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
|
|
||||||
|
|
@ -3795,7 +3795,7 @@ void ObjectMgr::LoadGroups()
|
||||||
// -- loading groups --
|
// -- loading groups --
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
||||||
QueryResult* result = CharacterDatabase.Query("SELECT mainTank, mainAssistant, lootMethod, looterGuid, lootThreshold, icon1, icon2, icon3, icon4, icon5, icon6, icon7, icon8, groupType, difficulty, raiddifficulty, leaderGuid, groupId FROM groups");
|
QueryResult* result = CharacterDatabase.Query("SELECT `mainTank`, `mainAssistant`, `lootMethod`, `looterGuid`, `lootThreshold`, `icon1`, `icon2`, `icon3`, `icon4`, `icon5`, `icon6`, `icon7`, `icon8`, `groupType`, `difficulty`, `raiddifficulty`, `leaderGuid`, `groupId` FROM `groups`");
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
|
|
@ -3834,7 +3834,7 @@ void ObjectMgr::LoadGroups()
|
||||||
// -- loading members --
|
// -- loading members --
|
||||||
count = 0;
|
count = 0;
|
||||||
// 0 1 2 3
|
// 0 1 2 3
|
||||||
result = CharacterDatabase.Query("SELECT memberGuid, assistant, subgroup, groupId FROM group_member ORDER BY groupId");
|
result = CharacterDatabase.Query("SELECT `memberGuid`, `assistant`, `subgroup`, `groupId` FROM `group_member` ORDER BY `groupId`");
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
BarGoLink bar2(1);
|
BarGoLink bar2(1);
|
||||||
|
|
@ -3863,7 +3863,7 @@ void ObjectMgr::LoadGroups()
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Incorrect entry in group_member table : no group with Id %d for member %s!",
|
sLog.outErrorDb("Incorrect entry in group_member table : no group with Id %d for member %s!",
|
||||||
groupId, memberGuid.GetString().c_str());
|
groupId, memberGuid.GetString().c_str());
|
||||||
CharacterDatabase.PExecute("DELETE FROM group_member WHERE memberGuid = '%u'", memberGuidlow);
|
CharacterDatabase.PExecute("DELETE FROM `group_member` WHERE `memberGuid` = '%u'", memberGuidlow);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3872,7 +3872,7 @@ void ObjectMgr::LoadGroups()
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Incorrect entry in group_member table : member %s can not be added to group (Id: %u)!",
|
sLog.outErrorDb("Incorrect entry in group_member table : member %s can not be added to group (Id: %u)!",
|
||||||
memberGuid.GetString().c_str(), groupId);
|
memberGuid.GetString().c_str(), groupId);
|
||||||
CharacterDatabase.PExecute("DELETE FROM group_member WHERE memberGuid = '%u'", memberGuidlow);
|
CharacterDatabase.PExecute("DELETE FROM `group_member` WHERE `memberGuid` = '%u'", memberGuidlow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (result->NextRow());
|
while (result->NextRow());
|
||||||
|
|
@ -3899,12 +3899,12 @@ void ObjectMgr::LoadGroups()
|
||||||
count = 0;
|
count = 0;
|
||||||
result = CharacterDatabase.Query(
|
result = CharacterDatabase.Query(
|
||||||
// 0 1 2 3 4 5
|
// 0 1 2 3 4 5
|
||||||
"SELECT group_instance.leaderGuid, map, instance, permanent, instance.difficulty, resettime, "
|
"SELECT `group_instance`.`leaderGuid`, `map`, `instance`, `permanent`, `instance`.`difficulty`, `resettime`, "
|
||||||
// 6
|
// 6
|
||||||
"(SELECT COUNT(*) FROM character_instance WHERE guid = group_instance.leaderGuid AND instance = group_instance.instance AND permanent = 1 LIMIT 1), "
|
"(SELECT COUNT(*) FROM `character_instance` WHERE `guid` = `group_instance`.`leaderGuid` AND `instance` = `group_instance`.`instance` AND `permanent` = 1 LIMIT 1), "
|
||||||
// 7 8
|
// 7 8
|
||||||
" groups.groupId, instance.encountersMask "
|
" `groups`.`groupId`, `instance`.`encountersMask` "
|
||||||
"FROM group_instance LEFT JOIN instance ON instance = id LEFT JOIN groups ON groups.leaderGUID = group_instance.leaderGUID ORDER BY leaderGuid"
|
"FROM `group_instance` LEFT JOIN `instance` ON `instance` = `id` LEFT JOIN `groups` ON `groups`.`leaderGUID` = `group_instance`.`leaderGUID` ORDER BY `leaderGuid`"
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
|
|
@ -3979,68 +3979,68 @@ void ObjectMgr::LoadQuests()
|
||||||
m_ExclusiveQuestGroups.clear();
|
m_ExclusiveQuestGroups.clear();
|
||||||
|
|
||||||
// 0 1 2 3 4 5 6 7 8 9
|
// 0 1 2 3 4 5 6 7 8 9
|
||||||
QueryResult* result = WorldDatabase.Query("SELECT entry, Method, ZoneOrSort, MinLevel, QuestLevel, Type, RequiredClasses, RequiredRaces, RequiredSkill, RequiredSkillValue,"
|
QueryResult* result = WorldDatabase.Query("SELECT `entry`, `Method`, `ZoneOrSort`, `MinLevel`, `QuestLevel`, `Type`, `RequiredClasses`, `RequiredRaces`, `RequiredSkill`, `RequiredSkillValue`,"
|
||||||
// 10 11 12 13 14 15 16 17
|
// 10 11 12 13 14 15 16 17
|
||||||
"RepObjectiveFaction, RepObjectiveValue, RequiredMinRepFaction, RequiredMinRepValue, RequiredMaxRepFaction, RequiredMaxRepValue, SuggestedPlayers, LimitTime,"
|
"`RepObjectiveFaction`, `RepObjectiveValue`, `RequiredMinRepFaction`, `RequiredMinRepValue`, `RequiredMaxRepFaction`, `RequiredMaxRepValue`, `SuggestedPlayers`, `LimitTime`,"
|
||||||
// 18 19 20 21 22 23 24 25 26 27 28
|
// 18 19 20 21 22 23 24 25 26 27 28
|
||||||
"QuestFlags, SpecialFlags, CharTitleId, PlayersSlain, BonusTalents, PortraitGiver, PortraitTurnIn, PrevQuestId, NextQuestId, ExclusiveGroup, NextQuestInChain,"
|
"`QuestFlags`, `SpecialFlags`, `CharTitleId`, `PlayersSlain`, `BonusTalents`, `PortraitGiver`, `PortraitTurnIn`, `PrevQuestId`, `NextQuestId`, `ExclusiveGroup`, `NextQuestInChain`,"
|
||||||
// 29 30 31 32
|
// 29 30 31 32
|
||||||
"RewXPId, SrcItemId, SrcItemCount, SrcSpell,"
|
"`RewXPId`, `SrcItemId`, `SrcItemCount`, `SrcSpell`,"
|
||||||
// 33 34 35 36 37 38 39 40 41 42 43
|
// 33 34 35 36 37 38 39 40 41 42 43
|
||||||
"Title, Details, Objectives, OfferRewardText, RequestItemsText, EndText, CompletedText, PortraitGiverName, PortraitGiverText, PortraitTurnInName, PortraitTurnInText,"
|
"`Title`, `Details`, `Objectives`, `OfferRewardText`, `RequestItemsText`, `EndText`, `CompletedText`, `PortraitGiverName`, `PortraitGiverText`, `PortraitTurnInName`, `PortraitTurnInText`,"
|
||||||
// 44 45 46 47
|
// 44 45 46 47
|
||||||
"ObjectiveText1, ObjectiveText2, ObjectiveText3, ObjectiveText4,"
|
"`ObjectiveText1`, `ObjectiveText2`, `ObjectiveText3`, `ObjectiveText4`,"
|
||||||
// 48 49 50 51 52 53 54 55 56 57 58 59
|
// 48 49 50 51 52 53 54 55 56 57 58 59
|
||||||
"ReqItemId1, ReqItemId2, ReqItemId3, ReqItemId4, ReqItemId5, ReqItemId6, ReqItemCount1, ReqItemCount2, ReqItemCount3, ReqItemCount4, ReqItemCount5, ReqItemCount6,"
|
"`ReqItemId1`, `ReqItemId2`, `ReqItemId3`, `ReqItemId4`, `ReqItemId5`, `ReqItemId6`, `ReqItemCount1`, `ReqItemCount2`, `ReqItemCount3`, `ReqItemCount4`, `ReqItemCount5`, `ReqItemCount6`,"
|
||||||
// 60 61 62 63 64 65 66 67
|
// 60 61 62 63 64 65 66 67
|
||||||
"ReqSourceId1, ReqSourceId2, ReqSourceId3, ReqSourceId4, ReqSourceCount1, ReqSourceCount2, ReqSourceCount3, ReqSourceCount4,"
|
"`ReqSourceId1`, `ReqSourceId2`, `ReqSourceId3`, `ReqSourceId4`, `ReqSourceCount1`, `ReqSourceCount2`, `ReqSourceCount3`, `ReqSourceCount4`,"
|
||||||
// 68 69 70 71 72 73 74 75
|
// 68 69 70 71 72 73 74 75
|
||||||
"ReqCreatureOrGOId1, ReqCreatureOrGOId2, ReqCreatureOrGOId3, ReqCreatureOrGOId4, ReqCreatureOrGOCount1, ReqCreatureOrGOCount2, ReqCreatureOrGOCount3, ReqCreatureOrGOCount4,"
|
"`ReqCreatureOrGOId1`, `ReqCreatureOrGOId2`, `ReqCreatureOrGOId3`, `ReqCreatureOrGOId4`, `ReqCreatureOrGOCount1`, `ReqCreatureOrGOCount2`, `ReqCreatureOrGOCount3`, `ReqCreatureOrGOCount4`,"
|
||||||
// 76 77 78 79
|
// 76 77 78 79
|
||||||
"ReqCurrencyId1, ReqCurrencyId2, ReqCurrencyId3, ReqCurrencyId4,"
|
"`ReqCurrencyId1`, `ReqCurrencyId2`, `ReqCurrencyId3`, `ReqCurrencyId4`,"
|
||||||
// 80 81 82 83
|
// 80 81 82 83
|
||||||
"ReqCurrencyCount1, ReqCurrencyCount1, ReqCurrencyCount1, ReqCurrencyCount1,"
|
"`ReqCurrencyCount1`, `ReqCurrencyCount1`, `ReqCurrencyCount1`, `ReqCurrencyCount1`,"
|
||||||
// 84 85 86 87 88
|
// 84 85 86 87 88
|
||||||
"ReqSpellCast1, ReqSpellCast2, ReqSpellCast3, ReqSpellCast4, ReqSpellLearned,"
|
"`ReqSpellCast1`, `ReqSpellCast2`, `ReqSpellCast3`, `ReqSpellCast4`, `ReqSpellLearnedv,"
|
||||||
// 89 90 91 92 93 94
|
// 89 90 91 92 93 94
|
||||||
"RewChoiceItemId1, RewChoiceItemId2, RewChoiceItemId3, RewChoiceItemId4, RewChoiceItemId5, RewChoiceItemId6,"
|
"`RewChoiceItemId1`, `RewChoiceItemId2`, `RewChoiceItemId3`, `RewChoiceItemId4`, `RewChoiceItemId5`, `RewChoiceItemId6`,"
|
||||||
// 95 96 97 98 99 100
|
// 95 96 97 98 99 100
|
||||||
"RewChoiceItemCount1, RewChoiceItemCount2, RewChoiceItemCount3, RewChoiceItemCount4, RewChoiceItemCount5, RewChoiceItemCount6,"
|
"`RewChoiceItemCount1`, `RewChoiceItemCount2`, `RewChoiceItemCount3`, `RewChoiceItemCount4`, `RewChoiceItemCount5`, `RewChoiceItemCount6`,"
|
||||||
// 101 102 103 104 105 106 107 108
|
// 101 102 103 104 105 106 107 108
|
||||||
"RewItemId1, RewItemId2, RewItemId3, RewItemId4, RewItemCount1, RewItemCount2, RewItemCount3, RewItemCount4,"
|
"`RewItemId1`, `RewItemId2`, `RewItemId3`, `RewItemId4`, `RewItemCount1`, `RewItemCount2`, `RewItemCount3`, `RewItemCount4`,"
|
||||||
// 109 110 111 112
|
// 109 110 111 112
|
||||||
"RewCurrencyId1, RewCurrencyId2, RewCurrencyId3, RewCurrencyId4,"
|
"`RewCurrencyId1`, `RewCurrencyId2`, `RewCurrencyId3`, `RewCurrencyId4`,"
|
||||||
// 113 114 115 116
|
// 113 114 115 116
|
||||||
"RewCurrencyCount1, RewCurrencyCount2, RewCurrencyCount3, RewCurrencyCount4,"
|
"`RewCurrencyCount1`, `RewCurrencyCount2`, `RewCurrencyCount3`, `RewCurrencyCount4`,"
|
||||||
// 117 118
|
// 117 118
|
||||||
"RewSkill, RewSkillValue,"
|
"`RewSkill`, `RewSkillValue`,"
|
||||||
// 119 120 121 122 123
|
// 119 120 121 122 123
|
||||||
"RewRepFaction1, RewRepFaction2, RewRepFaction3, RewRepFaction4, RewRepFaction5,"
|
"`RewRepFaction1`, `RewRepFaction2`, `RewRepFaction3`, `RewRepFaction4`, `RewRepFaction5`,"
|
||||||
// 124 125 126 127 128
|
// 124 125 126 127 128
|
||||||
"RewRepValueId1, RewRepValueId2, RewRepValueId3, RewRepValueId4, RewRepValueId5,"
|
"`RewRepValueId1`, `RewRepValueId2`, `RewRepValueId3`, `RewRepValueId4`, `RewRepValueId5`,"
|
||||||
// 129 130 131 132 133
|
// 129 130 131 132 133
|
||||||
"RewRepValue1, RewRepValue2, RewRepValue3, RewRepValue4, RewRepValue5,"
|
"`RewRepValue1`, `RewRepValue2`, `RewRepValue3`, `RewRepValue4`, `RewRepValue5`,"
|
||||||
// 134 135 136 137 138 139
|
// 134 135 136 137 138 139
|
||||||
"RewHonorAddition, RewHonorMultiplier, RewOrReqMoney, RewMoneyMaxLevel, RewSpell, RewSpellCast,"
|
"`RewHonorAddition`, `RewHonorMultiplier`, `RewOrReqMoney`, `RewMoneyMaxLevel`, `RewSpell`, `RewSpellCast`,"
|
||||||
// 140 141 142 143 144 145
|
// 140 141 142 143 144 145
|
||||||
"RewMailTemplateId, RewMailDelaySecs, PointMapId, PointX, PointY, PointOpt,"
|
"`RewMailTemplateId`, `RewMailDelaySecs`, `PointMapId`, `PointX`, `PointY`, `PointOpt`,"
|
||||||
// 146 147 148 149 150 151 152 153
|
// 146 147 148 149 150 151 152 153
|
||||||
"DetailsEmote1, DetailsEmote2, DetailsEmote3, DetailsEmote4, DetailsEmoteDelay1, DetailsEmoteDelay2, DetailsEmoteDelay3, DetailsEmoteDelay4,"
|
"`DetailsEmote1`, `DetailsEmote2`, `DetailsEmote3`, `DetailsEmote4`, `DetailsEmoteDelay1`, `DetailsEmoteDelay2`, `DetailsEmoteDelay3`, `DetailsEmoteDelay4`,"
|
||||||
// 154 155 156 157 158 159
|
// 154 155 156 157 158 159
|
||||||
"IncompleteEmote, CompleteEmote, OfferRewardEmote1, OfferRewardEmote2, OfferRewardEmote3, OfferRewardEmote4,"
|
"`IncompleteEmote`, `CompleteEmote`, `OfferRewardEmote1`, `OfferRewardEmote2`, `OfferRewardEmote3`, `OfferRewardEmote4`,"
|
||||||
// 160 161 162 163
|
// 160 161 162 163
|
||||||
"OfferRewardEmoteDelay1, OfferRewardEmoteDelay2, OfferRewardEmoteDelay3, OfferRewardEmoteDelay4,"
|
"`OfferRewardEmoteDelay1`, `OfferRewardEmoteDelay2`, `OfferRewardEmoteDelay3`, `OfferRewardEmoteDelay4`,"
|
||||||
// 164 165 166 167
|
// 164 165 166 167
|
||||||
"SoundAccept, SoundTurnIn, StartScript, CompleteScript,"
|
"`SoundAccept`, `SoundTurnIn`, `StartScript`, `CompleteScript`"
|
||||||
// 168 169 170 171 172 173 174
|
// 168 169 170 171 172 173 174
|
||||||
"ReqSpellLearned, PortraitGiver, PortraitTurnIn, PortraitGiverName, PortraitGiverText, PortraitTurnInName, PortraitTurnInText, "
|
"`ReqSpellLearned`, `PortraitGiver`, `PortraitTurnIn`, `PortraitGiverName`, `PortraitGiverText`, `PortraitTurnInName`, `PortraitTurnInText`, "
|
||||||
// 175 176 177 178 179 180 181 182
|
// 175 176 177 178 179 180 181 182
|
||||||
"ReqCurrencyId1, ReqCurrencyId2, ReqCurrencyId3, ReqCurrencyId4, ReqCurrencyCount1, ReqCurrencyCount2, ReqCurrencyCount3, ReqCurrencyCount4, "
|
"`ReqCurrencyId1`, `ReqCurrencyId2`, `ReqCurrencyId3`, `ReqCurrencyId4`, `ReqCurrencyCount1`, `ReqCurrencyCount2`, `ReqCurrencyCount3`, `ReqCurrencyCount4`, "
|
||||||
// 183 184 185 186 187 188 189 190
|
// 183 184 185 186 187 188 189 190
|
||||||
"RewCurrencyId1, RewCurrencyId2, RewCurrencyId3, RewCurrencyId4, RewCurrencyCount1, RewCurrencyCount2, RewCurrencyCount3, RewCurrencyCount4, "
|
"`RewCurrencyId1`, `RewCurrencyId2`, `RewCurrencyId3`, `RewCurrencyId4`, `RewCurrencyCount1`, `RewCurrencyCount2`, `RewCurrencyCount3`, `RewCurrencyCount4`, "
|
||||||
// 191 192 193 194
|
// 191 192 193 194
|
||||||
"RewSkill, RewSkillValue, SoundAccept, SoundTurnIn "
|
"`RewSkill`, `RewSkillValue`, `SoundAccept`, `SoundTurnIn` "
|
||||||
" FROM quest_template");
|
" FROM `quest_template`");
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
BarGoLink bar(1);
|
BarGoLink bar(1);
|
||||||
|
|
@ -4841,17 +4841,17 @@ void ObjectMgr::LoadQuestLocales()
|
||||||
{
|
{
|
||||||
mQuestLocaleMap.clear(); // need for reload case
|
mQuestLocaleMap.clear(); // need for reload case
|
||||||
|
|
||||||
QueryResult* result = WorldDatabase.Query("SELECT entry,"
|
QueryResult* result = WorldDatabase.Query("SELECT `entry`,"
|
||||||
// 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
// 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
||||||
"Title_loc1,Details_loc1,Objectives_loc1,OfferRewardText_loc1,RequestItemsText_loc1,EndText_loc1,CompletedText_loc1,ObjectiveText1_loc1,ObjectiveText2_loc1,ObjectiveText3_loc1,ObjectiveText4_loc1,PortraitGiverName_loc1,PortraitGiverText_loc1,PortraitTurnInName_loc1,PortraitTurnInText_loc1,"
|
"`Title_loc1`,`Details_loc1`,`Objectives_loc1`,`OfferRewardText_loc1`,`RequestItemsText_loc1`,`EndText_loc1`,`CompletedText_loc1`,`ObjectiveText1_loc1`,`ObjectiveText2_loc1`,`ObjectiveText3_loc1`,`ObjectiveText4_loc1`,`PortraitGiverName_loc1`,`PortraitGiverText_loc1`,`PortraitTurnInName_loc1`,`PortraitTurnInText_loc1`,"
|
||||||
"Title_loc2,Details_loc2,Objectives_loc2,OfferRewardText_loc2,RequestItemsText_loc2,EndText_loc2,CompletedText_loc2,ObjectiveText1_loc2,ObjectiveText2_loc2,ObjectiveText3_loc2,ObjectiveText4_loc2,PortraitGiverName_loc2,PortraitGiverText_loc2,PortraitTurnInName_loc2,PortraitTurnInText_loc2,"
|
"`Title_loc2`,`Details_loc2`,`Objectives_loc2`,`OfferRewardText_loc2`,`RequestItemsText_loc2`,`EndText_loc2`,`CompletedText_loc2`,`ObjectiveText1_loc2`,`ObjectiveText2_loc2`,`ObjectiveText3_loc2`,`ObjectiveText4_loc2`,`PortraitGiverName_loc2`,`PortraitGiverText_loc2`,`PortraitTurnInName_loc2`,`PortraitTurnInText_loc2`,"
|
||||||
"Title_loc3,Details_loc3,Objectives_loc3,OfferRewardText_loc3,RequestItemsText_loc3,EndText_loc3,CompletedText_loc3,ObjectiveText1_loc3,ObjectiveText2_loc3,ObjectiveText3_loc3,ObjectiveText4_loc3,PortraitGiverName_loc3,PortraitGiverText_loc3,PortraitTurnInName_loc3,PortraitTurnInText_loc3,"
|
"`Title_loc3`,`Details_loc3`,`Objectives_loc3`,`OfferRewardText_loc3`,`RequestItemsText_loc3`,`EndText_loc3`,`CompletedText_loc3`,`ObjectiveText1_loc3`,`ObjectiveText2_loc3`,`ObjectiveText3_loc3`,`ObjectiveText4_loc3`,`PortraitGiverName_loc3`,`PortraitGiverText_loc3`,`PortraitTurnInName_loc3`,`PortraitTurnInText_loc3`,"
|
||||||
"Title_loc4,Details_loc4,Objectives_loc4,OfferRewardText_loc4,RequestItemsText_loc4,EndText_loc4,CompletedText_loc4,ObjectiveText1_loc4,ObjectiveText2_loc4,ObjectiveText3_loc4,ObjectiveText4_loc4,PortraitGiverName_loc4,PortraitGiverText_loc4,PortraitTurnInName_loc4,PortraitTurnInText_loc4,"
|
"`Title_loc4`,`Details_loc4`,`Objectives_loc4`,`OfferRewardText_loc4`,`RequestItemsText_loc4`,`EndText_loc4`,`CompletedText_loc4`,`ObjectiveText1_loc4`,`ObjectiveText2_loc4`,`ObjectiveText3_loc4`,`ObjectiveText4_loc4`,`PortraitGiverName_loc4`,`PortraitGiverText_loc4`,`PortraitTurnInName_loc4`,`PortraitTurnInText_loc4`,"
|
||||||
"Title_loc5,Details_loc5,Objectives_loc5,OfferRewardText_loc5,RequestItemsText_loc5,EndText_loc5,CompletedText_loc5,ObjectiveText1_loc5,ObjectiveText2_loc5,ObjectiveText3_loc5,ObjectiveText4_loc5,PortraitGiverName_loc5,PortraitGiverText_loc5,PortraitTurnInName_loc5,PortraitTurnInText_loc5,"
|
"`Title_loc5`,`Details_loc5`,`Objectives_loc5`,`OfferRewardText_loc5`,`RequestItemsText_loc5`,`EndText_loc5`,`CompletedText_loc5`,`ObjectiveText1_loc5`,`ObjectiveText2_loc5`,`ObjectiveText3_loc5`,`ObjectiveText4_loc5`,`PortraitGiverName_loc5`,`PortraitGiverText_loc5`,`PortraitTurnInName_loc5`,`PortraitTurnInText_loc5`,"
|
||||||
"Title_loc6,Details_loc6,Objectives_loc6,OfferRewardText_loc6,RequestItemsText_loc6,EndText_loc6,CompletedText_loc6,ObjectiveText1_loc6,ObjectiveText2_loc6,ObjectiveText3_loc6,ObjectiveText4_loc6,PortraitGiverName_loc6,PortraitGiverText_loc6,PortraitTurnInName_loc6,PortraitTurnInText_loc6,"
|
"`Title_loc6`,`Details_loc6`,`Objectives_loc6`,`OfferRewardText_loc6`,`RequestItemsText_loc6`,`EndText_loc6`,`CompletedText_loc6`,`ObjectiveText1_loc6`,`ObjectiveText2_loc6`,`ObjectiveText3_loc6`,`ObjectiveText4_loc6`,`PortraitGiverName_loc6`,`PortraitGiverText_loc6`,`PortraitTurnInName_loc6`,`PortraitTurnInText_loc6`,"
|
||||||
"Title_loc7,Details_loc7,Objectives_loc7,OfferRewardText_loc7,RequestItemsText_loc7,EndText_loc7,CompletedText_loc7,ObjectiveText1_loc7,ObjectiveText2_loc7,ObjectiveText3_loc7,ObjectiveText4_loc7,PortraitGiverName_loc7,PortraitGiverText_loc7,PortraitTurnInName_loc7,PortraitTurnInText_loc7,"
|
"`Title_loc7`,`Details_loc7`,`Objectives_loc7`,`OfferRewardText_loc7`,`RequestItemsText_loc7`,`EndText_loc7`,`CompletedText_loc7`,`ObjectiveText1_loc7`,`ObjectiveText2_loc7`,`ObjectiveText3_loc7`,`ObjectiveText4_loc7`,`PortraitGiverName_loc7`,`PortraitGiverText_loc7`,`PortraitTurnInName_loc7`,`PortraitTurnInText_loc7`,"
|
||||||
"Title_loc8,Details_loc8,Objectives_loc8,OfferRewardText_loc8,RequestItemsText_loc8,EndText_loc8,CompletedText_loc8,ObjectiveText1_loc8,ObjectiveText2_loc8,ObjectiveText3_loc8,ObjectiveText4_loc8,PortraitGiverName_loc8,PortraitGiverText_loc8,PortraitTurnInName_loc8,PortraitTurnInText_loc8"
|
"`Title_loc8`,`Details_loc8`,`Objectives_loc8`,`OfferRewardText_loc8`,`RequestItemsText_loc8`,`EndText_loc8`,`CompletedText_loc8`,`ObjectiveText1_loc8`,`ObjectiveText2_loc8`,`ObjectiveText3_loc8`,`ObjectiveText4_loc8`,`PortraitGiverName_loc8`,`PortraitGiverText_loc8`,`PortraitTurnInName_loc8`,`PortraitTurnInText_loc8`"
|
||||||
" FROM locales_quest"
|
" FROM `locales_quest`"
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
|
|
@ -5169,7 +5169,7 @@ void ObjectMgr::LoadInstanceEncounters()
|
||||||
{
|
{
|
||||||
m_DungeonEncounters.clear(); // need for reload case
|
m_DungeonEncounters.clear(); // need for reload case
|
||||||
|
|
||||||
QueryResult* result = WorldDatabase.Query("SELECT entry, creditType, creditEntry, lastEncounterDungeon FROM instance_encounters");
|
QueryResult* result = WorldDatabase.Query("SELECT `entry`, `creditType`, `creditEntry`, `lastEncounterDungeon` FROM `instance_encounters`");
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
|
|
@ -5378,7 +5378,7 @@ GossipText const* ObjectMgr::GetGossipText(uint32 Text_ID) const
|
||||||
|
|
||||||
void ObjectMgr::LoadGossipText()
|
void ObjectMgr::LoadGossipText()
|
||||||
{
|
{
|
||||||
QueryResult* result = WorldDatabase.Query("SELECT * FROM npc_text");
|
QueryResult* result = WorldDatabase.Query("SELECT * FROM `npc_text`");
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
if (!result)
|
if (!result)
|
||||||
|
|
@ -5437,16 +5437,16 @@ void ObjectMgr::LoadGossipTextLocales()
|
||||||
{
|
{
|
||||||
mNpcTextLocaleMap.clear(); // need for reload case
|
mNpcTextLocaleMap.clear(); // need for reload case
|
||||||
|
|
||||||
QueryResult* result = WorldDatabase.Query("SELECT entry,"
|
QueryResult* result = WorldDatabase.Query("SELECT `entry`,"
|
||||||
"Text0_0_loc1,Text0_1_loc1,Text1_0_loc1,Text1_1_loc1,Text2_0_loc1,Text2_1_loc1,Text3_0_loc1,Text3_1_loc1,Text4_0_loc1,Text4_1_loc1,Text5_0_loc1,Text5_1_loc1,Text6_0_loc1,Text6_1_loc1,Text7_0_loc1,Text7_1_loc1,"
|
"`Text0_0_loc1`,`Text0_1_loc1`,`Text1_0_loc1`,`Text1_1_loc1`,`Text2_0_loc1`,`Text2_1_loc1`,`Text3_0_loc1`,`Text3_1_loc1`,`Text4_0_loc1`,`Text4_1_loc1`,`Text5_0_loc1`,`Text5_1_loc1`,`Text6_0_loc1`,`Text6_1_loc1`,`Text7_0_loc1`,`Text7_1_loc1`,"
|
||||||
"Text0_0_loc2,Text0_1_loc2,Text1_0_loc2,Text1_1_loc2,Text2_0_loc2,Text2_1_loc2,Text3_0_loc2,Text3_1_loc1,Text4_0_loc2,Text4_1_loc2,Text5_0_loc2,Text5_1_loc2,Text6_0_loc2,Text6_1_loc2,Text7_0_loc2,Text7_1_loc2,"
|
"`Text0_0_loc2`,`Text0_1_loc2`,`Text1_0_loc2`,`Text1_1_loc2`,`Text2_0_loc2`,`Text2_1_loc2`,`Text3_0_loc2`,`Text3_1_loc1`,`Text4_0_loc2`,`Text4_1_loc2`,`Text5_0_loc2`,`Text5_1_loc2`,`Text6_0_loc2`,`Text6_1_loc2`,`Text7_0_loc2`,`Text7_1_loc2`,"
|
||||||
"Text0_0_loc3,Text0_1_loc3,Text1_0_loc3,Text1_1_loc3,Text2_0_loc3,Text2_1_loc3,Text3_0_loc3,Text3_1_loc1,Text4_0_loc3,Text4_1_loc3,Text5_0_loc3,Text5_1_loc3,Text6_0_loc3,Text6_1_loc3,Text7_0_loc3,Text7_1_loc3,"
|
"`Text0_0_loc3`,`Text0_1_loc3`,`Text1_0_loc3`,`Text1_1_loc3`,`Text2_0_loc3`,`Text2_1_loc3`,`Text3_0_loc3`,`Text3_1_loc1`,`Text4_0_loc3`,`Text4_1_loc3`,`Text5_0_loc3`,`Text5_1_loc3`,`Text6_0_loc3`,`Text6_1_loc3`,`Text7_0_loc3`,`Text7_1_loc3`,"
|
||||||
"Text0_0_loc4,Text0_1_loc4,Text1_0_loc4,Text1_1_loc4,Text2_0_loc4,Text2_1_loc4,Text3_0_loc4,Text3_1_loc1,Text4_0_loc4,Text4_1_loc4,Text5_0_loc4,Text5_1_loc4,Text6_0_loc4,Text6_1_loc4,Text7_0_loc4,Text7_1_loc4,"
|
"`Text0_0_loc4`,`Text0_1_loc4`,`Text1_0_loc4`,`Text1_1_loc4`,`Text2_0_loc4`,`Text2_1_loc4`,`Text3_0_loc4`,`Text3_1_loc1`,`Text4_0_loc4`,`Text4_1_loc4`,`Text5_0_loc4`,`Text5_1_loc4`,`Text6_0_loc4`,`Text6_1_loc4`,`Text7_0_loc4`,`Text7_1_loc4`,"
|
||||||
"Text0_0_loc5,Text0_1_loc5,Text1_0_loc5,Text1_1_loc5,Text2_0_loc5,Text2_1_loc5,Text3_0_loc5,Text3_1_loc1,Text4_0_loc5,Text4_1_loc5,Text5_0_loc5,Text5_1_loc5,Text6_0_loc5,Text6_1_loc5,Text7_0_loc5,Text7_1_loc5,"
|
"`Text0_0_loc5`,`Text0_1_loc5`,`Text1_0_loc5`,`Text1_1_loc5`,`Text2_0_loc5`,`Text2_1_loc5`,`Text3_0_loc5`,`Text3_1_loc1`,`Text4_0_loc5`,`Text4_1_loc5`,`Text5_0_loc5`,`Text5_1_loc5`,`Text6_0_loc5`,`Text6_1_loc5`,`Text7_0_loc5`,`Text7_1_loc5`,"
|
||||||
"Text0_0_loc6,Text0_1_loc6,Text1_0_loc6,Text1_1_loc6,Text2_0_loc6,Text2_1_loc6,Text3_0_loc6,Text3_1_loc1,Text4_0_loc6,Text4_1_loc6,Text5_0_loc6,Text5_1_loc6,Text6_0_loc6,Text6_1_loc6,Text7_0_loc6,Text7_1_loc6,"
|
"`Text0_0_loc6`,`Text0_1_loc6`,`Text1_0_loc6`,`Text1_1_loc6`,`Text2_0_loc6`,`Text2_1_loc6`,`Text3_0_loc6`,`Text3_1_loc1`,`Text4_0_loc6`,`Text4_1_loc6`,`Text5_0_loc6`,`Text5_1_loc6`,`Text6_0_loc6`,`Text6_1_loc6`,`Text7_0_loc6`,`Text7_1_loc6`,"
|
||||||
"Text0_0_loc7,Text0_1_loc7,Text1_0_loc7,Text1_1_loc7,Text2_0_loc7,Text2_1_loc7,Text3_0_loc7,Text3_1_loc1,Text4_0_loc7,Text4_1_loc7,Text5_0_loc7,Text5_1_loc7,Text6_0_loc7,Text6_1_loc7,Text7_0_loc7,Text7_1_loc7, "
|
"`Text0_0_loc7`,`Text0_1_loc7`,`Text1_0_loc7`,`Text1_1_loc7`,`Text2_0_loc7`,`Text2_1_loc7`,`Text3_0_loc7`,`Text3_1_loc1`,`Text4_0_loc7`,`Text4_1_loc7`,`Text5_0_loc7`,`Text5_1_loc7`,`Text6_0_loc7`,`Text6_1_loc7`,`Text7_0_loc7`,`Text7_1_loc7`, "
|
||||||
"Text0_0_loc8,Text0_1_loc8,Text1_0_loc8,Text1_1_loc8,Text2_0_loc8,Text2_1_loc8,Text3_0_loc8,Text3_1_loc1,Text4_0_loc8,Text4_1_loc8,Text5_0_loc8,Text5_1_loc8,Text6_0_loc8,Text6_1_loc8,Text7_0_loc8,Text7_1_loc8 "
|
"`Text0_0_loc8`,`Text0_1_loc8`,`Text1_0_loc8`,`Text1_1_loc8`,`Text2_0_loc8`,`Text2_1_loc8`,`Text3_0_loc8`,`Text3_1_loc1`,`Text4_0_loc8`,`Text4_1_loc8`,`Text5_0_loc8`,`Text5_1_loc8`,`Text6_0_loc8`,`Text6_1_loc8`,`Text7_0_loc8`,`Text7_1_loc8` "
|
||||||
" FROM locales_npc_text");
|
" FROM `locales_npc_text`");
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
|
|
@ -5526,9 +5526,11 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp)
|
||||||
DEBUG_LOG("Returning mails current time: hour: %d, minute: %d, second: %d ", localtime(&basetime)->tm_hour, localtime(&basetime)->tm_min, localtime(&basetime)->tm_sec);
|
DEBUG_LOG("Returning mails current time: hour: %d, minute: %d, second: %d ", localtime(&basetime)->tm_hour, localtime(&basetime)->tm_min, localtime(&basetime)->tm_sec);
|
||||||
// delete all old mails without item and without body immediately, if starting server
|
// delete all old mails without item and without body immediately, if starting server
|
||||||
if (!serverUp)
|
if (!serverUp)
|
||||||
CharacterDatabase.PExecute("DELETE FROM mail WHERE expire_time < '" UI64FMTD "' AND has_items = '0' AND body = ''", (uint64)basetime);
|
{
|
||||||
|
CharacterDatabase.PExecute("DELETE FROM `mail` WHERE `expire_time` < '" UI64FMTD "' AND `has_items` = '0' AND `body` = ''", (uint64)basetime);
|
||||||
|
}
|
||||||
// 0 1 2 3 4 5 6 7 8
|
// 0 1 2 3 4 5 6 7 8
|
||||||
QueryResult* result = CharacterDatabase.PQuery("SELECT id,messageType,sender,receiver,has_items,expire_time,cod,checked,mailTemplateId FROM mail WHERE expire_time < '" UI64FMTD "'", (uint64)basetime);
|
QueryResult* result = CharacterDatabase.PQuery("SELECT `id`,`messageType`,`sender`,`receiver`,`has_items`,`expire_time`,`cod`,`checked`,`mailTemplateId` FROM `mail` WHERE `expire_time` < '" UI64FMTD "'", (uint64)basetime);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
BarGoLink bar(1);
|
BarGoLink bar(1);
|
||||||
|
|
@ -5540,8 +5542,8 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp)
|
||||||
|
|
||||||
// std::ostringstream delitems, delmails; // will be here for optimization
|
// std::ostringstream delitems, delmails; // will be here for optimization
|
||||||
// bool deletemail = false, deleteitem = false;
|
// bool deletemail = false, deleteitem = false;
|
||||||
// delitems << "DELETE FROM item_instance WHERE guid IN ( ";
|
// delitems << "DELETE FROM `item_instance` WHERE `guid` IN ( ";
|
||||||
// delmails << "DELETE FROM mail WHERE id IN ( "
|
// delmails << "DELETE FROM `mail` WHERE `id` IN ( "
|
||||||
|
|
||||||
BarGoLink bar(result->GetRowCount());
|
BarGoLink bar(result->GetRowCount());
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
|
|
@ -5579,7 +5581,7 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp)
|
||||||
// delete or return mail:
|
// delete or return mail:
|
||||||
if (has_items)
|
if (has_items)
|
||||||
{
|
{
|
||||||
QueryResult* resultItems = CharacterDatabase.PQuery("SELECT item_guid,item_template FROM mail_items WHERE mail_id='%u'", m->messageID);
|
QueryResult* resultItems = CharacterDatabase.PQuery("SELECT `item_guid`,`item_template` FROM `mail_items` WHERE `mail_id`='%u'", m->messageID);
|
||||||
if (resultItems)
|
if (resultItems)
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
|
|
@ -5601,19 +5603,19 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp)
|
||||||
// mail open and then not returned
|
// mail open and then not returned
|
||||||
for (MailItemInfoVec::iterator itr2 = m->items.begin(); itr2 != m->items.end(); ++itr2)
|
for (MailItemInfoVec::iterator itr2 = m->items.begin(); itr2 != m->items.end(); ++itr2)
|
||||||
{
|
{
|
||||||
CharacterDatabase.PExecute("DELETE FROM item_instance WHERE guid = '%u'", itr2->item_guid);
|
CharacterDatabase.PExecute("DELETE FROM `item_instance` WHERE `guid` = '%u'", itr2->item_guid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// mail will be returned:
|
// mail will be returned:
|
||||||
CharacterDatabase.PExecute("UPDATE mail SET sender = '%u', receiver = '%u', expire_time = '" UI64FMTD "', deliver_time = '" UI64FMTD "',cod = '0', checked = '%u' WHERE id = '%u'",
|
CharacterDatabase.PExecute("UPDATE `mail` SET `sender` = '%u', `receiver` = '%u', `expire_time` = '" UI64FMTD "', `deliver_time` = '" UI64FMTD "', `cod` = '0', `checked` = '%u' WHERE `id` = '%u'",
|
||||||
m->receiverGuid.GetCounter(), m->sender, (uint64)(basetime + 30 * DAY), (uint64)basetime, MAIL_CHECK_MASK_RETURNED, m->messageID);
|
m->receiverGuid.GetCounter(), m->sender, (uint64)(basetime + 30 * DAY), (uint64)basetime, MAIL_CHECK_MASK_RETURNED, m->messageID);
|
||||||
for (MailItemInfoVec::iterator itr2 = m->items.begin(); itr2 != m->items.end(); ++itr2)
|
for (MailItemInfoVec::iterator itr2 = m->items.begin(); itr2 != m->items.end(); ++itr2)
|
||||||
{
|
{
|
||||||
// update receiver in mail items for its proper delivery, and in instance_item for avoid lost item at sender delete
|
// update receiver in mail items for its proper delivery, and in instance_item for avoid lost item at sender delete
|
||||||
CharacterDatabase.PExecute("UPDATE mail_items SET receiver = %u WHERE item_guid = '%u'", m->sender, itr2->item_guid);
|
CharacterDatabase.PExecute("UPDATE `mail_items` SET `receiver` = %u WHERE `item_guid` = '%u'", m->sender, itr2->item_guid);
|
||||||
CharacterDatabase.PExecute("UPDATE item_instance SET owner_guid = %u WHERE guid = '%u'", m->sender, itr2->item_guid);
|
CharacterDatabase.PExecute("UPDATE `item_instance` SET `owner_guid` = %u WHERE `guid` = '%u'", m->sender, itr2->item_guid);
|
||||||
}
|
}
|
||||||
delete m;
|
delete m;
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -5622,7 +5624,7 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp)
|
||||||
|
|
||||||
// deletemail = true;
|
// deletemail = true;
|
||||||
// delmails << m->messageID << ", ";
|
// delmails << m->messageID << ", ";
|
||||||
CharacterDatabase.PExecute("DELETE FROM mail WHERE id = '%u'", m->messageID);
|
CharacterDatabase.PExecute("DELETE FROM `mail` WHERE id` = '%u'", m->messageID);
|
||||||
delete m;
|
delete m;
|
||||||
++count;
|
++count;
|
||||||
}
|
}
|
||||||
|
|
@ -5637,7 +5639,7 @@ void ObjectMgr::LoadQuestAreaTriggers()
|
||||||
{
|
{
|
||||||
mQuestAreaTriggerMap.clear(); // need for reload case
|
mQuestAreaTriggerMap.clear(); // need for reload case
|
||||||
|
|
||||||
QueryResult* result = WorldDatabase.PQuery("SELECT entry, quest FROM quest_relations WHERE actor = %d", QA_AREATRIGGER);
|
QueryResult* result = WorldDatabase.PQuery("SELECT `entry`, `quest` FROM `quest_relations` WHERE `actor` = %d", QA_AREATRIGGER);
|
||||||
|
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
|
|
||||||
|
|
@ -5701,7 +5703,7 @@ void ObjectMgr::LoadTavernAreaTriggers()
|
||||||
{
|
{
|
||||||
mTavernAreaTriggerSet.clear(); // need for reload case
|
mTavernAreaTriggerSet.clear(); // need for reload case
|
||||||
|
|
||||||
QueryResult* result = WorldDatabase.Query("SELECT id FROM areatrigger_tavern");
|
QueryResult* result = WorldDatabase.Query("SELECT `id` FROM `areatrigger_tavern`");
|
||||||
|
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
|
|
||||||
|
|
@ -5862,7 +5864,7 @@ void ObjectMgr::LoadGraveyardZones()
|
||||||
{
|
{
|
||||||
mGraveYardMap.clear(); // need for reload case
|
mGraveYardMap.clear(); // need for reload case
|
||||||
|
|
||||||
QueryResult* result = WorldDatabase.Query("SELECT id,ghost_zone,faction FROM game_graveyard_zone");
|
QueryResult* result = WorldDatabase.Query("SELECT `id`,`ghost_zone`,`faction` FROM `game_graveyard_zone`");
|
||||||
|
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
|
|
||||||
|
|
@ -6076,7 +6078,7 @@ bool ObjectMgr::AddGraveYardLink(uint32 id, uint32 zoneId, Team team, bool inDB)
|
||||||
// add link to DB
|
// add link to DB
|
||||||
if (inDB)
|
if (inDB)
|
||||||
{
|
{
|
||||||
WorldDatabase.PExecuteLog("INSERT INTO game_graveyard_zone ( id,ghost_zone,faction) VALUES ('%u', '%u','%u')", id, zoneId, uint32(team));
|
WorldDatabase.PExecuteLog("INSERT INTO `game_graveyard_zone` (`id`,`ghost_zone`,`faction`) VALUES ('%u', '%u','%u')", id, zoneId, uint32(team));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -6117,7 +6119,7 @@ void ObjectMgr::LoadAreaTriggerTeleports()
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
|
|
||||||
// 0 1 2 3 4 5 6 7 8 9 10 11 12
|
// 0 1 2 3 4 5 6 7 8 9 10 11 12
|
||||||
QueryResult* result = WorldDatabase.Query("SELECT id, required_level, required_item, required_item2, heroic_key, heroic_key2, required_quest_done, required_quest_done_heroic, target_map, target_position_x, target_position_y, target_position_z, target_orientation FROM areatrigger_teleport");
|
QueryResult* result = WorldDatabase.Query("SELECT `id`, `required_level`, `required_item`, `required_item2`, `heroic_key`, `heroic_key2`, `required_quest_done`, `required_quest_done_heroic`, `target_map`, `target_position_x`, `target_position_y`, `target_position_z`, `target_orientation` FROM `areatrigger_teleport`");
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
BarGoLink bar(1);
|
BarGoLink bar(1);
|
||||||
|
|
@ -6345,7 +6347,7 @@ void ObjectMgr::PackGroupIds()
|
||||||
// all valid ids are in the instance table
|
// all valid ids are in the instance table
|
||||||
// any associations to ids not in this table are assumed to be
|
// any associations to ids not in this table are assumed to be
|
||||||
// cleaned already in CleanupInstances
|
// cleaned already in CleanupInstances
|
||||||
QueryResult* result = CharacterDatabase.Query("SELECT groupId FROM groups");
|
QueryResult* result = CharacterDatabase.Query("SELECT `groupId` FROM `groups`");
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
|
|
@ -6357,8 +6359,8 @@ void ObjectMgr::PackGroupIds()
|
||||||
if (id == 0)
|
if (id == 0)
|
||||||
{
|
{
|
||||||
CharacterDatabase.BeginTransaction();
|
CharacterDatabase.BeginTransaction();
|
||||||
CharacterDatabase.PExecute("DELETE FROM groups WHERE groupId = '%u'", id);
|
CharacterDatabase.PExecute("DELETE FROM `groups` WHERE `groupId` = '%u'", id);
|
||||||
CharacterDatabase.PExecute("DELETE FROM group_member WHERE groupId = '%u'", id);
|
CharacterDatabase.PExecute("DELETE FROM `group_member` WHERE `groupId` = '%u'", id);
|
||||||
CharacterDatabase.CommitTransaction();
|
CharacterDatabase.CommitTransaction();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -6380,8 +6382,8 @@ void ObjectMgr::PackGroupIds()
|
||||||
{
|
{
|
||||||
// remap group id
|
// remap group id
|
||||||
CharacterDatabase.BeginTransaction();
|
CharacterDatabase.BeginTransaction();
|
||||||
CharacterDatabase.PExecute("UPDATE groups SET groupId = '%u' WHERE groupId = '%u'", groupId, *i);
|
CharacterDatabase.PExecute("UPDATE `groups` SET `groupId` = '%u' WHERE `groupId` = '%u'", groupId, *i);
|
||||||
CharacterDatabase.PExecute("UPDATE group_member SET groupId = '%u' WHERE groupId = '%u'", groupId, *i);
|
CharacterDatabase.PExecute("UPDATE `group_member` SET `groupId` = '%u' WHERE `groupId` = '%u'", groupId, *i);
|
||||||
CharacterDatabase.CommitTransaction();
|
CharacterDatabase.CommitTransaction();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -6395,21 +6397,21 @@ void ObjectMgr::PackGroupIds()
|
||||||
|
|
||||||
void ObjectMgr::SetHighestGuids()
|
void ObjectMgr::SetHighestGuids()
|
||||||
{
|
{
|
||||||
QueryResult* result = CharacterDatabase.Query("SELECT MAX(guid) FROM characters");
|
QueryResult* result = CharacterDatabase.Query("SELECT MAX(`guid`) FROM `characters`");
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
m_CharGuids.Set((*result)[0].GetUInt32() + 1);
|
m_CharGuids.Set((*result)[0].GetUInt32() + 1);
|
||||||
delete result;
|
delete result;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = WorldDatabase.Query("SELECT MAX(guid) FROM creature");
|
result = WorldDatabase.Query("SELECT MAX(`guid`) FROM `creature`");
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
m_FirstTemporaryCreatureGuid = (*result)[0].GetUInt32() + 1;
|
m_FirstTemporaryCreatureGuid = (*result)[0].GetUInt32() + 1;
|
||||||
delete result;
|
delete result;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = CharacterDatabase.Query("SELECT MAX(guid) FROM item_instance");
|
result = CharacterDatabase.Query("SELECT MAX(`guid`) FROM `item_instance`");
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
m_ItemGuids.Set((*result)[0].GetUInt32() + 1);
|
m_ItemGuids.Set((*result)[0].GetUInt32() + 1);
|
||||||
|
|
@ -6425,62 +6427,62 @@ void ObjectMgr::SetHighestGuids()
|
||||||
|
|
||||||
// Cleanup other tables from nonexistent guids (>=m_hiItemGuid)
|
// Cleanup other tables from nonexistent guids (>=m_hiItemGuid)
|
||||||
CharacterDatabase.BeginTransaction();
|
CharacterDatabase.BeginTransaction();
|
||||||
CharacterDatabase.PExecute("DELETE FROM character_inventory WHERE item >= '%u'", m_ItemGuids.GetNextAfterMaxUsed());
|
CharacterDatabase.PExecute("DELETE FROM `character_inventory` WHERE `item` >= '%u'", m_ItemGuids.GetNextAfterMaxUsed());
|
||||||
CharacterDatabase.PExecute("DELETE FROM mail_items WHERE item_guid >= '%u'", m_ItemGuids.GetNextAfterMaxUsed());
|
CharacterDatabase.PExecute("DELETE FROM `mail_items` WHERE `item_guid` >= '%u'", m_ItemGuids.GetNextAfterMaxUsed());
|
||||||
CharacterDatabase.PExecute("DELETE FROM auction WHERE itemguid >= '%u'", m_ItemGuids.GetNextAfterMaxUsed());
|
CharacterDatabase.PExecute("DELETE FROM `auction` WHERE `itemguid` >= '%u'", m_ItemGuids.GetNextAfterMaxUsed());
|
||||||
CharacterDatabase.PExecute("DELETE FROM guild_bank_item WHERE item_guid >= '%u'", m_ItemGuids.GetNextAfterMaxUsed());
|
CharacterDatabase.PExecute("DELETE FROM `guild_bank_item` WHERE `item_guid` >= '%u'", m_ItemGuids.GetNextAfterMaxUsed());
|
||||||
CharacterDatabase.CommitTransaction();
|
CharacterDatabase.CommitTransaction();
|
||||||
|
|
||||||
result = WorldDatabase.Query("SELECT MAX(guid) FROM gameobject");
|
result = WorldDatabase.Query("SELECT MAX(`guid`) FROM `gameobject`");
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
m_FirstTemporaryGameObjectGuid = (*result)[0].GetUInt32() + 1;
|
m_FirstTemporaryGameObjectGuid = (*result)[0].GetUInt32() + 1;
|
||||||
delete result;
|
delete result;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = CharacterDatabase.Query("SELECT MAX(id) FROM auction");
|
result = CharacterDatabase.Query("SELECT MAX(`id`) FROM `auction`");
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
m_AuctionIds.Set((*result)[0].GetUInt32() + 1);
|
m_AuctionIds.Set((*result)[0].GetUInt32() + 1);
|
||||||
delete result;
|
delete result;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = CharacterDatabase.Query("SELECT MAX(id) FROM mail");
|
result = CharacterDatabase.Query("SELECT MAX(`id`) FROM `mail`");
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
m_MailIds.Set((*result)[0].GetUInt32() + 1);
|
m_MailIds.Set((*result)[0].GetUInt32() + 1);
|
||||||
delete result;
|
delete result;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = CharacterDatabase.Query("SELECT MAX(guid) FROM corpse");
|
result = CharacterDatabase.Query("SELECT MAX(`guid`) FROM `corpse`");
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
m_CorpseGuids.Set((*result)[0].GetUInt32() + 1);
|
m_CorpseGuids.Set((*result)[0].GetUInt32() + 1);
|
||||||
delete result;
|
delete result;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = CharacterDatabase.Query("SELECT MAX(arenateamid) FROM arena_team");
|
result = CharacterDatabase.Query("SELECT MAX(`arenateamid`) FROM `arena_team`");
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
m_ArenaTeamIds.Set((*result)[0].GetUInt32() + 1);
|
m_ArenaTeamIds.Set((*result)[0].GetUInt32() + 1);
|
||||||
delete result;
|
delete result;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = CharacterDatabase.Query("SELECT MAX(setguid) FROM character_equipmentsets");
|
result = CharacterDatabase.Query("SELECT MAX(`setguid`) FROM `character_equipmentsets`");
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
m_EquipmentSetIds.Set((*result)[0].GetUInt64() + 1);
|
m_EquipmentSetIds.Set((*result)[0].GetUInt64() + 1);
|
||||||
delete result;
|
delete result;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = CharacterDatabase.Query("SELECT MAX(guildid) FROM guild");
|
result = CharacterDatabase.Query("SELECT MAX(`guildid`) FROM `guild`");
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
m_GuildIds.Set((*result)[0].GetUInt32() + 1);
|
m_GuildIds.Set((*result)[0].GetUInt32() + 1);
|
||||||
delete result;
|
delete result;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = CharacterDatabase.Query("SELECT MAX(groupId) FROM groups");
|
result = CharacterDatabase.Query("SELECT MAX(`groupId`) FROM `groups`");
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
m_GroupGuids.Set((*result)[0].GetUInt32() + 1);
|
m_GroupGuids.Set((*result)[0].GetUInt32() + 1);
|
||||||
|
|
@ -6499,10 +6501,10 @@ void ObjectMgr::LoadGameObjectLocales()
|
||||||
{
|
{
|
||||||
mGameObjectLocaleMap.clear(); // need for reload case
|
mGameObjectLocaleMap.clear(); // need for reload case
|
||||||
|
|
||||||
QueryResult* result = WorldDatabase.Query("SELECT entry,"
|
QueryResult* result = WorldDatabase.Query("SELECT `entry`,"
|
||||||
"name_loc1,name_loc2,name_loc3,name_loc4,name_loc5,name_loc6,name_loc7,name_loc8,"
|
"`name_loc1`,`name_loc2`,`name_loc3`,`name_loc4`,`name_loc5`,`name_loc6`,`name_loc7`,`name_loc8`,"
|
||||||
"castbarcaption_loc1,castbarcaption_loc2,castbarcaption_loc3,castbarcaption_loc4,"
|
"`castbarcaption_loc1`,`castbarcaption_loc2`,`castbarcaption_loc3`,`castbarcaption_loc4`,"
|
||||||
"castbarcaption_loc5,castbarcaption_loc6,castbarcaption_loc7,castbarcaption_loc8 FROM locales_gameobject");
|
"`castbarcaption_loc5`,`castbarcaption_loc6`,`castbarcaption_loc7`,`castbarcaption_loc8` FROM `locales_gameobject`");
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
|
|
@ -6923,7 +6925,7 @@ void ObjectMgr::LoadGameobjectInfo()
|
||||||
void ObjectMgr::LoadExplorationBaseXP()
|
void ObjectMgr::LoadExplorationBaseXP()
|
||||||
{
|
{
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
QueryResult* result = WorldDatabase.Query("SELECT level,basexp FROM exploration_basexp");
|
QueryResult* result = WorldDatabase.Query("SELECT `level`,`basexp` FROM `exploration_basexp`");
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
|
|
@ -6974,7 +6976,7 @@ uint32 ObjectMgr::GetXPForLevel(uint32 level) const
|
||||||
void ObjectMgr::LoadPetNames()
|
void ObjectMgr::LoadPetNames()
|
||||||
{
|
{
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
QueryResult* result = WorldDatabase.Query("SELECT word,entry,half FROM pet_name_generation");
|
QueryResult* result = WorldDatabase.Query("SELECT `word`,`entry`,`half` FROM `pet_name_generation`");
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
|
|
@ -7016,7 +7018,7 @@ void ObjectMgr::LoadPetNames()
|
||||||
|
|
||||||
void ObjectMgr::LoadPetNumber()
|
void ObjectMgr::LoadPetNumber()
|
||||||
{
|
{
|
||||||
QueryResult* result = CharacterDatabase.Query("SELECT MAX(id) FROM character_pet");
|
QueryResult* result = CharacterDatabase.Query("SELECT MAX(`id`) FROM `character_pet`");
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
Field* fields = result->Fetch();
|
Field* fields = result->Fetch();
|
||||||
|
|
@ -7054,11 +7056,11 @@ void ObjectMgr::LoadCorpses()
|
||||||
{
|
{
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
// 0 1 2 3 4 5 6
|
// 0 1 2 3 4 5 6
|
||||||
QueryResult* result = CharacterDatabase.Query("SELECT corpse.guid, player, corpse.position_x, corpse.position_y, corpse.position_z, corpse.orientation, corpse.map, "
|
QueryResult* result = CharacterDatabase.Query("SELECT `corpse`.`guid`, `player`, `corpse`.`position_x`, `corpse`.`position_y`, `corpse`.`position_z`, `corpse`.`orientation`, `corpse`.`map`, "
|
||||||
// 7 8 9 10 11 12 13 14 15 16 17 18
|
// 7 8 9 10 11 12 13 14 15 16 17 18
|
||||||
"time, corpse_type, instance, phaseMask, gender, race, class, playerBytes, playerBytes2, equipmentCache, guildId, playerFlags FROM corpse "
|
"`time`, `corpse_type`, `instance`, `phaseMask`, `gender`, `race`, `class`, `playerBytes`, `playerBytes2`, `equipmentCache`, `guildId`, `playerFlags` FROM `corpse` "
|
||||||
"JOIN characters ON player = characters.guid "
|
"JOIN `characters` ON `player` = `characters`.`guid` "
|
||||||
"LEFT JOIN guild_member ON player=guild_member.guid WHERE corpse_type <> 0");
|
"LEFT JOIN `guild_member` ON `player`=`guild_member`.`guid` WHERE `corpse_type` <> 0");
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
|
|
@ -7104,7 +7106,7 @@ void ObjectMgr::LoadReputationRewardRate()
|
||||||
m_RepRewardRateMap.clear(); // for reload case
|
m_RepRewardRateMap.clear(); // for reload case
|
||||||
|
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
QueryResult* result = WorldDatabase.Query("SELECT faction, quest_rate, creature_rate, spell_rate FROM reputation_reward_rate");
|
QueryResult* result = WorldDatabase.Query("SELECT `faction`, `quest_rate`, `creature_rate`, `spell_rate` FROM `reputation_reward_rate`");
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
|
|
@ -7175,10 +7177,10 @@ void ObjectMgr::LoadReputationOnKill()
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
|
|
||||||
// 0 1 2
|
// 0 1 2
|
||||||
QueryResult* result = WorldDatabase.Query("SELECT creature_id, RewOnKillRepFaction1, RewOnKillRepFaction2,"
|
QueryResult* result = WorldDatabase.Query("SELECT `creature_id`, `RewOnKillRepFaction1`, `RewOnKillRepFaction2`,"
|
||||||
// 3 4 5 6 7 8 9
|
// 3 4 5 6 7 8 9
|
||||||
"IsTeamAward1, MaxStanding1, RewOnKillRepValue1, IsTeamAward2, MaxStanding2, RewOnKillRepValue2, TeamDependent "
|
"`IsTeamAward1`, `MaxStanding1`, `RewOnKillRepValue1`, `IsTeamAward2`, `MaxStanding2`, `RewOnKillRepValue2`, `TeamDependent` "
|
||||||
"FROM creature_onkill_reputation");
|
"FROM `creature_onkill_reputation`");
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
|
|
@ -7254,7 +7256,7 @@ void ObjectMgr::LoadReputationSpilloverTemplate()
|
||||||
m_RepSpilloverTemplateMap.clear(); // for reload case
|
m_RepSpilloverTemplateMap.clear(); // for reload case
|
||||||
|
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
QueryResult* result = WorldDatabase.Query("SELECT faction, faction1, rate_1, rank_1, faction2, rate_2, rank_2, faction3, rate_3, rank_3, faction4, rate_4, rank_4, faction5, rate_5, rank_5 FROM reputation_spillover_template");
|
QueryResult* result = WorldDatabase.Query("SELECT `faction`, `faction1`, `rate_1`, `rank_1`, `faction2`, `rate_2`, `rank_2`, `faction3`, `rate_3`, `rank_3`, `faction4`, `rate_4`, `rank_4`, `faction5`, `rate_5`, `rank_5` FROM `reputation_spillover_template`");
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
|
|
@ -7712,7 +7714,7 @@ void ObjectMgr::LoadNPCSpellClickSpells()
|
||||||
|
|
||||||
mSpellClickInfoMap.clear();
|
mSpellClickInfoMap.clear();
|
||||||
// 0 1 2 3 4 5 6
|
// 0 1 2 3 4 5 6
|
||||||
QueryResult* result = WorldDatabase.Query("SELECT npc_entry, spell_id, quest_start, quest_start_active, quest_end, cast_flags, condition_id FROM npc_spellclick_spells");
|
QueryResult* result = WorldDatabase.Query("SELECT `npc_entry`, `spell_id`, `quest_start`, `quest_start_active`, `quest_end`, `cast_flags`, `condition_id` FROM `npc_spellclick_spells`");
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
|
|
@ -7916,7 +7918,7 @@ void ObjectMgr::LoadQuestRelationsHelper(QuestRelationsMap& map, QuestActor acto
|
||||||
|
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
|
|
||||||
QueryResult* result = WorldDatabase.PQuery("SELECT entry, quest FROM quest_relations WHERE actor = %d AND role = %d", actor, role);
|
QueryResult* result = WorldDatabase.PQuery("SELECT `entry`, `quest` FROM `quest_relations` WHERE `actor` = %d AND `role` = %d", actor, role);
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
|
|
@ -8033,7 +8035,7 @@ void ObjectMgr::LoadReservedPlayersNames()
|
||||||
{
|
{
|
||||||
m_ReservedNames.clear(); // need for reload case
|
m_ReservedNames.clear(); // need for reload case
|
||||||
|
|
||||||
QueryResult* result = WorldDatabase.Query("SELECT name FROM reserved_name");
|
QueryResult* result = WorldDatabase.Query("SELECT `name` FROM `reserved_name`");
|
||||||
|
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
|
|
||||||
|
|
@ -8450,7 +8452,7 @@ bool ObjectMgr::LoadMangosStrings(DatabaseType& db, char const* table, int32 min
|
||||||
|
|
||||||
sLog.outString("Loading texts from %s%s", table, extra_content ? ", with additional data" : "");
|
sLog.outString("Loading texts from %s%s", table, extra_content ? ", with additional data" : "");
|
||||||
|
|
||||||
QueryResult* result = db.PQuery("SELECT entry,content_default,content_loc1,content_loc2,content_loc3,content_loc4,content_loc5,content_loc6,content_loc7,content_loc8 %s FROM %s",
|
QueryResult* result = db.PQuery("SELECT `entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8` %s FROM %s",
|
||||||
extra_content ? ",sound,type,language,emote" : "", table);
|
extra_content ? ",sound,type,language,emote" : "", table);
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
|
|
@ -8604,7 +8606,7 @@ void ObjectMgr::LoadFishingBaseSkillLevel()
|
||||||
mFishingBaseForArea.clear(); // for reload case
|
mFishingBaseForArea.clear(); // for reload case
|
||||||
|
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
QueryResult* result = WorldDatabase.Query("SELECT entry,skill FROM skill_fishing_base_level");
|
QueryResult* result = WorldDatabase.Query("SELECT `entry`,`skill` FROM `skill_fishing_base_level`");
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
|
|
@ -9607,7 +9609,7 @@ void ObjectMgr::LoadGameTele()
|
||||||
m_GameTeleMap.clear(); // for reload case
|
m_GameTeleMap.clear(); // for reload case
|
||||||
|
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
QueryResult* result = WorldDatabase.Query("SELECT id, position_x, position_y, position_z, orientation, map, name FROM game_tele");
|
QueryResult* result = WorldDatabase.Query("SELECT `id`, `position_x`, `position_y`, `position_z`, `orientation`, `map`, `name` FROM `game_tele`");
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
|
|
@ -9713,8 +9715,8 @@ bool ObjectMgr::AddGameTele(GameTele& tele)
|
||||||
std::string safeName(tele.name);
|
std::string safeName(tele.name);
|
||||||
WorldDatabase.escape_string(safeName);
|
WorldDatabase.escape_string(safeName);
|
||||||
|
|
||||||
return WorldDatabase.PExecuteLog("INSERT INTO game_tele "
|
return WorldDatabase.PExecuteLog("INSERT INTO `game_tele` "
|
||||||
"(id,position_x,position_y,position_z,orientation,map,name) "
|
"(`id`,`position_x`,`position_y`,`position_z`,`orientation`,`map`,`name`) "
|
||||||
"VALUES (%u,%f,%f,%f,%f,%u,'%s')",
|
"VALUES (%u,%f,%f,%f,%f,%u,'%s')",
|
||||||
new_id, tele.position_x, tele.position_y, tele.position_z,
|
new_id, tele.position_x, tele.position_y, tele.position_z,
|
||||||
tele.orientation, tele.mapId, safeName.c_str());
|
tele.orientation, tele.mapId, safeName.c_str());
|
||||||
|
|
@ -9736,7 +9738,7 @@ bool ObjectMgr::DeleteGameTele(const std::string& name)
|
||||||
{
|
{
|
||||||
if (itr->second.wnameLow == wname)
|
if (itr->second.wnameLow == wname)
|
||||||
{
|
{
|
||||||
WorldDatabase.PExecuteLog("DELETE FROM game_tele WHERE name = '%s'", itr->second.name.c_str());
|
WorldDatabase.PExecuteLog("DELETE FROM `game_tele` WHERE `name` = '%s'", itr->second.name.c_str());
|
||||||
m_GameTeleMap.erase(itr);
|
m_GameTeleMap.erase(itr);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -9824,7 +9826,7 @@ void ObjectMgr::LoadTrainers(char const* tableName, bool isTemplates)
|
||||||
|
|
||||||
std::set<uint32> skip_trainers;
|
std::set<uint32> skip_trainers;
|
||||||
|
|
||||||
QueryResult* result = WorldDatabase.PQuery("SELECT entry, spell,spellcost,reqskill,reqskillvalue,reqlevel FROM %s", tableName);
|
QueryResult* result = WorldDatabase.PQuery("SELECT `entry`, `spell`,`spellcost`,`reqskill`,`reqskillvalue`,`reqlevel` FROM `%s`", tableName);
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
|
|
@ -10035,7 +10037,7 @@ void ObjectMgr::LoadVendors(char const* tableName, bool isTemplates)
|
||||||
|
|
||||||
std::set<uint32> skip_vendors;
|
std::set<uint32> skip_vendors;
|
||||||
|
|
||||||
QueryResult* result = WorldDatabase.PQuery("SELECT entry, item, maxcount, incrtime, ExtendedCost, condition_id FROM %s", tableName);
|
QueryResult* result = WorldDatabase.PQuery("SELECT `entry`, `item`, `maxcount`, `incrtime`, `ExtendedCost`, `condition_id` FROM `%s`", tableName);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
BarGoLink bar(1);
|
BarGoLink bar(1);
|
||||||
|
|
@ -10169,9 +10171,9 @@ void ObjectMgr::LoadGossipMenu(std::set<uint32>& gossipScriptSet)
|
||||||
{
|
{
|
||||||
m_mGossipMenusMap.clear();
|
m_mGossipMenusMap.clear();
|
||||||
// 0 1 2
|
// 0 1 2
|
||||||
QueryResult* result = WorldDatabase.Query("SELECT entry, text_id, script_id, "
|
QueryResult* result = WorldDatabase.Query("SELECT `entry`, `text_id`, `script_id`, "
|
||||||
// 3
|
// 3
|
||||||
"condition_id FROM gossip_menu");
|
"`condition_id` FROM `gossip_menu`");
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
|
|
@ -10267,10 +10269,10 @@ void ObjectMgr::LoadGossipMenuItems(std::set<uint32>& gossipScriptSet)
|
||||||
m_mGossipMenuItemsMap.clear();
|
m_mGossipMenuItemsMap.clear();
|
||||||
|
|
||||||
QueryResult* result = WorldDatabase.Query(
|
QueryResult* result = WorldDatabase.Query(
|
||||||
"SELECT menu_id, id, option_icon, option_text, option_id, npc_option_npcflag, "
|
"SELECT `menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, "
|
||||||
"action_menu_id, action_poi_id, action_script_id, box_coded, box_money, box_text, "
|
"`action_menu_id`, `action_poi_id`, `action_script_id`, `box_coded`, `box_money`, `box_text`, "
|
||||||
"condition_id "
|
"`condition_id` "
|
||||||
"FROM gossip_menu_option ORDER BY menu_id, id");
|
"FROM `gossip_menu_option` ORDER BY `menu_id`, `id`");
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
|
|
@ -10488,7 +10490,7 @@ void ObjectMgr::AddVendorItem(uint32 entry, uint32 item, uint8 type, uint32 maxc
|
||||||
VendorItemData& vList = m_mCacheVendorItemMap[entry];
|
VendorItemData& vList = m_mCacheVendorItemMap[entry];
|
||||||
vList.AddItem(item, type, maxcount, incrtime, extendedcost, 0);
|
vList.AddItem(item, type, maxcount, incrtime, extendedcost, 0);
|
||||||
|
|
||||||
WorldDatabase.PExecuteLog("INSERT INTO npc_vendor (entry,item,maxcount,incrtime,extendedcost) VALUES('%u','%i','%u','%u','%u')", entry, type == VENDOR_ITEM_TYPE_CURRENCY ? -int32(item) : item, maxcount, incrtime, extendedcost);
|
WorldDatabase.PExecuteLog("INSERT INTO `npc_vendor` (`entry`,`item`,`maxcount`,`incrtime`,`extendedcost`) VALUES('%u','%i','%u','%u','%u')", entry, type == VENDOR_ITEM_TYPE_CURRENCY ? -int32(item) : item, maxcount, incrtime, extendedcost);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ObjectMgr::RemoveVendorItem(uint32 entry, uint32 item, uint8 type)
|
bool ObjectMgr::RemoveVendorItem(uint32 entry, uint32 item, uint8 type)
|
||||||
|
|
@ -10504,7 +10506,7 @@ bool ObjectMgr::RemoveVendorItem(uint32 entry, uint32 item, uint8 type)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
WorldDatabase.PExecuteLog("DELETE FROM npc_vendor WHERE entry='%u' AND item='%i'", entry, type == VENDOR_ITEM_TYPE_CURRENCY ? -int32(item) : item);
|
WorldDatabase.PExecuteLog("DELETE FROM `npc_vendor` WHERE `entry`='%u' AND `item`='%i'", entry, type == VENDOR_ITEM_TYPE_CURRENCY ? -int32(item) : item);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -94,26 +94,26 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c
|
||||||
|
|
||||||
if (petnumber)
|
if (petnumber)
|
||||||
// known petnumber entry 0 1 2(?) 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
// known petnumber entry 0 1 2(?) 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
||||||
result = CharacterDatabase.PQuery("SELECT id, entry, owner, modelid, level, exp, Reactstate, slot, name, renamed, curhealth, curmana, abdata, savetime, resettalents_cost, resettalents_time, CreatedBySpell, PetType "
|
result = CharacterDatabase.PQuery("SELECT `id`, `entry`, `owner`, `modelid`, `level`, `exp`, `Reactstate`, `slot`, `name`, `renamed`, `curhealth`, `curmana`, `abdata`, `savetime`, `resettalents_cost`, `resettalents_time`, `CreatedBySpell`, `PetType` "
|
||||||
"FROM character_pet WHERE owner = '%u' AND id = '%u'",
|
"FROM `character_pet` WHERE `owner` = '%u' AND `id` = '%u'",
|
||||||
ownerid, petnumber);
|
ownerid, petnumber);
|
||||||
else if (current)
|
else if (current)
|
||||||
// current pet (slot 0) 0 1 2(?) 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
// current pet (slot 0) 0 1 2(?) 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
||||||
result = CharacterDatabase.PQuery("SELECT id, entry, owner, modelid, level, exp, Reactstate, slot, name, renamed, curhealth, curmana, abdata, savetime, resettalents_cost, resettalents_time, CreatedBySpell, PetType "
|
result = CharacterDatabase.PQuery("SELECT `id`, `entry`, `owner`, `modelid`, `level`, `exp`, `Reactstate`, `slot`, `name`, `renamed`, `curhealth`, `curmana`, `abdata`, `savetime`, `resettalents_cost`, `resettalents_time`, `CreatedBySpell`, `PetType` "
|
||||||
"FROM character_pet WHERE owner = '%u' AND slot = '%u'",
|
"FROM `character_pet` WHERE `owner` = '%u' AND `slot` = '%u'",
|
||||||
ownerid, PET_SAVE_AS_CURRENT);
|
ownerid, PET_SAVE_AS_CURRENT);
|
||||||
else if (petentry)
|
else if (petentry)
|
||||||
// known petentry entry (unique for summoned pet, but non unique for hunter pet (only from current or not stabled pets)
|
// known petentry entry (unique for summoned pet, but non unique for hunter pet (only from current or not stabled pets)
|
||||||
// 0 1 2(?) 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
// 0 1 2(?) 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
||||||
result = CharacterDatabase.PQuery("SELECT id, entry, owner, modelid, level, exp, Reactstate, slot, name, renamed, curhealth, curmana, abdata, savetime, resettalents_cost, resettalents_time, CreatedBySpell, PetType "
|
result = CharacterDatabase.PQuery("SELECT `id`, `entry`, `owner`, `modelid`, `level`, `exp`, `Reactstate`, `slot`, `name`, `renamed`, `curhealth`, `curmana`, `abdata`, `savetime`, `resettalents_cost`, `resettalents_time`, `CreatedBySpell`, `PetType` "
|
||||||
"FROM character_pet WHERE owner = '%u' AND entry = '%u' AND (slot = '%u' OR slot > '%u') ",
|
"FROM `character_pet` WHERE `owner` = '%u' AND `entry` = '%u' AND (`slot` = '%u' OR `slot` > '%u') ",
|
||||||
ownerid, petentry, PET_SAVE_AS_CURRENT, PET_SAVE_LAST_STABLE_SLOT);
|
ownerid, petentry, PET_SAVE_AS_CURRENT, PET_SAVE_LAST_STABLE_SLOT);
|
||||||
else
|
else
|
||||||
// any current or other non-stabled pet (for hunter "call pet")
|
// any current or other non-stabled pet (for hunter "call pet")
|
||||||
// 0 1 2(?) 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
// 0 1 2(?) 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
||||||
result = CharacterDatabase.PQuery("SELECT id, entry, owner, modelid, level, exp, Reactstate, slot, name, renamed, curhealth, curmana, abdata, savetime, resettalents_cost, resettalents_time, CreatedBySpell, PetType "
|
result = CharacterDatabase.PQuery("SELECT `id`, `entry`, `owner`, `modelid`, `level`, `exp`, `Reactstate`, `slot`, `name`, `renamed`, `curhealth`, `curmana`, `abdata`, `savetime`, `resettalents_cost`, `resettalents_time`, `CreatedBySpell`, `PetType` "
|
||||||
"FROM character_pet WHERE owner = '%u' AND (slot = '%u' OR slot > '%u') ",
|
"FROM `character_pet` WHERE `owner` = '%u' AND (`slot` = '%u' OR `slot` > '%u') ",
|
||||||
ownerid,PET_SAVE_AS_CURRENT,PET_SAVE_LAST_STABLE_SLOT);
|
ownerid, PET_SAVE_AS_CURRENT, PET_SAVE_LAST_STABLE_SLOT);
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
|
|
@ -239,10 +239,10 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c
|
||||||
static SqlStatementID id_1;
|
static SqlStatementID id_1;
|
||||||
static SqlStatementID id_2;
|
static SqlStatementID id_2;
|
||||||
|
|
||||||
SqlStatement stmt = CharacterDatabase.CreateStatement(id_1, "UPDATE character_pet SET slot = ? WHERE owner = ? AND slot = ? AND id <> ?");
|
SqlStatement stmt = CharacterDatabase.CreateStatement(id_1, "UPDATE `character_pet` SET `slot` = ? WHERE `owner` = ? AND `slot` = ? AND `id` <> ?");
|
||||||
stmt.PExecute(uint32(PET_SAVE_NOT_IN_SLOT), ownerid, uint32(PET_SAVE_AS_CURRENT), m_charmInfo->GetPetNumber());
|
stmt.PExecute(uint32(PET_SAVE_NOT_IN_SLOT), ownerid, uint32(PET_SAVE_AS_CURRENT), m_charmInfo->GetPetNumber());
|
||||||
|
|
||||||
stmt = CharacterDatabase.CreateStatement(id_2, "UPDATE character_pet SET slot = ? WHERE owner = ? AND id = ?");
|
stmt = CharacterDatabase.CreateStatement(id_2, "UPDATE `character_pet` SET `slot` = ? WHERE `owner` = ? AND `id` = ?");
|
||||||
stmt.PExecute(uint32(PET_SAVE_AS_CURRENT), ownerid, m_charmInfo->GetPetNumber());
|
stmt.PExecute(uint32(PET_SAVE_AS_CURRENT), ownerid, m_charmInfo->GetPetNumber());
|
||||||
|
|
||||||
CharacterDatabase.CommitTransaction();
|
CharacterDatabase.CommitTransaction();
|
||||||
|
|
@ -405,7 +405,7 @@ void Pet::SavePetToDB(PetSaveMode mode)
|
||||||
static SqlStatementID delPet ;
|
static SqlStatementID delPet ;
|
||||||
static SqlStatementID insPet ;
|
static SqlStatementID insPet ;
|
||||||
|
|
||||||
SqlStatement stmt = CharacterDatabase.CreateStatement(delPet, "DELETE FROM character_pet WHERE owner = ? AND id = ?");
|
SqlStatement stmt = CharacterDatabase.CreateStatement(delPet, "DELETE FROM `character_pet` WHERE `owner` = ? AND `id` = ?");
|
||||||
stmt.PExecute(ownerLow, m_charmInfo->GetPetNumber());
|
stmt.PExecute(ownerLow, m_charmInfo->GetPetNumber());
|
||||||
|
|
||||||
// prevent duplicate using slot (except PET_SAVE_NOT_IN_SLOT)
|
// prevent duplicate using slot (except PET_SAVE_NOT_IN_SLOT)
|
||||||
|
|
@ -413,7 +413,7 @@ void Pet::SavePetToDB(PetSaveMode mode)
|
||||||
{
|
{
|
||||||
static SqlStatementID updPet ;
|
static SqlStatementID updPet ;
|
||||||
|
|
||||||
stmt = CharacterDatabase.CreateStatement(updPet, "UPDATE character_pet SET slot = ? WHERE owner = ? AND slot = ?");
|
stmt = CharacterDatabase.CreateStatement(updPet, "UPDATE `character_pet` SET `slot` = ? WHERE `owner` = ? AND `slot` = ?");
|
||||||
stmt.PExecute(uint32(PET_SAVE_NOT_IN_SLOT), ownerLow, uint32(mode));
|
stmt.PExecute(uint32(PET_SAVE_NOT_IN_SLOT), ownerLow, uint32(mode));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -422,13 +422,13 @@ void Pet::SavePetToDB(PetSaveMode mode)
|
||||||
{
|
{
|
||||||
static SqlStatementID del ;
|
static SqlStatementID del ;
|
||||||
|
|
||||||
stmt = CharacterDatabase.CreateStatement(del, "DELETE FROM character_pet WHERE owner = ? AND (slot = ? OR slot > ?)");
|
stmt = CharacterDatabase.CreateStatement(del, "DELETE FROM `character_pet` WHERE `owner` = ? AND (`slot` = ? OR `slot` > ?)");
|
||||||
stmt.PExecute(ownerLow, uint32(PET_SAVE_AS_CURRENT), uint32(PET_SAVE_LAST_STABLE_SLOT));
|
stmt.PExecute(ownerLow, uint32(PET_SAVE_AS_CURRENT), uint32(PET_SAVE_LAST_STABLE_SLOT));
|
||||||
}
|
}
|
||||||
|
|
||||||
// save pet
|
// save pet
|
||||||
SqlStatement savePet = CharacterDatabase.CreateStatement(insPet, "INSERT INTO character_pet ( id, entry, owner, modelid, level, exp, Reactstate, slot, name, renamed, curhealth, "
|
SqlStatement savePet = CharacterDatabase.CreateStatement(insPet, "INSERT INTO `character_pet` "
|
||||||
"curmana, abdata, savetime, resettalents_cost, resettalents_time, CreatedBySpell, PetType) "
|
"(`id`, `entry`, `owner`, `modelid`, `level`, `exp`, `Reactstate`, `slot`, `name`, `renamed`, `curhealth`, `curmana`, `abdata`, `savetime`, `resettalents_cost`, `resettalents_time`, `CreatedBySpell`, `PetType`) "
|
||||||
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
||||||
|
|
||||||
savePet.addUInt32(m_charmInfo->GetPetNumber());
|
savePet.addUInt32(m_charmInfo->GetPetNumber());
|
||||||
|
|
@ -481,19 +481,19 @@ void Pet::DeleteFromDB(uint32 guidlow, bool separate_transaction)
|
||||||
static SqlStatementID delSpells ;
|
static SqlStatementID delSpells ;
|
||||||
static SqlStatementID delSpellCD ;
|
static SqlStatementID delSpellCD ;
|
||||||
|
|
||||||
SqlStatement stmt = CharacterDatabase.CreateStatement(delPet, "DELETE FROM character_pet WHERE id = ?");
|
SqlStatement stmt = CharacterDatabase.CreateStatement(delPet, "DELETE FROM `character_pet` WHERE `id` = ?");
|
||||||
stmt.PExecute(guidlow);
|
stmt.PExecute(guidlow);
|
||||||
|
|
||||||
stmt = CharacterDatabase.CreateStatement(delDeclName, "DELETE FROM character_pet_declinedname WHERE id = ?");
|
stmt = CharacterDatabase.CreateStatement(delDeclName, "DELETE FROM `character_pet_declinedname` WHERE `id` = ?");
|
||||||
stmt.PExecute(guidlow);
|
stmt.PExecute(guidlow);
|
||||||
|
|
||||||
stmt = CharacterDatabase.CreateStatement(delAuras, "DELETE FROM pet_aura WHERE guid = ?");
|
stmt = CharacterDatabase.CreateStatement(delAuras, "DELETE FROM `pet_aura` WHERE `guid` = ?");
|
||||||
stmt.PExecute(guidlow);
|
stmt.PExecute(guidlow);
|
||||||
|
|
||||||
stmt = CharacterDatabase.CreateStatement(delSpells, "DELETE FROM pet_spell WHERE guid = ?");
|
stmt = CharacterDatabase.CreateStatement(delSpells, "DELETE FROM `pet_spell` WHERE `guid` = ?");
|
||||||
stmt.PExecute(guidlow);
|
stmt.PExecute(guidlow);
|
||||||
|
|
||||||
stmt = CharacterDatabase.CreateStatement(delSpellCD, "DELETE FROM pet_spell_cooldown WHERE guid = ?");
|
stmt = CharacterDatabase.CreateStatement(delSpellCD, "DELETE FROM `pet_spell_cooldown` WHERE `guid` = ?");
|
||||||
stmt.PExecute(guidlow);
|
stmt.PExecute(guidlow);
|
||||||
|
|
||||||
if (separate_transaction)
|
if (separate_transaction)
|
||||||
|
|
@ -1231,7 +1231,7 @@ void Pet::_LoadSpellCooldowns()
|
||||||
m_CreatureSpellCooldowns.clear();
|
m_CreatureSpellCooldowns.clear();
|
||||||
m_CreatureCategoryCooldowns.clear();
|
m_CreatureCategoryCooldowns.clear();
|
||||||
|
|
||||||
QueryResult* result = CharacterDatabase.PQuery("SELECT spell,time FROM pet_spell_cooldown WHERE guid = '%u'", m_charmInfo->GetPetNumber());
|
QueryResult* result = CharacterDatabase.PQuery("SELECT `spell`,`time` FROM `pet_spell_cooldown` WHERE `guid` = '%u'", m_charmInfo->GetPetNumber());
|
||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
|
|
@ -1283,7 +1283,7 @@ void Pet::_SaveSpellCooldowns()
|
||||||
static SqlStatementID delSpellCD ;
|
static SqlStatementID delSpellCD ;
|
||||||
static SqlStatementID insSpellCD ;
|
static SqlStatementID insSpellCD ;
|
||||||
|
|
||||||
SqlStatement stmt = CharacterDatabase.CreateStatement(delSpellCD, "DELETE FROM pet_spell_cooldown WHERE guid = ?");
|
SqlStatement stmt = CharacterDatabase.CreateStatement(delSpellCD, "DELETE FROM `pet_spell_cooldown` WHERE `guid` = ?");
|
||||||
stmt.PExecute(m_charmInfo->GetPetNumber());
|
stmt.PExecute(m_charmInfo->GetPetNumber());
|
||||||
|
|
||||||
time_t curTime = time(NULL);
|
time_t curTime = time(NULL);
|
||||||
|
|
@ -1297,7 +1297,7 @@ void Pet::_SaveSpellCooldowns()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
stmt = CharacterDatabase.CreateStatement(insSpellCD, "INSERT INTO pet_spell_cooldown (guid,spell,time) VALUES (?, ?, ?)");
|
stmt = CharacterDatabase.CreateStatement(insSpellCD, "INSERT INTO `pet_spell_cooldown` (`guid`,`spell`,`time`) VALUES (?, ?, ?)");
|
||||||
stmt.PExecute(m_charmInfo->GetPetNumber(), itr->first, uint64(itr->second));
|
stmt.PExecute(m_charmInfo->GetPetNumber(), itr->first, uint64(itr->second));
|
||||||
++itr;
|
++itr;
|
||||||
}
|
}
|
||||||
|
|
@ -1306,7 +1306,7 @@ void Pet::_SaveSpellCooldowns()
|
||||||
|
|
||||||
void Pet::_LoadSpells()
|
void Pet::_LoadSpells()
|
||||||
{
|
{
|
||||||
QueryResult* result = CharacterDatabase.PQuery("SELECT spell,active FROM pet_spell WHERE guid = '%u'", m_charmInfo->GetPetNumber());
|
QueryResult* result = CharacterDatabase.PQuery("SELECT `spell`,`active` FROM `pet_spell` WHERE `guid` = '%u'", m_charmInfo->GetPetNumber());
|
||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
|
|
@ -1341,23 +1341,23 @@ void Pet::_SaveSpells()
|
||||||
{
|
{
|
||||||
case PETSPELL_REMOVED:
|
case PETSPELL_REMOVED:
|
||||||
{
|
{
|
||||||
SqlStatement stmt = CharacterDatabase.CreateStatement(delSpell, "DELETE FROM pet_spell WHERE guid = ? and spell = ?");
|
SqlStatement stmt = CharacterDatabase.CreateStatement(delSpell, "DELETE FROM `pet_spell` WHERE `guid` = ? AND `spell` = ?");
|
||||||
stmt.PExecute(m_charmInfo->GetPetNumber(), itr->first);
|
stmt.PExecute(m_charmInfo->GetPetNumber(), itr->first);
|
||||||
m_spells.erase(itr);
|
m_spells.erase(itr);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
case PETSPELL_CHANGED:
|
case PETSPELL_CHANGED:
|
||||||
{
|
{
|
||||||
SqlStatement stmt = CharacterDatabase.CreateStatement(delSpell, "DELETE FROM pet_spell WHERE guid = ? and spell = ?");
|
SqlStatement stmt = CharacterDatabase.CreateStatement(delSpell, "DELETE FROM `pet_spell` WHERE `guid` = ? AND `spell` = ?");
|
||||||
stmt.PExecute(m_charmInfo->GetPetNumber(), itr->first);
|
stmt.PExecute(m_charmInfo->GetPetNumber(), itr->first);
|
||||||
|
|
||||||
stmt = CharacterDatabase.CreateStatement(insSpell, "INSERT INTO pet_spell (guid,spell,active) VALUES (?, ?, ?)");
|
stmt = CharacterDatabase.CreateStatement(insSpell, "INSERT INTO `pet_spell` (`guid`,`spell`,`active`) VALUES (?, ?, ?)");
|
||||||
stmt.PExecute(m_charmInfo->GetPetNumber(), itr->first, uint32(itr->second.active));
|
stmt.PExecute(m_charmInfo->GetPetNumber(), itr->first, uint32(itr->second.active));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PETSPELL_NEW:
|
case PETSPELL_NEW:
|
||||||
{
|
{
|
||||||
SqlStatement stmt = CharacterDatabase.CreateStatement(insSpell, "INSERT INTO pet_spell (guid,spell,active) VALUES (?, ?, ?)");
|
SqlStatement stmt = CharacterDatabase.CreateStatement(insSpell, "INSERT INTO `pet_spell` (`guid`,`spell`,`active`) VALUES (?, ?, ?)");
|
||||||
stmt.PExecute(m_charmInfo->GetPetNumber(), itr->first, uint32(itr->second.active));
|
stmt.PExecute(m_charmInfo->GetPetNumber(), itr->first, uint32(itr->second.active));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -1373,7 +1373,7 @@ void Pet::_LoadAuras(uint32 timediff)
|
||||||
{
|
{
|
||||||
RemoveAllAuras();
|
RemoveAllAuras();
|
||||||
|
|
||||||
QueryResult* result = CharacterDatabase.PQuery("SELECT caster_guid,item_guid,spell,stackcount,remaincharges,basepoints0,basepoints1,basepoints2,periodictime0,periodictime1,periodictime2,maxduration,remaintime,effIndexMask FROM pet_aura WHERE guid = '%u'", m_charmInfo->GetPetNumber());
|
QueryResult* result = CharacterDatabase.PQuery("SELECT `caster_guid`,`item_guid`,`spell`,`stackcount`,`remaincharges`,`basepoints0`,`basepoints1`,`basepoints2`,`periodictime0`,`periodictime1`,`periodictime2`,`maxduration`,`remaintime`,`effIndexMask` FROM `pet_aura` WHERE `guid` = '%u'", m_charmInfo->GetPetNumber());
|
||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
|
|
@ -1485,7 +1485,7 @@ void Pet::_SaveAuras()
|
||||||
static SqlStatementID delAuras ;
|
static SqlStatementID delAuras ;
|
||||||
static SqlStatementID insAuras ;
|
static SqlStatementID insAuras ;
|
||||||
|
|
||||||
SqlStatement stmt = CharacterDatabase.CreateStatement(delAuras, "DELETE FROM pet_aura WHERE guid = ?");
|
SqlStatement stmt = CharacterDatabase.CreateStatement(delAuras, "DELETE FROM `pet_aura` WHERE `guid` = ?");
|
||||||
stmt.PExecute(m_charmInfo->GetPetNumber());
|
stmt.PExecute(m_charmInfo->GetPetNumber());
|
||||||
|
|
||||||
SpellAuraHolderMap const& auraHolders = GetSpellAuraHolderMap();
|
SpellAuraHolderMap const& auraHolders = GetSpellAuraHolderMap();
|
||||||
|
|
@ -1495,8 +1495,8 @@ void Pet::_SaveAuras()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
stmt = CharacterDatabase.CreateStatement(insAuras, "INSERT INTO pet_aura (guid, caster_guid, item_guid, spell, stackcount, remaincharges, "
|
stmt = CharacterDatabase.CreateStatement(insAuras, "INSERT INTO `pet_aura` (`guid`, `caster_guid`, `item_guid`, `spell`, `stackcount`, `remaincharges`, "
|
||||||
"basepoints0, basepoints1, basepoints2, periodictime0, periodictime1, periodictime2, maxduration, remaintime, effIndexMask) "
|
"`basepoints0`, `basepoints1`, `basepoints2`, `periodictime0`, `periodictime1`, `periodictime2`, `maxduration`, `remaintime`, `effIndexMask`) "
|
||||||
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
||||||
|
|
||||||
for (SpellAuraHolderMap::const_iterator itr = auraHolders.begin(); itr != auraHolders.end(); ++itr)
|
for (SpellAuraHolderMap::const_iterator itr = auraHolders.begin(); itr != auraHolders.end(); ++itr)
|
||||||
|
|
@ -1586,7 +1586,7 @@ bool Pet::addSpell(uint32 spell_id, ActiveStates active /*= ACT_DECIDE*/, PetSpe
|
||||||
if (state == PETSPELL_UNCHANGED) // spell load case
|
if (state == PETSPELL_UNCHANGED) // spell load case
|
||||||
{
|
{
|
||||||
sLog.outError("Pet::addSpell: nonexistent in SpellStore spell #%u request, deleting for all pets in `pet_spell`.", spell_id);
|
sLog.outError("Pet::addSpell: nonexistent in SpellStore spell #%u request, deleting for all pets in `pet_spell`.", spell_id);
|
||||||
CharacterDatabase.PExecute("DELETE FROM pet_spell WHERE spell = '%u'", spell_id);
|
CharacterDatabase.PExecute("DELETE FROM `pet_spell` WHERE `spell` = '%u'", spell_id);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -3294,7 +3294,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
|
||||||
if (!IsInWorld() && !learning) // spell load case
|
if (!IsInWorld() && !learning) // spell load case
|
||||||
{
|
{
|
||||||
sLog.outError("Player::addSpell: nonexistent in SpellStore spell #%u request, deleting for all characters in `character_spell`.", spell_id);
|
sLog.outError("Player::addSpell: nonexistent in SpellStore spell #%u request, deleting for all characters in `character_spell`.", spell_id);
|
||||||
CharacterDatabase.PExecute("DELETE FROM character_spell WHERE spell = '%u'", spell_id);
|
CharacterDatabase.PExecute("DELETE FROM `character_spell` WHERE `spell` = '%u'", spell_id);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
sLog.outError("Player::addSpell: nonexistent in SpellStore spell #%u request.", spell_id);
|
sLog.outError("Player::addSpell: nonexistent in SpellStore spell #%u request.", spell_id);
|
||||||
|
|
@ -3308,7 +3308,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
|
||||||
if (!IsInWorld() && !learning) // spell load case
|
if (!IsInWorld() && !learning) // spell load case
|
||||||
{
|
{
|
||||||
sLog.outError("Player::addSpell: Broken spell #%u learning not allowed, deleting for all characters in `character_spell`.", spell_id);
|
sLog.outError("Player::addSpell: Broken spell #%u learning not allowed, deleting for all characters in `character_spell`.", spell_id);
|
||||||
CharacterDatabase.PExecute("DELETE FROM character_spell WHERE spell = '%u'", spell_id);
|
CharacterDatabase.PExecute("DELETE FROM `character_spell` WHERE `spell` = '%u'", spell_id);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
sLog.outError("Player::addSpell: Broken spell #%u learning not allowed.", spell_id);
|
sLog.outError("Player::addSpell: Broken spell #%u learning not allowed.", spell_id);
|
||||||
|
|
@ -4067,7 +4067,7 @@ void Player::_SaveSpellCooldowns()
|
||||||
static SqlStatementID deleteSpellCooldown ;
|
static SqlStatementID deleteSpellCooldown ;
|
||||||
static SqlStatementID insertSpellCooldown ;
|
static SqlStatementID insertSpellCooldown ;
|
||||||
|
|
||||||
SqlStatement stmt = CharacterDatabase.CreateStatement(deleteSpellCooldown, "DELETE FROM character_spell_cooldown WHERE guid = ?");
|
SqlStatement stmt = CharacterDatabase.CreateStatement(deleteSpellCooldown, "DELETE FROM `character_spell_cooldown` WHERE `guid` = ?");
|
||||||
stmt.PExecute(GetGUIDLow());
|
stmt.PExecute(GetGUIDLow());
|
||||||
|
|
||||||
time_t curTime = time(NULL);
|
time_t curTime = time(NULL);
|
||||||
|
|
@ -4080,7 +4080,7 @@ void Player::_SaveSpellCooldowns()
|
||||||
m_spellCooldowns.erase(itr++);
|
m_spellCooldowns.erase(itr++);
|
||||||
else if (itr->second.end <= infTime) // not save locked cooldowns, it will be reset or set at reload
|
else if (itr->second.end <= infTime) // not save locked cooldowns, it will be reset or set at reload
|
||||||
{
|
{
|
||||||
stmt = CharacterDatabase.CreateStatement(insertSpellCooldown, "INSERT INTO character_spell_cooldown (guid,spell,item,time) VALUES( ?, ?, ?, ?)");
|
stmt = CharacterDatabase.CreateStatement(insertSpellCooldown, "INSERT INTO `character_spell_cooldown` (`guid`,`spell`,`item`,`time`) VALUES( ?, ?, ?, ?)");
|
||||||
stmt.PExecute(GetGUIDLow(), itr->first, itr->second.itemid, uint64(itr->second.end));
|
stmt.PExecute(GetGUIDLow(), itr->first, itr->second.itemid, uint64(itr->second.end));
|
||||||
++itr;
|
++itr;
|
||||||
}
|
}
|
||||||
|
|
@ -4602,7 +4602,7 @@ void Player::DeleteFromDB(ObjectGuid playerguid, uint32 accountId, bool updateRe
|
||||||
LeaveAllArenaTeams(playerguid);
|
LeaveAllArenaTeams(playerguid);
|
||||||
|
|
||||||
// the player was uninvited already on logout so just remove from group
|
// the player was uninvited already on logout so just remove from group
|
||||||
QueryResult* resultGroup = CharacterDatabase.PQuery("SELECT groupId FROM group_member WHERE memberGuid='%u'", lowguid);
|
QueryResult* resultGroup = CharacterDatabase.PQuery("SELECT `groupId` FROM `group_member` WHERE `memberGuid`='%u'", lowguid);
|
||||||
if (resultGroup)
|
if (resultGroup)
|
||||||
{
|
{
|
||||||
uint32 groupId = (*resultGroup)[0].GetUInt32();
|
uint32 groupId = (*resultGroup)[0].GetUInt32();
|
||||||
|
|
@ -4620,7 +4620,7 @@ void Player::DeleteFromDB(ObjectGuid playerguid, uint32 accountId, bool updateRe
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
// return back all mails with COD and Item 0 1 2 3 4 5 6 7
|
// return back all mails with COD and Item 0 1 2 3 4 5 6 7
|
||||||
QueryResult* resultMail = CharacterDatabase.PQuery("SELECT id,messageType,mailTemplateId,sender,subject,body,money,has_items FROM mail WHERE receiver='%u' AND has_items<>0 AND cod<>0", lowguid);
|
QueryResult* resultMail = CharacterDatabase.PQuery("SELECT `id`,`messageType`,`mailTemplateId`,`sender`,`subject`,`body`,`money`,`has_items` FROM `mail` WHERE `receiver`='%u' AND `has_items`<>0 AND `cod`<>0", lowguid);
|
||||||
if (resultMail)
|
if (resultMail)
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
|
|
@ -4638,13 +4638,15 @@ void Player::DeleteFromDB(ObjectGuid playerguid, uint32 accountId, bool updateRe
|
||||||
|
|
||||||
// we can return mail now
|
// we can return mail now
|
||||||
// so firstly delete the old one
|
// so firstly delete the old one
|
||||||
CharacterDatabase.PExecute("DELETE FROM mail WHERE id = '%u'", mail_id);
|
CharacterDatabase.PExecute("DELETE FROM `mail` WHERE id = '%u'", mail_id);
|
||||||
|
|
||||||
// mail not from player
|
// mail not from player
|
||||||
if (mailType != MAIL_NORMAL)
|
if (mailType != MAIL_NORMAL)
|
||||||
{
|
{
|
||||||
if (has_items)
|
if (has_items)
|
||||||
CharacterDatabase.PExecute("DELETE FROM mail_items WHERE mail_id = '%u'", mail_id);
|
{
|
||||||
|
CharacterDatabase.PExecute("DELETE FROM `mail_items` WHERE `mail_id` = '%u'", mail_id);
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4658,7 +4660,7 @@ void Player::DeleteFromDB(ObjectGuid playerguid, uint32 accountId, bool updateRe
|
||||||
{
|
{
|
||||||
// data needs to be at first place for Item::LoadFromDB
|
// data needs to be at first place for Item::LoadFromDB
|
||||||
// 0 1 2 3
|
// 0 1 2 3
|
||||||
QueryResult* resultItems = CharacterDatabase.PQuery("SELECT data,text,item_guid,item_template FROM mail_items JOIN item_instance ON item_guid = guid WHERE mail_id='%u'", mail_id);
|
QueryResult* resultItems = CharacterDatabase.PQuery("SELECT `data`,`text`,`item_guid`,`item_template` FROM `mail_items` JOIN `item_instance` ON `item_guid` = `guid` WHERE `mail_id`='%u'", mail_id);
|
||||||
if (resultItems)
|
if (resultItems)
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
|
|
@ -4671,7 +4673,7 @@ void Player::DeleteFromDB(ObjectGuid playerguid, uint32 accountId, bool updateRe
|
||||||
ItemPrototype const* itemProto = ObjectMgr::GetItemPrototype(item_template);
|
ItemPrototype const* itemProto = ObjectMgr::GetItemPrototype(item_template);
|
||||||
if (!itemProto)
|
if (!itemProto)
|
||||||
{
|
{
|
||||||
CharacterDatabase.PExecute("DELETE FROM item_instance WHERE guid = '%u'", item_guidlow);
|
CharacterDatabase.PExecute("DELETE FROM `item_instance` WHERE `guid` = '%u'", item_guidlow);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4691,7 +4693,7 @@ void Player::DeleteFromDB(ObjectGuid playerguid, uint32 accountId, bool updateRe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CharacterDatabase.PExecute("DELETE FROM mail_items WHERE mail_id = '%u'", mail_id);
|
CharacterDatabase.PExecute("DELETE FROM `mail_items` WHERE `mail_id` = '%u'", mail_id);
|
||||||
|
|
||||||
uint32 pl_account = sObjectMgr.GetPlayerAccountIdByGUID(playerguid);
|
uint32 pl_account = sObjectMgr.GetPlayerAccountIdByGUID(playerguid);
|
||||||
|
|
||||||
|
|
@ -4704,10 +4706,10 @@ void Player::DeleteFromDB(ObjectGuid playerguid, uint32 accountId, bool updateRe
|
||||||
|
|
||||||
// unsummon and delete for pets in world is not required: player deleted from CLI or character list with not loaded pet.
|
// unsummon and delete for pets in world is not required: player deleted from CLI or character list with not loaded pet.
|
||||||
// Get guids of character's pets, will deleted in transaction
|
// Get guids of character's pets, will deleted in transaction
|
||||||
QueryResult* resultPets = CharacterDatabase.PQuery("SELECT id FROM character_pet WHERE owner = '%u'", lowguid);
|
QueryResult* resultPets = CharacterDatabase.PQuery("SELECT `id` FROM `character_pet` WHERE `owner` = '%u'", lowguid);
|
||||||
|
|
||||||
// delete char from friends list when selected chars is online (non existing - error)
|
// delete char from friends list when selected chars is online (non existing - error)
|
||||||
QueryResult* resultFriend = CharacterDatabase.PQuery("SELECT DISTINCT guid FROM character_social WHERE friend = '%u'", lowguid);
|
QueryResult* resultFriend = CharacterDatabase.PQuery("SELECT DISTINCT `guid` FROM `character_social` WHERE `friend` = '%u'", lowguid);
|
||||||
|
|
||||||
// NOW we can finally clear other DB data related to character
|
// NOW we can finally clear other DB data related to character
|
||||||
CharacterDatabase.BeginTransaction();
|
CharacterDatabase.BeginTransaction();
|
||||||
|
|
@ -4743,45 +4745,45 @@ void Player::DeleteFromDB(ObjectGuid playerguid, uint32 accountId, bool updateRe
|
||||||
delete resultFriend;
|
delete resultFriend;
|
||||||
}
|
}
|
||||||
|
|
||||||
CharacterDatabase.PExecute("DELETE FROM characters WHERE guid = '%u'", lowguid);
|
CharacterDatabase.PExecute("DELETE FROM `characters` WHERE `guid` = '%u'", lowguid);
|
||||||
CharacterDatabase.PExecute("DELETE FROM character_account_data WHERE guid = '%u'", lowguid);
|
CharacterDatabase.PExecute("DELETE FROM `character_account_data` WHERE `guid` = '%u'", lowguid);
|
||||||
CharacterDatabase.PExecute("DELETE FROM character_declinedname WHERE guid = '%u'", lowguid);
|
CharacterDatabase.PExecute("DELETE FROM `character_declinedname` WHERE `guid` = '%u'", lowguid);
|
||||||
CharacterDatabase.PExecute("DELETE FROM character_action WHERE guid = '%u'", lowguid);
|
CharacterDatabase.PExecute("DELETE FROM `character_action` WHERE `guid` = '%u'", lowguid);
|
||||||
CharacterDatabase.PExecute("DELETE FROM character_aura WHERE guid = '%u'", lowguid);
|
CharacterDatabase.PExecute("DELETE FROM `character_aura` WHERE `guid` = '%u'", lowguid);
|
||||||
CharacterDatabase.PExecute("DELETE FROM character_battleground_data WHERE guid = '%u'", lowguid);
|
CharacterDatabase.PExecute("DELETE FROM `character_battleground_data` WHERE `guid` = '%u'", lowguid);
|
||||||
CharacterDatabase.PExecute("DELETE FROM character_gifts WHERE guid = '%u'", lowguid);
|
CharacterDatabase.PExecute("DELETE FROM `character_gifts` WHERE `guid` = '%u'", lowguid);
|
||||||
CharacterDatabase.PExecute("DELETE FROM character_glyphs WHERE guid = '%u'", lowguid);
|
CharacterDatabase.PExecute("DELETE FROM `character_glyphs` WHERE `guid` = '%u'", lowguid);
|
||||||
CharacterDatabase.PExecute("DELETE FROM character_homebind WHERE guid = '%u'", lowguid);
|
CharacterDatabase.PExecute("DELETE FROM `character_homebind` WHERE `guid` = '%u'", lowguid);
|
||||||
CharacterDatabase.PExecute("DELETE FROM character_instance WHERE guid = '%u'", lowguid);
|
CharacterDatabase.PExecute("DELETE FROM `character_instance` WHERE `guid` = '%u'", lowguid);
|
||||||
CharacterDatabase.PExecute("DELETE FROM group_instance WHERE leaderGuid = '%u'", lowguid);
|
CharacterDatabase.PExecute("DELETE FROM `group_instance` WHERE `leaderGuid` = '%u'", lowguid);
|
||||||
CharacterDatabase.PExecute("DELETE FROM character_inventory WHERE guid = '%u'", lowguid);
|
CharacterDatabase.PExecute("DELETE FROM `character_inventory` WHERE `guid` = '%u'", lowguid);
|
||||||
CharacterDatabase.PExecute("DELETE FROM character_queststatus WHERE guid = '%u'", lowguid);
|
CharacterDatabase.PExecute("DELETE FROM `character_queststatus` WHERE `guid` = '%u'", lowguid);
|
||||||
CharacterDatabase.PExecute("DELETE FROM character_queststatus_daily WHERE guid = '%u'", lowguid);
|
CharacterDatabase.PExecute("DELETE FROM `character_queststatus_daily` WHERE `guid` = '%u'", lowguid);
|
||||||
CharacterDatabase.PExecute("DELETE FROM character_queststatus_weekly WHERE guid = '%u'", lowguid);
|
CharacterDatabase.PExecute("DELETE FROM `character_queststatus_weekly` WHERE `guid` = '%u'", lowguid);
|
||||||
CharacterDatabase.PExecute("DELETE FROM character_reputation WHERE guid = '%u'", lowguid);
|
CharacterDatabase.PExecute("DELETE FROM `character_reputation` WHERE `guid` = '%u'", lowguid);
|
||||||
CharacterDatabase.PExecute("DELETE FROM character_skills WHERE guid = '%u'", lowguid);
|
CharacterDatabase.PExecute("DELETE FROM `character_skills` WHERE `guid` = '%u'", lowguid);
|
||||||
CharacterDatabase.PExecute("DELETE FROM character_spell WHERE guid = '%u'", lowguid);
|
CharacterDatabase.PExecute("DELETE FROM `character_spell` WHERE `guid` = '%u'", lowguid);
|
||||||
CharacterDatabase.PExecute("DELETE FROM character_spell_cooldown WHERE guid = '%u'", lowguid);
|
CharacterDatabase.PExecute("DELETE FROM `character_spell_cooldown` WHERE `guid` = '%u'", lowguid);
|
||||||
CharacterDatabase.PExecute("DELETE FROM character_talent WHERE guid = '%u'", lowguid);
|
CharacterDatabase.PExecute("DELETE FROM `character_talent` WHERE `guid` = '%u'", lowguid);
|
||||||
CharacterDatabase.PExecute("DELETE FROM character_ticket WHERE guid = '%u'", lowguid);
|
CharacterDatabase.PExecute("DELETE FROM `character_ticket` WHERE `guid` = '%u'", lowguid);
|
||||||
CharacterDatabase.PExecute("DELETE FROM item_instance WHERE owner_guid = '%u'", lowguid);
|
CharacterDatabase.PExecute("DELETE FROM `item_instance` WHERE `owner_guid` = '%u'", lowguid);
|
||||||
CharacterDatabase.PExecute("DELETE FROM character_social WHERE guid = '%u' OR friend='%u'", lowguid, lowguid);
|
CharacterDatabase.PExecute("DELETE FROM `character_social` WHERE `guid` = '%u' OR friend='%u'", lowguid, lowguid);
|
||||||
CharacterDatabase.PExecute("DELETE FROM mail WHERE receiver = '%u'", lowguid);
|
CharacterDatabase.PExecute("DELETE FROM `mail` WHERE `receiver` = '%u'", lowguid);
|
||||||
CharacterDatabase.PExecute("DELETE FROM mail_items WHERE receiver = '%u'", lowguid);
|
CharacterDatabase.PExecute("DELETE FROM `mail_items` WHERE `receiver` = '%u'", lowguid);
|
||||||
CharacterDatabase.PExecute("DELETE FROM character_pet WHERE owner = '%u'", lowguid);
|
CharacterDatabase.PExecute("DELETE FROM `character_pet` WHERE `owner` = '%u'", lowguid);
|
||||||
CharacterDatabase.PExecute("DELETE FROM character_pet_declinedname WHERE owner = '%u'", lowguid);
|
CharacterDatabase.PExecute("DELETE FROM `character_pet_declinedname` WHERE `owner` = '%u'", lowguid);
|
||||||
CharacterDatabase.PExecute("DELETE FROM character_achievement WHERE guid = '%u'", lowguid);
|
CharacterDatabase.PExecute("DELETE FROM `character_achievement` WHERE `guid` = '%u'", lowguid);
|
||||||
CharacterDatabase.PExecute("DELETE FROM character_achievement_progress WHERE guid = '%u'", lowguid);
|
CharacterDatabase.PExecute("DELETE FROM `character_achievement_progress` WHERE `guid` = '%u'", lowguid);
|
||||||
CharacterDatabase.PExecute("DELETE FROM character_equipmentsets WHERE guid = '%u'", lowguid);
|
CharacterDatabase.PExecute("DELETE FROM `character_equipmentsets` WHERE `guid` = '%u'", lowguid);
|
||||||
CharacterDatabase.PExecute("DELETE FROM guild_eventlog WHERE PlayerGuid1 = '%u' OR PlayerGuid2 = '%u'", lowguid, lowguid);
|
CharacterDatabase.PExecute("DELETE FROM `guild_eventlog` WHERE `PlayerGuid1` = '%u' OR `PlayerGuid2` = '%u'", lowguid, lowguid);
|
||||||
CharacterDatabase.PExecute("DELETE FROM guild_bank_eventlog WHERE PlayerGuid = '%u'", lowguid);
|
CharacterDatabase.PExecute("DELETE FROM `guild_bank_eventlog` WHERE `PlayerGuid` = '%u'", lowguid);
|
||||||
CharacterDatabase.PExecute("DELETE FROM character_currencies WHERE guid = '%u'", lowguid);
|
CharacterDatabase.PExecute("DELETE FROM `character_currencies` WHERE `guid` = '%u'", lowguid);
|
||||||
CharacterDatabase.CommitTransaction();
|
CharacterDatabase.CommitTransaction();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// The character gets unlinked from the account, the name gets freed up and appears as deleted ingame
|
// The character gets unlinked from the account, the name gets freed up and appears as deleted ingame
|
||||||
case 1:
|
case 1:
|
||||||
CharacterDatabase.PExecute("UPDATE characters SET deleteInfos_Name=name, deleteInfos_Account=account, deleteDate='" UI64FMTD "', name='', account=0 WHERE guid=%u", uint64(time(NULL)), lowguid);
|
CharacterDatabase.PExecute("UPDATE `characters` SET `deleteInfos_Name`=`name`, `deleteInfos_Account`=`account`, `deleteDate`='" UI64FMTD "', `name`='', `account`=0 WHERE `guid`=%u", uint64(time(NULL)), lowguid);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
sLog.outError("Player::DeleteFromDB: Unsupported delete method: %u.", charDelete_method);
|
sLog.outError("Player::DeleteFromDB: Unsupported delete method: %u.", charDelete_method);
|
||||||
|
|
@ -4818,7 +4820,7 @@ void Player::DeleteOldCharacters(uint32 keepDays)
|
||||||
{
|
{
|
||||||
sLog.outString("Player::DeleteOldChars: Deleting all characters which have been deleted %u days before...", keepDays);
|
sLog.outString("Player::DeleteOldChars: Deleting all characters which have been deleted %u days before...", keepDays);
|
||||||
|
|
||||||
QueryResult* resultChars = CharacterDatabase.PQuery("SELECT guid, deleteInfos_Account FROM characters WHERE deleteDate IS NOT NULL AND deleteDate < '" UI64FMTD "'", uint64(time(NULL) - time_t(keepDays * DAY)));
|
QueryResult* resultChars = CharacterDatabase.PQuery("SELECT `guid`, `deleteInfos_Account` FROM `characters` WHERE `deleteDate` IS NOT NULL AND `deleteDate` < '" UI64FMTD "'", uint64(time(NULL) - time_t(keepDays * DAY)));
|
||||||
if (resultChars)
|
if (resultChars)
|
||||||
{
|
{
|
||||||
sLog.outString("Player::DeleteOldChars: Found %u character(s) to delete", uint32(resultChars->GetRowCount()));
|
sLog.outString("Player::DeleteOldChars: Found %u character(s) to delete", uint32(resultChars->GetRowCount()));
|
||||||
|
|
@ -7274,7 +7276,7 @@ ObjectGuid Player::GetGuildGuidFromDB(ObjectGuid guid)
|
||||||
|
|
||||||
uint32 Player::GetRankFromDB(ObjectGuid guid)
|
uint32 Player::GetRankFromDB(ObjectGuid guid)
|
||||||
{
|
{
|
||||||
QueryResult* result = CharacterDatabase.PQuery("SELECT rank FROM guild_member WHERE guid='%u'", guid.GetCounter());
|
QueryResult* result = CharacterDatabase.PQuery("SELECT `rank` FROM `guild_member` WHERE `guid`='%u'", guid.GetCounter());
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
uint32 v = result->Fetch()[0].GetUInt32();
|
uint32 v = result->Fetch()[0].GetUInt32();
|
||||||
|
|
@ -7312,7 +7314,7 @@ uint32 Player::GetArenaTeamIdFromDB(ObjectGuid guid, ArenaType type)
|
||||||
uint32 Player::GetZoneIdFromDB(ObjectGuid guid)
|
uint32 Player::GetZoneIdFromDB(ObjectGuid guid)
|
||||||
{
|
{
|
||||||
uint32 lowguid = guid.GetCounter();
|
uint32 lowguid = guid.GetCounter();
|
||||||
QueryResult* result = CharacterDatabase.PQuery("SELECT zone FROM characters WHERE guid='%u'", lowguid);
|
QueryResult* result = CharacterDatabase.PQuery("SELECT `zone` FROM `characters` WHERE `guid`='%u'", lowguid);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -7324,7 +7326,7 @@ uint32 Player::GetZoneIdFromDB(ObjectGuid guid)
|
||||||
if (!zone)
|
if (!zone)
|
||||||
{
|
{
|
||||||
// stored zone is zero, use generic and slow zone detection
|
// stored zone is zero, use generic and slow zone detection
|
||||||
result = CharacterDatabase.PQuery("SELECT map,position_x,position_y,position_z FROM characters WHERE guid='%u'", lowguid);
|
result = CharacterDatabase.PQuery("SELECT `map`,`position_x`,`position_y`,`position_z` FROM `characters` WHERE `guid`='%u'", lowguid);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -7339,7 +7341,9 @@ uint32 Player::GetZoneIdFromDB(ObjectGuid guid)
|
||||||
zone = sTerrainMgr.GetZoneId(map, posx, posy, posz);
|
zone = sTerrainMgr.GetZoneId(map, posx, posy, posz);
|
||||||
|
|
||||||
if (zone > 0)
|
if (zone > 0)
|
||||||
CharacterDatabase.PExecute("UPDATE characters SET zone='%u' WHERE guid='%u'", zone, lowguid);
|
{
|
||||||
|
CharacterDatabase.PExecute("UPDATE `characters` SET `zone`='%u' WHERE `guid`='%u'", zone, lowguid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return zone;
|
return zone;
|
||||||
|
|
@ -7349,7 +7353,7 @@ uint32 Player::GetLevelFromDB(ObjectGuid guid)
|
||||||
{
|
{
|
||||||
uint32 lowguid = guid.GetCounter();
|
uint32 lowguid = guid.GetCounter();
|
||||||
|
|
||||||
QueryResult* result = CharacterDatabase.PQuery("SELECT level FROM characters WHERE guid='%u'", lowguid);
|
QueryResult* result = CharacterDatabase.PQuery("SELECT `level` FROM `characters` WHERE `guid`='%u'", lowguid);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -11992,7 +11996,7 @@ void Player::DestroyItem(uint8 bag, uint8 slot, bool update)
|
||||||
{
|
{
|
||||||
static SqlStatementID delGifts ;
|
static SqlStatementID delGifts ;
|
||||||
|
|
||||||
SqlStatement stmt = CharacterDatabase.CreateStatement(delGifts, "DELETE FROM character_gifts WHERE item_guid = ?");
|
SqlStatement stmt = CharacterDatabase.CreateStatement(delGifts, "DELETE FROM `character_gifts` WHERE `item_guid` = ?");
|
||||||
stmt.PExecute(pItem->GetGUIDLow());
|
stmt.PExecute(pItem->GetGUIDLow());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -16498,7 +16502,7 @@ void Player::_LoadBGData(QueryResult* result)
|
||||||
|
|
||||||
bool Player::LoadPositionFromDB(ObjectGuid guid, uint32& mapid, float& x, float& y, float& z, float& o, bool& in_flight)
|
bool Player::LoadPositionFromDB(ObjectGuid guid, uint32& mapid, float& x, float& y, float& z, float& o, bool& in_flight)
|
||||||
{
|
{
|
||||||
QueryResult* result = CharacterDatabase.PQuery("SELECT position_x,position_y,position_z,orientation,map,taxi_path FROM characters WHERE guid = '%u'", guid.GetCounter());
|
QueryResult* result = CharacterDatabase.PQuery("SELECT `position_x`,`position_y`,`position_z`,`orientation`,`map`,`taxi_path` FROM `characters` WHERE `guid` = '%u'", guid.GetCounter());
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -16582,7 +16586,7 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder* holder)
|
||||||
(GetSession()->GetSecurity() == SEC_PLAYER && sObjectMgr.IsReservedName(m_name)))
|
(GetSession()->GetSecurity() == SEC_PLAYER && sObjectMgr.IsReservedName(m_name)))
|
||||||
{
|
{
|
||||||
delete result;
|
delete result;
|
||||||
CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '%u' WHERE guid ='%u'",
|
CharacterDatabase.PExecute("UPDATE `characters` SET `at_login` = `at_login` | '%u' WHERE `guid` ='%u'",
|
||||||
uint32(AT_LOGIN_RENAME), guid.GetCounter());
|
uint32(AT_LOGIN_RENAME), guid.GetCounter());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -17235,7 +17239,7 @@ void Player::_LoadActions(QueryResult* result)
|
||||||
m_actionButtons[i].clear();
|
m_actionButtons[i].clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
// QueryResult *result = CharacterDatabase.PQuery("SELECT spec, button,action,type FROM character_action WHERE guid = '%u' ORDER BY button",GetGUIDLow());
|
// QueryResult *result = CharacterDatabase.PQuery("SELECT `spec`, `button`,`action`,`type` FROM `character_action` WHERE `guid` = '%u' ORDER BY `button`",GetGUIDLow());
|
||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
|
|
@ -17268,7 +17272,7 @@ void Player::_LoadAuras(QueryResult* result, uint32 timediff)
|
||||||
{
|
{
|
||||||
// RemoveAllAuras(); -- some spells casted before aura load, for example in LoadSkills, aura list explicitly cleaned early
|
// RemoveAllAuras(); -- some spells casted before aura load, for example in LoadSkills, aura list explicitly cleaned early
|
||||||
|
|
||||||
// QueryResult *result = CharacterDatabase.PQuery("SELECT caster_guid,item_guid,spell,stackcount,remaincharges,basepoints0,basepoints1,basepoints2,periodictime0,periodictime1,periodictime2,maxduration,remaintime,effIndexMask FROM character_aura WHERE guid = '%u'",GetGUIDLow());
|
// QueryResult *result = CharacterDatabase.PQuery("SELECT `caster_guid`,`item_guid`,`spell`,`stackcount`,`remaincharges`,`basepoints0`,`basepoints1`,`basepoints2`,`periodictime0`,`periodictime1`,`periodictime2`,`maxduration`,`remaintime`,`effIndexMask` FROM `character_aura` WHERE `guid` = '%u'",GetGUIDLow());
|
||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
|
|
@ -17430,7 +17434,7 @@ void Player::LoadCorpse()
|
||||||
|
|
||||||
void Player::_LoadInventory(QueryResult* result, uint32 timediff)
|
void Player::_LoadInventory(QueryResult* result, uint32 timediff)
|
||||||
{
|
{
|
||||||
// QueryResult *result = CharacterDatabase.PQuery("SELECT data,text,bag,slot,item,item_template FROM character_inventory JOIN item_instance ON character_inventory.item = item_instance.guid WHERE character_inventory.guid = '%u' ORDER BY bag,slot", GetGUIDLow());
|
// QueryResult *result = CharacterDatabase.PQuery("SELECT `data`,`text`,`bag`,`slot`,`item`,`item_template` FROM `character_inventory` JOIN `item_instance` ON `character_inventory`.`item` = `item_instance`.`guid` WHERE `character_inventory`.`guid` = '%u' ORDER BY `bag`,`slot`", GetGUIDLow());
|
||||||
std::map<uint32, Bag*> bagMap; // fast guid lookup for bags
|
std::map<uint32, Bag*> bagMap; // fast guid lookup for bags
|
||||||
// NOTE: the "order by `bag`" is important because it makes sure
|
// NOTE: the "order by `bag`" is important because it makes sure
|
||||||
// the bagMap is filled before items in the bags are loaded
|
// the bagMap is filled before items in the bags are loaded
|
||||||
|
|
@ -17457,8 +17461,8 @@ void Player::_LoadInventory(QueryResult* result, uint32 timediff)
|
||||||
|
|
||||||
if (!proto)
|
if (!proto)
|
||||||
{
|
{
|
||||||
CharacterDatabase.PExecute("DELETE FROM character_inventory WHERE item = '%u'", item_lowguid);
|
CharacterDatabase.PExecute("DELETE FROM `character_inventory` WHERE `item` = '%u'", item_lowguid);
|
||||||
CharacterDatabase.PExecute("DELETE FROM item_instance WHERE guid = '%u'", item_lowguid);
|
CharacterDatabase.PExecute("DELETE FROM `item_instance` WHERE `guid` = '%u'", item_lowguid);
|
||||||
sLog.outError("Player::_LoadInventory: Player %s has an unknown item (id: #%u) in inventory, deleted.", GetName(), item_id);
|
sLog.outError("Player::_LoadInventory: Player %s has an unknown item (id: #%u) in inventory, deleted.", GetName(), item_id);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -17468,7 +17472,7 @@ void Player::_LoadInventory(QueryResult* result, uint32 timediff)
|
||||||
if (!item->LoadFromDB(item_lowguid, fields, GetObjectGuid()))
|
if (!item->LoadFromDB(item_lowguid, fields, GetObjectGuid()))
|
||||||
{
|
{
|
||||||
sLog.outError("Player::_LoadInventory: Player %s has broken item (id: #%u) in inventory, deleted.", GetName(), item_id);
|
sLog.outError("Player::_LoadInventory: Player %s has broken item (id: #%u) in inventory, deleted.", GetName(), item_id);
|
||||||
CharacterDatabase.PExecute("DELETE FROM character_inventory WHERE item = '%u'", item_lowguid);
|
CharacterDatabase.PExecute("DELETE FROM `character_inventory` WHERE `item` = '%u'", item_lowguid);
|
||||||
item->FSetState(ITEM_REMOVED);
|
item->FSetState(ITEM_REMOVED);
|
||||||
item->SaveToDB(); // it also deletes item object !
|
item->SaveToDB(); // it also deletes item object !
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -17477,7 +17481,7 @@ void Player::_LoadInventory(QueryResult* result, uint32 timediff)
|
||||||
// not allow have in alive state item limited to another map/zone
|
// not allow have in alive state item limited to another map/zone
|
||||||
if (IsAlive() && item->IsLimitedToAnotherMapOrZone(GetMapId(), zone))
|
if (IsAlive() && item->IsLimitedToAnotherMapOrZone(GetMapId(), zone))
|
||||||
{
|
{
|
||||||
CharacterDatabase.PExecute("DELETE FROM character_inventory WHERE item = '%u'", item_lowguid);
|
CharacterDatabase.PExecute("DELETE FROM `character_inventory` WHERE `item` = '%u'", item_lowguid);
|
||||||
item->FSetState(ITEM_REMOVED);
|
item->FSetState(ITEM_REMOVED);
|
||||||
item->SaveToDB(); // it also deletes item object !
|
item->SaveToDB(); // it also deletes item object !
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -17486,7 +17490,7 @@ void Player::_LoadInventory(QueryResult* result, uint32 timediff)
|
||||||
// "Conjured items disappear if you are logged out for more than 15 minutes"
|
// "Conjured items disappear if you are logged out for more than 15 minutes"
|
||||||
if (timediff > 15 * MINUTE && (item->GetProto()->Flags & ITEM_FLAG_CONJURED))
|
if (timediff > 15 * MINUTE && (item->GetProto()->Flags & ITEM_FLAG_CONJURED))
|
||||||
{
|
{
|
||||||
CharacterDatabase.PExecute("DELETE FROM character_inventory WHERE item = '%u'", item_lowguid);
|
CharacterDatabase.PExecute("DELETE FROM `character_inventory` WHERE `item` = '%u'", item_lowguid);
|
||||||
item->FSetState(ITEM_REMOVED);
|
item->FSetState(ITEM_REMOVED);
|
||||||
item->SaveToDB(); // it also deletes item object !
|
item->SaveToDB(); // it also deletes item object !
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -17566,7 +17570,7 @@ void Player::_LoadInventory(QueryResult* result, uint32 timediff)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sLog.outError("Player::_LoadInventory: Player %s has item (GUID: %u Entry: %u) can't be loaded to inventory (Bag GUID: %u Slot: %u) by some reason, will send by mail.", GetName(), item_lowguid, item_id, bag_guid, slot);
|
sLog.outError("Player::_LoadInventory: Player %s has item (GUID: %u Entry: %u) can't be loaded to inventory (Bag GUID: %u Slot: %u) by some reason, will send by mail.", GetName(), item_lowguid, item_id, bag_guid, slot);
|
||||||
CharacterDatabase.PExecute("DELETE FROM character_inventory WHERE item = '%u'", item_lowguid);
|
CharacterDatabase.PExecute("DELETE FROM `character_inventory` WHERE `item` = '%u'", item_lowguid);
|
||||||
problematicItems.push_back(item);
|
problematicItems.push_back(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -17601,7 +17605,7 @@ void Player::_LoadInventory(QueryResult* result, uint32 timediff)
|
||||||
|
|
||||||
void Player::_LoadItemLoot(QueryResult* result)
|
void Player::_LoadItemLoot(QueryResult* result)
|
||||||
{
|
{
|
||||||
// QueryResult *result = CharacterDatabase.PQuery("SELECT guid,itemid,amount,suffix,property FROM item_loot WHERE guid = '%u'", GetGUIDLow());
|
// QueryResult *result = CharacterDatabase.PQuery("SELECT `guid`,`itemid`,`amount`,`suffix`,`property` FROM `item_loot` WHERE `guid` = '%u'", GetGUIDLow());
|
||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
|
|
@ -17614,7 +17618,7 @@ void Player::_LoadItemLoot(QueryResult* result)
|
||||||
|
|
||||||
if (!item)
|
if (!item)
|
||||||
{
|
{
|
||||||
CharacterDatabase.PExecute("DELETE FROM item_loot WHERE guid = '%u'", item_guid);
|
CharacterDatabase.PExecute("DELETE FROM `item_loot` WHERE `guid` = '%u'", item_guid);
|
||||||
sLog.outError("Player::_LoadItemLoot: Player %s has loot for nonexistent item (GUID: %u) in `item_loot`, deleted.", GetName(), item_guid);
|
sLog.outError("Player::_LoadItemLoot: Player %s has loot for nonexistent item (GUID: %u) in `item_loot`, deleted.", GetName(), item_guid);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -17655,8 +17659,8 @@ void Player::_LoadMailedItems(QueryResult* result)
|
||||||
if (!proto)
|
if (!proto)
|
||||||
{
|
{
|
||||||
sLog.outError("Player %u has unknown item_template (ProtoType) in mailed items(GUID: %u template: %u) in mail (%u), deleted.", GetGUIDLow(), item_guid_low, item_template, mail->messageID);
|
sLog.outError("Player %u has unknown item_template (ProtoType) in mailed items(GUID: %u template: %u) in mail (%u), deleted.", GetGUIDLow(), item_guid_low, item_template, mail->messageID);
|
||||||
CharacterDatabase.PExecute("DELETE FROM mail_items WHERE item_guid = '%u'", item_guid_low);
|
CharacterDatabase.PExecute("DELETE FROM `mail_items` WHERE `item_guid` = '%u'", item_guid_low);
|
||||||
CharacterDatabase.PExecute("DELETE FROM item_instance WHERE guid = '%u'", item_guid_low);
|
CharacterDatabase.PExecute("DELETE FROM `item_instance` WHERE `guid` = '%u'", item_guid_low);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -17665,7 +17669,7 @@ void Player::_LoadMailedItems(QueryResult* result)
|
||||||
if (!item->LoadFromDB(item_guid_low, fields, GetObjectGuid()))
|
if (!item->LoadFromDB(item_guid_low, fields, GetObjectGuid()))
|
||||||
{
|
{
|
||||||
sLog.outError("Player::_LoadMailedItems - Item in mail (%u) doesn't exist !!!! - item guid: %u, deleted from mail", mail->messageID, item_guid_low);
|
sLog.outError("Player::_LoadMailedItems - Item in mail (%u) doesn't exist !!!! - item guid: %u, deleted from mail", mail->messageID, item_guid_low);
|
||||||
CharacterDatabase.PExecute("DELETE FROM mail_items WHERE item_guid = '%u'", item_guid_low);
|
CharacterDatabase.PExecute("DELETE FROM `mail_items` WHERE `item_guid` = '%u'", item_guid_low);
|
||||||
item->FSetState(ITEM_REMOVED);
|
item->FSetState(ITEM_REMOVED);
|
||||||
item->SaveToDB(); // it also deletes item object !
|
item->SaveToDB(); // it also deletes item object !
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -18113,7 +18117,7 @@ void Player::_LoadBoundInstances(QueryResult* result)
|
||||||
if (!mapEntry || !mapEntry->IsDungeon())
|
if (!mapEntry || !mapEntry->IsDungeon())
|
||||||
{
|
{
|
||||||
sLog.outError("_LoadBoundInstances: player %s(%d) has bind to nonexistent or not dungeon map %d", GetName(), GetGUIDLow(), mapId);
|
sLog.outError("_LoadBoundInstances: player %s(%d) has bind to nonexistent or not dungeon map %d", GetName(), GetGUIDLow(), mapId);
|
||||||
CharacterDatabase.PExecute("DELETE FROM character_instance WHERE guid = '%u' AND instance = '%u'", GetGUIDLow(), instanceId);
|
CharacterDatabase.PExecute("DELETE FROM `character_instance` WHERE `guid` = '%u' AND `instance` = '%u'", GetGUIDLow(), instanceId);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -18136,7 +18140,7 @@ void Player::_LoadBoundInstances(QueryResult* result)
|
||||||
{
|
{
|
||||||
sLog.outError("_LoadBoundInstances: %s is in group (Id: %d) but has a non-permanent character bind to map %d,%d,%d",
|
sLog.outError("_LoadBoundInstances: %s is in group (Id: %d) but has a non-permanent character bind to map %d,%d,%d",
|
||||||
GetGuidStr().c_str(), group->GetId(), mapId, instanceId, difficulty);
|
GetGuidStr().c_str(), group->GetId(), mapId, instanceId, difficulty);
|
||||||
CharacterDatabase.PExecute("DELETE FROM character_instance WHERE guid = '%u' AND instance = '%u'",
|
CharacterDatabase.PExecute("DELETE FROM `character_instance` WHERE `guid` = '%u' AND `instance` = '%u'",
|
||||||
GetGUIDLow(), instanceId);
|
GetGUIDLow(), instanceId);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -18181,7 +18185,7 @@ void Player::UnbindInstance(BoundInstancesMap::iterator& itr, Difficulty difficu
|
||||||
if (itr != m_boundInstances[difficulty].end())
|
if (itr != m_boundInstances[difficulty].end())
|
||||||
{
|
{
|
||||||
if (!unload)
|
if (!unload)
|
||||||
CharacterDatabase.PExecute("DELETE FROM character_instance WHERE guid = '%u' AND instance = '%u'",
|
CharacterDatabase.PExecute("DELETE FROM `character_instance` WHERE `guid` = '%u' AND `instance` = '%u'",
|
||||||
GetGUIDLow(), itr->second.state->GetInstanceId());
|
GetGUIDLow(), itr->second.state->GetInstanceId());
|
||||||
|
|
||||||
sCalendarMgr.SendCalendarRaidLockoutRemove(this, itr->second.state);
|
sCalendarMgr.SendCalendarRaidLockoutRemove(this, itr->second.state);
|
||||||
|
|
@ -18201,13 +18205,13 @@ InstancePlayerBind* Player::BindToInstance(DungeonPersistentState* state, bool p
|
||||||
// update the state when the group kills a boss
|
// update the state when the group kills a boss
|
||||||
if (permanent != bind.perm || state != bind.state)
|
if (permanent != bind.perm || state != bind.state)
|
||||||
if (!load)
|
if (!load)
|
||||||
CharacterDatabase.PExecute("UPDATE character_instance SET instance = '%u', permanent = '%u' WHERE guid = '%u' AND instance = '%u'",
|
CharacterDatabase.PExecute("UPDATE `character_instance` SET `instance` = '%u', `permanent` = '%u' WHERE `guid` = '%u' AND `instance` = '%u'",
|
||||||
state->GetInstanceId(), permanent, GetGUIDLow(), bind.state->GetInstanceId());
|
state->GetInstanceId(), permanent, GetGUIDLow(), bind.state->GetInstanceId());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!load)
|
if (!load)
|
||||||
CharacterDatabase.PExecute("INSERT INTO character_instance (guid, instance, permanent) VALUES ('%u', '%u', '%u')",
|
CharacterDatabase.PExecute("INSERT INTO `character_instance` (`guid`, `instance`, `permanent`) VALUES ('%u', '%u', '%u')",
|
||||||
GetGUIDLow(), state->GetInstanceId(), permanent);
|
GetGUIDLow(), state->GetInstanceId(), permanent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -18388,11 +18392,15 @@ void Player::ConvertInstancesToGroup(Player* player, Group* group, ObjectGuid pl
|
||||||
|
|
||||||
// if the player's not online we don't know what binds it has
|
// if the player's not online we don't know what binds it has
|
||||||
if (!player || !group || has_binds)
|
if (!player || !group || has_binds)
|
||||||
CharacterDatabase.PExecute("INSERT INTO group_instance SELECT guid, instance, permanent FROM character_instance WHERE guid = '%u'", player_lowguid);
|
{
|
||||||
|
CharacterDatabase.PExecute("INSERT INTO `group_instance` SELECT `guid`, `instance`, `permanent` FROM `character_instance` WHERE `guid` = '%u'", player_lowguid);
|
||||||
|
}
|
||||||
|
|
||||||
// the following should not get executed when changing leaders
|
// the following should not get executed when changing leaders
|
||||||
if (!player || has_solo)
|
if (!player || has_solo)
|
||||||
CharacterDatabase.PExecute("DELETE FROM character_instance WHERE guid = '%u' AND permanent = 0", player_lowguid);
|
{
|
||||||
|
CharacterDatabase.PExecute("DELETE FROM `character_instance` WHERE `guid` = '%u' AND `permanent` = 0", player_lowguid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Player::_LoadHomeBind(QueryResult* result)
|
bool Player::_LoadHomeBind(QueryResult* result)
|
||||||
|
|
@ -18405,7 +18413,7 @@ bool Player::_LoadHomeBind(QueryResult* result)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
// QueryResult *result = CharacterDatabase.PQuery("SELECT map,zone,position_x,position_y,position_z FROM character_homebind WHERE guid = '%u'", GUID_LOPART(playerGuid));
|
// QueryResult *result = CharacterDatabase.PQuery("SELECT `map`,`zone`,`position_x`,`position_y`,`position_z` FROM `character_homebind` WHERE `guid` = '%u'", GUID_LOPART(playerGuid));
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
Field* fields = result->Fetch();
|
Field* fields = result->Fetch();
|
||||||
|
|
@ -18425,7 +18433,9 @@ bool Player::_LoadHomeBind(QueryResult* result)
|
||||||
ok = true;
|
ok = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
CharacterDatabase.PExecute("DELETE FROM character_homebind WHERE guid = '%u'", GetGUIDLow());
|
{
|
||||||
|
CharacterDatabase.PExecute("DELETE FROM `character_homebind` WHERE `guid` = '%u'", GetGUIDLow());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ok)
|
if (!ok)
|
||||||
|
|
@ -18436,7 +18446,7 @@ bool Player::_LoadHomeBind(QueryResult* result)
|
||||||
m_homebindY = info->positionY;
|
m_homebindY = info->positionY;
|
||||||
m_homebindZ = info->positionZ;
|
m_homebindZ = info->positionZ;
|
||||||
|
|
||||||
CharacterDatabase.PExecute("INSERT INTO character_homebind (guid,map,zone,position_x,position_y,position_z) VALUES ('%u', '%u', '%u', '%f', '%f', '%f')", GetGUIDLow(), m_homebindMapId, (uint32)m_homebindAreaId, m_homebindX, m_homebindY, m_homebindZ);
|
CharacterDatabase.PExecute("INSERT INTO `character_homebind` (`guid`,`map`,`zone`,`position_x`,`position_y`,`position_z`) VALUES ('%u', '%u', '%u', '%f', '%f', '%f')", GetGUIDLow(), m_homebindMapId, (uint32)m_homebindAreaId, m_homebindX, m_homebindY, m_homebindZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_LOG("Setting player home position: mapid is: %u, zoneid is %u, X is %f, Y is %f, Z is %f",
|
DEBUG_LOG("Setting player home position: mapid is: %u, zoneid is %u, X is %f, Y is %f, Z is %f",
|
||||||
|
|
@ -18480,17 +18490,19 @@ void Player::SaveToDB()
|
||||||
static SqlStatementID delChar ;
|
static SqlStatementID delChar ;
|
||||||
static SqlStatementID insChar ;
|
static SqlStatementID insChar ;
|
||||||
|
|
||||||
SqlStatement stmt = CharacterDatabase.CreateStatement(delChar, "DELETE FROM characters WHERE guid = ?");
|
SqlStatement stmt = CharacterDatabase.CreateStatement(delChar, "DELETE FROM `characters` WHERE `guid` = ?");
|
||||||
stmt.PExecute(GetGUIDLow());
|
stmt.PExecute(GetGUIDLow());
|
||||||
|
|
||||||
SqlStatement uberInsert = CharacterDatabase.CreateStatement(insChar, "INSERT INTO characters (guid,account,name,race,class,gender,level,xp,money,playerBytes,playerBytes2,playerFlags,"
|
SqlStatement uberInsert = CharacterDatabase.CreateStatement(insChar, "INSERT INTO `characters` (`guid`,`account`,`name`,`race`,`class`,`gender`, "
|
||||||
"map, dungeon_difficulty, position_x, position_y, position_z, orientation, "
|
"`level`,`xp`,`money`,`playerBytes`,`playerBytes2`,`playerFlags`,"
|
||||||
"taximask, online, cinematic, "
|
"`map`, `dungeon_difficulty`, `position_x`, `position_y`, `position_z`, `orientation`, "
|
||||||
"totaltime, leveltime, rest_bonus, logout_time, is_logout_resting, resettalents_cost, resettalents_time, primary_trees, "
|
"`taximask`, `online`, `cinematic`, "
|
||||||
"trans_x, trans_y, trans_z, trans_o, transguid, extra_flags, stable_slots, at_login, zone, "
|
"`totaltime`, `leveltime`, `rest_bonus`, `logout_time`, `is_logout_resting`, `resettalents_cost`, `resettalents_time`, `primary_trees`, "
|
||||||
"death_expire_time, taxi_path, totalKills, "
|
"`trans_x`, `trans_y`, `trans_z`, `trans_o`, `transguid`, `extra_flags`, `stable_slots`, `at_login`, `zone`, "
|
||||||
"todayKills, yesterdayKills, chosenTitle, watchedFaction, drunk, health, power1, power2, power3, "
|
"`death_expire_time`, `taxi_path`, `totalKills`, "
|
||||||
"power4, power5, specCount, activeSpec, exploredZones, equipmentCache, knownTitles, actionBars, slot) "
|
"`todayKills`, `yesterdayKills`, `chosenTitle`, "
|
||||||
|
"`watchedFaction`, `drunk`, `health`, `power1`, `power2`, `power3`, "
|
||||||
|
"`power4`, `power5`, `specCount`, `activeSpec`, `exploredZones`, `equipmentCache`, `knownTitles`, `actionBars`, `slot`) "
|
||||||
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, "
|
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, "
|
||||||
"?, ?, ?, ?, ?, ?, "
|
"?, ?, ?, ?, ?, ?, "
|
||||||
"?, ?, ?, "
|
"?, ?, ?, "
|
||||||
|
|
@ -18671,7 +18683,7 @@ void Player::SaveGoldToDB()
|
||||||
{
|
{
|
||||||
static SqlStatementID updateGold ;
|
static SqlStatementID updateGold ;
|
||||||
|
|
||||||
SqlStatement stmt = CharacterDatabase.CreateStatement(updateGold, "UPDATE characters SET money = ? WHERE guid = ?");
|
SqlStatement stmt = CharacterDatabase.CreateStatement(updateGold, "UPDATE `characters` SET `money` = ? WHERE `guid` = ?");
|
||||||
stmt.PExecute(GetMoney(), GetGUIDLow());
|
stmt.PExecute(GetMoney(), GetGUIDLow());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -18689,7 +18701,7 @@ void Player::_SaveActions()
|
||||||
{
|
{
|
||||||
case ACTIONBUTTON_NEW:
|
case ACTIONBUTTON_NEW:
|
||||||
{
|
{
|
||||||
SqlStatement stmt = CharacterDatabase.CreateStatement(insertAction, "INSERT INTO character_action (guid,spec, button,action,type) VALUES (?, ?, ?, ?, ?)");
|
SqlStatement stmt = CharacterDatabase.CreateStatement(insertAction, "INSERT INTO `character_action` (`guid`,`spec`, `button`,`action`,`type`) VALUES (?, ?, ?, ?, ?)");
|
||||||
stmt.addUInt32(GetGUIDLow());
|
stmt.addUInt32(GetGUIDLow());
|
||||||
stmt.addUInt32(i);
|
stmt.addUInt32(i);
|
||||||
stmt.addUInt32(uint32(itr->first));
|
stmt.addUInt32(uint32(itr->first));
|
||||||
|
|
@ -18736,7 +18748,7 @@ void Player::_SaveAuras()
|
||||||
static SqlStatementID deleteAuras ;
|
static SqlStatementID deleteAuras ;
|
||||||
static SqlStatementID insertAuras ;
|
static SqlStatementID insertAuras ;
|
||||||
|
|
||||||
SqlStatement stmt = CharacterDatabase.CreateStatement(deleteAuras, "DELETE FROM character_aura WHERE guid = ?");
|
SqlStatement stmt = CharacterDatabase.CreateStatement(deleteAuras, "DELETE FROM `character_aura` WHERE `guid` = ?");
|
||||||
stmt.PExecute(GetGUIDLow());
|
stmt.PExecute(GetGUIDLow());
|
||||||
|
|
||||||
SpellAuraHolderMap const& auraHolders = GetSpellAuraHolderMap();
|
SpellAuraHolderMap const& auraHolders = GetSpellAuraHolderMap();
|
||||||
|
|
@ -18746,8 +18758,8 @@ void Player::_SaveAuras()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
stmt = CharacterDatabase.CreateStatement(insertAuras, "INSERT INTO character_aura (guid, caster_guid, item_guid, spell, stackcount, remaincharges, "
|
stmt = CharacterDatabase.CreateStatement(insertAuras, "INSERT INTO `character_aura` (`guid`, `caster_guid`, `item_guid`, `spell`, `stackcount`, `remaincharges`, "
|
||||||
"basepoints0, basepoints1, basepoints2, periodictime0, periodictime1, periodictime2, maxduration, remaintime, effIndexMask) "
|
"`basepoints0`, `basepoints1`, `basepoints2`, `periodictime0`, `periodictime1`, `periodictime2`, `maxduration`, `remaintime`, `effIndexMask`) "
|
||||||
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
||||||
|
|
||||||
for (SpellAuraHolderMap::const_iterator itr = auraHolders.begin(); itr != auraHolders.end(); ++itr)
|
for (SpellAuraHolderMap::const_iterator itr = auraHolders.begin(); itr != auraHolders.end(); ++itr)
|
||||||
|
|
@ -18859,10 +18871,10 @@ void Player::_SaveInventory()
|
||||||
static SqlStatementID delInv ;
|
static SqlStatementID delInv ;
|
||||||
static SqlStatementID delItemInst ;
|
static SqlStatementID delItemInst ;
|
||||||
|
|
||||||
SqlStatement stmt = CharacterDatabase.CreateStatement(delInv, "DELETE FROM character_inventory WHERE item = ?");
|
SqlStatement stmt = CharacterDatabase.CreateStatement(delInv, "DELETE FROM `character_inventory` WHERE `item` = ?");
|
||||||
stmt.PExecute(item->GetGUIDLow());
|
stmt.PExecute(item->GetGUIDLow());
|
||||||
|
|
||||||
stmt = CharacterDatabase.CreateStatement(delItemInst, "DELETE FROM item_instance WHERE guid = ?");
|
stmt = CharacterDatabase.CreateStatement(delItemInst, "DELETE FROM `item_instance` WHERE `guid` = ?");
|
||||||
stmt.PExecute(item->GetGUIDLow());
|
stmt.PExecute(item->GetGUIDLow());
|
||||||
|
|
||||||
m_items[i]->FSetState(ITEM_NEW);
|
m_items[i]->FSetState(ITEM_NEW);
|
||||||
|
|
@ -18920,7 +18932,7 @@ void Player::_SaveInventory()
|
||||||
{
|
{
|
||||||
case ITEM_NEW:
|
case ITEM_NEW:
|
||||||
{
|
{
|
||||||
SqlStatement stmt = CharacterDatabase.CreateStatement(insertInventory, "INSERT INTO character_inventory (guid,bag,slot,item,item_template) VALUES (?, ?, ?, ?, ?)");
|
SqlStatement stmt = CharacterDatabase.CreateStatement(insertInventory, "INSERT INTO `character_inventory` (`guid`,`bag`,`slot`,`item`,`item_template`) VALUES (?, ?, ?, ?, ?)");
|
||||||
stmt.addUInt32(GetGUIDLow());
|
stmt.addUInt32(GetGUIDLow());
|
||||||
stmt.addUInt32(bag_guid);
|
stmt.addUInt32(bag_guid);
|
||||||
stmt.addUInt8(item->GetSlot());
|
stmt.addUInt8(item->GetSlot());
|
||||||
|
|
@ -18931,7 +18943,7 @@ void Player::_SaveInventory()
|
||||||
break;
|
break;
|
||||||
case ITEM_CHANGED:
|
case ITEM_CHANGED:
|
||||||
{
|
{
|
||||||
SqlStatement stmt = CharacterDatabase.CreateStatement(updateInventory, "UPDATE character_inventory SET guid = ?, bag = ?, slot = ?, item_template = ? WHERE item = ?");
|
SqlStatement stmt = CharacterDatabase.CreateStatement(updateInventory, "UPDATE `character_inventory` SET `guid` = ?, `bag` = ?, `slot` = ?, `item_template` = ? WHERE `item` = ?");
|
||||||
stmt.addUInt32(GetGUIDLow());
|
stmt.addUInt32(GetGUIDLow());
|
||||||
stmt.addUInt32(bag_guid);
|
stmt.addUInt32(bag_guid);
|
||||||
stmt.addUInt8(item->GetSlot());
|
stmt.addUInt8(item->GetSlot());
|
||||||
|
|
@ -18942,7 +18954,7 @@ void Player::_SaveInventory()
|
||||||
break;
|
break;
|
||||||
case ITEM_REMOVED:
|
case ITEM_REMOVED:
|
||||||
{
|
{
|
||||||
SqlStatement stmt = CharacterDatabase.CreateStatement(deleteInventory, "DELETE FROM character_inventory WHERE item = ?");
|
SqlStatement stmt = CharacterDatabase.CreateStatement(deleteInventory, "DELETE FROM `character_inventory` WHERE `item` = ?");
|
||||||
stmt.PExecute(item->GetGUIDLow());
|
stmt.PExecute(item->GetGUIDLow());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -18969,7 +18981,7 @@ void Player::_SaveMail()
|
||||||
Mail* m = (*itr);
|
Mail* m = (*itr);
|
||||||
if (m->state == MAIL_STATE_CHANGED)
|
if (m->state == MAIL_STATE_CHANGED)
|
||||||
{
|
{
|
||||||
SqlStatement stmt = CharacterDatabase.CreateStatement(updateMail, "UPDATE mail SET has_items = ?, expire_time = ?, deliver_time = ?, money = ?, cod = ?, checked = ? WHERE id = ?");
|
SqlStatement stmt = CharacterDatabase.CreateStatement(updateMail, "UPDATE `mail` SET `has_items` = ?, `expire_time` = ?, `deliver_time` = ?, `money` = ?, `cod` = ?, `checked` = ? WHERE `id` = ?");
|
||||||
stmt.addUInt32(m->HasItems() ? 1 : 0);
|
stmt.addUInt32(m->HasItems() ? 1 : 0);
|
||||||
stmt.addUInt64(uint64(m->expire_time));
|
stmt.addUInt64(uint64(m->expire_time));
|
||||||
stmt.addUInt64(uint64(m->deliver_time));
|
stmt.addUInt64(uint64(m->deliver_time));
|
||||||
|
|
@ -18981,7 +18993,7 @@ void Player::_SaveMail()
|
||||||
|
|
||||||
if (!m->removedItems.empty())
|
if (!m->removedItems.empty())
|
||||||
{
|
{
|
||||||
stmt = CharacterDatabase.CreateStatement(deleteMailItems, "DELETE FROM mail_items WHERE item_guid = ?");
|
stmt = CharacterDatabase.CreateStatement(deleteMailItems, "DELETE FROM `mail_items` WHERE `item_guid` = ?");
|
||||||
|
|
||||||
for (std::vector<uint32>::const_iterator itr2 = m->removedItems.begin(); itr2 != m->removedItems.end(); ++itr2)
|
for (std::vector<uint32>::const_iterator itr2 = m->removedItems.begin(); itr2 != m->removedItems.end(); ++itr2)
|
||||||
{
|
{
|
||||||
|
|
@ -18996,17 +19008,17 @@ void Player::_SaveMail()
|
||||||
{
|
{
|
||||||
if (m->HasItems())
|
if (m->HasItems())
|
||||||
{
|
{
|
||||||
SqlStatement stmt = CharacterDatabase.CreateStatement(deleteItem, "DELETE FROM item_instance WHERE guid = ?");
|
SqlStatement stmt = CharacterDatabase.CreateStatement(deleteItem, "DELETE FROM `item_instance` WHERE `guid` = ?");
|
||||||
for (MailItemInfoVec::const_iterator itr2 = m->items.begin(); itr2 != m->items.end(); ++itr2)
|
for (MailItemInfoVec::const_iterator itr2 = m->items.begin(); itr2 != m->items.end(); ++itr2)
|
||||||
{
|
{
|
||||||
stmt.PExecute(itr2->item_guid);
|
stmt.PExecute(itr2->item_guid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SqlStatement stmt = CharacterDatabase.CreateStatement(deleteMain, "DELETE FROM mail WHERE id = ?");
|
SqlStatement stmt = CharacterDatabase.CreateStatement(deleteMain, "DELETE FROM `mail` WHERE `id` = ?");
|
||||||
stmt.PExecute(m->messageID);
|
stmt.PExecute(m->messageID);
|
||||||
|
|
||||||
stmt = CharacterDatabase.CreateStatement(deleteItems, "DELETE FROM mail_items WHERE mail_id = ?");
|
stmt = CharacterDatabase.CreateStatement(deleteItems, "DELETE FROM `mail_items` WHERE `mail_id` = ?");
|
||||||
stmt.PExecute(m->messageID);
|
stmt.PExecute(m->messageID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -19041,7 +19053,7 @@ void Player::_SaveQuestStatus()
|
||||||
{
|
{
|
||||||
case QUEST_NEW :
|
case QUEST_NEW :
|
||||||
{
|
{
|
||||||
SqlStatement stmt = CharacterDatabase.CreateStatement(insertQuestStatus, "INSERT INTO character_queststatus (guid,quest,status,rewarded,explored,timer,mobcount1,mobcount2,mobcount3,mobcount4,itemcount1,itemcount2,itemcount3,itemcount4,itemcount5,itemcount6) "
|
SqlStatement stmt = CharacterDatabase.CreateStatement(insertQuestStatus, "INSERT INTO `character_queststatus` (`guid`,`quest`,`status`,`rewarded`,`explored`,`timer`,`mobcount1`,`mobcount2`,`mobcount3`,`mobcount4`,`itemcount1`,`itemcount2`,`itemcount3`,`itemcount4`,`itemcount5`,`itemcount6`) "
|
||||||
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
||||||
|
|
||||||
stmt.addUInt32(GetGUIDLow());
|
stmt.addUInt32(GetGUIDLow());
|
||||||
|
|
@ -19063,8 +19075,8 @@ void Player::_SaveQuestStatus()
|
||||||
break;
|
break;
|
||||||
case QUEST_CHANGED :
|
case QUEST_CHANGED :
|
||||||
{
|
{
|
||||||
SqlStatement stmt = CharacterDatabase.CreateStatement(updateQuestStatus, "UPDATE character_queststatus SET status = ?,rewarded = ?,explored = ?,timer = ?,"
|
SqlStatement stmt = CharacterDatabase.CreateStatement(updateQuestStatus, "UPDATE `character_queststatus` SET `status` = ?,`rewarded` = ?,`explored` = ?,`timer` = ?,"
|
||||||
"mobcount1 = ?,mobcount2 = ?,mobcount3 = ?,mobcount4 = ?,itemcount1 = ?,itemcount2 = ?,itemcount3 = ?,itemcount4 = ?,itemcount5 = ?,itemcount6 = ? WHERE guid = ? AND quest = ?");
|
"`mobcount1` = ?,`mobcount2` = ?,`mobcount3` = ?,`mobcount4` = ?,`itemcount1` = ?,`itemcount2` = ?,`itemcount3` = ?,`itemcount4` = ?,`itemcount5` = ?,`itemcount6` = ? WHERE `guid` = ? AND `quest` = ?");
|
||||||
|
|
||||||
stmt.addUInt8(i->second.m_status);
|
stmt.addUInt8(i->second.m_status);
|
||||||
stmt.addUInt8(i->second.m_rewarded);
|
stmt.addUInt8(i->second.m_rewarded);
|
||||||
|
|
@ -19180,7 +19192,7 @@ void Player::_SaveSkills()
|
||||||
|
|
||||||
if (itr->second.uState == SKILL_DELETED)
|
if (itr->second.uState == SKILL_DELETED)
|
||||||
{
|
{
|
||||||
SqlStatement stmt = CharacterDatabase.CreateStatement(delSkills, "DELETE FROM character_skills WHERE guid = ? AND skill = ?");
|
SqlStatement stmt = CharacterDatabase.CreateStatement(delSkills, "DELETE FROM `character_skills` WHERE `guid` = ? AND `skill` = ?");
|
||||||
stmt.PExecute(GetGUIDLow(), itr->first);
|
stmt.PExecute(GetGUIDLow(), itr->first);
|
||||||
mSkillStatus.erase(itr++);
|
mSkillStatus.erase(itr++);
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -19196,13 +19208,13 @@ void Player::_SaveSkills()
|
||||||
{
|
{
|
||||||
case SKILL_NEW:
|
case SKILL_NEW:
|
||||||
{
|
{
|
||||||
SqlStatement stmt = CharacterDatabase.CreateStatement(insSkills, "INSERT INTO character_skills (guid, skill, value, max) VALUES (?, ?, ?, ?)");
|
SqlStatement stmt = CharacterDatabase.CreateStatement(insSkills, "INSERT INTO `character_skills` (`guid`, `skill`, `value`, `max`) VALUES (?, ?, ?, ?)");
|
||||||
stmt.PExecute(GetGUIDLow(), itr->first, value, max);
|
stmt.PExecute(GetGUIDLow(), itr->first, value, max);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SKILL_CHANGED:
|
case SKILL_CHANGED:
|
||||||
{
|
{
|
||||||
SqlStatement stmt = CharacterDatabase.CreateStatement(updSkills, "UPDATE character_skills SET value = ?, max = ? WHERE guid = ? AND skill = ?");
|
SqlStatement stmt = CharacterDatabase.CreateStatement(updSkills, "UPDATE `character_skills` SET `value` = ?, `max` = ? WHERE `guid` = ? AND `skill` = ?");
|
||||||
stmt.PExecute(value, max, GetGUIDLow(), itr->first);
|
stmt.PExecute(value, max, GetGUIDLow(), itr->first);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -19222,8 +19234,8 @@ void Player::_SaveSpells()
|
||||||
static SqlStatementID delSpells ;
|
static SqlStatementID delSpells ;
|
||||||
static SqlStatementID insSpells ;
|
static SqlStatementID insSpells ;
|
||||||
|
|
||||||
SqlStatement stmtDel = CharacterDatabase.CreateStatement(delSpells, "DELETE FROM character_spell WHERE guid = ? and spell = ?");
|
SqlStatement stmtDel = CharacterDatabase.CreateStatement(delSpells, "DELETE FROM `character_spell` WHERE `guid` = ? and `spell` = ?");
|
||||||
SqlStatement stmtIns = CharacterDatabase.CreateStatement(insSpells, "INSERT INTO character_spell (guid,spell,active,disabled) VALUES (?, ?, ?, ?)");
|
SqlStatement stmtIns = CharacterDatabase.CreateStatement(insSpells, "INSERT INTO `character_spell` (`guid`,`spell`,`active`,`disabled`) VALUES (?, ?, ?, ?)");
|
||||||
|
|
||||||
for (PlayerSpellMap::iterator itr = m_spells.begin(), next = m_spells.begin(); itr != m_spells.end();)
|
for (PlayerSpellMap::iterator itr = m_spells.begin(), next = m_spells.begin(); itr != m_spells.end();)
|
||||||
{
|
{
|
||||||
|
|
@ -19292,12 +19304,12 @@ void Player::_SaveStats()
|
||||||
static SqlStatementID delStats ;
|
static SqlStatementID delStats ;
|
||||||
static SqlStatementID insertStats ;
|
static SqlStatementID insertStats ;
|
||||||
|
|
||||||
SqlStatement stmt = CharacterDatabase.CreateStatement(delStats, "DELETE FROM character_stats WHERE guid = ?");
|
SqlStatement stmt = CharacterDatabase.CreateStatement(delStats, "DELETE FROM `character_stats` WHERE `guid` = ?");
|
||||||
stmt.PExecute(GetGUIDLow());
|
stmt.PExecute(GetGUIDLow());
|
||||||
|
|
||||||
stmt = CharacterDatabase.CreateStatement(insertStats, "INSERT INTO character_stats (guid, maxhealth, maxpower1, maxpower2, maxpower3, maxpower4, maxpower5,"
|
stmt = CharacterDatabase.CreateStatement(insertStats, "INSERT INTO `character_stats` (`guid`, `maxhealth`, `maxpower1`, `maxpower2`, `maxpower3`, `maxpower4`, `maxpower5`,"
|
||||||
"strength, agility, stamina, intellect, spirit, armor, resHoly, resFire, resNature, resFrost, resShadow, resArcane, "
|
"`strength`, `agility`, `stamina`, `intellect`, `spirit`, `armor`, `resHoly`, `resFire`, `resNature`, `resFrost`, `resShadow`, `resArcane`, "
|
||||||
"blockPct, dodgePct, parryPct, critPct, rangedCritPct, spellCritPct, attackPower, rangedAttackPower, spellPower) "
|
"`blockPct`, `dodgePct`, `parryPct`, `critPct`, `rangedCritPct`, `spellCritPct`, `attackPower`, `rangedAttackPower`, `spellPower`) "
|
||||||
"VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
"VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
||||||
|
|
||||||
stmt.addUInt32(GetGUIDLow());
|
stmt.addUInt32(GetGUIDLow());
|
||||||
|
|
@ -19406,10 +19418,10 @@ void Player::SendAttackSwingNotInRange()
|
||||||
void Player::SavePositionInDB(ObjectGuid guid, uint32 mapid, float x, float y, float z, float o, uint32 zone)
|
void Player::SavePositionInDB(ObjectGuid guid, uint32 mapid, float x, float y, float z, float o, uint32 zone)
|
||||||
{
|
{
|
||||||
std::ostringstream ss;
|
std::ostringstream ss;
|
||||||
ss << "UPDATE characters SET position_x='" << x << "',position_y='" << y
|
ss << "UPDATE `characters` SET `position_x`='" << x << "',`position_y`='" << y
|
||||||
<< "',position_z='" << z << "',orientation='" << o << "',map='" << mapid
|
<< "',`position_z`='" << z << "',`orientation`='" << o << "',`map`='" << mapid
|
||||||
<< "',zone='" << zone << "',trans_x='0',trans_y='0',trans_z='0',"
|
<< "',`zone`='" << zone << "',`trans_x`='0',`trans_y`='0',`trans_z`='0',"
|
||||||
<< "transguid='0',taxi_path='' WHERE guid='" << guid.GetCounter() << "'";
|
<< "`transguid`='0',`taxi_path`='' WHERE `guid`='" << guid.GetCounter() << "'";
|
||||||
DEBUG_LOG("%s", ss.str().c_str());
|
DEBUG_LOG("%s", ss.str().c_str());
|
||||||
CharacterDatabase.Execute(ss.str().c_str());
|
CharacterDatabase.Execute(ss.str().c_str());
|
||||||
}
|
}
|
||||||
|
|
@ -19984,7 +19996,7 @@ void Player::RemovePetitionsAndSigns(ObjectGuid guid)
|
||||||
uint32 lowguid = guid.GetCounter();
|
uint32 lowguid = guid.GetCounter();
|
||||||
|
|
||||||
QueryResult* result = NULL;
|
QueryResult* result = NULL;
|
||||||
result = CharacterDatabase.PQuery("SELECT ownerguid,petitionguid FROM petition_sign WHERE playerguid = '%u'", lowguid);
|
result = CharacterDatabase.PQuery("SELECT `ownerguid`,`petitionguid` FROM `petition_sign` WHERE `playerguid` = '%u'", lowguid);
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
do // this part effectively does nothing, since the deletion / modification only takes place _after_ the PetitionQuery. Though I don't know if the result remains intact if I execute the delete query beforehand.
|
do // this part effectively does nothing, since the deletion / modification only takes place _after_ the PetitionQuery. Though I don't know if the result remains intact if I execute the delete query beforehand.
|
||||||
|
|
@ -20003,12 +20015,12 @@ void Player::RemovePetitionsAndSigns(ObjectGuid guid)
|
||||||
|
|
||||||
delete result;
|
delete result;
|
||||||
|
|
||||||
CharacterDatabase.PExecute("DELETE FROM petition_sign WHERE playerguid = '%u'", lowguid);
|
CharacterDatabase.PExecute("DELETE FROM `petition_sign` WHERE `playerguid` = '%u'", lowguid);
|
||||||
}
|
}
|
||||||
|
|
||||||
CharacterDatabase.BeginTransaction();
|
CharacterDatabase.BeginTransaction();
|
||||||
CharacterDatabase.PExecute("DELETE FROM petition WHERE ownerguid = '%u'", lowguid);
|
CharacterDatabase.PExecute("DELETE FROM `petition` WHERE `ownerguid` = '%u'", lowguid);
|
||||||
CharacterDatabase.PExecute("DELETE FROM petition_sign WHERE ownerguid = '%u'", lowguid);
|
CharacterDatabase.PExecute("DELETE FROM `petition_sign` WHERE `ownerguid` = '%u'", lowguid);
|
||||||
CharacterDatabase.CommitTransaction();
|
CharacterDatabase.CommitTransaction();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -23822,7 +23834,7 @@ void Player::_LoadSkills(QueryResult* result)
|
||||||
if (value == 0)
|
if (value == 0)
|
||||||
{
|
{
|
||||||
sLog.outError("Character %u has skill %u with value 0. Will be deleted.", GetGUIDLow(), skill);
|
sLog.outError("Character %u has skill %u with value 0. Will be deleted.", GetGUIDLow(), skill);
|
||||||
CharacterDatabase.PExecute("DELETE FROM character_skills WHERE guid = '%u' AND skill = '%u' ", GetGUIDLow(), skill);
|
CharacterDatabase.PExecute("DELETE FROM `character_skills` WHERE `guid` = '%u' AND `skill` = '%u' ", GetGUIDLow(), skill);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -25080,7 +25092,9 @@ void Player::RemoveAtLoginFlag(AtLoginFlags f, bool in_db_also /*= false*/)
|
||||||
m_atLoginFlags &= ~f;
|
m_atLoginFlags &= ~f;
|
||||||
|
|
||||||
if (in_db_also)
|
if (in_db_also)
|
||||||
CharacterDatabase.PExecute("UPDATE characters set at_login = at_login & ~ %u WHERE guid ='%u'", uint32(f), GetGUIDLow());
|
{
|
||||||
|
CharacterDatabase.PExecute("UPDATE `characters` set `at_login` = `at_login` & ~ %u WHERE `guid` ='%u'", uint32(f), GetGUIDLow());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::SendClearCooldown(uint32 spell_id, Unit* target)
|
void Player::SendClearCooldown(uint32 spell_id, Unit* target)
|
||||||
|
|
@ -25163,7 +25177,7 @@ void Player::SetHomebindToLocation(WorldLocation const& loc, uint32 area_id)
|
||||||
m_homebindZ = loc.coord_z;
|
m_homebindZ = loc.coord_z;
|
||||||
|
|
||||||
// update sql homebind
|
// update sql homebind
|
||||||
CharacterDatabase.PExecute("UPDATE character_homebind SET map = '%u', zone = '%u', position_x = '%f', position_y = '%f', position_z = '%f' WHERE guid = '%u'",
|
CharacterDatabase.PExecute("UPDATE `character_homebind` SET `map` = '%u', `zone` = '%u', `position_x` = '%f', `position_y` = '%f', `position_z` = '%f' WHERE `guid` = '%u'",
|
||||||
m_homebindMapId, m_homebindAreaId, m_homebindX, m_homebindY, m_homebindZ, GetGUIDLow());
|
m_homebindMapId, m_homebindAreaId, m_homebindX, m_homebindY, m_homebindZ, GetGUIDLow());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -509,7 +509,7 @@ void ReputationMgr::LoadFromDB(QueryResult* result)
|
||||||
// Set initial reputations (so everything is nifty before DB data load)
|
// Set initial reputations (so everything is nifty before DB data load)
|
||||||
Initialize();
|
Initialize();
|
||||||
|
|
||||||
// QueryResult *result = CharacterDatabase.PQuery("SELECT faction,standing,flags FROM character_reputation WHERE guid = '%u'",GetGUIDLow());
|
// QueryResult *result = CharacterDatabase.PQuery("SELECT `faction`,`standing`,`flags` FROM character_reputation WHERE guid = '%u'",GetGUIDLow());
|
||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
|
|
@ -577,8 +577,8 @@ void ReputationMgr::SaveToDB()
|
||||||
static SqlStatementID delRep ;
|
static SqlStatementID delRep ;
|
||||||
static SqlStatementID insRep ;
|
static SqlStatementID insRep ;
|
||||||
|
|
||||||
SqlStatement stmtDel = CharacterDatabase.CreateStatement(delRep, "DELETE FROM character_reputation WHERE guid = ? AND faction=?");
|
SqlStatement stmtDel = CharacterDatabase.CreateStatement(delRep, "DELETE FROM `character_reputation` WHERE `guid` = ? AND `faction`=?");
|
||||||
SqlStatement stmtIns = CharacterDatabase.CreateStatement(insRep, "INSERT INTO character_reputation (guid,faction,standing,flags) VALUES (?, ?, ?, ?)");
|
SqlStatement stmtIns = CharacterDatabase.CreateStatement(insRep, "INSERT INTO `character_reputation` (`guid`,`faction`,`standing`,`flags`) VALUES (?, ?, ?, ?)");
|
||||||
|
|
||||||
for (FactionStateList::iterator itr = m_factions.begin(); itr != m_factions.end(); ++itr)
|
for (FactionStateList::iterator itr = m_factions.begin(); itr != m_factions.end(); ++itr)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -79,12 +79,12 @@ bool PlayerSocial::AddToSocialList(ObjectGuid friend_guid, bool ignore)
|
||||||
PlayerSocialMap::const_iterator itr = m_playerSocialMap.find(friend_guid.GetCounter());
|
PlayerSocialMap::const_iterator itr = m_playerSocialMap.find(friend_guid.GetCounter());
|
||||||
if (itr != m_playerSocialMap.end())
|
if (itr != m_playerSocialMap.end())
|
||||||
{
|
{
|
||||||
CharacterDatabase.PExecute("UPDATE character_social SET flags = (flags | %u) WHERE guid = '%u' AND friend = '%u'", flag, m_playerLowGuid, friend_guid.GetCounter());
|
CharacterDatabase.PExecute("UPDATE `character_social` SET `flags` = (`flags` | %u) WHERE `guid` = '%u' AND `friend` = '%u'", flag, m_playerLowGuid, friend_guid.GetCounter());
|
||||||
m_playerSocialMap[friend_guid.GetCounter()].Flags |= flag;
|
m_playerSocialMap[friend_guid.GetCounter()].Flags |= flag;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CharacterDatabase.PExecute("INSERT INTO character_social (guid, friend, flags) VALUES ('%u', '%u', '%u')", m_playerLowGuid, friend_guid.GetCounter(), flag);
|
CharacterDatabase.PExecute("INSERT INTO `character_social` (`guid`, `friend`, `flags`) VALUES ('%u', '%u', '%u')", m_playerLowGuid, friend_guid.GetCounter(), flag);
|
||||||
FriendInfo fi;
|
FriendInfo fi;
|
||||||
fi.Flags |= flag;
|
fi.Flags |= flag;
|
||||||
m_playerSocialMap[friend_guid.GetCounter()] = fi;
|
m_playerSocialMap[friend_guid.GetCounter()] = fi;
|
||||||
|
|
@ -107,12 +107,12 @@ void PlayerSocial::RemoveFromSocialList(ObjectGuid friend_guid, bool ignore)
|
||||||
itr->second.Flags &= ~flag;
|
itr->second.Flags &= ~flag;
|
||||||
if (itr->second.Flags == 0)
|
if (itr->second.Flags == 0)
|
||||||
{
|
{
|
||||||
CharacterDatabase.PExecute("DELETE FROM character_social WHERE guid = '%u' AND friend = '%u'", m_playerLowGuid, friend_guid.GetCounter());
|
CharacterDatabase.PExecute("DELETE FROM `character_social` WHERE `guid` = '%u' AND `friend` = '%u'", m_playerLowGuid, friend_guid.GetCounter());
|
||||||
m_playerSocialMap.erase(itr);
|
m_playerSocialMap.erase(itr);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CharacterDatabase.PExecute("UPDATE character_social SET flags = (flags & ~%u) WHERE guid = '%u' AND friend = '%u'", flag, m_playerLowGuid, friend_guid.GetCounter());
|
CharacterDatabase.PExecute("UPDATE `character_social` SET `flags` = (`flags` & ~%u) WHERE `guid` = '%u' AND `friend` = '%u'", flag, m_playerLowGuid, friend_guid.GetCounter());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1266,7 +1266,7 @@ void SpellMgr::LoadSpellTargetPositions()
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
|
|
||||||
// 0 1 2 3 4 5
|
// 0 1 2 3 4 5
|
||||||
QueryResult* result = WorldDatabase.Query("SELECT id, target_map, target_position_x, target_position_y, target_position_z, target_orientation FROM spell_target_position");
|
QueryResult* result = WorldDatabase.Query("SELECT `id`, `target_map`, `target_position_x`, `target_position_y`, `target_position_z`, `target_orientation` FROM `spell_target_position`");
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
BarGoLink bar(1);
|
BarGoLink bar(1);
|
||||||
|
|
@ -1534,51 +1534,51 @@ void SpellMgr::LoadSpellProcEvents()
|
||||||
mSpellProcEventMap.clear(); // need for reload case
|
mSpellProcEventMap.clear(); // need for reload case
|
||||||
|
|
||||||
// 0 1 2
|
// 0 1 2
|
||||||
QueryResult* result = WorldDatabase.Query("SELECT entry, SchoolMask, SpellFamilyName, "
|
QueryResult* result = WorldDatabase.Query("SELECT `entry`, `SchoolMask`, `SpellFamilyName`, "
|
||||||
// 3 4 5
|
// 3 4 5
|
||||||
"SpellFamilyMaskA0, SpellFamilyMaskA1, SpellFamilyMaskA2, "
|
"`SpellFamilyMaskA0`, `SpellFamilyMaskA1`, `SpellFamilyMaskA2`, "
|
||||||
// 6 7 8
|
// 6 7 8
|
||||||
"SpellFamilyMaskB0, SpellFamilyMaskB1, SpellFamilyMaskB2, "
|
"`SpellFamilyMaskB0`, `SpellFamilyMaskB1`, `SpellFamilyMaskB2`, "
|
||||||
// 9 10 11
|
// 9 10 11
|
||||||
"SpellFamilyMaskC0, SpellFamilyMaskC1, SpellFamilyMaskC2, "
|
"`SpellFamilyMaskC0`, `SpellFamilyMaskC1`, `SpellFamilyMaskC2`, "
|
||||||
// 12 13 14
|
// 12 13 14
|
||||||
"SpellFamilyMaskD0, SpellFamilyMaskD1, SpellFamilyMaskD2, "
|
"`SpellFamilyMaskD0`, `SpellFamilyMaskD1`, `SpellFamilyMaskD2`, "
|
||||||
// 15 16 17
|
// 15 16 17
|
||||||
"SpellFamilyMaskE0, SpellFamilyMaskE1, SpellFamilyMaskE2, "
|
"`SpellFamilyMaskE0`, `SpellFamilyMaskE1`, `SpellFamilyMaskE2`, "
|
||||||
// 18 19 20
|
// 18 19 20
|
||||||
"SpellFamilyMaskF0, SpellFamilyMaskF1, SpellFamilyMaskF2, "
|
"`SpellFamilyMaskF0`, `SpellFamilyMaskF1`, `SpellFamilyMaskF2`, "
|
||||||
// 21 22 23
|
// 21 22 23
|
||||||
"SpellFamilyMaskG0, SpellFamilyMaskG1, SpellFamilyMaskG2, "
|
"`SpellFamilyMaskG0`, `SpellFamilyMaskG1`, `SpellFamilyMaskG2`, "
|
||||||
// 24 25 26
|
// 24 25 26
|
||||||
"SpellFamilyMaskH0, SpellFamilyMaskH1, SpellFamilyMaskH2, "
|
"`SpellFamilyMaskH0`, `SpellFamilyMaskH1`, `SpellFamilyMaskH2`, "
|
||||||
// 27 28 29
|
// 27 28 29
|
||||||
"SpellFamilyMaskI0, SpellFamilyMaskI1, SpellFamilyMaskI2, "
|
"`SpellFamilyMaskI0`, `SpellFamilyMaskI1`, `SpellFamilyMaskI2`, "
|
||||||
// 30 31 32
|
// 30 31 32
|
||||||
"SpellFamilyMaskJ0, SpellFamilyMaskJ1, SpellFamilyMaskJ2, "
|
"`SpellFamilyMaskJ0`, `SpellFamilyMaskJ1`, `SpellFamilyMaskJ2`, "
|
||||||
// 33 34 35
|
// 33 34 35
|
||||||
"SpellFamilyMaskK0, SpellFamilyMaskK1, SpellFamilyMaskK2, "
|
"`SpellFamilyMaskK0`, `SpellFamilyMaskK1`, `SpellFamilyMaskK2`, "
|
||||||
// 36 37 38
|
// 36 37 38
|
||||||
"SpellFamilyMaskL0, SpellFamilyMaskL1, SpellFamilyMaskL2, "
|
"`SpellFamilyMaskL0`, `SpellFamilyMaskL1`, `SpellFamilyMaskL2`, "
|
||||||
// 39 40 41
|
// 39 40 41
|
||||||
"SpellFamilyMaskM0, SpellFamilyMaskM1, SpellFamilyMaskM2, "
|
"`SpellFamilyMaskM0`, `SpellFamilyMaskM1`, `SpellFamilyMaskM2`, "
|
||||||
// 42 43 44
|
// 42 43 44
|
||||||
"SpellFamilyMaskN0, SpellFamilyMaskN1, SpellFamilyMaskN2, "
|
"`SpellFamilyMaskN0`, `SpellFamilyMaskN1`, `SpellFamilyMaskN2`, "
|
||||||
// 45 46 47
|
// 45 46 47
|
||||||
"SpellFamilyMaskO0, SpellFamilyMaskO1, SpellFamilyMaskO2, "
|
"`SpellFamilyMaskO0`, `SpellFamilyMaskO1`, `SpellFamilyMaskO2`, "
|
||||||
// 48 49 50
|
// 48 49 50
|
||||||
"SpellFamilyMaskP0, SpellFamilyMaskP1, SpellFamilyMaskP2, "
|
"`SpellFamilyMaskP0`, `SpellFamilyMaskP1`, `SpellFamilyMaskP2`, "
|
||||||
// 51 52 53
|
// 51 52 53
|
||||||
"SpellFamilyMaskQ0, SpellFamilyMaskQ1, SpellFamilyMaskQ2, "
|
"`SpellFamilyMaskQ0`, `SpellFamilyMaskQ1`, `SpellFamilyMaskQ2`, "
|
||||||
// 54 55 56
|
// 54 55 56
|
||||||
"SpellFamilyMaskR0, SpellFamilyMaskR1, SpellFamilyMaskR2, "
|
"`SpellFamilyMaskR0`, `SpellFamilyMaskR1`, `SpellFamilyMaskR2`, "
|
||||||
// 57 58 59
|
// 57 58 59
|
||||||
"SpellFamilyMaskS0, SpellFamilyMaskS1, SpellFamilyMaskS2, "
|
"`SpellFamilyMaskS0`, `SpellFamilyMaskS1`, `SpellFamilyMaskS2`, "
|
||||||
// 60 61 62
|
// 60 61 62
|
||||||
"SpellFamilyMaskT0, SpellFamilyMaskT1, SpellFamilyMaskT2, "
|
"`SpellFamilyMaskT0`, `SpellFamilyMaskT1`, `SpellFamilyMaskT2`, "
|
||||||
// 63 64 65
|
// 63 64 65
|
||||||
"SpellFamilyMaskU0, SpellFamilyMaskU1, SpellFamilyMaskU2, "
|
"`SpellFamilyMaskU0`, `SpellFamilyMaskU1`, `SpellFamilyMaskU2`, "
|
||||||
// 66 67 68 69 70
|
// 66 67 68 69 70
|
||||||
"procFlags, procEx, ppmRate, CustomChance, Cooldown FROM spell_proc_event");
|
"`procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown` FROM `spell_proc_event`");
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
BarGoLink bar(1);
|
BarGoLink bar(1);
|
||||||
|
|
@ -1644,7 +1644,7 @@ void SpellMgr::LoadSpellProcItemEnchant()
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
|
|
||||||
// 0 1
|
// 0 1
|
||||||
QueryResult* result = WorldDatabase.Query("SELECT entry, ppmRate FROM spell_proc_item_enchant");
|
QueryResult* result = WorldDatabase.Query("SELECT `entry`, `ppmRate` FROM `spell_proc_item_enchant`");
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
@ -1758,8 +1758,8 @@ void SpellMgr::LoadSpellBonuses()
|
||||||
{
|
{
|
||||||
mSpellBonusMap.clear(); // need for reload case
|
mSpellBonusMap.clear(); // need for reload case
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
// 0 1 2 3
|
QueryResult* result = WorldDatabase.Query("SELECT entry, direct_bonus, \
|
||||||
QueryResult* result = WorldDatabase.Query("SELECT entry, direct_bonus, dot_bonus, ap_bonus, ap_dot_bonus FROM spell_bonus_data");
|
`dot_bonus`, `ap_bonus`, `ap_dot_bonus` FROM `spell_bonus_data`");
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
BarGoLink bar(1);
|
BarGoLink bar(1);
|
||||||
|
|
@ -2007,7 +2007,7 @@ void SpellMgr::LoadSpellElixirs()
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
|
|
||||||
// 0 1
|
// 0 1
|
||||||
QueryResult* result = WorldDatabase.Query("SELECT entry, mask FROM spell_elixir");
|
QueryResult* result = WorldDatabase.Query("SELECT `entry`, `mask` FROM `spell_elixir`");
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
@ -2111,7 +2111,7 @@ void SpellMgr::LoadSpellThreats()
|
||||||
mSpellThreatMap.clear(); // need for reload case
|
mSpellThreatMap.clear(); // need for reload case
|
||||||
|
|
||||||
// 0 1 2 3
|
// 0 1 2 3
|
||||||
QueryResult* result = WorldDatabase.Query("SELECT entry, Threat, multiplier, ap_bonus FROM spell_threat");
|
QueryResult* result = WorldDatabase.Query("SELECT `entry`, `Threat`, `multiplier`, `ap_bonus` FROM `spell_threat`");
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
BarGoLink bar(1);
|
BarGoLink bar(1);
|
||||||
|
|
@ -3430,7 +3430,7 @@ void SpellMgr::LoadSpellChains()
|
||||||
}
|
}
|
||||||
|
|
||||||
// load custom case
|
// load custom case
|
||||||
QueryResult* result = WorldDatabase.Query("SELECT spell_id, prev_spell, first_spell, rank, req_spell FROM spell_chain");
|
QueryResult* result = WorldDatabase.Query("SELECT `spell_id`, `prev_spell`, `first_spell`, `rank`, `req_spell` FROM `spell_chain`");
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
BarGoLink bar(1);
|
BarGoLink bar(1);
|
||||||
|
|
@ -3731,7 +3731,7 @@ void SpellMgr::LoadSpellLearnSpells()
|
||||||
mSpellLearnSpells.clear(); // need for reload case
|
mSpellLearnSpells.clear(); // need for reload case
|
||||||
|
|
||||||
// 0 1 2
|
// 0 1 2
|
||||||
QueryResult* result = WorldDatabase.Query("SELECT entry, SpellID, Active FROM spell_learn_spell");
|
QueryResult* result = WorldDatabase.Query("SELECT `entry`, `SpellID`, `Active` FROM `spell_learn_spell`");
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
BarGoLink bar(1);
|
BarGoLink bar(1);
|
||||||
|
|
@ -3978,7 +3978,7 @@ void SpellMgr::LoadSpellPetAuras()
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
|
|
||||||
// 0 1 2 3
|
// 0 1 2 3
|
||||||
QueryResult* result = WorldDatabase.Query("SELECT spell, effectId, pet, aura FROM spell_pet_auras");
|
QueryResult* result = WorldDatabase.Query("SELECT `spell`, `effectId`, `pet`, `aura` FROM `spell_pet_auras`");
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
@ -4341,7 +4341,7 @@ void SpellMgr::LoadSpellAreas()
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
|
|
||||||
// 0 1 2 3 4 5 6 7 8 9
|
// 0 1 2 3 4 5 6 7 8 9
|
||||||
QueryResult* result = WorldDatabase.Query("SELECT spell, area, quest_start, quest_start_active, quest_end, condition_id, aura_spell, racemask, gender, autocast FROM spell_area");
|
QueryResult* result = WorldDatabase.Query("SELECT `spell`, `area`, `quest_start`, `quest_start_active`, `quest_end`, `condition_id`, `aura_spell`, `racemask`, `gender`, `autocast` FROM `spell_area`");
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
|
|
@ -4766,7 +4766,7 @@ void SpellMgr::CheckUsedSpells(char const* table)
|
||||||
uint32 countMasks = 0;
|
uint32 countMasks = 0;
|
||||||
|
|
||||||
// 0 1 2 3 4 5 6 7 8 9 10 11
|
// 0 1 2 3 4 5 6 7 8 9 10 11
|
||||||
QueryResult* result = WorldDatabase.PQuery("SELECT spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMaskB,SpellIcon,SpellVisual,SpellCategory,EffectType,EffectAura,EffectIdx,Name,Code FROM %s", table);
|
QueryResult* result = WorldDatabase.PQuery("SELECT `spellid`,`SpellFamilyName`,`SpellFamilyMaskA`,`SpellFamilyMaskB`,`SpellIcon`,`SpellVisual`,`SpellCategory`,`EffectType`,`EffectAura`,`EffectIdx`,`Name`,`Code` FROM `%s`", table);
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -555,7 +555,7 @@ void WorldSession::LogoutPlayer(bool Save)
|
||||||
#else
|
#else
|
||||||
static SqlStatementID id;
|
static SqlStatementID id;
|
||||||
|
|
||||||
SqlStatement stmt = LoginDatabase.CreateStatement(id, "UPDATE account SET active_realm_id = ? WHERE id = ?");
|
SqlStatement stmt = LoginDatabase.CreateStatement(id, "UPDATE `account` SET `active_realm_id` = ? WHERE `id` = ?");
|
||||||
stmt.PExecute(uint32(0), GetAccountId());
|
stmt.PExecute(uint32(0), GetAccountId());
|
||||||
#endif
|
#endif
|
||||||
///- If the player is in a guild, update the guild roster and broadcast a logout message to other guild members
|
///- If the player is in a guild, update the guild roster and broadcast a logout message to other guild members
|
||||||
|
|
@ -640,7 +640,7 @@ void WorldSession::LogoutPlayer(bool Save)
|
||||||
#ifdef ENABLE_PLAYERBOTS
|
#ifdef ENABLE_PLAYERBOTS
|
||||||
SqlStatement stmt = CharacterDatabase.CreateStatement(updChars, "UPDATE characters SET online = 0 WHERE account = ?");
|
SqlStatement stmt = CharacterDatabase.CreateStatement(updChars, "UPDATE characters SET online = 0 WHERE account = ?");
|
||||||
#else
|
#else
|
||||||
stmt = CharacterDatabase.CreateStatement(updChars, "UPDATE characters SET online = 0 WHERE account = ?");
|
stmt = CharacterDatabase.CreateStatement(updChars, "UPDATE `characters` SET `online` = 0 WHERE `account` = ?");
|
||||||
#endif
|
#endif
|
||||||
stmt.PExecute(GetAccountId());
|
stmt.PExecute(GetAccountId());
|
||||||
|
|
||||||
|
|
@ -1068,7 +1068,7 @@ void WorldSession::LoadTutorialsData()
|
||||||
m_Tutorials[ aX ] = 0;
|
m_Tutorials[ aX ] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
QueryResult* result = CharacterDatabase.PQuery("SELECT tut0,tut1,tut2,tut3,tut4,tut5,tut6,tut7 FROM character_tutorial WHERE account = '%u'", GetAccountId());
|
QueryResult* result = CharacterDatabase.PQuery("SELECT `tut0`,`tut1`,`tut2`,`tut3`,`tut4`,`tut5`,`tut6`,`tut7` FROM `character_tutorial` WHERE `account` = '%u'", GetAccountId());
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
|
|
@ -1128,7 +1128,7 @@ void WorldSession::SaveTutorialsData()
|
||||||
{
|
{
|
||||||
case TUTORIALDATA_CHANGED:
|
case TUTORIALDATA_CHANGED:
|
||||||
{
|
{
|
||||||
SqlStatement stmt = CharacterDatabase.CreateStatement(updTutorial, "UPDATE character_tutorial SET tut0=?, tut1=?, tut2=?, tut3=?, tut4=?, tut5=?, tut6=?, tut7=? WHERE account = ?");
|
SqlStatement stmt = CharacterDatabase.CreateStatement(updTutorial, "UPDATE `character_tutorial` SET `tut0`=?, `tut1`=?, `tut2`=?, `tut3`=?, `tut4`=?, `tut5`=?, `tut6`=?, `tut7`=? WHERE `account` = ?");
|
||||||
for (int i = 0; i < 8; ++i)
|
for (int i = 0; i < 8; ++i)
|
||||||
{
|
{
|
||||||
stmt.addUInt32(m_Tutorials[i]);
|
stmt.addUInt32(m_Tutorials[i]);
|
||||||
|
|
@ -1141,7 +1141,7 @@ void WorldSession::SaveTutorialsData()
|
||||||
|
|
||||||
case TUTORIALDATA_NEW:
|
case TUTORIALDATA_NEW:
|
||||||
{
|
{
|
||||||
SqlStatement stmt = CharacterDatabase.CreateStatement(insTutorial, "INSERT INTO character_tutorial (account,tut0,tut1,tut2,tut3,tut4,tut5,tut6,tut7) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
SqlStatement stmt = CharacterDatabase.CreateStatement(insTutorial, "INSERT INTO `character_tutorial` (`account`,`tut0`,`tut1`,`tut2`,`tut3`,`tut4`,`tut5`,`tut6`,`tut7`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
||||||
|
|
||||||
stmt.addUInt32(GetAccountId());
|
stmt.addUInt32(GetAccountId());
|
||||||
for (int i = 0; i < 8; ++i)
|
for (int i = 0; i < 8; ++i)
|
||||||
|
|
|
||||||
|
|
@ -908,18 +908,18 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
|
||||||
|
|
||||||
QueryResult* result =
|
QueryResult* result =
|
||||||
LoginDatabase.PQuery("SELECT "
|
LoginDatabase.PQuery("SELECT "
|
||||||
"id, " //0
|
"`id`, " // 0
|
||||||
"gmlevel," //1
|
"`gmlevel`, " // 1
|
||||||
"sessionkey, " //2
|
"`sessionkey`, " // 2
|
||||||
"last_ip, " //3
|
"`last_ip`, " // 3
|
||||||
"locked, " //4
|
"`locked`, " // 4
|
||||||
"v, " //5
|
"`v`, " // 5
|
||||||
"s, " //6
|
"`s`, " // 6
|
||||||
"expansion, " //7
|
"`expansion`, " // 7
|
||||||
"mutetime, " //8
|
"`mutetime`, " // 8
|
||||||
"locale " //9
|
"`locale` " // 9
|
||||||
"FROM account "
|
"FROM `account` "
|
||||||
"WHERE username = '%s'",
|
"WHERE `username` = '%s'",
|
||||||
safe_account.c_str());
|
safe_account.c_str());
|
||||||
|
|
||||||
// Stop if the account is not found
|
// Stop if the account is not found
|
||||||
|
|
@ -985,9 +985,9 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
|
||||||
|
|
||||||
// Re-check account ban (same check as in realmd)
|
// Re-check account ban (same check as in realmd)
|
||||||
QueryResult* banresult =
|
QueryResult* banresult =
|
||||||
LoginDatabase.PQuery("SELECT 1 FROM account_banned WHERE id = %u AND active = 1 AND (unbandate > UNIX_TIMESTAMP() OR unbandate = bandate)"
|
LoginDatabase.PQuery("SELECT 1 FROM `account_banned` WHERE `id` = %u AND `active` = 1 AND (`unbandate` > UNIX_TIMESTAMP() OR `unbandate` = `bandate`)"
|
||||||
"UNION "
|
"UNION "
|
||||||
"SELECT 1 FROM ip_banned WHERE (unbandate = bandate OR unbandate > UNIX_TIMESTAMP()) AND ip = '%s'",
|
"SELECT 1 FROM `ip_banned` WHERE (`unbandate` = `bandate` OR `unbandate` > UNIX_TIMESTAMP()) AND `ip` = '%s'",
|
||||||
id, GetRemoteAddress().c_str());
|
id, GetRemoteAddress().c_str());
|
||||||
|
|
||||||
if (banresult) // if account banned
|
if (banresult) // if account banned
|
||||||
|
|
@ -1041,7 +1041,7 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
|
||||||
// No SQL injection, username escaped.
|
// No SQL injection, username escaped.
|
||||||
static SqlStatementID updAccount;
|
static SqlStatementID updAccount;
|
||||||
|
|
||||||
SqlStatement stmt = LoginDatabase.CreateStatement(updAccount, "UPDATE account SET last_ip = ? WHERE username = ?");
|
SqlStatement stmt = LoginDatabase.CreateStatement(updAccount, "UPDATE `account` SET `last_ip` = ? WHERE `username` = ?");
|
||||||
stmt.PExecute(address.c_str(), accountName.c_str());
|
stmt.PExecute(address.c_str(), accountName.c_str());
|
||||||
|
|
||||||
// NOTE ATM the socket is single-threaded, have this in mind ...
|
// NOTE ATM the socket is single-threaded, have this in mind ...
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ void CharacterDatabaseCleaner::CleanDatabase()
|
||||||
sLog.outString("Cleaning character database...");
|
sLog.outString("Cleaning character database...");
|
||||||
|
|
||||||
// check flags which clean ups are necessary
|
// check flags which clean ups are necessary
|
||||||
QueryResult* result = CharacterDatabase.PQuery("SELECT cleaning_flags FROM saved_variables");
|
QueryResult* result = CharacterDatabase.PQuery("SELECT `cleaning_flags` FROM `saved_variables`");
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|
@ -60,13 +60,15 @@ void CharacterDatabaseCleaner::CleanDatabase()
|
||||||
CleanCharacterSpell();
|
CleanCharacterSpell();
|
||||||
}
|
}
|
||||||
if (flags & CLEANING_FLAG_TALENTS)
|
if (flags & CLEANING_FLAG_TALENTS)
|
||||||
|
{
|
||||||
CleanCharacterTalent();
|
CleanCharacterTalent();
|
||||||
CharacterDatabase.Execute("UPDATE saved_variables SET cleaning_flags = 0");
|
}
|
||||||
|
CharacterDatabase.Execute("UPDATE `saved_variables` SET `cleaning_flags` = 0");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CharacterDatabaseCleaner::CheckUnique(const char* column, const char* table, bool (*check)(uint32))
|
void CharacterDatabaseCleaner::CheckUnique(const char* column, const char* table, bool (*check)(uint32))
|
||||||
{
|
{
|
||||||
QueryResult* result = CharacterDatabase.PQuery("SELECT DISTINCT %s FROM %s", column, table);
|
QueryResult* result = CharacterDatabase.PQuery("SELECT DISTINCT `%s` FROM `%s`", column, table);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
sLog.outString("Table %s is empty.", table);
|
sLog.outString("Table %s is empty.", table);
|
||||||
|
|
@ -88,7 +90,7 @@ void CharacterDatabaseCleaner::CheckUnique(const char* column, const char* table
|
||||||
{
|
{
|
||||||
if (!found)
|
if (!found)
|
||||||
{
|
{
|
||||||
ss << "DELETE FROM " << table << " WHERE " << column << " IN (";
|
ss << "DELETE FROM `" << table << "` WHERE `" << column << "` IN (";
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -370,7 +370,7 @@ void PlayerDumpWriter::DumpTableContent(std::string& dump, uint32 guid, char con
|
||||||
wherestr = GenerateWhereStr(fieldname, guid);
|
wherestr = GenerateWhereStr(fieldname, guid);
|
||||||
}
|
}
|
||||||
|
|
||||||
QueryResult* result = CharacterDatabase.PQuery("SELECT * FROM %s WHERE %s", tableFrom, wherestr.c_str());
|
QueryResult* result = CharacterDatabase.PQuery("SELECT * FROM `%s` WHERE `%s`", tableFrom, wherestr.c_str());
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|
@ -410,7 +410,7 @@ std::string PlayerDumpWriter::GetDump(uint32 guid)
|
||||||
dump += "IMPORTANT NOTE: NOT APPLY ITS DIRECTLY to character DB or you will DAMAGE and CORRUPT character DB\n\n";
|
dump += "IMPORTANT NOTE: NOT APPLY ITS DIRECTLY to character DB or you will DAMAGE and CORRUPT character DB\n\n";
|
||||||
|
|
||||||
// revision check guard
|
// revision check guard
|
||||||
QueryNamedResult* result = CharacterDatabase.QueryNamed("SELECT * FROM character_db_version LIMIT 1");
|
QueryNamedResult* result = CharacterDatabase.QueryNamed("SELECT * FROM `db_version` LIMIT 1");
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
QueryFieldNames const& namesMap = result->GetFieldNames();
|
QueryFieldNames const& namesMap = result->GetFieldNames();
|
||||||
|
|
@ -427,18 +427,18 @@ std::string PlayerDumpWriter::GetDump(uint32 guid)
|
||||||
if (!reqName.empty())
|
if (!reqName.empty())
|
||||||
{
|
{
|
||||||
// this will fail at wrong character DB version
|
// this will fail at wrong character DB version
|
||||||
dump += "UPDATE character_db_version SET " + reqName + " = 1 WHERE FALSE;\n\n";
|
dump += "UPDATE `version` SET `" + reqName + "` = 1 WHERE FALSE;\n\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sLog.outError("Table 'character_db_version' not have revision guard field, revision guard query not added to pdump.");
|
sLog.outError("Character DB Table 'db_version' does not have revision guard field, revision guard query not added to pdump.");
|
||||||
}
|
}
|
||||||
|
|
||||||
delete result;
|
delete result;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sLog.outError("Character DB not have 'character_db_version' table, revision guard query not added to pdump.");
|
sLog.outError("Character DB not have 'db_version' table, revision guard query not added to pdump.");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (DumpTable* itr = &dumpTables[0]; itr->isValid(); ++itr)
|
for (DumpTable* itr = &dumpTables[0]; itr->isValid(); ++itr)
|
||||||
|
|
@ -494,7 +494,7 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
|
||||||
bool incHighest = true;
|
bool incHighest = true;
|
||||||
if (guid != 0 && guid < sObjectMgr.m_CharGuids.GetNextAfterMaxUsed())
|
if (guid != 0 && guid < sObjectMgr.m_CharGuids.GetNextAfterMaxUsed())
|
||||||
{
|
{
|
||||||
result = CharacterDatabase.PQuery("SELECT * FROM characters WHERE guid = '%u'", guid);
|
result = CharacterDatabase.PQuery("SELECT * FROM `characters` WHERE `guid` = '%u'", guid);
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
guid = sObjectMgr.m_CharGuids.GetNextAfterMaxUsed();
|
guid = sObjectMgr.m_CharGuids.GetNextAfterMaxUsed();
|
||||||
|
|
@ -517,7 +517,7 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
|
||||||
if (ObjectMgr::CheckPlayerName(name, true) == CHAR_NAME_SUCCESS)
|
if (ObjectMgr::CheckPlayerName(name, true) == CHAR_NAME_SUCCESS)
|
||||||
{
|
{
|
||||||
CharacterDatabase.escape_string(name); // for safe, we use name only for sql quearies anyway
|
CharacterDatabase.escape_string(name); // for safe, we use name only for sql quearies anyway
|
||||||
result = CharacterDatabase.PQuery("SELECT * FROM characters WHERE name = '%s'", name.c_str());
|
result = CharacterDatabase.PQuery("SELECT * FROM `characters` WHERE `name` = '%s'", name.c_str());
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
name = ""; // use the one from the dump
|
name = ""; // use the one from the dump
|
||||||
|
|
@ -571,7 +571,7 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
|
||||||
}
|
}
|
||||||
|
|
||||||
// add required_ check
|
// add required_ check
|
||||||
if (line.substr(nw_pos, 41) == "UPDATE character_db_version SET required_")
|
if (line.substr(nw_pos, 41) == "UPDATE `db_version` SET `required_`")
|
||||||
{
|
{
|
||||||
if (!CharacterDatabase.Execute(line.c_str()))
|
if (!CharacterDatabase.Execute(line.c_str()))
|
||||||
{
|
{
|
||||||
|
|
@ -647,7 +647,7 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
|
||||||
name = getnth(line, 3); // characters.name
|
name = getnth(line, 3); // characters.name
|
||||||
CharacterDatabase.escape_string(name);
|
CharacterDatabase.escape_string(name);
|
||||||
|
|
||||||
result = CharacterDatabase.PQuery("SELECT * FROM characters WHERE name = '%s'", name.c_str());
|
result = CharacterDatabase.PQuery("SELECT * FROM `characters` WHERE `name` = '%s'", name.c_str());
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
delete result;
|
delete result;
|
||||||
|
|
|
||||||
|
|
@ -305,7 +305,7 @@ void Warden::LogPositiveToDB(WardenCheck* check)
|
||||||
|
|
||||||
static SqlStatementID insWardenPositive;
|
static SqlStatementID insWardenPositive;
|
||||||
|
|
||||||
SqlStatement stmt = LoginDatabase.CreateStatement(insWardenPositive, "INSERT INTO warden_log (`check`, `action`, `account`, `guid`, `map`, `position_x`, `position_y`, `position_z`) VALUES (?, ?, ?, ?, ?, ?, ?, ?)");
|
SqlStatement stmt = LoginDatabase.CreateStatement(insWardenPositive, "INSERT INTO `warden_log` (`check`, `action`, `account`, `guid`, `map`, `position_x`, `position_y`, `position_z`) VALUES (?, ?, ?, ?, ?, ?, ?, ?)");
|
||||||
|
|
||||||
stmt.addUInt16(check->CheckId);
|
stmt.addUInt16(check->CheckId);
|
||||||
stmt.addInt8(check->Action);
|
stmt.addInt8(check->Action);
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ void WardenCheckMgr::LoadWardenChecks()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QueryResult *result = WorldDatabase.Query("SELECT MAX(id) FROM warden_checks");
|
QueryResult *result = WorldDatabase.Query("SELECT MAX(`id`) FROM `warden_checks`");
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
|
|
@ -247,7 +247,7 @@ void WardenCheckMgr::LoadWardenOverrides()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 0 1
|
// 0 1
|
||||||
QueryResult* result = CharacterDatabase.Query("SELECT wardenId, action FROM warden_action");
|
QueryResult* result = CharacterDatabase.Query("SELECT `wardenId`, `action` FROM `warden_action`");
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -54,9 +54,9 @@ AccountOpResult AccountMgr::CreateAccount(std::string username, std::string pass
|
||||||
{ return AOR_NAME_ALREADY_EXIST; } // username does already exist
|
{ return AOR_NAME_ALREADY_EXIST; } // username does already exist
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!LoginDatabase.PExecute("INSERT INTO account(username,sha_pass_hash,joindate) VALUES('%s','%s',NOW())", username.c_str(), CalculateShaPassHash(username, password).c_str()))
|
if (!LoginDatabase.PExecute("INSERT INTO `account` (`username`,`sha_pass_hash`,`joindate`) VALUES ('%s','%s',NOW())", username.c_str(), CalculateShaPassHash(username, password).c_str()))
|
||||||
{ return AOR_DB_INTERNAL_ERROR; } // unexpected error
|
{ return AOR_DB_INTERNAL_ERROR; } // unexpected error
|
||||||
LoginDatabase.Execute("INSERT INTO realmcharacters (realmid, acctid, numchars) SELECT realmlist.id, account.id, 0 FROM realmlist,account LEFT JOIN realmcharacters ON acctid=account.id WHERE acctid IS NULL");
|
LoginDatabase.Execute("INSERT INTO `realmcharacters` (`realmid`, `acctid`, `numchars`) SELECT `realmlist`.`id`, `account`.`id`, 0 FROM `realmlist`,`account` LEFT JOIN `realmcharacters` ON `acctid`=`account`.`id` WHERE `acctid` IS NULL");
|
||||||
|
|
||||||
return AOR_OK; // everything's fine
|
return AOR_OK; // everything's fine
|
||||||
}
|
}
|
||||||
|
|
@ -83,13 +83,13 @@ AccountOpResult AccountMgr::CreateAccount(std::string username, std::string pass
|
||||||
|
|
||||||
AccountOpResult AccountMgr::DeleteAccount(uint32 accid)
|
AccountOpResult AccountMgr::DeleteAccount(uint32 accid)
|
||||||
{
|
{
|
||||||
QueryResult* result = LoginDatabase.PQuery("SELECT 1 FROM account WHERE id='%u'", accid);
|
QueryResult* result = LoginDatabase.PQuery("SELECT 1 FROM `account` WHERE `id`='%u'", accid);
|
||||||
if (!result)
|
if (!result)
|
||||||
{ return AOR_NAME_NOT_EXIST; } // account doesn't exist
|
{ return AOR_NAME_NOT_EXIST; } // account doesn't exist
|
||||||
delete result;
|
delete result;
|
||||||
|
|
||||||
// existing characters list
|
// existing characters list
|
||||||
result = CharacterDatabase.PQuery("SELECT guid FROM characters WHERE account='%u'", accid);
|
result = CharacterDatabase.PQuery("SELECT `guid` FROM `characters` WHERE `account`='%u'", accid);
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
|
|
@ -108,13 +108,13 @@ AccountOpResult AccountMgr::DeleteAccount(uint32 accid)
|
||||||
}
|
}
|
||||||
|
|
||||||
// table realm specific but common for all characters of account for realm
|
// table realm specific but common for all characters of account for realm
|
||||||
CharacterDatabase.PExecute("DELETE FROM character_tutorial WHERE account = '%u'", accid);
|
CharacterDatabase.PExecute("DELETE FROM `character_tutorial` WHERE `account` = '%u'", accid);
|
||||||
|
|
||||||
LoginDatabase.BeginTransaction();
|
LoginDatabase.BeginTransaction();
|
||||||
|
|
||||||
bool res =
|
bool res =
|
||||||
LoginDatabase.PExecute("DELETE FROM account WHERE id='%u'", accid) &&
|
LoginDatabase.PExecute("DELETE FROM `account` WHERE `id`='%u'", accid) &&
|
||||||
LoginDatabase.PExecute("DELETE FROM realmcharacters WHERE acctid='%u'", accid);
|
LoginDatabase.PExecute("DELETE FROM `realmcharacters` WHERE `acctid`='%u'", accid);
|
||||||
|
|
||||||
LoginDatabase.CommitTransaction();
|
LoginDatabase.CommitTransaction();
|
||||||
|
|
||||||
|
|
@ -126,7 +126,7 @@ AccountOpResult AccountMgr::DeleteAccount(uint32 accid)
|
||||||
|
|
||||||
AccountOpResult AccountMgr::ChangeUsername(uint32 accid, std::string new_uname, std::string new_passwd)
|
AccountOpResult AccountMgr::ChangeUsername(uint32 accid, std::string new_uname, std::string new_passwd)
|
||||||
{
|
{
|
||||||
QueryResult* result = LoginDatabase.PQuery("SELECT 1 FROM account WHERE id='%u'", accid);
|
QueryResult* result = LoginDatabase.PQuery("SELECT 1 FROM `account` WHERE `id`='%u'", accid);
|
||||||
if (!result)
|
if (!result)
|
||||||
{ return AOR_NAME_NOT_EXIST; } // account doesn't exist
|
{ return AOR_NAME_NOT_EXIST; } // account doesn't exist
|
||||||
delete result;
|
delete result;
|
||||||
|
|
@ -147,7 +147,7 @@ AccountOpResult AccountMgr::ChangeUsername(uint32 accid, std::string new_uname,
|
||||||
std::string safe_new_uname = new_uname;
|
std::string safe_new_uname = new_uname;
|
||||||
LoginDatabase.escape_string(safe_new_uname);
|
LoginDatabase.escape_string(safe_new_uname);
|
||||||
|
|
||||||
if (!LoginDatabase.PExecute("UPDATE account SET v='0',s='0',username='%s',sha_pass_hash='%s' WHERE id='%u'", safe_new_uname.c_str(),
|
if (!LoginDatabase.PExecute("UPDATE `account` SET `v`='0',`s`='0',`username`='%s',`sha_pass_hash`='%s' WHERE `id`='%u'", safe_new_uname.c_str(),
|
||||||
CalculateShaPassHash(new_uname, new_passwd).c_str(), accid))
|
CalculateShaPassHash(new_uname, new_passwd).c_str(), accid))
|
||||||
{ return AOR_DB_INTERNAL_ERROR; } // unexpected error
|
{ return AOR_DB_INTERNAL_ERROR; } // unexpected error
|
||||||
|
|
||||||
|
|
@ -169,7 +169,7 @@ AccountOpResult AccountMgr::ChangePassword(uint32 accid, std::string new_passwd)
|
||||||
normalizeString(new_passwd);
|
normalizeString(new_passwd);
|
||||||
|
|
||||||
// also reset s and v to force update at next realmd login
|
// also reset s and v to force update at next realmd login
|
||||||
if (!LoginDatabase.PExecute("UPDATE account SET v='0', s='0', sha_pass_hash='%s' WHERE id='%u'",
|
if (!LoginDatabase.PExecute("UPDATE `account` SET `v`='0', `s`='0', `sha_pass_hash`='%s' WHERE `id`='%u'",
|
||||||
CalculateShaPassHash(username, new_passwd).c_str(), accid))
|
CalculateShaPassHash(username, new_passwd).c_str(), accid))
|
||||||
{ return AOR_DB_INTERNAL_ERROR; } // unexpected error
|
{ return AOR_DB_INTERNAL_ERROR; } // unexpected error
|
||||||
|
|
||||||
|
|
@ -179,7 +179,7 @@ AccountOpResult AccountMgr::ChangePassword(uint32 accid, std::string new_passwd)
|
||||||
uint32 AccountMgr::GetId(std::string username)
|
uint32 AccountMgr::GetId(std::string username)
|
||||||
{
|
{
|
||||||
LoginDatabase.escape_string(username);
|
LoginDatabase.escape_string(username);
|
||||||
QueryResult* result = LoginDatabase.PQuery("SELECT id FROM account WHERE username = '%s'", username.c_str());
|
QueryResult* result = LoginDatabase.PQuery("SELECT `id` FROM `account` WHERE `username` = '%s'", username.c_str());
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -194,7 +194,7 @@ uint32 AccountMgr::GetId(std::string username)
|
||||||
|
|
||||||
AccountTypes AccountMgr::GetSecurity(uint32 acc_id)
|
AccountTypes AccountMgr::GetSecurity(uint32 acc_id)
|
||||||
{
|
{
|
||||||
QueryResult* result = LoginDatabase.PQuery("SELECT gmlevel FROM account WHERE id = '%u'", acc_id);
|
QueryResult* result = LoginDatabase.PQuery("SELECT `gmlevel` FROM `account` WHERE `id` = '%u'", acc_id);
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
AccountTypes sec = AccountTypes((*result)[0].GetInt32());
|
AccountTypes sec = AccountTypes((*result)[0].GetInt32());
|
||||||
|
|
@ -207,7 +207,7 @@ AccountTypes AccountMgr::GetSecurity(uint32 acc_id)
|
||||||
|
|
||||||
bool AccountMgr::GetName(uint32 acc_id, std::string& name)
|
bool AccountMgr::GetName(uint32 acc_id, std::string& name)
|
||||||
{
|
{
|
||||||
QueryResult* result = LoginDatabase.PQuery("SELECT username FROM account WHERE id = '%u'", acc_id);
|
QueryResult* result = LoginDatabase.PQuery("SELECT `username` FROM `account` WHERE `id` = '%u'", acc_id);
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
name = (*result)[0].GetCppString();
|
name = (*result)[0].GetCppString();
|
||||||
|
|
@ -221,7 +221,7 @@ bool AccountMgr::GetName(uint32 acc_id, std::string& name)
|
||||||
uint32 AccountMgr::GetCharactersCount(uint32 acc_id)
|
uint32 AccountMgr::GetCharactersCount(uint32 acc_id)
|
||||||
{
|
{
|
||||||
// check character count
|
// check character count
|
||||||
QueryResult* result = CharacterDatabase.PQuery("SELECT COUNT(guid) FROM characters WHERE account = '%u'", acc_id);
|
QueryResult* result = CharacterDatabase.PQuery("SELECT COUNT(`guid`) FROM `characters` WHERE `account` = '%u'", acc_id);
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
Field* fields = result->Fetch();
|
Field* fields = result->Fetch();
|
||||||
|
|
@ -246,7 +246,7 @@ bool AccountMgr::CheckPassword(uint32 accid, std::string passwd)
|
||||||
normalizeString(passwd);
|
normalizeString(passwd);
|
||||||
normalizeString(username);
|
normalizeString(username);
|
||||||
|
|
||||||
QueryResult* result = LoginDatabase.PQuery("SELECT 1 FROM account WHERE id='%u' AND sha_pass_hash='%s'", accid, CalculateShaPassHash(username, passwd).c_str());
|
QueryResult* result = LoginDatabase.PQuery("SELECT 1 FROM `account` WHERE `id`='%u' AND `sha_pass_hash`='%s'", accid, CalculateShaPassHash(username, passwd).c_str());
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
delete result;
|
delete result;
|
||||||
|
|
|
||||||
|
|
@ -76,45 +76,47 @@ bool LoginQueryHolder::Initialize()
|
||||||
|
|
||||||
// NOTE: all fields in `characters` must be read to prevent lost character data at next save in case wrong DB structure.
|
// NOTE: all fields in `characters` must be read to prevent lost character data at next save in case wrong DB structure.
|
||||||
// !!! NOTE: including unused `zone`,`online`
|
// !!! NOTE: including unused `zone`,`online`
|
||||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADFROM, "SELECT guid, account, name, race, class, gender, level, xp, money, playerBytes, playerBytes2, playerFlags,"
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADFROM, "SELECT `guid`, `account`, `name`, `race`, `class`, `gender`, `level`, `xp`, `money`, `playerBytes`, `playerBytes2`, `playerFlags`,"
|
||||||
"position_x, position_y, position_z, map, orientation, taximask, cinematic, totaltime, leveltime, rest_bonus, logout_time, is_logout_resting, resettalents_cost,"
|
"`position_x`, `position_y`, `position_z`, `map`, `orientation`, `taximask`, `cinematic`, `totaltime`, `leveltime`, `rest_bonus`, `logout_time`, `is_logout_resting`, `resettalents_cost`,"
|
||||||
"resettalents_time, primary_trees, trans_x, trans_y, trans_z, trans_o, transguid, extra_flags, stable_slots, at_login, zone, online, death_expire_time, taxi_path, dungeon_difficulty,"
|
"`resettalents_time`, `primary_trees`, `trans_x`, `trans_y`, `trans_z`, `trans_o`, `transguid`, `extra_flags`, `stable_slots`, `at_login`, `zone`, `online`, `death_expire_time`, `taxi_path`, `dungeon_difficulty`,"
|
||||||
"totalKills, todayKills, yesterdayKills, chosenTitle, watchedFaction, drunk,"
|
"`totalKills`, `todayKills`, `yesterdayKills`, `chosenTitle`, `watchedFaction`, `drunk`,"
|
||||||
"health, power1, power2, power3, power4, power5, specCount, activeSpec, exploredZones, equipmentCache, knownTitles, actionBars, slot FROM characters WHERE guid = '%u'", m_guid.GetCounter());
|
"`health`, `power1`, `power2`, `power3`, `power4`, `power5`, `specCount`, `activeSpec`, `exploredZones`, `equipmentCache`, `knownTitles`, `actionBars`, `slot` FROM `characters` WHERE `guid` = '%u'", m_guid.GetCounter());
|
||||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADGROUP, "SELECT groupId FROM group_member WHERE memberGuid ='%u'", m_guid.GetCounter());
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADGROUP, "SELECT `groupId` FROM group_member WHERE `memberGuid` ='%u'", m_guid.GetCounter());
|
||||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADBOUNDINSTANCES, "SELECT id, permanent, map, difficulty, resettime FROM character_instance LEFT JOIN instance ON instance = id WHERE guid = '%u'", m_guid.GetCounter());
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADBOUNDINSTANCES, "SELECT `id`, `permanent`, `map`, `difficulty`, `resettime` FROM `character_instance` LEFT JOIN `instance` ON `instance` = `id` WHERE `guid` = '%u'", m_guid.GetCounter());
|
||||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADAURAS, "SELECT caster_guid,item_guid,spell,stackcount,remaincharges,"
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADAURAS, "SELECT `caster_guid`,`item_guid`,`spell`,`stackcount`,`remaincharges`,"
|
||||||
"basepoints0,basepoints1,basepoints2,basepoints3,basepoints4,basepoints5,basepoints6,basepoints7,basepoints8,basepoints9,basepoints10,basepoints11,basepoints12,basepoints13,basepoints14,basepoints15,basepoints16,basepoints17,basepoints18,basepoints19,basepoints20,"
|
"`basepoints0`,`basepoints1`,`basepoints2`,`basepoints3`,`basepoints4`,`basepoints5`,`basepoints6`,`basepoints7`,`basepoints8`,`basepoints9`,`basepoints10`,`basepoints11`,`basepoints12`,`basepoints13`,`basepoints14`,`basepoints15`,`basepoints16`,`basepoints17`,`basepoints18`,`basepoints19`,`basepoints20`,"
|
||||||
"periodictime0,periodictime1,periodictime2,periodictime3,periodictime4,periodictime5,periodictime6,periodictime7,periodictime8,periodictime9,periodictime10,periodictime11,periodictime12,periodictime13,periodictime14,periodictime15,periodictime16,periodictime17,periodictime18,periodictime19,periodictime20,"
|
"`periodictime0`,`periodictime1`,`periodictime2`,`periodictime3`,`periodictime4`,`periodictime5`,`periodictime6`,`periodictime7`,`periodictime8`,`periodictime9`,`periodictime10`,`periodictime11`,`periodictime12`,`periodictime13`,`periodictime14`,`periodictime15`,`periodictime16`,`periodictime17`,`periodictime18`,`periodictime19`,`periodictime20`,"
|
||||||
"maxduration,remaintime,effIndexMask FROM character_aura WHERE guid = '%u'", m_guid.GetCounter());
|
"`maxduration`,`remaintime`,`effIndexMask` FROM `character_aura` WHERE `guid` = '%u'", m_guid.GetCounter());
|
||||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADSPELLS, "SELECT spell,active,disabled FROM character_spell WHERE guid = '%u'", m_guid.GetCounter());
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADSPELLS, "SELECT `spell`,`active`,`disabled` FROM `character_spell` WHERE `guid` = '%u'", m_guid.GetCounter());
|
||||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADQUESTSTATUS, "SELECT quest,status,rewarded,explored,timer,mobcount1,mobcount2,mobcount3,mobcount4,itemcount1,itemcount2,itemcount3,itemcount4,itemcount5,itemcount6 FROM character_queststatus WHERE guid = '%u'", m_guid.GetCounter());
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADQUESTSTATUS, "SELECT `quest`,`status`,`rewarded`,`explored`,`timer`,`mobcount1`,`mobcount2`,`mobcount3`,`mobcount4`,`itemcount1`,`itemcount2`,`itemcount3`,`itemcount4`,`itemcount5`,`itemcount6` FROM `character_queststatus` WHERE `guid` = '%u'", m_guid.GetCounter());
|
||||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADDAILYQUESTSTATUS, "SELECT quest FROM character_queststatus_daily WHERE guid = '%u'", m_guid.GetCounter());
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADDAILYQUESTSTATUS, "SELECT `quest` FROM `character_queststatus_daily` WHERE `guid` = '%u'", m_guid.GetCounter());
|
||||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADWEEKLYQUESTSTATUS, "SELECT quest FROM character_queststatus_weekly WHERE guid = '%u'", m_guid.GetCounter());
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADWEEKLYQUESTSTATUS, "SELECT `quest` FROM `character_queststatus_weekly` WHERE `guid` = '%u'", m_guid.GetCounter());
|
||||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADMONTHLYQUESTSTATUS, "SELECT quest FROM character_queststatus_monthly WHERE guid = '%u'", m_guid.GetCounter());
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADMONTHLYQUESTSTATUS, "SELECT `quest` FROM `character_queststatus_monthly` WHERE `guid` = '%u'", m_guid.GetCounter());
|
||||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADREPUTATION, "SELECT faction,standing,flags FROM character_reputation WHERE guid = '%u'", m_guid.GetCounter());
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADREPUTATION, "SELECT `faction`,`standing`,`flags` FROM `character_reputation` WHERE `guid` = '%u'", m_guid.GetCounter());
|
||||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADINVENTORY, "SELECT data,text,bag,slot,item,item_template FROM character_inventory JOIN item_instance ON character_inventory.item = item_instance.guid WHERE character_inventory.guid = '%u' ORDER BY bag,slot", m_guid.GetCounter());
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADINVENTORY, "SELECT data,text,bag,slot,item,item_template FROM character_inventory JOIN item_instance ON character_inventory.item = item_instance.guid WHERE character_inventory.guid = '%u' ORDER BY bag,slot", m_guid.GetCounter());
|
||||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADITEMLOOT, "SELECT guid,itemid,amount,suffix,property FROM item_loot WHERE owner_guid = '%u'", m_guid.GetCounter());
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADITEMLOOT, "SELECT `guid`,`itemid`,`amount`,`suffix`,`property` FROM `item_loot` WHERE `owner_guid` = '%u'", m_guid.GetCounter());
|
||||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADACTIONS, "SELECT spec,button,action,type FROM character_action WHERE guid = '%u' ORDER BY button", m_guid.GetCounter());
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADACTIONS, "SELECT `spec`,`button`,`action`,`type` FROM `character_action` WHERE `guid` = '%u' ORDER BY `button`", m_guid.GetCounter());
|
||||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADSOCIALLIST, "SELECT friend,flags,note FROM character_social WHERE guid = '%u' LIMIT 255", m_guid.GetCounter());
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADSOCIALLIST, "SELECT `friend`,`flags`,`note` FROM `character_social` WHERE `guid` = '%u' LIMIT 255", m_guid.GetCounter());
|
||||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADHOMEBIND, "SELECT map,zone,position_x,position_y,position_z FROM character_homebind WHERE guid = '%u'", m_guid.GetCounter());
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADHOMEBIND, "SELECT `map`,`zone`,`position_x`,`position_y`,`position_z` FROM `character_homebind` WHERE `guid` = '%u'", m_guid.GetCounter());
|
||||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADSPELLCOOLDOWNS, "SELECT spell,item,time FROM character_spell_cooldown WHERE guid = '%u'", m_guid.GetCounter());
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADSPELLCOOLDOWNS, "SELECT `spell`,`item`,`time` FROM `character_spell_cooldown` WHERE `guid` = '%u'", m_guid.GetCounter());
|
||||||
if (sWorld.getConfig(CONFIG_BOOL_DECLINED_NAMES_USED))
|
if (sWorld.getConfig(CONFIG_BOOL_DECLINED_NAMES_USED))
|
||||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADDECLINEDNAMES, "SELECT genitive, dative, accusative, instrumental, prepositional FROM character_declinedname WHERE guid = '%u'", m_guid.GetCounter());
|
{
|
||||||
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADDECLINEDNAMES, "SELECT `genitive`, `dative`, `accusative`, `instrumental`, `prepositional` FROM `character_declinedname` WHERE `guid` = '%u'", m_guid.GetCounter());
|
||||||
|
}
|
||||||
// in other case still be dummy query
|
// in other case still be dummy query
|
||||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADGUILD, "SELECT guildid,rank FROM guild_member WHERE guid = '%u'", m_guid.GetCounter());
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADGUILD, "SELECT `guildid`,`rank` FROM `guild_member` WHERE `guid` = '%u'", m_guid.GetCounter());
|
||||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADARENAINFO, "SELECT arenateamid, played_week, played_season, wons_season, personal_rating FROM arena_team_member WHERE guid='%u'", m_guid.GetCounter());
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADARENAINFO, "SELECT `arenateamid`, `played_week`, `played_season`, `wons_season`, `personal_rating` FROM `arena_team_member` WHERE `guid`='%u'", m_guid.GetCounter());
|
||||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADACHIEVEMENTS, "SELECT achievement, date FROM character_achievement WHERE guid = '%u'", m_guid.GetCounter());
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADACHIEVEMENTS, "SELECT `achievement`, `date` FROM `character_achievement` WHERE `guid` = '%u'", m_guid.GetCounter());
|
||||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADCRITERIAPROGRESS, "SELECT criteria, counter, date FROM character_achievement_progress WHERE guid = '%u'", m_guid.GetCounter());
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADCRITERIAPROGRESS, "SELECT `criteria`, `counter`, `date` FROM `character_achievement_progress` WHERE `guid` = '%u'", m_guid.GetCounter());
|
||||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADEQUIPMENTSETS, "SELECT setguid, setindex, name, iconname, ignore_mask, item0, item1, item2, item3, item4, item5, item6, item7, item8, item9, item10, item11, item12, item13, item14, item15, item16, item17, item18 FROM character_equipmentsets WHERE guid = '%u' ORDER BY setindex", m_guid.GetCounter());
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADEQUIPMENTSETS, "SELECT `setguid`, `setindex`, `name`, `iconname`, `ignore_mask`, `item0`, `item1`, `item2`, `item3`, `item4`, `item5`, `item6`, `item7`, `item8`, `item9`, `item10`, `item11`, `item12`, `item13`, `item14`, `item15`, `item16`, `item17`, `item18` FROM `character_equipmentsets` WHERE `guid` = '%u' ORDER BY setindex", m_guid.GetCounter());
|
||||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADBGDATA, "SELECT instance_id, team, join_x, join_y, join_z, join_o, join_map, taxi_start, taxi_end, mount_spell FROM character_battleground_data WHERE guid = '%u'", m_guid.GetCounter());
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADBGDATA, "SELECT `instance_id`, `team`, `join_x`, `join_y`, `join_z`, `join_o`, `join_map`, `taxi_start`, `taxi_end`, `mount_spell` FROM `character_battleground_data` WHERE `guid` = '%u'", m_guid.GetCounter());
|
||||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADACCOUNTDATA, "SELECT type, time, data FROM character_account_data WHERE guid='%u'", m_guid.GetCounter());
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADACCOUNTDATA, "SELECT `type`, `time`, `data` FROM `character_account_data` WHERE `guid`='%u'", m_guid.GetCounter());
|
||||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADTALENTS, "SELECT talent_id, current_rank, spec FROM character_talent WHERE guid = '%u'", m_guid.GetCounter());
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADTALENTS, "SELECT `talent_id`, `current_rank`, `spec` FROM `character_talent` WHERE `guid` = '%u'", m_guid.GetCounter());
|
||||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADSKILLS, "SELECT skill, value, max FROM character_skills WHERE guid = '%u'", m_guid.GetCounter());
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADSKILLS, "SELECT `skill`, `value`, `max` FROM `character_skills` WHERE `guid` = '%u'", m_guid.GetCounter());
|
||||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADGLYPHS, "SELECT spec, slot, glyph FROM character_glyphs WHERE guid='%u'", m_guid.GetCounter());
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADGLYPHS, "SELECT `spec`, `slot`, `glyph` FROM `character_glyphs` WHERE `guid`='%u'", m_guid.GetCounter());
|
||||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADMAILS, "SELECT id,messageType,sender,receiver,subject,body,expire_time,deliver_time,money,cod,checked,stationery,mailTemplateId,has_items FROM mail WHERE receiver = '%u' ORDER BY id DESC", m_guid.GetCounter());
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADMAILS, "SELECT `id`,`messageType`,`sender`,`receiver`,`subject`,`body`,`expire_time`,`deliver_time`,`money`,`cod`,`checked`,`stationery`,`mailTemplateId`,`has_items` FROM `mail` WHERE `receiver` = '%u' ORDER BY `id` DESC", m_guid.GetCounter());
|
||||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADMAILEDITEMS, "SELECT data, text, mail_id, item_guid, item_template FROM mail_items JOIN item_instance ON item_guid = guid WHERE receiver = '%u'", m_guid.GetCounter());
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADMAILEDITEMS, "SELECT `data`, `text`, `mail_id`, `item_guid`, `item_template` FROM `mail_items` JOIN `item_instance` ON `item_guid` = `guid` WHERE `receiver` = '%u'", m_guid.GetCounter());
|
||||||
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADCURRENCIES, "SELECT id, totalCount, weekCount, seasonCount, flags FROM character_currencies WHERE guid = '%u'", m_guid.GetCounter());
|
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADCURRENCIES, "SELECT `id`, `totalCount`, `weekCount`, `seasonCount`, `flags` FROM `character_currencies` WHERE `guid` = '%u'", m_guid.GetCounter());
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
@ -190,26 +192,26 @@ void WorldSession::HandleCharEnumOpcode(WorldPacket & /*recv_data*/)
|
||||||
!sWorld.getConfig(CONFIG_BOOL_DECLINED_NAMES_USED) ?
|
!sWorld.getConfig(CONFIG_BOOL_DECLINED_NAMES_USED) ?
|
||||||
// ------- Query Without Declined Names --------
|
// ------- Query Without Declined Names --------
|
||||||
// 0 1 2 3 4 5 6 7
|
// 0 1 2 3 4 5 6 7
|
||||||
"SELECT characters.guid, characters.name, characters.race, characters.class, characters.gender, characters.playerBytes, characters.playerBytes2, characters.level, "
|
"SELECT `characters`.`guid`, `characters`.`name`, `characters`.`race`, `characters`.`class`, `characters`.`gender`, `characters`.`playerBytes`, `characters`.`playerBytes2`, `characters`.`level`, "
|
||||||
// 8 9 10 11 12 13 14
|
// 8 9 10 11 12 13 14
|
||||||
"characters.zone, characters.map, characters.position_x, characters.position_y, characters.position_z, guild_member.guildid, characters.playerFlags, "
|
"`characters`.`zone`, `characters`.`map`, `characters`.`position_x`, `characters`.`position_y`, `characters`.`position_z`, `guild_member`.`guildid`, `characters`.`playerFlags`, "
|
||||||
// 15 16 17 18 19 20
|
// 15 16 17 18 19 20
|
||||||
"characters.at_login, character_pet.entry, character_pet.modelid, character_pet.level, characters.equipmentCache, characters.slot "
|
"`characters`.`at_login`, `character_pet`.`entry`, `character_pet`.`modelid`, `character_pet`.`level`, `characters`.`equipmentCache`, `characters`.`slot` "
|
||||||
"FROM characters LEFT JOIN character_pet ON characters.guid=character_pet.owner AND character_pet.slot='%u' "
|
"FROM `characters` LEFT JOIN `character_pet` ON `characters`.`guid`=`character_pet`.`owner` AND `character_pet`.`slot`='%u' "
|
||||||
"LEFT JOIN guild_member ON characters.guid = guild_member.guid "
|
"LEFT JOIN `guild_member` ON `characters`.`guid` = `guild_member`.`guid` "
|
||||||
"WHERE characters.account = '%u' ORDER BY characters.guid"
|
"WHERE `characters`.`account` = '%u' ORDER BY `characters`.`guid`"
|
||||||
:
|
:
|
||||||
// --------- Query With Declined Names ---------
|
// --------- Query With Declined Names ---------
|
||||||
// 0 1 2 3 4 5 6 7
|
// 0 1 2 3 4 5 6 7
|
||||||
"SELECT characters.guid, characters.name, characters.race, characters.class, characters.gender, characters.playerBytes, characters.playerBytes2, characters.level, "
|
"SELECT `characters`.`guid`, `characters`.`name`, `characters`.`race`, `characters`.`class`, `characters`.`gender`, `characters`.`playerBytes`, `characters`.`playerBytes2`, `characters`.`level`, "
|
||||||
// 8 9 10 11 12 13 14
|
// 8 9 10 11 12 13 14
|
||||||
"characters.zone, characters.map, characters.position_x, characters.position_y, characters.position_z, guild_member.guildid, characters.playerFlags, "
|
"`characters`.`zone`, `characters`.`map`, `characters`.`position_x`, `characters`.`position_y`, `characters`.`position_z`, `guild_member`.`guildid`, `characters`.`playerFlags`, "
|
||||||
// 15 16 17 18 19 20 21
|
// 15 16 17 18 19 20 21
|
||||||
"characters.at_login, character_pet.entry, character_pet.modelid, character_pet.level, characters.equipmentCache, characters.slot, character_declinedname.genitive "
|
"`characters`.`at_login`, `character_pet`.`entry`, `character_pet`.`modelid`, `character_pet`.`level`, `characters`.`equipmentCache`, `characters`.`slot`, `character_declinedname`.`genitive` "
|
||||||
"FROM characters LEFT JOIN character_pet ON characters.guid = character_pet.owner AND character_pet.slot='%u' "
|
"FROM `characters` LEFT JOIN `character_pet` ON `characters`.`guid` = `character_pet`.`owner` AND `character_pet`.`slot`='%u' "
|
||||||
"LEFT JOIN character_declinedname ON characters.guid = character_declinedname.guid "
|
"LEFT JOIN `character_declinedname` ON `characters`.`guid` = `character_declinedname`.`guid` "
|
||||||
"LEFT JOIN guild_member ON characters.guid = guild_member.guid "
|
"LEFT JOIN `guild_member` ON `characters`.`guid` = `guild_member`.`guid` "
|
||||||
"WHERE characters.account = '%u' ORDER BY characters.guid",
|
"WHERE `characters`.`account` = '%u' ORDER BY `characters`.`guid`",
|
||||||
PET_SAVE_AS_CURRENT, GetAccountId());
|
PET_SAVE_AS_CURRENT, GetAccountId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -316,7 +318,7 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket& recvData)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QueryResult* resultacct = LoginDatabase.PQuery("SELECT SUM(numchars) FROM realmcharacters WHERE acctid = '%u'", GetAccountId());
|
QueryResult* resultacct = LoginDatabase.PQuery("SELECT SUM(`numchars`) FROM `realmcharacters` WHERE `acctid` = '%u'", GetAccountId());
|
||||||
if (resultacct)
|
if (resultacct)
|
||||||
{
|
{
|
||||||
Field* fields = resultacct->Fetch();
|
Field* fields = resultacct->Fetch();
|
||||||
|
|
@ -331,7 +333,7 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket& recvData)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QueryResult* result = CharacterDatabase.PQuery("SELECT COUNT(guid) FROM characters WHERE account = '%u'", GetAccountId());
|
QueryResult* result = CharacterDatabase.PQuery("SELECT COUNT(`guid`) FROM `characters` WHERE `account` = '%u'", GetAccountId());
|
||||||
uint8 charcount = 0;
|
uint8 charcount = 0;
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
|
|
@ -375,7 +377,7 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket& recvData)
|
||||||
|
|
||||||
if (!AllowTwoSideAccounts || skipCinematics == CINEMATICS_SKIP_SAME_RACE || class_ == CLASS_DEATH_KNIGHT)
|
if (!AllowTwoSideAccounts || skipCinematics == CINEMATICS_SKIP_SAME_RACE || class_ == CLASS_DEATH_KNIGHT)
|
||||||
{
|
{
|
||||||
QueryResult* result2 = CharacterDatabase.PQuery("SELECT level,race,class FROM characters WHERE account = '%u' %s",
|
QueryResult* result2 = CharacterDatabase.PQuery("SELECT `level`,`race`,`class` FROM `characters` WHERE `account` = '%u' %s",
|
||||||
GetAccountId(), (skipCinematics == CINEMATICS_SKIP_SAME_RACE || class_ == CLASS_DEATH_KNIGHT) ? "" : "LIMIT 1");
|
GetAccountId(), (skipCinematics == CINEMATICS_SKIP_SAME_RACE || class_ == CLASS_DEATH_KNIGHT) ? "" : "LIMIT 1");
|
||||||
if (result2)
|
if (result2)
|
||||||
{
|
{
|
||||||
|
|
@ -492,8 +494,8 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket& recvData)
|
||||||
pNewChar->SaveToDB();
|
pNewChar->SaveToDB();
|
||||||
charcount += 1;
|
charcount += 1;
|
||||||
|
|
||||||
LoginDatabase.PExecute("DELETE FROM realmcharacters WHERE acctid= '%u' AND realmid = '%u'", GetAccountId(), realmID);
|
LoginDatabase.PExecute("DELETE FROM `realmcharacters` WHERE `acctid`= '%u' AND `realmid`= '%u'", GetAccountId(), realmID);
|
||||||
LoginDatabase.PExecute("INSERT INTO realmcharacters (numchars, acctid, realmid) VALUES (%u, %u, %u)", charcount, GetAccountId(), realmID);
|
LoginDatabase.PExecute("INSERT INTO `realmcharacters` (`numchars`, `acctid`, `realmid`) VALUES (%u, %u, %u)", charcount, GetAccountId(), realmID);
|
||||||
uint32 pet_id = 1;
|
uint32 pet_id = 1;
|
||||||
if (CharacterDatabase.PQuery("SELECT id FROM character_pet ORDER BY id DESC LIMIT 1"))
|
if (CharacterDatabase.PQuery("SELECT id FROM character_pet ORDER BY id DESC LIMIT 1"))
|
||||||
{
|
{
|
||||||
|
|
@ -620,7 +622,7 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket& recvData)
|
||||||
|
|
||||||
uint32 lowguid = guid.GetCounter();
|
uint32 lowguid = guid.GetCounter();
|
||||||
|
|
||||||
QueryResult* result = CharacterDatabase.PQuery("SELECT account,name FROM characters WHERE guid='%u'", lowguid);
|
QueryResult* result = CharacterDatabase.PQuery("SELECT `account`,`name` FROM `characters` WHERE `guid`='%u'", lowguid);
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
Field* fields = result->Fetch();
|
Field* fields = result->Fetch();
|
||||||
|
|
@ -881,7 +883,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
|
||||||
static SqlStatementID updChars;
|
static SqlStatementID updChars;
|
||||||
static SqlStatementID updAccount;
|
static SqlStatementID updAccount;
|
||||||
|
|
||||||
SqlStatement stmt = CharacterDatabase.CreateStatement(updChars, "UPDATE characters SET online = 1 WHERE guid = ?");
|
SqlStatement stmt = CharacterDatabase.CreateStatement(updChars, "UPDATE `characters` SET `online` = 1 WHERE `guid` = ?");
|
||||||
stmt.PExecute(pCurrChar->GetGUIDLow());
|
stmt.PExecute(pCurrChar->GetGUIDLow());
|
||||||
|
|
||||||
stmt = LoginDatabase.CreateStatement(updAccount, "UPDATE account SET active_realm_id = ? WHERE id = ?");
|
stmt = LoginDatabase.CreateStatement(updAccount, "UPDATE account SET active_realm_id = ? WHERE id = ?");
|
||||||
|
|
@ -1130,7 +1132,7 @@ void WorldSession::HandleCharRenameOpcode(WorldPacket& recv_data)
|
||||||
// and that there is no character with the desired new name
|
// and that there is no character with the desired new name
|
||||||
CharacterDatabase.AsyncPQuery(&WorldSession::HandleChangePlayerNameOpcodeCallBack,
|
CharacterDatabase.AsyncPQuery(&WorldSession::HandleChangePlayerNameOpcodeCallBack,
|
||||||
GetAccountId(), newname,
|
GetAccountId(), newname,
|
||||||
"SELECT guid, name FROM characters WHERE guid = %u AND account = %u AND (at_login & %u) = %u AND NOT EXISTS (SELECT NULL FROM characters WHERE name = '%s')",
|
"SELECT `guid`, `name` FROM `characters` WHERE `guid` = %u AND `account` = %u AND (`at_login` & %u) = %u AND NOT EXISTS (SELECT NULL FROM `characters` WHERE `name` = '%s')",
|
||||||
guid.GetCounter(), GetAccountId(), AT_LOGIN_RENAME, AT_LOGIN_RENAME, escaped_newname.c_str()
|
guid.GetCounter(), GetAccountId(), AT_LOGIN_RENAME, AT_LOGIN_RENAME, escaped_newname.c_str()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -1159,8 +1161,8 @@ void WorldSession::HandleChangePlayerNameOpcodeCallBack(QueryResult* result, uin
|
||||||
delete result;
|
delete result;
|
||||||
|
|
||||||
CharacterDatabase.BeginTransaction();
|
CharacterDatabase.BeginTransaction();
|
||||||
CharacterDatabase.PExecute("UPDATE characters set name = '%s', at_login = at_login & ~ %u WHERE guid ='%u'", newname.c_str(), uint32(AT_LOGIN_RENAME), guidLow);
|
CharacterDatabase.PExecute("UPDATE `characters` SET `name` = '%s', `at_login` = `at_login` & ~ %u WHERE `guid` ='%u'", newname.c_str(), uint32(AT_LOGIN_RENAME), guidLow);
|
||||||
CharacterDatabase.PExecute("DELETE FROM character_declinedname WHERE guid ='%u'", guidLow);
|
CharacterDatabase.PExecute("DELETE FROM `character_declinedname` WHERE `guid` ='%u'", guidLow);
|
||||||
CharacterDatabase.CommitTransaction();
|
CharacterDatabase.CommitTransaction();
|
||||||
|
|
||||||
sLog.outChar("Account: %d (IP: %s) Character:[%s] (guid:%u) Changed name to: %s", session->GetAccountId(), session->GetRemoteAddress().c_str(), oldname.c_str(), guidLow, newname.c_str());
|
sLog.outChar("Account: %d (IP: %s) Character:[%s] (guid:%u) Changed name to: %s", session->GetAccountId(), session->GetRemoteAddress().c_str(), oldname.c_str(), guidLow, newname.c_str());
|
||||||
|
|
|
||||||
|
|
@ -852,7 +852,7 @@ ChatCommand* ChatHandler::getCommandTable()
|
||||||
// check hardcoded part integrity
|
// check hardcoded part integrity
|
||||||
CheckIntegrity(commandTable, NULL);
|
CheckIntegrity(commandTable, NULL);
|
||||||
|
|
||||||
QueryResult* result = WorldDatabase.Query("SELECT name,security,help FROM command");
|
QueryResult* result = WorldDatabase.Query("SELECT `name`,`security`,`help` FROM `command`");
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ void CreatureLinkingMgr::LoadFromDB()
|
||||||
// Load `creature_linking_template`
|
// Load `creature_linking_template`
|
||||||
sLog.outString("> Loading table `creature_linking_template`");
|
sLog.outString("> Loading table `creature_linking_template`");
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
QueryResult* result = WorldDatabase.Query("SELECT entry, map, master_entry, flag, search_range FROM creature_linking_template");
|
QueryResult* result = WorldDatabase.Query("SELECT `entry`, `map`, `master_entry`, `flag`, `search_range` FROM `creature_linking_template`");
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
BarGoLink bar(1);
|
BarGoLink bar(1);
|
||||||
|
|
@ -127,7 +127,7 @@ void CreatureLinkingMgr::LoadFromDB()
|
||||||
// Load `creature_linking`
|
// Load `creature_linking`
|
||||||
sLog.outString("> Loading table `creature_linking`");
|
sLog.outString("> Loading table `creature_linking`");
|
||||||
count = 0;
|
count = 0;
|
||||||
result = WorldDatabase.Query("SELECT guid, master_guid, flag FROM creature_linking");
|
result = WorldDatabase.Query("SELECT `guid`, `master_guid`, `flag` FROM `creature_linking`");
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
BarGoLink bar(1);
|
BarGoLink bar(1);
|
||||||
|
|
@ -245,7 +245,7 @@ bool CreatureLinkingMgr::IsLinkingEntryValid(uint32 slaveEntry, CreatureLinkingI
|
||||||
// Check for uniqueness of mob whom is followed, on whom spawning is dependend
|
// Check for uniqueness of mob whom is followed, on whom spawning is dependend
|
||||||
if (pTmp->searchRange == 0 && pTmp->linkingFlag & (FLAG_FOLLOW | FLAG_CANT_SPAWN_IF_BOSS_DEAD | FLAG_CANT_SPAWN_IF_BOSS_ALIVE))
|
if (pTmp->searchRange == 0 && pTmp->linkingFlag & (FLAG_FOLLOW | FLAG_CANT_SPAWN_IF_BOSS_DEAD | FLAG_CANT_SPAWN_IF_BOSS_ALIVE))
|
||||||
{
|
{
|
||||||
QueryResult* result = WorldDatabase.PQuery("SELECT guid FROM creature WHERE id=%u AND map=%u LIMIT 2", pTmp->masterId, pTmp->mapId);
|
QueryResult* result = WorldDatabase.PQuery("SELECT `guid` FROM `creature` WHERE `id`=%u AND `map`=%u LIMIT 2", pTmp->masterId, pTmp->mapId);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("`creature_linking_template` has FLAG_FOLLOW, but no master, (entry: %u, map: %u, master: %u)", slaveEntry, pTmp->mapId, pTmp->masterId);
|
sLog.outErrorDb("`creature_linking_template` has FLAG_FOLLOW, but no master, (entry: %u, map: %u, master: %u)", slaveEntry, pTmp->mapId, pTmp->masterId);
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ void LoadDisables()
|
||||||
|
|
||||||
m_DisableMap.clear();
|
m_DisableMap.clear();
|
||||||
|
|
||||||
QueryResult* result = WorldDatabase.Query("SELECT sourceType, entry, flags, data FROM disables");
|
QueryResult* result = WorldDatabase.Query("SELECT `sourceType`, `entry`, `flags`, `data` FROM `disables`");
|
||||||
|
|
||||||
uint32 total_count = 0;
|
uint32 total_count = 0;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -121,7 +121,7 @@ void GameEventMgr::StopEvent(uint16 event_id, bool overwrite)
|
||||||
void GameEventMgr::LoadFromDB()
|
void GameEventMgr::LoadFromDB()
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
QueryResult* result = WorldDatabase.Query("SELECT MAX(entry) FROM game_event");
|
QueryResult* result = WorldDatabase.Query("SELECT MAX(`entry`) FROM `game_event`");
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
sLog.outString(">> Table game_event is empty.");
|
sLog.outString(">> Table game_event is empty.");
|
||||||
|
|
@ -137,7 +137,7 @@ void GameEventMgr::LoadFromDB()
|
||||||
mGameEvent.resize(max_event_id + 1);
|
mGameEvent.resize(max_event_id + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
QueryResult* result = WorldDatabase.Query("SELECT entry,UNIX_TIMESTAMP(start_time),UNIX_TIMESTAMP(end_time),occurence,length,holiday,description FROM game_event");
|
QueryResult* result = WorldDatabase.Query("SELECT `entry`,UNIX_TIMESTAMP(`start_time`),UNIX_TIMESTAMP(`end_time`),`occurence`,`length`,`holiday`,`description` FROM `game_event`");
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
mGameEvent.clear();
|
mGameEvent.clear();
|
||||||
|
|
@ -213,8 +213,8 @@ void GameEventMgr::LoadFromDB()
|
||||||
|
|
||||||
mGameEventCreatureGuids.resize(mGameEvent.size() * 2 - 1);
|
mGameEventCreatureGuids.resize(mGameEvent.size() * 2 - 1);
|
||||||
// 1 2
|
// 1 2
|
||||||
result = WorldDatabase.Query("SELECT creature.guid, game_event_creature.event "
|
result = WorldDatabase.Query("SELECT `creature`.`guid`, `game_event_creature`.`event` "
|
||||||
"FROM creature JOIN game_event_creature ON creature.guid = game_event_creature.guid");
|
"FROM `creature` JOIN `game_event_creature` ON `creature`.`guid` = `game_event_creature`.`guid`");
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
if (!result)
|
if (!result)
|
||||||
|
|
@ -291,8 +291,8 @@ void GameEventMgr::LoadFromDB()
|
||||||
|
|
||||||
mGameEventGameobjectGuids.resize(mGameEvent.size() * 2 - 1);
|
mGameEventGameobjectGuids.resize(mGameEvent.size() * 2 - 1);
|
||||||
// 1 2
|
// 1 2
|
||||||
result = WorldDatabase.Query("SELECT gameobject.guid, game_event_gameobject.event "
|
result = WorldDatabase.Query("SELECT `gameobject`.`guid`, `game_event_gameobject`.`event` "
|
||||||
"FROM gameobject JOIN game_event_gameobject ON gameobject.guid=game_event_gameobject.guid");
|
"FROM `gameobject` JOIN `game_event_gameobject` ON `gameobject`.`guid`=`game_event_gameobject`.`guid`");
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
if (!result)
|
if (!result)
|
||||||
|
|
@ -377,12 +377,12 @@ void GameEventMgr::LoadFromDB()
|
||||||
|
|
||||||
mGameEventCreatureData.resize(mGameEvent.size());
|
mGameEventCreatureData.resize(mGameEvent.size());
|
||||||
// 0 1 2
|
// 0 1 2
|
||||||
result = WorldDatabase.Query("SELECT creature.guid, game_event_creature_data.event, game_event_creature_data.modelid,"
|
result = WorldDatabase.Query("SELECT `creature`.`guid`, `game_event_creature_data`.`event`, `game_event_creature_data`.`modelid`,"
|
||||||
// 3 4
|
// 3 4
|
||||||
"game_event_creature_data.equipment_id, game_event_creature_data.entry_id, "
|
"`game_event_creature_data`.`equipment_id`, `game_event_creature_data`.`entry_id`, "
|
||||||
// 5 6
|
// 5 6
|
||||||
"game_event_creature_data.spell_start, game_event_creature_data.spell_end "
|
"`game_event_creature_data`.`spell_start`, `game_event_creature_data`.`spell_end` "
|
||||||
"FROM creature JOIN game_event_creature_data ON creature.guid=game_event_creature_data.guid");
|
"FROM `creature` JOIN `game_event_creature_data` ON `creature`.`guid`=`game_event_creature_data`.`guid`");
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
if (!result)
|
if (!result)
|
||||||
|
|
@ -461,7 +461,7 @@ void GameEventMgr::LoadFromDB()
|
||||||
|
|
||||||
mGameEventQuests.resize(mGameEvent.size());
|
mGameEventQuests.resize(mGameEvent.size());
|
||||||
|
|
||||||
result = WorldDatabase.Query("SELECT quest, event FROM game_event_quest");
|
result = WorldDatabase.Query("SELECT `quest`, `event` FROM `game_event_quest`");
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
if (!result)
|
if (!result)
|
||||||
|
|
@ -520,7 +520,7 @@ void GameEventMgr::LoadFromDB()
|
||||||
|
|
||||||
mGameEventMails.resize(mGameEvent.size() * 2 - 1);
|
mGameEventMails.resize(mGameEvent.size() * 2 - 1);
|
||||||
|
|
||||||
result = WorldDatabase.Query("SELECT event, raceMask, quest, mailTemplateId, senderEntry FROM game_event_mail");
|
result = WorldDatabase.Query("SELECT `event`, `raceMask`, `quest`, `mailTemplateId`, `senderEntry` FROM `game_event_mail`");
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
if (!result)
|
if (!result)
|
||||||
|
|
@ -604,7 +604,7 @@ uint32 GameEventMgr::Initialize() // return the next e
|
||||||
|
|
||||||
ActiveEvents activeAtShutdown;
|
ActiveEvents activeAtShutdown;
|
||||||
|
|
||||||
if (QueryResult* result = CharacterDatabase.Query("SELECT event FROM game_event_status"))
|
if (QueryResult* result = CharacterDatabase.Query("SELECT `event` FROM `game_event_status`"))
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
|
@ -684,7 +684,7 @@ uint32 GameEventMgr::Update(ActiveEvents const* activeAtShutdown /*= NULL*/)
|
||||||
void GameEventMgr::UnApplyEvent(uint16 event_id)
|
void GameEventMgr::UnApplyEvent(uint16 event_id)
|
||||||
{
|
{
|
||||||
m_ActiveEvents.erase(event_id);
|
m_ActiveEvents.erase(event_id);
|
||||||
CharacterDatabase.PExecute("DELETE FROM game_event_status WHERE event = %u", event_id);
|
CharacterDatabase.PExecute("DELETE FROM `game_event_status` WHERE `event` = %u", event_id);
|
||||||
|
|
||||||
sLog.outString("GameEvent %u \"%s\" removed.", event_id, mGameEvent[event_id].description.c_str());
|
sLog.outString("GameEvent %u \"%s\" removed.", event_id, mGameEvent[event_id].description.c_str());
|
||||||
// un-spawn positive event tagged objects
|
// un-spawn positive event tagged objects
|
||||||
|
|
@ -703,7 +703,7 @@ void GameEventMgr::UnApplyEvent(uint16 event_id)
|
||||||
void GameEventMgr::ApplyNewEvent(uint16 event_id, bool resume)
|
void GameEventMgr::ApplyNewEvent(uint16 event_id, bool resume)
|
||||||
{
|
{
|
||||||
m_ActiveEvents.insert(event_id);
|
m_ActiveEvents.insert(event_id);
|
||||||
CharacterDatabase.PExecute("INSERT INTO game_event_status (event) VALUES (%u)", event_id);
|
CharacterDatabase.PExecute("INSERT INTO `game_event_status` (`event`) VALUES (%u)", event_id);
|
||||||
|
|
||||||
if (sWorld.getConfig(CONFIG_BOOL_EVENT_ANNOUNCE))
|
if (sWorld.getConfig(CONFIG_BOOL_EVENT_ANNOUNCE))
|
||||||
sWorld.SendWorldText(LANG_EVENTMESSAGE, mGameEvent[event_id].description.c_str());
|
sWorld.SendWorldText(LANG_EVENTMESSAGE, mGameEvent[event_id].description.c_str());
|
||||||
|
|
@ -996,12 +996,12 @@ void GameEventMgr::SendEventMails(int16 event_id)
|
||||||
{
|
{
|
||||||
// need special query
|
// need special query
|
||||||
std::ostringstream ss;
|
std::ostringstream ss;
|
||||||
ss << "SELECT characters.guid FROM characters, character_queststatus "
|
ss << "SELECT `characters`.`guid` FROM `characters`, `character_queststatus` "
|
||||||
"WHERE (1 << (characters.race - 1)) & "
|
"WHERE (1 << (`characters`.`race` - 1)) & "
|
||||||
<< itr->raceMask
|
<< itr->raceMask
|
||||||
<< " AND characters.deleteDate IS NULL AND character_queststatus.guid = characters.guid AND character_queststatus.quest = "
|
<< " AND `characters`.`deleteDate` IS NULL AND `character_queststatus`.`guid` = `characters`.`guid` AND `character_queststatus`.`quest` = "
|
||||||
<< itr->questId
|
<< itr->questId
|
||||||
<< " AND character_queststatus.rewarded <> 0";
|
<< " AND `character_queststatus`.`rewarded` <> 0";
|
||||||
sMassMailMgr.AddMassMailTask(new MailDraft(itr->mailTemplateId), MailSender(MAIL_CREATURE, itr->senderEntry), ss.str().c_str());
|
sMassMailMgr.AddMassMailTask(new MailDraft(itr->mailTemplateId), MailSender(MAIL_CREATURE, itr->senderEntry), ss.str().c_str());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -160,10 +160,10 @@ bool Group::Create(ObjectGuid guid, const char* name)
|
||||||
|
|
||||||
// store group in database
|
// store group in database
|
||||||
CharacterDatabase.BeginTransaction();
|
CharacterDatabase.BeginTransaction();
|
||||||
CharacterDatabase.PExecute("DELETE FROM groups WHERE groupId ='%u'", m_Id);
|
CharacterDatabase.PExecute("DELETE FROM `groups` WHERE `groupId` ='%u'", m_Id);
|
||||||
CharacterDatabase.PExecute("DELETE FROM group_member WHERE groupId ='%u'", m_Id);
|
CharacterDatabase.PExecute("DELETE FROM `group_member` WHERE `groupId` ='%u'", m_Id);
|
||||||
|
|
||||||
CharacterDatabase.PExecute("INSERT INTO groups (groupId,leaderGuid,mainTank,mainAssistant,lootMethod,looterGuid,lootThreshold,icon1,icon2,icon3,icon4,icon5,icon6,icon7,icon8,groupType,difficulty,raiddifficulty) "
|
CharacterDatabase.PExecute("INSERT INTO `groups` (`groupId`,`leaderGuid`,`mainTank`,`mainAssistant`,`lootMethod`,`looterGuid`,`lootThreshold`,`icon1`,`icon2`,`icon3`,`icon4`,`icon5`,`icon6`,`icon7`,`icon8`,`groupType`,`difficulty`,`raiddifficulty`) "
|
||||||
"VALUES ('%u','%u','%u','%u','%u','%u','%u','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','%u','%u','%u')",
|
"VALUES ('%u','%u','%u','%u','%u','%u','%u','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','%u','%u','%u')",
|
||||||
m_Id, m_leaderGuid.GetCounter(), m_mainTankGuid.GetCounter(), m_mainAssistantGuid.GetCounter(), uint32(m_lootMethod),
|
m_Id, m_leaderGuid.GetCounter(), m_mainTankGuid.GetCounter(), m_mainAssistantGuid.GetCounter(), uint32(m_lootMethod),
|
||||||
m_masterLooterGuid.GetCounter(), uint32(m_lootThreshold),
|
m_masterLooterGuid.GetCounter(), uint32(m_lootThreshold),
|
||||||
|
|
@ -195,7 +195,7 @@ bool Group::Create(ObjectGuid guid, const char* name)
|
||||||
bool Group::LoadGroupFromDB(Field* fields)
|
bool Group::LoadGroupFromDB(Field* fields)
|
||||||
{
|
{
|
||||||
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
||||||
// result = CharacterDatabase.Query("SELECT mainTank, mainAssistant, lootMethod, looterGuid, lootThreshold, icon1, icon2, icon3, icon4, icon5, icon6, icon7, icon8, groupType, difficulty, raiddifficulty, leaderGuid, groupId FROM groups");
|
// result = CharacterDatabase.Query("SELECT `mainTank`, `mainAssistant`, `lootMethod`, `looterGuid`, `lootThreshold`, `icon1`, `icon2`, `icon3`, `icon4`, `icon5`, `icon6`, `icon7`, `icon8`, `groupType`, `difficulty`, `raiddifficulty`, `leaderGuid`, `groupId` FROM `groups`");
|
||||||
|
|
||||||
m_Id = fields[17].GetUInt32();
|
m_Id = fields[17].GetUInt32();
|
||||||
m_leaderGuid = ObjectGuid(HIGHGUID_PLAYER, fields[16].GetUInt32());
|
m_leaderGuid = ObjectGuid(HIGHGUID_PLAYER, fields[16].GetUInt32());
|
||||||
|
|
@ -262,7 +262,9 @@ void Group::ConvertToRaid()
|
||||||
_initRaidSubGroupsCounter();
|
_initRaidSubGroupsCounter();
|
||||||
|
|
||||||
if (!isBGGroup())
|
if (!isBGGroup())
|
||||||
CharacterDatabase.PExecute("UPDATE groups SET groupType = %u WHERE groupId='%u'", uint8(m_groupType), m_Id);
|
{
|
||||||
|
CharacterDatabase.PExecute("UPDATE `groups` SET `groupType` = %u WHERE `groupId`='%u'", uint8(m_groupType), m_Id);
|
||||||
|
}
|
||||||
SendUpdate();
|
SendUpdate();
|
||||||
|
|
||||||
// update quest related GO states (quest activity dependent from raid membership)
|
// update quest related GO states (quest activity dependent from raid membership)
|
||||||
|
|
@ -541,8 +543,8 @@ void Group::Disband(bool hideDestroy)
|
||||||
if (!isBGGroup())
|
if (!isBGGroup())
|
||||||
{
|
{
|
||||||
CharacterDatabase.BeginTransaction();
|
CharacterDatabase.BeginTransaction();
|
||||||
CharacterDatabase.PExecute("DELETE FROM groups WHERE groupId='%u'", m_Id);
|
CharacterDatabase.PExecute("DELETE FROM `groups` WHERE `groupId`='%u'", m_Id);
|
||||||
CharacterDatabase.PExecute("DELETE FROM group_member WHERE groupId='%u'", m_Id);
|
CharacterDatabase.PExecute("DELETE FROM `group_member` WHERE `groupId`='%u'", m_Id);
|
||||||
CharacterDatabase.CommitTransaction();
|
CharacterDatabase.CommitTransaction();
|
||||||
ResetInstances(INSTANCE_RESET_GROUP_DISBAND, false, NULL);
|
ResetInstances(INSTANCE_RESET_GROUP_DISBAND, false, NULL);
|
||||||
ResetInstances(INSTANCE_RESET_GROUP_DISBAND, true, NULL);
|
ResetInstances(INSTANCE_RESET_GROUP_DISBAND, true, NULL);
|
||||||
|
|
@ -1325,7 +1327,7 @@ bool Group::_addMember(ObjectGuid guid, const char* name, bool isAssistant, uint
|
||||||
if (!isBGGroup())
|
if (!isBGGroup())
|
||||||
{
|
{
|
||||||
// insert into group table
|
// insert into group table
|
||||||
CharacterDatabase.PExecute("INSERT INTO group_member(groupId,memberGuid,assistant,subgroup) VALUES('%u','%u','%u','%u')",
|
CharacterDatabase.PExecute("INSERT INTO `group_member` (`groupId`,`memberGuid`,`assistant`,`subgroup`) VALUES ('%u','%u','%u','%u')",
|
||||||
m_Id, member.guid.GetCounter(), ((member.assistant == 1) ? 1 : 0), member.group);
|
m_Id, member.guid.GetCounter(), ((member.assistant == 1) ? 1 : 0), member.group);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1361,7 +1363,9 @@ bool Group::_removeMember(ObjectGuid guid)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isBGGroup())
|
if (!isBGGroup())
|
||||||
CharacterDatabase.PExecute("DELETE FROM group_member WHERE memberGuid='%u'", guid.GetCounter());
|
{
|
||||||
|
CharacterDatabase.PExecute("DELETE FROM `group_member` WHERE `memberGuid`='%u'", guid.GetCounter());
|
||||||
|
}
|
||||||
|
|
||||||
if (m_leaderGuid == guid) // leader was removed
|
if (m_leaderGuid == guid) // leader was removed
|
||||||
{
|
{
|
||||||
|
|
@ -1396,8 +1400,8 @@ void Group::_setLeader(ObjectGuid guid)
|
||||||
// in the DB also remove solo binds that will be replaced with permbinds
|
// in the DB also remove solo binds that will be replaced with permbinds
|
||||||
// from the new leader
|
// from the new leader
|
||||||
CharacterDatabase.PExecute(
|
CharacterDatabase.PExecute(
|
||||||
"DELETE FROM group_instance WHERE leaderguid='%u' AND (permanent = 1 OR "
|
"DELETE FROM `group_instance` WHERE `leaderguid`='%u' AND (`permanent` = 1 OR "
|
||||||
"instance IN (SELECT instance FROM character_instance WHERE guid = '%u')"
|
"`instance` IN (SELECT `instance` FROM `character_instance` WHERE `guid` = '%u')"
|
||||||
")", leader_lowguid, slot_lowguid);
|
")", leader_lowguid, slot_lowguid);
|
||||||
|
|
||||||
Player* player = sObjectMgr.GetPlayer(slot->guid);
|
Player* player = sObjectMgr.GetPlayer(slot->guid);
|
||||||
|
|
@ -1420,7 +1424,7 @@ void Group::_setLeader(ObjectGuid guid)
|
||||||
}
|
}
|
||||||
|
|
||||||
// update the group's solo binds to the new leader
|
// update the group's solo binds to the new leader
|
||||||
CharacterDatabase.PExecute("UPDATE group_instance SET leaderGuid='%u' WHERE leaderGuid = '%u'",
|
CharacterDatabase.PExecute("UPDATE `group_instance` SET `leaderGuid`='%u' WHERE `leaderGuid` = '%u'",
|
||||||
slot_lowguid, leader_lowguid);
|
slot_lowguid, leader_lowguid);
|
||||||
|
|
||||||
// copy the permanent binds from the new leader to the group
|
// copy the permanent binds from the new leader to the group
|
||||||
|
|
@ -1429,7 +1433,7 @@ void Group::_setLeader(ObjectGuid guid)
|
||||||
Player::ConvertInstancesToGroup(player, this, slot->guid);
|
Player::ConvertInstancesToGroup(player, this, slot->guid);
|
||||||
|
|
||||||
// update the group leader
|
// update the group leader
|
||||||
CharacterDatabase.PExecute("UPDATE groups SET leaderGuid='%u' WHERE groupId='%u'", slot_lowguid, m_Id);
|
CharacterDatabase.PExecute("UPDATE `groups` SET `leaderGuid`='%u' WHERE `groupId`='%u'", slot_lowguid, m_Id);
|
||||||
CharacterDatabase.CommitTransaction();
|
CharacterDatabase.CommitTransaction();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1484,7 +1488,9 @@ bool Group::_setMembersGroup(ObjectGuid guid, uint8 group)
|
||||||
SubGroupCounterIncrease(group);
|
SubGroupCounterIncrease(group);
|
||||||
|
|
||||||
if (!isBGGroup())
|
if (!isBGGroup())
|
||||||
CharacterDatabase.PExecute("UPDATE group_member SET subgroup='%u' WHERE memberGuid='%u'", group, guid.GetCounter());
|
{
|
||||||
|
CharacterDatabase.PExecute("UPDATE `group_member` SET `subgroup`='%u' WHERE `memberGuid`='%u'", group, guid.GetCounter());
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -1499,7 +1505,9 @@ bool Group::_setAssistantFlag(ObjectGuid guid, const bool& state)
|
||||||
|
|
||||||
slot->assistant = state;
|
slot->assistant = state;
|
||||||
if (!isBGGroup())
|
if (!isBGGroup())
|
||||||
CharacterDatabase.PExecute("UPDATE group_member SET assistant='%u' WHERE memberGuid='%u'", (state == true) ? 1 : 0, guid.GetCounter());
|
{
|
||||||
|
CharacterDatabase.PExecute("UPDATE `group_member` SET `assistant`='%u' WHERE `memberGuid`='%u'", (state == true) ? 1 : 0, guid.GetCounter());
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1525,7 +1533,9 @@ bool Group::_setMainTank(ObjectGuid guid)
|
||||||
m_mainTankGuid = guid;
|
m_mainTankGuid = guid;
|
||||||
|
|
||||||
if (!isBGGroup())
|
if (!isBGGroup())
|
||||||
CharacterDatabase.PExecute("UPDATE groups SET mainTank='%u' WHERE groupId='%u'", m_mainTankGuid.GetCounter(), m_Id);
|
{
|
||||||
|
CharacterDatabase.PExecute("UPDATE `groups` SET `mainTank`='%u' WHERE `groupId`='%u'", m_mainTankGuid.GetCounter(), m_Id);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -1552,7 +1562,7 @@ bool Group::_setMainAssistant(ObjectGuid guid)
|
||||||
m_mainAssistantGuid = guid;
|
m_mainAssistantGuid = guid;
|
||||||
|
|
||||||
if (!isBGGroup())
|
if (!isBGGroup())
|
||||||
CharacterDatabase.PExecute("UPDATE groups SET mainAssistant='%u' WHERE groupId='%u'",
|
CharacterDatabase.PExecute("UPDATE `groups` SET `mainAssistant`='%u' WHERE `groupId`='%u'",
|
||||||
m_mainAssistantGuid.GetCounter(), m_Id);
|
m_mainAssistantGuid.GetCounter(), m_Id);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -1928,7 +1938,9 @@ void Group::ResetInstances(InstanceResetMethod method, bool isRaid, Player* Send
|
||||||
if (state->CanReset())
|
if (state->CanReset())
|
||||||
state->DeleteFromDB();
|
state->DeleteFromDB();
|
||||||
else
|
else
|
||||||
CharacterDatabase.PExecute("DELETE FROM group_instance WHERE instance = '%u'", state->GetInstanceId());
|
{
|
||||||
|
CharacterDatabase.PExecute("DELETE FROM `group_instance` WHERE `instance` = '%u'", state->GetInstanceId());
|
||||||
|
}
|
||||||
// i don't know for sure if hash_map iterators
|
// i don't know for sure if hash_map iterators
|
||||||
m_boundInstances[diff].erase(itr);
|
m_boundInstances[diff].erase(itr);
|
||||||
itr = m_boundInstances[diff].begin();
|
itr = m_boundInstances[diff].begin();
|
||||||
|
|
@ -1997,11 +2009,11 @@ InstanceGroupBind* Group::BindToInstance(DungeonPersistentState* state, bool per
|
||||||
// when a boss is killed or when copying the players's binds to the group
|
// when a boss is killed or when copying the players's binds to the group
|
||||||
if (permanent != bind.perm || state != bind.state)
|
if (permanent != bind.perm || state != bind.state)
|
||||||
if (!load)
|
if (!load)
|
||||||
CharacterDatabase.PExecute("UPDATE group_instance SET instance = '%u', permanent = '%u' WHERE leaderGuid = '%u' AND instance = '%u'",
|
CharacterDatabase.PExecute("UPDATE `group_instance` SET `instance` = '%u', `permanent` = '%u' WHERE `leaderGuid` = '%u' AND `instance` = '%u'",
|
||||||
state->GetInstanceId(), permanent, GetLeaderGuid().GetCounter(), bind.state->GetInstanceId());
|
state->GetInstanceId(), permanent, GetLeaderGuid().GetCounter(), bind.state->GetInstanceId());
|
||||||
}
|
}
|
||||||
else if (!load)
|
else if (!load)
|
||||||
CharacterDatabase.PExecute("INSERT INTO group_instance (leaderGuid, instance, permanent) VALUES ('%u', '%u', '%u')",
|
CharacterDatabase.PExecute("INSERT INTO `group_instance` (`leaderGuid`, `instance`, `permanent`) VALUES ('%u', '%u', '%u')",
|
||||||
GetLeaderGuid().GetCounter(), state->GetInstanceId(), permanent);
|
GetLeaderGuid().GetCounter(), state->GetInstanceId(), permanent);
|
||||||
|
|
||||||
if (bind.state != state)
|
if (bind.state != state)
|
||||||
|
|
@ -2032,7 +2044,7 @@ void Group::UnbindInstance(uint32 mapid, uint8 difficulty, bool unload)
|
||||||
if (itr != m_boundInstances[difficulty].end())
|
if (itr != m_boundInstances[difficulty].end())
|
||||||
{
|
{
|
||||||
if (!unload)
|
if (!unload)
|
||||||
CharacterDatabase.PExecute("DELETE FROM group_instance WHERE leaderGuid = '%u' AND instance = '%u'",
|
CharacterDatabase.PExecute("DELETE FROM `group_instance` WHERE `leaderGuid` = '%u' AND `instance` = '%u'",
|
||||||
GetLeaderGuid().GetCounter(), itr->second.state->GetInstanceId());
|
GetLeaderGuid().GetCounter(), itr->second.state->GetInstanceId());
|
||||||
itr->second.state->RemoveGroup(this); // state can become invalid
|
itr->second.state->RemoveGroup(this); // state can become invalid
|
||||||
m_boundInstances[difficulty].erase(itr);
|
m_boundInstances[difficulty].erase(itr);
|
||||||
|
|
|
||||||
|
|
@ -134,10 +134,10 @@ void GuildMgr::LoadGuilds()
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
|
|
||||||
// 0 1 2 3 4 5 6
|
// 0 1 2 3 4 5 6
|
||||||
QueryResult* result = CharacterDatabase.Query("SELECT guild.guildid,guild.name,leaderguid,EmblemStyle,EmblemColor,BorderStyle,BorderColor,"
|
QueryResult* result = CharacterDatabase.Query("SELECT `guild`.`guildid`,`guild`.`name`,`leaderguid`,`EmblemStyle`,`EmblemColor`,`BorderStyle`,`BorderColor`,"
|
||||||
// 7 8 9 10 11 12
|
// 7 8 9 10 11 12
|
||||||
"BackgroundColor,info,motd,createdate,BankMoney,(SELECT COUNT(guild_bank_tab.guildid) FROM guild_bank_tab WHERE guild_bank_tab.guildid = guild.guildid) "
|
"`BackgroundColor`,`info`,`motd`,`createdate`,`BankMoney`,(SELECT COUNT(`guild_bank_tab.guildid`) FROM `guild_bank_tab` WHERE `guild_bank_tab`.`guildid` = `guild`.`guildid`) "
|
||||||
"FROM guild ORDER BY guildid ASC");
|
"FROM `guild` ORDER BY `guildid` ASC");
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
|
|
@ -152,15 +152,15 @@ void GuildMgr::LoadGuilds()
|
||||||
|
|
||||||
// load guild ranks
|
// load guild ranks
|
||||||
// 0 1 2 3 4
|
// 0 1 2 3 4
|
||||||
QueryResult* guildRanksResult = CharacterDatabase.Query("SELECT guildid,rid,rname,rights,BankMoneyPerDay FROM guild_rank ORDER BY guildid ASC, rid ASC");
|
QueryResult* guildRanksResult = CharacterDatabase.Query("SELECT `guildid`,`rid`,`rname`,`rights`,`BankMoneyPerDay` FROM `guild_rank` ORDER BY `guildid` ASC, `rid` ASC");
|
||||||
|
|
||||||
// load guild members
|
// load guild members
|
||||||
// 0 1 2 3 4 5 6
|
// 0 1 2 3 4 5 6
|
||||||
QueryResult* guildMembersResult = CharacterDatabase.Query("SELECT guildid,guild_member.guid,rank,pnote,offnote,BankResetTimeMoney,BankRemMoney,"
|
QueryResult* guildMembersResult = CharacterDatabase.Query("SELECT `guildid`,`guild_member`.`guid`,`rank`,`pnote`,`offnote`,`BankResetTimeMoney`,`BankRemMoney`,"
|
||||||
// 7 8 9 10 11 12
|
// 7 8 9 10 11 12
|
||||||
"BankResetTimeTab0,BankRemSlotsTab0,BankResetTimeTab1,BankRemSlotsTab1,BankResetTimeTab2,BankRemSlotsTab2,"
|
"`BankResetTimeTab0`,`BankRemSlotsTab0`,`BankResetTimeTab1`,`BankRemSlotsTab1`,`BankResetTimeTab2`,`BankRemSlotsTab2`,"
|
||||||
// 13 14 15 16 17 18
|
// 13 14 15 16 17 18
|
||||||
"BankResetTimeTab3,BankRemSlotsTab3,BankResetTimeTab4,BankRemSlotsTab4,BankResetTimeTab5,BankRemSlotsTab5,"
|
"`BankResetTimeTab3`,`BankRemSlotsTab3`,`BankResetTimeTab4`,`BankRemSlotsTab4`,`BankResetTimeTab5`,`BankRemSlotsTab5`,"
|
||||||
// 19 20 21 22 23 24
|
// 19 20 21 22 23 24
|
||||||
"characters.name, characters.level, characters.class, characters.zone, characters.logout_time, characters.account "
|
"characters.name, characters.level, characters.class, characters.zone, characters.logout_time, characters.account "
|
||||||
"FROM guild_member LEFT JOIN characters ON characters.guid = guild_member.guid ORDER BY guildid ASC");
|
"FROM guild_member LEFT JOIN characters ON characters.guid = guild_member.guid ORDER BY guildid ASC");
|
||||||
|
|
@ -205,8 +205,8 @@ void GuildMgr::LoadGuilds()
|
||||||
|
|
||||||
// delete unused LogGuid records in guild_eventlog and guild_bank_eventlog table
|
// delete unused LogGuid records in guild_eventlog and guild_bank_eventlog table
|
||||||
// you can comment these lines if you don't plan to change CONFIG_UINT32_GUILD_EVENT_LOG_COUNT and CONFIG_UINT32_GUILD_BANK_EVENT_LOG_COUNT
|
// you can comment these lines if you don't plan to change CONFIG_UINT32_GUILD_EVENT_LOG_COUNT and CONFIG_UINT32_GUILD_BANK_EVENT_LOG_COUNT
|
||||||
CharacterDatabase.PExecute("DELETE FROM guild_eventlog WHERE LogGuid > '%u'", sWorld.getConfig(CONFIG_UINT32_GUILD_EVENT_LOG_COUNT));
|
CharacterDatabase.PExecute("DELETE FROM `guild_eventlog` WHERE `LogGuid` > '%u'", sWorld.getConfig(CONFIG_UINT32_GUILD_EVENT_LOG_COUNT));
|
||||||
CharacterDatabase.PExecute("DELETE FROM guild_bank_eventlog WHERE LogGuid > '%u'", sWorld.getConfig(CONFIG_UINT32_GUILD_BANK_EVENT_LOG_COUNT));
|
CharacterDatabase.PExecute("DELETE FROM `guild_bank_eventlog` WHERE `LogGuid` > '%u'", sWorld.getConfig(CONFIG_UINT32_GUILD_BANK_EVENT_LOG_COUNT));
|
||||||
|
|
||||||
sLog.outString();
|
sLog.outString();
|
||||||
sLog.outString(">> Loaded %u guild definitions", count);
|
sLog.outString(">> Loaded %u guild definitions", count);
|
||||||
|
|
|
||||||
|
|
@ -46,11 +46,11 @@ void InstanceData::SaveToDB() const
|
||||||
|
|
||||||
if (instance->Instanceable())
|
if (instance->Instanceable())
|
||||||
{
|
{
|
||||||
CharacterDatabase.PExecute("UPDATE instance SET data = '%s' WHERE id = '%u'", data.c_str(), instance->GetInstanceId());
|
CharacterDatabase.PExecute("UPDATE `instance` SET `data` = '%s' WHERE `id` = '%u'", data.c_str(), instance->GetInstanceId());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CharacterDatabase.PExecute("UPDATE world SET data = '%s' WHERE map = '%u'", data.c_str(), instance->GetId());
|
CharacterDatabase.PExecute("UPDATE `world` SET `data` = '%s' WHERE `map` = '%u'", data.c_str(), instance->GetId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1114,7 +1114,7 @@ void WorldSession::HandleWrapItemOpcode(WorldPacket& recv_data)
|
||||||
}
|
}
|
||||||
|
|
||||||
CharacterDatabase.BeginTransaction();
|
CharacterDatabase.BeginTransaction();
|
||||||
CharacterDatabase.PExecute("INSERT INTO character_gifts VALUES ('%u', '%u', '%u', '%u')", item->GetOwnerGuid().GetCounter(), item->GetGUIDLow(), item->GetEntry(), item->GetUInt32Value(ITEM_FIELD_FLAGS));
|
CharacterDatabase.PExecute("INSERT INTO `character_gifts` VALUES ('%u', '%u', '%u', '%u')", item->GetOwnerGuid().GetCounter(), item->GetGUIDLow(), item->GetEntry(), item->GetUInt32Value(ITEM_FIELD_FLAGS));
|
||||||
item->SetEntry(gift->GetEntry());
|
item->SetEntry(gift->GetEntry());
|
||||||
|
|
||||||
switch (item->GetEntry())
|
switch (item->GetEntry())
|
||||||
|
|
|
||||||
|
|
@ -165,7 +165,9 @@ void MailDraft::deleteIncludedItems(bool inDB /**= false*/)
|
||||||
Item* item = mailItemIter->second;
|
Item* item = mailItemIter->second;
|
||||||
|
|
||||||
if (inDB)
|
if (inDB)
|
||||||
CharacterDatabase.PExecute("DELETE FROM item_instance WHERE guid='%u'", item->GetGUIDLow());
|
{
|
||||||
|
CharacterDatabase.PExecute("DELETE FROM `item_instance` WHERE `guid`='%u'", item->GetGUIDLow());
|
||||||
|
}
|
||||||
|
|
||||||
delete item;
|
delete item;
|
||||||
}
|
}
|
||||||
|
|
@ -234,7 +236,7 @@ void MailDraft::SendReturnToSender(uint32 sender_acc, ObjectGuid sender_guid, Ob
|
||||||
Item* item = mailItemIter->second;
|
Item* item = mailItemIter->second;
|
||||||
item->SaveToDB(); // item not in inventory and can be save standalone
|
item->SaveToDB(); // item not in inventory and can be save standalone
|
||||||
// owner in data will set at mail receive and item extracting
|
// owner in data will set at mail receive and item extracting
|
||||||
CharacterDatabase.PExecute("UPDATE item_instance SET owner_guid = '%u' WHERE guid='%u'", receiver_guid.GetCounter(), item->GetGUIDLow());
|
CharacterDatabase.PExecute("UPDATE `item_instance` SET `owner_guid` = '%u' WHERE `guid`='%u'", receiver_guid.GetCounter(), item->GetGUIDLow());
|
||||||
}
|
}
|
||||||
CharacterDatabase.CommitTransaction();
|
CharacterDatabase.CommitTransaction();
|
||||||
}
|
}
|
||||||
|
|
@ -298,14 +300,14 @@ void MailDraft::SendMailTo(MailReceiver const& receiver, MailSender const& sende
|
||||||
CharacterDatabase.escape_string(safe_body);
|
CharacterDatabase.escape_string(safe_body);
|
||||||
|
|
||||||
CharacterDatabase.BeginTransaction();
|
CharacterDatabase.BeginTransaction();
|
||||||
CharacterDatabase.PExecute("INSERT INTO mail (id,messageType,stationery,mailTemplateId,sender,receiver,subject,body,has_items,expire_time,deliver_time,money,cod,checked) "
|
CharacterDatabase.PExecute("INSERT INTO `mail` (`id`,`messageType`,`stationery`,`mailTemplateId`,`sender`,`receiver`,`subject`,`body`,`has_items`,`expire_time`,`deliver_time`,`money`,`cod`,`checked`) "
|
||||||
"VALUES ('%u', '%u', '%u', '%u', '%u', '%u', '%s', '%s', '%u', '" UI64FMTD "','" UI64FMTD "', '%u', '%u', '%u')",
|
"VALUES ('%u', '%u', '%u', '%u', '%u', '%u', '%s', '%s', '%u', '" UI64FMTD "','" UI64FMTD "', '%u', '%u', '%u')",
|
||||||
mailId, sender.GetMailMessageType(), sender.GetStationery(), GetMailTemplateId(), sender.GetSenderId(), receiver.GetPlayerGuid().GetCounter(), safe_subject.c_str(), safe_body.c_str(), (has_items ? 1 : 0), (uint64)expire_time, (uint64)deliver_time, m_money, m_COD, checked);
|
mailId, sender.GetMailMessageType(), sender.GetStationery(), GetMailTemplateId(), sender.GetSenderId(), receiver.GetPlayerGuid().GetCounter(), safe_subject.c_str(), safe_body.c_str(), (has_items ? 1 : 0), (uint64)expire_time, (uint64)deliver_time, m_money, m_COD, checked);
|
||||||
|
|
||||||
for (MailItemMap::const_iterator mailItemIter = m_items.begin(); mailItemIter != m_items.end(); ++mailItemIter)
|
for (MailItemMap::const_iterator mailItemIter = m_items.begin(); mailItemIter != m_items.end(); ++mailItemIter)
|
||||||
{
|
{
|
||||||
Item* item = mailItemIter->second;
|
Item* item = mailItemIter->second;
|
||||||
CharacterDatabase.PExecute("INSERT INTO mail_items (mail_id,item_guid,item_template,receiver) VALUES ('%u', '%u', '%u','%u')",
|
CharacterDatabase.PExecute("INSERT INTO `mail_items` (`mail_id`,`item_guid`,`item_template`,`receiver`) VALUES ('%u', '%u', '%u','%u')",
|
||||||
mailId, item->GetGUIDLow(), item->GetEntry(), receiver.GetPlayerGuid().GetCounter());
|
mailId, item->GetGUIDLow(), item->GetEntry(), receiver.GetPlayerGuid().GetCounter());
|
||||||
}
|
}
|
||||||
CharacterDatabase.CommitTransaction();
|
CharacterDatabase.CommitTransaction();
|
||||||
|
|
@ -373,7 +375,7 @@ void Mail::prepareTemplateItems(Player* receiver)
|
||||||
mailLoot.FillLoot(mailTemplateId, LootTemplates_Mail, receiver, true, true);
|
mailLoot.FillLoot(mailTemplateId, LootTemplates_Mail, receiver, true, true);
|
||||||
|
|
||||||
CharacterDatabase.BeginTransaction();
|
CharacterDatabase.BeginTransaction();
|
||||||
CharacterDatabase.PExecute("UPDATE mail SET has_items = 1 WHERE id = %u", messageID);
|
CharacterDatabase.PExecute("UPDATE `mail` SET `has_items` = 1 WHERE `id` = %u", messageID);
|
||||||
|
|
||||||
uint32 max_slot = mailLoot.GetMaxSlotInLootFor(receiver);
|
uint32 max_slot = mailLoot.GetMaxSlotInLootFor(receiver);
|
||||||
for (uint32 i = 0; items.size() < MAX_MAIL_ITEMS && i < max_slot; ++i)
|
for (uint32 i = 0; items.size() < MAX_MAIL_ITEMS && i < max_slot; ++i)
|
||||||
|
|
@ -388,7 +390,7 @@ void Mail::prepareTemplateItems(Player* receiver)
|
||||||
|
|
||||||
receiver->AddMItem(item);
|
receiver->AddMItem(item);
|
||||||
|
|
||||||
CharacterDatabase.PExecute("INSERT INTO mail_items (mail_id,item_guid,item_template,receiver) VALUES ('%u', '%u', '%u','%u')",
|
CharacterDatabase.PExecute("INSERT INTO `mail_items` (`mail_id`,`item_guid`,`item_template`,`receiver`) VALUES ('%u', '%u', '%u','%u')",
|
||||||
messageID, item->GetGUIDLow(), item->GetEntry(), receiver->GetGUIDLow());
|
messageID, item->GetGUIDLow(), item->GetEntry(), receiver->GetGUIDLow());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -231,7 +231,7 @@ void WorldSession::HandleSendMail(WorldPacket& recv_data)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rc_team = sObjectMgr.GetPlayerTeamByGUID(rc);
|
rc_team = sObjectMgr.GetPlayerTeamByGUID(rc);
|
||||||
if (QueryResult* result = CharacterDatabase.PQuery("SELECT COUNT(*) FROM mail WHERE receiver = '%u'", rc.GetCounter()))
|
if (QueryResult* result = CharacterDatabase.PQuery("SELECT COUNT(*) FROM `mail` WHERE `receiver` = '%u'", rc.GetCounter()))
|
||||||
{
|
{
|
||||||
Field* fields = result->Fetch();
|
Field* fields = result->Fetch();
|
||||||
mails_count = fields[0].GetUInt32();
|
mails_count = fields[0].GetUInt32();
|
||||||
|
|
@ -330,7 +330,7 @@ void WorldSession::HandleSendMail(WorldPacket& recv_data)
|
||||||
item->DeleteFromInventoryDB(); // deletes item from character's inventory
|
item->DeleteFromInventoryDB(); // deletes item from character's inventory
|
||||||
item->SaveToDB(); // recursive and not have transaction guard into self, item not in inventory and can be save standalone
|
item->SaveToDB(); // recursive and not have transaction guard into self, item not in inventory and can be save standalone
|
||||||
// owner in data will set at mail receive and item extracting
|
// owner in data will set at mail receive and item extracting
|
||||||
CharacterDatabase.PExecute("UPDATE item_instance SET owner_guid = '%u' WHERE guid='%u'", rc.GetCounter(), item->GetGUIDLow());
|
CharacterDatabase.PExecute("UPDATE `item_instance` SET `owner_guid` = '%u' WHERE `guid`='%u'", rc.GetCounter(), item->GetGUIDLow());
|
||||||
CharacterDatabase.CommitTransaction();
|
CharacterDatabase.CommitTransaction();
|
||||||
|
|
||||||
draft.AddItem(item);
|
draft.AddItem(item);
|
||||||
|
|
@ -466,9 +466,9 @@ void WorldSession::HandleMailReturnToSender(WorldPacket& recv_data)
|
||||||
// we can return mail now
|
// we can return mail now
|
||||||
// so firstly delete the old one
|
// so firstly delete the old one
|
||||||
CharacterDatabase.BeginTransaction();
|
CharacterDatabase.BeginTransaction();
|
||||||
CharacterDatabase.PExecute("DELETE FROM mail WHERE id = '%u'", mailId);
|
CharacterDatabase.PExecute("DELETE FROM `mail` WHERE `id` = '%u'", mailId);
|
||||||
// needed?
|
// needed?
|
||||||
CharacterDatabase.PExecute("DELETE FROM mail_items WHERE mail_id = '%u'", mailId);
|
CharacterDatabase.PExecute("DELETE FROM `mail_items` WHERE `mail_id` = '%u'", mailId);
|
||||||
CharacterDatabase.CommitTransaction();
|
CharacterDatabase.CommitTransaction();
|
||||||
pl->RemoveMail(mailId);
|
pl->RemoveMail(mailId);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1356,11 +1356,11 @@ void Map::CreateInstanceData(bool load)
|
||||||
|
|
||||||
if (Instanceable())
|
if (Instanceable())
|
||||||
{
|
{
|
||||||
result = CharacterDatabase.PQuery("SELECT data FROM instance WHERE id = '%u'", i_InstanceId);
|
result = CharacterDatabase.PQuery("SELECT `data` FROM `instance` WHERE `id` = '%u'", i_InstanceId);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
result = CharacterDatabase.PQuery("SELECT data FROM world WHERE map = '%u'", GetId());
|
result = CharacterDatabase.PQuery("SELECT `data` FROM `world` WHERE `map` = '%u'", GetId());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
|
|
@ -1379,7 +1379,7 @@ void Map::CreateInstanceData(bool load)
|
||||||
// for non-instanceable map always add data to table if not found, later code expected that for map in `word` exist always after load
|
// for non-instanceable map always add data to table if not found, later code expected that for map in `word` exist always after load
|
||||||
if (!Instanceable())
|
if (!Instanceable())
|
||||||
{
|
{
|
||||||
CharacterDatabase.PExecute("INSERT INTO world VALUES ('%u', '')", GetId());
|
CharacterDatabase.PExecute("INSERT INTO `world` VALUES ('%u', '')", GetId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -94,12 +94,12 @@ void MapPersistentState::SaveCreatureRespawnTime(uint32 loguid, time_t t)
|
||||||
static SqlStatementID delSpawnTime ;
|
static SqlStatementID delSpawnTime ;
|
||||||
static SqlStatementID insSpawnTime ;
|
static SqlStatementID insSpawnTime ;
|
||||||
|
|
||||||
SqlStatement stmt = CharacterDatabase.CreateStatement(delSpawnTime, "DELETE FROM creature_respawn WHERE guid = ? AND instance = ?");
|
SqlStatement stmt = CharacterDatabase.CreateStatement(delSpawnTime, "DELETE FROM `creature_respawn` WHERE `guid` = ? AND `instance` = ?");
|
||||||
stmt.PExecute(loguid, m_instanceid);
|
stmt.PExecute(loguid, m_instanceid);
|
||||||
|
|
||||||
if (t > sWorld.GetGameTime())
|
if (t > sWorld.GetGameTime())
|
||||||
{
|
{
|
||||||
stmt = CharacterDatabase.CreateStatement(insSpawnTime, "INSERT INTO creature_respawn VALUES ( ?, ?, ? )");
|
stmt = CharacterDatabase.CreateStatement(insSpawnTime, "INSERT INTO `creature_respawn` VALUES ( ?, ?, ? )");
|
||||||
stmt.PExecute(loguid, uint64(t), m_instanceid);
|
stmt.PExecute(loguid, uint64(t), m_instanceid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -121,12 +121,12 @@ void MapPersistentState::SaveGORespawnTime(uint32 loguid, time_t t)
|
||||||
static SqlStatementID delSpawnTime ;
|
static SqlStatementID delSpawnTime ;
|
||||||
static SqlStatementID insSpawnTime ;
|
static SqlStatementID insSpawnTime ;
|
||||||
|
|
||||||
SqlStatement stmt = CharacterDatabase.CreateStatement(delSpawnTime, "DELETE FROM gameobject_respawn WHERE guid = ? AND instance = ?");
|
SqlStatement stmt = CharacterDatabase.CreateStatement(delSpawnTime, "DELETE FROM `gameobject_respawn` WHERE `guid` = ? AND `instance` = ?");
|
||||||
stmt.PExecute(loguid, m_instanceid);
|
stmt.PExecute(loguid, m_instanceid);
|
||||||
|
|
||||||
if (t > sWorld.GetGameTime())
|
if (t > sWorld.GetGameTime())
|
||||||
{
|
{
|
||||||
stmt = CharacterDatabase.CreateStatement(insSpawnTime, "INSERT INTO gameobject_respawn VALUES ( ?, ?, ? )");
|
stmt = CharacterDatabase.CreateStatement(insSpawnTime, "INSERT INTO `gameobject_respawn` VALUES ( ?, ?, ? )");
|
||||||
stmt.PExecute(loguid, uint64(t), m_instanceid);
|
stmt.PExecute(loguid, uint64(t), m_instanceid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -270,14 +270,14 @@ void DungeonPersistentState::SaveToDB()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CharacterDatabase.PExecute("INSERT INTO instance VALUES ('%u', '%u', '" UI64FMTD "', '%u', '%u', '%s')", GetInstanceId(), GetMapId(), (uint64)GetResetTimeForDB(), GetDifficulty(), GetCompletedEncountersMask(), data.c_str());
|
CharacterDatabase.PExecute("INSERT INTO `instance` VALUES ('%u', '%u', '" UI64FMTD "', '%u', '%u', '%s')", GetInstanceId(), GetMapId(), (uint64)GetResetTimeForDB(), GetDifficulty(), GetCompletedEncountersMask(), data.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void DungeonPersistentState::DeleteRespawnTimes()
|
void DungeonPersistentState::DeleteRespawnTimes()
|
||||||
{
|
{
|
||||||
CharacterDatabase.BeginTransaction();
|
CharacterDatabase.BeginTransaction();
|
||||||
CharacterDatabase.PExecute("DELETE FROM creature_respawn WHERE instance = '%u'", GetInstanceId());
|
CharacterDatabase.PExecute("DELETE FROM `creature_respawn` WHERE `instance` = '%u'", GetInstanceId());
|
||||||
CharacterDatabase.PExecute("DELETE FROM gameobject_respawn WHERE instance = '%u'", GetInstanceId());
|
CharacterDatabase.PExecute("DELETE FROM `gameobject_respawn` WHERE `instance` = '%u'", GetInstanceId());
|
||||||
CharacterDatabase.CommitTransaction();
|
CharacterDatabase.CommitTransaction();
|
||||||
|
|
||||||
ClearRespawnTimes(); // state can be deleted at call if only respawn data prevent unload
|
ClearRespawnTimes(); // state can be deleted at call if only respawn data prevent unload
|
||||||
|
|
@ -381,7 +381,7 @@ void DungeonResetScheduler::LoadResetTimes()
|
||||||
typedef std::map<uint32, ResetTimeMapDiffType> InstResetTimeMapDiffType;
|
typedef std::map<uint32, ResetTimeMapDiffType> InstResetTimeMapDiffType;
|
||||||
InstResetTimeMapDiffType instResetTime;
|
InstResetTimeMapDiffType instResetTime;
|
||||||
|
|
||||||
QueryResult* result = CharacterDatabase.Query("SELECT id, map, difficulty, resettime FROM instance WHERE resettime > 0");
|
QueryResult* result = CharacterDatabase.Query("SELECT `id`, `map`, `difficulty`, `resettime` FROM `instance` WHERE `resettime` > 0");
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
|
|
@ -407,7 +407,7 @@ void DungeonResetScheduler::LoadResetTimes()
|
||||||
delete result;
|
delete result;
|
||||||
|
|
||||||
// update reset time for normal instances with the max creature respawn time + X hours
|
// update reset time for normal instances with the max creature respawn time + X hours
|
||||||
result = CharacterDatabase.Query("SELECT MAX(respawntime), instance FROM creature_respawn WHERE instance > 0 GROUP BY instance");
|
result = CharacterDatabase.Query("SELECT MAX(`respawntime`), `instance` FROM `creature_respawn` WHERE `instance` > 0 GROUP BY `instance`");
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
|
|
@ -420,7 +420,7 @@ void DungeonResetScheduler::LoadResetTimes()
|
||||||
InstResetTimeMapDiffType::iterator itr = instResetTime.find(instance);
|
InstResetTimeMapDiffType::iterator itr = instResetTime.find(instance);
|
||||||
if (itr != instResetTime.end() && itr->second.second != resettime)
|
if (itr != instResetTime.end() && itr->second.second != resettime)
|
||||||
{
|
{
|
||||||
CharacterDatabase.DirectPExecute("UPDATE instance SET resettime = '" UI64FMTD "' WHERE id = '%u'", uint64(resettime), instance);
|
CharacterDatabase.DirectPExecute("UPDATE `instance` SET `resettime` = '" UI64FMTD "' WHERE `id` = '%u'", uint64(resettime), instance);
|
||||||
itr->second.second = resettime;
|
itr->second.second = resettime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -436,7 +436,7 @@ void DungeonResetScheduler::LoadResetTimes()
|
||||||
|
|
||||||
// load the global respawn times for raid/heroic instances
|
// load the global respawn times for raid/heroic instances
|
||||||
uint32 diff = sWorld.getConfig(CONFIG_UINT32_INSTANCE_RESET_TIME_HOUR) * HOUR;
|
uint32 diff = sWorld.getConfig(CONFIG_UINT32_INSTANCE_RESET_TIME_HOUR) * HOUR;
|
||||||
result = CharacterDatabase.Query("SELECT mapid, difficulty, resettime FROM instance_reset");
|
result = CharacterDatabase.Query("SELECT `mapid`, `difficulty`, `resettime` FROM `instance_reset`");
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
|
|
@ -452,14 +452,16 @@ void DungeonResetScheduler::LoadResetTimes()
|
||||||
if (!mapEntry || !mapEntry->IsDungeon() || !GetMapDifficultyData(mapid, difficulty))
|
if (!mapEntry || !mapEntry->IsDungeon() || !GetMapDifficultyData(mapid, difficulty))
|
||||||
{
|
{
|
||||||
sLog.outError("MapPersistentStateManager::LoadResetTimes: invalid mapid(%u)/difficulty(%u) pair in instance_reset!", mapid, difficulty);
|
sLog.outError("MapPersistentStateManager::LoadResetTimes: invalid mapid(%u)/difficulty(%u) pair in instance_reset!", mapid, difficulty);
|
||||||
CharacterDatabase.DirectPExecute("DELETE FROM instance_reset WHERE mapid = '%u' AND difficulty = '%u'", mapid, difficulty);
|
CharacterDatabase.DirectPExecute("DELETE FROM `instance_reset` WHERE `mapid` = '%u' AND `difficulty` = '%u'", mapid, difficulty);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// update the reset time if the hour in the configs changes
|
// update the reset time if the hour in the configs changes
|
||||||
uint64 newresettime = (oldresettime / DAY) * DAY + diff;
|
uint64 newresettime = (oldresettime / DAY) * DAY + diff;
|
||||||
if (oldresettime != newresettime)
|
if (oldresettime != newresettime)
|
||||||
CharacterDatabase.DirectPExecute("UPDATE instance_reset SET resettime = '" UI64FMTD "' WHERE mapid = '%u' AND difficulty = '%u'", newresettime, mapid, difficulty);
|
{
|
||||||
|
CharacterDatabase.DirectPExecute("UPDATE `instance_reset` SET `resettime` = '" UI64FMTD "' WHERE `mapid` = '%u' AND `difficulty` = '%u'", newresettime, mapid, difficulty);
|
||||||
|
}
|
||||||
|
|
||||||
SetResetTimeFor(mapid, difficulty, newresettime);
|
SetResetTimeFor(mapid, difficulty, newresettime);
|
||||||
}
|
}
|
||||||
|
|
@ -495,7 +497,7 @@ void DungeonResetScheduler::LoadResetTimes()
|
||||||
{
|
{
|
||||||
// initialize the reset time
|
// initialize the reset time
|
||||||
t = today + period + diff;
|
t = today + period + diff;
|
||||||
CharacterDatabase.DirectPExecute("INSERT INTO instance_reset VALUES ('%u','%u','" UI64FMTD "')", mapid, difficulty, (uint64)t);
|
CharacterDatabase.DirectPExecute("INSERT INTO `instance_reset` VALUES ('%u','%u','" UI64FMTD "')", mapid, difficulty, (uint64)t);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (t < now || t > nextWeek)
|
if (t < now || t > nextWeek)
|
||||||
|
|
@ -504,7 +506,7 @@ void DungeonResetScheduler::LoadResetTimes()
|
||||||
// calculate the next reset time
|
// calculate the next reset time
|
||||||
t = (t / DAY) * DAY;
|
t = (t / DAY) * DAY;
|
||||||
t += ((today - t) / period + 1) * period + diff;
|
t += ((today - t) / period + 1) * period + diff;
|
||||||
CharacterDatabase.DirectPExecute("UPDATE instance_reset SET resettime = '" UI64FMTD "' WHERE mapid = '%u' AND difficulty= '%u'", (uint64)t, mapid, difficulty);
|
CharacterDatabase.DirectPExecute("UPDATE `instance_reset` SET `resettime` = '" UI64FMTD "' WHERE mapid = '%u' AND difficulty= '%u'", (uint64)t, mapid, difficulty);
|
||||||
}
|
}
|
||||||
|
|
||||||
SetResetTimeFor(mapid, difficulty, t);
|
SetResetTimeFor(mapid, difficulty, t);
|
||||||
|
|
@ -588,7 +590,7 @@ void DungeonResetScheduler::Update()
|
||||||
|
|
||||||
time_t next_reset = DungeonResetScheduler::CalculateNextResetTime(mapDiff, resetTime);
|
time_t next_reset = DungeonResetScheduler::CalculateNextResetTime(mapDiff, resetTime);
|
||||||
|
|
||||||
CharacterDatabase.DirectPExecute("UPDATE instance_reset SET resettime = '" UI64FMTD "' WHERE mapid = '%u' AND difficulty = '%u'", uint64(next_reset), uint32(event.mapid), uint32(event.difficulty));
|
CharacterDatabase.DirectPExecute("UPDATE `instance_reset` SET `resettime` = '" UI64FMTD "' WHERE `mapid` = '%u' AND `difficulty` = '%u'", uint64(next_reset), uint32(event.mapid), uint32(event.difficulty));
|
||||||
|
|
||||||
SetResetTimeFor(event.mapid, event.difficulty, next_reset);
|
SetResetTimeFor(event.mapid, event.difficulty, next_reset);
|
||||||
|
|
||||||
|
|
@ -727,11 +729,11 @@ void MapPersistentStateManager::DeleteInstanceFromDB(uint32 instanceid)
|
||||||
if (instanceid)
|
if (instanceid)
|
||||||
{
|
{
|
||||||
CharacterDatabase.BeginTransaction();
|
CharacterDatabase.BeginTransaction();
|
||||||
CharacterDatabase.PExecute("DELETE FROM instance WHERE id = '%u'", instanceid);
|
CharacterDatabase.PExecute("DELETE FROM `instance` WHERE `id` = '%u'", instanceid);
|
||||||
CharacterDatabase.PExecute("DELETE FROM character_instance WHERE instance = '%u'", instanceid);
|
CharacterDatabase.PExecute("DELETE FROM `character_instance` WHERE `instance` = '%u'", instanceid);
|
||||||
CharacterDatabase.PExecute("DELETE FROM group_instance WHERE instance = '%u'", instanceid);
|
CharacterDatabase.PExecute("DELETE FROM `group_instance` WHERE `instance` = '%u'", instanceid);
|
||||||
CharacterDatabase.PExecute("DELETE FROM creature_respawn WHERE instance = '%u'", instanceid);
|
CharacterDatabase.PExecute("DELETE FROM `creature_respawn` WHERE `instance` = '%u'", instanceid);
|
||||||
CharacterDatabase.PExecute("DELETE FROM gameobject_respawn WHERE instance = '%u'", instanceid);
|
CharacterDatabase.PExecute("DELETE FROM `gameobject_respawn` WHERE `instance` = '%u'", instanceid);
|
||||||
CharacterDatabase.CommitTransaction();
|
CharacterDatabase.CommitTransaction();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -751,7 +753,9 @@ void MapPersistentStateManager::RemovePersistentState(uint32 mapId, uint32 insta
|
||||||
// state the resettime for normal instances only when they get unloaded
|
// state the resettime for normal instances only when they get unloaded
|
||||||
if (itr->second->GetMapEntry()->IsDungeon())
|
if (itr->second->GetMapEntry()->IsDungeon())
|
||||||
if (time_t resettime = ((DungeonPersistentState*)itr->second)->GetResetTimeForDB())
|
if (time_t resettime = ((DungeonPersistentState*)itr->second)->GetResetTimeForDB())
|
||||||
CharacterDatabase.PExecute("UPDATE instance SET resettime = '" UI64FMTD "' WHERE id = '%u'", (uint64)resettime, instanceId);
|
{
|
||||||
|
CharacterDatabase.PExecute("UPDATE `instance` SET `resettime` = '" UI64FMTD "' WHERE `id` = '%u'", (uint64)resettime, instanceId);
|
||||||
|
}
|
||||||
|
|
||||||
_ResetSave(m_instanceSaveByInstanceId, itr);
|
_ResetSave(m_instanceSaveByInstanceId, itr);
|
||||||
}
|
}
|
||||||
|
|
@ -788,7 +792,7 @@ void MapPersistentStateManager::_DelHelper(DatabaseType& db, const char* fields,
|
||||||
db.escape_string(fieldValue);
|
db.escape_string(fieldValue);
|
||||||
ss << (i != 0 ? " AND " : "") << fieldTokens[i] << " = '" << fieldValue << "'";
|
ss << (i != 0 ? " AND " : "") << fieldTokens[i] << " = '" << fieldValue << "'";
|
||||||
}
|
}
|
||||||
db.PExecute("DELETE FROM %s WHERE %s", table, ss.str().c_str());
|
db.PExecute("DELETE FROM `%s` WHERE %s", table, ss.str().c_str());
|
||||||
}
|
}
|
||||||
while (result->NextRow());
|
while (result->NextRow());
|
||||||
delete result;
|
delete result;
|
||||||
|
|
@ -805,19 +809,19 @@ void MapPersistentStateManager::CleanupInstances()
|
||||||
|
|
||||||
CharacterDatabase.BeginTransaction();
|
CharacterDatabase.BeginTransaction();
|
||||||
// clean character/group - instance binds with invalid group/characters
|
// clean character/group - instance binds with invalid group/characters
|
||||||
_DelHelper(CharacterDatabase, "character_instance.guid, instance", "character_instance", "LEFT JOIN characters ON character_instance.guid = characters.guid WHERE characters.guid IS NULL");
|
_DelHelper(CharacterDatabase, "`character_instance`.`guid`, `instance`", "`character_instance`", "LEFT JOIN `characters` ON `character_instance`.`guid` = `characters`.`guid` WHERE `characters`.`guid` IS NULL");
|
||||||
_DelHelper(CharacterDatabase, "group_instance.leaderGuid, instance", "group_instance", "LEFT JOIN characters ON group_instance.leaderGuid = characters.guid LEFT JOIN groups ON group_instance.leaderGuid = groups.leaderGuid WHERE characters.guid IS NULL OR groups.leaderGuid IS NULL");
|
_DelHelper(CharacterDatabase, "`group_instance`.`leaderGuid`, `instance`", "`group_instance`", "LEFT JOIN `characters` ON `group_instance`.`leaderGuid` = `characters`.`guid` LEFT JOIN `groups` ON `group_instance`.`leaderGuid` = `groups`.`leaderGuid` WHERE `characters`.`guid` IS NULL OR `groups`.`leaderGuid` IS NULL");
|
||||||
|
|
||||||
// clean instances that do not have any players or groups bound to them
|
// clean instances that do not have any players or groups bound to them
|
||||||
_DelHelper(CharacterDatabase, "id, map, difficulty", "instance", "LEFT JOIN character_instance ON character_instance.instance = id LEFT JOIN group_instance ON group_instance.instance = id WHERE character_instance.instance IS NULL AND group_instance.instance IS NULL");
|
_DelHelper(CharacterDatabase, "`id`, `map`, `difficulty`", "`instance`", "LEFT JOIN `character_instance` ON `character_instance`.`instance` = `id` LEFT JOIN `group_instance` ON `group_instance`.`instance` = `id` WHERE `character_instance`.`instance` IS NULL AND `group_instance`.`instance` IS NULL");
|
||||||
|
|
||||||
// clean invalid instance references in other tables
|
// clean invalid instance references in other tables
|
||||||
_DelHelper(CharacterDatabase, "character_instance.guid, instance", "character_instance", "LEFT JOIN instance ON character_instance.instance = instance.id WHERE instance.id IS NULL");
|
_DelHelper(CharacterDatabase, "`character_instance`.`guid`, `instance`", "`character_instance`", "LEFT JOIN `instance` ON `character_instance`.`instance` = `instance`.`id` WHERE `instance`.`id` IS NULL");
|
||||||
_DelHelper(CharacterDatabase, "group_instance.leaderGuid, instance", "group_instance", "LEFT JOIN instance ON group_instance.instance = instance.id WHERE instance.id IS NULL");
|
_DelHelper(CharacterDatabase, "`group_instance`.`leaderGuid`, `instance`", "`group_instance`", "LEFT JOIN `instance` ON `group_instance`.`instance` = `instance`.`id` WHERE `instance`.`id` IS NULL");
|
||||||
|
|
||||||
// clean unused respawn data
|
// clean unused respawn data
|
||||||
CharacterDatabase.Execute("DELETE FROM creature_respawn WHERE instance <> 0 AND instance NOT IN (SELECT id FROM instance)");
|
CharacterDatabase.Execute("DELETE FROM `creature_respawn` WHERE `instance` <> 0 AND `instance` NOT IN (SELECT `id` FROM `instance`)");
|
||||||
CharacterDatabase.Execute("DELETE FROM gameobject_respawn WHERE instance <> 0 AND instance NOT IN (SELECT id FROM instance)");
|
CharacterDatabase.Execute("DELETE FROM `gameobject_respawn` WHERE `instance` <> 0 AND `instance` NOT IN (SELECT `id` FROM `instance`)");
|
||||||
// execute transaction directly
|
// execute transaction directly
|
||||||
CharacterDatabase.CommitTransaction();
|
CharacterDatabase.CommitTransaction();
|
||||||
|
|
||||||
|
|
@ -837,7 +841,7 @@ void MapPersistentStateManager::PackInstances()
|
||||||
// all valid ids are in the instance table
|
// all valid ids are in the instance table
|
||||||
// any associations to ids not in this table are assumed to be
|
// any associations to ids not in this table are assumed to be
|
||||||
// cleaned already in CleanupInstances
|
// cleaned already in CleanupInstances
|
||||||
QueryResult* result = CharacterDatabase.Query("SELECT id FROM instance");
|
QueryResult* result = CharacterDatabase.Query("SELECT `id` FROM `instance`");
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
|
|
@ -860,12 +864,12 @@ void MapPersistentStateManager::PackInstances()
|
||||||
{
|
{
|
||||||
CharacterDatabase.BeginTransaction();
|
CharacterDatabase.BeginTransaction();
|
||||||
// remap instance id
|
// remap instance id
|
||||||
CharacterDatabase.PExecute("UPDATE creature_respawn SET instance = '%u' WHERE instance = '%u'", InstanceNumber, *i);
|
CharacterDatabase.PExecute("UPDATE `creature_respawn` SET `instance` = '%u' WHERE `instance` = '%u'", InstanceNumber, *i);
|
||||||
CharacterDatabase.PExecute("UPDATE gameobject_respawn SET instance = '%u' WHERE instance = '%u'", InstanceNumber, *i);
|
CharacterDatabase.PExecute("UPDATE `gameobject_respawn` SET `instance` = '%u' WHERE `instance` = '%u'", InstanceNumber, *i);
|
||||||
CharacterDatabase.PExecute("UPDATE corpse SET instance = '%u' WHERE instance = '%u'", InstanceNumber, *i);
|
CharacterDatabase.PExecute("UPDATE `corpse` SET `instance` = '%u' WHERE `instance` = '%u'", InstanceNumber, *i);
|
||||||
CharacterDatabase.PExecute("UPDATE character_instance SET instance = '%u' WHERE instance = '%u'", InstanceNumber, *i);
|
CharacterDatabase.PExecute("UPDATE `character_instance` SET `instance` = '%u' WHERE `instance` = '%u'", InstanceNumber, *i);
|
||||||
CharacterDatabase.PExecute("UPDATE instance SET id = '%u' WHERE id = '%u'", InstanceNumber, *i);
|
CharacterDatabase.PExecute("UPDATE `instance` SET `id` = '%u' WHERE `id` = '%u'", InstanceNumber, *i);
|
||||||
CharacterDatabase.PExecute("UPDATE group_instance SET instance = '%u' WHERE instance = '%u'", InstanceNumber, *i);
|
CharacterDatabase.PExecute("UPDATE `group_instance` SET `instance` = '%u' WHERE `instance` = '%u'", InstanceNumber, *i);
|
||||||
// execute transaction synchronously
|
// execute transaction synchronously
|
||||||
CharacterDatabase.CommitTransaction();
|
CharacterDatabase.CommitTransaction();
|
||||||
}
|
}
|
||||||
|
|
@ -974,15 +978,15 @@ void MapPersistentStateManager::_ResetOrWarnAll(uint32 mapid, Difficulty difficu
|
||||||
|
|
||||||
// delete them from the DB, even if not loaded
|
// delete them from the DB, even if not loaded
|
||||||
CharacterDatabase.BeginTransaction();
|
CharacterDatabase.BeginTransaction();
|
||||||
CharacterDatabase.PExecute("DELETE FROM character_instance USING character_instance LEFT JOIN instance ON character_instance.instance = id WHERE map = '%u'", mapid);
|
CharacterDatabase.PExecute("DELETE FROM `character_instance` USING `character_instance` LEFT JOIN `instance` ON `character_instance`.`instance` = `id` WHERE `map` = '%u'", mapid);
|
||||||
CharacterDatabase.PExecute("DELETE FROM group_instance USING group_instance LEFT JOIN instance ON group_instance.instance = id WHERE map = '%u'", mapid);
|
CharacterDatabase.PExecute("DELETE FROM `group_instance` USING `group_instance` LEFT JOIN `instance` ON `group_instance`.`instance` = `id` WHERE `map` = '%u'", mapid);
|
||||||
CharacterDatabase.PExecute("DELETE FROM instance WHERE map = '%u'", mapid);
|
CharacterDatabase.PExecute("DELETE FROM `instance` WHERE `map` = '%u'", mapid);
|
||||||
CharacterDatabase.CommitTransaction();
|
CharacterDatabase.CommitTransaction();
|
||||||
|
|
||||||
// calculate the next reset time
|
// calculate the next reset time
|
||||||
time_t next_reset = DungeonResetScheduler::CalculateNextResetTime(mapDiff, now + timeLeft);
|
time_t next_reset = DungeonResetScheduler::CalculateNextResetTime(mapDiff, now + timeLeft);
|
||||||
// update it in the DB
|
// update it in the DB
|
||||||
CharacterDatabase.PExecute("UPDATE instance_reset SET resettime = '" UI64FMTD "' WHERE mapid = '%u' AND difficulty = '%u'", (uint64)next_reset, mapid, difficulty);
|
CharacterDatabase.PExecute("UPDATE `instance_reset` SET `resettime` = '" UI64FMTD "' WHERE `mapid` = '%u' AND `difficulty` = '%u'", (uint64)next_reset, mapid, difficulty);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1030,12 +1034,12 @@ void MapPersistentStateManager::InitWorldMaps()
|
||||||
void MapPersistentStateManager::LoadCreatureRespawnTimes()
|
void MapPersistentStateManager::LoadCreatureRespawnTimes()
|
||||||
{
|
{
|
||||||
// remove outdated data
|
// remove outdated data
|
||||||
CharacterDatabase.DirectExecute("DELETE FROM creature_respawn WHERE respawntime <= UNIX_TIMESTAMP(NOW())");
|
CharacterDatabase.DirectExecute("DELETE FROM `creature_respawn` WHERE `respawntime` <= UNIX_TIMESTAMP(NOW())");
|
||||||
|
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
|
|
||||||
// 0 1 2 3 4 5 6
|
// 0 1 2 3 4 5 6
|
||||||
QueryResult* result = CharacterDatabase.Query("SELECT guid, respawntime, map, instance, difficulty, resettime, encountersMask FROM creature_respawn LEFT JOIN instance ON instance = id");
|
QueryResult* result = CharacterDatabase.Query("SELECT `guid`, `respawntime`, `map`, `instance`, `difficulty`, `resettime`, `encountersMask` FROM `creature_respawn` LEFT JOIN `instance` ON `instance` = `id`");
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
BarGoLink bar(1);
|
BarGoLink bar(1);
|
||||||
|
|
@ -1103,12 +1107,12 @@ void MapPersistentStateManager::LoadCreatureRespawnTimes()
|
||||||
void MapPersistentStateManager::LoadGameobjectRespawnTimes()
|
void MapPersistentStateManager::LoadGameobjectRespawnTimes()
|
||||||
{
|
{
|
||||||
// remove outdated data
|
// remove outdated data
|
||||||
CharacterDatabase.DirectExecute("DELETE FROM gameobject_respawn WHERE respawntime <= UNIX_TIMESTAMP(NOW())");
|
CharacterDatabase.DirectExecute("DELETE FROM `gameobject_respawn` WHERE `respawntime` <= UNIX_TIMESTAMP(NOW())");
|
||||||
|
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
|
|
||||||
// 0 1 2 3 4 5 6
|
// 0 1 2 3 4 5 6
|
||||||
QueryResult* result = CharacterDatabase.Query("SELECT guid, respawntime, map, instance, difficulty, resettime, encountersMask FROM gameobject_respawn LEFT JOIN instance ON instance = id");
|
QueryResult* result = CharacterDatabase.Query("SELECT `guid`, `respawntime`, `map`, `instance`, `difficulty`, `resettime`, `encountersMask` FROM `gameobject_respawn` LEFT JOIN `instance` ON `instance` = `id`");
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -47,11 +47,13 @@ void MassMailMgr::AddMassMailTask(MailDraft* mailProto, const MailSender& sender
|
||||||
if (RACEMASK_ALL_PLAYABLE & ~raceMask) // have races not included in mask
|
if (RACEMASK_ALL_PLAYABLE & ~raceMask) // have races not included in mask
|
||||||
{
|
{
|
||||||
std::ostringstream ss;
|
std::ostringstream ss;
|
||||||
ss << "SELECT guid FROM characters WHERE (1 << (race - 1)) & " << raceMask << " AND deleteDate IS NULL";
|
ss << "SELECT `guid` FROM `characters` WHERE (1 << (`race` - 1)) & " << raceMask << " AND `deleteDate` IS NULL";
|
||||||
AddMassMailTask(mailProto, sender, ss.str().c_str());
|
AddMassMailTask(mailProto, sender, ss.str().c_str());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
AddMassMailTask(mailProto, sender, "SELECT guid FROM characters WHERE deleteDate IS NULL");
|
{
|
||||||
|
AddMassMailTask(mailProto, sender, "SELECT `guid` FROM `characters` WHERE `deleteDate` IS NULL");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct MassMailerQueryHandler
|
struct MassMailerQueryHandler
|
||||||
|
|
|
||||||
|
|
@ -500,7 +500,7 @@ void WorldSession::HandleAddFriendOpcode(WorldPacket& recv_data)
|
||||||
DEBUG_LOG("WORLD: %s asked to add friend : '%s'",
|
DEBUG_LOG("WORLD: %s asked to add friend : '%s'",
|
||||||
GetPlayer()->GetName(), friendName.c_str());
|
GetPlayer()->GetName(), friendName.c_str());
|
||||||
|
|
||||||
CharacterDatabase.AsyncPQuery(&WorldSession::HandleAddFriendOpcodeCallBack, GetAccountId(), friendNote, "SELECT guid, race FROM characters WHERE name = '%s'", friendName.c_str());
|
CharacterDatabase.AsyncPQuery(&WorldSession::HandleAddFriendOpcodeCallBack, GetAccountId(), friendNote, "SELECT `guid`, `race` FROM `characters` WHERE `name` = '%s'", friendName.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleAddFriendOpcodeCallBack(QueryResult* result, uint32 accountId, std::string friendNote)
|
void WorldSession::HandleAddFriendOpcodeCallBack(QueryResult* result, uint32 accountId, std::string friendNote)
|
||||||
|
|
@ -587,7 +587,7 @@ void WorldSession::HandleAddIgnoreOpcode(WorldPacket& recv_data)
|
||||||
DEBUG_LOG("WORLD: %s asked to Ignore: '%s'",
|
DEBUG_LOG("WORLD: %s asked to Ignore: '%s'",
|
||||||
GetPlayer()->GetName(), IgnoreName.c_str());
|
GetPlayer()->GetName(), IgnoreName.c_str());
|
||||||
|
|
||||||
CharacterDatabase.AsyncPQuery(&WorldSession::HandleAddIgnoreOpcodeCallBack, GetAccountId(), "SELECT guid FROM characters WHERE name = '%s'", IgnoreName.c_str());
|
CharacterDatabase.AsyncPQuery(&WorldSession::HandleAddIgnoreOpcodeCallBack, GetAccountId(), "SELECT `guid` FROM `characters` WHERE `name` = '%s'", IgnoreName.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleAddIgnoreOpcodeCallBack(QueryResult* result, uint32 accountId)
|
void WorldSession::HandleAddIgnoreOpcodeCallBack(QueryResult* result, uint32 accountId)
|
||||||
|
|
@ -673,7 +673,7 @@ void WorldSession::HandleBugOpcode(WorldPacket& recv_data)
|
||||||
|
|
||||||
CharacterDatabase.escape_string(type);
|
CharacterDatabase.escape_string(type);
|
||||||
CharacterDatabase.escape_string(content);
|
CharacterDatabase.escape_string(content);
|
||||||
CharacterDatabase.PExecute("INSERT INTO bugreport (type,content) VALUES('%s', '%s')", type.c_str(), content.c_str());
|
CharacterDatabase.PExecute("INSERT INTO `bugreport` (`type`,`content`) VALUES('%s', '%s')", type.c_str(), content.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleReclaimCorpseOpcode(WorldPacket& recv_data)
|
void WorldSession::HandleReclaimCorpseOpcode(WorldPacket& recv_data)
|
||||||
|
|
@ -1357,7 +1357,7 @@ void WorldSession::HandleWhoisOpcode(WorldPacket& recv_data)
|
||||||
|
|
||||||
uint32 accid = plr->GetSession()->GetAccountId();
|
uint32 accid = plr->GetSession()->GetAccountId();
|
||||||
|
|
||||||
QueryResult* result = LoginDatabase.PQuery("SELECT username,email,last_ip FROM account WHERE id=%u", accid);
|
QueryResult* result = LoginDatabase.PQuery("SELECT `username`,`email`,`last_ip` FROM `account` WHERE `id`=%u", accid);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
SendNotification(LANG_ACCOUNT_FOR_PLAYER_NOT_FOUND, charname.c_str());
|
SendNotification(LANG_ACCOUNT_FOR_PLAYER_NOT_FOUND, charname.c_str());
|
||||||
|
|
|
||||||
|
|
@ -577,7 +577,7 @@ void WorldSession::SendStablePet(ObjectGuid guid)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 0 1 2 3 4
|
// 0 1 2 3 4
|
||||||
QueryResult* result = CharacterDatabase.PQuery("SELECT owner, id, entry, level, name FROM character_pet WHERE owner = '%u' AND slot >= '%u' AND slot <= '%u' ORDER BY slot",
|
QueryResult* result = CharacterDatabase.PQuery("SELECT `owner`, `id`, `entry`, `level`, `name` FROM `character_pet` WHERE `owner` = '%u' AND `slot` >= '%u' AND `slot` <= '%u' ORDER BY `slot`",
|
||||||
_player->GetGUIDLow(), PET_SAVE_FIRST_STABLE_SLOT, PET_SAVE_LAST_STABLE_SLOT);
|
_player->GetGUIDLow(), PET_SAVE_FIRST_STABLE_SLOT, PET_SAVE_LAST_STABLE_SLOT);
|
||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
|
|
@ -665,7 +665,7 @@ void WorldSession::HandleStablePet(WorldPacket& recv_data)
|
||||||
|
|
||||||
uint32 free_slot = 1;
|
uint32 free_slot = 1;
|
||||||
|
|
||||||
QueryResult* result = CharacterDatabase.PQuery("SELECT owner,slot,id FROM character_pet WHERE owner = '%u' AND slot >= '%u' AND slot <= '%u' ORDER BY slot ",
|
QueryResult* result = CharacterDatabase.PQuery("SELECT `owner`,`slot`,`id` FROM `character_pet` WHERE `owner` = '%u' AND `slot` >= '%u' AND `slot` <= '%u' ORDER BY `slot`",
|
||||||
_player->GetGUIDLow(), PET_SAVE_FIRST_STABLE_SLOT, PET_SAVE_LAST_STABLE_SLOT);
|
_player->GetGUIDLow(), PET_SAVE_FIRST_STABLE_SLOT, PET_SAVE_LAST_STABLE_SLOT);
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
|
|
@ -713,7 +713,7 @@ void WorldSession::HandleUnstablePet(WorldPacket& recv_data)
|
||||||
uint32 creature_id = 0;
|
uint32 creature_id = 0;
|
||||||
|
|
||||||
{
|
{
|
||||||
QueryResult* result = CharacterDatabase.PQuery("SELECT entry FROM character_pet WHERE owner = '%u' AND id = '%u' AND slot >='%u' AND slot <= '%u'",
|
QueryResult* result = CharacterDatabase.PQuery("SELECT `entry` FROM `character_pet` WHERE `owner` = '%u' AND `id` = '%u' AND `slot` >='%u' AND `slot` <= '%u'",
|
||||||
_player->GetGUIDLow(), petnumber, PET_SAVE_FIRST_STABLE_SLOT, PET_SAVE_LAST_STABLE_SLOT);
|
_player->GetGUIDLow(), petnumber, PET_SAVE_FIRST_STABLE_SLOT, PET_SAVE_LAST_STABLE_SLOT);
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
|
|
@ -805,7 +805,7 @@ void WorldSession::HandleStableSwapPet(WorldPacket& recv_data)
|
||||||
}
|
}
|
||||||
|
|
||||||
// find swapped pet slot in stable
|
// find swapped pet slot in stable
|
||||||
QueryResult* result = CharacterDatabase.PQuery("SELECT slot,entry FROM character_pet WHERE owner = '%u' AND id = '%u'",
|
QueryResult* result = CharacterDatabase.PQuery("SELECT `slot`,`entry` FROM `character_pet` WHERE `owner` = '%u' AND `id` = '%u'",
|
||||||
_player->GetGUIDLow(), pet_number);
|
_player->GetGUIDLow(), pet_number);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -597,7 +597,7 @@ void WorldSession::HandlePetRename(WorldPacket& recv_data)
|
||||||
}
|
}
|
||||||
|
|
||||||
CharacterDatabase.escape_string(name);
|
CharacterDatabase.escape_string(name);
|
||||||
CharacterDatabase.PExecute("UPDATE character_pet SET name = '%s', renamed = '1' WHERE owner = '%u' AND id = '%u'", name.c_str(), _player->GetGUIDLow(), pet->GetCharmInfo()->GetPetNumber());
|
CharacterDatabase.PExecute("UPDATE `character_pet` SET `name` = '%s', `renamed` = '1' WHERE `owner` = '%u' AND `id` = '%u'", name.c_str(), _player->GetGUIDLow(), pet->GetCharmInfo()->GetPetNumber());
|
||||||
CharacterDatabase.CommitTransaction();
|
CharacterDatabase.CommitTransaction();
|
||||||
|
|
||||||
pet->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(time(NULL)));
|
pet->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(time(NULL)));
|
||||||
|
|
|
||||||
|
|
@ -144,7 +144,7 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket& recv_data)
|
||||||
|
|
||||||
// a petition is invalid, if both the owner and the type matches
|
// a petition is invalid, if both the owner and the type matches
|
||||||
// we checked above, if this player is in an arenateam, so this must be data corruption
|
// we checked above, if this player is in an arenateam, so this must be data corruption
|
||||||
QueryResult* result = CharacterDatabase.PQuery("SELECT petitionguid FROM petition WHERE ownerguid = '%u'", _player->GetGUIDLow());
|
QueryResult* result = CharacterDatabase.PQuery("SELECT `petitionguid` FROM `petition` WHERE `ownerguid` = '%u'", _player->GetGUIDLow());
|
||||||
|
|
||||||
std::ostringstream ssInvalidPetitionGUIDs;
|
std::ostringstream ssInvalidPetitionGUIDs;
|
||||||
|
|
||||||
|
|
@ -166,9 +166,9 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket& recv_data)
|
||||||
DEBUG_LOG("Invalid petition GUIDs: %s", ssInvalidPetitionGUIDs.str().c_str());
|
DEBUG_LOG("Invalid petition GUIDs: %s", ssInvalidPetitionGUIDs.str().c_str());
|
||||||
CharacterDatabase.escape_string(name);
|
CharacterDatabase.escape_string(name);
|
||||||
CharacterDatabase.BeginTransaction();
|
CharacterDatabase.BeginTransaction();
|
||||||
CharacterDatabase.PExecute("DELETE FROM petition WHERE petitionguid IN ( %s )", ssInvalidPetitionGUIDs.str().c_str());
|
CharacterDatabase.PExecute("DELETE FROM `petition` WHERE `petitionguid` IN ( %s )", ssInvalidPetitionGUIDs.str().c_str());
|
||||||
CharacterDatabase.PExecute("DELETE FROM petition_sign WHERE petitionguid IN ( %s )", ssInvalidPetitionGUIDs.str().c_str());
|
CharacterDatabase.PExecute("DELETE FROM `petition_sign` WHERE `petitionguid` IN ( %s )", ssInvalidPetitionGUIDs.str().c_str());
|
||||||
CharacterDatabase.PExecute("INSERT INTO petition (ownerguid, petitionguid, name) VALUES ('%u', '%u', '%s')",
|
CharacterDatabase.PExecute("INSERT INTO `petition` (`ownerguid`, `petitionguid`, `name`) VALUES ('%u', '%u', '%s')",
|
||||||
_player->GetGUIDLow(), charter->GetGUIDLow(), name.c_str());
|
_player->GetGUIDLow(), charter->GetGUIDLow(), name.c_str());
|
||||||
CharacterDatabase.CommitTransaction();
|
CharacterDatabase.CommitTransaction();
|
||||||
}
|
}
|
||||||
|
|
@ -200,7 +200,7 @@ void WorldSession::HandlePetitionShowSignOpcode(WorldPacket& recv_data)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = CharacterDatabase.PQuery("SELECT playerguid FROM petition_sign WHERE petitionguid = '%u'", petitionguid_low);
|
result = CharacterDatabase.PQuery("SELECT `playerguid` FROM `petition_sign` WHERE `petitionguid` = '%u'", petitionguid_low);
|
||||||
|
|
||||||
// result==NULL also correct in case no sign yet
|
// result==NULL also correct in case no sign yet
|
||||||
if (result)
|
if (result)
|
||||||
|
|
@ -251,9 +251,9 @@ void WorldSession::SendPetitionQueryOpcode(ObjectGuid petitionguid)
|
||||||
uint8 signs = 0;
|
uint8 signs = 0;
|
||||||
|
|
||||||
QueryResult* result = CharacterDatabase.PQuery(
|
QueryResult* result = CharacterDatabase.PQuery(
|
||||||
"SELECT ownerguid, name, "
|
"SELECT `ownerguid`, `name`, "
|
||||||
" (SELECT COUNT(playerguid) FROM petition_sign WHERE petition_sign.petitionguid = '%u') AS signs "
|
" (SELECT COUNT(`playerguid`) FROM `petition_sign` WHERE `petition_sign`.`petitionguid` = '%u') AS `signs` "
|
||||||
"FROM petition WHERE petitionguid = '%u'", petitionLowGuid, petitionLowGuid);
|
"FROM `petition` WHERE `petitionguid` = '%u'", petitionLowGuid, petitionLowGuid);
|
||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
|
|
@ -333,7 +333,7 @@ void WorldSession::HandlePetitionRenameOpcode(WorldPacket& recv_data)
|
||||||
|
|
||||||
std::string db_newname = newname;
|
std::string db_newname = newname;
|
||||||
CharacterDatabase.escape_string(db_newname);
|
CharacterDatabase.escape_string(db_newname);
|
||||||
CharacterDatabase.PExecute("UPDATE petition SET name = '%s' WHERE petitionguid = '%u'",
|
CharacterDatabase.PExecute("UPDATE `petition` SET `name` = '%s' WHERE `petitionguid` = '%u'",
|
||||||
db_newname.c_str(), petitionGuid.GetCounter());
|
db_newname.c_str(), petitionGuid.GetCounter());
|
||||||
|
|
||||||
DEBUG_LOG("Petition %s renamed to '%s'", petitionGuid.GetString().c_str(), newname.c_str());
|
DEBUG_LOG("Petition %s renamed to '%s'", petitionGuid.GetString().c_str(), newname.c_str());
|
||||||
|
|
@ -358,9 +358,9 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket& recv_data)
|
||||||
uint32 petitionLowGuid = petitionGuid.GetCounter();
|
uint32 petitionLowGuid = petitionGuid.GetCounter();
|
||||||
|
|
||||||
QueryResult* result = CharacterDatabase.PQuery(
|
QueryResult* result = CharacterDatabase.PQuery(
|
||||||
"SELECT ownerguid, "
|
"SELECT `ownerguid`, "
|
||||||
" (SELECT COUNT(playerguid) FROM petition_sign WHERE petition_sign.petitionguid = '%u') AS signs "
|
" (SELECT COUNT(`playerguid`) FROM `petition_sign` WHERE `petition_sign`.`petitionguid` = '%u') AS `signs` "
|
||||||
"FROM petition WHERE petitionguid = '%u'", petitionLowGuid, petitionLowGuid);
|
"FROM `petition` WHERE `petitionguid` = '%u'", petitionLowGuid, petitionLowGuid);
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
|
|
@ -404,7 +404,7 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket& recv_data)
|
||||||
|
|
||||||
// client doesn't allow to sign petition two times by one character, but not check sign by another character from same account
|
// client doesn't allow to sign petition two times by one character, but not check sign by another character from same account
|
||||||
// not allow sign another player from already sign player account
|
// not allow sign another player from already sign player account
|
||||||
result = CharacterDatabase.PQuery("SELECT playerguid, petitionguid FROM petition_sign WHERE player_account = '%u'", GetAccountId());
|
result = CharacterDatabase.PQuery("SELECT `playerguid`, `petitionguid` FROM `petition_sign` WHERE `player_account` = '%u'", GetAccountId());
|
||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
|
|
@ -434,7 +434,7 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket& recv_data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CharacterDatabase.PExecute("INSERT INTO petition_sign (ownerguid,petitionguid, playerguid, player_account) VALUES ('%u', '%u', '%u','%u')",
|
CharacterDatabase.PExecute("INSERT INTO `petition_sign` (`ownerguid`,`petitionguid`, `playerguid`, `player_account`) VALUES ('%u', '%u', '%u','%u')",
|
||||||
ownerLowGuid, petitionLowGuid, _player->GetGUIDLow(), GetAccountId());
|
ownerLowGuid, petitionLowGuid, _player->GetGUIDLow(), GetAccountId());
|
||||||
|
|
||||||
DEBUG_LOG("PETITION SIGN: %s by %s", petitionGuid.GetString().c_str(), _player->GetGuidStr().c_str());
|
DEBUG_LOG("PETITION SIGN: %s by %s", petitionGuid.GetString().c_str(), _player->GetGuidStr().c_str());
|
||||||
|
|
@ -464,7 +464,7 @@ void WorldSession::HandlePetitionDeclineOpcode(WorldPacket& recv_data)
|
||||||
|
|
||||||
uint32 petitionLowGuid = petitionGuid.GetCounter();
|
uint32 petitionLowGuid = petitionGuid.GetCounter();
|
||||||
|
|
||||||
QueryResult* result = CharacterDatabase.PQuery("SELECT ownerguid FROM petition WHERE petitionguid = '%u'", petitionLowGuid);
|
QueryResult* result = CharacterDatabase.PQuery("SELECT `ownerguid` FROM `petition` WHERE `petitionguid` = '%u'", petitionLowGuid);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|
@ -530,7 +530,7 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket& recv_data)
|
||||||
|
|
||||||
/// Get petition signs count
|
/// Get petition signs count
|
||||||
uint8 signs = 0;
|
uint8 signs = 0;
|
||||||
result = CharacterDatabase.PQuery("SELECT playerguid FROM petition_sign WHERE petitionguid = '%u'", petitionGuid.GetCounter());
|
result = CharacterDatabase.PQuery("SELECT `playerguid` FROM `petition_sign` WHERE `petitionguid` = '%u'", petitionGuid.GetCounter());
|
||||||
// result==NULL also correct charter without signs
|
// result==NULL also correct charter without signs
|
||||||
if (result)
|
if (result)
|
||||||
signs = (uint8)result->GetRowCount();
|
signs = (uint8)result->GetRowCount();
|
||||||
|
|
@ -573,7 +573,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket& recv_data)
|
||||||
std::string name;
|
std::string name;
|
||||||
|
|
||||||
// data
|
// data
|
||||||
QueryResult* result = CharacterDatabase.PQuery("SELECT ownerguid, name FROM petition WHERE petitionguid = '%u'", petitionGuid.GetCounter());
|
QueryResult* result = CharacterDatabase.PQuery("SELECT `ownerguid`, `name` FROM `petition` WHERE `petitionguid` = '%u'", petitionGuid.GetCounter());
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
Field* fields = result->Fetch();
|
Field* fields = result->Fetch();
|
||||||
|
|
@ -599,7 +599,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket& recv_data)
|
||||||
}
|
}
|
||||||
|
|
||||||
// signs
|
// signs
|
||||||
result = CharacterDatabase.PQuery("SELECT playerguid FROM petition_sign WHERE petitionguid = '%u'", petitionGuid.GetCounter());
|
result = CharacterDatabase.PQuery("SELECT `playerguid` FROM `petition_sign` WHERE `petitionguid` = '%u'", petitionGuid.GetCounter());
|
||||||
uint8 signs = result ? (uint8)result->GetRowCount() : 0;
|
uint8 signs = result ? (uint8)result->GetRowCount() : 0;
|
||||||
|
|
||||||
uint32 count = sWorld.getConfig(CONFIG_UINT32_MIN_PETITION_SIGNS);
|
uint32 count = sWorld.getConfig(CONFIG_UINT32_MIN_PETITION_SIGNS);
|
||||||
|
|
@ -657,8 +657,8 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket& recv_data)
|
||||||
delete result;
|
delete result;
|
||||||
|
|
||||||
CharacterDatabase.BeginTransaction();
|
CharacterDatabase.BeginTransaction();
|
||||||
CharacterDatabase.PExecute("DELETE FROM petition WHERE petitionguid = '%u'", petitionGuid.GetCounter());
|
CharacterDatabase.PExecute("DELETE FROM `petition` WHERE `petitionguid` = '%u'", petitionGuid.GetCounter());
|
||||||
CharacterDatabase.PExecute("DELETE FROM petition_sign WHERE petitionguid = '%u'", petitionGuid.GetCounter());
|
CharacterDatabase.PExecute("DELETE FROM `petition_sign` WHERE `petitionguid` = '%u'", petitionGuid.GetCounter());
|
||||||
CharacterDatabase.CommitTransaction();
|
CharacterDatabase.CommitTransaction();
|
||||||
|
|
||||||
// created
|
// created
|
||||||
|
|
|
||||||
|
|
@ -586,7 +586,7 @@ struct PoolMapChecker
|
||||||
|
|
||||||
void PoolManager::LoadFromDB()
|
void PoolManager::LoadFromDB()
|
||||||
{
|
{
|
||||||
QueryResult* result = WorldDatabase.Query("SELECT MAX(entry) FROM pool_template");
|
QueryResult* result = WorldDatabase.Query("SELECT MAX(`entry`) FROM `pool_template`");
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
sLog.outString(">> Table pool_template is empty.");
|
sLog.outString(">> Table pool_template is empty.");
|
||||||
|
|
@ -602,7 +602,7 @@ void PoolManager::LoadFromDB()
|
||||||
|
|
||||||
mPoolTemplate.resize(max_pool_id + 1);
|
mPoolTemplate.resize(max_pool_id + 1);
|
||||||
|
|
||||||
result = WorldDatabase.Query("SELECT entry, max_limit, description FROM pool_template");
|
result = WorldDatabase.Query("SELECT `entry`, `max_limit`, `description` FROM `pool_template`");
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
mPoolTemplate.clear();
|
mPoolTemplate.clear();
|
||||||
|
|
@ -641,7 +641,7 @@ void PoolManager::LoadFromDB()
|
||||||
mPoolCreatureGroups.resize(max_pool_id + 1);
|
mPoolCreatureGroups.resize(max_pool_id + 1);
|
||||||
mCreatureSearchMap.clear();
|
mCreatureSearchMap.clear();
|
||||||
// 1 2 3
|
// 1 2 3
|
||||||
result = WorldDatabase.Query("SELECT guid, pool_entry, chance FROM pool_creature");
|
result = WorldDatabase.Query("SELECT `guid`, `pool_entry`, `chance` FROM `pool_creature`");
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
if (!result)
|
if (!result)
|
||||||
|
|
@ -702,7 +702,7 @@ void PoolManager::LoadFromDB()
|
||||||
delete result;
|
delete result;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = WorldDatabase.Query("SELECT guid, pool_entry, chance, pool_creature_template.id FROM pool_creature_template LEFT JOIN creature ON creature.id = pool_creature_template.id");
|
result = WorldDatabase.Query("SELECT `guid`, `pool_entry`, `chance`, `pool_creature_template`.`id` FROM `pool_creature_template` LEFT JOIN `creature` ON `creature`.`id` = `pool_creature_template`.`id`");
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
if (!result)
|
if (!result)
|
||||||
|
|
@ -779,7 +779,7 @@ void PoolManager::LoadFromDB()
|
||||||
mPoolGameobjectGroups.resize(max_pool_id + 1);
|
mPoolGameobjectGroups.resize(max_pool_id + 1);
|
||||||
mGameobjectSearchMap.clear();
|
mGameobjectSearchMap.clear();
|
||||||
// 1 2 3
|
// 1 2 3
|
||||||
result = WorldDatabase.Query("SELECT guid, pool_entry, chance FROM pool_gameobject");
|
result = WorldDatabase.Query("SELECT `guid`, `pool_entry`, `chance` FROM `pool_gameobject`");
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
if (!result)
|
if (!result)
|
||||||
|
|
@ -850,7 +850,7 @@ void PoolManager::LoadFromDB()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 1 2 3
|
// 1 2 3
|
||||||
result = WorldDatabase.Query("SELECT guid, pool_entry, chance, pool_gameobject_template.id FROM pool_gameobject_template LEFT JOIN gameobject ON gameobject.id = pool_gameobject_template.id");
|
result = WorldDatabase.Query("SELECT `guid`, `pool_entry`, `chance`, `pool_gameobject_template`.`id` FROM `pool_gameobject_template` LEFT JOIN `gameobject` ON `gameobject`.`id` = `pool_gameobject_template`.`id`");
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
if (!result)
|
if (!result)
|
||||||
|
|
@ -934,7 +934,7 @@ void PoolManager::LoadFromDB()
|
||||||
// Pool of pools
|
// Pool of pools
|
||||||
mPoolPoolGroups.resize(max_pool_id + 1);
|
mPoolPoolGroups.resize(max_pool_id + 1);
|
||||||
// 1 2 3
|
// 1 2 3
|
||||||
result = WorldDatabase.Query("SELECT pool_id, mother_pool, chance FROM pool_pool");
|
result = WorldDatabase.Query("SELECT `pool_id`, `mother_pool`, `chance` FROM `pool_pool`");
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
if (!result)
|
if (!result)
|
||||||
|
|
|
||||||
|
|
@ -155,7 +155,7 @@ void ScriptMgr::LoadScripts(DBScriptType type)
|
||||||
m_dbScripts[type].clear(); // need for reload support
|
m_dbScripts[type].clear(); // need for reload support
|
||||||
|
|
||||||
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
||||||
QueryResult* result = WorldDatabase.PQuery("SELECT id, delay, command, datalong, datalong2, buddy_entry, search_radius, data_flags, dataint, dataint2, dataint3, dataint4, x, y, z, o FROM db_scripts WHERE script_type = %d ORDER BY script_guid ASC", type);
|
QueryResult* result = WorldDatabase.PQuery("SELECT `id`, `delay`, `command`, `datalong`, `datalong2`, `buddy_entry`, `search_radius`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o` FROM `db_scripts` WHERE `script_type` = %d ORDER BY `script_guid` ASC", type);
|
||||||
|
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
|
|
||||||
|
|
@ -2267,7 +2267,7 @@ void ScriptMgr::LoadScriptBinding()
|
||||||
m_scriptBind[i].clear();
|
m_scriptBind[i].clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
QueryResult* result = WorldDatabase.PQuery("SELECT type, bind, ScriptName, data FROM script_binding");
|
QueryResult* result = WorldDatabase.PQuery("SELECT `type`, `bind`, `ScriptName`, `data` FROM `script_binding`");
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
|
|
@ -2396,7 +2396,7 @@ bool ScriptMgr::ReloadScriptBinding()
|
||||||
void ScriptMgr::LoadScriptNames()
|
void ScriptMgr::LoadScriptNames()
|
||||||
{
|
{
|
||||||
m_scriptNames.push_back("");
|
m_scriptNames.push_back("");
|
||||||
QueryResult* result = WorldDatabase.Query("SELECT DISTINCT(ScriptName) FROM script_binding");
|
QueryResult* result = WorldDatabase.Query("SELECT DISTINCT(`ScriptName`) FROM `script_binding`");
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -254,7 +254,7 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket)
|
||||||
|
|
||||||
if (pItem->HasFlag(ITEM_FIELD_FLAGS, ITEM_DYNFLAG_WRAPPED))// wrapped?
|
if (pItem->HasFlag(ITEM_FIELD_FLAGS, ITEM_DYNFLAG_WRAPPED))// wrapped?
|
||||||
{
|
{
|
||||||
QueryResult* result = CharacterDatabase.PQuery("SELECT entry, flags FROM character_gifts WHERE item_guid = '%u'", pItem->GetGUIDLow());
|
QueryResult* result = CharacterDatabase.PQuery("SELECT `entry`, `flags` FROM `character_gifts` WHERE `item_guid` = '%u'", pItem->GetGUIDLow());
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
Field* fields = result->Fetch();
|
Field* fields = result->Fetch();
|
||||||
|
|
@ -276,7 +276,7 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket)
|
||||||
|
|
||||||
static SqlStatementID delGifts ;
|
static SqlStatementID delGifts ;
|
||||||
|
|
||||||
SqlStatement stmt = CharacterDatabase.CreateStatement(delGifts, "DELETE FROM character_gifts WHERE item_guid = ?");
|
SqlStatement stmt = CharacterDatabase.CreateStatement(delGifts, "DELETE FROM `character_gifts` WHERE `item_guid` = ?");
|
||||||
stmt.PExecute(pItem->GetGUIDLow());
|
stmt.PExecute(pItem->GetGUIDLow());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@
|
||||||
|
|
||||||
void MapManager::LoadTransports()
|
void MapManager::LoadTransports()
|
||||||
{
|
{
|
||||||
QueryResult* result = WorldDatabase.Query("SELECT entry, name, period FROM transports");
|
QueryResult* result = WorldDatabase.Query("SELECT `entry`, `name`, `period` FROM `transports`");
|
||||||
|
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
|
|
||||||
|
|
@ -132,7 +132,7 @@ void MapManager::LoadTransports()
|
||||||
sLog.outString(">> Loaded %u transports", count);
|
sLog.outString(">> Loaded %u transports", count);
|
||||||
|
|
||||||
// check transport data DB integrity
|
// check transport data DB integrity
|
||||||
result = WorldDatabase.Query("SELECT gameobject.guid,gameobject.id,transports.name FROM gameobject,transports WHERE gameobject.id = transports.entry");
|
result = WorldDatabase.Query("SELECT `gameobject`.`guid`,`gameobject`.`id`,`transports`.`name` FROM `gameobject`,`transports` WHERE `gameobject`.`id` = `transports`.`entry`");
|
||||||
if (result) // wrong data found
|
if (result) // wrong data found
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,7 @@ void WaypointManager::Load()
|
||||||
// creature_movement
|
// creature_movement
|
||||||
// /////////////////////////////////////////////////////
|
// /////////////////////////////////////////////////////
|
||||||
|
|
||||||
QueryResult* result = WorldDatabase.Query("SELECT id, COUNT(point) FROM creature_movement GROUP BY id");
|
QueryResult* result = WorldDatabase.Query("SELECT `id`, COUNT(`point`) FROM `creature_movement` GROUP BY `id`");
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
|
|
@ -116,9 +116,9 @@ void WaypointManager::Load()
|
||||||
delete result;
|
delete result;
|
||||||
|
|
||||||
// 0 1 2 3 4 5 6
|
// 0 1 2 3 4 5 6
|
||||||
result = WorldDatabase.Query("SELECT id, point, position_x, position_y, position_z, waittime, script_id,"
|
result = WorldDatabase.Query("SELECT `id`, `point`, `position_x`, `position_y`, `position_z`, `waittime`, `script_id`,"
|
||||||
// 7 8 9 10 11 12 13 14 15 16
|
// 7 8 9 10 11 12 13 14 15 16
|
||||||
"textid1, textid2, textid3, textid4, textid5, emote, spell, orientation, model1, model2 FROM creature_movement");
|
"`textid1`, `textid2`, `textid3`, `textid4`, `textid5`, `emote`, `spell`, `orientation`, `model1`, `model2` FROM `creature_movement`");
|
||||||
|
|
||||||
BarGoLink barRow((int)result->GetRowCount());
|
BarGoLink barRow((int)result->GetRowCount());
|
||||||
|
|
||||||
|
|
@ -157,7 +157,7 @@ void WaypointManager::Load()
|
||||||
// prevent using invalid coordinates
|
// prevent using invalid coordinates
|
||||||
if (!MaNGOS::IsValidMapCoord(node.x, node.y, node.z, node.orientation))
|
if (!MaNGOS::IsValidMapCoord(node.x, node.y, node.z, node.orientation))
|
||||||
{
|
{
|
||||||
QueryResult* result1 = WorldDatabase.PQuery("SELECT id, map FROM creature WHERE guid = '%u'", id);
|
QueryResult* result1 = WorldDatabase.PQuery("SELECT `id`, `map` FROM `creature` WHERE `guid` = '%u'", id);
|
||||||
if (result1)
|
if (result1)
|
||||||
sLog.outErrorDb("Creature (guidlow %d, entry %d) have invalid coordinates in his waypoint %d (X: %f, Y: %f).",
|
sLog.outErrorDb("Creature (guidlow %d, entry %d) have invalid coordinates in his waypoint %d (X: %f, Y: %f).",
|
||||||
id, result1->Fetch()[0].GetUInt32(), point, node.x, node.y);
|
id, result1->Fetch()[0].GetUInt32(), point, node.x, node.y);
|
||||||
|
|
@ -174,7 +174,7 @@ void WaypointManager::Load()
|
||||||
delete result1;
|
delete result1;
|
||||||
}
|
}
|
||||||
|
|
||||||
WorldDatabase.PExecute("UPDATE creature_movement SET position_x = '%f', position_y = '%f', position_z = '%f' WHERE id = '%u' AND point = '%u'", node.x, node.y, node.z, id, point);
|
WorldDatabase.PExecute("UPDATE `creature_movement` SET `position_x` = '%f', `position_y` = '%f', `position_z` = '%f' WHERE `id` = '%u' AND `point` = '%u'", node.x, node.y, node.z, id, point);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (node.script_id)
|
if (node.script_id)
|
||||||
|
|
@ -259,7 +259,7 @@ void WaypointManager::Load()
|
||||||
// creature_movement_template
|
// creature_movement_template
|
||||||
// /////////////////////////////////////////////////////
|
// /////////////////////////////////////////////////////
|
||||||
|
|
||||||
result = WorldDatabase.Query("SELECT entry, COUNT(point) FROM creature_movement_template GROUP BY entry");
|
result = WorldDatabase.Query("SELECT `entry`, COUNT(`point`) FROM `creature_movement_template` GROUP BY `entry`");
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
|
|
@ -293,9 +293,9 @@ void WaypointManager::Load()
|
||||||
sLog.outString(">> Path templates loaded");
|
sLog.outString(">> Path templates loaded");
|
||||||
|
|
||||||
// 0 1 2 3 4 5 6
|
// 0 1 2 3 4 5 6
|
||||||
result = WorldDatabase.Query("SELECT entry, point, position_x, position_y, position_z, waittime, script_id,"
|
result = WorldDatabase.Query("SELECT `entry`, `point`, `position_x`, `position_y`, `position_z`, `waittime`, `script_id`,"
|
||||||
// 7 8 9 10 11 12 13 14 15 16
|
// 7 8 9 10 11 12 13 14 15 16
|
||||||
"textid1, textid2, textid3, textid4, textid5, emote, spell, orientation, model1, model2 FROM creature_movement_template");
|
"`textid1`, `textid2`, `textid3`, `textid4`, `textid5`, `emote`, `spell`, `orientation`, `model1`, `model2` FROM `creature_movement_template`");
|
||||||
|
|
||||||
BarGoLink bar(result->GetRowCount());
|
BarGoLink bar(result->GetRowCount());
|
||||||
|
|
||||||
|
|
@ -337,7 +337,7 @@ void WaypointManager::Load()
|
||||||
sLog.outErrorDb("Table creature_movement_template for entry %u (point %u) are auto corrected to normalized position_x=%f, position_y=%f",
|
sLog.outErrorDb("Table creature_movement_template for entry %u (point %u) are auto corrected to normalized position_x=%f, position_y=%f",
|
||||||
entry, point, node.x, node.y);
|
entry, point, node.x, node.y);
|
||||||
|
|
||||||
WorldDatabase.PExecute("UPDATE creature_movement_template SET position_x = '%f', position_y = '%f' WHERE entry = %u AND point = %u", node.x, node.y, entry, point);
|
WorldDatabase.PExecute("UPDATE `creature_movement_template` SET `position_x` = '%f', `position_y` = '%f' WHERE `entry` = %u AND `point` = %u", node.x, node.y, entry, point);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (node.script_id)
|
if (node.script_id)
|
||||||
|
|
@ -504,10 +504,10 @@ WaypointNode const* WaypointManager::AddNode(uint32 entry, uint32 dbGuid, uint32
|
||||||
for (WaypointPath::reverse_iterator rItr = path.rbegin(); rItr != path.rend() && rItr->first > pointId; ++rItr)
|
for (WaypointPath::reverse_iterator rItr = path.rbegin(); rItr != path.rend() && rItr->first > pointId; ++rItr)
|
||||||
{
|
{
|
||||||
if (rItr->first <= nextPoint)
|
if (rItr->first <= nextPoint)
|
||||||
WorldDatabase.PExecuteLog("UPDATE %s SET point=point+1 WHERE %s=%u AND point=%u", table, key_field, key, rItr->first - 1);
|
WorldDatabase.PExecuteLog("UPDATE `%s` SET `point`=`point`+1 WHERE `%s`=%u AND `point`=%u", table, key_field, key, rItr->first - 1);
|
||||||
}
|
}
|
||||||
// Insert new Point to database
|
// Insert new Point to database
|
||||||
WorldDatabase.PExecuteLog("INSERT INTO %s (%s,point,position_x,position_y,position_z,orientation) VALUES (%u,%u, %f,%f,%f, 100)", table, key_field, key, pointId, x, y, z);
|
WorldDatabase.PExecuteLog("INSERT INTO `%s` (`%s`,`point`,`position_x`,`position_y`,`position_z`,`orientation`) VALUES (%u,%u, %f,%f,%f, 100)", table, key_field, key, pointId, x, y, z);
|
||||||
|
|
||||||
return &path[pointId];
|
return &path[pointId];
|
||||||
}
|
}
|
||||||
|
|
@ -529,14 +529,14 @@ void WaypointManager::DeleteNode(uint32 entry, uint32 dbGuid, uint32 point, int3
|
||||||
char const* const table = wpOrigin == PATH_FROM_GUID ? "creature_movement" : "creature_movement_template";
|
char const* const table = wpOrigin == PATH_FROM_GUID ? "creature_movement" : "creature_movement_template";
|
||||||
char const* const key_field = wpOrigin == PATH_FROM_GUID ? "id" : "entry";
|
char const* const key_field = wpOrigin == PATH_FROM_GUID ? "id" : "entry";
|
||||||
uint32 const key = wpOrigin == PATH_FROM_GUID ? dbGuid : entry;
|
uint32 const key = wpOrigin == PATH_FROM_GUID ? dbGuid : entry;
|
||||||
WorldDatabase.PExecuteLog("DELETE FROM %s WHERE %s=%u AND point=%u", table, key_field, key, point);
|
WorldDatabase.PExecuteLog("DELETE FROM `%s` WHERE `%s`=%u AND `point`=%u", table, key_field, key, point);
|
||||||
|
|
||||||
path->erase(point);
|
path->erase(point);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointManager::DeletePath(uint32 id)
|
void WaypointManager::DeletePath(uint32 id)
|
||||||
{
|
{
|
||||||
WorldDatabase.PExecuteLog("DELETE FROM creature_movement WHERE id=%u", id);
|
WorldDatabase.PExecuteLog("DELETE FROM `creature_movement` WHERE `id`=%u", id);
|
||||||
WaypointPathMap::iterator itr = m_pathMap.find(id);
|
WaypointPathMap::iterator itr = m_pathMap.find(id);
|
||||||
if (itr != m_pathMap.end())
|
if (itr != m_pathMap.end())
|
||||||
_clearPath(itr->second);
|
_clearPath(itr->second);
|
||||||
|
|
@ -563,7 +563,7 @@ void WaypointManager::SetNodePosition(uint32 entry, uint32 dbGuid, uint32 point,
|
||||||
char const* const table = wpOrigin == PATH_FROM_GUID ? "creature_movement" : "creature_movement_template";
|
char const* const table = wpOrigin == PATH_FROM_GUID ? "creature_movement" : "creature_movement_template";
|
||||||
char const* const key_field = wpOrigin == PATH_FROM_GUID ? "id" : "entry";
|
char const* const key_field = wpOrigin == PATH_FROM_GUID ? "id" : "entry";
|
||||||
uint32 const key = wpOrigin == PATH_FROM_GUID ? dbGuid : entry;
|
uint32 const key = wpOrigin == PATH_FROM_GUID ? dbGuid : entry;
|
||||||
WorldDatabase.PExecuteLog("UPDATE %s SET position_x=%f, position_y=%f, position_z=%f WHERE %s=%u AND point=%u", table, x, y, z, key_field, key, point);
|
WorldDatabase.PExecuteLog("UPDATE `%s` SET `position_x`=%f, `position_y`=%f, `position_z`=%f WHERE `%s`=%u AND `point`=%u", table, x, y, z, key_field, key, point);
|
||||||
|
|
||||||
WaypointPath::iterator find = path->find(point);
|
WaypointPath::iterator find = path->find(point);
|
||||||
if (find != path->end())
|
if (find != path->end())
|
||||||
|
|
@ -591,7 +591,7 @@ void WaypointManager::SetNodeWaittime(uint32 entry, uint32 dbGuid, uint32 point,
|
||||||
char const* const table = wpOrigin == PATH_FROM_GUID ? "creature_movement" : "creature_movement_template";
|
char const* const table = wpOrigin == PATH_FROM_GUID ? "creature_movement" : "creature_movement_template";
|
||||||
char const* const key_field = wpOrigin == PATH_FROM_GUID ? "id" : "entry";
|
char const* const key_field = wpOrigin == PATH_FROM_GUID ? "id" : "entry";
|
||||||
uint32 const key = wpOrigin == PATH_FROM_GUID ? dbGuid : entry;
|
uint32 const key = wpOrigin == PATH_FROM_GUID ? dbGuid : entry;
|
||||||
WorldDatabase.PExecuteLog("UPDATE %s SET waittime=%u WHERE %s=%u AND point=%u", table, waittime, key_field, key, point);
|
WorldDatabase.PExecuteLog("UPDATE `%s` SET `waittime`=%u WHERE `%s`=%u AND `point`=%u", table, waittime, key_field, key, point);
|
||||||
|
|
||||||
WaypointPath::iterator find = path->find(point);
|
WaypointPath::iterator find = path->find(point);
|
||||||
if (find != path->end())
|
if (find != path->end())
|
||||||
|
|
@ -615,7 +615,7 @@ void WaypointManager::SetNodeOrientation(uint32 entry, uint32 dbGuid, uint32 poi
|
||||||
char const* const table = wpOrigin == PATH_FROM_GUID ? "creature_movement" : "creature_movement_template";
|
char const* const table = wpOrigin == PATH_FROM_GUID ? "creature_movement" : "creature_movement_template";
|
||||||
char const* const key_field = wpOrigin == PATH_FROM_GUID ? "id" : "entry";
|
char const* const key_field = wpOrigin == PATH_FROM_GUID ? "id" : "entry";
|
||||||
uint32 const key = wpOrigin == PATH_FROM_GUID ? dbGuid : entry;
|
uint32 const key = wpOrigin == PATH_FROM_GUID ? dbGuid : entry;
|
||||||
WorldDatabase.PExecuteLog("UPDATE %s SET orientation=%f WHERE %s=%u AND point=%u", table, orientation, key_field, key, point);
|
WorldDatabase.PExecuteLog("UPDATE `%s` SET `orientation`=%f WHERE `%s`=%u AND `point`=%u", table, orientation, key_field, key, point);
|
||||||
|
|
||||||
WaypointPath::iterator find = path->find(point);
|
WaypointPath::iterator find = path->find(point);
|
||||||
if (find != path->end())
|
if (find != path->end())
|
||||||
|
|
@ -640,7 +640,7 @@ bool WaypointManager::SetNodeScriptId(uint32 entry, uint32 dbGuid, uint32 point,
|
||||||
char const* const table = wpOrigin == PATH_FROM_GUID ? "creature_movement" : "creature_movement_template";
|
char const* const table = wpOrigin == PATH_FROM_GUID ? "creature_movement" : "creature_movement_template";
|
||||||
char const* const key_field = wpOrigin == PATH_FROM_GUID ? "id" : "entry";
|
char const* const key_field = wpOrigin == PATH_FROM_GUID ? "id" : "entry";
|
||||||
uint32 const key = wpOrigin == PATH_FROM_GUID ? dbGuid : entry;
|
uint32 const key = wpOrigin == PATH_FROM_GUID ? dbGuid : entry;
|
||||||
WorldDatabase.PExecuteLog("UPDATE %s SET script_id=%u WHERE %s=%u AND point=%u", table, scriptId, key_field, key, point);
|
WorldDatabase.PExecuteLog("UPDATE `%s` SET `script_id`=%u WHERE `%s`=%u AND `point`=%u", table, scriptId, key_field, key, point);
|
||||||
|
|
||||||
WaypointPath::iterator find = path->find(point);
|
WaypointPath::iterator find = path->find(point);
|
||||||
if (find != path->end())
|
if (find != path->end())
|
||||||
|
|
|
||||||
|
|
@ -509,7 +509,7 @@ void WeatherMgr::LoadWeatherZoneChances()
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
|
|
||||||
// 0 1 2 3 4 5 6 7 8 9 10 11 12
|
// 0 1 2 3 4 5 6 7 8 9 10 11 12
|
||||||
QueryResult* result = WorldDatabase.Query("SELECT zone, spring_rain_chance, spring_snow_chance, spring_storm_chance, summer_rain_chance, summer_snow_chance, summer_storm_chance, fall_rain_chance, fall_snow_chance, fall_storm_chance, winter_rain_chance, winter_snow_chance, winter_storm_chance FROM game_weather");
|
QueryResult* result = WorldDatabase.Query("SELECT `zone`, `spring_rain_chance`, `spring_snow_chance`, `spring_storm_chance`, `summer_rain_chance`, `summer_snow_chance`, `summer_storm_chance`, `fall_rain_chance`, `fall_snow_chance`, `fall_storm_chance`, `winter_rain_chance`, `winter_snow_chance`, `winter_storm_chance` FROM `game_weather`");
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -342,7 +342,7 @@ World::AddSession_(WorldSession* s)
|
||||||
|
|
||||||
static SqlStatementID id;
|
static SqlStatementID id;
|
||||||
|
|
||||||
SqlStatement stmt = LoginDatabase.CreateStatement(id, "UPDATE realmlist SET population = ? WHERE id = ?");
|
SqlStatement stmt = LoginDatabase.CreateStatement(id, "UPDATE `realmlist` SET `population` = ? WHERE `id` = ?");
|
||||||
stmt.PExecute(popu, realmID);
|
stmt.PExecute(popu, realmID);
|
||||||
|
|
||||||
DETAIL_LOG("Server Population (%f).", popu);
|
DETAIL_LOG("Server Population (%f).", popu);
|
||||||
|
|
@ -1081,10 +1081,10 @@ void World::SetInitialWorldSettings()
|
||||||
// not send custom type REALM_FFA_PVP to realm list
|
// not send custom type REALM_FFA_PVP to realm list
|
||||||
uint32 server_type = IsFFAPvPRealm() ? uint32(REALM_TYPE_PVP) : getConfig(CONFIG_UINT32_GAME_TYPE);
|
uint32 server_type = IsFFAPvPRealm() ? uint32(REALM_TYPE_PVP) : getConfig(CONFIG_UINT32_GAME_TYPE);
|
||||||
uint32 realm_zone = getConfig(CONFIG_UINT32_REALM_ZONE);
|
uint32 realm_zone = getConfig(CONFIG_UINT32_REALM_ZONE);
|
||||||
LoginDatabase.PExecute("UPDATE realmlist SET icon = %u, timezone = %u WHERE id = '%u'", server_type, realm_zone, realmID);
|
LoginDatabase.PExecute("UPDATE `realmlist` SET `icon` = %u, `timezone` = %u WHERE `id` = '%u'", server_type, realm_zone, realmID);
|
||||||
|
|
||||||
///- Remove the bones (they should not exist in DB though) and old corpses after a restart
|
///- Remove the bones (they should not exist in DB though) and old corpses after a restart
|
||||||
CharacterDatabase.PExecute("DELETE FROM corpse WHERE corpse_type = '0' OR time < (UNIX_TIMESTAMP()-'%u')", 3 * DAY);
|
CharacterDatabase.PExecute("DELETE FROM `corpse` WHERE `corpse_type` = '0' OR `time` < (UNIX_TIMESTAMP()-'%u')", 3 * DAY);
|
||||||
|
|
||||||
///- Load the DBC and DB2 files
|
///- Load the DBC and DB2 files
|
||||||
|
|
||||||
|
|
@ -1514,7 +1514,7 @@ void World::SetInitialWorldSettings()
|
||||||
sprintf(isoDate, "%04d-%02d-%02d %02d:%02d:%02d",
|
sprintf(isoDate, "%04d-%02d-%02d %02d:%02d:%02d",
|
||||||
local.tm_year + 1900, local.tm_mon + 1, local.tm_mday, local.tm_hour, local.tm_min, local.tm_sec);
|
local.tm_year + 1900, local.tm_mon + 1, local.tm_mday, local.tm_hour, local.tm_min, local.tm_sec);
|
||||||
|
|
||||||
LoginDatabase.PExecute("INSERT INTO uptime (realmid, starttime, startstring, uptime) VALUES('%u', " UI64FMTD ", '%s', 0)",
|
LoginDatabase.PExecute("INSERT INTO `uptime` (`realmid`, `starttime`, `startstring`, `uptime`) VALUES('%u', " UI64FMTD ", '%s', 0)",
|
||||||
realmID, uint64(m_startTime), isoDate);
|
realmID, uint64(m_startTime), isoDate);
|
||||||
|
|
||||||
m_timers[WUPDATE_AUCTIONS].SetInterval(MINUTE * IN_MILLISECONDS);
|
m_timers[WUPDATE_AUCTIONS].SetInterval(MINUTE * IN_MILLISECONDS);
|
||||||
|
|
@ -1588,7 +1588,7 @@ void World::SetInitialWorldSettings()
|
||||||
sLog.outString();
|
sLog.outString();
|
||||||
|
|
||||||
sLog.outString("Deleting expired bans...");
|
sLog.outString("Deleting expired bans...");
|
||||||
LoginDatabase.Execute("DELETE FROM ip_banned WHERE unbandate<=UNIX_TIMESTAMP() AND unbandate<>bandate");
|
LoginDatabase.Execute("DELETE FROM `ip_banned` WHERE `unbandate`<=UNIX_TIMESTAMP() AND `unbandate`<>`bandate`");
|
||||||
sLog.outString();
|
sLog.outString();
|
||||||
|
|
||||||
sLog.outString("Calculate next daily quest and dungeon reset time...");
|
sLog.outString("Calculate next daily quest and dungeon reset time...");
|
||||||
|
|
@ -1869,7 +1869,7 @@ void World::Update(uint32 diff)
|
||||||
uint32 maxClientsNum = GetMaxActiveSessionCount();
|
uint32 maxClientsNum = GetMaxActiveSessionCount();
|
||||||
|
|
||||||
m_timers[WUPDATE_UPTIME].Reset();
|
m_timers[WUPDATE_UPTIME].Reset();
|
||||||
LoginDatabase.PExecute("UPDATE uptime SET uptime = %u, maxplayers = %u WHERE realmid = %u AND starttime = " UI64FMTD, tmpDiff, maxClientsNum, realmID, uint64(m_startTime));
|
LoginDatabase.PExecute("UPDATE `uptime` SET `uptime` = %u, `maxplayers` = %u WHERE `realmid` = %u AND `starttime` = " UI64FMTD, tmpDiff, maxClientsNum, realmID, uint64(m_startTime));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <li> Handle all other objects
|
/// <li> Handle all other objects
|
||||||
|
|
@ -2113,16 +2113,16 @@ BanReturn World::BanAccount(BanMode mode, std::string nameOrIP, uint32 duration_
|
||||||
{
|
{
|
||||||
case BAN_IP:
|
case BAN_IP:
|
||||||
// No SQL injection as strings are escaped
|
// No SQL injection as strings are escaped
|
||||||
resultAccounts = LoginDatabase.PQuery("SELECT id FROM account WHERE last_ip = '%s'", nameOrIP.c_str());
|
resultAccounts = LoginDatabase.PQuery("SELECT `id` FROM `account` WHERE `last_ip` = '%s'", nameOrIP.c_str());
|
||||||
LoginDatabase.PExecute("INSERT INTO ip_banned VALUES ('%s',UNIX_TIMESTAMP(),UNIX_TIMESTAMP()+%u,'%s','%s')", nameOrIP.c_str(), duration_secs, safe_author.c_str(), reason.c_str());
|
LoginDatabase.PExecute("INSERT INTO `ip_banned` VALUES ('%s',UNIX_TIMESTAMP(),UNIX_TIMESTAMP()+%u,'%s','%s')", nameOrIP.c_str(), duration_secs, safe_author.c_str(), reason.c_str());
|
||||||
break;
|
break;
|
||||||
case BAN_ACCOUNT:
|
case BAN_ACCOUNT:
|
||||||
// No SQL injection as string is escaped
|
// No SQL injection as string is escaped
|
||||||
resultAccounts = LoginDatabase.PQuery("SELECT id FROM account WHERE username = '%s'", nameOrIP.c_str());
|
resultAccounts = LoginDatabase.PQuery("SELECT `id` FROM `account` WHERE `username` = '%s'", nameOrIP.c_str());
|
||||||
break;
|
break;
|
||||||
case BAN_CHARACTER:
|
case BAN_CHARACTER:
|
||||||
// No SQL injection as string is escaped
|
// No SQL injection as string is escaped
|
||||||
resultAccounts = CharacterDatabase.PQuery("SELECT account FROM characters WHERE name = '%s'", nameOrIP.c_str());
|
resultAccounts = CharacterDatabase.PQuery("SELECT `account` FROM `characters` WHERE `name` = '%s'", nameOrIP.c_str());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return BAN_SYNTAX_ERROR;
|
return BAN_SYNTAX_ERROR;
|
||||||
|
|
@ -2149,7 +2149,7 @@ BanReturn World::BanAccount(BanMode mode, std::string nameOrIP, uint32 duration_
|
||||||
if (mode != BAN_IP)
|
if (mode != BAN_IP)
|
||||||
{
|
{
|
||||||
// No SQL injection as strings are escaped
|
// No SQL injection as strings are escaped
|
||||||
LoginDatabase.PExecute("INSERT INTO account_banned VALUES ('%u', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()+%u, '%s', '%s', '1')",
|
LoginDatabase.PExecute("INSERT INTO `account_banned` VALUES ('%u', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()+%u, '%s', '%s', '1')",
|
||||||
account, duration_secs, safe_author.c_str(), reason.c_str());
|
account, duration_secs, safe_author.c_str(), reason.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2170,7 +2170,7 @@ bool World::RemoveBanAccount(BanMode mode, std::string nameOrIP)
|
||||||
if (mode == BAN_IP)
|
if (mode == BAN_IP)
|
||||||
{
|
{
|
||||||
LoginDatabase.escape_string(nameOrIP);
|
LoginDatabase.escape_string(nameOrIP);
|
||||||
LoginDatabase.PExecute("DELETE FROM ip_banned WHERE ip = '%s'", nameOrIP.c_str());
|
LoginDatabase.PExecute("DELETE FROM `ip_banned` WHERE `ip` = '%s'", nameOrIP.c_str());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -2190,7 +2190,7 @@ bool World::RemoveBanAccount(BanMode mode, std::string nameOrIP)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NO SQL injection as account is uint32
|
// NO SQL injection as account is uint32
|
||||||
LoginDatabase.PExecute("UPDATE account_banned SET active = '0' WHERE id = '%u'", account);
|
LoginDatabase.PExecute("UPDATE `account_banned` SET `active` = '0' WHERE `id` = '%u'", account);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -2385,7 +2385,7 @@ void World::UpdateResultQueue()
|
||||||
void World::UpdateRealmCharCount(uint32 accountId)
|
void World::UpdateRealmCharCount(uint32 accountId)
|
||||||
{
|
{
|
||||||
CharacterDatabase.AsyncPQuery(this, &World::_UpdateRealmCharCount, accountId,
|
CharacterDatabase.AsyncPQuery(this, &World::_UpdateRealmCharCount, accountId,
|
||||||
"SELECT COUNT(guid) FROM characters WHERE account = '%u'", accountId);
|
"SELECT COUNT(`guid`) FROM `characters` WHERE `account` = '%u'", accountId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void World::_UpdateRealmCharCount(QueryResult* resultCharCount, uint32 accountId)
|
void World::_UpdateRealmCharCount(QueryResult* resultCharCount, uint32 accountId)
|
||||||
|
|
@ -2397,8 +2397,8 @@ void World::_UpdateRealmCharCount(QueryResult* resultCharCount, uint32 accountId
|
||||||
delete resultCharCount;
|
delete resultCharCount;
|
||||||
|
|
||||||
LoginDatabase.BeginTransaction();
|
LoginDatabase.BeginTransaction();
|
||||||
LoginDatabase.PExecute("DELETE FROM realmcharacters WHERE acctid= '%u' AND realmid = '%u'", accountId, realmID);
|
LoginDatabase.PExecute("DELETE FROM `realmcharacters` WHERE `acctid`= '%u' AND `realmid` = '%u'", accountId, realmID);
|
||||||
LoginDatabase.PExecute("INSERT INTO realmcharacters (numchars, acctid, realmid) VALUES (%u, %u, %u)", charCount, accountId, realmID);
|
LoginDatabase.PExecute("INSERT INTO `realmcharacters` (`numchars`, `acctid`, `realmid`) VALUES (%u, %u, %u)", charCount, accountId, realmID);
|
||||||
LoginDatabase.CommitTransaction();
|
LoginDatabase.CommitTransaction();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2654,7 +2654,7 @@ void World::SetPlayerLimit(int32 limit, bool needUpdate)
|
||||||
m_playerLimit = limit;
|
m_playerLimit = limit;
|
||||||
|
|
||||||
if (db_update_need)
|
if (db_update_need)
|
||||||
LoginDatabase.PExecute("UPDATE realmlist SET allowedSecurityLevel = '%u' WHERE id = '%u'",
|
LoginDatabase.PExecute("UPDATE `realmlist` SET `allowedSecurityLevel` = '%u' WHERE `id` = '%u'",
|
||||||
uint32(GetPlayerSecurityLimit()), realmID);
|
uint32(GetPlayerSecurityLimit()), realmID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2666,7 +2666,7 @@ void World::UpdateMaxSessionCounters()
|
||||||
|
|
||||||
void World::LoadDBVersion()
|
void World::LoadDBVersion()
|
||||||
{
|
{
|
||||||
QueryResult* result = WorldDatabase.Query("SELECT version, structure, content FROM db_version ORDER BY version DESC, structure DESC, content DESC LIMIT 1");
|
QueryResult* result = WorldDatabase.Query("SELECT `version`, `structure`, `content` FROM `db_version` ORDER BY `version` DESC, `structure` DESC, `content` DESC LIMIT 1");
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
Field* fields = result->Fetch();
|
Field* fields = result->Fetch();
|
||||||
|
|
|
||||||
|
|
@ -81,12 +81,12 @@ static void clear_online_accounts()
|
||||||
{
|
{
|
||||||
// Cleanup online status for characters hosted at current realm
|
// Cleanup online status for characters hosted at current realm
|
||||||
/// \todo Only accounts with characters logged on *this* realm should have online status reset. Move the online column from 'account' to 'realmcharacters'?
|
/// \todo Only accounts with characters logged on *this* realm should have online status reset. Move the online column from 'account' to 'realmcharacters'?
|
||||||
LoginDatabase.PExecute("UPDATE account SET active_realm_id = 0, os = '' WHERE active_realm_id = '%u'", realmID);
|
LoginDatabase.PExecute("UPDATE `account` SET `active_realm_id` = 0, `os` = '' WHERE `active_realm_id` = '%u'", realmID);
|
||||||
|
|
||||||
CharacterDatabase.Execute("UPDATE characters SET online = 0 WHERE online<>0");
|
CharacterDatabase.Execute("UPDATE `characters` SET `online` = 0 WHERE `online`<>0");
|
||||||
|
|
||||||
// Battleground instance ids reset at server restart
|
// Battleground instance ids reset at server restart
|
||||||
CharacterDatabase.Execute("UPDATE character_battleground_data SET instance_id = 0");
|
CharacterDatabase.Execute("UPDATE `character_battleground_data` SET `instance_id` = 0");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -411,7 +411,7 @@ int main(int argc, char** argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
///- Set Realm to Offline, if crash happens. Only used once.
|
///- Set Realm to Offline, if crash happens. Only used once.
|
||||||
LoginDatabase.DirectPExecute("UPDATE realmlist SET realmflags = realmflags | %u WHERE id = '%u'", REALM_FLAG_OFFLINE, realmID);
|
LoginDatabase.DirectPExecute("UPDATE `realmlist` SET `realmflags` = `realmflags` | %u WHERE `id` = '%u'", REALM_FLAG_OFFLINE, realmID);
|
||||||
|
|
||||||
initMTRandTSS();
|
initMTRandTSS();
|
||||||
|
|
||||||
|
|
@ -425,7 +425,7 @@ int main(int argc, char** argv)
|
||||||
// set realmbuilds depend on mangosd expected builds, and set server online
|
// set realmbuilds depend on mangosd expected builds, and set server online
|
||||||
std::string builds = AcceptableClientBuildsListStr();
|
std::string builds = AcceptableClientBuildsListStr();
|
||||||
LoginDatabase.escape_string(builds);
|
LoginDatabase.escape_string(builds);
|
||||||
LoginDatabase.DirectPExecute("UPDATE realmlist SET realmflags = realmflags & ~(%u), population = 0, realmbuilds = '%s' WHERE id = '%u'", REALM_FLAG_OFFLINE, builds.c_str(), realmID);
|
LoginDatabase.DirectPExecute("UPDATE `realmlist` SET `realmflags` = `realmflags` & ~(%u), `population` = 0, `realmbuilds` = '%s' WHERE `id` = '%u'", REALM_FLAG_OFFLINE, builds.c_str(), realmID);
|
||||||
|
|
||||||
// server loaded successfully => enable async DB requests
|
// server loaded successfully => enable async DB requests
|
||||||
// this is done to forbid any async transactions during server startup!
|
// this is done to forbid any async transactions during server startup!
|
||||||
|
|
@ -534,7 +534,7 @@ int main(int argc, char** argv)
|
||||||
unhook_signals();
|
unhook_signals();
|
||||||
|
|
||||||
///- Set server offline in realmlist
|
///- Set server offline in realmlist
|
||||||
LoginDatabase.DirectPExecute("UPDATE realmlist SET realmflags = realmflags | %u WHERE id = '%u'", REALM_FLAG_OFFLINE, realmID);
|
LoginDatabase.DirectPExecute("UPDATE `realmlist` SET `realmflags` = `realmflags` | %u WHERE `id` = '%u'", REALM_FLAG_OFFLINE, realmID);
|
||||||
|
|
||||||
///- Clean account database before leaving
|
///- Clean account database before leaving
|
||||||
clear_online_accounts();
|
clear_online_accounts();
|
||||||
|
|
|
||||||
|
|
@ -539,7 +539,7 @@ bool Database::CheckDatabaseVersion(DatabaseTypes database)
|
||||||
const DBVersion& dbversion = databaseVersions[database];
|
const DBVersion& dbversion = databaseVersions[database];
|
||||||
|
|
||||||
// Fetch the database version table information
|
// Fetch the database version table information
|
||||||
QueryResult* result = Query("SELECT version, structure, content, description FROM db_version ORDER BY version DESC, structure DESC, content DESC LIMIT 1");
|
QueryResult* result = Query("SELECT `version`, `structure`, `content`, `description` FROM `db_version` ORDER BY `version` DESC, `structure` DESC, `content` DESC LIMIT 1");
|
||||||
|
|
||||||
// db_version table does not exist or is empty
|
// db_version table does not exist or is empty
|
||||||
if (!result)
|
if (!result)
|
||||||
|
|
|
||||||
|
|
@ -240,7 +240,7 @@ template<class DerivedLoader, class StorageClass>
|
||||||
void SQLStorageLoaderBase<DerivedLoader, StorageClass>::Load(StorageClass& store, bool error_at_empty /*= true*/)
|
void SQLStorageLoaderBase<DerivedLoader, StorageClass>::Load(StorageClass& store, bool error_at_empty /*= true*/)
|
||||||
{
|
{
|
||||||
Field* fields = NULL;
|
Field* fields = NULL;
|
||||||
QueryResult* result = WorldDatabase.PQuery("SELECT MAX(%s) FROM %s", store.EntryFieldName(), store.GetTableName());
|
QueryResult* result = WorldDatabase.PQuery("SELECT MAX(`%s`) FROM `%s`", store.EntryFieldName(), store.GetTableName());
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
sLog.outError("Error loading %s table (not exist?)\n", store.GetTableName());
|
sLog.outError("Error loading %s table (not exist?)\n", store.GetTableName());
|
||||||
|
|
@ -253,7 +253,7 @@ void SQLStorageLoaderBase<DerivedLoader, StorageClass>::Load(StorageClass& store
|
||||||
uint32 recordsize = 0;
|
uint32 recordsize = 0;
|
||||||
delete result;
|
delete result;
|
||||||
|
|
||||||
result = WorldDatabase.PQuery("SELECT COUNT(*) FROM %s", store.GetTableName());
|
result = WorldDatabase.PQuery("SELECT COUNT(*) FROM `%s`", store.GetTableName());
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
fields = result->Fetch();
|
fields = result->Fetch();
|
||||||
|
|
@ -261,7 +261,7 @@ void SQLStorageLoaderBase<DerivedLoader, StorageClass>::Load(StorageClass& store
|
||||||
delete result;
|
delete result;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = WorldDatabase.PQuery("SELECT * FROM %s", store.GetTableName());
|
result = WorldDatabase.PQuery("SELECT * FROM `%s`", store.GetTableName());
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue