diff options
-rwxr-xr-x | src/server/game/Entities/Player/Player.cpp | 6 | ||||
-rwxr-xr-x | src/server/game/Entities/Unit/Unit.cpp | 20 |
2 files changed, 16 insertions, 10 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 65f6588f80e..142b5939d9b 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -24502,11 +24502,11 @@ bool Player::canSeeSpellClickOn(Creature const* c) const ConditionList conds = sConditionMgr->GetConditionsForSpellClickEvent(c->GetEntry(), itr->second.spellId); ConditionSourceInfo info = ConditionSourceInfo(const_cast<Player*>(this), const_cast<Creature*>(c)); - if (!sConditionMgr->IsObjectMeetToConditions(info, conds)) - return false; + if (sConditionMgr->IsObjectMeetToConditions(info, conds)) + return true; } - return true; + return false; } void Player::BuildPlayerTalentsInfoData(WorldPacket* data) diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 864c9f43dc7..55668af3679 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -16968,19 +16968,20 @@ void Unit::JumpTo(WorldObject* obj, float speedZ) bool Unit::HandleSpellClick(Unit* clicker, int8 seatId) { + bool result = false; uint32 spellClickEntry = GetVehicleKit() ? GetVehicleKit()->GetCreatureEntry() : GetEntry(); SpellClickInfoMapBounds clickPair = sObjectMgr->GetSpellClickInfoMapBounds(spellClickEntry); for (SpellClickInfoContainer::const_iterator itr = clickPair.first; itr != clickPair.second; ++itr) { //! First check simple relations from clicker to clickee if (!itr->second.IsFitToRequirements(clicker, this)) - return false; + continue; //! Check database conditions ConditionList conds = sConditionMgr->GetConditionsForSpellClickEvent(spellClickEntry, itr->second.spellId); ConditionSourceInfo info = ConditionSourceInfo(clicker, this); if (!sConditionMgr->IsObjectMeetToConditions(info, conds)) - return false; + continue; Unit* caster = (itr->second.castFlags & NPC_CLICK_CAST_CASTER_CLICKER) ? clicker : this; Unit* target = (itr->second.castFlags & NPC_CLICK_CAST_TARGET_CLICKER) ? clicker : this; @@ -17006,7 +17007,7 @@ bool Unit::HandleSpellClick(Unit* clicker, int8 seatId) if (!valid) { sLog->outError(LOG_FILTER_SQL, "Spell %u specified in npc_spellclick_spells is not a valid vehicle enter aura!", itr->second.spellId); - return false; + continue; } if (IsInMap(caster)) @@ -17024,13 +17025,18 @@ bool Unit::HandleSpellClick(Unit* clicker, int8 seatId) else Aura::TryRefreshStackOrCreate(spellEntry, MAX_EFFECT_MASK, this, clicker, NULL, NULL, origCasterGUID); } + + result = true; } - Creature* creature = ToCreature(); - if (creature && creature->IsAIEnabled) - creature->AI()->OnSpellClick(clicker); + if(result) + { + Creature* creature = ToCreature(); + if (creature && creature->IsAIEnabled) + creature->AI()->OnSpellClick(clicker); + } - return true; + return result; } void Unit::EnterVehicle(Unit* base, int8 seatId) |