[11278] Fixed auras stack size check at loading.

For non stacking auras preserve stack size 1 as auras created instead reset it to 0 at mnext load.
For client no difference in show and most non stacking auras not dependent from stack size value
at server side code, but any way set stack size to 0 can generate unexpected wrong caluclation results
in spell code.
This commit is contained in:
VladimirMangos 2011-03-23 05:33:15 +03:00
parent 96183f8e3f
commit 0751a35342
3 changed files with 18 additions and 9 deletions

View file

@ -1220,7 +1220,7 @@ void Pet::_LoadAuras(uint32 timediff)
uint32 effIndexMask = (int32)fields[14].GetUInt32(); uint32 effIndexMask = (int32)fields[14].GetUInt32();
SpellEntry const* spellproto = sSpellStore.LookupEntry(spellid); SpellEntry const* spellproto = sSpellStore.LookupEntry(spellid);
if(!spellproto) if (!spellproto)
{ {
sLog.outError("Unknown spell (spellid %u), ignore.",spellid); sLog.outError("Unknown spell (spellid %u), ignore.",spellid);
continue; continue;
@ -1232,16 +1232,21 @@ void Pet::_LoadAuras(uint32 timediff)
// prevent wrong values of remaincharges // prevent wrong values of remaincharges
uint32 procCharges = spellproto->procCharges; uint32 procCharges = spellproto->procCharges;
if(procCharges) if (procCharges)
{ {
if(remaincharges <= 0 || remaincharges > (int32)procCharges) if (remaincharges <= 0 || remaincharges > (int32)procCharges)
remaincharges = procCharges; remaincharges = procCharges;
} }
else else
remaincharges = 0; remaincharges = 0;
if (spellproto->StackAmount < stackcount) if (!spellproto->StackAmount)
stackcount = 1;
else if (spellproto->StackAmount < stackcount)
stackcount = spellproto->StackAmount; stackcount = spellproto->StackAmount;
else if (!stackcount)
stackcount = 1;
SpellAuraHolder *holder = CreateSpellAuraHolder(spellproto, this, NULL); SpellAuraHolder *holder = CreateSpellAuraHolder(spellproto, this, NULL);
for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i) for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i)

View file

@ -15957,23 +15957,27 @@ void Player::_LoadAuras(QueryResult *result, uint32 timediff)
uint32 effIndexMask = (int32)fields[14].GetUInt32(); uint32 effIndexMask = (int32)fields[14].GetUInt32();
SpellEntry const* spellproto = sSpellStore.LookupEntry(spellid); SpellEntry const* spellproto = sSpellStore.LookupEntry(spellid);
if(!spellproto) if (!spellproto)
{ {
sLog.outError("Unknown spell (spellid %u), ignore.",spellid); sLog.outError("Unknown spell (spellid %u), ignore.",spellid);
continue; continue;
} }
// prevent wrong values of remaincharges // prevent wrong values of remaincharges
if(spellproto->procCharges) if (spellproto->procCharges)
{ {
if(remaincharges <= 0 || remaincharges > (int32)spellproto->procCharges) if (remaincharges <= 0 || remaincharges > (int32)spellproto->procCharges)
remaincharges = spellproto->procCharges; remaincharges = spellproto->procCharges;
} }
else else
remaincharges = 0; remaincharges = 0;
if (spellproto->StackAmount < stackcount) if (!spellproto->StackAmount)
stackcount = 1;
else if (spellproto->StackAmount < stackcount)
stackcount = spellproto->StackAmount; stackcount = spellproto->StackAmount;
else if (!stackcount)
stackcount = 1;
SpellAuraHolder *holder = CreateSpellAuraHolder(spellproto, this, NULL); SpellAuraHolder *holder = CreateSpellAuraHolder(spellproto, this, NULL);
for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i) for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i)

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "11277" #define REVISION_NR "11278"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__