예제 #1
0
void instance_stratholme::SetData(uint32 uiType, uint32 uiData)
{
    // TODO: Remove the hard-coded indexes from array accessing
    switch (uiType)
    {
        case TYPE_BARON_RUN:
            switch (uiData)
            {
                case IN_PROGRESS:
                    if (m_auiEncounter[uiType] == IN_PROGRESS || m_auiEncounter[uiType] == FAIL)
                    {
                        break;
                    }

                    DoOrSimulateScriptTextForThisInstance(SAY_ANNOUNCE_RUN_START, NPC_BARON);

                    m_uiBaronRunTimer = 45 * MINUTE * IN_MILLISECONDS;
                    debug_log("SD2: Instance Stratholme: Baron run in progress.");
                    break;
                case FAIL:
                    // may add code to remove aura from players, but in theory the time should be up already and removed.
                    break;
                case DONE:
                    m_uiBaronRunTimer = 0;
                    break;
            }
            m_auiEncounter[uiType] = uiData;
            break;
        case TYPE_BARONESS:
        case TYPE_NERUB:
        case TYPE_PALLID:
            m_auiEncounter[uiType] = uiData;
            if (uiData == DONE)
            {
                DoSortZiggurats();
                DoUseDoorOrButton(m_zigguratStorage[uiType - TYPE_BARONESS].m_doorGuid);
            }
            if (uiData == SPECIAL)
            {
                StartSlaugtherSquare();
            }
            break;
        case TYPE_RAMSTEIN:
            if (uiData == SPECIAL)
            {
                if (m_auiEncounter[uiType] != SPECIAL && m_auiEncounter[uiType] != DONE)
                {
                    m_uiSlaugtherSquareTimer = 20000;       // TODO - unknown, also possible that this is not the very correct place..
                    DoUseDoorOrButton(GO_PORT_GAUNTLET);
                }

                uint32 uiCount = m_sAbomnationGUID.size();
                for (GuidSet::iterator itr = m_sAbomnationGUID.begin(); itr != m_sAbomnationGUID.end();)
                {
                    if (Creature* pAbom = instance->GetCreature(*itr))
                    {
                        ++itr;
                        if (!pAbom->IsAlive())
                        {
                            --uiCount;
                        }
                    }
                    else
                    {
                        // Remove obsolete guid from set and decrement count
                        m_sAbomnationGUID.erase(itr++);
                        --uiCount;
                    }
                }

                if (!uiCount)
                {
                    // Old Comment: a bit itchy, it should close GO_ZIGGURAT_DOOR_4 door after 10 secs, but it doesn't. skipping it for now.
                    // However looks like that this door is no more closed
                    DoUseDoorOrButton(GO_ZIGGURAT_DOOR_4);

                    // No more handlng of Abomnations
                    m_uiSlaugtherSquareTimer = 0;

                    if (Creature* pBaron = GetSingleCreatureFromStorage(NPC_BARON))
                    {
                        DoScriptText(SAY_ANNOUNCE_RAMSTEIN, pBaron);
                        if (Creature* pRamstein = pBaron->SummonCreature(NPC_RAMSTEIN, aStratholmeLocation[2].m_fX, aStratholmeLocation[2].m_fY, aStratholmeLocation[2].m_fZ, aStratholmeLocation[2].m_fO, TEMPSUMMON_DEAD_DESPAWN, 0))
                        {
                            pRamstein->GetMotionMaster()->MovePoint(0, aStratholmeLocation[3].m_fX, aStratholmeLocation[3].m_fY, aStratholmeLocation[3].m_fZ);
                        }

                        debug_log("SD2: Instance Stratholme - Slaugther event: Ramstein spawned.");
                    }
                }
                else
                {
                    debug_log("SD2: Instance Stratholme - Slaugther event: %u Abomnation left to kill.", uiCount);
                }
            }
            // After fail aggroing Ramstein means wipe on Ramstein, so close door again
            if (uiData == IN_PROGRESS && m_auiEncounter[uiType] == FAIL)
            {
                DoUseDoorOrButton(GO_PORT_GAUNTLET);
            }
            if (uiData == DONE)
            {
                // Open side gate and start summoning skeletons
                DoUseDoorOrButton(GO_PORT_SLAUGHTER_GATE);
                // use this timer as a bool just to start summoning
                m_uiMindlessSummonTimer = 500;
                m_uiMindlessCount = 0;
                m_luiUndeadGUIDs.clear();

                // Summon 5 guards
                if (Creature* pBaron = GetSingleCreatureFromStorage(NPC_BARON))
                {
                    for (uint8 i = 0; i < 5; ++i)
                    {
                        float fX, fY, fZ;
                        pBaron->GetRandomPoint(aStratholmeLocation[6].m_fX, aStratholmeLocation[6].m_fY, aStratholmeLocation[6].m_fZ, 5.0f, fX, fY, fZ);
                        if (Creature* pTemp = pBaron->SummonCreature(NPC_BLACK_GUARD, aStratholmeLocation[6].m_fX, aStratholmeLocation[6].m_fY, aStratholmeLocation[6].m_fZ, aStratholmeLocation[6].m_fO, TEMPSUMMON_DEAD_DESPAWN, 0))
                        {
                            m_luiGuardGUIDs.push_back(pTemp->GetObjectGuid());
                        }
                    }

                    debug_log("SD2: Instance Stratholme - Slaugther event: Summoned 5 guards.");
                }
            }
            // Open Door again and stop Abomnation
            if (uiData == FAIL && m_auiEncounter[uiType] != FAIL)
            {
                DoUseDoorOrButton(GO_PORT_GAUNTLET);
                m_uiSlaugtherSquareTimer = 0;

                // Let already moving Abomnations stop
                for (GuidSet::const_iterator itr = m_sAbomnationGUID.begin(); itr != m_sAbomnationGUID.end(); ++itr)
                {
                    Creature* pAbom = instance->GetCreature(*itr);
                    if (pAbom && pAbom->GetMotionMaster()->GetCurrentMovementGeneratorType() == POINT_MOTION_TYPE)
                    {
                        pAbom->GetMotionMaster()->MovementExpired();
                    }
                }
            }

            m_auiEncounter[uiType] = uiData;
            break;
        case TYPE_BARON:
            if (uiData == IN_PROGRESS)
            {
                // Reached the Baron within time-limit
                if (m_auiEncounter[TYPE_BARON_RUN] == IN_PROGRESS)
                {
                    SetData(TYPE_BARON_RUN, DONE);
                }

                // Close Slaughterhouse door if needed
                if (m_auiEncounter[uiType] == FAIL)
                {
                    DoUseDoorOrButton(GO_PORT_GAUNTLET);
                }
            }
            if (uiData == DONE)
            {
                if (m_auiEncounter[TYPE_BARON_RUN] == DONE)
                {
                    Map::PlayerList const& players = instance->GetPlayers();

                    for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
                    {
                        if (Player* pPlayer = itr->getSource())
                        {
                            if (pPlayer->HasAura(SPELL_BARON_ULTIMATUM))
                            {
                                pPlayer->RemoveAurasDueToSpell(SPELL_BARON_ULTIMATUM);
                            }

                            if (pPlayer->GetQuestStatus(QUEST_DEAD_MAN_PLEA) == QUEST_STATUS_INCOMPLETE)
                            {
                                pPlayer->AreaExploredOrEventHappens(QUEST_DEAD_MAN_PLEA);
                            }
                        }
                    }

                    // Open cage and finish rescue event
                    if (Creature* pYsidaT = GetSingleCreatureFromStorage(NPC_YSIDA_TRIGGER))
                    {
                        if (Creature* pYsida = pYsidaT->SummonCreature(NPC_YSIDA, pYsidaT->GetPositionX(), pYsidaT->GetPositionY(), pYsidaT->GetPositionZ(), pYsidaT->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN, 1800000))
                        {
                            DoScriptText(SAY_EPILOGUE, pYsida);
                            pYsida->GetMotionMaster()->MovePoint(0, aStratholmeLocation[7].m_fX, aStratholmeLocation[7].m_fY, aStratholmeLocation[7].m_fZ);
                        }
                        DoUseDoorOrButton(GO_YSIDA_CAGE);
                    }
                }

                // Open Slaughterhouse door again
                DoUseDoorOrButton(GO_PORT_GAUNTLET);
            }
            if (uiData == FAIL)
            {
                DoUseDoorOrButton(GO_PORT_GAUNTLET);
            }

            m_auiEncounter[uiType] = uiData;
            break;
        case TYPE_BARTHILAS_RUN:
            if (uiData == IN_PROGRESS)
            {
                Creature* pBarthilas = GetSingleCreatureFromStorage(NPC_BARTHILAS);
                if (pBarthilas && pBarthilas->IsAlive() && !pBarthilas->IsInCombat())
                {
                    DoScriptText(SAY_WARN_BARON, pBarthilas);
                    pBarthilas->SetWalk(false);
                    pBarthilas->GetMotionMaster()->MovePoint(0, aStratholmeLocation[0].m_fX, aStratholmeLocation[0].m_fY, aStratholmeLocation[0].m_fZ);

                    m_uiBarthilasRunTimer = 8000;
                }
            }
            m_auiEncounter[uiType] = uiData;
            break;
        case TYPE_BLACK_GUARDS:
            // Prevent double action
            if (m_auiEncounter[uiType] == uiData)
            {
                return;
            }

            // Restart after failure, close Gauntlet
            if (uiData == IN_PROGRESS && m_auiEncounter[uiType] == FAIL)
            {
                DoUseDoorOrButton(GO_PORT_GAUNTLET);
            }
            // Wipe case - open gauntlet
            if (uiData == FAIL)
            {
                DoUseDoorOrButton(GO_PORT_GAUNTLET);
            }
            if (uiData == DONE)
            {
                if (Creature* pBaron = GetSingleCreatureFromStorage(NPC_BARON))
                {
                    DoScriptText(SAY_UNDEAD_DEFEAT, pBaron);
                }
                DoUseDoorOrButton(GO_ZIGGURAT_DOOR_5);
            }
            m_auiEncounter[uiType] = uiData;

            // No need to save anything here, so return
            return;
        case TYPE_POSTMASTER:
            m_auiEncounter[uiType] = uiData;
            if (uiData == IN_PROGRESS)
            {
                ++m_uiPostboxesUsed;

                // After the second post box prepare to spawn the Post Master
                if (m_uiPostboxesUsed == 2)
                {
                    SetData(TYPE_POSTMASTER, SPECIAL);
                }
            }
            // No need to save anything here, so return
            return;
        case TYPE_TRUE_MASTERS:
            m_auiEncounter[uiType] = uiData;
            if (uiData == SPECIAL)
            {
                ++m_uiSilverHandKilled;

                // When the 5th paladin is killed set data to DONE in order to give the quest credit for the last paladin
                if (m_uiSilverHandKilled == MAX_SILVERHAND)
                {
                    SetData(TYPE_TRUE_MASTERS, DONE);
                }
            }
            // No need to save anything here, so return
            return;
    }

    if (uiData == DONE)
    {
        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;
    }
}
예제 #2
0
VectorBuffer::VectorBuffer(const PODVector<unsigned char>& data)
{
    SetData(data);
}
예제 #3
0
VectorBuffer::VectorBuffer(Deserializer& source, unsigned size)
{
    SetData(source, size);
}
tb::TBBitmap* CCryTBRenderer::CreateBitmap(int width, int height, tb::uint32* data)
{
	auto pBM = new CCryTBBitmap(width, height);
	pBM->SetData(data);
	return pBM;
}
예제 #5
0
    void OnCreatureDeath(Creature* pCreature)
    {
        switch (pCreature->GetEntry())
        {
            case NPC_GREYMIST_COASTRUNNNER:
                if (pCreature->IsTemporarySummon())         // Only count the ones summoned for Murkdeep quest
                {
                    ++m_uiMurkdeepAdds_KilledAddCount;

                    // If all 3 coastrunners are killed, summon 2 warriors
                    if (m_uiMurkdeepAdds_KilledAddCount == 3)
                    {
                        float fX, fY, fZ;
                        for (uint8 i = 0; i < 2; ++i)
                        {
                            pCreature->GetRandomPoint(aSpawnLocations[POS_IDX_MURKDEEP_SPAWN][0], aSpawnLocations[POS_IDX_MURKDEEP_SPAWN][1], aSpawnLocations[POS_IDX_MURKDEEP_SPAWN][2], 5.0f, fX, fY, fZ);

                            if (Creature* pTemp = pCreature->SummonCreature(NPC_GREYMIST_WARRIOR, fX, fY, fZ, aSpawnLocations[POS_IDX_MURKDEEP_SPAWN][3], TEMPSPAWN_DEAD_DESPAWN, 0))
                            {
                                pTemp->SetWalk(false);
                                pTemp->GetRandomPoint(aSpawnLocations[POS_IDX_MURKDEEP_MOVE][0], aSpawnLocations[POS_IDX_MURKDEEP_MOVE][1], aSpawnLocations[POS_IDX_MURKDEEP_MOVE][2], 5.0f, fX, fY, fZ);
                                pTemp->GetMotionMaster()->MovePoint(0, fX, fY, fZ);
                            }
                        }

                        m_uiMurkdeepAdds_KilledAddCount = 0;
                    }
                }
                break;
            case NPC_GREYMIST_WARRIOR:
                if (pCreature->IsTemporarySummon())         // Only count the ones summoned for Murkdeep quest
                {
                    ++m_uiMurkdeepAdds_KilledAddCount;

                    // After the 2 warriors are killed, Murkdeep spawns, along with a hunter
                    if (m_uiMurkdeepAdds_KilledAddCount == 2)
                    {
                        float fX, fY, fZ;
                        for (uint8 i = 0; i < 2; ++i)
                        {
                            pCreature->GetRandomPoint(aSpawnLocations[POS_IDX_MURKDEEP_SPAWN][0], aSpawnLocations[POS_IDX_MURKDEEP_SPAWN][1], aSpawnLocations[POS_IDX_MURKDEEP_SPAWN][2], 5.0f, fX, fY, fZ);

                            if (Creature* pTemp = pCreature->SummonCreature(!i ? NPC_MURKDEEP : NPC_GREYMIST_HUNTER, fX, fY, fZ, aSpawnLocations[POS_IDX_MURKDEEP_SPAWN][3], TEMPSPAWN_DEAD_DESPAWN, 0))
                            {
                                pTemp->SetWalk(false);
                                pTemp->GetRandomPoint(aSpawnLocations[POS_IDX_MURKDEEP_MOVE][0], aSpawnLocations[POS_IDX_MURKDEEP_MOVE][1], aSpawnLocations[POS_IDX_MURKDEEP_MOVE][2], 5.0f, fX, fY, fZ);
                                pTemp->GetMotionMaster()->MovePoint(0, fX, fY, fZ);
                            }
                        }

                        m_uiMurkdeepAdds_KilledAddCount = 0;
                    }
                }
                break;
            case NPC_OMEN:
                SetData(TYPE_OMEN, DONE);
                break;
            case NPC_THE_WINDREAVER:
                DoDespawnElementalRifts(ELEMENTAL_AIR);
                break;
            case NPC_PRINCESS_TEMPESTRIA:
                DoDespawnElementalRifts(ELEMENTAL_WATER);
                break;
            case NPC_BARON_CHARR:
                DoDespawnElementalRifts(ELEMENTAL_FIRE);
                break;
            case NPC_AVALANCHION:
                DoDespawnElementalRifts(ELEMENTAL_EARTH);
                break;
        }
    }
