*Fix the bug that some traps without charges and spell radius cannot be triggered.
*Provide spell support for quest 12698 --HG-- branch : trunk
This commit is contained in:
+15
-11
@@ -303,20 +303,19 @@ void GameObject::Update(uint32 /*p_time*/)
|
|||||||
if(m_cooldownTime >= time(NULL))
|
if(m_cooldownTime >= time(NULL))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if(!goInfo->trap.spellId)
|
||||||
|
return;
|
||||||
|
|
||||||
bool IsBattleGroundTrap = false;
|
bool IsBattleGroundTrap = false;
|
||||||
//FIXME: this is activation radius (in different casting radius that must be selected from spell data)
|
//FIXME: this is activation radius (in different casting radius that must be selected from spell data)
|
||||||
//TODO: move activated state code (cast itself) to GO_ACTIVATED, in this place only check activating and set state
|
//TODO: move activated state code (cast itself) to GO_ACTIVATED, in this place only check activating and set state
|
||||||
float radius = 0.0f;
|
float radius = goInfo->trap.radius;
|
||||||
const SpellEntry *spellEntry = sSpellStore.LookupEntry(m_spellId);
|
if(!radius) // i think this is a hack, spell radius is determined by trap radius (spell itself does not have radius)
|
||||||
if(spellEntry)
|
if(const SpellEntry *spellEntry = sSpellStore.LookupEntry(m_spellId))
|
||||||
radius = GetSpellRadiusForHostile(sSpellRadiusStore.LookupEntry(spellEntry->EffectRadiusIndex[0]));
|
radius = goInfo->trap.radius;
|
||||||
else
|
|
||||||
radius = goInfo->trap.radius;
|
|
||||||
if(!radius)
|
if(!radius)
|
||||||
{
|
{
|
||||||
if(goInfo->trap.cooldown != 3) // cast in other case (at some triggering/linked go/etc explicit call)
|
if(goInfo->trap.cooldown == 3) // cast in other case (at some triggering/linked go/etc explicit call)
|
||||||
return;
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
if(m_respawnTime > 0)
|
if(m_respawnTime > 0)
|
||||||
break;
|
break;
|
||||||
@@ -324,13 +323,15 @@ void GameObject::Update(uint32 /*p_time*/)
|
|||||||
radius = goInfo->trap.cooldown; // battlegrounds gameobjects has data2 == 0 && data5 == 3
|
radius = goInfo->trap.cooldown; // battlegrounds gameobjects has data2 == 0 && data5 == 3
|
||||||
IsBattleGroundTrap = true;
|
IsBattleGroundTrap = true;
|
||||||
}
|
}
|
||||||
|
if(!radius)
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NeedDespawn = (goInfo->trap.charges != 0);
|
bool NeedDespawn = (goInfo->trap.charges != 0);
|
||||||
|
|
||||||
// Note: this hack with search required until GO casting not implemented
|
// Note: this hack with search required until GO casting not implemented
|
||||||
// search unfriendly creature
|
// search unfriendly creature
|
||||||
if(owner && NeedDespawn) // hunter trap
|
if(owner) // hunter trap
|
||||||
{
|
{
|
||||||
Trinity::AnyUnfriendlyNoTotemUnitInObjectRangeCheck checker(this, owner, radius);
|
Trinity::AnyUnfriendlyNoTotemUnitInObjectRangeCheck checker(this, owner, radius);
|
||||||
Trinity::UnitSearcher<Trinity::AnyUnfriendlyNoTotemUnitInObjectRangeCheck> searcher(this, ok, checker);
|
Trinity::UnitSearcher<Trinity::AnyUnfriendlyNoTotemUnitInObjectRangeCheck> searcher(this, ok, checker);
|
||||||
@@ -354,7 +355,10 @@ void GameObject::Update(uint32 /*p_time*/)
|
|||||||
|
|
||||||
CastSpell(ok, goInfo->trap.spellId);
|
CastSpell(ok, goInfo->trap.spellId);
|
||||||
//caster->CastSpell(ok, goInfo->trap.spellId, true, 0, 0, GetGUID());
|
//caster->CastSpell(ok, goInfo->trap.spellId, true, 0, 0, GetGUID());
|
||||||
m_cooldownTime = time(NULL) + 4; // 4 seconds
|
if(goInfo->trap.cooldown)
|
||||||
|
m_cooldownTime = time(NULL) + goInfo->trap.cooldown;
|
||||||
|
else
|
||||||
|
m_cooldownTime = time(NULL) + 4; // 4 seconds
|
||||||
|
|
||||||
if(NeedDespawn)
|
if(NeedDespawn)
|
||||||
SetLootState(GO_JUST_DEACTIVATED); // can be despawned or destroyed
|
SetLootState(GO_JUST_DEACTIVATED); // can be despawned or destroyed
|
||||||
|
|||||||
@@ -4892,6 +4892,10 @@ void Spell::EffectScriptEffect(uint32 effIndex)
|
|||||||
if(unitTarget)
|
if(unitTarget)
|
||||||
m_caster->CastSpell(unitTarget, 52125, false);
|
m_caster->CastSpell(unitTarget, 52125, false);
|
||||||
return;
|
return;
|
||||||
|
case 52479: // Gift of the Harvester
|
||||||
|
if(unitTarget && m_originalCaster)
|
||||||
|
m_originalCaster->CastSpell(unitTarget, urand(0, 1) ? damage : 52505, true);
|
||||||
|
return;
|
||||||
// Death Gate
|
// Death Gate
|
||||||
case 52751:
|
case 52751:
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3370,6 +3370,7 @@ void SpellMgr::LoadSpellCustomAttr()
|
|||||||
case 39365: // Thundering Storm
|
case 39365: // Thundering Storm
|
||||||
case 41071: // Raise Dead (HACK)
|
case 41071: // Raise Dead (HACK)
|
||||||
case 52124: // Sky Darkener Assault
|
case 52124: // Sky Darkener Assault
|
||||||
|
case 52479: // Gift of the Harvester
|
||||||
spellInfo->MaxAffectedTargets = 1;
|
spellInfo->MaxAffectedTargets = 1;
|
||||||
break;
|
break;
|
||||||
case 41376: // Spite
|
case 41376: // Spite
|
||||||
|
|||||||
Reference in New Issue
Block a user