void IsSummonedBy(Unit* owner) override
            {
                if (owner->GetTypeId() != TYPEID_UNIT)
                    return;

                Position pos;
                if (MarrowgarAI* marrowgarAI = CAST_AI(MarrowgarAI, owner->GetAI()))
                    pos.Relocate(marrowgarAI->GetLastColdflamePosition());
                else
                    pos.Relocate(owner);

                if (owner->HasAura(SPELL_BONE_STORM))
                {
                    float ang = Position::NormalizeOrientation(pos.GetAngle(me));
                    me->SetOrientation(ang);
                    owner->GetNearPoint2D(pos.m_positionX, pos.m_positionY, 5.0f - owner->GetObjectSize(), ang);
                }
                else
                {
                    Player* target = ObjectAccessor::GetPlayer(*owner, owner->GetAI()->GetGUID(DATA_COLDFLAME_GUID));
                    if (!target)
                    {
                        me->DespawnOrUnsummon();
                        return;
                    }

                    float ang = Position::NormalizeOrientation(pos.GetAngle(target));
                    me->SetOrientation(ang);
                    owner->GetNearPoint2D(pos.m_positionX, pos.m_positionY, 15.0f - owner->GetObjectSize(), ang);
                }

                me->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), me->GetPositionZ(), me->GetOrientation());
                DoCast(SPELL_COLDFLAME_SUMMON);
                _events.ScheduleEvent(EVENT_COLDFLAME_TRIGGER, 500);
            }
Example #2
0
		void DoAction(const int32 actionId) {
			switch (actionId) {
			case ACTION_OUTRO: {
				Position pos;
				if (Creature* pIck = GetIck()) {
					// TODO: tele on Ick then run some distance.
					pIck->GetNearPosition(pos, 5.0f, 3.14f);
					me->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(),
							pos.GetPositionZ(), 0.0f);
				}
				me->SetVisible(true);

				Creature* pJainaOrSylvanas = me->GetCreature(*me,
						pInstance->GetData64(DATA_JAINA_SYLVANAS_1));
				if (pJainaOrSylvanas) {
					Position pos;
					me->GetNearPosition(pos, 5.0f, 0);
					pJainaOrSylvanas->NearTeleportTo(
							pos.GetPositionX(),
							pos.GetPositionY(),
							pos.GetPositionZ(),
							pos.GetAngle(me->GetPositionX(),
									me->GetPositionY()));
				} else {
					if (pInstance->GetData(DATA_TEAM_IN_INSTANCE)
							== TEAM_ALLIANCE)
						pJainaOrSylvanas = me->SummonCreature(
								NPC_SYLVANAS_PART1, *me,
								TEMPSUMMON_MANUAL_DESPAWN);
					else
						pJainaOrSylvanas = me->SummonCreature(NPC_JAINA_PART1,
								*me, TEMPSUMMON_MANUAL_DESPAWN);
				}

				if (pJainaOrSylvanas) {
					pJainaOrSylvanas->SetOrientation(
							pJainaOrSylvanas->GetAngle(me->GetPositionX(),
									me->GetPositionY()));
					me->SetOrientation(
							me->GetAngle(pJainaOrSylvanas->GetPositionX(),
									pJainaOrSylvanas->GetPositionY()));
					uiNpcOutroDialog = pJainaOrSylvanas->GetGUID();
				}

				phase = PHASE_OUTRO;
				events.Reset();
				events.ScheduleEvent(EVENT_OUTRO_1, 1000);
				break;
			}
			}
		}