From 5a0c00d9f9f8c0dfa3d732660edb8d4bf601cc4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartosz=20Korczy=C5=84ski?= Date: Mon, 4 Jul 2022 17:00:20 +0200 Subject: [PATCH] [Packet parser] Updated parser --- LoaderAvalonia/LoaderAvalonia.csproj | 2 +- .../AvaloniaRenderingTester.csproj | 2 +- .../RenderingTester/RenderingTester.csproj | 2 +- .../CommonModels/MySqlCreatureAddon.cs | 82 +++++++++++++++++-- .../Database/AzerothhMySqlDatabaseProvider.cs | 24 ++++++ .../BaseTrinityMySqlDatabaseProvider.cs | 28 ++----- .../TrinityCataMySqlDatabaseProvider.cs | 24 ++++++ .../TrinityMasterMySqlDatabaseProvider.cs | 25 ++++++ .../TrinityWrathMySqlDatabaseProvider.cs | 25 ++++++ .../Models/Databases/AzerothDatabase.cs | 2 + .../Models/Databases/BaseTrinityDatabase.cs | 2 - .../Models/Databases/TrinityCataDatabase.cs | 2 + .../Models/Databases/TrinityMasterDatabase.cs | 2 + .../Models/Databases/TrinityWrathDatabase.cs | 2 + WoWPacketParser | 2 +- 15 files changed, 191 insertions(+), 35 deletions(-) diff --git a/LoaderAvalonia/LoaderAvalonia.csproj b/LoaderAvalonia/LoaderAvalonia.csproj index 54e3f7651..ee2bb94d2 100644 --- a/LoaderAvalonia/LoaderAvalonia.csproj +++ b/LoaderAvalonia/LoaderAvalonia.csproj @@ -13,7 +13,7 @@ - + diff --git a/Rendering/AvaloniaRenderingTester/AvaloniaRenderingTester.csproj b/Rendering/AvaloniaRenderingTester/AvaloniaRenderingTester.csproj index c388975bf..d27baf7c4 100644 --- a/Rendering/AvaloniaRenderingTester/AvaloniaRenderingTester.csproj +++ b/Rendering/AvaloniaRenderingTester/AvaloniaRenderingTester.csproj @@ -7,7 +7,7 @@ - + diff --git a/Rendering/RenderingTester/RenderingTester.csproj b/Rendering/RenderingTester/RenderingTester.csproj index a09fbfe27..fc9e8a578 100644 --- a/Rendering/RenderingTester/RenderingTester.csproj +++ b/Rendering/RenderingTester/RenderingTester.csproj @@ -7,7 +7,7 @@ enable - + diff --git a/WDE.MySqlDatabaseCommon/CommonModels/MySqlCreatureAddon.cs b/WDE.MySqlDatabaseCommon/CommonModels/MySqlCreatureAddon.cs index 164215fae..618047e14 100644 --- a/WDE.MySqlDatabaseCommon/CommonModels/MySqlCreatureAddon.cs +++ b/WDE.MySqlDatabaseCommon/CommonModels/MySqlCreatureAddon.cs @@ -3,17 +3,15 @@ namespace WDE.MySqlDatabaseCommon.CommonModels; -public class MySqlBaseCreatureAddon : IBaseCreatureAddon +public abstract class MySqlBaseCreatureAddon : IBaseCreatureAddon { - [Column(Name = "path_id")] - public uint PathId { get; set; } + public abstract uint PathId { get; set; } [Column(Name = "mount")] public uint Mount { get; set; } - - [Column(Name = "MountCreatureID")] - public uint MountCreatureId { get; set; } - + + public abstract uint MountCreatureId { get; set; } + [Column(Name = "bytes1")] public uint Bytes1 { get; set; } @@ -41,6 +39,12 @@ public class MySqlCreatureAddon : MySqlBaseCreatureAddon, ICreatureAddon [Identity] [Column(Name = "guid")] public uint Guid { get; set; } + + [Column(Name = "path_id")] + public override uint PathId { get; set; } + + [Column(Name = "MountCreatureID")] + public override uint MountCreatureId { get; set; } } [Table(Name = "creature_template_addon")] @@ -50,4 +54,68 @@ public class MySqlCreatureTemplateAddon : MySqlBaseCreatureAddon, ICreatureTempl [Identity] [Column(Name = "entry")] public uint Entry { get; set; } + + [Column(Name = "path_id")] + public override uint PathId { get; set; } + + [Column(Name = "MountCreatureID")] + public override uint MountCreatureId { get; set; } +} + + +[Table(Name = "creature_addon")] +public class MySqlCreatureAddonCata : MySqlBaseCreatureAddon, ICreatureAddon +{ + [PrimaryKey] + [Identity] + [Column(Name = "guid")] + public uint Guid { get; set; } + + [Column(Name = "waypointPathId")] + public override uint PathId { get; set; } + + public override uint MountCreatureId { get; set; } +} + +[Table(Name = "creature_template_addon")] +public class MySqlCreatureTemplateAddonCata : MySqlBaseCreatureAddon, ICreatureTemplateAddon +{ + [PrimaryKey] + [Identity] + [Column(Name = "entry")] + public uint Entry { get; set; } + + [Column(Name = "waypointPathId")] + public override uint PathId { get; set; } + + public override uint MountCreatureId { get; set; } +} + + +[Table(Name = "creature_addon")] +public class MySqlCreatureAddonAC: MySqlBaseCreatureAddon, ICreatureAddon +{ + [PrimaryKey] + [Identity] + [Column(Name = "guid")] + public uint Guid { get; set; } + + [Column(Name = "path_id")] + public override uint PathId { get; set; } + + public override uint MountCreatureId { get; set; } +} + +[Table(Name = "creature_template_addon")] +public class MySqlCreatureTemplateAddonAC : MySqlBaseCreatureAddon, ICreatureTemplateAddon +{ + [PrimaryKey] + [Identity] + [Column(Name = "entry")] + public uint Entry { get; set; } + + [Column(Name = "path_id")] + public override uint PathId { get; set; } + + public override uint MountCreatureId { get; set; } } \ No newline at end of file diff --git a/WoWDatabaseEditor.Common/WDE.TrinityMySqlDatabase/Database/AzerothhMySqlDatabaseProvider.cs b/WoWDatabaseEditor.Common/WDE.TrinityMySqlDatabase/Database/AzerothhMySqlDatabaseProvider.cs index 13a91d827..a20ec0ad4 100644 --- a/WoWDatabaseEditor.Common/WDE.TrinityMySqlDatabase/Database/AzerothhMySqlDatabaseProvider.cs +++ b/WoWDatabaseEditor.Common/WDE.TrinityMySqlDatabase/Database/AzerothhMySqlDatabaseProvider.cs @@ -202,4 +202,28 @@ public override async Task> GetCreatureModelInfoAsync( await using var model = Database(); return await model.Creature.FirstOrDefaultAsync(x => x.Guid == guid); } + + public override async Task> GetCreatureAddons() + { + await using var model = Database(); + return await model.CreatureAddon.ToListAsync(); + } + + public override async Task> GetCreatureTemplateAddons() + { + await using var model = Database(); + return await model.CreatureTemplateAddon.ToListAsync(); + } + + public override async Task GetCreatureAddon(uint guid) + { + await using var model = Database(); + return await model.CreatureAddon.FirstOrDefaultAsync(x => x.Guid == guid); + } + + public override async Task GetCreatureTemplateAddon(uint entry) + { + await using var model = Database(); + return await model.CreatureTemplateAddon.FirstOrDefaultAsync(x => x.Entry == entry); + } } \ No newline at end of file diff --git a/WoWDatabaseEditor.Common/WDE.TrinityMySqlDatabase/Database/BaseTrinityMySqlDatabaseProvider.cs b/WoWDatabaseEditor.Common/WDE.TrinityMySqlDatabase/Database/BaseTrinityMySqlDatabaseProvider.cs index e036d7111..0ee00576f 100644 --- a/WoWDatabaseEditor.Common/WDE.TrinityMySqlDatabase/Database/BaseTrinityMySqlDatabaseProvider.cs +++ b/WoWDatabaseEditor.Common/WDE.TrinityMySqlDatabase/Database/BaseTrinityMySqlDatabaseProvider.cs @@ -598,17 +598,13 @@ public async Task> GetEventScript(EventScriptType type, u return await model.SceneTemplates.ToListAsync(); } - public async Task> GetCreatureAddons() - { - await using var model = Database(); - return await model.CreatureAddon.ToListAsync(); - } + public abstract Task> GetCreatureAddons(); - public async Task> GetCreatureTemplateAddons() - { - await using var model = Database(); - return await model.CreatureTemplateAddon.ToListAsync(); - } + public abstract Task> GetCreatureTemplateAddons(); + + public abstract Task GetCreatureAddon(uint guid); + + public abstract Task GetCreatureTemplateAddon(uint entry); public async Task?> GetCreatureEquipmentTemplates() { @@ -652,18 +648,6 @@ public async Task> GetGameEventGameObjectsAsync() public abstract Task GetCreaturesByGuidAsync(uint guid); - public async Task GetCreatureAddon(uint guid) - { - await using var model = Database(); - return await model.CreatureAddon.FirstOrDefaultAsync(x => x.Guid == guid); - } - - public async Task GetCreatureTemplateAddon(uint entry) - { - await using var model = Database(); - return await model.CreatureTemplateAddon.FirstOrDefaultAsync(x => x.Entry == entry); - } - public async Task> GetRbacPermissionsAsync() { if (!Supports()) diff --git a/WoWDatabaseEditor.Common/WDE.TrinityMySqlDatabase/Database/TrinityCataMySqlDatabaseProvider.cs b/WoWDatabaseEditor.Common/WDE.TrinityMySqlDatabase/Database/TrinityCataMySqlDatabaseProvider.cs index eb1c26e91..f1853a37a 100644 --- a/WoWDatabaseEditor.Common/WDE.TrinityMySqlDatabase/Database/TrinityCataMySqlDatabaseProvider.cs +++ b/WoWDatabaseEditor.Common/WDE.TrinityMySqlDatabase/Database/TrinityCataMySqlDatabaseProvider.cs @@ -238,4 +238,28 @@ public override async Task> GetCreatureModelInfoAsync( await using var model = Database(); return await model.Creature.FirstOrDefaultAsync(x => x.Guid == guid); } + + public override async Task> GetCreatureAddons() + { + await using var model = Database(); + return await model.CreatureAddon.ToListAsync(); + } + + public override async Task> GetCreatureTemplateAddons() + { + await using var model = Database(); + return await model.CreatureTemplateAddon.ToListAsync(); + } + + public override async Task GetCreatureAddon(uint guid) + { + await using var model = Database(); + return await model.CreatureAddon.FirstOrDefaultAsync(x => x.Guid == guid); + } + + public override async Task GetCreatureTemplateAddon(uint entry) + { + await using var model = Database(); + return await model.CreatureTemplateAddon.FirstOrDefaultAsync(x => x.Entry == entry); + } } \ No newline at end of file diff --git a/WoWDatabaseEditor.Common/WDE.TrinityMySqlDatabase/Database/TrinityMasterMySqlDatabaseProvider.cs b/WoWDatabaseEditor.Common/WDE.TrinityMySqlDatabase/Database/TrinityMasterMySqlDatabaseProvider.cs index a51f46430..be43133a6 100644 --- a/WoWDatabaseEditor.Common/WDE.TrinityMySqlDatabase/Database/TrinityMasterMySqlDatabaseProvider.cs +++ b/WoWDatabaseEditor.Common/WDE.TrinityMySqlDatabase/Database/TrinityMasterMySqlDatabaseProvider.cs @@ -213,4 +213,29 @@ public override async Task> GetCreatureModelInfoAsync( await using var model = Database(); return await model.Creature.FirstOrDefaultAsync(x => x.Guid == guid); } + + + public override async Task> GetCreatureAddons() + { + await using var model = Database(); + return await model.CreatureAddon.ToListAsync(); + } + + public override async Task> GetCreatureTemplateAddons() + { + await using var model = Database(); + return await model.CreatureTemplateAddon.ToListAsync(); + } + + public override async Task GetCreatureAddon(uint guid) + { + await using var model = Database(); + return await model.CreatureAddon.FirstOrDefaultAsync(x => x.Guid == guid); + } + + public override async Task GetCreatureTemplateAddon(uint entry) + { + await using var model = Database(); + return await model.CreatureTemplateAddon.FirstOrDefaultAsync(x => x.Entry == entry); + } } \ No newline at end of file diff --git a/WoWDatabaseEditor.Common/WDE.TrinityMySqlDatabase/Database/TrinityWrathMySqlDatabaseProvider.cs b/WoWDatabaseEditor.Common/WDE.TrinityMySqlDatabase/Database/TrinityWrathMySqlDatabaseProvider.cs index f31396dd2..abca8ae69 100644 --- a/WoWDatabaseEditor.Common/WDE.TrinityMySqlDatabase/Database/TrinityWrathMySqlDatabaseProvider.cs +++ b/WoWDatabaseEditor.Common/WDE.TrinityMySqlDatabase/Database/TrinityWrathMySqlDatabaseProvider.cs @@ -208,4 +208,29 @@ public override async Task> GetCreatureModelInfoAsync( await using var model = Database(); return await model.Creature.FirstOrDefaultAsync(x => x.Guid == guid); } + + + public override async Task> GetCreatureAddons() + { + await using var model = Database(); + return await model.CreatureAddon.ToListAsync(); + } + + public override async Task> GetCreatureTemplateAddons() + { + await using var model = Database(); + return await model.CreatureTemplateAddon.ToListAsync(); + } + + public override async Task GetCreatureAddon(uint guid) + { + await using var model = Database(); + return await model.CreatureAddon.FirstOrDefaultAsync(x => x.Guid == guid); + } + + public override async Task GetCreatureTemplateAddon(uint entry) + { + await using var model = Database(); + return await model.CreatureTemplateAddon.FirstOrDefaultAsync(x => x.Entry == entry); + } } \ No newline at end of file diff --git a/WoWDatabaseEditor.Common/WDE.TrinityMySqlDatabase/Models/Databases/AzerothDatabase.cs b/WoWDatabaseEditor.Common/WDE.TrinityMySqlDatabase/Models/Databases/AzerothDatabase.cs index 44ec51193..26030ca65 100644 --- a/WoWDatabaseEditor.Common/WDE.TrinityMySqlDatabase/Models/Databases/AzerothDatabase.cs +++ b/WoWDatabaseEditor.Common/WDE.TrinityMySqlDatabase/Models/Databases/AzerothDatabase.cs @@ -13,4 +13,6 @@ public class AzerothDatabase : BaseTrinityDatabase public ITable GameObject => GetTable(); public ITable ItemTemplate => GetTable(); public ITable CreatureModelInfo => GetTable(); + public ITable CreatureAddon => GetTable(); + public ITable CreatureTemplateAddon => GetTable(); } \ No newline at end of file diff --git a/WoWDatabaseEditor.Common/WDE.TrinityMySqlDatabase/Models/Databases/BaseTrinityDatabase.cs b/WoWDatabaseEditor.Common/WDE.TrinityMySqlDatabase/Models/Databases/BaseTrinityDatabase.cs index 06e0a6577..83cc8aebc 100644 --- a/WoWDatabaseEditor.Common/WDE.TrinityMySqlDatabase/Models/Databases/BaseTrinityDatabase.cs +++ b/WoWDatabaseEditor.Common/WDE.TrinityMySqlDatabase/Models/Databases/BaseTrinityDatabase.cs @@ -41,8 +41,6 @@ public BaseTrinityDatabase() : base("Trinity") public ITable SpellScripts => GetTable(); public ITable AreaTriggerCreateProperties => GetTable(); public ITable SceneTemplates => GetTable(); - public ITable CreatureAddon => GetTable(); - public ITable CreatureTemplateAddon => GetTable(); public ITable EquipmentTemplate => GetTable(); public ITable GameEventCreature => GetTable(); public ITable GameEventGameObject => GetTable(); diff --git a/WoWDatabaseEditor.Common/WDE.TrinityMySqlDatabase/Models/Databases/TrinityCataDatabase.cs b/WoWDatabaseEditor.Common/WDE.TrinityMySqlDatabase/Models/Databases/TrinityCataDatabase.cs index 8fee83ce7..b9fe056a3 100644 --- a/WoWDatabaseEditor.Common/WDE.TrinityMySqlDatabase/Models/Databases/TrinityCataDatabase.cs +++ b/WoWDatabaseEditor.Common/WDE.TrinityMySqlDatabase/Models/Databases/TrinityCataDatabase.cs @@ -15,4 +15,6 @@ public class TrinityCataDatabase : BaseTrinityDatabase public ITable CataQuestTemplate => GetTable(); public ITable CataQuestTemplateAddon => GetTable(); public ITable CreatureModelInfo => GetTable(); + public ITable CreatureAddon => GetTable(); + public ITable CreatureTemplateAddon => GetTable(); } \ No newline at end of file diff --git a/WoWDatabaseEditor.Common/WDE.TrinityMySqlDatabase/Models/Databases/TrinityMasterDatabase.cs b/WoWDatabaseEditor.Common/WDE.TrinityMySqlDatabase/Models/Databases/TrinityMasterDatabase.cs index 6a6ae174c..e2bae1e60 100644 --- a/WoWDatabaseEditor.Common/WDE.TrinityMySqlDatabase/Models/Databases/TrinityMasterDatabase.cs +++ b/WoWDatabaseEditor.Common/WDE.TrinityMySqlDatabase/Models/Databases/TrinityMasterDatabase.cs @@ -12,4 +12,6 @@ public class TrinityMasterDatabase : BaseTrinityDatabase public ITable SpellDbc => GetTable(); public ITable GameObject => GetTable(); public ITable CreatureModelInfo => GetTable(); + public ITable CreatureAddon => GetTable(); + public ITable CreatureTemplateAddon => GetTable(); } \ No newline at end of file diff --git a/WoWDatabaseEditor.Common/WDE.TrinityMySqlDatabase/Models/Databases/TrinityWrathDatabase.cs b/WoWDatabaseEditor.Common/WDE.TrinityMySqlDatabase/Models/Databases/TrinityWrathDatabase.cs index bdf836e7a..60eb20182 100644 --- a/WoWDatabaseEditor.Common/WDE.TrinityMySqlDatabase/Models/Databases/TrinityWrathDatabase.cs +++ b/WoWDatabaseEditor.Common/WDE.TrinityMySqlDatabase/Models/Databases/TrinityWrathDatabase.cs @@ -14,4 +14,6 @@ public class TrinityWrathDatabase : BaseTrinityDatabase public ITable ItemTemplate => GetTable(); public ITable SpawnGroupTemplate => GetTable(); public ITable CreatureModelInfo => GetTable(); + public ITable CreatureAddon => GetTable(); + public ITable CreatureTemplateAddon => GetTable(); } \ No newline at end of file diff --git a/WoWPacketParser b/WoWPacketParser index eeec7206f..8e193182d 160000 --- a/WoWPacketParser +++ b/WoWPacketParser @@ -1 +1 @@ -Subproject commit eeec7206f3acf4dba8106bb78353d7ff04ddd5ac +Subproject commit 8e193182d9838b7bdb20b774a753dfdaa2a68e75