void instance_blackwing_lair::Update(uint32 uiDiff)
{
    // Scepter of the Shifting Sand epic quest line
    if (m_uiScepterEpicTimer)
    {
        if (m_uiScepterEpicTimer <= uiDiff)
        {
            switch (m_uiScepterQuestStep)
            {
                case 0:     // On quest acceptance
                    DoOrSimulateScriptTextForThisInstance(YELL_REDSHARD_TAUNT_1, NPC_LORD_VICTOR_NEFARIUS);
                    m_uiScepterEpicTimer = 2 * HOUR * IN_MILLISECONDS;
                    break;
                case 1:     // 2 hours time mark
                    switch (urand(0, 1))
                    {
                        case 0:
                            DoOrSimulateScriptTextForThisInstance(YELL_REDSHARD_TAUNT_2, NPC_LORD_VICTOR_NEFARIUS);
                            DoOrSimulateScriptTextForThisInstance(EMOTE_REDSHARD_TAUNT_1, NPC_LORD_VICTOR_NEFARIUS);
                            break;
                        case 1:
                            DoOrSimulateScriptTextForThisInstance(YELL_REDSHARD_TAUNT_3, NPC_LORD_VICTOR_NEFARIUS);
                            break;
                    }
                    m_uiScepterEpicTimer = 2 * HOUR * IN_MILLISECONDS;
                    break;
                case 2:     // 1 hour left
                    switch (urand(0, 1))
                    {
                        case 0:
                            DoOrSimulateScriptTextForThisInstance(YELL_REDSHARD_TAUNT_4, NPC_LORD_VICTOR_NEFARIUS);
                            break;
                        case 1:
                            DoOrSimulateScriptTextForThisInstance(YELL_REDSHARD_TAUNT_5, NPC_LORD_VICTOR_NEFARIUS);
                            break;
                    }
                    m_uiScepterEpicTimer = 30 * MINUTE * IN_MILLISECONDS;
                    break;
                case 3:     // 30 min left
                    DoOrSimulateScriptTextForThisInstance(YELL_REDSHARD_TAUNT_6, NPC_LORD_VICTOR_NEFARIUS);
                    m_uiScepterEpicTimer = 30 * MINUTE * IN_MILLISECONDS;
                    break;
                case 4:     // Failure
                    SetData(TYPE_QUEST_SCEPTER, FAIL);
                    if (GetData(TYPE_NEFARIAN) == NOT_STARTED)
                    {
                        DoOrSimulateScriptTextForThisInstance(EMOTE_REDSHARD_TAUNT_2, NPC_LORD_VICTOR_NEFARIUS);
                        DoOrSimulateScriptTextForThisInstance(YELL_REDSHARD_TAUNT_7, NPC_LORD_VICTOR_NEFARIUS);
                    }
                default:    // Something weird happened: stop timer and fail the event
                    m_uiScepterEpicTimer = 0;
                    SetData(TYPE_QUEST_SCEPTER, FAIL);
                    break;
            }
            m_uiScepterQuestStep++;
        }
        else
            m_uiScepterEpicTimer -= uiDiff;
    }

    // Reset Razorgore in case of wipe
    if (m_uiResetTimer)
    {
        if (m_uiResetTimer <= uiDiff)
        {
            // Respawn Razorgore
            if (Creature* pRazorgore = GetSingleCreatureFromStorage(NPC_RAZORGORE))
            {
                if (!pRazorgore->isAlive())
                    pRazorgore->Respawn();
            }

            // Respawn the Dragon Eggs
            for (GuidList::const_iterator itr = m_lDragonEggsGuids.begin(); itr != m_lDragonEggsGuids.end(); ++itr)
            {
                if (GameObject* pEgg = instance->GetGameObject(*itr))
                {
                    if (!pEgg->isSpawned())
                        pEgg->Respawn();
                }
            }

            m_uiResetTimer = 0;
        }
        else
            m_uiResetTimer -= uiDiff;
    }

    if (GetData(TYPE_RAZORGORE) != IN_PROGRESS)
        return;

    if (m_uiDefenseTimer < uiDiff)
    {
        // Randomize generators
        std::random_shuffle(m_vGeneratorGuids.begin(), m_vGeneratorGuids.end());

        // Spawn the defenders
        for (uint8 i = 0; i < MAX_EGGS_DEFENDERS; ++i)
        {
            Creature* pGenerator = instance->GetCreature(m_vGeneratorGuids[i]);
            if (!pGenerator)
                continue;

            // Defenders are spawned randomly, 4 at a time
            // There can be up to 12 Dragonspawns spawned and 40 Orcs (either mage or legionnaire)
            // If one of the cap is reached, only the remaining type of NPC is spawned until the second cap is also reached

            uint32 uiSpellId = 0;                                                   // Hold the spell summoning the NPC defender for that generator
            uint8 uiMaxRange = (m_uiDragonspawnCount < MAX_DRAGONSPAWN ? 3 : 1);    // If all dragonspawns are already spawned, don't roll for them below

            switch (urand(0, uiMaxRange))
            {
                case 0:
                    if (m_uiBlackwingDefCount < MAX_BLACKWING_DEFENDER)
                        uiSpellId = SPELL_SUMMON_LEGIONNAIRE;
                    break;
                case 1:
                    if (m_uiBlackwingDefCount < MAX_BLACKWING_DEFENDER)
                        uiSpellId = SPELL_SUMMON_MAGE;
                    break;
                case 2:
                case 3:
                    uiSpellId = SPELL_SUMMON_DRAGONSPAWN;
                    break;
            }

            if (uiSpellId != 0)
                pGenerator->CastSpell(pGenerator, uiSpellId, TRIGGERED_NONE);
        }

        m_uiDefenseTimer = 15000;
    }
    else
        m_uiDefenseTimer -= uiDiff;
}
 void TombOfSevenStart()
 {
     HandleGameObject(GoTombExitGUID, false);//event started, close exit door
     HandleGameObject(GoTombEnterGUID, false);//event started, close entrance door
     SetData(TYPE_TOMB_OF_SEVEN, IN_PROGRESS);
 }
void instance_blackrock_depths::OnCreatureEnterCombat(Creature* pCreature)
{
    if (pCreature->GetEntry() == NPC_MAGMUS)
        SetData(TYPE_IRON_HALL, IN_PROGRESS);
}
예제 #9
0
void BattlefieldWG::OnBattleStart()
{
    // Spawn titan relic
    m_titansRelic = SpawnGameObject(GO_WINTERGRASP_TITAN_S_RELIC, 5440.0f, 2840.8f, 430.43f, 0);
    if (m_titansRelic)
    {
        // Update faction of relic, only attacker can click on
        m_titansRelic->SetUInt32Value(GAMEOBJECT_FACTION, WintergraspFaction[GetAttackerTeam()]);
        // Set in use (not allow to click on before last door is broken)
        m_titansRelic->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE);
    }
    else
        sLog->outError(LOG_FILTER_BATTLEFIELD, "WG: Failed to spawn titan relic.");


    // Update tower visibility and update faction
    for (GuidSet::const_iterator itr = CanonList.begin(); itr != CanonList.end(); ++itr)
    {
        if (Unit* unit = sObjectAccessor->FindUnit(*itr))
        {
            if (Creature* creature = unit->ToCreature())
            {
                ShowNpc(creature, true);
                creature->setFaction(WintergraspFaction[GetDefenderTeam()]);
            }
        }
    }

    // Rebuild all wall
    for (GameObjectBuilding::const_iterator itr = BuildingsInZone.begin(); itr != BuildingsInZone.end(); ++itr)
    {
        if (*itr)
        {
            (*itr)->Rebuild();
            (*itr)->UpdateTurretAttack(false);
        }
    }

    SetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT, 0);
    SetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_DEF, 0);
    SetData(BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT, 0);
    SetData(BATTLEFIELD_WG_DATA_DAMAGED_TOWER_DEF, 0);

    // Update graveyard (in no war time all graveyard is to deffender, in war time, depend of base)
    for (Workshop::const_iterator itr = WorkshopsList.begin(); itr != WorkshopsList.end(); ++itr)
        if (*itr)
            (*itr)->UpdateGraveyardAndWorkshop();

    for (uint8 team = 0; team < 2; ++team)
        for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
        {
            // Kick player in orb room, TODO: offline player ?
            if (Player* player = sObjectAccessor->FindPlayer(*itr))
            {
                float x, y, z;
                player->GetPosition(x, y, z);
                if (5500 > x && x > 5392 && y < 2880 && y > 2800 && z < 480)
                    player->TeleportTo(571, 5349.8686f, 2838.481f, 409.240f, 0.046328f);
                SendInitWorldStatesTo(player);
            }
        }
    // Initialize vehicle counter
    UpdateCounterVehicle(true);
    // Send start warning to all players
    SendWarningToAllInZone(BATTLEFIELD_WG_TEXT_START);
}
CharArrayHolder::CharArrayHolder(std::string data)
{
	SetData(data);
}
void instance_blackrock_depths::SetData(uint32 uiType, uint32 uiData)
{
    switch (uiType)
    {
        case TYPE_RING_OF_LAW:
            // If finished the arena event after theldren fight
            if (uiData == DONE && m_auiEncounter[0] == SPECIAL)
                DoRespawnGameObject(GO_ARENA_SPOILS, HOUR);
            else if (uiData == DONE)
            {
                for (GuidSet::const_iterator itr = m_sArenaCrowdNpcGuids.begin(); itr != m_sArenaCrowdNpcGuids.end(); ++itr)
                {
                    if (Creature* pSpectator = instance->GetCreature(*itr))
                        pSpectator->SetFactionTemporary(FACTION_ARENA_NEUTRAL, TEMPFACTION_RESTORE_RESPAWN);
                }
            }
            m_auiEncounter[0] = uiData;
            break;
        case TYPE_VAULT:
            if (uiData == SPECIAL)
            {
                ++m_uiCofferDoorsOpened;

                if (m_uiCofferDoorsOpened == MAX_RELIC_DOORS)
                {
                    SetData(TYPE_VAULT, IN_PROGRESS);

                    Creature* pConstruct = NULL;

                    // Activate vault constructs
                    for (GuidSet::const_iterator itr = m_sVaultNpcGuids.begin(); itr != m_sVaultNpcGuids.end(); ++itr)
                    {
                        pConstruct = instance->GetCreature(*itr);
                        if (pConstruct)
                            pConstruct->RemoveAurasDueToSpell(SPELL_STONED);
                    }

                    if (!pConstruct)
                        return;

                    // Summon doomgrip
                    pConstruct->SummonCreature(NPC_WATCHER_DOOMGRIP, aVaultPositions[0], aVaultPositions[1], aVaultPositions[2], aVaultPositions[3], TEMPSUMMON_DEAD_DESPAWN, 0);
                }
                // No need to store in this case
                return;
            }
            if (uiData == DONE)
            {
                DoUseDoorOrButton(GO_SECRET_DOOR);
                DoToggleGameObjectFlags(GO_SECRET_SAFE, GO_FLAG_NO_INTERACT, false);
            }
            m_auiEncounter[1] = uiData;
            break;
        case TYPE_BAR:
            if (uiData == SPECIAL)
                ++m_uiBarAleCount;
            else
                m_auiEncounter[2] = uiData;
            break;
        case TYPE_TOMB_OF_SEVEN:
            // Don't set the same data twice
            if (uiData == m_auiEncounter[3])
                break;
            // Combat door
            DoUseDoorOrButton(GO_TOMB_ENTER);
            // Start the event
            if (uiData == IN_PROGRESS)
                DoCallNextDwarf();
            if (uiData == FAIL)
            {
                // Reset dwarfes
                for (uint8 i = 0; i < MAX_DWARFS; ++i)
                {
                    if (Creature* pDwarf = GetSingleCreatureFromStorage(aTombDwarfes[i]))
                    {
                        if (!pDwarf->isAlive())
                            pDwarf->Respawn();
                    }
                }

                m_uiDwarfRound = 0;
                m_uiDwarfFightTimer = 0;
            }
            if (uiData == DONE)
            {
                DoRespawnGameObject(GO_CHEST_SEVEN, HOUR);
                DoUseDoorOrButton(GO_TOMB_EXIT);
            }
            m_auiEncounter[3] = uiData;
            break;
        case TYPE_LYCEUM:
            if (uiData == DONE)
            {
                DoUseDoorOrButton(GO_GOLEM_ROOM_N);
                DoUseDoorOrButton(GO_GOLEM_ROOM_S);
            }
            m_auiEncounter[4] = uiData;
            break;
        case TYPE_IRON_HALL:
            switch (uiData)
            {
                case IN_PROGRESS:
                    DoUseDoorOrButton(GO_GOLEM_ROOM_N);
                    DoUseDoorOrButton(GO_GOLEM_ROOM_S);
                    break;
                case FAIL:
                    DoUseDoorOrButton(GO_GOLEM_ROOM_N);
                    DoUseDoorOrButton(GO_GOLEM_ROOM_S);
                    break;
                case DONE:
                    DoUseDoorOrButton(GO_GOLEM_ROOM_N);
                    DoUseDoorOrButton(GO_GOLEM_ROOM_S);
                    DoUseDoorOrButton(GO_THRONE_ROOM);
                    break;
            }
            m_auiEncounter[5] = uiData;
            break;
        case TYPE_QUEST_JAIL_BREAK:
            m_auiEncounter[6] = uiData;
            return;
        case TYPE_FLAMELASH:
            for (int i = 0; i < MAX_DWARF_RUNES; ++i)
                DoUseDoorOrButton(GO_DWARFRUNE_A01 + i);
            return;
    }

    if (uiData == DONE)
    {
        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_auiEncounter[7];

        m_strInstData = saveStream.str();

        SaveToDB();
        OUT_SAVE_INST_DATA_COMPLETE;
    }
}
예제 #12
0
 virtual void Update(uint32 diff)
 {
     switch (PyramidPhase)
     {
         case PYRAMID_NOT_STARTED:
         case PYRAMID_KILLED_ALL_TROLLS:
             break;
         case PYRAMID_ARRIVED_AT_STAIR:
             SpawnPyramidWave(1);
             SetData(EVENT_PYRAMID, PYRAMID_WAVE_1);
             major_wave_Timer = 120000;
             minor_wave_Timer = 0;
             addGroupSize = 2;
             break;
         case PYRAMID_WAVE_1:
             if (IsWaveAllDead())
             {
                 SetData(EVENT_PYRAMID, PYRAMID_PRE_WAVE_2);
                 major_wave_Timer = 10000; //give players a few seconds before wave 2 starts to rebuff
             }
             else if (minor_wave_Timer < diff)
             {
                 SendAddsUpStairs(addGroupSize++);
                 minor_wave_Timer = 10000;
             }
             else
                 minor_wave_Timer -= diff;
             break;
         case PYRAMID_PRE_WAVE_2:
             if (major_wave_Timer < diff)
             {
                 // beginning 2nd wave!
                 SpawnPyramidWave(2);
                 SetData(EVENT_PYRAMID, PYRAMID_WAVE_2);
                 minor_wave_Timer = 0;
                 addGroupSize = 2;
             }
             else
                 major_wave_Timer -= diff;
             break;
         case PYRAMID_WAVE_2:
             if (IsWaveAllDead())
             {
                 SpawnPyramidWave(3);
                 SetData(EVENT_PYRAMID, PYRAMID_PRE_WAVE_3);
                 major_wave_Timer = 5000; //give NPCs time to return to their home spots
             }
             else if (minor_wave_Timer < diff)
             {
                 SendAddsUpStairs(addGroupSize++);
                 minor_wave_Timer = 10000;
             }
             else
                 minor_wave_Timer -= diff;
             break;
         case PYRAMID_PRE_WAVE_3:
             if (major_wave_Timer < diff)
             {
                 // move NPCs to bottom of stair
                 MoveNPCIfAlive(ENTRY_BLY, 1887.92f, 1228.179f, 9.98f, 4.78f);
                 MoveNPCIfAlive(ENTRY_MURTA, 1891.57f, 1228.68f, 9.69f, 4.78f);
                 MoveNPCIfAlive(ENTRY_ORO, 1897.23f, 1228.34f, 9.43f, 4.78f);
                 MoveNPCIfAlive(ENTRY_RAVEN, 1883.68f, 1227.95f, 9.543f, 4.78f);
                 MoveNPCIfAlive(ENTRY_WEEGLI, 1878.02f, 1227.65f, 9.485f, 4.78f);
                 SetData(EVENT_PYRAMID, PYRAMID_WAVE_3);
             }
             else
                 major_wave_Timer -= diff;
             break;
         case PYRAMID_WAVE_3:
             if (IsWaveAllDead()) // move NPCS to their final positions
             {
                 SetData(EVENT_PYRAMID, PYRAMID_KILLED_ALL_TROLLS);
                 MoveNPCIfAlive(ENTRY_BLY, 1883.82f, 1200.83f, 8.87f, 1.32f);
                 MoveNPCIfAlive(ENTRY_MURTA, 1891.83f, 1201.45f, 8.87f, 1.32f);
                 MoveNPCIfAlive(ENTRY_ORO, 1894.50f, 1204.40f, 8.87f, 1.32f);
                 MoveNPCIfAlive(ENTRY_RAVEN, 1874.11f, 1206.17f, 8.87f, 1.32f);
                 MoveNPCIfAlive(ENTRY_WEEGLI, 1877.52f, 1199.63f, 8.87f, 1.32f);
             }
             break;
     };
 }
