[9342] Fixed group creating :(

Also prevent not read tail packet spam in soem cases in group handlers.
This commit is contained in:
VladimirMangos 2010-02-09 16:59:59 +03:00
parent c49771337c
commit c2f8d39920
4 changed files with 51 additions and 42 deletions

View file

@ -93,6 +93,8 @@ bool Group::Create(const uint64 &guid, const char * name)
m_raidDifficulty = RAID_DIFFICULTY_10MAN_NORMAL; m_raidDifficulty = RAID_DIFFICULTY_10MAN_NORMAL;
if(!isBGGroup()) if(!isBGGroup())
{ {
m_Id = sObjectMgr.GenerateGroupId();
Player *leader = sObjectMgr.GetPlayer(guid); Player *leader = sObjectMgr.GetPlayer(guid);
if(leader) if(leader)
{ {
@ -116,10 +118,7 @@ bool Group::Create(const uint64 &guid, const char * name)
return false; return false;
if(!isBGGroup()) if(!isBGGroup())
{
CharacterDatabase.CommitTransaction(); CharacterDatabase.CommitTransaction();
m_Id = sObjectMgr.GenerateGroupId();
}
return true; return true;
} }
@ -438,7 +437,6 @@ void Group::Disband(bool hideDestroy)
ResetInstances(INSTANCE_RESET_GROUP_DISBAND, true, NULL); ResetInstances(INSTANCE_RESET_GROUP_DISBAND, true, NULL);
} }
m_Id = 0;
m_leaderGuid = 0; m_leaderGuid = 0;
m_leaderName = ""; m_leaderName = "";
} }
@ -1218,8 +1216,6 @@ void Group::_setLeader(const uint64 &guid)
CharacterDatabase.CommitTransaction(); CharacterDatabase.CommitTransaction();
} }
uint32 old_guidlow = GUID_LOPART(m_leaderGuid);
m_leaderGuid = slot->guid; m_leaderGuid = slot->guid;
m_leaderName = slot->name; m_leaderName = slot->name;
} }

View file

