Convert alot of methods to use TimeSpan.
This commit is contained in:
@@ -21,6 +21,7 @@ using Game.Entities;
|
||||
using Game.Scripting;
|
||||
using System.Collections.Generic;
|
||||
using Game.AI;
|
||||
using System;
|
||||
|
||||
namespace Scripts.World.Areatriggers
|
||||
{
|
||||
@@ -210,7 +211,7 @@ namespace Scripts.World.Areatriggers
|
||||
if (!player.IsDead() && player.GetQuestStatus(QuestIds.ScentOfLarkorwi) == QuestStatus.Incomplete)
|
||||
{
|
||||
if (!player.FindNearestCreature(CreatureIds.LarkorwiMate, 15))
|
||||
player.SummonCreature(CreatureIds.LarkorwiMate, player.GetPositionX() + 5, player.GetPositionY(), player.GetPositionZ(), 3.3f, TempSummonType.TimedDespawnOutOfCombat, 100000);
|
||||
player.SummonCreature(CreatureIds.LarkorwiMate, player.GetPositionX() + 5, player.GetPositionY(), player.GetPositionZ(), 3.3f, TempSummonType.TimedDespawnOutOfCombat, TimeSpan.FromSeconds(100));
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -257,7 +258,7 @@ namespace Scripts.World.Areatriggers
|
||||
{
|
||||
if (!player.FindNearestCreature(CreatureIds.LurkingShark, 20.0f))
|
||||
{
|
||||
Creature shark = player.SummonCreature(CreatureIds.LurkingShark, -4246.243f, -3922.356f, -7.488f, 5.0f, TempSummonType.TimedDespawnOutOfCombat, 100000);
|
||||
Creature shark = player.SummonCreature(CreatureIds.LurkingShark, -4246.243f, -3922.356f, -7.488f, 5.0f, TempSummonType.TimedDespawnOutOfCombat, TimeSpan.FromSeconds(100));
|
||||
if (shark)
|
||||
shark.GetAI().AttackStart(player);
|
||||
|
||||
@@ -361,7 +362,7 @@ namespace Scripts.World.Areatriggers
|
||||
break;
|
||||
}
|
||||
|
||||
player.SummonCreature(CreatureIds.Spotlight, x, y, z, 0.0f, TempSummonType.TimedDespawn, 5000);
|
||||
player.SummonCreature(CreatureIds.Spotlight, x, y, z, 0.0f, TempSummonType.TimedDespawn, TimeSpan.FromSeconds(5));
|
||||
player.AddAura(SpellIds.A52Neuralyzer, player);
|
||||
_triggerTimes[areaTrigger.Id] = GameTime.GetGameTime();
|
||||
return false;
|
||||
@@ -393,7 +394,7 @@ namespace Scripts.World.Areatriggers
|
||||
if (stormforgedEradictor)
|
||||
return false;
|
||||
|
||||
stormforgedMonitor = player.SummonCreature(CreatureIds.StormforgedMonitor, Misc.StormforgedMonitorPosition, TempSummonType.TimedDespawnOutOfCombat, 60000);
|
||||
stormforgedMonitor = player.SummonCreature(CreatureIds.StormforgedMonitor, Misc.StormforgedMonitorPosition, TempSummonType.TimedDespawnOutOfCombat, TimeSpan.FromSeconds(60));
|
||||
if (stormforgedMonitor)
|
||||
{
|
||||
stormforgedMonitorGUID = stormforgedMonitor.GetGUID();
|
||||
@@ -403,7 +404,7 @@ namespace Scripts.World.Areatriggers
|
||||
stormforgedMonitor.GetMotionMaster().MovePath(CreatureIds.StormforgedMonitor * 100, false);
|
||||
}
|
||||
|
||||
stormforgedEradictor = player.SummonCreature(CreatureIds.StormforgedEradictor, Misc.StormforgedEradictorPosition, TempSummonType.TimedDespawnOutOfCombat, 60000);
|
||||
stormforgedEradictor = player.SummonCreature(CreatureIds.StormforgedEradictor, Misc.StormforgedEradictorPosition, TempSummonType.TimedDespawnOutOfCombat, TimeSpan.FromSeconds(60));
|
||||
if (stormforgedEradictor)
|
||||
{
|
||||
stormforgedEradictorGUID = stormforgedEradictor.GetGUID();
|
||||
|
||||
@@ -299,7 +299,7 @@ namespace Scripts.World.EmeraldDragons
|
||||
if (spellInfo.Id == SpellIds.DrawSpirit && target.IsPlayer())
|
||||
{
|
||||
Position targetPos = target.GetPosition();
|
||||
me.SummonCreature(CreatureIds.SpiritShade, targetPos, TempSummonType.TimedDespawnOutOfCombat, 50000);
|
||||
me.SummonCreature(CreatureIds.SpiritShade, targetPos, TempSummonType.TimedDespawnOutOfCombat, TimeSpan.FromSeconds(50));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -326,7 +326,7 @@ namespace Scripts.World.EmeraldDragons
|
||||
if (moveType == MovementGeneratorType.Follow && data == _summonerGuid.GetCounter())
|
||||
{
|
||||
me.CastSpell((Unit)null, SpellIds.DarkOffering, false);
|
||||
me.DespawnOrUnsummon(1000);
|
||||
me.DespawnOrUnsummon(TimeSpan.FromSeconds(1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -313,7 +313,7 @@ namespace Scripts.World.GameObjects
|
||||
{
|
||||
if (player.GetQuestStatus(QuestIds.TheFirstTrial) == QuestStatus.Incomplete)
|
||||
{
|
||||
Creature Stillblade = player.SummonCreature(CreatureIds.Stillblade, 8106.11f, -7542.06f, 151.775f, 3.02598f, TempSummonType.DeadDespawn, 60000);
|
||||
Creature Stillblade = player.SummonCreature(CreatureIds.Stillblade, 8106.11f, -7542.06f, 151.775f, 3.02598f, TempSummonType.DeadDespawn, TimeSpan.FromMinutes(1));
|
||||
if (Stillblade)
|
||||
Stillblade.GetAI().AttackStart(player);
|
||||
}
|
||||
@@ -350,7 +350,7 @@ namespace Scripts.World.GameObjects
|
||||
me.UseDoorOrButton();
|
||||
int Random = (int)(RandomHelper.Rand32() % (CreatureIds.PrisonEntry.Length / sizeof(uint)));
|
||||
|
||||
Creature creature = player.SummonCreature(CreatureIds.PrisonEntry[Random], me.GetPositionX(), me.GetPositionY(), me.GetPositionZ(), me.GetAbsoluteAngle(player), TempSummonType.TimedDespawnOutOfCombat, 30000);
|
||||
Creature creature = player.SummonCreature(CreatureIds.PrisonEntry[Random], me.GetPositionX(), me.GetPositionY(), me.GetPositionZ(), me.GetAbsoluteAngle(player), TempSummonType.TimedDespawnOutOfCombat, TimeSpan.FromSeconds(30));
|
||||
if (creature)
|
||||
{
|
||||
if (!creature.IsHostileTo(player))
|
||||
@@ -404,7 +404,7 @@ namespace Scripts.World.GameObjects
|
||||
me.UseDoorOrButton();
|
||||
int Random = (int)(RandomHelper.Rand32() % CreatureIds.StasisEntry.Length / sizeof(uint));
|
||||
|
||||
player.SummonCreature(CreatureIds.StasisEntry[Random], me.GetPositionX(), me.GetPositionY(), me.GetPositionZ(), me.GetAbsoluteAngle(player), TempSummonType.TimedDespawnOutOfCombat, 30000);
|
||||
player.SummonCreature(CreatureIds.StasisEntry[Random], me.GetPositionX(), me.GetPositionY(), me.GetPositionZ(), me.GetAbsoluteAngle(player), TempSummonType.TimedDespawnOutOfCombat, TimeSpan.FromSeconds(30));
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -418,7 +418,7 @@ namespace Scripts.World.GameObjects
|
||||
public override bool GossipHello(Player player)
|
||||
{
|
||||
if (me.GetGoType() == GameObjectTypes.Goober)
|
||||
me.SummonCreature(CreatureIds.Goggeroc, 0.0f, 0.0f, 0.0f, 0.0f, TempSummonType.TimedDespawnOutOfCombat, 300000);
|
||||
me.SummonCreature(CreatureIds.Goggeroc, 0.0f, 0.0f, 0.0f, 0.0f, TempSummonType.TimedDespawnOutOfCombat, TimeSpan.FromMinutes(5));
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -434,7 +434,7 @@ namespace Scripts.World.GameObjects
|
||||
//implicitTarget=48 not implemented as of writing this code, and manual summon may be just ok for our purpose
|
||||
//player.CastSpell(player, SpellSummonRizzle, false);
|
||||
|
||||
Creature creature = player.SummonCreature(CreatureIds.Rizzle, 0.0f, 0.0f, 0.0f, 0.0f, TempSummonType.DeadDespawn, 0);
|
||||
Creature creature = player.SummonCreature(CreatureIds.Rizzle, 0.0f, 0.0f, 0.0f, 0.0f, TempSummonType.DeadDespawn);
|
||||
if (creature)
|
||||
creature.CastSpell(player, SpellIds.Blackjack, false);
|
||||
|
||||
@@ -543,7 +543,7 @@ namespace Scripts.World.GameObjects
|
||||
{
|
||||
if (player.GetQuestStatus(QuestIds.PrisonBreak) == QuestStatus.Incomplete)
|
||||
{
|
||||
me.SummonCreature(25318, 3485.089844f, 6115.7422188f, 70.966812f, 0, TempSummonType.TimedDespawn, 60000);
|
||||
me.SummonCreature(25318, 3485.089844f, 6115.7422188f, 70.966812f, 0, TempSummonType.TimedDespawn, TimeSpan.FromMinutes(1));
|
||||
player.CastSpell(player, SpellIds.ArcanePrisonerKillCredit, true);
|
||||
return true;
|
||||
}
|
||||
@@ -559,7 +559,7 @@ namespace Scripts.World.GameObjects
|
||||
public override bool GossipHello(Player player)
|
||||
{
|
||||
if (me.GetGoType() == GameObjectTypes.Goober)
|
||||
player.SummonCreature(CreatureIds.Zelemar, -369.746f, 166.759f, -21.50f, 5.235f, TempSummonType.TimedDespawnOutOfCombat, 30000);
|
||||
player.SummonCreature(CreatureIds.Zelemar, -369.746f, 166.759f, -21.50f, 5.235f, TempSummonType.TimedDespawnOutOfCombat, TimeSpan.FromSeconds(30));
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -691,8 +691,8 @@ namespace Scripts.World.GameObjects
|
||||
public override bool GossipHello(Player player)
|
||||
{
|
||||
player.SendLoot(me.GetGUID(), LootType.Corpse);
|
||||
me.SummonCreature(CreatureIds.HiveAmbusher, me.GetPositionX() + 1, me.GetPositionY(), me.GetPositionZ(), me.GetAbsoluteAngle(player), TempSummonType.TimedOrDeadDespawn, 60000);
|
||||
me.SummonCreature(CreatureIds.HiveAmbusher, me.GetPositionX(), me.GetPositionY() + 1, me.GetPositionZ(), me.GetAbsoluteAngle(player), TempSummonType.TimedOrDeadDespawn, 60000);
|
||||
me.SummonCreature(CreatureIds.HiveAmbusher, me.GetPositionX() + 1, me.GetPositionY(), me.GetPositionZ(), me.GetAbsoluteAngle(player), TempSummonType.TimedOrDeadDespawn, TimeSpan.FromMinutes(1));
|
||||
me.SummonCreature(CreatureIds.HiveAmbusher, me.GetPositionX(), me.GetPositionY() + 1, me.GetPositionZ(), me.GetAbsoluteAngle(player), TempSummonType.TimedOrDeadDespawn, TimeSpan.FromMinutes(1));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -724,7 +724,7 @@ namespace Scripts.World.GameObjects
|
||||
foreach (Creature creature in childrenList)
|
||||
{
|
||||
player.KilledMonsterCredit(CreatureIds.CaptiveChild, creature.GetGUID());
|
||||
creature.DespawnOrUnsummon(5000);
|
||||
creature.DespawnOrUnsummon(TimeSpan.FromSeconds(5));
|
||||
creature.GetMotionMaster().MovePoint(1, me.GetPositionX() + 5, me.GetPositionY(), me.GetPositionZ());
|
||||
creature.GetAI().Talk(TextIds.SayFree0);
|
||||
creature.GetMotionMaster().Clear();
|
||||
|
||||
@@ -464,7 +464,7 @@ namespace Scripts.World.NpcSpecial
|
||||
{
|
||||
Creature guard = ObjectAccessor.GetCreature(me, _myGuard);
|
||||
|
||||
if (guard == null && (guard = me.SummonCreature(_spawn.otherEntry, 0.0f, 0.0f, 0.0f, 0.0f, TempSummonType.TimedDespawnOutOfCombat, 300000)))
|
||||
if (guard == null && (guard = me.SummonCreature(_spawn.otherEntry, 0.0f, 0.0f, 0.0f, 0.0f, TempSummonType.TimedDespawnOutOfCombat, TimeSpan.FromMinutes(5))))
|
||||
_myGuard = guard.GetGUID();
|
||||
|
||||
return guard;
|
||||
@@ -951,7 +951,7 @@ namespace Scripts.World.NpcSpecial
|
||||
|
||||
var index = RandomHelper.IRand(0, Coordinates.Count - 1);
|
||||
|
||||
Creature Patient = me.SummonCreature(patientEntry, Coordinates[index], TempSummonType.TimedDespawnOutOfCombat, 5000);
|
||||
Creature Patient = me.SummonCreature(patientEntry, Coordinates[index], TempSummonType.TimedDespawnOutOfCombat, TimeSpan.FromSeconds(5));
|
||||
if (Patient)
|
||||
{
|
||||
//303, this flag appear to be required for client side item.spell to work (TARGET_SINGLE_FRIEND)
|
||||
@@ -1727,7 +1727,7 @@ namespace Scripts.World.NpcSpecial
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
Creature minion = me.SummonCreature(CreatureIds.MinionOfOmen, me.GetPositionX() + RandomHelper.FRand(-5.0f, 5.0f), me.GetPositionY() + RandomHelper.FRand(-5.0f, 5.0f), me.GetPositionZ(), 0.0f, TempSummonType.CorpseTimedDespawn, 20000);
|
||||
Creature minion = me.SummonCreature(CreatureIds.MinionOfOmen, me.GetPositionX() + RandomHelper.FRand(-5.0f, 5.0f), me.GetPositionY() + RandomHelper.FRand(-5.0f, 5.0f), me.GetPositionZ(), 0.0f, TempSummonType.CorpseTimedDespawn, TimeSpan.FromSeconds(20));
|
||||
if (minion)
|
||||
minion.GetAI().AttackStart(me.SelectNearestPlayer(20.0f));
|
||||
break;
|
||||
@@ -1742,7 +1742,7 @@ namespace Scripts.World.NpcSpecial
|
||||
|
||||
float displacement = 0.7f;
|
||||
for (byte i = 0; i < 4; i++)
|
||||
me.SummonGameObject(GetFireworkGameObjectId(), me.GetPositionX() + (i % 2 == 0 ? displacement : -displacement), me.GetPositionY() + (i > 1 ? displacement : -displacement), me.GetPositionZ() + 4.0f, me.GetOrientation(), Quaternion.CreateFromRotationMatrix(Extensions.fromEulerAnglesZYX(me.GetOrientation(), 0.0f, 0.0f)), 1);
|
||||
me.SummonGameObject(GetFireworkGameObjectId(), me.GetPositionX() + (i % 2 == 0 ? displacement : -displacement), me.GetPositionY() + (i > 1 ? displacement : -displacement), me.GetPositionZ() + 4.0f, me.GetOrientation(), Quaternion.CreateFromRotationMatrix(Extensions.fromEulerAnglesZYX(me.GetOrientation(), 0.0f, 0.0f)), TimeSpan.FromSeconds(1));
|
||||
}
|
||||
else
|
||||
//me.CastSpell(me, GetFireworkSpell(me.GetEntry()), true);
|
||||
@@ -1894,7 +1894,7 @@ namespace Scripts.World.NpcSpecial
|
||||
return target;
|
||||
|
||||
me.HandleEmoteCommand(Emote.OneshotRude);
|
||||
me.DespawnOrUnsummon(3 * Time.InMilliseconds);
|
||||
me.DespawnOrUnsummon(TimeSpan.FromSeconds(3));
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1972,7 +1972,7 @@ namespace Scripts.World.NpcSpecial
|
||||
}
|
||||
me.UpdateEntry(CreatureIds.ExultingWindUpTrainWrecker);
|
||||
me.SetEmoteState(Emote.OneshotDance);
|
||||
me.DespawnOrUnsummon(5 * Time.InMilliseconds);
|
||||
me.DespawnOrUnsummon(TimeSpan.FromSeconds(5));
|
||||
_nextAction = 0;
|
||||
break;
|
||||
default:
|
||||
@@ -2137,7 +2137,7 @@ namespace Scripts.World.NpcSpecial
|
||||
init.MoveTo(x, y, z, false);
|
||||
init.SetFacing(o);
|
||||
who.GetMotionMaster().LaunchMoveSpline(init, EventId.VehicleBoard, MovementGeneratorPriority.Highest);
|
||||
who.m_Events.AddEvent(new CastFoodSpell(who, SpellIds.ChairSpells[who.GetEntry()]), who.m_Events.CalculateTime(1000));
|
||||
who.m_Events.AddEvent(new CastFoodSpell(who, SpellIds.ChairSpells[who.GetEntry()]), who.m_Events.CalculateTime(TimeSpan.FromSeconds(1)));
|
||||
Creature creature = who.ToCreature();
|
||||
if (creature)
|
||||
creature.SetDisplayFromModel(0);
|
||||
|
||||
Reference in New Issue
Block a user