diff options
author | Shauren <shauren.trinity@gmail.com> | 2014-03-29 13:29:22 +0100 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2014-03-29 13:29:22 +0100 |
commit | 3fd6dd6175a3f75fd953083125ba3e62ab2bf1f4 (patch) | |
tree | c8499a1d060c795041c48dbef71638c6df4e2ba9 /src | |
parent | dee867547d302120467b3364307fdb1838f855f5 (diff) |
Core/Loot
* Master Looter cannot freely loot items under threshold
* Update round robin looter only if loot is not empty
* Fixed loot bag icon appearing in raid frames when loot method was not Master Looter
* Fixed changing loot method reseting current round robin looter
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Entities/Player/Player.cpp | 6 | ||||
-rw-r--r-- | src/server/game/Entities/Unit/Unit.cpp | 25 | ||||
-rw-r--r-- | src/server/game/Groups/Group.cpp | 4 | ||||
-rw-r--r-- | src/server/game/Handlers/GroupHandler.cpp | 1 | ||||
-rw-r--r-- | src/server/game/Loot/LootMgr.cpp | 63 |
5 files changed, 41 insertions, 58 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 05c89a99ed2..0e11bfd20ff 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -8796,7 +8796,7 @@ void Player::SendLoot(uint64 guid, LootType loot_type) loot->FillLoot(lootid, LootTemplates_Gameobject, this, !groupRules, false, go->GetLootMode()); // get next RR player (for next loot) - if (groupRules) + if (groupRules && !go->loot.empty()) group->UpdateLooterGuid(go); } @@ -17805,10 +17805,6 @@ bool Player::isAllowedToLoot(const Creature* creature) return loot->hasItemFor(this); case MASTER_LOOT: - // may loot if the player is the master looter - if (thisGroup->GetMasterLooterGuid() == GetGUID()) - return true; - // fall-through case GROUP_LOOT: case NEED_BEFORE_GREED: // may only loot if the player is the loot roundrobin player diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 379cecc3db7..98072e11632 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -15159,8 +15159,10 @@ void Unit::Kill(Unit* victim, bool durabilityLoss) data << uint64(victim->GetGUID()); // victim Player* looter = player; + Group* group = player->GetGroup(); + bool hasLooterGuid = false; - if (Group* group = player->GetGroup()) + if (group) { group->BroadcastPacket(&data, group->GetMemberGroup(player->GetGUID())); @@ -15172,16 +15174,10 @@ void Unit::Kill(Unit* victim, bool durabilityLoss) looter = ObjectAccessor::FindPlayer(group->GetLooterGuid()); if (looter) { + hasLooterGuid = true; creature->SetLootRecipient(looter); // update creature loot recipient to the allowed looter. - group->SendLooter(creature, looter); } - else - group->SendLooter(creature, NULL); } - else - group->SendLooter(creature, NULL); - - group->UpdateLooterGuid(creature); } } else @@ -15198,6 +15194,7 @@ void Unit::Kill(Unit* victim, bool durabilityLoss) } } + // Generate loot before updating looter if (creature) { Loot* loot = &creature->loot; @@ -15209,6 +15206,18 @@ void Unit::Kill(Unit* victim, bool durabilityLoss) loot->FillLoot(lootid, LootTemplates_Creature, looter, false, false, creature->GetLootMode()); loot->generateMoneyLoot(creature->GetCreatureTemplate()->mingold, creature->GetCreatureTemplate()->maxgold); + + if (group) + { + if (hasLooterGuid) + group->SendLooter(creature, looter); + else + group->SendLooter(creature, NULL); + + // Update round robin looter only if the creature had loot + if (!creature->loot.empty()) + group->UpdateLooterGuid(creature); + } } player->RewardPlayerAndGroupAtKill(victim, false); diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp index 699a67b5340..744ff52a2e2 100644 --- a/src/server/game/Groups/Group.cpp +++ b/src/server/game/Groups/Group.cpp @@ -895,7 +895,7 @@ void Group::SendLooter(Creature* creature, Player* groupLooter) WorldPacket data(SMSG_LOOT_LIST, (8+8)); data << uint64(creature->GetGUID()); - if (GetLootMethod() == MASTER_LOOT) + if (GetLootMethod() == MASTER_LOOT && creature->loot.hasOverThresholdItem()) data.appendPackGUID(GetMasterLooterGuid()); else data << uint8(0); @@ -1549,7 +1549,7 @@ void Group::SendUpdateToPlayer(uint64 playerGUID, MemberSlot* slot) if (m_lootMethod == MASTER_LOOT) data << uint64(m_masterLooterGuid); // master looter guid else - data << uint64(m_looterGuid); // looter guid + data << uint64(0); data << uint8(m_lootThreshold); // loot threshold data << uint8(m_dungeonDifficulty); // Dungeon Difficulty diff --git a/src/server/game/Handlers/GroupHandler.cpp b/src/server/game/Handlers/GroupHandler.cpp index 7e8f662df4c..eae95d20610 100644 --- a/src/server/game/Handlers/GroupHandler.cpp +++ b/src/server/game/Handlers/GroupHandler.cpp @@ -439,7 +439,6 @@ void WorldSession::HandleLootMethodOpcode(WorldPacket& recvData) // everything's fine, do it group->SetLootMethod((LootMethod)lootMethod); group->SetMasterLooterGuid(lootMaster); - group->SetLooterGuid(lootMaster); group->SetLootThreshold((ItemQualities)lootThreshold); group->SendUpdate(); } diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp index cbb7036538c..270af559f0b 100644 --- a/src/server/game/Loot/LootMgr.cpp +++ b/src/server/game/Loot/LootMgr.cpp @@ -879,6 +879,8 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv) switch (lv.permission) { case GROUP_PERMISSION: + case MASTER_PERMISSION: + case RESTRICTED_PERMISSION: { // if you are not the round-robin group looter, you can only see // blocked rolled items and quest items, and !ffa items @@ -888,9 +890,24 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv) { uint8 slot_type; - if (l.items[i].is_blocked) - slot_type = LOOT_SLOT_TYPE_ROLL_ONGOING; - else if (l.roundRobinPlayer == 0 || !l.items[i].is_underthreshold || lv.viewer->GetGUID() == l.roundRobinPlayer) + if (l.items[i].is_blocked) // for ML & restricted is_blocked = !is_underthreshold + { + switch (lv.permission) + { + case GROUP_PERMISSION: + slot_type = LOOT_SLOT_TYPE_ROLL_ONGOING; + break; + case MASTER_PERMISSION: + slot_type = LOOT_SLOT_TYPE_MASTER; + break; + case RESTRICTED_PERMISSION: + slot_type = LOOT_SLOT_TYPE_LOCKED; + break; + default: + continue; + } + } + else if (l.roundRobinPlayer == 0 || lv.viewer->GetGUID() == l.roundRobinPlayer || !l.items[i].is_underthreshold) { // no round robin owner or he has released the loot // or it IS the round robin group owner @@ -926,51 +943,13 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv) break; } case ALL_PERMISSION: - case MASTER_PERMISSION: case OWNER_PERMISSION: { - uint8 slot_type = LOOT_SLOT_TYPE_ALLOW_LOOT; - switch (lv.permission) - { - case MASTER_PERMISSION: - slot_type = LOOT_SLOT_TYPE_MASTER; - break; - case OWNER_PERMISSION: - slot_type = LOOT_SLOT_TYPE_OWNER; - break; - default: - break; - } - - for (uint8 i = 0; i < l.items.size(); ++i) - { - if (!l.items[i].is_looted && !l.items[i].freeforall && l.items[i].conditions.empty() && l.items[i].AllowedForPlayer(lv.viewer)) - { - b << uint8(i) << l.items[i]; - b << uint8(slot_type); - ++itemsShown; - } - } - break; - } - case RESTRICTED_PERMISSION: - { + uint8 slot_type = lv.permission == OWNER_PERMISSION ? LOOT_SLOT_TYPE_OWNER : LOOT_SLOT_TYPE_ALLOW_LOOT; for (uint8 i = 0; i < l.items.size(); ++i) { if (!l.items[i].is_looted && !l.items[i].freeforall && l.items[i].conditions.empty() && l.items[i].AllowedForPlayer(lv.viewer)) { - uint8 slot_type; - - if (l.items[i].is_blocked) - slot_type = LOOT_SLOT_TYPE_LOCKED; - else - { - if (l.roundRobinPlayer == 0 || lv.viewer->GetGUID() == l.roundRobinPlayer) - slot_type = LOOT_SLOT_TYPE_ALLOW_LOOT; - else - continue; // item shall not be displayed - } - b << uint8(i) << l.items[i]; b << uint8(slot_type); ++itemsShown; |