Core/Spells: Implemented SPELL_EFFECT_CANCEL_CONVERSATION
Port From (https://github.com/TrinityCore/TrinityCore/commit/1673b6e2ff69b9a59522892280e91cc5085a5ec0)
This commit is contained in:
@@ -80,7 +80,7 @@ namespace Game.Entities
|
||||
base.Update(diff);
|
||||
}
|
||||
|
||||
void Remove()
|
||||
public void Remove()
|
||||
{
|
||||
if (IsInWorld)
|
||||
{
|
||||
|
||||
@@ -1341,6 +1341,7 @@ namespace Game.Maps
|
||||
WorldObject _searcher;
|
||||
ICheck<WorldObject> i_check;
|
||||
}
|
||||
|
||||
public class WorldObjectListSearcher : Notifier
|
||||
{
|
||||
public WorldObjectListSearcher(WorldObject searcher, List<WorldObject> objects, ICheck<WorldObject> check, GridMapTypeMask mapTypeMask = GridMapTypeMask.All)
|
||||
@@ -2642,6 +2643,23 @@ namespace Game.Maps
|
||||
ObjectGuid _casterGUID;
|
||||
}
|
||||
|
||||
class ObjectEntryAndPrivateOwnerIfExistsCheck : ICheck<WorldObject>
|
||||
{
|
||||
ObjectGuid _ownerGUID;
|
||||
uint _entry;
|
||||
|
||||
public ObjectEntryAndPrivateOwnerIfExistsCheck(ObjectGuid ownerGUID, uint entry)
|
||||
{
|
||||
_ownerGUID = ownerGUID;
|
||||
_entry = entry;
|
||||
}
|
||||
|
||||
public bool Invoke(WorldObject obj)
|
||||
{
|
||||
return obj.GetEntry() == _entry && (!obj.IsPrivateObject() || obj.GetPrivateObjectOwner() == _ownerGUID);
|
||||
}
|
||||
}
|
||||
|
||||
class GameObjectFocusCheck : ICheck<GameObject>
|
||||
{
|
||||
public GameObjectFocusCheck(WorldObject caster, uint focusId)
|
||||
|
||||
@@ -5336,6 +5336,28 @@ namespace Game.Spells
|
||||
Conversation.CreateConversation((uint)effectInfo.MiscValue, unitCaster, destTarget.GetPosition(), ObjectGuid.Empty, GetSpellInfo());
|
||||
}
|
||||
|
||||
[SpellEffectHandler(SpellEffectName.CancelConversation)]
|
||||
void EffectCancelConversation()
|
||||
{
|
||||
if (effectHandleMode != SpellEffectHandleMode.HitTarget)
|
||||
return;
|
||||
|
||||
if (!unitTarget)
|
||||
return;
|
||||
|
||||
List<WorldObject> objs = new();
|
||||
ObjectEntryAndPrivateOwnerIfExistsCheck check = new(unitTarget.GetGUID(), (uint)effectInfo.MiscValue);
|
||||
WorldObjectListSearcher checker = new(unitTarget, objs, check, GridMapTypeMask.Conversation);
|
||||
Cell.VisitGridObjects(unitTarget, checker, 100.0f);
|
||||
|
||||
foreach (WorldObject obj in objs)
|
||||
{
|
||||
Conversation convo = obj.ToConversation();
|
||||
if (convo != null)
|
||||
convo.Remove();
|
||||
}
|
||||
}
|
||||
|
||||
[SpellEffectHandler(SpellEffectName.AddGarrisonFollower)]
|
||||
void EffectAddGarrisonFollower()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user