Move hardcoded aiscripts to database for map 542

Related to #1113
This commit is contained in:
Zyres
2023-07-11 19:57:26 +02:00
parent 3ca9437106
commit 620cd3f4f3
4 changed files with 72 additions and 54 deletions

View File

@@ -0,0 +1,16 @@
-- Blood Furnance (542)
INSERT INTO `creature_ai_scripts` VALUES ('8606', '12340', '17381', '4', '0', '1', '2', '0', '100', '0', '0', '0', '0', '0', '0', '0', '100', '4849', '0', 'The Maker - My work must not be');
INSERT INTO `creature_ai_scripts` VALUES ('8606', '12340', '17381', '4', '0', '1', '2', '0', '100', '0', '0', '0', '0', '0', '0', '0', '100', '4850', '0', 'The Maker - Perhaps I can find');
INSERT INTO `creature_ai_scripts` VALUES ('8606', '12340', '17381', '4', '0', '1', '2', '0', '100', '0', '0', '0', '0', '0', '0', '0', '100', '4851', '0', 'The Maker - Anger... hate...');
INSERT INTO `creature_ai_scripts` VALUES ('8606', '12340', '17381', '4', '0', '4', '2', '0', '100', '0', '0', '0', '0', '0', '0', '0', '100', '4852', '0', 'The Maker - Lets see what I can');
INSERT INTO `creature_ai_scripts` VALUES ('8606', '12340', '17381', '4', '0', '4', '2', '0', '100', '0', '0', '0', '0', '0', '0', '0', '100', '4853', '0', 'The Maker - It is pointless to resist');
INSERT INTO `creature_ai_scripts` VALUES ('8606', '12340', '17381', '4', '0', '3', '2', '0', '100', '0', '0', '0', '0', '0', '0', '0', '100', '4854', '0', 'The Maker - Stay away from...');
INSERT INTO `creature_ai_scripts` VALUES ('8606', '12340', '17380', '4', '0', '5', '1', '0', '12', '30917', '0', '0', '0', '15000', '15000', '0', '100', '0', '0', 'Broggok - Poison Bolt');
INSERT INTO `creature_ai_scripts` VALUES ('8606', '12340', '17380', '4', '0', '5', '1', '0', '10', '30913', '0', '0', '0', '25000', '25000', '0', '100', '0', '0', 'Broggok - Slime Spray');
INSERT INTO `creature_ai_scripts` VALUES ('8606', '12340', '17380', '4', '0', '5', '1', '0', '8', '31259', '0', '0', '7', '40000', '40000', '0', '100', '0', '0', 'Broggok - Poison Cloud');
INSERT INTO `creature_ai_scripts` VALUES ('8606', '12340', '17381', '4', '0', '5', '1', '0', '8', '30923', '0', '0', '6', '10000', '10000', '0', '100', '0', '0', 'The Maker - Domination');
INSERT INTO `creature_ai_scripts` VALUES ('8606', '12340', '17381', '4', '0', '5', '1', '0', '10', '38973', '0', '0', '0', '0', '0', '0', '100', '0', '0', 'The Maker - Acid Spray');
INSERT INTO `creature_ai_scripts` VALUES ('8606', '12340', '17381', '4', '0', '5', '1', '0', '20', '30925', '0', '0', '7', '0', '0', '0', '100', '0', '0', 'The Maker - Exploding Beaker');
INSERT INTO `world_db_version` VALUES ('134', '20230711-00_hardcoded_ai_scripts');

View File

