Core/AreaTriggers: Implement PositionalSoundKitId

This commit is contained in:
luis
2026-09-11 21:11:03 -03:00
parent 5459305be7
commit 5a04c57da9
4 changed files with 26 additions and 2 deletions
@@ -0,0 +1 @@
ALTER TABLE `areatrigger_create_properties` ADD `PositionalSoundKitId` int NOT NULL DEFAULT 0 AFTER `SpellForVisuals`;
@@ -230,6 +230,8 @@ bool AreaTrigger::Create(AreaTriggerCreatePropertiesId areaTriggerCreateProperti
if (GetCreateProperties()->Flags.HasFlag(AreaTriggerCreatePropertiesFlag::VisualAnimIsDecay))
SetUpdateFieldValue(visualAnim.ModifyValue(&UF::VisualAnim::IsDecay), true);
SetUpdateFieldValue(areaTriggerData.ModifyValue(&UF::AreaTriggerData::PositionalSoundKitID), GetCreateProperties()->PositionalSoundKitId);
AreaTriggerFieldFlags fieldFlags = [flags = GetCreateProperties()->Flags]()
{
AreaTriggerFieldFlags fieldFlags = AreaTriggerFieldFlags::None;
@@ -249,6 +249,8 @@ public:
Optional<int32> SpellForVisuals;
int32 PositionalSoundKitId = 0;
uint32 TimeToTargetScale = 0;
AreaTriggerShapeInfo Shape;
@@ -169,14 +169,16 @@ void AreaTriggerDataStore::LoadAreaTriggerTemplates()
}
if (QueryResult areatriggerCreateProperties = WorldDatabase.Query("SELECT Id, IsCustom, AreaTriggerId, IsAreatriggerCustom, Flags, "
"MoveCurveId, ScaleCurveId, MorphCurveId, FacingCurveId, AnimId, AnimKitId, DecalPropertiesId, SpellForVisuals, TimeToTargetScale, Speed, SpeedIsTime, "
"MoveCurveId, ScaleCurveId, MorphCurveId, FacingCurveId, AnimId, AnimKitId, DecalPropertiesId, SpellForVisuals, "
"PositionalSoundKitId, TimeToTargetScale, Speed, SpeedIsTime, "
"Shape, ShapeData0, ShapeData1, ShapeData2, ShapeData3, ShapeData4, ShapeData5, ShapeData6, ShapeData7, "
"Roll, Pitch, Yaw, TargetRoll, TargetPitch, TargetYaw, ScriptName FROM `areatrigger_create_properties`"))
{
do
{
DEFINE_FIELD_ACCESSOR_CACHE_ANONYMOUS(ResultSet, (Id)(IsCustom)(AreaTriggerId)(IsAreatriggerCustom)(Flags)
(MoveCurveId)(ScaleCurveId)(MorphCurveId)(FacingCurveId)(AnimId)(AnimKitId)(DecalPropertiesId)(SpellForVisuals)(TimeToTargetScale)(Speed)(SpeedIsTime)
(MoveCurveId)(ScaleCurveId)(MorphCurveId)(FacingCurveId)(AnimId)(AnimKitId)(DecalPropertiesId)(SpellForVisuals)
(PositionalSoundKitId)(TimeToTargetScale)(Speed)(SpeedIsTime)
(Shape)(ShapeData0)(ShapeData1)(ShapeData2)(ShapeData3)(ShapeData4)(ShapeData5)(ShapeData6)(ShapeData7)
(Roll)(Pitch)(Yaw)(TargetRoll)(TargetPitch)(TargetYaw)(ScriptName)
) fields {
@@ -240,6 +242,23 @@ void AreaTriggerDataStore::LoadAreaTriggerTemplates()
}
}
createProperties.PositionalSoundKitId = fields.PositionalSoundKitId().GetInt32();
if (createProperties.PositionalSoundKitId)
{
if (!sSoundKitStore.HasRecord(createProperties.PositionalSoundKitId))
{
TC_LOG_ERROR("sql.sql", "Table `areatrigger_create_properties` has AreaTriggerCreatePropertiesId (Id: {}, IsCustom: {}) with invalid PositionalSoundKitId {}, set to 0.",
createPropertiesId.Id, uint32(createPropertiesId.IsCustom), createProperties.PositionalSoundKitId);
createProperties.PositionalSoundKitId = 0;
}
else if (shape != AreaTriggerShapeType::Sphere && shape != AreaTriggerShapeType::Cylinder)
{
TC_LOG_ERROR("sql.sql", "Table `areatrigger_create_properties` has AreaTriggerCreatePropertiesId (Id: {}, IsCustom: {}) with PositionalSoundKitId {} on unsupported shape {}, set to 0.",
createPropertiesId.Id, uint32(createPropertiesId.IsCustom), createProperties.PositionalSoundKitId, uint32(shape));
createProperties.PositionalSoundKitId = 0;
}
}
createProperties.TimeToTargetScale = fields.TimeToTargetScale().GetUInt32();
createProperties.Speed = fields.Speed().GetFloat();
createProperties.SpeedIsTime = fields.SpeedIsTime().GetBool();