예제 #1
0
void BattlegroundRL::Update(uint32 diff)
{
    Battleground::Update(diff);

    if(GetStatus() == STATUS_IN_PROGRESS)
    {
        if(GetStartTime() >= 47*MINUTE*IN_MILLISECONDS)    // after 47 minutes without one team losing, the arena closes with no winner and no rating change
        {
            UpdateArenaWorldState();
            CheckArenaAfterTimerConditions();
        }

        if(m_uiTeleport < diff)
        {
            for(BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
            {
                Player*  plr = sObjectMgr->GetPlayer(itr->first);
                if(plr && plr->GetPositionZ() < 30)
                    plr->TeleportTo(plr->GetMapId(), plr->GetPositionX(), plr->GetPositionY(), 40, plr->GetOrientation(), false);
                if(plr && plr->GetPositionZ() < 30)
                    plr->TeleportTo(plr->GetMapId(), plr->GetPositionX(), plr->GetPositionY(), 40, plr->GetOrientation(), false);
            }
            m_uiTeleport = 1000;
        } else m_uiTeleport -= diff;
    }
}
예제 #2
0
void BattlegroundDS::Update (uint32 diff)
{
    Battleground::Update(diff);

    if (GetStatus() == STATUS_IN_PROGRESS)
    {
        if (GetStartTime() >= 47 * MINUTE * IN_MILLISECONDS)          // after 47 minutes without one team losing, the arena closes with no winner and no rating change
        {
            UpdateArenaWorldState();
            CheckArenaAfterTimerConditions();
        }
    }

    if (getWaterFallTimer() < diff)
    {
        if (isWaterFallActive())
        {
            setWaterFallTimer(urand(BG_DS_WATERFALL_TIMER_MIN, BG_DS_WATERFALL_TIMER_MAX));
            for (uint32 i = BG_DS_OBJECT_WATER_1; i <= BG_DS_OBJECT_WATER_2; ++i)
                SpawnBGObject(i, getWaterFallTimer());
            setWaterFallActive(false);
        }
        else
        {
            setWaterFallTimer(BG_DS_WATERFALL_DURATION);
            for (uint32 i = BG_DS_OBJECT_WATER_1; i <= BG_DS_OBJECT_WATER_2; ++i)
                SpawnBGObject(i, RESPAWN_IMMEDIATELY);
            setWaterFallActive(true);
        }
    }
    else
        setWaterFallTimer(getWaterFallTimer() - diff);
}
예제 #3
0
void BattlegroundRV::Update(uint32 diff)
{
    Battleground::Update(diff);

    if (GetStatus() == STATUS_IN_PROGRESS)
    {
        if (GetStartTime() >= 47*MINUTE*IN_MILLISECONDS)    // after 47 minutes without one team losing, the arena closes with no winner and no rating change
        {
            UpdateArenaWorldState();
            CheckArenaAfterTimerConditions();
        }
    }

    if (getTimer() < diff)
    {
        uint32 i;
        switch(getState())
        {
            case BG_RV_STATE_OPEN_FENCES:
            {
                setTimer(BG_RV_PILAR_TO_FIRE_TIMER);
                setState(BG_RV_STATE_CLOSE_FIRE);
                break;
            }
            case BG_RV_STATE_CLOSE_FIRE:
                for (i = BG_RV_OBJECT_FIRE_1; i <= BG_RV_OBJECT_FIREDOOR_2; ++i)
                    DoorClose(i);
                setTimer(BG_RV_FIRE_TO_PILAR_TIMER);
                setState(BG_RV_STATE_OPEN_PILARS);
                break;
            case BG_RV_STATE_OPEN_PILARS:
                for (i = BG_RV_OBJECT_PILAR_1; i <= BG_RV_OBJECT_PULLEY_2; ++i)
                    DoorOpen(i);
                setTimer(BG_RV_PILAR_TO_FIRE_TIMER);
                setState(BG_RV_STATE_OPEN_FIRE);
                break;
            case BG_RV_STATE_OPEN_FIRE:
                // FIXME: after 3.2.0 it's only decorative and should be opened only one time at battle start
                for (i = BG_RV_OBJECT_FIRE_1; i <= BG_RV_OBJECT_FIREDOOR_2; ++i)
                    DoorOpen(i);
                setTimer(BG_RV_FIRE_TO_PILAR_TIMER);
                setState(BG_RV_STATE_CLOSE_PILARS);
                break;
            case BG_RV_STATE_CLOSE_PILARS:
                uint32 i;
                for (i = BG_RV_OBJECT_PILAR_1; i <= BG_RV_OBJECT_PULLEY_2; ++i)
                    DoorOpen(i);
                setTimer(BG_RV_PILAR_TO_FIRE_TIMER);
                setState(BG_RV_STATE_CLOSE_FIRE);
                break;
        }
    }
    else
        setTimer(getTimer() - diff);
}
예제 #4
0
void BattlegroundBE::Update(uint32 diff) {
	Battleground::Update(diff);

	if (GetStatus() == STATUS_IN_PROGRESS) {
		if (GetStartTime() >= 47 * MINUTE * IN_MILLISECONDS) // after 47 minutes without one team losing, the arena closes with no winner and no rating change
				{
			UpdateArenaWorldState();
			CheckArenaAfterTimerConditions();
		}
	}
}
예제 #5
0
void BattlegroundDS::Update(uint32 diff)
{
    Battleground::Update(diff);

    if (GetStatus() == STATUS_IN_PROGRESS)
    {
        if (GetStartTime() >= 47*MINUTE*IN_MILLISECONDS)    // after 47 minutes without one team losing, the arena closes with no winner and no rating change
        {
            UpdateArenaWorldState();
            CheckArenaAfterTimerConditions();
        }
    }

    if (getWaterFallTimer() < diff)
    {
        if (GetBgMap(false))
            if (isWaterFallActive())
            {
                setWaterFallTimer(urand(BG_DS_WATERFALL_TIMER_MIN, BG_DS_WATERFALL_TIMER_MAX));
                for (uint32 i = BG_DS_OBJECT_WATER_1; i <= BG_DS_OBJECT_WATER_2; ++i)
                    SpawnBGObject(i, getWaterFallTimer());
                setWaterFallActive(false);
            }
            else
            {
                setWaterFallTimer(BG_DS_WATERFALL_DURATION);
                for (uint32 i = BG_DS_OBJECT_WATER_1; i <= BG_DS_OBJECT_WATER_2; ++i)
                    SpawnBGObject(i, RESPAWN_IMMEDIATELY);
                setWaterFallActive(true);
            }
    }
    else
        setWaterFallTimer(getWaterFallTimer() - diff);

    if (GetStatus() == STATUS_IN_PROGRESS)
    {
        if(m_knockback < diff && m_knockbackCheck)
        {
            for(BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); itr++)
            {
                Player * plr = sObjectMgr->GetPlayer(itr->first);
                if (plr->GetTeam() == ALLIANCE && plr->GetDistance2d(1214, 765) <= 50 && plr->GetPositionZ() > 10)
                    KnockBackPlayer(plr, 6.15f, 50.00f, 7.00f);
                if (plr->GetTeam() == HORDE && plr->GetDistance2d(1369, 817) <= 50 && plr->GetPositionZ() > 10)
                    KnockBackPlayer(plr, 3.10f, 50.00f, 7.00f);
                plr->RemoveAurasDueToSpell(48018);
            }
            m_knockbackCheck = false;
        } else m_knockback -= diff;
    }
}
예제 #6
0
void BattlegroundNA::InitializeObjects()
{
    ObjectGUIDsByType.resize(BG_NA_OBJECT_MAX);
    if (GetStatus() == STATUS_IN_PROGRESS)
    {
        if (GetStartTime() >= 47*MINUTE*IN_MILLISECONDS)    // after 47 minutes without one team losing, the arena closes with no winner and no rating change
        {
            UpdateArenaWorldState();
            CheckArenaAfterTimerConditions();
        }
    }

    for (uint32 i = BG_NA_OBJECT_DOOR_1; i <= BG_NA_OBJECT_DOOR_4; ++i)
        SpawnGameObject(i, RESPAWN_IMMEDIATELY);
}
예제 #7
0
void BattlegroundDS::Update(uint32 diff)
{
    Battleground::Update(diff);

    if(GetStatus() != STATUS_IN_PROGRESS)
        return;

    if(GetStatus() == STATUS_IN_PROGRESS)
    {
        if(GetStartTime() >= 47*MINUTE*IN_MILLISECONDS)    // after 47 minutes without one team losing, the arena closes with no winner and no rating change
        {
            UpdateArenaWorldState();
            CheckArenaAfterTimerConditions();
        }
    }
    if(getPipeKnockBackCount() < BG_DS_PIPE_KNOCKBACK_TOTAL_COUNT)
    {
        if(getPipeKnockBackTimer() < diff)
        {
            for(uint32 i = BG_DS_NPC_PIPE_KNOCKBACK_1; i <= BG_DS_NPC_PIPE_KNOCKBACK_2; ++i)
                if(Creature* waterSpout = GetBgMap()->GetCreature(BGArrayForCreatures[i]))
                    waterSpout->CastSpell(waterSpout, BG_DS_SPELL_FLUSH, true);

            setPipeKnockBackCount(getPipeKnockBackCount() + 1);
            setPipeKnockBackTimer(BG_DS_PIPE_KNOCKBACK_DELAY);
        }
        else
            setPipeKnockBackTimer(getPipeKnockBackTimer() - diff);
    }

    //if(!m_knockback && m_teleport)
    //{
    //    if(m_teleport <= diff)
    //    {
    //        for(BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
    //        {
    //            Player* plr = ObjectAccessor::FindPlayer(itr->first);
    //            if(!plr)
    //                continue;

    //            if(plr->GetPositionZ() > 13.0f)
    //                HandlePlayerUnderMap(plr);
    //        }
    //        m_teleport = 5 * IN_MILLISECONDS;
    //    }
    //    else
    //        m_teleport -= diff;
    //}

    if(getWaterFallTimer() < diff)
    {
        switch(getWaterFallStatus())
        {
        case BG_DS_WATERFALL_STATUS_OFF: // Add the water
            DoorClose(BG_DS_OBJECT_WATER_2);
            setWaterFallTimer(BG_DS_WATERFALL_WARNING_DURATION);
            setWaterFallStatus(BG_DS_WATERFALL_STATUS_WARNING);
            break;
        case BG_DS_WATERFALL_STATUS_WARNING: // Active collision and start knockback timer
            if(GameObject* gob = GetBgMap()->GetGameObject(BGArrayForObjects[BG_DS_OBJECT_WATER_1]))
                gob->SetGoState(GO_STATE_READY);

            setWaterFallTimer(BG_DS_WATERFALL_DURATION);
            setWaterFallStatus(BG_DS_WATERFALL_STATUS_ON);
            setWaterFallKnockbackTimer(BG_DS_WATERFALL_KNOCKBACK_TIMER);
            break;
        case BG_DS_WATERFALL_STATUS_ON: // Remove collision and water
            // turn off collision
            if(GameObject* gob = GetBgMap()->GetGameObject(BGArrayForObjects[BG_DS_OBJECT_WATER_1]))
                gob->SetGoState(GO_STATE_ACTIVE);

            DoorOpen(BG_DS_OBJECT_WATER_2);
            setWaterFallTimer(urand(BG_DS_WATERFALL_TIMER_MIN, BG_DS_WATERFALL_TIMER_MAX));
            setWaterFallStatus(BG_DS_WATERFALL_STATUS_OFF);
            break;
        }
    }
    else
        setWaterFallTimer(getWaterFallTimer() - diff);
}
예제 #8
0
void BattlegroundRV::Update(uint32 diff)
{
    Battleground::Update(diff);

    if (GetStatus() == STATUS_IN_PROGRESS)
    {
        if (GetStartTime() >= 47*MINUTE*IN_MILLISECONDS)    // after 47 minutes without one team losing, the arena closes with no winner and no rating change
        {
            UpdateArenaWorldState();
            CheckArenaAfterTimerConditions();
        }
        // bochki
        if (!fencesopened)
        {
            if (fencestimer < diff)
            {
                fencesopened = true;
            }
            else
                fencestimer -= diff;
        }
    }

    if (getTimer() < diff)
    {
        uint32 i;
        if (GetBgMap())
            switch(getState())
            {
                case BG_RV_STATE_OPEN_FENCES:
                {
                    setTimer(BG_RV_PILAR_TO_FIRE_TIMER);
                    setState(BG_RV_STATE_CLOSE_FIRE);
                    break;
                }
                case BG_RV_STATE_CLOSE_FIRE:

                    for (i = BG_RV_OBJECT_FIRE_1; i <= BG_RV_OBJECT_FIREDOOR_2; ++i)
                        DoorClose(i);
                    setTimer(BG_RV_FIRE_TO_PILAR_TIMER);
                    setState(BG_RV_STATE_OPEN_PILARS);
                    break;
                case BG_RV_STATE_OPEN_PILARS:
                    pillarsopened=true;
                    for (i = BG_RV_OBJECT_PILAR_1; i <= BG_RV_OBJECT_PULLEY_2; ++i)
                        DoorOpen(i);
                    setTimer(BG_RV_PILAR_TO_FIRE_TIMER);
                    setState(BG_RV_STATE_OPEN_FIRE);
                    break;
                case BG_RV_STATE_OPEN_FIRE:
                    for (i = BG_RV_OBJECT_FIRE_1; i <= BG_RV_OBJECT_FIREDOOR_2; ++i)
                        DoorOpen(i);
                    setTimer(BG_RV_FIRE_TO_PILAR_TIMER);
                    setState(BG_RV_STATE_CLOSE_PILARS);
                    break;
                case BG_RV_STATE_CLOSE_PILARS:
                    pillarsopened=false;
                    uint32 i;
                    for (i = BG_RV_OBJECT_PILAR_1; i <= BG_RV_OBJECT_PULLEY_2; ++i)
                        DoorOpen(i);
                    setTimer(BG_RV_PILAR_TO_FIRE_TIMER);
                    setState(BG_RV_STATE_CLOSE_FIRE);
                    break;
            }
    }
    else
        setTimer(getTimer() - diff);
}
예제 #9
0
void BattlegroundRV::Update(uint32 diff)
{
    Battleground::Update(diff);

    if (GetStatus() == STATUS_IN_PROGRESS)
    {
        if (GetStartTime() >= 47*MINUTE*IN_MILLISECONDS)    // after 47 minutes without one team losing, the arena closes with no winner and no rating change
        {
            UpdateArenaWorldState();
            CheckArenaAfterTimerConditions();
        }
        // teleport buggers
        if(m_uiTeleport < diff)
        {
            for(BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
            {
                Player * plr = sObjectMgr->GetPlayer(itr->first);
                if (plr && plr->GetPositionZ() < 27)
                    plr->TeleportTo(plr->GetMapId(), plr->GetPositionX(), plr->GetPositionY(), 29, plr->GetOrientation(), false);
                if (plr && plr->GetPositionZ() < 27)
                    plr->TeleportTo(plr->GetMapId(), plr->GetPositionX(), plr->GetPositionY(), 29, plr->GetOrientation(), false);
            }
            m_uiTeleport = 1000;
        }
        else
            m_uiTeleport -= diff;
    }

    if (getTimer() < diff)
    {
        uint32 i;
        switch(getState())
        {
        case BG_RV_STATE_OPEN_FENCES:
        {
            setTimer(BG_RV_PILAR_TO_FIRE_TIMER);
            setState(BG_RV_STATE_CLOSE_FIRE);
            break;
        }
        case BG_RV_STATE_CLOSE_FIRE:
            //uint32 i;
            for (i = BG_RV_OBJECT_FIRE_1; i <= BG_RV_OBJECT_FIREDOOR_2; ++i)
                DoorOpen(i);
            setTimer(BG_RV_FIRE_TO_PILAR_TIMER);
            setState(BG_RV_STATE_OPEN_PILARS);
            break;
        case BG_RV_STATE_OPEN_PILARS:
            for (i = BG_RV_OBJECT_PILAR_1; i <= BG_RV_OBJECT_PULLEY_2; ++i)
                DoorOpen(i);
            setTimer(BG_RV_PILAR_TO_FIRE_TIMER);
            setState(BG_RV_STATE_OPEN_FIRE);
            break;
        case BG_RV_STATE_OPEN_FIRE:
            for (i = BG_RV_OBJECT_FIRE_1; i <= BG_RV_OBJECT_FIREDOOR_2; ++i)
                DoorOpen(i);
            setTimer(BG_RV_FIRE_TO_PILAR_TIMER);
            setState(BG_RV_STATE_CLOSE_PILARS);
            break;
        case BG_RV_STATE_CLOSE_PILARS:
            //uint32 i;
            for (i = BG_RV_OBJECT_PILAR_1; i <= BG_RV_OBJECT_PULLEY_2; ++i)
                DoorOpen(i);
            setTimer(BG_RV_PILAR_TO_FIRE_TIMER);
            setState(BG_RV_STATE_CLOSE_FIRE);
            break;
        }
    }
    else
        setTimer(getTimer() - diff);
}