Пример #1
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;
 }
Пример #2
0
 public static final boolean checkCombatSpell(
     Player player, int spellId, int set, boolean delete) {
   if (spellId == 65535) return true;
   switch (player.getCombatDefinitions().getSpellBook()) {
     case 193:
       switch (spellId) {
         case 28:
           if (!checkSpellRequirements(
               player, 50, delete, CHAOS_RUNE, 2, DEATH_RUNE, 2, FIRE_RUNE, 1, AIR_RUNE, 1))
             return false;
           break;
         case 32:
           if (!checkSpellRequirements(
               player, 52, delete, CHAOS_RUNE, 2, DEATH_RUNE, 2, AIR_RUNE, 1, SOUL_RUNE, 1))
             return false;
           break;
         case 24:
           if (!checkSpellRequirements(
               player, 56, delete, CHAOS_RUNE, 2, DEATH_RUNE, 2, BLOOD_RUNE, 1)) return false;
           break;
         case 20:
           if (!checkSpellRequirements(
               player, 58, delete, CHAOS_RUNE, 2, DEATH_RUNE, 2, WATER_RUNE, 2)) return false;
           break;
         case 30:
           if (!checkSpellRequirements(
               player, 62, delete, CHAOS_RUNE, 4, DEATH_RUNE, 2, FIRE_RUNE, 2, AIR_RUNE, 2))
             return false;
           break;
         case 34:
           if (!checkSpellRequirements(
               player, 64, delete, CHAOS_RUNE, 4, DEATH_RUNE, 2, AIR_RUNE, 1, SOUL_RUNE, 2))
             return false;
           break;
         case 26:
           if (!checkSpellRequirements(
               player, 68, delete, CHAOS_RUNE, 4, DEATH_RUNE, 2, BLOOD_RUNE, 2)) return false;
           break;
         case 22:
           if (!checkSpellRequirements(
               player, 70, delete, CHAOS_RUNE, 4, DEATH_RUNE, 2, WATER_RUNE, 4)) return false;
           break;
         case 29:
           if (!checkSpellRequirements(
               player, 74, delete, DEATH_RUNE, 2, BLOOD_RUNE, 2, FIRE_RUNE, 2, AIR_RUNE, 2))
             return false;
           break;
         case 33:
           if (!checkSpellRequirements(
               player, 76, delete, DEATH_RUNE, 2, BLOOD_RUNE, 2, AIR_RUNE, 2, SOUL_RUNE, 2))
             return false;
           break;
         case 25:
           if (!checkSpellRequirements(player, 80, delete, DEATH_RUNE, 2, BLOOD_RUNE, 4))
             return false;
           break;
         case 21:
           if (!checkSpellRequirements(
               player, 82, delete, DEATH_RUNE, 2, BLOOD_RUNE, 2, WATER_RUNE, 3)) return false;
           break;
         case 31:
           if (!checkSpellRequirements(
               player, 86, delete, DEATH_RUNE, 4, BLOOD_RUNE, 2, FIRE_RUNE, 4, AIR_RUNE, 4))
             return false;
           break;
         case 35:
           if (!checkSpellRequirements(
               player, 88, delete, DEATH_RUNE, 4, BLOOD_RUNE, 2, AIR_RUNE, 4, SOUL_RUNE, 3))
             return false;
           break;
         case 27:
           if (!checkSpellRequirements(
               player, 92, delete, DEATH_RUNE, 4, BLOOD_RUNE, 4, SOUL_RUNE, 1)) return false;
           break;
         case 23:
           if (!checkSpellRequirements(
               player, 94, delete, DEATH_RUNE, 4, BLOOD_RUNE, 2, WATER_RUNE, 6)) return false;
           break;
         case 36: // Miasmic rush.
           if (!checkSpellRequirements(
               player, 61, delete, CHAOS_RUNE, 2, EARTH_RUNE, 1, SOUL_RUNE, 1)) {
             return false;
           }
           int weaponId = player.getEquipment().getWeaponId();
           if (weaponId != 13867
               && weaponId != 13869
               && weaponId != 13941
               && weaponId != 13943
               && !player.isExtremeDonator()) {
             player.getPackets().sendGameMessage("You need a Zuriel's staff to cast this spell.");
             player
                 .getPackets()
                 .sendGameMessage(
                     "Extreme donators can cast Miasmic spells without Zuriel's staff.");
             return false;
           }
           break;
         case 38: // Miasmic burst.
           if (!checkSpellRequirements(
               player, 73, delete, CHAOS_RUNE, 4, EARTH_RUNE, 2, SOUL_RUNE, 2)) {
             return false;
           }
           weaponId = player.getEquipment().getWeaponId();
           if (weaponId != 13867
               && weaponId != 13869
               && weaponId != 13941
               && weaponId != 13943
               && !player.isExtremeDonator()) {
             player.getPackets().sendGameMessage("You need a Zuriel's staff to cast this spell.");
             player
                 .getPackets()
                 .sendGameMessage(
                     "Extreme donators can cast Miasmic spells without Zuriel's staff.");
             return false;
           }
           break;
         case 37: // Miasmic blitz.
           if (!checkSpellRequirements(
               player, 85, delete, BLOOD_RUNE, 2, EARTH_RUNE, 3, SOUL_RUNE, 3)) {
             return false;
           }
           weaponId = player.getEquipment().getWeaponId();
           if (weaponId != 13867
               && weaponId != 13869
               && weaponId != 13941
               && weaponId != 13943
               && !player.isExtremeDonator()) {
             player.getPackets().sendGameMessage("You need a Zuriel's staff to cast this spell.");
             player
                 .getPackets()
                 .sendGameMessage(
                     "Extreme donators can cast Miasmic spells without Zuriel's staff.");
             return false;
           }
           break;
         case 39: // Miasmic barrage.
           if (!checkSpellRequirements(
               player, 97, delete, BLOOD_RUNE, 4, EARTH_RUNE, 4, SOUL_RUNE, 4)) {
             return false;
           }
           weaponId = player.getEquipment().getWeaponId();
           if (weaponId != 13867
               && weaponId != 13869
               && weaponId != 13941
               && weaponId != 13943
               && !player.isExtremeDonator()) {
             player.getPackets().sendGameMessage("You need a Zuriel's staff to cast this spell.");
             player
                 .getPackets()
                 .sendGameMessage(
                     "Extreme donators can cast Miasmic spells without Zuriel's staff.");
             return false;
           }
           break;
         default:
           return false;
       }
       break;
     case 192:
       switch (spellId) {
         case 25:
           if (!checkSpellRequirements(player, 1, delete, AIR_RUNE, 1, MIND_RUNE, 1)) return false;
           break;
         case 28:
           if (!checkSpellRequirements(
               player, 5, delete, WATER_RUNE, 1, AIR_RUNE, 1, MIND_RUNE, 1)) return false;
           break;
         case 30:
           if (!checkSpellRequirements(
               player, 9, delete, EARTH_RUNE, 2, AIR_RUNE, 1, MIND_RUNE, 1)) return false;
           break;
         case 32:
           if (!checkSpellRequirements(
               player, 13, delete, FIRE_RUNE, 3, AIR_RUNE, 2, MIND_RUNE, 1)) return false;
           break;
         case 34: // air bolt
           if (!checkSpellRequirements(player, 17, delete, AIR_RUNE, 2, CHAOS_RUNE, 1))
             return false;
           break;
         case 36: // bind
           if (!checkSpellRequirements(
               player, 20, delete, EARTH_RUNE, 3, WATER_RUNE, 3, NATURE_RUNE, 2)) return false;
           break;
         case 55: // snare
           if (!checkSpellRequirements(
               player, 50, delete, EARTH_RUNE, 4, WATER_RUNE, 4, NATURE_RUNE, 3)) return false;
           break;
         case 81: // entangle
           if (!checkSpellRequirements(
               player, 79, delete, EARTH_RUNE, 5, WATER_RUNE, 5, NATURE_RUNE, 4)) return false;
           break;
         case 39: // water bolt
           if (!checkSpellRequirements(
               player, 23, delete, WATER_RUNE, 2, AIR_RUNE, 2, CHAOS_RUNE, 1)) return false;
           break;
         case 42: // earth bolt
           if (!checkSpellRequirements(
               player, 29, delete, EARTH_RUNE, 3, AIR_RUNE, 2, CHAOS_RUNE, 1)) return false;
           break;
         case 45: // fire bolt
           if (!checkSpellRequirements(
               player, 35, delete, FIRE_RUNE, 4, AIR_RUNE, 3, CHAOS_RUNE, 1)) return false;
           break;
         case 49: // air blast
           if (!checkSpellRequirements(player, 41, delete, AIR_RUNE, 3, DEATH_RUNE, 1))
             return false;
           break;
         case 52: // water blast
           if (!checkSpellRequirements(
               player, 47, delete, WATER_RUNE, 3, AIR_RUNE, 3, DEATH_RUNE, 1)) return false;
           break;
         case 58: // earth blast
           if (!checkSpellRequirements(
               player, 53, delete, EARTH_RUNE, 4, AIR_RUNE, 3, DEATH_RUNE, 1)) return false;
           break;
         case 63: // fire blast
           if (!checkSpellRequirements(
               player, 59, delete, FIRE_RUNE, 5, AIR_RUNE, 4, DEATH_RUNE, 1)) return false;
           break;
         case 70: // air wave
           if (!checkSpellRequirements(player, 62, delete, AIR_RUNE, 5, BLOOD_RUNE, 1))
             return false;
           break;
         case 73: // water wave
           if (!checkSpellRequirements(
               player, 65, delete, WATER_RUNE, 7, AIR_RUNE, 5, BLOOD_RUNE, 1)) return false;
           break;
         case 77: // earth wave
           if (!checkSpellRequirements(
               player, 70, delete, EARTH_RUNE, 7, AIR_RUNE, 5, BLOOD_RUNE, 1)) return false;
           break;
         case 80: // fire wave
           if (!checkSpellRequirements(
               player, 75, delete, FIRE_RUNE, 7, AIR_RUNE, 5, BLOOD_RUNE, 1)) return false;
           break;
         case 84:
           if (!checkSpellRequirements(
               player, 81, delete, AIR_RUNE, 7, DEATH_RUNE, 1, BLOOD_RUNE, 1)) return false;
           break;
         case 87:
           if (!checkSpellRequirements(
               player, 85, delete, WATER_RUNE, 10, AIR_RUNE, 7, DEATH_RUNE, 1, BLOOD_RUNE, 1))
             return false;
           break;
         case 89:
           if (!checkSpellRequirements(
               player, 85, delete, EARTH_RUNE, 10, AIR_RUNE, 7, DEATH_RUNE, 1, BLOOD_RUNE, 1))
             return false;
           break;
         case 66: // Sara Strike
           if (player.getEquipment().getWeaponId() != 2415) {
             player
                 .getPackets()
                 .sendGameMessage(
                     "You need to be equipping a Saradomin staff to cast this spell.", true);
             return false;
           }
           if (!checkSpellRequirements(
               player, 60, delete, AIR_RUNE, 4, FIRE_RUNE, 1, BLOOD_RUNE, 2)) return false;
           break;
         case 67: // Guthix Claws
           if (player.getEquipment().getWeaponId() != 2416) {
             player
                 .getPackets()
                 .sendGameMessage(
                     "You need to be equipping a Guthix Staff or Void Mace to cast this spell.",
                     true);
             return false;
           }
           if (!checkSpellRequirements(
               player, 60, delete, AIR_RUNE, 4, FIRE_RUNE, 1, BLOOD_RUNE, 2)) return false;
           break;
         case 68: // Flame of Zammy
           if (player.getEquipment().getWeaponId() != 2417) {
             player
                 .getPackets()
                 .sendGameMessage(
                     "You need to be equipping a Zamorak Staff to cast this spell.", true);
             return false;
           }
           if (!checkSpellRequirements(
               player, 60, delete, AIR_RUNE, 4, FIRE_RUNE, 4, BLOOD_RUNE, 2)) return false;
           break;
         case 91:
           if (!checkSpellRequirements(
               player, 85, delete, FIRE_RUNE, 10, AIR_RUNE, 7, DEATH_RUNE, 1, BLOOD_RUNE, 1))
             return false;
           break;
         case 86: // teleblock
           if (!checkSpellRequirements(
               player, 85, delete, CHAOS_RUNE, 1, LAW_RUNE, 1, DEATH_RUNE, 1)) return false;
           break;
         case 99: // Storm of Armadyl
           if (!checkSpellRequirements(player, 77, delete, ARMADYL_RUNE, 1)) return false;
           break;
         default:
           return false;
       }
       break;
     default:
       return false;
   }
   if (set >= 0) {
     if (set == 0) player.getCombatDefinitions().setAutoCastSpell(spellId);
     else player.getTemporaryAttributtes().put("tempCastSpell", spellId);
   }
   return true;
 }