aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMeji <alvaromegias_46@hotmail.com>2022-02-06 21:46:28 +0100
committerGitHub <noreply@github.com>2022-02-06 21:46:28 +0100
commitfa3cba3a00bbb6286499818f6a1f8675579a9d78 (patch)
tree4d4085cb51b3acdffcef3002a4378fe59d0baa46 /src
parentf3e908dc997833d3e2c5297471210bf075121f90 (diff)
Core/BattlePets: Delete declined names of non-account battle pets when deleting character permanently (#27706)
Diffstat (limited to 'src')
-rw-r--r--src/server/database/Database/Implementation/LoginDatabase.cpp1
-rw-r--r--src/server/database/Database/Implementation/LoginDatabase.h1
-rw-r--r--src/server/game/Entities/Player/Player.cpp7
3 files changed, 8 insertions, 1 deletions
diff --git a/src/server/database/Database/Implementation/LoginDatabase.cpp b/src/server/database/Database/Implementation/LoginDatabase.cpp
index e3e200c701c..09372319688 100644
--- a/src/server/database/Database/Implementation/LoginDatabase.cpp
+++ b/src/server/database/Database/Implementation/LoginDatabase.cpp
@@ -170,6 +170,7 @@ void LoginDatabaseConnection::DoPrepareStatements()
PrepareStatement(LOGIN_DEL_BATTLE_PET_SLOTS, "DELETE FROM battle_pet_slots WHERE battlenetAccountId = ?", CONNECTION_ASYNC);
PrepareStatement(LOGIN_INS_BATTLE_PET_DECLINED_NAME, "INSERT INTO battle_pet_declinedname (guid, genitive, dative, accusative, instrumental, prepositional) VALUES (?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC);
PrepareStatement(LOGIN_DEL_BATTLE_PET_DECLINED_NAME, "DELETE FROM battle_pet_declinedname WHERE guid = ?", CONNECTION_ASYNC);
+ PrepareStatement(LOGIN_DEL_BATTLE_PET_DECLINED_NAME_BY_OWNER, "DELETE dn FROM battle_pet_declinedname dn INNER JOIN battle_pets bp ON dn.guid = bp.guid WHERE bp.owner = ? AND bp.ownerRealmId = ?", CONNECTION_ASYNC);
PrepareStatement(LOGIN_SEL_ACCOUNT_HEIRLOOMS, "SELECT itemId, flags FROM battlenet_account_heirlooms WHERE accountId = ?", CONNECTION_ASYNC);
PrepareStatement(LOGIN_REP_ACCOUNT_HEIRLOOMS, "REPLACE INTO battlenet_account_heirlooms (accountId, itemId, flags) VALUES (?, ?, ?)", CONNECTION_ASYNC);
diff --git a/src/server/database/Database/Implementation/LoginDatabase.h b/src/server/database/Database/Implementation/LoginDatabase.h
index 8d1438d0f56..d46e441d961 100644
--- a/src/server/database/Database/Implementation/LoginDatabase.h
+++ b/src/server/database/Database/Implementation/LoginDatabase.h
@@ -159,6 +159,7 @@ enum LoginDatabaseStatements : uint32
LOGIN_DEL_BATTLE_PET_SLOTS,
LOGIN_INS_BATTLE_PET_DECLINED_NAME,
LOGIN_DEL_BATTLE_PET_DECLINED_NAME,
+ LOGIN_DEL_BATTLE_PET_DECLINED_NAME_BY_OWNER,
LOGIN_SEL_ACCOUNT_HEIRLOOMS,
LOGIN_REP_ACCOUNT_HEIRLOOMS,
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 1bf9e3b66a5..0116dea0f61 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -4158,9 +4158,14 @@ void Player::DeleteFromDB(ObjectGuid playerguid, uint32 accountId, bool updateRe
stmt->setUInt64(0, guid);
trans->Append(stmt);
+ loginStmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_BATTLE_PET_DECLINED_NAME_BY_OWNER);
+ loginStmt->setInt64(0, guid);
+ loginStmt->setInt32(1, realm.Id.Realm);
+ loginTransaction->Append(loginStmt);
+
loginStmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_BATTLE_PETS_BY_OWNER);
loginStmt->setInt64(0, guid);
- loginStmt->setInt32(0, realm.Id.Realm);
+ loginStmt->setInt32(1, realm.Id.Realm);
loginTransaction->Append(loginStmt);
Corpse::DeleteFromDB(playerguid, trans);