Guest User

1234

a guest
Oct 19th, 2015
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 5.71 KB | None | 0 0
  1.  
  2. #include "ScriptMgr.h"
  3. #include "ScriptedCreature.h"
  4. #include "ScriptedGossip.h"
  5. #include "GameEventMgr.h"
  6. #include "Player.h"
  7. #include "WorldSession.h"
  8. #include <stdlib.h>
  9.  
  10. // Colors
  11. #define TEXT_LIGHTBLUE                                    "|cFF00FFFC"
  12. #define TEXT_RED                                          "|cffA40000"
  13. #define TEXT_GREEN                                        "|cffABD473"
  14.  
  15. class GoldGambling : public  CreatureScript
  16. {
  17. public:
  18.     GoldGambling() : CreatureScript("GoldGambling")
  19.     {
  20.  
  21.     }
  22.     bool OnGossipHello(Player* player, Creature* creature)
  23.     {
  24.         player->ADD_GOSSIP_ITEM(GOSSIP_ICON_MONEY_BAG, TEXT_LIGHTBLUE"I want to gamble!!", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
  25.         player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, TEXT_RED"Nevermind..", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2);
  26.         player->PlayerTalkClass->SendGossipMenu(1, creature->GetGUID());
  27.         return true;
  28.     }
  29.  
  30.  
  31.     bool OnGossipSelect(Player* player, Creature * creature, uint32 Sender, uint32 action)
  32.     {
  33.         player->PlayerTalkClass->ClearMenus();
  34.         if (Sender == GOSSIP_SENDER_MAIN)
  35.             switch (action)
  36.             {
  37.             case GOSSIP_ACTION_INFO_DEF + 1:
  38.                 if (player->GetMoney() > 1000000)
  39.  
  40.                 {
  41.                     player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, TEXT_LIGHTBLUE "-> Gamble " TEXT_RED "100 GOLD", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6);
  42.                     player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID());
  43.                     if (player->GetMoney() > 2500000)
  44.                         player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, TEXT_LIGHTBLUE "-> Gamble " TEXT_RED "250 GOLD", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 7);
  45.                     player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID());
  46.                     if (player->GetMoney() > 5000000)
  47.                         player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, TEXT_LIGHTBLUE "-> Gamble " TEXT_RED "500 GOLD", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 8);
  48.                     player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID());
  49.  
  50.                         if (player->GetMoney() > 10000000)
  51.                             player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, TEXT_LIGHTBLUE "-> Gamble " TEXT_RED "1000 GOLD", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 9);
  52.                         player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID());
  53.                             return true;
  54.                 }
  55.            
  56.                 else
  57.                 {
  58.                     creature->Whisper(TEXT_RED"Sorry you do not have the required gold to play!", LANG_UNIVERSAL, player);
  59.                     player->PlayerTalkClass->SendCloseGossip();
  60.                     return true;
  61.                 }
  62.             case GOSSIP_ACTION_INFO_DEF + 2:
  63.             {
  64.                 player->PlayerTalkClass->SendCloseGossip();
  65.                 return true;
  66.             }
  67.             case GOSSIP_ACTION_INFO_DEF + 6:
  68.             {
  69.                 if (player->GetMoney() > 1999999)
  70.                 {
  71.                     player->ModifyMoney(-1000000);
  72.                     uint32 number = urand(0, 10);
  73.                     if (number == 2)
  74.                     {
  75.                         player->ModifyMoney(2000000);
  76.                         creature->Whisper(TEXT_LIGHTBLUE"CONGRATZ YOU WON!! " TEXT_GREEN "200 GOLD", LANG_UNIVERSAL, player);
  77.                         player->PlayerTalkClass->SendCloseGossip();
  78.                         return true;
  79.  
  80.                     }
  81.  
  82.                     else
  83.                     {
  84.                         creature->Whisper(TEXT_LIGHTBLUE" I'm sorry but you lost! :(" TEXT_RED "100 GOLD", LANG_UNIVERSAL, player);
  85.                         player->PlayerTalkClass->SendCloseGossip();
  86.                         return true;
  87.                     }
  88.                 }
  89.                 else
  90.                 {
  91.                     creature->Whisper(TEXT_RED"Sorry you do not have the required gold to play!", LANG_UNIVERSAL, player);
  92.                     player->PlayerTalkClass->SendCloseGossip();
  93.                     return true;
  94.                 }
  95.             }
  96.             case GOSSIP_ACTION_INFO_DEF + 7:
  97.             {
  98.                 if (player->GetMoney() > 2500000)
  99.                 {
  100.                     player->ModifyMoney(-2500000);
  101.                     uint32 number = urand(0, 10);
  102.                     if (number == 2)
  103.                     {
  104.                         player->ModifyMoney(5000000);
  105.                         creature->Whisper(TEXT_LIGHTBLUE"CONGRATZ YOU WON!! " TEXT_GREEN "500 GOLD", LANG_UNIVERSAL, player);
  106.                         player->PlayerTalkClass->SendCloseGossip();
  107.                         return true;
  108.  
  109.                     }
  110.                     else
  111.                     {
  112.                         creature->Whisper(TEXT_LIGHTBLUE" I'm sorry but you lost! :(" TEXT_RED "250 GOLD", LANG_UNIVERSAL, player);
  113.                         player->PlayerTalkClass->SendCloseGossip();
  114.                         return true;
  115.                     }
  116.                 }
  117.                 else
  118.                 {
  119.                     creature->Whisper(TEXT_RED"Sorry you do not have the required gold to play!", LANG_UNIVERSAL, player);
  120.                     player->PlayerTalkClass->SendCloseGossip();
  121.                     return true;
  122.                 }
  123.                 return true;
  124.             }
  125.             case GOSSIP_ACTION_INFO_DEF +8:
  126.             {
  127.                 if (player->GetMoney() > 5000000)
  128.                 {
  129.                     player->ModifyMoney(-5000000);
  130.                     uint32 number = urand(0, 10);
  131.                     if (number == 2)
  132.                     {
  133.                         player->ModifyMoney(10000000);
  134.                         creature->Whisper(TEXT_LIGHTBLUE"CONGRATZ YOU WON!! " TEXT_GREEN "1000 GOLD", LANG_UNIVERSAL, player);
  135.                         player->PlayerTalkClass->SendCloseGossip();
  136.                         return true;
  137.  
  138.                     }
  139.                     else
  140.                     {
  141.                         creature->Whisper(TEXT_LIGHTBLUE" I'm sorry but you lost! :(" TEXT_RED "500 GOLD", LANG_UNIVERSAL, player);
  142.                         player->PlayerTalkClass->SendCloseGossip();
  143.                         return true;
  144.                     }
  145.                 }
  146.                 else
  147.                 {
  148.                     creature->Whisper(TEXT_RED"Sorry you do not have the required gold to play!", LANG_UNIVERSAL, player);
  149.                     player->PlayerTalkClass->SendCloseGossip();
  150.                     return true;
  151.                 }
  152.             }
  153.             case GOSSIP_ACTION_INFO_DEF +9:
  154.             {
  155.                 player->ModifyMoney(-10000000);
  156.                 uint32 number = urand(0, 10);
  157.                 if (number == 2)
  158.                 {
  159.                     player->ModifyMoney(20000000);
  160.                     creature->Whisper(TEXT_LIGHTBLUE"CONGRATZ YOU WON!! " TEXT_GREEN "2000 GOLD", LANG_UNIVERSAL, player);
  161.                     player->PlayerTalkClass->SendCloseGossip();
  162.                     return true;
  163.  
  164.                 }
  165.                 else
  166.                 {
  167.                     creature->Whisper(TEXT_LIGHTBLUE" I'm sorry but you lost! :(" TEXT_RED "1000 GOLD", LANG_UNIVERSAL, player);
  168.                     player->PlayerTalkClass->SendCloseGossip();
  169.                     return true;
  170.                 }
  171.             }
  172.             return true;
  173.  
  174.             }
  175.         return true;
  176.     }
  177.    
  178. };
  179.  
  180.  
  181.  
  182. void addSC_GoldGambling()
  183. {
  184.     new GoldGambling();
  185.  
  186. }
Advertisement
Add Comment
Please, Sign In to add comment