//////////////////////////////////////////////////////////////// ///This function handles CMSG_GROUP_ACCEPT: //////////////////////////////////////////////////////////////// void WorldSession::HandleGroupAcceptOpcode( WorldPacket & recv_data ) { if(!_player->IsInWorld()) return; PlayerPointer player = objmgr.GetPlayer(_player->GetInviter()); if ( !player ) return; player->SetInviter(0); _player->SetInviter(0); Group *grp = player->GetGroup(); if(grp) { grp->AddMember(_player->m_playerInfo); if(grp->GetLeader()->m_loggedInPlayer) _player->iInstanceType = grp->GetLeader()->m_loggedInPlayer->iInstanceType; _player->GetSession()->OutPacket(MSG_SET_DUNGEON_DIFFICULTY, 4, &_player->iInstanceType); return; } // If we're this far, it means we have no existing group, and have to make one. grp = new Group(true); grp->AddMember(player->m_playerInfo); // add the inviter first, therefore he is the leader grp->AddMember(_player->m_playerInfo); // add us. _player->iInstanceType = player->iInstanceType; _player->GetSession()->OutPacket(MSG_SET_DUNGEON_DIFFICULTY, 4, &player->iInstanceType); }
/////////////////////////////////////////////////////////////////////////////////////// ///This function handles CMSG_GROUP_DECLINE: ////////////////////////////////////////////////////////////////////////////////////// void WorldSession::HandleGroupDeclineOpcode( WorldPacket & recv_data ) { if(!_player->IsInWorld()) return; WorldPacket data(SMSG_GROUP_DECLINE, 100); PlayerPointer player = objmgr.GetPlayer(_player->GetInviter()); if(!player) return; data << GetPlayer()->GetName(); player->GetSession()->SendPacket( &data ); player->SetInviter(0); _player->SetInviter(0); }
////////////////////////////////////////////////////////////// /// This function handles CMSG_GROUP_INVITE ////////////////////////////////////////////////////////////// void WorldSession::HandleGroupInviteOpcode( WorldPacket & recv_data ) { if(!_player->IsInWorld()) return; CHECK_PACKET_SIZE(recv_data, 1); WorldPacket data(100); std::string membername; PlayerPointer player = NULLPLR; Group *group = NULL; recv_data >> membername; if(_player->HasBeenInvited())return; player = objmgr.GetPlayer(membername.c_str(), false); if ( player == NULL) { SendPartyCommandResult(_player, 0, membername, ERR_PARTY_CANNOT_FIND); return; } if (player == _player) { return; } if ( _player->InGroup() && (!_player->IsGroupLeader() || _player->GetGroup()->HasFlag(GROUP_FLAG_BATTLEGROUND_GROUP) ) ) { SendPartyCommandResult(_player, 0, "", ERR_PARTY_YOU_ARE_NOT_LEADER); return; } group = _player->GetGroup(); if ( group != NULL ) { if (group->IsFull()) { SendPartyCommandResult(_player, 0, "", ERR_PARTY_IS_FULL); return; } } if ( player->InGroup() ) { SendPartyCommandResult(_player, player->GetGroup()->GetGroupType(), membername, ERR_PARTY_ALREADY_IN_GROUP); data.SetOpcode(SMSG_GROUP_INVITE); data << uint8(0); data << GetPlayer()->GetName(); player->GetSession()->SendPacket(&data); return; } if(player->GetTeam()!=_player->GetTeam() && _player->GetSession()->GetPermissionCount() == 0 && !sWorld.cross_faction_world) { SendPartyCommandResult(_player, 0, membername, ERR_PARTY_WRONG_FACTION); return; } if ( player->HasBeenInvited() ) { SendPartyCommandResult(_player, 0, membername, ERR_PARTY_ALREADY_IN_GROUP); return; } if( player->Social_IsIgnoring( _player->GetLowGUID() ) ) { SendPartyCommandResult(_player, 0, membername, ERR_PARTY_IS_IGNORING_YOU); return; } if( player->bGMTagOn && !_player->GetSession()->HasPermissions()) { SendPartyCommandResult(_player, 0, membername, ERR_PARTY_CANNOT_FIND); return; } // 16/08/06 - change to guid to prevent very unlikely event of a crash in deny, etc _player->SetInviter(_player->GetLowGUID());//bugfix if player invtied 2 people-> he can be in 2 parties data.SetOpcode(SMSG_GROUP_INVITE); data << uint8(1); data << GetPlayer()->GetName(); player->GetSession()->SendPacket(&data); uint32 gtype = 0; if(group) gtype = group->GetGroupType(); SendPartyCommandResult(_player, gtype, membername, ERR_PARTY_NO_ERROR); // 16/08/06 - change to guid to prevent very unlikely event of a crash in deny, etc player->SetInviter(_player->GetLowGUID()); }