Merge branch 'master' of github.com:TrinityCore/TrinityCore into 4.3.4
Conflicts: src/server/game/AI/CoreAI/TotemAI.cpp src/server/game/Entities/Player/Player.cpp src/server/game/Entities/Unit/Unit.cpp src/server/game/Globals/ObjectMgr.cpp src/server/game/Guilds/Guild.cpp src/server/game/Guilds/Guild.h src/server/game/Movement/Spline/MoveSplineInit.cpp src/server/game/Movement/Spline/MovementPacketBuilder.cpp src/server/game/Movement/Spline/MovementPacketBuilder.h src/server/game/Spells/SpellMgr.cpp src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp src/server/scripts/EasternKingdoms/zone_silverpine_forest.cpp src/server/scripts/Kalimdor/zone_mulgore.cpp src/server/scripts/Kalimdor/zone_stonetalon_mountains.cpp src/server/shared/Database/Implementation/CharacterDatabase.cpp
This commit is contained in:
commit
e8be55aa8b
230 files changed
+35529
-5277
No files matched your search
@@ -4768,28 +4768,43 @@ void Spell::EffectSummonDeadPet(SpellEffIndex /*effIndex*/)
|
||||
if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT)
|
||||
return;
|
||||
|
||||
if (damage < 0)
|
||||
return;
|
||||
|
||||
Player* player = m_caster->ToPlayer();
|
||||
if (!player)
|
||||
return;
|
||||
|
||||
Pet* pet = player->GetPet();
|
||||
if (pet && pet->IsAlive())
|
||||
return;
|
||||
|
||||
if (damage < 0)
|
||||
return;
|
||||
|
||||
float x, y, z;
|
||||
player->GetPosition(x, y, z);
|
||||
if (!pet)
|
||||
// Maybe player dismissed dead pet or pet despawned?
|
||||
bool hadPet = true;
|
||||
if (!player->GetPet())
|
||||
{
|
||||
player->SummonPet(0, x, y, z, player->GetOrientation(), SUMMON_PET, 0);
|
||||
pet = player->GetPet();
|
||||
// Position passed to SummonPet is irrelevant with current implementation,
|
||||
// pet will be relocated without using these coords in Pet::LoadPetFromDB
|
||||
player->SummonPet(0, 0.0f, 0.0f, 0.0f, 0.0f, SUMMON_PET, 0);
|
||||
hadPet = false;
|
||||
}
|
||||
|
||||
// TODO: Better to fail Hunter's "Revive Pet" at cast instead of here when casting ends
|
||||
Pet* pet = player->GetPet(); // Attempt to get current pet
|
||||
if (!pet)
|
||||
return;
|
||||
|
||||
player->GetMap()->CreatureRelocation(pet, x, y, z, player->GetOrientation());
|
||||
// TODO: Better to fail Hunter's "Revive Pet" at cast instead of here when casting ends
|
||||
if (pet->IsAlive())
|
||||
return;
|
||||
|
||||
// If player did have a pet before reviving, teleport it
|
||||
if (hadPet)
|
||||
{
|
||||
// Reposition the pet's corpse before reviving so as not to grab aggro
|
||||
// We can use a different, more accurate version of GetClosePoint() since we have a pet
|
||||
float x, y, z; // Will be used later to reposition the pet if we have one
|
||||
player->GetClosePoint(x, y, z, pet->GetObjectSize(), PET_FOLLOW_DIST, pet->GetFollowAngle());
|
||||
pet->NearTeleportTo(x, y, z, player->GetOrientation());
|
||||
pet->Relocate(x, y, z, player->GetOrientation()); // This is needed so SaveStayPosition() will get the proper coords.
|
||||
}
|
||||
|
||||
pet->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_NONE);
|
||||
pet->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE);
|
||||
@@ -4797,8 +4812,20 @@ void Spell::EffectSummonDeadPet(SpellEffIndex /*effIndex*/)
|
||||
pet->ClearUnitState(uint32(UNIT_STATE_ALL_STATE));
|
||||
pet->SetHealth(pet->CountPctFromMaxHealth(damage));
|
||||
|
||||
//pet->AIM_Initialize();
|
||||
//player->PetSpellInitialize();
|
||||
// Reset things for when the AI to takes over
|
||||
CharmInfo *ci = pet->GetCharmInfo();
|
||||
if (ci)
|
||||
{
|
||||
// In case the pet was at stay, we don't want it running back
|
||||
ci->SaveStayPosition();
|
||||
ci->SetIsAtStay(ci->HasCommandState(COMMAND_STAY));
|
||||
|
||||
ci->SetIsFollowing(false);
|
||||
ci->SetIsCommandAttack(false);
|
||||
ci->SetIsCommandFollow(false);
|
||||
ci->SetIsReturning(false);
|
||||
}
|
||||
|
||||
pet->SavePetToDB(PET_SAVE_AS_CURRENT);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user