[11073] Prevent applying SPELLMOD_DURATION for summons with unlimited duration.

Fixes summon duration of spell 70908 in combination with talent 44557 and ranks.
This commit is contained in:
Lynx3d 2011-01-26 02:56:59 +01:00
parent 47ef4eca32
commit 6fbf464786
3 changed files with 20 additions and 15 deletions

View file

@ -1908,6 +1908,8 @@ bool Pet::IsPermanentPetFor(Player* owner)
case SUMMON_PET: case SUMMON_PET:
switch(owner->getClass()) switch(owner->getClass())
{ {
// oddly enough, Mage's Water Elemental is still treated as temporary pet with Glyph of Eternal Water
// i.e. does not unsummon at mounting, gets dismissed at teleport etc.
case CLASS_WARLOCK: case CLASS_WARLOCK:
return GetCreatureInfo()->type == CREATURE_TYPE_DEMON; return GetCreatureInfo()->type == CREATURE_TYPE_DEMON;
case CLASS_DEATH_KNIGHT: case CLASS_DEATH_KNIGHT:

View file

@ -4328,8 +4328,9 @@ void Spell::DoSummon(SpellEffectIndex eff_idx)
Pet* spawnCreature = new Pet(SUMMON_PET); Pet* spawnCreature = new Pet(SUMMON_PET);
int32 duration = GetSpellDuration(m_spellInfo); int32 duration = GetSpellDuration(m_spellInfo);
if(Player* modOwner = m_caster->GetSpellModOwner()) if (duration > 0)
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_DURATION, duration); if (Player* modOwner = m_caster->GetSpellModOwner())
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_DURATION, duration);
if (m_caster->GetTypeId()==TYPEID_PLAYER && spawnCreature->LoadPetFromDB((Player*)m_caster,pet_entry)) if (m_caster->GetTypeId()==TYPEID_PLAYER && spawnCreature->LoadPetFromDB((Player*)m_caster,pet_entry))
{ {
@ -4801,12 +4802,13 @@ void Spell::DoSummonGuardian(SpellEffectIndex eff_idx, uint32 forceFaction)
float radius = GetSpellRadius(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[eff_idx])); float radius = GetSpellRadius(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[eff_idx]));
int32 duration = GetSpellDuration(m_spellInfo); int32 duration = GetSpellDuration(m_spellInfo);
if(Player* modOwner = m_caster->GetSpellModOwner()) if (duration > 0)
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_DURATION, duration); if (Player* modOwner = m_caster->GetSpellModOwner())
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_DURATION, duration);
int32 amount = damage > 0 ? damage : 1; int32 amount = damage > 0 ? damage : 1;
for(int32 count = 0; count < amount; ++count) for (int32 count = 0; count < amount; ++count)
{ {
Pet* spawnCreature = new Pet(petType); Pet* spawnCreature = new Pet(petType);
@ -7276,7 +7278,7 @@ void Spell::DoSummonTotem(SpellEffectIndex eff_idx, uint8 slot_dbc)
int slot = slot_dbc ? slot_dbc - 1 : TOTEM_SLOT_NONE; int slot = slot_dbc ? slot_dbc - 1 : TOTEM_SLOT_NONE;
// unsummon old totem // unsummon old totem
if(slot < MAX_TOTEM_SLOT) if (slot < MAX_TOTEM_SLOT)
if (Totem *OldTotem = m_caster->GetTotem(TotemSlot(slot))) if (Totem *OldTotem = m_caster->GetTotem(TotemSlot(slot)))
OldTotem->UnSummon(); OldTotem->UnSummon();
@ -7286,8 +7288,8 @@ void Spell::DoSummonTotem(SpellEffectIndex eff_idx, uint8 slot_dbc)
Totem* pTotem = new Totem; Totem* pTotem = new Totem;
if(!pTotem->Create(sObjectMgr.GenerateLowGuid(HIGHGUID_UNIT), m_caster->GetMap(), m_caster->GetPhaseMask(), if (!pTotem->Create(sObjectMgr.GenerateLowGuid(HIGHGUID_UNIT), m_caster->GetMap(), m_caster->GetPhaseMask(),
m_spellInfo->EffectMiscValue[eff_idx], team )) m_spellInfo->EffectMiscValue[eff_idx], team))
{ {
delete pTotem; delete pTotem;
return; return;
@ -7306,7 +7308,7 @@ void Spell::DoSummonTotem(SpellEffectIndex eff_idx, uint8 slot_dbc)
m_caster->GetClosePoint(x, y, z, pTotem->GetObjectBoundingRadius(), 2.0f, angle); m_caster->GetClosePoint(x, y, z, pTotem->GetObjectBoundingRadius(), 2.0f, angle);
// totem must be at same Z in case swimming caster and etc. // totem must be at same Z in case swimming caster and etc.
if( fabs( z - m_caster->GetPositionZ() ) > 5 ) if (fabs( z - m_caster->GetPositionZ() ) > 5)
z = m_caster->GetPositionZ(); z = m_caster->GetPositionZ();
pTotem->Relocate(x, y, z, m_caster->GetOrientation()); pTotem->Relocate(x, y, z, m_caster->GetOrientation());
@ -7320,8 +7322,9 @@ void Spell::DoSummonTotem(SpellEffectIndex eff_idx, uint8 slot_dbc)
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);
if (Player* modOwner = m_caster->GetSpellModOwner()) if (duration > 0)
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_DURATION, duration); if (Player* modOwner = m_caster->GetSpellModOwner())
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_DURATION, duration);
pTotem->SetDuration(duration); pTotem->SetDuration(duration);
if (damage) // if not spell info, DB values used if (damage) // if not spell info, DB values used
@ -7332,13 +7335,13 @@ void Spell::DoSummonTotem(SpellEffectIndex eff_idx, uint8 slot_dbc)
pTotem->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id); pTotem->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id);
if(m_caster->GetTypeId() == TYPEID_PLAYER) if (m_caster->GetTypeId() == TYPEID_PLAYER)
pTotem->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); pTotem->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE);
if(m_caster->IsPvP()) if (m_caster->IsPvP())
pTotem->SetPvP(true); pTotem->SetPvP(true);
if(m_caster->IsFFAPvP()) if (m_caster->IsFFAPvP())
pTotem->SetFFAPvP(true); pTotem->SetFFAPvP(true);
pTotem->Summon(m_caster); pTotem->Summon(m_caster);

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 "11072" #define REVISION_NR "11073"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__