aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/PetHandler.cpp7
-rw-r--r--src/game/Player.cpp14
-rw-r--r--src/game/Player.h2
-rw-r--r--src/game/Spell.cpp8
4 files changed, 28 insertions, 3 deletions
diff --git a/src/game/PetHandler.cpp b/src/game/PetHandler.cpp
index 53c9873be72..0975a072841 100644
--- a/src/game/PetHandler.cpp
+++ b/src/game/PetHandler.cpp
@@ -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)
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index 215a1644134..7b229609c30 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -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);
diff --git a/src/game/Player.h b/src/game/Player.h
index 81616f279db..969d2a73960 100644
--- a/src/game/Player.h
+++ b/src/game/Player.h
@@ -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; }
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index 2f0b3a33a9f..f7593750ad7 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -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))