[Quest API] Add ResetDecayTimer() to Perl/Lua. (#2520)

This commit is contained in:
hg
2022-11-06 10:48:10 -05:00
committed by GitHub
parent 69e90c1739
commit 3d7c43e92f
5 changed files with 41 additions and 0 deletions
+27
View File
@@ -908,6 +908,33 @@ bool Corpse::Process() {
return true;
}
void Corpse::ResetDecayTimer()
{
int decay_ms = level > 54 ? RuleI(NPC, MajorNPCCorpseDecayTimeMS) : RuleI(NPC, MinorNPCCorpseDecayTimeMS);
if (IsPlayerCorpse())
{
decay_ms = RuleI(Character, CorpseDecayTimeMS);
}
else if (IsEmpty())
{
decay_ms = RuleI(NPC, EmptyNPCCorpseDecayTimeMS) + 1000;
}
else
{
for (const npcDecayTimes_Struct& decay_time : npcCorpseDecayTimes)
{
if (level >= decay_time.minlvl && level <= decay_time.maxlvl)
{
decay_ms = decay_time.seconds * 1000;
break;
}
}
}
corpse_decay_timer.SetTimer(decay_ms);
}
void Corpse::SetDecayTimer(uint32 decaytime) {
if (decaytime == 0)
corpse_decay_timer.Trigger();