Handle escort quest accept

This commit is contained in:
Yunfan Li
2023-12-24 13:06:43 +08:00
parent 98c87300b0
commit fa260017b1
4 changed files with 14 additions and 2 deletions

View File

@@ -13,6 +13,9 @@ bool QuestConfirmAcceptAction::Execute(Event event)
if (!quest || !bot->CanAddQuest(quest, true)) {
return false;
}
std::ostringstream out;
out << "Quest: " << chat->FormatQuest(quest) << " confirm accept";
botAI->TellMaster(out);
bot->GetSession()->HandleQuestConfirmAccept(sendPacket);
return true;
}

View File

@@ -16,10 +16,10 @@ class Player;
class PlayerbotAI;
class WorldObject;
class QuestConfirmAcceptAction : public QuestAction
class QuestConfirmAcceptAction : public Action
{
public:
QuestConfirmAcceptAction(PlayerbotAI* botAI) : QuestAction(botAI, "quest confirm accept") {}
QuestConfirmAcceptAction(PlayerbotAI* botAI) : Action(botAI, "quest confirm accept") {}
bool Execute(Event event) override;
};

View File

@@ -8,6 +8,7 @@
#include "ItemUsageValue.h"
#include "Object.h"
#include "Playerbots.h"
#include "QuestDef.h"
#include "WorldPacket.h"
void TalkToQuestGiverAction::ProcessQuest(Quest const* quest, Object* questGiver)
@@ -238,6 +239,7 @@ bool TurnInQueryQuestAction::Execute(Event event)
}
}
std::ostringstream out;
out << "Quest ";
switch (status)
{
case QUEST_STATUS_COMPLETE:
@@ -252,6 +254,9 @@ bool TurnInQueryQuestAction::Execute(Event event)
case QUEST_STATUS_FAILED:
out << "|cffff0000Failed|r";
break;
case QUEST_STATUS_REWARDED:
out << "|cffff0000Rewarded|r";
break;
}
out << ": " << chat->FormatQuest(quest);

View File

@@ -24,6 +24,7 @@
#include "QuestAction.h"
#include "PassLeadershipToMasterAction.h"
#include "PetitionSignAction.h"
#include "QuestConfirmAcceptAction.h"
#include "ReadyCheckAction.h"
#include "RememberTaxiAction.h"
#include "ReviveFromCorpseAction.h"
@@ -36,6 +37,7 @@
#include "TradeStatusAction.h"
#include "UseMeetingStoneAction.h"
#include "NamedObjectContext.h"
#include "QuestConfirmAcceptAction.h"
class PlayerbotAI;
@@ -92,6 +94,7 @@ class WorldPacketActionContext : public NamedObjectContext<Action>
creators["see spell"] = &WorldPacketActionContext::see_spell;
creators["arena team accept"] = &WorldPacketActionContext::arena_team_accept;
creators["turn in query quest"] = &WorldPacketActionContext::turn_in_query_quest;
creators["quest confirm accept"] = &WorldPacketActionContext::quest_confirm_accept;
}
private:
@@ -143,6 +146,7 @@ class WorldPacketActionContext : public NamedObjectContext<Action>
static Action* see_spell(PlayerbotAI* botAI) { return new SeeSpellAction(botAI); }
static Action* arena_team_accept(PlayerbotAI* botAI) { return new ArenaTeamAcceptAction(botAI); }
static Action* turn_in_query_quest(PlayerbotAI* botAI) { return new TurnInQueryQuestAction(botAI); }
static Action* quest_confirm_accept(PlayerbotAI* botAI) { return new QuestConfirmAcceptAction(botAI); }
};
#endif