Convert alot of methods to use TimeSpan.

This commit is contained in:
hondacrx
2022-03-01 23:47:53 -05:00
parent 6f1b2f5cd5
commit 042bfc12e5
31 changed files with 143 additions and 127 deletions
+6 -4
View File
@@ -93,10 +93,12 @@ namespace Game.Chat
string fill_str = args.NextString();
string duration_str = args.NextString();
if (!int.TryParse(duration_str, out int duration))
duration = -1;
if (duration <= 0 || duration >= 30 * Time.Minute) // arbitary upper limit
duration = 3 * Time.Minute;
if (!int.TryParse(duration_str, out int tempDuration))
tempDuration = 0;
TimeSpan duration = TimeSpan.FromSeconds(tempDuration);
if (duration <= TimeSpan.Zero || duration >= TimeSpan.FromMinutes(30)) // arbitary upper limit
duration = TimeSpan.FromMinutes(3);
bool doFill = fill_str.ToLower().Equals("fill");
@@ -645,10 +645,10 @@ namespace Game.Chat
Player player = handler.GetPlayer();
uint spawntime = args.NextUInt32();
uint spawntm = 300;
TimeSpan spawntm = TimeSpan.FromSeconds(300);
if (spawntime != 0)
spawntm = spawntime;
spawntm = TimeSpan.FromSeconds(spawntime);
Quaternion rotation = Quaternion.CreateFromRotationMatrix(Extensions.fromEulerAnglesZYX(player.GetOrientation(), 0.0f, 0.0f));
if (Global.ObjectMgr.GetGameObjectTemplate(id) == null)
+2 -1
View File
@@ -20,6 +20,7 @@ using Framework.IO;
using Game.Entities;
using Game.Maps;
using Game.Movement;
using System;
using System.Collections.Generic;
namespace Game.Chat
@@ -84,7 +85,7 @@ namespace Game.Chat
handler.SendSysMessage("Enable GM mode to see the path points.");
for (uint i = 0; i < pointPath.Length; ++i)
player.SummonCreature(1, pointPath[i].X, pointPath[i].Y, pointPath[i].Z, 0, TempSummonType.TimedDespawn, 9000);
player.SummonCreature(1, pointPath[i].X, pointPath[i].Y, pointPath[i].Z, 0, TempSummonType.TimedDespawn, TimeSpan.FromSeconds(9));
return true;
}
+1 -1
View File
@@ -858,7 +858,7 @@ namespace Game.Chat
return false;
Player chr = handler.GetSession().GetPlayer();
chr.SummonCreature(id, chr, loot ? TempSummonType.CorpseTimedDespawn : TempSummonType.CorpseDespawn, 30 * Time.InMilliseconds);
chr.SummonCreature(id, chr, loot ? TempSummonType.CorpseTimedDespawn : TempSummonType.CorpseDespawn, TimeSpan.FromSeconds(30));
return true;
}