Core/Conditions: Allow multiple condition for spellclick source type
Currently unused in 335 but required for some 434 spellclicks
This commit is contained in:
1 parent
340dc33b52
commit
aed0ecd2e4
2 files changed
+16
-10
No files matched your search
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user