mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/AreaTriggers: Added SpellForVisual for db spawned areatriggers (#29277)
This commit is contained in:
3
sql/updates/world/master/2023_08_31_01_world.sql
Normal file
3
sql/updates/world/master/2023_08_31_01_world.sql
Normal file
@@ -0,0 +1,3 @@
|
||||
--
|
||||
ALTER TABLE `areatrigger` ADD COLUMN `SpellForVisuals` int NULL DEFAULT NULL AFTER `ShapeData7`;
|
||||
ALTER TABLE `areatrigger` ADD COLUMN `VerifiedBuild` int NOT NULL DEFAULT '0' AFTER `Comment`;
|
||||
@@ -275,14 +275,22 @@ bool AreaTrigger::CreateServer(Map* map, AreaTriggerTemplate const* areaTriggerT
|
||||
|
||||
auto areaTriggerData = m_values.ModifyValue(&AreaTrigger::m_areaTriggerData);
|
||||
SetUpdateFieldValue(areaTriggerData.ModifyValue(&UF::AreaTriggerData::BoundsRadius2D), GetMaxSearchRadius());
|
||||
SetUpdateFieldValue(areaTriggerData.ModifyValue(&UF::AreaTriggerData::DecalPropertiesID), 24); // blue decal, for .debug areatrigger visibility
|
||||
if (position.SpellForVisuals)
|
||||
{
|
||||
SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(*position.SpellForVisuals, DIFFICULTY_NONE);
|
||||
SetUpdateFieldValue(areaTriggerData.ModifyValue(&UF::AreaTriggerData::SpellForVisuals), *position.SpellForVisuals);
|
||||
SetUpdateFieldValue(areaTriggerData.ModifyValue(&UF::AreaTriggerData::SpellVisual).ModifyValue(&UF::SpellCastVisual::SpellXSpellVisualID), spellInfo->GetSpellXSpellVisualId());
|
||||
SetUpdateFieldValue(areaTriggerData.ModifyValue(&UF::AreaTriggerData::SpellVisual).ModifyValue(&UF::SpellCastVisual::ScriptVisualID), 0);
|
||||
}
|
||||
|
||||
float tmp = 1.0000001f;
|
||||
uint32 tmp2;
|
||||
memcpy(&tmp2, &tmp, sizeof(tmp));
|
||||
if (IsServerSide())
|
||||
SetUpdateFieldValue(areaTriggerData.ModifyValue(&UF::AreaTriggerData::DecalPropertiesID), 24); // blue decal, for .debug areatrigger visibility
|
||||
|
||||
SetUpdateFieldValue(areaTriggerData.ModifyValue(&UF::AreaTriggerData::ExtraScaleCurve).ModifyValue(&UF::ScaleCurve::ParameterCurve), tmp2);
|
||||
SetUpdateFieldValue(areaTriggerData.ModifyValue(&UF::AreaTriggerData::ExtraScaleCurve).ModifyValue(&UF::ScaleCurve::OverrideActive), true);
|
||||
SetScaleCurve(areaTriggerData.ModifyValue(&UF::AreaTriggerData::ExtraScaleCurve), AreaTriggerScaleCurveTemplate());
|
||||
|
||||
SetUpdateFieldValue(areaTriggerData.ModifyValue(&UF::AreaTriggerData::VisualAnim).ModifyValue(&UF::VisualAnim::AnimationDataID), -1);
|
||||
|
||||
SetDuration(-1);
|
||||
|
||||
_shape = position.Shape;
|
||||
_maxSearchRadius = _shape.GetMaxSearchRadius();
|
||||
|
||||
@@ -254,6 +254,7 @@ struct AreaTriggerSpawn : SpawnData
|
||||
AreaTriggerId Id;
|
||||
|
||||
AreaTriggerShapeInfo Shape;
|
||||
Optional<int32> SpellForVisuals;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "Log.h"
|
||||
#include "MapManager.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "SpellMgr.h"
|
||||
#include "Timer.h"
|
||||
#include <cmath>
|
||||
|
||||
@@ -299,8 +300,8 @@ void AreaTriggerDataStore::LoadAreaTriggerSpawns()
|
||||
// Load area trigger positions (to put them on the server)
|
||||
// 0 1 2 3 4 5 6 7 8 9 10
|
||||
if (QueryResult templates = WorldDatabase.Query("SELECT SpawnId, AreaTriggerId, IsServerSide, MapId, PosX, PosY, PosZ, Orientation, PhaseUseFlags, PhaseId, PhaseGroup, "
|
||||
// 11 12 13 14 15 16 17 18 19 20
|
||||
"Shape, ShapeData0, ShapeData1, ShapeData2, ShapeData3, ShapeData4, ShapeData5, ShapeData6, ShapeData7, ScriptName FROM `areatrigger`"))
|
||||
// 11 12 13 14 15 16 17 18 19 20 21
|
||||
"Shape, ShapeData0, ShapeData1, ShapeData2, ShapeData3, ShapeData4, ShapeData5, ShapeData6, ShapeData7, SpellForVisuals, ScriptName FROM `areatrigger`"))
|
||||
{
|
||||
do
|
||||
{
|
||||
@@ -346,7 +347,18 @@ void AreaTriggerDataStore::LoadAreaTriggerSpawns()
|
||||
for (uint8 i = 0; i < MAX_AREATRIGGER_ENTITY_DATA; ++i)
|
||||
spawn.Shape.DefaultDatas.Data[i] = fields[12 + i].GetFloat();
|
||||
|
||||
spawn.scriptId = sObjectMgr->GetScriptId(fields[20].GetString());
|
||||
if (!fields[20].IsNull())
|
||||
{
|
||||
spawn.SpellForVisuals = fields[20].GetInt32();
|
||||
if (!sSpellMgr->GetSpellInfo(*spawn.SpellForVisuals, DIFFICULTY_NONE))
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "Table `areatrigger` has listed areatrigger SpawnId: {} with invalid SpellForVisual {}, set to none.",
|
||||
spawnId, *spawn.SpellForVisuals);
|
||||
spawn.SpellForVisuals.reset();
|
||||
}
|
||||
}
|
||||
|
||||
spawn.scriptId = sObjectMgr->GetScriptId(fields[21].GetString());
|
||||
spawn.spawnGroupData = sObjectMgr->GetLegacySpawnGroup();
|
||||
|
||||
// Add the trigger to a map::cell map, which is later used by GridLoader to query
|
||||
|
||||
Reference in New Issue
Block a user