Core/Items: Fixed deleting items from db leaving orphaned transmog/artifact/modifier data when deleted from outside of player item update queue

Port From (https://github.com/TrinityCore/TrinityCore/commit/f8cb710c7e6699c5542e9e435c3b7d2d8096669d)
This commit is contained in:
hondacrx
2019-12-02 22:49:54 -05:00
parent 013933d7f5
commit cd396cdda5
5 changed files with 119 additions and 79 deletions
+12 -8
View File
@@ -188,20 +188,24 @@ namespace Game.Entities
}
public override void DeleteFromDB(SQLTransaction trans)
{
DeleteFromDB(trans, GetGUID().GetCounter());
base.DeleteFromDB(trans);
}
public new static void DeleteFromDB(SQLTransaction trans, ulong itemGuid)
{
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_AZERITE);
stmt.AddValue(0, GetGUID().GetCounter());
trans.Append(stmt);
stmt.AddValue(0, itemGuid);
DB.Characters.ExecuteOrAppend(trans, stmt);
stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_AZERITE_MILESTONE_POWER);
stmt.AddValue(0, GetGUID().GetCounter());
trans.Append(stmt);
stmt.AddValue(0, itemGuid);
DB.Characters.ExecuteOrAppend(trans, stmt);
stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_AZERITE_UNLOCKED_ESSENCE);
stmt.AddValue(0, GetGUID().GetCounter());
trans.Append(stmt);
base.DeleteFromDB(trans);
stmt.AddValue(0, itemGuid);
DB.Characters.ExecuteOrAppend(trans, stmt);
}
public uint GetLevel() { return m_azeriteItemData.Level; }
+25 -1
View File
@@ -617,7 +617,31 @@ namespace Game.Entities
{
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE);
stmt.AddValue(0, itemGuid);
trans.Append(stmt);
DB.Characters.ExecuteOrAppend(trans, stmt);
stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_GEMS);
stmt.AddValue(0, itemGuid);
DB.Characters.ExecuteOrAppend(trans, stmt);
stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_TRANSMOG);
stmt.AddValue(0, itemGuid);
DB.Characters.ExecuteOrAppend(trans, stmt);
stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_ARTIFACT);
stmt.AddValue(0, itemGuid);
DB.Characters.ExecuteOrAppend(trans, stmt);
stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_ARTIFACT_POWERS);
stmt.AddValue(0, itemGuid);
DB.Characters.ExecuteOrAppend(trans, stmt);
stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_ITEM_INSTANCE_MODIFIERS);
stmt.AddValue(0, itemGuid);
DB.Characters.ExecuteOrAppend(trans, stmt);
stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_GIFT);
stmt.AddValue(0, itemGuid);
DB.Characters.ExecuteOrAppend(trans, stmt);
}
public virtual void DeleteFromDB(SQLTransaction trans)