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
+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()