#include"NPCs.h"
#include"NPCsScripts.h"
#include"Player.h"
// Mr MoneyBags ~
void NPCsScripts::npc_9300010(NPC* npc){
Player* player = npc->getPlayer();
int state = npc->getState();
if (state == 0) {
npc->addText("Hello! I'm Mr. Moneybags. Would you like to use a Red Envelope and try to win up to 5,000,000 mesos?"); // NPC Text
npc->sendYesNo();
}
else if (state == 1) {
if(npc->getSelected() == YES){
if(player->inv->getItemAmount(4031249) >= 1) {
npc->giveItem(4031249, -1);
int random = (rand()% 5) + 1; // Rates to get the mesos 1-5
if(random == 1){
npc->giveMesos(5000);
}
if(random == 2){
npc->giveMesos(5000);
}
if(random == 3){
npc->giveMesos(50000);
}
if(random == 4){
npc->giveMesos(500000);
}
if(random == 5){
npc->giveMesos(5000000);
}
}else{
npc->addText("I'm sorry, you don't have a #bRed Envelope#k.");
npc->sendOK();
}
}
}
}