*Fix some restriction of pet spell cast.
--HG-- branch : trunk
This commit is contained in:
@@ -632,7 +632,12 @@ void WorldSession::HandlePetCastSpellOpcode( WorldPacket& recvPacket )
|
||||
spell->m_cast_count = spellid == 33395 ? 0 : cast_count; // probably pending spell cast
|
||||
spell->m_targets = targets;
|
||||
|
||||
SpellCastResult result = spell->CheckPetCast(NULL);
|
||||
// TODO: need to check victim?
|
||||
SpellCastResult result;
|
||||
if(caster->m_movedPlayer)
|
||||
result = spell->CheckPetCast(caster->m_movedPlayer->GetSelectedUnit());
|
||||
else
|
||||
result = spell->CheckPetCast(NULL);
|
||||
if(result == SPELL_CAST_OK)
|
||||
{
|
||||
if(caster->GetTypeId() == TYPEID_UNIT)
|
||||
|
||||
@@ -19168,6 +19168,20 @@ void Player::InitPrimaryProfessions()
|
||||
SetFreePrimaryProfessions(sWorld.getConfig(CONFIG_MAX_PRIMARY_TRADE_SKILL));
|
||||
}
|
||||
|
||||
Unit * Player::GetSelectedUnit() const
|
||||
{
|
||||
if(m_curSelection)
|
||||
return ObjectAccessor::GetUnit(*this, m_curSelection);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Player * Player::GetSelectedPlayer() const
|
||||
{
|
||||
if(m_curSelection)
|
||||
return ObjectAccessor::GetPlayer(*this, m_curSelection);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void Player::SendComboPoints()
|
||||
{
|
||||
Unit *combotarget = ObjectAccessor::GetUnit(*this, m_comboTarget);
|
||||
|
||||
@@ -1383,6 +1383,8 @@ class MANGOS_DLL_SPEC Player : public Unit
|
||||
QuestStatusMap& getQuestStatusMap() { return mQuestStatus; };
|
||||
|
||||
const uint64& GetSelection( ) const { return m_curSelection; }
|
||||
Unit *GetSelectedUnit() const;
|
||||
Player *GetSelectedPlayer() const;
|
||||
void SetSelection(const uint64 &guid) { m_curSelection = guid; SetUInt64Value(UNIT_FIELD_TARGET, guid); }
|
||||
|
||||
uint8 GetComboPoints() { return m_comboPoints; }
|
||||
|
||||
+6
-2
@@ -2685,11 +2685,11 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect* triggeredByAura
|
||||
// set timer base at cast time
|
||||
ReSetTimer();
|
||||
|
||||
sLog.outDebug("Spell::prepare: spell id %u source %u caster %d triggered %u", m_spellInfo->Id, m_caster->GetEntry(), m_originalCaster ? m_originalCaster->GetEntry() : -1, m_IsTriggeredSpell ? 1 : 0);
|
||||
sLog.outDebug("Spell::prepare: spell id %u source %u caster %d triggered %u mask %u", m_spellInfo->Id, m_caster->GetEntry(), m_originalCaster ? m_originalCaster->GetEntry() : -1, m_IsTriggeredSpell ? 1 : 0, m_targets.m_targetMask);
|
||||
//if(m_targets.getUnitTarget())
|
||||
// sLog.outError("Spell::prepare: unit target %u", m_targets.getUnitTarget()->GetEntry());
|
||||
//if(m_targets.HasDst())
|
||||
// sLog.outError("Spell::prepare: pos target %f %f %f", m_targets.m_destX, m_targets.m_destY, m_targets.m_destZ);
|
||||
// sLog.outError("Spell::prepare: pos target %f %f %f", m_targets.m_dstPos.m_positionX, m_targets.m_dstPos.m_positionY, m_targets.m_dstPos.m_positionZ);
|
||||
|
||||
//Containers for channeled spells have to be set
|
||||
//TODO:Apply this to all casted spells if needed
|
||||
@@ -4512,6 +4512,9 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
}
|
||||
}
|
||||
|
||||
// who can give me an example to show what is the use of this
|
||||
// even if we need check, check by effect rather than whole spell, otherwise 57108,57143 are broken
|
||||
/*
|
||||
// TODO: this check can be applied and for player to prevent cheating when IsPositiveSpell will return always correct result.
|
||||
// check target for pet/charmed casts (not self targeted), self targeted cast used for area effects and etc
|
||||
if(non_caster_target && m_caster->GetTypeId() == TYPEID_UNIT && m_caster->GetCharmerOrOwnerGUID())
|
||||
@@ -4529,6 +4532,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
if(IsPositiveSpell(m_spellInfo->Id))
|
||||
if(target->IsImmunedToSpell(m_spellInfo))
|
||||
|
||||
Reference in New Issue
Block a user