mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 16:37:01 +00:00
[7833] Implement levelup spells for non-hunter pets.
* Use less hacky way to prepare data in SpellMgr::LoadPetLevelupSpellMap. * Fill data for all pet families including not hunter pets. * Fixed bug with lost/unexpected learned spells for some hunter pet families. Use less hackky way for
This commit is contained in:
parent
b722e75d90
commit
a1f4549862
5 changed files with 78 additions and 157 deletions
|
|
@ -941,7 +941,6 @@ bool Pet::InitStatsForLevel(uint32 petlevel)
|
||||||
case HUNTER_PET:
|
case HUNTER_PET:
|
||||||
{
|
{
|
||||||
SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, objmgr.GetXPForLevel(petlevel)/4);
|
SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, objmgr.GetXPForLevel(petlevel)/4);
|
||||||
learnLevelupSpells();
|
|
||||||
//these formula may not be correct; however, it is designed to be close to what it should be
|
//these formula may not be correct; however, it is designed to be close to what it should be
|
||||||
//this makes dps 0.5 of pets level
|
//this makes dps 0.5 of pets level
|
||||||
SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(petlevel - (petlevel / 4)) );
|
SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(petlevel - (petlevel / 4)) );
|
||||||
|
|
@ -999,6 +998,9 @@ bool Pet::InitStatsForLevel(uint32 petlevel)
|
||||||
for (int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i)
|
for (int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i)
|
||||||
SetModifierValue(UnitMods(UNIT_MOD_RESISTANCE_START + i), BASE_VALUE, float(createResistance[i]));
|
SetModifierValue(UnitMods(UNIT_MOD_RESISTANCE_START + i), BASE_VALUE, float(createResistance[i]));
|
||||||
|
|
||||||
|
if(cinfo->family)
|
||||||
|
learnLevelupSpells();
|
||||||
|
|
||||||
UpdateAllStats();
|
UpdateAllStats();
|
||||||
|
|
||||||
SetHealth(GetMaxHealth());
|
SetHealth(GetMaxHealth());
|
||||||
|
|
|
||||||
|
|
@ -1814,6 +1814,8 @@ enum CreatureFamily
|
||||||
CREATURE_FAMILY_SPIRIT_BEAST = 46
|
CREATURE_FAMILY_SPIRIT_BEAST = 46
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define MAX_CREATURE_FAMILY 47
|
||||||
|
|
||||||
enum CreatureTypeFlags
|
enum CreatureTypeFlags
|
||||||
{
|
{
|
||||||
CREATURE_TYPEFLAGS_TAMEABLE = 0x0001,
|
CREATURE_TYPEFLAGS_TAMEABLE = 0x0001,
|
||||||
|
|
|
||||||
|
|
@ -2126,184 +2126,101 @@ void SpellMgr::LoadSpellPetAuras()
|
||||||
sLog.outString( ">> Loaded %u spell pet auras", count );
|
sLog.outString( ">> Loaded %u spell pet auras", count );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static uint32 family2skillline[MAX_CREATURE_FAMILY][2] = {
|
||||||
|
/* ----------------------------- = 0 */ {0, 0 },
|
||||||
|
/*CREATURE_FAMILY_WOLF = 1 */ {208, 270},
|
||||||
|
/*CREATURE_FAMILY_CAT = 2 */ {209, 270},
|
||||||
|
/*CREATURE_FAMILY_SPIDER = 3 */ {203, 270},
|
||||||
|
/*CREATURE_FAMILY_BEAR = 4 */ {210, 270},
|
||||||
|
/*CREATURE_FAMILY_BOAR = 5 */ {211, 270},
|
||||||
|
/*CREATURE_FAMILY_CROCOLISK = 6 */ {212, 270},
|
||||||
|
/*CREATURE_FAMILY_CARRION_BIRD = 7 */ {213, 270},
|
||||||
|
/*CREATURE_FAMILY_CRAB = 8 */ {214, 270},
|
||||||
|
/*CREATURE_FAMILY_GORILLA = 9 */ {215, 270},
|
||||||
|
/*CREATURE_FAMILY_HORSE_CUSTOM = 10*/ {0, 0 },
|
||||||
|
/*CREATURE_FAMILY_RAPTOR = 11*/ {217, 270},
|
||||||
|
/*CREATURE_FAMILY_TALLSTRIDER = 12*/ {218, 270},
|
||||||
|
/* ----------------------------- = 13*/ {0, 0 },
|
||||||
|
/* ----------------------------- = 14*/ {0, 0 },
|
||||||
|
/*CREATURE_FAMILY_FELHUNTER = 15*/ {189, 0 },
|
||||||
|
/*CREATURE_FAMILY_VOIDWALKER = 16*/ {204, 0 },
|
||||||
|
/*CREATURE_FAMILY_SUCCUBUS = 17*/ {205, 0 },
|
||||||
|
/* ----------------------------- = 18*/ {0, 0 },
|
||||||
|
/*CREATURE_FAMILY_DOOMGUARD = 19*/ {207, 0 },
|
||||||
|
/*CREATURE_FAMILY_SCORPID = 20*/ {236, 270},
|
||||||
|
/*CREATURE_FAMILY_TURTLE = 21*/ {251, 270},
|
||||||
|
/* ----------------------------- = 22*/ {0, 0 },
|
||||||
|
/*CREATURE_FAMILY_IMP = 23*/ {188, 0 },
|
||||||
|
/*CREATURE_FAMILY_BAT = 24*/ {653, 270},
|
||||||
|
/*CREATURE_FAMILY_HYENA = 25*/ {654, 270},
|
||||||
|
/*CREATURE_FAMILY_BIRD_OF_PREY = 26*/ {655, 270},
|
||||||
|
/*CREATURE_FAMILY_WIND_SERPENT = 27*/ {656, 270},
|
||||||
|
/*CREATURE_FAMILY_REMOTE_CONTROL = 28*/ {758, 0 },
|
||||||
|
/*CREATURE_FAMILY_FELGUARD = 29*/ {761, 0 },
|
||||||
|
/*CREATURE_FAMILY_DRAGONHAWK = 30*/ {763, 270},
|
||||||
|
/*CREATURE_FAMILY_RAVAGER = 31*/ {767, 270},
|
||||||
|
/*CREATURE_FAMILY_WARP_STALKER = 32*/ {766, 270},
|
||||||
|
/*CREATURE_FAMILY_SPOREBAT = 33*/ {765, 270},
|
||||||
|
/*CREATURE_FAMILY_NETHER_RAY = 34*/ {764, 270},
|
||||||
|
/*CREATURE_FAMILY_SERPENT = 35*/ {768, 270},
|
||||||
|
/* ----------------------------- = 36*/ {0, 0 },
|
||||||
|
/*CREATURE_FAMILY_MOTH = 37*/ {775, 270},
|
||||||
|
/*CREATURE_FAMILY_CHIMAERA = 38*/ {780, 270},
|
||||||
|
/*CREATURE_FAMILY_DEVILSAUR = 39*/ {781, 270},
|
||||||
|
/*CREATURE_FAMILY_GHOUL = 40*/ {782, 0 },
|
||||||
|
/*CREATURE_FAMILY_SILITHID = 41*/ {783, 270},
|
||||||
|
/*CREATURE_FAMILY_WORM = 42*/ {784, 270},
|
||||||
|
/*CREATURE_FAMILY_RHINO = 43*/ {786, 270},
|
||||||
|
/*CREATURE_FAMILY_WASP = 44*/ {785, 270},
|
||||||
|
/*CREATURE_FAMILY_CORE_HOUND = 45*/ {787, 270},
|
||||||
|
/*CREATURE_FAMILY_SPIRIT_BEAST = 46*/ {788, 270}
|
||||||
|
};
|
||||||
|
|
||||||
void SpellMgr::LoadPetLevelupSpellMap()
|
void SpellMgr::LoadPetLevelupSpellMap()
|
||||||
{
|
{
|
||||||
CreatureFamilyEntry const *creatureFamily;
|
|
||||||
SpellEntry const *spell;
|
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
|
uint32 family_count = 0;
|
||||||
|
|
||||||
for (uint32 i = 0; i < sCreatureFamilyStore.GetNumRows(); ++i)
|
for (uint32 i = 0; i < sCreatureFamilyStore.GetNumRows(); ++i)
|
||||||
{
|
{
|
||||||
creatureFamily = sCreatureFamilyStore.LookupEntry(i);
|
CreatureFamilyEntry const *creatureFamily = sCreatureFamilyStore.LookupEntry(i);
|
||||||
|
|
||||||
if(!creatureFamily) // not exist
|
if(!creatureFamily) // not exist
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(creatureFamily->petTalentType < 0) // not hunter pet family
|
if(i >= MAX_CREATURE_FAMILY)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for(uint32 j = 0; j < sSpellStore.GetNumRows(); ++j)
|
if(!family2skillline[i][0])
|
||||||
|
continue;
|
||||||
|
|
||||||
|
for (uint32 j = 0; j < sSkillLineAbilityStore.GetNumRows(); ++j)
|
||||||
{
|
{
|
||||||
spell = sSpellStore.LookupEntry(j);
|
SkillLineAbilityEntry const *skillLine = sSkillLineAbilityStore.LookupEntry(j);
|
||||||
|
if( !skillLine )
|
||||||
// not exist
|
|
||||||
if(!spell)
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// not hunter spell
|
if (skillLine->skillId!=family2skillline[i][0] &&
|
||||||
if(spell->SpellFamilyName != SPELLFAMILY_HUNTER)
|
(!family2skillline[i][1] || skillLine->skillId!=family2skillline[i][1]))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// not pet spell
|
if(skillLine->learnOnGetSkill != ABILITY_LEARNED_ON_GET_RACE_OR_CLASS_SKILL)
|
||||||
if(!(spell->SpellFamilyFlags & 0x1000000000000000LL))
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// not Growl or Cower (generics)
|
SpellEntry const *spell = sSpellStore.LookupEntry(skillLine->spellId);
|
||||||
if(spell->SpellIconID != 201 && spell->SpellIconID != 958)
|
if(!spell) // not exist
|
||||||
{
|
continue;
|
||||||
switch(creatureFamily->ID)
|
|
||||||
{
|
|
||||||
case CREATURE_FAMILY_BAT: // Bite and Sonic Blast
|
|
||||||
if(spell->SpellIconID != 1680 && spell->SpellIconID != 1577)
|
|
||||||
continue;
|
|
||||||
break;
|
|
||||||
case CREATURE_FAMILY_BEAR: // Claw and Swipe
|
|
||||||
if(spell->SpellIconID != 262 && spell->SpellIconID != 1562)
|
|
||||||
continue;
|
|
||||||
break;
|
|
||||||
case CREATURE_FAMILY_BIRD_OF_PREY: // Claw and Snatch
|
|
||||||
if(spell->SpellIconID != 262 && spell->SpellIconID != 168)
|
|
||||||
continue;
|
|
||||||
break;
|
|
||||||
case CREATURE_FAMILY_BOAR: // Bite and Gore
|
|
||||||
if(spell->SpellIconID != 1680 && spell->SpellIconID != 1578)
|
|
||||||
continue;
|
|
||||||
break;
|
|
||||||
case CREATURE_FAMILY_CARRION_BIRD: // Bite and Demoralizing Screech
|
|
||||||
if(spell->SpellIconID != 1680 && spell->SpellIconID != 1579)
|
|
||||||
continue;
|
|
||||||
break;
|
|
||||||
case CREATURE_FAMILY_CAT: // Claw and Prowl and Rake
|
|
||||||
if(spell->SpellIconID != 262 && spell->SpellIconID != 495 && spell->SpellIconID != 494)
|
|
||||||
continue;
|
|
||||||
break;
|
|
||||||
case CREATURE_FAMILY_CHIMAERA: // Bite and Froststorm Breath
|
|
||||||
if(spell->SpellIconID != 1680 && spell->SpellIconID != 62)
|
|
||||||
continue;
|
|
||||||
break;
|
|
||||||
case CREATURE_FAMILY_CORE_HOUND: // Bite and Lava Breath
|
|
||||||
if(spell->SpellIconID != 1680 && spell->SpellIconID != 1197)
|
|
||||||
continue;
|
|
||||||
break;
|
|
||||||
case CREATURE_FAMILY_CRAB: // Claw and Pin
|
|
||||||
if(spell->SpellIconID != 262 && spell->SpellIconID != 2679)
|
|
||||||
continue;
|
|
||||||
break;
|
|
||||||
case CREATURE_FAMILY_CROCOLISK: // Bite and Bad Attitude
|
|
||||||
if(spell->SpellIconID != 1680 && spell->SpellIconID != 1581)
|
|
||||||
continue;
|
|
||||||
break;
|
|
||||||
case CREATURE_FAMILY_DEVILSAUR: // Bite and Monstrous Bite
|
|
||||||
if(spell->SpellIconID != 1680 && spell->SpellIconID != 599)
|
|
||||||
continue;
|
|
||||||
break;
|
|
||||||
case CREATURE_FAMILY_DRAGONHAWK: // Bite and Fire Breath
|
|
||||||
if(spell->SpellIconID != 1680 && spell->SpellIconID != 2128)
|
|
||||||
continue;
|
|
||||||
break;
|
|
||||||
case CREATURE_FAMILY_GORILLA: // Smack and Thunderstomp
|
|
||||||
if(spell->SpellIconID != 473 && spell->SpellIconID != 148)
|
|
||||||
continue;
|
|
||||||
break;
|
|
||||||
case CREATURE_FAMILY_HYENA: // Bite and Tendon Rip
|
|
||||||
if(spell->SpellIconID != 1680 && spell->SpellIconID != 138)
|
|
||||||
continue;
|
|
||||||
break;
|
|
||||||
case CREATURE_FAMILY_MOTH: // Serenity Dust and Smack
|
|
||||||
if(spell->SpellIconID != 1714 && spell->SpellIconID != 473)
|
|
||||||
continue;
|
|
||||||
break;
|
|
||||||
case CREATURE_FAMILY_NETHER_RAY: // Bite and Nether Shock
|
|
||||||
if(spell->SpellIconID != 1680 && spell->SpellIconID != 2027)
|
|
||||||
continue;
|
|
||||||
break;
|
|
||||||
case CREATURE_FAMILY_RAPTOR: // Claw and Savage Rend
|
|
||||||
if(spell->SpellIconID != 262 && spell->SpellIconID != 245)
|
|
||||||
continue;
|
|
||||||
break;
|
|
||||||
case CREATURE_FAMILY_RAVAGER: // Bite and Ravage
|
|
||||||
if(spell->SpellIconID != 1680 && spell->SpellIconID != 2253)
|
|
||||||
continue;
|
|
||||||
break;
|
|
||||||
case CREATURE_FAMILY_RHINO: // Smack and Stampede
|
|
||||||
if(spell->SpellIconID != 473 && spell->SpellIconID != 3066)
|
|
||||||
continue;
|
|
||||||
break;
|
|
||||||
case CREATURE_FAMILY_SCORPID: // Claw and Scorpid Poison
|
|
||||||
if(spell->SpellIconID != 262 && spell->SpellIconID != 163)
|
|
||||||
continue;
|
|
||||||
break;
|
|
||||||
case CREATURE_FAMILY_SERPENT: // Bite and Poison Spit
|
|
||||||
if(spell->SpellIconID != 1680 && spell->SpellIconID != 68)
|
|
||||||
continue;
|
|
||||||
break;
|
|
||||||
case CREATURE_FAMILY_SILITHID: // Claw and Venom Web Spray
|
|
||||||
if(spell->SpellIconID != 262 && (spell->SpellIconID != 272 && spell->SpellVisual[0] != 12013))
|
|
||||||
continue;
|
|
||||||
break;
|
|
||||||
case CREATURE_FAMILY_SPIDER: // Bite and Web
|
|
||||||
if(spell->SpellIconID != 1680 && (spell->SpellIconID != 272 && spell->SpellVisual[0] != 684))
|
|
||||||
continue;
|
|
||||||
break;
|
|
||||||
case CREATURE_FAMILY_SPIRIT_BEAST: // Claw and Prowl and Spirit Strike
|
|
||||||
if(spell->SpellIconID != 262 && spell->SpellIconID != 495 && spell->SpellIconID != 255)
|
|
||||||
continue;
|
|
||||||
break;
|
|
||||||
case CREATURE_FAMILY_SPOREBAT: // Smack and Spore Cloud
|
|
||||||
if(spell->SpellIconID != 473 && spell->SpellIconID != 2681)
|
|
||||||
continue;
|
|
||||||
break;
|
|
||||||
case CREATURE_FAMILY_TALLSTRIDER: // Claw and Dust Cloud
|
|
||||||
if(spell->SpellIconID != 262 && (spell->SpellIconID != 157 && !(spell->Attributes & 0x4000000)))
|
|
||||||
continue;
|
|
||||||
break;
|
|
||||||
case CREATURE_FAMILY_TURTLE: // Bite and Shell Shield
|
|
||||||
if(spell->SpellIconID != 1680 && spell->SpellIconID != 1588)
|
|
||||||
continue;
|
|
||||||
break;
|
|
||||||
case CREATURE_FAMILY_WARP_STALKER: // Bite and Warp
|
|
||||||
if(spell->SpellIconID != 1680 && spell->SpellIconID != 1952)
|
|
||||||
continue;
|
|
||||||
break;
|
|
||||||
case CREATURE_FAMILY_WASP: // Smack and Sting
|
|
||||||
if(spell->SpellIconID != 473 && spell->SpellIconID != 110)
|
|
||||||
continue;
|
|
||||||
break;
|
|
||||||
case CREATURE_FAMILY_WIND_SERPENT: // Bite and Lightning Breath
|
|
||||||
if(spell->SpellIconID != 1680 && spell->SpellIconID != 62)
|
|
||||||
continue;
|
|
||||||
break;
|
|
||||||
case CREATURE_FAMILY_WOLF: // Bite and Furious Howl
|
|
||||||
if(spell->SpellIconID != 1680 && spell->SpellIconID != 1573)
|
|
||||||
continue;
|
|
||||||
break;
|
|
||||||
case CREATURE_FAMILY_WORM: // Acid Spit and Bite
|
|
||||||
if(spell->SpellIconID != 636 && spell->SpellIconID != 1680)
|
|
||||||
continue;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
sLog.outError("LoadPetLevelupSpellMap: Unhandled creature family %u", creatureFamily->ID);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
mPetLevelupSpellMap[creatureFamily->ID][spell->spellLevel] = spell->Id;
|
PetLevelupSpellSet& spellSet = mPetLevelupSpellMap[creatureFamily->ID];
|
||||||
|
if(spellSet.empty())
|
||||||
|
++family_count;
|
||||||
|
|
||||||
|
spellSet.insert(PetLevelupSpellSet::value_type(spell->spellLevel,spell->Id));
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sLog.outString();
|
sLog.outString();
|
||||||
sLog.outString( ">> Loaded %u pet levelup spells", count );
|
sLog.outString( ">> Loaded %u pet levelup and default spells for %u families", count, family_count );
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Some checks for spells, to prevent adding deprecated/broken spells for trainers, spell book, etc
|
/// Some checks for spells, to prevent adding deprecated/broken spells for trainers, spell book, etc
|
||||||
|
|
|
||||||
|
|
@ -559,7 +559,7 @@ typedef std::multimap<uint32, SpellLearnSpellNode> SpellLearnSpellMap;
|
||||||
|
|
||||||
typedef std::multimap<uint32, SkillLineAbilityEntry const*> SkillLineAbilityMap;
|
typedef std::multimap<uint32, SkillLineAbilityEntry const*> SkillLineAbilityMap;
|
||||||
|
|
||||||
typedef std::map<uint32, uint32> PetLevelupSpellSet;
|
typedef std::multimap<uint32, uint32> PetLevelupSpellSet;
|
||||||
typedef std::map<uint32, PetLevelupSpellSet> PetLevelupSpellMap;
|
typedef std::map<uint32, PetLevelupSpellSet> PetLevelupSpellMap;
|
||||||
|
|
||||||
inline bool IsPrimaryProfessionSkill(uint32 skill)
|
inline bool IsPrimaryProfessionSkill(uint32 skill)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "7832"
|
#define REVISION_NR "7833"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue