Advertisement
Guest User

Untitled

a guest
Aug 14th, 2017
442
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 13.65 KB | None | 0 0
  1. From fa7d2e4d4fb37634b899776ef0923969892a0408 Mon Sep 17 00:00:00 2001
  2. From: lobuz <lobuz87@gmail.com>
  3. Date: Thu, 28 Apr 2011 13:44:36 +0200
  4. Subject: [PATCH 1/3] [Signum/Scripts] Init scripts for 'The Stonecore' and rename Emu name
  5.  
  6. ---
  7.  .../TheStonecore/instance_the_stonecore.cpp        |  183 +++++++++++++++++
  8.  .../EasternKingdoms/TheStonecore/the_stonecore.cpp |  209 ++++++++++++++++++++
  9.  .../EasternKingdoms/TheStonecore/the_stonecore.h   |   51 +++++
  10.  src/server/shared/SystemConfig.h                   |    2 +-
  11.  4 files changed, 444 insertions(+), 1 deletions(-)
  12.  create mode 100644 src/server/scripts/EasternKingdoms/TheStonecore/instance_the_stonecore.cpp
  13.  create mode 100644 src/server/scripts/EasternKingdoms/TheStonecore/the_stonecore.cpp
  14.  create mode 100644 src/server/scripts/EasternKingdoms/TheStonecore/the_stonecore.h
  15.  
  16. diff --git a/src/server/scripts/EasternKingdoms/TheStonecore/instance_the_stonecore.cpp b/src/server/scripts/EasternKingdoms/TheStonecore/instance_the_stonecore.cpp
  17. new file mode 100644
  18. index 0000000..1c043dd
  19. --- /dev/null
  20. +++ b/src/server/scripts/EasternKingdoms/TheStonecore/instance_the_stonecore.cpp
  21. @@ -0,0 +1,183 @@
  22. +/*
  23. + * Copyright (C) 2010-2011
  24. + * Author: Jakub "lobuz" Trojanowski
  25. + * email: lobuz87@gmail.com
  26. + */
  27. +
  28. +#include "ScriptPCH.h"
  29. +#include "the_stonecore.h"
  30. +
  31. +#define MAX_ENCOUNTER     4
  32. +
  33. +class instance_the_stonecore : public InstanceMapScript
  34. +{
  35. +public:
  36. +    instance_the_stonecore() : InstanceMapScript("instance_the_stonecore", 111) { }
  37. +
  38. +    InstanceScript* GetInstanceScript(InstanceMap* pMap) const
  39. +    {
  40. +        return new instance_the_stonecore_InstanceMapScript(pMap);
  41. +    }
  42. +
  43. +    struct instance_the_stonecore_InstanceMapScript : public InstanceScript
  44. +    {
  45. +        instance_the_stonecore_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {};
  46. +
  47. +       uint64 uiCorborus;
  48. +       uint64 uiSlabhide;
  49. +       uint64 uiOzruk;
  50. +       uint64 uiHighPriestessAzil;
  51. +        uint32 uiTeamInInstance;
  52. +        uint32 uiEncounter[MAX_ENCOUNTER];
  53. +
  54. +       void Initialize()
  55. +       {
  56. +            for (uint8 i = 0; i < MAX_ENCOUNTER; ++i)
  57. +                uiEncounter[i] = NOT_STARTED;
  58. +
  59. +            uiCorborus = 0;
  60. +            uiSlabhide = 0;
  61. +            uiOzruk = 0;
  62. +            uiHighPriestessAzil = 0;
  63. +
  64. +        }
  65. +
  66. +        bool IsEncounterInProgress() const
  67. +        {
  68. +            for (uint8 i = 0; i < MAX_ENCOUNTER; ++i)
  69. +                if (uiEncounter[i] == IN_PROGRESS)
  70. +                    return true;
  71. +
  72. +            return false;
  73. +        }
  74. +
  75. +        void OnCreatureCreate(Creature* pCreature, bool /*add*/)
  76. +        {
  77. +            Map::PlayerList const &players = instance->GetPlayers();
  78. +
  79. +            if (!players.isEmpty())
  80. +            {
  81. +                if (Player* pPlayer = players.begin()->getSource())
  82. +                    uiTeamInInstance = pPlayer->GetTeam();
  83. +            }
  84. +
  85. +            switch(pCreature->GetEntry())
  86. +            {
  87. +               case BOSS_CORBORUS:
  88. +                   uiCorborus = pCreature->GetGUID();
  89. +                   break;
  90. +               case BOSS_SLABHIDE:
  91. +                   uiSlabhide = pCreature->GetGUID();
  92. +                   break;
  93. +               case BOSS_OZRUK:
  94. +                   uiOzruk = pCreature->GetGUID();
  95. +                   break;
  96. +               case BOSS_HIGH_PRIESTESS_AZIL:
  97. +                   uiHighPriestessAzil = pCreature->GetGUID();
  98. +                   break;
  99. +            }
  100. +        }
  101. +
  102. +        uint64 GetData64(uint32 identifier)
  103. +        {
  104. +            switch(identifier)
  105. +            {
  106. +               case DATA_CORBORUS:                 return uiCorborus;
  107. +               case DATA_SLABHIDE:                 return uiSlabhide;
  108. +               case DATA_OZRUK:                    return uiOzruk;
  109. +               case DATA_HIGH_PRIESTESS_AZIL:      return uiHighPriestessAzil;
  110. +            }
  111. +
  112. +            return 0;
  113. +        }
  114. +
  115. +        void SetData(uint32 type, uint32 data)
  116. +        {
  117. +            switch(type)
  118. +            {
  119. +               case DATA_CORBORUS_EVENT:
  120. +                    uiEncounter[0] = data;
  121. +                    break;
  122. +               case DATA_SLABHIDE_EVENT:
  123. +                    uiEncounter[1] = data;
  124. +                    break;
  125. +               case DATA_OZRUK_EVENT:
  126. +                    uiEncounter[2] = data;
  127. +                    break;
  128. +               case DATA_HIGH_PRIESTESS_AZIL_EVENT:
  129. +                    uiEncounter[3] = data;
  130. +                    break;
  131. +            }
  132. +
  133. +            if (data == DONE)
  134. +                SaveToDB();
  135. +        }
  136. +
  137. +        uint32 GetData(uint32 type)
  138. +        {
  139. +            switch(type)
  140. +            {
  141. +               case DATA_CORBORUS_EVENT:               return uiEncounter[0];
  142. +               case DATA_SLABHIDE_EVENT:               return uiEncounter[1];
  143. +               case DATA_OZRUK_EVENT:                  return uiEncounter[2];
  144. +               case DATA_HIGH_PRIESTESS_AZIL_EVENT:    return uiEncounter[3];
  145. +            }
  146. +
  147. +            return 0;
  148. +        }
  149. +
  150. +        std::string GetSaveData()
  151. +        {
  152. +            OUT_SAVE_INST_DATA;
  153. +
  154. +            std::string str_data;
  155. +
  156. +            std::ostringstream saveStream;
  157. +            saveStream << "P S " << uiEncounter[0] << " " << uiEncounter[1]  << " " << uiEncounter[2]  << " " << uiEncounter[3];
  158. +
  159. +            str_data = saveStream.str();
  160. +
  161. +            OUT_SAVE_INST_DATA_COMPLETE;
  162. +            return str_data;
  163. +        }
  164. +
  165. +        void Load(const char* in)
  166. +        {
  167. +            if (!in)
  168. +            {
  169. +                OUT_LOAD_INST_DATA_FAIL;
  170. +                return;
  171. +            }
  172. +
  173. +            OUT_LOAD_INST_DATA(in);
  174. +
  175. +            char dataHead1, dataHead2;
  176. +            uint16 data0, data1, data2, data3;
  177. +
  178. +            std::istringstream loadStream(in);
  179. +            loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3;
  180. +
  181. +            if (dataHead1 == 'P' && dataHead2 == 'S')
  182. +            {
  183. +                uiEncounter[0] = data0;
  184. +                uiEncounter[1] = data1;
  185. +                uiEncounter[2] = data2;
  186. +                uiEncounter[3] = data3;
  187. +
  188. +                for (uint8 i = 0; i < MAX_ENCOUNTER; ++i)
  189. +                    if (uiEncounter[i] == IN_PROGRESS)
  190. +                        uiEncounter[i] = NOT_STARTED;
  191. +
  192. +            } else OUT_LOAD_INST_DATA_FAIL;
  193. +
  194. +            OUT_LOAD_INST_DATA_COMPLETE;
  195. +        }
  196. +    };
  197. +
  198. +};
  199. +
  200. +
  201. +void AddSC_instance_the_stonecore()
  202. +{
  203. +    new instance_the_stonecore();
  204. +}
  205. diff --git a/src/server/scripts/EasternKingdoms/TheStonecore/the_stonecore.cpp b/src/server/scripts/EasternKingdoms/TheStonecore/the_stonecore.cpp
  206. new file mode 100644
  207. index 0000000..808a7b1
  208. --- /dev/null
  209. +++ b/src/server/scripts/EasternKingdoms/TheStonecore/the_stonecore.cpp
  210. @@ -0,0 +1,209 @@
  211. +/*
  212. + * Copyright (C) 2010-2011
  213. + * Author: Jakub "lobuz" Trojanowski
  214. + * email: lobuz87@gmail.com
  215. + */
  216. +
  217. +#include "ScriptPCH.h"
  218. +#include "the_stonecore.h"
  219. +
  220. +/***************************************TRASH SPELLS*************************************/
  221. +// Crystalspawn Giant (42810) Health: 536,810 - 1,202,925
  222. +#define SPELL_QUAKE                      DUNGEON_MODE(81008,92631)
  223. +
  224. +// IMP (43014) Health: 4,468 - 7,749, Mana: 16,676 - 17,816
  225. +#define SPELL_FELL_FIREBALL                 DUNGEON_MODE(80344,92638)
  226. +
  227. +// Millhouse Manastorm (43391) Health: 386,505 - 513,248, Mana: 186,560 - 197,380
  228. +#define SPELL_BLUR                      81216
  229. +#define SPELL_FEAR                      81442
  230. +#define SPELL_FROSTBOLT_VOLLEY          DUNGEON_MODE(81440,92642)
  231. +#define SPELL_IMPENDING_DOOM            86830
  232. +#define SPELL_SHADOW_BOLT               DUNGEON_MODE(81439,92641)
  233. +#define SPELL_SHADOWFURY                DUNGEON_MODE(81441,92644)
  234. +#define SPELL_TIGULE                    81220
  235. +
  236. +// Rock Borer (43917,42845) Health: 6,702 - 11,624
  237. +#define SPELL_ROCK_BORE                     DUNGEON_MODE(80028,92630)
  238. +
  239. +// Stonecore Berserker (43430) Health: 312,753 - 387,450
  240. +#define SPELL_SCHARGE                   81574
  241. +#define SPELL_SPINNING_SLASH            81568
  242. +
  243. +// Stonecore Bruiser (42692) Health: 590,491 - 1,202,925
  244. +#define SPELL_BODY_SLAM                     80180
  245. +#define SPELL_SHOCKWAVE                     DUNGEON_MODE(80195,92640)
  246. +
  247. +// Stonecore Earthshaper (43537) Health: 250,201 - 309,960, Mana: 19,394
  248. +#define SPELL_DUST_STORM                81463
  249. +#define SPELL_FORCE_OF_EARTH            81459
  250. +#define SPELL_GROUND_SHOCK              DUNGEON_MODE(81530,92628)
  251. +#define SPELL_LAVA_BURST                DUNGEON_MODE(81576,92626)
  252. +
  253. +// Stonecore Flayer (42808) Health: 312,753 - 387,450
  254. +#define SPELL_FLAY                      79922
  255. +
  256. +// Stonecore Magmalord (42789) Health: 312,753 - 387,450, Mana: 25,014 - 26,724
  257. +#define SPELL_IGNITE                    DUNGEON_MODE(80151,92636)
  258. +#define SPELL_MAGMA_ERUPTION            80038
  259. +
  260. +// Stonecore Rift Conjurer (42691) Health: 312,753 - 387,450, Mana: 16,676 - 17,816
  261. +#define SPELL_DEMON_PORTAL              80308
  262. +#define SPELL_SHADOWBOLT                DUNGEON_MODE(80279,92637)
  263. +
  264. +//Stonecore Sentry (42695) Health: 6,702 - 11,624
  265. +// BIEGA ZA CREAPAMI I PRZYWOLUJE DO TARGETA
  266. +
  267. +// Stonecore Warbringer (42696) Health: 312,753 - 387,450
  268. +#define SPELL_CLAVE                         15496
  269. +#define SPELL_RAGE                      80158
  270. +
  271. +enum eEvents
  272. +{
  273. +    EVENT_NONE,
  274. +    EVENT_QUAKE,
  275. +    EVENT_FELL_FIREBALL,
  276. +    EVENT_BLUR,
  277. +    EVENT_FEAR,
  278. +    EVENT_FROSTBOLT_VOLLEY,
  279. +    EVENT_IMPENDING_DOOM,
  280. +    EVENT_SHADOW_BOLT,
  281. +    EVENT_SHADOWFURY,
  282. +    EVENT_TIGULE,
  283. +    EVENT_ROCK_BORE,
  284. +    EVENT_SCHARGE,
  285. +    EVENT_SPINNING_SLASH,
  286. +    EVENT_BODY_SLAM,
  287. +    EVENT_SHOCKWAVE,
  288. +    EVENT_DUST_STORM,
  289. +    EVENT_FORCE_OF_EARTH,
  290. +    EVENT_GROUND_SHOCK,
  291. +    EVENT_LAVA_BURST,
  292. +    EVENT_FLAY,
  293. +    EVENT_IGNITE,
  294. +    EVENT_MAGMA_ERUPTION,
  295. +    EVENT_DEMON_PORTAL,
  296. +    EVENT_SHADOWBOLT,
  297. +    EVENT_CLAVE,
  298. +    EVENT_RAGE,
  299. +};
  300. +
  301. +// Crystalspawn Giant (42810) AI
  302. +class mob_crystalspawn_giant : public CreatureScript
  303. +{
  304. +public:
  305. +    mob_crystalspawn_giant() : CreatureScript("mob_crystalspawn_giant") { }
  306. +
  307. +    CreatureAI* GetAI(Creature* pCreature) const
  308. +    {
  309. +        return new mob_crystalspawn_giantAI(pCreature);
  310. +    }
  311. +
  312. +    struct mob_crystalspawn_giantAI : public ScriptedAI
  313. +    {
  314. +        mob_crystalspawn_giantAI(Creature *c) : ScriptedAI(c)
  315. +        {
  316. +        }
  317. +
  318. +        EventMap events;
  319. +
  320. +        void Reset()
  321. +        {
  322. +            events.Reset();
  323. +        }
  324. +
  325. +        void EnterCombat(Unit* /*who*/)
  326. +        {
  327. +            events.ScheduleEvent(EVENT_QUAKE, 5000);
  328. +        }
  329. +
  330. +        void UpdateAI(const uint32 diff)
  331. +        {
  332. +            if (!UpdateVictim())
  333. +                return;
  334. +
  335. +            events.Update(diff);
  336. +
  337. +            if (me->hasUnitState(UNIT_STAT_CASTING))
  338. +                return;
  339. +
  340. +            while (uint32 eventId = events.ExecuteEvent())
  341. +            {
  342. +                switch(eventId)
  343. +                {
  344. +                    case EVENT_QUAKE:
  345. +                       DoCast(me->getVictim(), SPELL_QUAKE);
  346. +                        events.RescheduleEvent(EVENT_QUAKE, 7000);
  347. +                        return;
  348. +                }
  349. +            }
  350. +
  351. +            DoMeleeAttackIfReady();
  352. +        }
  353. +    };
  354. +
  355. +};
  356. +
  357. +// Imp (43014)
  358. +class mob_impp : public CreatureScript
  359. +{
  360. +public:
  361. +    mob_impp() : CreatureScript("mob_impp") { }
  362. +
  363. +    CreatureAI* GetAI(Creature* pCreature) const
  364. +    {
  365. +        return new mob_imppAI(pCreature);
  366. +    }
  367. +
  368. +    struct mob_imppAI : public ScriptedAI
  369. +    {
  370. +        mob_imppAI(Creature *c) : ScriptedAI(c)
  371. +        {
  372. +        }
  373. +
  374. +        EventMap events;
  375. +
  376. +        void Reset()
  377. +        {
  378. +            events.Reset();
  379. +        }
  380. +
  381. +        void EnterCombat(Unit* /*who*/)
  382. +        {
  383. +            events.ScheduleEvent(EVENT_FELL_FIREBALL, 1000);
  384. +        }
  385. +
  386. +        void UpdateAI(const uint32 diff)
  387. +        {
  388. +            if (!UpdateVictim())
  389. +                return;
  390. +
  391. +            events.Update(diff);
  392. +
  393. +            if (me->hasUnitState(UNIT_STAT_CASTING))
  394. +                return;
  395. +
  396. +            while (uint32 eventId = events.ExecuteEvent())
  397. +            {
  398. +                switch(eventId)
  399. +                {
  400. +                    case EVENT_FELL_FIREBALL:
  401. +                        if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0))
  402. +                            DoCast(pTarget, SPELL_FELL_FIREBALL);
  403. +                        events.RescheduleEvent(EVENT_FELL_FIREBALL, 1000);
  404. +                        return;
  405. +                }
  406. +            }
  407. +
  408. +            DoMeleeAttackIfReady();
  409. +        }
  410. +    };
  411. +
  412. +};
  413. +
  414. +void AddSC_the_stonecore()
  415. +{
  416. +   new mob_crystalspawn_giant();
  417. +    new mob_impp();
  418. +
  419. +}
  420. \ No newline at end of file
  421. diff --git a/src/server/scripts/EasternKingdoms/TheStonecore/the_stonecore.h b/src/server/scripts/EasternKingdoms/TheStonecore/the_stonecore.h
  422. new file mode 100644
  423. index 0000000..5a033b0
  424. --- /dev/null
  425. +++ b/src/server/scripts/EasternKingdoms/TheStonecore/the_stonecore.h
  426. @@ -0,0 +1,51 @@
  427. +/*
  428. + * Copyright (C) 2010-2011
  429. + * Author: Jakub "lobuz" Trojanowski
  430. + * email: lobuz87@gmail.com
  431. + */
  432. +
  433. +#ifndef DEF_THE_STONECORE_H
  434. +#define DEF_THE_STONECORE_H
  435. +
  436. +enum Data
  437. +{
  438. +    DATA_CORBORUS_EVENT,
  439. +    DATA_SLABHIDE_EVENT,
  440. +    DATA_OZRUK_EVENT,
  441. +   DATA_HIGH_PRIESTESS_AZIL_EVENT,
  442. +   DATA_TEAM_IN_INSTANCE,
  443. +};
  444. +
  445. +enum Data64
  446. +{
  447. +    DATA_CORBORUS,
  448. +    DATA_SLABHIDE,
  449. +    DATA_OZRUK,
  450. +   DATA_HIGH_PRIESTESS_AZIL,
  451. +};
  452. +
  453. +enum Creatures
  454. +{
  455. +   // Boss
  456. +   BOSS_CORBORUS                                       = 43438,
  457. +   BOSS_SLABHIDE                                       = 43214,
  458. +   BOSS_OZRUK                                          = 42188,
  459. +   BOSS_HIGH_PRIESTESS_AZIL                            = 42333,
  460. +
  461. +   // Trash npc
  462. +    CREATURE_CRYSTALSPAWN_GIANT                         = 42810,
  463. +   CREATURE_IMP                                        = 43014,
  464. +   CREATURE_MILLHOUSE_MANASTORM                        = 43391,
  465. +   CREATURE_ROCK_BORER                                 = 43917,
  466. +   CREATURE_ROCK_BORER2                                = 42845,
  467. +   CREATURE_STONECORE_BERSERKER                        = 43430,
  468. +   CREATURE_STONECORE_BRUISER                          = 42692,
  469. +   CREATURE_STONECORE_EARTHSHAPER                      = 43537,
  470. +   CREATURE_STONECORE_FLAYER                           = 42808,
  471. +   CREATURE_MAGMALORD                                  = 42789,
  472. +   CREATURE_RIFT_CONJURER                              = 42691,
  473. +   CREATURE_STONECORE_SENTRY                           = 42695,
  474. +   CREATURE_STONECORE_WARBRINGER                       = 42696,
  475. +};
  476. +
  477. +#endif
  478. \ No newline at end of file
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement