mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/GameObjects: Fixed gameobject spell casts failing when triggered by SPELL_EFFECT_OPEN_LOCK
This commit is contained in:
@@ -2569,12 +2569,14 @@ void GameObject::SwitchDoorOrButton(bool activate, bool alternative /* = false *
|
||||
SetGoState(GO_STATE_READY);
|
||||
}
|
||||
|
||||
void GameObject::Use(Unit* user)
|
||||
void GameObject::Use(Unit* user, bool ignoreCastInProgress /*= false*/)
|
||||
{
|
||||
// by default spell caster is user
|
||||
Unit* spellCaster = user;
|
||||
uint32 spellId = 0;
|
||||
bool triggered = false;
|
||||
CastSpellExtraArgs spellArgs;
|
||||
if (ignoreCastInProgress)
|
||||
spellArgs.TriggerFlags |= TRIGGERED_IGNORE_CAST_IN_PROGRESS;
|
||||
|
||||
if (Player* playerUser = user->ToPlayer())
|
||||
{
|
||||
@@ -2966,7 +2968,7 @@ void GameObject::Use(Unit* user)
|
||||
|
||||
if (fishingPool)
|
||||
{
|
||||
fishingPool->Use(player);
|
||||
fishingPool->Use(player, ignoreCastInProgress);
|
||||
SetLootState(GO_JUST_DEACTIVATED);
|
||||
}
|
||||
else
|
||||
@@ -3049,7 +3051,7 @@ void GameObject::Use(Unit* user)
|
||||
player->CastSpell(player, info->ritual.animSpell, true);
|
||||
|
||||
// for this case, summoningRitual.spellId is always triggered
|
||||
triggered = true;
|
||||
spellArgs.TriggerFlags = TRIGGERED_FULL_MASK;
|
||||
}
|
||||
|
||||
// full amount unique participants including original summoner
|
||||
@@ -3065,7 +3067,7 @@ void GameObject::Use(Unit* user)
|
||||
// spell have reagent and mana cost but it not expected use its
|
||||
// it triggered spell in fact cast at currently channeled GO
|
||||
spellId = 61993;
|
||||
triggered = true;
|
||||
spellArgs.TriggerFlags = TRIGGERED_FULL_MASK;
|
||||
}
|
||||
|
||||
// Cast casterTargetSpell at a random GO user
|
||||
@@ -3495,10 +3497,10 @@ void GameObject::Use(Unit* user)
|
||||
sOutdoorPvPMgr->HandleCustomSpell(player, spellId, this);
|
||||
|
||||
if (spellCaster)
|
||||
spellCaster->CastSpell(user, spellId, triggered);
|
||||
spellCaster->CastSpell(user, spellId, spellArgs);
|
||||
else
|
||||
{
|
||||
SpellCastResult castResult = CastSpell(user, spellId);
|
||||
SpellCastResult castResult = CastSpell(user, spellId, spellArgs);
|
||||
if (castResult == SPELL_FAILED_SUCCESS)
|
||||
{
|
||||
switch (GetGoType())
|
||||
|
||||
@@ -297,7 +297,7 @@ class TC_GAME_API GameObject : public WorldObject, public GridObject<GameObject>
|
||||
|
||||
void EnableCollision(bool enable);
|
||||
|
||||
void Use(Unit* user);
|
||||
void Use(Unit* user, bool ignoreCastInProgress = false);
|
||||
|
||||
LootState getLootState() const { return m_lootState; }
|
||||
// Note: unit is only used when s = GO_ACTIVATED
|
||||
|
||||
@@ -1652,7 +1652,7 @@ void Spell::EffectOpenLock()
|
||||
}
|
||||
|
||||
if (gameObjTarget)
|
||||
gameObjTarget->Use(player);
|
||||
gameObjTarget->Use(player, true);
|
||||
else if (itemTarget)
|
||||
{
|
||||
itemTarget->SetItemFlag(ITEM_FIELD_FLAG_UNLOCKED);
|
||||
|
||||
Reference in New Issue
Block a user