示例#1
0
 public void replayMusic() {
   if (playListOn && playList.size() > 0) {
     if (shuffleOn) playingMusic = playList.get(Utils.getRandom(playList.size() - 1));
     else {
       if (nextPlayListMusic >= playList.size()) nextPlayListMusic = 0;
       playingMusic = playList.get(nextPlayListMusic++);
     }
   } else if (unlockedMusics.size() > 0) // random music
   playingMusic = unlockedMusics.get(Utils.getRandom(unlockedMusics.size() - 1));
   playMusic(playingMusic);
 }
示例#2
0
 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;
 }