Core/Conditions: Refactor ConditionMgr internals to get rid of separate containers for some condition source types
Port From (https://github.com/TrinityCore/TrinityCore/commit/0b5406dd882c6d96bc1be6fd0a78375c3b316415)
This commit is contained in:
@@ -42,10 +42,10 @@ namespace Game.Loots
|
||||
return AllowedForPlayer(player, loot, itemid, needs_quest, follow_loot_rules, false, conditions);
|
||||
}
|
||||
|
||||
public static bool AllowedForPlayer(Player player, Loot loot, uint itemid, bool needs_quest, bool follow_loot_rules, bool strictUsabilityCheck, List<Condition> conditions)
|
||||
public static bool AllowedForPlayer(Player player, Loot loot, uint itemid, bool needs_quest, bool follow_loot_rules, bool strictUsabilityCheck, ConditionsReference conditions)
|
||||
{
|
||||
// DB conditions check
|
||||
if (!Global.ConditionMgr.IsObjectMeetToConditions(player, conditions))
|
||||
if (!conditions.Meets(player))
|
||||
return false;
|
||||
|
||||
ItemTemplate pProto = Global.ObjectMgr.GetItemTemplate(itemid);
|
||||
@@ -180,7 +180,7 @@ namespace Game.Loots
|
||||
public uint randomBonusListId;
|
||||
public List<uint> BonusListIDs = new();
|
||||
public ItemContext context;
|
||||
public List<Condition> conditions = new(); // additional loot condition
|
||||
public ConditionsReference conditions; // additional loot condition
|
||||
public List<ObjectGuid> allowedGUIDs = new();
|
||||
public ObjectGuid rollWinnerGUID; // Stores the guid of person who won loot, if his bags are full only he can see the item in loot list!
|
||||
public byte count;
|
||||
@@ -999,7 +999,7 @@ namespace Game.Loots
|
||||
return true;
|
||||
|
||||
foreach (LootItem item in items)
|
||||
if (!item.is_looted && item.follow_loot_rules && !item.freeforall && item.conditions.Empty())
|
||||
if (!item.is_looted && item.follow_loot_rules && !item.freeforall && item.conditions.IsEmpty())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user