fix(Core/SmartAI): Mist escort and follow completion granting Credit (#25653)

This commit is contained in:
sogladev
2026-05-05 09:46:47 +02:00
committed by GitHub
parent 5bf1a9d65d
commit 1cd8516e38
2 changed files with 30 additions and 17 deletions

View File

@@ -0,0 +1,13 @@
--
DELETE FROM `smart_scripts` WHERE (`source_type` = 0 AND `entryorguid` = 3568);
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`, `event_param5`, `event_param6`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES
(3568, 0, 1, 2, 19, 0, 100, 512, 938, 0, 0, 0, 0, 0, 29, 1, 1, 3519, 938, 1, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 'Mist - On Quest \'Mist\' Taken - Start Follow Invoker'),
(3568, 0, 2, 3, 61, 0, 100, 512, 0, 0, 0, 0, 0, 0, 83, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Mist - On Quest \'Mist\' Taken - Remove Npc Flags Questgiver'),
(3568, 0, 3, 4, 61, 0, 100, 512, 0, 0, 0, 0, 0, 0, 19, 512, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Mist - On Quest \'Mist\' Taken - Remove Flags Immune To NPC\'s'),
(3568, 0, 4, 0, 61, 0, 100, 513, 0, 0, 0, 0, 0, 0, 8, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Mist - On Quest \'Mist\' Taken - Set Reactstate Defensive'),
(3568, 0, 5, 0, 6, 0, 100, 512, 0, 0, 0, 0, 0, 0, 70, 1000, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Mist - On Just Died - Respawn Self'),
(3568, 0, 6, 7, 11, 0, 100, 512, 0, 0, 0, 0, 0, 0, 18, 512, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Mist - On Respawn - Set Flags Immune To NPC\'s'),
(3568, 0, 7, 8, 61, 0, 100, 512, 0, 0, 0, 0, 0, 0, 81, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Mist - On Respawn - Set Npc Flags Questgiver'),
(3568, 0, 8, 0, 61, 0, 100, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Mist - On Respawn - Set Reactstate Passive'),
(3568, 0, 9, 10, 65, 0, 100, 512, 0, 0, 0, 0, 0, 0, 70, 2000, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Mist - On Follow Complete - Respawn Self'),
(3568, 0, 10, 0, 61, 0, 100, 512, 0, 0, 0, 0, 0, 0, 1, 0, 1000, 0, 0, 0, 0, 19, 3519, 10, 0, 0, 0, 0, 0, 0, 'Mist - On Follow Complete - Say Line 0');

View File

@@ -1241,6 +1241,23 @@ void SmartAI::SetFollow(Unit* target, float dist, float angle, uint32 credit, ui
void SmartAI::StopFollow(bool complete)
{
if (complete)
{
Player* player = ObjectAccessor::GetPlayer(*me, mFollowGuid);
if (player && mFollowCredit > 0)
{
if (!mFollowCreditType)
player->RewardPlayerAndGroupAtEvent(mFollowCredit, me);
else
player->GroupEventHappens(mFollowCredit, me);
}
SetDespawnTime(5000);
StartDespawn();
GetScript()->ProcessEventsFor(SMART_EVENT_FOLLOW_COMPLETED, player);
}
mFollowGuid.Clear();
mFollowDist = 0;
mFollowAngle = 0;
@@ -1252,23 +1269,6 @@ void SmartAI::StopFollow(bool complete)
me->GetMotionMaster()->Clear(false);
me->StopMoving();
me->GetMotionMaster()->MoveIdle();
if (!complete)
return;
Player* player = ObjectAccessor::GetPlayer(*me, mFollowGuid);
if (player)
{
if (!mFollowCreditType)
player->RewardPlayerAndGroupAtEvent(mFollowCredit, me);
else
player->GroupEventHappens(mFollowCredit, me);
}
SetDespawnTime(5000);
StartDespawn();
GetScript()->ProcessEventsFor(SMART_EVENT_FOLLOW_COMPLETED, player);
}
void SmartAI::SetScript9(SmartScriptHolder& e, uint32 entry, WorldObject* invoker)