diff --git a/sql/warlock_pet_spells.sql b/sql/warlock_pet_spells.sql
new file mode 100644
index 0000000..208f609
--- /dev/null
+++ b/sql/warlock_pet_spells.sql
@@ -0,0 +1,121 @@
+-- Warlock Pet Spells FIX
+DROP TABLE IF EXISTS `pet_level_spell`;
+CREATE TABLE `pet_level_spell` (
+ `pet_family` int(11) unsigned NOT NULL default '0' COMMENT 'Pet Family',
+ `level` int(11) unsigned NOT NULL default '0' COMMENT 'Required Spell Level',
+ `spellid` int(11) unsigned NOT NULL default '0' COMMENT 'Spell Identifier',
+ PRIMARY KEY (`pet_family`,`spellid`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Player System';
+
+
+DELETE FROM `pet_level_spell`;
+-- Imp
+INSERT INTO `pet_level_spell` VALUES ('23','1','3110'); -- Firebolt Rank 1
+INSERT INTO `pet_level_spell` VALUES ('23','4','6307'); -- Blood Pact Rank 1
+INSERT INTO `pet_level_spell` VALUES ('23','8','7799'); -- Firebolt Rank 2
+INSERT INTO `pet_level_spell` VALUES ('23','12','4511'); -- Phase Shift
+INSERT INTO `pet_level_spell` VALUES ('23','14','7804'); -- Blood Pact Rank 2
+INSERT INTO `pet_level_spell` VALUES ('23','14','2947'); -- Fire Shield Rank 1
+INSERT INTO `pet_level_spell` VALUES ('23','18','7800'); -- Firebolt Rank 3
+INSERT INTO `pet_level_spell` VALUES ('23','24','8316'); -- Fire Shield Rank 2
+INSERT INTO `pet_level_spell` VALUES ('23','26','7805'); -- Blood Pact Rank 3
+INSERT INTO `pet_level_spell` VALUES ('23','28','7801'); -- Firebolt Rank 4
+INSERT INTO `pet_level_spell` VALUES ('23','34','8317'); -- Fire Shield Rank 5
+INSERT INTO `pet_level_spell` VALUES ('23','38','11766'); -- Blood Pact Rank 4
+INSERT INTO `pet_level_spell` VALUES ('23','38','7802'); -- Firebolt Rank 5
+INSERT INTO `pet_level_spell` VALUES ('23','44','11770');
+INSERT INTO `pet_level_spell` VALUES ('23','48','11762');
+INSERT INTO `pet_level_spell` VALUES ('23','50','11767');
+INSERT INTO `pet_level_spell` VALUES ('23','54','11771');
+INSERT INTO `pet_level_spell` VALUES ('23','58','11763');
+INSERT INTO `pet_level_spell` VALUES ('23','62','27268');
+INSERT INTO `pet_level_spell` VALUES ('23','64','27269');
+INSERT INTO `pet_level_spell` VALUES ('23','68','27267');
+INSERT INTO `pet_level_spell` VALUES ('23','74','47982');
+INSERT INTO `pet_level_spell` VALUES ('23','76','47983');
+INSERT INTO `pet_level_spell` VALUES ('23','78','47964');
+-- Voidwalker
+INSERT INTO `pet_level_spell` VALUES ('16','10','3716');
+INSERT INTO `pet_level_spell` VALUES ('16','16','7812');
+INSERT INTO `pet_level_spell` VALUES ('16','18','17767');
+INSERT INTO `pet_level_spell` VALUES ('16','20','7809');
+INSERT INTO `pet_level_spell` VALUES ('16','24','19438');
+INSERT INTO `pet_level_spell` VALUES ('16','24','17735');
+INSERT INTO `pet_level_spell` VALUES ('16','26','17850');
+INSERT INTO `pet_level_spell` VALUES ('16','30','7810');
+INSERT INTO `pet_level_spell` VALUES ('16','32','19440');
+INSERT INTO `pet_level_spell` VALUES ('16','34','17851');
+INSERT INTO `pet_level_spell` VALUES ('16','36','17750');
+INSERT INTO `pet_level_spell` VALUES ('16','40','19441');
+INSERT INTO `pet_level_spell` VALUES ('16','40','7811');
+INSERT INTO `pet_level_spell` VALUES ('16','42','17852');
+INSERT INTO `pet_level_spell` VALUES ('16','48','19442');
+INSERT INTO `pet_level_spell` VALUES ('16','48','17751');
+INSERT INTO `pet_level_spell` VALUES ('16','50','17853');
+INSERT INTO `pet_level_spell` VALUES ('16','50','11774');
+INSERT INTO `pet_level_spell` VALUES ('16','56','19443');
+INSERT INTO `pet_level_spell` VALUES ('16','58','17854');
+INSERT INTO `pet_level_spell` VALUES ('16','60','17752');
+INSERT INTO `pet_level_spell` VALUES ('16','60','11775');
+INSERT INTO `pet_level_spell` VALUES ('16','63','27271');
+INSERT INTO `pet_level_spell` VALUES ('16','64','27273');
+INSERT INTO `pet_level_spell` VALUES ('16','66','27272');
+INSERT INTO `pet_level_spell` VALUES ('16','69','33701');
+INSERT INTO `pet_level_spell` VALUES ('16','70','27270');
+INSERT INTO `pet_level_spell` VALUES ('16','72','47985');
+INSERT INTO `pet_level_spell` VALUES ('16','73','47987');
+INSERT INTO `pet_level_spell` VALUES ('16','75','47989');
+INSERT INTO `pet_level_spell` VALUES ('16','78','47988');
+INSERT INTO `pet_level_spell` VALUES ('16','79','47986');
+INSERT INTO `pet_level_spell` VALUES ('16','80','47990');
+INSERT INTO `pet_level_spell` VALUES ('16','80','47984');
+-- Succubus
+INSERT INTO `pet_level_spell` VALUES ('17','20','7814');
+INSERT INTO `pet_level_spell` VALUES ('17','22','6360');
+INSERT INTO `pet_level_spell` VALUES ('17','26','6358');
+INSERT INTO `pet_level_spell` VALUES ('17','28','7815');
+INSERT INTO `pet_level_spell` VALUES ('17','32','7870');
+INSERT INTO `pet_level_spell` VALUES ('17','34','7813');
+INSERT INTO `pet_level_spell` VALUES ('17','36','7816');
+INSERT INTO `pet_level_spell` VALUES ('17','44','11778');
+INSERT INTO `pet_level_spell` VALUES ('17','46','11784');
+INSERT INTO `pet_level_spell` VALUES ('17','52','11779');
+INSERT INTO `pet_level_spell` VALUES ('17','58','11785');
+INSERT INTO `pet_level_spell` VALUES ('17','60','11780');
+INSERT INTO `pet_level_spell` VALUES ('17','68','27274');
+INSERT INTO `pet_level_spell` VALUES ('17','70','27275');
+INSERT INTO `pet_level_spell` VALUES ('17','74','47991');
+INSERT INTO `pet_level_spell` VALUES ('17','80','47992');
+-- Felhunter
+INSERT INTO `pet_level_spell` VALUES ('15','30','19505');
+INSERT INTO `pet_level_spell` VALUES ('15','32','54424');
+INSERT INTO `pet_level_spell` VALUES ('15','36','19244');
+INSERT INTO `pet_level_spell` VALUES ('15','38','19731');
+INSERT INTO `pet_level_spell` VALUES ('15','42','57564');
+INSERT INTO `pet_level_spell` VALUES ('15','42','54049');
+INSERT INTO `pet_level_spell` VALUES ('15','46','19734');
+INSERT INTO `pet_level_spell` VALUES ('15','50','54050');
+INSERT INTO `pet_level_spell` VALUES ('15','52','57565');
+INSERT INTO `pet_level_spell` VALUES ('15','52','19647');
+INSERT INTO `pet_level_spell` VALUES ('15','54','19736');
+INSERT INTO `pet_level_spell` VALUES ('15','58','54051');
+INSERT INTO `pet_level_spell` VALUES ('15','62','27276');
+INSERT INTO `pet_level_spell` VALUES ('15','62','57566');
+INSERT INTO `pet_level_spell` VALUES ('15','66','54052');
+INSERT INTO `pet_level_spell` VALUES ('15','70','27277');
+INSERT INTO `pet_level_spell` VALUES ('15','72','57567');
+INSERT INTO `pet_level_spell` VALUES ('15','74','54053');
+INSERT INTO `pet_level_spell` VALUES ('15','77','48011');
+-- Felguard
+INSERT INTO `pet_level_spell` VALUES ('29','50','33698');
+INSERT INTO `pet_level_spell` VALUES ('29','50','30213');
+INSERT INTO `pet_level_spell` VALUES ('29','52','30151');
+INSERT INTO `pet_level_spell` VALUES ('29','60','33699');
+INSERT INTO `pet_level_spell` VALUES ('29','60','30219');
+INSERT INTO `pet_level_spell` VALUES ('29','61','30194');
+INSERT INTO `pet_level_spell` VALUES ('29','68','30223');
+INSERT INTO `pet_level_spell` VALUES ('29','69','33700');
+INSERT INTO `pet_level_spell` VALUES ('29','69','30198');
+INSERT INTO `pet_level_spell` VALUES ('29','76','47994');
+INSERT INTO `pet_level_spell` VALUES ('29','78','47993');
+INSERT INTO `pet_level_spell` VALUES ('29','79','47996');
\ No newline at end of file
diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp
index 7cf205f..63bed82 100644
--- a/src/game/Pet.cpp
+++ b/src/game/Pet.cpp
@@ -833,6 +833,9 @@ bool Pet::InitStatsForLevel(uint32 petlevel)
uint32 fire = owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FIRE);
uint32 shadow = owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_SHADOW);
uint32 val = (fire > shadow) ? fire : shadow;
+
+ // learn spells per level
+ learnWarlockLevelupSpells();
SetBonusDamage(int32 (val * 0.15f));
//bonusAP += val * 0.57;
@@ -1372,6 +1375,23 @@ void Pet::learnLevelupSpells()
}
}
+void Pet::learnWarlockLevelupSpells()
+{
+ PetLevelupSpellSet const *levelupSpells = spellmgr.GetWarlockPetLevelupSpellList(GetCreatureInfo()->family);
+ if(!levelupSpells)
+ return;
+
+ uint32 level = getLevel();
+
+ for(PetLevelupSpellSet::const_iterator itr = levelupSpells->begin(); itr != levelupSpells->end(); ++itr)
+ {
+ if(itr->first <= level)
+ learnSpell(itr->second);
+ else
+ unlearnSpell(itr->second);
+ }
+}
+
bool Pet::unlearnSpell(uint32 spell_id)
{
if(removeSpell(spell_id))
diff --git a/src/game/Pet.h b/src/game/Pet.h
index 47e0a65..f838335 100644
--- a/src/game/Pet.h
+++ b/src/game/Pet.h
@@ -191,6 +191,7 @@ class Pet : public Creature
bool addSpell(uint32 spell_id,uint16 active = ACT_DECIDE, PetSpellState state = PETSPELL_NEW, PetSpellType type = PETSPELL_NORMAL);
bool learnSpell(uint32 spell_id);
void learnLevelupSpells();
+ void learnWarlockLevelupSpells();
bool unlearnSpell(uint32 spell_id);
bool removeSpell(uint32 spell_id);
bool _removeSpell(uint32 spell_id);
diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp
index 89e8860..eecf6ee 100644
--- a/src/game/SpellMgr.cpp
+++ b/src/game/SpellMgr.cpp
@@ -2273,6 +2273,46 @@ void SpellMgr::LoadPetLevelupSpellMap()
sLog.outString( ">> Loaded %u pet levelup spells", count );
}
+
+void SpellMgr::LoadWarlockPetLevelupSpellMap()
+{
+ uint32 count = 0;
+ QueryResult *result = WorldDatabase.PQuery("SELECT pet_family, level, spellid FROM pet_level_spell");
+
+ if(!result)
+ {
+ sLog.outError( " Loaded 0 Warlock Pet Spells, Table pet_level_spell not exist/no data/wrong structure.");
+ }
+ else
+ {
+ uint32 cr_family = 0;
+ uint32 need_level = 0;
+ uint32 spellid = 0;
+
+ do
+ {
+ Field *fields = result->Fetch();
+
+ cr_family = fields[0].GetUInt32();
+ need_level = fields[1].GetUInt32();
+ spellid = fields[2].GetUInt32();
+
+ mWarlockPetLevelupSpellMap[cr_family][need_level] = spellid;
+ count++;
+ }
+ while( result->NextRow() );
+
+ delete result;
+
+
+ sLog.outString( ">> Loaded %u warlock pet levelup spells ", count);
+ sLog.outString();
+
+ }
+
+}
+
+
/// Some checks for spells, to prevent adding deprecated/broken spells for trainers, spell book, etc
bool SpellMgr::IsSpellValid(SpellEntry const* spellInfo, Player* pl, bool msg)
{
diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h
index 25e54a3..68c032b 100644
--- a/src/game/SpellMgr.h
+++ b/src/game/SpellMgr.h
@@ -745,6 +745,7 @@ typedef std::multimap<uint32, SkillLineAbilityEntry const*> SkillLineAbilityMap;
typedef std::map<uint32, uint32> PetLevelupSpellSet;
typedef std::map<uint32, PetLevelupSpellSet> PetLevelupSpellMap;
+typedef std::map<uint32, PetLevelupSpellSet> WarlockPetLevelupSpellMap;
inline bool IsPrimaryProfessionSkill(uint32 skill)
{
@@ -1025,9 +1026,16 @@ class SpellMgr
{
return SpellAreaForAreaMapBounds(mSpellAreaForAreaMap.lower_bound(area_id),mSpellAreaForAreaMap.upper_bound(area_id));
}
+ PetLevelupSpellSet const* GetWarlockPetLevelupSpellList(uint32 petFamily) const
+ {
+ WarlockPetLevelupSpellMap::const_iterator itr = mWarlockPetLevelupSpellMap.find(petFamily);
+ if(itr != mWarlockPetLevelupSpellMap.end())
+ return &itr->second;
+ else
+ return NULL;
+ }
- // Modifiers
- public:
+ public:
static SpellMgr& Instance();
// Loading data at server startup
@@ -1045,6 +1053,7 @@ class SpellMgr
void LoadSpellPetAuras();
void LoadPetLevelupSpellMap();
void LoadSpellAreas();
+ void LoadWarlockPetLevelupSpellMap();
private:
SpellScriptTarget mSpellScriptTarget;
@@ -1059,13 +1068,14 @@ class SpellMgr
SpellBonusMap mSpellBonusMap;
SkillLineAbilityMap mSkillLineAbilityMap;
SpellPetAuraMap mSpellPetAuraMap;
- PetLevelupSpellMap mPetLevelupSpellMap;
SpellAreaMap mSpellAreaMap;
SpellAreaForQuestMap mSpellAreaForQuestMap;
SpellAreaForQuestMap mSpellAreaForActiveQuestMap;
SpellAreaForQuestMap mSpellAreaForQuestEndMap;
SpellAreaForAuraMap mSpellAreaForAuraMap;
SpellAreaForAreaMap mSpellAreaForAreaMap;
+ PetLevelupSpellMap mPetLevelupSpellMap;
+ WarlockPetLevelupSpellMap mWarlockPetLevelupSpellMap;
};
#define spellmgr SpellMgr::Instance()
diff --git a/src/game/World.cpp b/src/game/World.cpp
index 0c7d222..532efba 100644
--- a/src/game/World.cpp
+++ b/src/game/World.cpp
@@ -1234,6 +1234,9 @@ void World::SetInitialWorldSettings()
sLog.outString( "Loading pet levelup spells..." );
spellmgr.LoadPetLevelupSpellMap();
+ sLog.outString( "Loading Warlock pet levelup spells..." );
+ spellmgr.LoadWarlockPetLevelupSpellMap();
+
sLog.outString( "Loading Player Create Info & Level Stats..." );
sLog.outString();
objmgr.LoadPlayerInfo();