예제 #1
0
    void Update(uint32 diff)
    {
        if (Encounter[1] != IN_PROGRESS)
            return;

        //add delay timer?
        if (!CanProgressEvent())
        {
            Clear();
            return;
        }

        if (NextPortal_Timer)
        {
            if (NextPortal_Timer <= diff)
            {
                ++mRiftPortalCount;
                UpdateBMWorldState(WORLD_STATE_BM_RIFT, mRiftPortalCount);

                DoSpawnPortal();
                NextPortal_Timer = RiftWaves[GetRiftWaveId()].NextPortalTime;
            }
            else NextPortal_Timer -= diff;
        }
    }
예제 #2
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;
        }
    }
예제 #3
0
 void InitWorldState(bool Enable = true)
 {
     UpdateBMWorldState(WORLD_STATE_BM, Enable ? 1 : 0);
     UpdateBMWorldState(WORLD_STATE_BM_SHIELD, 100);
     UpdateBMWorldState(WORLD_STATE_BM_RIFT, 0);
 }