Example #1
0
CHL2MPRules::CHL2MPRules()
{
#ifndef CLIENT_DLL
    // Create the team managers
    for ( int i = 0; i < ARRAYSIZE( sTeamNames ); i++ )
    {
        CTeam *pTeam = static_cast<CTeam*>(CreateEntityByName( "team_manager" ));
        pTeam->Init( sTeamNames[i], i );

        g_Teams.AddToTail( pTeam );
    }

    m_bTeamPlayEnabled = teamplay.GetBool();
    m_flIntermissionEndTime = 0.0f;
    m_flGameStartTime = 0;

    m_hRespawnableItemsAndWeapons.RemoveAll();
    m_tmNextPeriodicThink = 0;
    m_flRestartGameTime = 0;
    m_bCompleteReset = false;
    m_bHeardAllPlayersReady = false;
    m_bAwaitingReadyRestart = false;
    m_bChangelevelDone = false;

#endif
}
Example #2
0
CTeam* CTeamMgr::GetTeam(const char* sName)
{
	// Sanity checks...

	if (!sName) return(NULL);
	if (sName[0] == '\0') return(NULL);


	// Look for a team with the given name...

	CTeam* pTeam = GetFirstTeam();

	while (pTeam)
	{
		if (strncmp(pTeam->GetName(), sName, TM_MAX_NAME) == 0)
		{
			return(pTeam);
		}

		pTeam = GetNextTeam(pTeam);
	}


	// If we get here, we didn't find the team...

	return(NULL);
}
Example #3
0
bool CPlayer::IsPlayerIgnoringElement( CElement* pElement )
{
    // For each ignored element
    for ( list < CElement* > ::const_iterator iter = m_lstIgnoredList.begin () ; iter != m_lstIgnoredList.end () ; ++iter )
    {
        CElement* pIgnoredElement = *iter;
        if ( IS_TEAM ( pIgnoredElement ) )
        {
            // Check team
            CTeam* pTeam = static_cast < CTeam* > ( pIgnoredElement );
            // If the broadcast-to player is in the ignored team
            list < CPlayer* > ::const_iterator iter = pTeam->PlayersBegin ();
            for ( ; iter != pTeam->PlayersEnd (); iter++ )
            {
                if ( *iter == pElement )
                    return true;
            }
        }
        else if ( IS_PLAYER( pIgnoredElement ) )
        {
            // Check player
            if ( pIgnoredElement == pElement )
                return true;
        }
        else
        {
            // Check element decendants
            if ( pIgnoredElement->IsMyChild ( pElement , true ) )
                return true;
        }
    }
    return false;
}
Example #4
0
CTeam* CTeamMgr::GetTeamFromPlayerID(uint32 dwPlayerID)
{
	// Look for the player on each team...

	CTeam* pTeam = GetFirstTeam();

	while (pTeam)
	{
		CTeamPlayer* pPlayer = pTeam->GetFirstPlayer();

		while (pPlayer)
		{
			if (pPlayer->GetID() == dwPlayerID)
			{
				return(pTeam);
			}

			pPlayer = pTeam->GetNextPlayer(pPlayer);
		}

		pTeam = GetNextTeam(pTeam);
	}


	// If we get here, we didn't find the player's team...

	return(NULL);
}
Example #5
0
CTeam* CTeamMgr::AddTeam(uint32 dwTeamID, char* sTeamName, uint32 dwFlags)
{
	// Make sure this team doesn't already exist...

	if (GetTeam(dwTeamID)) return(NULL);
	if (GetTeam(sTeamName)) return(NULL);


	// Create and init a new team...

	CTeam* pTeam = debug_new(CTeam);
	if (!pTeam) return(NULL);

	if (!pTeam->Init(dwTeamID, sTeamName, dwFlags))
	{
		debug_delete(pTeam);
		return(NULL);
	}


	// Add the new team to our list...

	m_lsTeams.InsertLast(pTeam);


	// All done...

	return(pTeam);
}
Example #6
0
LTBOOL CTeamMgr::ChangePlayerTeam(uint32 dwPlayerID, CTeam* pNewTeam, LTBOOL bReset)
{
	// Sanity checks...

    if (!pNewTeam) return(LTFALSE);


	// Get the current team for the player...

	CTeam* pCurTeam = GetTeamFromPlayerID(dwPlayerID);
    if (!pCurTeam) return(LTFALSE);


	// Change the player's team to the new one...

	if (!pCurTeam->ChangePlayerTeam(dwPlayerID, pNewTeam, bReset))
	{
        return(LTFALSE);
	}


	// All done...

    return(LTTRUE);
}
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CTeamplayRules::Precache( void )
{
	// Call the Team Manager's precaches
	for ( int i = 0; i < GetNumberOfTeams(); i++ )
	{
		CTeam *pTeam = GetGlobalTeam( i );
		pTeam->Precache();
	}
}
Example #8
0
void CTeamMgr::ResetAllTeams()
{
	CTeam* pTeam = m_lsTeams.GetFirst();

	while (pTeam)
	{
		pTeam->Reset();
		pTeam = pTeam->GetNext();
	}
}
//---------------------------------------------------
// removeNpcFromGroup
//---------------------------------------------------
void CCreatureManager::removeNpcFromGroup( TAIAlias groupAlias, TAIAlias npcAlias )
{
	CHashMap< unsigned int,CNPCGroup >::iterator it = _NpcGroups.find( groupAlias );
	if ( it == _NpcGroups.end() )
	{
		nlwarning("<CCreatureManager removeNpcFromGroup> Invalid NPC group %s", CPrimitivesParser::aliasToString(groupAlias).c_str());
	}
	else
	{
		CNPCGroup & group = (*it).second;

		group.Members.erase( npcAlias );
		const bool groupWiped = (group.Members.empty());

		CMissionManager::getInstance()->checkEscortFailure(groupAlias, groupWiped);

		if (groupWiped)
		{
			// group is wiped, time to trigger mission event
			vector<uint16> processedTeams;
			for ( uint i = 0; i < group.TeamKillers.size(); i++ )
			{
				CTeam * team = TeamManager.getRealTeam( group.TeamKillers[i] );
				if ( team )
				{
					CCharacter * user = PlayerManager.getChar( team->getLeader() );
					if ( user )
					{
						CMissionEventKillGroup event(groupAlias,CMissionEvent::NoSolo);
						if ( user->processMissionEvent( event ) )
						{
							// the event has been processed for this team. We add the team to the processed team
							processedTeams.push_back( group.TeamKillers[i] );
						}
					}
				}
			}
			for ( uint i = 0; i < group.PlayerKillers.size(); i++ )
			{
				CCharacter * user = PlayerManager.getChar( group.PlayerKillers[i] );
				if ( user )
				{
					if ( std::find( processedTeams.begin(),processedTeams.end(),user->getTeamId() ) == processedTeams.end() )
					{
						CMissionEventKillGroup event( groupAlias,CMissionEvent::NoGroup );
						user->processMissionEvent( event );
					}
				}
			}
			_NpcGroups.erase(it);
		}
		else
			CMissionManager::getInstance()->checkEscortFailure(groupAlias,false);
	}
} // removeNpcFromGroup
Example #10
0
	CSDKGameRules::CSDKGameRules()
	{
		// Create the team managers
		for ( int i = 0; i < static_cast<int>(ARRAYSIZE( sTeamNames )); i++ )
		{
			CTeam *pTeam = static_cast<CTeam*>(CreateEntityByName( "sdk_team_manager" ));
			pTeam->Init( sTeamNames[i], i );

			g_Teams.AddToTail( pTeam );
		}
	}
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CTriggerAreaCapture::BreakCapture( bool bNotEnoughPlayers )
{
	if( m_bCapturing )
	{
		// Remap team to get first game team = 1
		switch ( m_nCapturingTeam - FIRST_GAME_TEAM+1 )
		{
		case 1: 
			m_OnBreakTeam1.FireOutput( this, this );
			break;
		case 2: 
			m_OnBreakTeam2.FireOutput( this, this );
			break;
		default:
			Assert(0);
			break;
		}

		m_BreakOutput.FireOutput(this,this);

		m_bCapturing = false;
		m_nCapturingTeam = TEAM_UNASSIGNED;

		UpdateCappingTeam( TEAM_UNASSIGNED );

		if ( bNotEnoughPlayers )
		{
			IncrementCapAttemptNumber();
		}

		SetCapTimeRemaining( 0 );

		if( m_hPoint )
		{
			m_hPoint->CaptureEnd();
		}

		m_OnNumCappersChanged.Set( 0, this, this );

		// tell all touching players to stop racking up capture points
		CTeam *pTeam = GetGlobalTeam( m_nCapturingTeam );
		if ( pTeam )
		{
			for ( int i=0;i<pTeam->GetNumPlayers();i++ )
			{
				CBaseMultiplayerPlayer *pPlayer = ToBaseMultiplayerPlayer( pTeam->GetPlayer(i) );
				if ( pPlayer && IsTouching( pPlayer ) )
				{
					pPlayer->StopScoringEscortPoints();					
				}
			}
		}
	}
}
Example #12
0
//=========================================================================
// Return the score/frags of a team, depending on whether TeamFrags is on
int TeamFortress_TeamGetScoreFrags(int tno)
{
	CTeam *pTeam = GetGlobalTeam( tno );
	if ( pTeam )
	{
		return pTeam->GetScore();
	}
	else
	{
		Assert( false );
		return -1;
	}
}
Example #13
0
void CTeamMgr::SortPlayers(int nSortKey, int nDir)
{
	// Sort the players on each team...

	CTeam* pTeam = GetFirstTeam();

	while (pTeam)
	{
		pTeam->SortPlayers(nSortKey, nDir);

		pTeam = GetNextTeam(pTeam);
	}
}
//----------------------------------------------------------------------------
void cbClientMissionGroupWake( NLNET::CMessage& msgin, const std::string & serviceName, NLNET::TServiceId serviceId )
{
    CEntityId userId;
    msgin.serial(userId);

    uint8 missionGroupIndex;
    msgin.serial(missionGroupIndex);

    CCharacter * user = PlayerManager.getChar(userId);
    if ( !user || !user->getEnterFlag() )
        return;

    user->setAfkState(false);

    CTeam * team = TeamManager.getRealTeam( user->getTeamId() );
    if ( !team )
    {
        MISLOG("user:%s cbClientMissionGroupWake : Invalid team", userId.toString().c_str());
        return;
    }
    if ( team->getLeader() != userId )
    {
        return;
    }

    if ( missionGroupIndex >=  team->getMissions().size() )
    {
        MISLOG("user:%s cbClientMissionGroupWake : Invalid group mission %u ( count %u )",
               userId.toString().c_str(), missionGroupIndex, team->getMissions().size());
        return;
    }


    CMissionTeam* mission = team->getMissions()[missionGroupIndex];
    nlassert(mission);

    if ( mission->getFinished() == false )
    {
        CMissionTemplate * templ = CMissionManager::getInstance()->getTemplate( mission->getTemplateId() );
        if ( !templ )
        {
            MISLOG("user:%s cbClientGroupAbandonMission : invalid group mission alias %u",
                   userId.toString().c_str(), mission->getTemplateId());
            return;
        }

        CMissionQueueManager::getInstance()->playerWakesUp (userId, templ->Alias );
    }
}
CTFCGameRules::CTFCGameRules()
{
	CTF_Map = true;

#ifdef GAME_DLL
	// Create the team managers
	for ( int i = 0; i < ARRAYSIZE( teamnames ); i++ )
	{
		CTeam *pTeam = static_cast<CTeam*>(CreateEntityByName( "tfc_team_manager" ));
		pTeam->Init( teamnames[i], i );

		g_Teams.AddToTail( pTeam );
	}
#endif
}
Example #16
0
CTeam* CTeamManager::Create(CElement* pParent, CXMLNode* pNode, char* szName, unsigned char ucRed, unsigned char ucGreen, unsigned char ucBlue)
{
    // Create the team
    CTeam* pTeam = new CTeam(this, pParent, pNode, szName, ucRed, ucGreen, ucBlue);

    // Invalid Team id?
    if (pTeam->GetID() == INVALID_ELEMENT_ID)
    {
        delete pTeam;
        return NULL;
    }

    // Return the created Team
    return pTeam;
}
Example #17
0
CTeam* CTeamManager::CreateFromXML(CElement* pParent, CXMLNode& Node, CEvents* pEvents)
{
    // Create the Team
    CTeam* pTeam = new CTeam(this, pParent, &Node);

    // Verify the Team id and load the data from xml
    if (pTeam->GetID() == INVALID_ELEMENT_ID || !pTeam->LoadFromCustomData(pEvents))
    {
        delete pTeam;
        return NULL;
    }

    // Return the created Team
    return pTeam;
}
Example #18
0
LTBOOL CTeamMgr::RemovePlayer(uint32 dwPlayerID)
{
	// Find the team this player is on...

	CTeam* pTeam = GetTeamFromPlayerID(dwPlayerID);
    if (!pTeam) return(LTFALSE);


	// Remove the player from our team-trans list...

	RemoveTeamTransID(dwPlayerID);


	// Remove the player from this team...

	return(pTeam->RemovePlayer(dwPlayerID));
}
Example #19
0
void CSDKGameRules::InitTeams( void )
{
	Assert( g_Teams.Count() == 0 );

	g_Teams.Purge();	// just in case

#if defined ( SDK_USE_PLAYERCLASSES )
	// clear the player class data
	ResetFilePlayerClassInfoDatabase();
#endif // SDK_USE_PLAYERCLASSES

	// Create the team managers

	//Tony; we have a special unassigned team incase our mod is using classes but not teams.
	CTeam *pUnassigned = static_cast<CTeam*>(CreateEntityByName( "sdk_team_unassigned" ));
	Assert( pUnassigned );
	pUnassigned->Init( pszTeamNames[TEAM_UNASSIGNED], TEAM_UNASSIGNED );
	g_Teams.AddToTail( pUnassigned );

	//Tony; just use a plain ole sdk_team_manager for spectators
	CTeam *pSpectator = static_cast<CTeam*>(CreateEntityByName( "sdk_team_manager" ));
	Assert( pSpectator );
	pSpectator->Init( pszTeamNames[TEAM_SPECTATOR], TEAM_SPECTATOR );
	g_Teams.AddToTail( pSpectator );

	//Tony; don't create these two managers unless teams are being used!
#if defined ( SDK_USE_TEAMS )
	//Tony; create the blue team
	CTeam *pBlue = static_cast<CTeam*>(CreateEntityByName( "sdk_team_blue" ));
	Assert( pBlue );
	pBlue->Init( pszTeamNames[SDK_TEAM_BLUE], SDK_TEAM_BLUE );
	g_Teams.AddToTail( pBlue );

	//Tony; create the red team
	CTeam *pRed = static_cast<CTeam*>(CreateEntityByName( "sdk_team_red" ));
	Assert( pRed );
	pRed->Init( pszTeamNames[SDK_TEAM_RED], SDK_TEAM_RED );
	g_Teams.AddToTail( pRed );
#else
	CTeam *pDeathmatch = static_cast<CTeam*>(CreateEntityByName( "sdk_team_deathmatch" ));
	Assert( pDeathmatch );
	pDeathmatch->Init( pszTeamNames[SDK_TEAM_BLUE], SDK_TEAM_BLUE );
	g_Teams.AddToTail( pDeathmatch );
#endif
}
//-----------------------------------------------------------------------------
// Purpose: Proxy that only sends data to team members
// Input  : *pStruct - 
//			*pData - 
//			*pOut - 
//			objectID - 
// Output : Returns true on success, false on failure.
//-----------------------------------------------------------------------------
void* SendProxy_OnlyToTeam( const SendProp *pProp, const void *pStruct, const void *pVarData, CSendProxyRecipients *pRecipients, int objectID )
{
	CBaseEntity *pEntity = (CBaseEntity*)pStruct;
	if ( pEntity )
	{
		CTeam *pTeam = pEntity->GetTeam();
		if ( pTeam )
		{
			pRecipients->ClearAllRecipients();
			for ( int i=0; i < pTeam->GetNumPlayers(); i++ )
				pRecipients->SetRecipient( pTeam->GetPlayer( i )->GetClientIndex() );
		
			return (void*)pVarData;
		}
	}

	return NULL;
}
Example #21
0
void CSDKPlayer::State_Enter_OBSERVER_MODE()
{
	// Always start a spectator session in roaming mode
	m_iObserverLastMode = OBS_MODE_ROAMING;

	if( m_hObserverTarget == NULL )
	{
		// find a new observer target
		CheckObserverSettings();
	}

	// Change our observer target to the nearest teammate
	CTeam *pTeam = GetGlobalTeam( GetTeamNumber() );

	CBasePlayer *pPlayer;
	Vector localOrigin = GetAbsOrigin();
	Vector targetOrigin;
	float flMinDist = FLT_MAX;
	float flDist;

	for ( int i=0;i<pTeam->GetNumPlayers();i++ )
	{
		pPlayer = pTeam->GetPlayer(i);

		if ( !pPlayer )
			continue;

		if ( !IsValidObserverTarget(pPlayer) )
			continue;

		targetOrigin = pPlayer->GetAbsOrigin();

		flDist = ( targetOrigin - localOrigin ).Length();

		if ( flDist < flMinDist )
		{
			m_hObserverTarget.Set( pPlayer );
			flMinDist = flDist;
		}
	}

	StartObserverMode( m_iObserverLastMode );
	PhysObjectSleep();
}
Example #22
0
void main()
{
	CFieldplayer* pMueller;
	pMueller = new CFieldplayer("Thomas", "Mueller");

	CFieldplayer Mueller("Thomas", "Mueller");
	CFieldplayer Aigner("Rainer", "Aigner");
	CFieldplayer Alaba("David", "Alaba");
	CFieldplayer Altntop("Hamit ", "Altntop");
	CFieldplayer Andersson("Patrik", "Andersson");
	CFieldplayer Arbinger("Fred", "Arbinger");
	CFieldplayer Aubynn("Jeffrey", "Aubynn");
	CFieldplayer Augenthaler("Klaus", "Augenthaler");
	CFieldplayer Aumann("Raimond", "Aumann");
	CFieldplayer Babbel("Markus", "Babbel");
	CFieldplayer Bacak("Stefan", "Bacak");
	CFieldplayer Backer("Sebastian", "Backer");
	CFieldplayer Badstuber("Holger", "Badstuber");
	CFieldplayer Ballack("Michael", "Ballack");
	CFieldplayer Barut("Barbaros", "Barut");
	CFieldplayer Basler("Mario", "Basler");
	CFieldplayer Baumjohann("Alexander", "Baumjohann");
	CFieldplayer Bayerschmidt("Uli", "Bayerschmidt");
	CFieldplayer Beckenbauer("Franz", " Beckenbauer");
	CFieldplayer Beierlorzer("Bertram", "Beierlorzer");
	CFieldplayer Bender("Manfred", " Bender");
	CFieldplayer Benfeld("Joachim", "Benfeld");
	CFieldplayer Bentil("Emanuel", " Bentil");

	CTeam BayernMuenchen;
	CTeam FCBarcelona;
	
	BayernMuenchen.addFieldplayer(pMueller);
	BayernMuenchen.addFieldplayer(&Aigner);

	CGame newGame;


	
	char* Name;


}
Example #23
0
//-----------------------------------------------------------------------------------------------------
int CFuncNavBlocker::DrawDebugTextOverlays( void )
{
	int offset = BaseClass::DrawDebugTextOverlays();

	if (m_debugOverlays & OVERLAY_TEXT_BIT) 
	{
		CFmtStr str;

		// FIRST_GAME_TEAM skips TEAM_SPECTATOR and TEAM_UNASSIGNED, so we can print
		// useful team names in a non-game-specific fashion.
		for ( int i=FIRST_GAME_TEAM; i<FIRST_GAME_TEAM + MAX_NAV_TEAMS; ++i )
		{
			if ( IsBlockingNav( i ) )
			{
				CTeam *team = GetGlobalTeam( i );
				if ( team )
				{
					EntityText( offset++, str.sprintf( "blocking team %s", team->GetName() ), 0 );
				}
				else
				{
					EntityText( offset++, str.sprintf( "blocking team %d", i ), 0 );
				}
			}
		}

		NavAreaCollector collector( true );
		Extent extent;
		extent.Init( this );
		TheNavMesh->ForAllAreasOverlappingExtent( collector, extent );

		for ( int i=0; i<collector.m_area.Count(); ++i )
		{
			CNavArea *area = collector.m_area[i];
			Extent areaExtent;
			area->GetExtent( &areaExtent );
			debugoverlay->AddBoxOverlay( vec3_origin, areaExtent.lo, areaExtent.hi, vec3_angle, 0, 255, 0, 10, NDEBUG_PERSIST_TILL_NEXT_SERVER );
		}
	}

	return offset;
}
int CLuaFunctionDefs::GetPlayersInTeam ( lua_State* luaVM )
{
    CTeam *pTeam;

    CScriptArgReader argStream ( luaVM );
    argStream.ReadUserData ( pTeam );

    if ( !argStream.HasErrors () )
    {
        lua_newtable ( luaVM );

        pTeam->GetPlayers ( luaVM );
        return 1;
    }
    else
        m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );

    lua_pushboolean ( luaVM, false );
    return 1;
}
Example #25
0
void CSF132FlagBase::OnScore()
{
	CTeam *pTeam = GetGlobalTeam((GetTeamNumber() == SDK_TEAM_RED) ? SDK_TEAM_BLUE : SDK_TEAM_RED);
	if ( !pTeam )
	{
		Error( "Flag has no team" );
	}

	pTeam->AddCapturePoints( FLAG_CLASSIC_CAPTURE_POINTS );

	switch( GetTeamNumber() )
	{
		case SDK_TEAM_BLUE:
			PlaySound( FLAG_RED_SCORE );
			break;

		case SDK_TEAM_RED:
			PlaySound( FLAG_BLUE_SCORE );
			break;
	}
}
Example #26
0
CTeam* CTeamMgr::GetTeam(uint32 dwTeamID)
{
	// Look for a team with the given ID...

	CTeam* pTeam = GetFirstTeam();

	while (pTeam)
	{
		if (pTeam->GetID() == dwTeamID)
		{
			return(pTeam);
		}

		pTeam = GetNextTeam(pTeam);
	}


	// If we get here, we didn't find the team...

	return(NULL);
}
//----------------------------------------------------------------------------
void cbClientGroupAbandonMission( NLNET::CMessage& msgin, const std::string &serviceName, NLNET::TServiceId serviceId )
{
    CEntityId userId;
    uint8 index;
    msgin.serial(userId,index);

    if (!checkPlayer(userId, "cbClientGroupAbandonMission")) return;
    CCharacter * user = PlayerManager.getChar( userId );

    user->setAfkState(false);
    CTeam * team = TeamManager.getRealTeam( user->getTeamId() );
    if ( !team )
    {
        MISLOG("user:%s cbClientGroupAbandonMission : Invalid team", userId.toString().c_str());
        return;
    }
    if ( team->getLeader() != userId )
    {
        CCharacter::sendDynamicSystemMessage( user->getEntityRowId(), "REQ_LEADER_TO_ABANDON_MISSION" );
        return;
    }

    if ( index >=  team->getMissions().size() )
    {
        MISLOG("user:%s cbClientGroupAbandonMission : Invalid group mission %u ( count %u )",
               userId.toString().c_str(), index, team->getMissions().size());
        return;
    }


    CMissionTeam* mission = team->getMissions()[index];
    nlassert(mission);

    if ( mission->getFinished() == false )
    {
        CMissionTemplate * templ = CMissionManager::getInstance()->getTemplate( mission->getTemplateId() );
        if ( !templ )
        {
            MISLOG("user:%s cbClientGroupAbandonMission : invalid group mission alias %u",
                   userId.toString().c_str(), mission->getTemplateId());
            return;
        }
        if ( templ->Tags.NonAbandonnable )
        {
            MISLOG("user:%s cbClientGroupAbandonMission : group mission alias %u is not abandonnable but user tries to abandon it",
                   userId.toString().c_str(), mission->getTemplateId());
            return;
        }
        set<CEntityId> excluded;
        excluded.insert( userId );

        team->sendDynamicMessageToMembers( "ABANDON_GROUP_MISSION",TVectorParamCheck(), excluded );
    }
    team->removeMission( index, mr_abandon );
}
Example #28
0
void CEventLog::FormatPlayer( CBaseEntity *ent, char *str, int len ) const
{
	if ( !str || len <= 0 )
	{
		return;
	}

	CBasePlayer *player = ToBasePlayer( ent );

	const char *playerName = "Unknown";
	int userID = 0;
	const char *networkIDString = "";
	const char *teamName = "";
	int areaID = 0;
	if ( player )
	{
		playerName = player->GetPlayerName();
		userID = player->GetUserID();
		networkIDString = player->GetNetworkIDString();
		CTeam *team = player->GetTeam();
		if ( team )
		{
			teamName = team->GetName();
		}
	}

#ifdef USE_NAV_MESH
	if ( ent && ent->MyCombatCharacterPointer() )
	{
		CNavArea *area = ent->MyCombatCharacterPointer()->GetLastKnownArea();
		if ( area )
		{
			areaID = area->GetID();
		}
	}
#endif // USE_NAV_MESH

	V_snprintf( str, len, "\"%s<%i><%s><%s><Area %d>\"", playerName, userID, networkIDString, teamName, areaID );
}
Example #29
0
//---------------------------------------------------
// PvP help occurs in a team
//---------------------------------------------------
void CTeamManager::pvpHelpOccursInTeam( CCharacter * actor, CCharacter * target )
{
	return;
	nlassert( actor );
	nlassert( target);
	CTeam * team = getRealTeam( actor->getTeamId() );
	if ( team != NULL )
	{
		//check if actor and target is not in same team
		if( actor->getTeamId() != target->getTeamId() )
		{
			// check if attack is in PvP faction context
			if( actor->getPVPFlag() && target->getPVPFlag() )
			{
				if( CPVPManager2::getInstance()->isFactionInWar( actor->getAllegiance().first ) || CPVPManager2::getInstance()->isFactionInWar( actor->getAllegiance().second ) )
				{
					// help is made in PvP faction context, on an external character of team
			
					// inform the kicked player
					SM_STATIC_PARAMS_1(params, STRING_MANAGER::player);	
					params[0].setEIdAIAlias( actor->getId(), CAIAliasTranslator::getInstance()->getAIAlias( actor->getId() ) );
					PHRASE_UTILITIES::sendDynamicSystemMessage(actor->getEntityRowId(), "TEAM_PVP_HELPER_KICKED_YOU", params);
					
					// inform other team members
					SM_STATIC_PARAMS_2(params2, STRING_MANAGER::player, STRING_MANAGER::player);	
					params2[0].setEIdAIAlias( actor->getId(), CAIAliasTranslator::getInstance()->getAIAlias( actor->getId() ) );
					params2[1].setEIdAIAlias( target->getId(), CAIAliasTranslator::getInstance()->getAIAlias( target->getId() ) );
					set<CEntityId> exclude;
					exclude.insert( actor->getId() );
					team->sendDynamicMessageToMembers("TEAM_PVP_HELPER_KICKED", params2, exclude);

					//  remove the kicked player from team	
					removeCharacter( actor->getId() );
				}
			}
		}
	}
}
void CTeamDeathMatchMissionMgr::Update()
{
	// Check the teams to see if any of them have reached the score limit...
	
	if( m_ServerSettings.m_nScoreLimit > 0 && m_fStartTime >= 0.0f )
	{
		for( uint8 i = 0; i < CTeamMgr::Instance().GetNumTeams(); ++i )
		{
			CTeam *pTeam = CTeamMgr::Instance().GetTeam( i );
			if( pTeam && (pTeam->GetScore() >= m_ServerSettings.m_nScoreLimit) )
			{
				CTeamMgr::Instance( ).WonRound( i );
				g_pLTServer->CPrint( "ScoreLimit reached." );
				NextRound();
			}
		}
	}


	// Skip the CDeathMatchMissionMgr::Update() but be sure to call up...

	CServerMissionMgr::Update( );
}