Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package bot.rsps;
- import java.util.ArrayList;
- import java.util.List;
- /**
- * Bad code for testing.
- *
- * @author bot
- *
- */
- public class SquealOfFortune {
- private static final int[] RARE = { 1, 5, 9, 12 };
- private static final int[] COMMON = { 3, 343, 1329, 85, 012, 94 };
- private static final int[] UNCOMMON = { 99, 2147483647, 939182, 2913219, 21 };
- private static final int TYPE_COMMON = 1;
- private static final int TYPE_UNCOMMON = 2;
- private static final int TYPE_RARE = 3;
- /**
- * Is this ever used?
- */
- public static int getType(int item) {
- for (int i : UNCOMMON) {
- if (item == i) {
- return TYPE_UNCOMMON;
- }
- }
- for (int i : RARE) {
- if (item == i) {
- return TYPE_RARE;
- }
- }
- return TYPE_COMMON;
- }
- private static void add(int type, List<Integer> dest, int amnt) {
- int[] typeArray = type == TYPE_RARE ? RARE : type == TYPE_UNCOMMON ? UNCOMMON : COMMON;
- for (int i = 0; i < amnt; i++) {
- dest.add(typeArray[(int) (Math.random() * typeArray.length)]);
- }
- }
- public static final List<Integer> generateRewards() {
- List<Integer> rewards = new ArrayList<Integer>(13);
- add(TYPE_COMMON, rewards, 5);
- add(TYPE_RARE, rewards, 1);
- add(TYPE_COMMON, rewards, 3);
- add(TYPE_RARE, rewards, 1);
- add(TYPE_UNCOMMON, rewards, 3);
- // 13 rewards, slots might be wrong, I could randomise slots.
- return rewards;
- }
- }
Add Comment
Please, Sign In to add comment