Post: [PI] Flower Game [Gambling]
03-05-2015, 09:29 PM #1
Stunz
Former Staff
(adsbygoogle = window.adsbygoogle || []).push({});
Flower game is where you talk to npc and place a fixed bet. Then you pick 1 of 5 colors of a flower. The npc will plant the flower and if its indeed the flower you predicted, you receive 3 times your bet. If you lose, well, you get no money. Many people can play on the same npc because only the person who bet their money can see the flower planted for them.


ID's used

Party pete - 659

Red flower - 2981
Blue flower - 2982
Yellow flower - 2983
Purple flower - 2984
Orange flower - 2985



Declare these variables in Client

    public int flowerBetAmount = 0;
public int flowerGuess = 0;


DialogueHandler (sendDialogues method)
    case 13371:
c.getPA().sendFrame126("Your Bet", 2493);
c.getPA().sendFrame126("500K", 2494);
c.getPA().sendFrame126("1000K", 2495);
c.getPA().sendFrame126("2500K", 2496);
c.getPA().sendFrame126("5000K", 2497);
c.getPA().sendFrame126("10M", 249Cool Man (aka Tustin);
c.getPA().sendFrame164(2492);
c.dialogueAction = 13371;
break;
case 13372:
c.getPA().sendFrame126("Flower Colour", 2493);
c.getPA().sendFrame126("Red", 2494);
c.getPA().sendFrame126("Blue", 2495);
c.getPA().sendFrame126("Yellow", 2496);
c.getPA().sendFrame126("Purple", 2497);
c.getPA().sendFrame126("Orange", 249Cool Man (aka Tustin);
c.getPA().sendFrame164(2492);
c.dialogueAction = 13372;
break;


ClickButtons
    			if (c.dialogueAction == 13372 ) {
if (actionButtonId == 9190) { //Red
c.flowerGuess = 2981;
}
else if (actionButtonId == 9191) { //Blue
c.flowerGuess = 2982;
}
else if (actionButtonId == 9192) { //Yellow
c.flowerGuess = 2983;
}
else if (actionButtonId == 9193) { //Purple
c.flowerGuess = 2984;
}
else if (actionButtonId == 9194) { //Orange
c.flowerGuess = 2985;
}
c.getPA().flowerGame(c);
c.dialogueAction = 0;
return;
}

if (c.dialogueAction == 13371 ) {
if (actionButtonId == 9190 && c.getItems().getItemAmount(995) >= 500000) { //500k
c.flowerBetAmount = 500000;
c.getDH().sendDialogues(13372, 0);
}
else if (actionButtonId == 9191 && c.getItems().getItemAmount(995) >= 1000000) { //1000k
c.flowerBetAmount = 1000000;
c.getDH().sendDialogues(13372, 0);
}
else if (actionButtonId == 9192 && c.getItems().getItemAmount(995) >= 2500000) { //2500k
c.flowerBetAmount = 2500000;
c.getDH().sendDialogues(13372, 0);
}
else if (actionButtonId == 9193 && c.getItems().getItemAmount(995) >= 5000000) { //5000k
c.flowerBetAmount = 5000000;
c.getDH().sendDialogues(13372, 0);
}
else if (actionButtonId == 9194 && c.getItems().getItemAmount(995) >= 10000000) { //10m
c.flowerBetAmount = 10000000;
c.getDH().sendDialogues(13372, 0);
}
else {
c.getPA().closeAllWindows();
c.sendMessage("Not enough coins in your inventory.");
c.dialogueAction = 0;
return;
}
return;
}



PlayerAssistant
    public int[] flowerGame = {2981, 2982, 2983, 2984, 2985};

public void flowerGame(final Client c) {
if (c.getItems().getItemAmount(995) >= c.flowerBetAmount) {
int flower = flowerGame[Misc.random(4)];
if (c.flowerGuess == flower) {
c.getItems().addItem(995, c.flowerBetAmount*2);
c.sendMessage("Congratulations, you've won!");
}
else {
c.getItems().deleteItem(995, c.flowerBetAmount);
c.sendMessage("Sorry, you've lost.");
}
c.getPA().closeAllWindows();
c.getPA().object(flower, c.absX, c.absY, 0, 10);
final int x = c.absX;
final int y = c.absY;
} else {
c.getPA().closeAllWindows();
c.sendMessage("Not enough coins in your inventory.");
}
}


ActionHandler (firstClickNpc method)
Search
    switch(npcType) {

under that put this code
    case 659: //PARTY PETE
c.getDH().sendDialogues(13371, 0);
break;
Last edited by Stunz ; 03-05-2015 at 09:38 PM.

The following 2 users say thank you to Stunz for this useful post:

ResistThePower
03-08-2015, 10:32 PM #2
CyberNomadic
Web Developer
I just read through this, and its a great concept, do you know by chance if anyone has actually typed Javadocs for Project Insanity? Last time I worked on a 317 was before PI (think it was called Delta or something close to that.). It'd be nice to read and learn PI's work through docs (as it'd be much faster then reading through a source.). Thanks, and great job.

The following user thanked CyberNomadic for this useful post:

Stunz
03-08-2015, 11:50 PM #3
Stunz
Former Staff
Originally posted by CyberNomadic View Post
I just read through this, and its a great concept, do you know by chance if anyone has actually typed Javadocs for Project Insanity? Last time I worked on a 317 was before PI (think it was called Delta or something close to that.). It'd be nice to read and learn PI's work through docs (as it'd be much faster then reading through a source.). Thanks, and great job.
DeltaScape? I have mainly worked with 317s/474s, I did program 614 & 718 for awhile too though.
03-09-2015, 12:44 AM #4
CyberNomadic
Web Developer
Originally posted by Stunz View Post
DeltaScape? I have mainly worked with 317s/474s, I did program 614 & 718 for awhile too though.


Yes it was DeltaScape. I've been out of RSPS development for a while, just went on Moparscape and got a PI source, going to read and play around with it to help contribute to this.

The following user thanked CyberNomadic for this useful post:

Stunz
03-09-2015, 01:04 AM #5
Stunz
Former Staff
Originally posted by CyberNomadic View Post
Yes it was DeltaScape. I've been out of RSPS development for a while, just went on Moparscape and got a PI source, going to read and play around with it to help contribute to this.
Nice stuff Winky Winky

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo