Example #1
0
    void JustDidDialogueStep(int32 iEntry)
    {
        if (!m_pInstance)
            return;

        switch (iEntry)
        {
        case NPC_HUMMEL:
        {
            if (Creature* pHummel = m_pInstance->GetSingleCreatureFromStorage(NPC_HUMMEL))
            {
                // WARNING: workaround -> faction should be set on event start
                pHummel->SetFactionTemporary(FACTION_HOSTILE, TEMPFACTION_RESTORE_REACH_HOME | TEMPFACTION_RESTORE_RESPAWN);
                pHummel->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE | UNIT_FLAG_NON_ATTACKABLE);

                if (Player* pPlayer = m_creature->GetMap()->GetPlayer(m_EventStarterGuid))
                    pHummel->AI()->AttackStart(pPlayer);
            }

            m_pInstance->SetData(TYPE_APOTHECARY, IN_PROGRESS);
            break;
        }
        case NPC_BAXTER:
        {
            Creature* pHummel = m_pInstance->GetSingleCreatureFromStorage(NPC_HUMMEL);
            if (!pHummel)
                return;

            if (Creature* pBaxter = m_pInstance->GetSingleCreatureFromStorage(NPC_BAXTER))
            {
                DoScriptText(SAY_CALL_BAXTER, pHummel);

                // WARNING: workaround -> faction should be set on event start
                pBaxter->SetFactionTemporary(FACTION_HOSTILE, TEMPFACTION_RESTORE_REACH_HOME | TEMPFACTION_RESTORE_RESPAWN);
                pBaxter->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE | UNIT_FLAG_NON_ATTACKABLE);
                if (pHummel->getVictim())
                    pBaxter->AI()->AttackStart(pHummel->getVictim());
            }
            break;
        }
        case NPC_FRYE:
        {
            Creature* pHummel = m_pInstance->GetSingleCreatureFromStorage(NPC_HUMMEL);
            if (!pHummel)
                return;

            if (Creature* pFrye = m_pInstance->GetSingleCreatureFromStorage(NPC_FRYE))
            {
                DoScriptText(SAY_CALL_FRYE, pHummel);

                // WARNING: workaround -> faction should be set on event start
                pFrye->SetFactionTemporary(FACTION_HOSTILE, TEMPFACTION_RESTORE_REACH_HOME | TEMPFACTION_RESTORE_RESPAWN);
                pFrye->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE | UNIT_FLAG_NON_ATTACKABLE);
                if (pHummel->getVictim())
                    pFrye->AI()->AttackStart(pHummel->getVictim());
            }
            break;
        }
        }
    }
void FleeingMovementGenerator<Creature>::Finalize(Creature &owner)
{
    owner.RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_FLEEING);
    owner.ClearUnitState(UNIT_STATE_FLEEING|UNIT_STATE_FLEEING_MOVE);
    if (owner.getVictim())
        owner.SetTarget(owner.getVictim()->GetGUID());
}
Example #3
0
 void EnterCombat(Unit* /*who*/)
 {
     DoScriptText(SAY_ROMULO_AGGRO, me);
     if (JulianneGUID)
     {
         Creature* Julianne = (Unit::GetCreature((*me), JulianneGUID));
         if (Julianne && Julianne->getVictim())
         {
             me->AddThreat(Julianne->getVictim(), 1.0f);
             AttackStart(Julianne->getVictim());
         }
     }
 }
Example #4
0
 void JustDied(Unit* /*killer*/)
 {
     if (ScriptedInstance* instance = me->GetInstanceScript())
     {
         Creature* Selin = (Unit::GetCreature(*me, instance->GetData64(DATA_SELIN)));
         if (Selin && Selin->isAlive())
         {
             if (CAST_AI(boss_selin_fireheartAI, Selin->AI())->CrystalGUID == me->GetGUID())
             {
                 // Set this to false if we are the Creature that Selin is draining so his AI flows properly
                 CAST_AI(boss_selin_fireheartAI, Selin->AI())->DrainingCrystal = false;
                 CAST_AI(boss_selin_fireheartAI, Selin->AI())->IsDraining = false;
                 CAST_AI(boss_selin_fireheartAI, Selin->AI())->EmpowerTimer = 10000;
                 if (Selin->getVictim())
                 {
                     Selin->AI()->AttackStart(Selin->getVictim());
                     Selin->GetMotionMaster()->MoveChase(Selin->getVictim());
                 }
             }
         }
     } else sLog->outError(ERROR_INST_DATA);
 }