diff --git a/Source/Game/Entities/Creature/Creature.Fields.cs b/Source/Game/Entities/Creature/Creature.Fields.cs index 38696e3b7..0256143d3 100644 --- a/Source/Game/Entities/Creature/Creature.Fields.cs +++ b/Source/Game/Entities/Creature/Creature.Fields.cs @@ -107,7 +107,7 @@ namespace Game.Entities public float Orientation; // the creature's "real" orientation while casting } - struct CreatureStaticFlagsHolder + public struct CreatureStaticFlagsHolder { CreatureStaticFlags _flags; CreatureStaticFlags2 _flags2; @@ -118,6 +118,18 @@ namespace Game.Entities CreatureStaticFlags7 _flags7; CreatureStaticFlags8 _flags8; + public CreatureStaticFlagsHolder(uint flags, uint flags2, uint flags3, uint flags4, uint flags5, uint flags6, uint flags7, uint flags8) + { + _flags = (CreatureStaticFlags)flags; + _flags2 = (CreatureStaticFlags2)flags2; + _flags3 = (CreatureStaticFlags3)flags3; + _flags4 = (CreatureStaticFlags4)flags4; + _flags5 = (CreatureStaticFlags5)flags5; + _flags6 = (CreatureStaticFlags6)flags6; + _flags7 = (CreatureStaticFlags7)flags7; + _flags8 = (CreatureStaticFlags8)flags8; + } + public bool HasFlag(CreatureStaticFlags flag) { return _flags.HasFlag(flag); } public bool HasFlag(CreatureStaticFlags2 flag) { return _flags2.HasFlag(flag); } public bool HasFlag(CreatureStaticFlags3 flag) { return _flags3.HasFlag(flag); } diff --git a/Source/Game/Entities/Creature/Creature.cs b/Source/Game/Entities/Creature/Creature.cs index 7b1207362..04152fdde 100644 --- a/Source/Game/Entities/Creature/Creature.cs +++ b/Source/Game/Entities/Creature/Creature.cs @@ -280,6 +280,8 @@ namespace Game.Entities for (byte i = 0; i < SharedConst.MaxCreatureSpells; ++i) m_spells[i] = GetCreatureTemplate().Spells[i]; + ApplyAllStaticFlags(m_creatureDifficulty.StaticFlags); + _staticFlags.ApplyFlag(CreatureStaticFlags.NoXp, creatureInfo.CreatureType == CreatureType.Critter || IsPet() || IsTotem() || creatureInfo.FlagsExtra.HasFlag(CreatureFlagsExtra.NoXP)); _staticFlags.ApplyFlag(CreatureStaticFlags4.TreatAsRaidUnitForHelpfulSpells, GetCreatureDifficulty().TypeFlags.HasFlag(CreatureTypeFlags.TreatAsRaidUnit)); @@ -400,6 +402,12 @@ namespace Game.Entities return true; } + void ApplyAllStaticFlags(CreatureStaticFlagsHolder flags) + { + // Apply all other side effects of flag changes + SetTemplateRooted(flags.HasFlag(CreatureStaticFlags.Sessile)); + } + public override void Update(uint diff) { if (IsAIEnabled() && triggerJustAppeared && m_deathState != DeathState.Dead) diff --git a/Source/Game/Entities/Creature/CreatureData.cs b/Source/Game/Entities/Creature/CreatureData.cs index 8025141fd..ec480e650 100644 --- a/Source/Game/Entities/Creature/CreatureData.cs +++ b/Source/Game/Entities/Creature/CreatureData.cs @@ -445,6 +445,7 @@ namespace Game.Entities public uint SkinLootID; public uint GoldMin; public uint GoldMax; + public CreatureStaticFlagsHolder StaticFlags; public CreatureDifficulty() { diff --git a/Source/Game/Globals/ObjectManager.cs b/Source/Game/Globals/ObjectManager.cs index 1f69972ba..86d365069 100644 --- a/Source/Game/Globals/ObjectManager.cs +++ b/Source/Game/Globals/ObjectManager.cs @@ -2673,8 +2673,15 @@ namespace Game { uint oldMSTime = Time.GetMSTime(); - // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 - SQLResult result = DB.World.Query("SELECT Entry, DifficultyID, LevelScalingDeltaMin, LevelScalingDeltaMax, ContentTuningID, HealthScalingExpansion, HealthModifier, ManaModifier, ArmorModifier, DamageModifier, CreatureDifficultyID, TypeFlags, TypeFlags2, LootID, PickPocketLootID, SkinLootID, GoldMin, GoldMax FROM creature_template_difficulty ORDER BY Entry"); + // 0 1 2 3 4 5 + SQLResult result = DB.World.Query("SELECT Entry, DifficultyID, LevelScalingDeltaMin, LevelScalingDeltaMax, ContentTuningID, HealthScalingExpansion, " + + //6 7 8 9 10 11 12 + "HealthModifier, ManaModifier, ArmorModifier, DamageModifier, CreatureDifficultyID, TypeFlags, TypeFlags2, " + + //13 14 15 16 17 + "LootID, PickPocketLootID, SkinLootID, GoldMin, GoldMax," + + //18 19 20 21 22 23 24 25 + "StaticFlags1, StaticFlags2, StaticFlags3, StaticFlags4, StaticFlags5, StaticFlags6, StaticFlags7, StaticFlags8 " + + "FROM creature_template_difficulty ORDER BY Entry"); if (result.IsEmpty()) { Log.outInfo(LogFilter.ServerLoading, "Loaded 0 creature template difficulty definitions. DB table `creature_template_difficulty` is empty."); @@ -2711,6 +2718,7 @@ namespace Game creatureDifficulty.SkinLootID = result.Read(15); creatureDifficulty.GoldMin = result.Read(16); creatureDifficulty.GoldMax = result.Read(17); + creatureDifficulty.StaticFlags = new(result.Read(18), result.Read(19), result.Read(20), result.Read(21), result.Read(22), result.Read(23), result.Read(24), result.Read(25)); // TODO: Check if this still applies creatureDifficulty.DamageModifier *= Creature._GetDamageMod(template.Rank);