Core/Auras: Fixed saving auras with same spell id but different item source

This commit is contained in:
Shauren authored and Ovahlord committed 2022-09-12 09:15:21 +02:00
1 parent b4b8fffa22
commit dc8bf301bb
8 files changed
+36 -29

No files matched your search

+21 -18
View File
@@ -17955,9 +17955,9 @@ void Player::_LoadAuras(PreparedQueryResult result, uint32 timediff)
{
TC_LOG_DEBUG("entities.player.loading", "Player::_LoadAuras: Loading auras for %s", GetGUID().ToString().c_str());
/* 0 1 2 3 4 5 6 7 8 9 10
QueryResult* result = CharacterDatabase.PQuery("SELECT casterGuid, spell, effectMask, recalculateMask, stackCount, amount0, amount1, amount2, base_amount0, base_amount1, base_amount2,
11 12 13 14 15
/* 0 1 2 3 4 5 6 7 8 9 10 11
QueryResult* result = CharacterDatabase.PQuery("SELECT casterGuid, itemGuid, spell, effectMask, recalculateMask, stackCount, amount0, amount1, amount2, base_amount0, base_amount1, base_amount2,
12 13 14 15 16
maxDuration, remainTime, remainCharges, critChance, applyResilience FROM character_aura WHERE guid = '%u'", GetGUID().GetCounter());
*/
@@ -17969,21 +17969,22 @@ void Player::_LoadAuras(PreparedQueryResult result, uint32 timediff)
int32 damage[3];
int32 baseDamage[3];
ObjectGuid caster_guid(fields[0].GetUInt64());
uint32 spellid = fields[1].GetUInt32();
uint8 effmask = fields[2].GetUInt8();
uint8 recalculatemask = fields[3].GetUInt8();
uint8 stackcount = fields[4].GetUInt8();
damage[0] = fields[5].GetInt32();
damage[1] = fields[6].GetInt32();
damage[2] = fields[7].GetInt32();
baseDamage[0] = fields[8].GetInt32();
baseDamage[1] = fields[9].GetInt32();
baseDamage[2] = fields[10].GetInt32();
int32 maxduration = fields[11].GetInt32();
int32 remaintime = fields[12].GetInt32();
uint8 remaincharges = fields[13].GetUInt8();
float critChance = fields[14].GetFloat();
bool applyResilience = fields[15].GetBool();
ObjectGuid itemGuid(fields[1].GetUInt64());
uint32 spellid = fields[2].GetUInt32();
uint8 effmask = fields[3].GetUInt8();
uint8 recalculatemask = fields[4].GetUInt8();
uint8 stackcount = fields[5].GetUInt8();
damage[0] = fields[6].GetInt32();
damage[1] = fields[7].GetInt32();
damage[2] = fields[8].GetInt32();
baseDamage[0] = fields[9].GetInt32();
baseDamage[1] = fields[10].GetInt32();
baseDamage[2] = fields[11].GetInt32();
int32 maxduration = fields[12].GetInt32();
int32 remaintime = fields[13].GetInt32();
uint8 remaincharges = fields[14].GetUInt8();
float critChance = fields[15].GetFloat();
bool applyResilience = fields[16].GetBool();
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellid);
if (!spellInfo)
@@ -18016,6 +18017,7 @@ void Player::_LoadAuras(PreparedQueryResult result, uint32 timediff)
AuraCreateInfo createInfo(spellInfo, effmask, this);
createInfo
.SetCasterGUID(caster_guid)
.SetCastItemGUID(itemGuid)
.SetBaseAmount(baseDamage);
if (Aura* aura = Aura::TryCreate(createInfo))
@@ -19934,6 +19936,7 @@ void Player::_SaveAuras(CharacterDatabaseTransaction& trans)
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_AURA);
stmt->setUInt32(index++, GetGUID().GetCounter());
stmt->setUInt64(index++, itr->second->GetCasterGUID().GetRawValue());
stmt->setUInt64(index++, itr->second->GetCastItemGUID().GetRawValue());
stmt->setUInt32(index++, itr->second->GetId());
stmt->setUInt8(index++, effMask);
stmt->setUInt8(index++, recalculateMask);