mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-01-21 12:37:05 +00:00
Rogue bots can unlock items in their bags and in the trade window (#1055)
This commit is contained in:
38
src/strategy/actions/UnlockItemAction.cpp
Normal file
38
src/strategy/actions/UnlockItemAction.cpp
Normal file
@@ -0,0 +1,38 @@
|
||||
#include "UnlockItemAction.h"
|
||||
#include "PlayerbotAI.h"
|
||||
#include "ItemTemplate.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "Player.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "SpellInfo.h"
|
||||
|
||||
#define PICK_LOCK_SPELL_ID 1804
|
||||
|
||||
bool UnlockItemAction::Execute(Event event)
|
||||
{
|
||||
bool foundLockedItem = false;
|
||||
|
||||
Item* item = botAI->FindLockedItem();
|
||||
if (item)
|
||||
{
|
||||
UnlockItem(item);
|
||||
foundLockedItem = true;
|
||||
}
|
||||
|
||||
return foundLockedItem;
|
||||
}
|
||||
|
||||
void UnlockItemAction::UnlockItem(Item* item)
|
||||
{
|
||||
// Use CastSpell to unlock the item
|
||||
if (botAI->CastSpell(PICK_LOCK_SPELL_ID, bot, item))
|
||||
{
|
||||
std::ostringstream out;
|
||||
out << "Used Pick Lock on: " << item->GetTemplate()->Name1;
|
||||
botAI->TellMaster(out.str());
|
||||
}
|
||||
else
|
||||
{
|
||||
botAI->TellError("Failed to cast Pick Lock.");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user