diff options
author | cyberbrest <cyberbrest@cyberbrest.com> | 2012-09-06 20:03:21 +0100 |
---|---|---|
committer | Nay <dnpd.dd@gmail.com> | 2012-09-06 20:03:21 +0100 |
commit | aed0ecd2e4b8471fb1e8e77d4a9c992835f61f7c (patch) | |
tree | ef6e47d1d7f7125d9c1cf0df7bd9350c03d888c1 | |
parent | 340dc33b52a7491c1e4a620cca9b4d3f2b349dc2 (diff) |
Core/Conditions: Allow multiple condition for spellclick source type
Currently unused in 335 but required for some 434 spellclicks
-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) |