public static final void processLunarSpell(Player player, int spellId, int packetId) { player.stopAll(false); switch (spellId) { case 37: if (player.getSkills().getLevel(Skills.MAGIC) < 94) { player .getPackets() .sendGameMessage("Your Magic level is not high enough for this spell."); return; } else if (player.getSkills().getLevel(Skills.DEFENCE) < 40) { player.getPackets().sendGameMessage("You need a Defence level of 40 for this spell"); return; } Long lastVeng = (Long) player.getTemporaryAttributtes().get("LAST_VENG"); if (lastVeng != null && lastVeng + 30000 > Utils.currentTimeMillis()) { player .getPackets() .sendGameMessage("Players may only cast vengeance once every 30 seconds."); return; } if (!checkRunes(player, true, ASTRAL_RUNE, 4, DEATH_RUNE, 2, EARTH_RUNE, 10)) return; player.setNextGraphics(new Graphics(726, 0, 100)); player.setNextAnimation(new Animation(4410)); player.setCastVeng(true); player.getTemporaryAttributtes().put("LAST_VENG", Utils.currentTimeMillis()); player.getPackets().sendGameMessage("You cast a vengeance."); break; case 39: useHomeTele(player); break; } }
/** * Departure interface. * * @param player the player to send interface */ private void sendInterfaces() { player.getPackets().sendIComponentText(407, 3, ""); player.getPackets().sendIComponentText(407, 14, "" + waitingPlayers.size()); player.getPackets().sendIComponentText(407, 16, "" + Integer.toString(player.getPestPoints())); player .getInterfaceManager() .sendTab(player.getInterfaceManager().hasRezizableScreen() ? 10 : 19, 407); }
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 final boolean checkSpellRequirements( Player player, int level, boolean delete, int... runes) { if (player.getSkills().getLevelForXp(Skills.MAGIC) < level) { player.getPackets().sendGameMessage("Your Magic level is not high enough for this spell."); return false; } return checkRunes(player, delete, runes); }
/** Starting the game and controler. */ public void startGame() { playersInGame.addAll(waitingPlayers); waitingPlayers.remove(playersInGame); for (Player players : waitingPlayers) { if ((Boolean) players.getTemporaryAttributtes().get("priority1")) players .getPackets() .sendGameMessage( "You have been given priority level 1 over other players in joining the next game."); if ((Boolean) players.getTemporaryAttributtes().get("priority2")) players .getPackets() .sendGameMessage( "You have been given priority level 2 over other players in joining the next game."); } // player.getControllerManager().startControler("PestControler"); }
/** * Entering in boat. * * @param player The player to add. */ private void enterInBoat() { player.getTemporaryAttributtes().put("priority1", false); player.getTemporaryAttributtes().put("priority2", false); if (waitingPlayers.size() > 25) player.getTemporaryAttributtes().put("priority1", true); if (waitingPlayers.size() > 50) player.getTemporaryAttributtes().put("priority2", true); waitingPlayers.add(player); player.setNextWorldTile(new WorldTile(2661, 2639, 0)); player.getPackets().sendGameMessage("You board the lander.", true); sendInterfaces(); startGame(); }
private static void sendOptions(final Player player) { player .getPackets() .sendInterSetItemsOptionsScript( INVENTORY_INTERFACE, 0, 93, 4, 7, "Deposit", "Deposit-5", "Deposit-10", "Deposit-All", "Deposit-X"); player.getPackets().sendIComponentSettings(INVENTORY_INTERFACE, 0, 0, 27, 1278); player .getPackets() .sendInterSetItemsOptionsScript( INVENTORY_INTERFACE, 30, CHEST_INTERFACE_ITEMS_KEY, 4, 7, "Value"); player.getPackets().sendIComponentSettings(PARTY_CHEST_INTERFACE, 30, 0, 27, 1150); player .getPackets() .sendInterSetItemsOptionsScript( PARTY_CHEST_INTERFACE, 33, CHEST_INTERFACE_ITEMS_KEY, true, 4, 7, "Examine"); player.getPackets().sendIComponentSettings(PARTY_CHEST_INTERFACE, 33, 0, 27, 1026); }
@Override public int attack(QueenBlackDragon npc, Player victim) { for (Iterator<TorturedSoul> it = npc.getSouls().iterator(); it.hasNext(); ) { if (it.next().isDead()) { it.remove(); } } npc.getTemporaryAttributtes().put("_last_soul_summon", npc.getTicks() + Utils.random(41, 100)); int count = npc.getPhase() - 1; if (count == 3) { count = 4; } if (npc.getSouls().size() < count) { victim .getPackets() .sendGameMessage( (count - npc.getSouls().size()) < 2 ? "<col=9900CC>The Queen Black Dragon summons one of her captive, tortured souls.</col>" : "<col=9900CC>The Queen Black Dragon summons several of her captive, tortured souls.</col>"); for (int i = npc.getSouls().size(); i < count; i++) { npc.getSouls() .add( new TorturedSoul( npc, victim, npc.getBase().transform(SPAWN_LOCATIONS[i][0], SPAWN_LOCATIONS[i][1], 0))); } } for (int i = 0; i < count; i++) { if (i >= npc.getSouls().size()) { break; } TorturedSoul s = npc.getSouls().get(i); if (s == null || s.isDead()) { continue; } s.specialAttack(npc.getBase().transform(SPAWN_LOCATIONS[i][0], SPAWN_LOCATIONS[i][1], 0)); } return Utils.random(4, 15); }
public static final boolean sendTeleportSpell( final Player player, int upEmoteId, final int downEmoteId, int upGraphicId, final int downGraphicId, int level, final double xp, final WorldTile tile, int delay, final boolean randomize, final int teleType, int... runes) { long currentTime = Utils.currentTimeMillis(); if (player.getLockDelay() > currentTime) return false; if (player.getSkills().getLevel(Skills.MAGIC) < level) { player.getPackets().sendGameMessage("Your Magic level is not high enough for this spell."); return false; } if (!checkRunes(player, false, runes)) return false; if (teleType == MAGIC_TELEPORT) { if (!player.getControlerManager().processMagicTeleport(tile)) return false; } else if (teleType == ITEM_TELEPORT) { if (!player.getControlerManager().processItemTeleport(tile)) return false; } else if (teleType == OBJECT_TELEPORT) { if (!player.getControlerManager().processObjectTeleport(tile)) return false; } checkRunes(player, true, runes); player.stopAll(); if (upEmoteId != -1) player.setNextAnimation(new Animation(upEmoteId)); if (upGraphicId != -1) player.setNextGraphics(new Graphics(upGraphicId)); if (teleType == MAGIC_TELEPORT) player.getPackets().sendSound(5527, 0, 2); player.lock(3 + delay); WorldTasksManager.schedule( new WorldTask() { boolean removeDamage; @Override public void run() { if (!removeDamage) { WorldTile teleTile = tile; if (randomize) { // attemps to randomize tile by 4x4 area for (int trycount = 0; trycount < 10; trycount++) { teleTile = new WorldTile(tile, 2); if (World.canMoveNPC( tile.getPlane(), teleTile.getX(), teleTile.getY(), player.getSize())) break; teleTile = tile; } } player.setNextWorldTile(teleTile); player.getControlerManager().magicTeleported(teleType); if (player.getControlerManager().getControler() == null) teleControlersCheck(player, teleTile); if (xp != 0) player.getSkills().addXp(Skills.MAGIC, xp); if (downEmoteId != -1) player.setNextAnimation(new Animation(downEmoteId == -2 ? -1 : downEmoteId)); if (downGraphicId != -1) player.setNextGraphics(new Graphics(downGraphicId)); if (teleType == MAGIC_TELEPORT) { player.getPackets().sendSound(5524, 0, 2); player.setNextFaceWorldTile( new WorldTile(teleTile.getX(), teleTile.getY() - 1, teleTile.getPlane())); player.setDirection(6); } removeDamage = true; } else { player.resetReceivedDamage(); stop(); } } }, delay, 0); return true; }
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; }
public static final void processNormalSpell(Player player, int spellId, int packetId) { player.stopAll(false); switch (spellId) { case 25: // air strike case 28: // water strike case 30: // earth strike case 32: // fire strike case 34: // air bolt case 39: // water bolt case 42: // earth bolt case 45: // fire bolt case 49: // air blast case 52: // water blast case 58: // earth blast case 63: // fire blast case 70: // air wave case 73: // water wave case 77: // earth wave case 80: // fire wave case 99: case 84: case 87: case 89: case 91: case 36: case 55: case 81: case 66: case 67: case 68: setCombatSpell(player, spellId); break; case 27: // crossbow bolt enchant if (player.getSkills().getLevel(Skills.MAGIC) < 4) { player .getPackets() .sendGameMessage("Your Magic level is not high enough for this spell."); return; } player.stopAll(); player.getInterfaceManager().sendInterface(432); break; case 24: useHomeTele(player); break; case 37: // mobi sendNormalTeleportSpell( player, 10, 19, new WorldTile(2413, 2848, 0), LAW_RUNE, 1, WATER_RUNE, 1, AIR_RUNE, 1); break; case 40: // varrock sendNormalTeleportSpell( player, 25, 19, new WorldTile(3212, 3424, 0), FIRE_RUNE, 1, AIR_RUNE, 3, LAW_RUNE, 1); break; case 43: // lumby sendNormalTeleportSpell( player, 31, 41, new WorldTile(3222, 3218, 0), EARTH_RUNE, 1, AIR_RUNE, 3, LAW_RUNE, 1); break; case 46: // fally sendNormalTeleportSpell( player, 37, 48, new WorldTile(2964, 3379, 0), WATER_RUNE, 1, AIR_RUNE, 3, LAW_RUNE, 1); break; case 51: // camelot sendNormalTeleportSpell( player, 45, 55.5, new WorldTile(2757, 3478, 0), AIR_RUNE, 5, LAW_RUNE, 1); break; case 57: // ardy sendNormalTeleportSpell( player, 51, 61, new WorldTile(2664, 3305, 0), WATER_RUNE, 2, LAW_RUNE, 2); break; case 62: // watch sendNormalTeleportSpell( player, 58, 68, new WorldTile(2547, 3113, 2), EARTH_RUNE, 2, LAW_RUNE, 2); break; case 69: // troll sendNormalTeleportSpell( player, 61, 68, new WorldTile(2888, 3674, 0), FIRE_RUNE, 2, LAW_RUNE, 2); break; case 72: // ape sendNormalTeleportSpell( player, 64, 76, new WorldTile(2776, 9103, 0), FIRE_RUNE, 2, WATER_RUNE, 2, LAW_RUNE, 2, 1963, 1); break; } }