[11787] Clean up some redundant GetSpellDuration calls

This commit is contained in:
zergtmn 2011-09-05 20:00:32 +06:00
parent 49a504141a
commit e7873b8ad8
2 changed files with 15 additions and 21 deletions

View file

@ -1389,7 +1389,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx)
// set loot recipient, prevent re-use same target
pCreature->SetLootRecipient(m_caster);
pCreature->ForcedDespawn(GetSpellDuration(m_spellInfo));
pCreature->ForcedDespawn(m_duration);
// EFFECT_INDEX_2 has 0 miscvalue for effect 134, doing the killcredit here instead (only one known case exist where 0)
((Player*)m_caster)->KilledMonster(pCreature->GetCreatureInfo(), pCreature->GetObjectGuid());
@ -1589,7 +1589,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx)
if (const SpellEntry *pSpell = sSpellStore.LookupEntry(45991))
{
unitTarget->CastSpell(unitTarget, pSpell, true);
((Creature*)unitTarget)->ForcedDespawn(GetSpellDuration(pSpell) + 1);
((Creature*)unitTarget)->ForcedDespawn(m_duration);
}
return;
@ -4971,12 +4971,11 @@ void Spell::EffectAddFarsight(SpellEffectIndex eff_idx)
if(m_caster->GetTypeId() != TYPEID_PLAYER)
return;
int32 duration = GetSpellDuration(m_spellInfo);
DynamicObject* dynObj = new DynamicObject;
// set radius to 0: spell not expected to work as persistent aura
if(!dynObj->Create(m_caster->GetMap()->GenerateLocalLowGuid(HIGHGUID_DYNAMICOBJECT), m_caster,
m_spellInfo->Id, eff_idx, m_targets.m_destX, m_targets.m_destY, m_targets.m_destZ, duration, 0, DYNAMIC_OBJECT_FARSIGHT_FOCUS))
m_spellInfo->Id, eff_idx, m_targets.m_destX, m_targets.m_destY, m_targets.m_destZ, m_duration, 0, DYNAMIC_OBJECT_FARSIGHT_FOCUS))
{
delete dynObj;
return;
@ -5014,8 +5013,7 @@ void Spell::DoSummonWild(SpellEffectIndex eff_idx, uint32 forceFaction)
float center_z = m_targets.m_destZ;
float radius = GetSpellRadius(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[eff_idx]));
int32 duration = GetSpellDuration(m_spellInfo);
TempSummonType summonType = (duration == 0) ? TEMPSUMMON_DEAD_DESPAWN : TEMPSUMMON_TIMED_OR_DEAD_DESPAWN;
TempSummonType summonType = (m_duration == 0) ? TEMPSUMMON_DEAD_DESPAWN : TEMPSUMMON_TIMED_OR_DEAD_DESPAWN;
int32 amount = damage > 0 ? damage : 1;
@ -5053,7 +5051,7 @@ void Spell::DoSummonWild(SpellEffectIndex eff_idx, uint32 forceFaction)
}
}
if(Creature *summon = m_caster->SummonCreature(creature_entry, px, py, pz, m_caster->GetOrientation(), summonType, duration))
if (Creature *summon = m_caster->SummonCreature(creature_entry, px, py, pz, m_caster->GetOrientation(), summonType, m_duration))
{
summon->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id);
@ -6138,9 +6136,7 @@ void Spell::EffectSummonObjectWild(SpellEffectIndex eff_idx)
return;
}
int32 duration = GetSpellDuration(m_spellInfo);
pGameObj->SetRespawnTime(duration > 0 ? duration/IN_MILLISECONDS : 0);
pGameObj->SetRespawnTime(m_duration > 0 ? m_duration/IN_MILLISECONDS : 0);
pGameObj->SetSpellId(m_spellInfo->Id);
// Wild object not have owner and check clickable by players
@ -7825,8 +7821,8 @@ void Spell::EffectDuel(SpellEffectIndex eff_idx)
pGameObj->SetUInt32Value(GAMEOBJECT_FACTION, m_caster->getFaction() );
pGameObj->SetUInt32Value(GAMEOBJECT_LEVEL, m_caster->getLevel()+1 );
int32 duration = GetSpellDuration(m_spellInfo);
pGameObj->SetRespawnTime(duration > 0 ? duration/IN_MILLISECONDS : 0);
pGameObj->SetRespawnTime(m_duration > 0 ? m_duration/IN_MILLISECONDS : 0);
pGameObj->SetSpellId(m_spellInfo->Id);
m_caster->AddGameObject(pGameObj);
@ -8048,7 +8044,7 @@ void Spell::EffectEnchantHeldItem(SpellEffectIndex eff_idx)
if (m_spellInfo->EffectMiscValue[eff_idx])
{
uint32 enchant_id = m_spellInfo->EffectMiscValue[eff_idx];
int32 duration = GetSpellDuration(m_spellInfo); // Try duration index first...
int32 duration = m_duration; // Try duration index first...
if(!duration)
duration = m_currentBasePoints[eff_idx]; // Base points after...
if(!duration)
@ -8189,8 +8185,7 @@ void Spell::EffectSummonObject(SpellEffectIndex eff_idx)
}
pGameObj->SetUInt32Value(GAMEOBJECT_LEVEL, m_caster->getLevel());
int32 duration = GetSpellDuration(m_spellInfo);
pGameObj->SetRespawnTime(duration > 0 ? duration/IN_MILLISECONDS : 0);
pGameObj->SetRespawnTime(m_duration > 0 ? m_duration/IN_MILLISECONDS : 0);
pGameObj->SetSpellId(m_spellInfo->Id);
m_caster->AddGameObject(pGameObj);
@ -8521,9 +8516,8 @@ void Spell::DoSummonCritter(SpellEffectIndex eff_idx, uint32 forceFaction)
// some mini-pets have quests
// set timer for unsummon
int32 duration = GetSpellDuration(m_spellInfo);
if(duration > 0)
critter->SetDuration(duration);
if(m_duration > 0)
critter->SetDuration(m_duration);
m_caster->SetMiniPet(critter);
@ -8797,7 +8791,7 @@ void Spell::EffectTransmitted(SpellEffectIndex eff_idx)
return;
}
int32 duration = GetSpellDuration(m_spellInfo);
int32 duration = m_duration;
switch(goinfo->type)
{

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "11786"
#define REVISION_NR "11787"
#endif // __REVISION_NR_H__