From 14a31e0014cf0553b4a6b751564d09c539d642e1 Mon Sep 17 00:00:00 2001 From: killerwife Date: Sat, 8 Jun 2024 13:51:24 +0200 Subject: [PATCH 1/5] Add support for 65th sql flag --- WowPacketParser/Misc/Extensions.cs | 18 ++++++++++++++++++ WowPacketParser/Misc/Settings.cs | 8 ++++---- WowPacketParser/Store/StoreDictionaries.cs | 2 +- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/WowPacketParser/Misc/Extensions.cs b/WowPacketParser/Misc/Extensions.cs index 66d5421a93..e8c82fc5df 100644 --- a/WowPacketParser/Misc/Extensions.cs +++ b/WowPacketParser/Misc/Extensions.cs @@ -56,6 +56,24 @@ public static bool HasAnyFlagBit(this IConvertible value, IConvertible bit) return (uThis & uFlag) != 0; } + /// + /// Returns true if bit is set in value (&) + /// + /// An enum, int, ... + /// An int + /// A boolean + public static bool HasAnyFlagBit(this UInt128 value, IConvertible bit) // uint128 doesnt implement IConvertible + { + var uBit = bit.ToInt32(null); + + Contract.Assert(uBit >= 0 && uBit <= 127); + + var uFlag = ((UInt128)1) << uBit; + var uThis = value; + + return (uThis & uFlag) != 0; + } + /// /// Return true if our string is a substring of any filter (case insensitive) /// diff --git a/WowPacketParser/Misc/Settings.cs b/WowPacketParser/Misc/Settings.cs index cc1ec55737..38640f8539 100644 --- a/WowPacketParser/Misc/Settings.cs +++ b/WowPacketParser/Misc/Settings.cs @@ -19,7 +19,7 @@ public static class Settings public static readonly TargetedDatabase TargetedDatabase = Conf.GetEnum("TargetedDatabase", TargetedDatabase.WrathOfTheLichKing); public static readonly TargetedProject TargetedProject = Conf.GetEnum("TargetedProject", TargetedProject.TrinityCore); public static readonly DumpFormatType DumpFormat = Conf.GetEnum("DumpFormat", DumpFormatType.Text); - public static readonly ulong SQLOutputFlag = GetSQLOutputFlag(); + public static readonly UInt128 SQLOutputFlag = GetSQLOutputFlag(); public static readonly bool SQLOrderByKey = Conf.GetBoolean("SqlOrderByKey", false); public static readonly bool SaveTempSpawns = Conf.GetBoolean("SaveTempSpawns", false); public static readonly bool SaveExistingSpawns = Conf.GetBoolean("SaveExistingSpawns", false); @@ -68,17 +68,17 @@ public static class Settings public static readonly bool UseDBC = Conf.GetBoolean("UseDBC", false); public static readonly bool ParseSpellInfos = Conf.GetBoolean("ParseSpellInfos", false); - private static ulong GetSQLOutputFlag() + private static UInt128 GetSQLOutputFlag() { var names = Enum.GetNames(typeof(SQLOutput)); var values = Enum.GetValues(typeof(SQLOutput)); - var result = 0ul; + UInt128 result = 0; for (var i = 0; i < names.Length; ++i) { if (Conf.GetBoolean(names[i], false)) - result += (1ul << (int)values.GetValue(i)); + result += (((UInt128)1) << (int)values.GetValue(i)); } return result; diff --git a/WowPacketParser/Store/StoreDictionaries.cs b/WowPacketParser/Store/StoreDictionaries.cs index e76d0f519d..f8650f5948 100644 --- a/WowPacketParser/Store/StoreDictionaries.cs +++ b/WowPacketParser/Store/StoreDictionaries.cs @@ -12,7 +12,7 @@ namespace WowPacketParser.Store { public abstract class Store { - public static ulong SQLEnabledFlags { protected get; set; } + public static UInt128 SQLEnabledFlags { protected get; set; } public List Types { get; protected set; } protected bool ProcessFlags() From bfd0ff8446480e3211f60812d8b15d73dee217bf Mon Sep 17 00:00:00 2001 From: killerwife Date: Sat, 8 Jun 2024 13:51:33 +0200 Subject: [PATCH 2/5] Implement waypoint sql generation --- WowPacketParser/App.config | 11 +- WowPacketParser/Enums/SQLOutput.cs | 1 + WowPacketParser/Misc/Settings.cs | 1 + WowPacketParser/SQL/Builders/Movement.cs | 118 ++++++++++++++++++ .../Objects/Movement/CreatureMovement.cs | 16 +++ .../Objects/Movement/CreatureMovementFlags.cs | 12 ++ .../Objects/Movement/CreatureMovementNode.cs | 10 ++ WowPacketParser/Store/Storage.cs | 4 + .../Parsers/UpdateHandler.cs | 46 ++++++- .../Parsers/MovementHandler.cs | 56 ++++++++- .../Parsers/MovementHandler.cs | 72 +++++++++-- 11 files changed, 332 insertions(+), 15 deletions(-) create mode 100644 WowPacketParser/SQL/Builders/Movement.cs create mode 100644 WowPacketParser/Store/Objects/Movement/CreatureMovement.cs create mode 100644 WowPacketParser/Store/Objects/Movement/CreatureMovementFlags.cs create mode 100644 WowPacketParser/Store/Objects/Movement/CreatureMovementNode.cs diff --git a/WowPacketParser/App.config b/WowPacketParser/App.config index 99a20f2315..484c562c73 100644 --- a/WowPacketParser/App.config +++ b/WowPacketParser/App.config @@ -202,6 +202,8 @@ + + + + + - +