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:
@@ -789,7 +789,7 @@ namespace Game.Misc
|
||||
public uint BoxBroadcastTextId;
|
||||
public int? SpellID;
|
||||
public int? OverrideIconID;
|
||||
public List<Condition> Conditions = new();
|
||||
public ConditionsReference Conditions;
|
||||
}
|
||||
|
||||
public class GossipMenuAddon
|
||||
@@ -817,6 +817,6 @@ namespace Game.Misc
|
||||
{
|
||||
public uint MenuId;
|
||||
public uint TextId;
|
||||
public List<Condition> Conditions = new();
|
||||
public ConditionsReference Conditions;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3301,8 +3301,7 @@ namespace Game.Entities
|
||||
var clickBounds = Global.ObjectMgr.GetSpellClickInfoMapBounds(obj.GetEntry());
|
||||
foreach (var spellClickInfo in clickBounds)
|
||||
{
|
||||
List<Condition> conds = Global.ConditionMgr.GetConditionsForSpellClickEvent(obj.GetEntry(), spellClickInfo.spellId);
|
||||
if (conds != null)
|
||||
if (Global.ConditionMgr.HasConditionsForSpellClickEvent(obj.GetEntry(), spellClickInfo.spellId))
|
||||
{
|
||||
ObjectFieldData objMask = new();
|
||||
UnitData unitMask = new();
|
||||
|
||||
@@ -2564,7 +2564,7 @@ namespace Game.Entities
|
||||
|
||||
foreach (var gossipMenuItem in menuItemBounds)
|
||||
{
|
||||
if (!ConditionMgr.IsObjectMeetToConditions(this, source, gossipMenuItem.Conditions))
|
||||
if (!gossipMenuItem.Conditions.Meets(this, source))
|
||||
continue;
|
||||
|
||||
bool canTalk = true;
|
||||
@@ -2889,7 +2889,7 @@ namespace Game.Entities
|
||||
if (menu.TextId == 0)
|
||||
continue;
|
||||
|
||||
if (ConditionMgr.IsObjectMeetToConditions(this, source, menu.Conditions))
|
||||
if (menu.Conditions.Meets(this, source))
|
||||
textId = menu.TextId;
|
||||
}
|
||||
|
||||
@@ -2913,9 +2913,9 @@ namespace Game.Entities
|
||||
{
|
||||
var menuBounds = ObjectMgr.GetGossipMenusMapBounds(menuId);
|
||||
|
||||
foreach (var itr in menuBounds)
|
||||
foreach (var menu in menuBounds)
|
||||
{
|
||||
if (!ConditionMgr.IsObjectMeetToConditions(this, source, itr.Conditions))
|
||||
if (!menu.Conditions.Meets(this, source))
|
||||
continue;
|
||||
|
||||
menuIdToShow = menuId;
|
||||
|
||||
Reference in New Issue
Block a user