Core/Loot: Prevent looting bosses by players that have already completed that encounter
Port From (https://github.com/TrinityCore/TrinityCore/commit/9ce47e6809eecc891904e272b368596fdc55e6a4)
This commit is contained in:
@@ -119,6 +119,9 @@ namespace Game
|
||||
if (!member)
|
||||
continue;
|
||||
|
||||
if (!loot.HasAllowedLooter(member.GetGUID()))
|
||||
continue;
|
||||
|
||||
if (player.IsAtGroupRewardDistance(member))
|
||||
playersNear.Add(member);
|
||||
}
|
||||
@@ -406,15 +409,21 @@ namespace Game
|
||||
{
|
||||
Loot loot = _player.GetAELootView().LookupByKey(req.Object);
|
||||
|
||||
if (loot == null || loot.GetLootMethod() != LootMethod.MasterLoot)
|
||||
return;
|
||||
|
||||
if (!_player.IsInRaidWith(target) || !_player.IsInMap(target))
|
||||
{
|
||||
_player.SendLootError(req.Object, ObjectGuid.Empty, LootError.MasterOther);
|
||||
_player.SendLootError(req.Object, loot.GetOwnerGUID(), LootError.MasterOther);
|
||||
Log.outInfo(LogFilter.Cheat, $"MasterLootItem: Player {GetPlayer().GetName()} tried to give an item to ineligible player {target.GetName()} !");
|
||||
return;
|
||||
}
|
||||
|
||||
if (loot == null || loot.GetLootMethod() != LootMethod.MasterLoot)
|
||||
if (!loot.HasAllowedLooter(masterLootItem.Target))
|
||||
{
|
||||
_player.SendLootError(req.Object, loot.GetOwnerGUID(), LootError.MasterOther);
|
||||
return;
|
||||
}
|
||||
|
||||
if (req.LootListID >= loot.items.Count)
|
||||
{
|
||||
@@ -426,16 +435,16 @@ namespace Game
|
||||
|
||||
List<ItemPosCount> dest = new();
|
||||
InventoryResult msg = target.CanStoreNewItem(ItemConst.NullBag, ItemConst.NullSlot, dest, item.itemid, item.count);
|
||||
if (!item.AllowedForPlayer(target, true))
|
||||
if (!item.HasAllowedLooter(target.GetGUID()))
|
||||
msg = InventoryResult.CantEquipEver;
|
||||
if (msg != InventoryResult.Ok)
|
||||
{
|
||||
if (msg == InventoryResult.ItemMaxCount)
|
||||
_player.SendLootError(req.Object, ObjectGuid.Empty, LootError.MasterUniqueItem);
|
||||
_player.SendLootError(req.Object, loot.GetOwnerGUID(), LootError.MasterUniqueItem);
|
||||
else if (msg == InventoryResult.InvFull)
|
||||
_player.SendLootError(req.Object, ObjectGuid.Empty, LootError.MasterInvFull);
|
||||
_player.SendLootError(req.Object, loot.GetOwnerGUID(), LootError.MasterInvFull);
|
||||
else
|
||||
_player.SendLootError(req.Object, ObjectGuid.Empty, LootError.MasterOther);
|
||||
_player.SendLootError(req.Object, loot.GetOwnerGUID(), LootError.MasterOther);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user