MichaelCrow

Untitled

Oct 26th, 2012
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. #include "ScriptPCH.h"
  2.  
  3. class Innkeep : public CreatureScript
  4. {
  5. public:
  6. Innkeep() : CreatureScript("Innkeep") { }
  7.  
  8. bool OnGossipHello(Player * pPlayer, Creature * pCreature)
  9. {
  10. pPlayer->ADD_GOSSIP_ITEM(6, "Purchase Goods.", GOSSIP_SENDER_MAIN, 0);
  11. pPlayer->ADD_GOSSIP_ITEM(10, "Nevermind.", GOSSIP_SENDER_MAIN, 2);
  12. pPlayer->PlayerTalkClass->SendGossipMenu(907, pCreature->GetGUID());
  13. }
  14. }
  15. bool OnGossipSelect(Player * player, Creature * creature, uint32 sender, uint32 uiAction)
  16. {
  17. int random;
  18. random = rand() % 100 + 1;
  19. if (sender == GOSSIP_SENDER_MAIN)
  20. {
  21. switch(uiAction)
  22. {
  23. case 0:
  24. if (random < 26)
  25. {
  26. player->GetSession()->SendListInventory(creature->GetGUID());
  27. }
  28. else
  29. {
  30. player->CLOSE_GOSSIP_MENU();
  31. creature->setFaction(14);
  32. creature->Attack(player, true);
  33. }
  34. break;
  35. case 2:
  36. player->CLOSE_GOSSIP_MENU();
  37. break;
  38. }
  39. }
  40. };
  41.  
  42. void AddSC_Innkeep()
  43. {
  44. new Innkeep();
  45. }
Advertisement
Add Comment
Please, Sign In to add comment