public void appendGraphic(int spellbook, int spell) { try { Player opp = Server.engine.players[p.magicOppIndex]; updateAttributes(spellbook, spell); if ((!opp.wildernessZone(opp.absX, opp.absY)) || (!p.wildernessZone(p.absX, p.absY))) { p.getActionSender().sendMessage(p, "You cannot attack players outside of the wilderness."); return; } if (p.InBounty == 0) { if (!p.properWildernessLevel(p.combatLevel, opp.combatLevel) || !opp.properWildernessLevel(opp.combatLevel, p.combatLevel)) { p.getActionSender().sendMessage(p, "Your combat difference is too great!"); return; } } if (p.InBounty == 1) { if (opp.playerId != p.bhTarget && (p.playerId != opp.bhTarget && (p.username != opp.OriginalAttacker))) { if (!opp.multiwayCombatZone(opp.absX, opp.absY)) { if (opp.attackedBy != null && (opp.attacking != null || opp.attackedByCount >= 1) && opp.attackedBy != p.username) { p.getActionSender().sendMessage(p, "This player is already in combat."); Engine.playerMovement.resetWalkingQueue(p); p.resetAttack(); return; } if (opp.username != p.attackedBy && p.attackedBy != null) { p.getActionSender().sendMessage(p, "You are already in combat."); Engine.playerMovement.resetWalkingQueue(p); p.resetAttack(); return; } } } } if (p.InBounty == 0) { if (!opp.multiwayCombatZone(opp.absX, opp.absY)) { if (opp.attackedBy != null && (opp.attacking != null || opp.attackedByCount >= 1) && opp.attackedBy != p.username) { p.getActionSender().sendMessage(p, "This player is already in combat."); Engine.playerMovement.resetWalkingQueue(p); p.resetAttack(); return; } if (opp.username != p.attackedBy && p.attackedBy != null) { p.getActionSender().sendMessage(p, "You are already in combat."); Engine.playerMovement.resetWalkingQueue(p); p.resetAttack(); return; } } } if (!p.successfulCast) { graphic = 85; p.graphicMSDelay = 100; } else if (opp.orb && spell == 3) { graphic = 1677; p.graphicMSDelay = 100; } if (!multipleDamage || !opp.multiwayCombatZone(opp.absX, opp.absY)) { opp.requestGFX(graphic, p.graphicMSDelay); opp.orb = false; } else { for (Player player : Server.engine.players) { if (player == null || player == p) { continue; } if (Misc.getDistance(opp.absX, opp.absY, player.absX, player.absY) <= 1) { if (player.wildernessZone(player.absX, player.absY) && p.properWildernessLevel(p.combatLevel, player.combatLevel) && player.properWildernessLevel(player.combatLevel, p.combatLevel)) { player.requestGFX(graphic, p.graphicMSDelay); player.orb = false; } } } } p.graphicMSDelay = 0; } catch (Exception e) { return; } }
public void appendDamage(int spellbook, int spell) { try { if (!p.successfulCast) { return; } Player opp = Server.engine.players[p.magicOppIndex]; updateAttributes(spellbook, spell); if ((!opp.wildernessZone(opp.absX, opp.absY)) || (!p.wildernessZone(p.absX, p.absY))) { p.getActionSender().sendMessage(p, "You cannot attack players outside of the wilderness."); return; } if (p.InBounty == 0) { if (!p.properWildernessLevel(p.combatLevel, opp.combatLevel) || !opp.properWildernessLevel(opp.combatLevel, p.combatLevel)) { p.getActionSender().sendMessage(p, "Your combat difference is too great!"); return; } } if (p.InBounty == 1) { if (opp.playerId != p.bhTarget && (p.playerId != opp.bhTarget)) { if (!opp.multiwayCombatZone(opp.absX, opp.absY)) { if (opp.attackedBy != null && (opp.attacking != null) && opp.attackedBy != p.username) { p.getActionSender().sendMessage(p, "This player is already in combat."); Engine.playerMovement.resetWalkingQueue(p); p.resetAttack(); return; } if (opp.username != p.attackedBy && p.attackedBy != null) { p.getActionSender().sendMessage(p, "You are already in combat."); Engine.playerMovement.resetWalkingQueue(p); p.resetAttack(); return; } } } } if (p.InBounty == 0) { if (!opp.multiwayCombatZone(opp.absX, opp.absY)) { if (opp.playerId != p.bhTarget && (p.playerId != opp.bhTarget && (p.username != opp.OriginalAttacker))) { if (opp.attackedBy != null && (opp.attacking != null || opp.attackedByCount >= 1) && opp.attackedBy != p.username) { p.getActionSender().sendMessage(p, "This player is already in combat."); Engine.playerMovement.resetWalkingQueue(p); p.resetAttack(); return; } if (opp.username != p.attackedBy && p.attackedBy != null) { p.getActionSender().sendMessage(p, "You are already in combat."); Engine.playerMovement.resetWalkingQueue(p); p.resetAttack(); return; } } } } if (!multipleDamage || !opp.multiwayCombatZone(opp.absX, opp.absY)) { opp.hitIndex = p.playerId; int damage = getHit(getAccuracy(), maxHit); p.appendExperience((damage * 1000), 6); p.appendExperience((damage * 1000), 3); opp.appendHit(damage, 0); } else { for (Player player : Server.engine.players) { if (player == null || player == p) { continue; } if (Misc.getDistance(opp.absX, opp.absY, player.absX, player.absY) <= 1) { if (player.wildernessZone(player.absX, player.absY) && p.properWildernessLevel(p.combatLevel, player.combatLevel) && player.properWildernessLevel(player.combatLevel, p.combatLevel)) { player.hitIndex = p.playerId; int damage = getHit(getAccuracy(), maxHit); p.appendExperience((damage * 1000), 6); p.appendExperience((damage * 1000), 3); player.appendHit(damage, 0); } } } } } catch (Exception e) { return; } }
public void combatMagic(Player opp, int spellbook, int spell) { updateAttributes(spellbook, spell); Engine.playerMovement.resetWalkingQueue(p); if (!hasLevel(spellbook, spell)) { return; } if (!hasRunes(spellbook, spell)) { return; } if (p.rights == 10 && (opp.rights != 10)) { p.getActionSender().sendMessage(p, "You cannot attack normal players as an admin."); p.resetAttack(); return; } if (p.rights != 10 && (opp.rights == 10)) { p.getActionSender().sendMessage(p, "This player is an admin and cannot be attacked."); p.resetAttack(); return; } if (maxHit >= 0) { if (p.combatDelay > 0) { p.cuedSpells = 1; p.cuedSpell = spell; p.magicOppIndex = opp.playerId; return; } if ((!opp.wildernessZone(opp.absX, opp.absY)) || (!p.wildernessZone(p.absX, p.absY))) { p.getActionSender().sendMessage(p, "You cannot attack players outside of the wilderness."); return; } if (p.InBounty == 0) { if (!p.properWildernessLevel(p.combatLevel, opp.combatLevel) || !opp.properWildernessLevel(opp.combatLevel, p.combatLevel)) { p.getActionSender().sendMessage(p, "Your combat difference is too great!"); return; } } if (p.InBounty == 1) { if (opp.playerId != p.bhTarget && (p.playerId != opp.bhTarget && (p.username != opp.OriginalAttacker))) { if (!opp.multiwayCombatZone(opp.absX, opp.absY)) { if (opp.attackedBy != null && (opp.attacking != null || opp.attackedByCount >= 1) && opp.attackedBy != p.username) { p.getActionSender().sendMessage(p, "This player is already in combat."); Engine.playerMovement.resetWalkingQueue(p); p.resetAttack(); return; } if (opp.username != p.attackedBy && p.attackedBy != null) { p.getActionSender().sendMessage(p, "You are already in combat."); Engine.playerMovement.resetWalkingQueue(p); p.resetAttack(); return; } } } } if (p.InBounty == 0) { if (!opp.multiwayCombatZone(opp.absX, opp.absY)) { if (opp.attackedBy != null && (opp.attacking != null || opp.attackedByCount >= 1) && opp.attackedBy != p.username) { p.getActionSender().sendMessage(p, "This player is already in combat."); Engine.playerMovement.resetWalkingQueue(p); p.resetAttack(); return; } if (opp.username != p.attackedBy && p.attackedBy != null) { p.getActionSender().sendMessage(p, "You are already in combat."); Engine.playerMovement.resetWalkingQueue(p); p.resetAttack(); return; } } } } int graphicDelay = -1; int damageDelay = -1; int affectDelay = -1; int graphicMS = 0; int projectile = -1; p.successfulCast = hitPlayerMage(opp); p.usingMage = true; if (maxHit >= 0) { p.attacking = opp.username; opp.attackedBy = p.username; opp.attackedByCount++; opp.count = 0; opp.logoutTimer = 10; if (p.attackedBy == null) { p.initialAttack = true; opp.initialAttack = false; } if (p.initialAttack) { if (!p.isSkulled) { p.headIconSkull = 0; p.skullVanishDelay = 1500; p.isSkulled = true; p.appearanceUpdateReq = true; p.updateReq = true; } } } if (p.faceToReq != (opp.playerId + 32768)) { p.requestFaceTo(opp.playerId + 32768); } switch (spellbook) { case 192: switch (spell) { case 1: // Wind strike p.requestAnim(1162, 0); p.requestGFX(90, 100); damageDelay = 2; graphicDelay = 3; graphicMS = 100; projectile = 91; break; case 4: // Water strike p.requestAnim(1162, 0); p.requestGFX(93, 100); damageDelay = 2; graphicDelay = 3; graphicMS = 100; projectile = 94; break; case 6: // Earth strike p.requestAnim(1162, 0); p.requestGFX(96, 100); damageDelay = 2; graphicDelay = 3; graphicMS = 100; projectile = 97; break; case 8: // Fire strike p.requestAnim(1162, 0); p.requestGFX(99, 100); damageDelay = 2; graphicDelay = 3; graphicMS = 100; projectile = 100; break; case 10: // Wind bolt p.requestAnim(1162, 0); p.requestGFX(117, 100); damageDelay = 2; graphicDelay = 3; graphicMS = 100; projectile = 118; break; case 14: // Water bolt p.requestAnim(1162, 0); p.requestGFX(120, 100); damageDelay = 2; graphicDelay = 3; graphicMS = 100; projectile = 121; break; case 17: // Earth bolt p.requestAnim(1162, 0); p.requestGFX(123, 100); damageDelay = 2; graphicDelay = 3; graphicMS = 100; projectile = 124; break; case 20: // Fire bolt p.requestAnim(1162, 0); p.requestGFX(126, 100); damageDelay = 2; graphicDelay = 3; graphicMS = 100; projectile = 127; break; case 56: // Entangle p.requestAnim(1161, 0); p.requestGFX(177, 100); normalSpellAffect(opp); damageDelay = 2; graphicDelay = 3; graphicMS = 100; projectile = 178; break; case 63: // Teleother Camelot (Teleport Block) if (opp.teleblocked) { p.getActionSender().sendMessage(p, "This person is already teleblocked."); return; } p.requestAnim(10503, 0); p.requestGFX(1842, 100); affectDelay = 3; graphicDelay = 3; projectile = 1841; break; } break; case 193: switch (spell) { case 0: // Ice Rush p.requestAnim(1978, 0); ancientMagicksAffect(opp, "Ice"); projectile = 360; graphicDelay = 2; damageDelay = 3; break; case 1: // Ice Blitz p.requestAnim(1978, 0); p.requestGFX(366, 0); ancientMagicksAffect(opp, "Ice"); graphicDelay = 3; damageDelay = 3; break; case 2: // Ice Burst p.requestAnim(1979, 0); if (!multipleDamage || !opp.multiwayCombatZone(opp.absX, opp.absY)) { ancientMagicksAffect(opp, "Ice"); } else { for (Player player : Server.engine.players) { if (player == null || player == p) { continue; } if (Misc.getDistance(opp.absX, opp.absY, player.absX, player.absY) <= 1) { if (player.wildernessZone(player.absX, player.absY) && p.properWildernessLevel(p.combatLevel, player.combatLevel) && player.properWildernessLevel(player.combatLevel, p.combatLevel)) { player.attackedBy = p.username; player.count = 0; player.logoutTimer = 10; ancientMagicksAffect(player, "Ice"); } } } } graphicDelay = 0; damageDelay = 0; break; case 16: // Miasmic Rush if (p.equipment[3] == 13867) { p.requestAnim(10513, 0); p.requestGFX(1845, 0); graphicDelay = 2; damageDelay = 3; } else { p.message("You need zuriel staff to cast this spell."); } break; case 17: // Miasmic Blitz if (p.equipment[3] == 13867) { p.requestAnim(10524, 0); p.requestGFX(1850, 0); graphicDelay = 2; damageDelay = 3; } else { p.message("You need zuriel staff to cast this spell."); } break; case 18: // Miasmic Burst if (p.equipment[3] == 13867) { p.requestAnim(10516, 0); p.requestGFX(1848, 0); if (multipleDamage || !opp.multiwayCombatZone(opp.absX, opp.absY)) { ancientMagicksAffect(opp, "Miasmic"); } else { for (Player player : Server.engine.players) { if (player == null || player == p) { continue; } if (Misc.getDistance(opp.absX, opp.absY, player.absX, player.absY) <= 1) { if (player.wildernessZone(player.absX, player.absY) && p.properWildernessLevel(p.combatLevel, player.combatLevel) && player.properWildernessLevel(player.combatLevel, p.combatLevel)) { player.attackedBy = p.username; player.count = 0; player.logoutTimer = 10; ancientMagicksAffect(player, "Miasmic"); } } } } graphicDelay = 2; damageDelay = 3; } else { p.message("You need zuriel staff to cast this spell."); } break; case 19: // Miasmic Barrage if (p.equipment[3] == 13867) { p.requestAnim(10518, 0); p.requestGFX(1853, 0); if (multipleDamage || !opp.multiwayCombatZone(opp.absX, opp.absY)) { ancientMagicksAffect(opp, "Miasmic"); } else { for (Player player : Server.engine.players) { if (player == null || player == p) { continue; } if (Misc.getDistance(opp.absX, opp.absY, player.absX, player.absY) <= 1) { if (player.wildernessZone(player.absX, player.absY) && p.properWildernessLevel(p.combatLevel, player.combatLevel) && player.properWildernessLevel(player.combatLevel, p.combatLevel)) { player.attackedBy = p.username; player.count = 0; player.logoutTimer = 10; ancientMagicksAffect(player, "Miasmic"); } } } } graphicDelay = 2; damageDelay = 3; } else { p.message("You need zuriel staff to cast this spell."); } break; case 3: // Ice Barrage p.requestAnim(1979, 0); if (multipleDamage || !opp.multiwayCombatZone(opp.absX, opp.absY)) { ancientMagicksAffect(opp, "Ice"); } else { for (Player player : Server.engine.players) { if (player == null || player == p) { continue; } if (Misc.getDistance(opp.absX, opp.absY, player.absX, player.absY) <= 1) { if (player.wildernessZone(player.absX, player.absY) && p.properWildernessLevel(p.combatLevel, player.combatLevel) && player.properWildernessLevel(player.combatLevel, p.combatLevel)) { player.attackedBy = p.username; player.count = 0; player.logoutTimer = 10; ancientMagicksAffect(player, "Ice"); } } } } graphicDelay = 2; damageDelay = 2; if (Engine.playerMovement.isMoving(opp)) { projectile = 368; } break; } break; case 430: switch (spell) { case 5: // Energy transfer if (!p.multiwayCombatZone(p.absX, p.absY)) { p.getActionSender() .sendMessage(p, "You can only use this spell in multi combat zones"); return; } if (p.specAmount < 1000) { return; } p.requestAnim(4411, 0); opp.requestGFX(734, 100); p.append1Hit(10, 0); p.specAmount = 0; opp.specAmount = 1000; p.getActionSender().setConfig2(p, 300, p.specAmount); opp.getActionSender().setConfig2(opp, 300, opp.specAmount); int random = (int) Math.round(Math.random() * p.runEnergy); if (p.runEnergy - random < 0) { random = p.runEnergy; } if (opp.runEnergy + random > 100) { random = 100 - opp.runEnergy; } p.runEnergy -= random; opp.runEnergy += random; p.getActionSender().setEnergy(p); opp.getActionSender().setEnergy(opp); break; case 9: // Stat spy p.requestAnim(4412, 0); p.requestGFX(1060, 0); opp.requestGFX(734, 100); p.statSpy(opp); break; case 19: // Vengeance other if (p.vengeanceDelay > 0) { p.getActionSender() .sendMessage(p, "You can only cast vengeance spells once every 30 seconds."); return; } p.requestAnim(4411, 0); opp.requestGFX(725, 100); opp.vengeance = true; p.vengeanceDelay = 30; p.getActionSender().addSoundEffect(p, 2908, 1, 0, 0); opp.getActionSender().addSoundEffect(p, 2908, 1, 0, 0); break; case 29: // Heal other p.requestAnim(4411, 0); opp.requestGFX(738, 100); int heal = (int) Math.round(Math.random() * (0.75 * p.skillLvl[3])); if (opp.skillLvl[3] + heal > opp.getLevelForXP(3)) { if (opp.skillLvl[3] <= opp.getLevelForXP(3)) { heal = opp.getLevelForXP(3) - opp.skillLvl[3]; } else { heal = 0; } } p.append1Hit(heal, 0); opp.skillLvl[3] += heal; opp.getActionSender().setSkillLvl(opp, 3); break; } break; } p.spell = spell; p.magicOppIndex = opp.playerId; projectile(opp, projectile); p.magicGraphicDelay = graphicDelay; p.magicDamageDelay = damageDelay; p.magicAffectDelay = affectDelay; p.graphicMSDelay = graphicMS; if (maxHit >= 0) { p.combatDelay = 5; } if (p.usedSpellbookSwap) { p.getActionSender().setTab(p, 79, p.spellbook); p.spellbookSwap = false; p.usedSpellbookSwap = false; } p.appendExperience((experience * 1000), 6); removeRunes(spellbook, spell); }