@ -206,7 +206,8 @@ void WorldSession::HandleGroupAcceptOpcode( WorldPacket & recv_data )
void WorldSession::HandleGroupDeclineOpcode( WorldPacket & /*recv_data*/ ) void WorldSession::HandleGroupDeclineOpcode( WorldPacket & /*recv_data*/ )
{ {
Group *group = GetPlayer()->GetGroupInvite(); Group *group = GetPlayer()->GetGroupInvite();
if (!group) return; if (!group)
return;
// remember leader if online // remember leader if online
Player *leader = sObjectMgr.GetPlayer(group->GetLeaderGUID()); Player *leader = sObjectMgr.GetPlayer(group->GetLeaderGUID());
@ -305,13 +306,13 @@ void WorldSession::HandleGroupUninviteOpcode(WorldPacket & recv_data)
void WorldSession::HandleGroupSetLeaderOpcode( WorldPacket & recv_data ) void WorldSession::HandleGroupSetLeaderOpcode( WorldPacket & recv_data )
{ {
uint64 guid;
recv_data >> guid;
Group *group = GetPlayer()->GetGroup(); Group *group = GetPlayer()->GetGroup();
if(!group) if(!group)
return; return;
uint64 guid;
recv_data >> guid;
Player *player = sObjectMgr.GetPlayer(guid); Player *player = sObjectMgr.GetPlayer(guid);
/** error handling **/ /** error handling **/
@ -345,15 +346,15 @@ void WorldSession::HandleGroupDisbandOpcode( WorldPacket & /*recv_data*/ )
void WorldSession::HandleLootMethodOpcode( WorldPacket & recv_data ) void WorldSession::HandleLootMethodOpcode( WorldPacket & recv_data )
{ {
Group *group = GetPlayer()->GetGroup();
if(!group)
return;
uint32 lootMethod; uint32 lootMethod;
uint64 lootMaster; uint64 lootMaster;
uint32 lootThreshold; uint32 lootThreshold;
recv_data >> lootMethod >> lootMaster >> lootThreshold; recv_data >> lootMethod >> lootMaster >> lootThreshold;
Group *group = GetPlayer()->GetGroup();
if(!group)
return;
/** error handling **/ /** error handling **/
if(!group->IsLeader(GetPlayer()->GetGUID())) if(!group->IsLeader(GetPlayer()->GetGUID()))
return; return;
@ -368,9 +369,6 @@ void WorldSession::HandleLootMethodOpcode( WorldPacket & recv_data )
void WorldSession::HandleLootRoll( WorldPacket &recv_data ) void WorldSession::HandleLootRoll( WorldPacket &recv_data )
{ {
if(!GetPlayer()->GetGroup())
return;
uint64 Guid; uint64 Guid;
uint32 NumberOfPlayers; uint32 NumberOfPlayers;
uint8 rollType; uint8 rollType;
@ -400,13 +398,13 @@ void WorldSession::HandleLootRoll( WorldPacket &recv_data )
void WorldSession::HandleMinimapPingOpcode(WorldPacket& recv_data) void WorldSession::HandleMinimapPingOpcode(WorldPacket& recv_data)
{ {
if(!GetPlayer()->GetGroup())
return;
float x, y; float x, y;
recv_data >> x; recv_data >> x;
recv_data >> y; recv_data >> y;
if(!GetPlayer()->GetGroup())
return;
//sLog.outDebug("Received opcode MSG_MINIMAP_PING X: %f, Y: %f", x, y); //sLog.outDebug("Received opcode MSG_MINIMAP_PING X: %f, Y: %f", x, y);
/** error handling **/ /** error handling **/
@ -449,13 +447,13 @@ void WorldSession::HandleRandomRollOpcode(WorldPacket& recv_data)
void WorldSession::HandleRaidTargetUpdateOpcode( WorldPacket & recv_data ) void WorldSession::HandleRaidTargetUpdateOpcode( WorldPacket & recv_data )
{ {
uint8 x;
recv_data >> x;
Group *group = GetPlayer()->GetGroup(); Group *group = GetPlayer()->GetGroup();
if(!group) if(!group)
return; return;
uint8 x;
recv_data >> x;
/** error handling **/ /** error handling **/
/********************/ /********************/
@ -496,17 +494,17 @@ void WorldSession::HandleGroupRaidConvertOpcode( WorldPacket & /*recv_data*/ )
void WorldSession::HandleGroupChangeSubGroupOpcode( WorldPacket & recv_data ) void WorldSession::HandleGroupChangeSubGroupOpcode( WorldPacket & recv_data )
{ {
// we will get correct pointer for group here, so we don't have to check if group is BG raid
Group *group = GetPlayer()->GetGroup();
if(!group)
return;
std::string name; std::string name;
uint8 groupNr; uint8 groupNr;
recv_data >> name; recv_data >> name;
recv_data >> groupNr; recv_data >> groupNr;
// we will get correct pointer for group here, so we don't have to check if group is BG raid
Group *group = GetPlayer()->GetGroup();
if(!group)
return;
/** error handling **/ /** error handling **/
if(!group->IsLeader(GetPlayer()->GetGUID()) && !group->IsAssistant(GetPlayer()->GetGUID())) if(!group->IsLeader(GetPlayer()->GetGUID()) && !group->IsAssistant(GetPlayer()->GetGUID()))
return; return;
@ -521,15 +519,15 @@ void WorldSession::HandleGroupChangeSubGroupOpcode( WorldPacket & recv_data )
void WorldSession::HandleGroupAssistantLeaderOpcode( WorldPacket & recv_data ) void WorldSession::HandleGroupAssistantLeaderOpcode( WorldPacket & recv_data )
{ {
Group *group = GetPlayer()->GetGroup();
if(!group)
return;
uint64 guid; uint64 guid;
uint8 flag; uint8 flag;
recv_data >> guid; recv_data >> guid;
recv_data >> flag; recv_data >> flag;
Group *group = GetPlayer()->GetGroup();
if(!group)
return;
/** error handling **/ /** error handling **/
if(!group->IsLeader(GetPlayer()->GetGUID())) if(!group->IsLeader(GetPlayer()->GetGUID()))
return; return;
@ -541,16 +539,17 @@ void WorldSession::HandleGroupAssistantLeaderOpcode( WorldPacket & recv_data )
void WorldSession::HandlePartyAssignmentOpcode( WorldPacket & recv_data ) void WorldSession::HandlePartyAssignmentOpcode( WorldPacket & recv_data )
{ {
uint8 flag1, flag2;
uint64 guid;
recv_data >> flag1 >> flag2;
recv_data >> guid;
sLog.outDebug("MSG_PARTY_ASSIGNMENT"); sLog.outDebug("MSG_PARTY_ASSIGNMENT");
Group *group = GetPlayer()->GetGroup(); Group *group = GetPlayer()->GetGroup();
if(!group) if(!group)
return; return;
uint8 flag1, flag2;
uint64 guid;
recv_data >> flag1 >> flag2;
recv_data >> guid;
// if(flag1) Main Assist // if(flag1) Main Assist
// 0x4 // 0x4
// if(flag2) Main Tank // if(flag2) Main Tank
@ -569,13 +568,13 @@ void WorldSession::HandlePartyAssignmentOpcode( WorldPacket & recv_data )
} }
void WorldSession::HandleRaidReadyCheckOpcode( WorldPacket & recv_data ) void WorldSession::HandleRaidReadyCheckOpcode( WorldPacket & recv_data )
{
if(recv_data.empty()) // request
{ {
Group *group = GetPlayer()->GetGroup(); Group *group = GetPlayer()->GetGroup();
if(!group) if(!group)
return; return;
if(recv_data.empty()) // request
{
/** error handling **/ /** error handling **/
if(!group->IsLeader(GetPlayer()->GetGUID()) && !group->IsAssistant(GetPlayer()->GetGUID())) if(!group->IsLeader(GetPlayer()->GetGUID()) && !group->IsAssistant(GetPlayer()->GetGUID()))
return; return;
@ -593,6 +592,10 @@ void WorldSession::HandleRaidReadyCheckOpcode( WorldPacket & recv_data )
uint8 state; uint8 state;
recv_data >> state; recv_data >> state;
Group *group = GetPlayer()->GetGroup();
if(!group)
return;
// everything's fine, do it // everything's fine, do it
WorldPacket data(MSG_RAID_READY_CHECK_CONFIRM, 9); WorldPacket data(MSG_RAID_READY_CHECK_CONFIRM, 9);
data << GetPlayer()->GetGUID(); data << GetPlayer()->GetGUID();

View file

@ -5600,7 +5600,17 @@ void ObjectMgr::PackGroupIds()
do do
{ {
Field *fields = result->Fetch(); Field *fields = result->Fetch();
groupIds.insert(fields[0].GetUInt32());
uint32 id = fields[0].GetUInt32();
if (id == 0)
{
CharacterDatabase.PExecute("DELETE FROM groups WHERE groupId = '%u'", id);
CharacterDatabase.PExecute("DELETE FROM group_member WHERE groupId = '%u'", id);
continue;
}
groupIds.insert(id);
} }
while (result->NextRow()); while (result->NextRow());
delete result; delete result;

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "9341" #define REVISION_NR "9342"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__