Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public List<GameItem> access(Player player, double modifier, int repeats) {
- int rights = player.getRights().getPrimary().getValue() - 1;
- List<GameItem> items = new ArrayList<>();
- for (Table table : this) {
- TablePolicy policy = table.getPolicy();
- if (policy.equals(TablePolicy.CONSTANT)) {
- for (Drop drop : table) {
- int minimumAmount = drop.getMinimumAmount();
- items.add(new GameItem(drop.getItemId(), minimumAmount + Misc.random(drop.getMaximumAmount() - minimumAmount)));
- }
- } else {
- for (int i = 0; i < repeats; i++) {
- double chance = (1.0 / (double) (table.getAccessibility() * modifier)) * 100D;
- double roll = Misc.preciseRandom(Range.between(0.0, 100.0));
- if (chance > 100.0) {
- chance = 100.0;
- }
- if (roll <= chance) {
- Drop drop = table.fetchRandom();
- int minimumAmount = drop.getMinimumAmount();
- GameItem item = new GameItem(drop.getItemId(),
- minimumAmount + Misc.random(drop.getMaximumAmount() - minimumAmount));
- if (policy.equals(TablePolicy.VERY_RARE) || policy.equals(TablePolicy.RARE)) {
- player.getCollectionLog().handleDrop(drop.getNpcIds().get(0), item.getId(), item.getAmount());
- }
- items.add(item);
- if (chance <= 1.5) {
- if (policy.equals(TablePolicy.VERY_RARE) || policy.equals(TablePolicy.RARE)) {
- if (Item.getItemName(item.getId()).toLowerCase().contains("cowhide")
- || Item.getItemName(item.getId()).toLowerCase().contains("feather")
- || Item.getItemName(item.getId()).toLowerCase().contains("arrow")
- || Item.getItemName(item.getId()).toLowerCase().contains("sq shield")
- || Item.getItemName(item.getId()).toLowerCase().contains("rune warhammer")
- || Item.getItemName(item.getId()).toLowerCase().contains("rune battleaxe")
- || Item.getItemName(item.getId()).toLowerCase().contains("casket")
- || Item.getItemName(item.getId()).toLowerCase().contains("silver ore")
- || Item.getItemName(item.getId()).toLowerCase().contains("rune spear")
- || item.getId() >= 554 && item.getId() <= 566) {
- } else {
- PlayerHandler.executeGlobalMessage(
- "@red@" + Misc.capitalize(player.playerName) + " received a drop: "
- + (item.getAmount() > 1 ? (item.getAmount() + "x ") : ItemAssistant.getItemName(item.getId()) + "@bla@."));
- }
- }
- }
- }
- }
- }
- }
- return items;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement