Skip to content

Commit

Permalink
[3150] Fix quest 1249, the missing diplo_pt11
Browse files Browse the repository at this point in the history
Sidenote: Due to changes in escortAI, checking for motion-tpye in MovementInform must be checked in every case.
Added wrapper for this to be prepared for easier transition
Also note that when Reaching the COMBAT_START point for escortAI will no more trigger MovementInform.

Thanks to xfurry for researching, as well as zimms in unified-db/Database~74 for reporting and all others who contributed to the problem research!
  • Loading branch information
Schmoozerd committed Aug 12, 2015
1 parent e73cd17 commit fcdfa6d
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 24 deletions.
8 changes: 7 additions & 1 deletion base/escort_ai.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -227,9 +227,15 @@ void npc_escortAI::UpdateEscortAI(const uint32 /*uiDiff*/)
DoMeleeAttackIfReady(); DoMeleeAttackIfReady();
} }


/// Helper function for transition between old Escort Movment and using WaypointMMGen
bool npc_escortAI::IsSD2EscortMovement(uint32 uiMoveType) const
{
return uiMoveType >= EXTERNAL_WAYPOINT_MOVE;
}

void npc_escortAI::MovementInform(uint32 uiMoveType, uint32 uiPointId) void npc_escortAI::MovementInform(uint32 uiMoveType, uint32 uiPointId)
{ {
if (uiMoveType < EXTERNAL_WAYPOINT_MOVE || !HasEscortState(STATE_ESCORT_ESCORTING)) if (!IsSD2EscortMovement(uiMoveType) || !HasEscortState(STATE_ESCORT_ESCORTING))
return; return;


//uint32 pathId = uiMoveType & 0xFF; //uint32 pathId = uiMoveType & 0xFF;
Expand Down
1 change: 1 addition & 0 deletions base/escort_ai.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ struct npc_escortAI : public ScriptedAI


protected: protected:
Player* GetPlayerForEscort() { return m_creature->GetMap()->GetPlayer(m_playerGuid); } Player* GetPlayerForEscort() { return m_creature->GetMap()->GetPlayer(m_playerGuid); }
bool IsSD2EscortMovement(uint32 uiMoveType) const;
virtual void JustStartedEscort() {} virtual void JustStartedEscort() {}


private: private:
Expand Down
39 changes: 17 additions & 22 deletions scripts/eastern_kingdoms/wetlands.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ enum
SAY_FRIEND_DEFEAT = -1000979, SAY_FRIEND_DEFEAT = -1000979,
SAY_SLIM_NOTES = -1000980, SAY_SLIM_NOTES = -1000980,


QUEST_MISSING_DIPLO_PT11 = 1249, QUEST_MISSING_DIPLOMAT11 = 1249,
FACTION_ENEMY = 168, // ToDo: faction needs to be confirmed! FACTION_ENEMY = 168, // ToDo: faction needs to be confirmed!


SPELL_STEALTH = 1785, SPELL_STEALTH = 1785,
Expand All @@ -54,7 +54,7 @@ static const DialogueEntry aDiplomatDialogue[] =
{ {
{SAY_SLIM_DEFEAT, NPC_TAPOKE_SLIM_JAHN, 4000}, {SAY_SLIM_DEFEAT, NPC_TAPOKE_SLIM_JAHN, 4000},
{SAY_SLIM_NOTES, NPC_TAPOKE_SLIM_JAHN, 7000}, {SAY_SLIM_NOTES, NPC_TAPOKE_SLIM_JAHN, 7000},
{QUEST_MISSING_DIPLO_PT11, 0, 0}, {QUEST_MISSING_DIPLOMAT11, 0, 0},
{0, 0, 0}, {0, 0, 0},
}; };


Expand All @@ -78,6 +78,18 @@ struct npc_tapoke_slim_jahnAI : public npc_escortAI, private DialogueHelper
} }
} }