예제 #13
0
void instance_stratholme::Update(uint32 uiDiff)
{
    if (m_uiBarthilasRunTimer)
    {
        if (m_uiBarthilasRunTimer <= uiDiff)
        {
            Creature* pBarthilas = GetSingleCreatureFromStorage(NPC_BARTHILAS);
            if (pBarthilas && pBarthilas->IsAlive() && !pBarthilas->IsInCombat())
            {
                pBarthilas->NearTeleportTo(aStratholmeLocation[1].m_fX, aStratholmeLocation[1].m_fY, aStratholmeLocation[1].m_fZ, aStratholmeLocation[1].m_fO);
            }

            SetData(TYPE_BARTHILAS_RUN, DONE);
            m_uiBarthilasRunTimer = 0;
        }
        else
        {
            m_uiBarthilasRunTimer -= uiDiff;
        }
    }

    if (m_uiBaronRunTimer)
    {
        if (m_uiYellCounter == 0 && m_uiBaronRunTimer <= 10 * MINUTE * IN_MILLISECONDS)
        {
            DoOrSimulateScriptTextForThisInstance(SAY_ANNOUNCE_RUN_10_MIN, NPC_BARON);
            ++m_uiYellCounter;
        }
        else if (m_uiYellCounter == 1 && m_uiBaronRunTimer <= 5 * MINUTE * IN_MILLISECONDS)
        {
            DoOrSimulateScriptTextForThisInstance(SAY_ANNOUNCE_RUN_5_MIN, NPC_BARON);
            ++m_uiYellCounter;
        }

        if (m_uiBaronRunTimer <= uiDiff)
        {
            SetData(TYPE_BARON_RUN, FAIL);

            DoOrSimulateScriptTextForThisInstance(SAY_ANNOUNCE_RUN_FAIL, NPC_BARON);

            m_uiBaronRunTimer = 0;
            debug_log("SD2: Instance Stratholme: Baron run event reached end. Event has state %u.", GetData(TYPE_BARON_RUN));
        }
        else
        {
            m_uiBaronRunTimer -= uiDiff;
        }
    }

    if (m_uiMindlessSummonTimer)
    {
        if (m_uiMindlessCount < 30)
        {
            if (m_uiMindlessSummonTimer <= uiDiff)
            {
                if (Creature* pBaron = GetSingleCreatureFromStorage(NPC_BARON))
                {
                    // Summon mindless skeletons and move them to random point in the center of the square
                    if (Creature* pTemp = pBaron->SummonCreature(NPC_MINDLESS_UNDEAD, aStratholmeLocation[4].m_fX, aStratholmeLocation[4].m_fY, aStratholmeLocation[4].m_fZ, aStratholmeLocation[4].m_fO, TEMPSUMMON_DEAD_DESPAWN, 0))
                    {
                        float fX, fY, fZ;
                        pBaron->GetRandomPoint(aStratholmeLocation[5].m_fX, aStratholmeLocation[5].m_fY, aStratholmeLocation[5].m_fZ, 20.0f, fX, fY, fZ);
                        pTemp->GetMotionMaster()->MovePoint(0, fX, fY, fZ);
                        m_luiUndeadGUIDs.push_back(pTemp->GetObjectGuid());
                        ++m_uiMindlessCount;
                    }
                }
                m_uiMindlessSummonTimer = 400;
            }
            else
            {
                m_uiMindlessSummonTimer -= uiDiff;
            }
        }
        else
        {
            m_uiMindlessSummonTimer = 0;
        }
    }

    if (m_uiSlaugtherSquareTimer)
    {
        if (m_uiSlaugtherSquareTimer <= uiDiff)
        {
            // Call next Abomnations
            for (GuidSet::const_iterator itr = m_sAbomnationGUID.begin(); itr != m_sAbomnationGUID.end(); ++itr)
            {
                Creature* pAbom = instance->GetCreature(*itr);
                // Skip killed and already walking Abomnations
                if (!pAbom || !pAbom->IsAlive() || pAbom->GetMotionMaster()->GetCurrentMovementGeneratorType() == POINT_MOTION_TYPE)
                {
                    continue;
                }

                // Let Move to somewhere in the middle
                if (!pAbom->IsInCombat())
                {
                    if (GameObject* pDoor = GetSingleGameObjectFromStorage(GO_PORT_SLAUGTHER))
                    {
                        float fX, fY, fZ;
                        pAbom->GetRandomPoint(pDoor->GetPositionX(), pDoor->GetPositionY(), pDoor->GetPositionZ(), 10.0f, fX, fY, fZ);
                        pAbom->GetMotionMaster()->MovePoint(0, fX, fY, fZ);
                    }
                }
                break;
            }

            // TODO - how fast are they called?
            m_uiSlaugtherSquareTimer = urand(15000, 30000);
        }
        else
        {
            m_uiSlaugtherSquareTimer -= uiDiff;
        }
    }
}
예제 #14
0
void instance_stratholme::OnCreatureDeath(Creature* pCreature)
{
    switch (pCreature->GetEntry())
    {
        case NPC_BARONESS_ANASTARI:
            SetData(TYPE_BARONESS, DONE);
            break;
        case NPC_MALEKI_THE_PALLID:
            SetData(TYPE_PALLID, DONE);
            break;
        case NPC_NERUBENKAN:
            SetData(TYPE_NERUB, DONE);
            break;
        case NPC_RAMSTEIN:
            SetData(TYPE_RAMSTEIN, DONE);
            break;
        case NPC_BARON:
            SetData(TYPE_BARON, DONE);
            break;

        case NPC_THUZADIN_ACOLYTE:
            ThazudinAcolyteJustDied(pCreature);
            break;

        case NPC_ABOM_BILE:
        case NPC_ABOM_VENOM:
            // Start Slaughterhouse Event
            SetData(TYPE_RAMSTEIN, SPECIAL);
            break;

        case NPC_MINDLESS_UNDEAD:
            m_luiUndeadGUIDs.remove(pCreature->GetObjectGuid());
            if (m_luiUndeadGUIDs.empty())
            {
                // Let the black Guards move out of the citadel
                for (GuidList::const_iterator itr = m_luiGuardGUIDs.begin(); itr != m_luiGuardGUIDs.end(); ++itr)
                {
                    Creature* pGuard = instance->GetCreature(*itr);
                    if (pGuard && pGuard->IsAlive() && !pGuard->IsInCombat())
                    {
                        float fX, fY, fZ;
                        pGuard->GetRandomPoint(aStratholmeLocation[5].m_fX, aStratholmeLocation[5].m_fY, aStratholmeLocation[5].m_fZ, 10.0f, fX, fY, fZ);
                        pGuard->GetMotionMaster()->MovePoint(0, fX, fY, fZ);
                    }
                }
            }
            break;
        case NPC_BLACK_GUARD:
            m_luiGuardGUIDs.remove(pCreature->GetObjectGuid());
            if (m_luiGuardGUIDs.empty())
            {
                SetData(TYPE_BLACK_GUARDS, DONE);
            }

            break;

            // Timmy spawn support
        case NPC_CRIMSON_INITIATE:
        case NPC_CRIMSON_GALLANT:
        case NPC_CRIMSON_GUARDSMAN:
        case NPC_CRIMSON_CONJURER:
            if (m_suiCrimsonLowGuids.find(pCreature->GetGUIDLow()) != m_suiCrimsonLowGuids.end())
            {
                m_suiCrimsonLowGuids.erase(pCreature->GetGUIDLow());

                // If all courtyard mobs are dead then summon Timmy
                if (m_suiCrimsonLowGuids.empty())
                {
                    pCreature->SummonCreature(NPC_TIMMY_THE_CRUEL, aTimmyLocation[0].m_fX, aTimmyLocation[0].m_fY, aTimmyLocation[0].m_fZ, aTimmyLocation[0].m_fO, TEMPSUMMON_DEAD_DESPAWN, 0);
                }
            }
            break;
    }
}
void instance_draktharon_keep::OnCreatureEvade(Creature* pCreature)
{
    if (pCreature->GetEntry() == NPC_KING_DRED)
        SetData(TYPE_KING_DRED, FAIL);
}
/* Keyword メッセージ処理 */
INT_PTR CPropKeyword::DispatchEvent(
	HWND	hwndDlg,	// handle to dialog box
	UINT	uMsg,		// message
	WPARAM	wParam,		// first message parameter
	LPARAM	lParam 		// second message parameter
)
{
	WORD				wNotifyCode;
	WORD				wID;
	HWND				hwndCtl;
	NMHDR*				pNMHDR;
	int					nIndex1;
	int					i;
	LV_COLUMN			lvc;
	LV_ITEM*			plvi;
	static HWND			hwndCOMBO_SET;
	static HWND			hwndLIST_KEYWORD;
	RECT				rc;
	CDlgInput1			cDlgInput1;
	wchar_t				szKeyWord[MAX_KEYWORDLEN + 1];
	LONG_PTR			lStyle;
	LV_DISPINFO*		plvdi;
	LV_KEYDOWN*			pnkd;

	switch( uMsg ){
	case WM_INITDIALOG:
		/* ダイアログデータの設定 Keyword */
		SetData( hwndDlg );
		// Modified by KEITA for WIN64 2003.9.6
		::SetWindowLongPtr( hwndDlg, DWLP_USER, lParam );
		if( wParam == IDOK ){ // 独立ウィンドウ
			hwndCtl = ::GetDlgItem( hwndDlg, IDOK );
			GetWindowRect( hwndCtl, &rc );
			i = rc.bottom; // OK,CANCELボタンの下端

			GetWindowRect( hwndDlg, &rc );
			SetWindowPos( hwndDlg, NULL, 0, 0, rc.right-rc.left, i-rc.top+10, SWP_NOZORDER|SWP_NOMOVE );
			std::tstring title = LS(STR_PROPCOMMON);
			title += _T(" - ");
			title += LS(STR_PROPCOMMON_KEYWORD);
			SetWindowText( hwndDlg, title.c_str() );

			hwndCOMBO_SET = ::GetDlgItem( hwndDlg, IDC_COMBO_SET );
			Combo_SetCurSel( hwndCOMBO_SET, m_nKeywordSet1 );
		}
		else{
			hwndCtl = ::GetDlgItem( hwndDlg, IDOK );
			ShowWindow( hwndCtl, SW_HIDE );
			hwndCtl = ::GetDlgItem( hwndDlg, IDCANCEL );
			ShowWindow( hwndCtl, SW_HIDE );
		}

		/* コントロールのハンドルを取得 */
		hwndCOMBO_SET = ::GetDlgItem( hwndDlg, IDC_COMBO_SET );
		hwndLIST_KEYWORD = ::GetDlgItem( hwndDlg, IDC_LIST_KEYWORD );
		::GetWindowRect( hwndLIST_KEYWORD, &rc );
		lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
		lvc.fmt = LVCFMT_LEFT;
		lvc.cx = rc.right - rc.left;
		lvc.pszText = const_cast<TCHAR*>(_T(""));
		lvc.iSubItem = 0;
		ListView_InsertColumn( hwndLIST_KEYWORD, 0, &lvc );

		lStyle = ::GetWindowLongPtr( hwndLIST_KEYWORD, GWL_STYLE );
		::SetWindowLongPtr( hwndLIST_KEYWORD, GWL_STYLE, lStyle | LVS_SHOWSELALWAYS );


		/* コントロール更新のタイミング用のタイマーを起動 */
		::SetTimer( hwndDlg, 1, 300, NULL );

		return TRUE;

	case WM_NOTIFY:
		pNMHDR = (NMHDR*)lParam;
		pnkd = (LV_KEYDOWN *)lParam;
		plvdi = (LV_DISPINFO*)lParam;
		plvi = &plvdi->item;

		if( hwndLIST_KEYWORD == pNMHDR->hwndFrom ){
			switch( pNMHDR->code ){
			case NM_DBLCLK:
//				MYTRACE( _T("NM_DBLCLK     \n") );
				/* リスト中で選択されているキーワードを編集する */
				Edit_List_KeyWord( hwndDlg, hwndLIST_KEYWORD );
				return TRUE;
			case LVN_BEGINLABELEDIT:
#ifdef _DEBUG
				MYTRACE( _T("LVN_BEGINLABELEDIT\n") );
												MYTRACE( _T("	plvi->mask =[%xh]\n"), plvi->mask );
												MYTRACE( _T("	plvi->iItem =[%d]\n"), plvi->iItem );
												MYTRACE( _T("	plvi->iSubItem =[%d]\n"), plvi->iSubItem );
				if (plvi->mask & LVIF_STATE)	MYTRACE( _T("	plvi->state =[%xf]\n"), plvi->state );
												MYTRACE( _T("	plvi->stateMask =[%xh]\n"), plvi->stateMask );
				if (plvi->mask & LVIF_TEXT)		MYTRACE( _T("	plvi->pszText =[%ts]\n"), plvi->pszText );
												MYTRACE( _T("	plvi->cchTextMax=[%d]\n"), plvi->cchTextMax );
				if (plvi->mask & LVIF_IMAGE)	MYTRACE( _T("	plvi->iImage=[%d]\n"), plvi->iImage );
				if (plvi->mask & LVIF_PARAM)	MYTRACE( _T("	plvi->lParam=[%xh(%d)]\n"), plvi->lParam, plvi->lParam );
#endif
				return TRUE;
			case LVN_ENDLABELEDIT:
#ifdef _DEBUG
				MYTRACE( _T("LVN_ENDLABELEDIT\n") );
												MYTRACE( _T("	plvi->mask =[%xh]\n"), plvi->mask );
												MYTRACE( _T("	plvi->iItem =[%d]\n"), plvi->iItem );
												MYTRACE( _T("	plvi->iSubItem =[%d]\n"), plvi->iSubItem );
				if (plvi->mask & LVIF_STATE)	MYTRACE( _T("	plvi->state =[%xf]\n"), plvi->state );
												MYTRACE( _T("	plvi->stateMask =[%xh]\n"), plvi->stateMask );
				if (plvi->mask & LVIF_TEXT)		MYTRACE( _T("	plvi->pszText =[%ts]\n"), plvi->pszText  );
												MYTRACE( _T("	plvi->cchTextMax=[%d]\n"), plvi->cchTextMax );
				if (plvi->mask & LVIF_IMAGE)	MYTRACE( _T("	plvi->iImage=[%d]\n"), plvi->iImage );
				if (plvi->mask & LVIF_PARAM)	MYTRACE( _T("	plvi->lParam=[%xh(%d)]\n"), plvi->lParam, plvi->lParam );
#endif
				if( NULL == plvi->pszText ){
					return TRUE;
				}
				if( plvi->pszText[0] != _T('\0') ){
					if( MAX_KEYWORDLEN < _tcslen( plvi->pszText ) ){
						InfoMessage( hwndDlg, LS(STR_PROPCOMKEYWORD_ERR_LEN), MAX_KEYWORDLEN );
						return TRUE;
					}
					/* n番目のセットにキーワードを編集 */
					m_Common.m_sSpecialKeyword.m_CKeyWordSetMgr.UpdateKeyWord(
						m_Common.m_sSpecialKeyword.m_CKeyWordSetMgr.m_nCurrentKeyWordSetIdx,
						plvi->lParam,
						to_wchar(plvi->pszText)
					);
				}else{
					/* n番目のセットのm番目のキーワードを削除 */
					m_Common.m_sSpecialKeyword.m_CKeyWordSetMgr.DelKeyWord( m_Common.m_sSpecialKeyword.m_CKeyWordSetMgr.m_nCurrentKeyWordSetIdx, plvi->lParam );
				}
				/* ダイアログデータの設定 Keyword 指定キーワードセットの設定 */
				SetKeyWordSet( hwndDlg, m_Common.m_sSpecialKeyword.m_CKeyWordSetMgr.m_nCurrentKeyWordSetIdx );

				ListView_SetItemState( hwndLIST_KEYWORD, plvi->iItem, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED );

				return TRUE;
			case LVN_KEYDOWN:
//				MYTRACE( _T("LVN_KEYDOWN\n") );
				switch( pnkd->wVKey ){
				case VK_DELETE:
					/* リスト中で選択されているキーワードを削除する */
					Delete_List_KeyWord( hwndDlg, hwndLIST_KEYWORD );
					break;
				case VK_SPACE:
					/* リスト中で選択されているキーワードを編集する */
					Edit_List_KeyWord( hwndDlg, hwndLIST_KEYWORD );
					break;
				}
				return TRUE;
			}
		}else{
			switch( pNMHDR->code ){
			case PSN_HELP:
				OnHelp( hwndDlg, IDD_PROP_KEYWORD );
				return TRUE;
			case PSN_KILLACTIVE:
				DEBUG_TRACE( _T("Keyword PSN_KILLACTIVE\n") );
				/* ダイアログデータの取得 Keyword */
				GetData( hwndDlg );
				return TRUE;
//@@@ 2002.01.03 YAZAKI 最後に表示していたシートを正しく覚えていないバグ修正
			case PSN_SETACTIVE:
				m_nPageNum = ID_PROPCOM_PAGENUM_KEYWORD;
				return TRUE;
			}
		}
		break;
	case WM_COMMAND:
		wNotifyCode = HIWORD(wParam);	/* 通知コード */
		wID = LOWORD(wParam);			/* 項目ID、 コントロールID、 またはアクセラレータID */
		hwndCtl = (HWND) lParam;		/* コントロールのハンドル */
		if( hwndCOMBO_SET == hwndCtl){
			switch( wNotifyCode ){
			case CBN_SELCHANGE:
				nIndex1 = Combo_GetCurSel( hwndCOMBO_SET );
				/* ダイアログデータの設定 Keyword 指定キーワードセットの設定 */
				SetKeyWordSet( hwndDlg, nIndex1 );
				return TRUE;
			}
		}else{
			switch( wNotifyCode ){
			/* ボタン/チェックボックスがクリックされた */
			case BN_CLICKED:
				switch( wID ){
				case IDC_BUTTON_ADDSET:	/* セット追加 */
					if( MAX_SETNUM <= m_Common.m_sSpecialKeyword.m_CKeyWordSetMgr.m_nKeyWordSetNum ){
						InfoMessage( hwndDlg, LS(STR_PROPCOMKEYWORD_SETMAX), MAX_SETNUM );
						return TRUE;
					}
					/* モードレスダイアログの表示 */
					szKeyWord[0] = L'\0';
					//	Oct. 5, 2002 genta 長さ制限の設定を修正.バッファオーバーランしていた.
					if( !cDlgInput1.DoModal(
						G_AppInstance(),
						hwndDlg,
						LS(STR_PROPCOMKEYWORD_SETNAME1),
						LS(STR_PROPCOMKEYWORD_SETNAME2),
						MAX_SETNAMELEN,
						szKeyWord
						)
					){
						return TRUE;
					}
					if( szKeyWord[0] != L'\0' ){
						/* セットの追加 */
						m_Common.m_sSpecialKeyword.m_CKeyWordSetMgr.AddKeyWordSet( szKeyWord, false );

						m_Common.m_sSpecialKeyword.m_CKeyWordSetMgr.m_nCurrentKeyWordSetIdx = m_Common.m_sSpecialKeyword.m_CKeyWordSetMgr.m_nKeyWordSetNum - 1;

						/* ダイアログデータの設定 Keyword */
						SetData( hwndDlg );
					}
					return TRUE;
				case IDC_BUTTON_DELSET:	/* セット削除 */
					nIndex1 = Combo_GetCurSel( hwndCOMBO_SET );
					if( CB_ERR == nIndex1 ){
						return TRUE;
					}
					/* 削除対象のセットを使用しているファイルタイプを列挙 */
					static TCHAR		pszLabel[1024];
					_tcscpy( pszLabel, _T("") );
					for( i = 0; i < GetDllShareData().m_nTypesCount; ++i ){
						std::auto_ptr<STypeConfig> type(new STypeConfig());
						CDocTypeManager().GetTypeConfig( CTypeConfig(i), *type );
						// 2002/04/25 YAZAKI STypeConfig全体を保持する必要はないし、m_pShareDataを直接見ても問題ない。
						if( nIndex1 == m_Types_nKeyWordSetIdx[i].index[0]
						||  nIndex1 == m_Types_nKeyWordSetIdx[i].index[1]
						||  nIndex1 == m_Types_nKeyWordSetIdx[i].index[2]
						||  nIndex1 == m_Types_nKeyWordSetIdx[i].index[3]
						||  nIndex1 == m_Types_nKeyWordSetIdx[i].index[4]
						||  nIndex1 == m_Types_nKeyWordSetIdx[i].index[5]
						||  nIndex1 == m_Types_nKeyWordSetIdx[i].index[6]
						||  nIndex1 == m_Types_nKeyWordSetIdx[i].index[7]
						||  nIndex1 == m_Types_nKeyWordSetIdx[i].index[8]
						||  nIndex1 == m_Types_nKeyWordSetIdx[i].index[9] ){
							_tcscat( pszLabel, _T("・") );
							_tcscat( pszLabel, type->m_szTypeName );
							_tcscat( pszLabel, _T("(") );
							_tcscat( pszLabel, type->m_szTypeExts );
							_tcscat( pszLabel, _T(")") );
							_tcscat( pszLabel, _T("\n") );
						}
					}
					if( IDCANCEL == ::MYMESSAGEBOX(	hwndDlg, MB_OKCANCEL | MB_ICONQUESTION, GSTR_APPNAME,
						LS(STR_PROPCOMKEYWORD_SETDEL),
						m_Common.m_sSpecialKeyword.m_CKeyWordSetMgr.GetTypeName( nIndex1 ),
						pszLabel
					) ){
						return TRUE;
					}
					/* 削除対象のセットを使用しているファイルタイプのセットをクリア */
					for( i = 0; i < GetDllShareData().m_nTypesCount; ++i ){
						// 2002/04/25 YAZAKI STypeConfig全体を保持する必要はない。
						for( int j = 0; j < MAX_KEYWORDSET_PER_TYPE; j++ ){
							if( nIndex1 == m_Types_nKeyWordSetIdx[i].index[j] ){
								m_Types_nKeyWordSetIdx[i].index[j] = -1;
							}
							else if( nIndex1 < m_Types_nKeyWordSetIdx[i].index[j] ){
								m_Types_nKeyWordSetIdx[i].index[j]--;
							}
						}
					}
					/* n番目のセットを削除 */
					m_Common.m_sSpecialKeyword.m_CKeyWordSetMgr.DelKeyWordSet( m_Common.m_sSpecialKeyword.m_CKeyWordSetMgr.m_nCurrentKeyWordSetIdx );
					/* ダイアログデータの設定 Keyword */
					SetData( hwndDlg );
					return TRUE;
				case IDC_BUTTON_KEYSETRENAME: // キーワードセットの名称変更
					// モードレスダイアログの表示
					wcscpy( szKeyWord, m_Common.m_sSpecialKeyword.m_CKeyWordSetMgr.GetTypeName( m_Common.m_sSpecialKeyword.m_CKeyWordSetMgr.m_nCurrentKeyWordSetIdx ) );
					{
						BOOL bDlgInputResult = cDlgInput1.DoModal(
							G_AppInstance(),
							hwndDlg,
							LS(STR_PROPCOMKEYWORD_RENAME1),
							LS(STR_PROPCOMKEYWORD_RENAME2),
							MAX_SETNAMELEN,
							szKeyWord
						);
						if( !bDlgInputResult ){
							return TRUE;
						}
					}
					if( szKeyWord[0] != L'\0' ){
						m_Common.m_sSpecialKeyword.m_CKeyWordSetMgr.SetTypeName( m_Common.m_sSpecialKeyword.m_CKeyWordSetMgr.m_nCurrentKeyWordSetIdx, szKeyWord );

						// ダイアログデータの設定 Keyword
						SetData( hwndDlg );
					}
					return TRUE;
				case IDC_CHECK_KEYWORDCASE:	/* キーワードの英大文字小文字区別 */
//					m_Common.m_sSpecialKeyword.m_CKeyWordSetMgr.m_bKEYWORDCASEArr[ m_Common.m_sSpecialKeyword.m_CKeyWordSetMgr.m_nCurrentKeyWordSetIdx ] = ::IsDlgButtonChecked( hwndDlg, IDC_CHECK_KEYWORDCASE );	//MIK 2000.12.01 case sense
					m_Common.m_sSpecialKeyword.m_CKeyWordSetMgr.SetKeyWordCase(m_Common.m_sSpecialKeyword.m_CKeyWordSetMgr.m_nCurrentKeyWordSetIdx, ::IsDlgButtonChecked( hwndDlg, IDC_CHECK_KEYWORDCASE ));			//MIK 2000.12.01 case sense
					return TRUE;
				case IDC_BUTTON_ADDKEYWORD:	/* キーワード追加 */
					/* n番目のセットのキーワードの数を返す */
					if( !m_Common.m_sSpecialKeyword.m_CKeyWordSetMgr.CanAddKeyWord( m_Common.m_sSpecialKeyword.m_CKeyWordSetMgr.m_nCurrentKeyWordSetIdx ) ){
						InfoMessage( hwndDlg, LS(STR_PROPCOMKEYWORD_KEYMAX) );
						return TRUE;
					}
					/* モードレスダイアログの表示 */
					szKeyWord[0] = L'\0';
					if( !cDlgInput1.DoModal( G_AppInstance(), hwndDlg, LS(STR_PROPCOMKEYWORD_KEYADD1), LS(STR_PROPCOMKEYWORD_KEYADD2), MAX_KEYWORDLEN, szKeyWord ) ){
						return TRUE;
					}
					if( szKeyWord[0] != L'\0' ){
						/* n番目のセットにキーワードを追加 */
						if( 0 == m_Common.m_sSpecialKeyword.m_CKeyWordSetMgr.AddKeyWord( m_Common.m_sSpecialKeyword.m_CKeyWordSetMgr.m_nCurrentKeyWordSetIdx, szKeyWord ) ){
							// ダイアログデータの設定 Keyword 指定キーワードセットの設定
							SetKeyWordSet( hwndDlg, m_Common.m_sSpecialKeyword.m_CKeyWordSetMgr.m_nCurrentKeyWordSetIdx );
						}
					}
					return TRUE;
				case IDC_BUTTON_EDITKEYWORD:	/* キーワード編集 */
					/* リスト中で選択されているキーワードを編集する */
					Edit_List_KeyWord( hwndDlg, hwndLIST_KEYWORD );
					return TRUE;
				case IDC_BUTTON_DELKEYWORD:	/* キーワード削除 */
					/* リスト中で選択されているキーワードを削除する */
					Delete_List_KeyWord( hwndDlg, hwndLIST_KEYWORD );
					return TRUE;
				// From Here 2005.01.26 Moca
				case IDC_BUTTON_KEYCLEAN:
					Clean_List_KeyWord( hwndDlg, hwndLIST_KEYWORD );
					return TRUE;
				// To Here 2005.01.26 Moca
				case IDC_BUTTON_IMPORT:	/* インポート */
					/* リスト中のキーワードをインポートする */
					Import_List_KeyWord( hwndDlg, hwndLIST_KEYWORD );
					return TRUE;
				case IDC_BUTTON_EXPORT:	/* エクスポート */
					/* リスト中のキーワードをエクスポートする */
					Export_List_KeyWord( hwndDlg, hwndLIST_KEYWORD );
					return TRUE;
				// 独立ウィンドウで使用する
				case IDOK:
					EndDialog( hwndDlg, IDOK );
					break;
				case IDCANCEL:
					EndDialog( hwndDlg, IDCANCEL );
					break;
				}
				break;	/* BN_CLICKED */
			}
		}
		break;	/* WM_COMMAND */

	case WM_TIMER:
		nIndex1 = ListView_GetNextItem( hwndLIST_KEYWORD, -1, LVNI_ALL | LVNI_SELECTED );
		if( -1 == nIndex1 ){
			::EnableWindow( ::GetDlgItem( hwndDlg, IDC_BUTTON_EDITKEYWORD ), FALSE );
			::EnableWindow( ::GetDlgItem( hwndDlg, IDC_BUTTON_DELKEYWORD ), FALSE );
		}else{
			::EnableWindow( ::GetDlgItem( hwndDlg, IDC_BUTTON_EDITKEYWORD ), TRUE );
			::EnableWindow( ::GetDlgItem( hwndDlg, IDC_BUTTON_DELKEYWORD ), TRUE );
		}
		break;

	case WM_DESTROY:
		::KillTimer( hwndDlg, 1 );
		break;

//@@@ 2001.02.04 Start by MIK: Popup Help
	case WM_HELP:
		{
			HELPINFO *p = (HELPINFO *)lParam;
			MyWinHelp( (HWND)p->hItemHandle, HELP_WM_HELP, (ULONG_PTR)(LPVOID)p_helpids );	// 2006.10.10 ryoji MyWinHelpに変更に変更
		}
		return TRUE;
		/*NOTREACHED*/
		//break;
//@@@ 2001.02.04 End

//@@@ 2001.12.22 Start by MIK: Context Menu Help
	//Context Menu
	case WM_CONTEXTMENU:
		MyWinHelp( hwndDlg, HELP_CONTEXTMENU, (ULONG_PTR)(LPVOID)p_helpids );	// 2006.10.10 ryoji MyWinHelpに変更に変更
		return TRUE;
//@@@ 2001.12.22 End

	}
	return FALSE;
}
void instance_blackwing_lair::SetData(uint32 uiType, uint32 uiData)
{
    switch (uiType)
    {
        case TYPE_RAZORGORE:
            m_auiEncounter[uiType] = uiData;
            if (uiData != SPECIAL)
                DoUseDoorOrButton(GO_DOOR_RAZORGORE_ENTER);
            if (uiData == DONE)
                DoUseDoorOrButton(GO_DOOR_RAZORGORE_EXIT);
            else if (uiData == FAIL)
            {
                m_uiResetTimer = 30000;

                // Reset the Orb of Domination and the eggs
                DoToggleGameObjectFlags(GO_ORB_OF_DOMINATION, GO_FLAG_NO_INTERACT, true);
                if (Creature* pOrb = GetSingleCreatureFromStorage(NPC_BLACKWING_ORB_TRIGGER))
                {
                    if (pOrb->isAlive())
                        pOrb->AI()->EnterEvadeMode();
                }

                // Reset defenders
                for (GuidList::const_iterator itr = m_lDefendersGuids.begin(); itr != m_lDefendersGuids.end(); ++itr)
                {
                    if (Creature* pDefender = instance->GetCreature(*itr))
                        pDefender->ForcedDespawn();
                }

                m_lUsedEggsGuids.clear();
                m_lDefendersGuids.clear();
                m_uiBlackwingDefCount = 0;
                m_uiDragonspawnCount = 0;
            }
            break;
        case TYPE_VAELASTRASZ:
            m_auiEncounter[uiType] = uiData;
            // Prevent the players from running back to the first room; use if the encounter is not special
            if (uiData != SPECIAL)
                DoUseDoorOrButton(GO_DOOR_RAZORGORE_EXIT);
            if (uiData == DONE)
                DoUseDoorOrButton(GO_DOOR_VAELASTRASZ);
            break;
        case TYPE_LASHLAYER:
            m_auiEncounter[uiType] = uiData;
            if (uiData == DONE)
                DoUseDoorOrButton(GO_DOOR_LASHLAYER);
            break;
        case TYPE_FIREMAW:
        case TYPE_EBONROC:
        case TYPE_FLAMEGOR:
            m_auiEncounter[uiType] = uiData;
            break;
        case TYPE_CHROMAGGUS:
            m_auiEncounter[uiType] = uiData;
            if (uiData == DONE)
                DoUseDoorOrButton(GO_DOOR_CHROMAGGUS_EXIT);
            break;
        case TYPE_NEFARIAN:
            // If epic quest for Scepter of the Shifting Sands is in progress when Nefarian is defeated mark it as complete
            if (uiData == DONE && GetData(TYPE_QUEST_SCEPTER) == IN_PROGRESS)
                SetData(TYPE_QUEST_SCEPTER, DONE);

            // Don't store the same thing twice
            if (m_auiEncounter[uiType] == uiData)
                break;

            if (uiData == SPECIAL)
            {
                // handle missing spell 23362
                Creature* pNefarius = GetSingleCreatureFromStorage(NPC_LORD_VICTOR_NEFARIUS);
                if (!pNefarius)
                    break;

                for (GuidList::const_iterator itr = m_lDrakonidBonesGuids.begin(); itr != m_lDrakonidBonesGuids.end(); ++itr)
                {
                    // The Go script will handle the missing spell 23361
                    if (GameObject* pGo = instance->GetGameObject(*itr))
                        pGo->Use(pNefarius);
                }
                // Don't store special data
                break;
            }
            m_auiEncounter[uiType] = uiData;
            DoUseDoorOrButton(GO_DOOR_NEFARIAN);
            // Cleanup the drakonid bones
            if (uiData == FAIL)
            {
                for (GuidList::const_iterator itr = m_lDrakonidBonesGuids.begin(); itr != m_lDrakonidBonesGuids.end(); ++itr)
                {
                    if (GameObject* pGo = instance->GetGameObject(*itr))
                        pGo->SetLootState(GO_JUST_DEACTIVATED);
                }

                m_lDrakonidBonesGuids.clear();
            }
            break;
        case TYPE_QUEST_SCEPTER:
            m_auiEncounter[uiType] = uiData;
            // Start 5 hours timer (various steps are handled in Update()
            if (uiData == IN_PROGRESS)
            {
                m_uiScepterEpicTimer = 2000;
                m_uiScepterQuestStep = 0;
            }
            // Stop timer
            if (uiData == DONE)
                m_uiScepterEpicTimer = 0;
            break;
    }

    if (uiData == DONE)
    {
        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_auiEncounter[7] << " " << m_auiEncounter[8];

        m_strInstData = saveStream.str();

        SaveToDB();
        OUT_SAVE_INST_DATA_COMPLETE;
    }
}
예제 #18
0
void instance_karazhan::Update(uint32 uiDiff)
{
    if (m_uiChessResetTimer)
    {
        // respawn all chess pieces and side stalkers on the original position
        if (m_uiChessResetTimer <= uiDiff)
        {
            for (GuidList::const_iterator itr = m_lChessPiecesAlliance.begin(); itr != m_lChessPiecesAlliance.end(); ++itr)
            {
                if (Creature* pTemp = instance->GetCreature(*itr))
                    pTemp->Respawn();
            }
            for (GuidList::const_iterator itr = m_lChessPiecesHorde.begin(); itr != m_lChessPiecesHorde.end(); ++itr)
            {
                if (Creature* pTemp = instance->GetCreature(*itr))
                    pTemp->Respawn();
            }

            for (GuidList::const_iterator itr = m_lChessAllianceStalkerList.begin(); itr != m_lChessAllianceStalkerList.end(); ++itr)
            {
                if (Creature* pTemp = instance->GetCreature(*itr))
                {
                    pTemp->Respawn();
                    pTemp->HandleEmote(EMOTE_STATE_NONE);
                }
            }
            for (GuidList::const_iterator itr = m_lChessHordeStalkerList.begin(); itr != m_lChessHordeStalkerList.end(); ++itr)
            {
                if (Creature* pTemp = instance->GetCreature(*itr))
                {
                    pTemp->Respawn();
                    pTemp->HandleEmote(EMOTE_STATE_NONE);
                }
            }

            if (GetData(TYPE_CHESS) == FAIL)
                SetData(TYPE_CHESS, NOT_STARTED);
            else if (GetData(TYPE_CHESS) == DONE)
                m_bFriendlyGame = true;

            m_uiChessResetTimer = 0;
        }
        else
            m_uiChessResetTimer -= uiDiff;
    }

    if (m_uiChessEndingTimer)
    {
        if (m_uiChessEndingTimer <= uiDiff)
        {
            m_uiChessEndingTimer = 0;
        }
        else
        {
            if (m_uiChessEndingTimer == 30000) // pick first 4 spots for visual
            {
                m_uiVictoryControllerTimer = 1000;
                bool tools[8];

                for (uint32 i = 0; i < 8; ++i)
                {
                    m_uiVictoryToolTimers[i] = 0;
                    tools[i] = false;
                    m_uiVictoryTimersPhase[i] = false;
                }

                if (Creature* pController = GetSingleCreatureFromStorage(NPC_CHESS_VICTORY_CONTROLLER))
                    pController->CastSpell(pController, SPELL_VICTORY_VISUAL, TRIGGERED_OLD_TRIGGERED);

                uint8 previous = 0;
                for (uint32 i = 0; i < 4; ++i)
                {
                    int k;
                    previous = (previous + urand(0, 7)) % 8;
                    for (k = previous; tools[k % 8] && k < 16; ++k);
                    previous = k % 8;
                    tools[previous] = true;
                    m_uiVictoryToolTimers[previous] = urand(4, 6) * 500;
                }

                for (uint32 i = 0; i < 8; i++)
                {
                    if (tools[i])
                    {
                        if (Creature* tool = instance->GetCreature(m_vVictoryDummyTools[i]))
                            tool->CastSpell(tool, SPELL_BOARD_VISUAL, TRIGGERED_OLD_TRIGGERED);
                    }
                    else
                        m_uiVictoryToolTimers[i] = urand(4, 6) * 500;
                }
            }
            else
            {
                if (m_uiVictoryControllerTimer <= uiDiff) // randomized visual all over the chess board
                {
                    m_uiVictoryControllerTimer = 1000;
                    if (Creature* pController = GetSingleCreatureFromStorage(NPC_CHESS_VICTORY_CONTROLLER))
                        pController->CastSpell(pController, SPELL_VICTORY_VISUAL, TRIGGERED_NONE);
                }
                else
                    m_uiVictoryControllerTimer -= uiDiff;

                for (uint32 i = 0; i < 8; i++)
                {
                    if (m_uiVictoryToolTimers[i] <= uiDiff)
                    {                   
                        if (!m_uiVictoryTimersPhase[i])
                        {
                            if (Creature* tool = instance->GetCreature(m_vVictoryDummyTools[i]))
                            {
                                if (Creature* square = instance->GetCreature(m_vChessSquares[urand(0, m_vChessSquares.size()-1)]))
                                    tool->NearTeleportTo(square->GetPositionX(), square->GetPositionY(), square->GetPositionZ(), square->GetOrientation());
                            }

                            m_uiVictoryToolTimers[i] = 500;
                            m_uiVictoryTimersPhase[i] = true;
                        }
                        else
                        {
                            m_uiVictoryToolTimers[i] = urand(4, 6) * 500;
                            m_uiVictoryTimersPhase[i] = false;

                            if (Creature* tool = instance->GetCreature(m_vVictoryDummyTools[i]))
                                tool->CastSpell(tool, SPELL_BOARD_VISUAL, TRIGGERED_OLD_TRIGGERED);
                        }
                    }
                    else
                        m_uiVictoryToolTimers[i] -= uiDiff;
                }
            }
            m_uiChessEndingTimer -= uiDiff;
        }
    }
}
예제 #19
0
void instance_gnomeregan::SetData(uint32 uiType, uint32 uiData)
{
    switch (uiType)
    {
        case TYPE_GRUBBIS:
            m_auiEncounter[0] = uiData;
            if (uiData == IN_PROGRESS)
            {
                // Sort the explosive charges if needed
                if (!m_luiExplosiveChargeGUIDs.empty())
                {
                    std::list<GameObject*> lExplosiveCharges;
                    for (GuidList::const_iterator itr = m_luiExplosiveChargeGUIDs.begin(); itr != m_luiExplosiveChargeGUIDs.end(); ++itr)
                    {
                        if (GameObject* pCharge = instance->GetGameObject(*itr))
                            lExplosiveCharges.push_back(pCharge);
                    }
                    m_luiExplosiveChargeGUIDs.clear();

                    // Sort from east to west
                    lExplosiveCharges.sort(sortFromEastToWest);

                    // Sort to south and north
                    uint8 uiCounterSouth = 0;
                    uint8 uiCounterNorth = 0;
                    GameObject* pCaveInSouth = GetSingleGameObjectFromStorage(GO_CAVE_IN_SOUTH);
                    GameObject* pCaveInNorth = GetSingleGameObjectFromStorage(GO_CAVE_IN_NORTH);
                    if (pCaveInSouth && pCaveInNorth)
                    {
                        for (std::list<GameObject*>::iterator itr = lExplosiveCharges.begin(); itr != lExplosiveCharges.end(); ++itr)
                        {
                            if ((*itr)->GetDistanceOrder(pCaveInSouth, pCaveInNorth) && uiCounterSouth < MAX_EXPLOSIVES_PER_SIDE)
                            {
                                m_aExplosiveSortedGuids[0][uiCounterSouth] = (*itr)->GetObjectGuid();
                                ++uiCounterSouth;
                            }
                            else if (uiCounterNorth < MAX_EXPLOSIVES_PER_SIDE)
                            {
                                m_aExplosiveSortedGuids[1][uiCounterNorth] = (*itr)->GetObjectGuid();
                                ++uiCounterNorth;
                            }
                        }
                    }
                }
            }
            if (uiData == FAIL)
            {
                // Despawn possible spawned explosive charges
                SetData(TYPE_EXPLOSIVE_CHARGE, DATA_EXPLOSIVE_CHARGE_USE);
            }
            if (uiData == DONE)
            {
                for (GuidList::const_iterator itr = m_lRedRocketGUIDs.begin(); itr != m_lRedRocketGUIDs.end(); ++itr)
                    DoRespawnGameObject(*itr, HOUR);
            }
            break;
        case TYPE_EXPLOSIVE_CHARGE:
            switch (uiData)
            {
                case DATA_EXPLOSIVE_CHARGE_1:
                    DoRespawnGameObject(m_aExplosiveSortedGuids[0][0], HOUR);
                    m_luiSpawnedExplosiveChargeGUIDs.push_back(m_aExplosiveSortedGuids[0][0]);
                    break;
                case DATA_EXPLOSIVE_CHARGE_2:
                    DoRespawnGameObject(m_aExplosiveSortedGuids[0][1], HOUR);
                    m_luiSpawnedExplosiveChargeGUIDs.push_back(m_aExplosiveSortedGuids[0][1]);
                    break;
                case DATA_EXPLOSIVE_CHARGE_3:
                    DoRespawnGameObject(m_aExplosiveSortedGuids[1][0], HOUR);
                    m_luiSpawnedExplosiveChargeGUIDs.push_back(m_aExplosiveSortedGuids[1][0]);
                    break;
                case DATA_EXPLOSIVE_CHARGE_4:
                    DoRespawnGameObject(m_aExplosiveSortedGuids[1][1], HOUR);
                    m_luiSpawnedExplosiveChargeGUIDs.push_back(m_aExplosiveSortedGuids[1][1]);
                    break;
                case DATA_EXPLOSIVE_CHARGE_USE:
                    Creature* pBlastmaster = GetSingleCreatureFromStorage(NPC_BLASTMASTER_SHORTFUSE);
                    if (!pBlastmaster)
                        break;
                    for (GuidList::const_iterator itr = m_luiSpawnedExplosiveChargeGUIDs.begin(); itr != m_luiSpawnedExplosiveChargeGUIDs.end(); ++itr)
                    {
                        if (GameObject* pExplosive = instance->GetGameObject(*itr))
                            pExplosive->Use(pBlastmaster);
                    }
                    m_luiSpawnedExplosiveChargeGUIDs.clear();
                    break;
            }
            return;
        case TYPE_THERMAPLUGG:
            m_auiEncounter[1] = uiData;
            if (uiData == IN_PROGRESS)
            {
                // Make Door locked
                if (GameObject* pDoor = GetSingleGameObjectFromStorage(GO_THE_FINAL_CHAMBER))
                {
                    pDoor->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED);
                    if (pDoor->getLootState() == GO_ACTIVATED)
                        pDoor->ResetDoorOrButton();
                }

                // Always directly activates this bomb-face
                DoActivateBombFace(2);
            }
            else if (uiData == DONE || uiData == FAIL)
            {
                // Make Door unlocked again
                if (GameObject* pDoor = GetSingleGameObjectFromStorage(GO_THE_FINAL_CHAMBER))
                {
                    pDoor->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED);
                    if (pDoor->getLootState() == GO_READY)
                        pDoor->UseDoorOrButton();
                }

                // Deactivate all remaining BombFaces
                for (uint8 i = 0; i < MAX_GNOME_FACES; ++i)
                    DoDeactivateBombFace(i);
            }
            break;
    }

    if (uiData == DONE)
    {
        OUT_SAVE_INST_DATA;

        std::ostringstream saveStream;
        saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1];

        m_strInstData = saveStream.str();

        SaveToDB();
        OUT_SAVE_INST_DATA_COMPLETE;
    }
}
예제 #20
0
 void SetData(uint32 id, uint32 data)
 {
     switch (id)
     {
     case DATA_KALECGOS_EVENT:
         {
             if (data == NOT_STARTED || data == DONE)
             {
                 HandleGameObject(ForceField, true);
                 HandleGameObject(KalecgosWall[0], true);
                 HandleGameObject(KalecgosWall[1], true);
             }
             else if (data == IN_PROGRESS)
             {
                 HandleGameObject(ForceField, false);
                 HandleGameObject(KalecgosWall[0], false);
                 HandleGameObject(KalecgosWall[1], false);
             }
             m_auiEncounter[0] = data;
         }
         break;
     case DATA_BRUTALLUS_EVENT:
         if (data == SPECIAL)
             DoUseDoorOrButton(IceBarrier, MINUTE);
         m_auiEncounter[1] = data;
         break;
     case DATA_FELMYST_EVENT:
         if (data == DONE)
             HandleGameObject(FireBarrier, true);
         m_auiEncounter[2] = data;
         break;
     case DATA_ACTIVATE_NORTH_TO_LEFT:
         for (std::vector<uint64>::iterator itr = northList.begin(); itr != northList.end(); itr++)
         {
             if (Creature *trigger = instance->GetCreature(*itr))
             {
                 if (trigger->GetPositionY() > data)
                     trigger->CastSpell(trigger, 45582, true);
             }
         }
         break;
     case DATA_ACTIVATE_CENTER_TO_LEFT:
         for (std::vector<uint64>::iterator itr = centerList.begin(); itr != centerList.end(); itr++)
         {
             if (Creature *trigger = instance->GetCreature(*itr))
             {
                 if (trigger->GetPositionY() > data)
                     trigger->CastSpell(trigger, 45582, true);
             }
         }
         break;
     case DATA_ACTIVATE_SOUTH_TO_LEFT:
         for (std::vector<uint64>::iterator itr = southList.begin(); itr != southList.end(); itr++)
         {
             if (Creature *trigger = instance->GetCreature(*itr))
             {
                 if (trigger->GetPositionY() > data)
                     trigger->CastSpell(trigger, 45582, true);
             }
         }
         break;
     case DATA_ACTIVATE_NORTH_TO_RIGHT:
         for (std::vector<uint64>::iterator itr = northList.begin(); itr != northList.end(); itr++)
         {
             if (Creature *trigger = instance->GetCreature(*itr))
             {
                 if (trigger->GetPositionY() < data)
                     trigger->CastSpell(trigger, 45582, true);
             }
         }
         break;
     case DATA_ACTIVATE_CENTER_TO_RIGHT:
         for (std::vector<uint64>::iterator itr = centerList.begin(); itr != centerList.end(); itr++)
         {
             if (Creature *trigger = instance->GetCreature(*itr))
             {
                 if (trigger->GetPositionY() < data)
                     trigger->CastSpell(trigger, 45582, true);
             }
         }
         break;
     case DATA_ACTIVATE_SOUTH_TO_RIGHT:
         for (std::vector<uint64>::iterator itr = southList.begin(); itr != southList.end(); itr++)
         {
             if (Creature *trigger = instance->GetCreature(*itr))
             {
                 if (trigger->GetPositionY() < data)
                     trigger->CastSpell(trigger, 45582, true);
             }
         }
         break;
     case DATA_EREDAR_TWINS_EVENT:
         m_auiEncounter[3] = data;
         break;
     case DATA_MURU_EVENT:
         switch (data)
         {
         case DONE:
             HandleGameObject(MurusGate[0], true);
             HandleGameObject(MurusGate[1], true);
             break;
         case IN_PROGRESS:
             HandleGameObject(MurusGate[0], false);
             HandleGameObject(MurusGate[1], false);
             break;
         case NOT_STARTED:
             HandleGameObject(MurusGate[0], true);
             HandleGameObject(MurusGate[1], false);
             break;
         }
         m_auiEncounter[4] = data;
         break;
     case DATA_OUTRO_KJ:
         m_outro_kj = data;
         break;
     case DATA_KILJAEDEN_EVENT:
         switch (data)
         {
             case DONE:
                 SetData(DATA_OUTRO_KJ, POINT_KILJAEDEN_DIE);
                 m_Outrotimer = 0;
                 break;
         }
         m_auiEncounter[5] = data;
         break;
     }
     if (data == DONE)
         SaveToDB();
 }
        void SetData(uint32 type, uint32 data)
        {
            if (type == DATA_WAVE_COUNT && data == SPECIAL)
            {
                CloseDoor(FrontDoor);
                events.ScheduleEvent(EVENT_NEXT_WAVE, 10000);
                return;
            }

            if (WaveCount && data == NOT_STARTED)
                DoWipe();

            switch (type)
            {
                case DATA_INTRO_EVENT:
                    IntroDone = data;
                    break;
                case DATA_FALRIC_EVENT:
                    Encounter[0] = data;
                    if (data == DONE)
                        events.ScheduleEvent(EVENT_NEXT_WAVE, 60000);
                    break;
                case DATA_MARWYN_EVENT:
                    Encounter[1] = data;
                    if (data == DONE)
                    {
                        OpenDoor(FrostwornDoor);
                        OpenDoor(FrontDoor);
                    }
                    break;
                case DATA_FROSWORN_EVENT:
                    Encounter[2] = data;
                    if (data == DONE)
                    {
                        OpenDoor(ArthasDoor);
                        SetData(DATA_PHASE, 3);
                        instance->SummonCreature(BOSS_LICH_KING, OutroSpawns[0]);
                        instance->SummonCreature(NPC_JAINA_OUTRO, OutroSpawns[1]);
                    }
                    break;
                case DATA_LICHKING_EVENT:
                    Encounter[3] = data;
                    if (data == IN_PROGRESS)
                    {
                        OpenDoor(RunDoor);

                        if (instance->IsHeroic())
                            DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_NOT_RETREATING_EVENT);
                    }
                    if (data == FAIL)
                    {
                        for(uint8 i = 0; i<4; i++)
                            OpenDoor(WallID[i]);

                        CloseDoor(RunDoor);

                        if (Creature* lichKing = instance->GetCreature(LichKing))
                            lichKing->DespawnOrUnsummon(10000);
                        if (Creature* lider = instance->GetCreature(Lider))
                            lider->DespawnOrUnsummon(10000);

                        DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_NOT_RETREATING_EVENT);
                        DoCastSpellOnPlayers(5); // Kill all players

                        SetData(DATA_PHASE, 3);
                        instance->SummonCreature(BOSS_LICH_KING, OutroSpawns[0]);
                        instance->SummonCreature(NPC_JAINA_OUTRO, OutroSpawns[1]);
                    }
                    if (data == DONE)
                    {
                        if (GameObject* chest = instance->GetGameObject(Chest))
                            chest->SetPhaseMask(1, true);
                        if (GameObject* portal = instance->GetGameObject(uiPortal))
                            portal->SetPhaseMask(1, true);

                        /*DoCompleteAchievement(ACHIEV_HALLS_OF_REFLECTION_N);
                        if (instance->IsHeroic())
                        {
                            DoCompleteAchievement(ACHIEV_HALLS_OF_REFLECTION_H);
                            DoCastSpellOnPlayers(SPELL_ACHIEV_CHECK);
                            DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_NOT_RETREATING_EVENT);
                        }*/
                    }
                    break;
                case DATA_SUMMONS:
                    if (data == 3) Summons = 0;
                    else if (data == 1) ++Summons;
                    else if (data == 0) --Summons;
                    data = NOT_STARTED;
                    break;
                case DATA_ICE_WALL_1:
                    Wall[0] = data;
                    break;
                case DATA_ICE_WALL_2:
                    Wall[1] = data;
                    break;
                case DATA_ICE_WALL_3:
                    Wall[2] = data;
                    break;
                case DATA_ICE_WALL_4:
                    Wall[3] = data;
                    break;
                case DATA_PHASE:
                    DataPhase = data;
                    break;
            }

            if (data == DONE)
                SaveToDB();
        }
