void UNavLinkCustomComponent::SetEnabled(bool bNewEnabled)
{
	if (bLinkEnabled != bNewEnabled)
	{
		bLinkEnabled = bNewEnabled;

		UNavigationSystem* NavSys = UNavigationSystem::GetCurrent(GetWorld());
		if (NavSys)
		{
			NavSys->UpdateCustomLink(this);
		}

		if (GetWorld())
		{
			GetWorld()->GetTimerManager().ClearTimer(TimerHandle_BroadcastStateChange);

			if ((bLinkEnabled && bNotifyWhenEnabled) || (!bLinkEnabled && bNotifyWhenDisabled))
			{
				BroadcastStateChange();
			}
		}
	}
}
예제 #2
0
void OPvPWintergrasp::ProcessEvent(GameObject *obj, uint32 eventId)
{
    if(eventId == 19982)
    {
        if(m_wartime)
            ChangeDefender();
    }
    else if(obj->GetGoType() == GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING)
    {
        BuildingStateMap::const_iterator itr = m_buildingStates.find(obj->GetDBTableGUIDLow());
        if(itr != m_buildingStates.end())
        {
            if(obj->HasFlag(GAMEOBJECT_FLAGS, GO_FLAG_DAMAGED))
                itr->second->damageState = DAMAGE_DAMAGED;
            else
                itr->second->damageState = DAMAGE_DESTROYED;
            BroadcastStateChange(itr->second);

            if(itr->second->type == BUILDING_WORKSHOP)
                if(SiegeWorkshop *workshop = GetWorkshop(obj->GetDBTableGUIDLow()))
                    workshop->DespawnAllVehicles();
        }
    }
}
예제 #3
0
void OPvPWintergrasp::ProcessEvent(GameObject *obj, uint32 eventId)
{
    if (eventId == 19982)
    {
        if (m_wartime && m_gate && m_gate->damageState == DAMAGE_DESTROYED)
        {
            m_changeDefender = true;
            m_timer = 0;
        }
    }
    else if (obj->GetGoType() == GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING)
    {
        BuildingStateMap::const_iterator itr = m_buildingStates.find(obj->GetDBTableGUIDLow());
        if (itr != m_buildingStates.end())
        {
            BuildingState *state = itr->second;
            if (eventId == obj->GetGOInfo()->building.damagedEvent)
            {
                state->damageState = DAMAGE_DAMAGED;

                if (state->type == BUILDING_TOWER)
                {
                    if (sWorld.getConfig(CONFIG_OUTDOORPVP_WINTERGRASP_CUSTOM_HONOR))
                    {
                        for (PlayerSet::const_iterator itr = m_players[m_defender].begin(); itr != m_players[m_defender].end(); ++itr)
                            if ((*itr)->HasAura(SPELL_LIEUTENANT) && ((*itr)->getLevel() > 69))
                               (*itr)->ModifyHonorPoints(m_customHonorReward[DAMAGED_TOWER]);
                    }
                    else
                        LieutenantCastSpell(m_defender, SPELL_DAMAGED_TOWER);
                }
            }
            else if (eventId == obj->GetGOInfo()->building.destroyedEvent)
            {
                state->damageState = DAMAGE_DESTROYED;

                if (state->type == BUILDING_WORKSHOP)
                {
                    //if (SiegeWorkshop *workshop = GetWorkshop(obj->GetDBTableGUIDLow()))
                    //    workshop->DespawnAllVehicles();
                    ModifyWorkshopCount(state->GetTeam(), false);
                }
                else if (state->type == BUILDING_TOWER)
                {
                    if (!m_towerCount)
                        sLog.outError("OPvPWintergrasp::ProcessEvent: negative tower count!");
                    else
                    {
                        --m_towerCount;
                        if (sWorld.getConfig(CONFIG_OUTDOORPVP_WINTERGRASP_CUSTOM_HONOR))
                        {
                            for (PlayerSet::const_iterator itr = m_players[m_defender].begin(); itr != m_players[m_defender].end(); ++itr)
                                if ((*itr)->HasAura(SPELL_LIEUTENANT) && ((*itr)->getLevel() > 69))
                                    (*itr)->ModifyHonorPoints(m_customHonorReward[DESTROYED_TOWER]);
                        }
                        else
                            LieutenantCastSpell(m_defender, SPELL_DESTROYED_TOWER);
                    }
                }
            }
            BroadcastStateChange(state);
        }
    }
}