Thread: Dice Bag

Results 1 to 3 of 3
  1. #1 Dice Bag 
    Donator

    Join Date
    Aug 2016
    Posts
    201
    Thanks given
    54
    Thanks received
    34
    Rep Power
    39
    My dice bag in-game just randomly stopped working

    I don't know much about coding, I'm not the coder;

    I found this under dice handler.

    Can anyone tell me what's wrong?

    I'm looking to fix the dice up to 100: code 19726 -- When I click it in-game it doesn't roll anymore. You can't roll the dice unless you're in a designated gambling zone ::gamble - it randomly stopped working today. Can anyone please help in anyway shape or form?


    package ab.model.players;

    import ab.model.items.ItemAssistant;

    public class DiceHandler {

    public static final int ROLL_TIMER = 1000, DICE_BAG = 19726;

    interface Data {
    public int diceId();

    public int diceSize();

    public int diceGfx();
    }

    enum Dice implements Data {
    DIE_6_SIDES(15086, 6, 2072), DICE_6_SIDES(15088, 12, 2074), DIE_8_SIDES(15090, 8, 2071), DIE_10_SIDES(15092, 10, 2070), DIE_12_SIDES(15094,
    12, 2073), DIE_20_SIDES(15096, 20, 2068), DICE_UP_TO_100(19726, 100, 2075), DIE_4_SIDES(15100, 4, 2069);

    private int id, sides, gfx;

    Dice(int id, int sides, int gfx) {
    this.id = id;
    this.sides = sides;
    this.gfx = gfx;
    }

    @Override
    public int diceId() {
    return id;
    }

    @Override
    public int diceSize() {
    return sides;
    }

    @Override
    public int diceGfx() {
    return gfx;
    }
    }

    /**
    * Handles the rolling of the dice to a player.
    *
    * @param c
    * The player.
    * @param roll
    * What the player rolled on the dice.
    * @param item
    * The id of the dice.
    */
    public static void selfRoll(Player c, int roll, int item) {
    c.sendMessage("You rolled @red@" + roll + "@bla@ on the " + ItemAssistant.getItemName(item) + ".");
    }

    /**
    * Handles selecting the dice
    *
    * @param c
    * The player.
    * @param item
    * The dice id.
    * @return Whether or not a dice were selected.
    */
    public static boolean selectDice(Player c, int item) {
    for (Dice d : Dice.values()) {
    if (item == d.diceId() || item == DICE_BAG) {
    c.getDH().sendOption5(ItemAssistant.getItemName(Di ce.DIE_6_SIDES.diceId()), ItemAssistant.getItemName(Dice.DICE_6_SIDES.diceId ()),
    ItemAssistant.getItemName(Dice.DIE_8_SIDES.diceId( )), ItemAssistant.getItemName(Dice.DIE_10_SIDES.diceId ()), "Next Page");
    c.diceItem = item;
    return true;
    }
    }
    return false;
    }

    /**
    * Handles all the clicking for the dice.
    *
    * @param c
    * The player.
    * @param actionButtonId
    * Action button id of what is clicked.
    * @return Whether or not a click was handled.
    */
    public static boolean handleClick(Player c, int actionButtonId) {
    int[][] dice = { { Dice.DIE_6_SIDES.diceId() }, { Dice.DICE_6_SIDES.diceId() }, { Dice.DIE_8_SIDES.diceId() }, { Dice.DIE_10_SIDES.diceId() },
    { Dice.DIE_12_SIDES.diceId() }, { Dice.DIE_20_SIDES.diceId() }, { Dice.DICE_UP_TO_100.diceId() }, { Dice.DIE_4_SIDES.diceId() } };
    int DICE = 0;
    if (actionButtonId - 9190 >= 0 && actionButtonId - 9190 <= 5) {
    if (c.page == 0) {
    c.getPA().removeAllWindows();
    if (actionButtonId - 9190 <= 3) {
    if (c.getItems().playerHasItem(c.diceItem, 1)) {
    c.getItems().deleteItem(c.diceItem, 1);
    c.getItems().addItem(dice[actionButtonId - 9190][DICE], 1);
    }
    } else {
    c.getDH().sendOption5(ItemAssistant.getItemName(Di ce.DIE_12_SIDES.diceId()),
    ItemAssistant.getItemName(Dice.DIE_20_SIDES.diceId ()), ItemAssistant.getItemName(Dice.DICE_UP_TO_100.dice Id()),
    ItemAssistant.getItemName(Dice.DIE_4_SIDES.diceId( )), "Return");
    c.page = 1;
    }
    } else if (c.page == 1) {
    c.getPA().removeAllWindows();
    if (actionButtonId - 9190 <= 3) {
    if (c.getItems().playerHasItem(c.diceItem, 1)) {
    c.getItems().deleteItem(c.diceItem, 1);
    c.getItems().addItem(dice[actionButtonId - 9186][DICE], 1);
    }
    } else {
    c.getPA().closeAllWindows();
    }
    c.page = 0;
    }
    return true;
    }
    return false;
    }




    P.S - My coder is away for a few hours hence why I posted

    }
    Reply With Quote  
     

  2. #2  
    Banned

    Join Date
    Oct 2012
    Posts
    4,710
    Thanks given
    1,679
    Thanks received
    1,105
    Rep Power
    0
    Debug the clicking.
    Reply With Quote  
     

  3. #3  
    Community Veteran


    Arch337's Avatar
    Join Date
    Sep 2008
    Posts
    2,950
    Thanks given
    210
    Thanks received
    349
    Rep Power
    1376
    Make sure it's sending "handleClick" and "selectDice" correctly.


    "A fail act is something you do regular, but a dumb act is something you can learn from"
    Spoiler for Problem?:
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. [PI] Req Dice bag models +ints.
    By walex80 in forum Requests
    Replies: 2
    Last Post: 11-04-2011, 12:01 AM
  2. Dice Bag Model.
    By Clamarus in forum Models
    Replies: 1
    Last Post: 10-18-2011, 10:22 PM
  3. Dice Bag Model.
    By Clamarus in forum Help
    Replies: 1
    Last Post: 10-18-2011, 01:53 PM
  4. Dice Bag Model
    By w33zyscape in forum Requests
    Replies: 1
    Last Post: 08-22-2011, 09:15 PM
  5. [Req] Dice Bag
    By `Basher in forum Models
    Replies: 7
    Last Post: 07-07-2011, 03:18 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •