Exemplo n.º 1
0
void instance_trial_of_the_crusader::DoHandleEventEpilogue()
{
    Player* pPlayer = GetPlayerInMap();
    if (!pPlayer)
        return;

    // Spawn Tirion and the mage
    if (Creature* pTirion = pPlayer->SummonCreature(NPC_TIRION_B, aSpawnPositions[12][0], aSpawnPositions[12][1], aSpawnPositions[12][2], aSpawnPositions[12][3], TEMPSUMMON_CORPSE_DESPAWN, 0))
        DoScriptText(SAY_TIRION_EPILOGUE, pTirion);

    pPlayer->SummonCreature(NPC_ARGENT_MAGE, aSpawnPositions[13][0], aSpawnPositions[13][1], aSpawnPositions[13][2], aSpawnPositions[13][3], TEMPSUMMON_CORPSE_DESPAWN, 0);

    DoRespawnGameObject(GO_PORTAL_DALARAN, 60 * MINUTE);

    // Spawn the chest for heroic difficulty
    if (IsHeroicDifficulty())
    {
        if (GetData(TYPE_WIPE_COUNT) == 0)
            DoRespawnGameObject(Is25ManDifficulty() ? GO_TRIBUTE_CHEST_25H_50 : GO_TRIBUTE_CHEST_10H_50, 60 * MINUTE);
        else if (GetData(TYPE_WIPE_COUNT) < 5)
            DoRespawnGameObject(Is25ManDifficulty() ? GO_TRIBUTE_CHEST_25H_45 : GO_TRIBUTE_CHEST_10H_45, 60 * MINUTE);
        else if (GetData(TYPE_WIPE_COUNT) < 25)
            DoRespawnGameObject(Is25ManDifficulty() ? GO_TRIBUTE_CHEST_25H_25 : GO_TRIBUTE_CHEST_10H_25, 60 * MINUTE);
        else
            DoRespawnGameObject(Is25ManDifficulty() ? GO_TRIBUTE_CHEST_25H_01 : GO_TRIBUTE_CHEST_10H_01, 60 * MINUTE);
    }
}
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);
    }
}
Exemplo n.º 3
0
void instance_trial_of_the_crusader::SetData(uint32 uiType, uint32 uiData)
{
    switch (uiType)
    {
        case TYPE_WIPE_COUNT:
            // Update data before updating worldstate
            m_auiEncounter[uiType] = uiData;
            if (IsHeroicDifficulty())
                DoUpdateWorldState(WORLD_STATE_WIPES_COUNT, MAX_WIPES_ALLOWED >= GetData(TYPE_WIPE_COUNT) ? MAX_WIPES_ALLOWED - GetData(TYPE_WIPE_COUNT) : 0);
            break;
        case TYPE_NORTHREND_BEASTS:
            if (uiData == SPECIAL)
            {
                if (Creature* pTirion = GetSingleCreatureFromStorage(NPC_TIRION_A))
                    DoScriptText(m_auiEncounter[uiType] != FAIL ? SAY_TIRION_RAID_INTRO_LONG : SAY_RAID_TRIALS_INTRO, pTirion);
                StartNextDialogueText(TYPE_NORTHREND_BEASTS);
            }
            else if (uiData == FAIL)
            {
                SetData(TYPE_WIPE_COUNT, m_auiEncounter[TYPE_WIPE_COUNT] + 1);
                StartNextDialogueText(SAY_TIRION_BEAST_WIPE);
                m_lSummonedGuidsList.clear();
            }
            else if (uiData == DONE)
                StartNextDialogueText(SAY_TIRION_BEAST_SLAY);
            // combat doors
            if (uiData != SPECIAL)
            {
                DoUseDoorOrButton(GO_WEST_GATE);
                DoUseDoorOrButton(GO_NORTH_GATE);
            }
            m_auiEncounter[uiType] = uiData;
            break;
        case TYPE_JARAXXUS:
            if (uiData == SPECIAL)
                // TODO - Confirm if we are not missing something
                StartNextDialogueText(m_auiEncounter[uiType] != FAIL ? TYPE_JARAXXUS : EVENT_JARAXXUS_RESET_DELAY);
            else if (uiData == FAIL)
            {
                SetData(TYPE_WIPE_COUNT, m_auiEncounter[TYPE_WIPE_COUNT] + 1);
                StartNextDialogueText(NPC_RAMSEY_2);
            }
            else if (uiData == DONE)
                StartNextDialogueText(SAY_JARAXXUS_DEATH);
            else if (uiData == IN_PROGRESS)
                m_lSummonedGuidsList.clear();
            // combat doors
            if (uiData != SPECIAL)
            {
                DoUseDoorOrButton(GO_WEST_GATE);
                DoUseDoorOrButton(GO_NORTH_GATE);
            }
            m_auiEncounter[uiType] = uiData;
            break;
        case TYPE_FACTION_CHAMPIONS:
            if (uiData == SPECIAL)
                StartNextDialogueText(m_auiEncounter[uiType] != FAIL ? int32(SAY_TIRION_PVP_INTRO_1) : int32(TYPE_FACTION_CHAMPIONS));
            else if (uiData == FAIL)
            {
                SetData(TYPE_WIPE_COUNT, m_auiEncounter[TYPE_WIPE_COUNT] + 1);
                StartNextDialogueText(NPC_RAMSEY_3);

                // cleanup and reset crusaders
                DoCleanupCrusaders();
                m_uiKilledCrusaders = 0;
                m_uiCrusadersAchievTimer = 0;
                m_bCrusadersSummoned = false;
                m_bCrusadersAchievCheck = false;
            }
            else if (uiData == DONE)
            {
                DoRespawnGameObject(GO_CRUSADERS_CACHE, 60 * MINUTE);
                StartNextDialogueText(SAY_VARIAN_PVP_A_WIN);
            }
            // combat doors
            if (uiData != SPECIAL)
            {
                DoUseDoorOrButton(GO_WEST_GATE);
                DoUseDoorOrButton(GO_NORTH_GATE);
            }
            m_auiEncounter[uiType] = uiData;
            break;
        case TYPE_TWIN_VALKYR:
            if (uiData == SPECIAL)
            {
                if (Creature* pTirion = GetSingleCreatureFromStorage(NPC_TIRION_A))
                    DoScriptText(m_auiEncounter[uiType] != FAIL ? SAY_TIRION_TWINS_INTRO : SAY_RAID_INTRO_SHORT, pTirion);
                StartNextDialogueText(TYPE_TWIN_VALKYR);
            }
            else if (uiData == FAIL)
            {
                SetData(TYPE_WIPE_COUNT, m_auiEncounter[TYPE_WIPE_COUNT] + 1);
                StartNextDialogueText(NPC_RAMSEY_4);
            }
            else if (uiData == DONE)
                StartNextDialogueText(EVENT_TWINS_KILLED);
            else if (uiData == IN_PROGRESS)
                DoStartTimedAchievement(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, ACHIEV_START_VALKYRS_ID);
            // combat doors
            if (uiData != SPECIAL)
            {
                DoUseDoorOrButton(GO_WEST_GATE);
                DoUseDoorOrButton(GO_NORTH_GATE);
            }
            m_auiEncounter[uiType] = uiData;
            break;
        case TYPE_ANUBARAK:
            if (uiData == SPECIAL)
                StartNextDialogueText(TYPE_ANUBARAK);
            else if (uiData == FAIL)
                SetData(TYPE_WIPE_COUNT, m_auiEncounter[TYPE_WIPE_COUNT] + 1);
            else if (uiData == DONE)
                DoHandleEventEpilogue();
            // Handle combat door
            if (uiData != SPECIAL)
                DoUseDoorOrButton(GO_WEB_DOOR);
            m_auiEncounter[uiType] = uiData;
            break;
        case TYPE_IMMORTALITY_FAILED:
            m_auiEncounter[uiType] = uiData;
            break;
        default:
            script_error_log("Instance Trial of The Crusader: ERROR SetData = %u for type %u does not exist/not implemented.", uiType, uiData);
            return;
    }

    if (uiData == DONE || uiType == TYPE_WIPE_COUNT)
    {
        OUT_SAVE_INST_DATA;

        std::ostringstream saveStream;
        saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " "
                   << m_auiEncounter[3] << " " << m_auiEncounter[4] << " " << m_auiEncounter[5] << " "
                   << m_auiEncounter[6];

        m_strInstData = saveStream.str();

        SaveToDB();
        OUT_SAVE_INST_DATA_COMPLETE;
    }
}
void instance_trial_of_the_crusader::SetData(uint32 uiType, uint32 uiData)
{
    switch(uiType)
    {
        case TYPE_WIPE_COUNT:
            if (IsHeroicDifficulty())
                DoUpdateWorldState(WORLD_STATE_WIPES_COUNT, MAX_WIPES_ALLOWED - m_auiEncounter[TYPE_WIPE_COUNT] >= 0 ? MAX_WIPES_ALLOWED - m_auiEncounter[TYPE_WIPE_COUNT] : 0);
            m_auiEncounter[uiType] = uiData;
            break;
        case TYPE_NORTHREND_BEASTS:
            if (uiData == SPECIAL)
            {
                if (Creature* pTirion = GetSingleCreatureFromStorage(NPC_TIRION_A))
                    DoScriptText(m_auiEncounter[uiType] != FAIL ? SAY_TIRION_RAID_INTRO_LONG : SAY_RAID_TRIALS_INTRO, pTirion);
                StartNextDialogueText(TYPE_NORTHREND_BEASTS);
            }
            else if (uiData == FAIL)
            {
                SetData(TYPE_WIPE_COUNT, m_auiEncounter[TYPE_WIPE_COUNT] + 1);
                StartNextDialogueText(SAY_TIRION_BEAST_WIPE);
            }
            else if (uiData == DONE)
                StartNextDialogueText(SAY_TIRION_BEAST_SLAY);
            m_auiEncounter[uiType] = uiData;
            break;
        case TYPE_JARAXXUS:
            if (uiData == SPECIAL)
                // TODO - What happen in wipe case?
                StartNextDialogueText(TYPE_JARAXXUS);
            else if (uiData == FAIL)
            {
                SetData(TYPE_WIPE_COUNT, m_auiEncounter[TYPE_WIPE_COUNT] + 1);
                StartNextDialogueText(NPC_RAMSEY_2);
            }
            else if (uiData == DONE)
                StartNextDialogueText(SAY_JARAXXUS_DEATH);
            m_auiEncounter[uiType] = uiData;
            break;
        case TYPE_FACTION_CHAMPIONS:
            if (uiData == SPECIAL)
                StartNextDialogueText(m_auiEncounter[uiType] != FAIL ? SAY_TIRION_PVP_INTRO_1 : TYPE_FACTION_CHAMPIONS);
            else if (uiData == FAIL)
            {
                SetData(TYPE_WIPE_COUNT, m_auiEncounter[TYPE_WIPE_COUNT] + 1);
                StartNextDialogueText(NPC_RAMSEY_3);
            }
            else if (uiData == DONE)
            {
                DoRespawnGameObject(GO_CRUSADERS_CACHE, 60*MINUTE);
                StartNextDialogueText(SAY_VARIAN_PVP_A_WIN);
            }
            m_auiEncounter[uiType] = uiData;
            break;
        case TYPE_TWIN_VALKYR:
            if (uiData == SPECIAL)
            {
                if (Creature* pTirion = GetSingleCreatureFromStorage(NPC_TIRION_A))
                    DoScriptText(m_auiEncounter[uiType] != FAIL ? SAY_TIRION_TWINS_INTRO : SAY_RAID_INTRO_SHORT, pTirion);
            }
            else if (uiData == FAIL)
            {
                SetData(TYPE_WIPE_COUNT, m_auiEncounter[TYPE_WIPE_COUNT] + 1);
                StartNextDialogueText(NPC_RAMSEY_4);
            }
            else if (uiData == DONE)
                StartNextDialogueText(EVENT_TWINS_KILLED);
            m_auiEncounter[uiType] = uiData;
            break;
        case TYPE_ANUBARAK:
            if (uiData == SPECIAL)
                StartNextDialogueText(TYPE_ANUBARAK);
            else if (uiData == FAIL)
                SetData(TYPE_WIPE_COUNT, m_auiEncounter[TYPE_WIPE_COUNT] + 1);
            else if (uiData == DONE)
                DoHandleEventEpilogue();
            // Handle combat door
            if (uiData != SPECIAL)
                DoUseDoorOrButton(GO_WEB_DOOR);
            m_auiEncounter[uiType] = uiData;
            break;
        default:
            error_log("SD2: Instance Trial of The Crusader: ERROR SetData = %u for type %u does not exist/not implemented.", uiType, uiData);
            return;
    }

    if (uiData == DONE || uiType == TYPE_WIPE_COUNT)
    {
        OUT_SAVE_INST_DATA;

        std::ostringstream saveStream;
        saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " "
            << m_auiEncounter[3] << " " << m_auiEncounter[4] << " " << m_auiEncounter[5];

        m_strInstData = saveStream.str();

        SaveToDB();
        OUT_SAVE_INST_DATA_COMPLETE;
    }
}