[10470] Fixed totem owner faction/level set for creature onwer case.

When totem created creature owner alos not in world yet.

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
Vinolentus 2010-09-11 14:52:30 +04:00 committed by VladimirMangos
parent 54d991ef3a
commit 73a85b0989
4 changed files with 8 additions and 11 deletions

View file

@ -6889,7 +6889,7 @@ void Spell::DoSummonTotem(SpellEffectIndex eff_idx, uint8 slot_dbc)
if (slot < MAX_TOTEM_SLOT) if (slot < MAX_TOTEM_SLOT)
m_caster->_AddTotem(TotemSlot(slot),pTotem); m_caster->_AddTotem(TotemSlot(slot),pTotem);
pTotem->SetOwner(m_caster->GetGUID()); pTotem->SetOwner(m_caster);
pTotem->SetTypeBySummonSpell(m_spellInfo); // must be after Create call where m_spells initialized pTotem->SetTypeBySummonSpell(m_spellInfo); // must be after Create call where m_spells initialized
int32 duration=GetSpellDuration(m_spellInfo); int32 duration=GetSpellDuration(m_spellInfo);

View file

@ -109,15 +109,12 @@ void Totem::UnSummon()
AddObjectToRemoveList(); AddObjectToRemoveList();
} }
void Totem::SetOwner(uint64 guid) void Totem::SetOwner(Unit* owner)
{ {
SetCreatorGUID(guid); SetCreatorGUID(owner->GetGUID());
SetOwnerGUID(guid); SetOwnerGUID(owner->GetGUID());
if (Unit *owner = GetOwner()) setFaction(owner->getFaction());
{ SetLevel(owner->getLevel());
setFaction(owner->getFaction());
SetLevel(owner->getLevel());
}
} }
Unit *Totem::GetOwner() Unit *Totem::GetOwner()

View file

@ -42,7 +42,7 @@ class Totem : public Creature
TotemType GetTotemType() const { return m_type; } TotemType GetTotemType() const { return m_type; }
void SetTypeBySummonSpell(SpellEntry const * spellProto); void SetTypeBySummonSpell(SpellEntry const * spellProto);
void SetDuration(uint32 dur) { m_duration = dur; } void SetDuration(uint32 dur) { m_duration = dur; }
void SetOwner(uint64 guid); void SetOwner(Unit* owner);
bool UpdateStats(Stats /*stat*/) { return true; } bool UpdateStats(Stats /*stat*/) { return true; }
bool UpdateAllStats() { return true; } bool UpdateAllStats() { return true; }

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 "10469" #define REVISION_NR "10470"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__