mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 16:37:01 +00:00
[9816] Add script effect of spell 44462
Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
parent
4fd4c1da3f
commit
ebc5de7477
2 changed files with 42 additions and 2 deletions
|
|
@ -54,6 +54,7 @@
|
||||||
#include "ScriptCalls.h"
|
#include "ScriptCalls.h"
|
||||||
#include "SkillDiscovery.h"
|
#include "SkillDiscovery.h"
|
||||||
#include "Formulas.h"
|
#include "Formulas.h"
|
||||||
|
#include "GridNotifiers.h"
|
||||||
|
|
||||||
pEffect SpellEffects[TOTAL_SPELL_EFFECTS]=
|
pEffect SpellEffects[TOTAL_SPELL_EFFECTS]=
|
||||||
{
|
{
|
||||||
|
|
@ -5502,15 +5503,54 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx)
|
||||||
if (pTarget->hasUnitState(UNIT_STAT_ROAMING | UNIT_STAT_ROAMING_MOVE))
|
if (pTarget->hasUnitState(UNIT_STAT_ROAMING | UNIT_STAT_ROAMING_MOVE))
|
||||||
pTarget->GetMotionMaster()->MovementExpired();
|
pTarget->GetMotionMaster()->MovementExpired();
|
||||||
|
|
||||||
|
// trigger cast of quest complete script (see code for this spell below)
|
||||||
|
pTarget->CastSpell(pTarget, 44462, true);
|
||||||
|
|
||||||
pTarget->GetMotionMaster()->MovePoint(0, m_caster->GetPositionX(), m_caster->GetPositionY(), m_caster->GetPositionZ());
|
pTarget->GetMotionMaster()->MovePoint(0, m_caster->GetPositionX(), m_caster->GetPositionY(), m_caster->GetPositionZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// or if we are first time used item
|
// or if it is first time used item, cast summon and despawn the target
|
||||||
m_caster->CastSpell(pTarget, pSpell, true);
|
m_caster->CastSpell(pTarget, pSpell, true);
|
||||||
pTarget->ForcedDespawn();
|
pTarget->ForcedDespawn();
|
||||||
|
|
||||||
|
// TODO: here we should get pointer to the just summoned and make it move.
|
||||||
|
// without, it will be one extra use of quest item
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
case 44462: // Cast Quest Complete on Master
|
||||||
|
{
|
||||||
|
if (m_caster->GetTypeId() != TYPEID_UNIT)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Creature* pQuestCow = NULL;
|
||||||
|
|
||||||
|
float range = 20.0f;
|
||||||
|
|
||||||
|
// search for a reef cow nearby
|
||||||
|
MaNGOS::NearestCreatureEntryWithLiveStateInObjectRangeCheck u_check(*m_caster, 24797, true, range);
|
||||||
|
MaNGOS::CreatureLastSearcher<MaNGOS::NearestCreatureEntryWithLiveStateInObjectRangeCheck> searcher(m_caster, pQuestCow, u_check);
|
||||||
|
|
||||||
|
Cell::VisitGridObjects(m_caster, searcher, range);
|
||||||
|
|
||||||
|
// no cows found, so return
|
||||||
|
if (!pQuestCow)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!((Creature*)m_caster)->isTemporarySummon())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (const SpellEntry *pSpell = sSpellStore.LookupEntry(m_spellInfo->CalculateSimpleValue(eff_idx)))
|
||||||
|
{
|
||||||
|
TemporarySummon* pSummon = (TemporarySummon*)m_caster;
|
||||||
|
|
||||||
|
// all ok, so make summoner cast the quest complete
|
||||||
|
if (Unit* pSummoner = pSummon->GetSummoner())
|
||||||
|
pSummoner->CastSpell(pSummoner, pSpell, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "9815"
|
#define REVISION_NR "9816"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue