aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoctorKraft <DoctorKraft@users.noreply.github.com>2017-03-21 17:36:44 +0100
committerShauren <shauren.trinity@gmail.com>2017-03-21 17:36:44 +0100
commit76dd3ae36849bc44cb77cad497575be446172d53 (patch)
tree2a2ff8949fbea14d46000d2de2c31da3acd92372
parent481825bd6d3139799cde79e14718d75ec603d728 (diff)
Core/Spells: Fixed EffectActivateSpec for hunter pets
Closes #19325
-rw-r--r--src/server/game/DataStores/DB2Structure.h5
-rw-r--r--src/server/game/Spells/Spell.cpp20
-rw-r--r--src/server/game/Spells/SpellEffects.cpp10
3 files changed, 29 insertions, 6 deletions
diff --git a/src/server/game/DataStores/DB2Structure.h b/src/server/game/DataStores/DB2Structure.h
index 68acb111477..075b4daadde 100644
--- a/src/server/game/DataStores/DB2Structure.h
+++ b/src/server/game/DataStores/DB2Structure.h
@@ -442,6 +442,11 @@ struct ChrSpecializationEntry
uint32 ID;
uint32 Flags;
uint32 AnimReplacementSetID;
+
+ bool IsPetSpecialization() const
+ {
+ return ClassID == 0;
+ }
};
struct CinematicCameraEntry
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index 7b2a71d9caf..dd5e4c70302 100644
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -5484,14 +5484,24 @@ SpellCastResult Spell::CheckCast(bool strict)
case SPELL_EFFECT_TALENT_SPEC_SELECT:
{
ChrSpecializationEntry const* spec = sChrSpecializationStore.LookupEntry(m_misc.SpecializationId);
- if (!spec || spec->ClassID != m_caster->getClass())
+ Player* player = m_caster->ToPlayer();
+ if (!player)
+ return SPELL_FAILED_TARGET_NOT_PLAYER;
+
+ if (!spec || (spec->ClassID != m_caster->getClass() && !spec->IsPetSpecialization()))
return SPELL_FAILED_NO_SPEC;
+ if (spec->IsPetSpecialization())
+ {
+ Pet* pet = player->GetPet();
+ if (!pet || pet->getPetType() != HUNTER_PET || !pet->GetCharmInfo())
+ return SPELL_FAILED_NO_PET;
+ }
+
// can't change during already started arena/battleground
- if (m_caster->GetTypeId() == TYPEID_PLAYER)
- if (Battleground const* bg = m_caster->ToPlayer()->GetBattleground())
- if (bg->GetStatus() == STATUS_IN_PROGRESS)
- return SPELL_FAILED_NOT_IN_BATTLEGROUND;
+ if (Battleground const* bg = player->GetBattleground())
+ if (bg->GetStatus() == STATUS_IN_PROGRESS)
+ return SPELL_FAILED_NOT_IN_BATTLEGROUND;
break;
}
case SPELL_EFFECT_REMOVE_TALENT:
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index e29f4c5eea1..af1fc188256 100644
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -5400,7 +5400,15 @@ void Spell::EffectActivateSpec(SpellEffIndex /*effIndex*/)
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
- unitTarget->ToPlayer()->ActivateTalentGroup(sChrSpecializationStore.AssertEntry(m_misc.SpecializationId));
+ Player* player = unitTarget->ToPlayer();
+ uint32 specID = m_misc.SpecializationId;
+ ChrSpecializationEntry const* spec = sChrSpecializationStore.AssertEntry(specID);
+
+ // Safety checks done in Spell::CheckCast
+ if (!spec->IsPetSpecialization())
+ player->ActivateTalentGroup(spec);
+ else
+ player->GetPet()->SetSpecialization(specID);
}
void Spell::EffectPlaySound(SpellEffIndex /*effIndex*/)