Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /// Transcendence : Transfer - 119996
- class spell_monk_transcendence_transfer: public SpellScriptLoader
- {
- public:
- spell_monk_transcendence_transfer() : SpellScriptLoader("spell_monk_transcendence_transfer") { }
- class spell_monk_transcendence_transfer_SpellScript : public SpellScript
- {
- PrepareSpellScript(spell_monk_transcendence_transfer_SpellScript);
- SpellCastResult CheckSpiritRange()
- {
- if (Unit* caster = GetCaster())
- {
- for (Unit::ControlList::const_iterator itr = caster->m_Controlled.begin(); itr != caster->m_Controlled.end(); ++itr)
- {
- if ((*itr)->GetEntry() == 54569)
- {
- if ((*itr)->GetDistance(caster) > 40.0f)
- return SPELL_FAILED_DONT_REPORT;
- }
- }
- }
- return SPELL_CAST_OK;
- }
- void HandleDummy()
- {
- if (Unit* caster = GetCaster())
- {
- for (Unit::ControlList::const_iterator itr = caster->m_Controlled.begin(); itr != caster->m_Controlled.end(); ++itr)
- {
- if ((*itr)->GetEntry() == 54569)
- {
- Creature* clone = (*itr)->ToCreature();
- if (clone && clone->AI())
- clone->AI()->DoAction(1);
- }
- }
- }
- }
- void Register()
- {
- OnCheckCast += SpellCheckCastFn(spell_monk_transcendence_transfer_SpellScript::CheckSpiritRange);
- OnHit += SpellHitFn(spell_monk_transcendence_transfer_SpellScript::HandleDummy);
- }
- };
- SpellScript* GetSpellScript() const
- {
- return new spell_monk_transcendence_transfer_SpellScript();
- }
- };
- /*######
- ## npc_transcendence_spirit -- 54569
- ######*/
- enum TranscendenceSpiritSpells
- {
- SPELL_MEDITATE = 124416,
- SPELL_ROOT_FOR_EVER = 31366,
- SPELL_VISUAL_SPIRIT = 119053,
- SPELL_INITIALIZE_IMAGES = 102284,
- SPELL_CLONE_CASTER = 102288
- };
- enum transcendenceActions
- {
- ACTION_TELEPORT = 1
- };
- class npc_transcendence_spirit : public CreatureScript
- {
- public:
- npc_transcendence_spirit() : CreatureScript("npc_transcendence_spirit") { }
- struct npc_transcendence_spiritAI : public Scripted_NoMovementAI
- {
- npc_transcendence_spiritAI(Creature* c) : Scripted_NoMovementAI(c)
- {
- me->SetReactState(REACT_PASSIVE);
- }
- void Reset()
- {
- me->CastSpell(me, SPELL_MEDITATE, true);
- me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE|UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_NON_ATTACKABLE);
- me->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_DISABLE_TURN);
- }
- void IsSummonedBy(Unit* owner)
- {
- if (!owner || owner->GetTypeId() != TYPEID_PLAYER)
- return;
- me->SetMaxHealth(owner->GetMaxHealth() / 2);
- me->SetHealth(me->GetMaxHealth());
- me->CastSpell(me, SPELL_VISUAL_SPIRIT, true);
- owner->CastSpell(me, SPELL_INITIALIZE_IMAGES, true);
- owner->CastSpell(me, SPELL_CLONE_CASTER, true);
- owner->AddAura(SPELL_MEDITATE, me);
- me->AddAura(SPELL_ROOT_FOR_EVER, me);
- }
- void DoAction(int32 const action)
- {
- switch (action)
- {
- case ACTION_TELEPORT:
- {
- if (Unit* owner = me->GetOwner())
- {
- Position ownerPos;
- owner->GetPosition(&ownerPos);
- owner->NearTeleportTo(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation());
- me->NearTeleportTo(ownerPos.m_positionX, ownerPos.m_positionY, ownerPos.m_positionZ, ownerPos.m_orientation);
- }
- break;
- }
- default:
- break;
- }
- }
- };
- CreatureAI* GetAI(Creature *creature) const
- {
- return new npc_transcendence_spiritAI(creature);
- }
- };
Add Comment
Please, Sign In to add comment