diff options
-rw-r--r-- | sql/updates/world/2014_11_20_02_world.sql | 7 | ||||
-rw-r--r-- | src/server/game/Spells/SpellInfo.cpp | 1 | ||||
-rw-r--r-- | src/server/game/Spells/SpellInfo.h | 5 | ||||
-rw-r--r-- | src/server/game/Spells/SpellMgr.cpp | 19 |
4 files changed, 23 insertions, 9 deletions
diff --git a/sql/updates/world/2014_11_20_02_world.sql b/sql/updates/world/2014_11_20_02_world.sql new file mode 100644 index 00000000000..1e0048e1943 --- /dev/null +++ b/sql/updates/world/2014_11_20_02_world.sql @@ -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`; diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index cc88cc41e5a..6d434a72def 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -358,6 +358,7 @@ SpellEffectInfo::SpellEffectInfo(SpellEntry const* /*spellEntry*/, SpellInfo con MiscValue = _effect ? _effect->EffectMiscValue : 0; MiscValueB = _effect ? _effect->EffectMiscValueB : 0; Mechanic = Mechanics(_effect ? _effect->EffectMechanic : 0); + PositionFacing = _effect ? _effect->EffectPosFacing : 0.0f; TargetA = SpellImplicitTargetInfo(_effect ? _effect->ImplicitTarget[0] : 0); TargetB = SpellImplicitTargetInfo(_effect ? _effect->ImplicitTarget[1] : 0); RadiusEntry = _effect && _effect->EffectRadiusIndex ? sSpellRadiusStore.LookupEntry(_effect->EffectRadiusIndex) : NULL; diff --git a/src/server/game/Spells/SpellInfo.h b/src/server/game/Spells/SpellInfo.h index 1fad30dd23b..b22c20ffbc1 100644 --- a/src/server/game/Spells/SpellInfo.h +++ b/src/server/game/Spells/SpellInfo.h @@ -245,6 +245,7 @@ public: int32 MiscValue; int32 MiscValueB; Mechanics Mechanic; + float PositionFacing; SpellImplicitTargetInfo TargetA; SpellImplicitTargetInfo TargetB; SpellRadiusEntry const* RadiusEntry; @@ -261,8 +262,8 @@ public: SpellEffectInfo() : _spellInfo(NULL), _effIndex(0), Effect(0), ApplyAuraName(0), ApplyAuraPeriod(0), DieSides(0), RealPointsPerLevel(0), BasePoints(0), PointsPerResource(0), Amplitude(0), ChainAmplitude(0), - BonusCoefficient(0), MiscValue(0), MiscValueB(0), Mechanic(MECHANIC_NONE), RadiusEntry(NULL), ChainTargets(0), - ItemType(0), TriggerSpell(0), ImplicitTargetConditions(NULL) {} + BonusCoefficient(0), MiscValue(0), MiscValueB(0), PositionFacing(0), Mechanic(MECHANIC_NONE), + RadiusEntry(NULL), ChainTargets(0), ItemType(0), TriggerSpell(0), ImplicitTargetConditions(NULL) { } SpellEffectInfo(SpellEntry const* spellEntry, SpellInfo const* spellInfo, uint8 effIndex, SpellEffectEntry const* effect); bool IsEffect() const; diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 3b7ab7abe30..ee92c9347c8 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -1672,8 +1672,8 @@ void SpellMgr::LoadSpellTargetPositions() mSpellTargetPositions.clear(); // need for reload case - // 0 1 2 3 4 5 6 - QueryResult result = WorldDatabase.Query("SELECT id, effIndex, target_map, target_position_x, target_position_y, target_position_z, target_orientation FROM spell_target_position"); + // 0 1 2 3 4 5 + QueryResult result = WorldDatabase.Query("SELECT ID, EffectIndex, MapID, PositionX, PositionY, PositionZ FROM spell_target_position"); if (!result) { 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_Y = fields[4].GetFloat(); st.target_Z = fields[5].GetFloat(); - st.target_Orientation = fields[6].GetFloat(); MapEntry const* mapEntry = sMapStore.LookupEntry(st.target_mapId); 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; } - 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; } SpellInfo const* spellInfo = GetSpellInfo(Spell_ID); 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; } + // 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) { std::pair<uint32, SpellEffIndex> key = std::make_pair(Spell_ID, effIndex); |