diff options
-rw-r--r-- | dep/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/server/game/Entities/Creature/Creature.cpp | 27 | ||||
-rw-r--r-- | src/server/game/Entities/Creature/Creature.h | 4 | ||||
-rw-r--r-- | src/server/game/Entities/Player/Player.cpp | 19 | ||||
-rw-r--r-- | src/server/worldserver/worldserver.conf.dist | 4 |
5 files changed, 31 insertions, 25 deletions
diff --git a/dep/CMakeLists.txt b/dep/CMakeLists.txt index 8e097ddb129..cc9be84a809 100644 --- a/dep/CMakeLists.txt +++ b/dep/CMakeLists.txt @@ -11,7 +11,7 @@ if( CMAKE_COMPILER_IS_GNUCXX ) add_definitions(--no-warnings) elseif( MSVC ) - add_definitions( /w ) + add_definitions(/W0) endif() if(CMAKE_SYSTEM_NAME MATCHES "Linux") diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 749cfbc310e..6cc80f74fd6 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -946,8 +946,16 @@ void Creature::AI_SendMoveToPacket(float x, float y, float z, uint32 time, uint3 Player *Creature::GetLootRecipient() const { - if (!m_lootRecipient) return NULL; - else return ObjectAccessor::FindPlayer(m_lootRecipient); + if (!m_lootRecipient) + return NULL; + return ObjectAccessor::FindPlayer(m_lootRecipient); +} + +Group *Creature::GetLootRecipientGroup() const +{ + if (!m_lootRecipientGroup) + return NULL; + return sObjectMgr.GetGroupByGUID(m_lootRecipientGroup); } void Creature::SetLootRecipient(Unit *unit) @@ -971,6 +979,9 @@ void Creature::SetLootRecipient(Unit *unit) return; m_lootRecipient = player->GetGUID(); + if (Group *group = player->GetGroup()) + m_lootRecipientGroup = group->GetLowGUID(); + SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_TAPPED); } @@ -980,17 +991,9 @@ 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; + if (!playerGroup || playerGroup != GetLootRecipientGroup()) // if we dont have a group we arent the recipient + return false; // if creature doesnt have group bound it means it was solo killed by someone else return true; } diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index eb4f15e19ce..13c9639687c 100644 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.h @@ -541,7 +541,8 @@ class Creature : public Unit, public GridObject<Creature> bool lootForPickPocketed; bool lootForBody; Player *GetLootRecipient() const; - bool hasLootRecipient() const { return m_lootRecipient != 0; } + Group *GetLootRecipientGroup() const; + bool hasLootRecipient() const { return m_lootRecipient || m_lootRecipientGroup; } bool isTappedBy(Player *player) const; // return true if the creature is tapped by the player or a member of his party. void SetLootRecipient (Unit* unit); @@ -682,6 +683,7 @@ class Creature : public Unit, public GridObject<Creature> uint32 m_lootMoney; uint64 m_lootRecipient; + uint32 m_lootRecipientGroup; /// Timers time_t m_corpseRemoveTime; // (msecs)timer for death or corpse disappearance diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 6cdadb9a989..8223959fc14 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -8458,10 +8458,13 @@ void Player::SendLoot(uint64 guid, LootType loot_type) } else { + // the player whose group may loot the corpse Player *recipient = creature->GetLootRecipient(); - if (!recipient) - return; + { + creature->SetLootRecipient(this); + recipient = this; + } if (!creature->lootForBody) { @@ -16488,16 +16491,10 @@ bool Player::isAllowedToLoot(const Creature* creature) if (loot->isLooted()) // nothing to loot or everything looted. return false; - Player* recipient = creature->GetLootRecipient(); - if (!recipient) - return false; - - Group* recipientGroup = recipient->GetGroup(); - if (!recipientGroup) - return (this == recipient); - Group* thisGroup = GetGroup(); - if (!thisGroup || thisGroup != recipientGroup) + if (!thisGroup) + return this == creature->GetLootRecipient(); + else if (thisGroup != creature->GetLootRecipientGroup()) return false; switch(thisGroup->GetLootMethod()) diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index 451ab7efb9b..5ca53cdf61e 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -1489,6 +1489,10 @@ Visibility.Notify.Period.InBGArenas = 1000 # Drop rates (items by quality and money) # Default: 1 # +# Rate.Drop.Item.ReferencedAmount +# Multiplier for referenced loot +# Default: 1 +# # Rate.Drop.Money # Drop rates # Default: 1 |