Advertisement
randy336

[Trinity] Lottery System

Nov 20th, 2013
529
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.68 KB | None | 0 0
  1. /*
  2. <--------------------------------------------------------------------------->
  3. - Made by: ??
  4. - Developer(s): Ghostcrawler336
  5. - Complete: %100
  6. - ScriptName: 'Lotto system'
  7. - Comment: N/A
  8. <--------------------------------------------------------------------------->
  9. */
  10. #include "ScriptPCH.h"
  11.  
  12. enum eEnums
  13. {
  14.     ITEM_LOTTO   = 200800,
  15.    
  16. };
  17.  
  18. class npc_lotto : public CreatureScript
  19. {
  20.     public:
  21.         npc_lotto() : CreatureScript("npc_lotto") { }
  22.  
  23.         bool OnGossipHello(Player* player, Creature* creature)
  24.         {
  25.             if (player->HasItemCount(ITEM_LOTTO, 1, false))
  26.             {
  27.                 player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Test your luck in the lottery this week.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
  28.             }
  29.             else
  30.                 creature->MonsterWhisper("You don't have enough Lottery Tickets", player->GetGUID());
  31.  
  32.             player->PlayerTalkClass->SendGossipMenu(65002, creature->GetGUID());
  33.             return true;
  34.         }
  35.  
  36.         bool OnGossipSelect(Player* player, Creature* creature, uint32 sender, uint32 action)
  37.         {
  38.            
  39.             player->PlayerTalkClass->ClearMenus();
  40.             player->CLOSE_GOSSIP_MENU();
  41.         switch (action)
  42.             {
  43.             case GOSSIP_ACTION_INFO_DEF+1:
  44.                 creature->MonsterWhisper("Greetings competitor! Thank you for purchasing your Lottery ticket, we give out prizes every Monday. Prizes change every week!", player->GetGUID());
  45.                 WorldDatabase.PExecute("INSERT INTO game_lotto (entry, comment) values ('%s',0)", player->GetName().c_str());
  46.                 player->DestroyItemCount(ITEM_LOTTO, 1, true, false);
  47.                 break;
  48.             }
  49.  
  50.             player->CLOSE_GOSSIP_MENU();
  51.             return true;
  52.         }
  53.  
  54.  
  55. };
  56.  
  57. void AddSC_npc_lotto()
  58. {
  59.     new npc_lotto();
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement