Core/Pets: merged funjoker's new Pet Slot system

* fixed packets and handling for stable master
* fixed Control Pet / Demon handling
* corrected wrong trainer spell for the Control spells
* Added base support for Assist behaivior
* corrected action bar layout
* Hunter Pets will now have the same level as their tamer (patch 4.1 change)
* corrected health stats for pets
This commit is contained in:
Ovalord committed 2018-01-07 02:00:31 +01:00
1 parent b2945a5c58
commit b7c15093a6
32 files changed
+803 -685

No files matched your search

+17 -14
View File
@@ -5943,7 +5943,7 @@ void Unit::SetMinion(Minion *minion, bool apply)
{
// remove existing minion pet
if (oldPet->IsPet())
((Pet*)oldPet)->Remove(PET_SAVE_AS_CURRENT);
((Pet*)oldPet)->Remove(PET_SAVE_DISMISS);
else
oldPet->UnSummon();
SetPetGUID(minion->GetGUID());
@@ -10041,7 +10041,7 @@ uint32 Unit::GetPowerIndex(uint32 powerType) const
uint32 classId = getClass();
if (Pet const* pet = ToPet())
{
if (pet->getPetType() == HUNTER_PET)
if (pet->IsHunterPet())
classId = CLASS_HUNTER;
else if (pet->IsPetGhoul())
classId = CLASS_ROGUE;
@@ -10290,17 +10290,19 @@ void CharmInfo::RestoreState()
void CharmInfo::InitPetActionBar()
{
// the first 3 SpellOrActions are attack, follow and stay
for (uint32 i = 0; i < ACTION_BAR_INDEX_PET_SPELL_START - ACTION_BAR_INDEX_START; ++i)
SetActionBar(ACTION_BAR_INDEX_START + i, COMMAND_ATTACK - i, ACT_COMMAND);
// the first 3 SpellOrActions are attack, follow and moveTo
SetActionBar(ACTION_BAR_INDEX_ATTACK, COMMAND_ATTACK, ACT_COMMAND);
SetActionBar(ACTION_BAR_INDEX_FOLLOW, COMMAND_FOLLOW, ACT_COMMAND);
SetActionBar(ACTION_BAR_INDEX_MOVE_TO, COMMAND_MOVE_TO, ACT_COMMAND);
// middle 4 SpellOrActions are spells/special attacks/abilities
for (uint32 i = 0; i < ACTION_BAR_INDEX_PET_SPELL_END-ACTION_BAR_INDEX_PET_SPELL_START; ++i)
SetActionBar(ACTION_BAR_INDEX_PET_SPELL_START + i, 0, ACT_PASSIVE);
// last 3 SpellOrActions are reactions
for (uint32 i = 0; i < ACTION_BAR_INDEX_END - ACTION_BAR_INDEX_PET_SPELL_END; ++i)
SetActionBar(ACTION_BAR_INDEX_PET_SPELL_END + i, COMMAND_ATTACK - i, ACT_REACTION);
SetActionBar(ACTION_BAR_INDEX_ASSIST, REACT_ASSIST, ACT_REACTION);
SetActionBar(ACTION_BAR_INDEX_DEFENSIVE, REACT_DEFENSIVE, ACT_REACTION);
SetActionBar(ACTION_BAR_INDEX_PASSIVE, REACT_PASSIVE, ACT_REACTION);
}
void CharmInfo::InitEmptyActionBar(bool withAttack)
@@ -10423,7 +10425,7 @@ bool CharmInfo::AddSpellToActionBar(SpellInfo const* spellInfo, ActiveStates new
uint8 j = (preferredSlot + i) % MAX_UNIT_ACTION_BAR_INDEX;
if (!PetActionBar[j].GetAction() && PetActionBar[j].IsActionBarForSpell())
{
SetActionBar(j, spell_id, newstate == ACT_DECIDE ? spellInfo->IsAutocastable() ? ACT_DISABLED : ACT_PASSIVE : newstate);
SetActionBar(j, spell_id, newstate == ACT_DECIDE ? spellInfo->IsAutocastable() ? ACT_ENABLED : ACT_PASSIVE : newstate);
return true;
}
}
@@ -11359,17 +11361,17 @@ void Unit::SetContestedPvP(Player* attackedPlayer)
Pet* Unit::CreateTamedPetFrom(Creature* creatureTarget, uint32 spell_id)
{
if (GetTypeId() != TYPEID_PLAYER)
return NULL;
return nullptr;
Pet* pet = new Pet(ToPlayer(), HUNTER_PET);
if (!pet->CreateBaseAtCreature(creatureTarget))
{
delete pet;
return NULL;
return nullptr;
}
uint8 level = creatureTarget->getLevel() + 5 < getLevel() ? (getLevel() - 5) : creatureTarget->getLevel();
uint8 level = getLevel();
InitTamedPet(pet, level, spell_id);
@@ -11379,18 +11381,18 @@ Pet* Unit::CreateTamedPetFrom(Creature* creatureTarget, uint32 spell_id)
Pet* Unit::CreateTamedPetFrom(uint32 creatureEntry, uint32 spell_id)
{
if (GetTypeId() != TYPEID_PLAYER)
return NULL;
return nullptr;
CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(creatureEntry);
if (!creatureInfo)
return NULL;
return nullptr;
Pet* pet = new Pet(ToPlayer(), HUNTER_PET);
if (!pet->CreateBaseAtCreatureInfo(creatureInfo, this) || !InitTamedPet(pet, getLevel(), spell_id))
{
delete pet;
return NULL;
return nullptr;
}
return pet;
@@ -11418,6 +11420,7 @@ bool Unit::InitTamedPet(Pet* pet, uint8 level, uint32 spell_id)
pet->InitPetCreateSpells();
//pet->InitLevelupSpellsForLevel();
pet->SetFullHealth();
pet->SetReactState(REACT_ASSIST);
return true;
}