//----------------------------------------------------------------------------- // Purpose: New client was added to the arena //----------------------------------------------------------------------------- void CDiscArena::AddClient( CBasePlayer *pPlayer, BOOL bCheckStart ) { // Remove them from any arena they're currently in if ( pPlayer->m_pCurrentArena != NULL ) pPlayer->m_pCurrentArena->RemoveClient( pPlayer ); m_iPlayers++; pPlayer->pev->groupinfo = pev->groupinfo; // Add her to the queue AddPlayerToQueue( pPlayer ); pPlayer->m_pCurrentArena = this; // Only check a restart if the flag is set if ( bCheckStart ) { // Start a game if there's none going, and we now have enough players // Allow starting of games if there aren't enough players, but there's more than 1 on the svr. //if ( (m_iPlayersPerTeam > 1) && (m_iPlayers > 1) && (m_iPlayers < (m_iPlayersPerTeam * 2)) ) //m_iPlayersPerTeam = 1; // If we're in a battle, and the players-per-team isn't the map's setting, restart the battle if ( (m_iArenaState == ARENA_WAITING_FOR_PLAYERS) && ( m_iPlayers >= (m_iPlayersPerTeam * 2) ) ) { // Start a battle in a second to let the clients learn about this new player SetThink( &CDiscArena::StartBattleThink ); pev->nextthink = gpGlobals->time + 1.0; } else { // Move her into spectator mode MoveToSpectator( pPlayer ); } } }
void WorldSession::HandleMeetingStoneJoinOpcode(WorldPacket & recv_data) { ObjectGuid guid; recv_data >> guid; DEBUG_LOG("WORLD: Recvd CMSG_MEETINGSTONE_JOIN Message guid: %s", guid.GetString().c_str()); // ignore for remote control state if (!_player->IsSelfMover()) return; GameObject *obj = GetPlayer()->GetMap()->GetGameObject(guid); if (!obj) return; // Never expect this opcode for some type GO's if (obj->GetGoType() != GAMEOBJECT_TYPE_MEETINGSTONE) { sLog.outError("HandleMeetingStoneJoinOpcode: CMSG_MEETINGSTONE_JOIN for not allowed GameObject type %u (Entry %u), didn't expect this to happen.", obj->GetGoType(), obj->GetEntry()); return; } GameObjectInfo const *gInfo = ObjectMgr::GetGameObjectInfo(obj->GetEntry()); if (Group *grp = _player->GetGroup()) { if(!grp->IsLeader(_player->GetGUID())) { SendMeetingstoneFailed(MEETINGSTONE_FAIL_PARTYLEADER); obj->Use(_player); return; } if(grp->isRaidGroup()) { SendMeetingstoneFailed(MEETINGSTONE_FAIL_RAID_GROUP); obj->Use(_player); return; } if(grp->IsFull()) { SendMeetingstoneFailed(MEETINGSTONE_FAIL_FULL_GROUP); obj->Use(_player); return; } } SendMeetingstoneSetqueue(gInfo->meetingstone.areaID, MEETINGSTONE_STATUS_JOINED_QUEUE); if (Group *grp = _player->GetGroup()) { AddGroupToQueue(grp->GetId(), gInfo->meetingstone.areaID); } else { AddPlayerToQueue(_player, gInfo->meetingstone.areaID); } LFGLoop(); obj->Use(_player); }