예제 #22
0
    void Update(uint32 diff)
    {
        // KilJaeden Outro
        if (m_Outrotimer <= diff)
        {
            switch (GetData(DATA_OUTRO_KJ))
            {
                case POINT_KILJAEDEN_DIE:
                    // While Kil'Jaeden die
                    if (Creature* Anveena = GetCreature(GetData64(DATA_ANVEENA)))
                        Anveena->ForcedDespawn(); //this should already be done but let's do it again in case phase was gm rushed

                    m_Outrotimer = 15000;
                    SetData(DATA_OUTRO_KJ, POINT_TELEPORT_KALECGOS);
                    break;
                case POINT_TELEPORT_KALECGOS:
                    if (Creature* pKalec = GetCreature(GetData64(DATA_KALECGOS_KJ)))
                    {
                        pKalec->SetVisible(true);
                        pKalec->CastSpell(pKalec, SPELL_KALEC_TELEPORT, true);
                        pKalec->SendMovementFlagUpdate();
                    }

                    if (Creature* pKJ = GetCreature(GetData64(DATA_KILJAEDEN)))
                        pKJ->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); //allow loot

                    m_Outrotimer = 2000;
                    SetData(DATA_OUTRO_KJ, SAY_KALECGOS_GOODBYE);
                    break;
                case SAY_KALECGOS_GOODBYE:
                    if (Creature* pKalec = GetCreature(GetData64(DATA_KALECGOS_KJ)))
                        DoScriptText(-1580090, pKalec);

                    m_Outrotimer = 15000;
                    SetData(DATA_OUTRO_KJ, POINT_SUMMON_SHATTERED);
                    break;
                case POINT_SUMMON_SHATTERED:
                    if (Creature *controller = GetCreature(GetData64(DATA_KILJAEDEN_CONTROLLER)))
                    {
                        if (Creature* portal = controller->SummonCreature(NPC_BOSS_PORTAL, aOutroLocations[0].m_fX, aOutroLocations[0].m_fY, aOutroLocations[0].m_fZ, aOutroLocations[0].m_fO, TEMPSUMMON_CORPSE_DESPAWN, 0))
                            portalGuid = portal->GetGUID();

                        for (uint8 i = 1; i < 3; i++)
                        {
                            if (TempSummon * riftWalker = controller->SummonCreature(NPC_RIFTWALKER, aOutroLocations[i].m_fX, aOutroLocations[i].m_fY, aOutroLocations[i].m_fZ, aOutroLocations[i].m_fO, TEMPSUMMON_CORPSE_DESPAWN, 0))
                            {
                                riftGuid[i - 1] = riftWalker->GetGUID();

                                if (i == 1)
                                    riftWalker->GetMotionMaster()->MovePoint(0, aOutroLocations[7].m_fX, aOutroLocations[7].m_fY, aOutroLocations[7].m_fZ);
                                else
                                    riftWalker->GetMotionMaster()->MovePoint(1, aOutroLocations[8].m_fX, aOutroLocations[8].m_fY, aOutroLocations[8].m_fZ);

                                if (Creature * riftTarget = controller->SummonCreature(WORLD_TRIGGER, aOutroLocations[8 + i].m_fX, aOutroLocations[8 + i].m_fY, aOutroLocations[8 + i].m_fZ, 0.0f, TEMPSUMMON_CORPSE_DESPAWN, 0))
                                {
                                    riftTargets[i - 1] = riftTarget->GetGUID();
                                    riftTarget->SetSpeed(MOVE_RUN, 0.5f);
                                }
                            }
                        }
                    }

                    m_Outrotimer = 15000;
                    SetData(DATA_OUTRO_KJ, POINT_SUMMON_PORTAL);
                    break;
                case POINT_SUMMON_PORTAL:
                    if (Creature* portal = GetCreature(portalGuid))
                    {
                        portal->SetDisplayId(DISPLAYID_PORTAL_OPENING);
                        for (uint8 i = 0; i < 2; i++)
                        {
                            if (Creature* riftTarget = GetCreature(riftTargets[i]))
                                riftTarget->ForcedDespawn(1000);
                        }
                    }

                    m_Outrotimer = 500;
                    SetData(DATA_OUTRO_KJ, POINT_SUMMON_PORTAL_ENDOPENANIM);
                    break;
                case POINT_SUMMON_PORTAL_ENDOPENANIM:
                    if (Creature* portal = GetCreature(portalGuid))
                        portal->SetStandState(UNIT_STAND_STATE_SIT); //this smoothly stop the explosion effect and just let the smokes continues

                    m_Outrotimer = 3500;
                    SetData(DATA_OUTRO_KJ, POINT_SUMMON_SOLDIERS_RIGHT);
                    break;
                case POINT_SUMMON_SOLDIERS_RIGHT:
                    for (uint8 i = 0; i < 2; i++)
                    {
                        if (Creature* rift = GetCreature(riftGuid[i]))
                        {
                            rift->RemoveAurasDueToSpell(SPELL_OPEN_PORTAL_KJ);
                            rift->InterruptNonMeleeSpells(false);
                        }
                    }
                    if (Creature *controller = GetCreature(GetData64(DATA_KILJAEDEN_CONTROLLER)))
                    {
                        for (uint8 i = 0; i < 10; i++)
                        {
                            if (TempSummon *soldier = controller->SummonCreature(NPC_SOLDIER, SoldierLocations[i].m_fX, SoldierLocations[i].m_fY, SoldierLocations[i].m_fZ, SoldierLocations[i].m_fO, TEMPSUMMON_CORPSE_DESPAWN, 0))
                            {
                                soldiersGuid[i] = soldier->GetGUID();
                                soldier->GetMotionMaster()->MovePoint(0, SoldierMiddle[0].m_fX, SoldierMiddle[0].m_fY, SoldierMiddle[0].m_fZ, false);

                                if (i == 0)
                                    soldier->GetMotionMaster()->MovePoint(0, SoldierMiddle[0].m_fX, SoldierMiddle[0].m_fY, SoldierMiddle[0].m_fZ, false);
                                else
                                {
                                    float sx, sy;
                                    float angle = m_currentAngleFirst * (2.0f * M_PI) / 360.0f;
                                    float rayon = 5.0f;
                                    sx = SoldierMiddle[0].m_fX + cos(angle) * rayon;
                                    sy = SoldierMiddle[0].m_fY + sin(angle) * rayon;
                                    soldier->GetMotionMaster()->MovePoint(0, sx, sy, SoldierMiddle[0].m_fZ, false);
                                    m_currentAngleFirst = m_currentAngleFirst + 36;
                                }
                            }
                        }
                    }

                    m_Outrotimer = 8000;
                    SetData(DATA_OUTRO_KJ, POINT_SUMMON_SOLDIERS_LEFT);
                    break;
                case POINT_SUMMON_SOLDIERS_LEFT:
                    if (Creature *controller = GetCreature(GetData64(DATA_KILJAEDEN_CONTROLLER)))
                    {
                        for (uint8 i = 10; i < 20; i++)
                        {
                            if (Creature *soldier = controller->SummonCreature(NPC_SOLDIER, SoldierLocations[i].m_fX, SoldierLocations[i].m_fY, SoldierLocations[i].m_fZ, SoldierLocations[i].m_fO, TEMPSUMMON_CORPSE_DESPAWN, 0))
                            {
                                soldiersGuid[i] = soldier->GetGUID();

                                if (i == 10)
                                    soldier->GetMotionMaster()->MovePoint(0, SoldierMiddle[1].m_fX, SoldierMiddle[1].m_fY, SoldierMiddle[1].m_fZ, false);
                                else
                                {
                                    float sx, sy;
                                    float angle = m_currentAngleFirst * (2 * M_PI) / 360;
                                    float rayon = 5.0f;
                                    sx = SoldierMiddle[1].m_fX + cos(angle) * rayon;
                                    sy = SoldierMiddle[1].m_fY + sin(angle) * rayon;
                                    soldier->GetMotionMaster()->MovePoint(0, sx, sy, SoldierMiddle[1].m_fZ, false);
                                    m_currentAngleFirst = m_currentAngleFirst + 36;
                                }
                            }
                        }
                    }

                    m_Outrotimer = 10000;
                    SetData(DATA_OUTRO_KJ, POINT_SUMMON_PROPHET);
                    break;
                case POINT_SUMMON_PROPHET:
                    if (Creature *controller = GetCreature(GetData64(DATA_KILJAEDEN_CONTROLLER)))
                    {
                        if (TempSummon* prophet = controller->SummonCreature(CREATURE_PROPHET, aOutroLocations[3].m_fX, aOutroLocations[3].m_fY, aOutroLocations[3].m_fZ, aOutroLocations[3].m_fO, TEMPSUMMON_CORPSE_DESPAWN, 0))
                            prophetGuid = prophet->GetGUID();

                        if (TempSummon* core = controller->SummonCreature(NPC_CORE_ENTROPIUS, controller->GetPositionX(), controller->GetPositionY(), 85.0f, 0, TEMPSUMMON_CORPSE_DESPAWN, 0))
                            entropiusCoreGuid = core->GetGUID();
                    }

                    m_Outrotimer = 2000;
                    SetData(DATA_OUTRO_KJ, POINT_SUMMON_LIADRIN);
                    break;
                case POINT_SUMMON_LIADRIN:
                    if (Creature *controller = GetCreature(GetData64(DATA_KILJAEDEN_CONTROLLER)))
                        if (Creature* liadrin = controller->SummonCreature(CREATURE_LIADRIN, aOutroLocations[4].m_fX, aOutroLocations[4].m_fY, aOutroLocations[4].m_fZ, aOutroLocations[4].m_fO, TEMPSUMMON_TIMED_DESPAWN, 4 * MINUTE * IN_MILLISECONDS))
                            liadrinGuid = liadrin->GetGUID();
                    
                    m_Outrotimer = 4000;
                    SetData(DATA_OUTRO_KJ, SAY_OUTRO_1);
                    break;
                case SAY_OUTRO_1:
                    if (Creature* prophet = GetCreature(prophetGuid))
                        DoScriptText(-1580099, prophet);

                    m_Outrotimer = 25000;
                    SetData(DATA_OUTRO_KJ, SAY_OUTRO_2);
                    break;
                case SAY_OUTRO_2:
                    if (Creature* prophet = GetCreature(prophetGuid))
                        DoScriptText(-1580100, prophet);

                    m_Outrotimer = 14000;
                    SetData(DATA_OUTRO_KJ, SAY_OUTRO_3);
                    break;
                case SAY_OUTRO_3:
                    if (Creature* prophet = GetCreature(prophetGuid))
                        DoScriptText(-1580111, prophet);

                    m_Outrotimer = 10000;
                    SetData(DATA_OUTRO_KJ, POINT_CALL_ENTROPIUS);
                    break;
                case POINT_CALL_ENTROPIUS:
                    if (Creature *controller = GetCreature(GetData64(DATA_KILJAEDEN_CONTROLLER)))
                    {
                        if (Creature* pEntropius = GetCreature(entropiusCoreGuid))
                        {
                            if (Creature* pVelen = GetCreature(prophetGuid))
                                pVelen->CastSpell(pEntropius, SPELL_CALL_ENTROPIUS, false);

                            pEntropius->SetWalk(false);
                            pEntropius->GetMotionMaster()->MovePoint(1, controller->GetPositionX(), controller->GetPositionY(), 40.0f);
                        }
                    }

                    m_Outrotimer = 10000;
                    SetData(DATA_OUTRO_KJ, SAY_OUTRO_4);
                    break;
                case SAY_OUTRO_4:
                    if (Creature* prophet = GetCreature(prophetGuid))
                        DoScriptText(-1580101, prophet);

                    m_Outrotimer = 22000;
                    SetData(DATA_OUTRO_KJ, POINT_MOVE_LIADRIN);
                    break;
                case POINT_MOVE_LIADRIN:
                    if (Creature* pLiadrin = GetCreature(liadrinGuid))
                        pLiadrin->GetMotionMaster()->MovePoint(0, aOutroLocations[6].m_fX, aOutroLocations[6].m_fY, aOutroLocations[6].m_fZ);
                    
                    m_Outrotimer = 6000;
                    SetData(DATA_OUTRO_KJ, SAY_OUTRO_5);
                    break;
                case SAY_OUTRO_5:
                    if (Creature* pLiadrin = GetCreature(liadrinGuid))
                        DoScriptText(-1580107, pLiadrin);

                    m_Outrotimer = 10000;
                    SetData(DATA_OUTRO_KJ, SAY_OUTRO_6);
                    break;
                case SAY_OUTRO_6:
                    if (Creature* prophet = GetCreature(prophetGuid))
                        DoScriptText(-1580102, prophet);

                    m_Outrotimer = 15000;
                    SetData(DATA_OUTRO_KJ, SAY_OUTRO_7);
                    break;
                case SAY_OUTRO_7:
                    if (Creature* pLiadrin = GetCreature(liadrinGuid))
                        DoScriptText(-1580108, pLiadrin);

                    m_Outrotimer = 2500;
                    SetData(DATA_OUTRO_KJ, SAY_OUTRO_8);
                    break;
                case SAY_OUTRO_8:
                    if (Creature* prophet = GetCreature(prophetGuid))
                        DoScriptText(-1580103, prophet);

                    m_Outrotimer = 4000;
                    SetData(DATA_OUTRO_KJ, POINT_BLAZE);
                    break;
                case POINT_BLAZE:
                    if (Creature* pEntropius = GetCreature(entropiusCoreGuid))
                    {
                        pEntropius->CastSpell(pEntropius, SPELL_BLAZE_TO_LIGHT, true);
                        pEntropius->RemoveAurasDueToSpell(SPELL_ENTROPIUS_BODY);
                    }

                    m_Outrotimer = 10000;
                    SetData(DATA_OUTRO_KJ, POINT_IGNITE);
                    break;
                case POINT_IGNITE:
                    if (Creature *controller = GetCreature(GetData64(DATA_KILJAEDEN_CONTROLLER)))
                    {
                        // When the purified Muru reaches the ground the sunwell ignites and Muru despawns
                        controller->AI()->DoCast(controller, SPELL_SUNWELL_IGNITION);

                        if (Creature* pLiadrin = GetCreature(liadrinGuid))
                            pLiadrin->SetStandState(UNIT_STAND_STATE_KNEEL);

                        if (Creature* pEntropius = GetCreature(entropiusCoreGuid))
                            pEntropius->ForcedDespawn();
                    }

                    m_Outrotimer = 500;
                    SetData(DATA_OUTRO_KJ, SAY_OUTRO_9);
                    break;
                case SAY_OUTRO_9:
                    if (Creature* prophet = GetCreature(prophetGuid))
                        DoScriptText(-1580104, prophet);

                    m_Outrotimer = 15000;
                    SetData(DATA_OUTRO_KJ, SAY_OUTRO_10);
                    break;
                case SAY_OUTRO_10:
                    if (Creature* pLiadrin = GetCreature(liadrinGuid))
                        DoScriptText(-1580109, pLiadrin);

                    m_Outrotimer = 20000;
                    SetData(DATA_OUTRO_KJ, SAY_OUTRO_11);
                    break;
                case SAY_OUTRO_11:
                    if (Creature* prophet = GetCreature(prophetGuid))
                        DoScriptText(-1580105, prophet);

                    m_Outrotimer = 6000;
                    SetData(DATA_OUTRO_KJ, SAY_OUTRO_12);
                    break;
                case SAY_OUTRO_12:
                    if (Creature* prophet = GetCreature(prophetGuid))
                        DoScriptText(-1580106, prophet);

                    m_Outrotimer = 2000;
                    SetData(DATA_OUTRO_KJ, POINT_EVENT_SOLDIER_EXIT);
                    break;
                case POINT_EVENT_SOLDIER_EXIT:
                    for (uint8 i = 0; i < 20; i++)
                    {
                        if (Creature* soldier = GetCreature(soldiersGuid[i]))
                        {
                            soldier->SetWalk(false);
                            soldier->SetSpeed(MOVE_RUN, 1.0f);
                            soldier->GetMotionMaster()->MovePoint(2, SoldierLocations[i].m_fX, SoldierLocations[i].m_fY, SoldierLocations[i].m_fZ, false);
                        }
                    }

                    m_Outrotimer = 8000;
                    SetData(DATA_OUTRO_KJ, POINT_EVENT_VELEN_EXIT);
                    break;
                case POINT_EVENT_VELEN_EXIT:
                    if (Creature* pVelen = GetCreature(prophetGuid))
                        pVelen->GetMotionMaster()->MovePoint(1, aOutroLocations[3].m_fX, aOutroLocations[3].m_fY, aOutroLocations[3].m_fZ);

                    if (Creature* pKalec = GetCreature(GetData64(DATA_KALECGOS_KJ)))
                    {
                        pKalec->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
                        pKalec->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                    }

                    m_Outrotimer = 0;
                    SetData(DATA_OUTRO_KJ, OUTRO_DONE);
                    break;
            }
        }
        else
            m_Outrotimer -= diff;
    }
