////////////////////////////////////////////////////////////////////////////////////////// ///This function handles CMSG_GROUP_UNINVITE_GUID(used since 3.1.3): ////////////////////////////////////////////////////////////////////////////////////////// void WorldSession::HandleGroupUninviteGuidOpcode(WorldPacket & recv_data) { CHECK_INWORLD_RETURN; CHECK_PACKET_SIZE(recv_data, 1); uint64 PlayerGUID; std::string membername = "unknown"; Group* group; Player* player; PlayerInfo* info; recv_data >> PlayerGUID; player = objmgr.GetPlayer(Arcemu::Util::GUID_LOPART(PlayerGUID)); info = objmgr.GetPlayerInfo(Arcemu::Util::GUID_LOPART(PlayerGUID)); // If both conditions match the player gets thrown out of the group by the server since this means the character is deleted if(player == NULL && info == NULL) { SendPartyCommandResult(_player, 0, membername, ERR_PARTY_CANNOT_FIND); return; } membername = player ? player->GetName() : info->name; if(!_player->InGroup() || (info != NULL && info->m_Group != _player->GetGroup())) { SendPartyCommandResult(_player, 0, membername, ERR_PARTY_IS_NOT_IN_YOUR_PARTY); return; } if(!_player->IsGroupLeader()) { if(player == NULL) { SendPartyCommandResult(_player, 0, membername, ERR_PARTY_CANNOT_FIND); return; } else if(_player != player) { SendPartyCommandResult(_player, 0, "", ERR_PARTY_YOU_ARE_NOT_LEADER); return; } } group = _player->GetGroup(); if(group != NULL) { group->RemovePlayer(info); } }
void WorldSession::HandleGroupAssistantLeader(WorldPacket & recv_data) { uint64 guid; uint8 on; if(!_player->IsInWorld()) return; if(_player->GetGroup() == NULL) return; if ( _player->GetGroup()->GetLeader() != _player->m_playerInfo ) //access denied { SendPartyCommandResult(_player, 0, "", ERR_PARTY_YOU_ARE_NOT_LEADER); return; } recv_data >> guid >> on; if(on == 0) _player->GetGroup()->SetAssistantLeader(NULL); else { PlayerInfo * np = objmgr.GetPlayerInfo((uint32)guid); if(np== NULL) _player->GetGroup()->SetAssistantLeader(NULL); else { if(_player->GetGroup()->HasMember(np)) _player->GetGroup()->SetAssistantLeader(np); } } }
void WorldSession::HandleConvertGroupToRaidOpcode(WorldPacket & recv_data) { if(!_player->IsInWorld()) return; // This is just soooo easy now Group *pGroup = _player->GetGroup(); if(!pGroup) return; if ( pGroup->GetLeader() != _player->m_playerInfo ) //access denied { SendPartyCommandResult(_player, 0, "", ERR_PARTY_YOU_ARE_NOT_LEADER); return; } pGroup->ExpandToRaid(); SendPartyCommandResult(_player, 0, "", ERR_PARTY_NO_ERROR); }
////////////////////////////////////////////////////////////////////////////////////////// ///This function handles CMSG_LOOT_METHOD: ////////////////////////////////////////////////////////////////////////////////////////// void WorldSession::HandleLootMethodOpcode(WorldPacket & recv_data) { CHECK_INWORLD_RETURN; CHECK_PACKET_SIZE(recv_data, 16); uint32 lootMethod; uint64 lootMaster; uint32 threshold; recv_data >> lootMethod >> lootMaster >> threshold; if(!_player->IsGroupLeader()) { SendPartyCommandResult(_player, 0, "", ERR_PARTY_YOU_ARE_NOT_LEADER); return; } Group* pGroup = _player->GetGroup(); if(pGroup == NULL) return; Player* plr = objmgr.GetPlayer((uint32)lootMaster); if(plr != NULL) { pGroup->SetLooter(plr, static_cast<uint8>(lootMethod), static_cast<uint16>(threshold)); } else { pGroup->SetLooter(_player, static_cast<uint8>(lootMethod), static_cast<uint16>(threshold)); } }
////////////////////////////////////////////////////////////////////////////////////////// ///This function handles CMSG_LOOT_METHOD: ////////////////////////////////////////////////////////////////////////////////////////// void WorldSession::HandleLootMethodOpcode( WorldPacket & recv_data ) { if(!_player->IsInWorld()) { return; } CHECK_PACKET_SIZE(recv_data, 16); uint32 lootMethod; uint64 lootMaster; uint32 threshold; recv_data >> lootMethod >> lootMaster >>threshold; if(!_player->IsGroupLeader()) { SendPartyCommandResult(_player, 0, "", ERR_PARTY_YOU_ARE_NOT_LEADER); return; } Group* pGroup = _player->GetGroup(); if( pGroup == NULL) { return; } Player * pLootMaster = objmgr.GetPlayer((uint32)lootMaster); if ( pLootMaster ) pGroup->SetLooter(pLootMaster , lootMethod, threshold ); else pGroup->SetLooter(_player , lootMethod, threshold ); }
////////////////////////////////////////////////////////////////////////////////////////// ///This function handles CMSG_GROUP_UNINVITE(unused since 3.1.3): ////////////////////////////////////////////////////////////////////////////////////////// void WorldSession::HandleGroupUninviteOpcode(WorldPacket & recv_data) { CHECK_INWORLD_RETURN; CHECK_PACKET_SIZE(recv_data, 1); std::string membername; Group* group; Player* player; PlayerInfo* info; recv_data >> membername; player = objmgr.GetPlayer(membername.c_str(), false); info = objmgr.GetPlayerInfoByName(membername.c_str()); if(player == NULL && info == NULL) { SendPartyCommandResult(_player, 0, membername, ERR_PARTY_CANNOT_FIND); return; } if(!_player->InGroup() || (info != NULL && info->m_Group != _player->GetGroup())) { SendPartyCommandResult(_player, 0, membername, ERR_PARTY_IS_NOT_IN_YOUR_PARTY); return; } if(!_player->IsGroupLeader()) { if(player == NULL) { SendPartyCommandResult(_player, 0, membername, ERR_PARTY_CANNOT_FIND); return; } else if(_player != player) { SendPartyCommandResult(_player, 0, "", ERR_PARTY_YOU_ARE_NOT_LEADER); return; } } group = _player->GetGroup(); if(group != NULL) { group->RemovePlayer(info); } }
////////////////////////////////////////////////////////////////////////////////////////// ///This function handles CMSG_GROUP_UNINVITE: ////////////////////////////////////////////////////////////////////////////////////////// void WorldSession::HandleGroupUninviteOpcode( WorldPacket & recv_data ) { if(!_player->IsInWorld()) return; CHECK_PACKET_SIZE(recv_data, 1); std::string membername; Group *group; Player * player; PlayerInfo * info; recv_data >> membername; player = objmgr.GetPlayer(membername.c_str(), false); info = objmgr.GetPlayerInfoByName(membername.c_str()); if ( player == NULL && info == NULL ) { SendPartyCommandResult(_player, 0, membername, ERR_PARTY_CANNOT_FIND); return; } if ( !_player->InGroup() || info->m_Group != _player->GetGroup() ) { SendPartyCommandResult(_player, 0, membername, ERR_PARTY_IS_NOT_IN_YOUR_PARTY); return; } if ( !_player->IsGroupLeader() || info->m_Group->HasFlag(GROUP_FLAG_BATTLEGROUND_GROUP) ) // bg group { if(_player != player) { SendPartyCommandResult(_player, 0, "", ERR_PARTY_YOU_ARE_NOT_LEADER); return; } } if(_player->m_bg) return; group = _player->GetGroup(); if(group) group->RemovePlayer(info); }
////////////////////////////////////////////////////////////////////////////////////////// ///This function handles CMSG_GROUP_SET_LEADER: ////////////////////////////////////////////////////////////////////////////////////////// void WorldSession::HandleGroupSetLeaderOpcode( WorldPacket & recv_data ) { if(!_player->IsInWorld()) { return; } // important note _player->GetName() can be wrong. CHECK_PACKET_SIZE(recv_data, 1); uint64 MemberGuid; Player * player; recv_data >> MemberGuid; player = objmgr.GetPlayer((uint32)MemberGuid); if ( player == NULL ) { //SendPartyCommandResult(_player, 0, membername, ERR_PARTY_CANNOT_FIND); SendPartyCommandResult(_player, 0, _player->GetName(), ERR_PARTY_CANNOT_FIND); return; } if(!_player->IsGroupLeader()) { SendPartyCommandResult(_player, 0, "", ERR_PARTY_YOU_ARE_NOT_LEADER); return; } if(player->GetGroup() != _player->GetGroup()) { //SendPartyCommandResult(_player, 0, membername, ERR_PARTY_IS_NOT_IN_YOUR_PARTY); SendPartyCommandResult(_player, 0, _player->GetName(), ERR_PARTY_IS_NOT_IN_YOUR_PARTY); return; } Group *pGroup = _player->GetGroup(); if(pGroup) pGroup->SetLeader(player,false); }
////////////////////////////////////////////////////////////////////////////////////////// ///This function handles CMSG_GROUP_UNINVITE: ////////////////////////////////////////////////////////////////////////////////////////// void WorldSession::HandleGroupUninviteOpcode( WorldPacket & recv_data ) { if(!_player->IsInWorld()) return; CHECK_PACKET_SIZE(recv_data, 1); WorldPacket data; std::string membername; Group *group; Player * player; recv_data >> membername; player = objmgr.GetPlayer(membername.c_str(), false); if ( player == NULL ) { SendPartyCommandResult(_player, 0, membername, ERR_PARTY_CANNOT_FIND); return; } if ( !_player->InGroup() || _player->GetGroup() != player->GetGroup() ) { SendPartyCommandResult(_player, 0, membername, ERR_PARTY_IS_NOT_IN_YOUR_PARTY); return; } if ( !_player->IsGroupLeader() ) { if(_player != player) { SendPartyCommandResult(_player, 0, "", ERR_PARTY_YOU_ARE_NOT_LEADER); return; } } group = _player->GetGroup(); if(group) group->RemovePlayer(player); }
void WorldSession::HandleGroupPromote(WorldPacket& recv_data) { CHECK_INWORLD_RETURN; uint8 promotetype, on; uint64 guid; if(_player->GetGroup() == NULL) return; if ( _player->GetGroup()->GetLeader() != _player->m_playerInfo ) //access denied { SendPartyCommandResult(_player, 0, "", ERR_PARTY_YOU_ARE_NOT_LEADER); return; } recv_data >> promotetype >> on; recv_data >> guid; void(Group::*function_to_call)(PlayerInfo*) = NULL; if(promotetype == 0) function_to_call = &Group::SetMainTank; else if(promotetype==1) function_to_call = &Group::SetMainAssist; if(function_to_call == NULL) return; if(on == 0) (_player->GetGroup()->*function_to_call)(NULL); else { PlayerInfo * np = objmgr.GetPlayerInfo((uint32)guid); if(np==NULL) (_player->GetGroup()->*function_to_call)(NULL); else { if(_player->GetGroup()->HasMember(np)) (_player->GetGroup()->*function_to_call)(np); } } }
////////////////////////////////////////////////////////////////////////////////////////// ///This function handles CMSG_LOOT_METHOD: ////////////////////////////////////////////////////////////////////////////////////////// void WorldSession::HandleLootMethodOpcode( WorldPacket & recv_data ) { if(!_player->IsInWorld()) return; CHECK_PACKET_SIZE(recv_data, 16); uint32 lootMethod; uint64 lootMaster; uint32 threshold; recv_data >> lootMethod >> lootMaster >>threshold; if(!_player->IsGroupLeader()) { SendPartyCommandResult(_player, 0, "", ERR_PARTY_YOU_ARE_NOT_LEADER); return; } // TODO: fix me burlex //PlayerPointer plyr = objmgr.GetPlayer((uint32)lootMaster); //if(!plyr)return; Group* pGroup = _player->GetGroup(); if( pGroup != NULL) pGroup->SetLooter( _player, lootMethod, threshold ); }
////////////////////////////////////////////////////////////// /// 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; Player * player = NULL; 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() ) { 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); return; } if(player->GetTeam()!=_player->GetTeam() && _player->GetSession()->GetPermissionCount() == 0) { 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; } // 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 << 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()); }
////////////////////////////////////////////////////////////// /// This function handles CMSG_GROUP_INVITE ////////////////////////////////////////////////////////////// void WorldSession::HandleGroupInviteOpcode(WorldPacket & recv_data) { CHECK_INWORLD_RETURN; CHECK_PACKET_SIZE(recv_data, 1); WorldPacket data(100); std::string membername; Group* group = NULL; recv_data >> membername; if(_player->HasBeenInvited()) return; Player* 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->GetMapId() == 750 || _player->GetMapId() == 750) return; if(_player->InGroup() && !_player->IsGroupLeader()) { 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.interfaction_group) { 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->HasFlag(PLAYER_FLAGS, PLAYER_FLAG_GM) && !_player->GetSession()->HasPermissions()) { SendPartyCommandResult(_player, 0, membername, ERR_PARTY_CANNOT_FIND); return; } data.SetOpcode(SMSG_GROUP_INVITE); data << uint8(1); data << GetPlayer()->GetName(); player->GetSession()->SendPacket(&data); SendPartyCommandResult(_player, 0, 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()); }
////////////////////////////////////////////////////////////// /// This function handles CMSG_GROUP_INVITE ////////////////////////////////////////////////////////////// void WorldSession::HandleGroupInviteOpcode( WorldPacket & recv_data ) { if(!_player->IsInWorld()) { return; } CHECK_PACKET_SIZE(recv_data, 1); std::string membername; Player * player = NULL; Group *group = NULL; recv_data.read_skip( 10 ); //no idea, they were all 0 recv_data >> membername; //tried to make sure the other guy can't accept the invited /* 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() ) { 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); return; } if(player->GetTeam()!=_player->GetTeam() && _player->GetSession()->GetPermissionCount() == 0 && !sWorld.interfaction_group) { SendPartyCommandResult(_player, 0, membername, ERR_PARTY_WRONG_FACTION); return; } //tried to make sure the other guy can't accept the invited /* 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; } /* {SERVER} Packet: (0x1F7F) SMSG_GROUP_INVITE PacketSize = 16 TimeStamp = 30686468 01 55 64 72 65 61 00 AA 2A 00 00 00 00 00 00 00 14333 {SERVER} Packet: (0x4723) UNKNOWN PacketSize = 44 TimeStamp = 17757047 4E E0 1001110 11100000 6F 00 00 00 03 go3 00 00 00 00 00 00 00 00 4C go2 44 75 6E 65 6D 61 75 6C 00 Dunemaul 00 00 00 00 41 6E 61 72 6B 65 00 Anarke 00 1F 59 15 00 go7 AF go1 81 go6 EB go0 {SERVER} Packet: (0xFA67) SMSG_NAME_QUERY_RESPONSE PacketSize = 20 TimeStamp = 17676894 CF EA AE 4D 02 80 01 00 41 6E 61 72 6B 65 00 00 02 00 06 00 {SERVER} Packet: (0x4723) UNKNOWN PacketSize = 46 TimeStamp = 18686064 4E E0 6F 00 00 00 00 00 00 00 00 42 00 00 00 81 44 75 6E 65 6D 61 75 6C 00 00 00 00 00 44 72 61 69 73 69 75 73 00 00 69 E3 1F 00 B0 81 F7 11001111 {SERVER} Packet: (0xFA67) SMSG_NAME_QUERY_RESPONSE PacketSize = 22 TimeStamp = 18570343 CF F6 B1 80 01 80 01 00 44 72 61 69 73 69 75 73 00 00 0A 00 03 00 */ uint64 inviter_guid = _player->GetGUID(); uint8 *guid_bytes = (uint8*)&inviter_guid; uint16 guid_mask = 0; //!!not confirmed, but seems to work ! /* if( guid_bytes[0] ) guid_mask |= BIT_0; if( guid_bytes[1] ) guid_mask |= BIT_1; if( guid_bytes[2] ) guid_mask |= BIT_2; if( guid_bytes[3] ) guid_mask |= BIT_3;*/ guid_mask = 0xE04E; sStackWorldPacket( data,SMSG_GROUP_INVITE, 100); data << uint16(guid_mask);//guid mask data << uint32( 0 ); //? // if( guid_bytes[3] ) data << ObfuscateByte( guid_bytes[3] ); data << uint32( 0x00000000 ); data << uint32( 0x00000000 ); // if( guid_bytes[2] ) data << ObfuscateByte( guid_bytes[2] ); data << ""; //realm name data << uint32( 0x00000000 ); data << GetPlayer()->GetName(); data << uint32( 0 ); // if( guid_bytes[7] ) data << ObfuscateByte( guid_bytes[7] ); // if( guid_bytes[1] ) data << ObfuscateByte( guid_bytes[1] ); // if( guid_bytes[6] ) data << ObfuscateByte( guid_bytes[6] ); // if( guid_bytes[0] ) data << ObfuscateByte( guid_bytes[0] ); 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() ); // 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 }