diff --git a/sql/updates/146_world.sql b/sql/updates/146_world.sql new file mode 100644 index 00000000000..adb426336d6 --- /dev/null +++ b/sql/updates/146_world.sql @@ -0,0 +1,120 @@ +update creature_template set spell1 = 40836, flags_extra = 128, scriptname = '' where entry = 23336; + +DROP TABLE IF EXISTS `spell_linked_spell`; +CREATE TABLE `spell_linked_spell` ( + `spell_trigger` int(10) NOT NULL, + `spell_effect` int(10) NOT NULL default '0', + `type` smallint(3) unsigned NOT NULL default '0', + `comment` text NOT NULL default '', + PRIMARY KEY (`spell_trigger`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +INSERT INTO spell_linked_spell + (`spell_trigger`, `spell_effect`, `type`, `comment`) +VALUES + (44008, 45265, 1, 'Static Disruption Visual'); + +INSERT INTO spell_linked_spell + (`spell_trigger`, `spell_effect`, `type`, `comment`) +VALUES + (42052, 40118, 0, 'Volcanic Geyser Visual'); + +INSERT INTO spell_linked_spell + (`spell_trigger`, `spell_effect`, `type`, `comment`) +VALUES + (-41914, 41915, 0, 'Summon Parasitic Shadowfiend\r\n'); + +INSERT INTO spell_linked_spell + (`spell_trigger`, `spell_effect`, `type`, `comment`) +VALUES + (46021, 44852, 1, 'Spectral Realm Aura'); + +INSERT INTO spell_linked_spell + (`spell_trigger`, `spell_effect`, `type`, `comment`) +VALUES + (-46021, 44867, 0, 'Spectral Exhaustion'); + +INSERT INTO spell_linked_spell + (`spell_trigger`, `spell_effect`, `type`, `comment`) +VALUES + (-30410, 44032, 0, 'Manticron Cube Mind Exhaustion'); + +INSERT INTO spell_linked_spell + (`spell_trigger`, `spell_effect`, `type`, `comment`) +VALUES + (-45934, 7, 0, 'Dark Fiend Suicide'); + +INSERT INTO spell_linked_spell + (`spell_trigger`, `spell_effect`, `type`, `comment`) +VALUES + (45661, 45665, 1, 'Encapsulate\r\n'); + +INSERT INTO spell_linked_spell + (`spell_trigger`, `spell_effect`, `type`, `comment`) +VALUES + (40604, 40616, 1, 'Fel Rage Aura'); + +INSERT INTO spell_linked_spell + (`spell_trigger`, `spell_effect`, `type`, `comment`) +VALUES + (40616, 41625, 1, 'Fel Rage Aura'); + +INSERT INTO spell_linked_spell + (`spell_trigger`, `spell_effect`, `type`, `comment`) +VALUES + (41292, 42017, 1, 'Aura of Suffering'); + +INSERT INTO spell_linked_spell + (`spell_trigger`, `spell_effect`, `type`, `comment`) +VALUES + (-41292, -42017, 0, 'Aura of Suffering'); + +INSERT INTO spell_linked_spell + (`spell_trigger`, `spell_effect`, `type`, `comment`) +VALUES + (45347, -45348, 1, 'Remove Flame Touched'); + +INSERT INTO spell_linked_spell + (`spell_trigger`, `spell_effect`, `type`, `comment`) +VALUES + (45348, -45347, 1, 'Remove Dark Touched'); + +INSERT INTO spell_linked_spell + (`spell_trigger`, `spell_effect`, `type`, `comment`) +VALUES + (45248, 45347, 1, 'Apply Dark Touched'); + +INSERT INTO spell_linked_spell + (`spell_trigger`, `spell_effect`, `type`, `comment`) +VALUES + (45329, 45347, 1, 'Apply Dark Touched'); + +INSERT INTO spell_linked_spell + (`spell_trigger`, `spell_effect`, `type`, `comment`) +VALUES + (45256, 45347, 1, 'Apply Dark Touched'); + +INSERT INTO spell_linked_spell + (`spell_trigger`, `spell_effect`, `type`, `comment`) +VALUES + (45270, 45347, 1, 'Apply Dark Touched'); + +INSERT INTO spell_linked_spell + (`spell_trigger`, `spell_effect`, `type`, `comment`) +VALUES + (45342, 45348, 1, 'Apply Flame Touched'); + +INSERT INTO spell_linked_spell + (`spell_trigger`, `spell_effect`, `type`, `comment`) +VALUES + (46771, 45348, 1, 'Apply Flame Touched'); + +INSERT INTO spell_linked_spell + (`spell_trigger`, `spell_effect`, `type`, `comment`) +VALUES + (45271, 45347, 1, 'Apply Dark Touched'); + +INSERT INTO spell_linked_spell + (`spell_trigger`, `spell_effect`, `type`, `comment`) +VALUES + (45246, 45348, 1, 'Apply Flame Touched'); \ No newline at end of file diff --git a/src/game/Object.cpp b/src/game/Object.cpp index 834c958e662..5a4d5d126f4 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -1482,6 +1482,9 @@ Creature* WorldObject::SummonCreature(uint32 id, float x, float y, float z, floa if(GetTypeId()==TYPEID_UNIT && ((Creature*)this)->AI()) ((Creature*)this)->AI()->JustSummoned(pCreature); + if(pCreature->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_TRIGGER && pCreature->m_spells[0]) + pCreature->CastSpell(pCreature, pCreature->m_spells[0], true, 0, 0, GetGUID()); + //return the creature therewith the summoner has access to it return pCreature; } diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 41d79e5203c..512c5533885 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -926,7 +926,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target) if(int32 spell_triggered = spellmgr.GetSpellLinked(m_spellInfo->Id, 1)) { if(spell_triggered > 0) - m_caster->CastSpell(unit, spell_triggered, true); + unit->CastSpell(unit, spell_triggered, true/*, 0, 0, m_caster->GetGUID()*/); else unit->RemoveAurasDueToSpell(-spell_triggered); } diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 2dae05b5411..3fed7edc22e 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -8571,7 +8571,10 @@ bool Unit::isVisibleForOrDetect(Unit const* u, bool detect, bool inVisibleList) else { // Units far than max visible distance for creature or not in our map are not visible too - if (!IsWithinDistInMap(u,World::GetMaxVisibleDistanceForCreature()+(inVisibleList ? World::GetVisibleUnitGreyDistance() : 0.0f))) + // Active unit should always be visibile + if (!IsWithinDistInMap(u, u->isActive() + ? (MAX_VISIBILITY_DISTANCE - (inVisibleList ? 0.0f : World::GetVisibleUnitGreyDistance())) + : (World::GetMaxVisibleDistanceForCreature() + (inVisibleList ? World::GetVisibleUnitGreyDistance() : 0.0f)))) return false; } } diff --git a/src/game/World.cpp b/src/game/World.cpp index 45070615f4d..6a0da7fc90a 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -1096,6 +1096,9 @@ void World::SetInitialWorldSettings() sLog.outString( "Loading spell extra attributes...(TODO)" ); spellmgr.LoadSpellExtraAttr(); + sLog.outString( "Loading linked spells..." ); + spellmgr.LoadSpellLinked(); + sLog.outString( "Loading player Create Info & Level Stats..." ); objmgr.LoadPlayerInfo();