PDA

View Full Version : How to get random Enum, where int Level == ##;?


newsbox
Feb 22, 2014, 04:53 AM
Hello,
I got a enum of tasks, and i want to randomly grab one, but the one grabbed has to be the appropriate level.

Can any1one tell me how to grab randomly and still grab the right level? (1,60 or 110)

here's my file:

package com.rs.game.player.actions.slayer;

public enum SlayerTasks {


//Newsbox Task's
//Level 1
RATS("Rats", 1, 15, 30, "Giant rat", "Rat"),
CRABS("Rock crabs", 1, 15, 30, "Rock crab"),
HANDS("Crawling hands", 1, 15, 30, "Crawling hand", "Crawling Hand"),
BANSHEE("Banshees", 1, 15, 20, "Banshee"),
MAGE("Infernal Mages", 1, 15, 20, "Infernal Mage"),
YAKS("Yaks", 1, 15, 30, "Yak"),
//Level 60
BLOODVELD("Bloodvelds", 60, 15, 20, "Bloodveld"),
DUSTDEVIL("Dustdevils", 60, 15, 20, "Dust devil"),
GARGOYLE("Gargoyles", 60, 10, 15, "Gargoyle"),
NECHRYAEL("Nechryaels", 60, 10, 15, "Nechryael"),
JADBABY("Jadinko baby's", 60, 10, 15, "Mutated jadinko baby"),
//Level 110
DEMON("Abyssal demons", 110, 10, 15, "Abyssal demon"),
JADS("Big Jadinkos", 110, 10, 15, "Mutated jadinko guard", "Mutated jadinko male"),
FROSTDRAG("Frost dragons", 110, 10, 12, "Frost dragon"),
DRAGONS("Iron/Steel Drags", 110, 10, 15, "Iron dragon", "Steel dragon", "Bronze dragon"),
STRYKEWYRM("Ice strykewyrms", 110, 10, 15, "Ice strykewyrm");



private SlayerTasks(String simpleName, int level, int min, int max,
String... monsters) {
this.slayable = monsters;
this.simpleName = simpleName;
this.level = level;
this.min = min;
this.max = max;
}


/**
* A simple name for the task
*/
public String simpleName;


/**
* The task set
*/
public TaskSet type;
/**
* The monsters that will effect this task
*/
public String[] slayable;
/**
* The minimum amount of monsters the player may be assigned to kill
*/
public int min;
/**
* The maximum amount of monsters the player may be assigned to kill
*/
public int max;

/*
* combat level for monsters
*/
public int level;

public int getLevel() {
return level;
}
}