Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "Creature.h"
- #include "Player.h"
- #include "ScriptMgr.h"
- #include "ScriptedGossip.h"
- #include "ScriptedCreature.h"
- #include "Define.h"
- class example : public CreatureScript
- {
- public:
- example() : CreatureScript("example") { }
- struct example_AI : public ScriptedAI
- {
- example_AI(Creature* creature) : ScriptedAI(creature) { }
- bool GossipHello(Player* player) override
- {
- if (me->IsQuestGiver())
- player->PrepareQuestMenu(me->GetGUID());
- AddGossipItemFor(player, 0, "Example 1 - Show main menu", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
- AddGossipItemFor(player, 0, "Example 2 - Exit", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2);
- SendGossipMenuFor(player, GOSSIP_MENU_I_HAVE_LONG_KNOWN, me->GetGUID());
- return true;
- }
- bool GossipSelect(Player* player, uint32 /*menuId*/, uint32 gossipListId) override
- {
- uint32 const sender = player->PlayerTalkClass->GetGossipOptionSender(gossipListId);
- uint32 const action = player->PlayerTalkClass->GetGossipOptionAction(gossipListId);
- ClearGossipMenuFor(player);
- if (sender == GOSSIP_SENDER_MAIN)
- {
- if (action == GOSSIP_ACTION_INFO_DEF + 1)
- {
- GossipHello(player);
- }
- if (action == GOSSIP_ACTION_INFO_DEF + 2)
- {
- CloseGossipMenuFor(player);
- }
- }
- return true;
- }
- };
- CreatureAI* GetAI(Creature* creature) const override
- {
- return new example_AI(creature);
- }
- };
- void AddSC_example()
- {
- new example();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement