quest confirm accept(group quest)

This commit is contained in:
Yunfan Li
2023-11-01 23:23:01 +08:00
parent af44b22ce1
commit 5c579ecf17
5 changed files with 48 additions and 1 deletions

View File

@@ -166,7 +166,8 @@ PlayerbotAI::PlayerbotAI(Player* bot) : PlayerbotAIBase(true), bot(bot), chatHel
botOutgoingPacketHandlers.AddHandler(SMSG_EMOTE, "receive emote");
botOutgoingPacketHandlers.AddHandler(SMSG_LOOT_START_ROLL, "master loot roll");
botOutgoingPacketHandlers.AddHandler(SMSG_ARENA_TEAM_INVITE, "arena team invite");
botOutgoingPacketHandlers.AddHandler(SMSG_QUEST_CONFIRM_ACCEPT, "quest confirm accept");
masterOutgoingPacketHandlers.AddHandler(SMSG_PARTY_COMMAND_RESULT, "party command");
masterOutgoingPacketHandlers.AddHandler(MSG_RAID_READY_CHECK, "ready check");
masterOutgoingPacketHandlers.AddHandler(MSG_RAID_READY_CHECK_FINISHED, "ready check finished");

View File

@@ -0,0 +1,18 @@
#include "QuestConfirmAcceptAction.h"
#include "WorldPacket.h"
bool QuestConfirmAcceptAction::Execute(Event event)
{
WorldPacket packet(event.getPacket());
uint32 questId;
packet >> questId;
WorldPacket sendPacket(CMSG_QUEST_CONFIRM_ACCEPT);
sendPacket << questId;
Quest const* quest = sObjectMgr->GetQuestTemplate(questId);
if (!quest || !bot->CanAddQuest(quest, true)) {
return false;
}
bot->GetSession()->HandleQuestConfirmAccept(sendPacket);
return true;
}

View File

@@ -0,0 +1,25 @@
/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license, you may redistribute it and/or modify it under version 2 of the License, or (at your option), any later version.
*/
#ifndef _PLAYERBOT_QUESTCONFIRMACCEPTACTION_H
#define _PLAYERBOT_QUESTCONFIRMACCEPTACTION_H
#include "PlayerbotAI.h"
#include "QuestAction.h"
#include "Player.h"
class ObjectGuid;
class Quest;
class Player;
class PlayerbotAI;
class WorldObject;
class QuestConfirmAcceptAction : public QuestAction
{
public:
QuestConfirmAcceptAction(PlayerbotAI* botAI) : QuestAction(botAI, "quest confirm accept") {}
bool Execute(Event event) override;
};
#endif

View File

@@ -32,6 +32,7 @@ void WorldPacketHandlerStrategy::InitTriggers(std::vector<TriggerNode*>& trigger
triggers.push_back(new TriggerNode("lfg proposal", NextAction::array(0, new NextAction("lfg accept", relevance), nullptr)));
triggers.push_back(new TriggerNode("lfg proposal active", NextAction::array(0, new NextAction("lfg accept", relevance), nullptr)));
triggers.push_back(new TriggerNode("arena team invite", NextAction::array(0, new NextAction("arena team accept", relevance), nullptr)));
triggers.push_back(new TriggerNode("quest confirm accept", NextAction::array(0, new NextAction("quest confirm accept", relevance), nullptr)));
//triggers.push_back(new TriggerNode("no non bot players around", NextAction::array(0, new NextAction("delay", relevance), nullptr)));
triggers.push_back(new TriggerNode("bg status", NextAction::array(0, new NextAction("bg status", relevance), nullptr)));
triggers.push_back(new TriggerNode("xpgain", NextAction::array(0, new NextAction("xp gain", relevance), nullptr)));

View File

@@ -60,6 +60,7 @@ class WorldPacketTriggerContext : public NamedObjectContext<Trigger>
creators["receive emote"] = &WorldPacketTriggerContext::receive_emote;
creators["receive text emote"] = &WorldPacketTriggerContext::receive_text_emote;
creators["arena team invite"] = &WorldPacketTriggerContext::arena_team_invite;
creators["quest confirm accept"] = &WorldPacketTriggerContext::quest_confirm_accept;
}
private:
@@ -109,6 +110,7 @@ class WorldPacketTriggerContext : public NamedObjectContext<Trigger>
static Trigger* receive_emote(PlayerbotAI* botAI) { return new WorldPacketTrigger(botAI, "receive emote"); }
static Trigger* receive_text_emote(PlayerbotAI* botAI) { return new WorldPacketTrigger(botAI, "receive text emote"); }
static Trigger* arena_team_invite(PlayerbotAI* botAI) { return new WorldPacketTrigger(botAI, "arena team invite"); }
static Trigger* quest_confirm_accept(PlayerbotAI* botAI) { return new WorldPacketTrigger(botAI, "quest confirm accept"); }
};
#endif