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:
@@ -1884,7 +1884,7 @@ namespace Game.Entities
|
||||
}
|
||||
}
|
||||
|
||||
UpdateForQuestWorldObjects();
|
||||
UpdateVisibleGameobjectsOrSpellClicks();
|
||||
PhasingHandler.OnConditionChange(this);
|
||||
}
|
||||
|
||||
@@ -2254,7 +2254,7 @@ namespace Game.Entities
|
||||
}
|
||||
}
|
||||
|
||||
UpdateForQuestWorldObjects();
|
||||
UpdateVisibleGameobjectsOrSpellClicks();
|
||||
}
|
||||
|
||||
public void KilledMonster(CreatureTemplate cInfo, ObjectGuid guid)
|
||||
@@ -2433,7 +2433,7 @@ namespace Game.Entities
|
||||
}
|
||||
|
||||
if (anyObjectiveChangedCompletionState)
|
||||
UpdateForQuestWorldObjects();
|
||||
UpdateVisibleGameobjectsOrSpellClicks();
|
||||
}
|
||||
|
||||
public bool HasQuestForItem(uint itemid)
|
||||
@@ -2900,7 +2900,7 @@ namespace Game.Entities
|
||||
return false;
|
||||
}
|
||||
|
||||
public void UpdateForQuestWorldObjects()
|
||||
public void UpdateVisibleGameobjectsOrSpellClicks()
|
||||
{
|
||||
if (m_clientGUIDs.Empty())
|
||||
return;
|
||||
@@ -2950,24 +2950,14 @@ namespace Game.Entities
|
||||
var clickBounds = Global.ObjectMgr.GetSpellClickInfoMapBounds(obj.GetEntry());
|
||||
foreach (var spellClickInfo in clickBounds)
|
||||
{
|
||||
//! This code doesn't look right, but it was logically converted to condition system to do the exact
|
||||
//! same thing it did before. It definitely needs to be overlooked for intended functionality.
|
||||
List<Condition> conds = Global.ConditionMgr.GetConditionsForSpellClickEvent(obj.GetEntry(), spellClickInfo.spellId);
|
||||
if (conds != null)
|
||||
{
|
||||
bool buildUpdateBlock = false;
|
||||
for (var i = 0; i < conds.Count && !buildUpdateBlock; ++i)
|
||||
if (conds[i].ConditionType == ConditionTypes.QuestRewarded || conds[i].ConditionType == ConditionTypes.QuestTaken || conds[i].ConditionType == ConditionTypes.QuestComplete)
|
||||
buildUpdateBlock = true;
|
||||
|
||||
if (buildUpdateBlock)
|
||||
{
|
||||
ObjectFieldData objMask = new();
|
||||
UnitData unitMask = new();
|
||||
unitMask.MarkChanged(obj.m_unitData.NpcFlags, 0); // NpcFlags[0] has UNIT_NPC_FLAG_SPELLCLICK
|
||||
obj.BuildValuesUpdateForPlayerWithMask(udata, objMask._changesMask, unitMask._changesMask, this);
|
||||
break;
|
||||
}
|
||||
ObjectFieldData objMask = new();
|
||||
UnitData unitMask = new();
|
||||
unitMask.MarkChanged(m_unitData.NpcFlags, 0); // NpcFlags[0] has UNIT_NPC_FLAG_SPELLCLICK
|
||||
obj.BuildValuesUpdateForPlayerWithMask(udata, objMask.GetUpdateMask(), unitMask.GetUpdateMask(), this);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3601,6 +3601,11 @@ namespace Game.Entities
|
||||
}
|
||||
|
||||
aura.HandleAuraSpecificMods(aurApp, caster, false, false);
|
||||
|
||||
Player player = ToPlayer();
|
||||
if (player != null)
|
||||
if (Global.ConditionMgr.IsSpellUsedInSpellClickConditions(aurApp.GetBase().GetId()))
|
||||
player.UpdateVisibleGameobjectsOrSpellClicks();
|
||||
}
|
||||
|
||||
public void _UnapplyAura(AuraApplication aurApp, AuraRemoveMode removeMode)
|
||||
@@ -3810,6 +3815,11 @@ namespace Game.Entities
|
||||
if (Convert.ToBoolean(effMask & 1 << i) && !(aurApp.HasRemoveMode()))
|
||||
aurApp._HandleEffect(i, true);
|
||||
}
|
||||
|
||||
Player player = ToPlayer();
|
||||
if (player != null)
|
||||
if (Global.ConditionMgr.IsSpellUsedInSpellClickConditions(aurApp.GetBase().GetId()))
|
||||
player.UpdateVisibleGameobjectsOrSpellClicks();
|
||||
}
|
||||
|
||||
public void _AddAura(UnitAura aura, Unit caster)
|
||||
|
||||
Reference in New Issue
Block a user