Core/Creature: Disallow nearly all non-static flags on DB side
Port From (https://github.com/TrinityCore/TrinityCore/commit/47bcacd00a3124e801672f57afd4557ccbbe93b6)
This commit is contained in:
@@ -79,7 +79,17 @@ namespace Framework.Constants
|
|||||||
Unk28 = 0x10000000,
|
Unk28 = 0x10000000,
|
||||||
PreventEmotesFromChatText = 0x20000000, // Prevent automatically playing emotes from parsing chat text, for example "lol" in /say, ending message with ? or !, or using /yell
|
PreventEmotesFromChatText = 0x20000000, // Prevent automatically playing emotes from parsing chat text, for example "lol" in /say, ending message with ? or !, or using /yell
|
||||||
Sheathe = 0x40000000,
|
Sheathe = 0x40000000,
|
||||||
Immune = 0x80000000
|
Immune = 0x80000000,
|
||||||
|
|
||||||
|
Disallowed = (ServerControlled | NonAttackable | RemoveClientControl |
|
||||||
|
PlayerControlled | Rename | Preparation | /* UNIT_FLAG_UNK_6 | */
|
||||||
|
NotAttackable1 | Looting | PetInCombat | PvpEnabling |
|
||||||
|
Silenced | NonAttackable2 | Pacified | Stunned |
|
||||||
|
InCombat | OnTaxi | Disarmed | Confused | Fleeing |
|
||||||
|
Possessed | Skinnable | Mount | Unk28 |
|
||||||
|
PreventEmotesFromChatText | Sheathe | Immune),
|
||||||
|
|
||||||
|
Allowed = (0xFFFFFFFF & ~Disallowed)
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum UnitFlags2 : uint
|
public enum UnitFlags2 : uint
|
||||||
@@ -90,7 +100,7 @@ namespace Framework.Constants
|
|||||||
ComprehendLang = 0x08,
|
ComprehendLang = 0x08,
|
||||||
MirrorImage = 0x10,
|
MirrorImage = 0x10,
|
||||||
DontFadeIn = 0x20,
|
DontFadeIn = 0x20,
|
||||||
ForceMove = 0x40,
|
ForceMovement = 0x40,
|
||||||
DisarmOffhand = 0x80,
|
DisarmOffhand = 0x80,
|
||||||
DisablePredStats = 0x100,
|
DisablePredStats = 0x100,
|
||||||
AllowChangingTalents = 0x200,
|
AllowChangingTalents = 0x200,
|
||||||
@@ -103,6 +113,7 @@ namespace Framework.Constants
|
|||||||
Unk2 = 0x10000,
|
Unk2 = 0x10000,
|
||||||
PlayDeathAnim = 0x20000,
|
PlayDeathAnim = 0x20000,
|
||||||
AllowCheatSpells = 0x40000,
|
AllowCheatSpells = 0x40000,
|
||||||
|
SuppressHighlightWhenTargetedOrMousedOver = 0x00080000,
|
||||||
TreatAsRaidUnitForHelpfulSpells = 0x100000,
|
TreatAsRaidUnitForHelpfulSpells = 0x100000,
|
||||||
LargeAoi = 0x00200000,
|
LargeAoi = 0x00200000,
|
||||||
GiganticAoi = 0x400000,
|
GiganticAoi = 0x400000,
|
||||||
@@ -112,12 +123,29 @@ namespace Framework.Constants
|
|||||||
UntargetableByClient = 0x4000000,
|
UntargetableByClient = 0x4000000,
|
||||||
AttackerIgnoresMinimumRanges = 0x8000000,
|
AttackerIgnoresMinimumRanges = 0x8000000,
|
||||||
UninteractibleIfHostile = 0x10000000,
|
UninteractibleIfHostile = 0x10000000,
|
||||||
|
Unsued11 = 0x20000000,
|
||||||
InfiniteAoi = 0x40000000,
|
InfiniteAoi = 0x40000000,
|
||||||
|
Unused13 = 0x80000000,
|
||||||
|
|
||||||
|
Disallowed = (FeignDeath | IgnoreReputation | ComprehendLang |
|
||||||
|
MirrorImage | ForceMovement | DisarmOffhand |
|
||||||
|
DisablePredStats | AllowChangingTalents | DisarmRanged |
|
||||||
|
/* UNIT_FLAG2_REGENERATE_POWER | */ RestrictPartyInteraction |
|
||||||
|
PreventSpellClick | InteractWhileHostile | /* UNIT_FLAG2_CANNOT_TURN | */
|
||||||
|
/* UNIT_FLAG2_PLAY_DEATH_ANIM | */ AllowCheatSpells | SuppressHighlightWhenTargetedOrMousedOver |
|
||||||
|
TreatAsRaidUnitForHelpfulSpells | LargeAoi | GiganticAoi | NoActions |
|
||||||
|
AiWillOnlySwimIfTargetSwims | DontGenerateCombatLogWhenEngagedWithNpcs | UntargetableByClient | AttackerIgnoresMinimumRanges |
|
||||||
|
UninteractibleIfHostile | Unsued11 | InfiniteAoi | Unused13),
|
||||||
|
|
||||||
|
Allowed = (0xFFFFFFFF & ~Disallowed)
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum UnitFlags3 : uint
|
public enum UnitFlags3 : uint
|
||||||
{
|
{
|
||||||
Unk1 = 0x01,
|
Unk1 = 0x01,
|
||||||
|
|
||||||
|
Disallowed = 0xFFFFFFFF,
|
||||||
|
Allowed = (0xFFFFFFFF & ~Disallowed)
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum NPCFlags : uint
|
public enum NPCFlags : uint
|
||||||
|
|||||||
@@ -3094,7 +3094,7 @@ namespace Game.Entities
|
|||||||
if (m_deathExpireTime > now + PlayerConst.MaxDeathCount * PlayerConst.DeathExpireStep)
|
if (m_deathExpireTime > now + PlayerConst.MaxDeathCount * PlayerConst.DeathExpireStep)
|
||||||
m_deathExpireTime = now + PlayerConst.MaxDeathCount * PlayerConst.DeathExpireStep - 1;
|
m_deathExpireTime = now + PlayerConst.MaxDeathCount * PlayerConst.DeathExpireStep - 1;
|
||||||
|
|
||||||
RemoveUnitFlag2(UnitFlags2.ForceMove);
|
RemoveUnitFlag2(UnitFlags2.ForceMovement);
|
||||||
|
|
||||||
// make sure the unit is considered out of combat for proper loading
|
// make sure the unit is considered out of combat for proper loading
|
||||||
ClearInCombat();
|
ClearInCombat();
|
||||||
|
|||||||
@@ -2825,6 +2825,33 @@ namespace Game
|
|||||||
cInfo.FlagsExtra &= CreatureFlagsExtra.DBAllowed;
|
cInfo.FlagsExtra &= CreatureFlagsExtra.DBAllowed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint disallowedUnitFlags = (uint)(cInfo.UnitFlags & ~UnitFlags.Allowed);
|
||||||
|
if (disallowedUnitFlags != 0)
|
||||||
|
{
|
||||||
|
Log.outError(LogFilter.Sql, $"Table `creature_template` lists creature (Entry: {cInfo.Entry}) with disallowed `unit_flags` {disallowedUnitFlags}, removing incorrect flag.");
|
||||||
|
cInfo.UnitFlags &= UnitFlags.Allowed;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint disallowedUnitFlags2 = (cInfo.UnitFlags2 & ~(uint)UnitFlags2.Allowed);
|
||||||
|
if (disallowedUnitFlags2 != 0)
|
||||||
|
{
|
||||||
|
Log.outError(LogFilter.Sql, $"Table `creature_template` lists creature (Entry: {cInfo.Entry}) with disallowed `unit_flags2` {disallowedUnitFlags2}, removing incorrect flag.");
|
||||||
|
cInfo.UnitFlags2 &= (uint)UnitFlags2.Allowed;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint disallowedUnitFlags3 = (cInfo.UnitFlags3 & ~(uint)UnitFlags3.Allowed);
|
||||||
|
if (disallowedUnitFlags3 != 0)
|
||||||
|
{
|
||||||
|
Log.outError(LogFilter.Sql, $"Table `creature_template` lists creature (Entry: {cInfo.Entry}) with disallowed `unit_flags2` {disallowedUnitFlags3}, removing incorrect flag.");
|
||||||
|
cInfo.UnitFlags3 &= (uint)UnitFlags3.Allowed;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cInfo.DynamicFlags != 0)
|
||||||
|
{
|
||||||
|
Log.outError(LogFilter.Sql, $"Table `creature_template` lists creature (Entry: {cInfo.Entry}) with `dynamicflags` > 0. Ignored and set to 0.");
|
||||||
|
cInfo.DynamicFlags = 0;
|
||||||
|
}
|
||||||
|
|
||||||
var levels = cInfo.GetMinMaxLevel();
|
var levels = cInfo.GetMinMaxLevel();
|
||||||
if (levels[0] < 1 || levels[0] > SharedConst.StrongMaxLevel)
|
if (levels[0] < 1 || levels[0] > SharedConst.StrongMaxLevel)
|
||||||
{
|
{
|
||||||
@@ -3572,6 +3599,33 @@ namespace Game
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint disallowedUnitFlags = (uint)(cInfo.UnitFlags & ~UnitFlags.Allowed);
|
||||||
|
if (disallowedUnitFlags != 0)
|
||||||
|
{
|
||||||
|
Log.outError(LogFilter.Sql, $"Table `creature_template` lists creature (Entry: {cInfo.Entry}) with disallowed `unit_flags` {disallowedUnitFlags}, removing incorrect flag.");
|
||||||
|
cInfo.UnitFlags &= UnitFlags.Allowed;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint disallowedUnitFlags2 = (cInfo.UnitFlags2 & ~(uint)UnitFlags2.Allowed);
|
||||||
|
if (disallowedUnitFlags2 != 0)
|
||||||
|
{
|
||||||
|
Log.outError(LogFilter.Sql, $"Table `creature_template` lists creature (Entry: {cInfo.Entry}) with disallowed `unit_flags2` {disallowedUnitFlags2}, removing incorrect flag.");
|
||||||
|
cInfo.UnitFlags2 &= (uint)UnitFlags2.Allowed;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint disallowedUnitFlags3 = (cInfo.UnitFlags3 & ~(uint)UnitFlags3.Allowed);
|
||||||
|
if (disallowedUnitFlags3 != 0)
|
||||||
|
{
|
||||||
|
Log.outError(LogFilter.Sql, $"Table `creature_template` lists creature (Entry: {cInfo.Entry}) with disallowed `unit_flags2` {disallowedUnitFlags3}, removing incorrect flag.");
|
||||||
|
cInfo.UnitFlags3 &= (uint)UnitFlags3.Allowed;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cInfo.DynamicFlags != 0)
|
||||||
|
{
|
||||||
|
Log.outError(LogFilter.Sql, $"Table `creature_template` lists creature (Entry: {cInfo.Entry}) with `dynamicflags` > 0. Ignored and set to 0.");
|
||||||
|
cInfo.DynamicFlags = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (WorldConfig.GetBoolValue(WorldCfg.CalculateCreatureZoneAreaData))
|
if (WorldConfig.GetBoolValue(WorldCfg.CalculateCreatureZoneAreaData))
|
||||||
{
|
{
|
||||||
PhasingHandler.InitDbVisibleMapId(phaseShift, data.terrainSwapMap);
|
PhasingHandler.InitDbVisibleMapId(phaseShift, data.terrainSwapMap);
|
||||||
|
|||||||
@@ -2273,13 +2273,13 @@ namespace Game.Spells
|
|||||||
Unit target = aurApp.GetTarget();
|
Unit target = aurApp.GetTarget();
|
||||||
|
|
||||||
if (apply)
|
if (apply)
|
||||||
target.AddUnitFlag2(UnitFlags2.ForceMove);
|
target.AddUnitFlag2(UnitFlags2.ForceMovement);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
|
// do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
|
||||||
if (target.HasAuraType(GetAuraType()))
|
if (target.HasAuraType(GetAuraType()))
|
||||||
return;
|
return;
|
||||||
target.RemoveUnitFlag2(UnitFlags2.ForceMove);
|
target.RemoveUnitFlag2(UnitFlags2.ForceMovement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user