Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class gossip_test : public CreatureScript
- {
- public:
- gossip_test() : CreatureScript("gossip_test") { }
- struct gossip_testAI : public ScriptedAI
- {
- gossip_testAI(Creature* creature) : ScriptedAI(creature) {}
- void sGossipHello(Player* player)
- {
- AddGossipItemFor(player, GOSSIP_ICON_CHAT, "testone", GOSSIP_SENDER_MAIN, 1);
- AddGossipItemFor(player, GOSSIP_ICON_CHAT, "testwo", GOSSIP_SENDER_MAIN, 2);
- SendGossipMenuFor(player, DEFAULT_GOSSIP_MESSAGE, me);
- }
- void sGossipSelect(Player* player, uint32 sender, uint32 action)
- {
- // UINT32 ACTION ALAWAYS HAVE WRONG VALUE
- if (action == 1)
- {
- me->MonsterYell("testone, LANG_UNIVERSAL, me);
- }
- if (action == 2)
- {
- me->MonsterYell("testwo, LANG_UNIVERSAL, me);
- }
- ClearGossipMenuFor(player);
- CloseGossipMenuFor(player);
- }
- void sGossipSelectCode(Player* player, uint32 sender, uint32 action, char const* code)
- {
- uint32 gold = (atoi(code)) * GOLD;
- player->Yell(to_string(gold), LANG_UNIVERSAL);
- if (player->HasEnoughMoney(gold))
- {
- Wager += gold;
- player->ModifyMoney(-gold, true);
- me->MonsterYell(("Current wager is " + to_string(Wager / GOLD) + " gold").c_str(), LANG_UNIVERSAL, me);
- }
- else
- {
- WorldPacket data(SMSG_BARBER_SHOP_RESULT, 4);
- data << uint32(1); // no money
- player->GetSession()->SendPacket(&data);
- }
- ClearGossipMenuFor(player);
- CloseGossipMenuFor(player);
- }
- };
- CreatureAI* GetAI(Creature* creature) const
- {
- return new gossip_testAI(creature);
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement