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:
@@ -3094,7 +3094,7 @@ namespace Game.Entities
|
||||
if (m_deathExpireTime > now + PlayerConst.MaxDeathCount * PlayerConst.DeathExpireStep)
|
||||
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
|
||||
ClearInCombat();
|
||||
|
||||
@@ -2825,6 +2825,33 @@ namespace Game
|
||||
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();
|
||||
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))
|
||||
{
|
||||
PhasingHandler.InitDbVisibleMapId(phaseShift, data.terrainSwapMap);
|
||||
|
||||
@@ -2273,13 +2273,13 @@ namespace Game.Spells
|
||||
Unit target = aurApp.GetTarget();
|
||||
|
||||
if (apply)
|
||||
target.AddUnitFlag2(UnitFlags2.ForceMove);
|
||||
target.AddUnitFlag2(UnitFlags2.ForceMovement);
|
||||
else
|
||||
{
|
||||
// do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
|
||||
if (target.HasAuraType(GetAuraType()))
|
||||
return;
|
||||
target.RemoveUnitFlag2(UnitFlags2.ForceMove);
|
||||
target.RemoveUnitFlag2(UnitFlags2.ForceMovement);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user