Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.93 KB | None | 0 0
  1. class gossip_test : public CreatureScript
  2. {
  3. public:
  4. gossip_test() : CreatureScript("gossip_test") { }
  5.  
  6. struct gossip_testAI : public ScriptedAI
  7. {
  8. gossip_testAI(Creature* creature) : ScriptedAI(creature) {}
  9.  
  10. void sGossipHello(Player* player)
  11. {
  12. AddGossipItemFor(player, GOSSIP_ICON_CHAT, "testone", GOSSIP_SENDER_MAIN, 1);
  13. AddGossipItemFor(player, GOSSIP_ICON_CHAT, "testwo", GOSSIP_SENDER_MAIN, 2);
  14. SendGossipMenuFor(player, DEFAULT_GOSSIP_MESSAGE, me);
  15. }
  16. void sGossipSelect(Player* player, uint32 sender, uint32 action)
  17. {
  18.  
  19. // UINT32 ACTION ALAWAYS HAVE WRONG VALUE
  20. if (action == 1)
  21. {
  22. me->MonsterYell("testone, LANG_UNIVERSAL, me);
  23. }
  24.  
  25. if (action == 2)
  26. {
  27. me->MonsterYell("testwo, LANG_UNIVERSAL, me);
  28. }
  29.  
  30. ClearGossipMenuFor(player);
  31. CloseGossipMenuFor(player);
  32. }
  33. void sGossipSelectCode(Player* player, uint32 sender, uint32 action, char const* code)
  34. {
  35. uint32 gold = (atoi(code)) * GOLD;
  36. player->Yell(to_string(gold), LANG_UNIVERSAL);
  37. if (player->HasEnoughMoney(gold))
  38. {
  39. Wager += gold;
  40. player->ModifyMoney(-gold, true);
  41. me->MonsterYell(("Current wager is " + to_string(Wager / GOLD) + " gold").c_str(), LANG_UNIVERSAL, me);
  42. }
  43. else
  44. {
  45. WorldPacket data(SMSG_BARBER_SHOP_RESULT, 4);
  46. data << uint32(1); // no money
  47. player->GetSession()->SendPacket(&data);
  48. }
  49.  
  50. ClearGossipMenuFor(player);
  51. CloseGossipMenuFor(player);
  52. }
  53. };
  54.  
  55. CreatureAI* GetAI(Creature* creature) const
  56. {
  57. return new gossip_testAI(creature);
  58. }
  59. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement