From e1692ae5b6f31fe77762b875a1e843c207573b3b Mon Sep 17 00:00:00 2001 From: daobashun <49193927+fangshun2004@users.noreply.github.com> Date: Thu, 29 Aug 2024 03:05:40 +0800 Subject: [PATCH] fix(scripts/npc_calvin_montague): Convert to SAI, Add emotes when completing quests (#18087) * Magic uses sniffing IDs Use the sniffer timer and factions * Wait 3 minutes if the mission fails * 1. When a task fails, it enters passive mode 2. Add 'quest_details' data to the database * Remove spaces * Delete blank lines * Modify the code as required * Update src/server/scripts/EasternKingdoms/zone_tirisfal_glades.cpp Co-authored-by: Kitzunu <24550914+Kitzunu@users.noreply.github.com> * Remove curly braces * Change the name of a private member variable * Move the c ++ script to smart script * Delete the C++ script Re-add the deleted quest_details data * del blank lines * Delete the C++ script file * Modify the annotation Return to the home pointset phase to 0 Return to the home point to allow the SAI phase reset * Remove spaces * Delete functions that are not in use * Update rev_1704025138911597700.sql * fix merge error - delete zone file --------- Co-authored-by: Kitzunu <24550914+Kitzunu@users.noreply.github.com> --- .../rev_1704025138911597700.sql | 56 ++++++ .../eastern_kingdoms_script_loader.cpp | 2 - .../EasternKingdoms/zone_tirisfal_glades.cpp | 174 ------------------ 3 files changed, 56 insertions(+), 176 deletions(-) create mode 100644 data/sql/updates/pending_db_world/rev_1704025138911597700.sql delete mode 100644 src/server/scripts/EasternKingdoms/zone_tirisfal_glades.cpp diff --git a/data/sql/updates/pending_db_world/rev_1704025138911597700.sql b/data/sql/updates/pending_db_world/rev_1704025138911597700.sql new file mode 100644 index 000000000..62b410425 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1704025138911597700.sql @@ -0,0 +1,56 @@ +-- Calvin Montague smart ai +SET @ENTRY := 6784; +UPDATE `creature_template` SET `AIName` = 'SmartAI', `ScriptName` = '' WHERE `entry` = @ENTRY; +DELETE FROM `smart_scripts` WHERE `source_type` = 0 AND `entryOrGuid` = @ENTRY; +DELETE FROM `smart_scripts` WHERE `source_type` = 9 AND `entryOrGuid` IN (678400, 678401); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(@ENTRY, 0, 0, 1, 19, 0, 100, 0, 590, 0, 0, 0, 22, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'On player accepted quest A Rogue\'s Deal (590) - Set event phase to phase 1'), +(@ENTRY, 0, 1, 2, 61, 0, 100, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'On player accepted quest A Rogue\'s Deal (590) - Self: storedTarget[0] = Player who accepted quest'), +(@ENTRY, 0, 2, 3, 61, 0, 100, 0, 0, 0, 0, 0, 2, 14, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'On player accepted quest A Rogue\'s Deal (590) - Self: Set faction to Monster (14)'), +(@ENTRY, 0, 3, 4, 61, 0, 100, 0, 0, 0, 0, 0, 83, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'On player accepted quest A Rogue\'s Deal (590) - Self: Remove npc flags QUESTGIVER'), +(@ENTRY, 0, 4, 5, 61, 0, 100, 0, 0, 0, 0, 0, 19, 256, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'On player accepted quest A Rogue\'s Deal (590) - Self: Remove UNIT_FLAGS to IMMUNE_TO_PC'), +(@ENTRY, 0, 5, 6, 61, 0, 100, 0, 0, 0, 0, 0, 18, 2048, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'On player accepted quest A Rogue\'s Deal (590) - Self: Set UNIT_FLAGS to PET_IN_COMBAT'), +(@ENTRY, 0, 6, 7, 61, 0, 100, 0, 0, 0, 0, 0, 8, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'On player accepted quest A Rogue\'s Deal (590) - Self: Set react state to Aggressive'), +(@ENTRY, 0, 7, 8, 61, 0, 100, 0, 0, 0, 0, 0, 49, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'On player accepted quest A Rogue\'s Deal (590) - Self: Attack Player who accepted quest'), +(@ENTRY, 0, 8, 9, 61, 0, 100, 0, 0, 0, 0, 0, 42, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'On player accepted quest A Rogue\'s Deal (590) - Self: Set invincibility to 1 HP'), +(@ENTRY, 0, 9, 0, 61, 0, 100, 0, 0, 0, 0, 0, 211, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'On player accepted quest A Rogue\'s Deal (590) - Self: Disallow SAI phase reset'), +(@ENTRY, 0, 10, 11, 2, 1, 100, 513, 0, 30, 0, 0, 22, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Calvin Montague - When health between 0%-30%% (once phase 1) - Set event phase to phase 2'), +(@ENTRY, 0, 11, 12, 61, 0, 100, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Calvin Montague - When health between 0%-30%% (once phase 1) - Reset faction'), +(@ENTRY, 0, 12, 13, 61, 0, 100, 0, 0, 0, 0, 0, 28, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Calvin Montague - When health between 0%-30%% (once phase 1) - Remove all auras'), +(@ENTRY, 0, 13, 14, 61, 0, 100, 0, 0, 0, 0, 0, 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Calvin Montague - When health between 0%-30%% (once phase 1) - Stop combat'), +(@ENTRY, 0, 14, 0, 61, 0, 100, 0, 0, 0, 0, 0, 24, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Calvin Montague - When health between 0%-30%% (once phase 1) - Evade'), +(@ENTRY, 0, 15, 16, 7, 1, 100, 0, 0, 0, 0, 0, 19, 256, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Calvin Montague - On evade(phase 1) - Remove UNIT_FLAGS to IMMUNE_TO_PC'), +(@ENTRY, 0, 16, 0, 61, 0, 100, 0, 0, 0, 0, 0, 8, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Calvin Montague - On evade (phase 1)- Set react state to Defensive'), +(@ENTRY, 0, 17, 0, 21, 1, 100, 0, 0, 0, 0, 0, 80, 678400, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Calvin Montague - On home reached (phase 1) - Self: Start timed action list id #Calvin Montague #0 (678400) (update out of combat) override existing // -inline'), +(@ENTRY * 100, 9, 0, 0, 0, 0, 100, 0, 150000, 150000, 0, 0, 2, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Calvin Montague - action list - Reset faction'), +(@ENTRY * 100, 9, 1, 0, 0, 0, 100, 0, 0, 0, 0, 0, 18, 256, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Calvin Montague - action list - Set UNIT_FLAGS to IMMUNE_TO_PC'), +(@ENTRY * 100, 9, 2, 0, 0, 0, 100, 0, 0, 0, 0, 0, 82, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Calvin Montague - action list - Add npc flags QUESTGIVER'), +(@ENTRY * 100, 9, 3, 0, 0, 0, 100, 0, 0, 0, 0, 0, 90, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Calvin Montague - action list - Set stand state to STAND'), +(@ENTRY * 100, 9, 4, 0, 0, 0, 100, 0, 0, 0, 0, 0, 40, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Calvin Montague - action list - Set sheath to Melee'), +(@ENTRY * 100, 9, 5, 0, 0, 0, 100, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Calvin Montague - action list - storedTarget[0] = None'), +(@ENTRY * 100, 9, 6, 0, 0, 0, 100, 0, 0, 0, 0, 0, 42, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Calvin Montague - action list - Set invincibility to 0 HP'), +(@ENTRY * 100, 9, 7, 0, 0, 0, 100, 0, 0, 0, 0, 0, 211, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Calvin Montague - action list - Allow SAI phase reset'), +(@ENTRY * 100, 9, 8, 0, 0, 0, 100, 0, 0, 0, 0, 0, 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Calvin Montague - action list - Set event phase to default (0)'), +(@ENTRY, 0, 18, 0, 21, 2, 100, 0, 0, 0, 0, 0, 80, 678401, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Calvin Montague - On home reached (phase 2) - Start timed action list id #Calvin Montague #1 (678401) (update out of combat) override existing // -inline'), +(@ENTRY * 100 + 1, 9, 0, 0, 0, 0, 100, 0, 1000, 1000, 0, 0, 66, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 'Calvin Montague - action list - Look at storedTarget[0]'), +(@ENTRY * 100 + 1, 9, 1, 0, 0, 0, 100, 0, 0, 0, 0, 0, 5, 14, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Calvin Montague - action list - Play emote ONESHOT_RUDE(DNR) (14)'), +(@ENTRY * 100 + 1, 9, 2, 0, 0, 0, 100, 0, 4000, 4000, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Calvin Montague - action list - Talk 0 to invoker'), +(@ENTRY * 100 + 1, 9, 3, 0, 0, 0, 100, 0, 6300, 6300, 0, 0, 11, 7737, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Calvin Montague - action list - Cast spell Food(7737) on Self'), +(@ENTRY * 100 + 1, 9, 4, 0, 0, 0, 100, 0, 0, 0, 0, 0, 26, 590, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 'Calvin Montague - action list - storedTarget[0]: Call group event happened from quest A Rogue\'s Deal (590)'), +(@ENTRY * 100 + 1, 9, 5, 0, 0, 0, 100, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Calvin Montague - action list - Reset faction'), +(@ENTRY * 100 + 1, 9, 6, 0, 0, 0, 100, 0, 0, 0, 0, 0, 18, 256, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Calvin Montague - action list - Set UNIT_FLAGS to IMMUNE_TO_PC'), +(@ENTRY * 100 + 1, 9, 7, 0, 0, 0, 100, 0, 0, 0, 0, 0, 82, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Calvin Montague - action list - Add npc flags QUESTGIVER'), +(@ENTRY * 100 + 1, 9, 8, 0, 0, 0, 100, 0, 0, 0, 0, 0, 19, 2048, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Calvin Montague - action list - Remove UNIT_FLAGS to PET_IN_COMBAT'), +(@ENTRY * 100 + 1, 9, 9, 0, 0, 0, 100, 0, 0, 0, 0, 0, 91, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Calvin Montague - action list - Remove stand state SIT'), +(@ENTRY * 100 + 1, 9, 10, 0, 0, 0, 100, 0, 0, 0, 0, 0, 40, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Calvin Montague - action list - Set sheath to Melee'), +(@ENTRY * 100 + 1, 9, 11, 0, 0, 0, 100, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Calvin Montague - action list - storedTarget[0] = None'), +(@ENTRY * 100 + 1, 9, 12, 0, 0, 0, 100, 0, 0, 0, 0, 0, 42, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Calvin Montague - action list - Set invincibility to 0 HP'), +(@ENTRY * 100 + 1, 9, 13, 0, 0, 0, 100, 0, 0, 0, 0, 0, 211, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Calvin Montague - action list - Allow SAI phase reset'), +(@ENTRY * 100 + 1, 9, 14, 0, 0, 0, 100, 0, 0, 0, 0, 0, 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Calvin Montague - action list - Set event phase to default (0)'); + +DELETE +FROM `quest_details` +WHERE `ID` IN (590,8); +INSERT INTO `quest_details` (`ID`, `Emote1`, `Emote2`, `Emote3`, `Emote4`, `EmoteDelay1`, `EmoteDelay2`, `EmoteDelay3`, `EmoteDelay4`, `VerifiedBuild`) VALUES +(8, 2, 1, 1, 0, 0, 0, 0, 0, 52237), +(590, 6, 1, 14, 0, 0, 0, 0, 0, 52237); diff --git a/src/server/scripts/EasternKingdoms/eastern_kingdoms_script_loader.cpp b/src/server/scripts/EasternKingdoms/eastern_kingdoms_script_loader.cpp index 82f3f0d19..67360281a 100644 --- a/src/server/scripts/EasternKingdoms/eastern_kingdoms_script_loader.cpp +++ b/src/server/scripts/EasternKingdoms/eastern_kingdoms_script_loader.cpp @@ -157,7 +157,6 @@ void AddSC_isle_of_queldanas(); void AddSC_redridge_mountains(); void AddSC_silverpine_forest(); void AddSC_stormwind_city(); -void AddSC_tirisfal_glades(); void AddSC_undercity(); void AddSC_western_plaguelands(); void AddSC_westfall(); @@ -309,7 +308,6 @@ void AddEasternKingdomsScripts() AddSC_redridge_mountains(); AddSC_silverpine_forest(); AddSC_stormwind_city(); - AddSC_tirisfal_glades(); AddSC_undercity(); AddSC_western_plaguelands(); AddSC_westfall(); diff --git a/src/server/scripts/EasternKingdoms/zone_tirisfal_glades.cpp b/src/server/scripts/EasternKingdoms/zone_tirisfal_glades.cpp deleted file mode 100644 index 976162d5f..000000000 --- a/src/server/scripts/EasternKingdoms/zone_tirisfal_glades.cpp +++ /dev/null @@ -1,174 +0,0 @@ -/* - * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Affero General Public License as published by the - * Free Software Foundation; either version 3 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 Affero General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -/* ScriptData -SDName: Tirisfal_Glades -SD%Complete: 100 -SDComment: Quest support: 590, 1819 -SDCategory: Tirisfal Glades -EndScriptData */ - -/* ContentData -npc_calvin_montague -go_mausoleum_door -go_mausoleum_trigger -EndContentData */ - -#include "CreatureScript.h" -#include "Player.h" -#include "ScriptedCreature.h" - -/*###### -## npc_calvin_montague -######*/ - -enum Calvin -{ - SAY_COMPLETE = 0, - SPELL_DRINK = 2639, // possibly not correct spell (but iconId is correct) - QUEST_590 = 590 -}; - -class npc_calvin_montague : public CreatureScript -{ -public: - npc_calvin_montague() : CreatureScript("npc_calvin_montague") { } - - bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest) override - { - if (quest->GetQuestId() == QUEST_590) - { - creature->SetFaction(FACTION_ENEMY); - creature->SetImmuneToPC(false); - CAST_AI(npc_calvin_montague::npc_calvin_montagueAI, creature->AI())->AttackStart(player); - } - return true; - } - - CreatureAI* GetAI(Creature* creature) const override - { - return new npc_calvin_montagueAI(creature); - } - - struct npc_calvin_montagueAI : public ScriptedAI - { - npc_calvin_montagueAI(Creature* creature) : ScriptedAI(creature) { } - - uint32 m_uiPhase; - uint32 m_uiPhaseTimer; - ObjectGuid m_uiPlayerGUID; - - void Reset() override - { - m_uiPhase = 0; - m_uiPhaseTimer = 5000; - m_uiPlayerGUID.Clear(); - - me->RestoreFaction(); - - if (!me->IsImmuneToPC()) - me->SetImmuneToPC(true); - } - - void JustEngagedWith(Unit* /*who*/) override { } - - void AttackedBy(Unit* pAttacker) override - { - if (me->GetVictim() || me->IsFriendlyTo(pAttacker)) - return; - - AttackStart(pAttacker); - } - - void DamageTaken(Unit* pDoneBy, uint32& uiDamage, DamageEffectType, SpellSchoolMask) override - { - if (!pDoneBy) - return; - - if (uiDamage >= me->GetHealth() || me->HealthBelowPctDamaged(15, uiDamage)) - { - uiDamage = 0; - - me->RestoreFaction(); - me->SetImmuneToPC(true); - me->CombatStop(true); - - m_uiPhase = 1; - - if (pDoneBy->IsPlayer()) - { - m_uiPlayerGUID = pDoneBy->GetGUID(); - } - else if (pDoneBy->IsPet()) - { - if (Unit* owner = pDoneBy->GetOwner()) - { - // not sure if this is needed. - if (owner->IsPlayer()) - { - m_uiPlayerGUID = owner->GetGUID(); - } - } - } - } - } - - void UpdateAI(uint32 diff) override - { - if (m_uiPhase) - { - if (m_uiPhaseTimer <= diff) - m_uiPhaseTimer = 7500; - else - { - m_uiPhaseTimer -= diff; - return; - } - - switch (m_uiPhase) - { - case 1: - Talk(SAY_COMPLETE); - ++m_uiPhase; - break; - case 2: - if (Player* player = ObjectAccessor::GetPlayer(*me, m_uiPlayerGUID)) - player->AreaExploredOrEventHappens(QUEST_590); - - DoCast(me, SPELL_DRINK, true); - ++m_uiPhase; - break; - case 3: - EnterEvadeMode(); - break; - } - - return; - } - - if (!UpdateVictim()) - return; - - DoMeleeAttackIfReady(); - } - }; -}; - -void AddSC_tirisfal_glades() -{ - new npc_calvin_montague(); -}