예제 #23
0
void AwesomeView::ProcessSelectedImage()
{
  // Before we even think about processing something, we need to make sure
  // that we have valid input. Don't be sloppy, this is a main reason
  // for application crashes if neglected.

  auto selectedDataNodes = this->GetDataManagerSelection();

  if (selectedDataNodes.empty())
    return;

  auto firstSelectedDataNode = selectedDataNodes.front();

  if (firstSelectedDataNode.IsNull())
  {
    QMessageBox::information(nullptr, "Awesome View", "Please load and select an image before starting image processing.");
    return;
  }

  auto data = firstSelectedDataNode->GetData();

  // Something is selected, but does it contain data?
  if (data != nullptr)
  {
    // We don't use the auto keyword here, which would evaluate to a native
    // image pointer. Instead, we want a smart pointer in order to ensure that
    // the image isn't deleted somewhere else while we're using it.
    mitk::Image::Pointer image = dynamic_cast<mitk::Image*>(data);

    // Something is selected and it contains data, but is it an image?
    if (image.IsNotNull())
    {
      auto imageName = firstSelectedDataNode->GetName();
      auto offset = m_Controls.offsetSpinBox->value();

      MITK_INFO << "Process image \"" << imageName << "\" ...";

      // We're finally using the AwesomeImageFilter from our AwesomeLib module.
      auto filter = AwesomeImageFilter::New();
      filter->SetInput(image);
      filter->SetOffset(offset);

      filter->Update();

      mitk::Image::Pointer processedImage = filter->GetOutput();

      if (processedImage.IsNull() || !processedImage->IsInitialized())
        return;

      MITK_INFO << "  done";

      // Stuff the resulting image into a data node, set some properties,
      // and add it to the data storage, which will eventually display the
      // image in the application.
      auto processedImageDataNode = mitk::DataNode::New();
      processedImageDataNode->SetData(processedImage);

      QString name = QString("%1 (Offset: %2)").arg(imageName.c_str()).arg(offset);
      processedImageDataNode->SetName(name.toStdString());

      // We don't really need to copy the level window, but if we wouldn't
      // do it, the new level window would be initialized to display the image
      // with optimal contrast in order to capture the whole range of pixel
      // values. This is also true for the input image as long as one didn't
      // modify its level window manually. Thus, the images would appear
      // identical unless you compare the level window widget for both images.
      mitk::LevelWindow levelWindow;

      if (firstSelectedDataNode->GetLevelWindow(levelWindow))
        processedImageDataNode->SetLevelWindow(levelWindow);

      // We also attach our AwesomeImageInteractor, which allows us to paint
      // on the resulting images by using the mouse as long as the CTRL key
      // is pressed.
      auto interactor = CreateAwesomeImageInteractor();

      if (interactor.IsNotNull())
        interactor->SetDataNode(processedImageDataNode);

      this->GetDataStorage()->Add(processedImageDataNode);
    }
  }

  // Now it's your turn. This class/method has lots of room for improvements,
  // for example:
  //
  // - What happens when multiple items are selected but the first one isn't
  //   an image? - There isn't any feedback for the user at all.
  // - What's the front item of a selection? Does it depend on the order
  //   of selection or the position in the Data Manager? - Isn't it
  //   better to process all selected images? Don't forget to adjust the
  //   titles of the UI widgets.
  // - In addition to the the displayed label, it's probably a good idea to
  //   enable or disable the button depending on the selection.
}
예제 #24
0
GLPrefsMgr::~GLPrefsMgr()
{
	JXGetChooseSaveFile()->JPrefObject::WritePrefs();
	SetData(kProgramVersionID, JGetString("VERSION"));
	SaveToDisk();
}
    void OnCreatureCreate(Creature* pCreature)
    {
        switch(pCreature->GetEntry())
        {
            case NPC_MARROWGAR: 
				m_uiMarrowgarGUID = pCreature->GetGUID();
				if(!pCreature->isAlive())
					SetData(TYPE_MARROWGAR,DONE);
				break;
            case NPC_DEATHWHISPER: 
				m_uiDeathwhisperGUID = pCreature->GetGUID();
				if(!pCreature->isAlive())
					SetData(TYPE_DEATHWHISPER,DONE);
				break;
            case NPC_SAURFANG: 
				m_uiSaurfangGUID = pCreature->GetGUID();
				if(!pCreature->isAlive())
				{
					m_auiEncounter[TYPE_SAURFANG] = DONE;
					OpenDoor(m_uiSaurfangDoorGUID);
				}
				break;
			case NPC_FESTERGUT:
				if(isHeroic())	AutoFreeze(pCreature);
				m_uiFestergutGUID = pCreature->GetGUID();
				if(!pCreature->isAlive())
					SetData(TYPE_FESTERGUT,DONE);
				break;
			case NPC_ROTFACE:
				if(isHeroic())	AutoFreeze(pCreature);
				m_uiRotfaceGUID = pCreature->GetGUID();
				if(!pCreature->isAlive())
					SetData(TYPE_ROTFACE,DONE);
				break;
			case NPC_PUTRICIDE:
				m_uiPutricideGUID = pCreature->GetGUID();
				if(!pCreature->isAlive())
					SetData(TYPE_PUTRICIDE,DONE);
				AutoFreeze(pCreature);
				if(isHeroic())	AutoFreeze(pCreature);
				break;
			case NPC_PRINCE_KELESETH:
				m_uiPrinceKelesethGUID = pCreature->GetGUID();
				if(isHeroic())	AutoFreeze(pCreature);
				break;
			case NPC_PRINCE_VALANAR:
				m_uiPrinceValanarGUID = pCreature->GetGUID();
				if(isHeroic())	AutoFreeze(pCreature);
				if(!pCreature->isAlive())
					SetData(TYPE_PRINCE_COUNCIL,DONE);
				break;
			case NPC_PRINCE_TALDARAM:
				m_uiPrinceTaldaramGUID = pCreature->GetGUID();
				if(isHeroic())	AutoFreeze(pCreature);
				break;
			case NPC_LANATHEL:
				m_uiLanathelGUID = pCreature->GetGUID();
				if(isHeroic())	AutoFreeze(pCreature);
				if(!pCreature->isAlive())
					SetData(TYPE_LANATHEL,DONE);
				break;
			case NPC_DREAMWALKER:
				m_uiDreamWalkerGUID = pCreature->GetGUID();
				if(isHeroic())	AutoFreeze(pCreature);
				if(GetData(TYPE_DREAMWALKER) == DONE)
					pCreature->ForcedDespawn(100);
				break;
			case NPC_SINDRAGOSA:
				m_uiSindragosaGUID = pCreature->GetGUID();
				if(isHeroic())	AutoFreeze(pCreature);
				if(!pCreature->isAlive())
					SetData(TYPE_SINDRAGOSA,DONE);
				break;
			case NPC_LICHKING:
				m_uiLichKingGUID = pCreature->GetGUID();
				if(isHeroic())	AutoFreeze(pCreature);
				break;
			case 37006:
				rotfacePoolsGUIDs.push_back(pCreature->GetGUID());
				break;
			case 38422:
			case 38458:
			case 38454:
			case 38369:
				vortexGUIDs.push_back(pCreature->GetGUID());
				break;
			case 38186:
			case 38068:
			case 37934:
			case 37907:
			case 37886:
			case 37863:
			case 36791:
				dreamwalkerAddsGUIDs.push_back(pCreature->GetGUID());
				break;
			case 37868:
				if(pCreature->GetDBTableGUIDLow() == 0)
					dreamwalkerAddsGUIDs.push_back(pCreature->GetGUID());
				else
				{
					if(GetData(TYPE_DREAMWALKER) == DONE)
						pCreature->ForcedDespawn(100);
					dreamwalkerEventAddGUIDs.push_back(pCreature->GetGUID());
				}
				break;
			case NPC_DREAMWALKER_IMAGE:
				pCreature->SetPhaseMask(16,true);
				m_uiDreamwalkerImageGUID = pCreature->GetGUID();
				break;
			case NPC_TIRION_FORDRING:
				m_uiFordringLKEventGUID = pCreature->GetGUID();
				break;

        }
    }
