diff --git a/sql/world/updates/20230711-00_hardcoded_ai_scripts.sql b/sql/world/updates/20230711-00_hardcoded_ai_scripts.sql new file mode 100644 index 000000000..07eebd7f8 --- /dev/null +++ b/sql/world/updates/20230711-00_hardcoded_ai_scripts.sql @@ -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'); diff --git a/src/scripts/InstanceScripts/Tbc/HellfireCitadel/BloodFurnace/Instance_BloodFurnace.cpp b/src/scripts/InstanceScripts/Tbc/HellfireCitadel/BloodFurnace/Instance_BloodFurnace.cpp index 52abe2f2c..f3904f791 100644 --- a/src/scripts/InstanceScripts/Tbc/HellfireCitadel/BloodFurnace/Instance_BloodFurnace.cpp +++ b/src/scripts/InstanceScripts/Tbc/HellfireCitadel/BloodFurnace/Instance_BloodFurnace.cpp @@ -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); } diff --git a/src/world/Chat/Commands/DebugCommands.cpp b/src/world/Chat/Commands/DebugCommands.cpp index 60d031618..999e4852a 100644 --- a/src/world/Chat/Commands/DebugCommands.cpp +++ b/src/world/Chat/Commands/DebugCommands.cpp @@ -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; diff --git a/src/world/Server/Master.cpp b/src/world/Server/Master.cpp index d3a44abf9..598be9650 100644 --- a/src/world/Server/Master.cpp +++ b/src/world/Server/Master.cpp @@ -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;