Thanks for answer. I`m looking for the code where it defines which class should have pets.And pet default status I can`t find where is defined.
//Determine pet type PetType petType = MAX_PET_TYPE; if (IsPet() && GetOwner()->GetTypeId() == TYPEID_PLAYER) { if (GetOwner()->getClass() == CLASS_WARLOCK || GetOwner()->getClass() == CLASS_SHAMAN // Fire Elemental || GetOwner()->getClass() == CLASS_DEATH_KNIGHT) // Risen Ghoul { petType = SUMMON_PET; } else if (GetOwner()->getClass() == CLASS_HUNTER) { petType = HUNTER_PET; m_unitTypeMask |= UNIT_MASK_HUNTER_PET; } else { TC_LOG_ERROR("entities.pet", "Unknown type pet %u is summoned by player class %u", GetEntry(), GetOwner()->getClass()); } }
Creature *creatureTarget = m_creature->SummonCreature(entry, player->GetPositionX(), player->GetPositionY()+2, player->GetPositionZ(), player->GetOrientation(), TEMPSUMMON_CORPSE_TIMED_DESPAWN, 500); if(!creatureTarget) return; Pet* pet = player->CreateTamedPetFrom(creatureTarget, 0); if(!pet) return; // kill original creature creatureTarget->setDeathState(JUST_DIED); creatureTarget->RemoveCorpse(); creatureTarget->SetHealth(0); pet->SetPower(POWER_HAPPINESS, 1048000); // prepare visual effect for levelup pet->SetUInt32Value(UNIT_FIELD_LEVEL, player->getLevel() - 1); pet->GetMap()->AddToMap((Creature*)pet); // visual effect for levelup pet->SetUInt32Value(UNIT_FIELD_LEVEL, player->getLevel()); if(!pet->InitStatsForLevel(player->getLevel())) TC_LOG_ERROR("scripts", "Pet Create fail: no init stats for entry %u", entry); pet->UpdateAllStats(); // caster have pet now player->SetMinion(pet, true); pet->SavePetToDB(PET_SAVE_AS_CURRENT); pet->InitTalentForLevel(); player->PetSpellInitialize();
// Summon creature. If this fails for some reason, cancel function Creature* creatureTarget = m_creature->SummonCreature(entry, player->GetPositionX(), player->GetPositionY()+2, player->GetPositionZ(), player->GetOrientation(), TEMPSUMMON_CORPSE_TIMED_DESPAWN, 500); if (!creatureTarget) return; // Create a tamed pet out of previously summoned creature. If this fails, cancel function. Pet* pet = player->CreateTamedPetFrom(creatureTarget, 0); if (!pet) { // We have to make sure that these summons are not abused for some reason. Remove them. creatureTarget->setDeathState(JUST_DIED); creatureTarget->RemoveCorpse(); creatureTarget->SetHealth(0); return; } // If pet creation was successful, remove the original creature. creatureTarget->setDeathState(JUST_DIED); creatureTarget->RemoveCorpse(); creatureTarget->SetHealth(0); // Creature was successfully summoned. We can set it as pet now. player->SetMinion(pet, true); // Set happiness level for newly summoned creature pet->SetPower(POWER_HAPPINESS, 1048000); // prepare visual effect for levelup pet->SynchronizeLevelWithOwner(); pet->GetMap()->AddToMap((Creature*)pet); // visual effect for levelup if (!pet->InitStatsForLevel(pet->getLevel())) TC_LOG_ERROR("scripts", "Pet Create fail: no init stats for entry %u", entry); pet->UpdateAllStats(); pet->SavePetToDB(PET_SAVE_AS_CURRENT); pet->InitTalentForLevel(); player->PetSpellInitialize();
if (GetOwner()->getClass() == CLASS_WARLOCK || GetOwner()->getClass() == CLASS_SHAMAN // Fire Elemental || GetOwner()->getClass() == CLASS_DEATH_KNIGHT) // Risen Ghoul { petType = SUMMON_PET; } else { petType = HUNTER_PET; m_unitTypeMask |= UNIT_MASK_HUNTER_PET; } }
Well, looks like seems to work correctly now, stats seem fine for all non-hunter classes.