2010-07-06 03:27:41 +02:00
/*
2012-01-01 00:32:13 +01:00
* Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
2010-07-06 03:27:41 +02:00
* Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
2008-10-21 13:19:26 -05:00
*
2010-07-06 03:27:41 +02:00
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
2008-10-21 13:19:26 -05:00
*
2010-07-06 03:27:41 +02:00
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
2008-10-21 13:19:26 -05:00
*/
2009-10-17 15:51:44 -07:00
2008-10-21 13:19:26 -05:00
/* ScriptData
SDName: Netherstorm
2010-08-26 11:36:26 +02:00
SD%Complete: 80
2011-04-29 20:47:02 +02:00
SDComment: Quest support: 10337, 10438, 10652 (special flight paths), 10299, 10321, 10322, 10323, 10329, 10330, 10338, 10365(Shutting Down Manaforge), 10198, 10191
2008-10-21 13:19:26 -05:00
SDCategory: Netherstorm
EndScriptData */
2009-10-17 15:51:44 -07:00
2008-10-21 13:19:26 -05:00
/* ContentData
npc_manaforge_control_console
go_manaforge_control_console
2008-12-20 19:10:00 +01:00
npc_commander_dawnforge
2009-01-14 19:33:55 +01:00
npc_bessy
2010-08-26 11:36:26 +02:00
npc_maxx_a_million
2011-12-25 00:36:17 +01:00
go_captain_tyralius_prison
2008-10-21 13:19:26 -05:00
EndContentData */
2009-10-17 15:51:44 -07:00
2012-07-29 21:40:10 +02:00
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
2010-01-19 11:36:05 +01:00
#include "ScriptedEscortAI.h"
2012-11-17 05:18:37 +01:00
#include "Player.h"
2009-10-17 15:51:44 -07:00
2008-10-21 13:19:26 -05:00
/*######
## npc_manaforge_control_console
######*/
2009-10-17 15:51:44 -07:00
2011-04-29 20:47:02 +02:00
//used by 20209, 20417, 20418, 20440, signed for 20209
2010-09-05 02:16:58 +06:00
enum eManaforgeConsoleData
{
2012-12-07 10:04:40 +01:00
EMOTE_START = 0 ,
EMOTE_60 = 1 ,
EMOTE_30 = 2 ,
EMOTE_10 = 3 ,
EMOTE_COMPLETE = 4 ,
EMOTE_ABORT = 5 ,
2010-09-05 02:16:58 +06:00
ENTRY_BNAAR_C_CONSOLE = 20209 ,
ENTRY_CORUU_C_CONSOLE = 20417 ,
ENTRY_DURO_C_CONSOLE = 20418 ,
ENTRY_ARA_C_CONSOLE = 20440 ,
ENTRY_SUNFURY_TECH = 20218 ,
ENTRY_SUNFURY_PROT = 20436 ,
ENTRY_ARA_TECH = 20438 ,
ENTRY_ARA_ENGI = 20439 ,
ENTRY_ARA_GORKLONN = 20460 ,
SPELL_DISABLE_VISUAL = 35031 ,
SPELL_INTERRUPT_1 = 35016 , //ACID mobs should cast this
SPELL_INTERRUPT_2 = 35176 , //ACID mobs should cast this (Manaforge Ara-version)
};
2010-08-09 00:56:10 +06:00
class npc_manaforge_control_console : public CreatureScript
2008-10-21 13:19:26 -05:00
{
2010-08-08 22:54:58 +06:00
public :
npc_manaforge_control_console () : CreatureScript ( "npc_manaforge_control_console" ) { }
2009-10-17 15:51:44 -07:00
2011-07-02 22:18:03 +02:00
CreatureAI * GetAI ( Creature * creature ) const
2008-10-21 13:19:26 -05:00
{
2011-07-02 22:18:03 +02:00
return new npc_manaforge_control_consoleAI ( creature );
2008-10-21 13:19:26 -05:00
}
2009-10-17 15:51:44 -07:00
2010-08-08 22:54:58 +06:00
struct npc_manaforge_control_consoleAI : public ScriptedAI
2008-10-21 13:19:26 -05:00
{
2012-03-14 09:20:36 +08:00
npc_manaforge_control_consoleAI ( Creature * creature ) : ScriptedAI ( creature ) {}
2009-10-17 15:51:44 -07:00
2010-08-08 22:54:58 +06:00
uint32 Event_Timer ;
uint32 Wave_Timer ;
uint32 Phase ;
bool Wave ;
uint64 someplayer ;
uint64 goConsole ;
Creature * add ;
2009-10-17 15:51:44 -07:00
2010-08-08 22:54:58 +06:00
void Reset ()
2008-10-21 13:19:26 -05:00
{
2010-08-08 22:54:58 +06:00
Event_Timer = 3000 ;
Wave_Timer = 0 ;
Phase = 1 ;
Wave = false ;
someplayer = 0 ;
goConsole = 0 ;
add = NULL ;
2008-10-21 13:19:26 -05:00
}
2009-10-17 15:51:44 -07:00
2011-06-11 22:35:29 +02:00
void EnterCombat ( Unit * /*who*/ ) {}
2010-08-08 22:54:58 +06:00
2011-09-15 14:08:17 +02:00
/*void SpellHit(Unit* caster, const SpellInfo* spell)
2008-10-21 13:19:26 -05:00
{
2010-08-08 22:54:58 +06:00
//we have no way of telling the Creature was hit by spell -> got aura applied after 10-12 seconds
//then no way for the mobs to actually stop the shutdown as intended.
if (spell->Id == SPELL_INTERRUPT_1)
2011-04-29 20:47:02 +02:00
DoSay("Silence! I kill you!", LANG_UNIVERSAL, NULL);
2010-08-08 22:54:58 +06:00
}*/
2009-10-17 15:51:44 -07:00
2010-08-08 22:54:58 +06:00
void JustDied ( Unit * /*killer*/ )
2008-10-21 13:19:26 -05:00
{
2012-12-07 10:04:40 +01:00
Talk ( EMOTE_ABORT );
2010-08-08 22:54:58 +06:00
if ( someplayer )
{
2012-04-01 19:56:41 +08:00
Unit * p = Unit :: GetUnit ( * me , someplayer );
2010-08-08 22:54:58 +06:00
if ( p && p -> GetTypeId () == TYPEID_PLAYER )
2008-10-21 13:19:26 -05:00
{
2011-09-29 12:43:05 +02:00
switch ( me -> GetEntry ())
2010-08-08 22:54:58 +06:00
{
case ENTRY_BNAAR_C_CONSOLE :
CAST_PLR ( p ) -> FailQuest ( 10299 );
CAST_PLR ( p ) -> FailQuest ( 10329 );
break ;
case ENTRY_CORUU_C_CONSOLE :
CAST_PLR ( p ) -> FailQuest ( 10321 );
CAST_PLR ( p ) -> FailQuest ( 10330 );
break ;
case ENTRY_DURO_C_CONSOLE :
CAST_PLR ( p ) -> FailQuest ( 10322 );
CAST_PLR ( p ) -> FailQuest ( 10338 );
break ;
case ENTRY_ARA_C_CONSOLE :
CAST_PLR ( p ) -> FailQuest ( 10323 );
CAST_PLR ( p ) -> FailQuest ( 10365 );
break ;
}
2008-10-21 13:19:26 -05:00
}
2010-08-08 22:54:58 +06:00
}
if ( goConsole )
{
2012-04-01 19:56:41 +08:00
if ( GameObject * go = GameObject :: GetGameObject ( * me , goConsole ))
2011-10-07 19:45:43 -05:00
go -> RemoveFlag ( GAMEOBJECT_FLAGS , GO_FLAG_IN_USE );
2010-08-08 22:54:58 +06:00
}
2008-10-21 13:19:26 -05:00
}
2009-10-17 15:51:44 -07:00
2011-07-02 22:18:03 +02:00
void DoWaveSpawnForCreature ( Creature * creature )
2008-10-21 13:19:26 -05:00
{
2011-09-29 12:43:05 +02:00
switch ( creature -> GetEntry ())
2008-10-21 13:19:26 -05:00
{
2010-08-08 22:54:58 +06:00
case ENTRY_BNAAR_C_CONSOLE :
if ( rand () % 2 )
2008-10-21 13:19:26 -05:00
{
2011-04-29 20:47:02 +02:00
add = me -> SummonCreature ( ENTRY_SUNFURY_TECH , 2933.68f , 4162.55f , 164.00f , 1.60f , TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT , 120000 );
if ( add ) add -> GetMotionMaster () -> MovePoint ( 0 , 2927.36f , 4212.97f , 164.00f );
2008-10-21 13:19:26 -05:00
}
2010-08-08 22:54:58 +06:00
else
{
2011-04-29 20:47:02 +02:00
add = me -> SummonCreature ( ENTRY_SUNFURY_TECH , 2927.36f , 4212.97f , 164.00f , 4.94f , TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT , 120000 );
if ( add ) add -> GetMotionMaster () -> MovePoint ( 0 , 2933.68f , 4162.55f , 164.00f );
2010-08-08 22:54:58 +06:00
}
Wave_Timer = 30000 ;
2008-10-21 13:19:26 -05:00
break ;
2010-08-08 22:54:58 +06:00
case ENTRY_CORUU_C_CONSOLE :
2011-04-29 20:47:02 +02:00
add = me -> SummonCreature ( ENTRY_SUNFURY_TECH , 2445.21f , 2765.26f , 134.49f , 3.93f , TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT , 120000 );
if ( add ) add -> GetMotionMaster () -> MovePoint ( 0 , 2424.21f , 2740.15f , 133.81f );
add = me -> SummonCreature ( ENTRY_SUNFURY_TECH , 2429.86f , 2731.85f , 134.53f , 1.31f , TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT , 120000 );
if ( add ) add -> GetMotionMaster () -> MovePoint ( 0 , 2435.37f , 2766.04f , 133.81f );
2010-08-08 22:54:58 +06:00
Wave_Timer = 20000 ;
2008-10-21 13:19:26 -05:00
break ;
2010-08-08 22:54:58 +06:00
case ENTRY_DURO_C_CONSOLE :
2011-04-29 20:47:02 +02:00
add = me -> SummonCreature ( ENTRY_SUNFURY_TECH , 2986.80f , 2205.36f , 165.37f , 3.74f , TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT , 120000 );
if ( add ) add -> GetMotionMaster () -> MovePoint ( 0 , 2985.15f , 2197.32f , 164.79f );
add = me -> SummonCreature ( ENTRY_SUNFURY_TECH , 2952.91f , 2191.20f , 165.32f , 0.22f , TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT , 120000 );
if ( add ) add -> GetMotionMaster () -> MovePoint ( 0 , 2060.01f , 2185.27f , 164.67f );
2010-08-08 22:54:58 +06:00
Wave_Timer = 15000 ;
2008-10-21 13:19:26 -05:00
break ;
2010-08-08 22:54:58 +06:00
case ENTRY_ARA_C_CONSOLE :
if ( rand () % 2 )
2008-10-21 13:19:26 -05:00
{
2011-04-29 20:47:02 +02:00
add = me -> SummonCreature ( ENTRY_ARA_TECH , 4035.11f , 4038.97f , 194.27f , 2.57f , TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT , 120000 );
if ( add ) add -> GetMotionMaster () -> MovePoint ( 0 , 4003.42f , 4040.19f , 193.49f );
add = me -> SummonCreature ( ENTRY_ARA_TECH , 4033.66f , 4036.79f , 194.28f , 2.57f , TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT , 120000 );
if ( add ) add -> GetMotionMaster () -> MovePoint ( 0 , 4003.42f , 4040.19f , 193.49f );
add = me -> SummonCreature ( ENTRY_ARA_TECH , 4037.13f , 4037.30f , 194.23f , 2.57f , TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT , 120000 );
if ( add ) add -> GetMotionMaster () -> MovePoint ( 0 , 4003.42f , 4040.19f , 193.49f );
2008-10-21 13:19:26 -05:00
}
2010-08-08 22:54:58 +06:00
else
2008-10-21 13:19:26 -05:00
{
2011-04-29 20:47:02 +02:00
add = me -> SummonCreature ( ENTRY_ARA_TECH , 3099.59f , 4049.30f , 194.22f , 0.05f , TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT , 120000 );
if ( add ) add -> GetMotionMaster () -> MovePoint ( 0 , 4028.01f , 4035.17f , 193.59f );
add = me -> SummonCreature ( ENTRY_ARA_TECH , 3999.72f , 4046.75f , 194.22f , 0.05f , TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT , 120000 );
if ( add ) add -> GetMotionMaster () -> MovePoint ( 0 , 4028.01f , 4035.17f , 193.59f );
add = me -> SummonCreature ( ENTRY_ARA_TECH , 3996.81f , 4048.26f , 194.22f , 0.05f , TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT , 120000 );
if ( add ) add -> GetMotionMaster () -> MovePoint ( 0 , 4028.01f , 4035.17f , 193.59f );
2008-10-21 13:19:26 -05:00
}
2010-08-08 22:54:58 +06:00
Wave_Timer = 15000 ;
break ;
}
}
2011-07-02 22:18:03 +02:00
void DoFinalSpawnForCreature ( Creature * creature )
2010-08-08 22:54:58 +06:00
{
2011-09-29 12:43:05 +02:00
switch ( creature -> GetEntry ())
2010-08-08 22:54:58 +06:00
{
case ENTRY_BNAAR_C_CONSOLE :
2011-04-29 20:47:02 +02:00
add = me -> SummonCreature ( ENTRY_SUNFURY_TECH , 2946.52f , 4201.42f , 163.47f , 3.54f , TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT , 120000 );
if ( add ) add -> GetMotionMaster () -> MovePoint ( 0 , 2927.49f , 4192.81f , 163.00f );
2010-08-08 22:54:58 +06:00
break ;
case ENTRY_CORUU_C_CONSOLE :
2011-04-29 20:47:02 +02:00
add = me -> SummonCreature ( ENTRY_SUNFURY_TECH , 2453.88f , 2737.85f , 133.27f , 2.59f , TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT , 120000 );
if ( add ) add -> GetMotionMaster () -> MovePoint ( 0 , 2433.96f , 2751.53f , 133.85f );
add = me -> SummonCreature ( ENTRY_SUNFURY_TECH , 2441.62f , 2735.32f , 134.49f , 1.97f , TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT , 120000 );
if ( add ) add -> GetMotionMaster () -> MovePoint ( 0 , 2433.96f , 2751.53f , 133.85f );
add = me -> SummonCreature ( ENTRY_SUNFURY_TECH , 2450.73f , 2754.50f , 134.49f , 3.29f , TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT , 120000 );
if ( add ) add -> GetMotionMaster () -> MovePoint ( 0 , 2433.96f , 2751.53f , 133.85f );
2010-08-08 22:54:58 +06:00
break ;
case ENTRY_DURO_C_CONSOLE :
2011-04-29 20:47:02 +02:00
add = me -> SummonCreature ( ENTRY_SUNFURY_TECH , 2956.18f , 2202.85f , 165.32f , 5.45f , TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT , 120000 );
if ( add ) add -> GetMotionMaster () -> MovePoint ( 0 , 2972.27f , 2193.22f , 164.48f );
add = me -> SummonCreature ( ENTRY_SUNFURY_TECH , 2975.30f , 2211.50f , 165.32f , 4.55f , TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT , 120000 );
if ( add ) add -> GetMotionMaster () -> MovePoint ( 0 , 2972.27f , 2193.22f , 164.48f );
add = me -> SummonCreature ( ENTRY_SUNFURY_PROT , 2965.02f , 2217.45f , 164.16f , 4.96f , TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT , 120000 );
if ( add ) add -> GetMotionMaster () -> MovePoint ( 0 , 2972.27f , 2193.22f , 164.48f );
2010-08-08 22:54:58 +06:00
break ;
case ENTRY_ARA_C_CONSOLE :
2011-04-29 20:47:02 +02:00
add = me -> SummonCreature ( ENTRY_ARA_ENGI , 3994.51f , 4020.46f , 192.18f , 0.91f , TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT , 120000 );
if ( add ) add -> GetMotionMaster () -> MovePoint ( 0 , 4008.35f , 4035.04f , 192.70f );
add = me -> SummonCreature ( ENTRY_ARA_GORKLONN , 4021.56f , 4059.35f , 193.59f , 4.44f , TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT , 120000 );
if ( add ) add -> GetMotionMaster () -> MovePoint ( 0 , 4016.62f , 4039.89f , 193.46f );
2008-10-21 13:19:26 -05:00
break ;
}
2010-08-08 22:54:58 +06:00
}
2009-10-17 15:51:44 -07:00
2010-08-08 22:54:58 +06:00
void UpdateAI ( const uint32 diff )
2008-10-21 13:19:26 -05:00
{
2010-08-08 22:54:58 +06:00
if ( Event_Timer <= diff )
2008-10-21 13:19:26 -05:00
{
2011-09-29 12:43:05 +02:00
switch ( Phase )
2010-08-08 22:54:58 +06:00
{
case 1 :
if ( someplayer )
{
2012-04-01 19:56:41 +08:00
Unit * u = Unit :: GetUnit ( * me , someplayer );
2012-12-14 01:23:53 +00:00
if ( u && u -> GetTypeId () == TYPEID_PLAYER )
2012-12-07 10:04:40 +01:00
Talk ( EMOTE_START , u -> GetGUID ());
2010-08-08 22:54:58 +06:00
}
Event_Timer = 60000 ;
Wave = true ;
++ Phase ;
break ;
case 2 :
2012-12-07 10:04:40 +01:00
Talk ( EMOTE_60 );
2010-08-08 22:54:58 +06:00
Event_Timer = 30000 ;
++ Phase ;
break ;
case 3 :
2012-12-07 10:04:40 +01:00
Talk ( EMOTE_30 );
2010-08-08 22:54:58 +06:00
Event_Timer = 20000 ;
DoFinalSpawnForCreature ( me );
++ Phase ;
break ;
case 4 :
2012-12-07 10:04:40 +01:00
Talk ( EMOTE_10 );
2010-08-08 22:54:58 +06:00
Event_Timer = 10000 ;
Wave = false ;
++ Phase ;
break ;
case 5 :
2012-12-07 10:04:40 +01:00
Talk ( EMOTE_COMPLETE );
2010-08-08 22:54:58 +06:00
if ( someplayer )
{
2012-04-01 19:56:41 +08:00
Unit * u = Unit :: GetUnit ( * me , someplayer );
2010-08-08 22:54:58 +06:00
if ( u && u -> GetTypeId () == TYPEID_PLAYER )
2011-04-29 20:47:02 +02:00
CAST_PLR ( u ) -> KilledMonsterCredit ( me -> GetEntry (), me -> GetGUID ());
2010-08-08 22:54:58 +06:00
DoCast ( me , SPELL_DISABLE_VISUAL );
}
if ( goConsole )
{
2012-04-01 19:56:41 +08:00
if ( GameObject * go = GameObject :: GetGameObject ( * me , goConsole ))
2011-10-07 19:45:43 -05:00
go -> RemoveFlag ( GAMEOBJECT_FLAGS , GO_FLAG_IN_USE );
2010-08-08 22:54:58 +06:00
}
++ Phase ;
break ;
}
} else Event_Timer -= diff ;
if ( Wave )
{
if ( Wave_Timer <= diff )
{
DoWaveSpawnForCreature ( me );
} else Wave_Timer -= diff ;
}
2008-10-21 13:19:26 -05:00
}
2010-08-08 22:54:58 +06:00
};
2008-10-21 13:19:26 -05:00
};
2009-10-17 15:51:44 -07:00
2008-10-21 13:19:26 -05:00
/*######
## go_manaforge_control_console
######*/
2009-10-17 15:51:44 -07:00
2010-08-09 00:56:10 +06:00
//TODO: clean up this workaround when Trinity adds support to do it properly (with gossip selections instead of instant summon)
class go_manaforge_control_console : public GameObjectScript
2008-10-21 13:19:26 -05:00
{
2010-08-08 22:54:58 +06:00
public :
go_manaforge_control_console () : GameObjectScript ( "go_manaforge_control_console" ) { }
2011-10-07 19:45:43 -05:00
bool OnGossipHello ( Player * player , GameObject * go )
2008-10-21 13:19:26 -05:00
{
2011-10-07 19:45:43 -05:00
if ( go -> GetGoType () == GAMEOBJECT_TYPE_QUESTGIVER )
2010-08-08 22:54:58 +06:00
{
2011-10-07 19:45:43 -05:00
player -> PrepareQuestMenu ( go -> GetGUID ());
player -> SendPreparedQuest ( go -> GetGUID ());
2010-08-08 22:54:58 +06:00
}
2009-10-17 15:51:44 -07:00
2010-08-08 22:54:58 +06:00
Creature * manaforge = NULL ;
2009-10-17 15:51:44 -07:00
2011-10-07 19:45:43 -05:00
switch ( go -> GetAreaId ())
2010-08-08 22:54:58 +06:00
{
case 3726 : //b'naar
2011-07-02 22:52:42 +02:00
if (( player -> GetQuestStatus ( 10299 ) == QUEST_STATUS_INCOMPLETE || player -> GetQuestStatus ( 10329 ) == QUEST_STATUS_INCOMPLETE ) &&
2012-10-23 13:11:08 +02:00
player -> HasItemCount ( 29366 ))
2011-07-02 22:52:42 +02:00
manaforge = player -> SummonCreature ( ENTRY_BNAAR_C_CONSOLE , 2918.95f , 4189.98f , 161.88f , 0.34f , TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN , 125000 );
2010-08-08 22:54:58 +06:00
break ;
case 3730 : //coruu
2011-07-02 22:52:42 +02:00
if (( player -> GetQuestStatus ( 10321 ) == QUEST_STATUS_INCOMPLETE || player -> GetQuestStatus ( 10330 ) == QUEST_STATUS_INCOMPLETE ) &&
2012-10-23 13:11:08 +02:00
player -> HasItemCount ( 29396 ))
2011-07-02 22:52:42 +02:00
manaforge = player -> SummonCreature ( ENTRY_CORUU_C_CONSOLE , 2426.77f , 2750.38f , 133.24f , 2.14f , TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN , 125000 );
2010-08-08 22:54:58 +06:00
break ;
case 3734 : //duro
2011-07-02 22:52:42 +02:00
if (( player -> GetQuestStatus ( 10322 ) == QUEST_STATUS_INCOMPLETE || player -> GetQuestStatus ( 10338 ) == QUEST_STATUS_INCOMPLETE ) &&
2012-10-23 13:11:08 +02:00
player -> HasItemCount ( 29397 ))
2011-07-02 22:52:42 +02:00
manaforge = player -> SummonCreature ( ENTRY_DURO_C_CONSOLE , 2976.48f , 2183.29f , 163.20f , 1.85f , TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN , 125000 );
2010-08-08 22:54:58 +06:00
break ;
case 3722 : //ara
2011-07-02 22:52:42 +02:00
if (( player -> GetQuestStatus ( 10323 ) == QUEST_STATUS_INCOMPLETE || player -> GetQuestStatus ( 10365 ) == QUEST_STATUS_INCOMPLETE ) &&
2012-10-23 13:11:08 +02:00
player -> HasItemCount ( 29411 ))
2011-07-02 22:52:42 +02:00
manaforge = player -> SummonCreature ( ENTRY_ARA_C_CONSOLE , 4013.71f , 4028.76f , 192.10f , 1.25f , TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN , 125000 );
2010-08-08 22:54:58 +06:00
break ;
}
2009-10-17 15:51:44 -07:00
2010-08-08 22:54:58 +06:00
if ( manaforge )
{
2011-07-02 22:52:42 +02:00
CAST_AI ( npc_manaforge_control_console :: npc_manaforge_control_consoleAI , manaforge -> AI ()) -> someplayer = player -> GetGUID ();
2011-10-07 19:45:43 -05:00
CAST_AI ( npc_manaforge_control_console :: npc_manaforge_control_consoleAI , manaforge -> AI ()) -> goConsole = go -> GetGUID ();
go -> SetFlag ( GAMEOBJECT_FLAGS , GO_FLAG_IN_USE );
2010-08-08 22:54:58 +06:00
}
return true ;
2008-10-21 13:19:26 -05:00
}
2010-08-08 22:54:58 +06:00
};
2009-10-17 15:51:44 -07:00
2008-12-20 19:10:00 +01:00
/*######
## npc_commander_dawnforge
######*/
2009-10-17 15:51:44 -07:00
2008-12-20 19:10:00 +01:00
// The Speech of Dawnforge, Ardonis & Pathaleon
2010-09-05 02:16:58 +06:00
enum eCommanderDawnforgeData
{
2012-12-07 10:04:40 +01:00
SAY_COMMANDER_DAWNFORGE_1 = 0 ,
SAY_COMMANDER_DAWNFORGE_2 = 1 ,
SAY_COMMANDER_DAWNFORGE_3 = 2 ,
SAY_COMMANDER_DAWNFORGE_4 = 3 ,
SAY_COMMANDER_DAWNFORGE_5 = 4 ,
SAY_ARCANIST_ARDONIS_1 = 0 ,
SAY_ARCANIST_ARDONIS_2 = 1 ,
SAY_PATHALEON_CULATOR_IMAGE_1 = 0 ,
SAY_PATHALEON_CULATOR_IMAGE_2 = 1 ,
SAY_PATHALEON_CULATOR_IMAGE_2_1 = 2 ,
SAY_PATHALEON_CULATOR_IMAGE_2_2 = 3 ,
2012-12-14 01:23:53 +00:00
2010-09-05 02:16:58 +06:00
QUEST_INFO_GATHERING = 10198 ,
SPELL_SUNFURY_DISGUISE = 34603 ,
};
2009-10-17 15:51:44 -07:00
2008-12-20 19:10:00 +01:00
// Entries of Arcanist Ardonis, Commander Dawnforge, Pathaleon the Curators Image
2009-05-27 21:30:03 +02:00
const uint32 CreatureEntry [ 3 ] =
2008-12-20 19:10:00 +01:00
{
2009-05-27 21:30:03 +02:00
19830 , // Ardonis
19831 , // Dawnforge
21504 // Pathaleon
2008-12-20 19:10:00 +01:00
};
2010-08-09 00:56:10 +06:00
class npc_commander_dawnforge : public CreatureScript
2008-12-20 19:10:00 +01:00
{
2010-08-08 22:54:58 +06:00
public :
npc_commander_dawnforge () : CreatureScript ( "npc_commander_dawnforge" ) { }
2008-12-20 19:10:00 +01:00
2011-07-02 22:18:03 +02:00
CreatureAI * GetAI ( Creature * creature ) const
2010-08-08 22:54:58 +06:00
{
2011-07-02 22:18:03 +02:00
return new npc_commander_dawnforgeAI ( creature );
2010-08-08 22:54:58 +06:00
}
2008-12-20 19:10:00 +01:00
2010-08-08 22:54:58 +06:00
struct npc_commander_dawnforgeAI : public ScriptedAI
{
2012-03-16 19:40:57 +08:00
npc_commander_dawnforgeAI ( Creature * creature ) : ScriptedAI ( creature ) { Reset (); }
2009-10-17 15:51:44 -07:00
2010-08-08 22:54:58 +06:00
uint64 PlayerGUID ;
uint64 ardonisGUID ;
uint64 pathaleonGUID ;
2009-10-17 15:51:44 -07:00
2010-08-08 22:54:58 +06:00
uint32 Phase ;
uint32 PhaseSubphase ;
uint32 Phase_Timer ;
bool isEvent ;
2009-10-17 15:51:44 -07:00
2010-08-08 22:54:58 +06:00
float angle_dawnforge ;
float angle_ardonis ;
2009-10-17 15:51:44 -07:00
2010-08-08 22:54:58 +06:00
void Reset ()
{
PlayerGUID = 0 ;
ardonisGUID = 0 ;
pathaleonGUID = 0 ;
2009-10-17 15:51:44 -07:00
2010-08-08 22:54:58 +06:00
Phase = 1 ;
PhaseSubphase = 0 ;
Phase_Timer = 4000 ;
isEvent = false ;
}
2009-10-17 15:51:44 -07:00
2011-06-11 22:35:29 +02:00
void EnterCombat ( Unit * /*who*/ ) { }
2010-08-08 22:54:58 +06:00
2011-06-30 14:24:56 +02:00
void JustSummoned ( Creature * summoned )
2009-02-09 08:16:34 -05:00
{
2010-08-08 22:54:58 +06:00
pathaleonGUID = summoned -> GetGUID ();
}
// Emote Ardonis and Pathaleon
void Turn_to_Pathaleons_Image ()
{
2011-06-30 14:24:56 +02:00
Creature * ardonis = Unit :: GetCreature ( * me , ardonisGUID );
Creature * pathaleon = Unit :: GetCreature ( * me , pathaleonGUID );
2011-07-02 22:52:42 +02:00
Player * player = Unit :: GetPlayer ( * me , PlayerGUID );
2009-10-17 15:51:44 -07:00
2011-07-02 22:52:42 +02:00
if ( ! ardonis || ! pathaleon || ! player )
2009-02-09 08:16:34 -05:00
return ;
2009-10-17 15:51:44 -07:00
2010-08-08 22:54:58 +06:00
//Calculate the angle to Pathaleon
angle_dawnforge = me -> GetAngle ( pathaleon -> GetPositionX (), pathaleon -> GetPositionY ());
angle_ardonis = ardonis -> GetAngle ( pathaleon -> GetPositionX (), pathaleon -> GetPositionY ());
2009-10-17 15:51:44 -07:00
2009-02-09 08:16:34 -05:00
//Turn Dawnforge and update
2010-04-14 23:07:41 +02:00
me -> SetOrientation ( angle_dawnforge );
2011-07-02 22:52:42 +02:00
me -> SendUpdateToPlayer ( player );
2009-02-09 08:16:34 -05:00
//Turn Ardonis and update
ardonis -> SetOrientation ( angle_ardonis );
2011-07-02 22:52:42 +02:00
ardonis -> SendUpdateToPlayer ( player );
2009-10-17 15:51:44 -07:00
2010-08-08 22:54:58 +06:00
//Set them to kneel
me -> SetStandState ( UNIT_STAND_STATE_KNEEL );
ardonis -> SetStandState ( UNIT_STAND_STATE_KNEEL );
2009-02-09 08:16:34 -05:00
}
2009-10-17 15:51:44 -07:00
2010-08-08 22:54:58 +06:00
//Set them back to each other
void Turn_to_eachother ()
2009-02-09 08:16:34 -05:00
{
2011-06-30 14:24:56 +02:00
if ( Unit * ardonis = Unit :: GetUnit ( * me , ardonisGUID ))
2010-08-08 22:54:58 +06:00
{
2011-07-02 22:52:42 +02:00
Player * player = Unit :: GetPlayer ( * me , PlayerGUID );
2009-10-17 15:51:44 -07:00
2011-07-02 22:52:42 +02:00
if ( ! player )
2010-08-08 22:54:58 +06:00
return ;
2009-10-17 15:51:44 -07:00
2010-08-08 22:54:58 +06:00
angle_dawnforge = me -> GetAngle ( ardonis -> GetPositionX (), ardonis -> GetPositionY ());
angle_ardonis = ardonis -> GetAngle ( me -> GetPositionX (), me -> GetPositionY ());
2009-10-17 15:51:44 -07:00
2010-08-08 22:54:58 +06:00
//Turn Dawnforge and update
me -> SetOrientation ( angle_dawnforge );
2011-07-02 22:52:42 +02:00
me -> SendUpdateToPlayer ( player );
2010-08-08 22:54:58 +06:00
//Turn Ardonis and update
ardonis -> SetOrientation ( angle_ardonis );
2011-07-02 22:52:42 +02:00
ardonis -> SendUpdateToPlayer ( player );
2010-08-08 22:54:58 +06:00
//Set state
me -> SetStandState ( UNIT_STAND_STATE_STAND );
ardonis -> SetStandState ( UNIT_STAND_STATE_STAND );
}
2009-02-09 08:16:34 -05:00
}
2009-10-17 15:51:44 -07:00
2011-07-02 22:52:42 +02:00
bool CanStartEvent ( Player * player )
2010-08-08 22:54:58 +06:00
{
if ( ! isEvent )
{
Creature * ardonis = me -> FindNearestCreature ( CreatureEntry [ 0 ], 10.0f );
if ( ! ardonis )
return false ;
2009-10-17 15:51:44 -07:00
2010-08-08 22:54:58 +06:00
ardonisGUID = ardonis -> GetGUID ();
2011-07-02 22:52:42 +02:00
PlayerGUID = player -> GetGUID ();
2009-10-17 15:51:44 -07:00
2010-08-08 22:54:58 +06:00
isEvent = true ;
2009-10-17 15:51:44 -07:00
2010-08-08 22:54:58 +06:00
Turn_to_eachother ();
return true ;
}
2009-10-17 15:51:44 -07:00
2012-08-03 14:20:18 +02:00
sLog -> outDebug ( LOG_FILTER_TSCR , "npc_commander_dawnforge event already in progress, need to wait." );
2010-08-08 22:54:58 +06:00
return false ;
2009-02-09 08:16:34 -05:00
}
2009-10-17 15:51:44 -07:00
2010-08-08 22:54:58 +06:00
void UpdateAI ( const uint32 diff )
2009-02-09 08:16:34 -05:00
{
2010-08-08 22:54:58 +06:00
//Is event even running?
if ( ! isEvent )
return ;
2009-10-17 15:51:44 -07:00
2010-08-08 22:54:58 +06:00
//Phase timing
if ( Phase_Timer >= diff )
2009-02-09 08:16:34 -05:00
{
2010-08-08 22:54:58 +06:00
Phase_Timer -= diff ;
return ;
2009-02-09 08:16:34 -05:00
}
2010-08-08 22:54:58 +06:00
2012-12-07 10:04:40 +01:00
Creature * ardonis = Creature :: GetCreature ( * me , ardonisGUID );
Creature * pathaleon = Creature :: GetCreature ( * me , pathaleonGUID );
2011-07-02 22:52:42 +02:00
Player * player = Unit :: GetPlayer ( * me , PlayerGUID );
2010-08-08 22:54:58 +06:00
2011-07-02 22:52:42 +02:00
if ( ! ardonis || ! player )
2010-08-08 22:54:58 +06:00
{
Reset ();
return ;
}
if ( Phase > 4 && ! pathaleon )
{
Reset ();
return ;
}
//Phase 1 Dawnforge say
switch ( Phase )
2009-02-09 08:16:34 -05:00
{
case 1 :
2012-12-07 10:04:40 +01:00
Talk ( SAY_COMMANDER_DAWNFORGE_1 );
2010-08-08 22:54:58 +06:00
++ Phase ;
2009-02-09 08:16:34 -05:00
Phase_Timer = 16000 ;
break ;
2010-08-08 22:54:58 +06:00
//Phase 2 Ardonis say
2009-02-09 08:16:34 -05:00
case 2 :
2012-12-07 10:04:40 +01:00
ardonis -> AI () -> Talk ( SAY_ARCANIST_ARDONIS_1 );
2010-08-08 22:54:58 +06:00
++ Phase ;
Phase_Timer = 16000 ;
break ;
//Phase 3 Dawnforge say
case 3 :
2012-12-07 10:04:40 +01:00
Talk ( SAY_COMMANDER_DAWNFORGE_2 );
2010-08-08 22:54:58 +06:00
++ Phase ;
Phase_Timer = 16000 ;
break ;
//Phase 4 Pathaleon spawns up to phase 9
case 4 :
//spawn pathaleon's image
2010-08-22 23:46:40 +06:00
me -> SummonCreature ( CreatureEntry [ 2 ], 2325.851563f , 2799.534668f , 133.084229f , 6.038996f , TEMPSUMMON_TIMED_DESPAWN , 90000 );
2010-08-08 22:54:58 +06:00
++ Phase ;
Phase_Timer = 500 ;
break ;
//Phase 5 Pathaleon say
case 5 :
2012-12-07 10:04:40 +01:00
pathaleon -> AI () -> Talk ( SAY_PATHALEON_CULATOR_IMAGE_1 );
2010-08-08 22:54:58 +06:00
++ Phase ;
Phase_Timer = 6000 ;
break ;
//Phase 6
case 6 :
2011-09-29 12:43:05 +02:00
switch ( PhaseSubphase )
2010-08-08 22:54:58 +06:00
{
//Subphase 1: Turn Dawnforge and Ardonis
case 0 :
Turn_to_Pathaleons_Image ();
++ PhaseSubphase ;
Phase_Timer = 8000 ;
break ;
//Subphase 2 Dawnforge say
case 1 :
2012-12-07 10:04:40 +01:00
Talk ( SAY_COMMANDER_DAWNFORGE_3 );
2010-08-08 22:54:58 +06:00
PhaseSubphase = 0 ;
++ Phase ;
Phase_Timer = 8000 ;
break ;
}
break ;
//Phase 7 Pathaleons say 3 Sentence, every sentence need a subphase
case 7 :
2011-09-29 12:43:05 +02:00
switch ( PhaseSubphase )
2010-08-08 22:54:58 +06:00
{
//Subphase 1
case 0 :
2012-12-07 10:04:40 +01:00
pathaleon -> AI () -> Talk ( SAY_PATHALEON_CULATOR_IMAGE_2 );
2010-08-08 22:54:58 +06:00
++ PhaseSubphase ;
Phase_Timer = 12000 ;
break ;
//Subphase 2
case 1 :
2012-12-07 10:04:40 +01:00
pathaleon -> AI () -> Talk ( SAY_PATHALEON_CULATOR_IMAGE_2_1 );
2010-08-08 22:54:58 +06:00
++ PhaseSubphase ;
Phase_Timer = 16000 ;
break ;
//Subphase 3
case 2 :
2012-12-07 10:04:40 +01:00
pathaleon -> AI () -> Talk ( SAY_PATHALEON_CULATOR_IMAGE_2_2 );
2010-08-08 22:54:58 +06:00
PhaseSubphase = 0 ;
++ Phase ;
Phase_Timer = 10000 ;
break ;
}
break ;
//Phase 8 Dawnforge & Ardonis say
case 8 :
2012-12-07 10:04:40 +01:00
Talk ( SAY_COMMANDER_DAWNFORGE_4 );
ardonis -> AI () -> Talk ( SAY_ARCANIST_ARDONIS_2 );
2010-08-08 22:54:58 +06:00
++ Phase ;
Phase_Timer = 4000 ;
break ;
//Phase 9 Pathaleons Despawn, Reset Dawnforge & Ardonis angle
case 9 :
Turn_to_eachother ();
//hide pathaleon, unit will despawn shortly
2010-11-16 01:13:04 +01:00
pathaleon -> SetVisible ( false );
2009-02-09 08:16:34 -05:00
PhaseSubphase = 0 ;
++ Phase ;
2010-08-08 22:54:58 +06:00
Phase_Timer = 3000 ;
break ;
//Phase 10 Dawnforge say
case 10 :
2012-12-07 10:04:40 +01:00
Talk ( SAY_COMMANDER_DAWNFORGE_5 );
2011-07-02 22:52:42 +02:00
player -> AreaExploredOrEventHappens ( QUEST_INFO_GATHERING );
2010-08-08 22:54:58 +06:00
Reset ();
2009-02-09 08:16:34 -05:00
break ;
}
2010-08-08 22:54:58 +06:00
}
};
};
2009-10-17 15:51:44 -07:00
2010-08-09 00:56:10 +06:00
class at_commander_dawnforge : public AreaTriggerScript
2008-12-20 19:10:00 +01:00
{
2010-08-08 22:54:58 +06:00
public :
at_commander_dawnforge () : AreaTriggerScript ( "at_commander_dawnforge" ) { }
2009-10-17 15:51:44 -07:00
2011-09-29 09:32:55 +02:00
bool OnTrigger ( Player * player , const AreaTriggerEntry * /*at*/ )
2009-02-09 08:16:34 -05:00
{
2010-08-08 22:54:58 +06:00
//if player lost aura or not have at all, we should not try start event.
2011-07-02 22:52:42 +02:00
if ( ! player -> HasAura ( SPELL_SUNFURY_DISGUISE ))
2009-02-09 08:16:34 -05:00
return false ;
2009-10-17 15:51:44 -07:00
2011-07-02 22:52:42 +02:00
if ( player -> isAlive () && player -> GetQuestStatus ( QUEST_INFO_GATHERING ) == QUEST_STATUS_INCOMPLETE )
2010-08-08 22:54:58 +06:00
{
2011-07-02 22:52:42 +02:00
Creature * Dawnforge = player -> FindNearestCreature ( CreatureEntry [ 1 ], 30.0f );
2010-08-08 22:54:58 +06:00
if ( ! Dawnforge )
return false ;
2011-07-02 22:52:42 +02:00
if ( CAST_AI ( npc_commander_dawnforge :: npc_commander_dawnforgeAI , Dawnforge -> AI ()) -> CanStartEvent ( player ))
2010-08-08 22:54:58 +06:00
return true ;
}
return false ;
2009-02-09 08:16:34 -05:00
}
2010-08-08 22:54:58 +06:00
};
2009-10-17 15:51:44 -07:00
2008-12-26 20:25:31 +01:00
/*######
## npc_professor_dabiri
######*/
2010-09-05 02:16:58 +06:00
enum eProfessorDabiriData
{
SPELL_PHASE_DISTRUPTOR = 35780 ,
2009-10-17 15:51:44 -07:00
2012-12-07 10:04:40 +01:00
//WHISPER_DABIRI = 0, not existing in database
2009-10-17 15:51:44 -07:00
2010-09-05 02:16:58 +06:00
QUEST_DIMENSIUS = 10439 ,
QUEST_ON_NETHERY_WINGS = 10438 ,
};
#define GOSSIP_ITEM "I need a new phase distruptor, Professor"
2010-08-09 00:56:10 +06:00
class npc_professor_dabiri : public CreatureScript
2008-12-26 20:25:31 +01:00
{
2010-08-08 22:54:58 +06:00
public :
npc_professor_dabiri () : CreatureScript ( "npc_professor_dabiri" ) { }
2009-10-17 15:51:44 -07:00
2012-12-14 01:23:53 +00:00
//OnQuestAccept:
2012-12-07 10:04:40 +01:00
//if (quest->GetQuestId() == QUEST_DIMENSIUS)
//creature->AI()->Talk(WHISPER_DABIRI, player->GetGUID());
2009-10-17 15:51:44 -07:00
2012-03-07 14:08:30 +01:00
bool OnGossipSelect ( Player * player , Creature * creature , uint32 /*sender*/ , uint32 action )
2010-08-08 22:54:58 +06:00
{
2011-07-02 22:52:42 +02:00
player -> PlayerTalkClass -> ClearMenus ();
2012-03-07 14:08:30 +01:00
if ( action == GOSSIP_ACTION_INFO_DEF + 1 )
2010-08-08 22:54:58 +06:00
{
2011-07-02 22:52:42 +02:00
creature -> CastSpell ( player , SPELL_PHASE_DISTRUPTOR , false );
player -> CLOSE_GOSSIP_MENU ();
2010-08-08 22:54:58 +06:00
}
2009-10-17 15:51:44 -07:00
2010-08-08 22:54:58 +06:00
return true ;
}
2011-07-02 22:52:42 +02:00
bool OnGossipHello ( Player * player , Creature * creature )
2009-02-09 08:16:34 -05:00
{
2011-07-02 22:18:03 +02:00
if ( creature -> isQuestGiver ())
2011-07-02 22:52:42 +02:00
player -> PrepareQuestMenu ( creature -> GetGUID ());
2010-08-08 22:54:58 +06:00
2012-10-23 13:11:08 +02:00
if ( player -> GetQuestStatus ( QUEST_ON_NETHERY_WINGS ) == QUEST_STATUS_INCOMPLETE && ! player -> HasItemCount ( 29778 ))
2011-07-02 22:52:42 +02:00
player -> ADD_GOSSIP_ITEM ( GOSSIP_ICON_CHAT , GOSSIP_ITEM , GOSSIP_SENDER_MAIN , GOSSIP_ACTION_INFO_DEF + 1 );
2010-08-08 22:54:58 +06:00
2011-07-02 22:52:42 +02:00
player -> SEND_GOSSIP_MENU ( player -> GetGossipTextId ( creature ), creature -> GetGUID ());
2010-08-08 22:54:58 +06:00
return true ;
2009-02-09 08:16:34 -05:00
}
2010-08-08 22:54:58 +06:00
};
2009-10-17 15:51:44 -07:00
2008-11-21 17:29:05 -06:00
/*######
## mob_phase_hunter
######*/
2009-10-17 15:51:44 -07:00
2010-09-05 02:16:58 +06:00
enum ePhaseHunterData
{
QUEST_RECHARGING_THE_BATTERIES = 10190 ,
2009-12-30 05:00:56 +01:00
2010-09-05 02:16:58 +06:00
NPC_PHASE_HUNTER_ENTRY = 18879 ,
NPC_DRAINED_PHASE_HUNTER_ENTRY = 19595 ,
2009-12-30 05:00:56 +01:00
2012-12-07 10:04:40 +01:00
EMOTE_WEAK = 0 ,
2009-10-17 15:51:44 -07:00
2010-09-05 02:16:58 +06:00
// Spells
SPELL_RECHARGING_BATTERY = 34219 ,
SPELL_PHASE_SLIP = 36574 ,
SPELL_MANA_BURN = 13321 ,
SPELL_MATERIALIZE = 34804 ,
SPELL_DE_MATERIALIZE = 34814 ,
};
2010-08-09 00:56:10 +06:00
class mob_phase_hunter : public CreatureScript
2008-11-21 17:29:05 -06:00
{
2010-08-08 22:54:58 +06:00
public :
mob_phase_hunter () : CreatureScript ( "mob_phase_hunter" ) { }
2009-10-17 15:51:44 -07:00
2011-07-02 22:18:03 +02:00
CreatureAI * GetAI ( Creature * creature ) const
2010-08-08 22:54:58 +06:00
{
2011-07-02 22:18:03 +02:00
return new mob_phase_hunterAI ( creature );
2010-08-08 22:54:58 +06:00
}
2009-12-30 05:00:56 +01:00
2010-08-08 22:54:58 +06:00
struct mob_phase_hunterAI : public ScriptedAI
{
2012-03-14 09:20:36 +08:00
mob_phase_hunterAI ( Creature * creature ) : ScriptedAI ( creature ) {}
2009-10-17 15:51:44 -07:00
2010-08-08 22:54:58 +06:00
bool Weak ;
bool Materialize ;
bool Drained ;
uint8 WeakPercent ;
2009-10-17 15:51:44 -07:00
2011-07-02 22:52:42 +02:00
Player * player ;
2010-08-08 22:54:58 +06:00
uint64 PlayerGUID ;
2009-10-17 15:51:44 -07:00
2010-08-08 22:54:58 +06:00
uint32 ManaBurnTimer ;
2009-12-30 05:00:56 +01:00
2010-08-08 22:54:58 +06:00
void Reset ()
{
Weak = false ;
Materialize = false ;
Drained = false ;
WeakPercent = 25 + ( rand () % 16 ); // 25-40
2009-12-30 05:00:56 +01:00
2010-08-08 22:54:58 +06:00
PlayerGUID = 0 ;
2009-10-17 15:51:44 -07:00
2010-08-08 22:54:58 +06:00
ManaBurnTimer = 5000 + ( rand () % 3 * 1000 ); // 5-8 sec cd
2009-10-17 15:51:44 -07:00
2010-08-08 22:54:58 +06:00
if ( me -> GetEntry () == NPC_DRAINED_PHASE_HUNTER_ENTRY )
me -> UpdateEntry ( NPC_PHASE_HUNTER_ENTRY );
}
2009-10-17 15:51:44 -07:00
2011-06-11 22:35:29 +02:00
void EnterCombat ( Unit * who )
2009-01-19 10:50:31 -06:00
{
2010-08-08 22:54:58 +06:00
if ( who -> GetTypeId () == TYPEID_PLAYER )
PlayerGUID = who -> GetGUID ();
2009-01-19 10:50:31 -06:00
}
2009-10-17 15:51:44 -07:00
2012-06-09 22:50:56 +02:00
//void SpellHit(Unit* /*caster*/, const SpellInfo* /*spell*/)
//{
// DoCast(me, SPELL_DE_MATERIALIZE);
//}
2009-10-17 15:51:44 -07:00
2010-08-08 22:54:58 +06:00
void UpdateAI ( const uint32 diff )
2009-01-19 10:50:31 -06:00
{
2010-08-08 22:54:58 +06:00
if ( ! Materialize )
{
DoCast ( me , SPELL_MATERIALIZE );
Materialize = true ;
}
2012-02-03 19:02:17 +02:00
if ( me -> HasAuraType ( SPELL_AURA_MOD_DECREASE_SPEED ) || me -> HasUnitState ( UNIT_STATE_ROOT )) // if the mob is rooted/slowed by spells eg.: Entangling Roots, Frost Nova, Hamstring, Crippling Poison, etc. => remove it
2010-08-08 22:54:58 +06:00
DoCast ( me , SPELL_PHASE_SLIP );
if ( ! UpdateVictim ())
return ;
2009-12-30 05:00:56 +01:00
2010-08-08 22:54:58 +06:00
// some code to cast spell Mana Burn on random target which has mana
if ( ManaBurnTimer <= diff )
2009-01-19 10:50:31 -06:00
{
2010-08-08 22:54:58 +06:00
std :: list < HostileReference *> AggroList = me -> getThreatManager (). getThreatList ();
std :: list < Unit *> UnitsWithMana ;
for ( std :: list < HostileReference *>:: const_iterator itr = AggroList . begin (); itr != AggroList . end (); ++ itr )
2009-12-30 05:00:56 +01:00
{
2011-10-07 10:48:56 -05:00
if ( Unit * unit = Unit :: GetUnit ( * me , ( * itr ) -> getUnitGuid ()))
2010-08-08 22:54:58 +06:00
{
2011-10-07 10:48:56 -05:00
if ( unit -> GetCreateMana () > 0 )
UnitsWithMana . push_back ( unit );
2010-08-08 22:54:58 +06:00
}
2009-12-30 05:00:56 +01:00
}
2010-08-08 22:54:58 +06:00
if ( ! UnitsWithMana . empty ())
{
2012-04-08 17:40:05 +02:00
DoCast ( Trinity :: Containers :: SelectRandomContainerElement ( UnitsWithMana ), SPELL_MANA_BURN );
2010-08-08 22:54:58 +06:00
ManaBurnTimer = 8000 + ( rand () % 10 * 1000 ); // 8-18 sec cd
}
else
ManaBurnTimer = 3500 ;
} else ManaBurnTimer -= diff ;
2009-10-17 15:51:44 -07:00
2011-07-02 22:52:42 +02:00
if ( Player * player = Unit :: GetPlayer ( * me , PlayerGUID )) // start: support for quest 10190
2009-01-14 19:33:55 +01:00
{
2010-08-26 01:20:57 +06:00
if ( ! Weak && HealthBelowPct ( WeakPercent )
2011-07-02 22:52:42 +02:00
&& player -> GetQuestStatus ( QUEST_RECHARGING_THE_BATTERIES ) == QUEST_STATUS_INCOMPLETE )
2010-08-08 22:54:58 +06:00
{
2012-12-07 10:04:40 +01:00
Talk ( EMOTE_WEAK );
2010-08-08 22:54:58 +06:00
Weak = true ;
}
if ( Weak && ! Drained && me -> HasAura ( SPELL_RECHARGING_BATTERY ))
{
Drained = true ;
2010-09-05 02:16:58 +06:00
int32 uHpPct = int32 ( me -> GetHealthPct ());
2009-10-17 15:51:44 -07:00
2010-08-08 22:54:58 +06:00
me -> UpdateEntry ( NPC_DRAINED_PHASE_HUNTER_ENTRY );
2009-10-17 15:51:44 -07:00
2010-09-05 02:16:58 +06:00
me -> SetHealth ( me -> CountPctFromMaxHealth ( uHpPct ));
2010-08-08 22:54:58 +06:00
me -> LowerPlayerDamageReq ( me -> GetMaxHealth () - me -> GetHealth ());
2011-07-02 22:52:42 +02:00
me -> SetInCombatWith ( player );
2010-08-08 22:54:58 +06:00
}
} // end: support for quest 10190
DoMeleeAttackIfReady ();
}
};
2008-11-21 17:29:05 -06:00
};
2009-10-17 15:51:44 -07:00
2009-01-14 19:33:55 +01:00
/*######
## npc_bessy
######*/
2010-09-05 02:16:58 +06:00
enum eBessyData
{
Q_ALMABTRIEB = 10337 ,
N_THADELL = 20464 ,
SPAWN_FIRST = 20512 ,
SPAWN_SECOND = 19881 ,
2012-12-07 10:04:40 +01:00
SAY_THADELL_1 = 0 ,
SAY_THADELL_2 = 1 ,
2010-09-05 02:16:58 +06:00
};
2010-08-09 00:56:10 +06:00
class npc_bessy : public CreatureScript
2009-01-14 19:33:55 +01:00
{
2010-08-08 22:54:58 +06:00
public :
npc_bessy () : CreatureScript ( "npc_bessy" ) { }
2009-10-17 15:51:44 -07:00
2011-07-02 22:52:42 +02:00
bool OnQuestAccept ( Player * player , Creature * creature , Quest const * quest )
2010-08-08 22:54:58 +06:00
{
if ( quest -> GetQuestId () == Q_ALMABTRIEB )
{
2011-07-02 22:18:03 +02:00
creature -> setFaction ( 113 );
creature -> RemoveFlag ( UNIT_FIELD_FLAGS , UNIT_FLAG_NON_ATTACKABLE );
2011-07-02 22:52:42 +02:00
CAST_AI ( npc_escortAI , ( creature -> AI ())) -> Start ( true , false , player -> GetGUID ());
2010-08-08 22:54:58 +06:00
}
return true ;
}
2009-10-17 15:51:44 -07:00
2011-07-02 22:18:03 +02:00
CreatureAI * GetAI ( Creature * creature ) const
2009-01-14 19:33:55 +01:00
{
2011-07-02 22:18:03 +02:00
return new npc_bessyAI ( creature );
2009-01-14 19:33:55 +01:00
}
2009-10-17 15:51:44 -07:00
2010-08-08 22:54:58 +06:00
struct npc_bessyAI : public npc_escortAI
2009-01-14 19:33:55 +01:00
{
2012-03-14 09:20:36 +08:00
npc_bessyAI ( Creature * creature ) : npc_escortAI ( creature ) {}
2009-10-17 15:51:44 -07:00
2010-08-08 22:54:58 +06:00
void JustDied ( Unit * /*killer*/ )
2009-02-09 08:16:34 -05:00
{
2011-07-02 22:52:42 +02:00
if ( Player * player = GetPlayerForEscort ())
player -> FailQuest ( Q_ALMABTRIEB );
2010-08-08 22:54:58 +06:00
}
2009-10-17 15:51:44 -07:00
2012-03-29 15:44:24 +08:00
void WaypointReached ( uint32 waypointId )
2010-08-08 22:54:58 +06:00
{
2011-07-02 22:52:42 +02:00
Player * player = GetPlayerForEscort ();
if ( ! player )
2010-08-08 22:54:58 +06:00
return ;
2009-10-17 15:51:44 -07:00
2012-03-29 15:44:24 +08:00
switch ( waypointId )
2010-08-08 22:54:58 +06:00
{
case 3 : //first spawn
2010-08-22 23:46:40 +06:00
me -> SummonCreature ( SPAWN_FIRST , 2449.67f , 2183.11f , 96.85f , 6.20f , TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT , 25000 );
me -> SummonCreature ( SPAWN_FIRST , 2449.53f , 2184.43f , 96.36f , 6.27f , TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT , 25000 );
me -> SummonCreature ( SPAWN_FIRST , 2449.85f , 2186.34f , 97.57f , 6.08f , TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT , 25000 );
2010-08-08 22:54:58 +06:00
break ;
case 7 :
2010-08-22 23:46:40 +06:00
me -> SummonCreature ( SPAWN_SECOND , 2309.64f , 2186.24f , 92.25f , 6.06f , TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT , 25000 );
me -> SummonCreature ( SPAWN_SECOND , 2309.25f , 2183.46f , 91.75f , 6.22f , TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT , 25000 );
2010-08-08 22:54:58 +06:00
break ;
case 12 :
2012-03-28 15:15:48 +08:00
player -> GroupEventHappens ( Q_ALMABTRIEB , me );
2010-08-24 14:44:56 +02:00
if ( me -> FindNearestCreature ( N_THADELL , 30 ))
2012-12-07 10:04:40 +01:00
Talk ( SAY_THADELL_1 );
2012-03-29 15:44:24 +08:00
break ;
2010-08-08 22:54:58 +06:00
case 13 :
2010-08-24 14:44:56 +02:00
if ( me -> FindNearestCreature ( N_THADELL , 30 ))
2012-12-07 10:04:40 +01:00
Talk ( SAY_THADELL_2 , player -> GetGUID ());
2012-03-29 15:44:24 +08:00
break ;
2010-08-08 22:54:58 +06:00
}
}
2009-10-17 15:51:44 -07:00
2010-08-08 22:54:58 +06:00
void JustSummoned ( Creature * summoned )
{
summoned -> AI () -> AttackStart ( me );
}
2009-10-17 15:51:44 -07:00
2010-08-08 22:54:58 +06:00
void Reset ()
{
me -> RestoreFaction ();
}
};
};
2009-10-17 15:51:44 -07:00
2008-10-21 13:19:26 -05:00
/*######
2010-08-26 11:36:26 +02:00
## npc_maxx_a_million
2008-10-21 13:19:26 -05:00
######*/
2009-10-17 15:51:44 -07:00
2010-08-26 11:36:26 +02:00
enum
{
QUEST_MARK_V_IS_ALIVE = 10191 ,
GO_DRAENEI_MACHINE = 183771
};
class npc_maxx_a_million_escort : public CreatureScript
{
public :
npc_maxx_a_million_escort () : CreatureScript ( "npc_maxx_a_million_escort" ) { }
2011-09-15 14:08:17 +02:00
CreatureAI * GetAI ( Creature * creature ) const
2010-08-26 11:36:26 +02:00
{
2011-07-02 22:18:03 +02:00
return new npc_maxx_a_million_escortAI ( creature );
2010-08-26 11:36:26 +02:00
}
struct npc_maxx_a_million_escortAI : public npc_escortAI
{
2011-07-02 22:18:03 +02:00
npc_maxx_a_million_escortAI ( Creature * creature ) : npc_escortAI ( creature ) {}
2010-08-26 11:36:26 +02:00
bool bTake ;
uint32 uiTakeTimer ;
void Reset ()
{
bTake = false ;
uiTakeTimer = 3000 ;
}
2012-03-29 15:44:24 +08:00
void WaypointReached ( uint32 waypointId )
2010-08-26 11:36:26 +02:00
{
2011-07-02 22:52:42 +02:00
Player * player = GetPlayerForEscort ();
if ( ! player )
2010-08-26 11:36:26 +02:00
return ;
2012-03-29 15:44:24 +08:00
switch ( waypointId )
2010-08-26 11:36:26 +02:00
{
case 7 :
case 17 :
case 29 :
//Find Object and "work"
2011-04-29 20:47:02 +02:00
if ( GetClosestGameObjectWithEntry ( me , GO_DRAENEI_MACHINE , INTERACTION_DISTANCE ))
2010-08-26 11:36:26 +02:00
{
// take the GO -> animation
me -> HandleEmoteCommand ( EMOTE_STATE_LOOT );
SetEscortPaused ( true );
bTake = true ;
}
break ;
case 36 : //return and quest_complete
2012-03-28 15:15:48 +08:00
player -> CompleteQuest ( QUEST_MARK_V_IS_ALIVE );
2010-08-26 11:36:26 +02:00
break ;
}
}
2011-07-02 23:58:05 +02:00
void JustDied ( Unit * /*killer*/ )
2010-08-26 11:36:26 +02:00
{
2012-03-28 15:15:48 +08:00
if ( Player * player = GetPlayerForEscort ())
2011-07-02 22:52:42 +02:00
player -> FailQuest ( QUEST_MARK_V_IS_ALIVE );
2010-08-26 11:36:26 +02:00
}
void UpdateAI ( const uint32 uiDiff )
{
npc_escortAI :: UpdateAI ( uiDiff );
if ( bTake )
{
if ( uiTakeTimer < uiDiff )
{
me -> HandleEmoteCommand ( EMOTE_STATE_NONE );
2012-03-16 19:28:10 +08:00
if ( GameObject * go = GetClosestGameObjectWithEntry ( me , GO_DRAENEI_MACHINE , INTERACTION_DISTANCE ))
2010-08-26 11:36:26 +02:00
{
SetEscortPaused ( false );
bTake = false ;
uiTakeTimer = 3000 ;
2012-03-16 19:28:10 +08:00
go -> Delete ();
2010-08-26 11:36:26 +02:00
}
}
else
uiTakeTimer -= uiDiff ;
}
DoMeleeAttackIfReady ();
}
};
2011-10-07 19:45:43 -05:00
bool OnQuestAccept ( Player * player , Creature * creature , const Quest * quest )
2010-08-26 11:36:26 +02:00
{
2011-10-07 19:45:43 -05:00
if ( quest -> GetQuestId () == QUEST_MARK_V_IS_ALIVE )
2010-08-26 11:36:26 +02:00
{
2011-07-02 22:18:03 +02:00
if ( npc_maxx_a_million_escortAI * pEscortAI = CAST_AI ( npc_maxx_a_million_escort :: npc_maxx_a_million_escortAI , creature -> AI ()))
2010-08-26 11:36:26 +02:00
{
2011-07-02 22:18:03 +02:00
creature -> setFaction ( 113 );
2011-07-02 22:52:42 +02:00
pEscortAI -> Start ( false , false , player -> GetGUID ());
2010-08-26 11:36:26 +02:00
}
}
return true ;
}
};
2011-12-25 00:36:17 +01:00
/*######
## go_captain_tyralius_prison
######*/
enum CaptainTyralius
{
NPC_CAPTAIN_TYRALIUS = 20787 ,
SAY_FREE = 0 ,
};
class go_captain_tyralius_prison : public GameObjectScript
{
public :
go_captain_tyralius_prison () : GameObjectScript ( "go_captain_tyralius_prison" ) { }
bool OnGossipHello ( Player * player , GameObject * go )
{
2012-11-30 18:53:13 +01:00
go -> UseDoorOrButton ();
2011-12-25 00:36:17 +01:00
if ( Creature * tyralius = go -> FindNearestCreature ( NPC_CAPTAIN_TYRALIUS , 1.0f ))
{
2011-12-25 01:21:09 +01:00
player -> KilledMonsterCredit ( NPC_CAPTAIN_TYRALIUS , 0 );
tyralius -> AI () -> Talk ( SAY_FREE );
2012-04-24 16:53:37 +02:00
tyralius -> DespawnOrUnsummon ( 8000 );
2011-12-25 00:36:17 +01:00
}
return true ;
}
};
2008-10-21 13:19:26 -05:00
void AddSC_netherstorm ()
{
2010-08-08 22:54:58 +06:00
new go_manaforge_control_console ();
new npc_manaforge_control_console ();
new npc_commander_dawnforge ();
new at_commander_dawnforge ();
new npc_professor_dabiri ();
new mob_phase_hunter ();
new npc_bessy ();
2010-08-26 11:36:26 +02:00
new npc_maxx_a_million_escort ();
2011-12-25 00:36:17 +01:00
new go_captain_tyralius_prison ();
2008-10-21 13:19:26 -05:00
}