Core/Creatures: Split creature_addon and creature_template_addon's byte columns into seperate ones
Port From (https://github.com/TrinityCore/TrinityCore/commit/4119f69b214d6199b7ab508e305b2958eeffb332)
This commit is contained in:
@@ -252,7 +252,9 @@ namespace Framework.Constants
|
|||||||
SitHighChair = 6,
|
SitHighChair = 6,
|
||||||
Dead = 7,
|
Dead = 7,
|
||||||
Kneel = 8,
|
Kneel = 8,
|
||||||
Submerged = 9
|
Submerged = 9,
|
||||||
|
|
||||||
|
Max
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum UnitVisFlags
|
public enum UnitVisFlags
|
||||||
@@ -271,7 +273,9 @@ namespace Framework.Constants
|
|||||||
Swim = 1, // falls back to ground tier animations, not handled by the client, should never appear in sniffs, will prevent tier change animations from playing correctly if used
|
Swim = 1, // falls back to ground tier animations, not handled by the client, should never appear in sniffs, will prevent tier change animations from playing correctly if used
|
||||||
Hover = 2, // plays flying tier animations or falls back to ground tier animations, automatically enables hover clientside when entering visibility with this value
|
Hover = 2, // plays flying tier animations or falls back to ground tier animations, automatically enables hover clientside when entering visibility with this value
|
||||||
Fly = 3, // plays flying tier animations
|
Fly = 3, // plays flying tier animations
|
||||||
Submerged = 4
|
Submerged = 4,
|
||||||
|
|
||||||
|
Max
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum UnitPVPStateFlags
|
public enum UnitPVPStateFlags
|
||||||
@@ -543,6 +547,7 @@ namespace Framework.Constants
|
|||||||
Unarmed = 0, // non prepared weapon
|
Unarmed = 0, // non prepared weapon
|
||||||
Melee = 1, // prepared melee weapon
|
Melee = 1, // prepared melee weapon
|
||||||
Ranged = 2, // prepared ranged weapon
|
Ranged = 2, // prepared ranged weapon
|
||||||
|
|
||||||
Max = 3
|
Max = 3
|
||||||
}
|
}
|
||||||
public enum MeleeHitOutcome
|
public enum MeleeHitOutcome
|
||||||
|
|||||||
@@ -2352,64 +2352,50 @@ namespace Game.Entities
|
|||||||
|
|
||||||
public bool LoadCreaturesAddon()
|
public bool LoadCreaturesAddon()
|
||||||
{
|
{
|
||||||
CreatureAddon cainfo = GetCreatureAddon();
|
CreatureAddon creatureAddon = GetCreatureAddon();
|
||||||
if (cainfo == null)
|
if (creatureAddon == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (cainfo.mount != 0)
|
if (creatureAddon.mount != 0)
|
||||||
Mount(cainfo.mount);
|
Mount(creatureAddon.mount);
|
||||||
|
|
||||||
if (cainfo.bytes1 != 0)
|
SetStandState((UnitStandStateType)creatureAddon.standState);
|
||||||
{
|
ReplaceAllVisFlags((UnitVisFlags)creatureAddon.visFlags);
|
||||||
// 0 StandState
|
SetAnimTier((AnimTier)creatureAddon.animTier, false);
|
||||||
// 1 FreeTalentPoints Pet only, so always 0 for default creature
|
|
||||||
// 2 StandFlags
|
|
||||||
// 3 StandMiscFlags
|
|
||||||
|
|
||||||
SetStandState((UnitStandStateType)(cainfo.bytes1 & 0xFF));
|
//! Suspected correlation between UNIT_FIELD_BYTES_1, offset 3, value 0x2:
|
||||||
ReplaceAllVisFlags((UnitVisFlags)((cainfo.bytes1 >> 16) & 0xFF));
|
//! If no inhabittype_fly (if no MovementFlag_DisableGravity or MovementFlag_CanFly flag found in sniffs)
|
||||||
SetAnimTier((AnimTier)((cainfo.bytes1 >> 24) & 0xFF), false);
|
//! Check using InhabitType as movement flags are assigned dynamically
|
||||||
|
//! basing on whether the creature is in air or not
|
||||||
|
//! Set MovementFlag_Hover. Otherwise do nothing.
|
||||||
|
if (CanHover())
|
||||||
|
AddUnitMovementFlag(MovementFlag.Hover);
|
||||||
|
|
||||||
//! Suspected correlation between UNIT_FIELD_BYTES_1, offset 3, value 0x2:
|
SetSheath((SheathState)creatureAddon.sheathState);
|
||||||
//! If no inhabittype_fly (if no MovementFlag_DisableGravity or MovementFlag_CanFly flag found in sniffs)
|
ReplaceAllPvpFlags((UnitPVPStateFlags)creatureAddon.pvpFlags);
|
||||||
//! Check using InhabitType as movement flags are assigned dynamically
|
|
||||||
//! basing on whether the creature is in air or not
|
|
||||||
//! Set MovementFlag_Hover. Otherwise do nothing.
|
|
||||||
if (CanHover())
|
|
||||||
AddUnitMovementFlag(MovementFlag.Hover);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cainfo.bytes2 != 0)
|
// These fields must only be handled by core internals and must not be modified via scripts/DB dat
|
||||||
{
|
ReplaceAllPetFlags(UnitPetFlags.None);
|
||||||
// 0 SheathState
|
SetShapeshiftForm(ShapeShiftForm.None);
|
||||||
// 1 PvpFlags
|
|
||||||
// 2 PetFlags Pet only, so always 0 for default creature
|
|
||||||
// 3 ShapeshiftForm Must be determined/set by shapeshift spell/aura
|
|
||||||
|
|
||||||
SetSheath((SheathState)(cainfo.bytes2 & 0xFF));
|
if (creatureAddon.emote != 0)
|
||||||
ReplaceAllPvpFlags((UnitPVPStateFlags)((cainfo.bytes2 >> 8) & 0xFF));
|
SetEmoteState((Emote)creatureAddon.emote);
|
||||||
ReplaceAllPetFlags(UnitPetFlags.None);
|
|
||||||
SetShapeshiftForm(ShapeShiftForm.None);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cainfo.emote != 0)
|
SetAIAnimKitId(creatureAddon.aiAnimKit);
|
||||||
SetEmoteState((Emote)cainfo.emote);
|
SetMovementAnimKitId(creatureAddon.movementAnimKit);
|
||||||
|
SetMeleeAnimKitId(creatureAddon.meleeAnimKit);
|
||||||
SetAIAnimKitId(cainfo.aiAnimKit);
|
|
||||||
SetMovementAnimKitId(cainfo.movementAnimKit);
|
|
||||||
SetMeleeAnimKitId(cainfo.meleeAnimKit);
|
|
||||||
|
|
||||||
// Check if visibility distance different
|
// Check if visibility distance different
|
||||||
if (cainfo.visibilityDistanceType != VisibilityDistanceType.Normal)
|
if (creatureAddon.visibilityDistanceType != VisibilityDistanceType.Normal)
|
||||||
SetVisibilityDistanceOverride(cainfo.visibilityDistanceType);
|
SetVisibilityDistanceOverride(creatureAddon.visibilityDistanceType);
|
||||||
|
|
||||||
//Load Path
|
//Load Path
|
||||||
if (cainfo.path_id != 0)
|
if (creatureAddon.path_id != 0)
|
||||||
_waypointPathId = cainfo.path_id;
|
_waypointPathId = creatureAddon.path_id;
|
||||||
|
|
||||||
if (cainfo.auras != null)
|
if (creatureAddon.auras != null)
|
||||||
{
|
{
|
||||||
foreach (var id in cainfo.auras)
|
foreach (var id in creatureAddon.auras)
|
||||||
{
|
{
|
||||||
SpellInfo AdditionalSpellInfo = Global.SpellMgr.GetSpellInfo(id, GetMap().GetDifficultyID());
|
SpellInfo AdditionalSpellInfo = Global.SpellMgr.GetSpellInfo(id, GetMap().GetDifficultyID());
|
||||||
if (AdditionalSpellInfo == null)
|
if (AdditionalSpellInfo == null)
|
||||||
|
|||||||
@@ -408,8 +408,11 @@ namespace Game.Entities
|
|||||||
{
|
{
|
||||||
public uint path_id;
|
public uint path_id;
|
||||||
public uint mount;
|
public uint mount;
|
||||||
public uint bytes1;
|
public byte standState;
|
||||||
public uint bytes2;
|
public byte animTier;
|
||||||
|
public byte sheathState;
|
||||||
|
public byte pvpFlags;
|
||||||
|
public byte visFlags;
|
||||||
public uint emote;
|
public uint emote;
|
||||||
public ushort aiAnimKit;
|
public ushort aiAnimKit;
|
||||||
public ushort movementAnimKit;
|
public ushort movementAnimKit;
|
||||||
|
|||||||
@@ -2097,8 +2097,8 @@ namespace Game
|
|||||||
public void LoadCreatureTemplateAddons()
|
public void LoadCreatureTemplateAddons()
|
||||||
{
|
{
|
||||||
var time = Time.GetMSTime();
|
var time = Time.GetMSTime();
|
||||||
// 0 1 2 3 4 5 6 7 8 9 10
|
// 0 1 2 3 4 5 6 7 8 9 10 11 12
|
||||||
SQLResult result = DB.World.Query("SELECT entry, path_id, mount, bytes1, bytes2, emote, aiAnimKit, movementAnimKit, meleeAnimKit, visibilityDistanceType, auras FROM creature_template_addon");
|
SQLResult result = DB.World.Query("SELECT entry, path_id, mount, StandState, AnimTier, VisFlags, SheathState, PvPFlags, emote, aiAnimKit, movementAnimKit, meleeAnimKit, visibilityDistanceType, auras FROM creature_template_addon");
|
||||||
|
|
||||||
if (result.IsEmpty())
|
if (result.IsEmpty())
|
||||||
{
|
{
|
||||||
@@ -2112,20 +2112,23 @@ namespace Game
|
|||||||
uint entry = result.Read<uint>(0);
|
uint entry = result.Read<uint>(0);
|
||||||
if (GetCreatureTemplate(entry) == null)
|
if (GetCreatureTemplate(entry) == null)
|
||||||
{
|
{
|
||||||
Log.outError(LogFilter.Sql, "Creature template (Entry: {0}) does not exist but has a record in `creature_template_addon`", entry);
|
Log.outError(LogFilter.Sql, $"Creature template (Entry: {entry}) does not exist but has a record in `creature_template_addon`");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CreatureAddon creatureAddon = new();
|
CreatureAddon creatureAddon = new();
|
||||||
creatureAddon.path_id = result.Read<uint>(1);
|
creatureAddon.path_id = result.Read<uint>(1);
|
||||||
creatureAddon.mount = result.Read<uint>(2);
|
creatureAddon.mount = result.Read<uint>(2);
|
||||||
creatureAddon.bytes1 = result.Read<uint>(3);
|
creatureAddon.standState = result.Read<byte>(3);
|
||||||
creatureAddon.bytes2 = result.Read<uint>(4);
|
creatureAddon.animTier = result.Read<byte>(4);
|
||||||
creatureAddon.emote = result.Read<uint>(5);
|
creatureAddon.visFlags = result.Read<byte>(5);
|
||||||
creatureAddon.aiAnimKit = result.Read<ushort>(6);
|
creatureAddon.sheathState = result.Read<byte>(6);
|
||||||
creatureAddon.movementAnimKit = result.Read<ushort>(7);
|
creatureAddon.pvpFlags = result.Read<byte>(7);
|
||||||
creatureAddon.meleeAnimKit = result.Read<ushort>(8);
|
creatureAddon.emote = result.Read<uint>(8);
|
||||||
creatureAddon.visibilityDistanceType = (VisibilityDistanceType)result.Read<byte>(9);
|
creatureAddon.aiAnimKit = result.Read<ushort>(9);
|
||||||
|
creatureAddon.movementAnimKit = result.Read<ushort>(10);
|
||||||
|
creatureAddon.meleeAnimKit = result.Read<ushort>(11);
|
||||||
|
creatureAddon.visibilityDistanceType = (VisibilityDistanceType)result.Read<byte>(12);
|
||||||
|
|
||||||
var tokens = new StringArray(result.Read<string>(10), ' ');
|
var tokens = new StringArray(result.Read<string>(10), ' ');
|
||||||
for (var c = 0; c < tokens.Length; ++c)
|
for (var c = 0; c < tokens.Length; ++c)
|
||||||
@@ -2137,16 +2140,16 @@ namespace Game
|
|||||||
SpellInfo AdditionalSpellInfo = Global.SpellMgr.GetSpellInfo(spellId, Difficulty.None);
|
SpellInfo AdditionalSpellInfo = Global.SpellMgr.GetSpellInfo(spellId, Difficulty.None);
|
||||||
if (AdditionalSpellInfo == null)
|
if (AdditionalSpellInfo == null)
|
||||||
{
|
{
|
||||||
Log.outError(LogFilter.Sql, "Creature (Entry: {0}) has wrong spell {1} defined in `auras` field in `creature_template_addon`.", entry, spellId);
|
Log.outError(LogFilter.Sql, $"Creature (Entry: {entry}) has wrong spell {spellId} defined in `auras` field in `creature_template_addon`.");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AdditionalSpellInfo.HasAura(AuraType.ControlVehicle))
|
if (AdditionalSpellInfo.HasAura(AuraType.ControlVehicle))
|
||||||
Log.outError(LogFilter.Sql, "Creature (Entry: {0}) has SPELL_AURA_CONTROL_VEHICLE aura {1} defined in `auras` field in `creature_template_addon`.", entry, spellId);
|
Log.outError(LogFilter.Sql, $"Creature (Entry: {entry}) has SPELL_AURA_CONTROL_VEHICLE aura {spellId} defined in `auras` field in `creature_template_addon`.");
|
||||||
|
|
||||||
if (creatureAddon.auras.Contains(spellId))
|
if (creatureAddon.auras.Contains(spellId))
|
||||||
{
|
{
|
||||||
Log.outError(LogFilter.Sql, "Creature (Entry: {0}) has duplicate aura (spell {1}) in `auras` field in `creature_template_addon`.", entry, spellId);
|
Log.outError(LogFilter.Sql, $"Creature (Entry: {entry}) has duplicate aura (spell {spellId}) in `auras` field in `creature_template_addon`.");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2163,32 +2166,52 @@ namespace Game
|
|||||||
{
|
{
|
||||||
if (CliDB.CreatureDisplayInfoStorage.LookupByKey(creatureAddon.mount) == null)
|
if (CliDB.CreatureDisplayInfoStorage.LookupByKey(creatureAddon.mount) == null)
|
||||||
{
|
{
|
||||||
Log.outError(LogFilter.Sql, "Creature (Entry: {0}) has invalid displayInfoId ({1}) for mount defined in `creature_template_addon`", entry, creatureAddon.mount);
|
Log.outError(LogFilter.Sql, $"Creature (Entry: {entry}) has invalid displayInfoId ({creatureAddon.mount}) for mount defined in `creature_template_addon`");
|
||||||
creatureAddon.mount = 0;
|
creatureAddon.mount = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (creatureAddon.standState >= (int)UnitStandStateType.Max)
|
||||||
|
{
|
||||||
|
Log.outError(LogFilter.Sql, $"Creature (Entry: {entry}) has invalid unit stand state ({creatureAddon.standState}) defined in `creature_addon`. Truncated to 0.");
|
||||||
|
creatureAddon.standState = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (creatureAddon.animTier >= (int)AnimTier.Max)
|
||||||
|
{
|
||||||
|
Log.outError(LogFilter.Sql, $"Creature (Entry: {entry}) has invalid animation tier ({creatureAddon.animTier}) defined in `creature_addon`. Truncated to 0.");
|
||||||
|
creatureAddon.animTier = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (creatureAddon.sheathState >= (int)SheathState.Max)
|
||||||
|
{
|
||||||
|
Log.outError(LogFilter.Sql, $"Creature (Entry: {entry}) has invalid sheath state ({creatureAddon.sheathState}) defined in `creature_addon`. Truncated to 0.");
|
||||||
|
creatureAddon.sheathState = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// PvPFlags don't need any checking for the time being since they cover the entire range of a byte
|
||||||
|
|
||||||
if (!CliDB.EmotesStorage.ContainsKey(creatureAddon.emote))
|
if (!CliDB.EmotesStorage.ContainsKey(creatureAddon.emote))
|
||||||
{
|
{
|
||||||
Log.outError(LogFilter.Sql, "Creature (Entry: {0}) has invalid emote ({1}) defined in `creatureaddon`.", entry, creatureAddon.emote);
|
Log.outError(LogFilter.Sql, $"Creature (Entry: {entry}) has invalid emote ({creatureAddon.emote}) defined in `creatureaddon`.");
|
||||||
creatureAddon.emote = 0;
|
creatureAddon.emote = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (creatureAddon.aiAnimKit != 0 && !CliDB.AnimKitStorage.ContainsKey(creatureAddon.aiAnimKit))
|
if (creatureAddon.aiAnimKit != 0 && !CliDB.AnimKitStorage.ContainsKey(creatureAddon.aiAnimKit))
|
||||||
{
|
{
|
||||||
Log.outError(LogFilter.Sql, "Creature (Entry: {0}) has invalid aiAnimKit ({1}) defined in `creature_template_addon`.", entry, creatureAddon.aiAnimKit);
|
Log.outError(LogFilter.Sql, $"Creature (Entry: {entry}) has invalid aiAnimKit ({creatureAddon.aiAnimKit}) defined in `creature_template_addon`.");
|
||||||
creatureAddon.aiAnimKit = 0;
|
creatureAddon.aiAnimKit = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (creatureAddon.movementAnimKit != 0 && !CliDB.AnimKitStorage.ContainsKey(creatureAddon.movementAnimKit))
|
if (creatureAddon.movementAnimKit != 0 && !CliDB.AnimKitStorage.ContainsKey(creatureAddon.movementAnimKit))
|
||||||
{
|
{
|
||||||
Log.outError(LogFilter.Sql, "Creature (Entry: {0}) has invalid movementAnimKit ({1}) defined in `creature_template_addon`.", entry, creatureAddon.movementAnimKit);
|
Log.outError(LogFilter.Sql, $"Creature (Entry: {entry}) has invalid movementAnimKit ({creatureAddon.movementAnimKit}) defined in `creature_template_addon`.");
|
||||||
creatureAddon.movementAnimKit = 0;
|
creatureAddon.movementAnimKit = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (creatureAddon.meleeAnimKit != 0 && !CliDB.AnimKitStorage.ContainsKey(creatureAddon.meleeAnimKit))
|
if (creatureAddon.meleeAnimKit != 0 && !CliDB.AnimKitStorage.ContainsKey(creatureAddon.meleeAnimKit))
|
||||||
{
|
{
|
||||||
Log.outError(LogFilter.Sql, "Creature (Entry: {0}) has invalid meleeAnimKit ({1}) defined in `creature_template_addon`.", entry, creatureAddon.meleeAnimKit);
|
Log.outError(LogFilter.Sql, $"Creature (Entry: {entry}) has invalid meleeAnimKit ({creatureAddon.meleeAnimKit}) defined in `creature_template_addon`.");
|
||||||
creatureAddon.meleeAnimKit = 0;
|
creatureAddon.meleeAnimKit = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2202,13 +2225,13 @@ namespace Game
|
|||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
while (result.NextRow());
|
while (result.NextRow());
|
||||||
Log.outInfo(LogFilter.ServerLoading, "Loaded {0} creature template addons in {1} ms", count, Time.GetMSTimeDiffToNow(time));
|
Log.outInfo(LogFilter.ServerLoading, $"Loaded {count} creature template addons in {Time.GetMSTimeDiffToNow(time)} ms");
|
||||||
}
|
}
|
||||||
public void LoadCreatureAddons()
|
public void LoadCreatureAddons()
|
||||||
{
|
{
|
||||||
var time = Time.GetMSTime();
|
var time = Time.GetMSTime();
|
||||||
// 0 1 2 3 4 5 6 7 8 9 10
|
// 0 1 2 3 4 5 6 7 8 9 10 11 12
|
||||||
SQLResult result = DB.World.Query("SELECT guid, path_id, mount, bytes1, bytes2, emote, aiAnimKit, movementAnimKit, meleeAnimKit, visibilityDistanceType, auras FROM creature_addon");
|
SQLResult result = DB.World.Query("SELECT guid, path_id, mount, StandState, AnimTier, VisFlags, SheathState, PvPFlags, emote, aiAnimKit, movementAnimKit, meleeAnimKit, visibilityDistanceType, auras FROM creature_addon");
|
||||||
|
|
||||||
if (result.IsEmpty())
|
if (result.IsEmpty())
|
||||||
{
|
{
|
||||||
@@ -2223,7 +2246,7 @@ namespace Game
|
|||||||
CreatureData creData = GetCreatureData(guid);
|
CreatureData creData = GetCreatureData(guid);
|
||||||
if (creData == null)
|
if (creData == null)
|
||||||
{
|
{
|
||||||
Log.outError(LogFilter.Sql, "Creature (GUID: {0}) does not exist but has a record in `creatureaddon`", guid);
|
Log.outError(LogFilter.Sql, $"Creature (GUID: {guid}) does not exist but has a record in `creatureaddon`");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2233,12 +2256,15 @@ namespace Game
|
|||||||
if (creData.movementType == (byte)MovementGeneratorType.Waypoint && creatureAddon.path_id == 0)
|
if (creData.movementType == (byte)MovementGeneratorType.Waypoint && creatureAddon.path_id == 0)
|
||||||
{
|
{
|
||||||
creData.movementType = (byte)MovementGeneratorType.Idle;
|
creData.movementType = (byte)MovementGeneratorType.Idle;
|
||||||
Log.outError(LogFilter.Sql, "Creature (GUID {0}) has movement type set to WAYPOINTMOTIONTYPE but no path assigned", guid);
|
Log.outError(LogFilter.Sql, $"Creature (GUID {guid}) has movement type set to WAYPOINTMOTIONTYPE but no path assigned");
|
||||||
}
|
}
|
||||||
|
|
||||||
creatureAddon.mount = result.Read<uint>(2);
|
creatureAddon.mount = result.Read<uint>(2);
|
||||||
creatureAddon.bytes1 = result.Read<uint>(3);
|
creatureAddon.standState = result.Read<byte>(3);
|
||||||
creatureAddon.bytes2 = result.Read<uint>(4);
|
creatureAddon.animTier = result.Read<byte>(4);
|
||||||
|
creatureAddon.visFlags = result.Read<byte>(5);
|
||||||
|
creatureAddon.sheathState = result.Read<byte>(6);
|
||||||
|
creatureAddon.pvpFlags = result.Read<byte>(7);
|
||||||
creatureAddon.emote = result.Read<uint>(5);
|
creatureAddon.emote = result.Read<uint>(5);
|
||||||
creatureAddon.aiAnimKit = result.Read<ushort>(6);
|
creatureAddon.aiAnimKit = result.Read<ushort>(6);
|
||||||
creatureAddon.movementAnimKit = result.Read<ushort>(7);
|
creatureAddon.movementAnimKit = result.Read<ushort>(7);
|
||||||
@@ -2255,16 +2281,16 @@ namespace Game
|
|||||||
SpellInfo AdditionalSpellInfo = Global.SpellMgr.GetSpellInfo(spellId, Difficulty.None);
|
SpellInfo AdditionalSpellInfo = Global.SpellMgr.GetSpellInfo(spellId, Difficulty.None);
|
||||||
if (AdditionalSpellInfo == null)
|
if (AdditionalSpellInfo == null)
|
||||||
{
|
{
|
||||||
Log.outError(LogFilter.Sql, "Creature (GUID: {0}) has wrong spell {1} defined in `auras` field in `creatureaddon`.", guid, spellId);
|
Log.outError(LogFilter.Sql, $"Creature (GUID: {guid}) has wrong spell {spellId} defined in `auras` field in `creatureaddon`.");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AdditionalSpellInfo.HasAura(AuraType.ControlVehicle))
|
if (AdditionalSpellInfo.HasAura(AuraType.ControlVehicle))
|
||||||
Log.outError(LogFilter.Sql, "Creature (GUID: {0}) has SPELL_AURA_CONTROL_VEHICLE aura {1} defined in `auras` field in `creature_addon`.", guid, spellId);
|
Log.outError(LogFilter.Sql, $"Creature (GUID: {guid}) has SPELL_AURA_CONTROL_VEHICLE aura {spellId} defined in `auras` field in `creature_addon`.");
|
||||||
|
|
||||||
if (creatureAddon.auras.Contains(spellId))
|
if (creatureAddon.auras.Contains(spellId))
|
||||||
{
|
{
|
||||||
Log.outError(LogFilter.Sql, "Creature (GUID: {0}) has duplicate aura (spell {1}) in `auras` field in `creature_addon`.", guid, spellId);
|
Log.outError(LogFilter.Sql, $"Creature (GUID: {guid}) has duplicate aura (spell {spellId}) in `auras` field in `creature_addon`.");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2281,33 +2307,53 @@ namespace Game
|
|||||||
{
|
{
|
||||||
if (!CliDB.CreatureDisplayInfoStorage.ContainsKey(creatureAddon.mount))
|
if (!CliDB.CreatureDisplayInfoStorage.ContainsKey(creatureAddon.mount))
|
||||||
{
|
{
|
||||||
Log.outError(LogFilter.Sql, "Creature (GUID: {0}) has invalid displayInfoId ({1}) for mount defined in `creatureaddon`", guid, creatureAddon.mount);
|
Log.outError(LogFilter.Sql, $"Creature (GUID: {guid}) has invalid displayInfoId ({creatureAddon.mount}) for mount defined in `creatureaddon`");
|
||||||
creatureAddon.mount = 0;
|
creatureAddon.mount = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (creatureAddon.standState >= (int)UnitStandStateType.Max)
|
||||||
|
{
|
||||||
|
Log.outError(LogFilter.Sql, $"Creature (GUID: {guid}) has invalid unit stand state ({creatureAddon.standState}) defined in `creature_addon`. Truncated to 0.");
|
||||||
|
creatureAddon.standState = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (creatureAddon.animTier >= (int)AnimTier.Max)
|
||||||
|
{
|
||||||
|
Log.outError(LogFilter.Sql, $"Creature (GUID: {guid}) has invalid animation tier ({creatureAddon.animTier}) defined in `creature_addon`. Truncated to 0.");
|
||||||
|
creatureAddon.animTier = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (creatureAddon.sheathState >= (int)SheathState.Max)
|
||||||
|
{
|
||||||
|
Log.outError(LogFilter.Sql, $"Creature (GUID: {guid}) has invalid sheath state ({creatureAddon.sheathState}) defined in `creature_addon`. Truncated to 0.");
|
||||||
|
creatureAddon.sheathState = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// PvPFlags don't need any checking for the time being since they cover the entire range of a byte
|
||||||
|
|
||||||
if (!CliDB.EmotesStorage.ContainsKey(creatureAddon.emote))
|
if (!CliDB.EmotesStorage.ContainsKey(creatureAddon.emote))
|
||||||
{
|
{
|
||||||
Log.outError(LogFilter.Sql, "Creature (GUID: {0}) has invalid emote ({1}) defined in `creatureaddon`.", guid, creatureAddon.emote);
|
Log.outError(LogFilter.Sql, $"Creature (GUID: {guid}) has invalid emote ({creatureAddon.emote}) defined in `creatureaddon`.");
|
||||||
creatureAddon.emote = 0;
|
creatureAddon.emote = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (creatureAddon.aiAnimKit != 0 && !CliDB.AnimKitStorage.ContainsKey(creatureAddon.aiAnimKit))
|
if (creatureAddon.aiAnimKit != 0 && !CliDB.AnimKitStorage.ContainsKey(creatureAddon.aiAnimKit))
|
||||||
{
|
{
|
||||||
Log.outError(LogFilter.Sql, "Creature (Guid: {0}) has invalid aiAnimKit ({1}) defined in `creature_addon`.", guid, creatureAddon.aiAnimKit);
|
Log.outError(LogFilter.Sql, $"Creature (Guid: {guid}) has invalid aiAnimKit ({creatureAddon.aiAnimKit}) defined in `creature_addon`.");
|
||||||
creatureAddon.aiAnimKit = 0;
|
creatureAddon.aiAnimKit = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (creatureAddon.movementAnimKit != 0 && !CliDB.AnimKitStorage.ContainsKey(creatureAddon.movementAnimKit))
|
if (creatureAddon.movementAnimKit != 0 && !CliDB.AnimKitStorage.ContainsKey(creatureAddon.movementAnimKit))
|
||||||
{
|
{
|
||||||
Log.outError(LogFilter.Sql, "Creature (Guid: {0}) has invalid movementAnimKit ({1}) defined in `creature_addon`.", guid, creatureAddon.movementAnimKit);
|
Log.outError(LogFilter.Sql, $"Creature (Guid: {guid}) has invalid movementAnimKit ({creatureAddon.movementAnimKit}) defined in `creature_addon`.");
|
||||||
creatureAddon.movementAnimKit = 0;
|
creatureAddon.movementAnimKit = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (creatureAddon.meleeAnimKit != 0 && !CliDB.AnimKitStorage.ContainsKey(creatureAddon.meleeAnimKit))
|
if (creatureAddon.meleeAnimKit != 0 && !CliDB.AnimKitStorage.ContainsKey(creatureAddon.meleeAnimKit))
|
||||||
{
|
{
|
||||||
Log.outError(LogFilter.Sql, "Creature (Guid: {0}) has invalid meleeAnimKit ({1}) defined in `creature_addon`.", guid, creatureAddon.meleeAnimKit);
|
Log.outError(LogFilter.Sql, $"Creature (Guid: {guid}) has invalid meleeAnimKit ({creatureAddon.meleeAnimKit}) defined in `creature_addon`.");
|
||||||
creatureAddon.meleeAnimKit = 0;
|
creatureAddon.meleeAnimKit = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2321,7 +2367,7 @@ namespace Game
|
|||||||
count++;
|
count++;
|
||||||
} while (result.NextRow());
|
} while (result.NextRow());
|
||||||
|
|
||||||
Log.outInfo(LogFilter.ServerLoading, "Loaded {0} creature addons in {1} ms", count, Time.GetMSTimeDiffToNow(time));
|
Log.outInfo(LogFilter.ServerLoading, $"Loaded {count} creature addons in {Time.GetMSTimeDiffToNow(time)} ms");
|
||||||
}
|
}
|
||||||
public void LoadCreatureQuestItems()
|
public void LoadCreatureQuestItems()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
ALTER TABLE `creature_template_addon`
|
||||||
|
ADD COLUMN `StandState` TINYINT UNSIGNED DEFAULT 0 NOT NULL AFTER `MountCreatureID`,
|
||||||
|
ADD COLUMN `AnimTier` TINYINT UNSIGNED DEFAULT 0 NOT NULL AFTER `StandState`,
|
||||||
|
ADD COLUMN `VisFlags` TINYINT UNSIGNED DEFAULT 0 NOT NULL AFTER `AnimTier`,
|
||||||
|
ADD COLUMN `SheathState` TINYINT UNSIGNED DEFAULT 1 NOT NULL AFTER `VisFlags`,
|
||||||
|
ADD COLUMN `PvPFlags` TINYINT UNSIGNED DEFAULT 0 NOT NULL AFTER `SheathState`;
|
||||||
|
|
||||||
|
UPDATE `creature_template_addon` SET `StandState`=`bytes1` & 0xFF;
|
||||||
|
UPDATE `creature_template_addon` SET `AnimTier`=(`bytes1` >> 24) & 0xFF;
|
||||||
|
UPDATE `creature_template_addon` SET `VisFlags`=(`bytes1` >> 16) & 0xFF;
|
||||||
|
UPDATE `creature_template_addon` SET `SheathState`=`bytes2` & 0xFF;
|
||||||
|
UPDATE `creature_template_addon` SET `PvPFlags`=(`bytes2` >> 8) & 0xFF;
|
||||||
|
|
||||||
|
ALTER TABLE `creature_addon`
|
||||||
|
ADD COLUMN `StandState` TINYINT UNSIGNED DEFAULT 0 NOT NULL AFTER `MountCreatureID`,
|
||||||
|
ADD COLUMN `AnimTier` TINYINT UNSIGNED DEFAULT 0 NOT NULL AFTER `StandState`,
|
||||||
|
ADD COLUMN `VisFlags` TINYINT UNSIGNED DEFAULT 0 NOT NULL AFTER `AnimTier`,
|
||||||
|
ADD COLUMN `SheathState` TINYINT UNSIGNED DEFAULT 1 NOT NULL AFTER `VisFlags`,
|
||||||
|
ADD COLUMN `PvPFlags` TINYINT UNSIGNED DEFAULT 0 NOT NULL AFTER `SheathState`;
|
||||||
|
|
||||||
|
UPDATE `creature_addon` SET `StandState`=`bytes1` & 0xFF;
|
||||||
|
UPDATE `creature_addon` SET `AnimTier`=(`bytes1` >> 24) & 0xFF;
|
||||||
|
UPDATE `creature_addon` SET `VisFlags`=(`bytes1` >> 16) & 0xFF;
|
||||||
|
UPDATE `creature_addon` SET `SheathState`=`bytes2` & 0xFF;
|
||||||
|
UPDATE `creature_addon` SET `PvPFlags`=(`bytes2` >> 8) & 0xFF;
|
||||||
|
|
||||||
|
-- Conversion done, drop old columns
|
||||||
|
ALTER TABLE `creature_template_addon`
|
||||||
|
DROP COLUMN `bytes1`,
|
||||||
|
DROP COLUMN `bytes2`;
|
||||||
|
|
||||||
|
ALTER TABLE `creature_addon`
|
||||||
|
DROP COLUMN `bytes1`,
|
||||||
|
DROP COLUMN `bytes2`;
|
||||||
Reference in New Issue
Block a user