Advertisement
Guest User

HOR

a guest
Nov 7th, 2012
951
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 212.52 KB | None | 0 0
  1. diff --git a/src/server/game/Scripting/ScriptLoader.cpp b/src/server/game/Scripting/ScriptLoader.cpp
  2. index 39b5dce..bdda79f 100755
  3. --- a/src/server/game/Scripting/ScriptLoader.cpp
  4. +++ b/src/server/game/Scripting/ScriptLoader.cpp
  5. @@ -485,6 +485,7 @@ void AddSC_instance_halls_of_reflection();   // Halls of Reflection
  6.  void AddSC_halls_of_reflection();
  7.  void AddSC_boss_falric();
  8.  void AddSC_boss_marwyn();
  9. +void AddSC_boss_lich_king_hr();
  10.  void AddSC_boss_lord_marrowgar();       // Icecrown Citadel
  11.  void AddSC_boss_lady_deathwhisper();
  12.  void AddSC_boss_deathbringer_saurfang();
  13. @@ -1208,6 +1209,7 @@ void AddNorthrendScripts()
  14.      AddSC_halls_of_reflection();
  15.      AddSC_boss_falric();
  16.      AddSC_boss_marwyn();
  17. +   AddSC_boss_lich_king_hr();
  18.      AddSC_boss_lord_marrowgar();        // Icecrown Citadel
  19.      AddSC_boss_lady_deathwhisper();
  20.      AddSC_boss_deathbringer_saurfang();
  21. diff --git a/src/server/scripts/Northrend/CMakeLists.txt b/src/server/scripts/Northrend/CMakeLists.txt
  22. index 22d0f37..c2977d5 100644
  23. --- a/src/server/scripts/Northrend/CMakeLists.txt
  24. +++ b/src/server/scripts/Northrend/CMakeLists.txt
  25. @@ -54,6 +54,7 @@ set(scripts_STAT_SRCS
  26.    Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp
  27.    Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h
  28.    Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp
  29. +  Northrend/FrozenHalls/HallsOfReflection/boss_the_lich_king_hor.cpp
  30.    Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp
  31.    Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp
  32.    Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp
  33. diff --git a/sql/custom/hallsofreflection.sql b/sql/custom/hallsofreflection.sql
  34. --- /dev/null
  35. +++ b/sql/custom/hallsofreflection.sql
  36. @@ -0,0 +1,252 @@
  37. +set names utf8;
  38. +
  39. +delete from `gameobject` where `map` = 668;
  40. +delete from `creature` where `map` = 668;
  41. +
  42. +DELETE FROM `conditions` WHERE `SourceEntry` IN (69431,69708,69784,70194,70224,70225,70464);
  43. +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES
  44. +(13, 1, 69784, 0, 0, 31, 0, 3, 37014, 0, 0, 0, '', NULL),
  45. +(13, 3, 69708, 0, 0, 31, 0, 3, 36954, 0, 0, 0, '', NULL),
  46. +(13, 1, 70464, 0, 1, 31, 0, 3, 37496, 0, 0, 0, '', NULL),
  47. +(13, 1, 70464, 0, 2, 31, 0, 3, 37497, 0, 0, 0, '', NULL),
  48. +(13, 1, 70464, 0, 3, 31, 0, 3, 37498, 0, 0, 0, '', NULL),
  49. +(13, 1, 70464, 0, 0, 31, 0, 3, 36881, 0, 0, 0, '', NULL),
  50. +(13, 3, 69708, 0, 1, 31, 0, 3, 37226, 0, 0, 0, '', NULL),
  51. +(13, 3, 70194, 0, 0, 31, 0, 3, 37226, 0, 0, 0, '', NULL),
  52. +(13, 1, 70224, 0, 0, 31, 0, 3, 37014, 0, 0, 0, '', NULL),
  53. +(13, 1, 70225, 0, 0, 31, 0, 3, 37014, 0, 0, 0, '', NULL),
  54. +(13, 1, 69431, 0, 1, 31, 0, 3, 37497, 0, 0, 0, '', NULL),
  55. +(13, 1, 69431, 0, 0, 31, 0, 3, 37496, 0, 0, 0, '', NULL),
  56. +(13, 1, 69431, 0, 4, 31, 0, 3, 37588, 0, 0, 0, '', NULL),
  57. +(13, 1, 69431, 0, 2, 31, 0, 3, 37584, 0, 0, 0, '', NULL),
  58. +(13, 1, 69431, 0, 3, 31, 0, 3, 37587, 0, 0, 0, '', NULL);
  59. +
  60. +insert into `creature` (`id`, `map`, `spawnMask`, `phaseMask`, `modelid`, `equipment_id`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `spawndist`, `currentwaypoint`, `curhealth`, `curmana`, `MovementType`, `npcflag`, `unit_flags`, `dynamicflags`) values('37906','668','3','1','11686','0','5314.98','2013.36','717.077','0.909173','86400','0','0','42','0','0','0','0','0');
  61. +insert into `creature` (`id`, `map`, `spawnMask`, `phaseMask`, `modelid`, `equipment_id`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `spawndist`, `currentwaypoint`, `curhealth`, `curmana`, `MovementType`, `npcflag`, `unit_flags`, `dynamicflags`) values('37906','668','3','1','11686','0','5311.79','1997.99','717.652','4.97445','86400','0','0','42','0','0','0','0','0');
  62. +insert into `creature` (`id`, `map`, `spawnMask`, `phaseMask`, `modelid`, `equipment_id`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `spawndist`, `currentwaypoint`, `curhealth`, `curmana`, `MovementType`, `npcflag`, `unit_flags`, `dynamicflags`) values('37906','668','3','1','11686','0','5300.16','2005.76','719.293','3.21137','86400','0','0','42','0','0','0','0','0');
  63. +insert into `creature` (`id`, `map`, `spawnMask`, `phaseMask`, `modelid`, `equipment_id`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `spawndist`, `currentwaypoint`, `curhealth`, `curmana`, `MovementType`, `npcflag`, `unit_flags`, `dynamicflags`) values('37906','668','3','1','11686','0','5300.33','2009.9','713.591','2.77885','86400','0','0','42','0','0','0','0','0');
  64. +insert into `creature` (`id`, `map`, `spawnMask`, `phaseMask`, `modelid`, `equipment_id`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `spawndist`, `currentwaypoint`, `curhealth`, `curmana`, `MovementType`, `npcflag`, `unit_flags`, `dynamicflags`) values('37906','668','3','1','11686','0','5315.18','2013.65','715.128','0.90371','86400','0','0','42','0','0','0','0','0');
  65. +insert into `creature` (`id`, `map`, `spawnMask`, `phaseMask`, `modelid`, `equipment_id`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `spawndist`, `currentwaypoint`, `curhealth`, `curmana`, `MovementType`, `npcflag`, `unit_flags`, `dynamicflags`) values('37704','668','3','1','17612','0','5309.26','2006.39','718.047','3.97935','86400','0','0','12600','0','0','0','0','0');
  66. +insert into `creature` (`id`, `map`, `spawnMask`, `phaseMask`, `modelid`, `equipment_id`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `spawndist`, `currentwaypoint`, `curhealth`, `curmana`, `MovementType`, `npcflag`, `unit_flags`, `dynamicflags`) values('14881','668','3','1','1160','0','5337.6','2012.14','707.695','3.52509','86400','0','0','8','0','0','0','0','0');
  67. +insert into `creature` (`id`, `map`, `spawnMask`, `phaseMask`, `modelid`, `equipment_id`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `spawndist`, `currentwaypoint`, `curhealth`, `curmana`, `MovementType`, `npcflag`, `unit_flags`, `dynamicflags`) values('37906','668','3','1','11686','0','5302.93','1998.54','718.959','3.98555','86400','0','0','42','0','0','0','0','0');
  68. +insert into `creature` (`id`, `map`, `spawnMask`, `phaseMask`, `modelid`, `equipment_id`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `spawndist`, `currentwaypoint`, `curhealth`, `curmana`, `MovementType`, `npcflag`, `unit_flags`, `dynamicflags`) values('37906','668','3','1','11686','0','5310.47','2016.02','712.831','1.46876','86400','0','0','42','0','0','0','0','0');
  69. +insert into `creature` (`id`, `map`, `spawnMask`, `phaseMask`, `modelid`, `equipment_id`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `spawndist`, `currentwaypoint`, `curhealth`, `curmana`, `MovementType`, `npcflag`, `unit_flags`, `dynamicflags`) values('37779','668','3','1','30687','0','5232.69','1931.52','707.778','0.820305','86400','0','0','75600','0','0','0','0','0');
  70. +insert into `creature` (`id`, `map`, `spawnMask`, `phaseMask`, `modelid`, `equipment_id`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `spawndist`, `currentwaypoint`, `curhealth`, `curmana`, `MovementType`, `npcflag`, `unit_flags`, `dynamicflags`) values('37906','668','3','1','11686','0','5307.8','2003.13','709.424','0.715585','86400','0','0','42','0','0','0','0','0');
  71. +insert into `creature` (`id`, `map`, `spawnMask`, `phaseMask`, `modelid`, `equipment_id`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `spawndist`, `currentwaypoint`, `curhealth`, `curmana`, `MovementType`, `npcflag`, `unit_flags`, `dynamicflags`) values('14881','668','3','1','2536','0','5268.91','1969.17','707.696','0.321519','86400','0','0','8','0','0','0','0','0');
  72. +insert into `creature` (`id`, `map`, `spawnMask`, `phaseMask`, `modelid`, `equipment_id`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `spawndist`, `currentwaypoint`, `curhealth`, `curmana`, `MovementType`, `npcflag`, `unit_flags`, `dynamicflags`) values('37906','668','3','1','11686','0','5320.61','2009.12','715.901','0.267618','86400','0','0','42','0','0','0','0','0');
  73. +insert into `creature` (`id`, `map`, `spawnMask`, `phaseMask`, `modelid`, `equipment_id`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `spawndist`, `currentwaypoint`, `curhealth`, `curmana`, `MovementType`, `npcflag`, `unit_flags`, `dynamicflags`) values('37906','668','3','1','11686','0','5310.23','1998.1','716.838','4.82407','86400','0','0','42','0','0','0','0','0');
  74. +insert into `creature` (`id`, `map`, `spawnMask`, `phaseMask`, `modelid`, `equipment_id`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `spawndist`, `currentwaypoint`, `curhealth`, `curmana`, `MovementType`, `npcflag`, `unit_flags`, `dynamicflags`) values('37906','668','3','1','11686','0','5303.75','1999.49','715.482','4.01671','86400','0','0','42','0','0','0','0','0');
  75. +insert into `creature` (`id`, `map`, `spawnMask`, `phaseMask`, `modelid`, `equipment_id`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `spawndist`, `currentwaypoint`, `curhealth`, `curmana`, `MovementType`, `npcflag`, `unit_flags`, `dynamicflags`) values('37906','668','3','1','11686','0','5315.09','2013.38','721.067','0.886024','86400','0','0','42','0','0','0','0','0');
  76. +insert into `creature` (`id`, `map`, `spawnMask`, `phaseMask`, `modelid`, `equipment_id`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `spawndist`, `currentwaypoint`, `curhealth`, `curmana`, `MovementType`, `npcflag`, `unit_flags`, `dynamicflags`) values('37226','668','3','1','30721','0','5362.46','2062.69','707.778','3.94444','86400','0','0','27890000','0','0','0','0','0');
  77. +insert into `creature` (`id`, `map`, `spawnMask`, `phaseMask`, `modelid`, `equipment_id`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `spawndist`, `currentwaypoint`, `curhealth`, `curmana`, `MovementType`, `npcflag`, `unit_flags`, `dynamicflags`) values('37906','668','3','1','11686','0','5300.25','2003.97','714.337','3.39532','86400','0','0','42','0','0','0','0','0');
  78. +insert into `creature` (`id`, `map`, `spawnMask`, `phaseMask`, `modelid`, `equipment_id`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `spawndist`, `currentwaypoint`, `curhealth`, `curmana`, `MovementType`, `npcflag`, `unit_flags`, `dynamicflags`) values('37906','668','3','1','11686','0','5304.45','2014.65','712.542','2.13851','86400','0','0','42','0','0','0','0','0');
  79. +insert into `creature` (`id`, `map`, `spawnMask`, `phaseMask`, `modelid`, `equipment_id`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `spawndist`, `currentwaypoint`, `curhealth`, `curmana`, `MovementType`, `npcflag`, `unit_flags`, `dynamicflags`) values('14881','668','3','1','1160','0','5386.99','2080.5','707.695','4.67797','86400','0','0','8','0','0','0','0','0');
  80. +insert into `creature` (`id`, `map`, `spawnMask`, `phaseMask`, `modelid`, `equipment_id`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `spawndist`, `currentwaypoint`, `curhealth`, `curmana`, `MovementType`, `npcflag`, `unit_flags`, `dynamicflags`) values('37906','668','3','1','11686','0','5319','2002.85','715.96','5.92525','86400','0','0','42','0','0','0','0','0');
  81. +insert into `creature` (`id`, `map`, `spawnMask`, `phaseMask`, `modelid`, `equipment_id`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `spawndist`, `currentwaypoint`, `curhealth`, `curmana`, `MovementType`, `npcflag`, `unit_flags`, `dynamicflags`) values('37906','668','3','1','11686','0','5310.21','1996.31','716.042','4.77527','86400','0','0','42','0','0','0','0','0');
  82. +insert into `creature` (`id`, `map`, `spawnMask`, `phaseMask`, `modelid`, `equipment_id`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `spawndist`, `currentwaypoint`, `curhealth`, `curmana`, `MovementType`, `npcflag`, `unit_flags`, `dynamicflags`) values('37906','668','3','1','11686','0','5312.31','2016.24','711.687','1.37907','86400','0','0','42','0','0','0','0','0');
  83. +insert into `creature` (`id`, `map`, `spawnMask`, `phaseMask`, `modelid`, `equipment_id`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `spawndist`, `currentwaypoint`, `curhealth`, `curmana`, `MovementType`, `npcflag`, `unit_flags`, `dynamicflags`) values('37223','668','3','1','28213','0','5236.67','1929.91','707.778','0.837758','86400','0','0','6972500','85160','0','0','0','0');
  84. +insert into `creature` (`id`, `map`, `spawnMask`, `phaseMask`, `modelid`, `equipment_id`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `spawndist`, `currentwaypoint`, `curhealth`, `curmana`, `MovementType`, `npcflag`, `unit_flags`, `dynamicflags`) values('37906','668','3','1','11686','0','5312.98','2013.87','721.169','1.10885','86400','0','0','42','0','0','0','0','0');
  85. +insert into `creature` (`id`, `map`, `spawnMask`, `phaseMask`, `modelid`, `equipment_id`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `spawndist`, `currentwaypoint`, `curhealth`, `curmana`, `MovementType`, `npcflag`, `unit_flags`, `dynamicflags`) values('37906','668','3','1','11686','0','5316.66','2013.38','711.619','0.982927','86400','0','0','42','0','0','0','0','0');
  86. +insert into `creature` (`id`, `map`, `spawnMask`, `phaseMask`, `modelid`, `equipment_id`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `spawndist`, `currentwaypoint`, `curhealth`, `curmana`, `MovementType`, `npcflag`, `unit_flags`, `dynamicflags`) values('37906','668','3','1','11686','0','5312.64','2013.21','711.998','1.76884','86400','0','0','42','0','0','0','0','0');
  87. +insert into `creature` (`id`, `map`, `spawnMask`, `phaseMask`, `modelid`, `equipment_id`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `spawndist`, `currentwaypoint`, `curhealth`, `curmana`, `MovementType`, `npcflag`, `unit_flags`, `dynamicflags`) values('37704','668','3','1','17612','0','5309.14','2006.21','715.783','3.9619','86400','0','0','12600','0','0','0','0','0');
  88. +
  89. +insert into `gameobject` (`id`, `map`, `spawnMask`, `phaseMask`, `position_x`, `position_y`, `position_z`, `orientation`, `rotation0`, `rotation1`, `rotation2`, `rotation3`, `spawntimesecs`, `animprogress`, `state`) values('202302','668','3','1','5309.36','2006.55','709.341','-2.33874','0','0','0','1','6000','100','1');
  90. +insert into `gameobject` (`id`, `map`, `spawnMask`, `phaseMask`, `position_x`, `position_y`, `position_z`, `orientation`, `rotation0`, `rotation1`, `rotation2`, `rotation3`, `spawntimesecs`, `animprogress`, `state`) values('197342','668','3','1','5520.77','2229.04','733.04','0.810935','0','0','-0.370856','0.928691','6000','100','0');
  91. +insert into `gameobject` (`id`, `map`, `spawnMask`, `phaseMask`, `position_x`, `position_y`, `position_z`, `orientation`, `rotation0`, `rotation1`, `rotation2`, `rotation3`, `spawntimesecs`, `animprogress`, `state`) values('197343','668','3','1','5582.81','2230.62','733.04','-0.75986','0','0','-0.370856','0.928691','6000','100','0');
  92. +insert into `gameobject` (`id`, `map`, `spawnMask`, `phaseMask`, `position_x`, `position_y`, `position_z`, `orientation`, `rotation0`, `rotation1`, `rotation2`, `rotation3`, `spawntimesecs`, `animprogress`, `state`) values('202236','668','3','1','5309.34','2006.52','709.316','-0.75986','0','0','-0.370856','0.928691','6000','100','1');
  93. +insert into `gameobject` (`id`, `map`, `spawnMask`, `phaseMask`, `position_x`, `position_y`, `position_z`, `orientation`, `rotation0`, `rotation1`, `rotation2`, `rotation3`, `spawntimesecs`, `animprogress`, `state`) values('201747','668','3','1','5231.04','1923.79','707.044','0.810935','0','0','-0.370856','0.928691','6000','100','1');
  94. +insert into `gameobject` (`id`, `map`, `spawnMask`, `phaseMask`, `position_x`, `position_y`, `position_z`, `orientation`, `rotation0`, `rotation1`, `rotation2`, `rotation3`, `spawntimesecs`, `animprogress`, `state`) values('201756','668','3','1','5231.04','1923.79','707.044','0.810935','0','0','-0.370856','0.928691','6000','100','1');
  95. +insert into `gameobject` (`id`, `map`, `spawnMask`, `phaseMask`, `position_x`, `position_y`, `position_z`, `orientation`, `rotation0`, `rotation1`, `rotation2`, `rotation3`, `spawntimesecs`, `animprogress`, `state`) values('201976','668','3','1','5264.61','1959.44','707.724','0.810935','0','0','-0.370856','0.928691','6000','100','0');
  96. +insert into `gameobject` (`id`, `map`, `spawnMask`, `phaseMask`, `position_x`, `position_y`, `position_z`, `orientation`, `rotation0`, `rotation1`, `rotation2`, `rotation3`, `spawntimesecs`, `animprogress`, `state`) values('197341','668','3','1','5358.96','2058.75','707.724','0.810935','0','0','-0.370856','0.928691','6000','100','1');
  97. +insert into `gameobject` (`id`, `map`, `spawnMask`, `phaseMask`, `position_x`, `position_y`, `position_z`, `orientation`, `rotation0`, `rotation1`, `rotation2`, `rotation3`, `spawntimesecs`, `animprogress`, `state`) values('190236','668','3','1','4926.09','1554.96','163.292','-2.26562','0','0','0.999999','-0.001655','6000','100','1');
  98. +insert into `gameobject` (`id`, `map`, `spawnMask`, `phaseMask`, `position_x`, `position_y`, `position_z`, `orientation`, `rotation0`, `rotation1`, `rotation2`, `rotation3`, `spawntimesecs`, `animprogress`, `state`) values('201596','668','3','1','5275.91','1693.72','786.151','4.05956','0','0','0.896503','-0.443037','25','0','0');
  99. +
  100. +
  101. +-- Halls of Reflection
  102. +-- Creature Templates
  103. +UPDATE `creature_template` SET `speed_walk`='1.5', `speed_run`='2.0' WHERE `entry` in (36954, 37226);
  104. +UPDATE `creature_template` SET `AIName`='', `Scriptname`='npc_jaina_and_sylvana_HRintro' WHERE `entry` in (37221, 37223);
  105. +UPDATE `creature_template` SET `AIName`='', `Scriptname`='boss_falric' WHERE `entry`=38112;
  106. +UPDATE `creature_template` SET `AIName`='', `Scriptname`='boss_marwyn' WHERE `entry`=38113;
  107. +UPDATE `creature_template` SET `AIName`='', `Scriptname`='npc_lich_king_hr' WHERE `entry`=36954;
  108. +UPDATE `creature_template` SET `AIName`='', `Scriptname`='boss_lich_king_hor' WHERE `entry`=37226;
  109. +UPDATE `creature_template` SET `AIName`='', `Scriptname`='npc_jaina_and_sylvana_HRextro' WHERE `entry` in (36955, 37554);
  110. +UPDATE `creature_template` SET `AIName`='', `Scriptname`='npc_raging_gnoul' WHERE `entry`=36940;
  111. +UPDATE `creature_template` SET `AIName`='', `Scriptname`='npc_risen_witch_doctor' WHERE `entry`=36941;
  112. +UPDATE `creature_template` SET `AIName`='', `Scriptname`='npc_abon' WHERE `entry`=37069;
  113. +UPDATE `creature_template` SET `AIName`='', `Scriptname`='npc_ghostly_priest' WHERE `entry`=38175;
  114. +UPDATE `creature_template` SET `AIName`='', `Scriptname`='npc_phantom_mage' WHERE `entry`=38172;
  115. +UPDATE `creature_template` SET `AIName`='', `Scriptname`='npc_phantom_hallucination' WHERE `entry`=38567;
  116. +UPDATE `creature_template` SET `AIName`='', `Scriptname`='npc_shadowy_mercenary' WHERE `entry`=38177;
  117. +UPDATE `creature_template` SET `AIName`='', `Scriptname`='npc_spectral_footman' WHERE `entry`=38173;
  118. +UPDATE `creature_template` SET `AIName`='', `Scriptname`='npc_ghostly_priest' WHERE `entry`=38176;
  119. +UPDATE `creature_template` SET `AIName`='', `Scriptname`='npc_frostworn_general' WHERE `entry`=36723;
  120. +UPDATE `creature_template` SET `AIName`='', `Scriptname`='npc_tortured_rifleman' WHERE `entry`=38176;
  121. +
  122. +UPDATE `creature_template` SET `scale`='0.8', `equipment_id`='1221' WHERE `entry` in (37221, 36955);
  123. +UPDATE `creature_template` SET `equipment_id`='1290' WHERE `entry` in (37223, 37554);
  124. +UPDATE `creature_template` SET `equipment_id`='0' WHERE `entry`=36954;
  125. +UPDATE `creature_template` SET `scale`='1' WHERE `entry`=37223;
  126. +UPDATE `creature_template` SET `scale`='0.8' WHERE `entry` in (36658, 37225, 37223, 37226, 37554);
  127. +UPDATE `creature_template` SET `unit_flags`='768', `type_flags`='268435564' WHERE `entry` in (38177, 38176, 38173, 38172, 38567, 38175);
  128. +UPDATE `creature_template` set `scale`='1' where `entry` in (37223);
  129. +UPDATE `instance_template` SET `script` = 'instance_hall_of_reflection' WHERE map=668;
  130. +UPDATE `gameobject_template` SET `faction`='1375' WHERE `entry` in (197341, 202302, 201385, 201596);
  131. +UPDATE `creature` SET `phaseMask` = 128 WHERE `id` = 36993;
  132. +UPDATE `creature` SET `phaseMask` = 64 WHERE `id` = 36990;
  133. +UPDATE `instance_template` SET `script` = 'instance_halls_of_reflection' WHERE map=668;
  134. +DELETE FROM `script_texts` WHERE `entry` BETWEEN -1594540 AND -1594430;
  135. +INSERT INTO `script_texts` (`entry`,`content_default`,`content_loc8`,`sound`,`type`,`language`,`emote`,`comment`) VALUES
  136. +(-1594473, '<need translate>', '?????? ????????! ??? ???? ?? ????? ????? ????! ?????? ?? ???? ???????, ?????? ?????? ? ???? ????????!', 17229,1,0,0, '67234'),
  137. +(-1594474, '<need translate>', '? ?? ??????? ??????? ??????, ????????. ?? ???? ??? ???? ?? ????????. ?? ?? ????????? ????? ??????? ? ?????? ???? ???? ?????? ????????!', 17228,1,0,0, '67234'),
  138. +-- SCENE - Hall Of Reflection (Extro) - PreEscape
  139. +(-1594477, 'Your allies have arrived, Jaina, just as you promised. You will all become powerful agents of the Scourge.', '???? ???????? ???????, ??????! ??? ?? ? ???????... ??-??-??-??... ??? ?? ??????? ???????? ????????? ?????...', 17212,1,0,0, '67234'),
  140. +(-1594478, 'I will not make the same mistake again, Sylvanas. This time there will be no escape. You will all serve me in death!', '? ?? ??????? ??????? ??????, ????????! ?? ???? ??? ???? ?? ????????. ?? ??? ?????? ??????? ??? ????? ??????...', 17213,1,0,0, '67234'),
  141. +(-1594479, 'He is too powerful, we must leave this place at once! My magic will hold him in place for only a short time! Come quickly, heroes!', '?? ??????? ?????. ?? ?????? ????????? ?? ???? ??? ????? ??????. ??? ????? ???????? ??? ?????????, ??????? ?????...', 16644,0,0,1, '67234'),
  142. +(-1594480, 'He\'s too powerful! Heroes, quickly, come to me! We must leave this place immediately! I will do what I can do hold him in place while we flee.', '?? ??????? ?????. ????? ??????, ?? ????. ?? ?????? ????????? ?????? ??????????. ? ?????????? ??? ?????????, ???? ?? ????? ???????.', 17058,0,0,1, '67234'),
  143. +-- SCENE - Hall Of Reflection (Extro) - Escape
  144. +(-1594481, 'Death\'s cold embrace awaits.', '?????? ???????????? ??????? ???????!', 17221,1,0,0, '67234'),
  145. +(-1594482, 'Rise minions, do not left them us!', '?????????? ???????????, ?? ????? ?? ???????!', 17216,1,0,0, '67234'),
  146. +(-1594483, 'Minions sees them. Bring their corpses back to me!', '???????? ??! ????????? ??? ?? ????!', 17222,1,0,0, '67234'),
  147. +(-1594484, 'No...', '??????? ???!', 17214,1,0,0, '67234'),
  148. +(-1594485, 'All is lost!', '??????? ? ???????.', 17215,1,0,0, '67234'),
  149. +(-1594486, 'There is no escape!', '?????? ??????!', 17217,1,0,0, '67234'),
  150. +(-1594487, 'I will destroy this barrier. You must hold the undead back!', '? ??????? ??? ????????, ? ?? ??????????? ?????? ?? ??????????!', 16607,1,0,0, '67234'),
  151. +(-1594488, 'No wall can hold the Banshee Queen! Keep the undead at bay, heroes! I will tear this barrier down!', '??????? ????? ?? ??????? ???????? ??????. ??????? ?????? ?? ??????????, ? ??????? ??? ????????.', 17029,1,0,0, '67234'),
  152. +(-1594489, 'Another ice wall! Keep the undead from interrupting my incantation so that I may bring this wall down!', '????? ??????? ?????... ? ??????? ??, ?????? ?? ????? ?????? ???????? ??? ??????????...', 16608,1,0,0, '67234'),
  153. +(-1594490, 'Another barrier? Stand strong, champions! I will bring the wall down!', '??? ???? ????????. ????????? ?????! ? ??????? ??? ?????!', 17030,1,0,0, '67234'),
  154. +(-1594491, 'Succumb to the chill of the grave.', '?????????? ????????? ??????!', 17218,1,0,0, '67234'),
  155. +(-1594492, 'Another dead end.', '?? ? ???????!', 17219,1,0,0, '67234'),
  156. +(-1594493, 'How long can you fight it?', '??? ????? ?? ??????? ???????????????', 17220,1,0,0, '67234'),
  157. +(-1594494, '<need translate>', '?? ? ???? ??????. ?  ?????? ??? ??? ?????? ????? ??? ??????????? ?? ?????!', 16609,0,0,0, '67234'),
  158. +(-1594495, 'Your barriers can\'t hold us back much longer, monster. I will shatter them all!', '???? ???????? ?????? ?? ???????? ???, ????????. ? ????? ?? ? ????!', 16610,1,0,0, '67234'),
  159. +(-1594496, 'I grow tired of these games, Arthas! Your walls can\'t stop me!', '? ?????? ?? ???? ??? ?????. ???? ????? ?? ????????? ????!', 17031,1,0,0, '67234'),
  160. +(-1594497, 'You won\'t impede our escape, fiend. Keep the undead off me while I bring this barrier down!', '?? ?? ????????? ??? ????, ??????. ??????????? ??????, ? ? ???????? ??? ????????.', 17032,1,0,0, '67234'),
  161. +(-1594498, 'There\'s an opening up ahead. GO NOW!', '? ???? ?????, ??????!', 16645,1,0,0, '67234'),
  162. +(-1594499, 'We\'re almost there... Don\'t give up!', '?? ????? ?????????, ?? ??????????!', 16646,1,0,0, '67234'),
  163. +(-1594500, 'There\'s an opening up ahead. GO NOW!', '? ???? ?????, ??????!', 17059,1,0,0, '67234'),
  164. +(-1594501, 'We\'re almost there! Don\'t give up!', '?? ????? ?????????, ?? ??????????!', 17060,1,0,0, '67234'),
  165. +(-1594502, 'It... It\'s a dead end. We have no choice but to fight. Steel yourself heroes, for this is our last stand!', '?????? ?????? ??????. ?????? ??? ???????? ?????????. ??? ???? ????????? ?????!', 16647,1,0,0, '67234'),
  166. +(-1594503, 'BLASTED DEAD END! So this is how it ends. Prepare yourselves, heroes, for today we make our final stand!', '????????? ?????, ?????? ??? ?????????? ?????. ?????????? ?????, ??? ???? ????????? ?????.', 17061,1,0,0, '67234'),
  167. +(-1594504, 'Nowhere to run! You\'re mine now...', '??-??-??... ?????? ??????. ?????? ?? ???!', 17223,1,0,0, '67234'),
  168. +(-1594505, 'Soldiers of Lordaeron, rise to meet your master\'s call!', '??????? ?????????, ?????????? ?? ???? ?????????!', 16714,1,0,0, '67234'),
  169. +(-1594506, 'The master surveyed his kingdom and found it... lacking. His judgement was swift and without mercy. Death to all!', '???????? ???????? ???? ??????????? ? ??????? ??? ????????! ??? ??? ??? ??????? ? ??????? - ??????? ???? ??????!', 16738,1,0,0, '67234'),
  170. +-- FrostWorn General
  171. +(-1594519, 'You are not worthy to face the Lich King!', '?? ?????????? ????????? ????? ??????? - ?????!', 16921,1,0,0, '67234'),
  172. +(-1594520, 'Master, I have failed...', '????????... ? ?????? ???...', 16922,1,0,0, '67234');
  173. +
  174. +-- Waipoints to escort event on Halls of reflection
  175. +
  176. +DELETE FROM script_waypoint WHERE entry IN (36955,37226,37554);
  177. +INSERT INTO script_waypoint VALUES
  178. +-- Jaina
  179. +
  180. +   (36955, 0, 5587.682,2228.586,733.011, 0, 'WP1'),
  181. +   (36955, 1, 5600.715,2209.058,731.618, 0, 'WP2'),
  182. +   (36955, 2, 5606.417,2193.029,731.129, 0, 'WP3'),
  183. +   (36955, 3, 5598.562,2167.806,730.918, 0, 'WP4 - Summon IceWall 01'),
  184. +   (36955, 4, 5556.436,2099.827,731.827, 0, 'WP5 - Spell Channel'),
  185. +   (36955, 5, 5543.498,2071.234,731.702, 0, 'WP6'),
  186. +   (36955, 6, 5528.969,2036.121,731.407, 0, 'WP7'),
  187. +   (36955, 7, 5512.045,1996.702,735.122, 0, 'WP8'),
  188. +   (36955, 8, 5504.490,1988.789,735.886, 0, 'WP9 - Spell Channel'),
  189. +   (36955, 9, 5489.645,1966.389,737.653, 0, 'WP10'),
  190. +   (36955, 10, 5475.517,1943.176,741.146, 0, 'WP11'),
  191. +   (36955, 11, 5466.930,1926.049,743.536, 0, 'WP12'),
  192. +   (36955, 12, 5445.157,1894.955,748.757, 0, 'WP13 - Spell Channel'),
  193. +   (36955, 13, 5425.907,1869.708,753.237, 0, 'WP14'),
  194. +   (36955, 14, 5405.118,1833.937,757.486, 0, 'WP15'),
  195. +   (36955, 15, 5370.324,1799.375,761.007, 0, 'WP16'),
  196. +   (36955, 16, 5335.422,1766.951,767.635, 0, 'WP17 - Spell Channel'),
  197. +   (36955, 17, 5311.438,1739.390,774.165, 0, 'WP18'),
  198. +   (36955, 18, 5283.589,1703.755,784.176, 0, 'WP19'),
  199. +   (36955, 19, 5260.400,1677.775,784.301, 3000, 'WP20'),
  200. +   (36955, 20, 5262.439,1680.410,784.294, 0, 'WP21'),
  201. +   (36955, 21, 5260.400,1677.775,784.301, 0, 'WP22'),
  202. +
  203. +-- Sylvana
  204. +
  205. +   (37554, 0, 5587.682,2228.586,733.011, 0, 'WP1'),
  206. +   (37554, 1, 5600.715,2209.058,731.618, 0, 'WP2'),
  207. +   (37554, 2, 5606.417,2193.029,731.129, 0, 'WP3'),
  208. +   (37554, 3, 5598.562,2167.806,730.918, 0, 'WP4 - Summon IceWall 01'),
  209. +   (37554, 4, 5556.436,2099.827,731.827, 0, 'WP5 - Spell Channel'),
  210. +   (37554, 5, 5543.498,2071.234,731.702, 0, 'WP6'),
  211. +   (37554, 6, 5528.969,2036.121,731.407, 0, 'WP7'),
  212. +   (37554, 7, 5512.045,1996.702,735.122, 0, 'WP8'),
  213. +   (37554, 8, 5504.490,1988.789,735.886, 0, 'WP9 - Spell Channel'),
  214. +   (37554, 9, 5489.645,1966.389,737.653, 0, 'WP10'),
  215. +   (37554, 10, 5475.517,1943.176,741.146, 0, 'WP11'),
  216. +   (37554, 11, 5466.930,1926.049,743.536, 0, 'WP12'),
  217. +   (37554, 12, 5445.157,1894.955,748.757, 0, 'WP13 - Spell Channel'),
  218. +   (37554, 13, 5425.907,1869.708,753.237, 0, 'WP14'),
  219. +   (37554, 14, 5405.118,1833.937,757.486, 0, 'WP15'),
  220. +   (37554, 15, 5370.324,1799.375,761.007, 0, 'WP16'),
  221. +   (37554, 16, 5335.422,1766.951,767.635, 0, 'WP17 - Spell Channel'),
  222. +   (37554, 17, 5311.438,1739.390,774.165, 0, 'WP18'),
  223. +   (37554, 18, 5283.589,1703.755,784.176, 0, 'WP19'),
  224. +   (37554, 19, 5260.400,1677.775,784.301, 3000, 'WP20'),
  225. +   (37554, 20, 5262.439,1680.410,784.294, 0, 'WP21'),
  226. +   (37554, 21, 5260.400,1677.775,784.301, 0, 'WP22'),
  227. +
  228. +-- Lich King
  229. +
  230. +   (37226, 0, 5577.187,2236.003,733.012, 0, 'WP1'),
  231. +   (37226, 1, 5587.682,2228.586,733.011, 0, 'WP2'),
  232. +   (37226, 2, 5600.715,2209.058,731.618, 0, 'WP3'),
  233. +   (37226, 3, 5606.417,2193.029,731.129, 0, 'WP4'),
  234. +   (37226, 4, 5598.562,2167.806,730.918, 0, 'WP5'),
  235. +   (37226, 5, 5559.218,2106.802,731.229, 0, 'WP6'),
  236. +   (37226, 6, 5543.498,2071.234,731.702, 0, 'WP7'),
  237. +   (37226, 7, 5528.969,2036.121,731.407, 0, 'WP8'),
  238. +   (37226, 8, 5512.045,1996.702,735.122, 0, 'WP9'),
  239. +   (37226, 9, 5504.490,1988.789,735.886, 0, 'WP10'),
  240. +   (37226, 10, 5489.645,1966.389,737.653, 0, 'WP10'),
  241. +   (37226, 11, 5475.517,1943.176,741.146, 0, 'WP11'),
  242. +   (37226, 12, 5466.930,1926.049,743.536, 0, 'WP12'),
  243. +   (37226, 13, 5445.157,1894.955,748.757, 0, 'WP13'),
  244. +   (37226, 14, 5425.907,1869.708,753.237, 0, 'WP14'),
  245. +   (37226, 15, 5405.118,1833.937,757.486, 0, 'WP15'),
  246. +   (37226, 16, 5370.324,1799.375,761.007, 0, 'WP16'),
  247. +   (37226, 17, 5335.422,1766.951,767.635, 0, 'WP17'),
  248. +   (37226, 18, 5311.438,1739.390,774.165, 0, 'WP18'),
  249. +   (37226, 19, 5283.589,1703.755,784.176, 0, 'WP19'),
  250. +   (37226, 20, 5278.694,1697.912,785.692, 0, 'WP20'),
  251. +   (37226, 21, 5283.589,1703.755,784.176, 0, 'WP19');
  252. +  
  253. +-- Fixed Halls of Reflection
  254. +DELETE FROM `gameobject_template` WHERE `entry` = 500001;
  255. +INSERT INTO `gameobject_template` VALUES ('500001', '0', '9214', 'Ice Wall', '', '', '', '1375', '0', '2.5', '0', '0', '0', '0', '0', '0', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '1');
  256. +DELETE FROM `creature` WHERE `id` IN (38112,37223,37221,36723,36955,37158,38113,37554,37226) AND `map` = 668;
  257. +INSERT INTO `creature` (`id`,`map`,`spawnMask`,`phaseMask`,`modelid`,`equipment_id`,`position_x`,`position_y`,`position_z`,`orientation`,`spawntimesecs`,`spawndist`,`currentwaypoint`,`curhealth`,`curmana`,`MovementType`,`npcflag`,`unit_flags`,`dynamicflags`)
  258. +VALUES
  259. +('38112', '668', '3', '1', '0', '0', '5276.81', '2037.45', '709.32', '5.58779', '604800', '0', '0', '377468', '0', '0', '0', '0', '0'),
  260. +('37223', '668', '3', '64', '0', '0', '5266.78', '1953.42', '707.697', '0.740877', '7200', '0', '0', '6972500', '85160', '0', '0', '0', '0'),
  261. +('37221', '668', '3', '128', '0', '0', '5266.78', '1953.42', '707.697', '0.740877', '7200', '0', '0', '5040000', '881400', '0', '0', '0', '0'),
  262. +('36723', '668', '3', '1', '0', '0', '5413.84', '2116.44', '707.695', '3.88117', '7200', '0', '0', '315000', '0', '0', '0', '0', '0'),
  263. +('36955', '668', '3', '128', '0', '0', '5547.27', '2256.95', '733.011', '0.835987', '7200', '0', '0', '252000', '881400', '0', '0', '0', '0'),
  264. +('37158', '668', '3', '99', '0', '0', '5304.5', '2001.35', '709.341', '4.15073', '7200', '0', '0', '214200', '0', '0', '0', '0', '0'),
  265. +('38113', '668', '3', '1', '0', '0', '5341.72', '1975.74', '709.32', '2.40694', '604800', '0', '0', '539240', '0', '0', '0', '0', '0'),
  266. +('37554', '668', '3', '64', '0', '0', '5547.27', '2256.95', '733.011', '0.835987', '7200', '0', '0', '252000', '881400', '0', '0', '0', '0'),
  267. +('37226', '668', '3', '1', '0', '0', '5551.29', '2261.33', '733.012', '4.0452', '604800', '0', '0', '27890000', '0', '0', '0', '0', '0');
  268. +DELETE FROM `gameobject` WHERE `id` IN (202302,202236,201596,500001,196391,196392,202396,201885,197341,201976,197342,197343,201385,202212,201710,202337,202336,202079) AND `map`=668;
  269. +INSERT INTO `gameobject` (`id`,`map`,`spawnMask`,`phaseMask`,`position_x`,`position_y`,`position_z`,`orientation`,`rotation0`,`rotation1`,`rotation2`,`rotation3`,`spawntimesecs`,`animprogress`,`state`)
  270. +VALUES
  271. +('202302', '668', '3', '1', '5309.51', '2006.64', '709.341', '5.50041', '0', '0', '0.381473', '-0.92438', '604800', '100', '1'),
  272. +('202236', '668', '3', '1', '5309.51', '2006.64', '709.341', '5.53575', '0', '0', '0.365077', '-0.930977', '604800', '100', '1'),
  273. +('201596', '668', '3', '1', '5275.28', '1694.23', '786.147', '0.981225', '0', '0', '0.471166', '0.882044', '25', '0', '1'),
  274. +('500001', '668', '3', '1', '5323.61', '1755.85', '770.305', '0.784186', '0', '0', '0.382124', '0.924111', '604800', '100', '1'),
  275. +('196391', '668', '3', '1', '5232.31', '1925.57', '707.695', '0.815481', '0', '0', '0.396536', '0.918019', '300', '0', '1'),
  276. +('196392', '668', '3', '1', '5232.31', '1925.57', '707.695', '0.815481', '0', '0', '0.396536', '0.918019', '300', '0', '1'),
  277. +('202396', '668', '3', '1', '5434.27', '1881.12', '751.303', '0.923328', '0', '0', '0.445439', '0.895312', '604800', '100', '1'),
  278. +('201885', '668', '3', '1', '5494.3', '1978.27', '736.689', '1.0885', '0', '0', '0.517777', '0.855516', '604800', '100', '1'),
  279. +('197341', '668', '3', '1', '5359.24', '2058.35', '707.695', '3.96022', '0', '0', '0.917394', '-0.397981', '300', '100', '1'),
  280. +('201976', '668', '3', '1', '5264.6', '1959.55', '707.695', '0.736951', '0', '0', '0.360194', '0.932877', '300', '100', '0'),
  281. +('197342', '668', '3', '1', '5520.72', '2228.89', '733.011', '0.778581', '0', '0', '0.379532', '0.925179', '300', '100', '1'),
  282. +('197343', '668', '3', '1', '5582.96', '2230.59', '733.011', '5.49098', '0', '0', '0.385827', '-0.922571', '300', '100', '1'),
  283. +('201385', '668', '3', '1', '5540.39', '2086.48', '731.066', '1.00057', '0', '0', '0.479677', '0.877445', '604800', '100', '1'),
  284. +('202212', '668', '1', '65535', '5241.05', '1663.44', '784.295', '0.54', '0', '0', '0', '0', '-604800', '100', '1'),
  285. +('201710', '668', '1', '65535', '5241.05', '1663.44', '784.295', '0.54', '0', '0', '0', '0', '-604800', '100', '1'),
  286. +('202337', '668', '2', '65535', '5241.05', '1663.44', '784.295', '0.54', '0', '0', '0', '0', '-604800', '100', '1'),
  287. +('202336', '668', '2', '65535', '5241.05', '1663.44', '784.295', '0.54', '0', '0', '0', '0', '-604800', '100', '1'),
  288. +('202079', '668', '3', '1', '5250.96', '1639.36', '784.302', '0', '0', '0', '0', '0', '-604800', '100', '1');
  289. \ No newline at end of file
  290. --- /dev/null
  291. +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_the_lich_king_hor.cpp
  292. @@ -0,0 +1,595 @@
  293. +/*
  294. + * Copyright (C) 2008 - 2010 Trinity <http://www.trinitycore.org/>
  295. + *
  296. + * Copyright (C) 2006 - 2010 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
  297. + *
  298. + * This program is free software; you can redistribute it and/or modify
  299. + * it under the terms of the GNU General Public License as published by
  300. + * the Free Software Foundation; either version 2 of the License, or
  301. + * (at your option) any later version.
  302. + *
  303. + * This program is distributed in the hope that it will be useful,
  304. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  305. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  306. + * GNU General Public License for more details.
  307. + *
  308. + * You should have received a copy of the GNU General Public License
  309. + * along with this program; if not, write to the Free Software
  310. + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  311. + */
  312. +
  313. + /* ScriptData
  314. + SDName: boss_Lich_king
  315. + SD%Complete: 0%
  316. + SDComment: new script for tc implementation.
  317. + SDCategory: Halls of Reflection
  318. + EndScriptData */
  319. +
  320. +#include "ScriptPCH.h"
  321. +#include "halls_of_reflection.h"
  322. +#include "ScriptedEscortAI.h"
  323. +#include "Unit.h"
  324. +
  325. +enum
  326. +{
  327. +    SPELL_WINTER                       = 69780,
  328. +    SPELL_FURY_OF_FROSTMOURNE          = 70063,
  329. +    SPELL_SOUL_REAPER                  = 73797,
  330. +    SPELL_RAISE_DEAD                   = 69818,
  331. +    SPELL_ICE_PRISON                   = 69708,
  332. +    SPELL_DARK_ARROW                   = 70194,
  333. +    SPELL_EMERGE_VISUAL                = 50142,
  334. +    SPELL_DESTROY_ICE_WALL_02          = 70224,
  335. +    SPELL_SILENCE                      = 69413,
  336. +    SPELL_LICH_KING_CAST               = 57561,
  337. +    SPELL_GNOUL_JUMP                   = 70150,
  338. +    SPELL_ABON_STRIKE                  = 40505,
  339. +    SPELL_FROSTMOURNE_VISUAL           = 73220,
  340. +
  341. +    /*SPELLS - Witch Doctor*/
  342. +    SPELL_COURSE_OF_DOOM               = 70144,
  343. +    SPELL_SHADOW_BOLT_VALLEY           = 70145,
  344. +    SPELL_SHADOW_BOLT_N                = 70080,
  345. +    SPELL_SHADOW_BOLT_H                = 70182,
  346. +
  347. +    SAY_LICH_KING_WALL_01              = -1594486,
  348. +    SAY_LICH_KING_WALL_02              = -1594491,
  349. +    SAY_LICH_KING_GNOUL                = -1594482,
  350. +    SAY_LICH_KING_ABON                 = -1594483,
  351. +    SAY_LICH_KING_WINTER               = -1594481,
  352. +    SAY_LICH_KING_END_DUN              = -1594504,
  353. +    SAY_LICH_KING_WIN                  = -1594485,
  354. +};
  355. +
  356. +class boss_lich_king_hor : public CreatureScript
  357. +{
  358. +public:
  359. +    boss_lich_king_hor() : CreatureScript("boss_lich_king_hor") { }
  360. +
  361. +    CreatureAI* GetAI(Creature* pCreature) const
  362. +    {
  363. +        return new boss_lich_king_horAI(pCreature);
  364. +    }
  365. +
  366. +    struct boss_lich_king_horAI : public npc_escortAI
  367. +    {
  368. +        boss_lich_king_horAI(Creature *pCreature) : npc_escortAI(pCreature)
  369. +        {
  370. +            m_pInstance = (InstanceScript*)pCreature->GetInstanceScript();
  371. +            Reset();
  372. +        }
  373. +
  374. +        InstanceScript* m_pInstance;
  375. +        uint32 Step;
  376. +        uint32 StepTimer;
  377. +        bool StartEscort;
  378. +        bool IceWall01;
  379. +        bool NonFight;
  380. +        bool Finish;
  381. +
  382. +        void Reset()
  383. +        {
  384. +            if(!m_pInstance)
  385. +                return;
  386. +            NonFight = false;
  387. +            StartEscort = false;
  388. +            me->CastSpell(me, SPELL_FROSTMOURNE_VISUAL, false);
  389. +        }
  390. +
  391. +        void JustDied(Unit* pKiller) { }
  392. +
  393. +        void WaypointReached(uint32 i)
  394. +        {
  395. +            switch(i)
  396. +            {
  397. +                case 20:
  398. +                    SetEscortPaused(true);
  399. +                    Finish = true;
  400. +                    DoCast(me, SPELL_LICH_KING_CAST);
  401. +                    m_pInstance->SetData(TYPE_LICH_KING, SPECIAL);
  402. +                    DoScriptText(SAY_LICH_KING_END_DUN, me);
  403. +                    if(Creature* pLider = ((Creature*)Unit::GetUnit((*me), m_pInstance->GetData64(DATA_ESCAPE_LIDER))))
  404. +                        me->CastSpell(pLider, SPELL_SILENCE, false);
  405. +                    me->setActive(false);
  406. +                    break;
  407. +            }
  408. +        }
  409. +
  410. +        void AttackStart(Unit* who)
  411. +        {
  412. +            if (!m_pInstance || !who)
  413. +                return;
  414. +
  415. +            if (NonFight)
  416. +                return;
  417. +
  418. +            if(m_pInstance->GetData(TYPE_LICH_KING) == IN_PROGRESS || who->GetTypeId() == TYPEID_PLAYER)
  419. +                return;
  420. +
  421. +            npc_escortAI::AttackStart(who);
  422. +        }
  423. +
  424. +        void JustSummoned(Creature* summoned)
  425. +        {
  426. +            if(!m_pInstance || !summoned)
  427. +                return;
  428. +
  429. +            summoned->SetPhaseMask(65535, true);
  430. +            summoned->SetInCombatWithZone();
  431. +            summoned->setActive(true);
  432. +
  433. +            m_pInstance->SetData(DATA_SUMMONS, 1);
  434. +            if (Unit* pLider = Unit::GetUnit((*me), m_pInstance->GetData64(DATA_ESCAPE_LIDER)))
  435. +            {
  436. +                summoned->GetMotionMaster()->MoveChase(pLider);
  437. +                summoned->AddThreat(pLider, 100.0f);
  438. +            }
  439. +        }
  440. +
  441. +        void CallGuard(uint32 GuardID)
  442. +        {
  443. +            me->SummonCreature(GuardID,(me->GetPositionX()-5)+rand()%10, (me->GetPositionY()-5)+rand()%10, me->GetPositionZ(),4.17f,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,360000);
  444. +        }
  445. +
  446. +        void Wall01()
  447. +        {
  448. +            switch(Step)
  449. +            {
  450. +                case 0:
  451. +                    SetEscortPaused(true);
  452. +                    m_pInstance->SetData(DATA_SUMMONS, 3);
  453. +                    DoScriptText(SAY_LICH_KING_WALL_01, me);
  454. +                    DoCast(me, SPELL_DESTROY_ICE_WALL_02);
  455. +                    StepTimer = 2000;
  456. +                    ++Step;
  457. +                    break;
  458. +                case 1:
  459. +                    StepTimer = 2000;
  460. +                    ++Step;
  461. +                    break;
  462. +                case 2:
  463. +                    DoCast(me, SPELL_RAISE_DEAD);
  464. +                    DoScriptText(SAY_LICH_KING_GNOUL, me);
  465. +                    StepTimer = 7000;
  466. +                    ++Step;
  467. +                    break;
  468. +                case 3:
  469. +                    DoCast(me, SPELL_WINTER);
  470. +                    DoScriptText(SAY_LICH_KING_WINTER, me);
  471. +                    me->SetSpeed(MOVE_WALK, 1.1f, true);
  472. +                    StepTimer = 1000;
  473. +                    ++Step;
  474. +                    break;
  475. +                case 4:
  476. +                    SetEscortPaused(false);
  477. +                    StepTimer = 2000;
  478. +                    ++Step;
  479. +                    break;
  480. +                case 5:
  481. +                    CallGuard(NPC_RISEN_WITCH_DOCTOR);
  482. +                    m_pInstance->SetData(TYPE_ICE_WALL_01, DONE);
  483. +                    StepTimer = 100;
  484. +                    Step = 0;
  485. +                    break;
  486. +            }
  487. +        }
  488. +
  489. +        void Wall02()
  490. +        {
  491. +            switch(Step)
  492. +            {
  493. +                case 0:
  494. +                    m_pInstance->SetData(DATA_SUMMONS, 3);
  495. +                    SetEscortPaused(true);
  496. +                    DoCast(me, SPELL_RAISE_DEAD);
  497. +                    DoScriptText(SAY_LICH_KING_GNOUL, me);
  498. +                    StepTimer = 10000;
  499. +                    ++Step;
  500. +                    break;
  501. +                case 1:
  502. +                    SetEscortPaused(false);
  503. +                    CallGuard(NPC_RISEN_WITCH_DOCTOR);
  504. +                    CallGuard(NPC_RISEN_WITCH_DOCTOR);
  505. +                    CallGuard(NPC_ABON);
  506. +                    m_pInstance->SetData(TYPE_ICE_WALL_02, DONE);
  507. +                    StepTimer = 100;
  508. +                    Step = 0;
  509. +                    break;
  510. +            }
  511. +        }
  512. +
  513. +        void Wall03()
  514. +        {
  515. +            switch(Step)
  516. +            {
  517. +                case 0:
  518. +                    m_pInstance->SetData(DATA_SUMMONS, 3);
  519. +                    SetEscortPaused(true);
  520. +                    DoCast(me, SPELL_RAISE_DEAD);
  521. +                    DoScriptText(SAY_LICH_KING_GNOUL, me);
  522. +                    StepTimer = 10000;
  523. +                    ++Step;
  524. +                    break;
  525. +                case 1:
  526. +                    SetEscortPaused(false);
  527. +                    DoScriptText(SAY_LICH_KING_ABON, me);
  528. +                    CallGuard(NPC_RISEN_WITCH_DOCTOR);
  529. +                    CallGuard(NPC_RISEN_WITCH_DOCTOR);
  530. +                    CallGuard(NPC_RISEN_WITCH_DOCTOR);
  531. +                    CallGuard(NPC_ABON);
  532. +                    CallGuard(NPC_ABON);
  533. +                    m_pInstance->SetData(TYPE_ICE_WALL_03, DONE);
  534. +                    StepTimer = 100;
  535. +                    Step = 0;
  536. +                    break;
  537. +            }
  538. +        }
  539. +
  540. +        void Wall04()
  541. +        {
  542. +            switch(Step)
  543. +            {
  544. +                case 0:
  545. +                    m_pInstance->SetData(DATA_SUMMONS, 3);
  546. +                    SetEscortPaused(true);
  547. +                    DoCast(me, SPELL_RAISE_DEAD);
  548. +                    DoScriptText(SAY_LICH_KING_GNOUL, me);
  549. +                    StepTimer = 10000;
  550. +                    ++Step;
  551. +                    break;
  552. +                case 1:
  553. +                    SetEscortPaused(false);
  554. +                    CallGuard(NPC_RISEN_WITCH_DOCTOR);
  555. +                    CallGuard(NPC_RISEN_WITCH_DOCTOR);
  556. +                    CallGuard(NPC_RISEN_WITCH_DOCTOR);
  557. +                    CallGuard(NPC_ABON);
  558. +                    CallGuard(NPC_ABON);
  559. +                    StepTimer = 15000;
  560. +                    ++Step;
  561. +                    break;
  562. +                case 2:
  563. +                    DoScriptText(SAY_LICH_KING_ABON, me);
  564. +                    CallGuard(NPC_RISEN_WITCH_DOCTOR);
  565. +                    CallGuard(NPC_RISEN_WITCH_DOCTOR);
  566. +                    m_pInstance->SetData(TYPE_ICE_WALL_04, DONE);
  567. +                    ++Step;
  568. +                    break;
  569. +            }
  570. +        }
  571. +
  572. +        void UpdateEscortAI(const uint32 diff)
  573. +        {
  574. +            if(!m_pInstance)
  575. +                return;
  576. +
  577. +            if(m_pInstance->GetData(TYPE_LICH_KING) != IN_PROGRESS)
  578. +            {
  579. +                if (!UpdateVictim())
  580. +                    return;
  581. +
  582. +                DoMeleeAttackIfReady();
  583. +            }
  584. +
  585. +            if(me->isInCombat() && m_pInstance->GetData(TYPE_LICH_KING) == IN_PROGRESS)
  586. +            {
  587. +                npc_escortAI::EnterEvadeMode();
  588. +            }
  589. +
  590. +            if(m_pInstance->GetData(TYPE_LICH_KING) == IN_PROGRESS && StartEscort != true)
  591. +            {
  592. +                StartEscort = true;
  593. +                me->RemoveAurasDueToSpell(SPELL_ICE_PRISON);
  594. +                me->RemoveAurasDueToSpell(SPELL_DARK_ARROW);
  595. +                //me->RemoveAllAuras();
  596. +                me->setActive(true);
  597. +                me->CastSpell(me, SPELL_FROSTMOURNE_VISUAL, false);
  598. +                NonFight = true;
  599. +                me->AttackStop();
  600. +                me->SetSpeed(MOVE_WALK, 2.5f, true);
  601. +                Start(false, false);
  602. +                Step = 0;
  603. +                StepTimer = 100;
  604. +            }
  605. +
  606. +            if (Creature* pLider = ((Creature*)Unit::GetUnit((*me), m_pInstance->GetData64(DATA_ESCAPE_LIDER))))
  607. +            {
  608. +                if (pLider->IsWithinDistInMap(me, 2.0f))
  609. +                {
  610. +                    me->setActive(false);
  611. +                    SetEscortPaused(true);
  612. +                    npc_escortAI::EnterEvadeMode();
  613. +                    DoScriptText(SAY_LICH_KING_WIN, me);
  614. +                    me->CastSpell(me, SPELL_FURY_OF_FROSTMOURNE, false);
  615. +                    me->DealDamage(pLider, pLider->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
  616. +                    me->NearTeleportTo(5572.077f, 2283.1f, 734.976f, 3.89f);
  617. +                    m_pInstance->SetData(TYPE_LICH_KING, FAIL);
  618. +                }
  619. +            }
  620. +
  621. +            if(m_pInstance->GetData(TYPE_ICE_WALL_01) == IN_PROGRESS)
  622. +            {
  623. +                if(StepTimer < diff)
  624. +                    Wall01();
  625. +                else
  626. +                    StepTimer -= diff;
  627. +            }
  628. +
  629. +            if(m_pInstance->GetData(TYPE_ICE_WALL_02) == IN_PROGRESS)
  630. +            {
  631. +                if(StepTimer < diff)
  632. +                    Wall02();
  633. +                else
  634. +                    StepTimer -= diff;
  635. +            }
  636. +
  637. +            if(m_pInstance->GetData(TYPE_ICE_WALL_03) == IN_PROGRESS)
  638. +            {
  639. +                if(StepTimer < diff)
  640. +                    Wall03();
  641. +                else
  642. +                    StepTimer -= diff;
  643. +            }
  644. +
  645. +            if(m_pInstance->GetData(TYPE_ICE_WALL_04) == IN_PROGRESS)
  646. +            {
  647. +                if(StepTimer < diff)
  648. +                    Wall04();
  649. +                else
  650. +                    StepTimer -= diff;
  651. +            }
  652. +            return;
  653. +        }
  654. +    };
  655. +};
  656. +
  657. +class npc_raging_gnoul : public CreatureScript
  658. +{
  659. +public:
  660. +    npc_raging_gnoul() : CreatureScript("npc_raging_gnoul") { }
  661. +
  662. +    struct npc_raging_gnoulAI : public ScriptedAI
  663. +    {
  664. +        npc_raging_gnoulAI(Creature *pCreature) : ScriptedAI(pCreature)
  665. +        {
  666. +            m_pInstance = (InstanceScript*)pCreature->GetInstanceScript();
  667. +            me->setActive(true);
  668. +            Reset();
  669. +        }
  670. +
  671. +        InstanceScript* m_pInstance;
  672. +        uint32 EmergeTimer;
  673. +        bool Emerge;
  674. +        uint64 m_uiLiderGUID;
  675. +
  676. +        void Reset()
  677. +        {
  678. +            DoCast(me, SPELL_EMERGE_VISUAL);
  679. +            EmergeTimer = 4000;
  680. +            Emerge = false;
  681. +        }
  682. +
  683. +        void JustDied(Unit* pKiller)
  684. +        {
  685. +            if(!m_pInstance)
  686. +                return;
  687. +
  688. +            m_pInstance->SetData(DATA_SUMMONS, 0);
  689. +        }
  690. +
  691. +        void AttackStart(Unit* who)
  692. +        {
  693. +            if (!who)
  694. +                return;
  695. +
  696. +            if(Emerge == false)
  697. +                return;
  698. +
  699. +            ScriptedAI::AttackStart(who);
  700. +        }
  701. +
  702. +        void UpdateAI(const uint32 diff)
  703. +        {
  704. +            if(!m_pInstance)
  705. +                return;
  706. +
  707. +            if(m_pInstance->GetData(TYPE_LICH_KING) == IN_PROGRESS)
  708. +            {
  709. +                if(Emerge != true)
  710. +                {
  711. +                    if(EmergeTimer < diff)
  712. +                    {
  713. +                        //me->RemoveFlag(SPLINEFLAG_WALKING | MOVEMENTFLAG_WALKING, true);
  714. +                        Emerge = true;
  715. +                        m_uiLiderGUID = m_pInstance->GetData64(DATA_ESCAPE_LIDER);
  716. +                        if(Creature* pLider = ((Creature*)Unit::GetUnit((*me), m_uiLiderGUID)))
  717. +                        {
  718. +                            DoResetThreat();
  719. +                            me->AI()->AttackStart(pLider);
  720. +                            me->GetMotionMaster()->Clear();
  721. +                            me->GetMotionMaster()->MoveChase(pLider);
  722. +                        }
  723. +                    }
  724. +                    else
  725. +                        EmergeTimer -= diff;
  726. +                }
  727. +            }
  728. +            DoMeleeAttackIfReady();
  729. +        }
  730. +    };
  731. +
  732. +    CreatureAI* GetAI(Creature* pCreature) const
  733. +    {
  734. +        return new npc_raging_gnoulAI(pCreature);
  735. +    }
  736. +
  737. +};
  738. +
  739. +class npc_risen_witch_doctor : public CreatureScript
  740. +{
  741. +public:
  742. +    npc_risen_witch_doctor() : CreatureScript("npc_risen_witch_doctor") { }
  743. +
  744. +    struct npc_risen_witch_doctorAI : public ScriptedAI
  745. +    {
  746. +        npc_risen_witch_doctorAI(Creature *pCreature) : ScriptedAI(pCreature)
  747. +        {
  748. +            m_pInstance = (InstanceScript*)pCreature->GetInstanceScript();
  749. +            me->setActive(true);
  750. +            Reset();
  751. +        }
  752. +
  753. +        InstanceScript* m_pInstance;
  754. +        uint32 EmergeTimer;
  755. +        bool Emerge;
  756. +        uint64 m_uiLiderGUID;
  757. +
  758. +        void Reset()
  759. +        {
  760. +            DoCast(me, SPELL_EMERGE_VISUAL);
  761. +            EmergeTimer = 5000;
  762. +            Emerge = false;
  763. +        }
  764. +
  765. +        void JustDied(Unit* pKiller)
  766. +        {
  767. +            if(!m_pInstance)
  768. +                return;
  769. +
  770. +            m_pInstance->SetData(DATA_SUMMONS, 0);
  771. +
  772. +        }
  773. +
  774. +        void AttackStart(Unit* who)
  775. +        {
  776. +            if (!who)
  777. +                return;
  778. +
  779. +            if(Emerge == false)
  780. +                return;
  781. +
  782. +            ScriptedAI::AttackStart(who);
  783. +        }
  784. +
  785. +        void UpdateAI(const uint32 diff)
  786. +        {
  787. +            if(!m_pInstance)
  788. +                return;
  789. +
  790. +            if(m_pInstance->GetData(TYPE_LICH_KING) == IN_PROGRESS)
  791. +            {
  792. +                if(Emerge != true)
  793. +                {
  794. +                    if(EmergeTimer < diff)
  795. +                    {
  796. +                        Emerge = true;
  797. +                        m_uiLiderGUID = m_pInstance->GetData64(DATA_ESCAPE_LIDER);
  798. +                        if(Creature* pLider = ((Creature*)Unit::GetUnit((*me), m_uiLiderGUID)))
  799. +                        {
  800. +                            DoResetThreat();
  801. +                            me->AI()->AttackStart(pLider);
  802. +                            me->GetMotionMaster()->Clear();
  803. +                            me->GetMotionMaster()->MoveChase(pLider);
  804. +                        }
  805. +                    }
  806. +                    else
  807. +                        EmergeTimer -= diff;
  808. +                }
  809. +            }
  810. +            DoMeleeAttackIfReady();
  811. +        }
  812. +    };
  813. +
  814. +    CreatureAI* GetAI(Creature* pCreature) const
  815. +    {
  816. +        return new npc_risen_witch_doctorAI(pCreature);
  817. +    }
  818. +
  819. +};
  820. +
  821. +class npc_abon : public CreatureScript
  822. +{
  823. +public:
  824. +    npc_abon() : CreatureScript("npc_abon") { }
  825. +
  826. +    struct npc_abonAI : public ScriptedAI
  827. +    {
  828. +        npc_abonAI(Creature *pCreature) : ScriptedAI(pCreature)
  829. +        {
  830. +            m_pInstance = (InstanceScript*)pCreature->GetInstanceScript();
  831. +            me->setActive(true);
  832. +            Reset();
  833. +        }
  834. +
  835. +        InstanceScript* m_pInstance;
  836. +        uint64 m_uiLiderGUID;
  837. +        bool Walk;
  838. +
  839. +        void Reset()
  840. +        {
  841. +            Walk = false;
  842. +        }
  843. +
  844. +        void UpdateAI(const uint32 diff)
  845. +        {
  846. +            if(!m_pInstance) return;
  847. +
  848. +            if(m_pInstance->GetData(TYPE_LICH_KING) == IN_PROGRESS)
  849. +            {
  850. +                if(Walk != true)
  851. +                {
  852. +                    Walk = true;
  853. +                    m_uiLiderGUID = m_pInstance->GetData64(DATA_ESCAPE_LIDER);
  854. +                    if(Creature* pLider = ((Creature*)Unit::GetUnit((*me), m_uiLiderGUID)))
  855. +                    {
  856. +                        DoResetThreat();
  857. +                        me->AI()->AttackStart(pLider);
  858. +                        me->GetMotionMaster()->Clear();
  859. +                        me->GetMotionMaster()->MoveChase(pLider);
  860. +                    }
  861. +                }
  862. +            }
  863. +            DoMeleeAttackIfReady();
  864. +        }
  865. +
  866. +        void JustDied(Unit* pKiller)
  867. +        {
  868. +            if(!m_pInstance)
  869. +                return;
  870. +
  871. +            m_pInstance->SetData(DATA_SUMMONS, 0);
  872. +        }
  873. +    };
  874. +
  875. +    CreatureAI* GetAI(Creature* pCreature) const
  876. +    {
  877. +        return new npc_abonAI(pCreature);
  878. +    }
  879. +};
  880. +
  881. +void AddSC_boss_lich_king_hr()
  882. +{
  883. +    new boss_lich_king_hor();
  884. +    new npc_raging_gnoul();
  885. +    new npc_risen_witch_doctor();
  886. +    new npc_abon();
  887. +}
  888. diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp
  889. index 4df13d3..67a69ee 100644
  890. --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp
  891. +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp
  892. @@ -1,49 +1,50 @@
  893.  /*
  894. - * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
  895. + * Copyright (C) 2008 - 2012 Trinity <http://www.trinitycore.org/>
  896. + * Copyright (C) 2008 - 2012 Facecore <https://github.com/SignFinder/FaceCore/>
  897.   *
  898. - * This program is free software; you can redistribute it and/or modify it
  899. - * under the terms of the GNU General Public License as published by the
  900. - * Free Software Foundation; either version 2 of the License, or (at your
  901. - * option) any later version.
  902. + * This program is free software; you can redistribute it and/or modify
  903. + * it under the terms of the GNU General Public License as published by
  904. + * the Free Software Foundation; either version 2 of the License, or
  905. + * (at your option) any later version.
  906.   *
  907. - * This program is distributed in the hope that it will be useful, but WITHOUT
  908. - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  909. - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  910. - * more details.
  911. + * This program is distributed in the hope that it will be useful,
  912. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  913. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  914. + * GNU General Public License for more details.
  915.   *
  916. - * You should have received a copy of the GNU General Public License along
  917. - * with this program. If not, see <http://www.gnu.org/licenses/>.
  918. + * You should have received a copy of the GNU General Public License
  919. + * along with this program; if not, write to the Free Software
  920. + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  921.   */
  922.  
  923. + /* ScriptData
  924. + SDName: boss_falric
  925. + SD%Complete: 0%
  926. + SDComment: new script for tc implementation.
  927. + SDCategory: Halls of Reflection
  928. + EndScriptData */
  929. +
  930.  #include "ScriptMgr.h"
  931.  #include "ScriptedCreature.h"
  932.  #include "halls_of_reflection.h"
  933.  
  934. -enum Yells
  935. +enum
  936.  {
  937. -    SAY_AGGRO                                     = -1668050,
  938. -    SAY_SLAY_1                                    = -1668051,
  939. -    SAY_SLAY_2                                    = -1668052,
  940. -    SAY_DEATH                                     = -1668053,
  941. -    SAY_IMPENDING_DESPAIR                         = -1668054,
  942. -    SAY_DEFILING_HORROR                           = -1668055,
  943. -};
  944. +    SAY_FALRIC_AGGRO                        = -1668050,
  945. +    SAY_FALRIC_DEATH                        = -1668053,
  946. +    SAY_FALRIC_SLAY01                       = -1668051,
  947. +    SAY_FALRIC_SLAY02                       = -1668052,
  948. +    SAY_FALRIC_SP01                         = -1668054,
  949. +    SAY_FALRIC_SP02                         = -1668055,
  950.  
  951. -enum Spells
  952. -{
  953. -    SPELL_QUIVERING_STRIKE                        = 72422,
  954. -    SPELL_IMPENDING_DESPAIR                       = 72426,
  955. -    SPELL_DEFILING_HORROR                         = 72435,
  956. -    SPELL_HOPELESSNESS                            = 72395,
  957. -    H_SPELL_HOPELESSNESS                          = 72390, // TODO: not in dbc. Add in DB.
  958. -};
  959. +    SPELL_HOPELESSNESS                      = 72395,
  960. +    SPELL_IMPENDING_DESPAIR                 = 72426,
  961. +    SPELL_DEFILING_HORROR_N                 = 72435,
  962. +    SPELL_DEFILING_HORROR_H                 = 72452,
  963. +    SPELL_QUIVERING_STRIKE_N                = 72422,
  964. +    SPELL_QUIVERING_STRIKE_H                = 72453,
  965.  
  966. -enum Events
  967. -{
  968. -    EVENT_NONE,
  969. -    EVENT_QUIVERING_STRIKE,
  970. -    EVENT_IMPENDING_DESPAIR,
  971. -    EVENT_DEFILING_HORROR,
  972. +    SPELL_BERSERK                           = 47008
  973.  };
  974.  
  975.  class boss_falric : public CreatureScript
  976. @@ -51,94 +52,216 @@ class boss_falric : public CreatureScript
  977.  public:
  978.      boss_falric() : CreatureScript("boss_falric") { }
  979.  
  980. -    CreatureAI* GetAI(Creature* creature) const
  981. +    struct boss_falricAI : public ScriptedAI
  982.      {
  983. -        return new boss_falricAI(creature);
  984. -    }
  985. +        boss_falricAI(Creature *pCreature) : ScriptedAI(pCreature)
  986. +       {
  987. +            m_pInstance = (InstanceScript*)pCreature->GetInstanceScript();
  988. +            Regular = pCreature->GetMap()->IsRegularDifficulty();
  989. +            Reset();
  990. +       }
  991.  
  992. -    struct boss_falricAI : public boss_horAI
  993. -    {
  994. -        boss_falricAI(Creature* creature) : boss_horAI(creature) {}
  995. +       InstanceScript* m_pInstance;
  996. +       bool Regular;
  997. +       bool m_bIsCall;
  998. +       //FUNCTIONS
  999. +       uint32 m_uiBerserkTimer;
  1000. +       uint32 m_uiGrowlTimer;
  1001. +       uint32 m_uiHorrorTimer;
  1002. +       uint32 m_uiStrikeTimer;
  1003. +       uint32 m_uiSummonTimer;
  1004. +       uint32 m_uiLocNo;
  1005. +       uint64 m_uiSummonGUID[16];
  1006. +       uint32 m_uiCheckSummon;
  1007.  
  1008. -        uint8 uiHopelessnessCount;
  1009. +       uint8 SummonCount;
  1010. +
  1011. +       uint64 pSummon;
  1012.  
  1013.          void Reset()
  1014.          {
  1015. -            boss_horAI::Reset();
  1016. +          m_uiBerserkTimer = 180000;
  1017. +          SummonCount = 0;
  1018. +          m_bIsCall = false;
  1019. +          m_uiGrowlTimer = 20000;
  1020. +          m_uiHorrorTimer = urand(14000,20000);
  1021. +          m_uiStrikeTimer = 2000;
  1022. +          m_uiSummonTimer = 11000;
  1023. +          me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
  1024. +          me->SetVisible(false);
  1025. +        }
  1026.  
  1027. -            uiHopelessnessCount = 0;
  1028. +        void EnterCombat(Unit* victim)
  1029. +        {
  1030. +          //me->RemoveFlag(MOVEFLAG_WALK, NULL);
  1031. +          DoScriptText(SAY_FALRIC_AGGRO, me);
  1032. +          DoCast(me, SPELL_HOPELESSNESS);
  1033. +        }
  1034.  
  1035. -            if (instance)
  1036. -                instance->SetData(DATA_FALRIC_EVENT, NOT_STARTED);
  1037. +        void KilledUnit(Unit* victim)
  1038. +        {
  1039. +            switch(urand(0,1))
  1040. +            {
  1041. +                case 0: DoScriptText(SAY_FALRIC_SLAY01, me); break;
  1042. +                case 1: DoScriptText(SAY_FALRIC_SLAY02, me); break;
  1043. +            }
  1044.          }
  1045.  
  1046. -        void EnterCombat(Unit* /*who*/)
  1047. +        void JustDied(Unit* pKiller)
  1048.          {
  1049. -            DoScriptText(SAY_AGGRO, me);
  1050. -            if (instance)
  1051. -                instance->SetData(DATA_FALRIC_EVENT, IN_PROGRESS);
  1052. +          if(!m_pInstance) return;
  1053. +             m_pInstance->SetData(TYPE_MARWYN, SPECIAL);
  1054. +          DoScriptText(SAY_FALRIC_DEATH, me);
  1055. +        }
  1056. +
  1057. +        void AttackStart(Unit* who)
  1058. +        {
  1059. +            if(!m_pInstance) return;
  1060. +
  1061. +               if(m_pInstance->GetData(TYPE_FALRIC) != IN_PROGRESS)
  1062. +                 return;
  1063.  
  1064. -            events.ScheduleEvent(EVENT_QUIVERING_STRIKE, 23000);
  1065. -            events.ScheduleEvent(EVENT_IMPENDING_DESPAIR, 9000);
  1066. -            events.ScheduleEvent(EVENT_DEFILING_HORROR, urand(25000, 45000)); // TODO adjust timer.
  1067. +             ScriptedAI::AttackStart(who);
  1068.          }
  1069.  
  1070. -        void JustDied(Unit* /*killer*/)
  1071. +        void Summon()
  1072.          {
  1073. -            DoScriptText(SAY_DEATH, me);
  1074. +             m_uiLocNo = 0;
  1075.  
  1076. -            if (instance)
  1077. -                instance->SetData(DATA_FALRIC_EVENT, DONE);
  1078. +             for(uint8 i = 0; i < 14; i++)
  1079. +             {
  1080. +                switch(urand(0,3))
  1081. +                {
  1082. +                   case 0:
  1083. +                       switch(urand(1, 3))
  1084. +                       {
  1085. +                         case 1: pSummon = NPC_DARK_1; break;
  1086. +                         case 2: pSummon = NPC_DARK_3; break;
  1087. +                         case 3: pSummon = NPC_DARK_6; break;
  1088. +                       }
  1089. +                       break;
  1090. +                   case 1:
  1091. +                       switch(urand(1, 3))
  1092. +                       {
  1093. +                         case 1: pSummon = NPC_DARK_2; break;
  1094. +                         case 2: pSummon = NPC_DARK_3; break;
  1095. +                         case 3: pSummon = NPC_DARK_4; break;
  1096. +                       }
  1097. +                       break;
  1098. +                   case 2:
  1099. +                       switch(urand(1, 3))
  1100. +                       {
  1101. +                         case 1: pSummon = NPC_DARK_2; break;
  1102. +                         case 2: pSummon = NPC_DARK_5; break;
  1103. +                         case 3: pSummon = NPC_DARK_6; break;
  1104. +                       }
  1105. +                       break;
  1106. +                   case 3:
  1107. +                       switch(urand(1, 3))
  1108. +                       {
  1109. +                         case 1: pSummon = NPC_DARK_1; break;
  1110. +                         case 2: pSummon = NPC_DARK_5; break;
  1111. +                         case 3: pSummon = NPC_DARK_4; break;
  1112. +                       }
  1113. +                       break;
  1114. +                 }
  1115. +
  1116. +                 m_uiCheckSummon = 0;
  1117. +
  1118. +                 if(Creature* Summon = me->SummonCreature(pSummon, SpawnLoc[m_uiLocNo].x, SpawnLoc[m_uiLocNo].y, SpawnLoc[m_uiLocNo].z, SpawnLoc[m_uiLocNo].o, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000))
  1119. +                 {
  1120. +                    m_uiSummonGUID[i] = Summon->GetGUID();
  1121. +                    Summon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
  1122. +                    Summon->setFaction(974);
  1123. +                    Summon->SetReactState(REACT_PASSIVE);
  1124. +                 }
  1125. +                 m_uiLocNo++;
  1126. +             }
  1127.          }
  1128.  
  1129. -        void KilledUnit(Unit* /*victim*/)
  1130. +        void CallFallSoldier()
  1131.          {
  1132. -            DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2), me);
  1133. +             for(uint8 i = 0; i < 4; i++)
  1134. +             {
  1135. +                if(Creature* Summon = m_pInstance->instance->GetCreature(m_uiSummonGUID[m_uiCheckSummon]))
  1136. +                {
  1137. +                   Summon->setFaction(14);
  1138. +                   Summon->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
  1139. +                   Summon->SetReactState(REACT_AGGRESSIVE);
  1140. +                   Summon->SetInCombatWithZone();
  1141. +                }
  1142. +                m_uiCheckSummon++;
  1143. +             }
  1144.          }
  1145.  
  1146. -        void UpdateAI(const uint32 diff)
  1147. +        void UpdateAI(const uint32 uiDiff)
  1148.          {
  1149. -            // Return since we have no target
  1150. -            if (!UpdateVictim())
  1151. -                return;
  1152. +            if(!m_pInstance) return;
  1153.  
  1154. -            events.Update(diff);
  1155. +            if (m_pInstance->GetData(TYPE_FALRIC) == SPECIAL)
  1156. +            {
  1157. +                if(!m_bIsCall)
  1158. +                {
  1159. +                   m_bIsCall = true;
  1160. +                   Summon();
  1161. +                }
  1162.  
  1163. -            if (me->HasUnitState(UNIT_STATE_CASTING))
  1164. +                if (m_uiSummonTimer < uiDiff)
  1165. +                {
  1166. +                        ++SummonCount;
  1167. +                        if(SummonCount > 4)
  1168. +                        {
  1169. +                            m_pInstance->SetData(TYPE_FALRIC, IN_PROGRESS);
  1170. +                            me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
  1171. +                            me->SetInCombatWithZone();
  1172. +                        }
  1173. +                        else CallFallSoldier();
  1174. +                        m_uiSummonTimer = 60000;
  1175. +                } else m_uiSummonTimer -= uiDiff;
  1176. +            }
  1177. +
  1178. +            if (!UpdateVictim())
  1179.                  return;
  1180.  
  1181. -            switch (events.ExecuteEvent())
  1182. +            if(m_uiStrikeTimer < uiDiff)
  1183.              {
  1184. -                case EVENT_QUIVERING_STRIKE:
  1185. -                    DoCast(SPELL_QUIVERING_STRIKE);
  1186. -                    events.ScheduleEvent(EVENT_QUIVERING_STRIKE, 10000);
  1187. -                    break;
  1188. -                case EVENT_IMPENDING_DESPAIR:
  1189. -                    if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM))
  1190. -                    {
  1191. -                        DoScriptText(SAY_IMPENDING_DESPAIR, me);
  1192. -                        DoCast(target, SPELL_IMPENDING_DESPAIR);
  1193. -                    }
  1194. -                    events.ScheduleEvent(EVENT_IMPENDING_DESPAIR, 13000);
  1195. -                    break;
  1196. -                case EVENT_DEFILING_HORROR:
  1197. -                    DoCast(SPELL_DEFILING_HORROR);
  1198. -                    events.ScheduleEvent(EVENT_DEFILING_HORROR, urand(25000, 45000)); // TODO adjust timer.
  1199. -                    break;
  1200. +                DoCast(me->getVictim(), Regular ? SPELL_QUIVERING_STRIKE_N : SPELL_QUIVERING_STRIKE_H);
  1201. +                m_uiStrikeTimer = (urand(7000, 14000));
  1202.              }
  1203. +            else m_uiStrikeTimer -= uiDiff;
  1204.  
  1205. -            if ((uiHopelessnessCount < 1 && HealthBelowPct(66))
  1206. -                || (uiHopelessnessCount < 2 && HealthBelowPct(33))
  1207. -                || (uiHopelessnessCount < 3 && HealthBelowPct(10)))
  1208. +            if(m_uiHorrorTimer < uiDiff)
  1209.              {
  1210. -                uiHopelessnessCount++;
  1211. -                DoCast(DUNGEON_MODE(SPELL_HOPELESSNESS, H_SPELL_HOPELESSNESS));
  1212. +                DoScriptText(SAY_FALRIC_SP01, me);
  1213. +                if(Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM))
  1214. +                   DoCast(pTarget, SPELL_IMPENDING_DESPAIR);
  1215. +                m_uiHorrorTimer = (urand(15000, 25000));
  1216.              }
  1217. +            else m_uiHorrorTimer -= uiDiff;
  1218.  
  1219. -            DoMeleeAttackIfReady();
  1220. +            if(m_uiGrowlTimer < uiDiff)
  1221. +            {
  1222. +                DoScriptText(SAY_FALRIC_SP02, me);
  1223. +                DoCast(me->getVictim(), Regular ? SPELL_DEFILING_HORROR_N : SPELL_DEFILING_HORROR_H);
  1224. +                m_uiGrowlTimer = (urand(25000, 30000));
  1225. +            }
  1226. +            else m_uiGrowlTimer -= uiDiff;
  1227. +
  1228. +            if (m_uiBerserkTimer < uiDiff)
  1229. +            {
  1230. +                DoCast(me, SPELL_BERSERK);
  1231. +                m_uiBerserkTimer = 180000;
  1232. +            } else  m_uiBerserkTimer -= uiDiff;
  1233. +
  1234. +            DoMeleeAttackIfReady();  
  1235. +
  1236. +            return;
  1237.          }
  1238.      };
  1239. -
  1240. +    CreatureAI* GetAI(Creature* pCreature) const
  1241. +    {
  1242. +        return new boss_falricAI(pCreature);
  1243. +    }
  1244.  };
  1245.  
  1246.  void AddSC_boss_falric()
  1247. diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp
  1248. index 8334a19..56af661 100644
  1249. --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp
  1250. +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp
  1251. @@ -1,49 +1,52 @@
  1252.  /*
  1253. - * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
  1254. + * Copyright (C) 2008 - 2012 Trinity <http://www.trinitycore.org/>
  1255. + * Copyright (C) 2008 - 2012 Facecore <https://github.com/SignFinder/FaceCore/>
  1256.   *
  1257. - * This program is free software; you can redistribute it and/or modify it
  1258. - * under the terms of the GNU General Public License as published by the
  1259. - * Free Software Foundation; either version 2 of the License, or (at your
  1260. - * option) any later version.
  1261. + * This program is free software; you can redistribute it and/or modify
  1262. + * it under the terms of the GNU General Public License as published by
  1263. + * the Free Software Foundation; either version 2 of the License, or
  1264. + * (at your option) any later version.
  1265.   *
  1266. - * This program is distributed in the hope that it will be useful, but WITHOUT
  1267. - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  1268. - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  1269. - * more details.
  1270. + * This program is distributed in the hope that it will be useful,
  1271. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  1272. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1273. + * GNU General Public License for more details.
  1274.   *
  1275. - * You should have received a copy of the GNU General Public License along
  1276. - * with this program. If not, see <http://www.gnu.org/licenses/>.
  1277. + * You should have received a copy of the GNU General Public License
  1278. + * along with this program; if not, write to the Free Software
  1279. + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  1280.   */
  1281.  
  1282. + /* ScriptData
  1283. + SDName: boss_Marwyn
  1284. + SD%Complete: 0%
  1285. + SDComment: new script for tc implementation.
  1286. + SDCategory: Halls of Reflection
  1287. + EndScriptData */
  1288. +
  1289.  #include "ScriptMgr.h"
  1290.  #include "ScriptedCreature.h"
  1291.  #include "halls_of_reflection.h"
  1292.  
  1293. -enum Yells
  1294. +enum
  1295.  {
  1296. -    SAY_AGGRO                                     = -1668060,
  1297. -    SAY_SLAY_1                                    = -1668061,
  1298. -    SAY_SLAY_2                                    = -1668062,
  1299. -    SAY_DEATH                                     = -1668063,
  1300. -    SAY_CORRUPTED_FLESH_1                         = -1668064,
  1301. -    SAY_CORRUPTED_FLESH_2                         = -1668065,
  1302. -};
  1303. +    SAY_MARWYN_INTRO                        = -1594506,
  1304. +    SAY_MARWYN_AGGRO                        = -1668060,
  1305. +    SAY_MARWYN_DEATH                        = -1668063,
  1306. +    SAY_MARWYN_SLAY01                       = -1668061,
  1307. +    SAY_MARWYN_SLAY02                       = -1668062,
  1308. +    SAY_MARWYN_SP01                         = -1668064,
  1309. +    SAY_MARWYN_SP02                         = -1668065,
  1310.  
  1311. -enum Spells
  1312. -{
  1313. -    SPELL_OBLITERATE                              = 72360,
  1314. -    SPELL_WELL_OF_CORRUPTION                      = 72362,
  1315. -    SPELL_CORRUPTED_FLESH                         = 72363,
  1316. -    SPELL_SHARED_SUFFERING                        = 72368,
  1317. -};
  1318. +    SPELL_OBLITERATE_N                      = 72360,
  1319. +    SPELL_OBLITERATE_H                      = 72434,
  1320. +    SPELL_SHARED_SUFFERING_N                = 72368,
  1321. +    SPELL_SHARED_SUFFERING_H                = 72369,
  1322. +    SPELL_WELL_OF_CORRUPTION                = 72362,
  1323. +    SPELL_CORRUPTED_FLESH_N                 = 72363,
  1324. +    SPELL_CORRUPTED_FLESH_H                 = 72436,
  1325.  
  1326. -enum Events
  1327. -{
  1328. -    EVENT_NONE,
  1329. -    EVENT_OBLITERATE,
  1330. -    EVENT_WELL_OF_CORRUPTION,
  1331. -    EVENT_CORRUPTED_FLESH,
  1332. -    EVENT_SHARED_SUFFERING,
  1333. +    SPELL_BERSERK                           = 47008,
  1334.  };
  1335.  
  1336.  class boss_marwyn : public CreatureScript
  1337. @@ -51,84 +54,238 @@ class boss_marwyn : public CreatureScript
  1338.  public:
  1339.      boss_marwyn() : CreatureScript("boss_marwyn") { }
  1340.  
  1341. -    CreatureAI* GetAI(Creature* creature) const
  1342. +    struct boss_marwynAI : public ScriptedAI
  1343.      {
  1344. -        return new boss_marwynAI(creature);
  1345. -    }
  1346. +       boss_marwynAI(Creature *pCreature) : ScriptedAI(pCreature)
  1347. +       {
  1348. +            m_pInstance = (InstanceScript*)pCreature->GetInstanceScript();
  1349. +            Regular = pCreature->GetMap()->IsRegularDifficulty();
  1350. +            Reset();
  1351. +       }
  1352.  
  1353. -    struct boss_marwynAI : public boss_horAI
  1354. -    {
  1355. -        boss_marwynAI(Creature* creature) : boss_horAI(creature) {}
  1356. +       InstanceScript* m_pInstance;
  1357. +       bool Regular;
  1358. +       bool m_bIsCall;
  1359. +
  1360. +       //FUNCTIONS
  1361. +       uint32 m_uiBerserkTimer;
  1362. +       uint32 m_uiSharedSufferingTimer;
  1363. +       uint32 m_uiWellTimer;
  1364. +       uint32 m_uiTouchTimer;
  1365. +       uint32 m_uiFleshTimer;
  1366. +       uint32 m_uiObliterateTimer;
  1367. +       uint32 m_uiSummonTimer;
  1368. +
  1369. +       uint32 m_uiLocNo;
  1370. +       uint64 m_uiSummonGUID[16];
  1371. +       uint32 m_uiCheckSummon;
  1372. +
  1373. +       uint8 SummonCount;
  1374. +
  1375. +       uint64 pSummon;
  1376.  
  1377. -        void Reset()
  1378. +       void Reset()
  1379. +       {
  1380. +          m_uiBerserkTimer = 180000;
  1381. +          m_uiSharedSufferingTimer = 4000;
  1382. +          m_uiWellTimer = 12000;
  1383. +          m_uiTouchTimer = 8000;
  1384. +          m_uiFleshTimer = 21000;
  1385. +          m_uiObliterateTimer = 5000;
  1386. +          SummonCount = 0;
  1387. +          m_bIsCall = false;
  1388. +          m_uiSummonTimer = 15000;
  1389. +          me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
  1390. +          me->SetVisible(false);
  1391. +        }
  1392. +
  1393. +        void Summon()
  1394.          {
  1395. -            boss_horAI::Reset();
  1396. +             m_uiLocNo = 14;
  1397. +
  1398. +             for(uint8 i = 0; i < 14; i++)
  1399. +             {
  1400. +                switch(urand(0,3))
  1401. +                {
  1402. +                   case 0:
  1403. +                       switch(urand(1, 3))
  1404. +                       {
  1405. +                         case 1: pSummon = NPC_DARK_1; break;
  1406. +                         case 2: pSummon = NPC_DARK_3; break;
  1407. +                         case 3: pSummon = NPC_DARK_6; break;
  1408. +                       }
  1409. +                       break;
  1410. +                   case 1:
  1411. +                       switch(urand(1, 3))
  1412. +                       {
  1413. +                         case 1: pSummon = NPC_DARK_2; break;
  1414. +                         case 2: pSummon = NPC_DARK_3; break;
  1415. +                         case 3: pSummon = NPC_DARK_4; break;
  1416. +                       }
  1417. +                       break;
  1418. +                   case 2:
  1419. +                       switch(urand(1, 3))
  1420. +                       {
  1421. +                         case 1: pSummon = NPC_DARK_2; break;
  1422. +                         case 2: pSummon = NPC_DARK_5; break;
  1423. +                         case 3: pSummon = NPC_DARK_6; break;
  1424. +                       }
  1425. +                       break;
  1426. +                   case 3:
  1427. +                       switch(urand(1, 3))
  1428. +                       {
  1429. +                         case 1: pSummon = NPC_DARK_1; break;
  1430. +                         case 2: pSummon = NPC_DARK_5; break;
  1431. +                         case 3: pSummon = NPC_DARK_4; break;
  1432. +                       }
  1433. +                       break;
  1434. +                 }
  1435.  
  1436. -            if (instance)
  1437. -                instance->SetData(DATA_MARWYN_EVENT, NOT_STARTED);
  1438. +                 m_uiCheckSummon = 0;
  1439. +
  1440. +                 if(Creature* Summon = me->SummonCreature(pSummon, SpawnLoc[m_uiLocNo].x, SpawnLoc[m_uiLocNo].y, SpawnLoc[m_uiLocNo].z, SpawnLoc[m_uiLocNo].o, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000))
  1441. +                 {
  1442. +                    m_uiSummonGUID[i] = Summon->GetGUID();
  1443. +                    Summon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
  1444. +                    Summon->SetReactState(REACT_PASSIVE);
  1445. +                    Summon->setFaction(974);
  1446. +                 }
  1447. +                 m_uiLocNo++;
  1448. +             }
  1449.          }
  1450.  
  1451. -        void EnterCombat(Unit* /*who*/)
  1452. +        void CallFallSoldier()
  1453.          {
  1454. -            DoScriptText(SAY_AGGRO, me);
  1455. -            if (instance)
  1456. -                instance->SetData(DATA_MARWYN_EVENT, IN_PROGRESS);
  1457. -
  1458. -            events.ScheduleEvent(EVENT_OBLITERATE, 30000);          // TODO Check timer
  1459. -            events.ScheduleEvent(EVENT_WELL_OF_CORRUPTION, 13000);
  1460. -            events.ScheduleEvent(EVENT_CORRUPTED_FLESH, 20000);
  1461. -            events.ScheduleEvent(EVENT_SHARED_SUFFERING, 20000);    // TODO Check timer
  1462. +             for(uint8 i = 0; i < 4; i++)
  1463. +             {
  1464. +                if(Creature* Summon = m_pInstance->instance->GetCreature(m_uiSummonGUID[m_uiCheckSummon]))
  1465. +                {
  1466. +                   Summon->setFaction(14);
  1467. +                   Summon->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
  1468. +                   Summon->SetReactState(REACT_AGGRESSIVE);
  1469. +                   Summon->SetInCombatWithZone();
  1470. +                }
  1471. +                m_uiCheckSummon++;
  1472. +             }
  1473.          }
  1474.  
  1475. -        void JustDied(Unit* /*killer*/)
  1476. +        void JustDied(Unit* pKiller)
  1477.          {
  1478. -            DoScriptText(SAY_DEATH, me);
  1479. +          if(m_pInstance)
  1480. +          {
  1481. +             m_pInstance->SetData(TYPE_MARWYN, DONE);
  1482. +             m_pInstance->SetData(TYPE_PHASE, 3);
  1483. +          }
  1484.  
  1485. -            if (instance)
  1486. -                instance->SetData(DATA_MARWYN_EVENT, DONE);
  1487. +          DoScriptText(SAY_MARWYN_DEATH, me);
  1488.          }
  1489.  
  1490. -        void KilledUnit(Unit* /*victim*/)
  1491. +        void KilledUnit(Unit* victim)
  1492.          {
  1493. -            DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2), me);
  1494. +            switch(urand(0,1))
  1495. +            {
  1496. +                case 0: DoScriptText(SAY_MARWYN_SLAY01, me); break;
  1497. +                case 1: DoScriptText(SAY_MARWYN_SLAY02, me); break;
  1498. +            }
  1499.          }
  1500.  
  1501. -        void UpdateAI(const uint32 diff)
  1502. +        void EnterCombat(Unit* victim)
  1503.          {
  1504. -            // Return since we have no target
  1505. -            if (!UpdateVictim())
  1506. -                return;
  1507. +            if (!m_pInstance) return;
  1508. +          //me->RemoveFlag(MOVEFLAG_WALK, MOVEMENTFLAG_WALK_MODE);
  1509. +          DoScriptText(SAY_MARWYN_AGGRO, me);
  1510. +        }
  1511.  
  1512. -            events.Update(diff);
  1513. +        void AttackStart(Unit* who)
  1514. +        {
  1515. +            if (!m_pInstance) return;
  1516.  
  1517. -            if (me->HasUnitState(UNIT_STATE_CASTING))
  1518. -                return;
  1519. +               if (m_pInstance->GetData(TYPE_MARWYN) != IN_PROGRESS)
  1520. +                 return;
  1521. +
  1522. +             ScriptedAI::AttackStart(who);
  1523. +        }
  1524.  
  1525. -            switch (events.ExecuteEvent())
  1526. +       void UpdateAI(const uint32 uiDiff)
  1527. +        {
  1528. +            if(!m_pInstance) return;
  1529. +
  1530. +            if (m_pInstance->GetData(TYPE_FALRIC) == SPECIAL)
  1531. +            {
  1532. +                if(!m_bIsCall)
  1533. +                {
  1534. +                   m_bIsCall = true;
  1535. +                   Summon();
  1536. +                }
  1537. +            }
  1538. +
  1539. +            if(m_pInstance->GetData(TYPE_MARWYN) == SPECIAL)
  1540.              {
  1541. -                case EVENT_OBLITERATE:
  1542. -                    DoCast(SPELL_OBLITERATE);
  1543. -                    events.ScheduleEvent(EVENT_OBLITERATE, 30000);
  1544. -                    break;
  1545. -                case EVENT_WELL_OF_CORRUPTION:
  1546. -                    DoCast(SPELL_WELL_OF_CORRUPTION);
  1547. -                    events.ScheduleEvent(EVENT_WELL_OF_CORRUPTION, 13000);
  1548. -                    break;
  1549. -                case EVENT_CORRUPTED_FLESH:
  1550. -                    DoScriptText(RAND(SAY_CORRUPTED_FLESH_1, SAY_CORRUPTED_FLESH_2), me);
  1551. -                    DoCast(SPELL_CORRUPTED_FLESH);
  1552. -                    events.ScheduleEvent(EVENT_CORRUPTED_FLESH, 20000);
  1553. -                    break;
  1554. -                case EVENT_SHARED_SUFFERING:
  1555. -                    if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM))
  1556. -                        DoCast(target, SPELL_SHARED_SUFFERING);
  1557. -                    events.ScheduleEvent(EVENT_SHARED_SUFFERING, 20000);
  1558. -                    break;
  1559. +               if(m_uiSummonTimer < uiDiff)
  1560. +               {
  1561. +                       ++SummonCount;
  1562. +                       if(SummonCount == 1)
  1563. +                          DoScriptText(SAY_MARWYN_INTRO, me);
  1564. +
  1565. +                       if(SummonCount > 4)
  1566. +                       {
  1567. +                            m_pInstance->SetData(TYPE_MARWYN, IN_PROGRESS);
  1568. +                            me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
  1569. +                            me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
  1570. +                            me->SetInCombatWithZone();
  1571. +                       }
  1572. +                       else CallFallSoldier();
  1573. +                       m_uiSummonTimer = 60000;
  1574. +               } else m_uiSummonTimer -= uiDiff;
  1575.              }
  1576.  
  1577. +            if(!UpdateVictim())
  1578. +                return;
  1579. +
  1580. +            if(m_uiObliterateTimer < uiDiff)
  1581. +            {
  1582. +                DoCast(me->getVictim(), Regular ? SPELL_OBLITERATE_N : SPELL_OBLITERATE_H);
  1583. +                m_uiObliterateTimer = urand(8000, 12000);
  1584. +            } else m_uiObliterateTimer -= uiDiff;
  1585. +
  1586. +            if (m_uiWellTimer < uiDiff)
  1587. +            {
  1588. +                DoScriptText(SAY_MARWYN_SP02, me);
  1589. +                if(Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM))
  1590. +                   DoCast(pTarget, SPELL_WELL_OF_CORRUPTION);
  1591. +                m_uiWellTimer= urand(25000, 30000);
  1592. +            } else m_uiWellTimer -= uiDiff;
  1593. +
  1594. +            if (m_uiSharedSufferingTimer < uiDiff)
  1595. +            {
  1596. +                if(Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM))
  1597. +                   DoCast(pTarget, Regular ? SPELL_SHARED_SUFFERING_N : SPELL_SHARED_SUFFERING_H);
  1598. +                m_uiSharedSufferingTimer = urand(15000, 20000);
  1599. +            } else m_uiSharedSufferingTimer -= uiDiff;
  1600. +
  1601. +            if (m_uiFleshTimer < uiDiff)
  1602. +            {
  1603. +                DoScriptText(SAY_MARWYN_SP01, me);
  1604. +                if(Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM))
  1605. +                    DoCast(pTarget, Regular ? SPELL_CORRUPTED_FLESH_N : SPELL_CORRUPTED_FLESH_H);
  1606. +                m_uiFleshTimer = urand(10000, 16000);
  1607. +            } else m_uiFleshTimer -= uiDiff;
  1608. +
  1609. +            if(m_uiBerserkTimer < uiDiff)
  1610. +            {
  1611. +                DoCast(me, SPELL_BERSERK);
  1612. +                m_uiBerserkTimer = 180000;
  1613. +            } else  m_uiBerserkTimer -= uiDiff;
  1614. +
  1615.              DoMeleeAttackIfReady();
  1616. +
  1617. +            return;
  1618.          }
  1619.      };
  1620. +    CreatureAI* GetAI(Creature* pCreature) const
  1621. +    {
  1622. +        return new boss_marwynAI(pCreature);
  1623. +    }
  1624.  
  1625.  };
  1626.  
  1627. diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp
  1628. index 26ec9e5..04861f7 100644
  1629. --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp
  1630. +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp
  1631. @@ -1,555 +1,1401 @@
  1632.  /*
  1633. - * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
  1634. + * Copyright (C) 2008 - 2012 Trinity <http://www.trinitycore.org/>
  1635. + * Copyright (C) 2008 - 2012 Facecore <https://github.com/SignFinder/FaceCore/>
  1636.   *
  1637. - * This program is free software; you can redistribute it and/or modify it
  1638. - * under the terms of the GNU General Public License as published by the
  1639. - * Free Software Foundation; either version 2 of the License, or (at your
  1640. - * option) any later version.
  1641. - *
  1642. - * This program is distributed in the hope that it will be useful, but WITHOUT
  1643. - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  1644. - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  1645. - * more details.
  1646. - *
  1647. - * You should have received a copy of the GNU General Public License along
  1648. - * with this program. If not, see <http://www.gnu.org/licenses/>.
  1649. - */
  1650. -
  1651. +* This program is free software; you can redistribute it and/or modify
  1652. +* it under the terms of the GNU General Public License as published by
  1653. +* the Free Software Foundation; either version 2 of the License, or
  1654. +* (at your option) any later version.
  1655. +*
  1656. +* This program is distributed in the hope that it will be useful,
  1657. +* but WITHOUT ANY WARRANTY; without even the implied warranty of
  1658. +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1659. +* GNU General Public License for more details.
  1660. +*
  1661. +* You should have received a copy of the GNU General Public License
  1662. +* along with this program; if not, write to the Free Software
  1663. +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  1664. +*/
  1665. +
  1666. +#include "ScriptedEscortAI.h"
  1667.  #include "ScriptMgr.h"
  1668.  #include "ScriptedCreature.h"
  1669.  #include "ScriptedGossip.h"
  1670.  #include "halls_of_reflection.h"
  1671.  
  1672. -enum Yells
  1673. +enum
  1674.  {
  1675. -    SAY_JAINA_INTRO_1                             = -1668001,
  1676. -    SAY_JAINA_INTRO_2                             = -1668002,
  1677. -    SAY_JAINA_INTRO_3                             = -1668003,
  1678. -    SAY_JAINA_INTRO_4                             = -1668004,
  1679. -    SAY_UTHER_INTRO_A2_1                          = -1668005,
  1680. -    SAY_JAINA_INTRO_5                             = -1668006,
  1681. -    SAY_UTHER_INTRO_A2_2                          = -1668007,
  1682. -    SAY_JAINA_INTRO_6                             = -1668008,
  1683. -    SAY_UTHER_INTRO_A2_3                          = -1668009,
  1684. -    SAY_JAINA_INTRO_7                             = -1668010,
  1685. -    SAY_UTHER_INTRO_A2_4                          = -1668011,
  1686. -    SAY_JAINA_INTRO_8                             = -1668012,
  1687. -    SAY_UTHER_INTRO_A2_5                          = -1668013,
  1688. -    SAY_JAINA_INTRO_9                             = -1668014,
  1689. -    SAY_UTHER_INTRO_A2_6                          = -1668015,
  1690. -    SAY_UTHER_INTRO_A2_7                          = -1668016,
  1691. -    SAY_JAINA_INTRO_10                            = -1668017,
  1692. -    SAY_UTHER_INTRO_A2_8                          = -1668018,
  1693. -    SAY_JAINA_INTRO_11                            = -1668019,
  1694. -    SAY_UTHER_INTRO_A2_9                          = -1668020,
  1695. -
  1696. -    SAY_SYLVANAS_INTRO_1                          = -1668021,
  1697. -    SAY_SYLVANAS_INTRO_2                          = -1668022,
  1698. -    SAY_SYLVANAS_INTRO_3                          = -1668023,
  1699. -    SAY_UTHER_INTRO_H2_1                          = -1668024,
  1700. -    SAY_SYLVANAS_INTRO_4                          = -1668025,
  1701. -    SAY_UTHER_INTRO_H2_2                          = -1668026,
  1702. -    SAY_SYLVANAS_INTRO_5                          = -1668027,
  1703. -    SAY_UTHER_INTRO_H2_3                          = -1668028,
  1704. -    SAY_SYLVANAS_INTRO_6                          = -1668029,
  1705. -    SAY_UTHER_INTRO_H2_4                          = -1668030,
  1706. -    SAY_SYLVANAS_INTRO_7                          = -1668031,
  1707. -    SAY_UTHER_INTRO_H2_5                          = -1668032,
  1708. -    SAY_UTHER_INTRO_H2_6                          = -1668033,
  1709. -    SAY_SYLVANAS_INTRO_8                          = -1668034,
  1710. -    SAY_UTHER_INTRO_H2_7                          = -1668035,
  1711. -
  1712. -    SAY_LK_INTRO_1                                = -1668036,
  1713. -    SAY_LK_INTRO_2                                = -1668037,
  1714. -    SAY_LK_INTRO_3                                = -1668038,
  1715. -    SAY_FALRIC_INTRO_1                            = -1668039,
  1716. -    SAY_MARWYN_INTRO_1                            = -1668040,
  1717. -    SAY_FALRIC_INTRO_2                            = -1668041,
  1718. -
  1719. -    SAY_JAINA_INTRO_END                           = -1668042,
  1720. -    SAY_SYLVANAS_INTRO_END                        = -1668043,
  1721. +   //Intro
  1722. +   SAY_JAINA_INTRO_01                 = -1668001,
  1723. +   SAY_JAINA_INTRO_02                 = -1668002,
  1724. +   SAY_JAINA_INTRO_03                 = -1668003,
  1725. +   SAY_JAINA_INTRO_04                 = -1668004,
  1726. +
  1727. +   SAY_SYLVANA_INTRO_01               = -1668021,
  1728. +   SAY_SYLVANA_INTRO_02               = -1668022,
  1729. +   SAY_SYLVANA_INTRO_03               = -1668023,
  1730. +
  1731. +   //Dialog with Uter
  1732. +   SAY_UTHER_A_01                     = -1668005,
  1733. +   SAY_JAINA_02                       = -1668006,
  1734. +   SAY_UTHER_A_03                     = -1668007,
  1735. +   SAY_JAINA_04                       = -1668008,
  1736. +   SAY_UTHER_A_05                     = -1668009,
  1737. +   SAY_JAINA_06                       = -1668010,
  1738. +   SAY_UTHER_A_07                     = -1668011,
  1739. +   SAY_JAINA_08                       = -1668012,
  1740. +   SAY_UTHER_A_09                     = -1668013,
  1741. +   SAY_JAINA_10                       = -1668014,
  1742. +   SAY_UTHER_A_11                     = -1668015,
  1743. +   SAY_JAINA_12                       = -1668017,
  1744. +   SAY_UTHER_A_13                     = -1668016,
  1745. +   SAY_UTHER_A_14                     = -1668018,
  1746. +   SAY_JAINA_15                       = -1668019,
  1747. +
  1748. +   SAY_UTHER_H_01                     = -1668024,
  1749. +   SAY_SYLVANA_02                     = -1668025,
  1750. +   SAY_UTHER_H_03                     = -1668026,
  1751. +   SAY_SYLVANA_04                     = -1668027,
  1752. +   SAY_UTHER_H_05                     = -1668028,
  1753. +   SAY_SYLVANA_06                     = -1668029,
  1754. +   SAY_UTHER_H_07                     = -1668030,
  1755. +   SAY_SYLVANA_08                     = -1668031,
  1756. +   SAY_UTHER_H_09                     = -1668032,
  1757. +   SAY_UTHER_H_11                     = -1668033,
  1758. +   SAY_SYLVANA_12                     = -1668034,
  1759. +
  1760. +   //Lich King dialog
  1761. +   SAY_UTHER_A_16                     = -1668020,
  1762. +   SAY_JAINA_20                       = -1668042,
  1763. +
  1764. +
  1765. +   SAY_UTHER_H_16                     = -1668035,
  1766. +   SAY_SYLVANA_20                     = -1668043,
  1767. +
  1768. +   SAY_LICH_KING_17                   = -1668036,
  1769. +   SAY_LICH_KING_18                   = -1668037,
  1770. +   SAY_LICH_KING_19                   = -1668038,
  1771. +   SAY_LICH_KING_A_21                 = -1594473,
  1772. +   SAY_LICH_KING_H_21                 = -1594474,
  1773. +
  1774. +   SAY_FALRIC_INTRO                   = -1668039,
  1775. +   SAY_MARWYN_INTRO                   = -1668040,
  1776. +   SAY_FALRIC_INTRO2                  = -1668041,
  1777. +
  1778. +   /*INTRO - Pre Escape*/
  1779. +   SAY_LICH_KING_AGGRO_A              = -1594477,
  1780. +   SAY_LICH_KING_AGGRO_H              = -1594478,
  1781. +   SAY_JAINA_AGGRO                    = -1594479,
  1782. +   SAY_SYLVANA_AGGRO                  = -1594480,
  1783. +
  1784. +   /*ESCAPE*/
  1785. +   SAY_JAINA_WALL_01                  = -1594487,
  1786. +   SAY_SYLVANA_WALL_01                = -1594488,
  1787. +   SAY_JAINA_WALL_02                  = -1594489,
  1788. +   SAY_SYLVANA_WALL_02                = -1594490,
  1789. +   SAY_LICH_KING_WALL_02              = -1594491,
  1790. +   SAY_LICH_KING_WALL_03              = -1594492,
  1791. +   SAY_LICH_KING_WALL_04              = -1594493,
  1792. +   SAY_JAINA_WALL_03                  = -1594494,
  1793. +   SAY_JAINA_WALL_04                  = -1594495,
  1794. +   SAY_SYLVANA_WALL_03                = -1594496,
  1795. +   SAY_SYLVANA_WALL_04                = -1594497,
  1796. +   SAY_JAINA_ESCAPE_01                = -1594498,
  1797. +   SAY_JAINA_ESCAPE_02                = -1594499,
  1798. +   SAY_SYLVANA_ESCAPE_01              = -1594500,
  1799. +   SAY_SYLVANA_ESCAPE_02              = -1594501,
  1800. +   SAY_JAINA_TRAP                     = -1594502,
  1801. +   SAY_SYLVANA_TRAP                   = -1594503,
  1802. +   SAY_MATHEAS_JAINA                  = -1594505,
  1803. +   SAY_LICH_KING_END_01               = -1594506,
  1804. +   SAY_LICH_KING_END_02               = -1594507,
  1805. +   SAY_LICH_KING_END_03               = -1594508,
  1806. +
  1807. +   /*SPELLS AND VISUAL EFFECTS*/
  1808. +   SPELL_TAKE_FROSTMOURNE             = 72729,
  1809. +   SPELL_FROSTMOURNE_DESPAWN          = 72726,
  1810. +   SPELL_FROSTMOURNE_SOUNDS           = 70667,
  1811. +   SPELL_CAST_VISUAL                  = 65633,  //Jaina And Sylavana cast this when summon uther.
  1812. +   SPELL_BOSS_SPAWN_AURA              = 72712,  //Falric and Marwyn
  1813. +   SPELL_UTHER_DESPAWN                = 70693,
  1814. +   SPELL_WINTER                       = 69780,
  1815. +   SPELL_FURY_OF_FROSTMOURNE          = 70063,
  1816. +   SPELL_SOUL_REAPER                  = 73797,
  1817. +   SPELL_RAISE_DEAD                   = 69818,
  1818. +   SPELL_ICE_PRISON                   = 71321,
  1819. +   SPELL_ICE_PRISON_VISUAL            = 69708,
  1820. +   SPELL_DARK_ARROW                   = 70194,
  1821. +   SPELL_ICE_BARRIER                  = 69787,
  1822. +   SPELL_DESTROY_ICE_WALL_01          = 69784, //Jaina
  1823. +   SPELL_DESTROY_ICE_WALL_02          = 70224,
  1824. +   SPELL_DESTROY_ICE_WALL_03          = 70225, //Sylvana
  1825. +   SPELL_SUMMON_ICE_WALL              = 69784,
  1826. +   SPELL_SYLVANA_JUMP                 = 68339,
  1827. +   SPELL_SYLVANA_STEP                 = 69087,
  1828. +   SPELL_SILENCE                      = 69413,
  1829. +   SPELL_LICH_KING_CAST               = 57561,
  1830. +   SPELL_FROSTMOURNE_VISUAL           = 73220,
  1831. +   SPELL_SHIELD_DISRUPTION            = 58291,
  1832. +
  1833. +   FACTION                            = 2076,
  1834.  };
  1835.  
  1836. -enum Events
  1837. +class npc_jaina_and_sylvana_HRintro : public CreatureScript
  1838.  {
  1839. -    EVENT_NONE,
  1840. -
  1841. -    EVENT_START_INTRO,
  1842. -    EVENT_SKIP_INTRO,
  1843. -
  1844. -    EVENT_INTRO_A2_1,
  1845. -    EVENT_INTRO_A2_2,
  1846. -    EVENT_INTRO_A2_3,
  1847. -    EVENT_INTRO_A2_4,
  1848. -    EVENT_INTRO_A2_5,
  1849. -    EVENT_INTRO_A2_6,
  1850. -    EVENT_INTRO_A2_7,
  1851. -    EVENT_INTRO_A2_8,
  1852. -    EVENT_INTRO_A2_9,
  1853. -    EVENT_INTRO_A2_10,
  1854. -    EVENT_INTRO_A2_11,
  1855. -    EVENT_INTRO_A2_12,
  1856. -    EVENT_INTRO_A2_13,
  1857. -    EVENT_INTRO_A2_14,
  1858. -    EVENT_INTRO_A2_15,
  1859. -    EVENT_INTRO_A2_16,
  1860. -    EVENT_INTRO_A2_17,
  1861. -    EVENT_INTRO_A2_18,
  1862. -    EVENT_INTRO_A2_19,
  1863. -
  1864. -    EVENT_INTRO_H2_1,
  1865. -    EVENT_INTRO_H2_2,
  1866. -    EVENT_INTRO_H2_3,
  1867. -    EVENT_INTRO_H2_4,
  1868. -    EVENT_INTRO_H2_5,
  1869. -    EVENT_INTRO_H2_6,
  1870. -    EVENT_INTRO_H2_7,
  1871. -    EVENT_INTRO_H2_8,
  1872. -    EVENT_INTRO_H2_9,
  1873. -    EVENT_INTRO_H2_10,
  1874. -    EVENT_INTRO_H2_11,
  1875. -    EVENT_INTRO_H2_12,
  1876. -    EVENT_INTRO_H2_13,
  1877. -    EVENT_INTRO_H2_14,
  1878. -    EVENT_INTRO_H2_15,
  1879. -
  1880. -    EVENT_INTRO_LK_1,
  1881. -    EVENT_INTRO_LK_2,
  1882. -    EVENT_INTRO_LK_3,
  1883. -    EVENT_INTRO_LK_4,
  1884. -    EVENT_INTRO_LK_5,
  1885. -    EVENT_INTRO_LK_6,
  1886. -    EVENT_INTRO_LK_7,
  1887. -    EVENT_INTRO_LK_8,
  1888. -    EVENT_INTRO_LK_9,
  1889. -
  1890. -    EVENT_INTRO_END,
  1891. -};
  1892. +public:
  1893. +    npc_jaina_and_sylvana_HRintro() : CreatureScript("npc_jaina_and_sylvana_HRintro") { }
  1894.  
  1895. -enum eEnum
  1896. -{
  1897. -    ACTION_START_INTRO,
  1898. -    ACTION_SKIP_INTRO,
  1899. +    bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction)
  1900. +    {
  1901. +        InstanceScript* m_pInstance = (InstanceScript*)pCreature->GetInstanceScript();
  1902.  
  1903. -    QUEST_DELIVRANCE_FROM_THE_PIT_A2              = 24710,
  1904. -    QUEST_DELIVRANCE_FROM_THE_PIT_H2              = 24712,
  1905. -    QUEST_WRATH_OF_THE_LICH_KING_A2               = 24500,
  1906. -    QUEST_WRATH_OF_THE_LICH_KING_H2               = 24802,
  1907. -};
  1908. +        if (!m_pInstance)
  1909. +            return false;
  1910.  
  1911. -const Position HallsofReflectionLocs[]=
  1912. -{
  1913. -    {5283.234863f, 1990.946777f, 707.695679f, 0.929097f},   // 2 Loralen Follows
  1914. -    {5408.031250f, 2102.918213f, 707.695251f, 0.792756f},   // 9 Sylvanas Follows
  1915. -    {5401.866699f, 2110.837402f, 707.695251f, 0.800610f},   // 10 Loralen follows
  1916. -};
  1917. +        switch (uiAction)
  1918. +        {
  1919. +            case GOSSIP_ACTION_INFO_DEF+1:
  1920. +                pPlayer->CLOSE_GOSSIP_MENU();
  1921. +                m_pInstance->SetData(TYPE_EVENT, 1);
  1922. +                break;
  1923. +        }
  1924.  
  1925. -const Position SpawnPos              = {5262.540527f, 1949.693726f, 707.695007f, 0.808736f}; // Jaina/Sylvanas Beginning Position
  1926. -const Position MoveThronePos         = {5306.952148f, 1998.499023f, 709.341431f, 1.277278f}; // Jaina/Sylvanas walks to throne
  1927. -const Position UtherSpawnPos         = {5308.310059f, 2003.857178f, 709.341431f, 4.650315f};
  1928. -const Position LichKingSpawnPos      = {5362.917480f, 2062.307129f, 707.695374f, 3.945812f};
  1929. -const Position LichKingMoveThronePos = {5312.080566f, 2009.172119f, 709.341431f, 3.973301f}; // Lich King walks to throne
  1930. -const Position LichKingMoveAwayPos   = {5400.069824f, 2102.7131689f, 707.69525f, 0.843803f}; // Lich King walks away
  1931. +        if(pPlayer->GetTeam() == ALLIANCE)
  1932. +            m_pInstance->SetData(DATA_LIDER, 1);
  1933. +        else
  1934. +            m_pInstance->SetData(DATA_LIDER, 2);
  1935.  
  1936. -class npc_jaina_or_sylvanas_hor : public CreatureScript
  1937. -{
  1938. -private:
  1939. -    bool m_isSylvana;
  1940. +        m_pInstance->SetData64(DATA_ESCAPE_LIDER,pCreature->GetGUID());
  1941.  
  1942. -public:
  1943. -    npc_jaina_or_sylvanas_hor(bool isSylvana, const char* name) : CreatureScript(name), m_isSylvana(isSylvana) { }
  1944. +        return true;
  1945. +    }
  1946.  
  1947. -    bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action)
  1948. +    bool OnGossipHello(Player* pPlayer, Creature* pCreature)
  1949.      {
  1950. -        player->PlayerTalkClass->ClearMenus();
  1951. -        switch (action)
  1952. +        InstanceScript* m_pInstance = (InstanceScript*)pCreature->GetInstanceScript();
  1953. +
  1954. +        if(pCreature->isQuestGiver())
  1955. +            pPlayer->PrepareQuestMenu( pCreature->GetGUID());
  1956. +
  1957. +        switch(pCreature->GetEntry())
  1958.          {
  1959. -            case GOSSIP_ACTION_INFO_DEF+1:
  1960. -                player->CLOSE_GOSSIP_MENU();
  1961. -                if (creature->AI())
  1962. -                    creature->AI()->DoAction(ACTION_START_INTRO);
  1963. -                creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
  1964. +            case NPC_JAINA:
  1965. +                pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "???? ??????, ?? ?????? ? ????????? ??????!", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
  1966.                  break;
  1967. -            case GOSSIP_ACTION_INFO_DEF+2:
  1968. -                player->CLOSE_GOSSIP_MENU();
  1969. -                if (creature->AI())
  1970. -                    creature->AI()->DoAction(ACTION_SKIP_INTRO);
  1971. -                creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
  1972. +            case NPC_SYLVANA:
  1973. +                pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "???? ????????, ?? ?????? ? ????????? ??????!", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
  1974.                  break;
  1975.          }
  1976.  
  1977. +        pPlayer->PlayerTalkClass->SendGossipMenu(907,pCreature->GetGUID());
  1978.          return true;
  1979.      }
  1980.  
  1981. -    bool OnGossipHello(Player* player, Creature* creature)
  1982. +    struct npc_jaina_and_sylvana_HRintroAI : public ScriptedAI
  1983.      {
  1984. -        if (creature->isQuestGiver())
  1985. -            player->PrepareQuestMenu(creature->GetGUID());
  1986. +        npc_jaina_and_sylvana_HRintroAI(Creature *pCreature) : ScriptedAI(pCreature)
  1987. +        {
  1988. +            m_pInstance = (InstanceScript*)pCreature->GetInstanceScript();
  1989. +            Reset();
  1990. +        }
  1991.  
  1992. -        QuestStatus status = player->GetQuestStatus(m_isSylvana ? QUEST_DELIVRANCE_FROM_THE_PIT_H2 : QUEST_DELIVRANCE_FROM_THE_PIT_A2);
  1993. -        if (status == QUEST_STATUS_COMPLETE || status == QUEST_STATUS_REWARDED)
  1994. -            player->ADD_GOSSIP_ITEM( 0, "Can you remove the sword?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
  1995. +        InstanceScript* m_pInstance;
  1996.  
  1997. -        // once last quest is completed, she offers this shortcut of the starting event
  1998. -        status = player->GetQuestStatus(m_isSylvana ? QUEST_WRATH_OF_THE_LICH_KING_H2 : QUEST_WRATH_OF_THE_LICH_KING_A2);
  1999. -        if (status == QUEST_STATUS_COMPLETE || status == QUEST_STATUS_REWARDED)
  2000. -            player->ADD_GOSSIP_ITEM( 0, "Dark Lady, I think I hear Arthas coming. Whatever you're going to do, do it quickly.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2);
  2001. +        uint32 StepTimer;
  2002. +        uint32 Step;
  2003. +        uint64 m_uiFrostmourneGUID;
  2004. +        uint64 m_uiMainGateGUID;
  2005. +        uint64 m_uiFalricGUID;
  2006. +        uint64 m_uiMarwynGUID;
  2007. +        Creature* pUther;
  2008. +        Creature* pLichKing;
  2009. +        bool Small;
  2010.  
  2011. -        player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID());
  2012. -        return true;
  2013. -    }
  2014. +        void Reset()
  2015. +        {
  2016. +            me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER);
  2017. +            me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
  2018. +            Small = false;
  2019. +        }
  2020. +
  2021. +        void StartEvent()
  2022. +        {
  2023. +            if(!m_pInstance)
  2024. +                return
  2025. +            sLog->outDebug(LOG_FILTER_TSCR, "EventMGR: creature %u received signal %u ",me->GetEntry(),m_pInstance->GetData(TYPE_EVENT));
  2026. +            m_pInstance->SetData(TYPE_PHASE, 1);
  2027. +            m_pInstance->SetData(TYPE_EVENT, 0);
  2028. +            Step = 1;
  2029. +            StepTimer = 100;
  2030. +        }
  2031. +
  2032. +        void JumpNextStep(uint32 Time)
  2033. +        {
  2034. +            StepTimer = Time;
  2035. +            Step++;
  2036. +        }
  2037.  
  2038. -    CreatureAI* GetAI(Creature* creature) const
  2039. +        void Event()
  2040. +        {
  2041. +            switch(Step)
  2042. +            {
  2043. +                case 1:
  2044. +                    me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER);
  2045. +                    me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
  2046. +                    JumpNextStep(2000);
  2047. +                    break;
  2048. +                case 2:
  2049. +                    if(me->GetEntry() == NPC_JAINA)
  2050. +                    {
  2051. +                        DoScriptText(SAY_JAINA_INTRO_01, me);
  2052. +                        JumpNextStep(5000);
  2053. +                    }
  2054. +                    if(me->GetEntry() == NPC_SYLVANA)
  2055. +                    {
  2056. +                        DoScriptText(SAY_SYLVANA_INTRO_01, me);
  2057. +                        JumpNextStep(8000);
  2058. +                    }
  2059. +                    break;
  2060. +                case 3:
  2061. +                    if(me->GetEntry() == NPC_JAINA)
  2062. +                    {
  2063. +                        DoScriptText(SAY_JAINA_INTRO_02, me);
  2064. +                        JumpNextStep(5000);
  2065. +                    }
  2066. +                    if(me->GetEntry() == NPC_SYLVANA)
  2067. +                        JumpNextStep(500);
  2068. +                    break;
  2069. +                case 4:
  2070. +                    me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING);
  2071. +                    me->GetMotionMaster()->MovePoint(0, 5307.031f, 1997.920f, 709.341f);
  2072. +                    JumpNextStep(10000);
  2073. +                    break;
  2074. +                case 5:
  2075. +                    if(Creature* pTarget = me->SummonCreature(NPC_ALTAR_TARGET,5309.374f,2006.788f,711.615f,1.37f,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,360000))
  2076. +                    {
  2077. +                        me->SetUInt64Value(UNIT_FIELD_TARGET, pTarget->GetGUID());
  2078. +                        pTarget->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
  2079. +                    }
  2080. +                    JumpNextStep(1000);
  2081. +                    break;
  2082. +                case 6:
  2083. +                    if(me->GetEntry() == NPC_JAINA)
  2084. +                    {
  2085. +                        DoScriptText(SAY_JAINA_INTRO_03, me);
  2086. +                        JumpNextStep(5000);
  2087. +                    }
  2088. +                    if(me->GetEntry() == NPC_SYLVANA)
  2089. +                    {
  2090. +                        DoScriptText(SAY_SYLVANA_INTRO_03, me);
  2091. +                        //DoScriptText(SAY_SYLVANA_INTRO_02, me);
  2092. +                        JumpNextStep(6000);
  2093. +                    }
  2094. +                    break;
  2095. +                case 7:
  2096. +                    DoCast(me, SPELL_CAST_VISUAL);
  2097. +                    if(me->GetEntry() == NPC_JAINA)
  2098. +                        DoScriptText(SAY_JAINA_INTRO_04, me);
  2099. +                    if(me->GetEntry() == NPC_SYLVANA)
  2100. +                        DoScriptText(SAY_SYLVANA_INTRO_03, me);
  2101. +                    JumpNextStep(3000);
  2102. +                    break;
  2103. +                case 8:
  2104. +                    DoCast(me, SPELL_FROSTMOURNE_SOUNDS);
  2105. +                    m_uiFrostmourneGUID = m_pInstance->GetData64(GO_FROSTMOURNE);
  2106. +                    if(GameObject* pFrostmourne = m_pInstance->instance->GetGameObject(m_uiFrostmourneGUID))
  2107. +                    {
  2108. +                        pFrostmourne->SetGoState(GO_STATE_ACTIVE);
  2109. +                    }
  2110. +                    if(me->GetEntry() == NPC_JAINA)
  2111. +                        JumpNextStep(12000);
  2112. +                    if(me->GetEntry() == NPC_SYLVANA)
  2113. +                        JumpNextStep(8000);
  2114. +                    break;
  2115. +                case 9:
  2116. +                    if(Creature* Uther = me->SummonCreature(NPC_UTHER,5308.228f,2003.641f,709.341f,4.17f,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,360000))
  2117. +                    {
  2118. +                        pUther = Uther;
  2119. +                        Uther->SetUInt64Value(UNIT_FIELD_TARGET, me->GetGUID());
  2120. +                        me->SetUInt64Value(UNIT_FIELD_TARGET, Uther->GetGUID());
  2121. +                        if(me->GetEntry() == NPC_JAINA)
  2122. +                        {
  2123. +                            DoScriptText(SAY_UTHER_A_01, Uther);
  2124. +                            JumpNextStep(3000);
  2125. +                        }
  2126. +                        if(me->GetEntry() == NPC_SYLVANA)
  2127. +                        {
  2128. +                            DoScriptText(SAY_UTHER_H_01, Uther);
  2129. +                            JumpNextStep(10000);
  2130. +                        }
  2131. +                    }
  2132. +                    break;
  2133. +                case 10:
  2134. +                    if(me->GetEntry() == NPC_JAINA)
  2135. +                    {
  2136. +                        DoScriptText(SAY_JAINA_02, me);
  2137. +                        JumpNextStep(5000);
  2138. +                    }
  2139. +                    if(me->GetEntry() == NPC_SYLVANA)
  2140. +                    {
  2141. +                        DoScriptText(SAY_SYLVANA_02, me);
  2142. +                        JumpNextStep(3000);
  2143. +                    }
  2144. +                    break;
  2145. +                case 11:
  2146. +                    if(me->GetEntry() == NPC_JAINA && pUther)
  2147. +                    {
  2148. +                        DoScriptText(SAY_UTHER_A_03, pUther);
  2149. +                        JumpNextStep(7000);
  2150. +                    }
  2151. +                    if(me->GetEntry() == NPC_SYLVANA && pUther)
  2152. +                    {
  2153. +                        DoScriptText(SAY_UTHER_H_03, pUther);
  2154. +                        JumpNextStep(6000);
  2155. +                    }
  2156. +                    if(Small)
  2157. +                        Step = 24;
  2158. +                    break;
  2159. +                case 12:
  2160. +                    if(me->GetEntry() == NPC_JAINA)
  2161. +                    {
  2162. +                        DoScriptText(SAY_JAINA_04, me);
  2163. +                        JumpNextStep(2000);
  2164. +                    }
  2165. +                    if(me->GetEntry() == NPC_SYLVANA)
  2166. +                    {
  2167. +                        DoScriptText(SAY_SYLVANA_04, me);
  2168. +                        JumpNextStep(5000);
  2169. +                    }
  2170. +                    break;
  2171. +                case 13:
  2172. +                    if(me->GetEntry() == NPC_JAINA && pUther)
  2173. +                    {
  2174. +                        DoScriptText(SAY_UTHER_A_05, pUther);
  2175. +                        JumpNextStep(10000);
  2176. +                    }
  2177. +                    if(me->GetEntry() == NPC_SYLVANA && pUther)
  2178. +                    {
  2179. +                        DoScriptText(SAY_UTHER_H_05, pUther);
  2180. +                        JumpNextStep(19000);
  2181. +                    }
  2182. +                    break;
  2183. +                case 14:
  2184. +                    if(me->GetEntry() == NPC_JAINA)
  2185. +                    {
  2186. +                        DoScriptText(SAY_JAINA_06, me);
  2187. +                        JumpNextStep(6000);
  2188. +                    }
  2189. +                    if(me->GetEntry() == NPC_SYLVANA)
  2190. +                    {
  2191. +                        DoScriptText(SAY_SYLVANA_06, me);
  2192. +                        JumpNextStep(2000);
  2193. +                    }
  2194. +                    break;
  2195. +                case 15:
  2196. +                    if(me->GetEntry() == NPC_JAINA && pUther)
  2197. +                    {
  2198. +                        DoScriptText(SAY_UTHER_A_07, pUther);
  2199. +                        JumpNextStep(12000);
  2200. +                    }
  2201. +                    if(me->GetEntry() == NPC_SYLVANA && pUther)
  2202. +                    {
  2203. +                        DoScriptText(SAY_UTHER_H_07, pUther);
  2204. +                        JumpNextStep(20000);
  2205. +                    }
  2206. +                    break;
  2207. +                case 16:
  2208. +                    if(me->GetEntry() == NPC_JAINA)
  2209. +                    {
  2210. +                        DoScriptText(SAY_JAINA_08, me);
  2211. +                        JumpNextStep(6000);
  2212. +                    }
  2213. +                    if(me->GetEntry() == NPC_SYLVANA)
  2214. +                    {
  2215. +                        DoScriptText(SAY_SYLVANA_08, me);
  2216. +                        JumpNextStep(3000);
  2217. +                    }
  2218. +                    break;
  2219. +                case 17:
  2220. +                    if(me->GetEntry() == NPC_JAINA && pUther)
  2221. +                    {
  2222. +                        DoScriptText(SAY_UTHER_A_09, pUther);
  2223. +                        JumpNextStep(12000);
  2224. +                    }
  2225. +                    if(me->GetEntry() == NPC_SYLVANA && pUther)
  2226. +                    {
  2227. +                        DoScriptText(SAY_UTHER_H_09, pUther);
  2228. +                        JumpNextStep(11000);
  2229. +                    }
  2230. +                    break;
  2231. +                case 18:
  2232. +                    if(me->GetEntry() == NPC_JAINA)
  2233. +                    {
  2234. +                        DoScriptText(SAY_JAINA_10, me);
  2235. +                        JumpNextStep(11000);
  2236. +                    }
  2237. +                    if(me->GetEntry() == NPC_SYLVANA)
  2238. +                    {
  2239. +                        JumpNextStep(100);
  2240. +                    }
  2241. +                    break;
  2242. +                case 19:
  2243. +                    if(me->GetEntry() == NPC_JAINA && pUther)
  2244. +                    {
  2245. +                        DoScriptText(SAY_UTHER_A_11, pUther);
  2246. +                        JumpNextStep(24000);
  2247. +                    }
  2248. +                    if(me->GetEntry() == NPC_SYLVANA && pUther)
  2249. +                    {
  2250. +                        DoScriptText(SAY_UTHER_H_11, pUther);
  2251. +                        JumpNextStep(9000);
  2252. +                    }
  2253. +                    break;
  2254. +                case 20:
  2255. +                    if(me->GetEntry() == NPC_JAINA)
  2256. +                    {
  2257. +                        DoScriptText(SAY_JAINA_12, me);
  2258. +                        JumpNextStep(2000);
  2259. +                    }
  2260. +                    if(me->GetEntry() == NPC_SYLVANA)
  2261. +                    {
  2262. +                        DoScriptText(SAY_SYLVANA_12, me);
  2263. +                        JumpNextStep(2100);
  2264. +                    }
  2265. +                    break;
  2266. +                case 21:
  2267. +                    if(me->GetEntry() == NPC_JAINA && pUther)
  2268. +                    {
  2269. +                        DoScriptText(SAY_UTHER_A_13, pUther);
  2270. +                        JumpNextStep(5000);
  2271. +                    }
  2272. +                    if(me->GetEntry() == NPC_SYLVANA)
  2273. +                    {
  2274. +                        JumpNextStep(100);
  2275. +                    }
  2276. +                    break;
  2277. +                case 22:
  2278. +                    if(me->GetEntry() == NPC_JAINA && pUther)
  2279. +                    {
  2280. +                        DoScriptText(SAY_UTHER_A_14, pUther);
  2281. +                        JumpNextStep(12000);
  2282. +                    }
  2283. +                    if(me->GetEntry() == NPC_SYLVANA)
  2284. +                    {
  2285. +                        JumpNextStep(100);
  2286. +                    }
  2287. +                    break;
  2288. +                case 23:
  2289. +                    if(me->GetEntry() == NPC_JAINA)
  2290. +                    {
  2291. +                        DoScriptText(SAY_JAINA_15, me);
  2292. +                        JumpNextStep(2000);
  2293. +                    }
  2294. +                    if(me->GetEntry() == NPC_SYLVANA)
  2295. +                    {
  2296. +                        JumpNextStep(100);
  2297. +                    }
  2298. +                    break;
  2299. +                case 24:
  2300. +                    if(me->GetEntry() == NPC_JAINA && pUther)
  2301. +                        DoScriptText(SAY_UTHER_A_16, pUther);
  2302. +                    if(me->GetEntry() == NPC_SYLVANA && pUther)
  2303. +                        DoScriptText(SAY_UTHER_H_16, pUther);
  2304. +                    m_uiMainGateGUID = m_pInstance->GetData64(GO_IMPENETRABLE_DOOR);
  2305. +                    if(GameObject* pGate = m_pInstance->instance->GetGameObject(m_uiMainGateGUID))
  2306. +                    {
  2307. +                        pGate->SetGoState(GO_STATE_ACTIVE);
  2308. +                    }
  2309. +                    if(Creature* LichKing = me->SummonCreature(NPC_LICH_KING,5362.469f,2062.342f,707.695f,3.97f,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,360000))
  2310. +                    {
  2311. +                        pLichKing = LichKing;
  2312. +                        LichKing->setActive(true);
  2313. +                    }
  2314. +                    JumpNextStep(1000);
  2315. +                    break;
  2316. +                case 25:
  2317. +                    if(pUther)
  2318. +                        pUther->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_COWER);
  2319. +                    if(pLichKing)
  2320. +                    {
  2321. +                        pLichKing->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
  2322. +                        pLichKing->AddUnitMovementFlag(MOVEMENTFLAG_WALKING);
  2323. +                        pLichKing->GetMotionMaster()->MovePoint(0, 5314.881f, 2012.496f, 709.341f);
  2324. +                    }
  2325. +                    JumpNextStep(3000);
  2326. +                    break;
  2327. +                case 26:
  2328. +                    if(GameObject* pGate = m_pInstance->instance->GetGameObject(m_uiMainGateGUID))
  2329. +                        pGate->SetGoState(GO_STATE_READY);
  2330. +                    JumpNextStep(7000);
  2331. +                    break;
  2332. +                case 27:
  2333. +                    if(pUther)
  2334. +                        pUther->CastSpell(pUther, SPELL_UTHER_DESPAWN, false);
  2335. +                    JumpNextStep(500);
  2336. +                    break;
  2337. +                case 28:
  2338. +                    if(pLichKing)
  2339. +                        DoScriptText(SAY_LICH_KING_17, pLichKing);
  2340. +                    JumpNextStep(10000);
  2341. +                    break;
  2342. +                case 29:
  2343. +                    if(pLichKing)
  2344. +                        DoScriptText(SAY_LICH_KING_18, pLichKing);
  2345. +                    JumpNextStep(5000);
  2346. +                    break;
  2347. +                case 30:
  2348. +                    if(pLichKing)
  2349. +                        pLichKing->CastSpell(pLichKing, SPELL_TAKE_FROSTMOURNE, false);
  2350. +                    if(GameObject* pFrostmourne = m_pInstance->instance->GetGameObject(m_uiFrostmourneGUID))
  2351. +                        pFrostmourne->SetGoState(GO_STATE_READY);
  2352. +                    JumpNextStep(1500);
  2353. +                    break;
  2354. +                case 31:
  2355. +                    if(GameObject* pFrostmourne = m_pInstance->instance->GetGameObject(m_uiFrostmourneGUID))
  2356. +                        pFrostmourne->SetPhaseMask(0, true);
  2357. +                    if(pLichKing)
  2358. +                        pLichKing->CastSpell(pLichKing, SPELL_FROSTMOURNE_VISUAL, false);
  2359. +                    me->RemoveAurasDueToSpell(SPELL_FROSTMOURNE_SOUNDS);
  2360. +                    JumpNextStep(5000);
  2361. +                    break;
  2362. +                case 32:
  2363. +                    if(pLichKing)
  2364. +                        DoScriptText(SAY_LICH_KING_19, pLichKing);
  2365. +                    JumpNextStep(9000);
  2366. +                    break;
  2367. +                case 33:
  2368. +                    m_uiFalricGUID = m_pInstance->GetData64(NPC_FALRIC);
  2369. +                    m_uiMarwynGUID = m_pInstance->GetData64(NPC_MARWYN);
  2370. +                    if(Creature* Falric = m_pInstance->instance->GetCreature(m_uiFalricGUID))
  2371. +                    {
  2372. +                        Falric->RemoveAllAuras();
  2373. +                        Falric->SetVisible(true);
  2374. +                        Falric->CastSpell(Falric, SPELL_BOSS_SPAWN_AURA, false);
  2375. +                        Falric->GetMotionMaster()->MovePoint(0, 5283.309f, 2031.173f, 709.319f);
  2376. +                    }
  2377. +                    if(Creature* Marwyn = m_pInstance->instance->GetCreature(m_uiMarwynGUID))
  2378. +                    {
  2379. +                        Marwyn->RemoveAllAuras();
  2380. +                        Marwyn->SetVisible(true);
  2381. +                        Marwyn->CastSpell(Marwyn, SPELL_BOSS_SPAWN_AURA, false);
  2382. +                        Marwyn->GetMotionMaster()->MovePoint(0, 5335.585f, 1981.439f, 709.319f);
  2383. +                    }
  2384. +                    if(pLichKing)
  2385. +                        pLichKing->GetMotionMaster()->MovePoint(0, 5402.286f, 2104.496f, 707.695f);
  2386. +                    JumpNextStep(600);
  2387. +                    break;
  2388. +                case 34:
  2389. +                    if(Creature* Falric = ((Creature*)Unit::GetUnit(*me, m_uiFalricGUID)))
  2390. +                        DoScriptText(SAY_FALRIC_INTRO, Falric);
  2391. +                    if(Creature* Marwyn = ((Creature*)Unit::GetUnit(*me, m_uiMarwynGUID)))
  2392. +                        DoScriptText(SAY_MARWYN_INTRO, Marwyn);
  2393. +                    JumpNextStep(3000);
  2394. +                    break;
  2395. +                case 35:
  2396. +                    if(GameObject* pGate = m_pInstance->instance->GetGameObject(m_uiMainGateGUID))
  2397. +                        pGate->SetGoState(GO_STATE_ACTIVE);
  2398. +                    if(Creature* Falric = ((Creature*)Unit::GetUnit(*me, m_uiFalricGUID)))
  2399. +                        DoScriptText(SAY_FALRIC_INTRO2, Falric);
  2400. +                    m_pInstance->SetData(TYPE_FALRIC, SPECIAL);
  2401. +                    JumpNextStep(4000);
  2402. +                    break;
  2403. +                case 36:
  2404. +                    if(me->GetEntry() == NPC_JAINA)
  2405. +                        DoScriptText(SAY_JAINA_20, me);
  2406. +                    if(me->GetEntry() == NPC_SYLVANA)
  2407. +                        DoScriptText(SAY_SYLVANA_20, me);
  2408. +                    me->GetMotionMaster()->MovePoint(0, 5443.880f, 2147.095f, 707.695f);
  2409. +                    JumpNextStep(4000);
  2410. +                    break;
  2411. +                case 37:
  2412. +                    if(pLichKing)
  2413. +                    {
  2414. +                        pLichKing->GetMotionMaster()->MovementExpired(false);
  2415. +                        pLichKing->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING);
  2416. +                        pLichKing->GetMotionMaster()->MovePoint(0, 5443.880f, 2147.095f, 707.695f);
  2417. +                    }
  2418. +                    if(me->GetEntry() == NPC_JAINA && pLichKing)
  2419. +                        DoScriptText(SAY_LICH_KING_A_21, pLichKing);
  2420. +                    if(me->GetEntry() == NPC_SYLVANA && pLichKing)
  2421. +                        DoScriptText(SAY_LICH_KING_H_21, pLichKing);
  2422. +                    JumpNextStep(8000);
  2423. +                    break;
  2424. +                case 38:
  2425. +                    if(GameObject* pGate = m_pInstance->instance->GetGameObject(m_uiMainGateGUID))
  2426. +                        pGate->SetGoState(GO_STATE_READY);
  2427. +                    JumpNextStep(5000);
  2428. +                    break;
  2429. +                case 39:
  2430. +                    me->SetVisible(false);
  2431. +                    if(pLichKing)
  2432. +                        pLichKing->SetVisible(false);
  2433. +                    m_pInstance->SetData(TYPE_PHASE, 2);
  2434. +                    JumpNextStep(1000);
  2435. +                    break;
  2436. +            }
  2437. +        }
  2438. +
  2439. +        void UpdateAI(const uint32 diff)
  2440. +        {
  2441. +            if(!m_pInstance)
  2442. +                return;
  2443. +
  2444. +            if(m_pInstance->GetData(TYPE_EVENT) == 1
  2445. +                &&  m_pInstance->GetData64(DATA_ESCAPE_LIDER) == me->GetGUID())
  2446. +                StartEvent();
  2447. +
  2448. +            if(m_pInstance->GetData(TYPE_EVENT) == 2
  2449. +                &&  m_pInstance->GetData64(DATA_ESCAPE_LIDER) == me->GetGUID())
  2450. +            {
  2451. +                Small = true;
  2452. +                StartEvent();
  2453. +            }
  2454. +
  2455. +            if(StepTimer < diff && m_pInstance->GetData(TYPE_PHASE) == 1)
  2456. +                Event();
  2457. +            else StepTimer -= diff;
  2458. +
  2459. +            return;
  2460. +        }
  2461. +    };
  2462. +
  2463. +    CreatureAI* GetAI(Creature* pCreature) const
  2464.      {
  2465. -        return new npc_jaina_or_sylvanas_horAI(creature);
  2466. +        return new npc_jaina_and_sylvana_HRintroAI(pCreature);
  2467.      }
  2468.  
  2469. -    // AI of Part1: handle the intro till start of gauntlet event.
  2470. -    struct npc_jaina_or_sylvanas_horAI : public ScriptedAI
  2471. +};
  2472. +
  2473. +class npc_jaina_and_sylvana_HRextro : public CreatureScript
  2474. +{
  2475. +public:
  2476. +    npc_jaina_and_sylvana_HRextro() : CreatureScript("npc_jaina_and_sylvana_HRextro") { }
  2477. +
  2478. +    bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction)
  2479.      {
  2480. -        npc_jaina_or_sylvanas_horAI(Creature* creature) : ScriptedAI(creature)
  2481. +        InstanceScript* m_pInstance = (InstanceScript*)pCreature->GetInstanceScript();
  2482. +        switch (uiAction)
  2483.          {
  2484. -            instance = me->GetInstanceScript();
  2485. +            case GOSSIP_ACTION_INFO_DEF+1:
  2486. +                pPlayer->CLOSE_GOSSIP_MENU();
  2487. +                ((npc_jaina_and_sylvana_HRextroAI*)pCreature->AI())->Start(false,true);
  2488. +                pCreature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER);
  2489. +                pCreature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
  2490. +                pCreature->SetUInt64Value(UNIT_FIELD_TARGET, 0);
  2491. +                pCreature->setActive(true);
  2492. +
  2493. +                if(m_pInstance)
  2494. +                {
  2495. +                    m_pInstance->SetData64(DATA_ESCAPE_LIDER, pCreature->GetGUID());
  2496. +                    m_pInstance->SetData(TYPE_LICH_KING, IN_PROGRESS);
  2497. +                    m_pInstance->SetData(TYPE_PHASE, 5);
  2498. +                }
  2499. +                return true;
  2500. +            default:
  2501. +                return false;
  2502.          }
  2503. +    }
  2504.  
  2505. -        InstanceScript* instance;
  2506. -        uint64 uiUther;
  2507. -        uint64 uiLichKing;
  2508. +    bool OnGossipHello(Player* pPlayer, Creature* pCreature)
  2509. +    {
  2510. +        InstanceScript*   m_pInstance = (InstanceScript*)pCreature->GetInstanceScript();
  2511.  
  2512. -        EventMap events;
  2513. +        if(!m_pInstance)
  2514. +            return false;
  2515.  
  2516. -        void Reset()
  2517. -        {
  2518. -            events.Reset();
  2519. +        if(m_pInstance->GetData(TYPE_LICH_KING) == DONE)
  2520. +            return false;
  2521.  
  2522. -            uiUther = 0;
  2523. -            uiLichKing = 0;
  2524. +        if(pCreature->isQuestGiver())
  2525. +           pPlayer->PrepareQuestMenu( pCreature->GetGUID());
  2526.  
  2527. -            me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
  2528. -            me->SetStandState(UNIT_STAND_STATE_STAND);
  2529. -            me->SetVisible(true);
  2530. +        pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "????????!", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
  2531. +
  2532. +        pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID());
  2533. +
  2534. +        return true;
  2535. +    }
  2536. +
  2537. +    struct npc_jaina_and_sylvana_HRextroAI : public npc_escortAI
  2538. +    {
  2539. +        npc_jaina_and_sylvana_HRextroAI(Creature *pCreature) : npc_escortAI(pCreature)
  2540. +        {
  2541. +            m_pInstance = (InstanceScript*)pCreature->GetInstanceScript();
  2542. +            Reset();
  2543.          }
  2544.  
  2545. -        void DoAction(const int32 actionId)
  2546. +        InstanceScript* m_pInstance;
  2547. +
  2548. +        uint32 CastTimer;
  2549. +        uint32 StepTimer;
  2550. +        uint32 Step;
  2551. +        int32 HoldTimer;
  2552. +        uint32 Count;
  2553. +        bool Fight;
  2554. +        bool Event;
  2555. +        bool PreFight;
  2556. +        bool WallCast;
  2557. +        uint64 m_uiLichKingGUID;
  2558. +        uint64 m_uiLiderGUID;
  2559. +        uint64 m_uiIceWallGUID;
  2560. +        uint64 m_uipWallTargetGUID;
  2561. +        Creature* pLichKing;
  2562. +        uint32 m_chestID;
  2563. +
  2564. +        void Reset()
  2565.          {
  2566. -            switch (actionId)
  2567. +            if(!m_pInstance)
  2568. +                return;
  2569. +
  2570. +            if(m_pInstance->GetData(TYPE_LICH_KING) == IN_PROGRESS)
  2571. +                return;
  2572. +
  2573. +            Step = 0;
  2574. +            StepTimer = 500;
  2575. +            Fight = true;
  2576. +            me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER);
  2577. +            me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
  2578. +            m_uipWallTargetGUID = 0;
  2579. +
  2580. +            if(me->GetEntry() == NPC_JAINA_OUTRO)
  2581.              {
  2582. -                case ACTION_START_INTRO:
  2583. -                    events.ScheduleEvent(EVENT_START_INTRO, 0);
  2584. -                    break;
  2585. -                case ACTION_SKIP_INTRO:
  2586. -                    events.ScheduleEvent(EVENT_SKIP_INTRO, 0);
  2587. -                    break;
  2588. +                me->CastSpell(me, SPELL_ICE_BARRIER, false);
  2589. +                me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2HL);
  2590.              }
  2591. +            if(m_pInstance->GetData(TYPE_LICH_KING) == DONE)
  2592. +                me->SetVisible(false);
  2593. +
  2594.          }
  2595.  
  2596. -        void UpdateAI(const uint32 diff)
  2597. +        void AttackStart(Unit* who)
  2598.          {
  2599. -            events.Update(diff);
  2600. -            switch (events.ExecuteEvent())
  2601. +            if(!who)
  2602. +                return;
  2603. +
  2604. +            if(me->GetEntry() != NPC_SYLVANA_OUTRO)
  2605. +                return;
  2606. +
  2607. +            if(m_pInstance->GetData(TYPE_LICH_KING) == IN_PROGRESS || Fight != true)
  2608. +                return;
  2609. +
  2610. +            npc_escortAI::AttackStart(who);
  2611. +
  2612. +        }
  2613. +
  2614. +        void JustDied(Unit* pKiller)
  2615. +        {
  2616. +            if(!m_pInstance)
  2617. +                return;
  2618. +            m_pInstance->SetData(TYPE_LICH_KING, FAIL);
  2619. +        }
  2620. +
  2621. +        void WaypointReached(uint32 i)
  2622. +        {
  2623. +            switch(i)
  2624.              {
  2625. -                case EVENT_START_INTRO:
  2626. -                    me->GetMotionMaster()->MovePoint(0, MoveThronePos);
  2627. -                    // Begining of intro is differents between fActions as the speech sequence and timers are differents.
  2628. -                    if (instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE)
  2629. -                        events.ScheduleEvent(EVENT_INTRO_A2_1, 0);
  2630. -                    else
  2631. -                        events.ScheduleEvent(EVENT_INTRO_H2_1, 0);
  2632. +                case 3:
  2633. +                    m_pInstance->SetData(TYPE_ICE_WALL_01, IN_PROGRESS);
  2634. +                    if(GameObject* pGate = m_pInstance->instance->GetGameObject(m_pInstance->GetData64(GO_ICE_WALL_1)))
  2635. +                    {
  2636. +                        pGate->SetGoState(GO_STATE_READY);
  2637. +                        m_uiIceWallGUID = pGate->GetGUID();
  2638. +                    }
  2639.                      break;
  2640. -
  2641. -            // A2 Intro Events
  2642. -                case EVENT_INTRO_A2_1:
  2643. -                    DoScriptText(SAY_JAINA_INTRO_3, me);
  2644. -                    events.ScheduleEvent(EVENT_INTRO_A2_2, 5000);
  2645. +                case 4:
  2646. +                    if(me->GetEntry() == NPC_JAINA_OUTRO)
  2647. +                        DoScriptText(SAY_JAINA_WALL_01, me);
  2648. +                    if(me->GetEntry() == NPC_SYLVANA_OUTRO)
  2649. +                        DoScriptText(SAY_SYLVANA_WALL_01, me);
  2650. +                    CastTimer = 1000;
  2651. +                    HoldTimer = 30000;
  2652. +                    SetEscortPaused(true);
  2653. +                    if (Creature *pWallTarget = me->SummonCreature(NPC_ICE_WALL,me->GetPositionX(),me->GetPositionY(),me->GetPositionZ(),me->GetOrientation(),TEMPSUMMON_MANUAL_DESPAWN,720000))
  2654. +                    {
  2655. +                        m_uipWallTargetGUID = pWallTarget->GetGUID();
  2656. +                        pWallTarget->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
  2657. +                        if(me->GetEntry() == NPC_JAINA_OUTRO)
  2658. +                            me->CastSpell(pWallTarget, SPELL_DESTROY_ICE_WALL_01, false);
  2659. +                    }
  2660. +                    WallCast = true;
  2661.                      break;
  2662. -                case EVENT_INTRO_A2_2:
  2663. -                    DoScriptText(SAY_JAINA_INTRO_4, me);
  2664. -                    events.ScheduleEvent(EVENT_INTRO_A2_3, 10000);
  2665. +                case 6:
  2666. +                    m_pInstance->SetData(TYPE_ICE_WALL_02, IN_PROGRESS);
  2667. +                    if (Creature* pWallTarget = m_pInstance->instance->GetCreature(m_uipWallTargetGUID))
  2668. +                    {
  2669. +                        if(pWallTarget->isAlive())
  2670. +                        {
  2671. +                            pWallTarget->DespawnOrUnsummon();
  2672. +                            m_uipWallTargetGUID = 0;
  2673. +                        }
  2674. +                    }
  2675. +                    break;
  2676. +                case 8:
  2677. +                    if(me->GetEntry() == NPC_JAINA_OUTRO)
  2678. +                        DoScriptText(SAY_JAINA_WALL_02, me);
  2679. +                    if(me->GetEntry() == NPC_SYLVANA_OUTRO)
  2680. +                        DoScriptText(SAY_SYLVANA_WALL_02, me);
  2681. +                    CastTimer = 1000;
  2682. +                    HoldTimer = 30000;
  2683. +                    SetEscortPaused(true);
  2684. +                    if (Creature *pWallTarget = me->SummonCreature(NPC_ICE_WALL,me->GetPositionX(),me->GetPositionY(),me->GetPositionZ(),me->GetOrientation(),TEMPSUMMON_MANUAL_DESPAWN,720000))
  2685. +                    {
  2686. +                        m_uipWallTargetGUID = pWallTarget->GetGUID();
  2687. +                        pWallTarget->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
  2688. +                        if(me->GetEntry() == NPC_JAINA_OUTRO)
  2689. +                            me->CastSpell(pWallTarget, SPELL_DESTROY_ICE_WALL_01, false);
  2690. +                    }
  2691. +                    WallCast = true;
  2692. +                    break;
  2693. +                case 9:
  2694. +                    if(me->GetEntry() == NPC_JAINA_OUTRO)
  2695. +                        DoScriptText(SAY_JAINA_ESCAPE_01, me);
  2696. +                    if(me->GetEntry() == NPC_SYLVANA_OUTRO)
  2697. +                        DoScriptText(SAY_SYLVANA_ESCAPE_01, me);
  2698.                      break;
  2699. -                case EVENT_INTRO_A2_3:
  2700. -                    // TODO: she's doing some kind of spell casting emote
  2701. -                    instance->HandleGameObject(instance->GetData64(DATA_FROSTMOURNE), true);
  2702. -                    events.ScheduleEvent(EVENT_INTRO_A2_4, 10000);
  2703. +                case 11:
  2704. +                    m_pInstance->SetData(TYPE_ICE_WALL_03, IN_PROGRESS);
  2705. +                    if (Creature* pWallTarget = m_pInstance->instance->GetCreature(m_uipWallTargetGUID))
  2706. +                    {
  2707. +                        if(pWallTarget->isAlive())
  2708. +                        {
  2709. +                            pWallTarget->DespawnOrUnsummon();
  2710. +                            m_uipWallTargetGUID = 0;
  2711. +                        }
  2712. +                    }
  2713.                      break;
  2714. -                case EVENT_INTRO_A2_4:
  2715. -                    // spawn UTHER during speach 2
  2716. -                    if (Creature* pUther = me->SummonCreature(NPC_UTHER, UtherSpawnPos, TEMPSUMMON_MANUAL_DESPAWN))
  2717. +                case 12:
  2718. +                    if(me->GetEntry() == NPC_JAINA_OUTRO)
  2719. +                        DoScriptText(SAY_JAINA_WALL_03, me);
  2720. +                    if(me->GetEntry() == NPC_SYLVANA_OUTRO)
  2721. +                        DoScriptText(SAY_SYLVANA_WALL_03, me);
  2722. +                    CastTimer = 1000;
  2723. +                    HoldTimer = 30000;
  2724. +                    SetEscortPaused(true);
  2725. +                    if (Creature *pWallTarget = me->SummonCreature(NPC_ICE_WALL,me->GetPositionX(),me->GetPositionY(),me->GetPositionZ(),me->GetOrientation(),TEMPSUMMON_MANUAL_DESPAWN,720000))
  2726.                      {
  2727. -                        pUther->GetMotionMaster()->MoveIdle();
  2728. -                        pUther->SetReactState(REACT_PASSIVE); // be sure he will not aggro arthas
  2729. -                        uiUther = pUther->GetGUID();
  2730. +                        m_uipWallTargetGUID = pWallTarget->GetGUID();
  2731. +                        pWallTarget->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
  2732. +                        if(me->GetEntry() == NPC_JAINA_OUTRO)
  2733. +                            me->CastSpell(pWallTarget, SPELL_DESTROY_ICE_WALL_01, false);
  2734.                      }
  2735. -                    events.ScheduleEvent(EVENT_INTRO_A2_5, 2000);
  2736. -                    break;
  2737. -                case EVENT_INTRO_A2_5:
  2738. -                    if (Creature* pUther = me->GetCreature(*me, uiUther))
  2739. -                        DoScriptText(SAY_UTHER_INTRO_A2_1, pUther);
  2740. -                    events.ScheduleEvent(EVENT_INTRO_A2_6, 3000);
  2741. -                    break;
  2742. -                case EVENT_INTRO_A2_6:
  2743. -                    DoScriptText(SAY_JAINA_INTRO_5, me);
  2744. -                    events.ScheduleEvent(EVENT_INTRO_A2_7, 6000);
  2745. -                    break;
  2746. -                case EVENT_INTRO_A2_7:
  2747. -                    if (Creature* pUther = me->GetCreature(*me, uiUther))
  2748. -                        DoScriptText(SAY_UTHER_INTRO_A2_2, pUther);
  2749. -                    events.ScheduleEvent(EVENT_INTRO_A2_8, 6500);
  2750. -                    break;
  2751. -                case EVENT_INTRO_A2_8:
  2752. -                    DoScriptText(SAY_JAINA_INTRO_6, me);
  2753. -                    events.ScheduleEvent(EVENT_INTRO_A2_9, 2000);
  2754. -                    break;
  2755. -                case EVENT_INTRO_A2_9:
  2756. -                    if (Creature* pUther = me->GetCreature(*me, uiUther))
  2757. -                        DoScriptText(SAY_UTHER_INTRO_A2_3, pUther);
  2758. -                    events.ScheduleEvent(EVENT_INTRO_A2_10, 9000);
  2759. -                    break;
  2760. -                case EVENT_INTRO_A2_10:
  2761. -                    DoScriptText(SAY_JAINA_INTRO_7, me);
  2762. -                    events.ScheduleEvent(EVENT_INTRO_A2_11, 5000);
  2763. -                    break;
  2764. -                case EVENT_INTRO_A2_11:
  2765. -                    if (Creature* pUther = me->GetCreature(*me, uiUther))
  2766. -                        DoScriptText(SAY_UTHER_INTRO_A2_4, pUther);
  2767. -                    events.ScheduleEvent(EVENT_INTRO_A2_12, 11000);
  2768. -                    break;
  2769. -                case EVENT_INTRO_A2_12:
  2770. -                    DoScriptText(SAY_JAINA_INTRO_8, me);
  2771. -                    events.ScheduleEvent(EVENT_INTRO_A2_13, 4000);
  2772. -                    break;
  2773. -                case EVENT_INTRO_A2_13:
  2774. -                    if (Creature* pUther = me->GetCreature(*me, uiUther))
  2775. -                        DoScriptText(SAY_UTHER_INTRO_A2_5, pUther);
  2776. -                    events.ScheduleEvent(EVENT_INTRO_A2_14, 12500);
  2777. -                    break;
  2778. -                case EVENT_INTRO_A2_14:
  2779. -                    DoScriptText(SAY_JAINA_INTRO_9, me);
  2780. -                    events.ScheduleEvent(EVENT_INTRO_A2_15, 10000);
  2781. -                    break;
  2782. -                case EVENT_INTRO_A2_15:
  2783. -                    if (Creature* pUther = me->GetCreature(*me, uiUther))
  2784. -                        DoScriptText(SAY_UTHER_INTRO_A2_6, pUther);
  2785. -                    events.ScheduleEvent(EVENT_INTRO_A2_16, 22000);
  2786. -                    break;
  2787. -                case EVENT_INTRO_A2_16:
  2788. -                    if (Creature* pUther = me->GetCreature(*me, uiUther))
  2789. -                        DoScriptText(SAY_UTHER_INTRO_A2_7, pUther);
  2790. -                    events.ScheduleEvent(EVENT_INTRO_A2_17, 4000);
  2791. -                    break;
  2792. -                case EVENT_INTRO_A2_17:
  2793. -                    DoScriptText(SAY_JAINA_INTRO_10, me);
  2794. -                    events.ScheduleEvent(EVENT_INTRO_A2_18, 2000);
  2795. -                    break;
  2796. -                case EVENT_INTRO_A2_18:
  2797. -                    if (Creature* pUther = me->GetCreature(*me, uiUther))
  2798. +                    WallCast = true;
  2799. +                    break;
  2800. +                case 13:
  2801. +                    if(me->GetEntry() == NPC_JAINA_OUTRO)
  2802. +                        DoScriptText(SAY_JAINA_ESCAPE_02, me);
  2803. +                    if(me->GetEntry() == NPC_SYLVANA_OUTRO)
  2804. +                        DoScriptText(SAY_SYLVANA_ESCAPE_02, me);
  2805. +                    break;
  2806. +                case 15:
  2807. +                    m_pInstance->SetData(TYPE_ICE_WALL_04, IN_PROGRESS);
  2808. +                    if (Creature* pWallTarget = m_pInstance->instance->GetCreature(m_uipWallTargetGUID))
  2809.                      {
  2810. -                        pUther->HandleEmoteCommand(EMOTE_ONESHOT_NO);
  2811. -                        DoScriptText(SAY_UTHER_INTRO_A2_8, pUther);
  2812. +                        if(pWallTarget->isAlive())
  2813. +                        {
  2814. +                            pWallTarget->DespawnOrUnsummon();
  2815. +                            m_uipWallTargetGUID = 0;
  2816. +                        }
  2817.                      }
  2818. -                    events.ScheduleEvent(EVENT_INTRO_A2_19, 11000);
  2819.                      break;
  2820. -                case EVENT_INTRO_A2_19:
  2821. -                    DoScriptText(SAY_JAINA_INTRO_11, me);
  2822. -                    events.ScheduleEvent(EVENT_INTRO_LK_1, 2000);
  2823. +                case 16:
  2824. +                    if(me->GetEntry() == NPC_JAINA_OUTRO)
  2825. +                        DoScriptText(SAY_JAINA_WALL_04, me);
  2826. +                    if(me->GetEntry() == NPC_SYLVANA_OUTRO)
  2827. +                        DoScriptText(SAY_SYLVANA_WALL_04, me);
  2828. +                    CastTimer = 1000;
  2829. +                    HoldTimer = 30000;
  2830. +                    SetEscortPaused(true);
  2831. +                    if (Creature *pWallTarget = me->SummonCreature(NPC_ICE_WALL,me->GetPositionX(),me->GetPositionY(),me->GetPositionZ(),me->GetOrientation(),TEMPSUMMON_MANUAL_DESPAWN,720000))
  2832. +                    {
  2833. +                        m_uipWallTargetGUID = pWallTarget->GetGUID();
  2834. +                        pWallTarget->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
  2835. +                        if(me->GetEntry() == NPC_JAINA_OUTRO)
  2836. +                            me->CastSpell(pWallTarget, SPELL_DESTROY_ICE_WALL_01, false);
  2837. +                    }
  2838. +                    WallCast = true;
  2839.                      break;
  2840. -
  2841. -            // H2 Intro Events
  2842. -                case EVENT_INTRO_H2_1:
  2843. -                    DoScriptText(SAY_SYLVANAS_INTRO_1, me);
  2844. -                    events.ScheduleEvent(EVENT_INTRO_H2_2, 8000);
  2845. +                case 19:
  2846. +                    if(me->GetEntry() == NPC_JAINA_OUTRO)
  2847. +                        DoScriptText(SAY_JAINA_TRAP, me);
  2848. +                    if(me->GetEntry() == NPC_SYLVANA_OUTRO)
  2849. +                        DoScriptText(SAY_SYLVANA_TRAP, me);
  2850.                      break;
  2851. -                case EVENT_INTRO_H2_2:
  2852. -                    DoScriptText(SAY_SYLVANAS_INTRO_2, me);
  2853. -                    events.ScheduleEvent(EVENT_INTRO_H2_3, 6000);
  2854. +                case 20:
  2855. +                    if (Creature* pWallTarget = m_pInstance->instance->GetCreature(m_uipWallTargetGUID))
  2856. +                    {
  2857. +                        if(pWallTarget->isAlive())
  2858. +                        {
  2859. +                            pWallTarget->DespawnOrUnsummon();
  2860. +                            m_uipWallTargetGUID = 0;
  2861. +                        }
  2862. +                    }
  2863. +                    SetEscortPaused(true);
  2864. +                    if(me->GetEntry() == NPC_JAINA_OUTRO)
  2865. +                        me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2HL);
  2866. +                    if(me->GetEntry() == NPC_SYLVANA_OUTRO)
  2867. +                        me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY1H);
  2868.                      break;
  2869. -                case EVENT_INTRO_H2_3:
  2870. -                    DoScriptText(SAY_SYLVANAS_INTRO_3, me);
  2871. -                    // TODO: she's doing some kind of spell casting emote
  2872. -                    events.ScheduleEvent(EVENT_INTRO_H2_4, 6000);
  2873. +            }
  2874. +        }
  2875. +
  2876. +        void MoveInLineOfSight(Unit* who)
  2877. +        {
  2878. +            if(!who || !m_pInstance)
  2879. +                return;
  2880. +
  2881. +            if(who->GetTypeId() != TYPEID_PLAYER)
  2882. +                return;
  2883. +
  2884. +            Player* pPlayer = (Player *)who;
  2885. +
  2886. +            if(pPlayer->GetTeam() == ALLIANCE && me->GetEntry() == NPC_SYLVANA_OUTRO)
  2887. +                return;
  2888. +
  2889. +            if(pPlayer->GetTeam() == HORDE && me->GetEntry() == NPC_JAINA_OUTRO)
  2890. +                return;
  2891. +
  2892. +            if(me->IsWithinDistInMap(who, 50.0f)
  2893. +                && m_pInstance->GetData(TYPE_FROST_GENERAL) == DONE
  2894. +                && m_pInstance->GetData(TYPE_PHASE) == 3)
  2895. +            {
  2896. +                pPlayer = (Player *)who;
  2897. +                Event = true;
  2898. +                me->setFaction(FACTION);
  2899. +                m_pInstance->SetData(TYPE_PHASE, 4);
  2900. +            }
  2901. +        }
  2902. +
  2903. +        void DamageTaken(Unit* pDoneBy, uint32 &uiDamage)
  2904. +        {
  2905. +            if(!m_pInstance)
  2906. +                return;
  2907. +
  2908. +            if(m_pInstance->GetData(TYPE_LICH_KING) != IN_PROGRESS)
  2909. +            {
  2910. +                uiDamage = 0;
  2911. +                return;
  2912. +            }
  2913. +
  2914. +            if(m_pInstance->GetData(TYPE_LICH_KING) == IN_PROGRESS && WallCast == true)
  2915. +            {
  2916. +                HoldTimer = HoldTimer + 100;
  2917. +                return;
  2918. +            }
  2919. +        }
  2920. +
  2921. +        void JumpNextStep(uint32 Time)
  2922. +        {
  2923. +            StepTimer = Time;
  2924. +            Step++;
  2925. +        }
  2926. +
  2927. +        void Intro()
  2928. +        {
  2929. +            switch(Step)
  2930. +            {
  2931. +                case 0:
  2932. +                    me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING);
  2933. +                    m_uiLichKingGUID = m_pInstance->GetData64(BOSS_LICH_KING);
  2934. +                    pLichKing = m_pInstance->instance->GetCreature(m_uiLichKingGUID);
  2935. +                    JumpNextStep(100);
  2936.                      break;
  2937. -                case EVENT_INTRO_H2_4:
  2938. -                    // spawn UTHER during speach 2
  2939. -                    if (Creature* pUther = me->SummonCreature(NPC_UTHER, UtherSpawnPos, TEMPSUMMON_MANUAL_DESPAWN))
  2940. +                case 1:
  2941. +                    if(pLichKing)
  2942.                      {
  2943. -                        pUther->GetMotionMaster()->MoveIdle();
  2944. -                        pUther->SetReactState(REACT_PASSIVE); // be sure he will not aggro arthas
  2945. -                        uiUther = pUther->GetGUID();
  2946. +                        pLichKing->SetPhaseMask(65535, true);
  2947. +                        if(me->GetEntry() == NPC_JAINA_OUTRO)
  2948. +                            DoScriptText(SAY_LICH_KING_AGGRO_A, pLichKing);
  2949. +                        if(me->GetEntry() == NPC_SYLVANA_OUTRO)
  2950. +                            DoScriptText(SAY_LICH_KING_AGGRO_H, pLichKing);
  2951. +                        pLichKing->AI()->AttackStart(me);
  2952. +                        me->AI()->AttackStart(pLichKing);
  2953.                      }
  2954. -                    events.ScheduleEvent(EVENT_INTRO_H2_5, 2000);
  2955. -                    break;
  2956. -                case EVENT_INTRO_H2_5:
  2957. -                    if (Creature* pUther = me->GetCreature(*me, uiUther))
  2958. -                        DoScriptText(SAY_UTHER_INTRO_H2_1, pUther);
  2959. -                    events.ScheduleEvent(EVENT_INTRO_H2_6, 11000);
  2960. -                    break;
  2961. -                case EVENT_INTRO_H2_6:
  2962. -                    DoScriptText(SAY_SYLVANAS_INTRO_4, me);
  2963. -                    events.ScheduleEvent(EVENT_INTRO_H2_7, 3000);
  2964. -                    break;
  2965. -                case EVENT_INTRO_H2_7:
  2966. -                    if (Creature* pUther = me->GetCreature(*me, uiUther))
  2967. -                        DoScriptText(SAY_UTHER_INTRO_H2_2, pUther);
  2968. -                    events.ScheduleEvent(EVENT_INTRO_H2_8, 6000);
  2969. -                    break;
  2970. -                case EVENT_INTRO_H2_8:
  2971. -                    DoScriptText(SAY_SYLVANAS_INTRO_5, me);
  2972. -                    events.ScheduleEvent(EVENT_INTRO_H2_9, 5000);
  2973. -                    break;
  2974. -                case EVENT_INTRO_H2_9:
  2975. -                    if (Creature* pUther = me->GetCreature(*me, uiUther))
  2976. -                        DoScriptText(SAY_UTHER_INTRO_H2_3, pUther);
  2977. -                    events.ScheduleEvent(EVENT_INTRO_H2_10, 19000);
  2978. -                    break;
  2979. -                case EVENT_INTRO_H2_10:
  2980. -                    DoScriptText(SAY_SYLVANAS_INTRO_6, me);
  2981. -                    events.ScheduleEvent(EVENT_INTRO_H2_11, 1500);
  2982. -                    break;
  2983. -                case EVENT_INTRO_H2_11:
  2984. -                    if (Creature* pUther = me->GetCreature(*me, uiUther))
  2985. -                        DoScriptText(SAY_UTHER_INTRO_H2_4, pUther);
  2986. -                    events.ScheduleEvent(EVENT_INTRO_H2_12, 19500);
  2987. -                    break;
  2988. -                case EVENT_INTRO_H2_12:
  2989. -                    DoScriptText(SAY_SYLVANAS_INTRO_7, me);
  2990. -                    events.ScheduleEvent(EVENT_INTRO_H2_13, 2000);
  2991. -                    break;
  2992. -                case EVENT_INTRO_H2_13:
  2993. -                    if (Creature* pUther = me->GetCreature(*me, uiUther))
  2994. +                    JumpNextStep(3000);
  2995. +                    break;
  2996. +                case 2:
  2997. +                    if(me->GetEntry() == NPC_SYLVANA_OUTRO)
  2998.                      {
  2999. -                        pUther->HandleEmoteCommand(EMOTE_ONESHOT_NO);
  3000. -                        DoScriptText(SAY_UTHER_INTRO_H2_5, pUther);
  3001. +                        Fight = false;
  3002. +                        if(pLichKing)
  3003. +                            me->GetMotionMaster()->MovePoint(0, (me->GetPositionX()-5)+rand()%10, (me->GetPositionY()-5)+rand()%10, me->GetPositionZ());
  3004. +                        JumpNextStep(3000);
  3005.                      }
  3006. -                    events.ScheduleEvent(EVENT_INTRO_H2_14, 12000);
  3007. +                    else
  3008. +                        JumpNextStep(100);
  3009.                      break;
  3010. -                case EVENT_INTRO_H2_14:
  3011. -                    if (Creature* pUther = me->GetCreature(*me, uiUther))
  3012. -                        DoScriptText(SAY_UTHER_INTRO_H2_6, pUther);
  3013. -                    events.ScheduleEvent(EVENT_INTRO_H2_15, 8000);
  3014. +                case 3:
  3015. +                    if(me->GetEntry() == NPC_SYLVANA_OUTRO)
  3016. +                        Fight = true;
  3017. +                    JumpNextStep(100);
  3018.                      break;
  3019. -                case EVENT_INTRO_H2_15:
  3020. -                    DoScriptText(SAY_SYLVANAS_INTRO_8, me);
  3021. -                    events.ScheduleEvent(EVENT_INTRO_LK_1, 2000);
  3022. +                case 4:
  3023. +                    if(me->GetEntry() == NPC_SYLVANA_OUTRO)
  3024. +                    {
  3025. +                        if(pLichKing)
  3026. +                            me->CastSpell(pLichKing, SPELL_SYLVANA_STEP, false);
  3027. +                        JumpNextStep(3000);
  3028. +                    }
  3029. +                    else
  3030. +                        JumpNextStep(100);
  3031.                      break;
  3032. -
  3033. -            // Remaining Intro Events common for both faction
  3034. -                case EVENT_INTRO_LK_1:
  3035. -                    // Spawn LK in front of door, and make him move to the sword.
  3036. -                    if (Creature* pLichKing = me->SummonCreature(NPC_LICH_KING_EVENT, LichKingSpawnPos, TEMPSUMMON_MANUAL_DESPAWN))
  3037. +                case 5:
  3038. +                    if(me->GetEntry() == NPC_SYLVANA_OUTRO)
  3039.                      {
  3040. -                        pLichKing->GetMotionMaster()->MovePoint(0, LichKingMoveThronePos);
  3041. -                        pLichKing->SetReactState(REACT_PASSIVE);
  3042. -                        uiLichKing = pLichKing->GetGUID();
  3043. +                        Fight = false;
  3044. +                        if(pLichKing)
  3045. +                            me->GetMotionMaster()->MovePoint(0, (me->GetPositionX()-5)+rand()%10, (me->GetPositionY()-5)+rand()%10, me->GetPositionZ());
  3046. +                        JumpNextStep(3000);
  3047.                      }
  3048. +                    else
  3049. +                        JumpNextStep(12000);
  3050. +                    break;
  3051. +                case 6:
  3052. +                    Fight = true;
  3053. +
  3054. +                    if(pLichKing)
  3055. +                   {
  3056. +                        me->CastSpell(pLichKing, me->GetEntry() == NPC_JAINA_OUTRO ? SPELL_ICE_PRISON_VISUAL : SPELL_DARK_ARROW,true);
  3057. +                       pLichKing->AttackStop();
  3058. +                   }
  3059. +                    JumpNextStep(2500);
  3060. +                    break;
  3061. +                case 7:
  3062. +                    if(pLichKing && !pLichKing->HasAura(SPELL_ICE_PRISON))
  3063. +                        pLichKing->CastSpell(pLichKing,me->GetEntry() == NPC_JAINA_OUTRO ? SPELL_ICE_PRISON : SPELL_DARK_ARROW,true);
  3064. +
  3065. +                    me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_STAND);
  3066. +                    me->AttackStop();
  3067.  
  3068. -                    if (Creature* pUther = me->GetCreature(*me, uiUther))
  3069. +                    if(me->GetEntry() == NPC_JAINA_OUTRO)
  3070.                      {
  3071. -                        if (instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE)
  3072. -                            DoScriptText(SAY_UTHER_INTRO_A2_9, pUther);
  3073. -                        else
  3074. -                            DoScriptText(SAY_UTHER_INTRO_H2_7, pUther);
  3075. +                        me->RemoveAurasDueToSpell(SPELL_ICE_BARRIER);
  3076. +                        DoScriptText(SAY_JAINA_AGGRO, me);
  3077.                      }
  3078.  
  3079. -                    events.ScheduleEvent(EVENT_INTRO_LK_2, 11000);
  3080. +                    if(me->GetEntry() == NPC_SYLVANA_OUTRO)
  3081. +                        DoScriptText(SAY_SYLVANA_AGGRO, me);
  3082. +
  3083. +                    JumpNextStep(3000);
  3084. +                    break;
  3085. +                case 8:
  3086. +                    me->GetMotionMaster()->MovePoint(0, 5577.187f, 2236.003f, 733.012f);
  3087. +                    if(pLichKing)
  3088. +                        me->SetUInt64Value(UNIT_FIELD_TARGET, pLichKing->GetGUID());
  3089. +                    JumpNextStep(10000);
  3090.                      break;
  3091. +                case 9:
  3092. +                    me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
  3093. +                    Count = 1;
  3094. +                    JumpNextStep(100);
  3095. +                    break;
  3096. +            }
  3097. +        }
  3098.  
  3099. -                case EVENT_INTRO_LK_2:
  3100. -                     if (Creature* pLichKing = me->GetCreature(*me, uiLichKing))
  3101. -                         DoScriptText(SAY_LK_INTRO_1, pLichKing);
  3102. -                     events.ScheduleEvent(EVENT_INTRO_LK_3, 2000);
  3103. -                     break;
  3104. +        void Outro()
  3105. +        {
  3106. +            switch(Step)
  3107. +            {
  3108. +                case 10:
  3109. +                    me->CastSpell(me, SPELL_SHIELD_DISRUPTION,false);
  3110. +                    me->RemoveAurasDueToSpell(SPELL_SILENCE);
  3111. +                    JumpNextStep(6000);
  3112. +                    break;
  3113. +                case 11:
  3114. +                    if(GameObject* pCave = m_pInstance->instance->GetGameObject(m_pInstance->GetData64(GO_CAVE)))
  3115. +                        pCave->SetGoState(GO_STATE_READY);
  3116. +                    me->CastSpell(me, SPELL_SHIELD_DISRUPTION,false);
  3117. +                    me->GetMotionMaster()->MovePoint(0, 5258.911328f,1652.112f,784.295166f);
  3118. +                    JumpNextStep(10000);
  3119. +                    break;
  3120. +                case 12:
  3121. +                    m_pInstance->SetData(TYPE_LICH_KING, DONE);
  3122. +                    JumpNextStep(10000);
  3123. +                    break;
  3124. +                case 13:
  3125. +                    JumpNextStep(20000);
  3126. +                    break;
  3127. +                case 14:
  3128. +                    me->GetMotionMaster()->MovePoint(0, 5240.66f, 1646.93f, 784.302f);
  3129. +                    JumpNextStep(5000);
  3130. +                    break;
  3131. +                case 15:
  3132. +                    me->SetOrientation(0.68f);
  3133. +                    me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER);
  3134. +                    me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
  3135. +                    QuestCompleate();
  3136. +                    JumpNextStep(5000);
  3137. +                    break;
  3138. +            }
  3139. +        }
  3140.  
  3141. -                case EVENT_INTRO_LK_3:
  3142. -                     // The Lich King banishes Uther to the abyss.
  3143. -                     if (Creature* pUther = me->GetCreature(*me, uiUther))
  3144. -                     {
  3145. -                         pUther->DisappearAndDie();
  3146. -                         uiUther = 0;
  3147. -                     }
  3148. +        void QuestCompleate()
  3149. +        {
  3150. +            if(m_pInstance)
  3151. +            {
  3152. +                Map::PlayerList const &PlayerList = m_pInstance->instance->GetPlayers();
  3153. +                for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
  3154. +                {
  3155. +                    i->getSource()->KilledMonsterCredit(36955, 0);
  3156. +                    i->getSource()->KilledMonsterCredit(37554, 0);
  3157. +                }
  3158. +            }
  3159. +        }
  3160.  
  3161. -                     // He steps forward and removes the runeblade from the heap of skulls.
  3162. +        void UpdateEscortAI(const uint32 diff)
  3163. +        {
  3164. +            if(!m_pInstance || !Event)
  3165. +                return;
  3166.  
  3167. -                     events.ScheduleEvent(EVENT_INTRO_LK_4, 4000);
  3168. -                     break;
  3169. +            DoMeleeAttackIfReady();
  3170.  
  3171. -                case EVENT_INTRO_LK_4:
  3172. -                      if (Creature* pLichKing = me->GetCreature(*me, uiLichKing))
  3173. -                          DoScriptText(SAY_LK_INTRO_2, pLichKing);
  3174. -                    events.ScheduleEvent(EVENT_INTRO_LK_5, 10000);
  3175. -                    break;
  3176. +            if(m_pInstance->GetData(TYPE_PHASE) == 4)
  3177. +            {
  3178. +                if(StepTimer < diff)
  3179. +                    Intro();
  3180. +                else
  3181. +                    StepTimer -= diff;
  3182. +            }
  3183.  
  3184. -                case EVENT_INTRO_LK_5:
  3185. -                    // summon Falric and Marwyn. then go back to the door
  3186. -                    if (Creature* pFalric = me->GetCreature(*me, instance->GetData64(DATA_FALRIC)))
  3187. -                        pFalric->SetVisible(true);
  3188. -                    if (Creature* pMarwyn = me->GetCreature(*me, instance->GetData64(DATA_MARWYN)))
  3189. -                        pMarwyn->SetVisible(true);
  3190. +            if(m_pInstance->GetData(TYPE_LICH_KING) == SPECIAL
  3191. +                && m_pInstance->GetData(TYPE_PHASE) != 6)       //End Cinematic
  3192. +            {
  3193. +                m_pInstance->SetData(TYPE_PHASE, 6);
  3194. +                Step = 10;
  3195. +            }
  3196.  
  3197. -                    if (Creature* pLichKing = me->GetCreature(*me, uiLichKing))
  3198. -                    {
  3199. -                        pLichKing->GetMotionMaster()->MovePoint(0, LichKingSpawnPos);
  3200. -                        DoScriptText(SAY_LK_INTRO_3, pLichKing);
  3201. -                    }
  3202. +            if (m_pInstance->GetData(TYPE_PHASE) == 6)
  3203. +            {
  3204. +                if(StepTimer < diff)
  3205. +                    Outro();
  3206. +                else
  3207. +                    StepTimer -= diff;
  3208. +                return;
  3209. +            }
  3210.  
  3211. -                    events.ScheduleEvent(EVENT_INTRO_LK_6, 8000);
  3212. -                    break;
  3213. +            if(WallCast == true && CastTimer < diff)
  3214. +            {
  3215. +                if(me->GetEntry() == NPC_SYLVANA_OUTRO)
  3216. +                {
  3217. +                   if (Creature* pWallTarget = m_pInstance->instance->GetCreature(m_uipWallTargetGUID))
  3218. +                        me->CastSpell(pWallTarget, SPELL_DESTROY_ICE_WALL_03, false);
  3219. +                    CastTimer = 1000;
  3220. +                }
  3221. +            }
  3222. +            else
  3223. +                CastTimer -= diff;
  3224.  
  3225. -                case EVENT_INTRO_LK_6:
  3226. -                    if (Creature* pFalric = me->GetCreature(*me, instance->GetData64(DATA_FALRIC)))
  3227. -                        DoScriptText(SAY_FALRIC_INTRO_1, pFalric);
  3228. +            if (WallCast == true && HoldTimer < 10000 && ( m_pInstance->GetData(DATA_SUMMONS) == 0 || !me->isInCombat()))
  3229. +            {
  3230. +                WallCast = false;
  3231. +                me->InterruptNonMeleeSpells(false);
  3232. +                SetEscortPaused(false);
  3233. +                if(GameObject* pGate = m_pInstance->instance->GetGameObject(m_uiIceWallGUID))
  3234. +                    pGate->SetGoState(GO_STATE_ACTIVE);
  3235. +                ++Count;
  3236. +                switch(Count)
  3237. +                {
  3238. +                    case 2:
  3239. +                        if(GameObject* pGate = m_pInstance->instance->GetGameObject(m_pInstance->GetData64(GO_ICE_WALL_2)))
  3240. +                        {
  3241. +                            pGate->SetGoState(GO_STATE_READY);
  3242. +                            if(pLichKing && pLichKing->isAlive())
  3243. +                                DoScriptText(SAY_LICH_KING_WALL_02, pLichKing);
  3244. +                            m_uiIceWallGUID = pGate->GetGUID();
  3245. +                        }
  3246. +                        break;
  3247. +                    case 3:
  3248. +                        if(GameObject* pGate = m_pInstance->instance->GetGameObject(m_pInstance->GetData64(GO_ICE_WALL_3)))
  3249. +                        {
  3250. +                            pGate->SetGoState(GO_STATE_READY);
  3251. +                            if(pLichKing && pLichKing->isAlive())
  3252. +                                DoScriptText(SAY_LICH_KING_WALL_03, pLichKing);
  3253. +                            m_uiIceWallGUID = pGate->GetGUID();
  3254. +                        }
  3255. +                        break;
  3256. +                    case 4:
  3257. +                        if(GameObject* pGate = m_pInstance->instance->GetGameObject(m_pInstance->GetData64(GO_ICE_WALL_4)))
  3258. +                        {
  3259. +                            pGate->SetGoState(GO_STATE_READY);
  3260. +                            if(pLichKing && pLichKing->isAlive())
  3261. +                                DoScriptText(SAY_LICH_KING_WALL_04, pLichKing);
  3262. +                            m_uiIceWallGUID = pGate->GetGUID();
  3263. +                        }
  3264. +                        break;
  3265. +                    case 5:
  3266. +                        if(pLichKing && pLichKing->isAlive())
  3267. +                        {
  3268. +                            pLichKing->RemoveAurasDueToSpell(SPELL_WINTER);
  3269. +                            pLichKing->SetSpeed(MOVE_WALK, 2.5f, true);
  3270. +                            Step = 0;
  3271. +                        }
  3272. +                        break;
  3273. +                }
  3274. +            }
  3275. +            else
  3276. +            {
  3277. +                HoldTimer -= diff;
  3278. +                if (HoldTimer <= 0)
  3279. +                    HoldTimer = 0;
  3280. +            }
  3281.  
  3282. -                    events.ScheduleEvent(EVENT_INTRO_LK_7, 2000);
  3283. -                    break;
  3284. +            return;
  3285. +        }
  3286. +    };
  3287.  
  3288. -                case EVENT_INTRO_LK_7:
  3289. -                    if (Creature* pMarwyn = me->GetCreature(*me, instance->GetData64(DATA_MARWYN)))
  3290. -                        DoScriptText(SAY_MARWYN_INTRO_1, pMarwyn);
  3291. +    CreatureAI* GetAI(Creature* pCreature) const
  3292. +    {
  3293. +        return new npc_jaina_and_sylvana_HRextroAI(pCreature);
  3294. +    }
  3295. +};
  3296.  
  3297. -                    events.ScheduleEvent(EVENT_INTRO_LK_8, 2000);
  3298. -                    break;
  3299. +class npc_lich_king_hr : public CreatureScript
  3300. +{
  3301. +public:
  3302. +    npc_lich_king_hr() : CreatureScript("npc_lich_king_hr") { }
  3303.  
  3304. -                case EVENT_INTRO_LK_8:
  3305. -                    if (Creature* pFalric = me->GetCreature(*me, instance->GetData64(DATA_FALRIC)))
  3306. -                        DoScriptText(SAY_FALRIC_INTRO_2, pFalric);
  3307. +    struct npc_lich_king_hrAI : public ScriptedAI
  3308. +    {
  3309. +        npc_lich_king_hrAI(Creature *pCreature) : ScriptedAI(pCreature)
  3310. +        {
  3311. +            Reset();
  3312. +        }
  3313.  
  3314. -                    events.ScheduleEvent(EVENT_INTRO_LK_9, 5000);
  3315. -                    break;
  3316. +        void Reset()
  3317. +        {
  3318. +        }
  3319.  
  3320. -                case EVENT_INTRO_LK_9:
  3321. -                    if (instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE)
  3322. -                        DoScriptText(SAY_JAINA_INTRO_END, me);
  3323. -                    else
  3324. -                        DoScriptText(SAY_SYLVANAS_INTRO_END, me);
  3325. +        void JustDied(Unit* pKiller)
  3326. +        {
  3327. +        }
  3328.  
  3329. -                    me->GetMotionMaster()->MovePoint(0, LichKingSpawnPos);
  3330. -                    // TODO: Loralen/Koreln shall run also
  3331. -                    events.ScheduleEvent(EVENT_INTRO_END, 10000);
  3332. -                    break;
  3333. +        void AttackStart(Unit* who)
  3334. +        {
  3335. +            return;
  3336. +        }
  3337.  
  3338. -                case EVENT_INTRO_END:
  3339. -                    if (instance)
  3340. -                        instance->SetData(DATA_WAVE_COUNT, SPECIAL);   // start first wave
  3341. +        void UpdateAI(const uint32 diff)
  3342. +        {
  3343. +        }
  3344. +    };
  3345.  
  3346. -                    // Loralen or Koreln disappearAndDie()
  3347. -                    me->DisappearAndDie();
  3348. -                    break;
  3349. +    CreatureAI* GetAI(Creature* pCreature) const
  3350. +    {
  3351. +        return new npc_lich_king_hrAI(pCreature);
  3352. +    }
  3353. +};
  3354.  
  3355. -                case EVENT_SKIP_INTRO:
  3356. -                    // TODO: implement
  3357. +enum GENERAL_EVENT
  3358. +{
  3359. +    SAY_AGGRO                    = -1594519,
  3360. +    SAY_DEATH                    = -1594520,
  3361.  
  3362. -                    if (Creature* pFalric = me->GetCreature(*me, instance->GetData64(DATA_FALRIC)))
  3363. -                        pFalric->SetVisible(true);
  3364. -                    if (Creature* pMarwyn = me->GetCreature(*me, instance->GetData64(DATA_MARWYN)))
  3365. -                        pMarwyn->SetVisible(true);
  3366. +    SPELL_SHIELD_THROWN          = 69222,
  3367. +    SPELL_SPIKE                  = 59446   // this is not right spell!
  3368. +};
  3369.  
  3370. -                    me->GetMotionMaster()->MovePoint(0, LichKingSpawnPos);
  3371. -                    // TODO: Loralen/Koreln shall run also
  3372. +class npc_frostworn_general : public CreatureScript
  3373. +{
  3374. +public:
  3375. +    npc_frostworn_general() : CreatureScript("npc_frostworn_general") { }
  3376.  
  3377. -                    events.ScheduleEvent(EVENT_INTRO_END, 15000);
  3378. -                    break;
  3379. +    struct npc_frostworn_generalAI : public ScriptedAI
  3380. +    {
  3381. +        npc_frostworn_generalAI(Creature *pCreature) : ScriptedAI(pCreature)
  3382. +        {
  3383. +            m_pInstance = (InstanceScript*)pCreature->GetInstanceScript();
  3384. +            Reset();
  3385. +        }
  3386. +
  3387. +        InstanceScript* m_pInstance;
  3388. +
  3389. +        uint32 m_uiShieldTimer;
  3390. +        uint32 m_uiSpikeTimer;
  3391. +
  3392. +        void Reset()
  3393. +        {
  3394. +            if (!m_pInstance)
  3395. +                return;
  3396. +            m_uiShieldTimer = 5000;
  3397. +            m_uiSpikeTimer = 14000;
  3398. +            m_pInstance->SetData(TYPE_FROST_GENERAL, NOT_STARTED);
  3399. +            me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
  3400. +        }
  3401. +
  3402. +        void JustDied(Unit* pKiller)
  3403. +        {
  3404. +            if (!m_pInstance)
  3405. +                return;
  3406. +            DoScriptText(SAY_DEATH, me);
  3407. +            m_pInstance->SetData(TYPE_FROST_GENERAL, DONE);
  3408. +            
  3409. +            me->SummonCreature(BOSS_LICH_KING, 5564.25f, 2274.69f, 733.01f, 3.93f, TEMPSUMMON_DEAD_DESPAWN);
  3410. +            
  3411. +            if(m_pInstance->GetData(DATA_TEAM_IN_INSTANCE)==ALLIANCE)
  3412. +                me->SummonCreature(NPC_JAINA_OUTRO, 5556.27f, 2266.28f, 733.01f, 0.8f, TEMPSUMMON_DEAD_DESPAWN);
  3413. +            else
  3414. +                me->SummonCreature(NPC_SYLVANA_OUTRO, 5556.27f, 2266.28f, 733.01f, 0.8f, TEMPSUMMON_DEAD_DESPAWN);
  3415. +        }
  3416. +
  3417. +        void MoveInLineOfSight(Unit* pWho)
  3418. +        {
  3419. +            if (!m_pInstance)
  3420. +                return;
  3421. +
  3422. +            if (me->getVictim())
  3423. +                return;
  3424. +
  3425. +            if (pWho->GetTypeId() != TYPEID_PLAYER
  3426. +                || m_pInstance->GetData(TYPE_MARWYN) != DONE
  3427. +                || !me->IsWithinDistInMap(pWho, 20.0f)
  3428. +                ) return;
  3429. +
  3430. +            if (Player* pPlayer = (Player*)pWho)
  3431. +                if (pPlayer->isGameMaster())
  3432. +                    return;
  3433. +
  3434. +            me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
  3435. +
  3436. +            AttackStart(pWho);
  3437. +        }
  3438. +
  3439. +        void EnterCombat(Unit* victim)
  3440. +        {
  3441. +            if (!m_pInstance)
  3442. +                return;
  3443. +            DoScriptText(SAY_AGGRO, me);
  3444. +            m_pInstance->SetData(TYPE_FROST_GENERAL, IN_PROGRESS);
  3445. +        }
  3446. +
  3447. +        void UpdateAI(const uint32 uiDiff)
  3448. +        {
  3449. +            if(!UpdateVictim())
  3450. +                return;
  3451. +
  3452. +            if(m_uiShieldTimer < uiDiff)
  3453. +            {
  3454. +                if(Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0))
  3455. +                   DoCast(pTarget,SPELL_SHIELD_THROWN);
  3456. +                m_uiShieldTimer = urand(8000, 12000);
  3457.              }
  3458. +            else
  3459. +                m_uiShieldTimer -= uiDiff;
  3460. +
  3461. +            if (m_uiSpikeTimer < uiDiff)
  3462. +            {
  3463. +                if(Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0))
  3464. +                    DoCast(pTarget, SPELL_SPIKE);
  3465. +                m_uiSpikeTimer = urand(15000, 20000);
  3466. +            }
  3467. +            else
  3468. +                m_uiSpikeTimer -= uiDiff;
  3469. +
  3470. +            DoMeleeAttackIfReady();
  3471.          }
  3472.      };
  3473. -
  3474. +    CreatureAI* GetAI(Creature* pCreature) const
  3475. +    {
  3476. +        return new npc_frostworn_generalAI(pCreature);
  3477. +    }
  3478.  };
  3479.  
  3480.  enum TrashSpells
  3481. @@ -628,14 +1474,14 @@ class npc_ghostly_priest : public CreatureScript
  3482.  public:
  3483.      npc_ghostly_priest() : CreatureScript("npc_ghostly_priest") { }
  3484.  
  3485. -    CreatureAI* GetAI(Creature* creature) const
  3486. +    CreatureAI* GetAI(Creature* pCreature) const
  3487.      {
  3488. -        return new npc_ghostly_priestAI(creature);
  3489. +        return new npc_ghostly_priestAI(pCreature);
  3490.      }
  3491.  
  3492.      struct npc_ghostly_priestAI: public ScriptedAI
  3493.      {
  3494. -        npc_ghostly_priestAI(Creature* creature) : ScriptedAI(creature)
  3495. +        npc_ghostly_priestAI(Creature *c) : ScriptedAI(c)
  3496.          {
  3497.          }
  3498.  
  3499. @@ -666,28 +1512,28 @@ public:
  3500.  
  3501.              while (uint32 eventId = events.ExecuteEvent())
  3502.              {
  3503. -                switch (eventId)
  3504. +                switch(eventId)
  3505.                  {
  3506.                      case EVENT_SHADOW_WORD_PAIN:
  3507. -                        if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM))
  3508. -                            DoCast(target, SPELL_SHADOW_WORD_PAIN);
  3509. +                        if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM))
  3510. +                            DoCast(pTarget, SPELL_SHADOW_WORD_PAIN);
  3511.                          events.ScheduleEvent(EVENT_SHADOW_WORD_PAIN, 8000);
  3512.                          return;
  3513.                      case EVENT_CIRCLE_OF_DESTRUCTION:
  3514. -                        if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM))
  3515. -                            DoCast(target, SPELL_CIRCLE_OF_DESTRUCTION);
  3516. +                        if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM))
  3517. +                            DoCast(pTarget, SPELL_CIRCLE_OF_DESTRUCTION);
  3518.                          events.ScheduleEvent(EVENT_CIRCLE_OF_DESTRUCTION, 12000);
  3519.                          return;
  3520.                      case EVENT_COWER_IN_FEAR:
  3521. -                        if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM))
  3522. -                            DoCast(target, SPELL_COWER_IN_FEAR);
  3523. +                        if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM))
  3524. +                            DoCast(pTarget, SPELL_COWER_IN_FEAR);
  3525.                          events.ScheduleEvent(EVENT_COWER_IN_FEAR, 10000);
  3526.                          return;
  3527.                      case EVENT_DARK_MENDING:
  3528.                          // find an ally with missing HP
  3529. -                        if (Unit* target = DoSelectLowestHpFriendly(40, DUNGEON_MODE(30000, 50000)))
  3530. +                        if (Unit *pTarget = DoSelectLowestHpFriendly(40, DUNGEON_MODE(30000, 50000)))
  3531.                          {
  3532. -                            DoCast(target, SPELL_DARK_MENDING);
  3533. +                            DoCast(pTarget, SPELL_DARK_MENDING);
  3534.                              events.ScheduleEvent(EVENT_DARK_MENDING, 20000);
  3535.                          }
  3536.                          else
  3537. @@ -710,14 +1556,14 @@ class npc_phantom_mage : public CreatureScript
  3538.  public:
  3539.      npc_phantom_mage() : CreatureScript("npc_phantom_mage") { }
  3540.  
  3541. -    CreatureAI* GetAI(Creature* creature) const
  3542. +    CreatureAI* GetAI(Creature* pCreature) const
  3543.      {
  3544. -        return new npc_phantom_mageAI(creature);
  3545. +        return new npc_phantom_mageAI(pCreature);
  3546.      }
  3547.  
  3548.      struct npc_phantom_mageAI: public ScriptedAI
  3549.      {
  3550. -        npc_phantom_mageAI(Creature* creature) : ScriptedAI(creature)
  3551. +        npc_phantom_mageAI(Creature *c) : ScriptedAI(c)
  3552.          {
  3553.          }
  3554.  
  3555. @@ -749,11 +1595,11 @@ public:
  3556.  
  3557.              while (uint32 eventId = events.ExecuteEvent())
  3558.              {
  3559. -                switch (eventId)
  3560. +                switch(eventId)
  3561.                  {
  3562.                      case EVENT_FIREBALL:
  3563. -                        if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM))
  3564. -                            DoCast(target, SPELL_FIREBALL);
  3565. +                        if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM))
  3566. +                            DoCast(pTarget, SPELL_FIREBALL);
  3567.                          events.ScheduleEvent(EVENT_FIREBALL, 15000);
  3568.                          return;
  3569.                      case EVENT_FLAMESTRIKE:
  3570. @@ -761,13 +1607,13 @@ public:
  3571.                          events.ScheduleEvent(EVENT_FLAMESTRIKE, 15000);
  3572.                          return;
  3573.                      case EVENT_FROSTBOLT:
  3574. -                        if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM))
  3575. -                            DoCast(target, SPELL_FROSTBOLT);
  3576. +                        if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM))
  3577. +                            DoCast(pTarget, SPELL_FROSTBOLT);
  3578.                          events.ScheduleEvent(EVENT_FROSTBOLT, 15000);
  3579.                          return;
  3580.                      case EVENT_CHAINS_OF_ICE:
  3581. -                        if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM))
  3582. -                            DoCast(target, SPELL_CHAINS_OF_ICE);
  3583. +                        if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM))
  3584. +                            DoCast(pTarget, SPELL_CHAINS_OF_ICE);
  3585.                          events.ScheduleEvent(EVENT_CHAINS_OF_ICE, 15000);
  3586.                          return;
  3587.                      case EVENT_HALLUCINATION:
  3588. @@ -787,9 +1633,9 @@ class npc_phantom_hallucination : public CreatureScript
  3589.  public:
  3590.      npc_phantom_hallucination() : CreatureScript("npc_phantom_hallucination") { }
  3591.  
  3592. -    CreatureAI* GetAI(Creature* creature) const
  3593. +    CreatureAI* GetAI(Creature* pCreature) const
  3594.      {
  3595. -        return new npc_phantom_hallucinationAI(creature);
  3596. +        return new npc_phantom_hallucinationAI(pCreature);
  3597.      }
  3598.  
  3599.      struct npc_phantom_hallucinationAI : public npc_phantom_mage::npc_phantom_mageAI
  3600. @@ -811,14 +1657,14 @@ class npc_shadowy_mercenary : public CreatureScript
  3601.  public:
  3602.      npc_shadowy_mercenary() : CreatureScript("npc_shadowy_mercenary") { }
  3603.  
  3604. -    CreatureAI* GetAI(Creature* creature) const
  3605. +    CreatureAI* GetAI(Creature* pCreature) const
  3606.      {
  3607. -        return new npc_shadowy_mercenaryAI(creature);
  3608. +        return new npc_shadowy_mercenaryAI(pCreature);
  3609.      }
  3610.  
  3611.      struct npc_shadowy_mercenaryAI: public ScriptedAI
  3612.      {
  3613. -        npc_shadowy_mercenaryAI(Creature* creature) : ScriptedAI(creature)
  3614. +        npc_shadowy_mercenaryAI(Creature *c) : ScriptedAI(c)
  3615.          {
  3616.          }
  3617.  
  3618. @@ -849,7 +1695,7 @@ public:
  3619.  
  3620.              while (uint32 eventId = events.ExecuteEvent())
  3621.              {
  3622. -                switch (eventId)
  3623. +                switch(eventId)
  3624.                  {
  3625.                      case EVENT_SHADOW_STEP:
  3626.                          DoCast(SPELL_SHADOW_STEP);
  3627. @@ -860,8 +1706,8 @@ public:
  3628.                          events.ScheduleEvent(EVENT_DEADLY_POISON, 10000);
  3629.                          return;
  3630.                      case EVENT_ENVENOMED_DAGGER_THROW:
  3631. -                        if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM))
  3632. -                            DoCast(target, SPELL_ENVENOMED_DAGGER_THROW);
  3633. +                        if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM))
  3634. +                            DoCast(pTarget, SPELL_ENVENOMED_DAGGER_THROW);
  3635.                          events.ScheduleEvent(EVENT_ENVENOMED_DAGGER_THROW, 10000);
  3636.                          return;
  3637.                      case EVENT_KIDNEY_SHOT:
  3638. @@ -882,14 +1728,14 @@ class npc_spectral_footman : public CreatureScript
  3639.  public:
  3640.      npc_spectral_footman() : CreatureScript("npc_spectral_footman") { }
  3641.  
  3642. -    CreatureAI* GetAI(Creature* creature) const
  3643. +    CreatureAI* GetAI(Creature* pCreature) const
  3644.      {
  3645. -        return new npc_spectral_footmanAI(creature);
  3646. +        return new npc_spectral_footmanAI(pCreature);
  3647.      }
  3648.  
  3649.      struct npc_spectral_footmanAI: public ScriptedAI
  3650.      {
  3651. -        npc_spectral_footmanAI(Creature* creature) : ScriptedAI(creature)
  3652. +        npc_spectral_footmanAI(Creature *c) : ScriptedAI(c)
  3653.          {
  3654.          }
  3655.  
  3656. @@ -919,7 +1765,7 @@ public:
  3657.  
  3658.              while (uint32 eventId = events.ExecuteEvent())
  3659.              {
  3660. -                switch (eventId)
  3661. +                switch(eventId)
  3662.                  {
  3663.                      case EVENT_SPECTRAL_STRIKE:
  3664.                          DoCast(me->getVictim(), SPELL_SPECTRAL_STRIKE);
  3665. @@ -947,14 +1793,14 @@ class npc_tortured_rifleman : public CreatureScript
  3666.  public:
  3667.      npc_tortured_rifleman() : CreatureScript("npc_tortured_rifleman") { }
  3668.  
  3669. -    CreatureAI* GetAI(Creature* creature) const
  3670. +    CreatureAI* GetAI(Creature* pCreature) const
  3671.      {
  3672. -        return new npc_tortured_riflemanAI(creature);
  3673. +        return new npc_tortured_riflemanAI(pCreature);
  3674.      }
  3675.  
  3676.      struct npc_tortured_riflemanAI  : public ScriptedAI
  3677.      {
  3678. -        npc_tortured_riflemanAI(Creature* creature) : ScriptedAI(creature)
  3679. +        npc_tortured_riflemanAI(Creature *c) : ScriptedAI(c)
  3680.          {
  3681.          }
  3682.  
  3683. @@ -985,16 +1831,16 @@ public:
  3684.  
  3685.              while (uint32 eventId = events.ExecuteEvent())
  3686.              {
  3687. -                switch (eventId)
  3688. +                switch(eventId)
  3689.                  {
  3690.                      case EVENT_SHOOT:
  3691. -                        if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM))
  3692. -                            DoCast(target, SPELL_SHOOT);
  3693. +                        if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM))
  3694. +                            DoCast(pTarget, SPELL_SHOOT);
  3695.                          events.ScheduleEvent(EVENT_SHOOT, 2000);
  3696.                          return;
  3697.                      case EVENT_CURSED_ARROW:
  3698. -                        if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM))
  3699. -                            DoCast(target, SPELL_CURSED_ARROW);
  3700. +                        if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM))
  3701. +                            DoCast(pTarget, SPELL_CURSED_ARROW);
  3702.                          events.ScheduleEvent(EVENT_CURSED_ARROW, 10000);
  3703.                          return;
  3704.                      case EVENT_FROST_TRAP:
  3705. @@ -1002,8 +1848,8 @@ public:
  3706.                          events.ScheduleEvent(EVENT_FROST_TRAP, 30000);
  3707.                          return;
  3708.                      case EVENT_ICE_SHOT:
  3709. -                        if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM))
  3710. -                            DoCast(target, SPELL_ICE_SHOT);
  3711. +                        if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM))
  3712. +                            DoCast(pTarget, SPELL_ICE_SHOT);
  3713.                          events.ScheduleEvent(EVENT_ICE_SHOT, 15000);
  3714.                          return;
  3715.                  }
  3716. @@ -1017,8 +1863,10 @@ public:
  3717.  
  3718.  void AddSC_halls_of_reflection()
  3719.  {
  3720. -    new npc_jaina_or_sylvanas_hor(true, "npc_sylvanas_hor_part1");
  3721. -    new npc_jaina_or_sylvanas_hor(false, "npc_jaina_hor_part1");
  3722. +    new npc_jaina_and_sylvana_HRintro();
  3723. +    new npc_jaina_and_sylvana_HRextro();
  3724. +    new npc_lich_king_hr();
  3725. +    new npc_frostworn_general();
  3726.      new npc_ghostly_priest();
  3727.      new npc_phantom_mage();
  3728.      new npc_phantom_hallucination();
  3729. diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h
  3730. index 1557fd1..4bd27b6 100644
  3731. --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h
  3732. +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h
  3733. @@ -1,18 +1,20 @@
  3734.  /*
  3735. - * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
  3736. + * Copyright (C) 2008 - 2012 Trinity <http://www.trinitycore.org/>
  3737. + * Copyright (C) 2008 - 2012 Facecore <https://github.com/SignFinder/FaceCore/>
  3738.   *
  3739. - * This program is free software; you can redistribute it and/or modify it
  3740. - * under the terms of the GNU General Public License as published by the
  3741. - * Free Software Foundation; either version 2 of the License, or (at your
  3742. - * option) any later version.
  3743. + * This program is free software; you can redistribute it and/or modify
  3744. + * it under the terms of the GNU General Public License as published by
  3745. + * the Free Software Foundation; either version 2 of the License, or
  3746. + * (at your option) any later version.
  3747.   *
  3748. - * This program is distributed in the hope that it will be useful, but WITHOUT
  3749. - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  3750. - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  3751. - * more details.
  3752. + * This program is distributed in the hope that it will be useful,
  3753. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  3754. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  3755. + * GNU General Public License for more details.
  3756.   *
  3757. - * You should have received a copy of the GNU General Public License along
  3758. - * with this program. If not, see <http://www.gnu.org/licenses/>.
  3759. + * You should have received a copy of the GNU General Public License
  3760. + * along with this program; if not, write to the Free Software
  3761. + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  3762.   */
  3763.  
  3764.  #ifndef DEF_HALLS_OF_REFLECTION_H
  3765. @@ -20,138 +22,118 @@
  3766.  
  3767.  enum Data
  3768.  {
  3769. -    DATA_FALRIC_EVENT,
  3770. -    DATA_MARWYN_EVENT,
  3771. -    DATA_LICHKING_EVENT,
  3772. -    DATA_WAVE_COUNT,
  3773. -    DATA_TEAM_IN_INSTANCE,
  3774. +    TYPE_PHASE              = 0,
  3775. +    TYPE_EVENT              = 1,
  3776. +    TYPE_FALRIC             = 2,
  3777. +    TYPE_MARWYN             = 3,
  3778. +    TYPE_FROST_GENERAL      = 4,
  3779. +    TYPE_LICH_KING          = 5,
  3780. +    TYPE_ICE_WALL_01        = 6,
  3781. +    TYPE_ICE_WALL_02        = 7,
  3782. +    TYPE_ICE_WALL_03        = 8,
  3783. +    TYPE_ICE_WALL_04        = 9,
  3784. +    TYPE_HALLS              = 10,
  3785. +    MAX_ENCOUNTERS,
  3786. +
  3787. +    DATA_ESCAPE_LIDER       = 101,
  3788. +    DATA_LIDER              = 102,
  3789. +    DATA_SUMMONS            = 103,
  3790. +    DATA_TEAM_IN_INSTANCE   = 104,
  3791. +
  3792. +    /*UNITS*/
  3793. +    NPC_DARK_1                   = 38177, //Shadowy Mercenary
  3794. +    NPC_DARK_2                   = 38176, //Tortured Rifleman
  3795. +    NPC_DARK_3                   = 38173, //Spectral Footman
  3796. +    NPC_DARK_4                   = 38172, //Phantom Mage
  3797. +    NPC_DARK_5                   = 38567, //Phantom Hallucination
  3798. +    NPC_DARK_6                   = 38175, //Ghostly Priest
  3799. +    NPC_JAINA                    = 37221,
  3800. +    NPC_SYLVANA                  = 37223,
  3801. +    NPC_JAINA_OUTRO              = 36955,
  3802. +    NPC_SYLVANA_OUTRO            = 37554,
  3803. +    NPC_ALTAR_TARGET             = 37704,
  3804. +    NPC_UTHER                    = 37225,
  3805. +    NPC_LICH_KING                = 36954,
  3806. +    BOSS_LICH_KING               = 37226,
  3807. +    NPC_ICE_WALL                 = 37014,
  3808. +    NPC_FALRIC                   = 38112,
  3809. +    NPC_MARWYN                   = 38113,
  3810. +    NPC_GHOSTLY_ROGUE            = 38177,
  3811. +    NPC_GHOSTLY_PRIEST           = 38175,
  3812. +    NPC_GHOSTLY_MAGE             = 38172,
  3813. +    NPC_GHOSTLY_FOOTMAN          = 38173,
  3814. +    NPC_GHOSTLY_RIFLEMAN         = 38176,
  3815. +    NPC_GLUK                     = 38567,
  3816. +
  3817. +    NPC_RAGING_GNOUL             = 36940,
  3818. +    NPC_RISEN_WITCH_DOCTOR       = 36941,
  3819. +    NPC_ABON                     = 37069,
  3820. +
  3821. +    NPC_FROST_GENERAL            = 36723,
  3822. +
  3823. +    GO_ICECROWN_DOOR             = 201976, //72802
  3824. +    GO_ICECROWN_DOOR_2           = 197342,
  3825. +    GO_ICECROWN_DOOR_3           = 197343,
  3826. +    GO_IMPENETRABLE_DOOR         = 197341, //72801
  3827. +    GO_FROSTMOURNE_ALTAR         = 202236, //3551
  3828. +    GO_FROSTMOURNE               = 202302, //364
  3829. +
  3830. +    GO_ICE_WALL_1                = 201385,
  3831. +    GO_ICE_WALL_2                = 201885,
  3832. +    GO_ICE_WALL_3                = 202396,
  3833. +    GO_ICE_WALL_4                = 500001,
  3834. +    GO_CAVE                      = 201596,
  3835. +    GO_PORTAL                    = 202079,
  3836. +
  3837. +    GO_CAPTAIN_CHEST_1           = 202212, //3145
  3838. +    GO_CAPTAIN_CHEST_2           = 201710, //30357
  3839. +    GO_CAPTAIN_CHEST_3           = 202337, //3246
  3840. +    GO_CAPTAIN_CHEST_4           = 202336, //3333
  3841.  };
  3842.  
  3843. -enum Data64
  3844. +struct Locations
  3845.  {
  3846. -    DATA_FALRIC,
  3847. -    DATA_MARWYN,
  3848. -    DATA_LICHKING,
  3849. -    DATA_FROSTMOURNE,
  3850. +    float x, y, z, o;
  3851. +    uint32 id;
  3852.  };
  3853.  
  3854. -enum Creatures
  3855. +static Locations SpawnLoc[]=
  3856.  {
  3857. -    NPC_FALRIC                                    = 38112,
  3858. -    NPC_MARWYN                                    = 38113,
  3859. -    NPC_LICH_KING_EVENT                           = 37226,
  3860. -    NPC_LICH_KING_BOSS                            = 36954,
  3861. -
  3862. -    NPC_UTHER                                     = 37225,
  3863. -    NPC_JAINA_PART1                               = 37221,
  3864. -    NPC_JAINA_PART2                               = 36955,
  3865. -    NPC_SYLVANAS_PART1                            = 37223,
  3866. -    NPC_SYLVANAS_PART2                            = 37554,
  3867. -
  3868. -    NPC_WAVE_MERCENARY                            = 38177,
  3869. -    NPC_WAVE_FOOTMAN                              = 38173,
  3870. -    NPC_WAVE_RIFLEMAN                             = 38176,
  3871. -    NPC_WAVE_PRIEST                               = 38175,
  3872. -    NPC_WAVE_MAGE                                 = 38172,
  3873. -};
  3874. -
  3875. -enum GameObjects
  3876. -{
  3877. -    GO_FROSTMOURNE                                = 202302,
  3878. -    GO_FROSTMOURNE_ALTAR                          = 202236,
  3879. -    GO_FRONT_DOOR                                 = 201976,
  3880. -    GO_ARTHAS_DOOR                                = 197341,
  3881. -};
  3882. -
  3883. -enum HorWorldStates
  3884. -{
  3885. -    WORLD_STATE_HOR                               = 4884,
  3886. -    WORLD_STATE_HOR_WAVE_COUNT                    = 4882,
  3887. -};
  3888. -
  3889. -// Common actions from Instance Script to Boss Script
  3890. -enum Actions
  3891. -{
  3892. -    ACTION_ENTER_COMBAT,
  3893. -};
  3894. -
  3895. -// Base class for FALRIC and MARWYN
  3896. -// handled the summonList and the notification events to/from the InstanceScript
  3897. -struct boss_horAI : ScriptedAI
  3898. -{
  3899. -    boss_horAI(Creature* creature) : ScriptedAI(creature), summons(creature)
  3900. -    {
  3901. -        instance = me->GetInstanceScript();
  3902. -    }
  3903. -
  3904. -    InstanceScript* instance;
  3905. -    EventMap events;
  3906. -    SummonList summons;
  3907. -
  3908. -    void Reset()
  3909. -    {
  3910. -        events.Reset();
  3911. -        me->SetVisible(false);
  3912. -        me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE);
  3913. -        me->SetReactState(REACT_PASSIVE);
  3914. -    }
  3915. -
  3916. -    void DamageTaken(Unit* /*who*/, uint32 &uiDamage)
  3917. -    {
  3918. -        if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE))
  3919. -            uiDamage = 0;
  3920. -    }
  3921. -
  3922. -    void DoAction(const int32 actionID)
  3923. -    {
  3924. -        switch (actionID)
  3925. -        {
  3926. -            case ACTION_ENTER_COMBAT:  // called by InstanceScript when boss shall enter in combat.
  3927. -                // Just in case. Should have been done by InstanceScript
  3928. -                me->SetVisible(true);
  3929. -
  3930. -                // Reset flags
  3931. -                me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE);
  3932. -                me->SetReactState(REACT_AGGRESSIVE);
  3933. -
  3934. -                if (Unit* unit = me->SelectNearestTarget())
  3935. -                    AttackStart(unit);
  3936. -
  3937. -                DoZoneInCombat();
  3938. -                break;
  3939. -        }
  3940. -    }
  3941. -
  3942. -    void JustSummoned(Creature* summoned)
  3943. -    {
  3944. -        summons.Summon(summoned);
  3945. -
  3946. -        if (Unit* target = summoned->SelectNearestTarget())
  3947. -        {
  3948. -            if (summoned->AI())
  3949. -                summoned->AI()->AttackStart(target);
  3950. -            else
  3951. -            {
  3952. -                summoned->GetMotionMaster()->MoveChase(target);
  3953. -                summoned->Attack(target, true);
  3954. -            }
  3955. -        }
  3956. -
  3957. -        if (summoned->AI())
  3958. -            summoned->AI()->DoZoneInCombat();
  3959. -    }
  3960. -
  3961. -    void SummonedCreatureDespawn(Creature* summoned)
  3962. -    {
  3963. -        summons.Despawn(summoned);
  3964. -        if (summons.empty())
  3965. -        {
  3966. -            if (summoned->isAlive())
  3967. -                instance->SetData(DATA_WAVE_COUNT, NOT_STARTED);
  3968. -            else
  3969. -                instance->SetData(DATA_WAVE_COUNT, SPECIAL);
  3970. -        }
  3971. -    }
  3972. +    //Wing 01
  3973. +    {5277.409f, 1993.161f, 707.694f, 0.05f}, //27
  3974. +    {5301.876f, 2041.699f, 707.694f, 4.71f}, //1
  3975. +    {5339.830f, 2020.887f, 707.694f, 3.14f}, //13
  3976. +    {5311.041f, 2042.935f, 707.694f, 4.71f}, //3
  3977. +    {5314.750f, 2039.969f, 707.694f, 4.71f}, //4
  3978. +    {5342.823f, 2003.801f, 707.694f, 3.14f}, //10
  3979. +    {5311.579f, 1972.823f, 707.694f, 1.62f}, //16
  3980. +
  3981. +    //Wing 02
  3982. +    {5272.491f, 2005.673f, 707.694f, 0.05f}, //23
  3983. +    {5302.669f, 1973.050f, 707.694f, 1.62f}, //18
  3984. +    {5346.187f, 2008.058f, 707.694f, 3.14f}, //9
  3985. +    {5319.752f, 2041.321f, 707.694f, 4.71f}, //5
  3986. +    {5344.882f, 1998.714f, 707.694f, 3.14f}, //11
  3987. +    {5340.552f, 1994.735f, 707.694f, 3.14f}, //12
  3988. +    {5306.441f, 2040.358f, 707.694f, 4.71f}, //2
  3989. +
  3990. +    //Wing 03
  3991. +    {5273.297f, 2014.009f, 707.694f, 0.05f}, //25
  3992. +    {5316.062f, 1970.777f, 707.694f, 1.62f}, //15
  3993. +    {5322.498f, 2037.415f, 707.694f, 4.71f}, //6
  3994. +    {5307.087f, 1970.065f, 707.694f, 1.62f}, //17
  3995. +    {5342.460f, 2012.391f, 707.694f, 3.14f}, //8
  3996. +    {5297.601f, 1971.420f, 707.694f, 1.62f}, //19
  3997. +    {5295.668f, 1975.853f, 707.694f, 1.62f}, //20
  3998. +
  3999. +    //Wing 04
  4000. +    {5273.661f, 1996.767f, 707.694f, 0.05f}, //21
  4001. +    {5275.228f, 2001.275f, 707.694f, 0.05f}, //22
  4002. +    {5344.153f, 2017.753f, 707.694f, 3.14f}, //7
  4003. +    {5275.310f, 2009.686f, 707.694f, 0.05f}, //24
  4004. +    {5319.835f, 1975.177f, 707.694f, 1.62f}, //14
  4005. +    {5277.445f, 2017.197f, 707.694f, 0.05f}, //26
  4006. +    {5298.198f, 2037.762f, 707.694f, 4.71f}  //0
  4007.  };
  4008.  
  4009.  #endif
  4010. diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp
  4011. index e360489..62b1975 100644
  4012. --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp
  4013. +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp
  4014. @@ -1,429 +1,384 @@
  4015.  /*
  4016. - * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
  4017. + * Copyright (C) 2008 - 2012 Trinity <http://www.trinitycore.org/>
  4018. + * Copyright (C) 2008 - 2012 Facecore <https://github.com/SignFinder/FaceCore/>
  4019.   *
  4020. - * This program is free software; you can redistribute it and/or modify it
  4021. - * under the terms of the GNU General Public License as published by the
  4022. - * Free Software Foundation; either version 2 of the License, or (at your
  4023. - * option) any later version.
  4024. + * This program is free software; you can redistribute it and/or modify
  4025. + * it under the terms of the GNU General Public License as published by
  4026. + * the Free Software Foundation; either version 2 of the License, or
  4027. + * (at your option) any later version.
  4028.   *
  4029. - * This program is distributed in the hope that it will be useful, but WITHOUT
  4030. - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  4031. - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  4032. - * more details.
  4033. + * This program is distributed in the hope that it will be useful,
  4034. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  4035. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  4036. + * GNU General Public License for more details.
  4037.   *
  4038. - * You should have received a copy of the GNU General Public License along
  4039. - * with this program. If not, see <http://www.gnu.org/licenses/>.
  4040. + * You should have received a copy of the GNU General Public License
  4041. + * along with this program; if not, write to the Free Software
  4042. + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  4043.   */
  4044.  
  4045. +/* ScriptData
  4046. +SDName: instance_halls_of_reflection
  4047. +SD%Complete: 70%
  4048. +SDComment:
  4049. +SDErrors:
  4050. +SDCategory: instance script
  4051. +SDAuthor: /dev/rsa, modified by MaxXx2021 aka Mioka
  4052. +EndScriptData */
  4053. +
  4054.  #include "ScriptMgr.h"
  4055.  #include "ScriptedCreature.h"
  4056.  #include "InstanceScript.h"
  4057.  #include "halls_of_reflection.h"
  4058. -
  4059. -#define MAX_ENCOUNTER 3
  4060. -
  4061. -/* Halls of Reflection encounters:
  4062. -0- Falric
  4063. -1- Marwyn
  4064. -2- The Lich King
  4065. -*/
  4066. -
  4067. -enum eEnum
  4068. -{
  4069. -    ENCOUNTER_WAVE_MERCENARY                      = 6,
  4070. -    ENCOUNTER_WAVE_FOOTMAN                        = 10,
  4071. -    ENCOUNTER_WAVE_RIFLEMAN                       = 6,
  4072. -    ENCOUNTER_WAVE_PRIEST                         = 6,
  4073. -    ENCOUNTER_WAVE_MAGE                           = 6,
  4074. -};
  4075. -
  4076. -enum Events
  4077. -{
  4078. -    EVENT_NONE,
  4079. -    EVENT_NEXT_WAVE,
  4080. -    EVENT_START_LICH_KING,
  4081. -};
  4082. -
  4083. -static Position PriestSpawnPos[ENCOUNTER_WAVE_PRIEST] =
  4084. -{
  4085. -    {5277.74f, 2016.88f, 707.778f, 5.96903f},
  4086. -    {5295.88f, 2040.34f, 707.778f, 5.07891f},
  4087. -    {5320.37f, 1980.13f, 707.778f, 2.00713f},
  4088. -    {5280.51f, 1997.84f, 707.778f, 0.296706f},
  4089. -    {5302.45f, 2042.22f, 707.778f, 4.90438f},
  4090. -    {5306.57f, 1977.47f, 707.778f, 1.50098f},
  4091. -};
  4092. -
  4093. -static Position MageSpawnPos[ENCOUNTER_WAVE_MAGE] =
  4094. -{
  4095. -    {5312.75f, 2037.12f, 707.778f, 4.59022f},
  4096. -    {5309.58f, 2042.67f, 707.778f, 4.69494f},
  4097. -    {5275.08f, 2008.72f, 707.778f, 6.21337f},
  4098. -    {5279.65f, 2004.66f, 707.778f, 0.069813f},
  4099. -    {5275.48f, 2001.14f, 707.778f, 0.174533f},
  4100. -    {5316.7f, 2041.55f, 707.778f, 4.50295f},
  4101. -};
  4102. -
  4103. -static Position MercenarySpawnPos[ENCOUNTER_WAVE_MERCENARY] =
  4104. -{
  4105. -    {5302.25f, 1972.41f, 707.778f, 1.37881f},
  4106. -    {5311.03f, 1972.23f, 707.778f, 1.64061f},
  4107. -    {5277.36f, 1993.23f, 707.778f, 0.401426f},
  4108. -    {5318.7f, 2036.11f, 707.778f, 4.2237f},
  4109. -    {5335.72f, 1996.86f, 707.778f, 2.74017f},
  4110. -    {5299.43f, 1979.01f, 707.778f, 1.23918f},
  4111. -};
  4112. -
  4113. -static Position FootmenSpawnPos[ENCOUNTER_WAVE_FOOTMAN] =
  4114. -{
  4115. -    {5306.06f, 2037, 707.778f, 4.81711f},
  4116. -    {5344.15f, 2007.17f, 707.778f, 3.15905f},
  4117. -    {5337.83f, 2010.06f, 707.778f, 3.22886f},
  4118. -    {5343.29f, 1999.38f, 707.778f, 2.9147f},
  4119. -    {5340.84f, 1992.46f, 707.778f, 2.75762f},
  4120. -    {5325.07f, 1977.6f, 707.778f, 2.07694f},
  4121. -    {5336.6f, 2017.28f, 707.778f, 3.47321f},
  4122. -    {5313.82f, 1978.15f, 707.778f, 1.74533f},
  4123. -    {5280.63f, 2012.16f, 707.778f, 6.05629f},
  4124. -    {5322.96f, 2040.29f, 707.778f, 4.34587f},
  4125. -};
  4126. -
  4127. -static Position RiflemanSpawnPos[ENCOUNTER_WAVE_RIFLEMAN] =
  4128. -{
  4129. -    {5343.47f, 2015.95f, 707.778f, 3.49066f},
  4130. -    {5337.86f, 2003.4f, 707.778f, 2.98451f},
  4131. -    {5319.16f, 1974, 707.778f, 1.91986f},
  4132. -    {5299.25f, 2036, 707.778f, 5.02655f},
  4133. -    {5295.64f, 1973.76f, 707.778f, 1.18682f},
  4134. -    {5282.9f, 2019.6f, 707.778f, 5.88176f},
  4135. -};
  4136. +#include "World.h"
  4137.  
  4138.  class instance_halls_of_reflection : public InstanceMapScript
  4139.  {
  4140.  public:
  4141.      instance_halls_of_reflection() : InstanceMapScript("instance_halls_of_reflection", 668) { }
  4142.  
  4143. -    InstanceScript* GetInstanceScript(InstanceMap* map) const
  4144. -    {
  4145. -        return new instance_halls_of_reflection_InstanceMapScript(map);
  4146. -    }
  4147. -
  4148.      struct instance_halls_of_reflection_InstanceMapScript : public InstanceScript
  4149.      {
  4150. -        instance_halls_of_reflection_InstanceMapScript(Map* map) : InstanceScript(map) {};
  4151. -
  4152. -        uint64 uiFalric;
  4153. -        uint64 uiMarwyn;
  4154. -        uint64 uiLichKingEvent;
  4155. -        uint64 uiJainaPart1;
  4156. -        uint64 uiSylvanasPart1;
  4157. +        instance_halls_of_reflection_InstanceMapScript(Map* pMap) : InstanceScript(pMap)
  4158. +        {
  4159. +            Difficulty = pMap->GetDifficulty();
  4160. +            Initialize();
  4161. +        }
  4162.  
  4163. -        uint64 uiFrostmourne;
  4164. -        uint64 uiFrostmourneAltar;
  4165. -        uint64 uiArthasDoor;
  4166. -        uint64 uiFrontDoor;
  4167. +        uint32 m_auiEncounter[MAX_ENCOUNTERS+1];
  4168. +        uint32 m_auiLider;
  4169. +        std::string strSaveData;
  4170. +
  4171. +        uint8 Difficulty;
  4172. +        uint8 m_uiSummons;
  4173. +
  4174. +        uint64 m_uiFalricGUID;
  4175. +        uint64 m_uiMarwynGUID;  
  4176. +        uint64 m_uiLichKingGUID;
  4177. +        uint64 m_uiLiderGUID;
  4178. +
  4179. +        uint64 m_uiMainGateGUID;
  4180. +        uint64 m_uiExitGateGUID;
  4181. +        uint64 m_uiDoor2GUID;
  4182. +        uint64 m_uiDoor3GUID;
  4183. +
  4184. +        uint64 m_uiFrostGeneralGUID;
  4185. +        uint64 m_uiCaptainsChestHordeGUID;
  4186. +        uint64 m_uiCaptainsChestAllianceGUID;
  4187. +        uint64 m_uiFrostmourneGUID;
  4188. +        uint64 m_uiFrostmourneAltarGUID;
  4189. +        uint64 m_uiPortalGUID;
  4190. +        uint64 m_uiIceWall1GUID;
  4191. +        uint64 m_uiIceWall2GUID;
  4192. +        uint64 m_uiIceWall3GUID;
  4193. +        uint64 m_uiIceWall4GUID;
  4194. +        uint64 m_uiGoCaveGUID;
  4195. +        uint32 m_uiTeamInInstance;
  4196.  
  4197. -        uint32 uiEncounter[MAX_ENCOUNTER];
  4198. -        uint32 uiTeamInInstance;
  4199. -        uint32 uiWaveCount;
  4200. -        bool bIntroDone;
  4201. +        void Initialize()
  4202. +        {
  4203. +            for (uint8 i = 0; i < MAX_ENCOUNTERS; ++i)
  4204. +                m_auiEncounter[i] = NOT_STARTED;
  4205. +            m_uiMainGateGUID = 0;
  4206. +            m_uiFrostmourneGUID = 0;
  4207. +            m_uiFalricGUID = 0;
  4208. +            m_uiLiderGUID = 0;
  4209. +            m_uiLichKingGUID = 0;
  4210. +            m_uiExitGateGUID = 0;
  4211. +            m_uiSummons = 0;
  4212. +            m_uiIceWall1GUID = 0;
  4213. +            m_uiIceWall2GUID = 0;
  4214. +            m_uiIceWall3GUID = 0;
  4215. +            m_uiIceWall4GUID = 0;
  4216. +            m_uiGoCaveGUID = 0;
  4217. +            m_uiTeamInInstance = 0;
  4218. +        }
  4219.  
  4220. -        EventMap events;
  4221. +        void OpenDoor(uint64 guid)
  4222. +        {
  4223. +            if(!guid) return;
  4224. +            GameObject* go = instance->GetGameObject(guid);
  4225. +            if(go) go->SetGoState(GO_STATE_ACTIVE);
  4226. +        }
  4227.  
  4228. -        void Initialize()
  4229. +        void CloseDoor(uint64 guid)
  4230.          {
  4231. -            events.Reset();
  4232. -
  4233. -            uiFalric = 0;
  4234. -            uiMarwyn = 0;
  4235. -            uiLichKingEvent = 0;
  4236. -            uiJainaPart1 = 0;
  4237. -            uiSylvanasPart1 = 0;
  4238. -
  4239. -            uiFrostmourne = 0;
  4240. -            uiFrostmourneAltar = 0;
  4241. -            uiArthasDoor = 0;
  4242. -            uiFrontDoor = 0;
  4243. -            uiTeamInInstance = 0;
  4244. -            uiWaveCount = 0;
  4245. -            bIntroDone = false;
  4246. -
  4247. -            for (uint8 i = 0; i < MAX_ENCOUNTER; ++i)
  4248. -                uiEncounter[i] = NOT_STARTED;
  4249. +            if(!guid) return;
  4250. +            GameObject* go = instance->GetGameObject(guid);
  4251. +            if(go) go->SetGoState(GO_STATE_READY);
  4252.          }
  4253.  
  4254.          void OnCreatureCreate(Creature* creature)
  4255.          {
  4256.              Map::PlayerList const &players = instance->GetPlayers();
  4257.              if (!players.isEmpty())
  4258. -                if (Player* player = players.begin()->getSource())
  4259. -                    uiTeamInInstance = player->GetTeam();
  4260. +                if (Player* pPlayer = players.begin()->getSource())
  4261. +                    m_uiTeamInInstance = pPlayer->GetTeam();
  4262.  
  4263. -            switch (creature->GetEntry())
  4264. +            switch(creature->GetEntry())
  4265.              {
  4266. -                case NPC_FALRIC:
  4267. -                    uiFalric = creature->GetGUID();
  4268. -                    break;
  4269. -                case NPC_MARWYN:
  4270. -                    uiMarwyn = creature->GetGUID();
  4271. -                    break;
  4272. -                case NPC_LICH_KING_EVENT:
  4273. -                    uiLichKingEvent = creature->GetGUID();
  4274. -                    break;
  4275. -                case NPC_JAINA_PART1:
  4276. -                    uiJainaPart1 = creature->GetGUID();
  4277. -                    break;
  4278. -                case NPC_SYLVANAS_PART1:
  4279. -                    uiSylvanasPart1 = creature->GetGUID();
  4280. -                    break;
  4281. +                case NPC_FALRIC:
  4282. +                       m_uiFalricGUID = creature->GetGUID();
  4283. +                       break;
  4284. +                case NPC_MARWYN:
  4285. +                       m_uiMarwynGUID = creature->GetGUID();  
  4286. +                       break;
  4287. +                case BOSS_LICH_KING:
  4288. +                       m_uiLichKingGUID = creature->GetGUID();
  4289. +                       break;
  4290. +                case NPC_FROST_GENERAL:
  4291. +                       m_uiFrostGeneralGUID = creature->GetGUID();
  4292. +                       break;
  4293.              }
  4294.          }
  4295.  
  4296. +        void OnPlayerEnter(Player *pPlayer)
  4297. +        {
  4298. +
  4299. +        enum PhaseControl
  4300. +        {
  4301. +            HORDE_CONTROL_PHASE_SHIFT_1    = 55773,
  4302. +            HORDE_CONTROL_PHASE_SHIFT_2    = 60028,
  4303. +            ALLIANCE_CONTROL_PHASE_SHIFT_1 = 55774,
  4304. +            ALLIANCE_CONTROL_PHASE_SHIFT_2 = 60027,
  4305. +        };
  4306. +        
  4307. +         if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP)) return;
  4308. +
  4309. +            switch (pPlayer->GetTeam())
  4310. +            {
  4311. +                case ALLIANCE:
  4312. +                      if (pPlayer && pPlayer->IsInWorld() && pPlayer->HasAura(HORDE_CONTROL_PHASE_SHIFT_1))
  4313. +                          pPlayer->RemoveAurasDueToSpell(HORDE_CONTROL_PHASE_SHIFT_1);
  4314. +                      pPlayer->CastSpell(pPlayer, HORDE_CONTROL_PHASE_SHIFT_2, false);
  4315. +                      break;
  4316. +                case HORDE:
  4317. +                      if (pPlayer && pPlayer->IsInWorld() && pPlayer->HasAura(ALLIANCE_CONTROL_PHASE_SHIFT_1))
  4318. +                          pPlayer->RemoveAurasDueToSpell(ALLIANCE_CONTROL_PHASE_SHIFT_1);
  4319. +                      pPlayer->CastSpell(pPlayer, ALLIANCE_CONTROL_PHASE_SHIFT_2, false);
  4320. +                      break;
  4321. +            };
  4322. +
  4323. +        };
  4324. +
  4325.          void OnGameObjectCreate(GameObject* go)
  4326.          {
  4327. -            // TODO: init state depending on encounters
  4328. -            switch (go->GetEntry())
  4329. +            switch(go->GetEntry())
  4330.              {
  4331. -                case GO_FROSTMOURNE:
  4332. -                    uiFrostmourne = go->GetGUID();
  4333. -                    go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_INTERACT_COND);
  4334. -                    HandleGameObject(0, false, go);
  4335. +                case GO_IMPENETRABLE_DOOR: m_uiMainGateGUID = go->GetGUID(); break;
  4336. +                case GO_FROSTMOURNE: m_uiFrostmourneGUID = go->GetGUID(); break;
  4337. +                case GO_ICECROWN_DOOR:     m_uiExitGateGUID = go->GetGUID(); break;
  4338. +                case GO_ICECROWN_DOOR_2:   m_uiDoor2GUID = go->GetGUID(); break;
  4339. +                case GO_ICECROWN_DOOR_3:   m_uiDoor3GUID = go->GetGUID(); break;
  4340. +                case GO_PORTAL:            m_uiPortalGUID = go->GetGUID(); break;
  4341. +                case GO_CAPTAIN_CHEST_1:
  4342. +                                      if (Difficulty == RAID_DIFFICULTY_10MAN_NORMAL)
  4343. +                                      m_uiCaptainsChestHordeGUID = go->GetGUID();
  4344. +                                      break;
  4345. +                case GO_CAPTAIN_CHEST_3:
  4346. +                                      if (Difficulty == RAID_DIFFICULTY_25MAN_NORMAL)
  4347. +                                      m_uiCaptainsChestHordeGUID = go->GetGUID();
  4348. +                                      break;
  4349. +                case GO_CAPTAIN_CHEST_2:
  4350. +                                      if (Difficulty == RAID_DIFFICULTY_10MAN_NORMAL)
  4351. +                                      m_uiCaptainsChestAllianceGUID = go->GetGUID();
  4352. +                                      break;
  4353. +                case GO_CAPTAIN_CHEST_4:
  4354. +                                      if (Difficulty == RAID_DIFFICULTY_25MAN_NORMAL)
  4355. +                                      m_uiCaptainsChestAllianceGUID = go->GetGUID();
  4356. +                                      break;
  4357. +                case GO_ICE_WALL_1:
  4358. +                    m_uiIceWall1GUID = go->GetGUID();
  4359. +                    go->SetGoState(GO_STATE_READY);
  4360.                      break;
  4361. -                case GO_FROSTMOURNE_ALTAR:
  4362. -                    uiFrostmourneAltar = go->GetGUID();
  4363. -                    go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_INTERACT_COND);
  4364. -                    HandleGameObject(0, true, go);
  4365. +                case GO_ICE_WALL_2:
  4366. +                    m_uiIceWall2GUID = go->GetGUID();
  4367. +                    go->SetGoState(GO_STATE_READY);
  4368.                      break;
  4369. -                case GO_FRONT_DOOR:
  4370. -                    uiFrontDoor = go->GetGUID();
  4371. -                    go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_INTERACT_COND);
  4372. -                    HandleGameObject(0, true, go);
  4373. +                case GO_ICE_WALL_3:
  4374. +                    m_uiIceWall3GUID = go->GetGUID();
  4375. +                    go->SetGoState(GO_STATE_READY);
  4376.                      break;
  4377. -                case GO_ARTHAS_DOOR:
  4378. -                    uiArthasDoor = go->GetGUID();
  4379. -                    go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_INTERACT_COND);
  4380. -
  4381. -                    if (uiEncounter[1] == DONE)
  4382. -                        HandleGameObject(0, true, go);
  4383. -                    else
  4384. -                        HandleGameObject(0, false, go);
  4385. +                case GO_ICE_WALL_4:
  4386. +                    m_uiIceWall4GUID = go->GetGUID();
  4387. +                    go->SetGoState(GO_STATE_READY);
  4388. +                    break;
  4389. +                case GO_CAVE:
  4390. +                    m_uiGoCaveGUID = go->GetGUID();
  4391. +                    go->SetGoState(GO_STATE_ACTIVE);
  4392.                      break;
  4393.              }
  4394.          }
  4395.  
  4396. -        void SetData(uint32 type, uint32 data)
  4397. +        void SetData(uint32 uiType, uint32 uiData)
  4398.          {
  4399. -            if (type == DATA_WAVE_COUNT && data == SPECIAL)
  4400. -            {
  4401. -                bIntroDone = true;
  4402. -                events.ScheduleEvent(EVENT_NEXT_WAVE, 10000);
  4403. -                return;
  4404. -            }
  4405. -
  4406. -            if (uiWaveCount && data == NOT_STARTED)
  4407. -                DoWipe();
  4408. -
  4409. -            switch (type)
  4410. +            switch(uiType)
  4411.              {
  4412. -                case DATA_FALRIC_EVENT:
  4413. -                    uiEncounter[0] = data;
  4414. -                    if (data == DONE)
  4415. -                        events.ScheduleEvent(EVENT_NEXT_WAVE, 60000);
  4416. +                case TYPE_PHASE:                m_auiEncounter[uiType] = uiData; break;
  4417. +                case TYPE_EVENT:                m_auiEncounter[uiType] = uiData;
  4418. +                                                uiData = NOT_STARTED;
  4419. +                    break;
  4420. +                case TYPE_FALRIC:               m_auiEncounter[uiType] = uiData;
  4421. +                    if(uiData == SPECIAL)
  4422. +                                                    CloseDoor(m_uiExitGateGUID);
  4423. +                    break;
  4424. +                case TYPE_MARWYN:               m_auiEncounter[uiType] = uiData;
  4425. +                    if(uiData == DONE)
  4426. +                    {
  4427. +                                                   OpenDoor(m_uiMainGateGUID);
  4428. +                                                   OpenDoor(m_uiExitGateGUID);
  4429. +                    }
  4430. +                    break;
  4431. +                case TYPE_FROST_GENERAL:        m_auiEncounter[uiType] = uiData;
  4432. +                                                if(uiData == DONE)
  4433. +                                                   OpenDoor(m_uiDoor2GUID);
  4434. +                    break;
  4435. +                case TYPE_LICH_KING:            m_auiEncounter[uiType] = uiData;
  4436. +                                                if(uiData == IN_PROGRESS)
  4437. +                                                   OpenDoor(m_uiDoor3GUID);
  4438. +                                                if(uiData == DONE)
  4439. +                                                {
  4440. +                                                if (m_auiLider == 1)
  4441. +                                                {
  4442. +                                                if (GameObject* pChest = instance->GetGameObject(m_uiCaptainsChestAllianceGUID))
  4443. +                                                    if (pChest && !pChest->isSpawned()) {
  4444. +                                                        pChest->SetRespawnTime(DAY);
  4445. +                                                    };
  4446. +                                                } else
  4447. +                                                if (GameObject* pChest = instance->GetGameObject(m_uiCaptainsChestHordeGUID))
  4448. +                                                    if (pChest && !pChest->isSpawned()) {
  4449. +                                                        pChest->SetRespawnTime(DAY);
  4450. +                                                    };
  4451. +                                                if (GameObject* pPortal = instance->GetGameObject(m_uiPortalGUID))
  4452. +                                                    if (pPortal && !pPortal->isSpawned()) {
  4453. +                                                        pPortal->SetRespawnTime(DAY);
  4454. +                                                    };
  4455. +                                                }
  4456.                      break;
  4457. -                case DATA_MARWYN_EVENT:
  4458. -                    uiEncounter[1] = data;
  4459. -                    if (data == DONE)
  4460. -                        HandleGameObject(uiArthasDoor, true);
  4461. +                case TYPE_ICE_WALL_01:          m_auiEncounter[uiType] = uiData; break;
  4462. +                case TYPE_ICE_WALL_02:          m_auiEncounter[uiType] = uiData; break;
  4463. +                case TYPE_ICE_WALL_03:          m_auiEncounter[uiType] = uiData; break;
  4464. +                case TYPE_ICE_WALL_04:          m_auiEncounter[uiType] = uiData; break;
  4465. +                case TYPE_HALLS:                m_auiEncounter[uiType] = uiData; break;
  4466. +                case DATA_LIDER:                m_auiLider = uiData;
  4467. +                                                uiData = NOT_STARTED;
  4468.                      break;
  4469. -                case DATA_LICHKING_EVENT:
  4470. -                    uiEncounter[2] = data;
  4471. +                case DATA_SUMMONS:              if (uiData == 3) m_uiSummons = 0;
  4472. +                                                else if (uiData == 1) ++m_uiSummons;
  4473. +                                                else if (uiData == 0) --m_uiSummons;
  4474. +                                                uiData = NOT_STARTED;
  4475.                      break;
  4476.              }
  4477.  
  4478. -            if (data == DONE)
  4479. +            if (uiData == DONE)
  4480. +            {
  4481. +                OUT_SAVE_INST_DATA;
  4482. +
  4483. +                std::ostringstream saveStream;
  4484. +
  4485. +                for(uint8 i = 0; i < MAX_ENCOUNTERS; ++i)
  4486. +                    saveStream << m_auiEncounter[i] << " ";
  4487. +
  4488. +                strSaveData = saveStream.str();
  4489. +
  4490.                  SaveToDB();
  4491. +                OUT_SAVE_INST_DATA_COMPLETE;
  4492. +            }
  4493. +        }
  4494. +
  4495. +        const char* Save()
  4496. +        {
  4497. +            return strSaveData.c_str();
  4498.          }
  4499.  
  4500. -        uint32 GetData(uint32 type)
  4501. +        uint32 GetData(uint32 uiType)
  4502.          {
  4503. -            switch (type)
  4504. +            switch(uiType)
  4505.              {
  4506. -                case DATA_FALRIC_EVENT:         return uiEncounter[0];
  4507. -                case DATA_MARWYN_EVENT:         return uiEncounter[1];
  4508. -                case DATA_LICHKING_EVENT:       return uiEncounter[2];
  4509. -                case DATA_WAVE_COUNT:           return uiWaveCount;
  4510. -                case DATA_TEAM_IN_INSTANCE:     return uiTeamInInstance;
  4511. +                case TYPE_PHASE:                return m_auiEncounter[uiType];
  4512. +                case TYPE_EVENT:                return m_auiEncounter[uiType];
  4513. +                case TYPE_FALRIC:               return m_auiEncounter[uiType];
  4514. +                case TYPE_MARWYN:               return m_auiEncounter[uiType];
  4515. +                case TYPE_LICH_KING:            return m_auiEncounter[uiType];
  4516. +                case TYPE_FROST_GENERAL:        return m_auiEncounter[uiType];
  4517. +                case TYPE_ICE_WALL_01:          return m_auiEncounter[uiType];
  4518. +                case TYPE_ICE_WALL_02:          return m_auiEncounter[uiType];
  4519. +                case TYPE_ICE_WALL_03:          return m_auiEncounter[uiType];
  4520. +                case TYPE_ICE_WALL_04:          return m_auiEncounter[uiType];
  4521. +                case TYPE_HALLS:                return m_auiEncounter[uiType];
  4522. +                case DATA_LIDER:                return m_auiLider;
  4523. +                case DATA_SUMMONS:              return m_uiSummons;
  4524. +                case DATA_TEAM_IN_INSTANCE:     return m_uiTeamInInstance;
  4525. +                default:                        return 0;
  4526.              }
  4527. -
  4528.              return 0;
  4529.          }
  4530.  
  4531. -        uint64 GetData64(uint32 identifier)
  4532. +        void SetData64(uint32 uiData, uint64 uiGuid)
  4533.          {
  4534. -            switch (identifier)
  4535. +            switch(uiData)
  4536.              {
  4537. -                case DATA_FALRIC:               return uiFalric;
  4538. -                case DATA_MARWYN:               return uiMarwyn;
  4539. -                case DATA_LICHKING:             return uiLichKingEvent;
  4540. -                case DATA_FROSTMOURNE:          return uiFrostmourne;
  4541. +                case DATA_ESCAPE_LIDER:
  4542. +                       m_uiLiderGUID = uiGuid;
  4543. +                       break;
  4544.              }
  4545. -
  4546. -            return 0;
  4547.          }
  4548.  
  4549. -        std::string GetSaveData()
  4550. +        uint64 GetData64(uint32 uiData)
  4551.          {
  4552. -            OUT_SAVE_INST_DATA;
  4553. -
  4554. -            std::ostringstream saveStream;
  4555. -            saveStream << "H R 1 " << uiEncounter[0] << ' ' << uiEncounter[1] << ' ' << uiEncounter[2];
  4556. -
  4557. -            OUT_SAVE_INST_DATA_COMPLETE;
  4558. -            return saveStream.str();
  4559. +            switch(uiData)
  4560. +            {
  4561. +                case GO_IMPENETRABLE_DOOR: return m_uiMainGateGUID;
  4562. +                case GO_FROSTMOURNE:       return m_uiFrostmourneGUID;
  4563. +                case NPC_FALRIC:           return m_uiFalricGUID;
  4564. +                case NPC_MARWYN:           return m_uiMarwynGUID;
  4565. +                case BOSS_LICH_KING:       return m_uiLichKingGUID;
  4566. +                case DATA_ESCAPE_LIDER:    return m_uiLiderGUID;
  4567. +                case NPC_FROST_GENERAL:    return m_uiFrostGeneralGUID;
  4568. +                case GO_ICECROWN_DOOR:     return m_uiExitGateGUID;
  4569. +                case GO_ICECROWN_DOOR_2:   return m_uiDoor2GUID;
  4570. +                case GO_ICECROWN_DOOR_3:   return m_uiDoor3GUID;
  4571. +                case GO_ICE_WALL_1:        return m_uiIceWall1GUID;
  4572. +                case GO_ICE_WALL_2:        return m_uiIceWall2GUID;
  4573. +                case GO_ICE_WALL_3:        return m_uiIceWall3GUID;
  4574. +                case GO_ICE_WALL_4:        return m_uiIceWall4GUID;
  4575. +                case GO_CAVE:              return m_uiGoCaveGUID;
  4576. +            }
  4577. +            return 0;
  4578.          }
  4579.  
  4580. -        void Load(const char* in)
  4581. +        void Load(const char* chrIn)
  4582.          {
  4583. -            if (!in)
  4584. +            if (!chrIn)
  4585.              {
  4586.                  OUT_LOAD_INST_DATA_FAIL;
  4587.                  return;
  4588.              }
  4589.  
  4590. -            OUT_LOAD_INST_DATA(in);
  4591. -
  4592. -            char dataHead1, dataHead2;
  4593. -            uint16 version;
  4594. -            uint16 data0, data1, data2;
  4595. +            OUT_LOAD_INST_DATA(chrIn);
  4596.  
  4597. -            std::istringstream loadStream(in);
  4598. -            loadStream >> dataHead1 >> dataHead2 >> version >> data0 >> data1 >> data2;
  4599. +            std::istringstream loadStream(chrIn);
  4600.  
  4601. -            if (dataHead1 == 'H' && dataHead2 == 'R')
  4602. +            for(uint8 i = 0; i < MAX_ENCOUNTERS; ++i)
  4603.              {
  4604. -                uiEncounter[0] = data0;
  4605. -                uiEncounter[1] = data1;
  4606. -                uiEncounter[2] = data2;
  4607. -
  4608. -                for (uint8 i = 0; i < MAX_ENCOUNTER; ++i)
  4609. -                    if (uiEncounter[i] == IN_PROGRESS)
  4610. -                        uiEncounter[i] = NOT_STARTED;
  4611. -
  4612. -            } else OUT_LOAD_INST_DATA_FAIL;
  4613. -
  4614. -            if (uiEncounter[0] == DONE || uiEncounter[1] == DONE)
  4615. -                bIntroDone = true;
  4616. +                loadStream >> m_auiEncounter[i];
  4617.  
  4618. -            OUT_LOAD_INST_DATA_COMPLETE;
  4619. -        }
  4620. -
  4621. -        void AddWave()
  4622. -        {
  4623. -            DoUpdateWorldState(WORLD_STATE_HOR, 1);
  4624. -            DoUpdateWorldState(WORLD_STATE_HOR_WAVE_COUNT, uiWaveCount);
  4625. -
  4626. -            switch (uiWaveCount)
  4627. -            {
  4628. -                case 1:
  4629. -                case 2:
  4630. -                case 3:
  4631. -                case 4:
  4632. -                    if (Creature* pFalric = instance->GetCreature(uiFalric))
  4633. -                        SpawnWave(pFalric);
  4634. -                    break;
  4635. -                case 5:
  4636. -                    if (GetData(DATA_FALRIC_EVENT) == DONE)
  4637. -                        events.ScheduleEvent(EVENT_NEXT_WAVE, 10000);
  4638. -                    else if (Creature* pFalric = instance->GetCreature(uiFalric))
  4639. -                        if (pFalric->AI())
  4640. -                            pFalric->AI()->DoAction(ACTION_ENTER_COMBAT);
  4641. -                    break;
  4642. -                case 6:
  4643. -                case 7:
  4644. -                case 8:
  4645. -                case 9:
  4646. -                    if (Creature* pMarwyn  = instance->GetCreature(uiMarwyn))
  4647. -                        SpawnWave(pMarwyn);
  4648. -                    break;
  4649. -                case 10:
  4650. -                    if (GetData(DATA_MARWYN_EVENT) != DONE) // wave should not have been started if DONE. Check anyway to avoid bug exploit!
  4651. -                        if (Creature* pMarwyn = instance->GetCreature(uiMarwyn))
  4652. -                            if (pMarwyn->AI())
  4653. -                                pMarwyn->AI()->DoAction(ACTION_ENTER_COMBAT);
  4654. -                    break;
  4655. +                if (m_auiEncounter[i] == IN_PROGRESS)
  4656. +                    m_auiEncounter[i] = NOT_STARTED;
  4657.              }
  4658. -        }
  4659. -
  4660. -        // Wipe has been detected. Perform cleanup and reset.
  4661. -        void DoWipe()
  4662. -        {
  4663. -            uiWaveCount = 0;
  4664. -            events.Reset();
  4665. -            DoUpdateWorldState(WORLD_STATE_HOR, 1);
  4666. -            DoUpdateWorldState(WORLD_STATE_HOR_WAVE_COUNT, uiWaveCount);
  4667. -            HandleGameObject(uiFrontDoor, true);
  4668. -
  4669. -            // TODO
  4670. -            // in case of wipe, the event is normally restarted by jumping into the center of the room.
  4671. -            // As I can't find a trigger area there, just respawn Jaina/Sylvanas so the event may be restarted.
  4672. -            if (Creature* pJaina = instance->GetCreature(uiJainaPart1))
  4673. -                pJaina->Respawn();
  4674. -            if (Creature* pSylvanas = instance->GetCreature(uiSylvanasPart1))
  4675. -                pSylvanas->Respawn();
  4676. -
  4677. -            if (Creature* pFalric = instance->GetCreature(uiFalric))
  4678. -                pFalric->SetVisible(false);
  4679. -            if (Creature* pMarwyn = instance->GetCreature(uiMarwyn))
  4680. -                pMarwyn->SetVisible(false);
  4681. -        }
  4682. -
  4683. -        // spawn a wave on behalf of the summoner.
  4684. -        void SpawnWave(Creature* summoner)
  4685. -        {
  4686. -            uint32 index;
  4687. -
  4688. -            summoner->SetVisible(true);
  4689. -
  4690. -            // TODO: do composition at random. # of spawn also depends on uiWaveCount
  4691. -            // As of now, it is just one of each.
  4692. -            index = urand(0, ENCOUNTER_WAVE_MERCENARY-1);
  4693. -            summoner->SummonCreature(NPC_WAVE_MERCENARY, MercenarySpawnPos[index], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0);
  4694. -
  4695. -            index = urand(0, ENCOUNTER_WAVE_FOOTMAN-1);
  4696. -            summoner->SummonCreature(NPC_WAVE_FOOTMAN, FootmenSpawnPos[index], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0);
  4697. -
  4698. -            index = urand(0, ENCOUNTER_WAVE_RIFLEMAN-1);
  4699. -            summoner->SummonCreature(NPC_WAVE_RIFLEMAN, RiflemanSpawnPos[index], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0);
  4700. -
  4701. -            index = urand(0, ENCOUNTER_WAVE_PRIEST-1);
  4702. -            summoner->SummonCreature(NPC_WAVE_PRIEST, PriestSpawnPos[index], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0);
  4703.  
  4704. -            index = urand(0, ENCOUNTER_WAVE_MAGE-1);
  4705. -            summoner->SummonCreature(NPC_WAVE_MAGE, MageSpawnPos[index], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0);
  4706. +            OUT_LOAD_INST_DATA_COMPLETE;
  4707.          }
  4708.  
  4709. -        void Update(uint32 diff)
  4710. -        {
  4711. -            if (!instance->HavePlayers())
  4712. -                return;
  4713. -
  4714. -            events.Update(diff);
  4715. -
  4716. -            switch (events.ExecuteEvent())
  4717. -            {
  4718. -                case EVENT_NEXT_WAVE:
  4719. -                    uiWaveCount++;
  4720. -                    AddWave();
  4721. -                    break;
  4722. -                case EVENT_START_LICH_KING:
  4723. -                    // TODO
  4724. -                    break;
  4725. -            }
  4726. -        }
  4727.      };
  4728.  
  4729. +    InstanceScript* GetInstanceScript (InstanceMap* pMap) const
  4730. +    {
  4731. +        return new instance_halls_of_reflection_InstanceMapScript(pMap);
  4732. +    }
  4733.  };
  4734.  
  4735. +
  4736.  void AddSC_instance_halls_of_reflection()
  4737.  {
  4738.      new instance_halls_of_reflection();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement