Skip to content
This repository was archived by the owner on Jan 18, 2024. It is now read-only.

Commit

Permalink
Core/Creatures: implemented a helper to set CREATURE_STATIC_FLAG_DESP…
Browse files Browse the repository at this point in the history
…AWN_INSTANTLY and use to to despawn totems instead to match sniff data
  • Loading branch information
Ovahlord committed Oct 25, 2023
1 parent 6575616 commit 5c17978
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 13 deletions.
1 change: 1 addition & 0 deletions src/server/game/Entities/Creature/Creature.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ class TC_GAME_API Creature : public Unit, public GridObject<Creature>, public Ma

void DisableLoot(bool disable) { _staticFlags.ApplyFlag(CREATURE_STATIC_FLAG_NO_LOOT, !disable); }
bool IsLootDisabled() const { return _staticFlags.HasFlag(CREATURE_STATIC_FLAG_NO_LOOT); }
void SetDespawnInstantlyAfterDeath(bool apply) { _staticFlags.ApplyFlag(CREATURE_STATIC_FLAG_DESPAWN_INSTANTLY, !apply); }

bool HasSpell(uint32 spellID) const override;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,13 +245,17 @@ void NewTemporarySummon::HandlePostSummonActions()
}
}

// Totem slot summons despawn instantly after they have died
if (AsUnderlyingType(_summonSlot) >= AsUnderlyingType(SummonPropertiesSlot::Totem1) && AsUnderlyingType(_summonSlot) <= AsUnderlyingType(SummonPropertiesSlot::Totem4))
SetDespawnInstantlyAfterDeath(true);

// If a summon is suposed to follow its summoner, make sure that it stays within its distance
if (ShouldJoinSummonerSpawnGroupAfterCreation() || ShouldFollowSummonerAfterCreation())
if (ShouldJoinSummonerSpawnGroupAfterCreation() || ShouldFollowSummonerAfterCreation() || IsGuardian())
_summonDistanceCheckTimer = 1s;

// Mark all temporary summons as active to keep updating duration and distance checks
// @todo: research possible exploits or performance issues because of that
setActive(true);
if (_summonDistanceCheckTimer.has_value() || !_isPermanentSummon)
setActive(true);
}

void NewTemporarySummon::Unsummon(Milliseconds timeUntilDespawn /*= 0ms*/)
Expand Down Expand Up @@ -304,10 +308,6 @@ bool NewTemporarySummon::ShouldDespawnOnExpiration() const
if (_summonProperties && _summonProperties->GetFlags().HasFlag(SummonPropertiesFlags::DespawnWhenExpired))
return true;

// Anything that goes into totem slots will despawn instantly upon expiration
if (AsUnderlyingType(_summonSlot) >= AsUnderlyingType(SummonPropertiesSlot::Totem1) && AsUnderlyingType(_summonSlot) <= AsUnderlyingType(SummonPropertiesSlot::Totem4))
return true;

return false;
}

Expand Down
2 changes: 1 addition & 1 deletion src/server/game/Entities/Object/Object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3705,7 +3705,7 @@ void WorldObject::DestroyForNearbyPlayers()
continue;

if (GetTypeId() == TYPEID_UNIT)
DestroyForPlayer(player, ToUnit()->IsDuringRemoveFromWorld() && ToCreature()->isDead()); // at remove from world (destroy) show kill animation
DestroyForPlayer(player, ToUnit()->IsDuringRemoveFromWorld() && !ToCreature()->IsAlive()); // at remove from world (destroy) show kill animation
else
DestroyForPlayer(player);

Expand Down
5 changes: 0 additions & 5 deletions src/server/scripts/Spells/spell_paladin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,6 @@ enum PaladinSpellIcons
PALADIN_ICON_ID_GUARDED_BY_THE_LIGHT = 3026
};

enum PaladinCreatures
{
NPC_PALADIN_CONSECRATION = 43499
};

class spell_pal_ardent_defender : public AuraScript
{
bool Validate(SpellInfo const* /*spellInfo*/) override
Expand Down

0 comments on commit 5c17978

Please sign in to comment.