aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsrc/server/game/Achievements/AchievementMgr.cpp26
-rwxr-xr-xsrc/server/game/Addons/AddonMgr.cpp9
-rwxr-xr-xsrc/server/game/Chat/Chat.h6
-rwxr-xr-xsrc/server/game/Chat/Commands/Level3.cpp66
-rwxr-xr-xsrc/server/game/Entities/GameObject/GameObject.cpp14
-rwxr-xr-xsrc/server/game/Entities/Pet/Pet.cpp27
-rwxr-xr-xsrc/server/game/Entities/Pet/Pet.h2
-rwxr-xr-xsrc/server/game/Entities/Player/Player.cpp157
-rwxr-xr-xsrc/server/game/Entities/Player/Player.h4
-rwxr-xr-xsrc/server/game/Groups/Group.cpp180
-rwxr-xr-xsrc/server/game/Instances/InstanceSaveMgr.cpp21
-rwxr-xr-xsrc/server/game/Server/WorldSocket.cpp21
-rwxr-xr-xsrc/server/game/Tickets/TicketMgr.cpp5
-rwxr-xr-xsrc/server/shared/Database/Implementation/CharacterDatabase.cpp26
-rwxr-xr-xsrc/server/shared/Database/Implementation/CharacterDatabase.h26
-rwxr-xr-xsrc/server/shared/Database/Implementation/LoginDatabase.cpp1
-rwxr-xr-xsrc/server/shared/Database/Implementation/LoginDatabase.h1
-rwxr-xr-xsrc/server/shared/Database/Implementation/WorldDatabase.cpp6
-rwxr-xr-xsrc/server/shared/Database/Implementation/WorldDatabase.h2
19 files changed, 447 insertions, 153 deletions
diff --git a/src/server/game/Achievements/AchievementMgr.cpp b/src/server/game/Achievements/AchievementMgr.cpp
index d22f4b94caa..030837b2649 100755
--- a/src/server/game/Achievements/AchievementMgr.cpp
+++ b/src/server/game/Achievements/AchievementMgr.cpp
@@ -619,7 +619,13 @@ void AchievementMgr::LoadFromDB(PreparedQueryResult achievementResult, PreparedQ
{
// we will remove not existed criteria for all characters
sLog->outError("Non-existing achievement criteria %u data removed from table `character_achievement_progress`.", id);
- CharacterDatabase.PExecute("DELETE FROM character_achievement_progress WHERE criteria = %u", id);
+
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_ACHIEV_PROGRESS_CRITERIA);
+
+ stmt->setUInt16(0, uint16(id));
+
+ CharacterDatabase.Execute(stmt);
+
continue;
}
@@ -2375,17 +2381,23 @@ void AchievementGlobalMgr::LoadCompletedAchievements()
{
Field* fields = result->Fetch();
- uint32 achievement_id = fields[0].GetUInt32();
- const AchievementEntry* achievement = sAchievementStore.LookupEntry(achievement_id);
+ uint32 achievementId = fields[0].GetUInt32();
+ const AchievementEntry* achievement = sAchievementStore.LookupEntry(achievementId);
if (!achievement)
{
- // we will remove not existed achievement for all characters
- sLog->outError("Non-existing achievement %u data removed from table `character_achievement`.", achievement_id);
- CharacterDatabase.PExecute("DELETE FROM character_achievement WHERE achievement = %u", achievement_id);
+ // Remove non existent achievements from all characters
+ sLog->outError("Non-existing achievement %u data removed from table `character_achievement`.", achievementId);
+
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_ACHIEVMENT);
+
+ stmt->setUInt16(0, uint16(achievementId));
+
+ CharacterDatabase.Execute(stmt);
+
continue;
}
else if (achievement->flags & (ACHIEVEMENT_FLAG_REALM_FIRST_REACH | ACHIEVEMENT_FLAG_REALM_FIRST_KILL))
- m_allCompletedAchievements.insert(achievement_id);
+ m_allCompletedAchievements.insert(achievementId);
} while (result->NextRow());
sLog->outString(">> Loaded %lu completed achievements in %u ms", (unsigned long)m_allCompletedAchievements.size(), GetMSTimeDiffToNow(oldMSTime));
diff --git a/src/server/game/Addons/AddonMgr.cpp b/src/server/game/Addons/AddonMgr.cpp
index 9d5bdd159f7..ff6d16bef4d 100755
--- a/src/server/game/Addons/AddonMgr.cpp
+++ b/src/server/game/Addons/AddonMgr.cpp
@@ -70,8 +70,13 @@ void LoadFromDB()
void SaveAddon(AddonInfo const& addon)
{
std::string name = addon.Name;
- CharacterDatabase.EscapeString(name);
- CharacterDatabase.PExecute("INSERT INTO addons (name, crc) VALUES ('%s', %u)", name.c_str(), addon.CRC);
+
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_ADD_ADDON);
+
+ stmt->setString(0, name);
+ stmt->setUInt32(1, addon.CRC);
+
+ CharacterDatabase.Execute(stmt);
m_knownAddons.push_back(SavedAddon(addon.Name, addon.CRC));
}
diff --git a/src/server/game/Chat/Chat.h b/src/server/game/Chat/Chat.h
index 95c244167f6..d9190265bbb 100755
--- a/src/server/game/Chat/Chat.h
+++ b/src/server/game/Chat/Chat.h
@@ -215,9 +215,9 @@ class ChatHandler
bool HandleResetAllCommand(const char * args);
bool HandleResetHonorCommand(const char * args);
bool HandleResetLevelCommand(const char * args);
- bool HandleResetSpellsCommand(const char * args);
+ bool HandleResetSpellsCommand(const char* args);
bool HandleResetStatsCommand(const char * args);
- bool HandleResetTalentsCommand(const char * args);
+ bool HandleResetTalentsCommand(const char* args);
bool HandleSendItemsCommand(const char* args);
bool HandleSendMailCommand(const char* args);
@@ -355,7 +355,7 @@ class ChatHandler
bool HandleBanHelper(BanMode mode, char const* args);
bool HandleBanInfoHelper(uint32 accountid, char const* accountname);
bool HandleUnBanHelper(BanMode mode, char const* args);
- void HandleCharacterLevel(Player* player, uint64 player_guid, uint32 oldlevel, uint32 newlevel);
+ void HandleCharacterLevel(Player* player, uint64 playerGuid, uint32 oldLevel, uint32 newLevel);
void HandleLearnSkillRecipesHelper(Player* player, uint32 skill_id);
// Stores informations about a deleted character
diff --git a/src/server/game/Chat/Commands/Level3.cpp b/src/server/game/Chat/Commands/Level3.cpp
index 43aa100e4b3..9b29483bcb4 100755
--- a/src/server/game/Chat/Commands/Level3.cpp
+++ b/src/server/game/Chat/Commands/Level3.cpp
@@ -2177,28 +2177,33 @@ bool ChatHandler::HandleHoverCommand(const char *args)
return true;
}
-void ChatHandler::HandleCharacterLevel(Player* player, uint64 player_guid, uint32 oldlevel, uint32 newlevel)
+void ChatHandler::HandleCharacterLevel(Player* player, uint64 playerGuid, uint32 oldLevel, uint32 newLevel)
{
if (player)
{
- player->GiveLevel(newlevel);
+ player->GiveLevel(newLevel);
player->InitTalentForLevel();
player->SetUInt32Value(PLAYER_XP, 0);
if (needReportToTarget(player))
{
- if (oldlevel == newlevel)
+ if (oldLevel == newLevel)
ChatHandler(player).PSendSysMessage(LANG_YOURS_LEVEL_PROGRESS_RESET, GetNameLink().c_str());
- else if (oldlevel < newlevel)
- ChatHandler(player).PSendSysMessage(LANG_YOURS_LEVEL_UP, GetNameLink().c_str(), newlevel);
+ else if (oldLevel < newLevel)
+ ChatHandler(player).PSendSysMessage(LANG_YOURS_LEVEL_UP, GetNameLink().c_str(), newLevel);
else // if (oldlevel > newlevel)
- ChatHandler(player).PSendSysMessage(LANG_YOURS_LEVEL_DOWN, GetNameLink().c_str(), newlevel);
+ ChatHandler(player).PSendSysMessage(LANG_YOURS_LEVEL_DOWN, GetNameLink().c_str(), newLevel);
}
}
else
{
- // 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, GUID_LOPART(player_guid));
+ // Update level and reset XP, everything else will be updated at login
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPDATE_LEVEL);
+
+ stmt->setUInt8(0, uint8(newLevel));
+ stmt->setUInt32(1, GUID_LOPART(playerGuid));
+
+ CharacterDatabase.Execute(stmt);
}
}
@@ -2562,12 +2567,12 @@ bool ChatHandler::HandleResetStatsCommand(const char * args)
return true;
}
-bool ChatHandler::HandleResetSpellsCommand(const char * args)
+bool ChatHandler::HandleResetSpellsCommand(const char* args)
{
Player* target;
- uint64 target_guid;
- std::string target_name;
- if (!extractPlayerTarget((char*)args, &target, &target_guid, &target_name))
+ uint64 targetGuid;
+ std::string targetName;
+ if (!extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
return false;
if (target)
@@ -2580,19 +2585,25 @@ bool ChatHandler::HandleResetSpellsCommand(const char * args)
}
else
{
- CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '%u' WHERE guid = '%u'", uint32(AT_LOGIN_RESET_SPELLS), GUID_LOPART(target_guid));
- PSendSysMessage(LANG_RESET_SPELLS_OFFLINE, target_name.c_str());
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPDATE_AT_LOGIN_FLAG);
+
+ stmt->setUInt16(0, uint16(AT_LOGIN_RESET_SPELLS));
+ stmt->setUInt32(1, GUID_LOPART(targetGuid));
+
+ CharacterDatabase.Execute(stmt);
+
+ PSendSysMessage(LANG_RESET_SPELLS_OFFLINE, targetName.c_str());
}
return true;
}
-bool ChatHandler::HandleResetTalentsCommand(const char * args)
+bool ChatHandler::HandleResetTalentsCommand(const char* args)
{
Player* target;
- uint64 target_guid;
- std::string target_name;
- if (!extractPlayerTarget((char*)args, &target, &target_guid, &target_name))
+ uint64 targetGuid;
+ std::string targetName;
+ if (!extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
{
// Try reset talents as Hunter Pet
Creature* creature = getSelectedCreature();
@@ -2630,11 +2641,16 @@ bool ChatHandler::HandleResetTalentsCommand(const char * args)
target->SendTalentsInfoData(true);
return true;
}
- else if (target_guid)
+ else if (targetGuid)
{
- uint32 at_flags = AT_LOGIN_NONE | AT_LOGIN_RESET_PET_TALENTS;
- CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '%u' WHERE guid = '%u'", at_flags, GUID_LOPART(target_guid));
- std::string nameLink = playerLink(target_name);
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPDATE_AT_LOGIN_FLAG);
+
+ stmt->setUInt16(0, uint16(AT_LOGIN_NONE | AT_LOGIN_RESET_PET_TALENTS));
+ stmt->setUInt32(1, GUID_LOPART(targetGuid));
+
+ CharacterDatabase.Execute(stmt);
+
+ std::string nameLink = playerLink(targetName);
PSendSysMessage(LANG_RESET_TALENTS_OFFLINE, nameLink.c_str());
return true;
}
@@ -2675,7 +2691,11 @@ bool ChatHandler::HandleResetAllCommand(const char * args)
return false;
}
- CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '%u' WHERE (at_login & '%u') = '0'", atLogin, atLogin);
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPDATE_ALL_AT_LOGIN_FLAGS);
+
+ stmt->setUInt16(0, uint16(atLogin));
+
+ CharacterDatabase.Execute(stmt);
TRINITY_READ_GUARD(HashMapHolder<Player>::LockType, *HashMapHolder<Player>::GetLock());
HashMapHolder<Player>::MapType const& plist = sObjectAccessor->GetPlayers();
diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp
index 036664a2760..df7aa90982e 100755
--- a/src/server/game/Entities/GameObject/GameObject.cpp
+++ b/src/server/game/Entities/GameObject/GameObject.cpp
@@ -770,8 +770,18 @@ void GameObject::DeleteFromDB()
{
sObjectMgr->RemoveGORespawnTime(m_DBTableGuid, GetInstanceId());
sObjectMgr->DeleteGOData(m_DBTableGuid);
- WorldDatabase.PExecute("DELETE FROM gameobject WHERE guid = '%u'", m_DBTableGuid);
- WorldDatabase.PExecute("DELETE FROM game_event_gameobject WHERE guid = '%u'", m_DBTableGuid);
+
+ PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_GAMEOBJECT);
+
+ stmt->setUInt32(0, m_DBTableGuid);
+
+ WorldDatabase.Execute(stmt);
+
+ stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_EVENT_GAMEOBJECT);
+
+ stmt->setUInt32(0, m_DBTableGuid);
+
+ WorldDatabase.Execute(stmt);
}
GameObject* GameObject::GetGameObject(WorldObject& object, uint64 guid)
diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp
index 4e33142f5ce..eb590e7b82f 100755
--- a/src/server/game/Entities/Pet/Pet.cpp
+++ b/src/server/game/Entities/Pet/Pet.cpp
@@ -1247,24 +1247,29 @@ void Pet::_SaveAuras(SQLTransaction& trans)
}
}
-bool Pet::addSpell(uint32 spell_id, ActiveStates active /*= ACT_DECIDE*/, PetSpellState state /*= PETSPELL_NEW*/, PetSpellType type /*= PETSPELL_NORMAL*/)
+bool Pet::addSpell(uint32 spellId, ActiveStates active /*= ACT_DECIDE*/, PetSpellState state /*= PETSPELL_NEW*/, PetSpellType type /*= PETSPELL_NORMAL*/)
{
- SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell_id);
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo)
{
// do pet spell book cleanup
if (state == PETSPELL_UNCHANGED) // spell load case
{
- sLog->outError("Pet::addSpell: Non-existed 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);
+ sLog->outError("Pet::addSpell: Non-existed in SpellStore spell #%u request, deleting for all pets in `pet_spell`.", spellId);
+
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_PET_SPELL);
+
+ stmt->setUInt32(0, spellId);
+
+ CharacterDatabase.Execute(stmt);
}
else
- sLog->outError("Pet::addSpell: Non-existed in SpellStore spell #%u request.", spell_id);
+ sLog->outError("Pet::addSpell: Non-existed in SpellStore spell #%u request.", spellId);
return false;
}
- PetSpellMap::iterator itr = m_spells.find(spell_id);
+ PetSpellMap::iterator itr = m_spells.find(spellId);
if (itr != m_spells.end())
{
if (itr->second.state == PETSPELL_REMOVED)
@@ -1303,7 +1308,7 @@ bool Pet::addSpell(uint32 spell_id, ActiveStates active /*= ACT_DECIDE*/, PetSpe
newspell.active = active;
// talent: unlearn all other talent ranks (high and low)
- if (TalentSpellPos const* talentPos = GetTalentSpellPos(spell_id))
+ if (TalentSpellPos const* talentPos = GetTalentSpellPos(spellId))
{
if (TalentEntry const* talentInfo = sTalentStore.LookupEntry(talentPos->talent_id))
{
@@ -1311,7 +1316,7 @@ bool Pet::addSpell(uint32 spell_id, ActiveStates active /*= ACT_DECIDE*/, PetSpe
{
// skip learning spell and no rank spell case
uint32 rankSpellId = talentInfo->RankID[i];
- if (!rankSpellId || rankSpellId == spell_id)
+ if (!rankSpellId || rankSpellId == spellId)
continue;
// skip unknown ranks
@@ -1352,17 +1357,17 @@ bool Pet::addSpell(uint32 spell_id, ActiveStates active /*= ACT_DECIDE*/, PetSpe
}
}
- m_spells[spell_id] = newspell;
+ m_spells[spellId] = newspell;
if (spellInfo->IsPassive() && (!spellInfo->CasterAuraState || HasAuraState(AuraStateType(spellInfo->CasterAuraState))))
- CastSpell(this, spell_id, true);
+ CastSpell(this, spellId, true);
else
m_charmInfo->AddSpellToActionBar(spellInfo);
if (newspell.active == ACT_ENABLED)
ToggleAutocast(spellInfo, true);
- uint32 talentCost = GetTalentSpellCost(spell_id);
+ uint32 talentCost = GetTalentSpellCost(spellId);
if (talentCost)
{
int32 free_points = GetMaxTalentPointsForLevel(getLevel());
diff --git a/src/server/game/Entities/Pet/Pet.h b/src/server/game/Entities/Pet/Pet.h
index 973e5e99bee..ac86c061b31 100755
--- a/src/server/game/Entities/Pet/Pet.h
+++ b/src/server/game/Entities/Pet/Pet.h
@@ -192,7 +192,7 @@ class Pet : public Guardian
void _LoadSpells();
void _SaveSpells(SQLTransaction& trans);
- bool addSpell(uint32 spell_id, ActiveStates active = ACT_DECIDE, PetSpellState state = PETSPELL_NEW, PetSpellType type = PETSPELL_NORMAL);
+ bool addSpell(uint32 spellId, ActiveStates active = ACT_DECIDE, PetSpellState state = PETSPELL_NEW, PetSpellType type = PETSPELL_NORMAL);
bool learnSpell(uint32 spell_id);
void learnSpellHighRank(uint32 spellid);
void InitLevelupSpellsForLevel();
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 510813a4e56..235613c11c4 100755
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -3416,19 +3416,24 @@ void Player::AddNewMailDeliverTime(time_t deliver_time)
}
}
-bool Player::AddTalent(uint32 spell_id, uint8 spec, bool learning)
+bool Player::AddTalent(uint32 spellId, uint8 spec, bool learning)
{
- SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell_id);
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo)
{
// do character spell book cleanup (all characters)
if (!IsInWorld() && !learning) // spell load case
{
- sLog->outError("Player::addSpell: Non-existed in SpellStore spell #%u request, deleting for all characters in `character_spell`.", spell_id);
- CharacterDatabase.PExecute("DELETE FROM character_talent WHERE spell = '%u'", spell_id);
+ sLog->outError("Player::addSpell: Non-existed in SpellStore spell #%u request, deleting for all characters in `character_spell`.", spellId);
+
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_SPELL);
+
+ stmt->setUInt32(0, spellId);
+
+ CharacterDatabase.Execute(stmt);
}
else
- sLog->outError("Player::addSpell: Non-existed in SpellStore spell #%u request.", spell_id);
+ sLog->outError("Player::addSpell: Non-existed in SpellStore spell #%u request.", spellId);
return false;
}
@@ -3438,19 +3443,24 @@ bool Player::AddTalent(uint32 spell_id, uint8 spec, bool learning)
// do character spell book cleanup (all characters)
if (!IsInWorld() && !learning) // spell load case
{
- sLog->outError("Player::addTalent: Broken spell #%u learning not allowed, deleting for all characters in `character_talent`.", spell_id);
- CharacterDatabase.PExecute("DELETE FROM character_talent WHERE spell = '%u'", spell_id);
+ sLog->outError("Player::addTalent: Broken spell #%u learning not allowed, deleting for all characters in `character_talent`.", spellId);
+
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_SPELL);
+
+ stmt->setUInt32(0, spellId);
+
+ CharacterDatabase.Execute(stmt);
}
else
- sLog->outError("Player::addTalent: Broken spell #%u learning not allowed.", spell_id);
+ sLog->outError("Player::addTalent: Broken spell #%u learning not allowed.", spellId);
return false;
}
- PlayerTalentMap::iterator itr = m_talents[spec]->find(spell_id);
+ PlayerTalentMap::iterator itr = m_talents[spec]->find(spellId);
if (itr != m_talents[spec]->end())
itr->second->state = PLAYERSPELL_UNCHANGED;
- else if (TalentSpellPos const* talentPos = GetTalentSpellPos(spell_id))
+ else if (TalentSpellPos const* talentPos = GetTalentSpellPos(spellId))
{
if (TalentEntry const* talentInfo = sTalentStore.LookupEntry(talentPos->talent_id))
{
@@ -3458,7 +3468,7 @@ bool Player::AddTalent(uint32 spell_id, uint8 spec, bool learning)
{
// skip learning spell and no rank spell case
uint32 rankSpellId = talentInfo->RankID[rank];
- if (!rankSpellId || rankSpellId == spell_id)
+ if (!rankSpellId || rankSpellId == spellId)
continue;
itr = m_talents[spec]->find(rankSpellId);
@@ -3473,25 +3483,30 @@ bool Player::AddTalent(uint32 spell_id, uint8 spec, bool learning)
newtalent->state = state;
newtalent->spec = spec;
- (*m_talents[spec])[spell_id] = newtalent;
+ (*m_talents[spec])[spellId] = newtalent;
return true;
}
return false;
}
-bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependent, bool disabled, bool loading /*=false*/)
+bool Player::addSpell(uint32 spellId, bool active, bool learning, bool dependent, bool disabled, bool loading /*= false*/)
{
- SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell_id);
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo)
{
// do character spell book cleanup (all characters)
if (!IsInWorld() && !learning) // spell load case
{
- sLog->outError("Player::addSpell: Non-existed 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);
+ sLog->outError("Player::addSpell: Non-existed in SpellStore spell #%u request, deleting for all characters in `character_spell`.", spellId);
+
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_SPELL);
+
+ stmt->setUInt32(0, spellId);
+
+ CharacterDatabase.Execute(stmt);
}
else
- sLog->outError("Player::addSpell: Non-existed in SpellStore spell #%u request.", spell_id);
+ sLog->outError("Player::addSpell: Non-existed in SpellStore spell #%u request.", spellId);
return false;
}
@@ -3501,11 +3516,16 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
// do character spell book cleanup (all characters)
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);
- CharacterDatabase.PExecute("DELETE FROM character_spell WHERE spell = '%u'", spell_id);
+ sLog->outError("Player::addSpell: Broken spell #%u learning not allowed, deleting for all characters in `character_spell`.", spellId);
+
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_SPELL);
+
+ stmt->setUInt32(0, spellId);
+
+ CharacterDatabase.Execute(stmt);
}
else
- sLog->outError("Player::addSpell: Broken spell #%u learning not allowed.", spell_id);
+ sLog->outError("Player::addSpell: Broken spell #%u learning not allowed.", spellId);
return false;
}
@@ -3516,18 +3536,18 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
bool disabled_case = false;
bool superceded_old = false;
- PlayerSpellMap::iterator itr = m_spells.find(spell_id);
+ PlayerSpellMap::iterator itr = m_spells.find(spellId);
// Remove temporary spell if found to prevent conflicts
if (itr != m_spells.end() && itr->second->state == PLAYERSPELL_TEMPORARY)
- RemoveTemporarySpell(spell_id);
+ RemoveTemporarySpell(spellId);
else if (itr != m_spells.end())
{
uint32 next_active_spell_id = 0;
// fix activate state for non-stackable low rank (and find next spell for !active case)
if (!spellInfo->IsStackableWithRanks() && spellInfo->IsRanked())
{
- if (uint32 next = sSpellMgr->GetNextSpellInChain(spell_id))
+ if (uint32 next = sSpellMgr->GetNextSpellInChain(spellId))
{
if (HasSpell(next))
{
@@ -3570,7 +3590,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
if (active)
{
if (spellInfo->IsPassive() && IsNeedCastPassiveSpellAtLearn(spellInfo))
- CastSpell (this, spell_id, true);
+ CastSpell (this, spellId, true);
}
else if (IsInWorld())
{
@@ -3578,14 +3598,14 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
{
// update spell ranks in spellbook and action bar
WorldPacket data(SMSG_SUPERCEDED_SPELL, 4 + 4);
- data << uint32(spell_id);
+ data << uint32(spellId);
data << uint32(next_active_spell_id);
GetSession()->SendPacket(&data);
}
else
{
WorldPacket data(SMSG_REMOVED_SPELL, 4);
- data << uint32(spell_id);
+ data << uint32(spellId);
GetSession()->SendPacket(&data);
}
}
@@ -3629,7 +3649,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
if (!disabled_case) // skip new spell adding if spell already known (disabled spells case)
{
// talent: unlearn all other talent ranks (high and low)
- if (TalentSpellPos const* talentPos = GetTalentSpellPos(spell_id))
+ if (TalentSpellPos const* talentPos = GetTalentSpellPos(spellId))
{
if (TalentEntry const* talentInfo = sTalentStore.LookupEntry(talentPos->talent_id))
{
@@ -3637,7 +3657,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
{
// skip learning spell and no rank spell case
uint32 rankSpellId = talentInfo->RankID[rank];
- if (!rankSpellId || rankSpellId == spell_id)
+ if (!rankSpellId || rankSpellId == spellId)
continue;
removeSpell(rankSpellId, false, false);
@@ -3645,7 +3665,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
}
}
// non talent spell: learn low ranks (recursive call)
- else if (uint32 prev_spell = sSpellMgr->GetPrevSpellInChain(spell_id))
+ else if (uint32 prev_spell = sSpellMgr->GetPrevSpellInChain(spellId))
{
if (!IsInWorld() || disabled) // at spells loading, no output, but allow save
addSpell(prev_spell, active, true, true, disabled);
@@ -3678,7 +3698,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
{
WorldPacket data(SMSG_SUPERCEDED_SPELL, 4 + 4);
data << uint32(itr2->first);
- data << uint32(spell_id);
+ data << uint32(spellId);
GetSession()->SendPacket(&data);
}
@@ -3693,7 +3713,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
if (IsInWorld()) // not send spell (re-/over-)learn packets at loading
{
WorldPacket data(SMSG_SUPERCEDED_SPELL, 4 + 4);
- data << uint32(spell_id);
+ data << uint32(spellId);
data << uint32(itr2->first);
GetSession()->SendPacket(&data);
}
@@ -3708,31 +3728,31 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
}
}
- m_spells[spell_id] = newspell;
+ m_spells[spellId] = newspell;
// return false if spell disabled
if (newspell->disabled)
return false;
}
- uint32 talentCost = GetTalentSpellCost(spell_id);
+ uint32 talentCost = GetTalentSpellCost(spellId);
// cast talents with SPELL_EFFECT_LEARN_SPELL (other dependent spells will learned later as not auto-learned)
// note: all spells with SPELL_EFFECT_LEARN_SPELL isn't passive
if (!loading && talentCost > 0 && spellInfo->HasEffect(SPELL_EFFECT_LEARN_SPELL))
{
// ignore stance requirement for talent learn spell (stance set for spell only for client spell description show)
- CastSpell(this, spell_id, true);
+ CastSpell(this, spellId, true);
}
// also cast passive spells (including all talents without SPELL_EFFECT_LEARN_SPELL) with additional checks
else if (spellInfo->IsPassive())
{
if (IsNeedCastPassiveSpellAtLearn(spellInfo))
- CastSpell(this, spell_id, true);
+ CastSpell(this, spellId, true);
}
else if (spellInfo->HasEffect(SPELL_EFFECT_SKILL_STEP))
{
- CastSpell(this, spell_id, true);
+ CastSpell(this, spellId, true);
return false;
}
@@ -3749,9 +3769,9 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
// add dependent skills
uint16 maxskill = GetMaxSkillValueForLevel();
- SpellLearnSkillNode const* spellLearnSkill = sSpellMgr->GetSpellLearnSkill(spell_id);
+ SpellLearnSkillNode const* spellLearnSkill = sSpellMgr->GetSpellLearnSkill(spellId);
- SkillLineAbilityMapBounds skill_bounds = sSpellMgr->GetSkillLineAbilityMapBounds(spell_id);
+ SkillLineAbilityMapBounds skill_bounds = sSpellMgr->GetSkillLineAbilityMapBounds(spellId);
if (spellLearnSkill)
{
@@ -3809,7 +3829,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
}
// learn dependent spells
- SpellLearnSpellMapBounds spell_bounds = sSpellMgr->GetSpellLearnSpellMapBounds(spell_id);
+ SpellLearnSpellMapBounds spell_bounds = sSpellMgr->GetSpellLearnSpellMapBounds(spellId);
for (SpellLearnSpellMap::const_iterator itr2 = spell_bounds.first; itr2 != spell_bounds.second; ++itr2)
{
@@ -3831,7 +3851,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILLLINE_SPELLS, _spell_idx->second->skillId);
}
- GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LEARN_SPELL, spell_id);
+ GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LEARN_SPELL, spellId);
}
// return true (for send learn packet) only if spell active (in case ranked spells) and not replace old spell
@@ -4921,8 +4941,14 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC
}
// The character gets unlinked from the account, the name gets freed up and appears as deleted ingame
case CHAR_DELETE_UNLINK:
- CharacterDatabase.PExecute("UPDATE characters SET deleteInfos_Name=name, deleteInfos_Account=account, deleteDate='" UI64FMTD "', name='', account=0 WHERE guid=%u", uint64(time(NULL)), guid);
+ {
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPDATE_DELETE_INFO);
+
+ stmt->setUInt32(0, guid);
+
+ CharacterDatabase.Execute(stmt);
break;
+ }
default:
sLog->outError("Player::DeleteFromDB: Unsupported delete method: %u.", charDelete_method);
}
@@ -7317,7 +7343,14 @@ uint32 Player::GetZoneIdFromDB(uint64 guid)
zone = sMapMgr->GetZoneId(map, posx, posy, posz);
if (zone > 0)
- CharacterDatabase.PExecute("UPDATE characters SET zone='%u' WHERE guid='%u'", zone, guidLow);
+ {
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPDATE_ZONE);
+
+ stmt->setUInt16(0, uint16(zone));
+ stmt->setUInt32(1, guidLow);
+
+ CharacterDatabase.Execute(stmt);
+ }
}
return zone;
@@ -12348,7 +12381,13 @@ void Player::DestroyItem(uint8 bag, uint8 slot, bool update)
DestroyItem(slot, i, update);
if (pItem->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_WRAPPED))
- CharacterDatabase.PExecute("DELETE FROM character_gifts WHERE item_guid = '%u'", pItem->GetGUIDLow());
+ {
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GIFT);
+
+ stmt->setUInt32(0, pItem->GetGUIDLow());
+
+ CharacterDatabase.Execute(stmt);
+ }
RemoveEnchantmentDurations(pItem);
RemoveItemDurations(pItem);
@@ -16466,7 +16505,13 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
if (ObjectMgr::CheckPlayerName(m_name) != CHAR_NAME_SUCCESS ||
(AccountMgr::IsPlayerAccount(GetSession()->GetSecurity()) && sObjectMgr->IsReservedName(m_name)))
{
- CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '%u' WHERE guid ='%u'", uint32(AT_LOGIN_RENAME), guid);
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPDATE_AT_LOGIN_FLAG);
+
+ stmt->setUInt16(0, uint16(AT_LOGIN_RENAME));
+ stmt->setUInt32(1, guid);
+
+ CharacterDatabase.Execute(stmt);
+
return false;
}
@@ -17487,29 +17532,33 @@ void Player::_LoadMailedItems(Mail* mail)
{
Field* fields = result->Fetch();
- uint32 item_guid_low = fields[11].GetUInt32();
- uint32 item_template = fields[12].GetUInt32();
+ uint32 itemGuid = fields[11].GetUInt32();
+ uint32 itemTemplate = fields[12].GetUInt32();
- mail->AddItem(item_guid_low, item_template);
+ mail->AddItem(itemGuid, itemTemplate);
- ItemTemplate const* proto = sObjectMgr->GetItemTemplate(item_template);
+ ItemTemplate const* proto = sObjectMgr->GetItemTemplate(itemTemplate);
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);
- CharacterDatabase.PExecute("DELETE FROM mail_items WHERE item_guid = '%u'", item_guid_low);
+ sLog->outError("Player %u has unknown item_template (ProtoType) in mailed items(GUID: %u template: %u) in mail (%u), deleted.", GetGUIDLow(), itemGuid, itemTemplate, mail->messageID);
+
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_MAIL_ITEM);
+ stmt->setUInt32(0, itemGuid);
+ CharacterDatabase.Execute(stmt);
+
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE);
- stmt->setUInt32(0, item_guid_low);
+ stmt->setUInt32(0, itemGuid);
CharacterDatabase.Execute(stmt);
continue;
}
Item* item = NewItemOrBag(proto);
- if (!item->LoadFromDB(item_guid_low, MAKE_NEW_GUID(fields[13].GetUInt32(), 0, HIGHGUID_PLAYER), fields, item_template))
+ if (!item->LoadFromDB(itemGuid, MAKE_NEW_GUID(fields[13].GetUInt32(), 0, HIGHGUID_PLAYER), fields, itemTemplate))
{
- 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);
+ sLog->outError("Player::_LoadMailedItems - Item in mail (%u) doesn't exist !!!! - item guid: %u, deleted from mail", mail->messageID, itemGuid);
+ CharacterDatabase.PExecute("DELETE FROM mail_items WHERE item_guid = '%u'", itemGuid);
item->FSetState(ITEM_REMOVED);
SQLTransaction temp = SQLTransaction(NULL);
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index 8ee7d1a417f..a9bba9cbdc4 100755
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -1650,7 +1650,7 @@ class Player : public Unit, public GridObject<Player>
void SendProficiency(ItemClass itemClass, uint32 itemSubclassMask);
void SendInitialSpells();
- bool addSpell(uint32 spell_id, bool active, bool learning, bool dependent, bool disabled, bool loading = false);
+ bool addSpell(uint32 spellId, bool active, bool learning, bool dependent, bool disabled, bool loading = false);
void learnSpell(uint32 spell_id, bool dependent);
void removeSpell(uint32 spell_id, bool disabled = false, bool learn_low_rank = true);
void resetSpells(bool myClassOnly = false);
@@ -1674,7 +1674,7 @@ class Player : public Unit, public GridObject<Player>
void LearnTalent(uint32 talentId, uint32 talentRank);
void LearnPetTalent(uint64 petGuid, uint32 talentId, uint32 talentRank);
- bool AddTalent(uint32 spell, uint8 spec, bool learning);
+ bool AddTalent(uint32 spellId, uint8 spec, bool learning);
bool HasTalent(uint32 spell_id, uint8 spec) const;
uint32 CalculateTalentsPoints() const;
diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp
index 11175b13114..ffb5e0ca1aa 100755
--- a/src/server/game/Groups/Group.cpp
+++ b/src/server/game/Groups/Group.cpp
@@ -123,12 +123,30 @@ bool Group::Create(Player* leader)
sGroupMgr->RegisterGroupDbStoreId(m_dbStoreId, this);
- // store group in database
- CharacterDatabase.PExecute("INSERT INTO groups (guid, leaderGuid, lootMethod, looterGuid, lootThreshold, icon1, icon2, icon3, icon4, icon5, icon6, icon7, icon8, groupType, difficulty, raiddifficulty) "
- "VALUES ('%u', '%u', '%u', '%u', '%u', '" UI64FMTD "', '" UI64FMTD "', '" UI64FMTD "', '" UI64FMTD "', '" UI64FMTD "', '" UI64FMTD "', '" UI64FMTD "', '" UI64FMTD "', '%u', '%u', '%u')",
- m_dbStoreId, GUID_LOPART(m_leaderGuid), uint32(m_lootMethod),
- GUID_LOPART(m_looterGuid), uint32(m_lootThreshold), m_targetIcons[0], m_targetIcons[1], m_targetIcons[2], m_targetIcons[3], m_targetIcons[4], m_targetIcons[5], m_targetIcons[6],
- m_targetIcons[7], uint8(m_groupType), uint32(m_dungeonDifficulty), m_raidDifficulty);
+ // Store group in database
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_ADD_GROUP);
+
+ uint8 index = 0;
+
+ stmt->setUInt32(index++, m_dbStoreId);
+ stmt->setUInt32(index++, GUID_LOPART(m_leaderGuid));
+ stmt->setUInt8(index++, uint8(m_lootMethod));
+ stmt->setUInt32(index++, GUID_LOPART(m_looterGuid));
+ stmt->setUInt8(index++, uint8(m_lootThreshold));
+ stmt->setUInt32(index++, uint32(m_targetIcons[0]));
+ stmt->setUInt32(index++, uint32(m_targetIcons[1]));
+ stmt->setUInt32(index++, uint32(m_targetIcons[2]));
+ stmt->setUInt32(index++, uint32(m_targetIcons[3]));
+ stmt->setUInt32(index++, uint32(m_targetIcons[4]));
+ stmt->setUInt32(index++, uint32(m_targetIcons[5]));
+ stmt->setUInt32(index++, uint32(m_targetIcons[6]));
+ stmt->setUInt32(index++, uint32(m_targetIcons[7]));
+ stmt->setUInt8(index++, uint8(m_groupType));
+ stmt->setUInt32(index++, uint8(m_dungeonDifficulty));
+ stmt->setUInt32(index++, uint8(m_raidDifficulty));
+
+ CharacterDatabase.Execute(stmt);
+
ASSERT(AddMember(leader)); // If the leader can't be added to a new group because it appears full, something is clearly wrong.
@@ -200,7 +218,15 @@ void Group::ConvertToLFG()
m_groupType = GroupType(m_groupType | GROUPTYPE_LFG | GROUPTYPE_UNK1);
m_lootMethod = NEED_BEFORE_GREED;
if (!isBGGroup())
- CharacterDatabase.PExecute("UPDATE groups SET groupType='%u' WHERE guid='%u'", uint8(m_groupType), m_dbStoreId);
+ {
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPDATE_GROUP_TYPE);
+
+ stmt->setUInt8(0, uint8(m_groupType));
+ stmt->setUInt32(1, m_dbStoreId);
+
+ CharacterDatabase.Execute(stmt);
+ }
+
SendUpdate();
}
@@ -211,7 +237,15 @@ void Group::ConvertToRaid()
_initRaidSubGroupsCounter();
if (!isBGGroup())
- CharacterDatabase.PExecute("UPDATE groups SET groupType='%u' WHERE guid='%u'", uint8(m_groupType), m_dbStoreId);
+ {
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPDATE_GROUP_TYPE);
+
+ stmt->setUInt8(0, uint8(m_groupType));
+ stmt->setUInt32(1, m_dbStoreId);
+
+ CharacterDatabase.Execute(stmt);
+ }
+
SendUpdate();
// update quest related GO states (quest activity dependent from raid membership)
@@ -343,8 +377,18 @@ bool Group::AddMember(Player* player)
// insert into the table if we're not a battleground group
if (!isBGGroup())
- CharacterDatabase.PExecute("INSERT INTO group_member (guid, memberGuid, memberFlags, subgroup, roles) VALUES(%u, %u, %u, %u, %u)",
- m_dbStoreId, GUID_LOPART(member.guid), member.flags, member.group, member.roles);
+ {
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_ADD_GROUP_MEMBER);
+
+ stmt->setUInt32(0, m_dbStoreId);
+ stmt->setUInt32(1, GUID_LOPART(member.guid));
+ stmt->setUInt8(2, member.flags);
+ stmt->setUInt8(3, member.group);
+ stmt->setUInt8(4, member.roles);
+
+ CharacterDatabase.Execute(stmt);
+
+ }
SendUpdate();
sScriptMgr->OnGroupAddMember(this, player->GetGUID());
@@ -435,7 +479,11 @@ bool Group::RemoveMember(uint64 guid, const RemoveMethod &method /*= GROUP_REMOV
}
// Remove player from group in DB
- CharacterDatabase.PExecute("DELETE FROM group_member WHERE memberGuid=%u", GUID_LOPART(guid));
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GROUP_MEMBER);
+
+ stmt->setUInt32(0, GUID_LOPART(guid));
+
+ CharacterDatabase.Execute(stmt);
// Reevaluate group enchanter if the leaving player had enchanting skill or the player is offline
if ((player && player->GetSkillValue(SKILL_ENCHANTING)) || !player)
@@ -530,14 +578,24 @@ void Group::ChangeLeader(uint64 guid)
}
// Same in the database
- CharacterDatabase.PExecute("DELETE FROM group_instance WHERE guid=%u AND (permanent = 1 OR instance IN (SELECT instance FROM character_instance WHERE guid = '%u'))",
- m_dbStoreId, player->GetGUIDLow());
+
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GROUP_INSTANCE_PERM_BINDING);
+
+ stmt->setUInt32(0, m_dbStoreId);
+ stmt->setUInt32(1, player->GetGUIDLow());
+
+ CharacterDatabase.Execute(stmt);
// Copy the permanent binds from the new leader to the group
Player::ConvertInstancesToGroup(player, this, true);
- // update the group leader
- CharacterDatabase.PExecute("UPDATE groups SET leaderGuid='%u' WHERE guid='%u'", player->GetGUIDLow(), m_dbStoreId);
+ // Update the group leader
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPDATE_GROUP_LEADER);
+
+ stmt->setUInt32(0, player->GetGUIDLow());
+ stmt->setUInt32(1, m_dbStoreId);
+
+ CharacterDatabase.Execute(stmt);
}
m_leaderGuid = player->GetGUID();
@@ -1321,7 +1379,14 @@ bool Group::_setMembersGroup(uint64 guid, uint8 group)
SubGroupCounterIncrease(group);
if (!isBGGroup())
- CharacterDatabase.PExecute("UPDATE group_member SET subgroup='%u' WHERE memberGuid='%u'", group, GUID_LOPART(guid));
+ {
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPDATE_GROUP_MEMBER_SUBGROUP);
+
+ stmt->setUInt8(0, group);
+ stmt->setUInt32(1, GUID_LOPART(guid));
+
+ CharacterDatabase.Execute(stmt);
+ }
return true;
}
@@ -1365,7 +1430,14 @@ void Group::ChangeMembersGroup(uint64 guid, uint8 group)
// Preserve new sub group in database for non-raid groups
if (!isBGGroup())
- CharacterDatabase.PExecute("UPDATE group_member SET subgroup='%u' WHERE memberGuid='%u'", group, GUID_LOPART(guid));
+ {
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPDATE_GROUP_MEMBER_SUBGROUP);
+
+ stmt->setUInt8(0, group);
+ stmt->setUInt32(1, GUID_LOPART(guid));
+
+ CharacterDatabase.Execute(stmt);
+ }
// In case the moved player is online, update the player object with the new sub group references
if (Player* player = ObjectAccessor::FindPlayer(guid))
@@ -1553,7 +1625,14 @@ void Group::SetDungeonDifficulty(Difficulty difficulty)
{
m_dungeonDifficulty = difficulty;
if (!isBGGroup())
- CharacterDatabase.PExecute("UPDATE groups SET difficulty = %u WHERE guid ='%u'", m_dungeonDifficulty, m_dbStoreId);
+ {
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPDATE_GROUP_DIFFICULTY);
+
+ stmt->setUInt8(0, uint8(m_dungeonDifficulty));
+ stmt->setUInt32(1, m_dbStoreId);
+
+ CharacterDatabase.Execute(stmt);
+ }
for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next())
{
@@ -1570,7 +1649,14 @@ void Group::SetRaidDifficulty(Difficulty difficulty)
{
m_raidDifficulty = difficulty;
if (!isBGGroup())
- CharacterDatabase.PExecute("UPDATE groups SET raiddifficulty = %u WHERE guid ='%u'", m_raidDifficulty, m_dbStoreId);
+ {
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPDATE_GROUP_RAID_DIFFICULTY);
+
+ stmt->setUInt8(0, uint8(m_raidDifficulty));
+ stmt->setUInt32(1, m_dbStoreId);
+
+ CharacterDatabase.Execute(stmt);
+ }
for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next())
{
@@ -1608,9 +1694,9 @@ void Group::ResetInstances(uint8 method, bool isRaid, Player* SendMsgTo)
for (BoundInstancesMap::iterator itr = m_boundInstances[diff].begin(); itr != m_boundInstances[diff].end();)
{
- InstanceSave* p = itr->second.save;
+ InstanceSave* instanceSave = itr->second.save;
const MapEntry* entry = sMapStore.LookupEntry(itr->first);
- if (!entry || entry->IsRaid() != isRaid || (!p->CanReset() && method != INSTANCE_RESET_GROUP_DISBAND))
+ if (!entry || entry->IsRaid() != isRaid || (!instanceSave->CanReset() && method != INSTANCE_RESET_GROUP_DISBAND))
{
++itr;
continue;
@@ -1628,10 +1714,10 @@ void Group::ResetInstances(uint8 method, bool isRaid, Player* SendMsgTo)
bool isEmpty = true;
// if the map is loaded, reset it
- Map* map = sMapMgr->FindMap(p->GetMapId(), p->GetInstanceId());
- if (map && map->IsDungeon() && !(method == INSTANCE_RESET_GROUP_DISBAND && !p->CanReset()))
+ Map* map = sMapMgr->FindMap(instanceSave->GetMapId(), instanceSave->GetInstanceId());
+ if (map && map->IsDungeon() && !(method == INSTANCE_RESET_GROUP_DISBAND && !instanceSave->CanReset()))
{
- if (p->CanReset())
+ if (instanceSave->CanReset())
isEmpty = ((InstanceMap*)map)->Reset(method);
else
isEmpty = !map->HavePlayers();
@@ -1640,25 +1726,32 @@ void Group::ResetInstances(uint8 method, bool isRaid, Player* SendMsgTo)
if (SendMsgTo)
{
if (isEmpty)
- SendMsgTo->SendResetInstanceSuccess(p->GetMapId());
+ SendMsgTo->SendResetInstanceSuccess(instanceSave->GetMapId());
else
- SendMsgTo->SendResetInstanceFailed(0, p->GetMapId());
+ SendMsgTo->SendResetInstanceFailed(0, instanceSave->GetMapId());
}
if (isEmpty || method == INSTANCE_RESET_GROUP_DISBAND || method == INSTANCE_RESET_CHANGE_DIFFICULTY)
{
// do not reset the instance, just unbind if others are permanently bound to it
- if (p->CanReset())
- p->DeleteFromDB();
+ if (instanceSave->CanReset())
+ instanceSave->DeleteFromDB();
else
- CharacterDatabase.PExecute("DELETE FROM group_instance WHERE instance = '%u'", p->GetInstanceId());
+ {
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GROUP_INSTANCE_BY_INSTANCE);
+
+ stmt->setUInt32(0, instanceSave->GetInstanceId());
+
+ CharacterDatabase.Execute(stmt);
+ }
+
// i don't know for sure if hash_map iterators
m_boundInstances[diff].erase(itr);
itr = m_boundInstances[diff].begin();
// this unloads the instance save unless online players are bound to it
// (eg. permanent binds or GM solo binds)
- p->RemoveGroup(this);
+ instanceSave->RemoveGroup(this);
}
else
++itr;
@@ -1711,7 +1804,15 @@ InstanceGroupBind* Group::BindToInstance(InstanceSave* save, bool permanent, boo
InstanceGroupBind& bind = m_boundInstances[save->GetDifficulty()][save->GetMapId()];
if (!load && (!bind.save || permanent != bind.perm || save != bind.save))
- CharacterDatabase.PExecute("REPLACE INTO group_instance (guid, instance, permanent) VALUES (%u, %u, %u)", m_dbStoreId, save->GetInstanceId(), permanent);
+ {
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_ADD_GROUP_INSTANCE);
+
+ stmt->setUInt32(0, m_dbStoreId);
+ stmt->setUInt32(1, save->GetInstanceId());
+ stmt->setBool(2, permanent);
+
+ CharacterDatabase.Execute(stmt);
+ }
if (bind.save != save)
{
@@ -1735,7 +1836,15 @@ void Group::UnbindInstance(uint32 mapid, uint8 difficulty, bool unload)
if (itr != m_boundInstances[difficulty].end())
{
if (!unload)
- CharacterDatabase.PExecute("DELETE FROM group_instance WHERE guid=%u AND instance=%u", m_dbStoreId, itr->second.save->GetInstanceId());
+ {
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GROUP_INSTANCE_BY_GUID);
+
+ stmt->setUInt32(0, m_dbStoreId);
+ stmt->setUInt32(1, itr->second.save->GetInstanceId());
+
+ CharacterDatabase.Execute(stmt);
+ }
+
itr->second.save->RemoveGroup(this); // save can become invalid
m_boundInstances[difficulty].erase(itr);
}
@@ -1964,7 +2073,12 @@ void Group::SetGroupMemberFlag(uint64 guid, bool apply, GroupMemberFlags flag)
ToggleGroupMemberFlag(slot, flag, apply);
// Preserve the new setting in the db
- CharacterDatabase.PExecute("UPDATE group_member SET memberFlags='%u' WHERE memberGuid='%u'", slot->flags, GUID_LOPART(guid));
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPDATE_GROUP_MEMBER_FLAG);
+
+ stmt->setUInt8(0, slot->flags);
+ stmt->setUInt32(0, GUID_LOPART(guid));
+
+ CharacterDatabase.Execute(stmt);
// Broadcast the changes to the group
SendUpdate();
diff --git a/src/server/game/Instances/InstanceSaveMgr.cpp b/src/server/game/Instances/InstanceSaveMgr.cpp
index 7a2368161d8..9d5ffb6542a 100755
--- a/src/server/game/Instances/InstanceSaveMgr.cpp
+++ b/src/server/game/Instances/InstanceSaveMgr.cpp
@@ -138,7 +138,14 @@ void InstanceSaveManager::RemoveInstanceSave(uint32 InstanceId)
{
// save the resettime for normal instances only when they get unloaded
if (time_t resettime = itr->second->GetResetTimeForDB())
- CharacterDatabase.PExecute("UPDATE instance SET resettime = '"UI64FMTD"' WHERE id = '%u'", (uint64)resettime, InstanceId);
+ {
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPDATE_INSTANCE_RESETTIME);
+
+ stmt->setUInt32(0, uint32(resettime));
+ stmt->setUInt32(1, InstanceId);
+
+ CharacterDatabase.Execute(stmt);
+ }
delete itr->second;
m_instanceSaveById.erase(itr);
@@ -573,13 +580,19 @@ void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, Difficulty difficulty, b
if (period < DAY)
period = DAY;
- uint64 next_reset = ((resetTime + MINUTE) / DAY * DAY) + period + diff;
+ uint32 next_reset = ((resetTime + MINUTE) / DAY * DAY) + period + diff;
SetResetTimeFor(mapid, difficulty, next_reset);
ScheduleReset(true, time_t(next_reset-3600), InstResetEvent(1, mapid, difficulty, 0));
- // update it in the DB
- CharacterDatabase.PExecute("UPDATE instance_reset SET resettime = '%u' WHERE mapid = '%d' AND difficulty = '%d'", uint32(next_reset), mapid, difficulty);
+ // Update it in the DB
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPDATE_GLOBAL_INSTANCE_RESETTIME);
+
+ stmt->setUInt32(0, next_reset);
+ stmt->setUInt16(1, uint16(mapid));
+ stmt->setUInt8(2, uint8(difficulty));
+
+ CharacterDatabase.Execute(stmt);
}
// note: this isn't fast but it's meant to be executed very rarely
diff --git a/src/server/game/Server/WorldSocket.cpp b/src/server/game/Server/WorldSocket.cpp
index 0ddc03e3d5c..e0ba9eaaaa4 100755
--- a/src/server/game/Server/WorldSocket.cpp
+++ b/src/server/game/Server/WorldSocket.cpp
@@ -889,7 +889,13 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
if (mutetime < 0)
{
mutetime = time(NULL) + llabs(mutetime);
- LoginDatabase.PExecute("UPDATE account SET mutetime = " SI64FMTD " WHERE id = '%u'", mutetime, id);
+
+ PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPDATE_MUTE_TIME);
+
+ stmt->setInt64(0, mutetime);
+ stmt->setUInt32(1, id);
+
+ LoginDatabase.Execute(stmt);
}
locale = LocaleConstant (fields[8].GetUInt8());
@@ -985,14 +991,13 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
isRecruiter = true;
// Update the last_ip in the database
- // No SQL injection, username escaped.
- LoginDatabase.EscapeString (address);
- LoginDatabase.PExecute ("UPDATE account "
- "SET last_ip = '%s' "
- "WHERE username = '%s'",
- address.c_str(),
- safe_account.c_str());
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(LOGIN_UPDATE_LAST_IP);
+
+ stmt->setString(0, address);
+ stmt->setString(1, account);
+
+ CharacterDatabase.Execute(stmt);
// NOTE ATM the socket is single-threaded, have this in mind ...
ACE_NEW_RETURN (m_Session, WorldSession (id, this, AccountTypes(security), expansion, mutetime, locale, recruiter, isRecruiter), -1);
diff --git a/src/server/game/Tickets/TicketMgr.cpp b/src/server/game/Tickets/TicketMgr.cpp
index 10c1f4a1dfd..c657248c595 100755
--- a/src/server/game/Tickets/TicketMgr.cpp
+++ b/src/server/game/Tickets/TicketMgr.cpp
@@ -207,7 +207,10 @@ void TicketMgr::ResetTickets()
sTicketMgr->RemoveTicket(itr->second->GetId());
_lastTicketId = 0;
- CharacterDatabase.PExecute("TRUNCATE TABLE gm_tickets");
+
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ALL_GM_TICKETS);
+
+ CharacterDatabase.Execute(stmt);
}
void TicketMgr::LoadTickets()
diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.cpp b/src/server/shared/Database/Implementation/CharacterDatabase.cpp
index 02ff2dc5fb3..fb43a7286dd 100755
--- a/src/server/shared/Database/Implementation/CharacterDatabase.cpp
+++ b/src/server/shared/Database/Implementation/CharacterDatabase.cpp
@@ -95,6 +95,7 @@ void CharacterDatabaseConnection::DoPrepareStatements()
PREPARE_STATEMENT(CHAR_ADD_MAIL, "INSERT INTO mail(id, messageType, stationery, mailTemplateId, sender, receiver, subject, body, has_items, expire_time, deliver_time, money, cod, checked) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC)
PREPARE_STATEMENT(CHAR_DEL_MAIL, "DELETE FROM mail WHERE id = ?", CONNECTION_ASYNC)
PREPARE_STATEMENT(CHAR_ADD_MAIL_ITEM, "INSERT INTO mail_items(mail_id, item_guid, receiver) VALUES (?, ?, ?)", CONNECTION_ASYNC)
+ PREPARE_STATEMENT(CHAR_DEL_INVALID_MAIL_ITEM, "DELETE FROM mail_items WHERE item_guid = ?", CONNECTION_ASYNC);
PREPARE_STATEMENT(CHAR_DEL_EMPTY_EXPIRED_MAIL, "DELETE FROM mail WHERE expire_time < ? AND has_items = 0 AND body = ''", CONNECTION_ASYNC)
PREPARE_STATEMENT(CHAR_GET_EXPIRED_MAIL, "SELECT id, messageType, sender, receiver, has_items, expire_time, cod, checked, mailTemplateId FROM mail WHERE expire_time < ?", CONNECTION_SYNCH)
PREPARE_STATEMENT(CHAR_GET_EXPIRED_MAIL_ITEMS, "SELECT item_guid, itemEntry, mail_id FROM mail_items mi INNER JOIN item_instance ii ON ii.guid = mi.item_guid LEFT JOIN mail mm ON mi.mail_id = mm.id WHERE mm.id IS NOT NULL AND mm.expire_time < ?", CONNECTION_SYNCH)
@@ -329,8 +330,33 @@ void CharacterDatabaseConnection::DoPrepareStatements()
"equipmentCache=?,ammoId=?,knownTitles=?,actionBars=?,grantableLevels=?,online=? WHERE guid=?", CONNECTION_ASYNC);
PREPARE_STATEMENT(CHAR_UPDATE_AT_LOGIN_FLAG, "UPDATE characters SET at_login = at_login | ? WHERE guid = ?", CONNECTION_ASYNC);
+ PREPARE_STATEMENT(CHAR_UPDATE_ALL_AT_LOGIN_FLAGS, "UPDATE characters SET at_login = at_login | ?", CONNECTION_ASYNC);
PREPARE_STATEMENT(CHAR_ADD_BUG_REPORT, "INSERT INTO bugreport (type, content) VALUES(?, ?)", CONNECTION_ASYNC);
PREPARE_STATEMENT(CHAR_UPD_PETITION_NAME, "UPDATE petition SET name = ? WHERE petitionguid = ?", CONNECTION_ASYNC);
PREPARE_STATEMENT(CHAR_ADD_PETITION_SIGNATURE, "INSERT INTO petition_sign (ownerguid, petitionguid, playerguid, player_account) VALUES (?, ?, ?, ?)", CONNECTION_ASYNC);
PREPARE_STATEMENT(CHAR_UPD_ACCOUNT_ONLINE, "UPDATE characters SET online = 0 WHERE account = ?", CONNECTION_ASYNC);
+ PREPARE_STATEMENT(CHAR_ADD_GROUP, "INSERT INTO groups (guid, leaderGuid, lootMethod, looterGuid, lootThreshold, icon1, icon2, icon3, icon4, icon5, icon6, icon7, icon8, groupType, difficulty, raiddifficulty) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC);
+ PREPARE_STATEMENT(CHAR_ADD_GROUP_MEMBER, "INSERT INTO group_member (guid, memberGuid, memberFlags, subgroup, roles) VALUES(?, ?, ?, ?, ?)", CONNECTION_ASYNC);
+ PREPARE_STATEMENT(CHAR_DEL_GROUP_MEMBER, "DELETE FROM group_member WHERE memberGuid = ?", CONNECTION_ASYNC);
+ PREPARE_STATEMENT(CHAR_DEL_GROUP_INSTANCE_PERM_BINDING, "DELETE FROM group_instance WHERE guid = ? AND (permanent = 1 OR instance IN (SELECT instance FROM character_instance WHERE guid = ?))", CONNECTION_ASYNC);
+ PREPARE_STATEMENT(CHAR_UPDATE_GROUP_LEADER, "UPDATE groups SET leaderGuid = ? WHERE guid = ?", CONNECTION_ASYNC);
+ PREPARE_STATEMENT(CHAR_UPDATE_GROUP_TYPE, "UPDATE groups SET groupType = ? WHERE guid = ?", CONNECTION_ASYNC);
+ PREPARE_STATEMENT(CHAR_UPDATE_GROUP_MEMBER_SUBGROUP, "UPDATE group_member SET subgroup = ? WHERE memberGuid = ?", CONNECTION_ASYNC);
+ PREPARE_STATEMENT(CHAR_UPDATE_GROUP_MEMBER_FLAG, "UPDATE group_member SET memberFlags = ? WHERE memberGuid = ?", CONNECTION_ASYNC);
+ PREPARE_STATEMENT(CHAR_UPDATE_GROUP_DIFFICULTY, "UPDATE groups SET difficulty = ? WHERE guid = ?", CONNECTION_ASYNC);
+ PREPARE_STATEMENT(CHAR_UPDATE_GROUP_RAID_DIFFICULTY, "UPDATE groups SET raiddifficulty = ? WHERE guid = ?", CONNECTION_ASYNC);
+ PREPARE_STATEMENT(CHAR_DEL_ALL_GM_TICKETS, "TRUNCATE TABLE gm_tickets", CONNECTION_ASYNC);
+ PREPARE_STATEMENT(CHAR_DEL_INVALID_SPELL, "DELETE FROM character_talent WHERE spell = ?", CONNECTION_ASYNC);
+ PREPARE_STATEMENT(CHAR_UPDATE_DELETE_INFO, "UPDATE characters SET deleteInfos_Name = name, deleteInfos_Account = account, deleteDate = UNIX_TIMESTAMP(), name = '', account = 0 WHERE guid = ?", CONNECTION_ASYNC);
+ PREPARE_STATEMENT(CHAR_UPDATE_ZONE, "UPDATE characters SET zone = ? WHERE guid = ?", CONNECTION_ASYNC);
+ PREPARE_STATEMENT(CHAR_UPDATE_LEVEL, "UPDATE characters SET level = ?, xp = 0 WHERE guid = ?", CONNECTION_ASYNC);
+ PREPARE_STATEMENT(CHAR_DEL_INVALID_ACHIEV_PROGRESS_CRITERIA, "DELETE FROM character_achievement_progress WHERE criteria = ?", CONNECTION_ASYNC);
+ PREPARE_STATEMENT(CHAR_DEL_INVALID_ACHIEVMENT, "DELETE FROM character_achievement WHERE achievement = ?", CONNECTION_ASYNC);
+ PREPARE_STATEMENT(CHAR_ADD_ADDON, "INSERT INTO addons (name, crc) VALUES (?, ?)", CONNECTION_ASYNC);
+ PREPARE_STATEMENT(CHAR_DEL_INVALID_PET_SPELL, "DELETE FROM pet_spell WHERE spell = ?", CONNECTION_ASYNC);
+ PREPARE_STATEMENT(CHAR_DEL_GROUP_INSTANCE_BY_INSTANCE, "DELETE FROM group_instance WHERE instance = ?", CONNECTION_ASYNC);
+ PREPARE_STATEMENT(CHAR_DEL_GROUP_INSTANCE_BY_GUID, "DELETE FROM group_instance WHERE guid = ? AND instance = ?", CONNECTION_ASYNC);
+ PREPARE_STATEMENT(CHAR_ADD_GROUP_INSTANCE, "REPLACE INTO group_instance (guid, instance, permanent) VALUES (?, ?, ?)", CONNECTION_ASYNC);
+ PREPARE_STATEMENT(CHAR_UPDATE_INSTANCE_RESETTIME, "UPDATE instance SET resettime = ? WHERE id = ?", CONNECTION_ASYNC);
+ PREPARE_STATEMENT(CHAR_UPDATE_GLOBAL_INSTANCE_RESETTIME, "UPDATE instance_reset SET resettime = ? WHERE mapid = ? AND difficulty = ?", CONNECTION_ASYNC);
}
diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.h b/src/server/shared/Database/Implementation/CharacterDatabase.h
index 636a8221d85..691b1f61706 100755
--- a/src/server/shared/Database/Implementation/CharacterDatabase.h
+++ b/src/server/shared/Database/Implementation/CharacterDatabase.h
@@ -104,6 +104,7 @@ enum CharacterDatabaseStatements
CHAR_ADD_MAIL,
CHAR_DEL_MAIL,
CHAR_ADD_MAIL_ITEM,
+ CHAR_DEL_INVALID_MAIL_ITEM,
CHAR_DEL_EMPTY_EXPIRED_MAIL,
CHAR_GET_EXPIRED_MAIL,
CHAR_GET_EXPIRED_MAIL_ITEMS,
@@ -278,6 +279,7 @@ enum CharacterDatabaseStatements
CHAR_LOAD_GM_TICKETS,
CHAR_ADD_GM_TICKET,
CHAR_DEL_GM_TICKET,
+ CHAR_DEL_ALL_GM_TICKETS,
CHAR_DEL_PLAYER_GM_TICKETS,
CHAR_ADD_GM_SURVEY,
@@ -290,10 +292,34 @@ enum CharacterDatabaseStatements
CHAR_UPD_CHARACTER,
CHAR_UPDATE_AT_LOGIN_FLAG,
+ CHAR_UPDATE_ALL_AT_LOGIN_FLAGS,
CHAR_ADD_BUG_REPORT,
CHAR_UPD_PETITION_NAME,
CHAR_ADD_PETITION_SIGNATURE,
CHAR_UPD_ACCOUNT_ONLINE,
+ CHAR_ADD_GROUP,
+ CHAR_ADD_GROUP_MEMBER,
+ CHAR_DEL_GROUP_MEMBER,
+ CHAR_DEL_GROUP_INSTANCE_PERM_BINDING,
+ CHAR_UPDATE_GROUP_LEADER,
+ CHAR_UPDATE_GROUP_TYPE,
+ CHAR_UPDATE_GROUP_MEMBER_SUBGROUP,
+ CHAR_UPDATE_GROUP_MEMBER_FLAG,
+ CHAR_UPDATE_GROUP_DIFFICULTY,
+ CHAR_UPDATE_GROUP_RAID_DIFFICULTY,
+ CHAR_DEL_INVALID_SPELL,
+ CHAR_UPDATE_DELETE_INFO,
+ CHAR_UPDATE_ZONE,
+ CHAR_UPDATE_LEVEL,
+ CHAR_DEL_INVALID_ACHIEV_PROGRESS_CRITERIA,
+ CHAR_DEL_INVALID_ACHIEVMENT,
+ CHAR_ADD_ADDON,
+ CHAR_DEL_INVALID_PET_SPELL,
+ CHAR_DEL_GROUP_INSTANCE_BY_INSTANCE,
+ CHAR_DEL_GROUP_INSTANCE_BY_GUID,
+ CHAR_ADD_GROUP_INSTANCE,
+ CHAR_UPDATE_INSTANCE_RESETTIME,
+ CHAR_UPDATE_GLOBAL_INSTANCE_RESETTIME,
MAX_CHARACTERDATABASE_STATEMENTS,
};
diff --git a/src/server/shared/Database/Implementation/LoginDatabase.cpp b/src/server/shared/Database/Implementation/LoginDatabase.cpp
index 9a7514ff053..713d4a31e6d 100755
--- a/src/server/shared/Database/Implementation/LoginDatabase.cpp
+++ b/src/server/shared/Database/Implementation/LoginDatabase.cpp
@@ -55,4 +55,5 @@ void LoginDatabaseConnection::DoPrepareStatements()
PREPARE_STATEMENT(LOGIN_UPDATE_USERNAME, "UPDATE account SET v = 0, s = 0, username = ?, sha_pass_hash = ? WHERE id = ?", CONNECTION_ASYNC);
PREPARE_STATEMENT(LOGIN_UPDATE_PASSWORD, "UPDATE account SET v = 0, s = 0, sha_pass_hash = ? WHERE id = ?", CONNECTION_ASYNC);
PREPARE_STATEMENT(LOGIN_UPDATE_MUTE_TIME, "UPDATE account SET mutetime = ? WHERE id = ?", CONNECTION_ASYNC);
+ PREPARE_STATEMENT(LOGIN_UPDATE_LAST_IP, "UPDATE account SET last_ip = ? WHERE username = ?", CONNECTION_ASYNC);
}
diff --git a/src/server/shared/Database/Implementation/LoginDatabase.h b/src/server/shared/Database/Implementation/LoginDatabase.h
index 96b437372d6..98d9c505fa0 100755
--- a/src/server/shared/Database/Implementation/LoginDatabase.h
+++ b/src/server/shared/Database/Implementation/LoginDatabase.h
@@ -75,6 +75,7 @@ enum LoginDatabaseStatements
LOGIN_UPDATE_USERNAME,
LOGIN_UPDATE_PASSWORD,
LOGIN_UPDATE_MUTE_TIME,
+ LOGIN_UPDATE_LAST_IP,
MAX_LOGINDATABASE_STATEMENTS,
};
diff --git a/src/server/shared/Database/Implementation/WorldDatabase.cpp b/src/server/shared/Database/Implementation/WorldDatabase.cpp
index ebf60e3d20e..5df8299310f 100755
--- a/src/server/shared/Database/Implementation/WorldDatabase.cpp
+++ b/src/server/shared/Database/Implementation/WorldDatabase.cpp
@@ -26,6 +26,8 @@ void WorldDatabaseConnection::DoPrepareStatements()
PREPARE_STATEMENT(WORLD_DEL_CRELINKED_RESPAWN, "DELETE FROM linked_respawn WHERE guid = ?", CONNECTION_ASYNC)
PREPARE_STATEMENT(WORLD_REP_CRELINKED_RESPAWN, "REPLACE INTO linked_respawn (guid, linkedGuid) VALUES (?, ?)", CONNECTION_ASYNC)
PREPARE_STATEMENT(WORLD_LOAD_CRETEXT, "SELECT entry, groupid, id, text, type, language, probability, emote, duration, sound FROM creature_text", CONNECTION_SYNCH)
- PREPARE_STATEMENT(WORLD_LOAD_SMART_SCRIPTS, "SELECT entryorguid, source_type, id, link, event_type, event_phase_mask, event_chance, event_flags, event_param1, event_param2, event_param3, event_param4, action_type, action_param1, action_param2, action_param3, action_param4, action_param5, action_param6, target_type, target_param1, target_param2, target_param3, target_x, target_y, target_z, target_o FROM smart_scripts ORDER BY entryorguid, source_type, id, link", CONNECTION_SYNCH)
- PREPARE_STATEMENT(WORLD_LOAD_SMARTAI_WP, "SELECT entry, pointid, position_x, position_y, position_z FROM waypoints ORDER BY entry, pointid", CONNECTION_SYNCH)
+ PREPARE_STATEMENT(WORLD_LOAD_SMART_SCRIPTS, "SELECT entryorguid, source_type, id, link, event_type, event_phase_mask, event_chance, event_flags, event_param1, event_param2, event_param3, event_param4, action_type, action_param1, action_param2, action_param3, action_param4, action_param5, action_param6, target_type, target_param1, target_param2, target_param3, target_x, target_y, target_z, target_o FROM smart_scripts ORDER BY entryorguid, source_type, id, link", CONNECTION_SYNCH)
+ PREPARE_STATEMENT(WORLD_LOAD_SMARTAI_WP, "SELECT entry, pointid, position_x, position_y, position_z FROM waypoints ORDER BY entry, pointid", CONNECTION_SYNCH)
+ PREPARE_STATEMENT(WORLD_DEL_GAMEOBJECT, "DELETE FROM gameobject WHERE guid = ?", CONNECTION_ASYNC);
+ PREPARE_STATEMENT(WORLD_DEL_EVENT_GAMEOBJECT, "DELETE FROM game_event_gameobject WHERE guid = ?", CONNECTION_ASYNC);
}
diff --git a/src/server/shared/Database/Implementation/WorldDatabase.h b/src/server/shared/Database/Implementation/WorldDatabase.h
index 274ea4350c9..94d6365c081 100755
--- a/src/server/shared/Database/Implementation/WorldDatabase.h
+++ b/src/server/shared/Database/Implementation/WorldDatabase.h
@@ -48,6 +48,8 @@ enum WorldDatabaseStatements
WORLD_LOAD_CRETEXT,
WORLD_LOAD_SMART_SCRIPTS,
WORLD_LOAD_SMARTAI_WP,
+ WORLD_DEL_GAMEOBJECT,
+ WORLD_DEL_EVENT_GAMEOBJECT,
MAX_WORLDDATABASE_STATEMENTS,
};