aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Groups/Group.cpp
diff options
context:
space:
mode:
authorDehravor <dehravor@gmail.com>2014-03-16 19:12:01 +0100
committerDehravor <dehravor@gmail.com>2014-03-16 19:12:01 +0100
commit6a5c43b0d819fc43a3d46aa63fa7576a11e5761c (patch)
tree7d0a26d1ff26e68906c62d3545e6c9687d99cd96 /src/server/game/Groups/Group.cpp
parent892d9eac79e94796e3b22e5be368063d59b20efc (diff)
Core/Loot: Implement round robin for under threshold items in case of master loot
Thanks @Shauren for pointing out
Diffstat (limited to 'src/server/game/Groups/Group.cpp')
-rw-r--r--src/server/game/Groups/Group.cpp62
1 files changed, 33 insertions, 29 deletions
diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp
index abc4b19f3f2..699a67b5340 100644
--- a/src/server/game/Groups/Group.cpp
+++ b/src/server/game/Groups/Group.cpp
@@ -56,7 +56,7 @@ Loot* Roll::getLoot()
Group::Group() : m_leaderGuid(0), m_leaderName(""), m_groupType(GROUPTYPE_NORMAL),
m_dungeonDifficulty(DUNGEON_DIFFICULTY_NORMAL), m_raidDifficulty(RAID_DIFFICULTY_10MAN_NORMAL),
m_bgGroup(NULL), m_bfGroup(NULL), m_lootMethod(FREE_FOR_ALL), m_lootThreshold(ITEM_QUALITY_UNCOMMON), m_looterGuid(0),
-m_subGroupsCounts(NULL), m_guid(0), m_counter(0), m_maxEnchantingLevel(0), m_dbStoreId(0)
+m_masterLooterGuid(0), m_subGroupsCounts(NULL), m_guid(0), m_counter(0), m_maxEnchantingLevel(0), m_dbStoreId(0)
{
for (uint8 i = 0; i < TARGETICONCOUNT; ++i)
m_targetIcons[i] = 0;
@@ -112,6 +112,7 @@ bool Group::Create(Player* leader)
m_lootThreshold = ITEM_QUALITY_UNCOMMON;
m_looterGuid = leaderGuid;
+ m_masterLooterGuid = 0;
m_dungeonDifficulty = DUNGEON_DIFFICULTY_NORMAL;
m_raidDifficulty = RAID_DIFFICULTY_10MAN_NORMAL;
@@ -146,6 +147,7 @@ bool Group::Create(Player* leader)
stmt->setUInt8(index++, uint8(m_groupType));
stmt->setUInt32(index++, uint8(m_dungeonDifficulty));
stmt->setUInt32(index++, uint8(m_raidDifficulty));
+ stmt->setUInt32(index++, GUID_LOPART(m_masterLooterGuid));
CharacterDatabase.Execute(stmt);
@@ -162,7 +164,7 @@ bool Group::Create(Player* leader)
void Group::LoadGroupFromDB(Field* fields)
{
- m_dbStoreId = fields[15].GetUInt32();
+ m_dbStoreId = fields[16].GetUInt32();
m_guid = MAKE_NEW_GUID(sGroupMgr->GenerateGroupId(), 0, HIGHGUID_GROUP);
m_leaderGuid = MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER);
@@ -193,6 +195,8 @@ void Group::LoadGroupFromDB(Field* fields)
else
m_raidDifficulty = Difficulty(r_diff);
+ m_masterLooterGuid = MAKE_NEW_GUID(fields[15].GetUInt32(), 0, HIGHGUID_PLAYER);
+
if (m_groupType & GROUPTYPE_LFG)
sLFGMgr->_LoadFromDB(fields, GetGUID());
}
@@ -891,24 +895,15 @@ void Group::SendLooter(Creature* creature, Player* groupLooter)
WorldPacket data(SMSG_LOOT_LIST, (8+8));
data << uint64(creature->GetGUID());
- if (groupLooter)
- {
- if (GetLootMethod() == MASTER_LOOT)
- {
- data.append(groupLooter->GetPackGUID());
- data << uint8(0);
- }
- else
- {
- data << uint8(0);
- data.append(groupLooter->GetPackGUID());
- }
- }
+ if (GetLootMethod() == MASTER_LOOT)
+ data.appendPackGUID(GetMasterLooterGuid());
else
- {
data << uint8(0);
+
+ if (groupLooter)
+ data.append(groupLooter->GetPackGUID());
+ else
data << uint8(0);
- }
BroadcastPacket(&data, false);
}
@@ -1550,7 +1545,12 @@ void Group::SendUpdateToPlayer(uint64 playerGUID, MemberSlot* slot)
if (GetMembersCount() - 1)
{
data << uint8(m_lootMethod); // loot method
- data << uint64(m_looterGuid); // looter guid
+
+ if (m_lootMethod == MASTER_LOOT)
+ data << uint64(m_masterLooterGuid); // master looter guid
+ else
+ data << uint64(m_looterGuid); // looter guid
+
data << uint8(m_lootThreshold); // loot threshold
data << uint8(m_dungeonDifficulty); // Dungeon Difficulty
data << uint8(m_raidDifficulty); // Raid Difficulty
@@ -1706,7 +1706,7 @@ void Group::ChangeMembersGroup(uint64 guid, uint8 group)
// Retrieve the next Round-Roubin player for the group
//
-// No update done if loot method is Master or FFA.
+// No update done if loot method is FFA.
//
// If the RR player is not yet set for the group, the first group member becomes the round-robin player.
// If the RR player is set, the next player in group becomes the round-robin player.
@@ -1717,16 +1717,10 @@ void Group::ChangeMembersGroup(uint64 guid, uint8 group)
// if not, he loses his turn.
void Group::UpdateLooterGuid(WorldObject* pLootedObject, bool ifneed)
{
- switch (GetLootMethod())
- {
- case MASTER_LOOT:
- case FREE_FOR_ALL:
- return;
- default:
- // round robin style looting applies for all low
- // quality items in each loot method except free for all and master loot
- break;
- }
+ // round robin style looting applies for all low
+ // quality items in each loot method except free for all
+ if (GetLootMethod() == FREE_FOR_ALL)
+ return;
uint64 oldLooterGUID = GetLooterGuid();
member_citerator guid_itr = _getMemberCSlot(oldLooterGUID);
@@ -2150,6 +2144,11 @@ void Group::SetLooterGuid(uint64 guid)
m_looterGuid = guid;
}
+void Group::SetMasterLooterGuid(uint64 guid)
+{
+ m_masterLooterGuid = guid;
+}
+
void Group::SetLootThreshold(ItemQualities threshold)
{
m_lootThreshold = threshold;
@@ -2225,6 +2224,11 @@ uint64 Group::GetLooterGuid() const
return m_looterGuid;
}
+uint64 Group::GetMasterLooterGuid() const
+{
+ return m_masterLooterGuid;
+}
+
ItemQualities Group::GetLootThreshold() const
{
return m_lootThreshold;