//--------------------------------------------------- // joinLeagueAccept : //--------------------------------------------------- void CTeamManager::joinLeagueAccept( const NLMISC::CEntityId &charId) { // get the invited char CCharacter * invited = PlayerManager.getOnlineChar(charId); if ( invited == NULL ) { nlwarning("<CTeamManager joinLeagueAccept>Invalid char %s",charId.toString().c_str()); return; } // get the invitor id const NLMISC::CEntityId & invitorId = invited->getLeagueInvitor(); if ( invitorId == CEntityId::Unknown ) { nlwarning("<CTeamManager joinLeagueAccept>character %s has an Invalid invitor",charId.toString().c_str()); return; } //get the invitor char CCharacter * invitor = PlayerManager.getOnlineChar(invitorId); if ( invitor == NULL ) { nlwarning("<CTeamManager joinLeagueAccept>character %s, Invalid invitor id %s",charId.toString().c_str(),invitorId.toString().c_str()); invited->setLeagueInvitor( CEntityId::Unknown ); return; } invitor->setAfkState(false); //cancel the proposal invited->setLeagueInvitor( CEntityId::Unknown ); CTeam *teamInvitor; CTeam *teamInvited; //if the invited player had a fake team, remove it teamInvited = getRealTeam(invited->getTeamId()); teamInvitor = getRealTeam(invitor->getTeamId()); if ( !teamInvitor ) { nlwarning("<CTeamManager joinLeagueAccept>character %s, invitor id %s, the invited or invitor player is not in a valid team. ",charId.toString().c_str(),invitor->getId().toString().c_str() ); return; } // check that the invitor team have league else create them if (teamInvitor->getLeagueId() == DYN_CHAT_INVALID_CHAN ) { teamInvitor->setLeague("League"); } if (teamInvited) { const string playerName = CEntityIdTranslator::getInstance()->getByEntity(invited->getId()).toString(); CPVPManager2::getInstance()->broadcastMessage(teamInvitor->getLeagueId(), string("<TEAM>"), "<-- "+playerName); teamInvited->setLeagueId(teamInvitor->getLeagueId()); teamInvited->updateLeague(); } else { const string playerName = CEntityIdTranslator::getInstance()->getByEntity(invited->getId()).toString(); CPVPManager2::getInstance()->broadcastMessage(teamInvitor->getLeagueId(), string("<PLAYER>"), "<-- "+playerName); invited->setLeagueId(teamInvitor->getLeagueId(), true); } } // joinLeagueAccept //