Add respawn timer to smartscript despawn
This commit is contained in:
@@ -95,7 +95,7 @@ namespace Game.AI
|
|||||||
mDespawnState++;
|
mDespawnState++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
me.DespawnOrUnsummon();
|
me.DespawnOrUnsummon(0, TimeSpan.FromSeconds(mRespawnTime));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
mDespawnTime -= diff;
|
mDespawnTime -= diff;
|
||||||
@@ -549,6 +549,7 @@ namespace Game.AI
|
|||||||
public override void JustRespawned()
|
public override void JustRespawned()
|
||||||
{
|
{
|
||||||
mDespawnTime = 0;
|
mDespawnTime = 0;
|
||||||
|
mRespawnTime = 0;
|
||||||
mDespawnState = 0;
|
mDespawnState = 0;
|
||||||
mEscortState = SmartEscortState.None;
|
mEscortState = SmartEscortState.None;
|
||||||
me.SetVisible(true);
|
me.SetVisible(true);
|
||||||
@@ -907,9 +908,10 @@ namespace Game.AI
|
|||||||
|
|
||||||
public void SetInvincibilityHpLevel(uint level) { mInvincibilityHpLevel = level; }
|
public void SetInvincibilityHpLevel(uint level) { mInvincibilityHpLevel = level; }
|
||||||
|
|
||||||
public void SetDespawnTime(uint t)
|
public void SetDespawnTime(uint t, uint r = 0)
|
||||||
{
|
{
|
||||||
mDespawnTime = t;
|
mDespawnTime = t;
|
||||||
|
mRespawnTime = r;
|
||||||
mDespawnState = (uint)(t != 0 ? 1 : 0);
|
mDespawnState = (uint)(t != 0 ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -945,6 +947,7 @@ namespace Game.AI
|
|||||||
uint mInvincibilityHpLevel;
|
uint mInvincibilityHpLevel;
|
||||||
|
|
||||||
uint mDespawnTime;
|
uint mDespawnTime;
|
||||||
|
uint mRespawnTime;
|
||||||
uint mDespawnState;
|
uint mDespawnState;
|
||||||
|
|
||||||
public uint mEscortQuestID;
|
public uint mEscortQuestID;
|
||||||
|
|||||||
@@ -2348,6 +2348,7 @@ namespace Game.AI
|
|||||||
public struct ForceDespawn
|
public struct ForceDespawn
|
||||||
{
|
{
|
||||||
public uint delay;
|
public uint delay;
|
||||||
|
public uint respawn;
|
||||||
}
|
}
|
||||||
public struct InvincHP
|
public struct InvincHP
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1071,11 +1071,11 @@ namespace Game.AI
|
|||||||
Creature target = obj.ToCreature();
|
Creature target = obj.ToCreature();
|
||||||
if (target.IsAlive() && IsSmart(target))
|
if (target.IsAlive() && IsSmart(target))
|
||||||
{
|
{
|
||||||
((SmartAI)target.GetAI()).SetDespawnTime(e.Action.forceDespawn.delay + 1); // Next tick
|
((SmartAI)target.GetAI()).SetDespawnTime(e.Action.forceDespawn.delay + 1, e.Action.forceDespawn.respawn); // Next tick
|
||||||
((SmartAI)target.GetAI()).StartDespawn();
|
((SmartAI)target.GetAI()).StartDespawn();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
target.DespawnOrUnsummon(e.Action.forceDespawn.delay);
|
target.DespawnOrUnsummon(e.Action.forceDespawn.delay, TimeSpan.FromSeconds(e.Action.forceDespawn.respawn));
|
||||||
}
|
}
|
||||||
else if (obj.IsTypeId(TypeId.GameObject))
|
else if (obj.IsTypeId(TypeId.GameObject))
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user