#include "StdAfx.h"
#include "Setup.h"
class Key : public GameObjectAIScript
{
public:
Key(GameObject* goinstance) : GameObjectAIScript(goinstance) {}
static GameObjectAIScript *Create(GameObject * GO) { return new Key(GO); }
void OnActivate(Player * pPlayer)
{
if(pPlayer->GetItemInterface()->GetItemCount(140001,false))
this->_gameobject->Activate(pPlayer->GetMapMgr());
else
pPlayer->GetSession()->SendNotification("You need a key to open this.");
}
};
void SetupKey(ScriptMgr * mgr)
{
mgr->register_gameobject_script(198446, &Key::Create);
}