http://thelaststand659.ucoz.com/
Would You Like To Log In To The Last Stand 659 Forum's Please Remember To Vote And Invite Your Friends


http://thelaststand659.ucoz.com/
 
HomeHome  Download Client  WebClient  FAQFAQ  SearchSearch  UsergroupsUsergroups  RegisterRegister  Log inLog in  MemberlistMemberlist  CalendarCalendar  

Share | 
 

 Add dicing

Go down 
AuthorMessage
Quit
New Member
New Member


Posts : 18
Reputation : 1
Join date : 2011-08-26

PostSubject: 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!
Back to top Go down
View user profile
omfgpku
New Member
New Member


Posts : 38
Reputation : 4
Join date : 2011-08-26

PostSubject: Re: Add dicing   Fri Aug 26, 2011 9:12 pm

Is this so player can gamble or something 0.0
Back to top Go down
View user profile
Quit
New Member
New Member


Posts : 18
Reputation : 1
Join date : 2011-08-26

PostSubject: 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.
Back to top Go down
View user profile
omfgpku
New Member
New Member


Posts : 38
Reputation : 4
Join date : 2011-08-26

PostSubject: 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.
Back to top Go down
View user profile
Quit
New Member
New Member


Posts : 18
Reputation : 1
Join date : 2011-08-26

PostSubject: 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.
Back to top Go down
View user profile
Unkle
New Member
New Member


Posts : 12
Reputation : 1
Join date : 2011-08-27

PostSubject: Re: Add dicing   Sat Aug 27, 2011 12:16 pm

You have my vote on dicing Smile.
Back to top Go down
View user profile
omfgpku
New Member
New Member


Posts : 38
Reputation : 4
Join date : 2011-08-26

PostSubject: Re: Add dicing   Sat Aug 27, 2011 4:28 pm

Just doubled my tokens from dice, what a great way to gain tokens.
Back to top Go down
View user profile
pk ancients
New Member
New Member


Posts : 23
Reputation : 10
Join date : 2011-08-27
Age : 22
Location : Netherland

PostSubject: dicing   Sun Aug 28, 2011 3:07 am

I got uber rich of this!
thanks bud!
Back to top Go down
View user profile
Sponsored content




PostSubject: Re: Add dicing   

Back to top Go down
 
Add dicing
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
http://thelaststand659.ucoz.com/ :: Suggestions And Ideas-
Jump to: