From 6d294143c622a7d1fbd592fb8afd13d333c8c52a Mon Sep 17 00:00:00 2001 From: hondacrx Date: Sat, 2 Jul 2022 20:35:56 -0400 Subject: [PATCH] Core/Units: Defined many UnitFlags3 and implemented UNIT_FLAG3_ALTERNATIVE_DEFAULT_LANGUAGE Port From (https://github.com/TrinityCore/TrinityCore/commit/2a5329847636ddc080c461bda06375edfbf3815d) --- Source/Framework/Constants/CreatureConst.cs | 45 +++++++++++++++++++-- Source/Game/Spells/Auras/AuraEffect.cs | 19 +++++++++ Source/Scripts/Spells/Generic.cs | 4 +- 3 files changed, 63 insertions(+), 5 deletions(-) diff --git a/Source/Framework/Constants/CreatureConst.cs b/Source/Framework/Constants/CreatureConst.cs index a50407e53..7b0d0b4e6 100644 --- a/Source/Framework/Constants/CreatureConst.cs +++ b/Source/Framework/Constants/CreatureConst.cs @@ -142,10 +142,48 @@ namespace Framework.Constants public enum UnitFlags3 : uint { - Unk1 = 0x01, + Unk0 = 0x01, + UnconsciousOnDeath = 0x02, // Title Unconscious On Death Description Shows "Unconscious" In Unit Tooltip Instead Of "Dead" + AllowMountedCombat = 0x04, // Title Allow Mounted Combat + GarrisonPet = 0x08, // Title Garrison Pet Description Special Garrison Pet Creatures That Display One Of Favorite Player Battle Pets - This Flag Allows Querying Name And Turns Off Default Battle Pet Behavior + UiCanGetPosition = 0x10, // Title Ui Can Get Position Description Allows Lua Functions Like Unitposition To Always Get The Position Even For Npcs Or Non-Grouped Players + AiObstacle = 0x20, + AlternativeDefaultLanguage = 0x40, + SuppressAllNpcFeedback = 0x80, // Title Suppress All Npc Feedback Description Skips Playing Sounds On Left Clicking Npc For All Npcs As Long As Npc With This Flag Is Visible + IgnoreCombat = 0x100, // Title Ignore Combat Description Same As SpellAuraIgnoreCombat + SuppressNpcFeedback = 0x200, // Title Suppress Npc Feedback Description Skips Playing Sounds On Left Clicking Npc + Unk10 = 0x400, + Unk11 = 0x800, + Unk12 = 0x1000, + FakeDead = 0x2000, // Title Show As Dead + NoFacingOnInteractAndFastFacingChase = 0x4000, // Causes The Creature To Both Not Change Facing On Interaction And Speeds Up Smooth Facing Changes While Attacking (Clientside) + UntargetableFromUi = 0x8000, // Title Untargetable From Ui Description Cannot Be Targeted From Lua Functions Startattack, Targetunit, Petattack + NoFacingOnInteractWhileFakeDead = 0x10000, // Prevents Facing Changes While Interacting If Creature Has Flag FakeDead + AlreadySkinned = 0x20000, + SuppressAllNpcSounds = 0x40000, // Title Suppress All Npc Sounds Description Skips Playing Sounds On Beginning And End Of Npc Interaction For All Npcs As Long As Npc With This Flag Is Visible + SuppressNpcSounds = 0x80000, // Title Suppress Npc Sounds Description Skips Playing Sounds On Beginning And End Of Npc Interaction + Unk20 = 0x100000, + Unk21 = 0x200000, + DontFadeOut = 0x400000, + Unk23 = 0x800000, + Unk24 = 0x1000000, + Unk25 = 0x2000000, + Unk26 = 0x4000000, + Unk27 = 0x8000000, + Unk28 = 0x10000000, + Unk29 = 0x20000000, + Unk30 = 0x40000000, + Unk31 = 0x80000000, - Disallowed = 0xFFFFFFFF, - Allowed = (0xFFFFFFFF & ~Disallowed) + Disallowed = (Unk0 | /* UnconsciousOnDeath | */ /* AllowMountedCombat | */ GarrisonPet | + /* UiCanGetPosition | */ /* AiObstacle | */ AlternativeDefaultLanguage | /* SuppressAllNpcFeedback | */ + IgnoreCombat | SuppressNpcFeedback | Unk10 | Unk11 | + Unk12 | /* FakeDead | */ /* NoFacingOnInteractAndFastFacingChase | */ /* UntargetableFromUi | */ + /* NoFacingOnInteractWhileFakeDead | */ AlreadySkinned | /* SuppressAllNpcSounds | */ /* SuppressNpcSounds | */ + Unk20 | Unk21 | /* DontFadeOut | */ Unk23 | + Unk24 | Unk25 | Unk26 | Unk27 | + Unk28 | Unk29 | Unk30 | Unk31), // Skip + Allowed = (0xffffffff & ~Disallowed) // Skip } public enum NPCFlags : uint @@ -199,6 +237,7 @@ namespace Framework.Constants ContributionCollector = 0x400, AzeriteRespec = 0x4000, IslandsQueue = 0x8000, + SuppressNpcSoundsExceptEndOfInteraction = 0x00010000, } [Flags] diff --git a/Source/Game/Spells/Auras/AuraEffect.cs b/Source/Game/Spells/Auras/AuraEffect.cs index 49d83e466..e846ed124 100644 --- a/Source/Game/Spells/Auras/AuraEffect.cs +++ b/Source/Game/Spells/Auras/AuraEffect.cs @@ -4615,6 +4615,25 @@ namespace Game.Spells } } + [AuraEffectHandler(AuraType.ModAlternativeDefaultLanguage)] + void HandleModAlternativeDefaultLanguage(AuraApplication aurApp, AuraEffectHandleModes mode, bool apply) + { + if (!mode.HasAnyFlag(AuraEffectHandleModes.SendForClientMask)) + return; + + Unit target = aurApp.GetTarget(); + + if (apply) + target.SetUnitFlag3(UnitFlags3.AlternativeDefaultLanguage); + else + { + if (target.HasAuraType(GetAuraType())) + return; + + target.RemoveUnitFlag3(UnitFlags3.AlternativeDefaultLanguage); + } + } + [AuraEffectHandler(AuraType.Linked)] void HandleAuraLinked(AuraApplication aurApp, AuraEffectHandleModes mode, bool apply) { diff --git a/Source/Scripts/Spells/Generic.cs b/Source/Scripts/Spells/Generic.cs index d128aa256..5941e00db 100644 --- a/Source/Scripts/Spells/Generic.cs +++ b/Source/Scripts/Spells/Generic.cs @@ -4511,10 +4511,10 @@ namespace Scripts.Spells.Generic switch (target.GetTeamId()) { case TeamId.Alliance: - amount = Global.WorldStateMgr.GetValue(WorldStates.WarModeAllianceBuffValue, null); + amount = Global.WorldStateMgr.GetValue(WorldStates.WarModeAllianceBuffValue, target.GetMap()); break; case TeamId.Horde: - amount = Global.WorldStateMgr.GetValue(WorldStates.WarModeHordeBuffValue, null); + amount = Global.WorldStateMgr.GetValue(WorldStates.WarModeHordeBuffValue, target.GetMap()); break; } }