Untitled diff
34 lines
#include "ScriptMgr.h"
#include "ScriptMgr.h"
#include "Player.h"
#include "Player.h"
#include "Creature.h"
#include "Creature.h"
#include "ScriptedCreature.h"
class TestGossip : public CreatureScript
class TestGossip : public CreatureScript
{
{
public:
public:
TestGossip() : CreatureScript("TestGossip") { }
TestGossip() : CreatureScript("TestGossip") { }
bool OnGossipHello(Player* player, Creature* creature) override
static bool OnGossipHello(Player* player, Creature* creature)
{
{
// code
// code
return true;
return true;
}
}
bool OnGossipSelect(Player* player, Creature* creature, uint32 sender, uint32 action) override
static bool OnGossipSelect(Player* player, Creature* creature, uint32 sender, uint32 action)
{
{
player->PlayerTalkClass->ClearMenus();
player->PlayerTalkClass->ClearMenus();
// code
// code
return true;
return true;
}
}
bool OnGossipSelectCode(Player* player, Creature* creature, uint32 sender, uint32 action, char const* code) override
static bool OnGossipSelectCode(Player* player, Creature* creature, uint32 sender, uint32 action, char const* code)
{
{
player->PlayerTalkClass->ClearMenus();
player->PlayerTalkClass->ClearMenus();
// code
// code
return true;
return true;
}
}
struct MyAI : public ScriptedAI
{
MyAI(Creature* creature) : ScriptedAI(creature) { }
bool GossipHello(Player* player) override
{
return OnGossipHello(player, me);
}
bool GossipSelect(Player* player, uint32 menuId, uint32 gossipListId) override
{
uint32 sender = player->PlayerTalkClass->GetGossipOptionSender(gossipListId);
uint32 action = player->PlayerTalkClass->GetGossipOptionAction(gossipListId);
return OnGossipSelect(player, me, sender, action);
}
bool GossipSelectCode(Player* player, uint32 menuId, uint32 gossipListId, char const* code) override
{
uint32 sender = player->PlayerTalkClass->GetGossipOptionSender(gossipListId);
uint32 action = player->PlayerTalkClass->GetGossipOptionAction(gossipListId);
return OnGossipSelectCode(player, me, sender, action, code);
}
};
CreatureAI* GetAI(Creature* creature) const override
{
return new MyAI(creature);
}
};
};
void AddSC_TestGossip()
void AddSC_TestGossip()
{
{
new TestGossip;
new TestGossip;
}
}