void JustReachedHome() override
{
// after the npc is defeated, start the dialog right after it reaches the evade point
if (m_bEventComplete)
{
if (Player* pPlayer = GetPlayerForEscort())
m_creature->SetFacingToObject(pPlayer);

StartNextDialogueText(SAY_SLIM_DEFEAT);
}
}

void WaypointReached(uint32 uiPointId) override void WaypointReached(uint32 uiPointId) override
{ {
switch (uiPointId) switch (uiPointId)
Expand Down Expand Up @@ -137,23 +149,6 @@ struct npc_tapoke_slim_jahnAI : public npc_escortAI, private DialogueHelper
} }
} }


void MovementInform(uint32 uiMoveType, uint32 uiPointId) override
{
if (uiMoveType != POINT_MOTION_TYPE || !HasEscortState(STATE_ESCORT_ESCORTING))
return;

npc_escortAI::MovementInform(uiMoveType, uiPointId);

// after the npc is defeated, start the dialog right after it reaches the evade point
if (m_bEventComplete)
{
if (Player* pPlayer = GetPlayerForEscort())
m_creature->SetFacingToObject(pPlayer);

StartNextDialogueText(SAY_SLIM_DEFEAT);
}
}

void ReceiveAIEvent(AIEventType eventType, Creature* /*pSender*/, Unit* pInvoker, uint32 uiMiscValue) override void ReceiveAIEvent(AIEventType eventType, Creature* /*pSender*/, Unit* pInvoker, uint32 uiMiscValue) override
{ {
// start escort // start escort
Expand All @@ -163,11 +158,11 @@ struct npc_tapoke_slim_jahnAI : public npc_escortAI, private DialogueHelper


void JustDidDialogueStep(int32 iEntry) override void JustDidDialogueStep(int32 iEntry) override
{ {
if (iEntry == QUEST_MISSING_DIPLO_PT11) if (iEntry == QUEST_MISSING_DIPLOMAT11)
{ {
// complete quest // complete quest
if (Player* pPlayer = GetPlayerForEscort()) if (Player* pPlayer = GetPlayerForEscort())
pPlayer->GroupEventHappens(QUEST_MISSING_DIPLO_PT11, m_creature); pPlayer->GroupEventHappens(QUEST_MISSING_DIPLOMAT11, m_creature);


// despawn and respawn at inn // despawn and respawn at inn
m_creature->ForcedDespawn(1000); m_creature->ForcedDespawn(1000);
Expand Down Expand Up @@ -205,7 +200,7 @@ CreatureAI* GetAI_npc_tapoke_slim_jahn(Creature* pCreature)


bool QuestAccept_npc_mikhail(Player* pPlayer, Creature* pCreature, const Quest* pQuest) bool QuestAccept_npc_mikhail(Player* pPlayer, Creature* pCreature, const Quest* pQuest)
{ {
if (pQuest->GetQuestId() == QUEST_MISSING_DIPLO_PT11) if (pQuest->GetQuestId() == QUEST_MISSING_DIPLOMAT11)
{ {
Creature* pSlim = GetClosestCreatureWithEntry(pCreature, NPC_TAPOKE_SLIM_JAHN, 25.0f); Creature* pSlim = GetClosestCreatureWithEntry(pCreature, NPC_TAPOKE_SLIM_JAHN, 25.0f);
if (!pSlim) if (!pSlim)
Expand Down
2 changes: 1 addition & 1 deletion sd2_revision_nr.h
Original file line number Original file line Diff line number Diff line change
@@ -1,4 +1,4 @@
#ifndef __SD2_REVISION_NR_H__ #ifndef __SD2_REVISION_NR_H__
#define __SD2_REVISION_NR_H__ #define __SD2_REVISION_NR_H__
#define SD2_REVISION_NR "3149" #define SD2_REVISION_NR "3150"
#endif // __SD2_REVISION_NR_H__ #endif // __SD2_REVISION_NR_H__

0 comments on commit fcdfa6d

Please sign in to comment.