Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "ScriptMgr.h"
- #include "ScriptedCreature.h"
- #include "ScriptedGossip.h"
- #include "GameEventMgr.h"
- #include "Player.h"
- #include "WorldSession.h"
- #include <stdlib.h>
- // Colors
- #define TEXT_LIGHTBLUE "|cFF00FFFC"
- #define TEXT_RED "|cffA40000"
- #define TEXT_GREEN "|cffABD473"
- class GoldGambling : public CreatureScript
- {
- public:
- GoldGambling() : CreatureScript("GoldGambling")
- {
- }
- bool OnGossipHello(Player* player, Creature* creature)
- {
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_MONEY_BAG, TEXT_LIGHTBLUE"I want to gamble!!", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, TEXT_RED"Nevermind..", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2);
- player->PlayerTalkClass->SendGossipMenu(1, creature->GetGUID());
- return true;
- }
- bool OnGossipSelect(Player* player, Creature * creature, uint32 Sender, uint32 action)
- {
- player->PlayerTalkClass->ClearMenus();
- if (Sender == GOSSIP_SENDER_MAIN)
- switch (action)
- {
- case GOSSIP_ACTION_INFO_DEF + 1:
- if (player->GetMoney() > 1000000)
- {
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, TEXT_LIGHTBLUE "-> Gamble " TEXT_RED "100 GOLD", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6);
- player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID());
- if (player->GetMoney() > 2500000)
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, TEXT_LIGHTBLUE "-> Gamble " TEXT_RED "250 GOLD", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 7);
- player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID());
- if (player->GetMoney() > 5000000)
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, TEXT_LIGHTBLUE "-> Gamble " TEXT_RED "500 GOLD", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 8);
- player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID());
- if (player->GetMoney() > 10000000)
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, TEXT_LIGHTBLUE "-> Gamble " TEXT_RED "1000 GOLD", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 9);
- player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID());
- return true;
- }
- else
- {
- creature->Whisper(TEXT_RED"Sorry you do not have the required gold to play!", LANG_UNIVERSAL, player);
- player->PlayerTalkClass->SendCloseGossip();
- return true;
- }
- case GOSSIP_ACTION_INFO_DEF + 2:
- {
- player->PlayerTalkClass->SendCloseGossip();
- return true;
- }
- case GOSSIP_ACTION_INFO_DEF + 6:
- {
- if (player->GetMoney() > 1999999)
- {
- player->ModifyMoney(-1000000);
- uint32 number = urand(0, 10);
- if (number == 2)
- {
- player->ModifyMoney(2000000);
- creature->Whisper(TEXT_LIGHTBLUE"CONGRATZ YOU WON!! " TEXT_GREEN "200 GOLD", LANG_UNIVERSAL, player);
- player->PlayerTalkClass->SendCloseGossip();
- return true;
- }
- else
- {
- creature->Whisper(TEXT_LIGHTBLUE" I'm sorry but you lost! :(" TEXT_RED "100 GOLD", LANG_UNIVERSAL, player);
- player->PlayerTalkClass->SendCloseGossip();
- return true;
- }
- }
- else
- {
- creature->Whisper(TEXT_RED"Sorry you do not have the required gold to play!", LANG_UNIVERSAL, player);
- player->PlayerTalkClass->SendCloseGossip();
- return true;
- }
- }
- case GOSSIP_ACTION_INFO_DEF + 7:
- {
- if (player->GetMoney() > 2500000)
- {
- player->ModifyMoney(-2500000);
- uint32 number = urand(0, 10);
- if (number == 2)
- {
- player->ModifyMoney(5000000);
- creature->Whisper(TEXT_LIGHTBLUE"CONGRATZ YOU WON!! " TEXT_GREEN "500 GOLD", LANG_UNIVERSAL, player);
- player->PlayerTalkClass->SendCloseGossip();
- return true;
- }
- else
- {
- creature->Whisper(TEXT_LIGHTBLUE" I'm sorry but you lost! :(" TEXT_RED "250 GOLD", LANG_UNIVERSAL, player);
- player->PlayerTalkClass->SendCloseGossip();
- return true;
- }
- }
- else
- {
- creature->Whisper(TEXT_RED"Sorry you do not have the required gold to play!", LANG_UNIVERSAL, player);
- player->PlayerTalkClass->SendCloseGossip();
- return true;
- }
- return true;
- }
- case GOSSIP_ACTION_INFO_DEF +8:
- {
- if (player->GetMoney() > 5000000)
- {
- player->ModifyMoney(-5000000);
- uint32 number = urand(0, 10);
- if (number == 2)
- {
- player->ModifyMoney(10000000);
- creature->Whisper(TEXT_LIGHTBLUE"CONGRATZ YOU WON!! " TEXT_GREEN "1000 GOLD", LANG_UNIVERSAL, player);
- player->PlayerTalkClass->SendCloseGossip();
- return true;
- }
- else
- {
- creature->Whisper(TEXT_LIGHTBLUE" I'm sorry but you lost! :(" TEXT_RED "500 GOLD", LANG_UNIVERSAL, player);
- player->PlayerTalkClass->SendCloseGossip();
- return true;
- }
- }
- else
- {
- creature->Whisper(TEXT_RED"Sorry you do not have the required gold to play!", LANG_UNIVERSAL, player);
- player->PlayerTalkClass->SendCloseGossip();
- return true;
- }
- }
- case GOSSIP_ACTION_INFO_DEF +9:
- {
- player->ModifyMoney(-10000000);
- uint32 number = urand(0, 10);
- if (number == 2)
- {
- player->ModifyMoney(20000000);
- creature->Whisper(TEXT_LIGHTBLUE"CONGRATZ YOU WON!! " TEXT_GREEN "2000 GOLD", LANG_UNIVERSAL, player);
- player->PlayerTalkClass->SendCloseGossip();
- return true;
- }
- else
- {
- creature->Whisper(TEXT_LIGHTBLUE" I'm sorry but you lost! :(" TEXT_RED "1000 GOLD", LANG_UNIVERSAL, player);
- player->PlayerTalkClass->SendCloseGossip();
- return true;
- }
- }
- return true;
- }
- return true;
- }
- };
- void addSC_GoldGambling()
- {
- new GoldGambling();
- }
Advertisement
Add Comment
Please, Sign In to add comment