rendered paste bodyIndex: Pet.cpp
===================================================================
--- Pet.cpp (revision 4790)
+++ Pet.cpp (working copy)
@@ -1026,7 +1026,39 @@
}
};
break;
+
+ case GUARDIAN_PET:
+ {
+ SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(petlevel - (petlevel / 4)) );
+ SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float(petlevel + (petlevel / 4)) );
+ PetLevelInfo const* pInfo = objmgr.GetPetLevelInfo(creature_ID, petlevel);
+ if(pInfo) // exist in DB
+ {
+ SetCreateHealth(pInfo->health);
+ SetCreateMana(pInfo->mana);
+
+ for(int stat = 0; stat < MAX_STATS; ++stat)
+ {
+ SetCreateStat(Stats(stat),float(pInfo->stats[stat]));
+ }
+ }
+ else // not exist in DB, use some default fake data
+ {
+ sLog.outErrorDb("Summoned pet (Entry: %u) not have pet stats data in DB",cinfo->Entry);
+
+ SetCreateHealth(28 + 30 * petlevel );
+ SetCreateMana( 28 + 10 * petlevel );
+
+ SetCreateStat(STAT_STRENGTH,22);
+ SetCreateStat(STAT_AGILITY,22);
+ SetCreateStat(STAT_STAMINA,25);
+ SetCreateStat(STAT_INTELLECT,28);
+ SetCreateStat(STAT_SPIRIT,27);
+ }
+ }
+ break;
+
default: sLog.outError("Pet have incorrect type (%u) for levelup.",getPetType()); break;
}
Index: SpellEffects.cpp
===================================================================
--- SpellEffects.cpp (revision 4790)
+++ SpellEffects.cpp (working copy)
@@ -2302,15 +2302,7 @@
int32 duration = GetDuration(m_spellInfo);
if(duration > 0)
spawnCreature->SetDuration(duration);
-
spawnCreature->SetUInt64Value(UNIT_FIELD_SUMMONEDBY,m_caster->GetGUID());
- spawnCreature->setPowerType(POWER_MANA);
- spawnCreature->SetMaxPower(POWER_MANA,28 + 10 * level);
- spawnCreature->SetPower( POWER_MANA,28 + 10 * level);
- spawnCreature->SetUInt32Value(UNIT_NPC_FLAGS , 0);
- spawnCreature->SetMaxHealth( 28 + 30*level);
- spawnCreature->SetHealth( 28 + 30*level);
- spawnCreature->SetLevel(level);
spawnCreature->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE,m_caster->getFaction());
spawnCreature->SetUInt32Value(UNIT_FIELD_FLAGS,0);
spawnCreature->SetUInt32Value(UNIT_FIELD_BYTES_1,0);
@@ -2320,6 +2312,8 @@
spawnCreature->SetUInt64Value(UNIT_FIELD_CREATEDBY, m_caster->GetGUID());
spawnCreature->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id);
+ spawnCreature->InitStatsForLevel(level);
+
spawnCreature->SetArmor(level*50);
spawnCreature->AIM_Initialize();