void instance_trial_of_the_crusader::JustDidDialogueStep(int32 iEntry)
{
    switch (iEntry)
    {
        case NPC_RAMSEY_1:
        case NPC_RAMSEY_2:
        case NPC_RAMSEY_3:
        case NPC_RAMSEY_4:
        case NPC_RAMSEY_5:
            DoSummonRamsey(iEntry);
            break;
        case SAY_VARIAN_BEAST_1:
            if (Player* pPlayer = GetPlayerInMap())
            {
                if (Creature* pBeasts = pPlayer->SummonCreature(NPC_BEAST_COMBAT_STALKER, aSpawnPositions[0][0], aSpawnPositions[0][1], aSpawnPositions[0][2], aSpawnPositions[0][3], TEMPSUMMON_DEAD_DESPAWN, 0))
                    pBeasts->SummonCreature(NPC_GORMOK, aSpawnPositions[1][0], aSpawnPositions[1][1], aSpawnPositions[1][2], aSpawnPositions[1][3], TEMPSUMMON_DEAD_DESPAWN, 0);
            }
            break;
        case NPC_FIZZLEBANG:
            if (Player* pPlayer = GetPlayerInMap())
                pPlayer->SummonCreature(NPC_FIZZLEBANG, aSpawnPositions[5][0], aSpawnPositions[5][1], aSpawnPositions[5][2], aSpawnPositions[5][3], TEMPSUMMON_DEAD_DESPAWN, 0);
            break;
        case SAY_WILFRED_JARAXXUS_INTRO_3:
            if (Player* pPlayer = GetPlayerInMap())
                pPlayer->SummonCreature(NPC_JARAXXUS, aSpawnPositions[6][0], aSpawnPositions[6][1], aSpawnPositions[6][2], aSpawnPositions[6][3], TEMPSUMMON_DEAD_DESPAWN, 0);
            break;
        case NPC_FJOLA:
            if (Player* pPlayer = GetPlayerInMap())
            {
                pPlayer->SummonCreature(NPC_FJOLA, aSpawnPositions[7][0], aSpawnPositions[7][1], aSpawnPositions[7][2], aSpawnPositions[7][3], TEMPSUMMON_DEAD_DESPAWN, 0);
                pPlayer->SummonCreature(NPC_EYDIS, aSpawnPositions[8][0], aSpawnPositions[8][1], aSpawnPositions[8][2], aSpawnPositions[8][3], TEMPSUMMON_DEAD_DESPAWN, 0);
            }
            break;
    }
}
void instance_trial_of_the_crusader::OnPlayerEnter(Player* pPlayer)
{
    if (m_uiTeam)
        return;

    m_uiTeam = pPlayer->GetTeam();
    SetDialogueSide(m_uiTeam == ALLIANCE);

    DoSummonRamsey(0);
}
void instance_trial_of_the_crusader::OnPlayerEnter(Player* pPlayer)
{
    if (m_uiTeam)
        return;

    m_uiTeam = pPlayer->GetTeam();
    SetDialogueSide(m_uiTeam == ALLIANCE);

    DoSummonRamsey(0);

    // Show wipe world state on heroic difficulty
    if (IsHeroicDifficulty())
    {
        pPlayer->SendUpdateWorldState(WORLD_STATE_WIPES, 1);
        pPlayer->SendUpdateWorldState(WORLD_STATE_WIPES_COUNT, MAX_WIPES_ALLOWED - GetData(TYPE_WIPE_COUNT) >= 0 ? MAX_WIPES_ALLOWED - GetData(TYPE_WIPE_COUNT) : 0);
    }
}
Esempio n. 4
0
void instance_trial_of_the_crusader::JustDidDialogueStep(int32 iEntry)
{
    switch (iEntry)
    {
        case NPC_RAMSEY_1:
        case NPC_RAMSEY_2:
        case NPC_RAMSEY_3:
        case NPC_RAMSEY_4:
        case NPC_RAMSEY_5:
            DoSummonRamsey(iEntry);
            break;
        case SAY_VARIAN_BEAST_1:
            if (Player* pPlayer = GetPlayerInMap())
            {
                if (Creature* pBeasts = pPlayer->SummonCreature(NPC_BEASTS_COMBAT_STALKER, aSpawnPositions[0][0], aSpawnPositions[0][1], aSpawnPositions[0][2], aSpawnPositions[0][3], TEMPSUMMON_DEAD_DESPAWN, 0))
                {
                    Creature* pGormok = pBeasts->SummonCreature(NPC_GORMOK, aSpawnPositions[1][0], aSpawnPositions[1][1], aSpawnPositions[1][2], aSpawnPositions[1][3], TEMPSUMMON_DEAD_DESPAWN, 0);
                    if (!pGormok)
                        return;

                    // spawn the snobolds on his back
                    uint8 uiMaxSnobolds = Is25ManDifficulty() ? 5 : 4;
                    for (uint8 i = 0; i < uiMaxSnobolds; ++i)
                    {
                        if (Creature* pSnobold = pGormok->SummonCreature(NPC_SNOBOLD_VASSAL, pGormok->GetPositionX(), pGormok->GetPositionY(), pGormok->GetPositionZ(), 0, TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN, 30000))
                            pSnobold->CastSpell(pGormok, SPELL_RIDE_VEHICLE_HARDCODED, TRIGGERED_OLD_TRIGGERED);
                    }
                }
            }
            break;
        case NPC_FIZZLEBANG:
            if (Player* pPlayer = GetPlayerInMap())
                pPlayer->SummonCreature(NPC_FIZZLEBANG, aSpawnPositions[5][0], aSpawnPositions[5][1], aSpawnPositions[5][2], aSpawnPositions[5][3], TEMPSUMMON_DEAD_DESPAWN, 0);
            break;
        case SAY_WILFRED_JARAXXUS_INTRO_1:
            DoUseDoorOrButton(GO_MAIN_GATE); // Close main gate
            break;
        case SAY_WILFRED_JARAXXUS_INTRO_2:
            if (Creature* pFizzlebang = GetSingleCreatureFromStorage(NPC_FIZZLEBANG))
            {
                pFizzlebang->SummonCreature(NPC_PURPLE_RUNE, aSpawnPositions[11][0], aSpawnPositions[11][1], aSpawnPositions[11][2], aSpawnPositions[11][3], TEMPSUMMON_TIMED_DESPAWN, 15000);
                pFizzlebang->CastSpell(pFizzlebang, SPELL_OPEN_PORTAL, TRIGGERED_NONE);
            }
            break;
        case EVENT_OPEN_PORTAL:
            if (Creature* pOpenPortalTarget = GetSingleCreatureFromStorage(NPC_OPEN_PORTAL_TARGET))
            {
                pOpenPortalTarget->CastSpell(pOpenPortalTarget, SPELL_WILFRED_PORTAL, TRIGGERED_OLD_TRIGGERED);
                pOpenPortalTarget->ForcedDespawn(9000);
            }
            break;
        case SAY_WILFRED_JARAXXUS_INTRO_3:
            if (Player* pPlayer = GetPlayerInMap())
                if (Creature* pJaraxxus = pPlayer->SummonCreature(NPC_JARAXXUS, aSpawnPositions[6][0], aSpawnPositions[6][1], aSpawnPositions[6][2], aSpawnPositions[6][3], TEMPSUMMON_DEAD_DESPAWN, 0))
                    pJaraxxus->GetMotionMaster()->MovePoint(POINT_COMBAT_POSITION, aMovePositions[3][0], aMovePositions[3][1], aMovePositions[3][2]);
            break;
        case EVENT_KILL_FIZZLEBANG:
            if (Creature* pJaraxxus = GetSingleCreatureFromStorage(NPC_JARAXXUS))
                pJaraxxus->CastSpell(pJaraxxus, SPELL_FEL_LIGHTNING_KILL, TRIGGERED_OLD_TRIGGERED);
            break;
        case EVENT_JARAXXUS_START_ATTACK:
            if (Creature* pJaraxxus = GetSingleCreatureFromStorage(NPC_JARAXXUS))
            {
                pJaraxxus->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PLAYER | UNIT_FLAG_IMMUNE_TO_NPC);
                pJaraxxus->RemoveAurasDueToSpell(SPELL_ENSLAVE_JARAXXUS);
            }
            break;
        case SAY_TIRION_PVP_INTRO_1:
        case TYPE_FACTION_CHAMPIONS:
            // skip if already summoned
            if (m_bCrusadersSummoned)
                break;

            if (Player* pPlayer = GetPlayerInMap())
            {
                // safety check
                uint8 uiMaxCrusaders = Is25ManDifficulty() ? MAX_CRUSADERS_25MAN : MAX_CRUSADERS_10MAN;
                if (m_vCrusadersEntries.empty() || m_vCrusadersEntries.size() < uiMaxCrusaders)
                {
                    script_error_log("Instance Trial of The Crusader: ERROR Crusaders entries are not properly selected. Please report this to the dev team!");
                    return;
                }

                // summon the crusaders
                m_vCrusadersGuidsVector.clear();
                float fX, fY, fZ, fO;
                for (uint8 i = 0; i < uiMaxCrusaders; ++i)
                {
                    fX = m_uiTeam == ALLIANCE ? aHordeCrusadersLoc[i].fSourceX : aAllyCrusadersLoc[i].fSourceX;
                    fY = m_uiTeam == ALLIANCE ? aHordeCrusadersLoc[i].fSourceY : aAllyCrusadersLoc[i].fSourceY;
                    fZ = m_uiTeam == ALLIANCE ? aHordeCrusadersLoc[i].fSourceZ : aAllyCrusadersLoc[i].fSourceZ;
                    fO = m_uiTeam == ALLIANCE ? aHordeCrusadersLoc[i].fSourceO : aAllyCrusadersLoc[i].fSourceO;

                    if (Creature* pCrusader = pPlayer->SummonCreature(m_vCrusadersEntries[i], fX, fY, fZ, fO, TEMPSUMMON_DEAD_DESPAWN, 0))
                        m_vCrusadersGuidsVector.push_back(pCrusader->GetObjectGuid());
                }

                m_bCrusadersSummoned = true;
            }
            break;
        case SAY_GARROSH_PVP_A_INTRO_2:
        {
            // make the champions jump
            uint8 uiMaxCrusaders = Is25ManDifficulty() ? MAX_CRUSADERS_25MAN : MAX_CRUSADERS_10MAN;

            float fX, fY, fZ;
            for (uint8 i = 0; i < uiMaxCrusaders; ++i)
            {
                fX = m_uiTeam == ALLIANCE ? aHordeCrusadersLoc[i].fTargetX : aAllyCrusadersLoc[i].fTargetX;
                fY = m_uiTeam == ALLIANCE ? aHordeCrusadersLoc[i].fTargetY : aAllyCrusadersLoc[i].fTargetY;
                fZ = m_uiTeam == ALLIANCE ? aHordeCrusadersLoc[i].fTargetZ : aAllyCrusadersLoc[i].fTargetZ;

                // ToDo: use spell 67382 when proper implemented in the core
                if (Creature* pCrusader = instance->GetCreature(m_vCrusadersGuidsVector[i]))
                    pCrusader->GetMotionMaster()->MoveJump(fX, fY, fZ, pCrusader->GetDistance2d(fX, fY) * 10.0f / 15.0f, 15.0f);
            }
            break;
        }
        case EVENT_CHAMPIONS_ATTACK:
        {
            // prepare champions combat
            uint8 uiMaxCrusaders = Is25ManDifficulty() ? MAX_CRUSADERS_25MAN : MAX_CRUSADERS_10MAN;
            for (uint8 i = 0; i < uiMaxCrusaders; ++i)
            {
                if (Creature* pCrusader = instance->GetCreature(m_vCrusadersGuidsVector[i]))
                {
                    pCrusader->CastSpell(pCrusader, SPELL_ANCHOR_HERE, TRIGGERED_OLD_TRIGGERED);
                    pCrusader->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PLAYER);

                    // some crusaders have to summon their pet
                    pCrusader->AI()->SendAIEvent(AI_EVENT_CUSTOM_A, pCrusader, pCrusader);
                }
            }
            break;
        }
        case EVENT_SUMMON_TWINS:
            if (Player* pPlayer = GetPlayerInMap())
            {
                // spawn the twin valkyrs; movement and the rest of spawns are handled in DB
                DoOpenMainGate(15000);

                pPlayer->SummonCreature(NPC_FJOLA, aSpawnPositions[7][0], aSpawnPositions[7][1], aSpawnPositions[7][2], aSpawnPositions[7][3], TEMPSUMMON_DEAD_DESPAWN, 0);
                pPlayer->SummonCreature(NPC_EYDIS, aSpawnPositions[8][0], aSpawnPositions[8][1], aSpawnPositions[8][2], aSpawnPositions[8][3], TEMPSUMMON_DEAD_DESPAWN, 0);
            }
            break;
        case EVENT_TWINS_ATTACK:
            if (Creature* pTwin = GetSingleCreatureFromStorage(NPC_FJOLA))
            {
                pTwin->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PLAYER | UNIT_FLAG_IMMUNE_TO_NPC);
                pTwin->CastSpell(pTwin, SPELL_TWIN_EMPATHY_LIGHT, TRIGGERED_OLD_TRIGGERED);
            }
            if (Creature* pTwin = GetSingleCreatureFromStorage(NPC_EYDIS))
            {
                pTwin->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PLAYER | UNIT_FLAG_IMMUNE_TO_NPC);
                pTwin->CastSpell(pTwin, SPELL_TWIN_EMPATHY_DARK, TRIGGERED_OLD_TRIGGERED);
            }
            break;
        case SAY_LKING_ANUB_INTRO_1:
            if (Player* pPlayer = GetPlayerInMap())
                pPlayer->SummonCreature(NPC_WORLD_TRIGGER_LARGE, aSpawnPositions[9][0], aSpawnPositions[9][1], aSpawnPositions[9][2], aSpawnPositions[9][3], TEMPSUMMON_DEAD_DESPAWN, 0);
            break;
        case EVENT_ARTHAS_PORTAL:
            if (Creature* pWorldTriggerLarge = GetSingleCreatureFromStorage(NPC_WORLD_TRIGGER_LARGE))
                pWorldTriggerLarge->CastSpell(pWorldTriggerLarge, SPELL_ARTHAS_PORTAL, TRIGGERED_OLD_TRIGGERED);
            break;
        case EVENT_SUMMON_THE_LICHKING:
            if (Player* pPlayer = GetPlayerInMap())
                pPlayer->SummonCreature(NPC_THE_LICHKING_VISUAL, aSpawnPositions[10][0], aSpawnPositions[10][1], aSpawnPositions[10][2], aSpawnPositions[10][3], TEMPSUMMON_DEAD_DESPAWN, 0);
            break;
        case EVENT_DESTROY_FLOOR:
            if (GameObject* pColiseumFloor = GetSingleGameObjectFromStorage(GO_COLISEUM_FLOOR))
            {
                pColiseumFloor->SetDisplayId(DISPLAYID_DESTROYED_FLOOR);
                pColiseumFloor->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK_10 | GO_FLAG_NODESPAWN);
                pColiseumFloor->SetGoState(GO_STATE_ACTIVE);
            }

            if (Creature* pLichKingVisual = GetSingleCreatureFromStorage(NPC_THE_LICHKING_VISUAL))
            {
                pLichKingVisual->CastSpell(pLichKingVisual, SPELL_FROSTNOVA, TRIGGERED_OLD_TRIGGERED);
                // pLichKingVisual->CastSpell(pLichKingVisual, SPELL_CORPSE_TELEPORT, TRIGGERED_OLD_TRIGGERED); // NYI
                pLichKingVisual->ForcedDespawn();
            }

            if (Creature* pLichKing = GetSingleCreatureFromStorage(NPC_THE_LICHKING))
                pLichKing->CastSpell(pLichKing, SPELL_DESTROY_FLOOR_KNOCKUP, TRIGGERED_OLD_TRIGGERED);

            if (Creature* pWorldTriggerLarge = GetSingleCreatureFromStorage(NPC_WORLD_TRIGGER_LARGE))
                pWorldTriggerLarge->ForcedDespawn();
            break;
    }
}
void instance_trial_of_the_crusader::JustDidDialogueStep(int32 iEntry)
{
    switch (iEntry)
    {
        case NPC_RAMSEY_1:
        case NPC_RAMSEY_2:
        case NPC_RAMSEY_3:
        case NPC_RAMSEY_4:
        case NPC_RAMSEY_5:
            DoSummonRamsey(iEntry);
            break;
        case SAY_VARIAN_BEAST_1:
            if (Player* pPlayer = GetPlayerInMap())
            {
                if (Creature* pBeasts = pPlayer->SummonCreature(NPC_BEAST_COMBAT_STALKER, aSpawnPositions[0][0], aSpawnPositions[0][1], aSpawnPositions[0][2], aSpawnPositions[0][3], TEMPSUMMON_DEAD_DESPAWN, 0))
                    pBeasts->SummonCreature(NPC_GORMOK, aSpawnPositions[1][0], aSpawnPositions[1][1], aSpawnPositions[1][2], aSpawnPositions[1][3], TEMPSUMMON_DEAD_DESPAWN, 0);
            }
            break;
        case NPC_FIZZLEBANG:
            if (Player* pPlayer = GetPlayerInMap())
                pPlayer->SummonCreature(NPC_FIZZLEBANG, aSpawnPositions[5][0], aSpawnPositions[5][1], aSpawnPositions[5][2], aSpawnPositions[5][3], TEMPSUMMON_DEAD_DESPAWN, 0);
            break;
        case SAY_WILFRED_JARAXXUS_INTRO_1:
            DoUseDoorOrButton(GO_MAIN_GATE); // Close main gate
            break;
        case SAY_WILFRED_JARAXXUS_INTRO_2:
            if (Creature* pFizzlebang = GetSingleCreatureFromStorage(NPC_FIZZLEBANG))
            {
                pFizzlebang->SummonCreature(NPC_PURPLE_RUNE, aSpawnPositions[11][0], aSpawnPositions[11][1], aSpawnPositions[11][2], aSpawnPositions[11][3], TEMPSUMMON_TIMED_DESPAWN, 15000);
                pFizzlebang->CastSpell(pFizzlebang, SPELL_OPEN_PORTAL, false);
            }
            break;
        case EVENT_OPEN_PORTAL:
            if (Creature* pOpenPortalTarget = GetSingleCreatureFromStorage(NPC_OPEN_PORTAL_TARGET))
            {
                pOpenPortalTarget->CastSpell(pOpenPortalTarget, SPELL_WILFRED_PORTAL, true);
                pOpenPortalTarget->ForcedDespawn(9000);
            }
            break;
        case SAY_WILFRED_JARAXXUS_INTRO_3:
            if (Player* pPlayer = GetPlayerInMap())
                if (Creature* pJaraxxus = pPlayer->SummonCreature(NPC_JARAXXUS, aSpawnPositions[6][0], aSpawnPositions[6][1], aSpawnPositions[6][2], aSpawnPositions[6][3], TEMPSUMMON_DEAD_DESPAWN, 0))
                    pJaraxxus->GetMotionMaster()->MovePoint(POINT_COMBAT_POSITION, aMovePositions[3][0], aMovePositions[3][1], aMovePositions[3][2]);
            break;
        case EVENT_KILL_FIZZLEBANG:
            if (Creature* pJaraxxus = GetSingleCreatureFromStorage(NPC_JARAXXUS))
                pJaraxxus->CastSpell(pJaraxxus, SPELL_FEL_LIGHTNING_KILL, true);
            break;
        case EVENT_JARAXXUS_START_ATTACK:
            if (Creature* pJaraxxus = GetSingleCreatureFromStorage(NPC_JARAXXUS))
                pJaraxxus->SetInCombatWithZone();
            break;
        case EVENT_SUMMON_TWINS:
            if (Player* pPlayer = GetPlayerInMap())
            {
                pPlayer->SummonCreature(NPC_FJOLA, aSpawnPositions[7][0], aSpawnPositions[7][1], aSpawnPositions[7][2], aSpawnPositions[7][3], TEMPSUMMON_DEAD_DESPAWN, 0);
                pPlayer->SummonCreature(NPC_EYDIS, aSpawnPositions[8][0], aSpawnPositions[8][1], aSpawnPositions[8][2], aSpawnPositions[8][3], TEMPSUMMON_DEAD_DESPAWN, 0);
            }
            break;
        case SAY_LKING_ANUB_INTRO_1:
            if (Player* pPlayer = GetPlayerInMap())
                pPlayer->SummonCreature(NPC_WORLD_TRIGGER_LARGE, aSpawnPositions[9][0], aSpawnPositions[9][1], aSpawnPositions[9][2], aSpawnPositions[9][3], TEMPSUMMON_DEAD_DESPAWN, 0);
            break;
        case EVENT_ARTHAS_PORTAL:
            if (Creature* pWorldTriggerLarge = GetSingleCreatureFromStorage(NPC_WORLD_TRIGGER_LARGE))
                pWorldTriggerLarge->CastSpell(pWorldTriggerLarge, SPELL_ARTHAS_PORTAL, true);
            break;
        case EVENT_SUMMON_THE_LICHKING:
            if (Player* pPlayer = GetPlayerInMap())
                pPlayer->SummonCreature(NPC_THE_LICHKING_VISUAL, aSpawnPositions[10][0], aSpawnPositions[10][1], aSpawnPositions[10][2], aSpawnPositions[10][3], TEMPSUMMON_DEAD_DESPAWN, 0);
            break;
        case EVENT_DESTROY_FLOOR:
            if (GameObject* pColiseumFloor = GetSingleGameObjectFromStorage(GO_COLISEUM_FLOOR))
            {
                pColiseumFloor->SetDisplayId(DISPLAYID_DESTROYED_FLOOR);
                pColiseumFloor->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK_10 | GO_FLAG_NODESPAWN);
                pColiseumFloor->SetGoState(GO_STATE_ACTIVE);
            }

            if (Creature* pLichKingVisual = GetSingleCreatureFromStorage(NPC_THE_LICHKING_VISUAL))
            {
                pLichKingVisual->CastSpell(pLichKingVisual, SPELL_FROSTNOVA, true);
                //pLichKingVisual->CastSpell(pLichKingVisual, SPELL_CORPSE_TELEPORT, true); // NYI
                pLichKingVisual->ForcedDespawn();
            }

            if (Creature* pLichKing = GetSingleCreatureFromStorage(NPC_THE_LICHKING))
                pLichKing->CastSpell(pLichKing, SPELL_DESTROY_FLOOR_KNOCKUP, true);

            if (Creature* pWorldTriggerLarge = GetSingleCreatureFromStorage(NPC_WORLD_TRIGGER_LARGE))
                pWorldTriggerLarge->ForcedDespawn();
            break;
    }
}