Skip to content

Commit

Permalink
[Core/Spell] Fix hunter spell Stampede with HUNTER_SPELL_GLYPH_OF_STA… (
Browse files Browse the repository at this point in the history
#315)

* [Core/Spell] Fix hunter spell Stampede with HUNTER_SPELL_GLYPH_OF_STAMPEDE

* Add some checks

* revent some code
  • Loading branch information
leelf00 authored Aug 4, 2024
1 parent 8b651d0 commit 220e257
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 20 deletions.
6 changes: 3 additions & 3 deletions src/server/game/Entities/Creature/TemporarySummon.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information
* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
Expand Down Expand Up @@ -323,9 +323,9 @@ void TempSummon::UnSummon(uint32 msTime)
}

//ASSERT(!IsPet());
if (IsPet() && !ToPet()->IsTemporary())
if (IsPet())
{
((Pet*)this)->Remove(PET_REMOVE_DISMISS, PET_REMOVE_FLAG_RESET_CURRENT);
ToPet()->Remove(PET_REMOVE_DISMISS, PET_REMOVE_FLAG_RESET_CURRENT);
ASSERT(!IsInWorld());
return;
}
Expand Down
21 changes: 16 additions & 5 deletions src/server/game/Entities/Pet/Pet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@ void Pet::RemoveFromWorld()
///- Remove the pet from the accessor
if (IsInWorld())
{
if (IsTemporary()) // hackfix, need remove in future
{
ASSERT(FindMap() == GetOwner()->FindMap());
GetOwner()->SetMinion(this, false);
GetOwner()->RemoveSummon(this);
}
///- Don't call the function for Creature, normal mobs + totems go in a different storage
Unit::RemoveFromWorld();
GetMap()->GetObjectsStore().Remove<Pet>(GetGUID());
Expand Down Expand Up @@ -564,7 +570,15 @@ void Pet::Update(uint32 diff)
m_duration -= diff;
else
{
Remove(PET_REMOVE_DISMISS);
if (getPetType() != SUMMON_PET)
{
Remove(PET_REMOVE_DISMISS);
}
else
{
Remove(PET_REMOVE_DISMISS, PET_REMOVE_FLAG_RESET_CURRENT);
}

return;
}
}
Expand All @@ -577,10 +591,7 @@ void Pet::Update(uint32 diff)

void Pet::Remove(PetRemoveMode mode, int32 flags)
{
if (IsTemporary())
UnSummon();
else
GetOwner()->RemovePet(mode, flags);
GetOwner()->RemovePet(mode, flags);
}

bool Pet::IsAutoCastEnabled(uint32 spellId) const
Expand Down
2 changes: 1 addition & 1 deletion src/server/game/Entities/Pet/Pet.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information
* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
Expand Down
2 changes: 1 addition & 1 deletion src/server/game/Entities/Pet/PetDefines.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* This file is part of the Pandaria 5.4.8 Project. See THANKS file for Copyright information
* This file is part of the Legends of Azeroth Pandaria Project. See THANKS file for Copyright information
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
Expand Down
13 changes: 3 additions & 10 deletions src/server/game/Entities/Unit/Unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13785,6 +13785,9 @@ void Unit::RemoveFromWorld()
GetMotionMaster()->Clear(false); // Do it here, because MovementInform may provoke casts.

m_duringRemoveFromWorld = true;
if (UnitAI* ai = GetAI())
ai->OnDespawn();

if (IsVehicle())
RemoveVehicleKit(true);

Expand Down Expand Up @@ -13817,16 +13820,6 @@ void Unit::RemoveFromWorld()
}
}

if (GetTypeId() == TYPEID_PLAYER)
{
while (!m_summons.empty())
{
auto summon = m_summons.front();
m_summons.pop_front();
summon->UnSummon();
}
}

getHostileRefManager().clearReferences();

WorldObject::RemoveFromWorld();
Expand Down

0 comments on commit 220e257

Please sign in to comment.