From 6d562b12481790d57e673843cec77d8ccbd60c64 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Thu, 10 Oct 2013 07:31:42 +0200 Subject: [PATCH 01/15] Fix typo (thx to vlad852) --- sql/updates/world/2013_10_10_00_world_misc.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sql/updates/world/2013_10_10_00_world_misc.sql b/sql/updates/world/2013_10_10_00_world_misc.sql index e46668548b1..9dcae219b16 100644 --- a/sql/updates/world/2013_10_10_00_world_misc.sql +++ b/sql/updates/world/2013_10_10_00_world_misc.sql @@ -2,7 +2,7 @@ UPDATE `creature` SET `spawndist`=0 WHERE `guid`=142524; UPDATE `smart_scripts` SET `event_param2`=100 WHERE `entryorguid`=16769 AND `source_type`=0 AND `id`=9; UPDATE `smart_scripts` SET `action_param1`=55661 WHERE `entryorguid`=29872 AND `source_type`=0 AND `id`=1; -UPDATE `smart_scripts` SET `action_param1`=55661 WHERE `entryorguid`=29895 AND `source_type`=0 AND `id`=3; +UPDATE `smart_scripts` SET `action_param1`=55662 WHERE `entryorguid`=29895 AND `source_type`=0 AND `id`=3; UPDATE `conditions` SET `SourceGroup`=10059 WHERE `SourceTypeOrReferenceId`=10 AND `SourceGroup`=10058 AND `SourceEntry`=51969; -UPDATE `conditions` SET `SourceGroup`=10058 WHERE `SourceTypeOrReferenceId`=10 AND `SourceGroup`=10059 AND `SourceEntry`=51961; \ No newline at end of file +UPDATE `conditions` SET `SourceGroup`=10058 WHERE `SourceTypeOrReferenceId`=10 AND `SourceGroup`=10059 AND `SourceEntry`=51961; From 114bafe82b91157fdd523d3382914d7bdb97806d Mon Sep 17 00:00:00 2001 From: Filip Date: Thu, 10 Oct 2013 08:58:58 +0200 Subject: [PATCH 02/15] DB/Update: Chat flood By @bele fixes #11025 --- sql/updates/world/2013_10_10_01_world_update.sql | 1 + 1 file changed, 1 insertion(+) create mode 100644 sql/updates/world/2013_10_10_01_world_update.sql diff --git a/sql/updates/world/2013_10_10_01_world_update.sql b/sql/updates/world/2013_10_10_01_world_update.sql new file mode 100644 index 00000000000..e6aaa90f07f --- /dev/null +++ b/sql/updates/world/2013_10_10_01_world_update.sql @@ -0,0 +1 @@ +UPDATE `smart_scripts` SET `event_flags` = 1 WHERE `entryorguid` IN (16325,16326) AND `source_type` = 0 AND `id` = 0 AND `link` = 1; From 6d08d06341309811fea8e98a62fad72c36befb4f Mon Sep 17 00:00:00 2001 From: Filip Date: Fri, 11 Oct 2013 02:43:11 +0200 Subject: [PATCH 03/15] Create 2013_10_11_00_world_sai.sql --- sql/updates/world/2013_10_11_00_world_sai.sql | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 sql/updates/world/2013_10_11_00_world_sai.sql diff --git a/sql/updates/world/2013_10_11_00_world_sai.sql b/sql/updates/world/2013_10_11_00_world_sai.sql new file mode 100644 index 00000000000..ff3e9ccc9f3 --- /dev/null +++ b/sql/updates/world/2013_10_11_00_world_sai.sql @@ -0,0 +1,16 @@ +UPDATE `creature_template` SET `ainame`='SmartAI' WHERE `entry` IN (18305,18306,18307); +DELETE FROM `smart_scripts` WHERE `entryorguid` IN (18305,18306,18307) AND `source_type`=0; +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(18305,0,0,0,8,0,100,0,32205,0,0,0,33,18305,0,0,0,0,0,7,0,0,0,0,0,0,0,'Burning Blade Pyre (01) - On Spell Hit (Place Maghar Battle Standard)- Give Quest Credit'), +(18306,0,0,0,8,0,100,0,32205,0,0,0,33,18306,0,0,0,0,0,7,0,0,0,0,0,0,0,'Burning Blade Pyre (02) - On Spell Hit (Place Maghar Battle Standard)- Give Quest Credit'), +(18307,0,0,0,8,0,100,0,32205,0,0,0,33,18307,0,0,0,0,0,7,0,0,0,0,0,0,0,'Burning Blade Pyre (03) - On Spell Hit (Place Maghar Battle Standard)- Give Quest Credit'); + +UPDATE `creature_template` SET `ainame`='SmartAI' WHERE `entry`=23439; +DELETE FROM `smart_scripts` WHERE `entryorguid`= 23439 AND `source_type`=0; +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(23439,0,0,1,38,0,100,0,1,1,0,0,45,1,0,0,0,0,0,1,0,0,0,0,0,0,0,'Hungry Nether Ray - On Data set - Set Data'), +(23439,0,1,0,61,0,100,0,0,0,0,0,11,41427,0,0,0,0,0,23,0,0,0,0,0,0,0,'Hungry Nether Ray - Linked with Previous Event - Cast Lucille Feed Credit Trigger'); + +DELETE FROM `smart_scripts` WHERE `entryorguid`=23219 AND `id`=6; +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(23219, 0, 6, 0, 6, 0, 100, 0, 0, 0, 0, 0, 45, 1, 1, 0, 0, 0, 0, 9, 23439, 0, 50, 0, 0, 0, 0, 'Blackwind Warp Chaser - On Death - Set Data Hungry Nether Ray'); From ca02411eff684ebfb12f73612857d0b8bf2ba83b Mon Sep 17 00:00:00 2001 From: Discover- Date: Fri, 11 Oct 2013 16:57:28 +0200 Subject: [PATCH 04/15] Core/SAI: When the castflags are set to both SMARTCAST_AURA_NOT_PRESENT and SMARTCAST_INTERRUPT_PREVIOUS, we only interrupt the spell if there is actually a spell cast. --- .../game/AI/SmartScripts/SmartScript.cpp | 56 +++++++++++-------- 1 file changed, 33 insertions(+), 23 deletions(-) diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 3823f7ba287..d228a441893 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -507,18 +507,20 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) { - if (IsUnit(*itr)) + if (!IsUnit(*itr)) + continue; + + if (!(e.action.cast.flags & SMARTCAST_AURA_NOT_PRESENT) || !(*itr)->ToUnit()->HasAura(e.action.cast.spell)) { if (e.action.cast.flags & SMARTCAST_INTERRUPT_PREVIOUS) me->InterruptNonMeleeSpells(false); - if (!(e.action.cast.flags & SMARTCAST_AURA_NOT_PRESENT) || !(*itr)->ToUnit()->HasAura(e.action.cast.spell)) - me->CastSpell((*itr)->ToUnit(), e.action.cast.spell, (e.action.cast.flags & SMARTCAST_TRIGGERED) ? true : false); - else - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "Spell %u not casted because it has flag SMARTCAST_AURA_NOT_PRESENT and the target (Guid: " UI64FMTD " Entry: %u Type: %u) already has the aura", e.action.cast.spell, (*itr)->GetGUID(), (*itr)->GetEntry(), uint32((*itr)->GetTypeId())); + me->CastSpell((*itr)->ToUnit(), e.action.cast.spell, (e.action.cast.flags & SMARTCAST_TRIGGERED) ? true : false); TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_CAST:: Creature %u casts spell %u on target %u with castflags %u", me->GetGUIDLow(), e.action.cast.spell, (*itr)->GetGUIDLow(), e.action.cast.flags); } + else + TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "Spell %u not casted because it has flag SMARTCAST_AURA_NOT_PRESENT and the target (Guid: " UI64FMTD " Entry: %u Type: %u) already has the aura", e.action.cast.spell, (*itr)->GetGUID(), (*itr)->GetEntry(), uint32((*itr)->GetTypeId())); } delete targets; @@ -536,19 +538,20 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) { - if (IsUnit(*itr)) - { - if (e.action.cast.flags & SMARTCAST_INTERRUPT_PREVIOUS) - tempLastInvoker->InterruptNonMeleeSpells(false); + if (!IsUnit(*itr)) + continue; if (!(e.action.cast.flags & SMARTCAST_AURA_NOT_PRESENT) || !(*itr)->ToUnit()->HasAura(e.action.cast.spell)) + { + if (e.action.cast.flags & SMARTCAST_INTERRUPT_PREVIOUS) + tempLastInvoker->InterruptNonMeleeSpells(false); + tempLastInvoker->CastSpell((*itr)->ToUnit(), e.action.cast.spell, (e.action.cast.flags & SMARTCAST_TRIGGERED) ? true : false); + TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_INVOKER_CAST: Invoker %u casts spell %u on target %u with castflags %u", + tempLastInvoker->GetGUIDLow(), e.action.cast.spell, (*itr)->GetGUIDLow(), e.action.cast.flags); + } else TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "Spell %u not casted because it has flag SMARTCAST_AURA_NOT_PRESENT and the target (Guid: " UI64FMTD " Entry: %u Type: %u) already has the aura", e.action.cast.spell, (*itr)->GetGUID(), (*itr)->GetEntry(), uint32((*itr)->GetTypeId())); - - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_INVOKER_CAST: Invoker %u casts spell %u on target %u with castflags %u", - tempLastInvoker->GetGUIDLow(), e.action.cast.spell, (*itr)->GetGUIDLow(), e.action.cast.flags); - } } delete targets; @@ -1659,21 +1662,28 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u for (ObjectList::const_iterator itr = casters->begin(); itr != casters->end(); ++itr) { - if (IsUnit(*itr)) - { - if (e.action.cast.flags & SMARTCAST_INTERRUPT_PREVIOUS) - (*itr)->ToUnit()->InterruptNonMeleeSpells(false); + if (!IsUnit(*itr)) + continue; - for (ObjectList::const_iterator it = targets->begin(); it != targets->end(); ++it) + bool interruptedSpell = false; + + for (ObjectList::const_iterator it = targets->begin(); it != targets->end(); ++it) + { + if (!IsUnit(*it)) + continue; + + if (!(e.action.cast.flags & SMARTCAST_AURA_NOT_PRESENT) || !(*it)->ToUnit()->HasAura(e.action.cast.spell)) { - if (IsUnit(*it)) + if (!interruptedSpell && e.action.cast.flags & SMARTCAST_INTERRUPT_PREVIOUS) { - if (!(e.action.cast.flags & SMARTCAST_AURA_NOT_PRESENT) || !(*it)->ToUnit()->HasAura(e.action.cast.spell)) - (*itr)->ToUnit()->CastSpell((*it)->ToUnit(), e.action.cast.spell, (e.action.cast.flags & SMARTCAST_TRIGGERED) ? true : false); - else - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "Spell %u not casted because it has flag SMARTCAST_AURA_NOT_PRESENT and the target (Guid: " UI64FMTD " Entry: %u Type: %u) already has the aura", e.action.cast.spell, (*it)->GetGUID(), (*it)->GetEntry(), uint32((*it)->GetTypeId())); + (*itr)->ToUnit()->InterruptNonMeleeSpells(false); + interruptedSpell = true; } + + (*itr)->ToUnit()->CastSpell((*it)->ToUnit(), e.action.cast.spell, (e.action.cast.flags & SMARTCAST_TRIGGERED) ? true : false); } + else + TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "Spell %u not casted because it has flag SMARTCAST_AURA_NOT_PRESENT and the target (Guid: " UI64FMTD " Entry: %u Type: %u) already has the aura", e.action.cast.spell, (*it)->GetGUID(), (*it)->GetEntry(), uint32((*it)->GetTypeId())); } } From 731b3670febaf72d89776a05164f7663f45821ee Mon Sep 17 00:00:00 2001 From: LilleCarl Date: Fri, 11 Oct 2013 21:49:06 +0200 Subject: [PATCH 05/15] Make damage and healing references, so that damage can be altered by scripts! Correct typo (thanks AwkwardDev) --- src/server/game/Scripting/ScriptMgr.cpp | 4 ++-- src/server/game/Scripting/ScriptMgr.h | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp index fb96c327b05..26b3bb5f78f 100644 --- a/src/server/game/Scripting/ScriptMgr.cpp +++ b/src/server/game/Scripting/ScriptMgr.cpp @@ -1363,12 +1363,12 @@ void ScriptMgr::OnGroupDisband(Group* group) } // Unit -void ScriptMgr::OnHeal(Unit* healer, Unit* reciever, uint32 gain) +void ScriptMgr::OnHeal(Unit* healer, Unit* reciever, uint32& gain) { FOREACH_SCRIPT(UnitScript)->OnHeal(healer, reciever, gain); } -void ScriptMgr::OnDamage(Unit* attacker, Unit* victim, uint32 damage) +void ScriptMgr::OnDamage(Unit* attacker, Unit* victim, uint32& damage) { FOREACH_SCRIPT(UnitScript)->OnDamage(attacker, victim, damage); } diff --git a/src/server/game/Scripting/ScriptMgr.h b/src/server/game/Scripting/ScriptMgr.h index a3eff880bb9..37a95c77254 100644 --- a/src/server/game/Scripting/ScriptMgr.h +++ b/src/server/game/Scripting/ScriptMgr.h @@ -396,11 +396,11 @@ class UnitScript : public ScriptObject UnitScript(const char* name, bool addToScripts = true); public: - // Called when a unit deals damage to another unit - virtual void OnHeal(Unit* /*healer*/, Unit* /*reciever*/, uint32 /*gain*/) { } + // Called when a unit deals healing to another unit + virtual void OnHeal(Unit* /*healer*/, Unit* /*reciever*/, uint32& /*gain*/) { } // Called when a unit deals damage to another unit - virtual void OnDamage(Unit* /*attacker*/, Unit* /*victim*/, uint32 /*damage*/) { } + virtual void OnDamage(Unit* /*attacker*/, Unit* /*victim*/, uint32& /*damage*/) { } // Called when DoT's Tick Damage is being Dealt virtual void ModifyPeriodicDamageAurasTick(Unit* /*target*/, Unit* /*attacker*/, uint32& /*damage*/) { } @@ -1060,8 +1060,8 @@ class ScriptMgr public: /* UnitScript */ - void OnHeal(Unit* healer, Unit* reciever, uint32 gain); - void OnDamage(Unit* attacker, Unit* victim, uint32 damage); + void OnHeal(Unit* healer, Unit* reciever, uint32& gain); + void OnDamage(Unit* attacker, Unit* victim, uint32& damage); void ModifyPeriodicDamageAurasTick(Unit* target, Unit* attacker, uint32& damage); void ModifyMeleeDamage(Unit* target, Unit* attacker, uint32& damage); void ModifySpellDamageTaken(Unit* target, Unit* attacker, int32& damage); From 9f50caeb50d4b0056cd953ec21284453139dfc08 Mon Sep 17 00:00:00 2001 From: Filip Date: Sat, 12 Oct 2013 04:37:37 +0200 Subject: [PATCH 06/15] DB/SAI: Updates for I've got a flying machine --- sql/updates/world/2013_10_12_00_world_sai.sql | 74 +++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 sql/updates/world/2013_10_12_00_world_sai.sql diff --git a/sql/updates/world/2013_10_12_00_world_sai.sql b/sql/updates/world/2013_10_12_00_world_sai.sql new file mode 100644 index 00000000000..914fbba5f50 --- /dev/null +++ b/sql/updates/world/2013_10_12_00_world_sai.sql @@ -0,0 +1,74 @@ +-- Fix I've Got a Flying Machine +-- Steel Gate Chief Archaeologist SAI & Text & Condition +SET @ENTRY := 24399; +SET @ENTRY1 := 24418; +SET @ENTRY2 := 24439; +SET @ENTRY3 := 24438; +SET @STALKER := 105997; +SET @MENUID := 8954; +SET @OPTION := 0; + +DELETE FROM `creature_template_addon` WHERE `entry`=24418; +INSERT INTO `creature_template_addon` (`entry`,`path_id`,`mount`,`bytes1`,`bytes2`,`emote`,`auras`) VALUES +(24418, 0, 0, 0, 0x1, 0x1, '43775 43889'); -- Steel Gate Flying Machine - Flight Drop Off Buff + +UPDATE `creature_template` SET `AIName`= 'SmartAI' WHERE `entry`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@ENTRY,0,0,1,62,0,100,0,@MENUID,@OPTION,0,0,11,45973,1,0,0,0,0,7,0,0,0,0,0,0,0, 'Steel Gate Chief Archaeologist - On gossip option select - Cast spell'), +(@ENTRY,0,1,2,61,0,100,0,0,0,0,0,72,0,0,0,0,0,0,7,0,0,0,0,0,0,0, 'Steel Gate Chief Archaeologist - On Link - Close gossip'), +(@ENTRY,0,2,0,61,0,100,0,0,0,0,0,11,43767,0,0,0,0,0,7,0,0,0,0,0,0,0, 'Steel Gate Chief Archaeologist - On Link - Cast Invoker'), +(@ENTRY,0,3,4,19,0,100,0,11390,0,0,0,11,45973,1,0,0,0,0,7,0,0,0,0,0,0,0, 'Steel Gate Chief Archaeologist - On Quest Accept - Cast spell'), +(@ENTRY,0,4,0,61,0,100,0,0,0,0,0,11,43767,0,0,0,0,0,7,0,0,0,0,0,0,0, 'Steel Gate Chief Archaeologist - On Link - Cast Invoker'), +(@ENTRY,0,5,6,19,0,100,0,11390,0,0,0,12,@ENTRY3,3,120000,0,0,0,8,0,0,0,1972.773,-3265.381,134.719,0, 'Steel Gate Chief Archaeologist - On Quest Accept - Summon Graple Target'); + +DELETE FROM `spell_area` WHERE `spell`=43889; +INSERT INTO `spell_area` (`spell`, `area`, `quest_start`, `quest_end`, `aura_spell`, `racemask`, `gender`, `autocast`, `quest_start_status`, `quest_end_status`) VALUES +(43889, 3999, 11390, 0, 0, 0, 2, 1, 8, 0); + +UPDATE `creature_template` SET `modelid1`=11686, `modelid2`=0, `AIName`= 'SmartAI', `type_flags`=1048576 WHERE `entry`=@ENTRY3; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY3; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@ENTRY3,0,0,0,54,0,100,0,0,0,0,0,11,43890,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Grapple Target - Just Summoned - Cast Invisibility on self'); + +DELETE FROM `npc_spellclick_spells` WHERE `npc_entry`= @ENTRY1; +INSERT INTO `npc_spellclick_spells` (`npc_entry`, `spell_id`, `cast_flags`, `user_type`) VALUES +(@ENTRY1, 43768, 1, 0); + +-- Gossip conditions +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=15 AND `SourceGroup`=@MENUID AND `SourceEntry`=@OPTION; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(15,@MENUID,@OPTION,0,9,11390,0,0,0,'','Show gossip option 0 if player has quest I''ve got a Flying Machine'); + +DELETE FROM `conditions` WHERE `SourceEntry`=@ENTRY1; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(16, 0, @ENTRY1, 0, 23, 3999, 0, 0, 0, '', 'Dismount player when not in intended zone'); +-- Condition for Grappling Hook spell(43770) +DELETE FROM `conditions` WHERE `SourceEntry`=43770; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(13, 1, 43770, 0, 31, 3, 24439, 0, 0, '', 'Spell 43770(Grappling Hook) targets npc 24439(Sack of Relics)'); +-- Spell Conditions +DELETE FROM `conditions` WHERE `SourceEntry`IN (43891,43892,43789); +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(13, 1, 43892, 0, 31, 3, 24439, 0, 0, '', 'Spell 43892 targets npc 24439'), +(13, 1, 43891, 0, 29, @ENTRY2, 1, 0, 0, '', 'Spell 43892 targets npc 24439'), +(13, 1, 43789, 0, 31, 3, 24439, 0, 0, '', 'Spell 43892 targets npc 24439'); + +-- Sack of Relics SAI +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY2 AND `source_type`=0; +UPDATE `creature_template` SET AIName='SmartAI' WHERE entry=@ENTRY2; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@ENTRY2,0,0,0,8,0,100,0,43770,0,0,0,11,46598,0,0,0,0,0,7,0,0,0,0.0,0.0,0.0,0.0,'Sack of Relics - On Link - Mount Sack to vehicle'), +(@ENTRY2,0,1,2,8,0,100,1,43892,0,0,0,11,46598,0,0,0,0,0,10,105997,15214,0,0.0,0.0,0.0,0.0,' Sack of Relics - Remove Vehicle - In range'), +(@ENTRY2,0,2,3,61,0,100,1,0,0,0,0,11,36553,0,0,0,0,0,1,0,0,0,0.0,0.0,0.0,0.0,'Sack of Relics - On Link - Cast pet stay(36553)'), +(@ENTRY2,0,3,4,61,0,100,1,0,0,0,0,33,24439,0,0,0,0,0,21,20,0,0,0.0,0.0,0.0,0.0,'Sack of Relics - On Link - Quest Credit'), +(@ENTRY2,0,4,0,61,0,100,1,0,0,0,0,41,10000,0,0,0,0,0,1,0,0,0,0.0,0.0,0.0,0.0,'Sack of Relics - On Link - Despawn'); + +DELETE FROM `spell_linked_spell` WHERE `spell_trigger`=43770; +INSERT INTO `spell_linked_spell` (`spell_trigger`,`spell_effect`,`type`,`comment`) VALUES +(43770,43789,1,'Trigger grip beam'); + +DELETE FROM `smart_scripts` WHERE `entryorguid`=-@STALKER AND `source_type`=0; +UPDATE `creature_template` SET AIName='SmartAI' WHERE entry=15214; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(-@STALKER,0,0,0,1,0,100,0,0,0,0,0,11,43892,0,0,0,0,0,11,@ENTRY2,10,0,0.0,0.0,0.0,0.0,'Invisible Stalker - OOC - Cast Spell'); From db848f20453818f16f3ad3594755182bb330c878 Mon Sep 17 00:00:00 2001 From: Discover- Date: Sat, 12 Oct 2013 13:41:00 +0200 Subject: [PATCH 07/15] Core/Misc: Fix build after 731b3670febaf72d89776a05164f7663f45821ee (again..) --- src/server/game/Entities/Unit/Unit.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 985a110ff27..b1af72492d2 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -9581,8 +9581,10 @@ int32 Unit::DealHeal(Unit* victim, uint32 addhealth) if (addhealth) gain = victim->ModifyHealth(int32(addhealth)); + uint32 unsignedGain = gain; + // Hook for OnHeal Event - sScriptMgr->OnHeal(this, victim, gain); + sScriptMgr->OnHeal(this, victim, unsignedGain); Unit* unit = this; From 6f98e4106e6a8e03c0319dbb552c1b61bf47d9f3 Mon Sep 17 00:00:00 2001 From: jackpoz Date: Sun, 13 Oct 2013 18:30:59 +0200 Subject: [PATCH 08/15] Scripts/TheBlackMorass: Fix first 7 rifts spawn timings Partially revert 7e76ab97f895da1320106fad28e31d6b34c15443 to properly spawn first 7 rifts. Also allow only 1 EVENT_NEXT_PORTAL event at time. --- .../TheBlackMorass/instance_the_black_morass.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/instance_the_black_morass.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/instance_the_black_morass.cpp index d8dfa2f5cf6..19024172aa0 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/instance_the_black_morass.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/instance_the_black_morass.cpp @@ -196,7 +196,7 @@ public: TC_LOG_DEBUG(LOG_FILTER_TSCR, "Instance The Black Morass: Starting event."); InitWorldState(); m_auiEncounter[1] = IN_PROGRESS; - Events.ScheduleEvent(EVENT_NEXT_PORTAL, 15000); + ScheduleEventNextPortal(15000); } if (data == DONE) @@ -228,7 +228,7 @@ public: if (data == SPECIAL) { if (mRiftPortalCount < 7) - Events.ScheduleEvent(EVENT_NEXT_PORTAL, 5000); + ScheduleEventNextPortal(5000); } else m_auiEncounter[1] = data; @@ -336,10 +336,16 @@ public: ++mRiftPortalCount; DoUpdateWorldState(WORLD_STATE_BM_RIFT, mRiftPortalCount); DoSpawnPortal(); - Events.ScheduleEvent(EVENT_NEXT_PORTAL, RiftWaves[GetRiftWaveId()].NextPortalTime); + ScheduleEventNextPortal(RiftWaves[GetRiftWaveId()].NextPortalTime); } } + void ScheduleEventNextPortal(uint32 nextPortalTime) + { + if (nextPortalTime > 0) + Events.RescheduleEvent(EVENT_NEXT_PORTAL, nextPortalTime); + } + protected: EventMap Events; }; From ce17fb9d5e11cf05ca901d75ea0d047820654225 Mon Sep 17 00:00:00 2001 From: Filip Date: Sun, 13 Oct 2013 23:20:07 +0200 Subject: [PATCH 09/15] Db/Disable: Sibling Rivalry credit By @untaught fixes #11020 --- sql/updates/world/2013_10_13_00_world_disable.sql | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 sql/updates/world/2013_10_13_00_world_disable.sql diff --git a/sql/updates/world/2013_10_13_00_world_disable.sql b/sql/updates/world/2013_10_13_00_world_disable.sql new file mode 100644 index 00000000000..1c062837397 --- /dev/null +++ b/sql/updates/world/2013_10_13_00_world_disable.sql @@ -0,0 +1,3 @@ +DELETE FROM `disables` WHERE `entry` =56940; +INSERT INTO `disables` (`sourceType`, `entry`, `flags`, `params_0`, `params_1`, `comment`) VALUES +(0,56940,64,'','','Disable LOS check for Thorim Story Kill Credit'); From 0bdeb126360352740e83bafda4507c97b1daf2b4 Mon Sep 17 00:00:00 2001 From: joschiwald Date: Mon, 14 Oct 2013 16:46:03 +0200 Subject: [PATCH 10/15] Scripts/Ahnkahet: Prince Taldaram rewritten to BossAI Closes #10993 --- ...013_10_13_01_world_spelldifficulty_dbc.sql | 3 + .../Ahnkahet/boss_prince_taldaram.cpp | 534 +++++++++--------- 2 files changed, 261 insertions(+), 276 deletions(-) create mode 100644 sql/updates/world/2013_10_13_01_world_spelldifficulty_dbc.sql diff --git a/sql/updates/world/2013_10_13_01_world_spelldifficulty_dbc.sql b/sql/updates/world/2013_10_13_01_world_spelldifficulty_dbc.sql new file mode 100644 index 00000000000..4ebdf253422 --- /dev/null +++ b/sql/updates/world/2013_10_13_01_world_spelldifficulty_dbc.sql @@ -0,0 +1,3 @@ +DELETE FROM `spelldifficulty_dbc` WHERE `id` = 55959; +INSERT INTO `spelldifficulty_dbc` (`id`, `spellid0`, `spellid1`) VALUES +(55959, 55959, 59513); diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp index 2f01cc734e6..c642092cf71 100644 --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp @@ -29,11 +29,9 @@ enum Spells SPELL_FLAME_SPHERE_SPAWN_EFFECT = 55891, SPELL_FLAME_SPHERE_VISUAL = 55928, SPELL_FLAME_SPHERE_PERIODIC = 55926, - H_SPELL_FLAME_SPHERE_PERIODIC = 59508, SPELL_FLAME_SPHERE_DEATH_EFFECT = 55947, SPELL_BEAM_VISUAL = 60342, SPELL_EMBRACE_OF_THE_VAMPYR = 55959, - H_SPELL_EMBRACE_OF_THE_VAMPYR = 59513, SPELL_VANISH = 55964, CREATURE_FLAME_SPHERE = 30106, H_CREATURE_FLAME_SPHERE_1 = 31686, @@ -48,8 +46,8 @@ enum Misc DATA_SPHERE_DISTANCE = 15 }; -#define DATA_SPHERE_ANGLE_OFFSET 0.7f -#define DATA_GROUND_POSITION_Z 11.30809f +#define DATA_SPHERE_ANGLE_OFFSET 0.7f +#define DATA_GROUND_POSITION_Z 11.30809f enum Yells { @@ -61,315 +59,299 @@ enum Yells SAY_FEED = 5, SAY_VANISH = 6 }; -enum CombatPhase + +enum Events { - NORMAL, - CASTING_FLAME_SPHERES, - JUST_VANISHED, - VANISHED, - FEEDING + EVENT_CASTING_FLAME_SPHERES = 1, + EVENT_JUST_VANISHED, + EVENT_VANISHED, + EVENT_FEEDING, + + EVENT_BLOODTHIRST, + EVENT_FLAME_SPHERE, + EVENT_VANISH +}; + +enum Phase +{ + PHASE_NORMAL = 1, + PHASE_SPECIAL = 2 }; class boss_taldaram : public CreatureScript { -public: - boss_taldaram() : CreatureScript("boss_taldaram") { } + public: + boss_taldaram() : CreatureScript("boss_taldaram") { } - struct boss_taldaramAI : public ScriptedAI - { - boss_taldaramAI(Creature* creature) : ScriptedAI(creature) + struct boss_taldaramAI : public BossAI { - instance = creature->GetInstanceScript(); - me->SetDisableGravity(true); - } - - uint32 uiBloodthirstTimer; - uint32 uiVanishTimer; - uint32 uiWaitTimer; - uint32 uiEmbraceTimer; - uint32 uiEmbraceTakenDamage; - uint32 uiFlamesphereTimer; - uint32 uiPhaseTimer; - - uint64 uiEmbraceTarget; - - CombatPhase Phase; - - InstanceScript* instance; - - void Reset() OVERRIDE - { - uiBloodthirstTimer = 10*IN_MILLISECONDS; - uiVanishTimer = urand(25*IN_MILLISECONDS, 35*IN_MILLISECONDS); - uiEmbraceTimer = 20*IN_MILLISECONDS; - uiFlamesphereTimer = 5*IN_MILLISECONDS; - uiEmbraceTakenDamage = 0; - Phase = NORMAL; - uiPhaseTimer = 0; - uiEmbraceTarget = 0; - if (instance) - instance->SetBossState(DATA_PRINCE_TALDARAM, NOT_STARTED); - } - - void EnterCombat(Unit* /*who*/) OVERRIDE - { - if (instance) - instance->SetBossState(DATA_PRINCE_TALDARAM, IN_PROGRESS); - Talk(SAY_AGGRO); - } - - void UpdateAI(uint32 diff) OVERRIDE - { - if (!UpdateVictim()) - return; - if (uiPhaseTimer <= diff) + boss_taldaramAI(Creature* creature) : BossAI(creature, DATA_PRINCE_TALDARAM) { - switch (Phase) + me->SetDisableGravity(true); + } + + void Reset() OVERRIDE + { + _Reset(); + _embraceTargetGUID = 0; + _embraceTakenDamage = 0; + } + + void EnterCombat(Unit* /*who*/) OVERRIDE + { + _EnterCombat(); + Talk(SAY_AGGRO); + events.SetPhase(PHASE_NORMAL); + events.ScheduleEvent(EVENT_BLOODTHIRST, 10000); + events.ScheduleEvent(EVENT_VANISH, urand(25000, 35000)); + events.ScheduleEvent(EVENT_FLAME_SPHERE, 5000); + } + + void UpdateAI(uint32 diff) OVERRIDE + { + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) { - case CASTING_FLAME_SPHERES: + switch (eventId) { - Creature* pSpheres[3]; - - //DoCast(me, SPELL_FLAME_SPHERE_SUMMON_1); - pSpheres[0] = DoSpawnCreature(CREATURE_FLAME_SPHERE, 0, 0, 5, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10*IN_MILLISECONDS); - Unit* pSphereTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); - if (pSphereTarget && pSpheres[0]) + if (events.IsInPhase(PHASE_NORMAL)) { + case EVENT_BLOODTHIRST: + DoCast(me, SPELL_BLOODTHIRST); + events.ScheduleEvent(EVENT_BLOODTHIRST, 10000); + break; + case EVENT_FLAME_SPHERE: + DoCastVictim(SPELL_CONJURE_FLAME_SPHERE); + events.SetPhase(PHASE_SPECIAL); + events.ScheduleEvent(EVENT_CASTING_FLAME_SPHERES, 3000); + events.ScheduleEvent(EVENT_FLAME_SPHERE, 15000); + break; + case EVENT_VANISH: + { + Map::PlayerList const& players = me->GetMap()->GetPlayers(); + uint32 targets = 0; + for (Map::PlayerList::const_iterator i = players.begin(); i != players.end(); ++i) + { + Player* player = i->GetSource(); + if (player && player->IsAlive()) + ++targets; + } + + if (targets > 2) + { + Talk(SAY_VANISH); + DoCast(me, SPELL_VANISH); + events.SetPhase(PHASE_SPECIAL); + events.ScheduleEvent(EVENT_JUST_VANISHED, 500); + if (Unit* embraceTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + _embraceTargetGUID = embraceTarget->GetGUID(); + } + events.ScheduleEvent(EVENT_VANISH, urand(25000, 35000)); + break; + } + } + case EVENT_CASTING_FLAME_SPHERES: + { + events.SetPhase(PHASE_NORMAL); + Unit* sphereTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); + if (!sphereTarget) + break; + float angle, x, y; - angle = pSpheres[0]->GetAngle(pSphereTarget); - x = pSpheres[0]->GetPositionX() + DATA_SPHERE_DISTANCE * std::cos(angle); - y = pSpheres[0]->GetPositionY() + DATA_SPHERE_DISTANCE * std::sin(angle); - pSpheres[0]->GetMotionMaster()->MovePoint(0, x, y, pSpheres[0]->GetPositionZ()); - } - if (IsHeroic()) - { - //DoCast(me, H_SPELL_FLAME_SPHERE_SUMMON_1); - pSpheres[1] = DoSpawnCreature(H_CREATURE_FLAME_SPHERE_1, 0, 0, 5, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10*IN_MILLISECONDS); - //DoCast(me, H_SPELL_FLAME_SPHERE_SUMMON_2); - pSpheres[2] = DoSpawnCreature(H_CREATURE_FLAME_SPHERE_2, 0, 0, 5, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10*IN_MILLISECONDS); - if (pSphereTarget && pSpheres[1] && pSpheres[2]) - { - float angle, x, y; - angle = pSpheres[1]->GetAngle(pSphereTarget) + DATA_SPHERE_ANGLE_OFFSET; - x = pSpheres[1]->GetPositionX() + DATA_SPHERE_DISTANCE/2 * std::cos(angle); - y = pSpheres[1]->GetPositionY() + DATA_SPHERE_DISTANCE/2 * std::sin(angle); - pSpheres[1]->GetMotionMaster()->MovePoint(0, x, y, pSpheres[1]->GetPositionZ()); - angle = pSpheres[2]->GetAngle(pSphereTarget) - DATA_SPHERE_ANGLE_OFFSET; - x = pSpheres[2]->GetPositionX() + DATA_SPHERE_DISTANCE/2 * std::cos(angle); - y = pSpheres[2]->GetPositionY() + DATA_SPHERE_DISTANCE/2 * std::sin(angle); - pSpheres[2]->GetMotionMaster()->MovePoint(0, x, y, pSpheres[2]->GetPositionZ()); - } - } - Phase = NORMAL; - uiPhaseTimer = 0; - break; - } - case JUST_VANISHED: - if (Unit* pEmbraceTarget = GetEmbraceTarget()) - { + //DoCast(me, SPELL_FLAME_SPHERE_SUMMON_1); + if (Creature* sphere = DoSpawnCreature(CREATURE_FLAME_SPHERE, 0, 0, 5, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10 * IN_MILLISECONDS)) + { + angle = sphere->GetAngle(sphereTarget); + x = sphere->GetPositionX() + DATA_SPHERE_DISTANCE * std::cos(angle); + y = sphere->GetPositionY() + DATA_SPHERE_DISTANCE * std::sin(angle); + sphere->GetMotionMaster()->MovePoint(0, x, y, sphere->GetPositionZ()); + } + + if (IsHeroic()) + { + //DoCast(me, H_SPELL_FLAME_SPHERE_SUMMON_1); + if (Creature* sphere = DoSpawnCreature(H_CREATURE_FLAME_SPHERE_1, 0, 0, 5, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10 * IN_MILLISECONDS)) + { + angle = sphere->GetAngle(sphereTarget) + DATA_SPHERE_ANGLE_OFFSET; + x = sphere->GetPositionX() + DATA_SPHERE_DISTANCE/2 * std::cos(angle); + y = sphere->GetPositionY() + DATA_SPHERE_DISTANCE/2 * std::sin(angle); + sphere->GetMotionMaster()->MovePoint(0, x, y, sphere->GetPositionZ()); + } + + //DoCast(me, H_SPELL_FLAME_SPHERE_SUMMON_2); + if (Creature* sphere = DoSpawnCreature(H_CREATURE_FLAME_SPHERE_2, 0, 0, 5, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10 * IN_MILLISECONDS)) + { + angle = sphere->GetAngle(sphereTarget) - DATA_SPHERE_ANGLE_OFFSET; + x = sphere->GetPositionX() + DATA_SPHERE_DISTANCE/2 * std::cos(angle); + y = sphere->GetPositionY() + DATA_SPHERE_DISTANCE/2 * std::sin(angle); + sphere->GetMotionMaster()->MovePoint(0, x, y, sphere->GetPositionZ()); + } + } + break; + } + case EVENT_JUST_VANISHED: + if (Unit* embraceTarget = GetEmbraceTarget()) + { + me->GetMotionMaster()->Clear(); + me->SetSpeed(MOVE_WALK, 2.0f, true); + me->GetMotionMaster()->MoveChase(embraceTarget); + } + events.ScheduleEvent(EVENT_VANISHED, 1300); + break; + case EVENT_VANISHED: + if (Unit* embraceTarget = GetEmbraceTarget()) + DoCast(embraceTarget, SPELL_EMBRACE_OF_THE_VAMPYR); + Talk(SAY_FEED); me->GetMotionMaster()->Clear(); - me->SetSpeed(MOVE_WALK, 2.0f, true); - me->GetMotionMaster()->MoveChase(pEmbraceTarget); - } - Phase = VANISHED; - uiPhaseTimer = 1300; - break; - case VANISHED: - if (Unit* pEmbraceTarget = GetEmbraceTarget()) - DoCast(pEmbraceTarget, DUNGEON_MODE(SPELL_EMBRACE_OF_THE_VAMPYR, H_SPELL_EMBRACE_OF_THE_VAMPYR)); - Talk(SAY_FEED); - me->GetMotionMaster()->Clear(); - me->SetSpeed(MOVE_WALK, 1.0f, true); - me->GetMotionMaster()->MoveChase(me->GetVictim()); - Phase = FEEDING; - uiPhaseTimer = 20*IN_MILLISECONDS; - break; - case FEEDING: - Phase = NORMAL; - uiPhaseTimer = 0; - uiEmbraceTarget = 0; - break; - case NORMAL: - if (uiBloodthirstTimer <= diff) - { - DoCast(me, SPELL_BLOODTHIRST); - uiBloodthirstTimer = 10*IN_MILLISECONDS; - } else uiBloodthirstTimer -= diff; - - if (uiFlamesphereTimer <= diff) - { - // because TARGET_UNIT_TARGET_ENEMY we need a target selected to cast - DoCastVictim(SPELL_CONJURE_FLAME_SPHERE); - Phase = CASTING_FLAME_SPHERES; - uiPhaseTimer = 3*IN_MILLISECONDS + diff; - uiFlamesphereTimer = 15*IN_MILLISECONDS; - } else uiFlamesphereTimer -= diff; - - if (uiVanishTimer <= diff) - { - //Count alive players - Unit* target = NULL; - std::list t_list = me->getThreatManager().getThreatList(); - std::vector target_list; - for (std::list::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) - { - target = Unit::GetUnit(*me, (*itr)->getUnitGuid()); - // exclude pets & totems - if (target && target->GetTypeId() == TYPEID_PLAYER && target->IsAlive()) - target_list.push_back(target); - target = NULL; - } - //He only vanishes if there are 3 or more alive players - if (target_list.size() > 2) - { - Talk(SAY_VANISH); - DoCast(me, SPELL_VANISH); - Phase = JUST_VANISHED; - uiPhaseTimer = 500; - if (Unit* pEmbraceTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - uiEmbraceTarget = pEmbraceTarget->GetGUID(); - - } - uiVanishTimer = urand(25*IN_MILLISECONDS, 35*IN_MILLISECONDS); - } else uiVanishTimer -= diff; - - DoMeleeAttackIfReady(); - break; + me->SetSpeed(MOVE_WALK, 1.0f, true); + me->GetMotionMaster()->MoveChase(me->GetVictim()); + events.ScheduleEvent(EVENT_FEEDING, 20000); + break; + case EVENT_FEEDING: + _embraceTargetGUID = 0; + events.SetPhase(PHASE_NORMAL); + break; + default: + break; + } } - } else uiPhaseTimer -= diff; - } - void DamageTaken(Unit* /*done_by*/, uint32 &damage) OVERRIDE - { - Unit* pEmbraceTarget = GetEmbraceTarget(); - - if (Phase == FEEDING && pEmbraceTarget && pEmbraceTarget->IsAlive()) - { - uiEmbraceTakenDamage += damage; - if (uiEmbraceTakenDamage > (uint32) DUNGEON_MODE(DATA_EMBRACE_DMG, H_DATA_EMBRACE_DMG)) - { - Phase = NORMAL; - uiPhaseTimer = 0; - uiEmbraceTarget = 0; - me->CastStop(); - } + DoMeleeAttackIfReady(); } - } - void JustDied(Unit* /*killer*/) OVERRIDE - { - Talk(SAY_DEATH); - - if (instance) - instance->SetBossState(DATA_PRINCE_TALDARAM, DONE); - } - - void KilledUnit(Unit* victim) OVERRIDE - { - if (victim->GetTypeId() != TYPEID_PLAYER) - return; - - Unit* pEmbraceTarget = GetEmbraceTarget(); - if (Phase == FEEDING && pEmbraceTarget && victim == pEmbraceTarget) + void DamageTaken(Unit* /*doneBy*/, uint32& damage) OVERRIDE { - Phase = NORMAL; - uiPhaseTimer = 0; - uiEmbraceTarget = 0; + Unit* embraceTarget = GetEmbraceTarget(); + + if (events.IsInPhase(PHASE_SPECIAL) && embraceTarget && embraceTarget->IsAlive()) + { + _embraceTakenDamage += damage; + if (_embraceTakenDamage > DUNGEON_MODE(DATA_EMBRACE_DMG, H_DATA_EMBRACE_DMG)) + { + _embraceTargetGUID = 0; + events.SetPhase(PHASE_NORMAL); + me->CastStop(); + } + } } - Talk(SAY_SLAY); - } - bool CheckSpheres() - { - for (uint8 i = 0; i < 2; ++i) - if (!instance->GetData(DATA_SPHERE_1 + i)) - return false; + void JustDied(Unit* /*killer*/) OVERRIDE + { + Talk(SAY_DEATH); + _JustDied(); + } - RemovePrison(); - return true; - } + void KilledUnit(Unit* victim) OVERRIDE + { + if (victim->GetTypeId() != TYPEID_PLAYER) + return; + + Unit* embraceTarget = GetEmbraceTarget(); + if (events.IsInPhase(PHASE_SPECIAL) && embraceTarget && victim == embraceTarget) + { + _embraceTargetGUID = 0; + events.SetPhase(PHASE_NORMAL); + } + Talk(SAY_SLAY); + } + + bool CheckSpheres() + { + for (uint8 i = 0; i < 2; ++i) + if (!instance->GetData(DATA_SPHERE_1 + i)) + return false; + + RemovePrison(); + return true; + } + + Unit* GetEmbraceTarget() + { + if (_embraceTargetGUID) + return ObjectAccessor::GetUnit(*me, _embraceTargetGUID); - Unit* GetEmbraceTarget() - { - if (!uiEmbraceTarget) return NULL; + } - return Unit::GetUnit(*me, uiEmbraceTarget); - } + void RemovePrison() + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->RemoveAurasDueToSpell(SPELL_BEAM_VISUAL); + me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), DATA_GROUND_POSITION_Z, me->GetOrientation()); + DoCast(SPELL_HOVER_FALL); + me->SetDisableGravity(false); + me->GetMotionMaster()->MovePoint(0, me->GetHomePosition()); + Talk(SAY_WARNING); + instance->HandleGameObject(instance->GetData64(DATA_PRINCE_TALDARAM_PLATFORM), true); + } - void RemovePrison() + private: + uint64 _embraceTargetGUID; + uint32 _embraceTakenDamage; + }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE { - if (!instance) - return; - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->RemoveAurasDueToSpell(SPELL_BEAM_VISUAL); - me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), DATA_GROUND_POSITION_Z, me->GetOrientation()); - DoCast(SPELL_HOVER_FALL); - me->SetDisableGravity(false); - me->GetMotionMaster()->MovePoint(0, me->GetHomePosition()); - Talk(SAY_WARNING); - uint64 prison_GUID = instance->GetData64(DATA_PRINCE_TALDARAM_PLATFORM); - instance->HandleGameObject(prison_GUID, true); + return GetAhnKahetAI(creature); } - }; - - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return GetAhnKahetAI(creature); - } }; class npc_taldaram_flamesphere : public CreatureScript { -public: - npc_taldaram_flamesphere() : CreatureScript("npc_taldaram_flamesphere") { } + public: + npc_taldaram_flamesphere() : CreatureScript("npc_taldaram_flamesphere") { } - struct npc_taldaram_flamesphereAI : public ScriptedAI - { - npc_taldaram_flamesphereAI(Creature* creature) : ScriptedAI(creature) + struct npc_taldaram_flamesphereAI : public ScriptedAI { - instance = creature->GetInstanceScript(); - } + npc_taldaram_flamesphereAI(Creature* creature) : ScriptedAI(creature) + { + } - uint32 uiDespawnTimer; - InstanceScript* instance; + void Reset() OVERRIDE + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + //! HACK: Creature's can't have MOVEMENTFLAG_FLYING + me->AddUnitMovementFlag(MOVEMENTFLAG_FLYING); + me->setFaction(16); + me->SetObjectScale(1.0f); + DoCast(me, SPELL_FLAME_SPHERE_VISUAL); + DoCast(me, SPELL_FLAME_SPHERE_SPAWN_EFFECT); + DoCast(me, SPELL_FLAME_SPHERE_PERIODIC); + _despawnTimer = 10 * IN_MILLISECONDS; + } - void Reset() OVERRIDE + void EnterCombat(Unit* /*who*/) OVERRIDE { } + void MoveInLineOfSight(Unit* /*who*/) OVERRIDE { } + + void JustDied(Unit* /*killer*/) OVERRIDE + { + DoCast(me, SPELL_FLAME_SPHERE_DEATH_EFFECT); + } + + void UpdateAI(uint32 diff) OVERRIDE + { + if (_despawnTimer <= diff) + me->DisappearAndDie(); + else + _despawnTimer -= diff; + } + + private: + uint32 _despawnTimer; + }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - //! HACK: Creature's can't have MOVEMENTFLAG_FLYING - me->AddUnitMovementFlag(MOVEMENTFLAG_FLYING); - me->setFaction(16); - me->SetObjectScale(1.0f); - DoCast(me, SPELL_FLAME_SPHERE_VISUAL); - DoCast(me, SPELL_FLAME_SPHERE_SPAWN_EFFECT); - DoCast(me, SPELL_FLAME_SPHERE_PERIODIC); - uiDespawnTimer = 10*IN_MILLISECONDS; + return new npc_taldaram_flamesphereAI(creature); } - - void EnterCombat(Unit* /*who*/) OVERRIDE {} - void MoveInLineOfSight(Unit* /*who*/) OVERRIDE {} - - - void JustDied(Unit* /*killer*/) OVERRIDE - { - DoCast(me, SPELL_FLAME_SPHERE_DEATH_EFFECT); - } - - void UpdateAI(uint32 diff) OVERRIDE - { - if (uiDespawnTimer <= diff) - me->DisappearAndDie(); - else - uiDespawnTimer -= diff; - } - }; - - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new npc_taldaram_flamesphereAI(creature); - } }; class prince_taldaram_sphere : public GameObjectScript @@ -377,7 +359,7 @@ class prince_taldaram_sphere : public GameObjectScript public: prince_taldaram_sphere() : GameObjectScript("prince_taldaram_sphere") { } - bool OnGossipHello(Player* /*player*/, GameObject* go) + bool OnGossipHello(Player* /*player*/, GameObject* go) OVERRIDE { InstanceScript* instance = go->GetInstanceScript(); if (!instance) From 82eda3244ae97de3e6aebf352c134b03ff24e035 Mon Sep 17 00:00:00 2001 From: Discover- Date: Mon, 14 Oct 2013 16:56:09 +0200 Subject: [PATCH 11/15] Core/Misc: Ugh.. Fix recent commit that broke the OnHeal hook :disappointed_relieved: --- src/server/game/Entities/Unit/Unit.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index b1af72492d2..74c50145311 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -9581,10 +9581,8 @@ int32 Unit::DealHeal(Unit* victim, uint32 addhealth) if (addhealth) gain = victim->ModifyHealth(int32(addhealth)); - uint32 unsignedGain = gain; - // Hook for OnHeal Event - sScriptMgr->OnHeal(this, victim, unsignedGain); + sScriptMgr->OnHeal(this, victim, (uint32&)gain); Unit* unit = this; From 53167ea9a12276c83aa296139be7733c3de4fa84 Mon Sep 17 00:00:00 2001 From: joschiwald Date: Mon, 14 Oct 2013 17:04:55 +0200 Subject: [PATCH 12/15] Fix build. --- .../Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp index c642092cf71..e3688cc780c 100644 --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp @@ -17,6 +17,7 @@ #include "ScriptMgr.h" #include "ScriptedCreature.h" +#include "Map.h" #include "ahnkahet.h" enum Spells From 186e0852d780d67fae74ce42effca1f689b7a001 Mon Sep 17 00:00:00 2001 From: joschiwald Date: Mon, 14 Oct 2013 17:13:27 +0200 Subject: [PATCH 13/15] Fix non-pch build. --- .../Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp index e3688cc780c..e0098570923 100644 --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp @@ -17,7 +17,7 @@ #include "ScriptMgr.h" #include "ScriptedCreature.h" -#include "Map.h" +#include "Player.h" #include "ahnkahet.h" enum Spells From b1c706a1eb7ce808189f800f7f52a297a78f60f3 Mon Sep 17 00:00:00 2001 From: Baeumchen Date: Tue, 15 Oct 2013 06:02:55 +0200 Subject: [PATCH 14/15] Just, because this typo was annoying... --- src/server/game/Spells/SpellMgr.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 29a869cf458..ff89cc61f6f 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -1855,7 +1855,7 @@ void SpellMgr::LoadSpellProcEvents() } if (!spellInfo->ProcFlags && !spellProcEvent.procFlags) - TC_LOG_ERROR(LOG_FILTER_SQL, "Spell %u listed in `spell_proc_event` probally not triggered spell", spellInfo->Id); + TC_LOG_ERROR(LOG_FILTER_SQL, "Spell %u listed in `spell_proc_event` probably not triggered spell", spellInfo->Id); mSpellProcEventMap[spellInfo->Id] = spellProcEvent; From 53cc37bceca9ce7de1b9839251ccc809ebf768b6 Mon Sep 17 00:00:00 2001 From: Gacko Date: Tue, 15 Oct 2013 20:22:28 +0200 Subject: [PATCH 15/15] CMake: Fix typo Running cmake threw a warning because of this. --- cmake/genrev.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/genrev.cmake b/cmake/genrev.cmake index b39a0780b1c..ceeed7bfac7 100644 --- a/cmake/genrev.cmake +++ b/cmake/genrev.cmake @@ -58,7 +58,7 @@ else() # No valid ways available to find/set the revision/hash, so let's force some defaults message(STATUS " Could not find a proper repository signature (hash) - you may need to pull tags with git fetch -t - Continuing anyway - note that the versionstring will be set to \"unknown 1970-01-01 00:00:00 (Archived)"\") + Continuing anyway - note that the versionstring will be set to \"unknown 1970-01-01 00:00:00 (Archived)\"") set(rev_date "1970-01-01 00:00:00 +0000") set(rev_hash "unknown") set(rev_branch "Archived")