Quit New Member
Posts : 18 Reputation : 1 Join date : 2011-08-26
| Subject: Add dicing Fri Aug 26, 2011 7:01 pm | |
| I propose we add dicing to the scene of The last stand!
(This is for Smiley) Put this in com.rs2hd.content: - Code:
-
package com.rs2hd.content;
import com.rs2hd.event.Event; import com.rs2hd.model.Player; import com.rs2hd.model.World; import com.rs2hd.util.Misc;
/** * * @author Cyber Sheep/Hax (Cyber Sheep is my runelocus name) * */
public class DiceGame {
public static final int PERCENTILE = 1;
public static final int WAGER = 2;
public static void rollDice(int type, final Player player) { switch (type) { case PERCENTILE: if (player.potDelay == 0) { player.potDelay = 4; player.animate(11900); player.graphics(2072);
World.getInstance().registerEvent(new Event(750) {
@Override public void execute() { sayRoll(PERCENTILE, player); this.stop(); }
});
} break; case WAGER: if (player.potDelay == 0) { player.potDelay = 4; player.animate(11900); player.graphics(2072);
World.getInstance().registerEvent(new Event(750) {
@Override public void execute() { sayRoll(WAGER, player); this.stop(); }
}); } break; default: if (player.potDelay == 0) { player.potDelay = 4; player.animate(11900); player.graphics(2072);
sayRoll(PERCENTILE, player); } break; } }
private static void sayRoll(int type, Player p) { switch (type) { case PERCENTILE: for (Player player : World.getInstance().getPlayerList()) { player.getActionSender().sendMessage( new StringBuilder() .append("<col=FF3333> ") .append(Misc.formatPlayerNameForDisplay(p .getUsername())) .append("</col> rolled <col=FF3333>") .append(random(100, 1)) .append("</col> on the percentile dice") .toString()); } break; case WAGER: for (Player player : World.getInstance().getPlayerList()) { player.getActionSender().sendMessage( new StringBuilder() .append("<col=FF3333> ") .append(Misc.formatPlayerNameForDisplay(p .getUsername())) .append("</col> rolled <col=FF3333>") .append(random(12, 1)) .append("</col> on the wager dice").toString()); break; } } }
private static int random(int highest, int lowest) { long range = (long) highest - (long) lowest + 1; long fraction = (long) (range * new java.util.Random().nextDouble()); int roll = (int) (fraction + lowest);
return roll; } } Now go to ItemPackethandler. Search for - Code:
-
if (interfaceId == 149) { switch(id) Under that, put: - Code:
-
case 15098: com.rs2hd.content.DiceGame.rollDice(DiceGame.PERCENTILE, player); break; case 15088: com.rs2hd.content.DiceGame.rollDice(DiceGame.WAGER, player); break; case 15084: player.getActionSender().animateInterface(1, 230, 2); player.getActionSender().sendString("Dice", 230, 2); player.getActionSender().sendString("55x2", 230, 3); player.getActionSender().sendString("Wager", 230, 4); player.dice = 1; break; Thanks for reading Smiley! I hope to see dicing on the server soon! | |
|
omfgpku New Member
Posts : 38 Reputation : 4 Join date : 2011-08-26
| Subject: Re: Add dicing Fri Aug 26, 2011 9:12 pm | |
| Is this so player can gamble or something 0.0 | |
|
Quit New Member
Posts : 18 Reputation : 1 Join date : 2011-08-26
| Subject: Re: Add dicing Fri Aug 26, 2011 9:14 pm | |
| Yes. A gambler trades over a certain amount to a "host". The host then rolls the dice. If the number generated is greater than 55, the host doubles the gambler's money. Otherwise, the host keeps the money. | |
|
omfgpku New Member
Posts : 38 Reputation : 4 Join date : 2011-08-26
| Subject: Re: Add dicing Fri Aug 26, 2011 9:28 pm | |
| I wonder if there would be a way for it to gamble tokens rather than coins. Otherwise it seems like something I would blow all my money at once on. | |
|
Quit New Member
Posts : 18 Reputation : 1 Join date : 2011-08-26
| Subject: Re: Add dicing Fri Aug 26, 2011 9:41 pm | |
| The amount you bet has nothing to do with the code; provided that tokens are tradeable, you might as well gamble them. | |
|
Unkle New Member
Posts : 12 Reputation : 1 Join date : 2011-08-27
| Subject: Re: Add dicing Sat Aug 27, 2011 12:16 pm | |
| You have my vote on dicing . | |
|
omfgpku New Member
Posts : 38 Reputation : 4 Join date : 2011-08-26
| Subject: Re: Add dicing Sat Aug 27, 2011 4:28 pm | |
| Just doubled my tokens from dice, what a great way to gain tokens. | |
|
pk ancients New Member
Posts : 23 Reputation : 10 Join date : 2011-08-27 Age : 28 Location : Netherland
| Subject: dicing Sun Aug 28, 2011 3:07 am | |
| I got uber rich of this! thanks bud! | |
|