Core/Conditions: allow spellclick conditions to properly work for aura apply/remove

Port From (https://github.com/TrinityCore/TrinityCore/commit/edf12fd6a1b989d7785bc0619002eda1ccc87368)
This commit is contained in:
hondacrx
2021-12-27 15:23:22 -05:00
parent 08678c970e
commit 7a47eaeb24
5 changed files with 37 additions and 25 deletions
@@ -279,6 +279,11 @@ namespace Game
return true;
}
public bool IsSpellUsedInSpellClickConditions(uint spellId)
{
return spellsUsedInSpellClickConditions.Contains(spellId);
}
public List<Condition> GetConditionsForAreaTrigger(uint areaTriggerId, bool isServerSide)
{
return areaTriggerConditionContainerStorage.LookupByKey(Tuple.Create(areaTriggerId, isServerSide));
@@ -486,6 +491,8 @@ namespace Game
spellClickEventConditionStorage[cond.SourceGroup] = new MultiMap<uint, Condition>();
spellClickEventConditionStorage[cond.SourceGroup].Add((uint)cond.SourceEntry, cond);
if (cond.ConditionType == ConditionTypes.Aura)
spellsUsedInSpellClickConditions.Add(cond.ConditionValue1);
++count;
continue; // do not add to m_AllocatedMemory to avoid double deleting
}
@@ -550,6 +557,9 @@ namespace Game
}
//add new Condition to storage based on Type/Entry
if (cond.SourceType == ConditionSourceType.SpellClickEvent && cond.ConditionType == ConditionTypes.Aura)
spellsUsedInSpellClickConditions.Add(cond.ConditionValue1);
conditionStorage[cond.SourceType].Add((uint)cond.SourceEntry, cond);
++count;
}
@@ -1703,6 +1713,7 @@ namespace Game
smartEventConditionStorage.Clear();
spellClickEventConditionStorage.Clear();
spellsUsedInSpellClickConditions.Clear();
npcVendorConditionContainerStorage.Clear();
@@ -2488,6 +2499,7 @@ namespace Game
MultiMap<uint, Condition> conditionReferenceStorage = new();
Dictionary<uint, MultiMap<uint, Condition>> vehicleSpellConditionStorage = new();
Dictionary<uint, MultiMap<uint, Condition>> spellClickEventConditionStorage = new();
List<uint> spellsUsedInSpellClickConditions = new();
Dictionary<uint, MultiMap<uint, Condition>> npcVendorConditionContainerStorage = new();
Dictionary<Tuple<int, uint>, MultiMap<uint, Condition>> smartEventConditionStorage = new();
MultiMap<Tuple<uint, bool>, Condition> areaTriggerConditionContainerStorage = new();