Skip to content

Instantly share code, notes, and snippets.

@rsa
Created March 31, 2011 12:22
Show Gist options
  • Save rsa/896270 to your computer and use it in GitHub Desktop.
Save rsa/896270 to your computer and use it in GitHub Desktop.
[PATCH] implement GroupFlagMask and work with his:
From 149d5c772e8f78770bd4d81eaf5004ae5343b965 Mon Sep 17 00:00:00 2001
From: /dev/rsa <kris13@bk.ru>
Date: Thu, 31 Mar 2011 16:04:18 +0400
Subject: [PATCH] implement GroupFlagMask and work with his:
- correct raid group assignment, implement true rules and rights;
- correct displaying assignments in client;
- correct saving assignments to DB;
- remove many old stuff from Group class, remove not needed saving mainTankGuid/mainAssistGuid in DB;
- add role storage for save LFG role in DB;
part of algorithm and group_member structure from TC, realization by me.
Special version for clean mangos core (11299)
---
sql/updates/99999_characters_group_flags.sql | 8 ++
src/game/Group.cpp | 161 ++++++++++++++------------
src/game/Group.h | 91 ++++++--------
src/game/GroupHandler.cpp | 37 ++----
src/game/ObjectMgr.cpp | 13 +-
5 files changed, 153 insertions(+), 157 deletions(-)
create mode 100644 sql/updates/99999_characters_group_flags.sql
diff --git a/sql/updates/99999_characters_group_flags.sql b/sql/updates/99999_characters_group_flags.sql
new file mode 100644
index 0000000..da12112
--- /dev/null
+++ b/sql/updates/99999_characters_group_flags.sql
@@ -0,0 +1,8 @@
+-- Group flags and roles support
+ALTER TABLE `group_member` ADD COLUMN `roles`
+TINYINT(1) UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Member roles bit mask'
+AFTER `subgroup`;
+ALTER TABLE `group_member` CHANGE `assistant` `memberFlags`
+TINYINT(1) UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Member flags bit mask';
+
+ALTER TABLE `groups` DROP `mainTank`, DROP `mainAssistant`;
diff --git a/src/game/Group.cpp b/src/game/Group.cpp
index 67b50c2..93f0416 100644
--- a/src/game/Group.cpp
+++ b/src/game/Group.cpp
@@ -146,9 +146,9 @@ bool Group::Create(ObjectGuid guid, const char * name)
CharacterDatabase.BeginTransaction();
CharacterDatabase.PExecute("DELETE FROM groups WHERE groupId ='%u'", m_Id);
CharacterDatabase.PExecute("DELETE FROM group_member WHERE groupId ='%u'", m_Id);
- CharacterDatabase.PExecute("INSERT INTO groups (groupId,leaderGuid,mainTank,mainAssistant,lootMethod,looterGuid,lootThreshold,icon1,icon2,icon3,icon4,icon5,icon6,icon7,icon8,groupType,difficulty,raiddifficulty) "
- "VALUES ('%u','%u','%u','%u','%u','%u','%u','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','%u','%u','%u')",
- m_Id, m_leaderGuid.GetCounter(), m_mainTankGuid.GetCounter(), m_mainAssistantGuid.GetCounter(), uint32(m_lootMethod),
+ CharacterDatabase.PExecute("INSERT INTO groups (groupId,leaderGuid,lootMethod,looterGuid,lootThreshold,icon1,icon2,icon3,icon4,icon5,icon6,icon7,icon8,groupType,difficulty,raiddifficulty) "
+ "VALUES ('%u','%u','%u','%u','%u','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','%u','%u','%u')",
+ m_Id, m_leaderGuid.GetCounter(), uint32(m_lootMethod),
m_looterGuid.GetCounter(), uint32(m_lootThreshold),
m_targetIcons[0].GetRawValue(), m_targetIcons[1].GetRawValue(),
m_targetIcons[2].GetRawValue(), m_targetIcons[3].GetRawValue(),
@@ -168,11 +168,11 @@ bool Group::Create(ObjectGuid guid, const char * name)
bool Group::LoadGroupFromDB(Field* fields)
{
- // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
- // result = CharacterDatabase.Query("SELECT mainTank, mainAssistant, lootMethod, looterGuid, lootThreshold, icon1, icon2, icon3, icon4, icon5, icon6, icon7, icon8, groupType, difficulty, raiddifficulty, leaderGuid, groupId FROM groups");
+ // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
+ // result = CharacterDatabase.Query("SELECT lootMethod, looterGuid, lootThreshold, icon1, icon2, icon3, icon4, icon5, icon6, icon7, icon8, groupType, difficulty, raiddifficulty, leaderGuid, groupId FROM groups");
- m_Id = fields[17].GetUInt32();
- m_leaderGuid = ObjectGuid(HIGHGUID_PLAYER, fields[16].GetUInt32());
+ m_Id = fields[15].GetUInt32();
+ m_leaderGuid = ObjectGuid(HIGHGUID_PLAYER, fields[14].GetUInt32());
// group leader not exist
if (!sObjectMgr.GetPlayerNameByGUID(m_leaderGuid, m_leaderName))
@@ -183,29 +183,27 @@ bool Group::LoadGroupFromDB(Field* fields)
if (m_groupType & GROUPTYPE_RAID)
_initRaidSubGroupsCounter();
- uint32 diff = fields[14].GetUInt8();
+ uint32 diff = fields[12].GetUInt8();
if (diff >= MAX_DUNGEON_DIFFICULTY)
diff = DUNGEON_DIFFICULTY_NORMAL;
m_dungeonDifficulty = Difficulty(diff);
- uint32 r_diff = fields[15].GetUInt8();
+ uint32 r_diff = fields[13].GetUInt8();
if (r_diff >= MAX_RAID_DIFFICULTY)
r_diff = RAID_DIFFICULTY_10MAN_NORMAL;
m_raidDifficulty = Difficulty(r_diff);
- m_mainTankGuid = ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt32());
- m_mainAssistantGuid = ObjectGuid(HIGHGUID_PLAYER, fields[1].GetUInt32());
- m_lootMethod = LootMethod(fields[2].GetUInt8());
- m_looterGuid = ObjectGuid(HIGHGUID_PLAYER, fields[3].GetUInt32());
- m_lootThreshold = ItemQualities(fields[4].GetUInt16());
+ m_lootMethod = LootMethod(fields[0].GetUInt8());
+ m_looterGuid = ObjectGuid(HIGHGUID_PLAYER, fields[1].GetUInt32());
+ m_lootThreshold = ItemQualities(fields[2].GetUInt16());
for(int i = 0; i < TARGET_ICON_COUNT; ++i)
- m_targetIcons[i] = ObjectGuid(fields[5+i].GetUInt64());
+ m_targetIcons[i] = ObjectGuid(fields[3+i].GetUInt64());
return true;
}
-bool Group::LoadMemberFromDB(uint32 guidLow, uint8 subgroup, bool assistant)
+bool Group::LoadMemberFromDB(uint32 guidLow, uint8 subgroup, GroupFlagMask flags, uint8 roles)
{
MemberSlot member;
member.guid = ObjectGuid(HIGHGUID_PLAYER, guidLow);
@@ -215,7 +213,8 @@ bool Group::LoadMemberFromDB(uint32 guidLow, uint8 subgroup, bool assistant)
return false;
member.group = subgroup;
- member.assistant = assistant;
+ member.flags = flags;
+ member.roles = roles;
m_memberSlots.push_back(member);
SubGroupCounterIncrease(subgroup);
@@ -1032,8 +1031,8 @@ void Group::SendUpdate()
WorldPacket data(SMSG_GROUP_LIST, (1+1+1+1+8+4+GetMembersCount()*20));
data << uint8(m_groupType); // group type (flags in 3.3)
data << uint8(citr->group); // groupid
- data << uint8(GetFlags(*citr)); // group flags
- data << uint8(isBGGroup() ? 1 : 0); // 2.0.x, isBattleGroundGroup?
+ data << uint8(citr->flags); // group flags
+ data << uint8(citr->roles); // roles mask
if(m_groupType & GROUPTYPE_LFD)
{
data << uint8(0);
@@ -1054,8 +1053,8 @@ void Group::SendUpdate()
data << citr2->guid;
data << uint8(onlineState); // online-state
data << uint8(citr2->group); // groupid
- data << uint8(GetFlags(*citr2)); // group flags
- data << uint8(0); // 3.3, role?
+ data << uint8(citr2->flags); // group flags
+ data << uint8(citr2->roles); // 3.3, role?
}
data << m_leaderGuid; // leader guid
@@ -1128,10 +1127,12 @@ void Group::OfflineReadyCheck()
}
}
-bool Group::_addMember(ObjectGuid guid, const char* name, bool isAssistant)
+bool Group::_addMember(ObjectGuid guid, const char* name)
{
// get first not-full group
uint8 groupid = 0;
+ GroupFlagMask flags = GROUP_MEMBER;
+ uint8 roles = 0;
if (m_subGroupsCounts)
{
bool groupFound = false;
@@ -1148,10 +1149,10 @@ bool Group::_addMember(ObjectGuid guid, const char* name, bool isAssistant)
return false;
}
- return _addMember(guid, name, isAssistant, groupid);
+ return _addMember(guid, name, groupid, flags, roles);
}
-bool Group::_addMember(ObjectGuid guid, const char* name, bool isAssistant, uint8 group)
+bool Group::_addMember(ObjectGuid guid, const char* name, uint8 group, GroupFlagMask flags, uint8 roles)
{
if(IsFull())
return false;
@@ -1165,7 +1166,8 @@ bool Group::_addMember(ObjectGuid guid, const char* name, bool isAssistant, uint
member.guid = guid;
member.name = name;
member.group = group;
- member.assistant = isAssistant;
+ member.flags = flags;
+ member.roles = roles;
m_memberSlots.push_back(member);
SubGroupCounterIncrease(group);
@@ -1198,8 +1200,8 @@ bool Group::_addMember(ObjectGuid guid, const char* name, bool isAssistant, uint
if (!isBGGroup())
{
// insert into group table
- CharacterDatabase.PExecute("INSERT INTO group_member(groupId,memberGuid,assistant,subgroup) VALUES('%u','%u','%u','%u')",
- m_Id, member.guid.GetCounter(), ((member.assistant==1)?1:0), member.group);
+ CharacterDatabase.PExecute("INSERT INTO group_member(groupId,memberGuid,memberFlags,subgroup,roles) VALUES('%u','%u','%u','%u','%u')",
+ m_Id, member.guid.GetCounter(), member.flags, member.group, member.roles);
}
return true;
@@ -1352,63 +1354,72 @@ bool Group::_setMembersGroup(ObjectGuid guid, uint8 group)
return true;
}
-bool Group::_setAssistantFlag(ObjectGuid guid, const bool &state)
+void Group::SetGroupUniqueFlag(ObjectGuid guid, GroupFlagsAssignment assignment, uint8 apply)
{
- member_witerator slot = _getMemberWSlot(guid);
- if (slot == m_memberSlots.end())
- return false;
+ static SqlStatementID updGroupMember;
- slot->assistant = state;
- if (!isBGGroup())
- CharacterDatabase.PExecute("UPDATE group_member SET assistant='%u' WHERE memberGuid='%u'", (state==true)?1:0, guid.GetCounter());
- return true;
-}
+ GroupFlagMask mask = GROUP_MEMBER;
+ GroupFlagMask excludeMask = GROUP_MEMBER;
-bool Group::_setMainTank(ObjectGuid guid)
-{
- if (m_mainTankGuid == guid)
- return false;
-
- if (!guid.IsEmpty())
+ switch (assignment)
{
- member_citerator slot = _getMemberCSlot(guid);
- if (slot == m_memberSlots.end())
- return false;
-
- if (m_mainAssistantGuid == guid)
- _setMainAssistant(ObjectGuid());
- }
-
- m_mainTankGuid = guid;
-
- if (!isBGGroup())
- CharacterDatabase.PExecute("UPDATE groups SET mainTank='%u' WHERE groupId='%u'", m_mainTankGuid.GetCounter(), m_Id);
-
- return true;
-}
-
-bool Group::_setMainAssistant(ObjectGuid guid)
-{
- if (m_mainAssistantGuid == guid)
- return false;
+ case GROUP_ASSIGN_MAINTANK:
+ mask = GROUP_MAIN_TANK;
+ excludeMask = GROUP_MAIN_ASSISTANT;
+ break;
+ case GROUP_ASSIGN_MAINASSIST:
+ mask = GROUP_MAIN_ASSISTANT;
+ excludeMask = GROUP_MAIN_TANK;
+ break;
+ case GROUP_ASSIGN_ASSISTANT:
+ mask = GROUP_ASSISTANT;
+ break;
+ default:
+ sLog.outError("Group::SetGroupUniqueFlag unknown assignment % on player %u", assignment, guid.GetCounter());
+ return;
+ };
if (!guid.IsEmpty())
{
- member_witerator slot = _getMemberWSlot(guid);
- if (slot == m_memberSlots.end())
- return false;
-
- if (m_mainTankGuid == guid)
- _setMainTank(ObjectGuid());
- }
+ SqlStatement stmt = CharacterDatabase.CreateStatement(updGroupMember, "UPDATE group_member SET memberFlags = ? WHERE memberGuid = ?");
- m_mainAssistantGuid = guid;
-
- if (!isBGGroup())
- CharacterDatabase.PExecute("UPDATE groups SET mainAssistant='%u' WHERE groupId='%u'",
- m_mainAssistantGuid.GetCounter(), m_Id);
+ if (apply)
+ {
+ for (member_witerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr)
+ {
+ if (itr->guid != guid )
+ {
+ if (itr->flags & mask)
+ {
+ GroupFlagMask oldMask = itr->flags;
+ itr->flags = GroupFlagMask(oldMask & ~mask);
+ if (itr->flags != oldMask)
+ stmt.PExecute(uint8(itr->flags), itr->guid.GetCounter());
+ }
+ }
+ else
+ {
+ GroupFlagMask oldMask = itr->flags;
+ itr->flags = GroupFlagMask((oldMask | mask) & ~excludeMask);
+ if (itr->flags != oldMask)
+ stmt.PExecute(uint8(itr->flags), itr->guid.GetCounter());
+ }
+ }
+ }
+ else
+ {
+ member_witerator slot = _getMemberWSlot(guid);
+ if (slot != m_memberSlots.end())
+ {
+ GroupFlagMask oldMask = slot->flags;
+ slot->flags = GroupFlagMask(oldMask & ~mask);
+ if (slot->flags != oldMask)
+ stmt.PExecute(uint8(slot->flags), slot->guid.GetCounter());
+ }
+ }
- return true;
+ SendUpdate();
+ }
}
bool Group::SameSubGroup(Player const* member1, Player const* member2) const
diff --git a/src/game/Group.h b/src/game/Group.h
index 653afed..f6f8f80 100644
--- a/src/game/Group.h
+++ b/src/game/Group.h
@@ -104,11 +104,38 @@ enum GroupType // group type flags?
// 0x10, leave/change group?, I saw this flag when leaving group and after leaving BG while in group
};
+enum GroupFlags
+{
+ GROUP_FLAG_ASSISTANT = 0,
+ GROUP_FLAG_MAIN_ASSISTANT = 1,
+ GROUP_FLAG_MAIN_TANK = 2,
+};
+
enum GroupFlagMask
{
- GROUP_ASSISTANT = 0x01,
- GROUP_MAIN_ASSISTANT = 0x02,
- GROUP_MAIN_TANK = 0x04,
+ GROUP_MEMBER = 0x00,
+ GROUP_ASSISTANT = (1 << GROUP_FLAG_ASSISTANT),
+ GROUP_MAIN_ASSISTANT = (1 << GROUP_FLAG_MAIN_ASSISTANT),
+ GROUP_MAIN_TANK = (1 << GROUP_FLAG_MAIN_TANK),
+
+ // unions
+ GROUP_MEMBER_AMT = ( GROUP_ASSISTANT |
+ GROUP_MAIN_ASSISTANT |
+ GROUP_MAIN_TANK ),
+ GROUP_MEMBER_AT = ( GROUP_ASSISTANT |
+ GROUP_MAIN_TANK ),
+ GROUP_MEMBER_AM = ( GROUP_ASSISTANT |
+ GROUP_MAIN_ASSISTANT ),
+ GROUP_MEMBER_MT = ( GROUP_MAIN_ASSISTANT |
+ GROUP_MAIN_TANK ),
+
+};
+
+enum GroupFlagsAssignment
+{
+ GROUP_ASSIGN_MAINASSIST = 0,
+ GROUP_ASSIGN_MAINTANK = 1,
+ GROUP_ASSIGN_ASSISTANT = 2,
};
enum GroupUpdateFlags
@@ -194,14 +221,16 @@ class MANGOS_DLL_SPEC Group
ObjectGuid guid;
std::string name;
uint8 group;
- bool assistant;
+ GroupFlagMask flags;
+ uint8 roles;
};
typedef std::list<MemberSlot> MemberSlotList;
typedef MemberSlotList::const_iterator member_citerator;
+ typedef MemberSlotList::iterator member_witerator;
typedef UNORDERED_MAP< uint32 /*mapId*/, InstanceGroupBind> BoundInstancesMap;
+
protected:
- typedef MemberSlotList::iterator member_witerator;
typedef std::set<Player*> InvitesList;
typedef std::vector<Roll*> Rolls;
@@ -213,7 +242,7 @@ class MANGOS_DLL_SPEC Group
// group manipulation methods
bool Create(ObjectGuid guid, const char * name);
bool LoadGroupFromDB(Field *fields);
- bool LoadMemberFromDB(uint32 guidLow, uint8 subgroup, bool assistant);
+ bool LoadMemberFromDB(uint32 guidLow, uint8 subgroup, GroupFlagMask flags, uint8 roles);
bool AddInvite(Player *player);
uint32 RemoveInvite(Player *player);
void RemoveAllInvites();
@@ -256,7 +285,7 @@ class MANGOS_DLL_SPEC Group
if (mslot==m_memberSlots.end())
return false;
- return mslot->assistant;
+ return mslot->flags & GROUP_ASSISTANT;
}
Player* GetInvited(ObjectGuid guid) const;
Player* GetInvited(const std::string& name) const;
@@ -290,32 +319,7 @@ class MANGOS_DLL_SPEC Group
void ChangeMembersGroup(ObjectGuid guid, uint8 group);
void ChangeMembersGroup(Player *player, uint8 group);
- ObjectGuid GetMainTankGuid() const { return m_mainTankGuid; }
- ObjectGuid GetMainAssistantGuid() const { return m_mainAssistantGuid; }
-
- void SetAssistant(ObjectGuid guid, bool state)
- {
- if (!isRaidGroup())
- return;
- if (_setAssistantFlag(guid, state))
- SendUpdate();
- }
- void SetMainTank(ObjectGuid guid)
- {
- if (!isRaidGroup())
- return;
-
- if (_setMainTank(guid))
- SendUpdate();
- }
- void SetMainAssistant(ObjectGuid guid)
- {
- if (!isRaidGroup())
- return;
-
- if (_setMainAssistant(guid))
- SendUpdate();
- }
+ void SetGroupUniqueFlag(ObjectGuid guid, GroupFlagsAssignment assignment, uint8 apply);
void SetTargetIcon(uint8 id, ObjectGuid whoGuid, ObjectGuid targetGuid);
@@ -363,17 +367,14 @@ class MANGOS_DLL_SPEC Group
BoundInstancesMap& GetBoundInstances(Difficulty difficulty) { return m_boundInstances[difficulty]; }
protected:
- bool _addMember(ObjectGuid guid, const char* name, bool isAssistant=false);
- bool _addMember(ObjectGuid guid, const char* name, bool isAssistant, uint8 group);
+ bool _addMember(ObjectGuid guid, const char* name);
+ bool _addMember(ObjectGuid guid, const char* name, uint8 group, GroupFlagMask flags = GROUP_MEMBER, uint8 roles = 0);
bool _removeMember(ObjectGuid guid); // returns true if leader has changed
void _setLeader(ObjectGuid guid);
void _removeRolls(ObjectGuid guid);
bool _setMembersGroup(ObjectGuid guid, uint8 group);
- bool _setAssistantFlag(ObjectGuid guid, const bool &state);
- bool _setMainTank(ObjectGuid guid);
- bool _setMainAssistant(ObjectGuid guid);
void _homebindIfInstance(Player *player);
@@ -424,26 +425,12 @@ class MANGOS_DLL_SPEC Group
void CountTheRoll(Rolls::iterator& roll); // iterator update to next, in CountRollVote if true
bool CountRollVote(ObjectGuid const& playerGUID, Rolls::iterator& roll, RollVote vote);
- GroupFlagMask GetFlags(MemberSlot const& slot) const
- {
- uint8 flags = 0;
- if (slot.assistant)
- flags |= GROUP_ASSISTANT;
- if (slot.guid == m_mainAssistantGuid)
- flags |= GROUP_MAIN_ASSISTANT;
- if (slot.guid == m_mainTankGuid)
- flags |= GROUP_MAIN_TANK;
- return GroupFlagMask(flags);
- }
-
uint32 m_Id; // 0 for not created or BG groups
MemberSlotList m_memberSlots;
GroupRefManager m_memberMgr;
InvitesList m_invitees;
ObjectGuid m_leaderGuid;
std::string m_leaderName;
- ObjectGuid m_mainTankGuid;
- ObjectGuid m_mainAssistantGuid;
GroupType m_groupType;
Difficulty m_dungeonDifficulty;
Difficulty m_raidDifficulty;
diff --git a/src/game/GroupHandler.cpp b/src/game/GroupHandler.cpp
index 15a5db9..a838097 100644
--- a/src/game/GroupHandler.cpp
+++ b/src/game/GroupHandler.cpp
@@ -543,12 +543,15 @@ void WorldSession::HandleGroupChangeSubGroupOpcode( WorldPacket & recv_data )
void WorldSession::HandleGroupAssistantLeaderOpcode( WorldPacket & recv_data )
{
ObjectGuid guid;
- uint8 flag;
+ uint8 apply;
recv_data >> guid;
- recv_data >> flag;
+ recv_data >> apply;
+
+ DEBUG_LOG("CMSG_GROUP_ASSISTANT_LEADER: guid %u, apply %u",guid.GetCounter(),apply);
Group *group = GetPlayer()->GetGroup();
- if (!group)
+
+ if (!group || !group->isRaidGroup()) // Only raid groups may have assistant
return;
/** error handling **/
@@ -557,7 +560,8 @@ void WorldSession::HandleGroupAssistantLeaderOpcode( WorldPacket & recv_data )
/********************/
// everything is fine, do it
- group->SetAssistant(guid, (flag==0?false:true));
+ group->SetGroupUniqueFlag(guid, GROUP_ASSIGN_ASSISTANT, apply);
+
}
void WorldSession::HandlePartyAssignmentOpcode( WorldPacket & recv_data )
@@ -568,34 +572,19 @@ void WorldSession::HandlePartyAssignmentOpcode( WorldPacket & recv_data )
recv_data >> role >> apply; // role 0 = Main Tank, 1 = Main Assistant
recv_data >> guid;
- DEBUG_LOG("MSG_PARTY_ASSIGNMENT");
+ DEBUG_LOG("MSG_PARTY_ASSIGNMENT: guid %u, role %u, apply %u",guid.GetCounter(),role,apply);
Group *group = GetPlayer()->GetGroup();
- if (!group)
+
+ if (!group || !group->isRaidGroup()) // Only raid groups may have mainassistant/maintank
return;
/** error handling **/
- if (!group->IsLeader(GetPlayer()->GetObjectGuid()))
+ if (!group->IsLeader(GetPlayer()->GetObjectGuid()) && !group->IsAssistant(GetPlayer()->GetObjectGuid()))
return;
/********************/
- // everything is fine, do it
- if (apply)
- {
- switch(role)
- {
- case 0: group->SetMainTank(guid); break;
- case 1: group->SetMainAssistant(guid); break;
- default: break;
- }
- }
- else
- {
- if (group->GetMainTankGuid() == guid)
- group->SetMainTank(ObjectGuid());
- if (group->GetMainAssistantGuid() == guid)
- group->SetMainAssistant(ObjectGuid());
- }
+ group->SetGroupUniqueFlag(guid, GroupFlagsAssignment(role), apply);
}
void WorldSession::HandleRaidReadyCheckOpcode( WorldPacket & recv_data )
diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp
index c3b8fca..f7bc875 100644
--- a/src/game/ObjectMgr.cpp
+++ b/src/game/ObjectMgr.cpp
@@ -3460,8 +3460,8 @@ void ObjectMgr::LoadGroups()
{
// -- loading groups --
uint32 count = 0;
- // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
- QueryResult *result = CharacterDatabase.Query("SELECT mainTank, mainAssistant, lootMethod, looterGuid, lootThreshold, icon1, icon2, icon3, icon4, icon5, icon6, icon7, icon8, groupType, difficulty, raiddifficulty, leaderGuid, groupId FROM groups");
+ // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
+ QueryResult *result = CharacterDatabase.Query("SELECT lootMethod, looterGuid, lootThreshold, icon1, icon2, icon3, icon4, icon5, icon6, icon7, icon8, groupType, difficulty, raiddifficulty, leaderGuid, groupId FROM groups");
if (!result)
{
@@ -3498,8 +3498,8 @@ void ObjectMgr::LoadGroups()
// -- loading members --
count = 0;
- // 0 1 2 3
- result = CharacterDatabase.Query("SELECT memberGuid, assistant, subgroup, groupId FROM group_member ORDER BY groupId");
+ // 0 1 2 3 4
+ result = CharacterDatabase.Query("SELECT memberGuid, memberFlags, subgroup, groupId, roles FROM group_member ORDER BY groupId");
if (!result)
{
barGoLink bar2( 1 );
@@ -3518,9 +3518,10 @@ void ObjectMgr::LoadGroups()
uint32 memberGuidlow = fields[0].GetUInt32();
ObjectGuid memberGuid = ObjectGuid(HIGHGUID_PLAYER, memberGuidlow);
- bool assistent = fields[1].GetBool();
+ uint8 flags = fields[1].GetUInt8();
uint8 subgroup = fields[2].GetUInt8();
uint32 groupId = fields[3].GetUInt32();
+ uint8 roles = fields[4].GetUInt8();
if (!group || group->GetId() != groupId)
{
group = GetGroupById(groupId);
@@ -3533,7 +3534,7 @@ void ObjectMgr::LoadGroups()
}
}
- if (!group->LoadMemberFromDB(memberGuidlow, subgroup, assistent))
+ if (!group->LoadMemberFromDB(memberGuidlow, subgroup, GroupFlagMask(flags), roles))
{
sLog.outErrorDb("Incorrect entry in group_member table : member %s cannot be added to group (Id: %u)!",
memberGuid.GetString().c_str(), groupId);
--
1.6.0.6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment