mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-22 21:26:23 +00:00
fix(Core): loot party (#4409)
This commit is contained in:
@@ -18599,6 +18599,9 @@ bool Player::isAllowedToLoot(const Creature* creature)
|
||||
if (loot->isLooted()) // nothing to loot or everything looted.
|
||||
return false;
|
||||
|
||||
if (!loot->hasItemForAll() && !loot->hasItemFor(this)) // no loot in creature for this player
|
||||
return false;
|
||||
|
||||
Group* thisGroup = GetGroup();
|
||||
if (!thisGroup)
|
||||
return this == creature->GetLootRecipient();
|
||||
|
||||
@@ -392,13 +392,10 @@ void WorldSession::DoLootRelease(uint64 lguid)
|
||||
loot->roundRobinPlayer = 0;
|
||||
|
||||
if (Group* group = player->GetGroup())
|
||||
{
|
||||
group->SendLooter(creature, nullptr);
|
||||
|
||||
// force update of dynamic flags, otherwise other group's players still not able to loot.
|
||||
creature->ForceValuesUpdateAtIndex(UNIT_DYNAMIC_FLAGS);
|
||||
}
|
||||
}
|
||||
// force dynflag update to update looter and lootable info
|
||||
creature->ForceValuesUpdateAtIndex(UNIT_DYNAMIC_FLAGS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -781,6 +781,14 @@ uint32 Loot::GetMaxSlotInLootFor(Player* player) const
|
||||
return items.size() + (itr != PlayerQuestItems.end() ? itr->second->size() : 0);
|
||||
}
|
||||
|
||||
bool Loot::hasItemForAll() const
|
||||
{
|
||||
for (LootItem const& item : items)
|
||||
if (!item.is_looted && !item.freeforall && item.conditions.empty())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
// return true if there is any FFA, quest or conditional item for the player.
|
||||
bool Loot::hasItemFor(Player* player) const
|
||||
{
|
||||
|
||||
@@ -364,6 +364,7 @@ struct Loot
|
||||
|
||||
LootItem* LootItemInSlot(uint32 lootslot, Player* player, QuestItem** qitem = nullptr, QuestItem** ffaitem = nullptr, QuestItem** conditem = nullptr);
|
||||
uint32 GetMaxSlotInLootFor(Player* player) const;
|
||||
bool hasItemForAll() const;
|
||||
bool hasItemFor(Player* player) const;
|
||||
[[nodiscard]] bool hasOverThresholdItem() const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user