Ejemplo n.º 1
0
void OPvPCapturePointEP_NPT::ChangeState()
{
    if(fabs(m_value) == m_maxValue)  // state won't change, only phase when maxed out!
    {
        // if changing from controlling alliance to horde or vice versa
        if( m_OldState == OBJECTIVESTATE_ALLIANCE && m_OldState != m_State )
        {
            sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetCWStringForDBCLocale(LANG_OPVP_EP_LOOSE_NPT_A));
            ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_NPT] = 0;
        }
        else if ( m_OldState == OBJECTIVESTATE_HORDE && m_OldState != m_State )
        {
            sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetCWStringForDBCLocale(LANG_OPVP_EP_LOOSE_NPT_H));
            ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_NPT] = 0;
        }

        uint32 artkit = 21;

        switch(m_State)
        {
        case OBJECTIVESTATE_ALLIANCE:
            if(m_value == m_maxValue)
                m_TowerState = EP_TS_A;
            else
                m_TowerState = EP_TS_A_P;
            artkit = 2;
            SummonGO(ALLIANCE);
            ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_NPT] = ALLIANCE;
            if(m_OldState != m_State) sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetCWStringForDBCLocale(LANG_OPVP_EP_CAPTURE_NPT_A));
            break;
        case OBJECTIVESTATE_HORDE:
            if(m_value == -m_maxValue)
                m_TowerState = EP_TS_H;
            else
                m_TowerState = EP_TS_H_P;
            artkit = 1;
            SummonGO(HORDE);
            ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_NPT] = HORDE;
            if(m_OldState != m_State) sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetCWStringForDBCLocale(LANG_OPVP_EP_CAPTURE_NPT_H));
            break;
        case OBJECTIVESTATE_NEUTRAL:
            m_TowerState = EP_TS_N;
            m_SummonedGOSide = 0;
            DelObject(EP_NPT_BUFF);
            break;
        case OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE:
        case OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE:
            m_TowerState = EP_TS_N_A;
            break;
        case OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE:
        case OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE:
            m_TowerState = EP_TS_N_H;
            break;
        }

        GameObject* flag = HashMapHolder<GameObject>::Find(m_capturePointGUID);
        GameObject* flag2 = HashMapHolder<GameObject>::Find(m_Objects[EP_NPT_FLAGS]);
        if(flag)
        {
            flag->SetGoArtKit(artkit);
            flag->SendUpdateObjectToAllExcept(NULL);
        }
        if(flag2)
        {
            flag2->SetGoArtKit(artkit);
            flag2->SendUpdateObjectToAllExcept(NULL);
        }

        UpdateTowerState();

        // complete quest objective
        if(m_TowerState == EP_TS_A || m_TowerState == EP_TS_H)
            SendObjectiveComplete(EP_NPT_CM, 0);
    }
}
Ejemplo n.º 2
0
bool OutdoorPvPObjectiveEP_NPT::Update(uint32 diff)
{
    if (OutdoorPvPObjective::Update(diff))
    {
        if (m_OldState != m_State || fabs(m_ShiftPhase) == m_ShiftMaxPhase)  // state won't change, only phase when maxed out!
        {
            // if changing from controlling alliance to horde or vice versa
            if (m_OldState == OBJECTIVESTATE_ALLIANCE && m_OldState != m_State )
            {
                sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetNeoStringForDBCLocale(LANG_OPVP_EP_LOOSE_NPT_A));
                ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_NPT] = 0;
            }
            else if (m_OldState == OBJECTIVESTATE_HORDE && m_OldState != m_State )
            {
                sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetNeoStringForDBCLocale(LANG_OPVP_EP_LOOSE_NPT_H));
                ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_NPT] = 0;
            }

            uint32 artkit = 21;

            switch(m_State)
            {
            case OBJECTIVESTATE_ALLIANCE:
                if (m_ShiftPhase == m_ShiftMaxPhase)
                    m_TowerState = EP_TS_A;
                else
                    m_TowerState = EP_TS_A_P;
                artkit = 2;
                SummonGO(ALLIANCE);
                ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_NPT] = ALLIANCE;
                if (m_OldState != m_State) sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetNeoStringForDBCLocale(LANG_OPVP_EP_CAPTURE_NPT_A));
                break;
            case OBJECTIVESTATE_HORDE:
                if (m_ShiftPhase == -m_ShiftMaxPhase)
                    m_TowerState = EP_TS_H;
                else
                    m_TowerState = EP_TS_H_P;
                artkit = 1;
                SummonGO(HORDE);
                ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_NPT] = HORDE;
                if (m_OldState != m_State) sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetNeoStringForDBCLocale(LANG_OPVP_EP_CAPTURE_NPT_H));
                break;
            case OBJECTIVESTATE_NEUTRAL:
                m_TowerState = EP_TS_N;
                m_SummonedGOSide = 0;
                DelObject(EP_NPT_BUFF);
                break;
            case OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE:
            case OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE:
                m_TowerState = EP_TS_N_A;
                break;
            case OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE:
            case OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE:
                m_TowerState = EP_TS_N_H;
                break;
            }

            GameObject* flag = HashMapHolder<GameObject>::Find(m_CapturePoint);
            GameObject* flag2 = HashMapHolder<GameObject>::Find(m_Objects[EP_NPT_FLAGS]);
            if (flag)
            {
                flag->SetGoArtKit(artkit);
                flag->SendUpdateObjectToAllExcept(NULL);
            }
            if (flag2)
            {
                flag2->SetGoArtKit(artkit);
                flag2->SendUpdateObjectToAllExcept(NULL);
            }

            UpdateTowerState();

            // complete quest objective
            if (m_TowerState == EP_TS_A || m_TowerState == EP_TS_H)
                SendObjectiveComplete(EP_NPT_CM, 0);
        }

        if (m_ShiftPhase != m_OldPhase)
        {
            // send this too, sometimes the slider disappears, dunno why :(
            SendUpdateWorldState(EP_UI_TOWER_SLIDER_DISPLAY, 1);
            // send these updates to only the ones in this objective
            uint32 phase = (uint32)ceil((m_ShiftPhase + m_ShiftMaxPhase) / (2 * m_ShiftMaxPhase ) * 100.0f);
            SendUpdateWorldState(EP_UI_TOWER_SLIDER_POS, phase);
            // send this too, sometimes it resets :S
            SendUpdateWorldState(EP_UI_TOWER_SLIDER_N, m_NeutralValue);
        }
        return m_OldState != m_State;
    }
    return false;
}
Ejemplo n.º 3
0
void OPvPCapturePointEP_NPT::ChangeState()
{
    // if changing from controlling alliance to horde or vice versa
    if (m_OldState == OBJECTIVESTATE_ALLIANCE || m_OldState == OBJECTIVESTATE_HORDE)
        ((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_NPT, 0);

    uint32 artkit = 21;

    switch (m_State)
    {
        case OBJECTIVESTATE_ALLIANCE:
            m_TowerState = EP_TS_A;
            artkit = 2;
            SummonGO(ALLIANCE);
            ((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_NPT, ALLIANCE);
            m_PvP->SendDefenseMessage(EP_GraveYardZone, TEXT_NORTHPASS_TOWER_TAKEN_ALLIANCE);
            break;
        case OBJECTIVESTATE_HORDE:
            m_TowerState = EP_TS_H;
            artkit = 1;
            SummonGO(HORDE);
            ((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_NPT, HORDE);
            m_PvP->SendDefenseMessage(EP_GraveYardZone, TEXT_NORTHPASS_TOWER_TAKEN_HORDE);
            break;
        case OBJECTIVESTATE_NEUTRAL:
            m_TowerState = EP_TS_N;
            m_SummonedGOSide = 0;
            DelObject(EP_NPT_BUFF);
            break;
        case OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE:
            m_TowerState = EP_TS_N_A;
            break;
        case OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE:
            m_TowerState = EP_TS_N_A;
            m_SummonedGOSide = 0;
            DelObject(EP_NPT_BUFF);
            break;
        case OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE:
            m_TowerState = EP_TS_N_H;
            break;
        case OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE:
            m_TowerState = EP_TS_N_H;
            m_SummonedGOSide = 0;
            DelObject(EP_NPT_BUFF);
            break;
    }

    GameObject* flag = HashMapHolder<GameObject>::Find(m_capturePointGUID);
    GameObject* flag2 = HashMapHolder<GameObject>::Find(m_Objects[EP_NPT_FLAGS]);
    if (flag)
    {
        flag->SetGoArtKit(artkit);
    }
    if (flag2)
    {
        flag2->SetGoArtKit(artkit);
    }

    UpdateTowerState();

    // complete quest objective
    if (m_TowerState == EP_TS_A || m_TowerState == EP_TS_H)
        SendObjectiveComplete(EP_NPT_CM, ObjectGuid::Empty);
}
Ejemplo n.º 4
0
void OPvPCapturePointEP_NPT::ChangeState() {
	// if changing from controlling alliance to horde or vice versa
	if (m_OldState == OBJECTIVESTATE_ALLIANCE && m_OldState != m_State) {
		sWorld->SendZoneText(
				EP_GraveYardZone,
				sObjectMgr->GetArkCoreStringForDBCLocale(
						LANG_OPVP_EP_LOOSE_NPT_A));
		((OutdoorPvPEP*) m_PvP)->EP_Controls[EP_NPT] = 0;
	} else if (m_OldState == OBJECTIVESTATE_HORDE && m_OldState != m_State) {
		sWorld->SendZoneText(
				EP_GraveYardZone,
				sObjectMgr->GetArkCoreStringForDBCLocale(
						LANG_OPVP_EP_LOOSE_NPT_H));
		((OutdoorPvPEP*) m_PvP)->EP_Controls[EP_NPT] = 0;
	}

	uint32 artkit = 21;

	switch (m_State) {
	case OBJECTIVESTATE_ALLIANCE:
		m_TowerState = EP_TS_A;
		artkit = 2;
		SummonGO(ALLIANCE);
		((OutdoorPvPEP*) m_PvP)->EP_Controls[EP_NPT] = ALLIANCE;
		if (m_OldState != m_State)
			sWorld->SendZoneText(
					EP_GraveYardZone,
					sObjectMgr->GetArkCoreStringForDBCLocale(
							LANG_OPVP_EP_CAPTURE_NPT_A));
		break;
	case OBJECTIVESTATE_HORDE:
		m_TowerState = EP_TS_H;
		artkit = 1;
		SummonGO(HORDE);
		((OutdoorPvPEP*) m_PvP)->EP_Controls[EP_NPT] = HORDE;
		if (m_OldState != m_State)
			sWorld->SendZoneText(
					EP_GraveYardZone,
					sObjectMgr->GetArkCoreStringForDBCLocale(
							LANG_OPVP_EP_CAPTURE_NPT_H));
		break;
	case OBJECTIVESTATE_NEUTRAL:
		m_TowerState = EP_TS_N;
		m_SummonedGOSide = 0;
		DelObject(EP_NPT_BUFF);
		break;
	case OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE:
		m_TowerState = EP_TS_N_A;
		break;
	case OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE:
		m_TowerState = EP_TS_N_A;
		m_SummonedGOSide = 0;
		DelObject(EP_NPT_BUFF);
		break;
	case OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE:
		m_TowerState = EP_TS_N_H;
		break;
	case OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE:
		m_TowerState = EP_TS_N_H;
		m_SummonedGOSide = 0;
		DelObject(EP_NPT_BUFF);
		break;
	}

	GameObject* flag = HashMapHolder<GameObject>::Find(m_capturePointGUID);
	GameObject* flag2 = HashMapHolder<GameObject>::Find(
			m_Objects[EP_NPT_FLAGS]);
	if (flag) {
		flag->SetGoArtKit(artkit);
	}
	if (flag2) {
		flag2->SetGoArtKit(artkit);
	}

	UpdateTowerState();

	// complete quest objective
	if (m_TowerState == EP_TS_A || m_TowerState == EP_TS_H)
		SendObjectiveComplete(EP_NPT_CM, 0);
}
Ejemplo n.º 5
0
void OPvPCapturePointEP_NPT::ChangeState()
{
    // if changing from controlling alliance to horde or vice versa
    if (m_OldState == OBJECTIVESTATE_ALLIANCE || m_OldState == OBJECTIVESTATE_HORDE)
        ((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_NPT, 0);

    uint32 artkit = 21;

    switch (m_State)
    {
        case OBJECTIVESTATE_ALLIANCE:
            m_TowerState = EP_TS_A;
            artkit = 2;
            SummonGO(ALLIANCE);
            ((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_NPT, ALLIANCE);
            m_PvP->SendDefenseMessage(EP_GraveYardZone, TEXT_NORTHPASS_TOWER_TAKEN_ALLIANCE);
            break;
        case OBJECTIVESTATE_HORDE:
            m_TowerState = EP_TS_H;
            artkit = 1;
            SummonGO(HORDE);
            ((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_NPT, HORDE);
            m_PvP->SendDefenseMessage(EP_GraveYardZone, TEXT_NORTHPASS_TOWER_TAKEN_HORDE);
            break;
        case OBJECTIVESTATE_NEUTRAL:
            m_TowerState = EP_TS_N;
            m_SummonedGOSide = 0;
            DelObject(EP_NPT_BUFF);
            break;
        case OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE:
            m_TowerState = EP_TS_N_A;
            break;
        case OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE:
            m_TowerState = EP_TS_N_A;
            m_SummonedGOSide = 0;
            DelObject(EP_NPT_BUFF);
            break;
        case OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE:
            m_TowerState = EP_TS_N_H;
            break;
        case OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE:
            m_TowerState = EP_TS_N_H;
            m_SummonedGOSide = 0;
            DelObject(EP_NPT_BUFF);
            break;
    }

    Map* map = sMapMgr->FindMap(0, 0);
    auto bounds = map->GetGameObjectBySpawnIdStore().equal_range(m_capturePointSpawnId);
    for (auto itr = bounds.first; itr != bounds.second; ++itr)
        itr->second->SetGoArtKit(artkit);

    bounds = map->GetGameObjectBySpawnIdStore().equal_range(m_Objects[EP_NPT_FLAGS]);
    for (auto itr = bounds.first; itr != bounds.second; ++itr)
        itr->second->SetGoArtKit(artkit);

    UpdateTowerState();

    // complete quest objective
    if (m_TowerState == EP_TS_A || m_TowerState == EP_TS_H)
        SendObjectiveComplete(EP_NPT_CM, ObjectGuid::Empty);
}