Fixed DB2 loading and world login!!!!!

This commit is contained in:
hondacrx
2018-12-14 18:43:35 -05:00
parent 8e20114e10
commit f414068883
44 changed files with 779 additions and 852 deletions
+3 -1
View File
@@ -469,7 +469,9 @@ namespace BNetServer.Networking
{
var realmListTicketClientInformation = Json.CreateObject<RealmListTicketClientInformation>(clientInfo.BlobValue.ToStringUtf8(), true);
clientInfoOk = true;
_clientSecret.AddRange(realmListTicketClientInformation.Info.Secret.Select(Convert.ToByte).ToArray());
int i = 0;
foreach (var b in realmListTicketClientInformation.Info.Secret.Select(Convert.ToByte))
_clientSecret[i++] = b;
}
if (!clientInfoOk)
+6 -13
View File
@@ -21,6 +21,8 @@ namespace System.Collections.Generic
{
public class Array<T> : List<T>
{
int _limit;
public Array(int size) : base(size)
{
_limit = size;
@@ -31,8 +33,9 @@ namespace System.Collections.Generic
_limit = args.Length;
}
public Array(int size, T defaultFillValue) : this(size)
public Array(int size, T defaultFillValue) : base(size)
{
_limit = size;
Fill(defaultFillValue);
}
@@ -42,14 +45,6 @@ namespace System.Collections.Generic
Add(value);
}
public new void Add(T value)
{
if (base.Count >= _limit)
throw new InternalBufferOverflowException("Attempted to read more array elements from packet " + base.Count + 1 + " than allowed " + _limit);
base.Add(value);
}
public new T this[int index]
{
get
@@ -61,8 +56,8 @@ namespace System.Collections.Generic
if (index >= Count)
{
if (Count >= _limit)
throw new InternalBufferOverflowException("Attempted to read more array elements from packet " + base.Count + 1 + " than allowed " + _limit);
base.Insert(index, value);
throw new InternalBufferOverflowException("Attempted to read more array elements from packet " + Count + 1 + " than allowed " + _limit);
Insert(index, value);
}
else
base[index] = value;
@@ -75,7 +70,5 @@ namespace System.Collections.Generic
{
return array.ToArray();
}
int _limit;
}
}
+23 -1
View File
@@ -13,10 +13,32 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
*/
using System;
namespace Framework.Constants
{
public enum DB2ColumnCompression : uint
{
None,
Immediate,
Common,
Pallet,
PalletArray,
SignedImmediate
}
[Flags]
public enum HeaderFlags : short
{
None = 0x0,
OffsetMap = 0x1,
SecondIndex = 0x2,
IndexMap = 0x4,
Unknown = 0x8,
Compressed = 0x10,
}
public enum AbilityLearnType : byte
{
OnSkillValue = 1, // Spell state will update depending on skill value
+1 -1
View File
@@ -36,7 +36,7 @@ namespace Framework.Constants
public const int MaxItemSubclassTotal = 21;
public const int MaxItemSetItems = 10;
public const int MaxItemSetItems = 17;
public const int MaxItemSetSpells = 8;
public static uint[] ItemQualityColors =
+1 -1
View File
@@ -12,7 +12,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.CSharp" Version="4.5.0" />
<PackageReference Include="MySqlConnector" Version="0.46.2" />
<PackageReference Include="MySqlConnector" Version="0.48.2" />
<PackageReference Include="System.Reflection.Emit.Lightweight" Version="4.3.0" />
</ItemGroup>
-57
View File
@@ -305,44 +305,6 @@ namespace Framework.IO
WriteBytes(buffer.GetData());
}
public void Replace<T>(int pos, T value)
{
int retpos = (int)writeStream.BaseStream.Position;
writeStream.Seek(pos, SeekOrigin.Begin);
switch (typeof(T).Name)
{
case "Byte":
WriteUInt8(Convert.ToByte(value));
break;
case "SByte":
WriteInt8(Convert.ToSByte(value));
break;
case "Float":
WriteFloat(Convert.ToSingle(value));
break;
case "Int16":
WriteInt16(Convert.ToInt16(value));
break;
case "UInt16":
WriteUInt16(Convert.ToUInt16(value));
break;
case "Int32":
WriteInt32(Convert.ToInt32(value));
break;
case "UInt32":
WriteUInt32(Convert.ToUInt32(value));
break;
case "Int64":
WriteInt64(Convert.ToInt64(value));
break;
case "UInt64":
WriteUInt64(Convert.ToUInt64(value));
break;
}
writeStream.Seek(retpos, SeekOrigin.Begin);
}
public void WriteVector3(Vector3 pos)
{
WriteFloat(pos.X);
@@ -401,25 +363,6 @@ namespace Framework.IO
}
#endregion
public int GetPosition()
{
long pos = 0;
if (writeStream != null)
pos = writeStream.BaseStream.Position;
else if (readStream != null)
pos = readStream.BaseStream.Position;
return (int)pos;
}
public void SetPosition(long pos)
{
if (writeStream != null)
writeStream.BaseStream.Position = pos;
else if (readStream != null)
readStream.BaseStream.Position = pos;
}
public void FlushBits()
{
if (BitPosition == 8)
+2 -1
View File
@@ -2120,7 +2120,8 @@ namespace Game
new ConditionTypeInfo("Pet type", true, false, false),
new ConditionTypeInfo("On Taxi", false,false, false),
new ConditionTypeInfo("Quest state mask", true, true, false),
new ConditionTypeInfo("Objective Complete", true, false, false)
new ConditionTypeInfo("Objective Complete", true, false, false),
new ConditionTypeInfo("Map Difficulty", true, false, false)
};
public struct ConditionTypeInfo
+2 -2
View File
@@ -275,6 +275,8 @@ namespace Game.DataStorage
WorldMapOverlayStorage = DBReader.Read<WorldMapOverlayRecord>("WorldMapOverlay.db2", HotfixStatements.SEL_WORLD_MAP_OVERLAY);
WorldSafeLocsStorage = DBReader.Read<WorldSafeLocsRecord>("WorldSafeLocs.db2", HotfixStatements.SEL_WORLD_SAFE_LOCS, HotfixStatements.SEL_WORLD_SAFE_LOCS_LOCALE);
Global.DB2Mgr.LoadStores();
foreach (var entry in TaxiPathStorage.Values)
{
if (!TaxiPathSetBySource.ContainsKey(entry.FromTaxiNode))
@@ -321,8 +323,6 @@ namespace Game.DataStorage
OldContinentsNodesMask[field] |= submask;
}
Global.DB2Mgr.LoadStores();
// Check loaded DB2 files proper version
if (!AreaTableStorage.ContainsKey(10048) || // last area added in 8.0.1 (28153)
!CharTitlesStorage.ContainsKey(633) || // last char title added in 8.0.1 (28153)
@@ -15,72 +15,58 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.IO;
using System;
using System.Runtime.CompilerServices;
using System.Text;
namespace Game.DataStorage
{
public class BitReader
{
private byte[] m_data;
private int m_bitPosition;
private int m_offset;
public int Position { get => m_bitPosition; set => m_bitPosition = value; }
public int Offset { get => m_offset; set => m_offset = value; }
public byte[] Data { get => m_data; set => m_data = value; }
public BitReader(byte[] data)
{
m_array = data;
m_data = data;
}
public BitReader(byte[] data, int offset)
{
m_array = data;
m_readOffset = offset;
m_data = data;
m_offset = offset;
}
public uint ReadUInt32(int numBits)
public T Read<T>(int numBits) where T : unmanaged
{
uint result = BitConverter.ToUInt32(m_array, m_readOffset + (m_readPos >> 3)) << (32 - numBits - (m_readPos & 7)) >> (32 - numBits);
m_readPos += numBits;
ulong result = Unsafe.As<byte, ulong>(ref m_data[m_offset + (m_bitPosition >> 3)]) << (64 - numBits - (m_bitPosition & 7)) >> (64 - numBits);
m_bitPosition += numBits;
return Unsafe.As<ulong, T>(ref result);
}
public T ReadSigned<T>(int numBits) where T : unmanaged
{
ulong result = Unsafe.As<byte, ulong>(ref m_data[m_offset + (m_bitPosition >> 3)]) << (64 - numBits - (m_bitPosition & 7)) >> (64 - numBits);
m_bitPosition += numBits;
ulong signedShift = (1UL << (numBits - 1));
result = (signedShift ^ result) - signedShift;
return Unsafe.As<ulong, T>(ref result);
}
public string ReadCString()
{
int start = m_bitPosition;
while (m_data[m_offset + (m_bitPosition >> 3)] != 0)
m_bitPosition += 8;
string result = Encoding.UTF8.GetString(m_data, m_offset + (start >> 3), (m_bitPosition - start) >> 3);
m_bitPosition += 8;
return result;
}
public ulong ReadUInt64(int bitWidth, int bitOffset)
{
int bitsToRead = bitOffset & 7;
ulong result = BitConverter.ToUInt64(m_array, m_readOffset + (m_readPos >> 3)) << (64 - bitsToRead - bitWidth) >> (64 - bitWidth);
m_readPos += bitWidth;
return result;
}
public byte[] ReadValue(int bitWidth, int bitOffset = 0, bool isSigned = false)
{
ulong result = ReadUInt64(bitWidth, bitOffset);
if (isSigned)
{
ulong mask = 1ul << (bitWidth - 1);
result = (result ^ mask) - mask;
}
var ulongBytes = BitConverter.GetBytes(result);
byte[] data = new byte[NextPow2((bitWidth + 7) / 8)];
Buffer.BlockCopy(ulongBytes, 0, data, 0, data.Length);
return data;
}
private int NextPow2(int v)
{
v--;
v |= v >> 1;
v |= v >> 2;
v |= v >> 4;
v |= v >> 8;
v |= v >> 16;
v++;
return Math.Max(v, 1);
}
public int Position { get => m_readPos; set => m_readPos = value; }
public int Offset { get => m_readOffset; set => m_readOffset = value; }
private byte[] m_array;
private int m_readPos;
private int m_readOffset;
}
}
@@ -17,6 +17,7 @@
using Framework.Constants;
using Framework.Database;
using Framework.Dynamic;
using Framework.GameMath;
using Framework.IO;
using System;
@@ -37,146 +38,130 @@ namespace Game.DataStorage
[Serializable]
public class DB6Storage<T> : Dictionary<uint, T>, IDB2Storage where T : new()
{
public void LoadData(int indexField, DB6FieldInfo[] helpers, HotfixStatements preparedStatement, HotfixStatements preparedStatementLocale)
public void LoadData(int indexField, HotfixStatements preparedStatement, HotfixStatements preparedStatementLocale)
{
SQLResult result = DB.Hotfix.Query(DB.Hotfix.GetPreparedStatement(preparedStatement));
if (!result.IsEmpty())
{
do
{
var idValue = result.Read<uint>(indexField == -1 ? 0 : indexField);
var id = result.Read<uint>(indexField == -1 ? 0 : indexField);
var obj = new T();
int index = 0;
for (var fieldIndex = 0; fieldIndex < helpers.Length; fieldIndex++)
int dbIndex = 0;
foreach (var f in typeof(T).GetFields())
{
var helper = helpers[fieldIndex];
if (helper.IsArray)
Type type = f.FieldType;
if (type.IsArray)
{
Array array = (Array)helper.Getter(obj);
for (var i = 0; i < array.Length; ++i)
Type arrayElementType = type.GetElementType();
if (arrayElementType.IsEnum)
arrayElementType = arrayElementType.GetEnumUnderlyingType();
Array array = (Array)f.GetValue(obj);
switch (Type.GetTypeCode(arrayElementType))
{
switch (Type.GetTypeCode(helper.FieldType))
{
case TypeCode.SByte:
helper.SetValue(array, result.Read<sbyte>(index++), i);
break;
case TypeCode.Byte:
helper.SetValue(array, result.Read<byte>(index++), i);
break;
case TypeCode.Int16:
helper.SetValue(array, result.Read<short>(index++), i);
break;
case TypeCode.UInt16:
helper.SetValue(array, result.Read<ushort>(index++), i);
break;
case TypeCode.Int32:
helper.SetValue(array, result.Read<int>(index++), i);
break;
case TypeCode.UInt32:
helper.SetValue(array, result.Read<uint>(index++), i);
break;
case TypeCode.Single:
helper.SetValue(array, result.Read<float>(index++), i);
break;
case TypeCode.String:
helper.SetValue(array, result.Read<string>(index++), i);
break;
case TypeCode.Object:
switch (helper.FieldType.Name)
{
case "Vector2":
var vector2 = new Vector2();
vector2.X = result.Read<float>(index++);
vector2.Y = result.Read<float>(index++);
helper.SetValue(array, vector2, i);
break;
case "Vector3":
var vector3 = new Vector3();
vector3.X = result.Read<float>(index++);
vector3.Y = result.Read<float>(index++);
vector3.Z = result.Read<float>(index++);
helper.SetValue(array, vector3, i);
break;
case "LocalizedString":
LocalizedString locString = new LocalizedString();
locString[Global.WorldMgr.GetDefaultDbcLocale()] = result.Read<string>(index++);
helper.SetValue(array, locString, i);
break;
default:
Log.outError(LogFilter.ServerLoading, "Wrong Array Type: {0}", helper.FieldType.Name);
break;
}
break;
default:
Log.outError(LogFilter.ServerLoading, "Wrong Array Type: {0}", helper.FieldType.Name);
break;
}
case TypeCode.SByte:
f.SetValue(obj, ReadArray<sbyte>(result, dbIndex, array.Length));
break;
case TypeCode.Byte:
f.SetValue(obj, ReadArray<byte>(result, dbIndex, array.Length));
break;
case TypeCode.Int16:
f.SetValue(obj, ReadArray<short>(result, dbIndex, array.Length));
break;
case TypeCode.UInt16:
f.SetValue(obj, ReadArray<ushort>(result, dbIndex, array.Length));
break;
case TypeCode.Int32:
f.SetValue(obj, ReadArray<int>(result, dbIndex, array.Length));
break;
case TypeCode.UInt32:
f.SetValue(obj, ReadArray<uint>(result, dbIndex, array.Length));
break;
case TypeCode.Single:
f.SetValue(obj, ReadArray<float>(result, dbIndex, array.Length));
break;
case TypeCode.String:
f.SetValue(obj, ReadArray<string>(result, dbIndex, array.Length));
break;
case TypeCode.Object:
if (arrayElementType == typeof(Vector3))
f.SetValue(obj, new Vector3(ReadArray<float>(result, dbIndex, 3)));
break;
default:
Log.outError(LogFilter.ServerLoading, "Wrong Array Type: {0}", arrayElementType.Name);
break;
}
dbIndex += array.Length;
}
else
{
switch (Type.GetTypeCode(helper.FieldType))
if (type.IsEnum)
type = type.GetEnumUnderlyingType();
switch (Type.GetTypeCode(type))
{
case TypeCode.SByte:
helper.SetValue(obj, result.Read<sbyte>(index++));
f.SetValue(obj, result.Read<sbyte>(dbIndex++));
break;
case TypeCode.Byte:
helper.SetValue(obj, result.Read<byte>(index++));
f.SetValue(obj, result.Read<byte>(dbIndex++));
break;
case TypeCode.Int16:
helper.SetValue(obj, result.Read<short>(index++));
f.SetValue(obj, result.Read<short>(dbIndex++));
break;
case TypeCode.UInt16:
helper.SetValue(obj, result.Read<ushort>(index++));
f.SetValue(obj, result.Read<ushort>(dbIndex++));
break;
case TypeCode.Int32:
helper.SetValue(obj, result.Read<int>(index++));
f.SetValue(obj, result.Read<int>(dbIndex++));
break;
case TypeCode.UInt32:
helper.SetValue(obj, result.Read<uint>(index++));
f.SetValue(obj, result.Read<uint>(dbIndex++));
break;
case TypeCode.Single:
helper.SetValue(obj, result.Read<float>(index++));
f.SetValue(obj, result.Read<float>(dbIndex++));
break;
case TypeCode.String:
string str = result.Read<string>(index++);
helper.SetValue(obj, str);
string str = result.Read<string>(dbIndex++);
f.SetValue(obj, str);
break;
case TypeCode.Object:
switch (helper.FieldType.Name)
if (type == typeof(LocalizedString))
{
case "Vector2":
var vector2 = new Vector2();
vector2.X = result.Read<float>(index++);
vector2.Y = result.Read<float>(index++);
helper.SetValue(obj, vector2);
break;
case "Vector3":
var vector3 = new Vector3();
vector3.X = result.Read<float>(index++);
vector3.Y = result.Read<float>(index++);
vector3.Z = result.Read<float>(index++);
helper.SetValue(obj, vector3);
break;
case "LocalizedString":
LocalizedString locString = new LocalizedString();
locString[Global.WorldMgr.GetDefaultDbcLocale()] = result.Read<string>(index++);
helper.SetValue(obj, locString);
break;
default:
Log.outError(LogFilter.ServerLoading, "Wrong Array Type: {0}", helper.FieldType.Name);
break;
LocalizedString locString = new LocalizedString();
locString[Global.WorldMgr.GetDefaultDbcLocale()] = result.Read<string>(dbIndex++);
f.SetValue(obj, locString);
}
else if (type == typeof(Vector2))
{
f.SetValue(obj, new Vector2(ReadArray<float>(result, dbIndex, 2)));
dbIndex += 2;
}
else if (type == typeof(Vector3))
{
f.SetValue(obj, new Vector3(ReadArray<float>(result, dbIndex, 3)));
dbIndex += 3;
}
else if (type == typeof(FlagArray128))
{
f.SetValue(obj, new FlagArray128(ReadArray<uint>(result, dbIndex, 4)));
dbIndex += 4;
}
break;
default:
Log.outError(LogFilter.ServerLoading, "Wrong Array Type: {0}", helper.FieldType.Name);
Log.outError(LogFilter.ServerLoading, "Wrong Type: {0}", type.Name);
break;
}
}
}
base[idValue] = obj;
base[id] = obj;
}
while (result.NextRow());
}
@@ -202,19 +187,27 @@ namespace Game.DataStorage
if (obj == null)
continue;
for (var i = 0; i < helpers.Length; i++)
foreach (var f in typeof(T).GetFields())
{
var fieldInfo = helpers[i];
if (fieldInfo.FieldType != typeof(LocalizedString))
if (f.FieldType != typeof(LocalizedString))
continue;
LocalizedString locString = (LocalizedString)fieldInfo.Getter(obj);
LocalizedString locString = (LocalizedString)f.GetValue(obj);
locString[locale] = localeResult.Read<string>(index++);
}
} while (localeResult.NextRow());
}
}
TValue[] ReadArray<TValue>(SQLResult result, int dbIndex, int arrayLength)
{
TValue[] values = new TValue[arrayLength];
for (int i = 0; i < arrayLength; ++i)
values[i] = result.Read<TValue>(dbIndex + i);
return values;
}
public bool HasRecord(uint id)
{
return ContainsKey(id);
File diff suppressed because it is too large Load Diff
+4 -4
View File
@@ -164,11 +164,11 @@ namespace Game.DataStorage
foreach (GameObjectDisplayInfoRecord gameObjectDisplayInfo in CliDB.GameObjectDisplayInfoStorage.Values)
{
if (gameObjectDisplayInfo.GeoBoxMax.X < gameObjectDisplayInfo.GeoBoxMin.X)
Extensions.Swap(ref gameObjectDisplayInfo.GeoBoxMax.X, ref gameObjectDisplayInfo.GeoBoxMin.X);
Extensions.Swap(ref gameObjectDisplayInfo.GeoBox[3], ref gameObjectDisplayInfo.GeoBox[0]);
if (gameObjectDisplayInfo.GeoBoxMax.Y < gameObjectDisplayInfo.GeoBoxMin.Y)
Extensions.Swap(ref gameObjectDisplayInfo.GeoBoxMax.Y, ref gameObjectDisplayInfo.GeoBoxMin.Y);
Extensions.Swap(ref gameObjectDisplayInfo.GeoBox[4], ref gameObjectDisplayInfo.GeoBox[1]);
if (gameObjectDisplayInfo.GeoBoxMax.Z < gameObjectDisplayInfo.GeoBoxMin.Z)
Extensions.Swap(ref gameObjectDisplayInfo.GeoBoxMax.Z, ref gameObjectDisplayInfo.GeoBoxMin.Z);
Extensions.Swap(ref gameObjectDisplayInfo.GeoBox[5], ref gameObjectDisplayInfo.GeoBox[2]);
}
foreach (HeirloomRecord heirloom in CliDB.HeirloomStorage.Values)
@@ -1732,7 +1732,7 @@ namespace Game.DataStorage
UiMapAssignmentRecord FindNearestMapAssignment(float x, float y, float z, int mapId, int areaId, int wmoDoodadPlacementId, int wmoGroupId, UiMapSystem system)
{
UiMapAssignmentStatus nearestMapAssignment = null;
UiMapAssignmentStatus nearestMapAssignment = new UiMapAssignmentStatus();
var iterateUiMapAssignments = new Action<MultiMap<int, UiMapAssignmentRecord>, int>((assignments, id) =>
{
foreach (var assignment in assignments.LookupByKey(id))
+3 -3
View File
@@ -173,7 +173,7 @@ namespace Game.DataStorage
public ushort AltHandUICameraID;
public sbyte ForgeAttachmentOverride;
public byte Flags;
public byte ArtifactID;
public uint ArtifactID;
}
public sealed class ArtifactCategoryRecord
@@ -214,7 +214,7 @@ namespace Game.DataStorage
public uint SpellID;
public ushort ItemBonusListID;
public float AuraPointsOverride;
public ushort ArtifactPowerID;
public uint ArtifactPowerID;
}
public sealed class ArtifactQuestXPRecord
@@ -240,7 +240,7 @@ namespace Game.DataStorage
public byte PowerRank;
public ushort ItemBonusListID;
public uint PlayerConditionID;
public byte ArtifactID;
public uint ArtifactID;
}
public sealed class AuctionHouseRecord
+2 -2
View File
@@ -55,7 +55,7 @@ namespace Game.DataStorage
public uint Id;
public byte BattlePetStateID;
public ushort Value;
public byte BattlePetBreedID;
public uint BattlePetBreedID;
}
public sealed class BattlePetSpeciesRecord
@@ -78,7 +78,7 @@ namespace Game.DataStorage
public uint Id;
public byte BattlePetStateID;
public int Value;
public ushort BattlePetSpeciesID;
public uint BattlePetSpeciesID;
}
public sealed class BattlemasterListRecord
+2 -2
View File
@@ -68,7 +68,7 @@ namespace Game.DataStorage
public uint PetDisplayID; // Pet Model ID for starting pet
public byte PetFamilyID; // Pet Family Entry for starting pet
public int[] ItemID = new int[24];
public byte RaceID;
public uint RaceID;
}
public sealed class CharTitlesRecord
@@ -117,7 +117,7 @@ namespace Game.DataStorage
{
public uint Id;
public sbyte PowerType;
public byte ClassID;
public uint ClassID;
}
public sealed class ChrRacesRecord
+1 -1
View File
@@ -45,7 +45,7 @@ namespace Game.DataStorage
public byte ClassId;
public byte SexId;
public uint SoundId;
public ushort EmotesTextId;
public uint EmotesTextId;
}
public sealed class ExpectedStatRecord
+15 -5
View File
@@ -23,12 +23,22 @@ namespace Game.DataStorage
public sealed class GameObjectDisplayInfoRecord
{
public uint Id;
public Vector3 GeoBoxMin;
public Vector3 GeoBoxMax;
public float[] GeoBox = new float[6];
public int FileDataID;
public short ObjectEffectPackageID;
public float OverrideLootEffectScale;
public float OverrideNameScale;
public Vector3 GeoBoxMin
{
get { return new Vector3(GeoBox[0], GeoBox[1], GeoBox[2]); }
set { GeoBox[0] = value.X; GeoBox[1] = value.Y; GeoBox[2] = value.Z; }
}
public Vector3 GeoBoxMax
{
get { return new Vector3(GeoBox[3], GeoBox[4], GeoBox[5]); }
set { GeoBox[3] = value.X; GeoBox[4] = value.Y; GeoBox[5] = value.Z; }
}
}
public sealed class GameObjectsRecord
@@ -151,7 +161,7 @@ namespace Game.DataStorage
public byte OrderIndex;
public byte FactionIndex;
public ushort GarrAbilityID;
public ushort GarrFollowerID;
public uint GarrFollowerID;
}
public sealed class GarrPlotRecord
@@ -215,7 +225,7 @@ namespace Game.DataStorage
{
public uint Id;
public int SpellID;
public short GlyphPropertiesID;
public uint GlyphPropertiesID;
}
public sealed class GlyphPropertiesRecord
@@ -231,7 +241,7 @@ namespace Game.DataStorage
{
public uint Id;
public ushort ChrSpecializationID;
public ushort GlyphPropertiesID;
public uint GlyphPropertiesID;
}
public sealed class GuildColorBackgroundRecord
+5 -5
View File
@@ -119,7 +119,7 @@ namespace Game.DataStorage
public ushort ChildItemBonusTreeID;
public ushort ChildItemBonusListID;
public ushort ChildItemLevelSelectorID;
public ushort ParentItemBonusTreeID;
public uint ParentItemBonusTreeID;
}
public sealed class ItemChildEquipmentRecord
@@ -169,7 +169,7 @@ namespace Game.DataStorage
public ushort MaxLevel;
public ushort SkillRequired;
public sbyte ExpansionID;
public byte Class;
public uint Class;
}
public sealed class ItemEffectRecord
@@ -183,7 +183,7 @@ namespace Game.DataStorage
public ushort SpellCategoryID;
public int SpellID;
public ushort ChrSpecializationID;
public int ParentItemID;
public uint ParentItemID;
}
public sealed class ItemExtendedCostRecord
@@ -213,7 +213,7 @@ namespace Game.DataStorage
public uint Id;
public uint QualityItemBonusListID;
public sbyte Quality;
public short ParentILSQualitySetID;
public uint ParentILSQualitySetID;
}
public sealed class ItemLevelSelectorQualitySetRecord
@@ -306,7 +306,7 @@ namespace Game.DataStorage
public ushort ChrSpecID;
public uint SpellID;
public byte Threshold;
public ushort ItemSetID;
public uint ItemSetID;
}
public sealed class ItemSparseRecord
+1 -1
View File
@@ -103,7 +103,7 @@ namespace Game.DataStorage
public byte MaxPlayers;
public byte ItemContext;
public byte Flags;
public ushort MapID;
public uint MapID;
public uint GetRaidDuration()
{
+2 -2
View File
@@ -30,7 +30,7 @@ namespace Game.DataStorage
{
public uint Id;
public ushort PhaseId;
public ushort PhaseGroupID;
public uint PhaseGroupID;
}
public sealed class PlayerConditionRecord
@@ -163,7 +163,7 @@ namespace Game.DataStorage
public byte RangeIndex;
public byte MinLevel;
public byte MaxLevel;
public ushort MapID;
public uint MapID;
// helpers
public BattlegroundBracketId GetBracketId()
+1 -1
View File
@@ -441,7 +441,7 @@ namespace Game.DataStorage
public SpellProcsPerMinuteModType Type;
public ushort Param;
public float Coeff;
public ushort SpellProcsPerMinuteID;
public uint SpellProcsPerMinuteID;
}
public sealed class SpellRadiusRecord
+1 -1
View File
@@ -65,7 +65,7 @@ namespace Game.DataStorage
public uint Id;
public int PhaseID;
public int UiMapArtID;
public int UiMapID;
public uint UiMapID;
}
public sealed class UnitPowerBarRecord
@@ -82,13 +82,14 @@ namespace Game.Entities
public void EncodeDynamicFieldChangeType(DynamicFieldChangeType changeType, UpdateType updateType)
{
_updateType = updateType;
DynamicFieldChangeType = (uint)(_blockCount | ((uint)(changeType & Entities.DynamicFieldChangeType.ValueAndSizeChanged) * ((3 - (int)updateType /*this part evaluates to 0 if update type is not VALUES*/) / 3)));
}
public override void AppendToPacket(ByteBuffer data)
{
data.WriteUInt16(DynamicFieldChangeType);
if (DynamicFieldChangeType.HasAnyFlag((uint)Entities.DynamicFieldChangeType.ValueAndSizeChanged))
if (DynamicFieldChangeType.HasAnyFlag((uint)Entities.DynamicFieldChangeType.ValueAndSizeChanged) && _updateType == UpdateType.Values)
data.WriteUInt32(_fieldCount);
var maskArray = new byte[_blockCount << 2];
@@ -98,6 +99,7 @@ namespace Game.Entities
}
public uint DynamicFieldChangeType;
public UpdateType _updateType;
}
public enum DynamicFieldChangeType
+2 -2
View File
@@ -155,8 +155,8 @@ namespace Game.Entities
{
flags.ThisIsYou = true;
flags.ActivePlayer = true;
tempObjectType = TypeId.Player;
tempObjectTypeMask |= TypeMask.Player;
tempObjectType = TypeId.ActivePlayer;
tempObjectTypeMask |= TypeMask.ActivePlayer;
}
switch (GetGUID().GetHigh())
+3 -3
View File
@@ -2424,9 +2424,9 @@ namespace Game.Entities
SetMoney(money);
Array<byte> customDisplay = new Array<byte>(PlayerConst.CustomDisplaySize);
customDisplay.Add(result.Read<byte>(14));
customDisplay.Add(result.Read<byte>(15));
customDisplay.Add(result.Read<byte>(16));
customDisplay[0] = result.Read<byte>(14);
customDisplay[1] = result.Read<byte>(15);
customDisplay[2] = result.Read<byte>(16);
SetByteValue(PlayerFields.Bytes, PlayerFieldOffsets.BytesOffsetSkinId, result.Read<byte>(9));
SetByteValue(PlayerFields.Bytes, PlayerFieldOffsets.BytesOffsetFaceId, result.Read<byte>(10));
+1 -1
View File
@@ -320,7 +320,7 @@ namespace Game.Entities
for (byte i = 0; i < PlayerConst.MaxSpecializations; ++i)
{
Talents[i] = new Dictionary<uint, PlayerSpellState>();
PvpTalents[i] = new Array<uint>(PlayerConst.MaxPvpTalentSlots);
PvpTalents[i] = new Array<uint>(PlayerConst.MaxPvpTalentSlots, 0);
Glyphs[i] = new List<uint>();
}
}
+1 -1
View File
@@ -35,7 +35,7 @@ namespace Game.Entities
public void Initialize()
{
if (m_graph.NumberOfVertices > 0)
if (m_graph != null)
return;
List<Tuple<Tuple<uint, uint>, uint>> edges = new List<Tuple<Tuple<uint, uint>, uint>>();
+2 -1
View File
@@ -1564,7 +1564,8 @@ namespace Game.Entities
MoveTeleport moveTeleport = new MoveTeleport();
moveTeleport.MoverGUID = GetGUID();
moveTeleport.Pos = new Position(x, y, z, o);
moveTeleport.TransportGUID.Set(GetTransGUID());
if (GetTransGUID() != ObjectGuid.Empty)
moveTeleport.TransportGUID.Set(GetTransGUID());
moveTeleport.Facing = o;
moveTeleport.SequenceIndex = m_movementCounter++;
playerMover.SendPacket(moveTeleport);
+5
View File
@@ -4,8 +4,13 @@
<TargetFramework>netstandard2.0</TargetFramework>
<Platforms>x64</Platforms>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>7.3</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.5.2" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Framework\Framework.csproj" />
</ItemGroup>
+2 -2
View File
@@ -3680,8 +3680,8 @@ namespace Game
"Data0, Data1, Data2, Data3, Data4, Data5, Data6, Data7, Data8, Data9, Data10, Data11, Data12, " +
//21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
"Data13, Data14, Data15, Data16, Data17, Data18, Data19, Data20, Data21, Data22, Data23, Data24, Data25, Data26, Data27, Data28, " +
//37 38 39 40 41 42 44 44
"Data29, Data30, Data31, Data32 Data33, RequiredLevel, AIName, ScriptName FROM gameobject_template");
//37 38 39 40 41 42 44 44
"Data29, Data30, Data31, Data32, Data33, RequiredLevel, AIName, ScriptName FROM gameobject_template");
if (result.IsEmpty())
{
@@ -36,7 +36,7 @@ namespace Game.Network.Packets
ArtifactPowerChoice artifactPowerChoice;
artifactPowerChoice.ArtifactPowerID = _worldPacket.ReadUInt32();
artifactPowerChoice.Rank = _worldPacket.ReadUInt8();
PowerChoices.Add(artifactPowerChoice);
PowerChoices[i] = artifactPowerChoice;
}
}
@@ -102,7 +102,7 @@ namespace Game.Network.Packets
AuctionItemForSale item;
item.Guid = _worldPacket.ReadPackedGuid();
item.UseCount = _worldPacket.ReadUInt32();
Items.Add(item);
Items[i] = item;
}
}
@@ -304,9 +304,9 @@ namespace Game.Network.Packets
ClassFilter.SubClassFilter subClassFilter;
subClassFilter.ItemSubclass = _worldPacket.ReadInt32();
subClassFilter.InvTypeMask = _worldPacket.ReadUInt32();
classFilter.SubClassFilters.Add(subClassFilter);
classFilter.SubClassFilters[x] = subClassFilter;
}
ClassFilters.Add(classFilter);
ClassFilters[i] = classFilter;
}
_worldPacket.Skip(4); // DataSize = (SortCount * 2)
@@ -83,7 +83,7 @@ namespace Game.Network.Packets
RealmID = _worldPacket.ReadUInt32();
for (var i = 0; i < LocalChallenge.GetLimit(); ++i)
LocalChallenge.Add(_worldPacket.ReadUInt8());
LocalChallenge[i] = _worldPacket.ReadUInt8();
Digest = _worldPacket.ReadBytes(24);
@@ -106,7 +106,8 @@ namespace Game.Network.Packets
public override void Read()
{
Token = _worldPacket.ReadUInt32();
Secret.AddRange(_worldPacket.ReadBytes((uint)Secret.Capacity));
for (var i = 0; i < Secret.GetLimit(); ++i)
Secret[i] = _worldPacket.ReadUInt8();
}
public uint Token;
@@ -182,6 +182,7 @@ namespace Game.Network.Packets
public void Write(WorldPacket data)
{
data.WritePackedGuid(Guid);
data.WriteUInt64(GuildClubMemberID);
data.WriteUInt8(ListPosition);
data.WriteUInt8(RaceId);
data.WriteUInt8(ClassId);
@@ -228,6 +229,7 @@ namespace Game.Network.Packets
}
public ObjectGuid Guid;
public ulong GuildClubMemberID; // same as bgs.protocol.club.v1.MemberId.unique_id, guessed basing on SMSG_QUERY_PLAYER_NAME_RESPONSE (that one is known)
public string Name;
public byte ListPosition; // Order of the characters in list
public byte RaceId;
@@ -320,7 +322,7 @@ namespace Game.Network.Packets
CreateInfo.OutfitId = _worldPacket.ReadUInt8();
for (var i = 0; i < CreateInfo.CustomDisplay.GetLimit(); ++i)
CreateInfo.CustomDisplay.Add(_worldPacket.ReadUInt8());
CreateInfo.CustomDisplay[i] = _worldPacket.ReadUInt8();
CreateInfo.Name = _worldPacket.ReadString(nameLength);
if (CreateInfo.TemplateSet.HasValue)
@@ -423,7 +425,7 @@ namespace Game.Network.Packets
CustomizeInfo.FaceID = _worldPacket.ReadUInt8();
for (var i = 0; i < CustomizeInfo.CustomDisplay.GetLimit(); ++i)
CustomizeInfo.CustomDisplay.Add(_worldPacket.ReadUInt8());
CustomizeInfo.CustomDisplay[i] = _worldPacket.ReadUInt8();
CustomizeInfo.CharName = _worldPacket.ReadString(_worldPacket.ReadBits<uint>(6));
}
@@ -456,7 +458,7 @@ namespace Game.Network.Packets
RaceOrFactionChangeInfo.FaceID = _worldPacket.ReadUInt8();
for (var i = 0; i < RaceOrFactionChangeInfo.CustomDisplay.GetLimit(); ++i)
RaceOrFactionChangeInfo.CustomDisplay.Add(_worldPacket.ReadUInt8());
RaceOrFactionChangeInfo.CustomDisplay[i] = _worldPacket.ReadUInt8();
RaceOrFactionChangeInfo.Name = _worldPacket.ReadString(nameLength);
}
@@ -809,7 +811,7 @@ namespace Game.Network.Packets
NewFace = _worldPacket.ReadUInt32();
for (var i = 0; i < NewCustomDisplay.GetLimit(); ++i)
NewCustomDisplay.Add(_worldPacket.ReadUInt32());
NewCustomDisplay[i] = _worldPacket.ReadUInt32();
}
public uint NewHairStyle;
@@ -93,12 +93,12 @@ namespace Game.Network.Packets
for (byte i = 0; i < EquipmentSlot.End; ++i)
{
Set.Pieces.Add(_worldPacket.ReadPackedGuid());
Set.Appearances.Add(_worldPacket.ReadInt32());
Set.Pieces[i] = _worldPacket.ReadPackedGuid();
Set.Appearances[i] = _worldPacket.ReadInt32();
}
Set.Enchants.Add(_worldPacket.ReadInt32());
Set.Enchants.Add(_worldPacket.ReadInt32());
Set.Enchants[0] = _worldPacket.ReadInt32();
Set.Enchants[1] = _worldPacket.ReadInt32();
bool hasSpecIndex = _worldPacket.HasBit();
+12 -7
View File
@@ -204,12 +204,13 @@ namespace Game.Network.Packets
data.WriteFloat(1.0f); // DurationModifier
data.WriteFloat(1.0f); // NextDurationModifier
data.WriteBits((byte)moveSpline.facing.type, 2); // Face
bool HasJumpGravity = data.WriteBit(moveSpline.splineflags.hasFlag(SplineFlag.Parabolic | SplineFlag.Animation)); // HasJumpGravity
bool HasSpecialTime = data.WriteBit(moveSpline.splineflags.hasFlag(SplineFlag.Parabolic) && moveSpline.effect_start_time < moveSpline.Duration()); // HasSpecialTime
bool hasFadeObjectTime = data.WriteBit(moveSpline.splineflags.hasFlag(SplineFlag.FadeObject) && moveSpline.effect_start_time < moveSpline.Duration());
data.WriteBits(moveSpline.getPath().Length, 16);
data.WriteBits((byte)moveSpline.spline.m_mode, 2); // Mode
data.WriteBit(0); // HasSplineFilter
data.WriteBit(moveSpline.spell_effect_extra.HasValue); // HasSpellEffectExtraData
data.WriteBit(moveSpline.splineflags.hasFlag(SplineFlag.Parabolic)); // HasJumpExtraData
data.FlushBits();
//if (HasSplineFilterKey)
//{
@@ -237,11 +238,8 @@ namespace Game.Network.Packets
break;
}
if (HasJumpGravity)
data.WriteFloat(moveSpline.vertical_acceleration); // JumpGravity
if (HasSpecialTime)
data.WriteUInt32(moveSpline.effect_start_time); // SpecialTime
if (hasFadeObjectTime)
data.WriteUInt32(moveSpline.effect_start_time); // FadeObjectTime
foreach (var vec in moveSpline.getPath())
data.WriteVector3(vec);
@@ -253,6 +251,13 @@ namespace Game.Network.Packets
data.WriteUInt32(moveSpline.spell_effect_extra.Value.ProgressCurveId);
data.WriteUInt32(moveSpline.spell_effect_extra.Value.ParabolicCurveId);
}
if (moveSpline.splineflags.hasFlag(SplineFlag.Parabolic))
{
data.WriteFloat(moveSpline.vertical_acceleration);
data.WriteUInt32(moveSpline.effect_start_time);
data.WriteUInt32(0); // Duration (override)
}
}
}
+1 -3
View File
@@ -111,8 +111,6 @@ namespace Game.Network.Packets
for (var i = 0; i < SharedConst.MaxCreatureKillCredit; ++i)
_worldPacket.WriteUInt32(Stats.ProxyCreatureID[i]);
_worldPacket.WriteUInt32(Stats.Display.CreatureDisplay.Count);
_worldPacket.WriteFloat(Stats.Display.TotalProbability);
_worldPacket.WriteUInt32(Stats.Display.CreatureDisplay.Count);
_worldPacket.WriteFloat(Stats.Display.TotalProbability);
@@ -760,7 +758,7 @@ namespace Game.Network.Packets
public string UnkString;
public uint Type;
public uint DisplayID;
public int[] Data = new int[33];
public int[] Data = new int[SharedConst.MaxGOData];
public float Size;
public List<uint> QuestItems = new List<uint>();
public uint RequiredLevel;
@@ -119,7 +119,7 @@ namespace Game.Network.Packets
{
var count = _worldPacket.ReadUInt32();
for (var i = 0; i < count; ++i)
MissingScenarioPOIs.Add(_worldPacket.ReadInt32());
MissingScenarioPOIs[i] = _worldPacket.ReadInt32();
}
public Array<int> MissingScenarioPOIs = new Array<int>(35);
@@ -79,6 +79,7 @@ namespace Game.Network.Packets
_worldPacket.WriteBit(ClubsCharacterClubTypeAllowed);
_worldPacket.WriteBit(VoiceChatDisabledByParentalControl);
_worldPacket.WriteBit(VoiceChatMutedByParentalControl);
_worldPacket.FlushBits();
{
_worldPacket.WriteBit(QuickJoinConfig.ToastsDisabled);
+2 -3
View File
@@ -71,9 +71,8 @@ namespace Game.Network.Packets
public override void Read()
{
uint count = _worldPacket.ReadBits<uint>(6);
for (uint i = 0; i < count; ++i)
Talents.Add(_worldPacket.ReadUInt16());
for (int i = 0; i < count; ++i)
Talents[i] = _worldPacket.ReadUInt16();
}
public Array<ushort> Talents = new Array<ushort>(PlayerConst.MaxTalentTiers);
@@ -34,7 +34,7 @@ namespace Game.Network.Packets
{
TransmogrifyItem item = new TransmogrifyItem();
item.Read(_worldPacket);
Items.Add(item);
Items[i] = item;
}
CurrentSpecOnly = _worldPacket.HasBit();
+4 -3
View File
@@ -6,6 +6,7 @@ Special Thanks To:
For the base code, and tons of help and ideas.
- TrinityCore (http://www.trinitycore.org)
For code and DB. As CypherCore is a full port of them.
We still add commits from them to keep CypherCore updated.
Much of CpherCore is from them, and we give them alots of thanks.
For code and DB and updates.
- Wow-Tools (https://github.com/WoW-Tools)
For CASC Ideas and ClientDB loading code.
@@ -14235,7 +14235,7 @@ UPDATE `creature_model_info` SET `BoundingRadius`=0.2700765 WHERE `DisplayID`=32
UPDATE `creature_model_info` SET `BoundingRadius`=5.458125 WHERE `DisplayID`=36753;
UPDATE `creature_model_info` SET `BoundingRadius`=0.3828198 WHERE `DisplayID`=1141;
DELETE FROM `creature_equip_template` WHERE (`CreatureID`=68 AND `ID`=2) OR (`CreatureID`=45798 AND `ID`=3) OR (`CreatureID`=1976 AND `ID`=2) OR (`CreatureID`=1976 AND `ID`=3) OR (`CreatureID`=45798 AND `ID`=2) OR (`CreatureID`=45798 AND `ID`=1) OR (`CreatureID`=50602 AND `ID`=2) OR (`CreatureID`=49361 AND `ID`=1) OR (`CreatureID`=49364 AND `ID`=1) OR (`CreatureID`=48176 AND `ID`=1) OR (`CreatureID`=45334 AND `ID`=2) OR (`CreatureID`=47168 AND `ID`=2) OR (`CreatureID`=47168 AND `ID`=1) OR (`CreatureID`=46922 AND `ID`=1) OR (`CreatureID`=95928 AND `ID`=1) OR (`CreatureID`=46807 AND `ID`=1) OR (`CreatureID`=42775 AND `ID`=3) OR (`CreatureID`=42775 AND `ID`=2) OR (`CreatureID`=42775 AND `ID`=1) OR (`CreatureID`=61841 AND `ID`=1) OR (`CreatureID`=54218 AND `ID`=1) OR (`CreatureID`=54216 AND `ID`=1) OR (`CreatureID`=54217 AND `ID`=1) OR (`CreatureID`=61838 AND `ID`=1) OR (`CreatureID`=61836 AND `ID`=1) OR (`CreatureID`=61834 AND `ID`=1) OR (`CreatureID`=112912 AND `ID`=1) OR (`CreatureID`=68980 AND `ID`=1) OR (`CreatureID`=114246 AND `ID`=1) OR (`CreatureID`=113211 AND `ID`=1) OR (`CreatureID`=29016 AND `ID`=3) OR (`CreatureID`=24927 AND `ID`=1) OR (`CreatureID`=52809 AND `ID`=1) OR (`CreatureID`=51307 AND `ID`=1) OR (`CreatureID`=3296 AND `ID`=3);
DELETE FROM `creature_equip_template` WHERE (`CreatureID`=68 AND `ID`=2) OR (`CreatureID`=45798 AND `ID`=3) OR (`CreatureID`=1976 AND `ID`=2) OR (`CreatureID`=1976 AND `ID`=3) OR (`CreatureID`=45798 AND `ID`=2) OR (`CreatureID`=45798 AND `ID`=1) OR (`CreatureID`=50602 AND `ID`=2) OR (`CreatureID`=49361 AND `ID`=1) OR (`CreatureID`=49364 AND `ID`=1) OR (`CreatureID`=48176 AND `ID`=1) OR (`CreatureID`=45334 AND `ID`=2) OR (`CreatureID`=47168 AND `ID`=2) OR (`CreatureID`=47168 AND `ID`=1) OR (`CreatureID`=46922 AND `ID`=1) OR (`CreatureID`=95928 AND `ID`=1) OR (`CreatureID`=46807 AND `ID`=1) OR (`CreatureID`=42775 AND `ID`=3) OR (`CreatureID`=42775 AND `ID`=2) OR (`CreatureID`=42775 AND `ID`=1) OR (`CreatureID`=61841 AND `ID`=1) OR (`CreatureID`=54218 AND `ID`=1) OR (`CreatureID`=54216 AND `ID`=1) OR (`CreatureID`=54217 AND `ID`=1) OR (`CreatureID`=61838 AND `ID`=1) OR (`CreatureID`=61836 AND `ID`=1) OR (`CreatureID`=61834 AND `ID`=1) OR (`CreatureID`=112912 AND `ID`=1) OR (`CreatureID`=68980 AND `ID`=1) OR (`CreatureID`=114246 AND `ID`=1) OR (`CreatureID`=113211 AND `ID`=1) OR (`CreatureID`=29016 AND `ID`=3) OR (`CreatureID`=24927 AND `ID`=1) OR (`CreatureID`=52809 AND `ID`=1) OR (`CreatureID`=51307 AND `ID`=1) OR (`CreatureID`=3296 AND `ID`=3);;
INSERT INTO `creature_equip_template` (`CreatureID`, `ID`, `ItemID1`, `ItemID2`, `ItemID3`) VALUES
(45798, 3, 31604, 0, 0), -- Crushblow Warrior
(45798, 2, 31601, 0, 0), -- Crushblow Warrior