mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-01-17 10:45:43 +00:00
Big update.
This commit is contained in:
39
src/strategy/actions/ShareQuestAction.cpp
Normal file
39
src/strategy/actions/ShareQuestAction.cpp
Normal file
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "ShareQuestAction.h"
|
||||
#include "Event.h"
|
||||
#include "Playerbots.h"
|
||||
|
||||
bool ShareQuestAction::Execute(Event event)
|
||||
{
|
||||
std::string const link = event.getParam();
|
||||
if (!GetMaster())
|
||||
return false;
|
||||
|
||||
PlayerbotChatHandler handler(GetMaster());
|
||||
uint32 entry = handler.extractQuestId(link);
|
||||
if (!entry)
|
||||
return false;
|
||||
|
||||
Quest const* quest = sObjectMgr->GetQuestTemplate(entry);
|
||||
if (!quest)
|
||||
return false;
|
||||
|
||||
// remove all quest entries for 'entry' from quest log
|
||||
for (uint8 slot = 0; slot < MAX_QUEST_LOG_SIZE; ++slot)
|
||||
{
|
||||
uint32 logQuest = bot->GetQuestSlotQuestId(slot);
|
||||
if (logQuest == entry)
|
||||
{
|
||||
WorldPacket p;
|
||||
p << entry;
|
||||
bot->GetSession()->HandlePushQuestToParty(p);
|
||||
botAI->TellMaster("Quest shared");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
Reference in New Issue
Block a user