Core/Loot: make Loot::AddItem() honor LootItem::AllowedForPlayer() so that items that cannot be looted don't prevent skinning.
Port From (https://github.com/TrinityCore/TrinityCore/commit/ef4d4e3d98eeb1edb2e0eb5dc92ba40aea9996f7)
This commit is contained in:
@@ -205,6 +205,29 @@ namespace Game.Loots
|
|||||||
lootItems.Add(generatedLoot);
|
lootItems.Add(generatedLoot);
|
||||||
count -= proto.GetMaxStackSize();
|
count -= proto.GetMaxStackSize();
|
||||||
|
|
||||||
|
// In some cases, a dropped item should be visible/lootable only for some players in group
|
||||||
|
bool canSeeItemInLootWindow = false;
|
||||||
|
Player player = Global.ObjAccessor.FindPlayer(lootOwnerGUID);
|
||||||
|
if (player != null)
|
||||||
|
{
|
||||||
|
Group group = player.GetGroup();
|
||||||
|
if (group != null)
|
||||||
|
{
|
||||||
|
for (GroupReference itr = group.GetFirstMember(); itr != null; itr = itr.Next())
|
||||||
|
{
|
||||||
|
Player member = itr.GetSource();
|
||||||
|
if (member != null)
|
||||||
|
if (generatedLoot.AllowedForPlayer(member))
|
||||||
|
canSeeItemInLootWindow = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (generatedLoot.AllowedForPlayer(player))
|
||||||
|
canSeeItemInLootWindow = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!canSeeItemInLootWindow)
|
||||||
|
continue;
|
||||||
|
|
||||||
// non-conditional one-player only items are counted here,
|
// non-conditional one-player only items are counted here,
|
||||||
// free for all items are counted in FillFFALoot(),
|
// free for all items are counted in FillFFALoot(),
|
||||||
// non-ffa conditionals are counted in FillNonQuestNonFFAConditionalLoot()
|
// non-ffa conditionals are counted in FillNonQuestNonFFAConditionalLoot()
|
||||||
@@ -232,6 +255,8 @@ namespace Game.Loots
|
|||||||
if (lootOwner == null)
|
if (lootOwner == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
lootOwnerGUID = lootOwner.GetGUID();
|
||||||
|
|
||||||
LootTemplate tab = store.GetLootFor(lootId);
|
LootTemplate tab = store.GetLootFor(lootId);
|
||||||
if (tab == null)
|
if (tab == null)
|
||||||
{
|
{
|
||||||
@@ -851,6 +876,7 @@ namespace Game.Loots
|
|||||||
public uint gold;
|
public uint gold;
|
||||||
public byte unlootedCount;
|
public byte unlootedCount;
|
||||||
public ObjectGuid roundRobinPlayer; // GUID of the player having the Round-Robin ownership for the loot. If 0, round robin owner has released.
|
public ObjectGuid roundRobinPlayer; // GUID of the player having the Round-Robin ownership for the loot. If 0, round robin owner has released.
|
||||||
|
ObjectGuid lootOwnerGUID;
|
||||||
public LootType loot_type; // required for achievement system
|
public LootType loot_type; // required for achievement system
|
||||||
public byte maxDuplicates; // Max amount of items with the same entry that can drop (default is 1; on 25 man raid mode 3)
|
public byte maxDuplicates; // Max amount of items with the same entry that can drop (default is 1; on 25 man raid mode 3)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user