@@ -6,11 +6,65 @@ This file is released under the MIT license. See README-MIT for more information
#include "Setup.h"
#include "Instance_BloodFurnace.h"
enum BloodFurnanceEncounter
{
DATA_THE_MAKER = 0,
DATA_BROGGOK = 1,
DATA_KELIDAN_THE_BREAKER = 2
};
class BloodFurnaceInstanceScript : public InstanceScript
{
public:
explicit BloodFurnaceInstanceScript(WorldMap* pMapMgr) : InstanceScript(pMapMgr){}
static InstanceScript* Create(WorldMap* pMapMgr) { return new BloodFurnaceInstanceScript(pMapMgr); }
void OnEncounterStateChange(uint32_t entry, uint32_t state) override
{
switch (entry)
{
case DATA_BROGGOK:
{
if (state == Performed)
{
if (m_broggokDoorGUID)
if (GetGameObjectByGuid(m_broggokDoorGUID))
GetGameObjectByGuid(m_broggokDoorGUID)->setState(GO_STATE_OPEN);
}
} break;
case DATA_KELIDAN_THE_BREAKER:
{
if (state == Performed)
{
if (m_theMakerDoorGUID)
if (GetGameObjectByGuid(m_theMakerDoorGUID))
GetGameObjectByGuid(m_theMakerDoorGUID)->setState(GO_STATE_OPEN);
}
} break;
default:
break;
}
}
void OnGameObjectPushToWorld(GameObject* pGameObject)
{
switch (pGameObject->getEntry())
{
case GO_BROGGOK:
m_broggokDoorGUID = pGameObject->getGuidLow();
break;
case GO_THE_MAKER:
m_theMakerDoorGUID = pGameObject->getGuidLow();
break;
default:
break;
}
}
uint64_t m_broggokDoorGUID = 0;
uint64_t m_theMakerDoorGUID = 0;
};
class KelidanTheBreakerAI : public CreatureAIScript
@@ -73,61 +127,9 @@ public:
uint32_t mBurningNovaTimerId;
};
class BroggokAI : public CreatureAIScript
{
public:
static CreatureAIScript* Create(Creature* c) { return new BroggokAI(c); }
explicit BroggokAI(Creature* pCreature) : CreatureAIScript(pCreature)
{
addAISpell(POISON_BOLT, 12.0f, TARGET_SELF, 0, 15);
addAISpell(SLIME_SPRAY, 10.0f, TARGET_SELF, 0, 25);
auto poisonCloud = addAISpell(POISON_CLOUD, 8.0f, TARGET_RANDOM_DESTINATION, 0, 40);
poisonCloud->setMinMaxDistance(0.0f, 40.0f);
}
void OnDied(Unit* /*pKiller*/) override
{
GameObject* pDoor = getNearestGameObject(456.157349f, 34.248005f, 9.559463f, GO_BROGGOK);
if (pDoor)
pDoor->setState(GO_STATE_OPEN);
}
};
class TheMakerAI : public CreatureAIScript
{
public:
static CreatureAIScript* Create(Creature* c) { return new TheMakerAI(c); }
explicit TheMakerAI(Creature* pCreature) : CreatureAIScript(pCreature)
{
addAISpell(DOMINATION, 8.0f, TARGET_RANDOM_SINGLE);
addAISpell(ACID_SPRAY, 10.0f, TARGET_SELF);
auto throwBreaker = addAISpell(THROW_BEAKER, 20.0f, TARGET_RANDOM_DESTINATION);
throwBreaker->setMinMaxDistance(0.0f, 40.0f);
addEmoteForEvent(Event_OnCombatStart, 4849); // My work must not be interrupted!
addEmoteForEvent(Event_OnCombatStart, 4850); // Perhaps I can find a use for you...
addEmoteForEvent(Event_OnCombatStart, 4851); // Anger...hate... These are tools I can use.
addEmoteForEvent(Event_OnTargetDied, 4852); // Let's see what I can make of you!
addEmoteForEvent(Event_OnTargetDied, 4853); // It is pointless to resist.
addEmoteForEvent(Event_OnDied, 4854); // Stay away from... Me!
}
void OnDied(Unit* /*pKiller*/) override
{
GameObject* pDoor = getNearestGameObject(327.155487f, 149.753418f, 9.559869f, GO_THE_MAKER);
if (pDoor)
pDoor->setState(GO_STATE_OPEN);
}
};
void SetupBloodFurnace(ScriptMgr* mgr)
{
mgr->register_instance_script(MAP_HC_BLOOD_FURNANCE, &BloodFurnaceInstanceScript::Create);
mgr->register_creature_script(CN_KELIDAN_THE_BREAKER, &KelidanTheBreakerAI::Create);
mgr->register_creature_script(CN_BROGGOK, &BroggokAI::Create);
mgr->register_creature_script(CN_THE_MAKER, &TheMakerAI::Create);
}

View File

@@ -135,7 +135,7 @@ bool ChatHandler::HandleMoveHardcodedScriptsToDBCommand(const char* args, WorldS
std::string comment = name + " - " + spellname;
char my_insert1[700];
sprintf(my_insert1, "INSERT INTO creature_ai_scripts_%s VALUES (5875,12340,%u,4,0,5,1,0,%f,%u,%u,0,%u,%u,%u,0,100,0,0,'%s')", args, entry, chance, spell, spelltype, target, cooldown, cooldown, comment.c_str());
sprintf(my_insert1, "INSERT INTO creature_ai_scripts_%s VALUES (8606,12340,%u,4,0,5,1,0,%f,%u,%u,0,%u,%u,%u,0,100,0,0,'%s')", args, entry, chance, spell, spelltype, target, cooldown, cooldown, comment.c_str());
WorldDatabase.Execute(my_insert1);
++count;

View File

@@ -42,7 +42,7 @@
// DB version
static const char* REQUIRED_CHAR_DB_VERSION = "20230710-00_characters_taxi";
static const char* REQUIRED_WORLD_DB_VERSION = "20230710-01_hardcoded_ai_scripts";
static const char* REQUIRED_WORLD_DB_VERSION = "20230711-00_hardcoded_ai_scripts";
volatile bool Master::m_stopEvent = false;