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

View file

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

View file

@ -5600,7 +5600,17 @@ void ObjectMgr::PackGroupIds()
do
{
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());
delete result;

View file

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