void SetData(uint32 type, uint32 data) override
        {
            switch (type)
            {
            case TYPE_MEDIVH:
                if (data == SPECIAL && m_auiEncounter[0] == IN_PROGRESS)
                {
                    --mShieldPercent;

                    DoUpdateWorldState(WORLD_STATE_BM_SHIELD, mShieldPercent);

                    if (!mShieldPercent)
                    {
                        if (Creature* medivh = instance->GetCreature(_medivhGUID))
                        {
                            if (medivh->IsAlive())
                            {
                                medivh->DealDamage(medivh, medivh->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
                                m_auiEncounter[0] = FAIL;
                                m_auiEncounter[1] = NOT_STARTED;
                            }
                        }
                    }
                }
                else
                {
                    if (data == IN_PROGRESS)
                    {
                        TC_LOG_DEBUG("scripts", "Instance The Black Morass: Starting event.");
                        InitWorldState();
                        m_auiEncounter[1] = IN_PROGRESS;
                        ScheduleEventNextPortal(15000);
                    }

                    if (data == DONE)
                    {
                        //this may be completed further out in the post-event
                        TC_LOG_DEBUG("scripts", "Instance The Black Morass: Event completed.");
                        Map::PlayerList const& players = instance->GetPlayers();

                        if (!players.isEmpty())
                        {
                            for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
                            {
                                if (Player* player = itr->GetSource())
                                {
                                    if (player->GetQuestStatus(QUEST_OPENING_PORTAL) == QUEST_STATUS_INCOMPLETE)
                                        player->AreaExploredOrEventHappens(QUEST_OPENING_PORTAL);

                                    if (player->GetQuestStatus(QUEST_MASTER_TOUCH) == QUEST_STATUS_INCOMPLETE)
                                        player->AreaExploredOrEventHappens(QUEST_MASTER_TOUCH);
                                }
                            }
                        }
                    }

                    m_auiEncounter[0] = data;
                }
                break;
            case TYPE_RIFT:
                if (data == SPECIAL)
                {
                    if (mRiftPortalCount < 7)
                        ScheduleEventNextPortal(5000);
                }
                else
                    m_auiEncounter[1] = data;
                break;
            }
        }
Пример #2
0
        void SetData(uint32 type, uint32 data)
        {
            switch (type)
            {
            case TYPE_MEDIVH:
                if (data == SPECIAL && m_auiEncounter[0] == IN_PROGRESS)
                {
                    --mShieldPercent;

                    DoUpdateWorldState(WORLD_STATE_BM_SHIELD, mShieldPercent);

                    if (!mShieldPercent)
                    {
                        if (Creature* pMedivh = instance->GetCreature(MedivhGUID))
                        {
                            if (pMedivh->isAlive())
                            {
                                pMedivh->DealDamage(pMedivh, pMedivh->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
                                m_auiEncounter[0] = FAIL;
                                m_auiEncounter[1] = NOT_STARTED;
                            }
                        }
                    }
                }
                else
                {
                    if (data == IN_PROGRESS)
                    {
                        sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Dark Portal: Starting event.");
                        InitWorldState();
                        m_auiEncounter[1] = IN_PROGRESS;
                        NextPortal_Timer = 15000;
                    }

                    if (data == DONE)
                    {
                        //this may be completed further out in the post-event
                        sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Dark Portal: Event completed.");
                        Map::PlayerList const& players = instance->GetPlayers();

                        if (!players.isEmpty())
                        {
                            for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
                            {
                                if (Player* player = itr->getSource())
                                {
                                    if (player->GetQuestStatus(QUEST_OPENING_PORTAL) == QUEST_STATUS_INCOMPLETE)
                                        player->AreaExploredOrEventHappens(QUEST_OPENING_PORTAL);

                                    if (player->GetQuestStatus(QUEST_MASTER_TOUCH) == QUEST_STATUS_INCOMPLETE)
                                        player->AreaExploredOrEventHappens(QUEST_MASTER_TOUCH);
                                }
                            }
                        }
                    }

                    m_auiEncounter[0] = data;
                }
                break;
            case TYPE_RIFT:
                if (data == SPECIAL)
                {
                    if (mRiftPortalCount < 7)
                        NextPortal_Timer = 5000;
                }
                else
                    m_auiEncounter[1] = data;
                break;
            }
        }
    void SetData(uint32 uiType, uint32 uiData)
    {
        switch(uiType)
        {
            case TYPE_EVENT:
                if (uiData == IN_PROGRESS)
                {
                    Clear();
                    InitWorldState();
                }
                else if (uiData == FAIL || uiData == DONE)
                {
                    DoUpdateWorldState(WORLD_STATE_VH, 0);
                    DoUseDoorOrButton(GO_DOOR_SEAL);
                    if (Creature* pSinclari = GetSingleCreatureFromStorage(NPC_SINCLARI))
                        pSinclari->ForcedDespawn(1000);
                }
                m_auiEncounter[0] = uiData;
                break;
            case TYPE_EREKEM:
                m_auiEncounter[2] = uiData;
                if (uiData == IN_PROGRESS) bIsInBoss = true;
                break;
            case TYPE_MORAGG:
                m_auiEncounter[3] = uiData;
                if (uiData == IN_PROGRESS) bIsInBoss = true;
                break;
            case TYPE_ICHORON:
                m_auiEncounter[4] = uiData;
                if (uiData == IN_PROGRESS) bIsInBoss = true;
                break;
            case TYPE_XEVOZZ:
                m_auiEncounter[5] = uiData;
                if (uiData == IN_PROGRESS) bIsInBoss = true;
                break;
            case TYPE_LAVANTHOR:
                m_auiEncounter[6] = uiData;
                if (uiData == IN_PROGRESS) bIsInBoss = true;
                break;
            case TYPE_ZURAMAT:
                m_auiEncounter[7] = uiData;
                if (uiData == IN_PROGRESS) bIsInBoss = true;
                break;
            case TYPE_CYANIGOSA:
                m_auiEncounter[8] = uiData;
                if (uiData == IN_PROGRESS) bIsInBoss = true;
                break;
            case TYPE_PORTAL6:
                m_auiEncounter[9] = uiData;
                break;
            case TYPE_PORTAL12:
                m_auiEncounter[10] = uiData;
                break;
            case TYPE_RIFT:
                if (uiData == FAIL)
                   DoUseDoorOrButton(GO_DOOR_SEAL);
                m_auiEncounter[1] = uiData;
                break;
            case TYPE_DOOR:
                if (uiData == SPECIAL)
                {
                    m_uiShieldPercent = m_uiShieldPercent - 5;
                    if(m_uiShieldPercent > 0)
                        DoUpdateWorldState(WORLD_STATE_VH_PRISON, m_uiShieldPercent);
                    else
                    {   DoUpdateWorldState(WORLD_STATE_VH, 0);
                        DoUseDoorOrButton(GO_DOOR_SEAL);
                        m_auiEncounter[0] = FAIL;
                    }
                }
                break;
            case TYPE_DISRUPTIONS:
            m_uiDisruptions = uiData;
//            DoUpdateWorldState(WORLD_STATE_VH_PRISON, 100-m_uiDisruptions*5);
            break;
            case TYPE_LASTBOSS_ID:
            m_uiLastBossIDConst = uiData;
            break;

        }
        if (uiData == DONE)
        {
            bIsInBoss = false;
            OUT_SAVE_INST_DATA;

            std::ostringstream saveStream;

            for(uint8 i = 0; i < MAX_ENCOUNTER; ++i)
                saveStream << m_auiEncounter[i] << " ";

            m_strInstData = saveStream.str();

            SaveToDB();
            OUT_SAVE_INST_DATA_COMPLETE;
        }

    }
Пример #4
0
    void SetData(uint32 type, uint32 data)
    {
        Player* player = GetPlayerInMap();

        if (!player)
        {
            sLog->outDebug("TSCR: Instance Black Portal: SetData (Type: %u Data %u) cannot find any player.", type, data);
            return;
        }

        switch (type)
        {
        case TYPE_MEDIVH:
            if (data == SPECIAL && Encounter[0] == IN_PROGRESS)
            {
                --mShieldPercent;
                UpdateBMWorldState(WORLD_STATE_BM_SHIELD, mShieldPercent);

                if (!mShieldPercent)
                {
                    if (Unit *medivh = Unit::GetUnit(*player, MedivhGUID))
                    {
                        if (medivh->isAlive())
                        {
                            medivh->DealDamage(medivh, medivh->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
                            Encounter[0] = FAIL;
                            Encounter[1] = NOT_STARTED;
                        }
                    }
                }
            }
            else
            {
                if (data == IN_PROGRESS)
                {
                    sLog->outDebug("TSCR: Instance Dark Portal: Starting event.");
                    InitWorldState();
                    Encounter[1] = IN_PROGRESS;
                    NextPortal_Timer = 15000;
                }

                if (data == DONE)
                {
                    //this may be completed further out in the post-event
                    if (Unit *medivh = Unit::GetUnit(*player, MedivhGUID))
                    {
                        player->GroupEventHappens(QUEST_OPENING_PORTAL, medivh);
                        player->GroupEventHappens(QUEST_MASTER_TOUCH, medivh);
                    }
                }

                Encounter[0] = data;
            }
            break;
        case TYPE_RIFT:
            if (data == SPECIAL)
            {
                if (mRiftPortalCount < 7)
                    NextPortal_Timer = 5000;
            }
            else
                Encounter[1] = data;
            break;
        }
    }
Пример #5
0
    void SetData(uint32 uiType, uint32 uiData)
    {
        switch(uiType)
        {
            case TYPE_EVENT:
                if (uiData == IN_PROGRESS)
                {
                    Clear();
                    InitWorldState();
                }
                else if (uiData == FAIL || uiData == DONE)
                {
                    DoUpdateWorldState(WORLD_STATE_VH, 0);
                    DoUseDoorOrButton(m_uiSealDoorGUID);
                }
                m_auiEncounter[0] = uiData;
                break;
            case TYPE_EREKEM:
                m_auiEncounter[2] = uiData;
                if (uiData == IN_PROGRESS) bIsInBoss = true;
                break;
            case TYPE_MORAGG:
                m_auiEncounter[3] = uiData;
                if (uiData == IN_PROGRESS) bIsInBoss = true;
                break;
            case TYPE_ICHORON:
                m_auiEncounter[4] = uiData;
                if (uiData == IN_PROGRESS) bIsInBoss = true;
                break;
            case TYPE_XEVOZZ:
                m_auiEncounter[5] = uiData;
                if (uiData == IN_PROGRESS) bIsInBoss = true;
                break;
            case TYPE_LAVANTHOR:
                m_auiEncounter[6] = uiData;
                if (uiData == IN_PROGRESS) bIsInBoss = true;
                break;
            case TYPE_ZURAMAT:
                m_auiEncounter[7] = uiData;
                if (uiData == IN_PROGRESS) bIsInBoss = true;
                break;
            case TYPE_RIFT:
                if (uiData == FAIL) 
                    DoUseDoorOrButton(m_uiSealDoorGUID);
                m_auiEncounter[1] = uiData;
                break;
            case TYPE_DOOR:
                if (uiData == SPECIAL)
                {
                    m_uiShieldPercent = m_uiShieldPercent - 5;
                    if(m_uiShieldPercent > 0)
                        DoUpdateWorldState(WORLD_STATE_VH_PRISON, m_uiShieldPercent);
                    else
                    {   DoUpdateWorldState(WORLD_STATE_VH, 0);
                        DoUseDoorOrButton(m_uiSealDoorGUID);
                        m_auiEncounter[0] = FAIL;
                    }
                }
                break;
            case TYPE_DISRUPTIONS:
            m_uiDisruptions = uiData;
//            DoUpdateWorldState(WORLD_STATE_VH_PRISON, 100-m_uiDisruptions*5);
            break;
            case TYPE_LASTBOSS_ID:
                m_uiLastBossIDConst = uiData;
                break;
            case TYPE_BOSS:
                m_uiBossID = uiData;
                break;
            case TYPE_BOSS2:
                m_uiBoss2ID = uiData;
                break;

        }
        if (uiData == DONE)
        {
            bIsInBoss = false;
            OUT_SAVE_INST_DATA;

            std::ostringstream saveStream;

            uint32 boss1 = m_uiBossID;
            uint32 boss2 = m_uiBoss2ID;

            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] << " "
                << boss1 << " " << boss2;

            m_strInstData = saveStream.str();

            SaveToDB();
            OUT_SAVE_INST_DATA_COMPLETE;
        }

    }