Core/Creature: Allow to skip Rate.Corpse.Decay.Looted when calling SetCorpseDelay()

Port From (https://github.com/TrinityCore/TrinityCore/commit/a4a3e2e75999230d0d2e38886eef4ce0271f4a1d)
This commit is contained in:
hondacrx
2022-05-25 13:36:12 -04:00
parent 1e041a00d8
commit 78d39e4c19
4 changed files with 12 additions and 3 deletions
@@ -3143,6 +3143,7 @@ namespace Game.AI
public struct CorpseDelay
{
public uint timer;
public uint includeDecayRatio;
}
public struct DisableEvade
{
+1 -1
View File
@@ -2178,7 +2178,7 @@ namespace Game.AI
{
foreach (var target in targets)
if (IsCreature(target))
target.ToCreature().SetCorpseDelay(e.Action.corpseDelay.timer);
target.ToCreature().SetCorpseDelay(e.Action.corpseDelay.timer, e.Action.corpseDelay.includeDecayRatio == 0);
break;
}
case SmartActions.SpawnSpawngroup:
@@ -81,6 +81,7 @@ namespace Game.Entities
long m_respawnTime; // (secs) time of next respawn
uint m_respawnDelay; // (secs) delay between corpse disappearance and respawning
uint m_corpseDelay; // (secs) delay between death and corpse disappearance
bool m_ignoreCorpseDecayRatio;
float m_wanderDistance;
uint m_boundaryCheckTime; // (msecs) remaining time for next evade boundary check
uint m_combatPulseTime; // (msecs) remaining time for next zone-in-combat pulse
+9 -2
View File
@@ -2593,7 +2593,9 @@ namespace Game.Entities
if (m_corpseRemoveTime <= now)
return;
float decayRate = WorldConfig.GetFloatValue(WorldCfg.RateCorpseDecayLooted);
// Scripts can choose to ignore RATE_CORPSE_DECAY_LOOTED by calling SetCorpseDelay(timer, true)
float decayRate = m_ignoreCorpseDecayRatio ? 1.0f : WorldConfig.GetFloatValue(WorldCfg.RateCorpseDecayLooted);
// corpse skinnable, but without skinning flag, and then skinned, corpse will despawn next update
if (loot.loot_type == LootType.Skinning)
m_corpseRemoveTime = now;
@@ -3102,7 +3104,12 @@ namespace Game.Entities
public ulong GetSpawnId() { return m_spawnId; }
public void SetCorpseDelay(uint delay) { m_corpseDelay = delay; }
public void SetCorpseDelay(uint delay, bool ignoreCorpseDecayRatio = false)
{
m_corpseDelay = delay;
if (ignoreCorpseDecayRatio)
m_ignoreCorpseDecayRatio = true;
}
public uint GetCorpseDelay() { return m_corpseDelay; }
public bool IsRacialLeader() { return GetCreatureTemplate().RacialLeader; }
public bool IsCivilian()