aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Entities/GameObject
diff options
context:
space:
mode:
authorjackpoz <giacomopoz@gmail.com>2016-09-24 14:43:18 +0200
committerjoschiwald <joschiwald.trinity@gmail.com>2017-03-03 22:31:28 +0100
commit9d09307e344fbfe7e0b7ac9b65de45229d11b483 (patch)
tree515b229c4a371006b84581e3dfb7b4a42758ef72 /src/server/game/Entities/GameObject
parentdf3e8cab1256d74125bd2b32cb710e2681b5416d (diff)
Scripts/ICC: Fix chest loot exploit
Fix an exploit at chest loot bosses Valithria and Deathbringer that allowed the first played to hit them to leave party at low hp % and loot the whole chest alone, without the party being able to loot anything. (cherry picked from commit c4865fe63ee4bb9d401d09cb9543acaf9c853b56) # Conflicts: # src/server/game/Entities/GameObject/GameObject.cpp
Diffstat (limited to 'src/server/game/Entities/GameObject')
-rw-r--r--src/server/game/Entities/GameObject/GameObject.cpp10
-rw-r--r--src/server/game/Entities/GameObject/GameObject.h2
2 files changed, 8 insertions, 4 deletions
diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp
index 47391d8a6bb..d5931dc1718 100644
--- a/src/server/game/Entities/GameObject/GameObject.cpp
+++ b/src/server/game/Entities/GameObject/GameObject.cpp
@@ -2304,7 +2304,7 @@ Group* GameObject::GetLootRecipientGroup() const
return sGroupMgr->GetGroupByGUID(m_lootRecipientGroup);
}
-void GameObject::SetLootRecipient(Unit* unit)
+void GameObject::SetLootRecipient(Unit* unit, Group* group)
{
// set the player whose group should receive the right
// to loot the creature after it dies
@@ -2313,7 +2313,7 @@ void GameObject::SetLootRecipient(Unit* unit)
if (!unit)
{
m_lootRecipient.Clear();
- m_lootRecipientGroup.Clear();
+ m_lootRecipientGroup = group ? group->GetGUID() : ObjectGuid::Empty;
return;
}
@@ -2325,8 +2325,12 @@ void GameObject::SetLootRecipient(Unit* unit)
return;
m_lootRecipient = player->GetGUID();
- if (Group* group = player->GetGroup())
+
+ // either get the group from the passed parameter or from unit's one
+ if (group)
m_lootRecipientGroup = group->GetGUID();
+ else if (Group* unitGroup = player->GetGroup())
+ m_lootRecipientGroup = unitGroup->GetGUID();
}
bool GameObject::IsLootAllowedFor(Player const* player) const
diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h
index b2173ad170b..0e22c841022 100644
--- a/src/server/game/Entities/GameObject/GameObject.h
+++ b/src/server/game/Entities/GameObject/GameObject.h
@@ -1075,7 +1075,7 @@ class TC_GAME_API GameObject : public WorldObject, public GridObject<GameObject>
Player* GetLootRecipient() const;
Group* GetLootRecipientGroup() const;
- void SetLootRecipient(Unit* unit);
+ void SetLootRecipient(Unit* unit, Group* group = nullptr);
bool IsLootAllowedFor(Player const* player) const;
bool HasLootRecipient() const { return !m_lootRecipient.IsEmpty() || !m_lootRecipientGroup.IsEmpty(); }
uint32 m_groupLootTimer; // (msecs)timer used for group loot