mirror of
https://github.com/mangosfour/server.git
synced 2025-12-31 22:37:05 +00:00
[SD3] first commit with SD3 inplace - not complete yet
This commit is contained in:
parent
35415eb738
commit
afc2df2f7d
603 changed files with 222771 additions and 1729 deletions
|
|
@ -0,0 +1,165 @@
|
|||
/**
|
||||
* ScriptDev3 is an extension for mangos providing enhanced features for
|
||||
* area triggers, creatures, game objects, instances, items, and spells beyond
|
||||
* the default database scripting in mangos.
|
||||
*
|
||||
* Copyright (C) 2006-2013 ScriptDev2 <http://www.scriptdev2.com/>
|
||||
* Copyright (C) 2014-2016 MaNGOS <https://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* World of Warcraft, and all World of Warcraft or Warcraft art, images,
|
||||
* and lore are copyrighted by Blizzard Entertainment, Inc.
|
||||
*/
|
||||
|
||||
/**
|
||||
* ScriptData
|
||||
* SDName: Boss_Darkmaster_Gandling
|
||||
* SD%Complete: 100
|
||||
* SDComment: None
|
||||
* SDCategory: Scholomance
|
||||
* EndScriptData
|
||||
*/
|
||||
|
||||
#include "precompiled.h"
|
||||
#include "scholomance.h"
|
||||
|
||||
enum
|
||||
{
|
||||
SPELL_ARCANE_MISSILES = 15790,
|
||||
SPELL_SHADOW_SHIELD = 12040,
|
||||
SPELL_CURSE = 18702,
|
||||
SPELL_SHADOW_PORTAL = 17950
|
||||
};
|
||||
|
||||
struct boss_darkmaster_gandling : public CreatureScript
|
||||
{
|
||||
boss_darkmaster_gandling() : CreatureScript("boss_darkmaster_gandling") {}
|
||||
|
||||
struct boss_darkmaster_gandlingAI : public ScriptedAI
|
||||
{
|
||||
boss_darkmaster_gandlingAI(Creature* pCreature) : ScriptedAI(pCreature)
|
||||
{
|
||||
m_pInstance = (ScriptedInstance*)pCreature->GetInstanceData();
|
||||
}
|
||||
|
||||
ScriptedInstance* m_pInstance;
|
||||
|
||||
uint32 m_uiArcaneMissilesTimer;
|
||||
uint32 m_uiShadowShieldTimer;
|
||||
uint32 m_uiCurseTimer;
|
||||
uint32 m_uiTeleportTimer;
|
||||
|
||||
void Reset() override
|
||||
{
|
||||
m_uiArcaneMissilesTimer = 4500;
|
||||
m_uiShadowShieldTimer = 12000;
|
||||
m_uiCurseTimer = 2000;
|
||||
m_uiTeleportTimer = 16000;
|
||||
}
|
||||
|
||||
void UpdateAI(const uint32 uiDiff) override
|
||||
{
|
||||
if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Arcane Missiles Timer
|
||||
if (m_uiArcaneMissilesTimer < uiDiff)
|
||||
{
|
||||
if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_ARCANE_MISSILES) == CAST_OK)
|
||||
{
|
||||
m_uiArcaneMissilesTimer = 8000;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_uiArcaneMissilesTimer -= uiDiff;
|
||||
}
|
||||
|
||||
// Shadow Shield Timer
|
||||
if (m_uiShadowShieldTimer < uiDiff)
|
||||
{
|
||||
if (DoCastSpellIfCan(m_creature, SPELL_SHADOW_SHIELD) == CAST_OK)
|
||||
{
|
||||
m_uiShadowShieldTimer = urand(14000, 28000);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_uiShadowShieldTimer -= uiDiff;
|
||||
}
|
||||
|
||||
// Curse Timer
|
||||
if (m_uiCurseTimer < uiDiff)
|
||||
{
|
||||
if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_CURSE) == CAST_OK)
|
||||
{
|
||||
m_uiCurseTimer = urand(15000, 27000);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_uiCurseTimer -= uiDiff;
|
||||
}
|
||||
|
||||
// Teleporting Random Target to one of the six pre boss rooms and spawn 3-4 skeletons near the gamer.
|
||||
// We will only telport if gandling has more than 3% of hp so teleported gamers can always loot.
|
||||
if (m_creature->GetHealthPercent() > 3.0f)
|
||||
{
|
||||
if (m_uiTeleportTimer < uiDiff)
|
||||
{
|
||||
if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0, SPELL_SHADOW_PORTAL, SELECT_FLAG_PLAYER))
|
||||
{
|
||||
if (DoCastSpellIfCan(pTarget, SPELL_SHADOW_PORTAL) == CAST_OK)
|
||||
{
|
||||
// remove threat
|
||||
if (m_creature->GetThreatManager().getThreat(pTarget))
|
||||
{
|
||||
m_creature->GetThreatManager().modifyThreatPercent(pTarget, -100);
|
||||
}
|
||||
|
||||
m_uiTeleportTimer = urand(20000, 35000);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_uiTeleportTimer -= uiDiff;
|
||||
}
|
||||
}
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* pCreature) override
|
||||
{
|
||||
return new boss_darkmaster_gandlingAI(pCreature);
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_boss_darkmaster_gandling()
|
||||
{
|
||||
Script *s;
|
||||
s = new boss_darkmaster_gandling();
|
||||
s->RegisterSelf();
|
||||
|
||||
//pNewScript = new Script;
|
||||
//pNewScript->Name = "boss_darkmaster_gandling";
|
||||
//pNewScript->GetAI = &GetAI_boss_darkmaster_gandling;
|
||||
//pNewScript->RegisterSelf();
|
||||
}
|
||||
|
|
@ -0,0 +1,144 @@
|
|||
/**
|
||||
* ScriptDev3 is an extension for mangos providing enhanced features for
|
||||
* area triggers, creatures, game objects, instances, items, and spells beyond
|
||||
* the default database scripting in mangos.
|
||||
*
|
||||
* Copyright (C) 2006-2013 ScriptDev2 <http://www.scriptdev2.com/>
|
||||
* Copyright (C) 2014-2016 MaNGOS <https://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* World of Warcraft, and all World of Warcraft or Warcraft art, images,
|
||||
* and lore are copyrighted by Blizzard Entertainment, Inc.
|
||||
*/
|
||||
|
||||
/**
|
||||
* ScriptData
|
||||
* SDName: Boss_jandicebarov
|
||||
* SD%Complete: 100
|
||||
* SDComment: None
|
||||
* SDCategory: Scholomance
|
||||
* EndScriptData
|
||||
*/
|
||||
|
||||
#include "precompiled.h"
|
||||
|
||||
enum
|
||||
{
|
||||
SPELL_CURSE_OF_BLOOD = 16098,
|
||||
SPELL_SUMMON_ILLUSIONS = 17773,
|
||||
SPELL_BANISH = 8994,
|
||||
};
|
||||
|
||||
struct boss_jandicebarov : public CreatureScript
|
||||
{
|
||||
boss_jandicebarov() : CreatureScript("boss_jandice_barov") {}
|
||||
|
||||
struct boss_jandicebarovAI : public ScriptedAI
|
||||
{
|
||||
boss_jandicebarovAI(Creature* pCreature) : ScriptedAI(pCreature) { Reset(); }
|
||||
|
||||
uint32 m_uiCurseOfBloodTimer;
|
||||
uint32 m_uiIllusionTimer;
|
||||
uint32 m_uiBanishTimer;
|
||||
|
||||
void Reset() override
|
||||
{
|
||||
m_uiCurseOfBloodTimer = 5000;
|
||||
m_uiIllusionTimer = 15000;
|
||||
m_uiBanishTimer = urand(9000, 13000);
|
||||
}
|
||||
|
||||
void JustSummoned(Creature* pSummoned) override
|
||||
{
|
||||
pSummoned->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_MAGIC, true);
|
||||
|
||||
if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
|
||||
{
|
||||
pSummoned->AI()->AttackStart(pTarget);
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateAI(const uint32 uiDiff) override
|
||||
{
|
||||
// Return since we have no target
|
||||
if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// CurseOfBlood_Timer
|
||||
if (m_uiCurseOfBloodTimer < uiDiff)
|
||||
{
|
||||
if (DoCastSpellIfCan(m_creature, SPELL_CURSE_OF_BLOOD) == CAST_OK)
|
||||
{
|
||||
m_uiCurseOfBloodTimer = urand(30000, 35000);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_uiCurseOfBloodTimer -= uiDiff;
|
||||
}
|
||||
|
||||
// Banish
|
||||
if (m_uiBanishTimer < uiDiff)
|
||||
{
|
||||
if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 1))
|
||||
{
|
||||
if (DoCastSpellIfCan(pTarget, SPELL_BANISH) == CAST_OK)
|
||||
{
|
||||
m_uiBanishTimer = urand(17000, 21000);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_uiBanishTimer -= uiDiff;
|
||||
}
|
||||
|
||||
// Illusion_Timer
|
||||
if (m_uiIllusionTimer < uiDiff)
|
||||
{
|
||||
if (DoCastSpellIfCan(m_creature, SPELL_SUMMON_ILLUSIONS) == CAST_OK)
|
||||
{
|
||||
m_uiIllusionTimer = 25000;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_uiIllusionTimer -= uiDiff;
|
||||
}
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* pCreature) override
|
||||
{
|
||||
return new boss_jandicebarovAI(pCreature);
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_boss_jandicebarov()
|
||||
{
|
||||
Script *s;
|
||||
s = new boss_jandicebarov();
|
||||
s->RegisterSelf();
|
||||
|
||||
//pNewScript = new Script;
|
||||
//pNewScript->Name = "boss_jandice_barov";
|
||||
//pNewScript->GetAI = &GetAI_boss_jandicebarov;
|
||||
//pNewScript->RegisterSelf();
|
||||
}
|
||||
|
|
@ -0,0 +1,526 @@
|
|||
/**
|
||||
* ScriptDev3 is an extension for mangos providing enhanced features for
|
||||
* area triggers, creatures, game objects, instances, items, and spells beyond
|
||||
* the default database scripting in mangos.
|
||||
*
|
||||
* Copyright (C) 2006-2013 ScriptDev2 <http://www.scriptdev2.com/>
|
||||
* Copyright (C) 2014-2016 MaNGOS <https://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* World of Warcraft, and all World of Warcraft or Warcraft art, images,
|
||||
* and lore are copyrighted by Blizzard Entertainment, Inc.
|
||||
*/
|
||||
|
||||
/**
|
||||
* ScriptData
|
||||
* SDName: Instance_Scholomance
|
||||
* SD%Complete: 99
|
||||
* SDComment: Possible some D2 or other exotic missing
|
||||
* SDCategory: Scholomance
|
||||
* EndScriptData
|
||||
*/
|
||||
|
||||
#include "precompiled.h"
|
||||
#include "scholomance.h"
|
||||
|
||||
struct is_scholomance : public InstanceScript
|
||||
{
|
||||
is_scholomance() : InstanceScript("instance_scholomance") {}
|
||||
|
||||
class instance_scholomance : public ScriptedInstance
|
||||
{
|
||||
public:
|
||||
instance_scholomance(Map* pMap) : ScriptedInstance(pMap),
|
||||
m_uiGandlingEvent(0)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
~instance_scholomance() {}
|
||||
|
||||
void Initialize() override
|
||||
{
|
||||
memset(&m_auiEncounter, 0, sizeof(m_auiEncounter));
|
||||
|
||||
for (uint8 i = 0; i < MAX_EVENTS; ++i)
|
||||
{
|
||||
m_mGandlingData[aGandlingEvents[i]] = GandlingEventData();
|
||||
}
|
||||
}
|
||||
|
||||
void OnCreatureEnterCombat(Creature* pCreature) override
|
||||
{
|
||||
switch (pCreature->GetEntry())
|
||||
{
|
||||
case NPC_KIRTONOS:
|
||||
SetData(TYPE_KIRTONOS, IN_PROGRESS);
|
||||
break;
|
||||
case NPC_RATTLEGORE:
|
||||
SetData(TYPE_RATTLEGORE, IN_PROGRESS);
|
||||
break;
|
||||
case NPC_RAS_FROSTWHISPER:
|
||||
SetData(TYPE_RAS_FROSTWHISPER, IN_PROGRESS);
|
||||
break;
|
||||
case NPC_THEOLEN_KRASTINOV:
|
||||
SetData(TYPE_THEOLEN, IN_PROGRESS);
|
||||
break;
|
||||
case NPC_LOREKEEPER_POLKELT:
|
||||
SetData(TYPE_POLKELT, IN_PROGRESS);
|
||||
break;
|
||||
case NPC_RAVENIAN:
|
||||
SetData(TYPE_RAVENIAN, IN_PROGRESS);
|
||||
break;
|
||||
case NPC_ILLUCIA_BAROV:
|
||||
SetData(TYPE_ILLUCIA_BAROV, IN_PROGRESS);
|
||||
break;
|
||||
case NPC_ALEXEI_BAROV:
|
||||
SetData(TYPE_ALEXEI_BAROV, IN_PROGRESS);
|
||||
break;
|
||||
case NPC_INSTRUCTOR_MALICIA:
|
||||
SetData(TYPE_MALICIA, IN_PROGRESS);
|
||||
break;
|
||||
case NPC_DARKMASTER_GANDLING:
|
||||
SetData(TYPE_GANDLING, IN_PROGRESS);
|
||||
break;
|
||||
|
||||
case NPC_BONE_MINION:
|
||||
for (GandlingEventMap::iterator itr = m_mGandlingData.begin(); itr != m_mGandlingData.end(); ++itr)
|
||||
{
|
||||
// if there are no minions for a room, skip it
|
||||
if (!itr->second.m_sAddGuids.empty())
|
||||
{
|
||||
// set data to fail in case of player death
|
||||
if (itr->second.m_sAddGuids.find(pCreature->GetGUIDLow()) != itr->second.m_sAddGuids.end())
|
||||
{
|
||||
HandlePortalEvent(itr->first, IN_PROGRESS);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void OnCreatureEvade(Creature* pCreature) override
|
||||
{
|
||||
switch (pCreature->GetEntry())
|
||||
{
|
||||
case NPC_KIRTONOS:
|
||||
SetData(TYPE_KIRTONOS, FAIL);
|
||||
break;
|
||||
case NPC_RATTLEGORE:
|
||||
SetData(TYPE_RATTLEGORE, FAIL);
|
||||
break;
|
||||
case NPC_RAS_FROSTWHISPER:
|
||||
SetData(TYPE_RAS_FROSTWHISPER, FAIL);
|
||||
break;
|
||||
case NPC_THEOLEN_KRASTINOV:
|
||||
SetData(TYPE_THEOLEN, FAIL);
|
||||
break;
|
||||
case NPC_LOREKEEPER_POLKELT:
|
||||
SetData(TYPE_POLKELT, FAIL);
|
||||
break;
|
||||
case NPC_RAVENIAN:
|
||||
SetData(TYPE_RAVENIAN, FAIL);
|
||||
break;
|
||||
case NPC_ILLUCIA_BAROV:
|
||||
SetData(TYPE_ILLUCIA_BAROV, FAIL);
|
||||
break;
|
||||
case NPC_ALEXEI_BAROV:
|
||||
SetData(TYPE_ALEXEI_BAROV, FAIL);
|
||||
break;
|
||||
case NPC_INSTRUCTOR_MALICIA:
|
||||
SetData(TYPE_MALICIA, FAIL);
|
||||
break;
|
||||
case NPC_DARKMASTER_GANDLING:
|
||||
SetData(TYPE_GANDLING, FAIL);
|
||||
break;
|
||||
|
||||
case NPC_BONE_MINION:
|
||||
for (GandlingEventMap::iterator itr = m_mGandlingData.begin(); itr != m_mGandlingData.end(); ++itr)
|
||||
{
|
||||
// if there are no minions for a room, skip it
|
||||
if (!itr->second.m_sAddGuids.empty())
|
||||
{
|
||||
// set data to fail in case of player death
|
||||
if (itr->second.m_sAddGuids.find(pCreature->GetGUIDLow()) != itr->second.m_sAddGuids.end())
|
||||
{
|
||||
HandlePortalEvent(itr->first, FAIL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void OnCreatureDeath(Creature* pCreature) override
|
||||
{
|
||||
switch (pCreature->GetEntry())
|
||||
{
|
||||
case NPC_KIRTONOS:
|
||||
SetData(TYPE_KIRTONOS, DONE);
|
||||
break;
|
||||
case NPC_RATTLEGORE:
|
||||
SetData(TYPE_RATTLEGORE, DONE);
|
||||
break;
|
||||
case NPC_RAS_FROSTWHISPER:
|
||||
SetData(TYPE_RAS_FROSTWHISPER, DONE);
|
||||
break;
|
||||
case NPC_THEOLEN_KRASTINOV:
|
||||
SetData(TYPE_THEOLEN, DONE);
|
||||
break;
|
||||
case NPC_LOREKEEPER_POLKELT:
|
||||
SetData(TYPE_POLKELT, DONE);
|
||||
break;
|
||||
case NPC_RAVENIAN:
|
||||
SetData(TYPE_RAVENIAN, DONE);
|
||||
break;
|
||||
case NPC_ILLUCIA_BAROV:
|
||||
SetData(TYPE_ILLUCIA_BAROV, DONE);
|
||||
break;
|
||||
case NPC_ALEXEI_BAROV:
|
||||
SetData(TYPE_ALEXEI_BAROV, DONE);
|
||||
break;
|
||||
case NPC_INSTRUCTOR_MALICIA:
|
||||
SetData(TYPE_MALICIA, DONE);
|
||||
break;
|
||||
case NPC_DARKMASTER_GANDLING:
|
||||
SetData(TYPE_GANDLING, DONE);
|
||||
break;
|
||||
|
||||
case NPC_BONE_MINION:
|
||||
for (GandlingEventMap::iterator itr = m_mGandlingData.begin(); itr != m_mGandlingData.end(); ++itr)
|
||||
{
|
||||
// if there are no minions for a room, skip it
|
||||
if (!itr->second.m_sAddGuids.empty())
|
||||
{
|
||||
// search for the dead minion and erase it
|
||||
if (itr->second.m_sAddGuids.find(pCreature->GetGUIDLow()) != itr->second.m_sAddGuids.end())
|
||||
{
|
||||
itr->second.m_sAddGuids.erase(pCreature->GetGUIDLow());
|
||||
|
||||
// if the current list is empty; set event id as done
|
||||
if (itr->second.m_sAddGuids.empty())
|
||||
{
|
||||
HandlePortalEvent(itr->first, DONE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void OnCreatureCreate(Creature* pCreature) override
|
||||
{
|
||||
switch (pCreature->GetEntry())
|
||||
{
|
||||
case NPC_DARKMASTER_GANDLING:
|
||||
m_mNpcEntryGuidStore[NPC_DARKMASTER_GANDLING] = pCreature->GetObjectGuid();
|
||||
break;
|
||||
case NPC_BONE_MINION:
|
||||
GandlingEventMap::iterator find = m_mGandlingData.find(m_uiGandlingEvent);
|
||||
if (find != m_mGandlingData.end())
|
||||
{
|
||||
find->second.m_sAddGuids.insert(pCreature->GetGUIDLow());
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void OnObjectCreate(GameObject* pGo) override
|
||||
{
|
||||
switch (pGo->GetEntry())
|
||||
{
|
||||
case GO_GATE_KIRTONOS:
|
||||
case GO_GATE_RAS:
|
||||
case GO_GATE_GANDLING:
|
||||
m_mGoEntryGuidStore[pGo->GetEntry()] = pGo->GetObjectGuid();
|
||||
break;
|
||||
|
||||
case GO_GATE_MALICIA:
|
||||
m_mGandlingData[EVENT_ID_MALICIA].m_doorGuid = pGo->GetObjectGuid();
|
||||
break;
|
||||
case GO_GATE_THEOLEN:
|
||||
m_mGandlingData[EVENT_ID_THEOLEN].m_doorGuid = pGo->GetObjectGuid();
|
||||
break;
|
||||
case GO_GATE_POLKELT:
|
||||
m_mGandlingData[EVENT_ID_POLKELT].m_doorGuid = pGo->GetObjectGuid();
|
||||
break;
|
||||
case GO_GATE_RAVENIAN:
|
||||
m_mGandlingData[EVENT_ID_RAVENIAN].m_doorGuid = pGo->GetObjectGuid();
|
||||
break;
|
||||
case GO_GATE_BAROV:
|
||||
m_mGandlingData[EVENT_ID_BAROV].m_doorGuid = pGo->GetObjectGuid();
|
||||
break;
|
||||
case GO_GATE_ILLUCIA:
|
||||
m_mGandlingData[EVENT_ID_ILLUCIA].m_doorGuid = pGo->GetObjectGuid();
|
||||
break;
|
||||
|
||||
case GO_VIEWING_ROOM_DOOR:
|
||||
// In normal flow of the instance, this door is opened by a dropped key
|
||||
if (m_auiEncounter[TYPE_RATTLEGORE] == DONE)
|
||||
{
|
||||
pGo->SetGoState(GO_STATE_ACTIVE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void OnPlayerEnter(Player* /*pPlayer*/) override
|
||||
{
|
||||
// Summon Gandling if can
|
||||
DoSpawnGandlingIfCan(true);
|
||||
}
|
||||
|
||||
|
||||
void SetData(uint32 uiType, uint32 uiData) override
|
||||
{
|
||||
switch (uiType)
|
||||
{
|
||||
case TYPE_KIRTONOS:
|
||||
// This door is initially closed by DB-scripts, so only use it in case of FAIL, DONE, or on aggro after wipe
|
||||
if (m_auiEncounter[uiType] != FAIL && uiData == IN_PROGRESS)
|
||||
{
|
||||
return;
|
||||
}
|
||||
m_auiEncounter[uiType] = uiData;
|
||||
DoUseDoorOrButton(GO_GATE_KIRTONOS);
|
||||
break;
|
||||
case TYPE_RATTLEGORE:
|
||||
m_auiEncounter[uiType] = uiData;
|
||||
break;
|
||||
case TYPE_RAS_FROSTWHISPER:
|
||||
m_auiEncounter[uiType] = uiData;
|
||||
DoUseDoorOrButton(GO_GATE_RAS);
|
||||
break;
|
||||
case TYPE_MALICIA: // TODO this code can be simplified, when it is known which event-ids correspond to which room
|
||||
m_auiEncounter[uiType] = uiData;
|
||||
DoUseDoorOrButton(m_mGandlingData[EVENT_ID_MALICIA].m_doorGuid);
|
||||
break;
|
||||
case TYPE_THEOLEN:
|
||||
m_auiEncounter[uiType] = uiData;
|
||||
DoUseDoorOrButton(m_mGandlingData[EVENT_ID_THEOLEN].m_doorGuid);
|
||||
break;
|
||||
case TYPE_POLKELT:
|
||||
m_auiEncounter[uiType] = uiData;
|
||||
DoUseDoorOrButton(m_mGandlingData[EVENT_ID_POLKELT].m_doorGuid);
|
||||
break;
|
||||
case TYPE_RAVENIAN:
|
||||
m_auiEncounter[uiType] = uiData;
|
||||
DoUseDoorOrButton(m_mGandlingData[EVENT_ID_RAVENIAN].m_doorGuid);
|
||||
break;
|
||||
case TYPE_ALEXEI_BAROV:
|
||||
m_auiEncounter[uiType] = uiData;
|
||||
DoUseDoorOrButton(m_mGandlingData[EVENT_ID_BAROV].m_doorGuid);
|
||||
break;
|
||||
case TYPE_ILLUCIA_BAROV:
|
||||
m_auiEncounter[uiType] = uiData;
|
||||
DoUseDoorOrButton(m_mGandlingData[EVENT_ID_ILLUCIA].m_doorGuid);
|
||||
break;
|
||||
case TYPE_GANDLING:
|
||||
m_auiEncounter[uiType] = uiData;
|
||||
// Close the door to main room, because the encounter will take place only in the main hall and random around all the 6 rooms
|
||||
DoUseDoorOrButton(GO_GATE_GANDLING);
|
||||
break;
|
||||
case TYPE_SIGNAL:
|
||||
HandlePortalEvent(uiData, SPECIAL);
|
||||
return;
|
||||
}
|
||||
|
||||
// Summon Gandling
|
||||
if (uiData == DONE)
|
||||
{
|
||||
DoSpawnGandlingIfCan(false);
|
||||
}
|
||||
|
||||
if (uiData == DONE)
|
||||
{
|
||||
OUT_SAVE_INST_DATA;
|
||||
|
||||
std::ostringstream saveStream;
|
||||
saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " "
|
||||
<< m_auiEncounter[3] << " " << m_auiEncounter[4] << " " << m_auiEncounter[5] << " "
|
||||
<< m_auiEncounter[6] << " " << m_auiEncounter[7] << " " << m_auiEncounter[8] << " " << m_auiEncounter[9];
|
||||
|
||||
m_strInstData = saveStream.str();
|
||||
|
||||
SaveToDB();
|
||||
OUT_SAVE_INST_DATA_COMPLETE;
|
||||
}
|
||||
}
|
||||
|
||||
uint32 GetData(uint32 uiType) const override
|
||||
{
|
||||
if (uiType < MAX_ENCOUNTER)
|
||||
{
|
||||
return m_auiEncounter[uiType];
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char* Save() const override { return m_strInstData.c_str(); }
|
||||
void Load(const char* chrIn) override
|
||||
{
|
||||
if (!chrIn)
|
||||
{
|
||||
OUT_LOAD_INST_DATA_FAIL;
|
||||
return;
|
||||
}
|
||||
|
||||
OUT_LOAD_INST_DATA(chrIn);
|
||||
|
||||
std::istringstream loadStream(chrIn);
|
||||
loadStream >> m_auiEncounter[0] >> m_auiEncounter[1] >> m_auiEncounter[2] >> m_auiEncounter[3] >> m_auiEncounter[4]
|
||||
>> m_auiEncounter[5] >> m_auiEncounter[6] >> m_auiEncounter[7] >> m_auiEncounter[8] >> m_auiEncounter[9];
|
||||
|
||||
for (uint8 i = 0; i < MAX_ENCOUNTER; ++i)
|
||||
if (m_auiEncounter[i] == IN_PROGRESS)
|
||||
{
|
||||
m_auiEncounter[i] = NOT_STARTED;
|
||||
}
|
||||
|
||||
OUT_LOAD_INST_DATA_COMPLETE;
|
||||
}
|
||||
|
||||
private:
|
||||
void HandlePortalEvent(uint32 uiEventId, uint32 uiData)
|
||||
{
|
||||
GandlingEventMap::iterator find = m_mGandlingData.find(uiEventId);
|
||||
if (find == m_mGandlingData.end())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (uiData == SPECIAL)
|
||||
{
|
||||
// Set current Event index
|
||||
m_uiGandlingEvent = uiEventId;
|
||||
|
||||
// Close door if needed
|
||||
if (!find->second.m_bIsActive)
|
||||
{
|
||||
find->second.m_bIsActive = true;
|
||||
DoUseDoorOrButton(find->second.m_doorGuid);
|
||||
}
|
||||
}
|
||||
// Toggle door and event state in case of state-switch
|
||||
else
|
||||
{
|
||||
if ((uiData == IN_PROGRESS && !find->second.m_bIsActive) ||
|
||||
(uiData == FAIL && find->second.m_bIsActive) ||
|
||||
(uiData == DONE && find->second.m_bIsActive))
|
||||
{
|
||||
find->second.m_bIsActive = !find->second.m_bIsActive;
|
||||
DoUseDoorOrButton(find->second.m_doorGuid);
|
||||
}
|
||||
}
|
||||
}
|
||||
void DoSpawnGandlingIfCan(bool bByPlayerEnter)
|
||||
{
|
||||
// Do not summon, if event finished
|
||||
if (m_auiEncounter[TYPE_GANDLING] == DONE)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Summon only once
|
||||
if (GetSingleCreatureFromStorage(NPC_DARKMASTER_GANDLING))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Player* pPlayer = GetPlayerInMap();
|
||||
if (!pPlayer)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if all the six bosses are done first
|
||||
if (m_auiEncounter[TYPE_MALICIA] == DONE && m_auiEncounter[TYPE_THEOLEN] == DONE && m_auiEncounter[TYPE_POLKELT] == DONE &&
|
||||
m_auiEncounter[TYPE_RAVENIAN] == DONE && m_auiEncounter[TYPE_ALEXEI_BAROV] == DONE && m_auiEncounter[TYPE_ILLUCIA_BAROV] == DONE)
|
||||
{
|
||||
if (Creature* pGandling = pPlayer->SummonCreature(NPC_DARKMASTER_GANDLING, aGandlingSpawnLocs[0].m_fX, aGandlingSpawnLocs[0].m_fY, aGandlingSpawnLocs[0].m_fZ, aGandlingSpawnLocs[0].m_fO, TEMPSUMMON_DEAD_DESPAWN, 0))
|
||||
{
|
||||
if (!bByPlayerEnter)
|
||||
{
|
||||
DoScriptText(SAY_GANDLING_SPAWN, pGandling);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint32 m_auiEncounter[MAX_ENCOUNTER];
|
||||
std::string m_strInstData;
|
||||
|
||||
uint32 m_uiGandlingEvent;
|
||||
GandlingEventMap m_mGandlingData;
|
||||
};
|
||||
|
||||
InstanceData* GetInstanceData(Map* pMap) override
|
||||
{
|
||||
return new instance_scholomance(pMap);
|
||||
}
|
||||
};
|
||||
|
||||
struct event_spell_gandling_shadow_portal : public MapEventScript
|
||||
{
|
||||
event_spell_gandling_shadow_portal() : MapEventScript("event_spell_gandling_shadow_portal") {}
|
||||
|
||||
bool OnReceived(uint32 uiEventId, Object* pSource, Object* /*pTarget*/, bool /*bIsStart*/) override
|
||||
{
|
||||
if (pSource->GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
if (InstanceData* pInstance = ((Creature*)pSource)->GetInstanceData())
|
||||
{
|
||||
// Check if we are handling an event associated with the room events of gandling
|
||||
for (uint8 i = 0; i < MAX_EVENTS; ++i)
|
||||
{
|
||||
if (uiEventId == aGandlingEvents[i])
|
||||
{
|
||||
// Set data in progress for the current event and store current event
|
||||
pInstance->SetData(TYPE_SIGNAL, uiEventId);
|
||||
// return false, to allow the DB-scripts to summon some NPCSs
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_instance_scholomance()
|
||||
{
|
||||
Script* s;
|
||||
s = new is_scholomance();
|
||||
s->RegisterSelf();
|
||||
s = new event_spell_gandling_shadow_portal();
|
||||
s->RegisterSelf();
|
||||
|
||||
//pNewScript = new Script;
|
||||
//pNewScript->Name = "instance_scholomance";
|
||||
//pNewScript->GetInstanceData = &GetInstanceData_instance_scholomance;
|
||||
//pNewScript->RegisterSelf();
|
||||
|
||||
//pNewScript = new Script;
|
||||
//pNewScript->Name = "event_spell_gandling_shadow_portal";
|
||||
//pNewScript->pProcessEventId = &ProcessEventId_event_spell_gandling_shadow_portal;
|
||||
//pNewScript->RegisterSelf();
|
||||
}
|
||||
|
|
@ -0,0 +1,104 @@
|
|||
/**
|
||||
* ScriptDev3 is an extension for mangos providing enhanced features for
|
||||
* area triggers, creatures, game objects, instances, items, and spells beyond
|
||||
* the default database scripting in mangos.
|
||||
*
|
||||
* Copyright (C) 2006-2013 ScriptDev2 <http://www.scriptdev2.com/>
|
||||
* Copyright (C) 2014-2016 MaNGOS <https://getmangos.eu>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* World of Warcraft, and all World of Warcraft or Warcraft art, images,
|
||||
* and lore are copyrighted by Blizzard Entertainment, Inc.
|
||||
*/
|
||||
|
||||
#ifndef DEF_SCHOLOMANCE_H
|
||||
#define DEF_SCHOLOMANCE_H
|
||||
|
||||
enum
|
||||
{
|
||||
MAX_ENCOUNTER = 10,
|
||||
TYPE_SIGNAL = MAX_ENCOUNTER,
|
||||
MAX_EVENTS = 6,
|
||||
|
||||
TYPE_KIRTONOS = 0,
|
||||
TYPE_RATTLEGORE = 1,
|
||||
TYPE_RAS_FROSTWHISPER = 2,
|
||||
TYPE_MALICIA = 3,
|
||||
TYPE_THEOLEN = 4,
|
||||
TYPE_POLKELT = 5,
|
||||
TYPE_RAVENIAN = 6,
|
||||
TYPE_ALEXEI_BAROV = 7,
|
||||
TYPE_ILLUCIA_BAROV = 8,
|
||||
TYPE_GANDLING = 9,
|
||||
|
||||
NPC_KIRTONOS = 10506,
|
||||
NPC_RATTLEGORE = 11622,
|
||||
NPC_RAS_FROSTWHISPER = 10508,
|
||||
NPC_THEOLEN_KRASTINOV = 11261,
|
||||
NPC_LOREKEEPER_POLKELT = 10901,
|
||||
NPC_RAVENIAN = 10507,
|
||||
NPC_ILLUCIA_BAROV = 10502,
|
||||
NPC_ALEXEI_BAROV = 10504,
|
||||
NPC_INSTRUCTOR_MALICIA = 10505,
|
||||
NPC_DARKMASTER_GANDLING = 1853,
|
||||
NPC_BONE_MINION = 16119, // summoned in random rooms by gandling
|
||||
|
||||
GO_GATE_KIRTONOS = 175570,
|
||||
GO_VIEWING_ROOM_DOOR = 175167, // Must be opened in reload case
|
||||
GO_GATE_RAS = 177370,
|
||||
GO_GATE_MALICIA = 177375,
|
||||
GO_GATE_THEOLEN = 177377,
|
||||
GO_GATE_POLKELT = 177376,
|
||||
GO_GATE_RAVENIAN = 177372,
|
||||
GO_GATE_BAROV = 177373,
|
||||
GO_GATE_ILLUCIA = 177371,
|
||||
GO_GATE_GANDLING = 177374,
|
||||
|
||||
// Because the shadow portal teleport coordinates are guesswork (taken from old script) these IDs might be randomized
|
||||
// TODO Syncronise with correct DB coordinates when they will be known
|
||||
EVENT_ID_POLKELT = 5618,
|
||||
EVENT_ID_THEOLEN = 5619,
|
||||
EVENT_ID_MALICIA = 5620,
|
||||
EVENT_ID_ILLUCIA = 5621,
|
||||
EVENT_ID_BAROV = 5622,
|
||||
EVENT_ID_RAVENIAN = 5623,
|
||||
|
||||
SAY_GANDLING_SPAWN = -1289000,
|
||||
};
|
||||
|
||||
struct SpawnLocation
|
||||
{
|
||||
float m_fX, m_fY, m_fZ, m_fO;
|
||||
};
|
||||
|
||||
static const SpawnLocation aGandlingSpawnLocs[1] =
|
||||
{
|
||||
{180.771f, -5.4286f, 75.5702f, 1.29154f}
|
||||
};
|
||||
|
||||
struct GandlingEventData
|
||||
{
|
||||
GandlingEventData() : m_bIsActive(false) {}
|
||||
bool m_bIsActive;
|
||||
ObjectGuid m_doorGuid;
|
||||
std::set<uint32> m_sAddGuids;
|
||||
};
|
||||
|
||||
static const uint32 aGandlingEvents[MAX_EVENTS] = {EVENT_ID_POLKELT, EVENT_ID_THEOLEN, EVENT_ID_MALICIA, EVENT_ID_ILLUCIA, EVENT_ID_BAROV, EVENT_ID_RAVENIAN};
|
||||
|
||||
typedef std::map<uint32, GandlingEventData> GandlingEventMap;
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue