Core/Misc: Misc fixes
This commit is contained in:
@@ -59,7 +59,10 @@ namespace Framework.Database
|
||||
|
||||
public bool IsEmpty()
|
||||
{
|
||||
return _reader == null || !_reader.HasRows;
|
||||
if (_reader == null)
|
||||
return true;
|
||||
|
||||
return _reader.IsClosed || !_reader.HasRows;
|
||||
}
|
||||
|
||||
public SQLFields GetFields()
|
||||
|
||||
@@ -27,7 +27,6 @@ public static class Time
|
||||
public const int Year = Month * 12;
|
||||
public const int InMilliseconds = 1000;
|
||||
|
||||
public static readonly DateTime Epoch = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
|
||||
public static readonly DateTime ApplicationStartTime = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
@@ -37,7 +36,7 @@ public static class Time
|
||||
{
|
||||
get
|
||||
{
|
||||
return (long)(DateTime.Now - Epoch).TotalSeconds;
|
||||
return DateTimeToUnixTime(DateTime.Now);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,8 +47,7 @@ public static class Time
|
||||
{
|
||||
get
|
||||
{
|
||||
var ts = (DateTime.Now - Epoch);
|
||||
return ts.ToMilliseconds();
|
||||
return ((DateTimeOffset)DateTime.Now).ToUnixTimeMilliseconds();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,11 +93,11 @@ public static class Time
|
||||
|
||||
public static DateTime UnixTimeToDateTime(long unixTime)
|
||||
{
|
||||
return Epoch.AddSeconds(unixTime);
|
||||
return DateTimeOffset.FromUnixTimeSeconds(unixTime).LocalDateTime;
|
||||
}
|
||||
public static long DateTimeToUnixTime(DateTime dateTime)
|
||||
{
|
||||
return (long)(dateTime - Epoch).TotalSeconds;
|
||||
return ((DateTimeOffset)dateTime).ToUnixTimeSeconds();
|
||||
}
|
||||
|
||||
public static long GetNextResetUnixTime(int hours)
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace Game.BattleGrounds
|
||||
var bgs = data.m_Battlegrounds;
|
||||
|
||||
// first one is template and should not be deleted
|
||||
foreach (var pair in bgs)
|
||||
foreach (var pair in bgs.ToList())
|
||||
{
|
||||
Battleground bg = pair.Value;
|
||||
bg.Update(m_UpdateTimer);
|
||||
|
||||
@@ -414,7 +414,7 @@ namespace Game
|
||||
pair.Value.GetAchievementMgr().LoadFromDB(achievementResult, criteriaResult);
|
||||
}
|
||||
|
||||
Log.outInfo(LogFilter.ServerLoading, "Loaded guild achievements and criterias in {1} ms", Time.GetMSTimeDiffToNow(oldMSTime));
|
||||
Log.outInfo(LogFilter.ServerLoading, "Loaded guild achievements and criterias in {0} ms", Time.GetMSTimeDiffToNow(oldMSTime));
|
||||
}
|
||||
|
||||
// 11. Validate loaded guild data
|
||||
|
||||
@@ -133,8 +133,6 @@ namespace Game
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "Received opcode CMSG_PETITION_SHOW_SIGNATURES");
|
||||
|
||||
byte signs = 0;
|
||||
|
||||
// if has guild => error, return;
|
||||
if (GetPlayer().GetGuildId() != 0)
|
||||
return;
|
||||
@@ -436,8 +434,6 @@ namespace Game
|
||||
}
|
||||
|
||||
// Get petition signatures from db
|
||||
byte signatures;
|
||||
|
||||
stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_PETITION_SIGNATURE);
|
||||
stmt.AddValue(0, packet.Item.GetCounter());
|
||||
result = DB.Characters.Query(stmt);
|
||||
|
||||
@@ -2340,8 +2340,9 @@ namespace Game.Maps
|
||||
break;
|
||||
case TypeId.GameObject:
|
||||
GameObject go = obj.ToGameObject();
|
||||
if (go.IsTransport())
|
||||
RemoveFromMap(go.ToTransport(), true);
|
||||
Transport transport = go.ToTransport();
|
||||
if (transport)
|
||||
RemoveFromMap(transport, true);
|
||||
else
|
||||
RemoveFromMap(go, true);
|
||||
break;
|
||||
@@ -2721,7 +2722,7 @@ namespace Game.Maps
|
||||
bones = new Corpse();
|
||||
bones.Create(corpse.GetGUID().GetCounter(), this);
|
||||
|
||||
for (byte i = (int)ObjectFields.Guid + 4; i < (int)CorpseFields.End; ++i) // don't overwrite guid
|
||||
for (int i = (int)ObjectFields.Guid + 4; i < (int)CorpseFields.End; ++i) // don't overwrite guid
|
||||
bones.SetUInt32Value(i, corpse.GetUInt32Value(i));
|
||||
|
||||
bones.SetCellCoord(corpse.GetCellCoord());
|
||||
|
||||
@@ -38,7 +38,6 @@ namespace Game.Maps
|
||||
_workerThreads[i] = new Thread(WorkerThread);
|
||||
_workerThreads[i].Start();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void Deactivate()
|
||||
@@ -48,11 +47,8 @@ namespace Game.Maps
|
||||
Wait();
|
||||
|
||||
_queue.Cancel();
|
||||
|
||||
foreach (var thread in _workerThreads)
|
||||
{
|
||||
thread.Join();
|
||||
}
|
||||
}
|
||||
|
||||
public void Wait()
|
||||
@@ -96,7 +92,6 @@ namespace Game.Maps
|
||||
return;
|
||||
|
||||
request.Call();
|
||||
UpdateFinished();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -123,11 +118,7 @@ namespace Game.Maps
|
||||
public void Call()
|
||||
{
|
||||
m_map.Update(m_diff);
|
||||
}
|
||||
|
||||
public uint GetId()
|
||||
{
|
||||
return m_map.GetId();
|
||||
m_updater.UpdateFinished();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4643,7 +4643,7 @@ namespace Game.Spells
|
||||
float x, y, z;
|
||||
m_targets.GetDstPos().GetPosition(out x, out y, out z);
|
||||
|
||||
if (!m_spellInfo.HasAttribute(SpellAttr2.CanTargetDead) && !Global.DisableMgr.IsDisabledFor(DisableType.Spell, m_spellInfo.Id, null, DisableFlags.SpellLOS)
|
||||
if (!m_spellInfo.HasAttribute(SpellAttr2.CanTargetNotInLos) && !Global.DisableMgr.IsDisabledFor(DisableType.Spell, m_spellInfo.Id, null, DisableFlags.SpellLOS)
|
||||
&& !m_caster.IsWithinLOS(x, y, z))
|
||||
return SpellCastResult.LineOfSight;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user