예제 #26
0
void instance_uldaman::OnCreatureEvade(Creature* pCreature)
{
    // Reset Altar event
    if (pCreature->GetEntry() == NPC_STONE_KEEPER)
        SetData(TYPE_ALTAR_EVENT, NOT_STARTED);
}
예제 #27
0
VectorBuffer::VectorBuffer(const void* data, unsigned size)
{
    SetData(data, size);
}
void instance_draktharon_keep::OnCreatureEnterCombat(Creature* pCreature)
{
    if (pCreature->GetEntry() == NPC_KING_DRED)
        SetData(TYPE_KING_DRED, IN_PROGRESS);
}
예제 #29
0
bool Texture3D::SetData(SharedPtr<Image> image, bool useAlpha)
{
    if (!image)
    {
        LOGERROR("Null image, can not set data");
        return false;
    }

    unsigned memoryUse = sizeof(Texture3D);
    
    int quality = QUALITY_HIGH;
    Renderer* renderer = GetSubsystem<Renderer>();
    if (renderer)
        quality = renderer->GetTextureQuality();
    
    if (!image->IsCompressed())
    {
        unsigned char* levelData = image->GetData();
        int levelWidth = image->GetWidth();
        int levelHeight = image->GetHeight();
        int levelDepth = image->GetDepth();
        unsigned components = image->GetComponents();
        unsigned format = 0;
        
        // Discard unnecessary mip levels
        for (unsigned i = 0; i < mipsToSkip_[quality]; ++i)
        {
            image = image->GetNextLevel();
            levelData = image->GetData();
            levelWidth = image->GetWidth();
            levelHeight = image->GetHeight();
            levelDepth = image->GetDepth();
        }
        
        switch (components)
        {
        case 1:
            format = useAlpha ? Graphics::GetAlphaFormat() : Graphics::GetLuminanceFormat();
            break;
            
        case 2:
            format = Graphics::GetLuminanceAlphaFormat();
            break;
            
        case 3:
            format = Graphics::GetRGBFormat();
            break;
            
        case 4:
            format = Graphics::GetRGBAFormat();
            break;
        }
        
        // If image was previously compressed, reset number of requested levels to avoid error if level count is too high for new size
        if (IsCompressed() && requestedLevels_ > 1)
            requestedLevels_ = 0;
        SetSize(levelWidth, levelHeight, levelDepth, format);
        if (!object_)
            return false;
        
        for (unsigned i = 0; i < levels_; ++i)
        {
            SetData(i, 0, 0, 0, levelWidth, levelHeight, levelDepth, levelData);
            memoryUse += levelWidth * levelHeight * levelDepth * components;
            
            if (i < levels_ - 1)
            {
                image = image->GetNextLevel();
                levelData = image->GetData();
                levelWidth = image->GetWidth();
                levelHeight = image->GetHeight();
                levelDepth = image->GetDepth();
            }
        }
    }
    else
    {
        int width = image->GetWidth();
        int height = image->GetHeight();
        int depth = image->GetDepth();
        unsigned levels = image->GetNumCompressedLevels();
        unsigned format = graphics_->GetFormat(image->GetCompressedFormat());
        bool needDecompress = false;
        
        if (!format)
        {
            format = Graphics::GetRGBAFormat();
            needDecompress = true;
        }
        
        unsigned mipsToSkip = mipsToSkip_[quality];
        if (mipsToSkip >= levels)
            mipsToSkip = levels - 1;
        while (mipsToSkip && (width / (1 << mipsToSkip) < 4 || height / (1 << mipsToSkip) < 4 || depth / (1 << mipsToSkip) < 4))
            --mipsToSkip;
        width /= (1 << mipsToSkip);
        height /= (1 << mipsToSkip);
        depth /= (1 << mipsToSkip);
        
        SetNumLevels(Max((int)(levels - mipsToSkip), 1));
        SetSize(width, height, depth, format);
        
        for (unsigned i = 0; i < levels_ && i < levels - mipsToSkip; ++i)
        {
            CompressedLevel level = image->GetCompressedLevel(i + mipsToSkip);
            if (!needDecompress)
            {
                SetData(i, 0, 0, 0, level.width_, level.height_, level.depth_, level.data_);
                memoryUse += level.depth_ * level.rows_ * level.rowSize_;
            }
            else
            {
                unsigned char* rgbaData = new unsigned char[level.width_ * level.height_ * level.depth_ * 4];
                level.Decompress(rgbaData);
                SetData(i, 0, 0, 0, level.width_, level.height_, level.depth_, rgbaData);
                memoryUse += level.width_ * level.height_ * level.depth_ * 4;
                delete[] rgbaData;
            }
        }
    }
    
    SetMemoryUse(memoryUse);
    return true;
}
예제 #30
0
bool CBitcoinAddress::Set(const CScriptID &id) {
    SetData(Params().Base58Prefix(script_address), &id, 20);
    return true;
}