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