aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormegamage <none@none>2009-03-28 22:05:12 -0600
committermegamage <none@none>2009-03-28 22:05:12 -0600
commit3a485c658d9003aaaa4bd8e99dfebb9e7f0ec862 (patch)
tree2235db375f485aef14b65c6955ce906cbc0fc5d7 /src
parent6e438e38ec365f5bd3d17b6e3341b854a7b5cc4e (diff)
*Fix a bug that pet does not toggle autocast when loaded.
--HG-- branch : trunk
Diffstat (limited to 'src')
-rw-r--r--src/game/Pet.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp
index 0cf0befb35d..cfa4d9a09f1 100644
--- a/src/game/Pet.cpp
+++ b/src/game/Pet.cpp
@@ -254,9 +254,14 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool
// patch for old data where some spells have ACT_DECIDE but should have ACT_CAST
// so overwrite old state
- SpellEntry const *spellInfo = sSpellStore.LookupEntry(m_charmInfo->GetActionBarEntry(index)->SpellOrAction);
- if (spellInfo && spellInfo->AttributesEx & SPELL_ATTR_EX_UNAUTOCASTABLE_BY_PET)
- m_charmInfo->GetActionBarEntry(index)->Type = ACT_DISABLED;
+ if(SpellEntry const *spellInfo = sSpellStore.LookupEntry(m_charmInfo->GetActionBarEntry(index)->SpellOrAction))
+ {
+ if (spellInfo && spellInfo->AttributesEx & SPELL_ATTR_EX_UNAUTOCASTABLE_BY_PET)
+ m_charmInfo->GetActionBarEntry(index)->Type = ACT_DISABLED;
+
+ if(m_charmInfo->GetActionBarEntry(index)->Type == ACT_ENABLED)
+ ToggleAutocast(spellInfo->Id, true);
+ }
}
//init teach spells