From 1d99440f74354f14a5b67fcd3dc8dcb0a0bd2989 Mon Sep 17 00:00:00 2001 From: ConorB <126167126+ConorB1745@users.noreply.github.com> Date: Sat, 12 Oct 2024 13:06:42 +0200 Subject: [PATCH] fix(cpp/db): how to win friends and infleunce enemies missing dialogue (#20132) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(cpp/db): Quest how to win friends and infleunce enemies missing dialogue during torture Scarlet Crusader (id: 28940), Scarlet Marksman (id: 28610), Scarlet Preacher (id: 28939) and Scarlet Commander (id: 28936) were missing some dialog in the database and script npc_crusade_persuaded always succeeded when the spell on Keleseth's Persuader (item id: 39371 and spell id: 52781) procced. It now only succeeds thirty percent of the time. Increased ppmRate for spell to 8. Finally removed aggro when scarlet was 'persuaded' closes Azerothcore issue #20110 * fix(cpp): trailing white space * fix(db): error in text * fix(db): syntax error * fix(cpp/db): using urand and removed db name from insert * fix(db): remove broadcast text and missing creature text * fix(DB): change sql queries to comply with rules Added a delete query before insert and backticks to column and table names * add empty newline at the end --------- Co-authored-by: Stefano Borzì --- .../rev_1728059831124992100.sql | 27 +++++++++ .../ScarletEnclave/chapter2.cpp | 60 ++++++++++++------- 2 files changed, 66 insertions(+), 21 deletions(-) create mode 100644 data/sql/updates/pending_db_world/rev_1728059831124992100.sql diff --git a/data/sql/updates/pending_db_world/rev_1728059831124992100.sql b/data/sql/updates/pending_db_world/rev_1728059831124992100.sql new file mode 100644 index 000000000..21723da6d --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1728059831124992100.sql @@ -0,0 +1,27 @@ +DELETE FROM `creature_text` +WHERE (`CreatureID`, `GroupID`, `ID`) IN ((28936, 1, 0), (28936, 1, 1), (28936, 1, 2), (28936, 1, 3), (28936, 1, 4), (28936, 1, 5), (28936, 2, 0), (28936, 3, 0), (28936, 4, 0), (28936, 5, 0), (28936, 6, 0), (28936, 7, 0), (28936, 8, 0), (28936, 8, 1), (28936, 8, 2), (28936, 8, 3), (28936, 8, 4), (28936, 8, 5), (28936, 8, 6)); +INSERT INTO `creature_text` +(`CreatureID`, `GroupID`, `ID`, `Text`, `Type`, `Language`, `Probability`, `Emote`, `Duration`, `Sound`, `BroadcastTextId`, `TextRange`, `comment`) +VALUES(28936, 1, 0, 'You''ll be hanging in the gallows shortly, Scourge fiend!', 12, 0, 100.0, 0, 0, 0, 29160, 0, 'crusader SAY_CURSADER1'), +(28936, 1, 1, 'You''ll have to kill me, monster. I will tell you NOTHING!', 12, 0, 100.0, 0, 0, 0, 29142, 0, 'crusader SAY_CURSADER2'), +(28936, 1, 2, 'You hit like a girl. Honestly. Is that the best you can do?', 12, 0, 100.0, 0, 0, 0, 29146, 0, 'crusader SAY_CURSADER3'), +(28936, 1, 3, 'ARGH! You burned my last good tabard!', 12, 0, 100.0, 0, 0, 0, 29162, 0, 'crusader SAY_CURSADER4'), +(28936, 1, 4, 'Argh... The pain... The pain is almost as unbearable as the lashings I received in grammar school when I was but a child.', 12, 0, 100.0, 0, 0, 0, 29143, 0, 'crusader SAY_CURSADER5'), +(28936, 1, 5, 'I used to work for Grand Inquisitor Isillien! Your idea of pain is a normal mid-afternoon for me!', 12, 0, 100.0, 0, 0, 0, 29161, 0, 'crusader SAY_CURSADER6'), +(28936, 2, 0, 'I''ll tell you everything! STOP! PLEASE!', 12, 0, 100.0, 0, 0, 0, 29149, 0, 'break crusader SAY_PERSUADED1'), +(28936, 3, 0, 'We... We have only been told that the "Crimson Dawn" is an awakening. You... You see, the Light speaks to the High General. It is the Light...', 12, 0, 100.0, 0, 0, 0, 29150, 0, 'break crusader SAY_PERSUADED2'), +(28936, 4, 0, 'The Light that guides us. This movement was set in motion before you came... We... We do as we are told. It is what must be done.', 12, 0, 100.0, 0, 0, 0, 29151, 0, 'break crusader SAY_PERSUADED3'), +(28936, 5, 0, 'I know very litte else... The High General chooses who may go and who must stay behind. There''s nothing else... You must believe me!', 12, 0, 100.0, 0, 0, 0, 29152, 0, 'break crusader SAY_PERSUADED4'), +(28936, 6, 0, 'LIES! The pain you are about to endure will be talked about for years to come!', 12, 0, 100.0, 0, 0, 0, 29163, 0, 'break crusader SAY_PERSUADED5'), +(28936, 7, 0, 'NO! PLEASE! There is one more thing that I forgot to mention... A courier comes soon... From Hearthglen. It...', 12, 0, 100.0, 0, 0, 0, 29153, 0, 'break crusader SAY_PERSUADED6'), +(28936, 8, 0, 'I''ll tear the secrets from your soul! Tell me about the "Crimson Dawn" and your life may be spared!', 12, 0, 100.0, 0, 0, 0, 29138, 0, 'player SAY_PERSUADE1'), +(28936, 8, 1, 'Tell me what you know about "Crimson Dawn" or the beatings will continue!', 12, 0, 100.0, 0, 0, 0, 29134, 0, 'player SAY_PERSUADE2'), +(28936, 8, 2, 'I''m through being courteous with your kind, human! What is the "Crimson Dawn?"', 12, 0, 100.0, 0, 0, 0, 29135, 0, 'player SAY_PERSUADE3'), +(28936, 8, 3, 'Is your life worth so little? Just tell me what I need to know about "Crimson Dawn" and I''ll end your suffering quickly.', 12, 0, 100.0, 0, 0, 0, 29139, 0, 'player SAY_PERSUADE4'), +(28936, 8, 4, 'I can keep this up for a very long time, Scarlet dog! Tell me about the "Crimson Dawn!"', 12, 0, 100.0, 0, 0, 0, 29137, 0, 'player SAY_PERSUADE'), +(28936, 8, 5, 'What is the "Crimson Dawn?"', 12, 0, 100.0, 0, 0, 0, 29133, 0, 'player SAY_PERSUADE6'), +(28936, 8, 6, '"Crimson Dawn!" What is it! Speak!', 12, 0, 100.0, 0, 0, 0, 29136, 0, 'player SAY_PERSUADE7'); + +UPDATE `creature_template` SET `ScriptName` = 'npc_crusade_persuaded' WHERE (`entry` = 28940); + +UPDATE `item_template` SET `spellppmRate_1` = 8 WHERE (`entry` = 39371); diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp index 05b0d8ef7..77ca10551 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp @@ -56,14 +56,22 @@ public: { npc_crusade_persuadedAI(Creature* creature) : CombatAI(creature) { } + const uint32 SAY_AGGRO_CHANCE = 33; + const uint32 PERSUADE_SUCCESS_CHANCE = 3; // 30% chance + const uint32 SPEECH_TIMER_DEFAULT = 1000; + const uint32 SPEECH_TIMER_FOR_ROLEPLAY = 8000; + const uint32 SPEECH_COUNTER_PREVENT_SUCCESS_ROLEPLAY = 0; + const uint32 SPEECH_COUNTER_START_SUCCESS_ROLEPLAY = 1; + uint32 speechTimer; uint32 speechCounter; ObjectGuid playerGUID; + bool persuaded; void Reset() override { speechTimer = 0; - speechCounter = 0; + speechCounter = SPEECH_COUNTER_PREVENT_SUCCESS_ROLEPLAY; playerGUID.Clear(); me->SetReactState(REACT_AGGRESSIVE); me->RestoreFaction(); @@ -71,7 +79,7 @@ public: void JustEngagedWith(Unit*) override { - if (roll_chance_i(33)) + if (roll_chance_i(SAY_AGGRO_CHANCE)) Talk(SAY_AGGRO); } @@ -81,20 +89,23 @@ public: { if (Player* player = caster->ToPlayer()) { - if (player->GetQuestStatus(QUEST_HOW_TO_WIN_FRIENDS) == QUEST_STATUS_INCOMPLETE) + playerGUID = player->GetGUID(); + speechTimer = SPEECH_TIMER_DEFAULT; + speechCounter = SPEECH_COUNTER_START_SUCCESS_ROLEPLAY; + uint32 persuadeRoll = urand(1, 10); + + sCreatureTextMgr->SendChat(me, SAY_PERSUADE_RAND, nullptr, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_NORMAL, 0, TEAM_NEUTRAL, false, player); + + if (persuadeRoll <= PERSUADE_SUCCESS_CHANCE && player->GetQuestStatus(QUEST_HOW_TO_WIN_FRIENDS) == QUEST_STATUS_INCOMPLETE) { - playerGUID = player->GetGUID(); - speechTimer = 1000; - speechCounter = 1; + persuaded = true; me->SetFaction(player->GetFaction()); me->CombatStop(true); me->GetMotionMaster()->MoveIdle(); me->SetReactState(REACT_PASSIVE); - DoCastAOE(SPELL_THREAT_PULSE, true); - - sCreatureTextMgr->SendChat(me, SAY_PERSUADE_RAND, nullptr, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_NORMAL, 0, TEAM_NEUTRAL, false, player); - Talk(SAY_CRUSADER); } + else + persuaded = false; } } } @@ -112,46 +123,53 @@ public: return; } - switch (speechCounter) + if (persuaded) { + switch (speechCounter) + { case 1: Talk(SAY_PERSUADED1); - speechTimer = 8000; + speechTimer = SPEECH_TIMER_FOR_ROLEPLAY; break; case 2: Talk(SAY_PERSUADED2); - speechTimer = 8000; + speechTimer = SPEECH_TIMER_FOR_ROLEPLAY; break; case 3: Talk(SAY_PERSUADED3); - speechTimer = 8000; + speechTimer = SPEECH_TIMER_FOR_ROLEPLAY; break; case 4: Talk(SAY_PERSUADED4); - speechTimer = 8000; + speechTimer = SPEECH_TIMER_FOR_ROLEPLAY; break; case 5: sCreatureTextMgr->SendChat(me, SAY_PERSUADED5, nullptr, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_NORMAL, 0, TEAM_NEUTRAL, false, player); - speechTimer = 8000; + speechTimer = SPEECH_TIMER_FOR_ROLEPLAY; break; case 6: Talk(SAY_PERSUADED6); Unit::Kill(player, me); - speechCounter = 0; + speechCounter = SPEECH_COUNTER_PREVENT_SUCCESS_ROLEPLAY; player->GroupEventHappens(QUEST_HOW_TO_WIN_FRIENDS, me); return; - } + } - ++speechCounter; - DoCastAOE(SPELL_THREAT_PULSE, true); + ++speechCounter; + } + else + { + Talk(SAY_CRUSADER); + speechCounter = SPEECH_COUNTER_PREVENT_SUCCESS_ROLEPLAY; + } } else - speechTimer -= diff; + speechTimer = (speechTimer > diff) ? (speechTimer - diff) : 0; return; }