diff options
author | Trazom62 <none@none> | 2010-03-14 00:22:53 +0100 |
---|---|---|
committer | Trazom62 <none@none> | 2010-03-14 00:22:53 +0100 |
commit | 6fdaf225f3bb9ce84e74f40e56727ccfea729a38 (patch) | |
tree | 381d341248fc721a4f9255c5756736560caaea54 /src/game/Creature.cpp | |
parent | 274268a68643c949cd914229fe31e98dc4c862c4 (diff) |
Fix creature tapped and lootable dynamic flags => fix creature not lootable.
Fixes issue #1067.
--HG--
branch : trunk
Diffstat (limited to 'src/game/Creature.cpp')
-rw-r--r-- | src/game/Creature.cpp | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index 9b4332a579f..8404702f748 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -973,8 +973,7 @@ void Creature::SetLootRecipient(Unit *unit) if (!unit) { m_lootRecipient = 0; - RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); - RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_TAPPED); + RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE|UNIT_DYNFLAG_TAPPED); return; } @@ -986,6 +985,27 @@ void Creature::SetLootRecipient(Unit *unit) SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_TAPPED); } +// return true if this creature is tapped by the player or by a member of his group. +bool Creature::isTappedBy(Player *player) const +{ + if (player->GetGUID() == m_lootRecipient) + return true; + + Player* recipient = GetLootRecipient(); + if (!recipient) + return false; // recipient exist but is offline. can't check any further. + + Group* recipientGroup = recipient->GetGroup(); + if (!recipientGroup) + return (player == recipient); + + Group* playerGroup = player->GetGroup(); + if (!playerGroup || playerGroup != recipientGroup) + return false; + + return true; +} + void Creature::SaveToDB() { // this should only be used when the creature has already been loaded |