public static final boolean checkRunes(Player player, boolean delete, int... runes) { int weaponId = player.getEquipment().getWeaponId(); int shieldId = player.getEquipment().getShieldId(); int runesCount = 0; while (runesCount < runes.length) { int runeId = runes[runesCount++]; int ammount = runes[runesCount++]; if (hasInfiniteRunes(runeId, weaponId, shieldId)) continue; if (hasStaffOfLight(weaponId) && Utils.getRandom(8) == 0 && runeId != 21773) // 1 in eight chance of keeping runes continue; if (!player.getInventory().containsItem(runeId, ammount)) { player .getPackets() .sendGameMessage( "You do not have enough " + ItemDefinitions.getItemDefinitions(runeId).getName().replace("rune", "Rune") + "s to cast this spell."); return false; } } if (delete) { runesCount = 0; while (runesCount < runes.length) { int runeId = runes[runesCount++]; int ammount = runes[runesCount++]; if (hasInfiniteRunes(runeId, weaponId, shieldId)) continue; player.getInventory().deleteItem(runeId, ammount); } } return true; }
public static void openChest(Player p) { if (p.getInventory().containsItem(MAIN_KEY, KEY_AMOUNT)) { p.sm("Magical chest's power notices your magical key..."); /*Other Actions*/ } else { p.sm("Machine didn't detect all the four keys."); } }
public static void purchase(final Player player, boolean balloons) { if (balloons) { if (player.getInventory().containsItem(995, 1000)) { // startParty(player); } else { player .getDialogueManager() .startDialogue("SimpleMessage", "Balloon Bonanza costs 1000 coins."); } } else { if (player.getInventory().containsItem(995, 500)) { startDancingKnights(); } else { player .getDialogueManager() .startDialogue("SimpleMessage", "Nightly Dance costs 500 coins."); } } }
public static boolean useTabTeleport(final Player player, final int itemId) { if (itemId < 8007 || itemId > 8007 + TABS.length - 1) return false; if (useTeleTab(player, TABS[itemId - 8007])) player.getInventory().deleteItem(itemId, 1); return true; }