Core/Spells: Made the loading of the orientation of SPELL_DEST_DB from SpellEffect.dbc
This commit is contained in:
@@ -0,0 +1,7 @@
|
|||||||
|
ALTER TABLE `spell_target_position` CHANGE `id` `ID` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0';
|
||||||
|
ALTER TABLE `spell_target_position` CHANGE `effIndex` `EffectIndex` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0';
|
||||||
|
ALTER TABLE `spell_target_position` CHANGE `target_map` `MapID` SMALLINT(3) UNSIGNED NOT NULL DEFAULT '0';
|
||||||
|
ALTER TABLE `spell_target_position` CHANGE `target_position_x` `PositionX` FLOAT NOT NULL DEFAULT '0';
|
||||||
|
ALTER TABLE `spell_target_position` CHANGE `target_position_y` `PositionY` FLOAT NOT NULL DEFAULT '0';
|
||||||
|
ALTER TABLE `spell_target_position` CHANGE `target_position_z` `PositionZ` FLOAT NOT NULL DEFAULT '0';
|
||||||
|
ALTER TABLE `spell_target_position` DROP COLUMN `target_orientation`;
|
||||||
@@ -358,6 +358,7 @@ SpellEffectInfo::SpellEffectInfo(SpellEntry const* /*spellEntry*/, SpellInfo con
|
|||||||
MiscValue = _effect ? _effect->EffectMiscValue : 0;
|
MiscValue = _effect ? _effect->EffectMiscValue : 0;
|
||||||
MiscValueB = _effect ? _effect->EffectMiscValueB : 0;
|
MiscValueB = _effect ? _effect->EffectMiscValueB : 0;
|
||||||
Mechanic = Mechanics(_effect ? _effect->EffectMechanic : 0);
|
Mechanic = Mechanics(_effect ? _effect->EffectMechanic : 0);
|
||||||
|
PositionFacing = _effect ? _effect->EffectPosFacing : 0.0f;
|
||||||
TargetA = SpellImplicitTargetInfo(_effect ? _effect->ImplicitTarget[0] : 0);
|
TargetA = SpellImplicitTargetInfo(_effect ? _effect->ImplicitTarget[0] : 0);
|
||||||
TargetB = SpellImplicitTargetInfo(_effect ? _effect->ImplicitTarget[1] : 0);
|
TargetB = SpellImplicitTargetInfo(_effect ? _effect->ImplicitTarget[1] : 0);
|
||||||
RadiusEntry = _effect && _effect->EffectRadiusIndex ? sSpellRadiusStore.LookupEntry(_effect->EffectRadiusIndex) : NULL;
|
RadiusEntry = _effect && _effect->EffectRadiusIndex ? sSpellRadiusStore.LookupEntry(_effect->EffectRadiusIndex) : NULL;
|
||||||
|
|||||||
@@ -245,6 +245,7 @@ public:
|
|||||||
int32 MiscValue;
|
int32 MiscValue;
|
||||||
int32 MiscValueB;
|
int32 MiscValueB;
|
||||||
Mechanics Mechanic;
|
Mechanics Mechanic;
|
||||||
|
float PositionFacing;
|
||||||
SpellImplicitTargetInfo TargetA;
|
SpellImplicitTargetInfo TargetA;
|
||||||
SpellImplicitTargetInfo TargetB;
|
SpellImplicitTargetInfo TargetB;
|
||||||
SpellRadiusEntry const* RadiusEntry;
|
SpellRadiusEntry const* RadiusEntry;
|
||||||
@@ -261,8 +262,8 @@ public:
|
|||||||
|
|
||||||
SpellEffectInfo() : _spellInfo(NULL), _effIndex(0), Effect(0), ApplyAuraName(0), ApplyAuraPeriod(0), DieSides(0),
|
SpellEffectInfo() : _spellInfo(NULL), _effIndex(0), Effect(0), ApplyAuraName(0), ApplyAuraPeriod(0), DieSides(0),
|
||||||
RealPointsPerLevel(0), BasePoints(0), PointsPerResource(0), Amplitude(0), ChainAmplitude(0),
|
RealPointsPerLevel(0), BasePoints(0), PointsPerResource(0), Amplitude(0), ChainAmplitude(0),
|
||||||
BonusCoefficient(0), MiscValue(0), MiscValueB(0), Mechanic(MECHANIC_NONE), RadiusEntry(NULL), ChainTargets(0),
|
BonusCoefficient(0), MiscValue(0), MiscValueB(0), PositionFacing(0), Mechanic(MECHANIC_NONE),
|
||||||
ItemType(0), TriggerSpell(0), ImplicitTargetConditions(NULL) {}
|
RadiusEntry(NULL), ChainTargets(0), ItemType(0), TriggerSpell(0), ImplicitTargetConditions(NULL) { }
|
||||||
SpellEffectInfo(SpellEntry const* spellEntry, SpellInfo const* spellInfo, uint8 effIndex, SpellEffectEntry const* effect);
|
SpellEffectInfo(SpellEntry const* spellEntry, SpellInfo const* spellInfo, uint8 effIndex, SpellEffectEntry const* effect);
|
||||||
|
|
||||||
bool IsEffect() const;
|
bool IsEffect() const;
|
||||||
|
|||||||
@@ -1672,8 +1672,8 @@ void SpellMgr::LoadSpellTargetPositions()
|
|||||||
|
|
||||||
mSpellTargetPositions.clear(); // need for reload case
|
mSpellTargetPositions.clear(); // need for reload case
|
||||||
|
|
||||||
// 0 1 2 3 4 5 6
|
// 0 1 2 3 4 5
|
||||||
QueryResult result = WorldDatabase.Query("SELECT id, effIndex, target_map, target_position_x, target_position_y, target_position_z, target_orientation FROM spell_target_position");
|
QueryResult result = WorldDatabase.Query("SELECT ID, EffectIndex, MapID, PositionX, PositionY, PositionZ FROM spell_target_position");
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
TC_LOG_INFO("server.loading", ">> Loaded 0 spell target coordinates. DB table `spell_target_position` is empty.");
|
TC_LOG_INFO("server.loading", ">> Loaded 0 spell target coordinates. DB table `spell_target_position` is empty.");
|
||||||
@@ -1694,28 +1694,33 @@ void SpellMgr::LoadSpellTargetPositions()
|
|||||||
st.target_X = fields[3].GetFloat();
|
st.target_X = fields[3].GetFloat();
|
||||||
st.target_Y = fields[4].GetFloat();
|
st.target_Y = fields[4].GetFloat();
|
||||||
st.target_Z = fields[5].GetFloat();
|
st.target_Z = fields[5].GetFloat();
|
||||||
st.target_Orientation = fields[6].GetFloat();
|
|
||||||
|
|
||||||
MapEntry const* mapEntry = sMapStore.LookupEntry(st.target_mapId);
|
MapEntry const* mapEntry = sMapStore.LookupEntry(st.target_mapId);
|
||||||
if (!mapEntry)
|
if (!mapEntry)
|
||||||
{
|
{
|
||||||
TC_LOG_ERROR("sql.sql", "Spell (Id: %u, effIndex: %u) target map (ID: %u) does not exist in `Map.dbc`.", Spell_ID, effIndex, st.target_mapId);
|
TC_LOG_ERROR("sql.sql", "Spell (ID: %u, EffectIndex: %u) is using a non-existant MapID (ID: %u).", Spell_ID, effIndex, st.target_mapId);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (st.target_X==0 && st.target_Y==0 && st.target_Z==0)
|
if (st.target_X == 0 && st.target_Y == 0 && st.target_Z == 0)
|
||||||
{
|
{
|
||||||
TC_LOG_ERROR("sql.sql", "Spell (Id: %u, effIndex: %u) target coordinates not provided.", Spell_ID, effIndex);
|
TC_LOG_ERROR("sql.sql", "Spell (ID: %u, EffectIndex: %u): target coordinates not provided.", Spell_ID, effIndex);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
SpellInfo const* spellInfo = GetSpellInfo(Spell_ID);
|
SpellInfo const* spellInfo = GetSpellInfo(Spell_ID);
|
||||||
if (!spellInfo)
|
if (!spellInfo)
|
||||||
{
|
{
|
||||||
TC_LOG_ERROR("sql.sql", "Spell (Id: %u) listed in `spell_target_position` does not exist.", Spell_ID);
|
TC_LOG_ERROR("sql.sql", "Spell (ID: %u) listed in `spell_target_position` does not exist.", Spell_ID);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// target facing is in degrees for 6484 & 9268... (blizz sucks)
|
||||||
|
if (spellInfo->Effects[effIndex].PositionFacing > 2 * M_PI)
|
||||||
|
st.target_Orientation = spellInfo->Effects[effIndex].PositionFacing * M_PI / 180;
|
||||||
|
else
|
||||||
|
st.target_Orientation = spellInfo->Effects[effIndex].PositionFacing;
|
||||||
|
|
||||||
if (spellInfo->Effects[effIndex].TargetA.GetTarget() == TARGET_DEST_DB || spellInfo->Effects[effIndex].TargetB.GetTarget() == TARGET_DEST_DB)
|
if (spellInfo->Effects[effIndex].TargetA.GetTarget() == TARGET_DEST_DB || spellInfo->Effects[effIndex].TargetB.GetTarget() == TARGET_DEST_DB)
|
||||||
{
|
{
|
||||||
std::pair<uint32, SpellEffIndex> key = std::make_pair(Spell_ID, effIndex);
|
std::pair<uint32, SpellEffIndex> key = std::make_pair(Spell_ID, effIndex);
|
||||||
|
|||||||
Reference in New Issue
Block a user