Fixed two crashes

This commit is contained in:
hondacrx
2021-04-21 19:54:20 -04:00
parent ba064327b0
commit 40826f78a2
6 changed files with 12 additions and 10 deletions
@@ -98,7 +98,7 @@ namespace BNetServer.Networking
PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.UpdBnetLastLoginInfo);
stmt.AddValue(0, GetRemoteIpEndPoint().ToString());
stmt.AddValue(1, (byte)Enum.Parse(typeof(Locale), locale));
stmt.AddValue(1, (byte)locale.ToEnum<Locale>());
stmt.AddValue(2, os);
stmt.AddValue(3, accountInfo.Id);
+4 -4
View File
@@ -335,11 +335,11 @@ namespace Framework.IO
WriteUInt32(packed);
}
public bool WriteBit(object bit)
public bool WriteBit(bool bit)
{
--_bitPosition;
if (Convert.ToBoolean(bit))
if (bit)
BitValue |= (byte)(1 << _bitPosition);
if (_bitPosition == 0)
@@ -349,13 +349,13 @@ namespace Framework.IO
_bitPosition = 8;
BitValue = 0;
}
return Convert.ToBoolean(bit);
return bit;
}
public void WriteBits(object bit, int count)
{
for (int i = count - 1; i >= 0; --i)
WriteBit((Convert.ToUInt32(bit) >> i) & 1);
WriteBit(((Convert.ToUInt32(bit) >> i) & 1) != 0);
}
public void WritePackedTime(long time)
+3 -1
View File
@@ -2921,7 +2921,7 @@ namespace Game.Entities
public class AzeriteEmpoweredData
{
public Array<int> SelectedAzeritePowers = new(SharedConst.MaxAzeriteEmpoweredTier);
public int[] SelectedAzeritePowers = new int[SharedConst.MaxAzeriteEmpoweredTier];
}
class ItemAdditionalLoadInfo
@@ -2989,6 +2989,8 @@ namespace Game.Entities
info.AzeriteItem.KnowledgeLevel = azeriteItemResult.Read<uint>(3);
for (int i = 0; i < info.AzeriteItem.SelectedAzeriteEssences.Length; ++i)
{
info.AzeriteItem.SelectedAzeriteEssences[i] = new();
uint specializationId = azeriteItemResult.Read<uint>(4 + i * 4);
if (!CliDB.ChrSpecializationStorage.ContainsKey(specializationId))
continue;
+1 -1
View File
@@ -493,7 +493,7 @@ namespace Game.Entities
data.WriteBit(hasMovementScript);
if (hasUnk3)
data.WriteBit(0);
data.WriteBit(false);
data.FlushBits();
@@ -137,7 +137,7 @@ namespace Game.Networking.Packets
_worldPacket.WriteUInt32(Mapid);
_worldPacket.WriteUInt32(ShutdownTimer);
_worldPacket.WriteUInt32(StartTimer);
_worldPacket.WriteBit(ArenaFaction);
_worldPacket.WriteBit(ArenaFaction != 0);
_worldPacket.WriteBit(LeftEarly);
_worldPacket.FlushBits();
}
@@ -629,7 +629,7 @@ namespace Game.Networking.Packets
foreach (var pvpStat in Stats)
pvpStat.Write(data);
data.WriteBit(Faction);
data.WriteBit(Faction != 0);
data.WriteBit(IsInWorld);
data.WriteBit(Honor.HasValue);
data.WriteBit(PreMatchRating.HasValue);
@@ -63,7 +63,7 @@ namespace Game.Networking.Packets
_worldPacket.WriteInt32(MaxLevel);
_worldPacket.WriteInt32(MapID);
_worldPacket.WriteUInt32(InstanceID);
_worldPacket.WriteBit(Index);
_worldPacket.WriteBit(Index != 0);
_worldPacket.FlushBits();
}