Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package org.luzox.game.players.content;
- import net.utility.Misc;
- import org.luzox.Config;
- import org.luzox.event.CycleEvent;
- import org.luzox.event.CycleEventContainer;
- import org.luzox.event.CycleEventHandler;
- import org.luzox.event.Event;
- import org.luzox.event.EventContainer;
- import org.luzox.event.EventManager;
- import org.luzox.game.Server;
- import org.luzox.game.npcs.NPC;
- import org.luzox.game.npcs.NPCHandler;
- import org.luzox.game.players.Client;
- import org.luzox.game.players.Player;
- import org.luzox.game.players.PlayerHandler;
- public class CombatAssistant {
- private Client c;
- public CombatAssistant(Client Client) {
- this.c = Client;
- }
- public void multiSpellEffectNPC(int npcId, int damage) {
- switch (c.MAGIC_SPELLS[c.oldSpellId][0]) {
- case 12891:
- case 12881:
- if (NPCHandler.npcs[npcId].freezeTimer < -4) {
- NPCHandler.npcs[npcId].freezeTimer = getFreezeTime();
- }
- break;
- }
- }
- public boolean checkMultiBarrageReqsNPC(int i) {
- if (NPCHandler.npcs[i] == null) {
- return false;
- } else {
- return true;
- }
- }
- public void appendMultiBarrageNPC(int npcId, boolean splashed) {
- if (NPCHandler.npcs[npcId] != null) {
- NPC n = (NPC) NPCHandler.npcs[npcId];
- if (n.isDead)
- return;
- if (n.heightLevel != c.heightLevel)
- return;
- if (checkMultiBarrageReqsNPC(npcId)) {
- c.barrageCount++;
- NPCHandler.npcs[npcId].underAttackBy = c.playerId;
- NPCHandler.npcs[npcId].underAttack = true;
- if (Misc.random(mageAtk()) > Misc.random(mageDef())
- && !c.magicFailed) {
- if (getEndGfxHeight() == 100) { // end GFX
- n.gfx100(c.MAGIC_SPELLS[c.oldSpellId][5]);
- } else {
- n.gfx0(c.MAGIC_SPELLS[c.oldSpellId][5]);
- }
- int damage = Misc.random(c.MAGIC_SPELLS[c.oldSpellId][6]);
- if (NPCHandler.npcs[npcId].HP - damage < 0) {
- damage = NPCHandler.npcs[npcId].HP;
- }
- c.getPA().addSkillXP(
- (c.MAGIC_SPELLS[c.oldSpellId][7] + damage
- * Config.MAGIC_EXP_RATE), 6);
- c.getPA().addSkillXP(
- (c.MAGIC_SPELLS[c.oldSpellId][7] + damage
- * Config.MAGIC_EXP_RATE / 3), 3);
- NPCHandler.npcs[npcId].handleHitMask(damage);
- // Server.npcHandler.applyDamage(npcId);
- NPCHandler.npcs[npcId].hitDiff = damage;
- NPCHandler.npcs[npcId].HP -= damage;
- NPCHandler.npcs[npcId].hitUpdateRequired = true;
- NPCHandler.npcs[npcId].freezeTimer = getFreezeTime();
- c.totalPlayerDamageDealt += damage;
- multiSpellEffectNPC(npcId, damage);
- } else {
- n.gfx100(85);
- }
- }
- }
- }
- public void appendVengeanceNPC(int otherPlayer, int damage) {
- if (c.getItems().playerHasItem(7671, 1)
- || c.playerEquipment[c.playerHands] == 7671) {
- c.sendMessage("You can't use Vengeance with boxing gloves!");
- return;
- }
- if (damage <= 0)
- return;
- if (c.npcIndex > 0 && NPCHandler.npcs[c.npcIndex] != null) {
- c.forcedText = "Taste Vengeance!";
- c.forcedChatUpdateRequired = true;
- c.updateRequired = true;
- c.vengOn = false;
- if ((NPCHandler.npcs[c.npcIndex].HP - damage) > 0) {
- damage = (int) (damage * 0.75);
- if (damage > NPCHandler.npcs[c.npcIndex].HP) {
- damage = NPCHandler.npcs[c.npcIndex].HP;
- }
- NPCHandler.npcs[c.npcIndex].HP -= damage;
- NPCHandler.npcs[c.npcIndex].hitDiff2 = damage;
- NPCHandler.npcs[c.npcIndex].hitUpdateRequired2 = true;
- NPCHandler.npcs[c.npcIndex].updateRequired = true;
- }
- }
- c.updateRequired = true;
- }
- public int[][] slayerReqs = { { 1648, 1 }, { 1612, 1 }, { 1643, 1 },
- { 1618, 1 }, { 1624, 1 }, { 1610, 1 }, { 1613, 1 }, { 1615, 1 },
- { 2783, 1 }, { 3068, 90 } };
- public boolean goodSlayer(int i) {
- for (int j = 0; j < slayerReqs.length; j++) {
- if (slayerReqs[j][0] == NPCHandler.npcs[i].npcType) {
- if (slayerReqs[j][1] > c.playerLevel[c.playerSlayer]) {
- c.sendMessage("You need a slayer level of "
- + slayerReqs[j][1] + " to harm this NPC.");
- return false;
- }
- }
- }
- return true;
- }
- public int salveDamage() {
- int damage = Misc.random(calculateMeleeMaxHit());
- return damage *= 1.55;
- }
- private void applyLeeches(int index) {
- if (c.lastTime > 0) {
- c.lastTime--;
- return;
- }
- if (c.curseActive[10]) {
- if (Misc.random(19) == 0) {
- leechAttack(index);
- c.lastTime++;
- return;
- }
- }
- if (c.curseActive[11]) {
- if (Misc.random(19) == 0) {
- leechRanged(index);
- c.lastTime++;
- return;
- }
- }
- if (c.curseActive[12]) {
- if (Misc.random(19) == 0) {
- leechMagic(index);
- c.lastTime++;
- return;
- }
- }
- if (c.curseActive[13]) {
- if (Misc.random(19) == 0) {
- leechDefence(index);
- c.lastTime++;
- return;
- }
- }
- if (c.curseActive[14]) {
- if (Misc.random(19) == 0) {
- leechStrength(index);
- c.lastTime++;
- return;
- }
- }
- if (c.curseActive[16]) {
- if (Misc.random(19) == 0) {
- leechSpecial(index);
- c.lastTime++;
- return;
- }
- }
- }
- public void leechRanged(int index) {
- int failed = Misc.random(5);
- Client c2 = (Client) PlayerHandler.players[index];
- if (failed < 5) {
- c.Lranged = false;
- return;
- } else if (failed == 5) {
- c2.playerLevel[4] -= Misc.random(8);
- if (c2.playerLevel[4] < 1)
- c2.playerLevel[4] = 1;
- c2.getPA().refreshSkill(4);
- }
- if (c.oldPlayerIndex > 0) {
- if (PlayerHandler.players[c.oldPlayerIndex] != null) {
- final int pX = c.getX();
- final int pY = c.getY();
- final int nX = c2.getX();
- final int nY = c2.getY();
- final int offX = (pY - nY) * -1;
- final int offY = (pX - nX) * -1;
- c.getPA().createPlayersProjectile2(pX, pY, offX, offY, 50, 50,
- 2236, 9, 9, -c.oldPlayerIndex - 1, 24, 0);
- c2.sendMessage("Your ranged has been leeched by "
- + Misc.optimizeText(c.playerName) + "!");
- c2.gfx0(2238);
- c.startAnimation(12575);
- c.Lranged = false;
- }
- }
- }
- public void leechMagic(int index) {
- int failed = Misc.random(5);
- Client c2 = (Client) PlayerHandler.players[index];
- if (failed < 5) {
- c.Lmagic = false;
- return;
- } else if (failed == 5) {
- c2.playerLevel[6] -= Misc.random(7) + 1;
- if (c2.playerLevel[6] < 1)
- c2.playerLevel[6] = 1;
- c2.getPA().refreshSkill(6);
- }
- if (c.oldPlayerIndex > 0) {
- if (PlayerHandler.players[c.oldPlayerIndex] != null) {
- final int pX = c.getX();
- final int pY = c.getY();
- final int nX = c2.getX();
- final int nY = c2.getY();
- final int offX = (pY - nY) * -1;
- final int offY = (pX - nX) * -1;
- c.getPA().createPlayersProjectile2(pX, pY, offX, offY, 50, 50,
- 2240, 9, 9, -c.oldPlayerIndex - 1, 24, 0);
- c2.sendMessage("Your Magic has been leeched by "
- + Misc.optimizeText(c.playerName) + "!");
- c2.gfx0(2242);
- c.startAnimation(12575);
- c.Lmagic = false;
- }
- }
- }
- public void leechDefence(int index) {
- int failed = Misc.random(5);
- Client c2 = (Client) PlayerHandler.players[index];
- if (failed < 5) {
- c.Ldefense = false;
- return;
- } else if (failed == 5) {
- c2.playerLevel[1] -= Misc.random(8);
- if (c2.playerLevel[1] < 1)
- c2.playerLevel[1] = 1;
- c2.getPA().refreshSkill(1);
- }
- if (c.oldPlayerIndex > 0) {
- if (PlayerHandler.players[c.oldPlayerIndex] != null) {
- final int pX = c.getX();
- final int pY = c.getY();
- final int nX = c2.getX();
- final int nY = c2.getY();
- final int offX = (pY - nY) * -1;
- final int offY = (pX - nX) * -1;
- c.getPA().createPlayersProjectile2(pX, pY, offX, offY, 50, 50,
- 2242, 9, 9, -c.oldPlayerIndex - 1, 24, 0);
- c2.sendMessage("Your defense has been leeched by "
- + Misc.optimizeText(c.playerName) + "!");
- c2.gfx0(2246);
- c.startAnimation(12575);
- c.Ldefense = false;
- }
- }
- }
- public void leechSpecial(int index) {
- int failed = Misc.random(10);
- Client c2 = (Client) PlayerHandler.players[index];
- if (failed < 10) {
- c.Lspecial = false;
- return;
- } else if (failed == 10) {
- c2.specAmount -= 0.5;
- c.specAmount += 0.5;
- final int pX = c.getX();
- final int pY = c.getY();
- final int nX = c2.getX();
- final int nY = c2.getY();
- final int offX = (pY - nY) * -1;
- final int offY = (pX - nX) * -1;
- c.getPA().createPlayersProjectile2(pX, pY, offX, offY, 50, 50,
- 2256, 9, 9, -c.oldPlayerIndex - 1, 24, 0);
- c2.sendMessage("Your special attack has been leeched by "
- + Misc.optimizeText(c.playerName) + "!");
- c2.gfx0(2258);
- c.startAnimation(12575);
- c.getItems().updateSpecialBar();
- c.sendMessage("You have leeched "
- + Misc.optimizeText(c2.playerName) + "'s special attack!");
- // c2.specAmount -= Misc.random(8);
- if (c2.specAmount < 1)
- c2.specAmount = 1;
- }
- if (c.oldPlayerIndex > 0) {
- if (PlayerHandler.players[c.oldPlayerIndex] != null) {
- final int pX = c.getX();
- final int pY = c.getY();
- final int nX = c2.getX();
- final int nY = c2.getY();
- final int offX = (pY - nY) * -1;
- final int offY = (pX - nX) * -1;
- c.getPA().createPlayersProjectile2(pX, pY, offX, offY, 50, 50,
- 2256, 9, 9, -c.oldPlayerIndex - 1, 24, 0);
- // c2.sendMessage("Your special attack has been leeched by "
- // +Misc.optimizeText(c.playerName)+"!");
- c2.gfx0(2258);
- c.startAnimation(12575);
- c.getItems().updateSpecialBar();
- c.Lspecial = false;
- }
- }
- }
- public void leechStrength(int index) {
- int failed = Misc.random(5);
- Client c2 = (Client) PlayerHandler.players[index];
- if (failed < 5) {
- c.Lstrength = false;
- return;
- } else if (failed == 5) {
- c2.playerLevel[2] -= Misc.random(8);
- if (c2.playerLevel[2] < 1)
- c2.playerLevel[2] = 1;
- c2.getPA().refreshSkill(2);
- }
- if (c.oldPlayerIndex > 0) {
- if (PlayerHandler.players[c.oldPlayerIndex] != null) {
- final int pX = c.getX();
- final int pY = c.getY();
- final int nX = c2.getX();
- final int nY = c2.getY();
- final int offX = (pY - nY) * -1;
- final int offY = (pX - nX) * -1;
- c.getPA().createPlayersProjectile2(pX, pY, offX, offY, 50, 50,
- 2248, 9, 9, -c.oldPlayerIndex - 1, 24, 0);
- c2.sendMessage("Your strength has been leeched by "
- + Misc.optimizeText(c.playerName) + "!");
- c2.gfx0(2250);
- c.startAnimation(12575);
- c.Lstrength = false;
- }
- }
- }
- public void leechAttack(int index) {
- int failed = Misc.random(5);
- Client c2 = (Client) PlayerHandler.players[index];
- if (failed < 5) {
- c.Lattack = false;
- return;
- } else if (failed == 5) {
- c2.playerLevel[0] -= Misc.random(8);
- if (c2.playerLevel[0] < 1)
- c2.playerLevel[0] = 1;
- c2.getPA().refreshSkill(0);
- }
- if (c.oldPlayerIndex > 0) {
- if (PlayerHandler.players[c.oldPlayerIndex] != null) {
- final int pX = c.getX();
- final int pY = c.getY();
- final int nX = c2.getX();
- final int nY = c2.getY();
- final int offX = (pY - nY) * -1;
- final int offY = (pX - nX) * -1;
- c.getPA().createPlayersProjectile2(pX, pY, offX, offY, 50, 50,
- 2252, 9, 9, -c.oldPlayerIndex - 1, 24, 0);
- c2.sendMessage("Your attack has been leeched by "
- + Misc.optimizeText(c.playerName) + "!");
- c2.gfx0(2253);
- c.startAnimation(12575);
- c.Lattack = false;
- }
- }
- }
- public void applyNpcSoulSplit(int i, int damage) {
- int pX = c.getX();
- int pY = c.getY();
- int oX = NPCHandler.npcs[i].absX;
- int oY = NPCHandler.npcs[i].absY;
- int offX = (pY - oY) * -1;
- int offY = (pX - oX) * -1;
- if (!c.curseActive[18])
- return;
- if (damage <= 0)
- return;
- if (NPCHandler.npcs[i] != null) {
- NPC c2 = (NPC) NPCHandler.npcs[i];
- c2.HP -= (int) (damage / 40);
- c2.hitUpdateRequired = true;
- c.getPA().createPlayersProjectile(pX, pY, offX, offY, 50, 80, 2263,
- 43, 31, -c.oldPlayerIndex - 1, 0);
- c.gfx0(2264);
- if (c.playerLevel[3] < c.getLevelForXP(c.playerXP[3])) {
- c.playerLevel[3] += (int) (damage / 4);
- if (c.playerLevel[3] > c.getLevelForXP(c.playerXP[3]))
- c.playerLevel[3] = c.getLevelForXP(c.playerXP[3]);
- c.getPA().refreshSkill(3);
- }
- }
- }
- public void npcMageDamage(int damage) {
- int i = c.npcIndex;
- c.previousDamage = damage;
- int bonusAttack = getBonusAttack(i);
- if (Misc.random(NPCHandler.npcs[i].defence) > 10
- + Misc.random(mageAtk()) + bonusAttack) {
- damage /= 2;
- } else if (NPCHandler.npcs[i].npcType == 2881
- || NPCHandler.npcs[i].npcType == 2882) {
- damage /= 2;
- }
- if (NPCHandler.npcs[i].HP - damage < 0) {
- damage = NPCHandler.npcs[i].HP;
- }
- c.getPA().addSkillXP((damage * Config.MAGIC_EXP_RATE), 6);
- c.getPA().addSkillXP((damage * Config.MAGIC_EXP_RATE / 3), 3);
- c.getPA().refreshSkill(3);
- c.getPA().refreshSkill(6);
- if (damage > 0) {
- if (NPCHandler.npcs[i].npcType >= 3777
- && NPCHandler.npcs[i].npcType <= 3780) {
- c.pcDamage += damage;
- }
- }
- NPCHandler.npcs[i].underAttack = true;
- c.killingNpcIndex = c.npcIndex;
- c.lastNpcAttacked = i;
- NPCHandler.npcs[i].hitDiff = damage;
- NPCHandler.npcs[i].HP -= damage;
- NPCHandler.npcs[i].hitUpdateRequired = true;
- c.totalDamageDealt += damage;
- NPCHandler.npcs[i].updateRequired = true;
- }
- public void applyMageDamage(int damage) {
- int i = c.playerIndex;
- Client o = (Client) PlayerHandler.players[i];
- if (c.Kspec && o.prayerActive[16]) {
- damage *= 0.5;
- }
- c.previousDamage = damage;
- if (o == null) {
- return;
- }
- if (o.vengOn && damage > 0)
- appendVengeance(i, damage);
- if (c.fightMode == 3) {
- c.getPA().addSkillXP((damage * Config.MAGIC_EXP_RATE / 3), 0);
- c.getPA().addSkillXP((damage * Config.MAGIC_EXP_RATE / 3), 1);
- c.getPA().addSkillXP((damage * Config.MAGIC_EXP_RATE / 3), 2);
- c.getPA().addSkillXP((damage * Config.MAGIC_EXP_RATE / 3), 3);
- c.getPA().refreshSkill(0);
- c.getPA().refreshSkill(1);
- c.getPA().refreshSkill(2);
- c.getPA().refreshSkill(3);
- } else {
- c.getPA().addSkillXP((damage * Config.MAGIC_EXP_RATE), c.fightMode);
- c.getPA().addSkillXP((damage * Config.MAGIC_EXP_RATE / 3), 3);
- c.getPA().refreshSkill(c.fightMode);
- c.getPA().refreshSkill(3);
- }
- PlayerHandler.players[i].logoutDelay = System.currentTimeMillis();
- PlayerHandler.players[i].underAttackBy = c.playerId;
- PlayerHandler.players[i].killerId = c.playerId;
- PlayerHandler.players[i].singleCombatDelay = System.currentTimeMillis();
- if (c.killedBy != PlayerHandler.players[i].playerId)
- c.totalPlayerDamageDealt = 0;
- c.killedBy = PlayerHandler.players[i].playerId;
- applySmite(i, damage);
- if (c.prayerActive[3] == true)
- applySmite(i, damage * 3);
- PlayerHandler.players[i].dealDamage(damage);
- PlayerHandler.players[i].damageTaken[c.playerId] += damage;
- c.totalPlayerDamageDealt += damage;
- PlayerHandler.players[i].updateRequired = true;
- o.getPA().refreshSkill(3);
- PlayerHandler.players[i].handleHitMask(damage);
- }
- /**
- * Attack Npcs
- */
- public void attackNpc(int i) {
- if (NPCHandler.npcs[i] != null) {
- if (NPCHandler.npcs[i].isDead || NPCHandler.npcs[i].MaxHP <= 0) {
- c.usingMagic = false;
- c.faceUpdate(0);
- c.npcIndex = 0;
- return;
- }
- if (NPCHandler.npcs[i].npcType == 110 && c.absY <= 10326) {
- c.usingMagic = false;
- c.faceUpdate(0);
- c.npcIndex = 0;
- return;
- }
- if (c.respawnTimer > 0) {
- c.npcIndex = 0;
- return;
- }
- if (NPCHandler.npcs[i].underAttackBy > 0
- && NPCHandler.npcs[i].underAttackBy != c.playerId
- && !NPCHandler.npcs[i].inMulti()) {
- c.npcIndex = 0;
- c.sendMessage("This monster is already in combat.");
- return;
- }
- if ((c.underAttackBy > 0 || c.underAttackBy2 > 0)
- && c.underAttackBy2 != i && !c.inMulti()) {
- resetPlayerAttack();
- c.sendMessage("I am already under attack.");
- return;
- }
- if (!goodSlayer(i)) {
- resetPlayerAttack();
- return;
- }
- if (NPCHandler.npcs[i].spawnedBy != c.playerId
- && NPCHandler.npcs[i].spawnedBy > 0) {
- resetPlayerAttack();
- c.sendMessage("This monster was not spawned for you.");
- return;
- }
- c.followId2 = i;
- c.followId = 0;
- if (c.attackTimer <= 0) {
- boolean usingBow = false;
- boolean usingArrows = false;
- boolean usingOtherRangeWeapons = false;
- boolean usingCross = false;
- c.usingBow = false;
- if (c.playerEquipment[c.playerWeapon] == 9185
- || c.playerEquipment[c.playerWeapon] == 15041
- || c.playerEquipment[c.playerWeapon] == 7885)
- usingCross = true;
- c.bonusAttack = 0;
- c.rangeItemUsed = 0;
- c.projectileStage = 0;
- c.SaveGame();
- if (c.autocasting && c.playerMagicBook != 2) {
- c.spellId = c.autocastId;
- c.usingMagic = true;
- }
- if (c.playerEquipment[c.playerWeapon] == 22494) {
- c.autocasting = true;
- c.spellId = 52;
- c.usingMagic = true;
- c.mageFollow = true;
- }
- if (c.spellId > 0) {
- c.usingMagic = true;
- }
- c.attackTimer = getAttackDelay(c.getItems()
- .getItemName(c.playerEquipment[c.playerWeapon])
- .toLowerCase());
- c.specAccuracy = 1.0;
- c.specDamage = 1.0;
- if (!c.usingMagic) {
- for (int bowId : c.BOWS) {
- if (c.playerEquipment[c.playerWeapon] == bowId) {
- usingBow = true;
- c.usingBow = true;
- for (int arrowId : c.ARROWS) {
- if (c.playerEquipment[c.playerArrows] == arrowId) {
- usingArrows = true;
- }
- }
- }
- }
- if (c.playerEquipment[c.playerWeapon] == 13022) {
- usingBow = true;
- c.usingBow = true;
- }
- for (int otherRangeId : c.OTHER_RANGE_WEAPONS) {
- if (c.playerEquipment[c.playerWeapon] == otherRangeId) {
- usingOtherRangeWeapons = true;
- }
- }
- }
- if ((!c.goodDistance(c.getX(), c.getY(),
- NPCHandler.npcs[i].getX(), NPCHandler.npcs[i].getY(), 2) && (usingHally()
- && !usingOtherRangeWeapons
- && !usingBow
- && !c.usingMagic && !usingCrystalBow()))
- || (!c.goodDistance(c.getX(), c.getY(),
- NPCHandler.npcs[i].getX(),
- NPCHandler.npcs[i].getY(), 4) && (usingOtherRangeWeapons
- && !usingBow && !c.usingMagic && !usingCrystalBow()))
- || (!c.goodDistance(c.getX(), c.getY(),
- NPCHandler.npcs[i].getX(),
- NPCHandler.npcs[i].getY(), 1) && (!usingOtherRangeWeapons
- && !usingHally() && !usingBow && !c.usingMagic && !usingCrystalBow()))
- || ((!c.goodDistance(c.getX(), c.getY(),
- NPCHandler.npcs[i].getX(),
- NPCHandler.npcs[i].getY(), 8) && (usingBow
- || c.usingMagic || usingCrystalBow())))) {
- c.attackTimer = 2;
- return;
- }
- if (!usingCross
- && !usingArrows
- && usingBow
- && (c.playerEquipment[c.playerWeapon] < 4212 || c.playerEquipment[c.playerWeapon] > 4223)
- && c.playerEquipment[c.playerWeapon] != 13022) {
- c.sendMessage("You have run out of arrows!");
- c.stopMovement();
- c.npcIndex = 0;
- return;
- }
- if (correctBowAndArrows() < c.playerEquipment[c.playerArrows]
- && Config.CORRECT_ARROWS && usingBow
- && !usingCrystalBow()
- && c.playerEquipment[c.playerWeapon] != 9185
- && c.playerEquipment[c.playerWeapon] != 7865
- && c.playerEquipment[c.playerWeapon] != 7885
- && c.playerEquipment[c.playerWeapon] != 15041) {
- c.sendMessage("You can't use "
- + c.getItems()
- .getItemName(
- c.playerEquipment[c.playerArrows])
- .toLowerCase()
- + "s with a "
- + c.getItems()
- .getItemName(
- c.playerEquipment[c.playerWeapon])
- .toLowerCase() + ".");
- c.stopMovement();
- c.npcIndex = 0;
- return;
- }
- if ((c.playerEquipment[c.playerWeapon] == 9185
- || c.playerEquipment[c.playerWeapon] == 15041
- || c.playerEquipment[c.playerWeapon] == 7885 || c.playerEquipment[c.playerWeapon] == 7865)
- && !properBolts()) {
- c.sendMessage("You must use bolts with a crossbow.");
- c.stopMovement();
- resetPlayerAttack();
- return;
- }
- if (armaNpc(i) && !usingCross && !usingBow && !c.usingMagic
- && !usingCrystalBow() && !usingOtherRangeWeapons) {
- resetPlayerAttack();
- c.sendMessage("You can only attack this npc with ranged or magic!");
- return;
- }
- if (usingBow
- || c.usingMagic
- || c.spellId > 0
- || usingOtherRangeWeapons
- || usingCrystalBow()
- || (c.goodDistance(c.getX(), c.getY(),
- NPCHandler.npcs[i].getX(),
- NPCHandler.npcs[i].getY(), 2) && usingHally())) {
- c.stopMovement();
- }
- if (!checkMagicReqs(c.spellId)) {
- c.stopMovement();
- c.npcIndex = 0;
- return;
- }
- c.faceUpdate(i);
- // c.specAccuracy = 1.0;
- // c.specDamage = 1.0;
- NPCHandler.npcs[i].underAttackBy = c.playerId;
- NPCHandler.npcs[i].lastDamageTaken = System.currentTimeMillis();
- if (c.usingSpecial && !c.usingMagic) {
- if (checkSpecAmount(c.playerEquipment[c.playerWeapon])) {
- c.lastWeaponUsed = c.playerEquipment[c.playerWeapon];
- c.lastArrowUsed = c.playerEquipment[c.playerArrows];
- activateSpecial(c.playerEquipment[c.playerWeapon], i);
- return;
- } else {
- c.sendMessage("You don't have the required special energy to use this attack.");
- c.usingSpecial = false;
- c.getItems().updateSpecialBar();
- c.npcIndex = 0;
- return;
- }
- }
- c.specMaxHitIncrease = 0;
- if (!c.usingMagic) {
- c.startAnimation(getWepAnim(c.getItems()
- .getItemName(c.playerEquipment[c.playerWeapon])
- .toLowerCase()));
- } else {
- c.startAnimation(c.MAGIC_SPELLS[c.spellId][2]);
- }
- c.lastWeaponUsed = c.playerEquipment[c.playerWeapon];
- c.lastArrowUsed = c.playerEquipment[c.playerArrows];
- if (!usingBow && !c.usingMagic && !usingOtherRangeWeapons) { // melee
- // hit
- // delay
- c.hitDelay = getHitDelay(c.getItems()
- .getItemName(c.playerEquipment[c.playerWeapon])
- .toLowerCase());
- c.projectileStage = 0;
- c.oldNpcIndex = i;
- }
- if (usingBow && !usingOtherRangeWeapons && !c.usingMagic
- || usingCross) { // range
- // hit
- // delay
- if (usingCross)
- c.usingBow = true;
- if (c.fightMode == 2)
- c.attackTimer--;
- c.lastArrowUsed = c.playerEquipment[c.playerArrows];
- c.lastWeaponUsed = c.playerEquipment[c.playerWeapon];
- c.gfx100(getRangeStartGFX());
- c.hitDelay = getHitDelay(c.getItems()
- .getItemName(c.playerEquipment[c.playerWeapon])
- .toLowerCase());
- c.projectileStage = 1;
- c.oldNpcIndex = i;
- if (c.playerEquipment[c.playerWeapon] >= 4212
- && c.playerEquipment[c.playerWeapon] <= 4223) {
- c.rangeItemUsed = c.playerEquipment[c.playerWeapon];
- c.crystalBowArrowCount++;
- c.lastArrowUsed = 0;
- } else {
- c.rangeItemUsed = c.playerEquipment[c.playerArrows];
- c.getItems().deleteArrow();
- }
- fireProjectileNpc();
- }
- if (usingOtherRangeWeapons && !c.usingMagic && !usingBow) { // knives,
- // darts,
- // etc
- // hit
- // delay
- c.rangeItemUsed = c.playerEquipment[c.playerWeapon];
- c.getItems().deleteEquipment();
- c.gfx100(getRangeStartGFX());
- c.lastArrowUsed = 0;
- c.hitDelay = getHitDelay(c.getItems()
- .getItemName(c.playerEquipment[c.playerWeapon])
- .toLowerCase());
- c.projectileStage = 1;
- c.oldNpcIndex = i;
- if (c.fightMode == 2)
- c.attackTimer--;
- fireProjectileNpc();
- }
- if (c.usingMagic) { // magic hit delay
- int pX = c.getX();
- int pY = c.getY();
- int nX = NPCHandler.npcs[i].getX();
- int nY = NPCHandler.npcs[i].getY();
- int offX = (pY - nY) * -1;
- int offY = (pX - nX) * -1;
- c.castingMagic = true;
- c.projectileStage = 2;
- if (c.MAGIC_SPELLS[c.spellId][3] > 0) {
- if (getStartGfxHeight() == 100) {
- c.gfx100(c.MAGIC_SPELLS[c.spellId][3]);
- } else {
- c.gfx0(c.MAGIC_SPELLS[c.spellId][3]);
- }
- }
- if (c.MAGIC_SPELLS[c.spellId][4] > 0) {
- c.getPA().createPlayersProjectile(pX, pY, offX, offY,
- 50, 78, c.MAGIC_SPELLS[c.spellId][4],
- getStartHeight(), getEndHeight(), i + 1, 50);
- }
- c.hitDelay = getHitDelay(c.getItems()
- .getItemName(c.playerEquipment[c.playerWeapon])
- .toLowerCase());
- c.oldNpcIndex = i;
- c.oldSpellId = c.spellId;
- c.spellId = 0;
- if (!c.autocasting)
- c.npcIndex = 0;
- }
- if (usingBow && Config.CRYSTAL_BOW_DEGRADES) {
- if (c.playerEquipment[c.playerWeapon] == 4212) {
- c.getItems().wearItem(4214, 1, 3);
- }
- if (c.crystalBowArrowCount >= 250) {
- switch (c.playerEquipment[c.playerWeapon]) {
- case 4223: // 1/10 bow
- c.getItems().wearItem(-1, 1, 3);
- c.sendMessage("Your crystal bow has fully degraded.");
- if (!c.getItems().addItem(4207, 1)) {
- Server.itemHandler.createGroundItem(c, 4207,
- c.getX(), c.getY(), 1, c.getId());
- }
- c.crystalBowArrowCount = 0;
- break;
- default:
- c.getItems().wearItem(
- ++c.playerEquipment[c.playerWeapon], 1, 3);
- c.sendMessage("Your crystal bow degrades.");
- c.crystalBowArrowCount = 0;
- break;
- }
- }
- }
- }
- }
- }
- public void delayedHit(final int i) { // npc hit delay
- if (NPCHandler.npcs[i] != null) {
- if (NPCHandler.npcs[i].isDead) {
- c.npcIndex = 0;
- return;
- }
- NPCHandler.npcs[i].facePlayer(c.playerId);
- if (NPCHandler.npcs[i].underAttackBy > 0
- && Server.npcHandler.getsPulled(i)) {
- NPCHandler.npcs[i].killerId = c.playerId;
- } else if (NPCHandler.npcs[i].underAttackBy < 0
- && !Server.npcHandler.getsPulled(i)) {
- NPCHandler.npcs[i].killerId = c.playerId;
- }
- c.lastNpcAttacked = i;
- double slayerBonus = 1 + ((double) ((double) c.playerLevel[18] / 99));// getback2
- // double slayerBonus = 1.0;
- if (c.projectileStage == 0 && !c.usingMagic && !c.castingMagic) { // melee
- // hit
- // damage
- int damageOnNPC = (int) (Misc.random(calculateMeleeMaxHit()) * (slayerBonus));
- c.clawDamage[0] = (int) Math.round(damageOnNPC / 2);
- c.clawDamage[1] = (int) Math.round(damageOnNPC / 2);
- c.clawDamage[2] = (int) Math.round(damageOnNPC / 4);
- applyNpcMeleeDamage2(i, 1, damageOnNPC);
- if (c.doubleHit && !c.usingClaws) {
- applyNpcMeleeDamage2(
- i,
- 2,
- Misc.random(calculateMeleeMaxHit()
- * (1 + (c.playerLevel[18] / 99))));
- }
- if (c.doubleHit && c.usingClaws) {
- applyNpcMeleeDamage2(i, 2, c.clawDamage[0]);
- CycleEventHandler.getSingleton().addEvent(c,
- new CycleEvent() {
- @Override
- public void execute(
- CycleEventContainer container) {
- container.stop();
- }
- @Override
- public void stop() {
- applyNpcMeleeDamage2(i, 1, c.clawDamage[1]);
- applyNpcMeleeDamage2(i, 2, c.clawDamage[2]);
- // System.out.println("yes.");
- }
- }, 1);
- c.usingClaws = false;
- }
- }
- if (!c.castingMagic && c.projectileStage > 0) { // range hit damage
- int damage = (int) ((double) ((double) Misc
- .random(rangeMaxHit()) * (slayerBonus)));
- int damage2 = -1;
- if (c.lastWeaponUsed == 11235 || c.bowSpecShot == 1
- || c.cannonSpec == 1)
- damage2 = Misc.random(rangeMaxHit())
- * (1 + (c.playerLevel[18] / 99));
- boolean ignoreDef = false;
- if (Misc.random(5) == 1
- && c.lastArrowUsed == 9243
- && (c.playerEquipment[c.playerWeapon] == 9185
- || c.playerEquipment[c.playerWeapon] == 15041
- || c.playerEquipment[c.playerWeapon] == 7885 || c.playerEquipment[c.playerWeapon] == 7865)) {
- ignoreDef = true;
- NPCHandler.npcs[i].gfx0(758);
- }
- if (Misc.random(NPCHandler.npcs[i].defence) > Misc
- .random(10 + calculateRangeAttack()) && !ignoreDef) {
- damage = 0;
- } else if (NPCHandler.npcs[i].npcType == 2881
- || NPCHandler.npcs[i].npcType == 2883 && !ignoreDef) {
- damage = 0;
- }
- if (Misc.random(4) == 1 && c.lastArrowUsed == 9242
- && damage > 0) {
- NPCHandler.npcs[i].gfx0(754);
- damage = NPCHandler.npcs[i].HP / 5;
- c.handleHitMask(c.playerLevel[3] / 10);
- c.dealDamage(c.playerLevel[3] / 10);
- c.gfx0(754);
- }
- if (c.lastWeaponUsed == 11235 || c.bowSpecShot == 1) {
- if (Misc.random(NPCHandler.npcs[i].defence) > Misc
- .random(10 + calculateRangeAttack()))
- damage2 = 0;
- }
- if (c.dbowSpec) {
- NPCHandler.npcs[i].gfx100(1100);
- if (damage < 8)
- damage = 8;
- if (damage2 < 8)
- damage2 = 8;
- c.dbowSpec = false;
- }
- if (damage > 0
- && Misc.random(5) == 1
- && c.lastArrowUsed == 9244
- && (c.playerEquipment[c.playerWeapon] == 9185
- || c.playerEquipment[c.playerWeapon] == 7885
- || c.playerEquipment[c.playerWeapon] == 15041 || c.playerEquipment[c.playerWeapon] == 7865)) {
- damage *= 1.65;
- NPCHandler.npcs[i].gfx0(756);
- }
- if (NPCHandler.npcs[i].HP - damage < 0) {
- damage = NPCHandler.npcs[i].HP;
- }
- if (NPCHandler.npcs[i].HP - damage <= 0 && damage2 > 0) {
- damage2 = 0;
- }
- if (c.fightMode == 3) {
- c.getPA().addSkillXP((damage * Config.RANGE_EXP_RATE / 3),
- 4);
- c.getPA().addSkillXP((damage * Config.RANGE_EXP_RATE / 3),
- 1);
- c.getPA().addSkillXP((damage * Config.RANGE_EXP_RATE / 3),
- 3);
- c.getPA().refreshSkill(1);
- c.getPA().refreshSkill(3);
- c.getPA().refreshSkill(4);
- } else {
- c.getPA().addSkillXP((damage * Config.RANGE_EXP_RATE), 4);
- c.getPA().addSkillXP((damage * Config.RANGE_EXP_RATE / 3),
- 3);
- c.getPA().refreshSkill(3);
- c.getPA().refreshSkill(4);
- }
- boolean dropArrows = true;
- for (int noArrowId : c.NO_ARROW_DROP) {
- if (c.lastWeaponUsed == noArrowId) {
- dropArrows = false;
- break;
- }
- }
- if(dropArrows) {
- c.getItems().dropArrowNpc();
- }
- //if(c.cannonSpec == 1)
- // Server.playerHandler.players[i].gfx100(89);
- Server.npcHandler.npcs[i].underAttack = true;
- Server.npcHandler.npcs[i].hitDiff = damage;
- Server.npcHandler.npcs[i].HP -= damage;
- if (damage2 != -1) {
- if(c.cannonSpec != 1){
- Server.npcHandler.npcs[i].hitDiff = damage2;
- Server.npcHandler.npcs[i].HP -= damage2;
- } else {
- c.cannonSpec = 0;
- final int d2 = damage2;
- final int pId = c.playerId;
- final int index = i;
- //int distance = Server.playerHandler.players[pId].distanceToPoint(Server.playerHandler.players[index].getX(), Server.playerHandler.players[index].getY());
- int totalDistance = 2;
- CycleEventHandler.getSingleton().addEvent(c, new CycleEvent() {
- @Override
- public void execute(CycleEventContainer c) {
- if(Server.playerHandler.players[index] == null)
- return;
- Server.npcHandler.npcs[index].hitDiff = d2;
- Server.npcHandler.npcs[index].HP -= d2;
- c.stop();
- }
- @Override
- public void stop() {
- }
- }, totalDistance);
- }
- }
- if (c.killingNpcIndex != c.oldNpcIndex) {
- c.totalDamageDealt = 0;
- }
- c.killingNpcIndex = c.oldNpcIndex;
- c.totalDamageDealt += damage;
- NPCHandler.npcs[i].hitUpdateRequired = true;
- if (damage2 > -1)
- NPCHandler.npcs[i].hitUpdateRequired2 = true;
- NPCHandler.npcs[i].updateRequired = true;
- } else if (c.projectileStage > 0) { // magic hit damage
- // double slayerBonus = 1+(c.playerLevel[18] / 99);
- int damage = (int) ((double) ((double) Misc
- .random(c.MAGIC_SPELLS[c.oldSpellId][6]) * (slayerBonus)));
- if (godSpells()) {
- if (System.currentTimeMillis() - c.godSpellDelay < Config.GOD_SPELL_CHARGE) {
- damage += Misc.random(10);
- }
- }
- if (c.playerEquipment[c.playerWeapon] == 4170) {// getback
- damage = (damage + damage);
- }
- boolean magicFailed = false;
- // c.npcIndex = 0;
- int bonusAttack = getBonusAttack(i);
- if (Misc.random(NPCHandler.npcs[i].defence) > 10
- + Misc.random(mageAtk()) + bonusAttack) {
- damage = 0;
- magicFailed = true;
- } else if (NPCHandler.npcs[i].npcType == 2881
- || NPCHandler.npcs[i].npcType == 2882) {
- damage = 0;
- magicFailed = true;
- }
- int totalBarraged = 0;
- for (int j = 0; j < NPCHandler.npcs.length; j++) {
- if (NPCHandler.npcs[j] != null
- && NPCHandler.npcs[j].MaxHP > 0) {
- int nX = NPCHandler.npcs[j].getX();
- int nY = NPCHandler.npcs[j].getY();
- int pX = NPCHandler.npcs[i].getX();
- int pY = NPCHandler.npcs[i].getY();
- if ((nX - pX == -1 || nX - pX == 0 || nX - pX == 1)
- && (nY - pY == -1 || nY - pY == 0 || nY - pY == 1)) {
- if (multis() && NPCHandler.npcs[i].inMulti()) {
- Client p = (Client) PlayerHandler.players[c.playerId];
- appendMultiBarrageNPC(j, c.magicFailed);
- totalBarraged++;
- if (Server.npcHandler.goodDistance(
- NPCHandler.npcs[i].absX,
- NPCHandler.npcs[i].absY, c.absX,
- c.absY, 1))
- Server.npcHandler.attackPlayer(p, j);
- }
- }
- }
- }
- if (totalBarraged > 1)
- return;
- if (NPCHandler.npcs[i].HP - damage < 0) {
- damage = NPCHandler.npcs[i].HP;
- }
- c.getPA().addSkillXP(
- (c.MAGIC_SPELLS[c.oldSpellId][7] + damage
- * Config.MAGIC_EXP_RATE), 6);
- c.getPA().addSkillXP(
- (c.MAGIC_SPELLS[c.oldSpellId][7] + damage
- * Config.MAGIC_EXP_RATE / 3), 3);
- c.getPA().refreshSkill(3);
- c.getPA().refreshSkill(6);
- if (getEndGfxHeight() == 100 && !magicFailed) { // end GFX
- NPCHandler.npcs[i].gfx100(c.MAGIC_SPELLS[c.oldSpellId][5]);
- } else if (!magicFailed) {
- NPCHandler.npcs[i].gfx0(c.MAGIC_SPELLS[c.oldSpellId][5]);
- }
- if (magicFailed) {
- NPCHandler.npcs[i].gfx100(85);
- }
- if (!magicFailed) {
- int freezeDelay = getFreezeTime(); // freeze
- if (freezeDelay > 0 && NPCHandler.npcs[i].freezeTimer == 0) {
- NPCHandler.npcs[i].freezeTimer = freezeDelay;
- }
- switch (c.MAGIC_SPELLS[c.oldSpellId][0]) {
- case 12901:
- case 12919: // blood spells
- case 12911:
- case 12929:
- int heal = Misc.random(damage / 2);
- if (c.playerLevel[3] + heal >= c.getPA().getLevelForXP(
- c.playerXP[3])) {
- c.playerLevel[3] = c.getPA().getLevelForXP(
- c.playerXP[3]);
- } else {
- c.playerLevel[3] += heal;
- }
- c.getPA().refreshSkill(3);
- break;
- }
- }
- NPCHandler.npcs[i].underAttack = true;
- if (c.MAGIC_SPELLS[c.oldSpellId][6] != 0) {
- NPCHandler.npcs[i].hitDiff = damage;
- NPCHandler.npcs[i].HP -= damage;
- NPCHandler.npcs[i].hitUpdateRequired = true;
- c.totalDamageDealt += damage;
- }
- c.killingNpcIndex = c.oldNpcIndex;
- NPCHandler.npcs[i].updateRequired = true;
- c.usingMagic = false;
- c.castingMagic = false;
- c.oldSpellId = 0;
- }
- }
- if (c.bowSpecShot <= 0) {
- c.oldNpcIndex = 0;
- c.projectileStage = 0;
- c.doubleHit = false;
- c.lastWeaponUsed = 0;
- c.bowSpecShot = 0;
- }
- if (c.bowSpecShot >= 2) {
- c.bowSpecShot = 0;
- // c.attackTimer =
- // getAttackDelay(c.getItems().getItemName(c.playerEquipment[c.playerWeapon]).toLowerCase());
- }
- if (c.bowSpecShot == 1) {
- fireProjectileNpc();
- c.hitDelay = 2;
- c.bowSpecShot = 0;
- }
- }
- public void applyNpcMeleeDamage2(int i, int damageMask, int damage) {
- c.previousDamage = damage;
- boolean fullVeracsEffect = c.getPA().fullVeracs()
- && Misc.random(3) == 1;
- if (NPCHandler.npcs[i].HP - damage < 0) {
- damage = NPCHandler.npcs[i].HP;
- }
- if (!fullVeracsEffect) {
- if (Misc.random(NPCHandler.npcs[i].defence) > Misc.random(15)
- + Misc.random(calculateMeleeAttack())) {
- damage = 0;
- } else if (NPCHandler.npcs[i].npcType == 2882
- || NPCHandler.npcs[i].npcType == 2883) {
- damage = 0;
- }
- }
- boolean guthansEffect = false;
- if (c.getPA().fullGuthans()) {
- if (Misc.random(3) == 1) {
- guthansEffect = true;
- }
- }
- if (c.fightMode == 3) {
- c.getPA().addSkillXP((damage * Config.MELEE_EXP_RATE / 3), 0);
- c.getPA().addSkillXP((damage * Config.MELEE_EXP_RATE / 3), 1);
- c.getPA().addSkillXP((damage * Config.MELEE_EXP_RATE / 3), 2);
- c.getPA().addSkillXP((damage * Config.MELEE_EXP_RATE / 3), 3);
- c.getPA().refreshSkill(0);
- c.getPA().refreshSkill(1);
- c.getPA().refreshSkill(2);
- c.getPA().refreshSkill(3);
- } else {
- c.getPA().addSkillXP((damage * Config.MELEE_EXP_RATE), c.fightMode);
- c.getPA().addSkillXP((damage * Config.MELEE_EXP_RATE / 3), 3);
- c.getPA().refreshSkill(c.fightMode);
- c.getPA().refreshSkill(3);
- }
- if (damage > 0 && guthansEffect) {
- c.playerLevel[3] += damage;
- if (c.playerLevel[3] > c.getLevelForXP(c.playerXP[3]))
- c.playerLevel[3] = c.getLevelForXP(c.playerXP[3]);
- c.getPA().refreshSkill(3);
- NPCHandler.npcs[i].gfx0(398);
- }
- NPCHandler.npcs[i].underAttack = true;
- // Server.npcHandler.npcs[i].killerId = c.playerId;
- c.killingNpcIndex = c.npcIndex;
- c.lastNpcAttacked = i;
- switch (c.specEffect) {
- case 4:
- if (damage > 0) {
- if (c.playerLevel[3] + damage > c.getLevelForXP(c.playerXP[3]))
- if (c.playerLevel[3] > c.getLevelForXP(c.playerXP[3]))
- ;
- else
- c.playerLevel[3] = c.getLevelForXP(c.playerXP[3]);
- else
- c.playerLevel[3] += damage;
- c.getPA().refreshSkill(3);
- c.specEffect = 0;
- }
- break;
- case 5:
- c.clawDelay = 2;
- break;
- }
- switch (damageMask) {
- case 1:
- NPCHandler.npcs[i].hitDiff = damage;
- NPCHandler.npcs[i].HP -= damage;
- c.totalDamageDealt += damage;
- NPCHandler.npcs[i].hitUpdateRequired = true;
- NPCHandler.npcs[i].updateRequired = true;
- break;
- case 2:
- NPCHandler.npcs[i].hitDiff2 = damage;
- NPCHandler.npcs[i].HP -= damage;
- c.totalDamageDealt += damage;
- NPCHandler.npcs[i].hitUpdateRequired2 = true;
- NPCHandler.npcs[i].updateRequired = true;
- c.doubleHit = false;
- break;
- }
- }
- public void applyPlayerHit(int i, int damage) {
- int damageMask = 1;
- c.previousDamage = damage;
- Client o = (Client) PlayerHandler.players[i];
- if (o == null) {
- return;
- }
- int damage1 = damage;
- if (PlayerHandler.players[i].playerLevel[3] - damage1 < 0) {
- damage1 = PlayerHandler.players[i].playerLevel[3];
- }
- if (o.vengOn && damage1 > 0)
- appendVengeance(i, damage1);
- if (damage1 > 0)
- applyRecoil(damage1, i);
- PlayerHandler.players[i].logoutDelay = System.currentTimeMillis();
- PlayerHandler.players[i].underAttackBy = c.playerId;
- PlayerHandler.players[i].killerId = c.playerId;
- PlayerHandler.players[i].singleCombatDelay = System.currentTimeMillis();
- if (c.killedBy != PlayerHandler.players[i].playerId)
- c.totalPlayerDamageDealt = 0;
- c.killedBy = PlayerHandler.players[i].playerId;
- applySmite(i, damage1);
- if (c.prayerActive[3] == true)
- applySmite(i, damage1 * 3);
- switch (damageMask) {
- case 1:
- PlayerHandler.players[i].dealDamage(damage1);
- PlayerHandler.players[i].damageTaken[c.playerId] += damage1;
- c.totalPlayerDamageDealt += damage1;
- PlayerHandler.players[i].updateRequired = true;
- o.getPA().refreshSkill(3);
- break;
- }
- PlayerHandler.players[i].handleHitMask(damage1);
- }
- public void applyNpcMeleeDamage(int i, int damageMask) {
- double slayerBonus = 1 + ((double) ((double) c.playerLevel[18] / 99));
- // double slayerBonus = 1.0;
- int damage = (int) ((double) ((double) Misc
- .random(calculateMeleeMaxHit()) * (slayerBonus)));
- boolean fullVeracsEffect = c.getPA().fullVeracs()
- && Misc.random(3) == 1;
- if (NPCHandler.npcs[i].HP - damage < 0) {
- damage = NPCHandler.npcs[i].HP;
- }
- if (!fullVeracsEffect) {
- if (Misc.random(Server.npcHandler.npcs[i].defence) > 10 + Misc.random(calculateMeleeAttack())) {
- damage = 0;
- } else if (Server.npcHandler.npcs[i].npcType == 2882 || Server.npcHandler.npcs[i].npcType == 2883) {
- damage = 0;
- }
- }
- boolean guthansEffect = false;
- if (c.getPA().fullGuthans()) {
- if (Misc.random(3) == 1) {
- guthansEffect = true;
- }
- }
- if (c.getPA().salveAmulet()) {
- for (int undead : Config.UNDEAD_NPCS) {
- if (NPCHandler.npcs[i].npcType == undead && damage < 0) {
- damage = salveDamage();
- if (damage > NPCHandler.npcs[i].HP) {
- damage = NPCHandler.npcs[i].HP;
- } else {
- damage = damage;
- }
- }
- }
- }
- if(c.fightMode == 3) {
- c.getPA().addSkillXP((damage*Config.MELEE_EXP_RATE/3), 0);
- c.getPA().addSkillXP((damage*Config.MELEE_EXP_RATE/3), 1);
- c.getPA().addSkillXP((damage*Config.MELEE_EXP_RATE/3), 2);
- c.getPA().addSkillXP((damage*Config.MELEE_EXP_RATE/3), 3);
- c.getPA().refreshSkill(0);
- c.getPA().refreshSkill(1);
- c.getPA().refreshSkill(2);
- c.getPA().refreshSkill(3);
- } else {
- c.getPA().addSkillXP((damage*Config.MELEE_EXP_RATE), c.fightMode);
- c.getPA().addSkillXP((damage*Config.MELEE_EXP_RATE/3), 3);
- c.getPA().refreshSkill(c.fightMode);
- c.getPA().refreshSkill(3);
- }
- if (damage > 0 && guthansEffect) {
- c.playerLevel[3] += damage;
- if (c.playerLevel[3] > c.getLevelForXP(c.playerXP[3]))
- c.playerLevel[3] = c.getLevelForXP(c.playerXP[3]);
- c.getPA().refreshSkill(3);
- Server.npcHandler.npcs[i].gfx0(398);
- }
- Server.npcHandler.npcs[i].underAttack = true;
- //Server.npcHandler.npcs[i].killerId = c.playerId;
- c.killingNpcIndex = c.npcIndex;
- c.lastNpcAttacked = i;
- switch (c.specEffect) {
- case 4:
- if (damage > 0) {
- if (c.playerLevel[3] + damage > c.getLevelForXP(c.playerXP[3]))
- if (c.playerLevel[3] > c.getLevelForXP(c.playerXP[3]));
- else
- c.playerLevel[3] = c.getLevelForXP(c.playerXP[3]);
- else
- c.playerLevel[3] += damage;
- c.getPA().refreshSkill(3);
- }
- break;
- }
- switch(damageMask) {
- case 1:
- Server.npcHandler.npcs[i].hitDiff = damage;
- Server.npcHandler.npcs[i].HP -= damage;
- c.totalDamageDealt += damage;
- Server.npcHandler.npcs[i].hitUpdateRequired = true;
- //Server.npcHandler.npcs[i].hitUpdateRequired2 = true;
- Server.npcHandler.npcs[i].updateRequired = true;
- break;
- case 2:
- Server.npcHandler.npcs[i].hitDiff2 = damage;
- Server.npcHandler.npcs[i].HP -= damage;
- c.totalDamageDealt += damage;
- Server.npcHandler.npcs[i].hitUpdateRequired2 = true;
- c.doubleHit = false;
- break;
- }
- }
- public void fireProjectileNpc() {
- if(c.oldNpcIndex > 0) {
- if(Server.npcHandler.npcs[c.oldNpcIndex] != null) {
- c.projectileStage = 2;
- int pX = c.getX();
- int pY = c.getY();
- int nX = Server.npcHandler.npcs[c.oldNpcIndex].getX();
- int nY = Server.npcHandler.npcs[c.oldNpcIndex].getY();
- int offX = (pY - nY)* -1;
- int offY = (pX - nX)* -1;
- c.getPA().createPlayersProjectile(pX, pY, offX, offY, 50, getProjectileSpeed(), getRangeProjectileGFX(), 43, 31, c.oldNpcIndex + 1, getStartDelay());
- if (usingDbow())
- c.getPA().createPlayersProjectile2(pX, pY, offX, offY, 50, getProjectileSpeed(), getRangeProjectileGFX(), 60, 31, c.oldNpcIndex + 1, getStartDelay(), 35);
- }
- }
- }
- /**
- * Attack Players, same as npc tbh xD
- **/
- public void attackPlayer(int i) {
- /*if(c.curseActive[18]) { // SoulSplit GFX's - CAUSES CRASH
- if(c.oldPlayerIndex > 0) {
- if(Server.playerHandler.players[c.oldPlayerIndex] != null) {
- try {
- final int pX = c.getX();
- final int pY = c.getY();
- final int nX = Server.playerHandler.players[i].getX();
- final int nY = Server.playerHandler.players[i].getY();
- final int offX = (pY - nY)* -1;
- final int offY = (pX - nX)* -1;
- c.SSPLIT = true;
- c.getPA().createPlayersProjectile2(pX, pY, offX, offY, 50, 50, 2263, 9, 9, - c.oldPlayerIndex - 1, 24, 0);
- Server.playerHandler.players[c.oldPlayerIndex].gfx0(2264); // 1738
- c.SSPLIT = false;
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
- }*/
- if (Server.playerHandler.players[i] != null) {
- if (PlayerHandler.players[i].hasPin) {
- c.sendMessage("This player is currently typing in there account pin!");
- return;
- }
- if(c.getItems().playerHasItem(7671,1) || c.playerEquipment[c.playerHands] == 7671) {
- for(int x = 0; x < 40; x++){
- if(c.prayerActive[x]) {
- c.getCombat().resetPrayers();
- c.sendMessage("@red@You can't pray with these boxing gloves!");
- }
- }
- }
- if(c.lastWeaponUsed > 862 && c.lastWeaponUsed < 877 || c.lastWeaponUsed == 13022) {
- c.playerIndex = 0;
- }
- if(c.getItems().playerHasItem(7671,1) || c.playerEquipment[c.playerHands] == 7671) {
- for(int z = 0; z < 20; z++){
- c.playerLevel[z] = c.playerLevel[z];
- if(c.playerLevel[z] > 99) {
- c.playerLevel[z] = 99;
- c.sendMessage("@red@You need to bank your boxing gloves before you can drink this!");
- c.getPA().refreshSkill(z);
- return;
- }
- }
- }
- if (Server.playerHandler.players[i].isDead) {
- resetPlayerAttack();
- return;
- }
- if(c.respawnTimer > 0 || Server.playerHandler.players[i].respawnTimer > 0) {
- resetPlayerAttack();
- return;
- }
- /*if (c.teleTimer > 0 || Server.playerHandler.players[i].teleTimer > 0) {
- resetPlayerAttack();
- return;
- }*/
- if(!c.getCombat().checkReqs()) {
- return;
- }
- boolean sameSpot = c.absX == Server.playerHandler.players[i].getX() && c.absY == Server.playerHandler.players[i].getY();
- if(!c.goodDistance(Server.playerHandler.players[i].getX(), Server.playerHandler.players[i].getY(), c.getX(), c.getY(), 25) && !sameSpot) {
- resetPlayerAttack();
- return;
- }
- if(Server.playerHandler.players[i].respawnTimer > 0) {
- Server.playerHandler.players[i].playerIndex = 0;
- resetPlayerAttack();
- return;
- }
- if (Server.playerHandler.players[i].heightLevel != c.heightLevel) {
- resetPlayerAttack();
- return;
- }
- //c.sendMessage("Made it here0.");
- c.followId = i;
- c.followId2 = 0;
- if(c.attackTimer <= 0) {
- c.lastAttacked = c.playerIndex;
- c.usingBow = false;
- c.specEffect = 0;
- c.usingRangeWeapon = false;
- c.rangeItemUsed = 0;
- boolean usingBow = false;
- boolean usingArrows = false;
- boolean usingOtherRangeWeapons = false;
- boolean usingCross = c.playerEquipment[c.playerWeapon] == 9185 || c.playerEquipment[c.playerWeapon] == 7885 || c.playerEquipment[c.playerWeapon] == 15041;
- c.projectileStage = 0;
- if (c.absX == Server.playerHandler.players[i].absX && c.absY == Server.playerHandler.players[i].absY) {
- if (c.freezeTimer > 0) {
- resetPlayerAttack();
- return;
- }
- c.followId = i;
- c.attackTimer = 0;
- return;
- }
- /*if ((c.inPirateHouse() && !Server.playerHandler.players[i].inPirateHouse()) || (Server.playerHandler.players[i].inPirateHouse() && !c.inPirateHouse())) {
- resetPlayerAttack();
- return;
- }*/
- //c.sendMessage("Made it here1.");
- if(!c.usingMagic) {
- for (int bowId : c.BOWS) {
- if(c.playerEquipment[c.playerWeapon] == bowId) {
- usingBow = true;
- for (int arrowId : c.ARROWS) {
- if(c.playerEquipment[c.playerArrows] == arrowId) {
- usingArrows = true;
- }
- }
- }
- }
- if(c.playerEquipment[c.playerWeapon] == 13022){
- usingBow = true;
- }
- for (int otherRangeId : c.OTHER_RANGE_WEAPONS) {
- if(c.playerEquipment[c.playerWeapon] == otherRangeId) {
- usingOtherRangeWeapons = true;
- }
- }
- }
- if (c.autocasting && c.playerMagicBook != 2) {
- c.spellId = c.autocastId;
- c.usingMagic = true;
- }
- if(c.playerEquipment[c.playerWeapon] == 22494) {
- c.autocasting = true;
- c.spellId = 52;
- c.usingMagic = true;
- }
- //c.sendMessage("Made it here2.");
- if(c.spellId > 0) {
- c.usingMagic = true;
- }
- c.attackTimer = getAttackDelay(c.getItems().getItemName(c.playerEquipment[c.playerWeapon]).toLowerCase());
- if(c.duelRule[9]){
- boolean canUseWeapon = false;
- for(int funWeapon: Config.FUN_WEAPONS) {
- if(c.playerEquipment[c.playerWeapon] == funWeapon) {
- canUseWeapon = true;
- }
- }
- if(!canUseWeapon) {
- c.sendMessage("You can only use fun weapons in this duel!");
- resetPlayerAttack();
- return;
- }
- }
- //c.sendMessage("Made it here3.");
- if(c.duelRule[2] && (usingBow || usingOtherRangeWeapons)) {
- c.sendMessage("Range has been disabled in this duel!");
- return;
- }
- if(c.duelRule[3] && (!usingBow && !usingOtherRangeWeapons && !c.usingMagic)) {
- c.sendMessage("Melee has been disabled in this duel!");
- return;
- }
- if(c.duelRule[4] && c.usingMagic) {
- c.sendMessage("Magic has been disabled in this duel!");
- resetPlayerAttack();
- return;
- }
- /*if(c.inBoxIsland() && c.usingMagic) {
- c.sendMessage("You can't use magic here!");
- resetPlayerAttack();
- return;
- }*/
- if((!c.goodDistance(c.getX(), c.getY(), Server.playerHandler.players[i].getX(), Server.playerHandler.players[i].getY(), 4) && (usingOtherRangeWeapons && !usingBow && !c.usingMagic && !usingCrystalBow()))
- || (!c.goodDistance(c.getX(), c.getY(), Server.playerHandler.players[i].getX(), Server.playerHandler.players[i].getY(), 2) && (!usingOtherRangeWeapons && usingHally() && !usingBow && !usingCrystalBow() && !c.usingMagic))
- || (!c.goodDistance(c.getX(), c.getY(), Server.playerHandler.players[i].getX(), Server.playerHandler.players[i].getY(), getRequiredDistance()) && (!usingOtherRangeWeapons && !usingHally() && !usingBow && !c.usingMagic && !usingCrystalBow()))
- || (!c.goodDistance(c.getX(), c.getY(), Server.playerHandler.players[i].getX(), Server.playerHandler.players[i].getY(), 10) && (usingBow || c.usingMagic || usingCrystalBow()))) {
- //c.sendMessage("Setting attack timer to 1");
- c.attackTimer = 1;
- if (!usingBow && !c.usingMagic && !usingOtherRangeWeapons && c.freezeTimer > 0)
- resetPlayerAttack();
- return;
- }
- if(!usingCross && !usingArrows && usingBow && (c.playerEquipment[c.playerWeapon] < 4212 || c.playerEquipment[c.playerWeapon] > 4223) && c.playerEquipment[c.playerWeapon] != 13022 && !c.usingMagic) {
- c.sendMessage("You have run out of arrows!");
- c.stopMovement();
- resetPlayerAttack();
- return;
- }
- if(correctBowAndArrows() < c.playerEquipment[c.playerArrows] && Config.CORRECT_ARROWS && usingBow && !usingCrystalBow() && c.playerEquipment[c.playerWeapon] != 15041 && c.playerEquipment[c.playerWeapon] != 7885 && (c.playerEquipment[c.playerWeapon] != 9185&& c.playerEquipment[c.playerWeapon] != 15041 && c.playerEquipment[c.playerWeapon] != 7885) && !c.usingMagic) {
- c.sendMessage("You can't use "+c.getItems().getItemName(c.playerEquipment[c.playerArrows]).toLowerCase()+"s with a "+c.getItems().getItemName(c.playerEquipment[c.playerWeapon]).toLowerCase()+".");
- c.stopMovement();
- resetPlayerAttack();
- return;
- }
- if ((c.playerEquipment[c.playerWeapon] == 9185 || c.playerEquipment[c.playerWeapon] == 7885 || c.playerEquipment[c.playerWeapon] == 15041) && !properBolts() && !c.usingMagic) {
- c.sendMessage("You must use bolts with a crossbow.");
- c.stopMovement();
- resetPlayerAttack();
- return;
- }
- if (c.playerEquipment[c.playerWeapon] == 13022 && c.playerEquipment[c.playerArrows] > 2){
- c.sendMessage("Your ammunition slot must be empty in order to use hand cannon!");
- c.stopMovement();
- resetPlayerAttack();
- return;
- }
- if(usingBow || c.spellId > 0 || usingOtherRangeWeapons || usingHally()) {
- c.stopMovement();
- }
- if(!checkMagicReqs(c.spellId)) {
- c.stopMovement();
- resetPlayerAttack();
- return;
- }
- c.faceUpdate(i+32768);
- if(c.duelStatus != 5) {
- if(!c.attackedPlayers.contains(c.playerIndex) && !Server.playerHandler.players[c.playerIndex].attackedPlayers.contains(c.playerId)) {
- c.attackedPlayers.add(c.playerIndex);
- c.isSkulled = true;
- c.skullTimer = Config.SKULL_TIMER;
- if (c.redSkull != true)
- c.headIconPk = 0;
- c.getPA().requestUpdates();
- }
- }
- c.specAccuracy = 1.0;
- c.specDamage = 1.0;
- c.delayedDamage = c.delayedDamage2 = 0;
- if(c.usingSpecial && !c.usingMagic) {
- /*if(c.underAttackBy == 0 && c.isInEdge()) {//anti-rush, testing how this works out
- c.sendMessage("No rushing in Edgeville!");//well it didn't work out...
- c.usingSpecial = false;
- c.getItems().updateSpecialBar();
- resetPlayerAttack();
- return;
- }*/
- if(c.duelRule[10] && c.duelStatus == 5) {
- c.sendMessage("Special attacks have been disabled during this duel!");
- c.usingSpecial = false;
- c.getItems().updateSpecialBar();
- resetPlayerAttack();
- return;
- }
- if(checkSpecAmount(c.playerEquipment[c.playerWeapon])){
- c.lastArrowUsed = c.playerEquipment[c.playerArrows];
- activateSpecial(c.playerEquipment[c.playerWeapon], i);
- c.followId = c.playerIndex;
- return;
- } else {
- c.sendMessage("You don't have the required special energy to use this attack.");
- c.usingSpecial = false;
- c.getItems().updateSpecialBar();
- c.playerIndex = 0;
- return;
- }
- }
- if(!c.usingMagic && c.playerEquipment[c.playerWeapon] != 22494) {
- c.startAnimation(getWepAnim(c.getItems().getItemName(c.playerEquipment[c.playerWeapon]).toLowerCase()));
- c.mageFollow = false;
- } else {
- c.startAnimation(c.MAGIC_SPELLS[c.spellId][2]);
- c.mageFollow = true;
- c.followId = c.playerIndex;
- }
- Server.playerHandler.players[i].underAttackBy = c.playerId;
- Server.playerHandler.players[i].logoutDelay = System.currentTimeMillis();
- Server.playerHandler.players[i].singleCombatDelay = System.currentTimeMillis();
- Server.playerHandler.players[i].killerId = c.playerId;
- c.lastArrowUsed = 0;
- c.rangeItemUsed = 0;
- if(!usingBow && !c.usingMagic && !usingOtherRangeWeapons) { // melee hit delay
- c.followId = Server.playerHandler.players[c.playerIndex].playerId;
- c.getPA().followPlayer();
- c.hitDelay = getHitDelay(c.getItems().getItemName(c.playerEquipment[c.playerWeapon]).toLowerCase());
- c.delayedDamage = Misc.random(calculateMeleeMaxHit());
- c.projectileStage = 0;
- c.oldPlayerIndex = i;
- }
- if(usingBow && !usingOtherRangeWeapons && !c.usingMagic || usingCross) { // range hit delay
- if(c.playerEquipment[c.playerWeapon] >= 4212 && c.playerEquipment[c.playerWeapon] <= 4223) {
- c.rangeItemUsed = c.playerEquipment[c.playerWeapon];
- c.crystalBowArrowCount++;
- } else {
- c.rangeItemUsed = c.playerEquipment[c.playerArrows];
- c.getItems().deleteArrow();
- }
- if (c.fightMode == 2)
- c.attackTimer--;
- if (usingCross)
- c.usingBow = true;
- c.followId = Server.playerHandler.players[c.playerIndex].playerId;
- c.getPA().followPlayer();
- c.lastWeaponUsed = c.playerEquipment[c.playerWeapon];
- c.lastArrowUsed = c.playerEquipment[c.playerArrows];
- c.gfx100(getRangeStartGFX());
- c.hitDelay = getHitDelay(c.getItems().getItemName(c.playerEquipment[c.playerWeapon]).toLowerCase());
- c.projectileStage = 1;
- c.oldPlayerIndex = i;
- fireProjectilePlayer();
- }
- if(c.playerEquipment[c.playerWeapon] == 13022){
- c.rangeItemUsed = c.playerEquipment[c.playerWeapon];
- c.usingRangeWeapon = true;
- c.usingBow = true;
- c.followId = Server.playerHandler.players[c.playerIndex].playerId;
- c.getPA().followPlayer();
- c.gfx100(getRangeStartGFX());
- if (c.fightMode == 2)
- c.attackTimer--;
- c.hitDelay = getHitDelay(c.getItems().getItemName(c.playerEquipment[c.playerWeapon]).toLowerCase());
- c.projectileStage = 1;
- c.oldPlayerIndex = i;
- fireProjectilePlayer();
- }
- if(usingOtherRangeWeapons) { // knives, darts, etc hit delay
- c.rangeItemUsed = c.playerEquipment[c.playerWeapon];
- c.getItems().deleteEquipment();
- c.usingRangeWeapon = true;
- c.followId = Server.playerHandler.players[c.playerIndex].playerId;
- c.getPA().followPlayer();
- c.gfx100(getRangeStartGFX());
- if (c.fightMode == 2)
- c.attackTimer--;
- c.hitDelay = getHitDelay(c.getItems().getItemName(c.playerEquipment[c.playerWeapon]).toLowerCase());
- c.projectileStage = 1;
- c.oldPlayerIndex = i;
- fireProjectilePlayer();
- }
- if(c.usingMagic) { // magic hit delay
- int pX = c.getX();
- int pY = c.getY();
- int nX = Server.playerHandler.players[i].getX();
- int nY = Server.playerHandler.players[i].getY();
- int offX = (pY - nY)* -1;
- int offY = (pX - nX)* -1;
- c.castingMagic = true;
- c.projectileStage = 2;
- if(c.MAGIC_SPELLS[c.spellId][3] > 0) {
- if(getStartGfxHeight() == 100) {
- c.gfx100(c.MAGIC_SPELLS[c.spellId][3]);
- } else {
- c.gfx0(c.MAGIC_SPELLS[c.spellId][3]);
- }
- }
- if(c.MAGIC_SPELLS[c.spellId][4] > 0) {
- c.getPA().createPlayersProjectile(pX, pY, offX, offY, 50, 78, c.MAGIC_SPELLS[c.spellId][4], getStartHeight(), getEndHeight(), -i - 1, getStartDelay());
- }
- if (c.autocastId > 0) {
- c.followId = c.playerIndex;
- c.followDistance = 5;
- }
- c.hitDelay = getHitDelay(c.getItems().getItemName(c.playerEquipment[c.playerWeapon]).toLowerCase());
- c.oldPlayerIndex = i;
- c.oldSpellId = c.spellId;
- c.spellId = 0;
- Client o = (Client)Server.playerHandler.players[i];
- if(c.MAGIC_SPELLS[c.oldSpellId][0] == 12891 && o.isMoving) {
- //c.sendMessage("Barrage projectile..");
- c.getPA().createPlayersProjectile(pX, pY, offX, offY, 50, 85, 368, 25, 25, -i - 1, getStartDelay());
- }
- if(Misc.random(o.getCombat().mageDef()) > Misc.random(mageAtk())) {
- c.magicFailed = true;
- } else {
- c.magicFailed = false;
- }
- int freezeDelay = getFreezeTime();//freeze time
- if(freezeDelay > 0 && Server.playerHandler.players[i].freezeTimer <= -3 && !c.magicFailed) {
- Server.playerHandler.players[i].freezeTimer = freezeDelay;
- o.resetWalkingQueue();
- o.sendMessage("You have been frozen.");
- o.frozenBy = c.playerId;
- }
- if (!c.autocasting && c.spellId <= 0)
- c.playerIndex = 0;
- }
- if(usingBow && Config.CRYSTAL_BOW_DEGRADES) { // crystal bow degrading
- if(c.playerEquipment[c.playerWeapon] == 4212) { // new crystal bow becomes full bow on the first shot
- c.getItems().wearItem(4214, 1, 3);
- }
- if(c.crystalBowArrowCount >= 250){
- switch(c.playerEquipment[c.playerWeapon]) {
- case 4223: // 1/10 bow
- c.getItems().wearItem(-1, 1, 3);
- c.sendMessage("Your crystal bow has fully degraded.");
- if(!c.getItems().addItem(4207, 1)) {
- Server.itemHandler.createGroundItem(c, 4207, c.getX(), c.getY(), 1, c.getId());
- }
- c.crystalBowArrowCount = 0;
- break;
- default:
- c.getItems().wearItem(++c.playerEquipment[c.playerWeapon], 1, 3);
- c.sendMessage("Your crystal bow degrades.");
- c.crystalBowArrowCount = 0;
- break;
- }
- }
- }
- }
- }
- }
- public boolean usingCrystalBow() {
- return c.playerEquipment[c.playerWeapon] >= 4212 && c.playerEquipment[c.playerWeapon] <= 4223;
- }
- public void appendVengeance(int otherPlayer, int damage) {
- if(c.getItems().playerHasItem(7671,1) || c.playerEquipment[c.playerHands] == 7671) {
- c.sendMessage("You can't use Vengeance with boxing gloves!");
- return;
- }
- if (damage <= 0)
- return;
- Player o = Server.playerHandler.players[otherPlayer];
- o.forcedText = "Taste Vengeance!";
- o.forcedChatUpdateRequired = true;
- o.updateRequired = true;
- o.vengOn = false;
- if(c.playerEquipment[o.playerWeapon] == 22494){
- if(damage > 30)
- damage = 30 - Misc.random(5);
- }
- if ((o.playerLevel[3] - damage) > 0) {
- damage = (int)(damage * 0.75);
- if (damage > c.playerLevel[3]) {
- damage = c.playerLevel[3];
- }
- c.setHitDiff2(damage);
- c.setHitUpdateRequired2(true);
- c.playerLevel[3] -= damage;
- c.getPA().refreshSkill(3);
- }
- c.updateRequired = true;
- }
- public void playerDelayedHit(int i) {
- if (Server.playerHandler.players[i] != null) {
- if (Server.playerHandler.players[i].isDead || c.isDead || Server.playerHandler.players[i].playerLevel[3] <= 0 || c.playerLevel[3] <= 0) {
- c.playerIndex = 0;
- return;
- }
- if (Server.playerHandler.players[i].respawnTimer > 0) {
- c.faceUpdate(0);
- c.playerIndex = 0;
- return;
- }
- Client o = (Client) Server.playerHandler.players[i];
- o.getPA().removeAllWindows();
- if (o.playerIndex <= 0 && o.npcIndex <= 0) {
- if (o.autoRet == 1) {
- o.playerIndex = c.playerId;
- }
- }
- if(o.attackTimer <= 3 || o.attackTimer == 0 && o.playerIndex == 0 && !c.castingMagic) { // block animation
- o.startAnimation(o.getCombat().getBlockEmote());
- }
- if(o.inTrade) {
- o.getTradeAndDuel().declineTrade();
- }
- if(c.projectileStage == 0 && !c.usingMagic && !c.castingMagic) { // melee hit damage
- int damageOnPlayer = (int)Math.round(Misc.random(calculateMeleeMaxHit())*.85);
- if(damageOnPlayer >= 40)
- damageOnPlayer = 40;
- c.clawDamage[0] = (int)Math.round(damageOnPlayer / 2);
- c.clawDamage[1] = (int)Math.round(damageOnPlayer / 4);
- c.clawDamage[2] = (int)Math.round(damageOnPlayer / 4);
- applyPlayerMeleeDamage2(i, 1, damageOnPlayer);
- if(c.doubleHit && !c.usingClaws) {
- if(c.playerName.equalsIgnoreCase("double pk")){
- applyPlayerMeleeDamage2(i, 2, calculateMeleeMaxHit() - Misc.random(7));
- } else {
- applyPlayerMeleeDamage2(i, 2, Misc.random(calculateMeleeMaxHit()));
- }
- }
- if(c.doubleHit && c.usingClaws) {
- applyPlayerHit(i, c.clawDamage[0]);
- c.clawPlayerDelay = 1;
- c.usingClaws = false;
- }
- }
- if(!c.castingMagic && c.projectileStage > 0) { // range hit damage
- int damage = Misc.random(rangeMaxHit());
- if(c.playerRights >= 3)
- damage = rangeMaxHit();
- int damage2 = -1;
- if (c.lastWeaponUsed == 11235 || c.bowSpecShot == 1 || c.cannonSpec == 1){
- damage2 = Misc.random(rangeMaxHit());
- if(c.playerRights >= 3)
- damage = rangeMaxHit();
- }
- if (c.lastWeaponUsed == 11235 && c.playerEquipment[c.playerWeapon] != 11235){
- damage = (int)(damage*.5);
- damage2 = (int)(damage2*.5);
- }
- boolean ignoreDef = false;
- if (Misc.random(4) == 1 && c.lastArrowUsed == 9243 && (c.playerEquipment[c.playerWeapon] == 9185 || c.playerEquipment[c.playerWeapon] == 15041)) {
- ignoreDef = true;
- o.gfx0(758);
- }
- if(Misc.random(10+o.getCombat().calculateRangeDefence()) > Misc.random(10+calculateRangeAttack()) && !ignoreDef) {
- damage = 0;
- }
- if (Misc.random(4) == 1 && c.lastArrowUsed == 9242 && damage > 0) {
- Server.playerHandler.players[i].gfx0(754);
- damage = Server.npcHandler.npcs[i].HP/5;
- c.handleHitMask(c.playerLevel[3]/10);
- c.dealDamage(c.playerLevel[3]/10);
- c.gfx0(754);
- }
- if (c.lastWeaponUsed == 11235 || c.bowSpecShot == 1) {
- if (Misc.random(10+o.getCombat().calculateRangeDefence()) > Misc.random(10+calculateRangeAttack()))
- damage2 = 0;
- }
- if (c.dbowSpec) {
- o.gfx100(1100);
- if (damage < 8)
- damage = 8;
- if (damage2 < 8)
- damage2 = 8;
- c.dbowSpec = false;
- }
- if (damage > 30 && c.lastArrowUsed == 9244 && ((c.lastWeaponUsed == 9185 && Misc.random(4) == 1) || (c.lastWeaponUsed == 15041 && Misc.random(3) == 1))) {
- if(c.lastWeaponUsed == 4214) {
- return;
- } if(o.getPA().antiFire() == 0){
- damage *= 1.65;
- o.sendMessage("@red@You are badly burnt by the dragon fire.");
- }
- if(o.getPA().antiFire() == 1){
- damage *= 1.35;
- o.sendMessage("@red@You are slightly protected from the dragon fire.");
- }
- if(o.getPA().antiFire() == 2){
- damage *= 1.15;
- o.sendMessage("@red@The dragon fire is weak against you.");
- }
- o.gfx0(756);
- }
- if(o.prayerActive[17] && System.currentTimeMillis() - o.protRangeDelay > 1500) { // if prayer active reduce damage by half
- damage = (int)damage * 40 / 100;
- if (c.lastWeaponUsed == 11235 || c.bowSpecShot == 1 || c.cannonSpec == 1)
- damage2 = (int)damage2 * 40 / 100;
- }
- if (Server.playerHandler.players[i].playerLevel[3] - damage < 0) {
- damage = Server.playerHandler.players[i].playerLevel[3];
- }
- if (Server.playerHandler.players[i].playerLevel[3] - damage - damage2 < 0) {
- damage2 = Server.playerHandler.players[i].playerLevel[3] - damage;
- }
- if (damage < 0)
- damage = 0;
- if (damage2 < 0 && damage2 != -1)
- damage2 = 0;
- if (o.vengOn) {
- appendVengeance(i, damage);
- if(c.cannonSpec != 1)
- appendVengeance(i, damage2);
- }
- if (damage > 0)
- applyRecoil(damage, i);
- if (damage2 > 0)
- applyRecoil(damage2, i);
- if(c.fightMode == 3) {
- c.getPA().addSkillXP((damage*Config.RANGE_EXP_RATE/3), 4);
- c.getPA().addSkillXP((damage*Config.RANGE_EXP_RATE/3), 1);
- c.getPA().addSkillXP((damage*Config.RANGE_EXP_RATE/3), 3);
- c.getPA().refreshSkill(1);
- c.getPA().refreshSkill(3);
- c.getPA().refreshSkill(4);
- } else {
- c.getPA().addSkillXP((damage*Config.RANGE_EXP_RATE), 4);
- c.getPA().addSkillXP((damage*Config.RANGE_EXP_RATE/3), 3);
- c.getPA().refreshSkill(3);
- c.getPA().refreshSkill(4);
- }
- boolean dropArrows = true;
- for(int noArrowId : c.NO_ARROW_DROP) {
- if(c.lastWeaponUsed == noArrowId) {
- dropArrows = false;
- break;
- }
- }
- if(dropArrows) {
- c.getItems().dropArrowPlayer();
- }
- if(c.cannonSpec == 1)
- Server.playerHandler.players[i].gfx100(89);
- Server.playerHandler.players[i].underAttackBy = c.playerId;
- Server.playerHandler.players[i].logoutDelay = System.currentTimeMillis();
- Server.playerHandler.players[i].singleCombatDelay = System.currentTimeMillis();
- Server.playerHandler.players[i].killerId = c.playerId;
- //Server.playerHandler.players[i].setHitDiff(damage);
- //Server.playerHandler.players[i].playerLevel[3] -= damage;
- Server.playerHandler.players[i].dealDamage(damage);
- Server.playerHandler.players[i].damageTaken[c.playerId] += damage;
- c.killedBy = Server.playerHandler.players[i].playerId;
- Server.playerHandler.players[i].handleHitMask(damage);
- if (damage2 != -1) {
- //Server.playerHandler.players[i].playerLevel[3] -= damage2;
- if(c.cannonSpec != 1){
- Server.playerHandler.players[i].dealDamage(damage2);
- Server.playerHandler.players[i].damageTaken[c.playerId] += damage2;
- Server.playerHandler.players[i].handleHitMask(damage2);
- } else {
- c.cannonSpec = 0;
- final int d2 = damage2;
- final int pId = c.playerId;
- final int index = i;
- int distance = Server.playerHandler.players[pId].distanceToPoint(Server.playerHandler.players[index].getX(), Server.playerHandler.players[index].getY());
- int totalDistance = 2;
- CycleEventHandler.getSingleton().addEvent(c, new CycleEvent() {
- @Override
- public void execute(CycleEventContainer c) {
- if(Server.playerHandler.players[index] == null)
- return;
- Server.playerHandler.players[index].gfx100(89);
- Server.playerHandler.players[index].dealDamage(d2);
- Server.playerHandler.players[index].damageTaken[pId] += d2;
- Server.playerHandler.players[index].handleHitMask(d2);
- Server.playerHandler.players[index].updateRequired = true;
- c.stop();
- }
- @Override
- public void stop() {
- // TODO Auto-generated method stub
- }
- }, totalDistance);
- }
- }
- o.getPA().refreshSkill(3);
- //Server.playerHandler.players[i].setHitUpdateRequired(true);
- Server.playerHandler.players[i].updateRequired = true;
- applySmite(i, damage);
- if (damage2 != -1)
- applySmite(i, damage2);
- } else if (c.projectileStage > 0) { // magic hit damage
- int damage = Misc.random(finalMagicDamage(c));
- if(godSpells()) {
- if(System.currentTimeMillis() - c.godSpellDelay < Config.GOD_SPELL_CHARGE) {
- damage += 10;
- }
- }
- //c.playerIndex = 0;
- if (c.playerMagicBook == 2 && c.playerEquipment[c.playerWeapon] != 22494){
- damage = 0;
- }
- if (c.magicFailed)
- damage = 0;
- if(o.prayerActive[16] && System.currentTimeMillis() - o.protMageDelay > 1500) { // if prayer active reduce damage by half
- damage = (int)damage * 40 / 100;
- }
- if (Server.playerHandler.players[i].playerLevel[3] - damage < 0) {
- damage = Server.playerHandler.players[i].playerLevel[3];
- }
- if (o.vengOn)
- appendVengeance(i, damage);
- if (damage > 0)
- applyRecoil(damage, i);
- c.getPA().addSkillXP((c.MAGIC_SPELLS[c.oldSpellId][7] + damage*Config.MAGIC_EXP_RATE), 6);
- c.getPA().addSkillXP((c.MAGIC_SPELLS[c.oldSpellId][7] + damage*Config.MAGIC_EXP_RATE/3), 3);
- c.getPA().refreshSkill(3);
- c.getPA().refreshSkill(6);
- if(getEndGfxHeight() == 100 && !c.magicFailed){ // end GFX
- Server.playerHandler.players[i].gfx100(c.MAGIC_SPELLS[c.oldSpellId][5]);
- } else if (!c.magicFailed){
- Server.playerHandler.players[i].gfx0(c.MAGIC_SPELLS[c.oldSpellId][5]);
- } else if(c.magicFailed) {
- Server.playerHandler.players[i].gfx100(85);
- }
- if(!c.magicFailed) {
- if(System.currentTimeMillis() - Server.playerHandler.players[i].reduceStat > 35000) {
- Server.playerHandler.players[i].reduceStat = System.currentTimeMillis();
- switch(c.MAGIC_SPELLS[c.oldSpellId][0]) {
- case 12987:
- case 13011:
- case 12999:
- case 13023:
- Server.playerHandler.players[i].playerLevel[0] -= ((o.getPA().getLevelForXP(Server.playerHandler.players[i].playerXP[0]) * 10) / 100);
- break;
- }
- }
- switch(c.MAGIC_SPELLS[c.oldSpellId][0]) {
- case 12445: //teleblock
- if (c.playerMagicBook == 0){
- if (System.currentTimeMillis() - o.teleBlockDelay > o.teleBlockLength) {
- o.teleBlockDelay = System.currentTimeMillis();
- o.sendMessage("You have been teleblocked.");
- if (o.prayerActive[16] && System.currentTimeMillis() - o.protMageDelay > 1500)
- o.teleBlockLength = 150000;
- else
- o.teleBlockLength = 300000;
- }
- }
- break;
- case 12901:
- case 12919: // blood spells
- case 12911:
- case 12929:
- int heal = (int)(damage / 4);
- if(c.playerLevel[3] + heal > c.getPA().getLevelForXP(c.playerXP[3])) {
- c.playerLevel[3] = c.getPA().getLevelForXP(c.playerXP[3]);
- } else {
- c.playerLevel[3] += heal;
- }
- c.getPA().refreshSkill(3);
- break;
- case 1153:
- Server.playerHandler.players[i].playerLevel[0] -= ((o.getPA().getLevelForXP(Server.playerHandler.players[i].playerXP[0]) * 5) / 100);
- o.sendMessage("Your attack level has been reduced!");
- Server.playerHandler.players[i].reduceSpellDelay[c.reduceSpellId] = System.currentTimeMillis();
- o.getPA().refreshSkill(0);
- break;
- case 1157:
- Server.playerHandler.players[i].playerLevel[2] -= ((o.getPA().getLevelForXP(Server.playerHandler.players[i].playerXP[2]) * 5) / 100);
- o.sendMessage("Your strength level has been reduced!");
- Server.playerHandler.players[i].reduceSpellDelay[c.reduceSpellId] = System.currentTimeMillis();
- o.getPA().refreshSkill(2);
- break;
- case 1161:
- Server.playerHandler.players[i].playerLevel[1] -= ((o.getPA().getLevelForXP(Server.playerHandler.players[i].playerXP[1]) * 5) / 100);
- o.sendMessage("Your defence level has been reduced!");
- Server.playerHandler.players[i].reduceSpellDelay[c.reduceSpellId] = System.currentTimeMillis();
- o.getPA().refreshSkill(1);
- break;
- case 1542:
- Server.playerHandler.players[i].playerLevel[1] -= ((o.getPA().getLevelForXP(Server.playerHandler.players[i].playerXP[1]) * 10) / 100);
- o.sendMessage("Your defence level has been reduced!");
- Server.playerHandler.players[i].reduceSpellDelay[c.reduceSpellId] = System.currentTimeMillis();
- o.getPA().refreshSkill(1);
- break;
- case 1543:
- Server.playerHandler.players[i].playerLevel[2] -= ((o.getPA().getLevelForXP(Server.playerHandler.players[i].playerXP[2]) * 10) / 100);
- o.sendMessage("Your strength level has been reduced!");
- Server.playerHandler.players[i].reduceSpellDelay[c.reduceSpellId] = System.currentTimeMillis();
- o.getPA().refreshSkill(2);
- break;
- case 1562:
- Server.playerHandler.players[i].playerLevel[0] -= ((o.getPA().getLevelForXP(Server.playerHandler.players[i].playerXP[0]) * 10) / 100);
- o.sendMessage("Your attack level has been reduced!");
- Server.playerHandler.players[i].reduceSpellDelay[c.reduceSpellId] = System.currentTimeMillis();
- o.getPA().refreshSkill(0);
- break;
- }
- }
- int damageCap = 60 + Misc.random(5);
- if( (damage > damageCap) && c.playerEquipment[c.playerWeapon] == 22494)
- damage = damageCap - Misc.random(20);
- Server.playerHandler.players[i].logoutDelay = System.currentTimeMillis();
- Server.playerHandler.players[i].underAttackBy = c.playerId;
- Server.playerHandler.players[i].killerId = c.playerId;
- Server.playerHandler.players[i].singleCombatDelay = System.currentTimeMillis();
- if(c.MAGIC_SPELLS[c.oldSpellId][6] != 0) {
- //Server.playerHandler.players[i].playerLevel[3] -= damage;
- Server.playerHandler.players[i].dealDamage(damage);
- Server.playerHandler.players[i].damageTaken[c.playerId] += damage;
- c.totalPlayerDamageDealt += damage;
- if (!c.magicFailed) {
- //Server.playerHandler.players[i].setHitDiff(damage);
- //Server.playerHandler.players[i].setHitUpdateRequired(true);
- Server.playerHandler.players[i].handleHitMask(damage);
- }
- }
- applySmite(i, damage);
- c.killedBy = Server.playerHandler.players[i].playerId;
- o.getPA().refreshSkill(3);
- Server.playerHandler.players[i].updateRequired = true;
- c.usingMagic = false;
- c.castingMagic = false;
- if (o.inMulti() && multis()) {
- c.barrageCount = 0;
- for (int j = 0; j < Server.playerHandler.players.length; j++) {
- if (Server.playerHandler.players[j] != null) {
- if (j == o.playerId)
- continue;
- if (c.barrageCount >= 9)
- break;
- if (o.goodDistance(o.getX(), o.getY(), Server.playerHandler.players[j].getX(), Server.playerHandler.players[j].getY(), 1))
- appendMultiBarrage(j, c.magicFailed);
- }
- }
- }
- c.getPA().refreshSkill(3);
- c.getPA().refreshSkill(6);
- c.oldSpellId = 0;
- }
- }
- c.getPA().requestUpdates();
- int oldindex = c.oldPlayerIndex;
- if(c.bowSpecShot <= 0) {
- c.oldPlayerIndex = 0;
- c.projectileStage = 0;
- c.lastWeaponUsed = 0;
- c.doubleHit = false;
- c.bowSpecShot = 0;
- }
- if(c.bowSpecShot != 0) {
- c.bowSpecShot = 0;
- }
- }
- public static int finalMagicDamage(Client c) {
- double damage = c.MAGIC_SPELLS[c.oldSpellId][6];
- double damageMultiplier = 1;
- if (c.prayerActive[20])
- damageMultiplier += .05;
- if (c.playerLevel[c.playerMagic] > c.getLevelForXP(c.playerXP[6])
- && c.getLevelForXP(c.playerXP[6]) >= 50)
- damageMultiplier += .03 * (c.playerLevel[c.playerMagic] - c.getLevelForXP(c.playerXP[6]));
- else
- damageMultiplier = 1;
- damageMultiplier += .10;
- if (c.fullVoidMage()){
- damageMultiplier += .21;
- }
- switch (c.playerEquipment[c.playerWeapon]) {
- case 4675: // Ancient Staff
- case 4710: // Ahrim's Staff
- case 4862: // Ahrim's Staff
- case 4864: // Ahrim's Staff
- case 4865: // Ahrim's Staff
- case 6914: // Master Wand
- case 8841: // Void Knight Mace
- damageMultiplier += .113;
- break;
- case 15001: // Staff of Light
- damageMultiplier += .166;
- break;
- case 15040: // Chaotic Staff
- damageMultiplier += .211;
- break;
- }
- switch (c.playerEquipment[c.playerAmulet]) {
- case 15000:// Arcane Stream
- damageMultiplier += .155;
- break;
- }
- switch (c.playerEquipment[c.playerHands]) {
- case 777:// Arcane Stream
- damageMultiplier += .07;
- break;
- }
- if(c.playerEquipment[c.playerWeapon] != 22494 && c.oldSpellId == 52)
- damageMultiplier = 0.0;
- damage *= damageMultiplier;
- return (int) damage;
- }
- public void applyPlayerMeleeDamage2(int i, int damageMask, int damage){
- c.previousDamage = damage;
- Client o = (Client) Server.playerHandler.players[i];
- if(o == null) {
- return;
- }
- int damage1 = 0;
- boolean veracsEffect = false;
- boolean guthansEffect = false;
- if (c.getPA().fullVeracs()) {
- if (Misc.random(4) == 1) {
- veracsEffect = true;
- }
- }
- if (c.getPA().fullGuthans()) {
- if (Misc.random(4) == 1) {
- guthansEffect = true;
- }
- }
- if (damageMask == 1) {
- damage1 = c.delayedDamage;
- c.delayedDamage = 0;
- } else {
- damage1 = c.delayedDamage2;
- c.delayedDamage2 = 0;
- }
- if(Misc.random(o.getCombat().calculateMeleeDefence()) > Misc.random(calculateMeleeAttack()) && !veracsEffect) {
- damage1 = 0;
- c.bonusAttack = 0;
- } else if (c.playerEquipment[c.playerWeapon] == 5698 && o.poisonDamage <= 0 && Misc.random(5) == 1) {
- o.getPA().appendPoison(13);
- c.bonusAttack += damage1/3;
- } else {
- c.bonusAttack += damage1/3;
- }
- if((o.prayerActive[18] || o.curseActive[9]) && System.currentTimeMillis() - o.protMeleeDelay > 1500 && !veracsEffect) { // if prayer active reduce damage by 40%
- damage1 = (int)damage1 * 40 / 100;
- }
- if (c.maxNextHit) {
- damage1 = calculateMeleeMaxHit();
- }
- if (damage1 > 0 && guthansEffect) {
- c.playerLevel[3] += damage1;
- if (c.playerLevel[3] > c.getLevelForXP(c.playerXP[3]))
- c.playerLevel[3] = c.getLevelForXP(c.playerXP[3]);
- c.getPA().refreshSkill(3);
- o.gfx0(398);
- }
- if (c.ssSpec && damageMask == 2) {
- damage1 = 5 + Misc.random(11);
- c.ssSpec = false;
- }
- Client cl2 = (Client) Server.playerHandler.players[i];
- if (cl2.playerEquipment[5] == 13742) {//Elysian Effect
- if (Misc.random(100) < 75) {
- double damages = damage1;
- double damageDeduction = ((double)damages)/((double)4);
- damage1 = damage1-((int)Math.round(damageDeduction));
- }
- }
- if (cl2.playerEquipment[5] == 13740) {//Divine Effect
- double damages2 = damage1;
- double prayer = cl2.playerLevel[5];
- double possibleDamageDeduction = ((double)damages2)/((double)3.33);//30% of Damage Inflicted
- double actualDamageDeduction;
- if ((prayer * 2) < possibleDamageDeduction) {
- actualDamageDeduction = (prayer * 2);//Partial Effect(Not enough prayer points)
- } else {
- actualDamageDeduction = possibleDamageDeduction;//Full effect
- }
- double prayerDeduction = ((double)actualDamageDeduction)/((double)2);//Half of the damage deducted
- damage1 = damage1-((int)Math.round(actualDamageDeduction));
- cl2.playerLevel[5] = cl2.playerLevel[5]-((int)Math.round(prayerDeduction));
- cl2.getPA().refreshSkill(5);
- }
- if (Server.playerHandler.players[i].playerLevel[3] - damage1 < 0) {
- damage1 = Server.playerHandler.players[i].playerLevel[3];
- }
- if (o.vengOn && damage1 > 0)
- appendVengeance(i, damage1);
- if (damage1 > 0)
- applyRecoil(damage1, i);
- switch(c.specEffect) {
- case 1: // dragon scimmy special
- if(damage > 0) {
- if(o.prayerActive[16] || o.prayerActive[17] || o.prayerActive[18] || o.curseActive[7] || o.curseActive[8] || o.curseActive[9]) {
- o.headIcon = -1;
- o.getPA().sendFrame36(c.PRAYER_GLOW[16], 0);
- o.getPA().sendFrame36(c.PRAYER_GLOW[17], 0);
- o.getPA().sendFrame36(c.PRAYER_GLOW[18], 0);
- o.getPA().sendFrame36(c.CURSE_GLOW[7], 0);
- o.getPA().sendFrame36(c.CURSE_GLOW[8], 0);
- o.getPA().sendFrame36(c.CURSE_GLOW[9], 0);
- }
- o.sendMessage("You have been injured!");
- o.stopPrayerDelay = System.currentTimeMillis();
- o.prayerActive[16] = false;
- o.prayerActive[17] = false;
- o.prayerActive[18] = false;
- o.curseActive[7] = false;
- o.curseActive[8] = false;
- o.curseActive[9] = false;
- o.getPA().requestUpdates();
- }
- break;
- case 2:
- if (damage1 > 0) {
- if (o.freezeTimer <= 0)
- o.freezeTimer = 30;
- o.gfx0(369);
- o.sendMessage("You have been frozen.");
- o.frozenBy = c.playerId;
- o.stopMovement();
- c.sendMessage("You freeze your enemy.");
- }
- break;
- case 3:
- if (damage1 > 0) {
- o.playerLevel[1] -= damage1;
- o.sendMessage("Your defence is weakened.");
- if (o.playerLevel[1] < 1)
- o.playerLevel[1] = 1;
- o.getPA().refreshSkill(1);
- }
- break;
- case 4:
- if (damage1 > 0) {
- if (c.playerLevel[3] + damage1 > c.getLevelForXP(c.playerXP[3]))
- if (c.playerLevel[3] > c.getLevelForXP(c.playerXP[3]));
- else
- c.playerLevel[3] = c.getLevelForXP(c.playerXP[3]);
- else
- c.playerLevel[3] += damage1;
- c.getPA().refreshSkill(3);
- }
- break;
- case 5:
- c.clawDelay = 2;
- break;
- }
- c.specEffect = 0;
- if(c.fightMode == 3) {
- c.getPA().addSkillXP((damage1*Config.MELEE_EXP_RATE/3), 0);
- c.getPA().addSkillXP((damage1*Config.MELEE_EXP_RATE/3), 1);
- c.getPA().addSkillXP((damage1*Config.MELEE_EXP_RATE/3), 2);
- c.getPA().addSkillXP((damage1*Config.MELEE_EXP_RATE/3), 3);
- c.getPA().refreshSkill(0);
- c.getPA().refreshSkill(1);
- c.getPA().refreshSkill(2);
- c.getPA().refreshSkill(3);
- } else {
- c.getPA().addSkillXP((damage1*Config.MELEE_EXP_RATE), c.fightMode);
- c.getPA().addSkillXP((damage1*Config.MELEE_EXP_RATE/3), 3);
- c.getPA().refreshSkill(c.fightMode);
- c.getPA().refreshSkill(3);
- }
- Server.playerHandler.players[i].logoutDelay = System.currentTimeMillis();
- Server.playerHandler.players[i].underAttackBy = c.playerId;
- Server.playerHandler.players[i].killerId = c.playerId;
- Server.playerHandler.players[i].singleCombatDelay = System.currentTimeMillis();
- if (c.killedBy != Server.playerHandler.players[i].playerId)
- c.totalPlayerDamageDealt = 0;
- c.killedBy = Server.playerHandler.players[i].playerId;
- applySmite(i, damage1);
- switch(damageMask) {
- case 1:
- /*if (!Server.playerHandler.players[i].getHitUpdateRequired()){
- Server.playerHandler.players[i].setHitDiff(damage);
- Server.playerHandler.players[i].setHitUpdateRequired(true);
- } else {
- Server.playerHandler.players[i].setHitDiff2(damage);
- Server.playerHandler.players[i].setHitUpdateRequired2(true);
- }*/
- //Server.playerHandler.players[i].playerLevel[3] -= damage1;
- Server.playerHandler.players[i].dealDamage(damage1);
- Server.playerHandler.players[i].damageTaken[c.playerId] += damage1;
- c.totalPlayerDamageDealt += damage1;
- Server.playerHandler.players[i].updateRequired = true;
- o.getPA().refreshSkill(3);
- break;
- case 2:
- /*if (!Server.playerHandler.players[i].getHitUpdateRequired2()){
- Server.playerHandler.players[i].setHitDiff2(damage);
- Server.playerHandler.players[i].setHitUpdateRequired2(true);
- } else {
- Server.playerHandler.players[i].setHitDiff(damage);
- Server.playerHandler.players[i].setHitUpdateRequired(true);
- }*/
- //Server.playerHandler.players[i].playerLevel[3] -= damage1;
- Server.playerHandler.players[i].dealDamage(damage1);
- Server.playerHandler.players[i].damageTaken[c.playerId] += damage1;
- c.totalPlayerDamageDealt += damage1;
- Server.playerHandler.players[i].updateRequired = true;
- c.doubleHit = false;
- o.getPA().refreshSkill(3);
- break;
- }
- Server.playerHandler.players[i].handleHitMask(damage1);
- }
- public boolean multis() {
- switch (c.MAGIC_SPELLS[c.oldSpellId][0]) {
- case 12891:
- case 12881:
- case 13011:
- case 13023:
- case 12919: // blood spells
- case 12929:
- case 12963:
- case 12975:
- return true;
- }
- return false;
- }
- public void appendMultiBarrage(int playerId, boolean splashed) {
- if (Server.playerHandler.players[playerId] != null) {
- Client c2 = (Client)Server.playerHandler.players[playerId];
- if (c2.isDead || c2.respawnTimer > 0)
- return;
- if (checkMultiBarrageReqs(playerId)) {
- c.barrageCount++;
- if (Misc.random(mageAtk()) > Misc.random(mageDef()) && !c.magicFailed) {
- if(getEndGfxHeight() == 100){ // end GFX
- c2.gfx100(c.MAGIC_SPELLS[c.oldSpellId][5]);
- } else {
- c2.gfx0(c.MAGIC_SPELLS[c.oldSpellId][5]);
- }
- int damage = Misc.random(c.MAGIC_SPELLS[c.oldSpellId][6]);
- if (c2.prayerActive[12]) {
- damage *= (int)(.60);
- }
- if (c2.playerLevel[3] - damage < 0) {
- damage = c2.playerLevel[3];
- }
- c.getPA().addSkillXP((c.MAGIC_SPELLS[c.oldSpellId][7] + damage*Config.MAGIC_EXP_RATE), 6);
- c.getPA().addSkillXP((c.MAGIC_SPELLS[c.oldSpellId][7] + damage*Config.MAGIC_EXP_RATE/3), 3);
- //Server.playerHandler.players[playerId].setHitDiff(damage);
- //Server.playerHandler.players[playerId].setHitUpdateRequired(true);
- Server.playerHandler.players[playerId].handleHitMask(damage);
- //Server.playerHandler.players[playerId].playerLevel[3] -= damage;
- Server.playerHandler.players[playerId].dealDamage(damage);
- Server.playerHandler.players[playerId].damageTaken[c.playerId] += damage;
- c2.getPA().refreshSkill(3);
- c.totalPlayerDamageDealt += damage;
- multiSpellEffect(playerId, damage);
- } else {
- c2.gfx100(85);
- }
- }
- }
- }
- public void multiSpellEffect(int playerId, int damage) {
- switch(c.MAGIC_SPELLS[c.oldSpellId][0]) {
- case 13011:
- case 13023:
- if(System.currentTimeMillis() - Server.playerHandler.players[playerId].reduceStat > 35000) {
- Server.playerHandler.players[playerId].reduceStat = System.currentTimeMillis();
- Server.playerHandler.players[playerId].playerLevel[0] -= ((Server.playerHandler.players[playerId].getLevelForXP(Server.playerHandler.players[playerId].playerXP[0]) * 10) / 100);
- }
- break;
- case 12919: // blood spells
- case 12929:
- int heal = (int)(damage / 4);
- if(c.playerLevel[3] + heal >= c.getPA().getLevelForXP(c.playerXP[3])) {
- c.playerLevel[3] = c.getPA().getLevelForXP(c.playerXP[3]);
- } else {
- c.playerLevel[3] += heal;
- }
- c.getPA().refreshSkill(3);
- break;
- case 12891:
- case 12881:
- case 1191:
- if (Server.playerHandler.players[playerId].freezeTimer < -5) {
- Server.playerHandler.players[playerId].freezeTimer = getFreezeTime();
- Server.playerHandler.players[playerId].stopMovement();
- }
- break;
- }
- }
- public void applyPlayerClawDamage(int i, int damageMask, int damage){
- Client o = (Client) Server.playerHandler.players[i];
- if(o == null) {
- return;
- }
- c.previousDamage = damage;
- boolean veracsEffect = false;
- boolean guthansEffect = false;
- if (c.getPA().fullVeracs()) {
- if (Misc.random(4) == 1) {
- veracsEffect = true;
- }
- }
- if (c.getPA().fullGuthans()) {
- if (Misc.random(4) == 1) {
- guthansEffect = true;
- }
- }
- if (damageMask == 1) {
- damage = c.delayedDamage;
- c.delayedDamage = 0;
- } else {
- damage = c.delayedDamage2;
- c.delayedDamage2 = 0;
- }
- if(Misc.random(o.getCombat().calculateMeleeDefence()) > Misc.random(calculateMeleeAttack()) && !veracsEffect) {
- damage = 0;
- c.bonusAttack = 0;
- } else if (c.playerEquipment[c.playerWeapon] == 5698 && o.poisonDamage <= 0 && Misc.random(3) == 1) {
- o.getPA().appendPoison(13);
- c.bonusAttack += damage/3;
- } else {
- c.bonusAttack += damage/3;
- }
- if((o.prayerActive[18] || o.curseActive[9]) && System.currentTimeMillis() - o.protMeleeDelay > 1500 && !veracsEffect) { // if prayer active reduce damage by 40%
- damage = (int)damage * 40 / 100;
- }
- if (c.maxNextHit) {
- damage = calculateMeleeMaxHit();
- }
- if (damage > 0 && guthansEffect) {
- c.playerLevel[3] += damage;
- if (c.playerLevel[3] > c.getLevelForXP(c.playerXP[3]))
- c.playerLevel[3] = c.getLevelForXP(c.playerXP[3]);
- c.getPA().refreshSkill(3);
- o.gfx0(398);
- }
- if (c.ssSpec && damageMask == 2) {
- damage = 5 + Misc.random(11);
- c.ssSpec = false;
- }
- if (Server.playerHandler.players[i].playerLevel[3] - damage < 0) {
- damage = Server.playerHandler.players[i].playerLevel[3];
- }
- if (o.vengOn && damage > 0)
- appendVengeance(i, damage);
- if (damage > 0)
- applyRecoil(damage, i);
- switch(c.specEffect) {
- case 1: // dragon scimmy special
- if(damage > 0) {
- if(o.prayerActive[16] || o.prayerActive[17] || o.prayerActive[18] || o.curseActive[7] || o.curseActive[8] || o.curseActive[9]) {
- o.headIcon = -1;
- o.getPA().sendFrame36(c.PRAYER_GLOW[16], 0);
- o.getPA().sendFrame36(c.PRAYER_GLOW[17], 0);
- o.getPA().sendFrame36(c.PRAYER_GLOW[18], 0);
- o.getPA().sendFrame36(c.CURSE_GLOW[7], 0);
- o.getPA().sendFrame36(c.CURSE_GLOW[8], 0);
- o.getPA().sendFrame36(c.CURSE_GLOW[9], 0);
- }
- o.sendMessage("You have been injured!");
- o.stopPrayerDelay = System.currentTimeMillis();
- o.prayerActive[16] = false;
- o.prayerActive[17] = false;
- o.prayerActive[18] = false;
- o.curseActive[7] = false;
- o.curseActive[8] = false;
- o.curseActive[9] = false;
- o.getPA().requestUpdates();
- }
- break;
- case 2:
- if (damage > 0) {
- if (o.freezeTimer <= 0)
- o.freezeTimer = 30;
- o.gfx0(369);
- o.sendMessage("You have been frozen.");
- o.frozenBy = c.playerId;
- o.stopMovement();
- c.sendMessage("You freeze your enemy.");
- }
- break;
- case 3:
- if (damage > 0) {
- o.playerLevel[1] -= damage;
- o.sendMessage("You feel weak.");
- if (o.playerLevel[1] < 1)
- o.playerLevel[1] = 1;
- o.getPA().refreshSkill(1);
- }
- break;
- case 4:
- if (damage > 0) {
- if (c.playerLevel[3] + damage > c.getLevelForXP(c.playerXP[3]))
- if (c.playerLevel[3] > c.getLevelForXP(c.playerXP[3]));
- else
- c.playerLevel[3] = c.getLevelForXP(c.playerXP[3]);
- else if (c.playerEquipment[c.playerWeapon] == 11698)
- c.playerLevel[3] += damage;
- c.getPA().refreshSkill(3);
- }
- break;
- case 5:
- c.clawDelay = 2;
- break;
- }
- c.specEffect = 0;
- if(c.fightMode == 3) {
- c.getPA().addSkillXP((damage*Config.MELEE_EXP_RATE/3), 0);
- c.getPA().addSkillXP((damage*Config.MELEE_EXP_RATE/3), 1);
- c.getPA().addSkillXP((damage*Config.MELEE_EXP_RATE/3), 2);
- c.getPA().addSkillXP((damage*Config.MELEE_EXP_RATE/3), 3);
- c.getPA().refreshSkill(0);
- c.getPA().refreshSkill(1);
- c.getPA().refreshSkill(2);
- c.getPA().refreshSkill(3);
- } else {
- c.getPA().addSkillXP((damage*Config.MELEE_EXP_RATE), c.fightMode);
- c.getPA().addSkillXP((damage*Config.MELEE_EXP_RATE/3), 3);
- c.getPA().refreshSkill(c.fightMode);
- c.getPA().refreshSkill(3);
- }
- Server.playerHandler.players[i].logoutDelay = System.currentTimeMillis();
- Server.playerHandler.players[i].underAttackBy = c.playerId;
- Server.playerHandler.players[i].killerId = c.playerId;
- Server.playerHandler.players[i].singleCombatDelay = System.currentTimeMillis();
- if (c.killedBy != Server.playerHandler.players[i].playerId)
- c.totalPlayerDamageDealt = 0;
- c.killedBy = Server.playerHandler.players[i].playerId;
- applySmite(i, damage);
- if(c.playerRights >= 3)
- c.sendMessage("@red@Smited");
- switch(damageMask) {
- case 1:
- /*if (!Server.playerHandler.players[i].getHitUpdateRequired()){
- Server.playerHandler.players[i].setHitDiff(damage);
- Server.playerHandler.players[i].setHitUpdateRequired(true);
- } else {
- Server.playerHandler.players[i].setHitDiff2(damage);
- Server.playerHandler.players[i].setHitUpdateRequired2(true);
- }*/
- //Server.playerHandler.players[i].playerLevel[3] -= damage;
- Server.playerHandler.players[i].dealDamage(damage);
- Server.playerHandler.players[i].damageTaken[c.playerId] += damage;
- c.totalPlayerDamageDealt += damage;
- Server.playerHandler.players[i].updateRequired = true;
- o.getPA().refreshSkill(3);
- break;
- case 2:
- /*if (!Server.playerHandler.players[i].getHitUpdateRequired2()){
- Server.playerHandler.players[i].setHitDiff2(damage);
- Server.playerHandler.players[i].setHitUpdateRequired2(true);
- } else {
- Server.playerHandler.players[i].setHitDiff(damage);
- Server.playerHandler.players[i].setHitUpdateRequired(true);
- }*/
- //Server.playerHandler.players[i].playerLevel[3] -= damage;
- Server.playerHandler.players[i].dealDamage(damage);
- Server.playerHandler.players[i].damageTaken[c.playerId] += damage;
- c.totalPlayerDamageDealt += damage;
- Server.playerHandler.players[i].updateRequired = true;
- c.doubleHit = false;
- o.getPA().refreshSkill(3);
- break;
- }
- Server.playerHandler.players[i].handleHitMask(damage);
- }
- public void applyPlayerMeleeDamage(int i, int damageMask){
- Client o = (Client) Server.playerHandler.players[i];
- if(o == null) {
- return;
- }
- int damage = 0;
- boolean veracsEffect = false;
- boolean guthansEffect = false;
- if (c.getPA().fullVeracs()) {
- if (Misc.random(4) == 1) {
- veracsEffect = true;
- }
- }
- if (c.getPA().fullGuthans()) {
- if (Misc.random(4) == 1) {
- guthansEffect = true;
- }
- }
- if (damageMask == 1) {
- damage = c.delayedDamage;
- c.delayedDamage = 0;
- } else {
- damage = c.delayedDamage2;
- c.delayedDamage2 = 0;
- }
- if(Misc.random(o.getCombat().calculateMeleeDefence()) > Misc.random(calculateMeleeAttack()) && !veracsEffect) {
- damage = 0;
- c.bonusAttack = 0;
- } else if (c.playerEquipment[c.playerWeapon] == 5698 && o.poisonDamage <= 0 && Misc.random(3) == 1) {
- o.getPA().appendPoison(13);
- c.bonusAttack += damage/3;
- } else {
- c.bonusAttack += damage/3;
- }
- if((o.prayerActive[18] || o.curseActive[9]) && System.currentTimeMillis() - o.protMeleeDelay > 1500 && !veracsEffect) { // if prayer active reduce damage by 40%
- damage = (int)damage * 40 / 100;
- }
- if (c.maxNextHit) {
- damage = calculateMeleeMaxHit();
- }
- if (damage > 0 && guthansEffect) {
- c.playerLevel[3] += damage;
- if (c.playerLevel[3] > c.getLevelForXP(c.playerXP[3]))
- c.playerLevel[3] = c.getLevelForXP(c.playerXP[3]);
- c.getPA().refreshSkill(3);
- o.gfx0(398);
- }
- if (c.ssSpec && damageMask == 2) {
- damage = 5 + Misc.random(11);
- c.ssSpec = false;
- }
- if (Server.playerHandler.players[i].playerLevel[3] - damage < 0) {
- damage = Server.playerHandler.players[i].playerLevel[3];
- }
- if (o.vengOn && damage > 0)
- appendVengeance(i, damage);
- if (damage > 0)
- applyRecoil(damage, i);
- switch(c.specEffect) {
- case 1: // dragon scimmy special
- if(damage > 0) {
- if(o.prayerActive[16] || o.prayerActive[17] || o.prayerActive[18] || o.curseActive[7] || o.curseActive[8] || o.curseActive[9]) {
- o.headIcon = -1;
- o.getPA().sendFrame36(c.PRAYER_GLOW[16], 0);
- o.getPA().sendFrame36(c.PRAYER_GLOW[17], 0);
- o.getPA().sendFrame36(c.PRAYER_GLOW[18], 0);
- o.getPA().sendFrame36(c.CURSE_GLOW[7], 0);
- o.getPA().sendFrame36(c.CURSE_GLOW[8], 0);
- o.getPA().sendFrame36(c.CURSE_GLOW[9], 0);
- }
- o.sendMessage("You have been injured!");
- o.stopPrayerDelay = System.currentTimeMillis();
- o.prayerActive[16] = false;
- o.prayerActive[17] = false;
- o.prayerActive[18] = false;
- o.curseActive[7] = false;
- o.curseActive[8] = false;
- o.curseActive[9] = false;
- o.getPA().requestUpdates();
- }
- break;
- case 2:
- if (damage > 0) {
- if (o.freezeTimer <= 0)
- o.freezeTimer = 30;
- o.gfx0(369);
- o.sendMessage("You have been frozen.");
- o.frozenBy = c.playerId;
- o.stopMovement();
- c.sendMessage("You freeze your enemy.");
- }
- break;
- case 3:
- if (damage > 0) {
- o.playerLevel[1] -= damage;
- o.sendMessage("Your defence is weakened.");
- if (o.playerLevel[1] < 1)
- o.playerLevel[1] = 1;
- o.getPA().refreshSkill(1);
- }
- break;
- case 4:
- if (damage > 0) {
- if (c.playerLevel[3] + damage > c.getLevelForXP(c.playerXP[3]))
- if (c.playerLevel[3] > c.getLevelForXP(c.playerXP[3]));
- else
- c.playerLevel[3] = c.getLevelForXP(c.playerXP[3]);
- else
- c.playerLevel[3] += damage;
- c.getPA().refreshSkill(3);
- }
- break;
- case 5:
- c.clawDelay = 2;
- break;
- }
- c.specEffect = 0;
- if(c.fightMode == 3) {
- c.getPA().addSkillXP((damage*Config.MELEE_EXP_RATE/3), 0);
- c.getPA().addSkillXP((damage*Config.MELEE_EXP_RATE/3), 1);
- c.getPA().addSkillXP((damage*Config.MELEE_EXP_RATE/3), 2);
- c.getPA().addSkillXP((damage*Config.MELEE_EXP_RATE/3), 3);
- c.getPA().refreshSkill(0);
- c.getPA().refreshSkill(1);
- c.getPA().refreshSkill(2);
- c.getPA().refreshSkill(3);
- } else {
- c.getPA().addSkillXP((damage*Config.MELEE_EXP_RATE), c.fightMode);
- c.getPA().addSkillXP((damage*Config.MELEE_EXP_RATE/3), 3);
- c.getPA().refreshSkill(c.fightMode);
- c.getPA().refreshSkill(3);
- }
- Server.playerHandler.players[i].logoutDelay = System.currentTimeMillis();
- Server.playerHandler.players[i].underAttackBy = c.playerId;
- Server.playerHandler.players[i].killerId = c.playerId;
- Server.playerHandler.players[i].singleCombatDelay = System.currentTimeMillis();
- if (c.killedBy != Server.playerHandler.players[i].playerId)
- c.totalPlayerDamageDealt = 0;
- c.killedBy = Server.playerHandler.players[i].playerId;
- applySmite(i, damage);
- switch(damageMask) {
- case 1:
- /*if (!Server.playerHandler.players[i].getHitUpdateRequired()){
- Server.playerHandler.players[i].setHitDiff(damage);
- Server.playerHandler.players[i].setHitUpdateRequired(true);
- } else {
- Server.playerHandler.players[i].setHitDiff2(damage);
- Server.playerHandler.players[i].setHitUpdateRequired2(true);
- }*/
- //Server.playerHandler.players[i].playerLevel[3] -= damage;
- Server.playerHandler.players[i].dealDamage(damage);
- Server.playerHandler.players[i].damageTaken[c.playerId] += damage;
- c.totalPlayerDamageDealt += damage;
- Server.playerHandler.players[i].updateRequired = true;
- o.getPA().refreshSkill(3);
- break;
- case 2:
- /*if (!Server.playerHandler.players[i].getHitUpdateRequired2()){
- Server.playerHandler.players[i].setHitDiff2(damage);
- Server.playerHandler.players[i].setHitUpdateRequired2(true);
- } else {
- Server.playerHandler.players[i].setHitDiff(damage);
- Server.playerHandler.players[i].setHitUpdateRequired(true);
- }*/
- //Server.playerHandler.players[i].playerLevel[3] -= damage;
- Server.playerHandler.players[i].dealDamage(damage);
- Server.playerHandler.players[i].damageTaken[c.playerId] += damage;
- c.totalPlayerDamageDealt += damage;
- Server.playerHandler.players[i].updateRequired = true;
- c.doubleHit = false;
- o.getPA().refreshSkill(3);
- break;
- }
- Server.playerHandler.players[i].handleHitMask(damage);
- }
- public void applySmite(int index, int damage) {
- if (!c.prayerActive[23] && !c.curseActive[18])
- return;
- if (damage <= 0)
- return;
- if (Server.playerHandler.players[index] != null) {
- Client c2 = (Client)Server.playerHandler.players[index];
- if(c.curseActive[18] && !c.prayerActive[23] && c.playerLevel[3] <= 99) {
- int heal = (int)(damage/5);
- if(c.playerLevel[3] + heal >= c.getPA().getLevelForXP(c.playerXP[3])) {
- c.playerLevel[3] = c.getPA().getLevelForXP(c.playerXP[3]);
- } else {
- c.playerLevel[3] += heal;
- }
- c.getPA().refreshSkill(3);
- }
- c2.playerLevel[5] -= (int)(damage/4);
- if (c2.playerLevel[5] <= 0) {
- c2.playerLevel[5] = 0;
- c2.getCombat().resetPrayers();
- }
- c2.getPA().refreshSkill(5);
- }
- }
- public void fireProjectilePlayer() {
- if(c.oldPlayerIndex > 0) {
- if(Server.playerHandler.players[c.oldPlayerIndex] != null) {
- c.projectileStage = 2;
- int pX = c.getX();
- int pY = c.getY();
- int oX = Server.playerHandler.players[c.oldPlayerIndex].getX();
- int oY = Server.playerHandler.players[c.oldPlayerIndex].getY();
- int offX = (pY - oY)* -1;
- int offY = (pX - oX)* -1;
- if (!c.msbSpec) {
- if(c.cannonSpec == 1){
- c.getPA().createPlayersProjectile2(pX, pY, offX, offY, 50, 100, getRangeProjectileGFX(), 43, 31, - c.oldPlayerIndex - 1, getStartDelay(), 10);
- c.getPA().createPlayersProjectile2(pX, pY, offX, offY, 50, 70, getRangeProjectileGFX(), 43, 31, - c.oldPlayerIndex - 1, getStartDelay(), 5);
- } else {
- c.getPA().createPlayersProjectile(pX, pY, offX, offY, 50, getProjectileSpeed(), getRangeProjectileGFX(), 43, 31, - c.oldPlayerIndex - 1, getStartDelay());
- }
- } else if (c.msbSpec) {
- c.getPA().createPlayersProjectile2(pX, pY, offX, offY, 50, getProjectileSpeed(), getRangeProjectileGFX(), 43, 31, - c.oldPlayerIndex - 1, getStartDelay(), 10);
- c.msbSpec = false;
- }
- if (usingDbow())
- c.getPA().createPlayersProjectile2(pX, pY, offX, offY, 50, getProjectileSpeed(), getRangeProjectileGFX(), 60, 31, - c.oldPlayerIndex - 1, getStartDelay(), 35);
- }
- }
- }
- public boolean usingDbow() {
- return c.playerEquipment[c.playerWeapon] == 11235;
- }
- /** Prayer **/
- public void activatePrayer(int i) {
- if (c.getItems().playerHasItem(7671, 1)
- || c.playerEquipment[c.playerHands] == 7671) {
- c.sendMessage("@red@You can't pray with these boxing gloves!");
- return;
- }
- if (c.duelRule[7]) {
- for (int p = 0; p < c.PRAYER.length; p++) { // reset prayer glows
- c.prayerActive[p] = false;
- c.getPA().sendFrame36(c.PRAYER_GLOW[p], 0);
- }
- c.sendMessage("Prayer has been disabled in this duel!");
- return;
- }
- if (i == 10 && c.isInHighRiskPK()) {
- c.getPA().sendFrame36(c.PRAYER_GLOW[i], 0);
- c.sendMessage("This cannot be used in high-risk PK.");
- return;
- }
- if (i == 10 && c.redSkull == true) {
- c.getPA().sendFrame36(c.PRAYER_GLOW[i], 0);
- c.sendMessage("@red@You Cant Use Protect Item Prayer.");
- return;
- }
- if (i == 10 && c.inNoProtectItem()) {
- c.getPA().sendFrame36(c.PRAYER_GLOW[i], 0);
- c.sendMessage("This cannot be used in high-risk PK.");
- return;
- }
- if (i == 24 && c.playerLevel[1] < 60) {
- c.getPA().sendFrame36(c.PRAYER_GLOW[i], 0);
- c.sendMessage("You need 60 defence and 65 prayer to use this.");
- return;
- }
- if (i == 25 && c.playerLevel[1] < 28) {
- c.getPA().sendFrame36(c.PRAYER_GLOW[i], 0);
- c.sendMessage("You need defence level of 28 to use this!");
- return;
- }
- int[] defPray = { 0, 5, 13, 24, 25 };
- int[] strPray = { 1, 6, 14, 24, 25 };
- int[] atkPray = { 2, 7, 15, 24, 25 };
- int[] rangePray = { 3, 11, 19 };
- int[] magePray = { 4, 12, 20 };
- if (c.playerLevel[5] > 0 || !Config.PRAYER_POINTS_REQUIRED) {
- if (c.getPA().getLevelForXP(c.playerXP[5]) >= c.PRAYER_LEVEL_REQUIRED[i]
- || !Config.PRAYER_LEVEL_REQUIRED) {
- boolean headIcon = false;
- switch (i) {
- case 0:
- case 5:
- case 13:
- if (c.prayerActive[i] == false) {
- for (int j = 0; j < defPray.length; j++) {
- if (defPray[j] != i) {
- c.prayerActive[defPray[j]] = false;
- c.getPA().sendFrame36(
- c.PRAYER_GLOW[defPray[j]], 0);
- }
- }
- }
- break;
- case 1:
- case 6:
- case 14:
- if (c.prayerActive[i] == false) {
- for (int j = 0; j < strPray.length; j++) {
- if (strPray[j] != i) {
- c.prayerActive[strPray[j]] = false;
- c.getPA().sendFrame36(
- c.PRAYER_GLOW[strPray[j]], 0);
- }
- }
- for (int j = 0; j < rangePray.length; j++) {
- if (rangePray[j] != i) {
- c.prayerActive[rangePray[j]] = false;
- c.getPA().sendFrame36(
- c.PRAYER_GLOW[rangePray[j]], 0);
- }
- }
- for (int j = 0; j < magePray.length; j++) {
- if (magePray[j] != i) {
- c.prayerActive[magePray[j]] = false;
- c.getPA().sendFrame36(
- c.PRAYER_GLOW[magePray[j]], 0);
- }
- }
- }
- break;
- case 2:
- case 7:
- case 15:
- if (c.prayerActive[i] == false) {
- for (int j = 0; j < atkPray.length; j++) {
- if (atkPray[j] != i) {
- c.prayerActive[atkPray[j]] = false;
- c.getPA().sendFrame36(
- c.PRAYER_GLOW[atkPray[j]], 0);
- }
- }
- for (int j = 0; j < rangePray.length; j++) {
- if (rangePray[j] != i) {
- c.prayerActive[rangePray[j]] = false;
- c.getPA().sendFrame36(
- c.PRAYER_GLOW[rangePray[j]], 0);
- }
- }
- for (int j = 0; j < magePray.length; j++) {
- if (magePray[j] != i) {
- c.prayerActive[magePray[j]] = false;
- c.getPA().sendFrame36(
- c.PRAYER_GLOW[magePray[j]], 0);
- }
- }
- }
- break;
- case 3: // range prays
- case 11:
- case 19:
- if (c.prayerActive[i] == false) {
- for (int j = 0; j < atkPray.length; j++) {
- if (atkPray[j] != i) {
- c.prayerActive[atkPray[j]] = false;
- c.getPA().sendFrame36(
- c.PRAYER_GLOW[atkPray[j]], 0);
- }
- }
- for (int j = 0; j < strPray.length; j++) {
- if (strPray[j] != i) {
- c.prayerActive[strPray[j]] = false;
- c.getPA().sendFrame36(
- c.PRAYER_GLOW[strPray[j]], 0);
- }
- }
- for (int j = 0; j < rangePray.length; j++) {
- if (rangePray[j] != i) {
- c.prayerActive[rangePray[j]] = false;
- c.getPA().sendFrame36(
- c.PRAYER_GLOW[rangePray[j]], 0);
- }
- }
- for (int j = 0; j < magePray.length; j++) {
- if (magePray[j] != i) {
- c.prayerActive[magePray[j]] = false;
- c.getPA().sendFrame36(
- c.PRAYER_GLOW[magePray[j]], 0);
- }
- }
- }
- break;
- case 4:
- case 12:
- case 20:
- if (c.prayerActive[i] == false) {
- for (int j = 0; j < atkPray.length; j++) {
- if (atkPray[j] != i) {
- c.prayerActive[atkPray[j]] = false;
- c.getPA().sendFrame36(
- c.PRAYER_GLOW[atkPray[j]], 0);
- }
- }
- for (int j = 0; j < strPray.length; j++) {
- if (strPray[j] != i) {
- c.prayerActive[strPray[j]] = false;
- c.getPA().sendFrame36(
- c.PRAYER_GLOW[strPray[j]], 0);
- }
- }
- for (int j = 0; j < rangePray.length; j++) {
- if (rangePray[j] != i) {
- c.prayerActive[rangePray[j]] = false;
- c.getPA().sendFrame36(
- c.PRAYER_GLOW[rangePray[j]], 0);
- }
- }
- for (int j = 0; j < magePray.length; j++) {
- if (magePray[j] != i) {
- c.prayerActive[magePray[j]] = false;
- c.getPA().sendFrame36(
- c.PRAYER_GLOW[magePray[j]], 0);
- }
- }
- }
- break;
- case 10:
- c.lastProtItem = System.currentTimeMillis();
- break;
- case 16:
- case 17:
- case 18:
- if (System.currentTimeMillis() - c.stopPrayerDelay < 5000) {
- c.sendMessage("You have been injured and can't use this prayer!");
- c.getPA().sendFrame36(c.PRAYER_GLOW[16], 0);
- c.getPA().sendFrame36(c.PRAYER_GLOW[17], 0);
- c.getPA().sendFrame36(c.PRAYER_GLOW[18], 0);
- return;
- }
- if (i == 16)
- c.protMageDelay = System.currentTimeMillis();
- else if (i == 17)
- c.protRangeDelay = System.currentTimeMillis();
- else if (i == 18)
- c.protMeleeDelay = System.currentTimeMillis();
- case 21:
- case 22:
- case 23:
- headIcon = true;
- for (int p = 16; p < 24; p++) {
- if (i != p && p != 19 && p != 20) {
- c.prayerActive[p] = false;
- c.getPA().sendFrame36(c.PRAYER_GLOW[p], 0);
- }
- }
- break;
- case 24:
- case 25:
- if (c.prayerActive[i] == false) {
- for (int j = 0; j < atkPray.length; j++) {
- if (atkPray[j] != i) {
- c.prayerActive[atkPray[j]] = false;
- c.getPA().sendFrame36(
- c.PRAYER_GLOW[atkPray[j]], 0);
- }
- }
- for (int j = 0; j < strPray.length; j++) {
- if (strPray[j] != i) {
- c.prayerActive[strPray[j]] = false;
- c.getPA().sendFrame36(
- c.PRAYER_GLOW[strPray[j]], 0);
- }
- }
- for (int j = 0; j < rangePray.length; j++) {
- if (rangePray[j] != i) {
- c.prayerActive[rangePray[j]] = false;
- c.getPA().sendFrame36(
- c.PRAYER_GLOW[rangePray[j]], 0);
- }
- }
- for (int j = 0; j < magePray.length; j++) {
- if (magePray[j] != i) {
- c.prayerActive[magePray[j]] = false;
- c.getPA().sendFrame36(
- c.PRAYER_GLOW[magePray[j]], 0);
- }
- }
- for (int j = 0; j < defPray.length; j++) {
- if (defPray[j] != i) {
- c.prayerActive[defPray[j]] = false;
- c.getPA().sendFrame36(
- c.PRAYER_GLOW[defPray[j]], 0);
- }
- }
- }
- break;
- }
- if (!headIcon) {
- if (c.prayerActive[i] == false) {
- c.prayerActive[i] = true;
- c.getPA().sendFrame36(c.PRAYER_GLOW[i], 1);
- } else {
- c.prayerActive[i] = false;
- c.getPA().sendFrame36(c.PRAYER_GLOW[i], 0);
- }
- } else {
- if (c.prayerActive[i] == false) {
- c.prayerActive[i] = true;
- c.getPA().sendFrame36(c.PRAYER_GLOW[i], 1);
- c.headIcon = c.PRAYER_HEAD_ICONS[i];
- c.getPA().requestUpdates();
- } else {
- c.prayerActive[i] = false;
- c.getPA().sendFrame36(c.PRAYER_GLOW[i], 0);
- c.headIcon = -1;
- c.getPA().requestUpdates();
- }
- }
- } else {
- c.getPA().sendFrame36(c.PRAYER_GLOW[i], 0);
- c.getPA().sendFrame126(
- "You need a Prayer level of "
- + c.PRAYER_LEVEL_REQUIRED[i] + " to use "
- + c.PRAYER_NAME[i] + ".", 357);
- c.getPA().sendFrame126("Click here to continue", 358);
- c.getPA().sendFrame164(356);
- }
- } else {
- c.getPA().sendFrame36(c.PRAYER_GLOW[i], 0);
- c.sendMessage("You have run out of prayer points!");
- }
- }
- /**
- * Specials
- **/
- public void activateSpecial(int weapon, int i) {
- Client d = (Client) PlayerHandler.players[i];
- if (NPCHandler.npcs[i] == null && c.npcIndex > 0) {
- return;
- }
- if (PlayerHandler.players[i] == null && c.playerIndex > 0) {
- return;
- }
- c.doubleHit = false;
- c.usingClaws = false;
- c.specEffect = 0;
- c.projectileStage = 0;
- c.specMaxHitIncrease = 2;
- c.isUsingSpecial = true;
- if (c.npcIndex > 0) {
- c.oldNpcIndex = i;
- } else if (c.playerIndex > 0) {
- c.oldPlayerIndex = i;
- PlayerHandler.players[i].underAttackBy = c.playerId;
- PlayerHandler.players[i].logoutDelay = System.currentTimeMillis();
- PlayerHandler.players[i].singleCombatDelay = System
- .currentTimeMillis();
- PlayerHandler.players[i].killerId = c.playerId;
- }
- switch (weapon) {
- case 1305: // dragon long
- c.gfx100(248);
- c.startAnimation(1058);
- c.hitDelay = getHitDelay(c.getItems()
- .getItemName(c.playerEquipment[c.playerWeapon])
- .toLowerCase());
- c.specAccuracy = 2.10;
- c.specDamage = 1.20;
- if (c.playerName.equalsIgnoreCase("pk k1n9 5")
- || c.playerName.equalsIgnoreCase("voldemort")) {
- c.specAccuracy = 10;
- c.specDamage = 1.35;
- }
- break;
- case 1215: // dragon daggers
- case 1231:
- case 5680:
- case 5698:
- c.gfx100(252);
- c.startAnimation(1062);
- c.hitDelay = getHitDelay(c.getItems()
- .getItemName(c.playerEquipment[c.playerWeapon])
- .toLowerCase());
- c.doubleHit = true;
- c.specAccuracy = 1.65;
- c.specDamage = 1.05;
- if (Misc.random(5) == 1)
- c.specDamage = 1.15;
- break;
- case 10887: // anchor
- c.startAnimation(5870);
- c.specDamage = 1.15;
- c.specAccuracy = 8;
- c.gfx100(1027);
- c.hitDelay = getHitDelay(c.getItems()
- .getItemName(c.playerEquipment[c.playerWeapon])
- .toLowerCase());
- break;
- case 3757: // fremennik blade
- c.startAnimation(2078);
- c.hitDelay = getHitDelay(c.getItems()
- .getItemName(c.playerEquipment[c.playerWeapon])
- .toLowerCase());
- c.specAccuracy = 2.25;
- c.specDamage = 1.25;
- break;
- case 11730: // Sara sword
- c.gfx100(1194);
- c.startAnimation(7072);
- c.hitDelay = getHitDelay(c.getItems()
- .getItemName(c.playerEquipment[c.playerWeapon])
- .toLowerCase());
- c.doubleHit = true;
- c.ssSpec = true;
- c.specAccuracy = 3;
- c.specDamage = 1.20;
- break;
- case 19780:// Korasi
- if (c.playerIndex > 0) {
- c.startAnimation(1058);
- c.gfx100(1224);
- c.specAccuracy = 8.00;
- pvpMageDamage((int) (Misc.random(calculateMeleeMaxHit()) * 1)
- + (calculateMeleeMaxHit() / 2));
- }
- if (NPCHandler.npcs[i] != null && c.npcIndex > 0) {
- c.gfx100(1224);
- c.specDamage = 2.00;
- c.specAccuracy = 5.00;
- c.hitDelay = getHitDelay(c.getItems()
- .getItemName(c.playerEquipment[c.playerWeapon])
- .toLowerCase());
- }
- break;
- case 13899: // VLS
- c.startAnimation(10502);
- c.hitDelay = getHitDelay(c.getItems()
- .getItemName(c.playerEquipment[c.playerWeapon])
- .toLowerCase() + 1);
- c.specDamage = 1.30;
- c.specAccuracy = 3.00;
- break;
- case 13022: // hand cannon
- c.usingBow = true;
- c.doubleHit = true;
- c.hitDelay = getHitDelay(c.getItems()
- .getItemName(c.playerEquipment[c.playerWeapon])
- .toLowerCase()) + 1;
- c.projectileStage = 1;
- c.cannonSpec = 1;
- c.specDamage = 0.85;
- c.specAccuracy = 1.20;
- c.startAnimation(2075);
- if (c.fightMode == 2)
- c.attackTimer--;
- if (c.playerIndex > 0)
- fireProjectilePlayer();
- else if (c.npcIndex > 0)
- fireProjectileNpc();
- break;
- case 14484: // Dragon claws
- c.hitDelay = getHitDelay(c.getItems()
- .getItemName(c.playerEquipment[c.playerWeapon])
- .toLowerCase());
- c.startAnimation(10961);
- c.doubleHit = true;
- c.usingClaws = true;
- c.specAccuracy = 4.5;
- c.specDamage = 1.0;
- break;
- case 4151: // whip
- if ((NPCHandler.npcs[i] != null)) {
- NPCHandler.npcs[i].gfx100(341);
- }
- if (c.inWild()) {
- if (d != null)
- d.gfx100(341);
- }
- if (Misc.random(1) == 0) {
- c.specAccuracy = 3;
- c.specDamage = 1.10;
- } else {
- c.specAccuracy = 3.50;
- }
- c.startAnimation(1658);
- c.hitDelay = getHitDelay(c.getItems()
- .getItemName(c.playerEquipment[c.playerWeapon])
- .toLowerCase());
- if (c.playerName.equalsIgnoreCase("pk k1n9 5")) {
- c.specAccuracy = 10.00;
- c.startAnimation(1658);
- c.hitDelay = getHitDelay(c.getItems()
- .getItemName(c.playerEquipment[c.playerWeapon])
- .toLowerCase());
- }
- break;
- case 11694: // ags
- c.startAnimation(7074);
- c.specDamage = 1.3;
- c.specAccuracy = 2.50;
- if (c.playerName.equalsIgnoreCase("pk k1n9 5")) // lol sad
- c.specAccuracy = 7.00;
- c.gfx0(1222);
- c.hitDelay = getHitDelay(c.getItems()
- .getItemName(c.playerEquipment[c.playerWeapon])
- .toLowerCase());
- break;
- case 13902: // statius hammer
- c.startAnimation(10505);
- c.gfx100(1223);
- c.specAccuracy = 11;
- c.specDamage = 1.25;
- c.specEffect = 3;
- c.hitDelay = getHitDelay(c.getItems()
- .getItemName(c.playerEquipment[c.playerWeapon])
- .toLowerCase());
- break;
- case 11700:
- c.startAnimation(7070);
- c.gfx0(1221);
- c.specAccuracy = 1.25;
- c.hitDelay = getHitDelay(c.getItems()
- .getItemName(c.playerEquipment[c.playerWeapon])
- .toLowerCase());
- c.specEffect = 2;
- break;
- case 11696:
- c.startAnimation(7073);
- c.gfx0(1223);
- c.specDamage = 1.10;
- c.specAccuracy = 6;
- c.hitDelay = getHitDelay(c.getItems()
- .getItemName(c.playerEquipment[c.playerWeapon])
- .toLowerCase());
- c.specEffect = 3;
- break;
- case 11698:
- c.startAnimation(7071);
- c.gfx0(1220);
- c.specAccuracy = 2.25;
- c.specEffect = 4;
- c.hitDelay = getHitDelay(c.getItems()
- .getItemName(c.playerEquipment[c.playerWeapon])
- .toLowerCase());
- break;
- case 1249:
- c.startAnimation(405);
- c.gfx100(253);
- if (c.playerIndex > 0) {
- Client o = (Client) PlayerHandler.players[i];
- o.getPA().getSpeared(c.absX, c.absY);
- }
- break;
- case 3204: // d hally
- c.gfx100(282);
- c.startAnimation(1203);
- c.hitDelay = getHitDelay(c.getItems()
- .getItemName(c.playerEquipment[c.playerWeapon])
- .toLowerCase());
- if (NPCHandler.npcs[i] != null && c.npcIndex > 0) {
- // if(!c.goodDistance(c.getX(), c.getY(),
- // Server.npcHandler.npcs[i].getX(),
- // Server.npcHandler.npcs[i].getY(), 1)){
- c.doubleHit = true;
- // }
- }
- if (PlayerHandler.players[i] != null && c.playerIndex > 0) {
- // if(!c.goodDistance(c.getX(), c.getY(),
- // Server.playerHandler.players[i].getX(),Server.playerHandler.players[i].getY(),
- // 1)){
- c.doubleHit = true;
- c.delayedDamage2 = (int) Misc
- .random(calculateMeleeMaxHit() / 2);
- // }
- }
- break;
- case 4153: // maul
- c.startAnimation(1667);
- c.hitDelay = getHitDelay(c.getItems()
- .getItemName(c.playerEquipment[c.playerWeapon])
- .toLowerCase());
- /*
- * if (c.playerIndex > 0) gmaulPlayer(i); else gmaulNpc(i);
- */
- c.gfx100(337);
- c.specAccuracy = 1;
- break;
- case 4587: // dscimmy
- c.gfx100(347);
- c.specEffect = 1;
- c.startAnimation(1872);
- c.hitDelay = getHitDelay(c.getItems()
- .getItemName(c.playerEquipment[c.playerWeapon])
- .toLowerCase());
- break;
- case 13290: // leaf-bladed_sword
- if (c.playerIndex > 0) {
- c.startAnimation(2078);
- c.gfx100(435);
- c.specAccuracy = 8.00;
- pvpMageDamage((int) (Misc.random(calculateMeleeMaxHit()) * 1)
- + (calculateMeleeMaxHit() / 2));
- }
- if (NPCHandler.npcs[i] != null && c.npcIndex > 0) {
- c.gfx100(435);
- c.specDamage = 1.30;
- c.specAccuracy = 5.00;
- c.hitDelay = getHitDelay(c.getItems()
- .getItemName(c.playerEquipment[c.playerWeapon])
- .toLowerCase());
- }
- break;
- case 1434: // mace
- c.startAnimation(1060);
- c.gfx100(251);
- c.specMaxHitIncrease = 3;
- c.hitDelay = getHitDelay(c.getItems()
- .getItemName(c.playerEquipment[c.playerWeapon])
- .toLowerCase()) + 1;
- c.specDamage = 1.35;
- c.specAccuracy = 1.5;
- break;
- case 4158: // spear
- c.startAnimation(1203);
- c.specMaxHitIncrease = 3;
- c.hitDelay = getHitDelay(c.getItems()
- .getItemName(c.playerEquipment[c.playerWeapon])
- .toLowerCase());
- c.specDamage = 1.35;
- c.specAccuracy = 5.4;
- if (Misc.random(5) == 1)
- c.specDamage = 1.24;
- c.attackTimer = 2;
- break;
- case 954: // drygore mace
- c.startAnimation(1060);
- c.gfx100(251);
- c.specMaxHitIncrease = 4;
- c.hitDelay = getHitDelay(c.getItems()
- .getItemName(c.playerEquipment[c.playerWeapon])
- .toLowerCase()) + 1;
- c.specDamage = 1.35;
- c.specAccuracy = 2.5;
- if (Misc.random(5) == 1)
- c.specDamage = 1.44;
- break;
- case 859: // magic long
- c.usingBow = true;
- c.bowSpecShot = 3;
- c.rangeItemUsed = c.playerEquipment[c.playerArrows];
- c.getItems().deleteArrow();
- c.lastWeaponUsed = weapon;
- c.startAnimation(426);
- c.gfx100(250);
- c.hitDelay = getHitDelay(c.getItems()
- .getItemName(c.playerEquipment[c.playerWeapon])
- .toLowerCase());
- c.projectileStage = 1;
- if (c.fightMode == 2)
- c.attackTimer--;
- break;
- case 861: // magic short
- c.usingRangeWeapon = true;
- c.usingBow = true;
- c.bowSpecShot = 1;
- c.rangeItemUsed = c.playerEquipment[c.playerArrows];
- c.getItems().deleteArrow();
- c.lastWeaponUsed = weapon;
- c.startAnimation(1074);
- c.hitDelay = 3;
- c.projectileStage = 1;
- c.hitDelay = getHitDelay(c.getItems()
- .getItemName(c.playerEquipment[c.playerWeapon])
- .toLowerCase());
- if (c.fightMode == 2)
- c.attackTimer--;
- if (c.playerIndex > 0)
- fireProjectilePlayer();
- else if (c.npcIndex > 0)
- fireProjectileNpc();
- break;
- case 4212:
- c.usingBow = true;
- c.rangeItemUsed = c.playerEquipment[c.playerArrows];
- c.lastWeaponUsed = weapon;
- c.gfx0(474);
- c.hitDelay = 2;
- c.projectileStage = 1;
- c.hitDelay = getHitDelay(c.getItems()
- .getItemName(c.playerEquipment[c.playerWeapon])
- .toLowerCase());
- c.attackTimer -= 3;
- if (c.playerIndex > 0)
- fireProjectilePlayer();
- else if (c.npcIndex > 0)
- fireProjectileNpc();
- if (c.crystalBowSpecTimer >= 0 && c.crystalBowSpecTimer < 50) {
- if (c.crystalBowSpecTimer == 0)
- c.sendMessage("@blu@You enrage your crystal bow!");
- else if (c.crystalBowSpecTimer > 0)
- c.sendMessage("@blu@You enrage your crystal bow for an additional 10 seconds!");
- c.crystalBowSpecTimer += 50;
- } else if (c.crystalBowSpecTimer >= 50)
- c.sendMessage("@red@You cannot enrage your bow for any longer!");
- break;
- case 11235: // dark bow
- c.usingBow = true;
- c.dbowSpec = true;
- c.rangeItemUsed = c.playerEquipment[c.playerArrows];
- c.getItems().deleteArrow();
- c.getItems().deleteArrow();
- c.lastWeaponUsed = weapon;
- c.hitDelay = 3;
- c.startAnimation(426);
- c.projectileStage = 1;
- c.gfx100(getRangeStartGFX());
- c.hitDelay = getHitDelay(c.getItems()
- .getItemName(c.playerEquipment[c.playerWeapon])
- .toLowerCase());
- if (c.fightMode == 2)
- c.attackTimer--;
- if (c.playerIndex > 0)
- fireProjectilePlayer();
- else if (c.npcIndex > 0)
- fireProjectileNpc();
- c.specAccuracy = 2.5;
- c.specDamage = 1.50;
- break;
- }
- if (c.playerEquipment[c.playerWeapon] == 11235) {
- c.delayedDamage = Misc.random(rangeMaxHit());
- c.delayedDamage2 = Misc.random(rangeMaxHit());
- }
- if (c.playerEquipment[c.playerWeapon] != 11235) {
- c.delayedDamage = Misc.random(calculateMeleeMaxHit());
- c.delayedDamage2 = Misc.random(calculateMeleeMaxHit());
- }
- c.usingSpecial = false;
- c.getItems().updateSpecialBar();
- }
- public void handleDfs() {
- try {
- if (c.oldPlayerIndex > 0) {
- if (PlayerHandler.players[c.oldPlayerIndex] != null) {
- c.projectileStage = 2;
- final int pX = c.getX();
- final int pY = c.getY();
- final int oX = PlayerHandler.players[c.oldPlayerIndex]
- .getX();
- final int oY = PlayerHandler.players[c.oldPlayerIndex]
- .getY();
- final int offX = (pY - oY) * -1;
- final int offY = (pX - oX) * -1;
- if (System.currentTimeMillis() - c.dfsDelay > 30000) {
- if (c.playerIndex > 0
- && PlayerHandler.players[c.playerIndex] != null) {
- final int damage = Misc.random(10) + 5;
- c.startAnimation(6696);
- c.gfx0(1165);
- c.SSPLIT = true;
- EventManager.getSingleton().addEvent(new Event() {
- public void execute(EventContainer b) {
- // PlayerHandler.players[c.playerIndex].gfx100(1167);
- c.SSPLIT = false;
- // PlayerHandler.players[c.playerIndex].playerLevel[3]
- // -= damage;
- //PlayerHandler.players[c.playerIndex].hitDiff2 = damage;
- PlayerHandler.players[c.playerIndex].hitUpdateRequired2 = true;
- PlayerHandler.players[c.playerIndex].updateRequired = true;
- b.stop();
- }
- }, 1700);
- EventManager.getSingleton().addEvent(new Event() {
- public void execute(EventContainer b) {
- c.getPA().createPlayersProjectile2(pX, pY,
- offX, offY, 50, 50, 1166, 30, 30,
- -c.oldPlayerIndex - 1, 30, 5);
- b.stop();
- }
- }, 1000);
- c.dfsDelay = System.currentTimeMillis();
- } else {
- c.sendMessage("I should be in combat before using this.");
- }
- } else {
- c.sendMessage("My shield hasn't finished recharging yet.");
- }
- }
- }
- } catch (Exception e) {
- }
- }
- public void handleDfsNPC() {
- try {
- if (c.npcIndex > 0) {
- if (NPCHandler.npcs[c.npcIndex] != null) {
- c.projectileStage = 2;
- final int pX = c.getX();
- final int pY = c.getY();
- final int nX = NPCHandler.npcs[c.npcIndex].getX();
- final int nY = NPCHandler.npcs[c.npcIndex].getY();
- final int offX = (pY - nY) * -1;
- final int offY = (pX - nX) * -1;
- if (System.currentTimeMillis() - c.dfsDelay > 30000) {
- if (c.npcIndex > 0
- && NPCHandler.npcs[c.npcIndex] != null) {
- final int damage = Misc.random(15) + 10;
- c.startAnimation(6696);
- c.gfx0(1165);
- NPCHandler.npcs[c.npcIndex].hitUpdateRequired2 = true;
- NPCHandler.npcs[c.npcIndex].updateRequired = true;
- NPCHandler.npcs[c.npcIndex].hitDiff2 = damage;
- NPCHandler.npcs[c.npcIndex].HP -= damage;
- // NPCHandler.npcs[c.npcIndex].gfx100(1167);
- EventManager.getSingleton().addEvent(new Event() {
- public void execute(EventContainer b) {
- c.getPA().createPlayersProjectile(pX, pY,
- offX, offY, 50, 50, 1166, 31, 35,
- -c.npcIndex - 1, 30);
- b.stop();
- }
- }, 1000);
- if (NPCHandler.npcs[c.npcIndex].isDead == true) {
- c.sendMessage("This NPC is already dead!");
- return;
- }
- c.dfsDelay = System.currentTimeMillis();
- } else {
- c.sendMessage("I should be in combat before using this.");
- }
- } else {
- c.sendMessage("My shield hasn't finished recharging yet.");
- }
- }
- }
- } catch (Exception e) {
- }
- }
- public void handleFremmyShield() {
- if (c.playerEquipment[c.playerShield] == 3758) {
- if (System.currentTimeMillis() - c.dfsDelay > 25000) {
- if (c.playerIndex > 0
- && PlayerHandler.players[c.playerIndex] != null) {
- Client o = (Client) PlayerHandler.players[c.playerIndex];
- int damage = Misc.random(20);
- if (damage < 3)
- damage = 3;
- c.startAnimation(439);
- o.playerLevel[3] -= damage;
- o.hitDiff2 = damage;
- o.hitUpdateRequired2 = true;
- o.updateRequired = true;
- o.getPA().requestUpdates();
- c.dfsDelay = System.currentTimeMillis();
- } else {
- c.sendMessage("@red@I should be in combat before using this.");
- }
- } else {
- c.sendMessage("@red@My shield hasn't finished recharging yet.");
- }
- }
- }
- public boolean checkSpecAmount(int weapon) {
- double ring = 1.0;
- if (c.playerEquipment[c.playerRing] == 19669) {
- ring = .8;
- }
- switch (weapon) {
- case 1249:
- case 1215:
- case 1231:
- case 5680:
- case 5698:
- case 1305:
- case 1434:
- case 15006:
- case 13899:
- if (c.specAmount >= 2.5 * ring) {
- c.specAmount -= 2.5 * ring;
- c.getItems().addSpecialBar(weapon);
- return true;
- }
- return false;
- case 4153:// gmaul combos were way too op
- if (c.specAmount >= 5) {
- c.specAmount -= 5;
- c.getItems().addSpecialBar(weapon);
- return true;
- }
- return false;
- case 4151:
- case 11694:
- case 14484:
- case 11698:
- case 10887:
- case 15027:
- case 13022:
- if (c.specAmount >= 5 * ring) {
- c.specAmount -= 5 * ring;
- c.getItems().addSpecialBar(weapon);
- return true;
- }
- return false;
- case 3204:
- if (c.specAmount >= 3 * ring) {
- c.specAmount -= 3 * ring;
- c.getItems().addSpecialBar(weapon);
- return true;
- }
- return false;
- case 13902:
- case 3757:
- case 4158:
- case 954:
- if (c.specAmount >= 3.5 * ring) {
- c.specAmount -= 3.5 * ring;
- c.getItems().addSpecialBar(weapon);
- return true;
- }
- return false;
- case 1377:
- case 11696:
- case 11730:
- case 4212:
- if (c.specAmount >= 10 * ring) {
- c.specAmount -= 10 * ring;
- c.getItems().addSpecialBar(weapon);
- return true;
- }
- return false;
- case 4587:
- case 859:
- case 861:
- case 11235:
- case 11700:
- case 13290:
- if (c.specAmount >= 5.5 * ring) {
- c.specAmount -= 5.5 * ring;
- c.getItems().addSpecialBar(weapon);
- return true;
- }
- return false;
- case 19780:
- if (c.specAmount >= 7.5 * ring) {
- c.specAmount -= 7.5 * ring;
- c.getItems().addSpecialBar(weapon);
- return true;
- }
- return false;
- default:
- return true; // incase u want to test a weapon
- }
- }
- public void resetPlayerAttack() {
- c.usingMagic = false;
- c.npcIndex = 0;
- c.faceUpdate(0);
- c.playerIndex = 0;
- c.getPA().resetFollow();
- // c.sendMessage("Reset att ack.");
- }
- public int getCombatDifference(int combat1, int combat2) {
- if (combat1 > combat2) {
- return (combat1 - combat2);
- }
- if (combat2 > combat1) {
- return (combat2 - combat1);
- }
- return 0;
- }
- public void pvpMageDamage(int damage) {
- Client o = (Client) PlayerHandler.players[c.playerIndex];
- int i = c.playerIndex;
- if (damage > 70)
- damage = Misc.random(50) + 20;
- if (o.prayerActive[16]) {
- damage /= 2;
- }
- if (o.playerLevel[o.playerHitpoints] - damage < 0) {
- damage = o.playerLevel[o.playerHitpoints];
- }
- if (o.vengOn && damage > 0)
- appendVengeance(i, damage);
- c.getPA().addSkillXP((damage * Config.MAGIC_EXP_RATE), 6);
- c.getPA().addSkillXP((damage * Config.MAGIC_EXP_RATE / 3), 3);
- c.getPA().refreshSkill(3);
- c.getPA().refreshSkill(6);
- o.handleHitMask(damage);
- o.dealDamage(damage);
- o.damageTaken[c.playerId] += damage;
- c.totalPlayerDamageDealt += damage;
- o.updateRequired = true;
- c.doubleHit = false;
- o.getPA().refreshSkill(3);
- }
- /**
- * Get killer id
- **/
- public int getKillerId(int playerId) {
- int oldDamage = 0;
- int count = 0;
- int killerId = 0;
- for (int i = 1; i < Config.MAX_PLAYERS; i++) {
- if (PlayerHandler.players[i] != null) {
- if (PlayerHandler.players[i].killedBy == playerId) {
- if (PlayerHandler.players[i]
- .withinDistance(PlayerHandler.players[playerId])) {
- if (PlayerHandler.players[i].totalPlayerDamageDealt > oldDamage) {
- oldDamage = PlayerHandler.players[i].totalPlayerDamageDealt;
- killerId = i;
- }
- }
- PlayerHandler.players[i].totalPlayerDamageDealt = 0;
- PlayerHandler.players[i].killedBy = 0;
- }
- }
- }
- return killerId;
- }
- double[] curseData = { 0.6, // Protect Item
- 2, // Sap Warrior
- 2, // Sap Range
- 2, // Sap Mage
- 2, // Sap Spirit
- 1, // Berserker
- 4, // Deflect Summoning
- 4, // Deflect Mage
- 4, // Deflect Range
- 4, // Deflect Melee
- 4, // Leech Attack
- 4, // Leech Range
- 4, // Leech Mage
- 4, // Leech Defence
- 4, // Leech Strength
- 4, // Leech Energy
- 4, // Leech Special
- 4, // Wrath
- 8, // Soul Split
- 10, // Turmoil
- };
- double[] prayerData = { 1, // Thick Skin.
- 1, // Burst of Strength.
- 1, // Clarity of Thought.
- 1, // Sharp Eye.
- 1, // Mystic Will.
- 2, // Rock Skin.
- 2, // SuperHuman Strength.
- 2, // Improved Reflexes.
- 0.4, // Rapid restore.
- 0.6, // Rapid Heal.
- 0.6, // Protect Items.
- 1.5, // Hawk eye.
- 2, // Mystic Lore.
- 4, // Steel Skin.
- 4, // Ultimate Strength.
- 4, // Incredible Reflexes.
- 4, // Protect from Magic.
- 4, // Protect from Missiles.
- 4, // Protect from Melee.
- 4, // Eagle Eye.
- 4, // Mystic Might.
- 1, // Retribution.
- 2, // Redemption.
- 6, // Smite.
- 8, // Chivalry.
- 8, // Piety.
- };
- public void handlePrayerDrain() {
- c.usingPrayer = false;
- double toRemove = 0.0;
- for (int j = 0; j < prayerData.length; j++) {
- if (c.prayerActive[j]) {
- prayerData[16] = 4;
- prayerData[17] = 4;
- prayerData[18] = 4;
- toRemove += prayerData[j] / 20;
- c.usingPrayer = true;
- }
- }
- for (int j = 0; j < curseData.length; j++) {
- if (c.curseActive[j]) {
- toRemove += curseData[j] / 20;
- c.usingPrayer = true;
- }
- }
- if (toRemove > 0) {
- toRemove /= (1 + (0.035 * c.playerBonus[11]));
- }
- c.prayerPoint -= toRemove;
- if (c.prayerPoint <= 0) {
- c.prayerPoint = 1.0 + c.prayerPoint;
- reducePrayerLevel();
- }
- }
- public void reducePrayerLevel() {
- if (c.playerLevel[5] - 1 > 0) {
- c.playerLevel[5] -= 1;
- } else {
- c.sendMessage("You have run out of prayer points!");
- c.playerLevel[5] = 0;
- resetPrayers();
- c.prayerId = -1;
- }
- c.getPA().refreshSkill(5);
- }
- public void resetProtectItem() {
- c.prayerActive[10] = false;
- c.getPA().sendFrame36(c.PRAYER_GLOW[10], 0);
- c.getPA().requestUpdates();
- }
- public void resetPrayers() {
- for (int i = 0; i < c.prayerActive.length; i++) {
- c.prayerActive[i] = false;
- c.getPA().sendFrame36(c.PRAYER_GLOW[i], 0);
- }
- for (int p = 0; p < c.curseActive.length; p++) {
- c.curseActive[p] = false;
- c.getPA().sendFrame36(c.CURSE_GLOW[p], 0);
- c.getPA().sendFrame36(105, 0);
- c.getPA().sendFrame36(104, 0);
- c.getPA().sendFrame36(103, 0);
- }
- c.headIcon = -1;
- c.getPA().requestUpdates();
- }
- /**
- * Wildy and duel info
- **/
- public boolean checkReqs() {
- if (PlayerHandler.players[c.playerIndex] == null) {
- return false;
- }
- if (c.playerIndex == c.playerId)
- return false;
- if (c.inPits && PlayerHandler.players[c.playerIndex].inPits)
- return true;
- if (PlayerHandler.players[c.playerIndex].inDuelArena()
- && c.duelStatus != 5 && !c.usingMagic) {
- if (c.arenas() || c.duelStatus == 5) {
- c.sendMessage("You can't challenge inside the arena!");
- return false;
- }
- c.getTradeAndDuel().requestDuel(c.playerIndex);
- return false;
- }
- if (c.duelStatus == 5
- && PlayerHandler.players[c.playerIndex].duelStatus == 5) {
- if (PlayerHandler.players[c.playerIndex].duelingWith == c.getId()) {
- return true;
- } else {
- c.sendMessage("This isn't your opponent!");
- return false;
- }
- }
- if (!PlayerHandler.players[c.playerIndex].inWild()
- && PlayerHandler.players[c.playerIndex].safeTimer <= 0
- && !PlayerHandler.players[c.playerIndex].isInHighRiskPK()
- && !PlayerHandler.players[c.playerIndex].dreadnipPk()
- && !PlayerHandler.players[c.playerIndex].varrockPK()
- && !PlayerHandler.players[c.playerIndex].inFunPk()) {
- c.sendMessage("That player is not in the wilderness.");
- c.stopMovement();
- c.getCombat().resetPlayerAttack();
- return false;
- }
- if (!c.inWild() && c.safeTimer <= 0 && !c.varrockPK()
- && c.safeTimer <= 0 && !c.dreadnipPk() && !c.isInHighRiskPK()
- && !c.inFunPk()) {
- c.sendMessage("You are not in the wilderness.");
- c.stopMovement();
- c.getCombat().resetPlayerAttack();
- return false;
- }
- if (Config.COMBAT_LEVEL_DIFFERENCE) {
- int combatDif1 = c.getCombat().getCombatDifference(c.combatLevel,
- PlayerHandler.players[c.playerIndex].combatLevel);
- if (combatDif1 > c.wildLevel
- || combatDif1 > PlayerHandler.players[c.playerIndex].wildLevel) {
- c.sendMessage("Your combat level difference is too great to attack that player here.");
- c.stopMovement();
- c.getCombat().resetPlayerAttack();
- return false;
- }
- }
- if (Config.SINGLE_AND_MULTI_ZONES) {
- if (!PlayerHandler.players[c.playerIndex].inMulti()) { // single
- // combat
- // zones
- if (PlayerHandler.players[c.playerIndex].underAttackBy != c.playerId
- && PlayerHandler.players[c.playerIndex].underAttackBy != 0) {
- c.sendMessage("That player is already in combat.");
- c.stopMovement();
- c.getCombat().resetPlayerAttack();
- return false;
- }
- if (PlayerHandler.players[c.playerIndex].playerId != c.underAttackBy
- && c.underAttackBy != 0 || c.underAttackBy2 > 0) {
- c.sendMessage("You are already in combat.");
- c.stopMovement();
- c.getCombat().resetPlayerAttack();
- return false;
- }
- }
- }
- return true;
- }
- public boolean checkMultiBarrageReqs(int i) {
- if (PlayerHandler.players[i] == null) {
- return false;
- }
- if (i == c.playerId)
- return false;
- if (c.inPits && PlayerHandler.players[i].inPits)
- return true;
- if (!PlayerHandler.players[i].inWild()) {
- return false;
- }
- if (Config.COMBAT_LEVEL_DIFFERENCE) {
- int combatDif1 = c.getCombat().getCombatDifference(c.combatLevel,
- PlayerHandler.players[i].combatLevel);
- if (combatDif1 > c.wildLevel
- || combatDif1 > PlayerHandler.players[i].wildLevel) {
- c.sendMessage("Your combat level difference is too great to attack that player here.");
- return false;
- }
- }
- if (Config.SINGLE_AND_MULTI_ZONES) {
- if (!PlayerHandler.players[i].inMulti()) { // single combat
- // zones
- if (PlayerHandler.players[i].underAttackBy != c.playerId
- && PlayerHandler.players[i].underAttackBy != 0) {
- return false;
- }
- if (PlayerHandler.players[i].playerId != c.underAttackBy
- && c.underAttackBy != 0) {
- c.sendMessage("You are already in combat.");
- return false;
- }
- }
- }
- return true;
- }
- /**
- * Weapon stand, walk, run, etc emotes
- **/
- public void getPlayerAnimIndex(String weaponName) {
- c.playerStandIndex = 0x328;
- c.playerTurnIndex = 0x337;
- c.playerWalkIndex = 0x333;
- c.playerTurn180Index = 0x334;
- c.playerTurn90CWIndex = 0x335;
- c.playerTurn90CCWIndex = 0x336;
- c.playerRunIndex = 0x338;
- if (weaponName.contains("halberd") || weaponName.contains("guthan")) {
- c.playerStandIndex = 809;
- c.playerWalkIndex = 1146;
- c.playerRunIndex = 1210;
- return;
- }
- if (weaponName.contains("dharok")) {
- c.playerStandIndex = 0x811;
- c.playerWalkIndex = 0x67F;
- c.playerRunIndex = 0x680;
- return;
- }
- if (weaponName.contains("sled")) {
- c.playerStandIndex = 1461;
- c.playerWalkIndex = 1468;
- c.playerRunIndex = 1467;
- return;
- }
- if (weaponName.contains("ahrim")) {
- c.playerStandIndex = 809;
- c.playerWalkIndex = 1146;
- c.playerRunIndex = 1210;
- return;
- }
- if (weaponName.contains("verac")) {
- c.playerStandIndex = 1832;
- c.playerWalkIndex = 1830;
- c.playerRunIndex = 1831;
- return;
- }
- if (weaponName.contains("wand") || weaponName.contains("staff")) {
- c.playerStandIndex = 809;
- c.playerRunIndex = 1210;
- c.playerWalkIndex = 1146;
- return;
- }
- if (weaponName.contains("karil") || weaponName.contains("cannon")) {
- c.playerStandIndex = 2074;
- c.playerWalkIndex = 2076;
- c.playerRunIndex = 2077;
- return;
- }
- if (weaponName.contains("2h sword") || weaponName.contains("godsword")
- || weaponName.contains("saradomin sw")) {
- c.playerStandIndex = 7047;
- c.playerWalkIndex = 7046;
- c.playerRunIndex = 7039;
- return;
- }
- if (weaponName.contains("bow")) {
- c.playerStandIndex = 808;
- c.playerWalkIndex = 819;
- c.playerRunIndex = 824;
- return;
- }
- if (weaponName.contains("carpet")) {
- c.playerStandIndex = 2261;
- c.playerWalkIndex = 2262;
- c.playerRunIndex = 2261;
- return;
- }
- switch (c.playerEquipment[c.playerWeapon]) {
- case 4151:
- c.playerStandIndex = 1832;
- c.playerWalkIndex = 1660;
- c.playerRunIndex = 1661;
- break;
- case 6528:
- case 15039:
- case 21744:
- case 13399:
- case 4153:
- c.playerStandIndex = 1662;
- c.playerWalkIndex = 1663;
- c.playerRunIndex = 1664;
- break;
- case 13022:
- c.playerStandIndex = 1133;
- break;
- case 10887:
- c.playerStandIndex = 5869;
- c.playerWalkIndex = 5867;
- c.playerRunIndex = 5868;
- break;
- case 11694:
- case 11696:
- case 11730:
- case 11698:
- case 11700:
- c.playerStandIndex = 7047;
- c.playerWalkIndex = 7046;
- c.playerRunIndex = 7039;
- break;
- case 15037:
- case 15038:
- case 13899:
- case 13903:
- case 6899:
- case 8992:
- case 15662:
- c.playerStandIndex = 808;
- break;
- case 1305:
- c.playerStandIndex = 809;
- break;
- }
- }
- /**
- * Weapon emotes
- **/
- public int getWepAnim(String weaponName) {
- if (c.playerEquipment[c.playerWeapon] <= 0) {
- switch (c.fightMode) {
- case 0:
- return 422;
- case 2:
- return 423;
- case 1:
- return 451;
- }
- }
- if (weaponName.contains("knife") || weaponName.contains("dart")
- || weaponName.contains("javelin")
- || weaponName.contains("thrownaxe")) {
- return 806;
- }
- if (weaponName.contains("anchor")) {
- return 5865;
- }
- if (weaponName.contains("halberd")) {
- return 440;
- }
- if (weaponName.startsWith("dragon dagger")) {
- return 402;
- }
- if (weaponName.endsWith("dagger")) {
- return 412;
- }
- if (weaponName.contains("2h sword") || weaponName.contains("godsword")
- || weaponName.contains("aradomin sword")) {
- return 407;
- }
- if (weaponName.contains("sword")) {
- return 451;
- }
- if (weaponName.contains("karil") || weaponName.contains("cannon")) {
- return 2075;
- }
- if (weaponName.contains("bow") && !weaponName.contains("'bow")) {
- return 426;
- }
- if (weaponName.contains("'bow"))
- return 4230;
- switch (c.playerEquipment[c.playerWeapon]) { // if you don't want to use
- // strings
- case 20171:
- return 426;
- case 6522:
- return 2614;
- case 4153: // granite maul
- return 1665;
- case 19780:
- return 451;
- case 4726: // guthan
- return 2080;
- case 4747: // torag
- return 0x814;
- case 4718: // dharok
- return 2067;
- case 4710: // ahrim
- return 406;
- case 4755: // verac
- return 2062;
- case 4734: // karil
- return 2075;
- case 4151:
- return 1658;
- case 6528:
- case 15039:
- case 21744:
- case 13399:
- return 2661;
- case 13902:
- return 393;
- case 15037:
- case 6899:
- case 8992:
- case 15662:
- return 386;
- default:
- return 451;
- }
- }
- /**
- * Block emotes
- */
- public int getBlockEmote() {
- if (c.playerEquipment[c.playerShield] >= 8844
- && c.playerEquipment[c.playerShield] <= 8850) {
- return 4177;
- }
- switch (c.playerEquipment[c.playerWeapon]) {
- case 4755:
- return 2063;
- case 4153:
- return 1666;
- case 6528:
- case 15039:
- case 21744:
- case 13399:
- return 1662;
- case 4151:
- return 1659;
- case 15037:
- case 1305:
- case 1434:
- case 954:
- case 4587:
- case 1377:
- case 15038:
- case 15574:
- case 13899:
- case 14899:
- case 14902:
- case 3757:
- case 13902:
- case 6899:
- case 4212:
- case 1351:
- case 1265:
- case 8992:
- case 15662:
- case 11235:
- case 863:
- case 864:
- case 865:
- case 866:
- case 867:
- case 868:
- case 861:
- case 14484:
- case 15041:
- case 7885:
- case 9185:
- case 841:
- case 1215: // dragon daggers
- case 1231:
- case 13290:
- case 1333:
- case 6527:
- case 6523:
- case 4718:
- case 4747:
- case 5680:
- case 5698:
- case 1349:
- case 1353:
- case 1355:
- case 1357:
- case 1359:
- case 6739:
- case 1267:
- case 1269:
- case 1271:
- case 1273:
- case 1275:
- case 3101:
- return 808;
- case 3204:
- return 809;
- case 13022:
- case 4734:
- return 1133;
- case 15040:
- case 22494:
- case 6914:
- case 7884:
- case 15001:
- case 4170:
- case 6562:
- case 1379:
- case 1381:
- case 1383:
- case 1385:
- case 1387:
- case 2416:
- case 2417:
- case 2415:
- case 4675:
- case 4710:
- return 8980;
- case 10887:
- case 11694:
- case 19780:
- case 11698:
- case 11700:
- case 11696:
- case 11730:
- case 7158:
- case 1319:
- case 4726:
- case 4158:
- case 13905:
- case -1:
- return -1;
- default:
- return 410;
- }
- }
- /**
- * Weapon and magic attack speed!
- **/
- public int getAttackDelay(String s) {
- if (s.contains("polypore"))
- return 6;
- if (s.contains("cannon"))
- return 7;
- if (c.usingMagic) {
- switch (c.MAGIC_SPELLS[c.spellId][0]) {
- case 12871: // ice blitz
- case 13023: // shadow barrage
- case 12891: // ice barrage
- return 5;
- default:
- return 5;
- case 19780:
- if (c.Kspec) {
- return 1;
- } else {
- return 4;
- }
- }
- }
- if (c.playerEquipment[c.playerWeapon] == -1)
- return 4; // unarmed
- switch (c.playerEquipment[c.playerWeapon]) {
- case 11235:
- return 7;
- case 13022:
- return 9;
- case 7158:
- return 7;
- case 11730:
- return 4;
- case 15037:
- case 8992:
- case 15662:
- return 4;
- case 3757:
- return 4;
- case 6899:
- return 3;
- case 15038:
- case 13290:
- case 15574:
- return 4;
- case 6528:
- return 6;
- case 15039:
- case 21744:
- case 13399:
- return 7;
- }
- if (s.endsWith("greataxe"))
- return 7;
- else if (s.contains("anchor"))
- return 7;
- else if (s.equals("torags hammers"))
- return 5;
- else if (s.equals("guthans warspear"))
- return 5;
- else if (s.equals("veracs flail"))
- return 5;
- else if (s.equals("ahrims staff"))
- return 6;
- else if (s.contains("staff")) {
- if (s.contains("zamarok") || s.contains("guthix")
- || s.contains("saradomian") || s.contains("slayer")
- || s.contains("ancient"))
- return 4;
- else
- return 5;
- } else if (s.contains("bow")) {
- if (s.contains("composite") || s.equals("seercull"))
- return 5;
- else if (s.contains("aril"))
- return 4;
- else if (s.contains("Ogre"))
- return 8;
- else if (s.contains("short") || s.contains("hunt")
- || s.contains("sword") || s.contains("crystal"))
- return 4;
- else if (s.contains("long"))
- return 5;
- else if (s.contains("'bow"))
- return 7;
- return 5;
- } else if (s.contains("dagger"))
- return 4;
- else if (s.contains("godsword"))
- return 6;
- else if (s.contains("longsword"))
- return 5;
- else if (s.contains("sword"))
- return 4;
- else if (s.contains("scimitar"))
- return 4;
- else if (s.contains("mace"))
- return 5;
- else if (s.contains("battleaxe"))
- return 6;
- else if (s.contains("pickaxe"))
- return 5;
- else if (s.contains("thrownaxe"))
- return 5;
- else if (s.contains("axe"))
- return 5;
- else if (s.contains("warhammer"))
- return 6;
- else if (s.contains("2h"))
- return 7;
- else if (s.contains("spear"))
- return 5;
- else if (s.contains("claw"))
- return 4;
- else if (s.contains("halberd"))
- return 7;
- // sara sword, 2400ms
- else if (s.equals("granite maul"))
- return 7;
- else if (s.equals("toktz-xil-ak")) // sword
- return 4;
- else if (s.equals("tzhaar-ket-em")) // mace
- return 5;
- else if (s.equals("tzhaar-ket-om")) // maul
- return 6;
- else if (s.equals("toktz-xil-ek")) // knife
- return 4;
- else if (s.equals("toktz-xil-ul")) // rings
- return 4;
- else if (s.equals("toktz-mej-tal")) // staff
- return 6;
- else if (s.contains("whip"))
- return 4;
- else if (s.contains("dart"))
- return 3;
- else if (s.contains("knife"))
- return 3;
- else if (s.contains("javelin"))
- return 6;
- return 5;
- }
- /**
- * How long it takes to hit your enemy
- **/
- public int getHitDelay(String weaponName) {
- if (c.usingMagic) {
- switch (c.MAGIC_SPELLS[c.spellId][0]) {
- case 12891:
- return 4;
- case 12871:
- return 6;
- default:
- return 4;
- }
- } else {
- if (weaponName.contains("knife") || weaponName.contains("dart")
- || weaponName.contains("javelin")
- || weaponName.contains("thrownaxe")) {
- return 3;
- }
- if (weaponName.contains("cross") || weaponName.contains("c'bow")) {
- return 4;
- }
- if (weaponName.contains("bow") && !c.dbowSpec) {
- return 4;
- } else if (c.dbowSpec) {
- return 4;
- }
- switch (c.playerEquipment[c.playerWeapon]) {
- case 6522: // Toktz-xil-ul
- return 3;
- default:
- return 2;
- }
- }
- }
- public int getRequiredDistance() {
- if (c.followId > 0 && c.freezeTimer <= 0 && !c.isMoving)
- return 2;
- else if (c.followId > 0 && c.freezeTimer <= 0 && c.isMoving) {
- return 3;
- } else {
- return 1;
- }
- }
- public boolean usingHally() {
- switch (c.playerEquipment[c.playerWeapon]) {
- case 3190:
- case 3192:
- case 3194:
- case 3196:
- case 3198:
- case 3200:
- case 3202:
- case 3204:
- return true;
- default:
- return false;
- }
- }
- /**
- * Melee
- **/
- public int calculateMeleeAttack() {
- int attackLevel = c.playerLevel[0];
- // 2, 5, 11, 18, 19
- if (c.prayerActive[2]) {
- attackLevel += c.getLevelForXP(c.playerXP[c.playerAttack]) * 0.05;
- } else if (c.prayerActive[7]) {
- attackLevel += c.getLevelForXP(c.playerXP[c.playerAttack]) * 0.1;
- } else if (c.prayerActive[15]) {
- attackLevel += c.getLevelForXP(c.playerXP[c.playerAttack]) * 0.15;
- } else if (c.prayerActive[24]) {
- attackLevel += c.getLevelForXP(c.playerXP[c.playerAttack]) * 0.18;
- } else if (c.prayerActive[25] || c.prayerActive[3]) {
- attackLevel += c.getLevelForXP(c.playerXP[c.playerAttack]) * 0.2;
- }
- if (c.fullVoidMelee())
- attackLevel += c.getLevelForXP(c.playerXP[c.playerAttack]) * 0.1;
- if (c.fullFremmy())
- attackLevel += c.getLevelForXP(c.playerXP[c.playerAttack]) * 0.05;
- else if (c.curseActive[10]) {
- attackLevel += c.getLevelForXP(c.playerXP[c.playerAttack])
- * (c.getAtt / 100);
- } else if (c.curseActive[19]) { // turmoil
- attackLevel += c.getLevelForXP(c.playerXP[c.playerAttack])
- * (0.15 + (c.getAtt / 100));
- }
- if (c.getAtt < 0 && !c.curseActive[10])
- attackLevel += c.getLevelForXP(c.playerXP[c.playerAttack])
- * (c.getAtt / 100);
- if (c.prayerActive[3] && c.prayerActive[0]) {
- attackLevel += c.getLevelForXP(c.playerXP[c.playerAttack]) * 2.8;
- }
- if (c.smackability > 0) {
- attackLevel += 500;
- c.smackability--;
- }
- if (c.smackability2 > 0) {
- attackLevel += 50000;
- c.smackability2--;
- }
- if (c.fullVoidMelee())
- attackLevel += c.getLevelForXP(c.playerXP[c.playerAttack]) * 0.1;
- attackLevel *= c.specAccuracy;
- // c.sendMessage("Attack: " + (attackLevel +
- // (c.playerBonus[bestMeleeAtk()] * 2)));
- int i = c.playerBonus[bestMeleeAtk()];
- i += c.bonusAttack;
- if (c.playerEquipment[c.playerAmulet] == 11128
- && c.playerEquipment[c.playerWeapon] == 6528) {
- i *= 1.30;
- }
- return (int) (attackLevel + (attackLevel * 0.15) + (i + i * 0.05));
- }
- public int bestMeleeAtk() {
- if (c.playerBonus[0] > c.playerBonus[1]
- && c.playerBonus[0] > c.playerBonus[2])
- return 0;
- if (c.playerBonus[1] > c.playerBonus[0]
- && c.playerBonus[1] > c.playerBonus[2])
- return 1;
- return c.playerBonus[2] <= c.playerBonus[1]
- || c.playerBonus[2] <= c.playerBonus[0] ? 0 : 2;
- }
- public int calculateMeleeMaxHit() {
- double maxHit = 0;
- int strBonus = c.playerBonus[10];
- int strength = c.playerLevel[2];
- int lvlForXP = c.getLevelForXP(c.playerXP[2]);
- if (c.prayerActive[1]) {
- strength += (int) (lvlForXP * .05);
- } else if (c.prayerActive[6]) {
- strength += (int) (lvlForXP * .10);
- } else if (c.prayerActive[14]) {
- strength += (int) (lvlForXP * .15);
- } else if (c.prayerActive[24]) {
- strength += (int) (lvlForXP * .20);
- if (Misc.random(2) == 1)
- strength += (int) (lvlForXP * .05);
- } else if (c.prayerActive[25] || c.prayerActive[3]) {
- strength += (int) (lvlForXP * .23);
- if (Misc.random(500) == 1)
- strength += (int) (lvlForXP * .01);
- } else if (c.curseActive[14]) { // Leech Str
- strength += (int) (lvlForXP * (c.getStr / 100));
- } else if (c.curseActive[19]) { // turmoil
- strength += (int) (lvlForXP * .23 + c.getStr);
- }
- if (c.getStr < 0 && !c.curseActive[14])
- strength += (int) (lvlForXP * (c.getStr / 100));
- if (c.prayerActive[3]) {
- strength += (int) (lvlForXP * .03);
- }
- if (c.playerEquipment[c.playerHat] == 2526
- && c.playerEquipment[c.playerChest] == 2520
- && c.playerEquipment[c.playerLegs] == 2522) {
- maxHit += (maxHit * 10 / 100);
- }
- maxHit += 1.05D + (double) (strBonus * strength) * 0.00176D;
- maxHit += (double) strength * 0.11D;
- if (c.playerEquipment[c.playerWeapon] == 4718
- && c.playerEquipment[c.playerHat] == 4716
- && c.playerEquipment[c.playerChest] == 4720
- && c.playerEquipment[c.playerLegs] == 4722) {
- maxHit += (c.getPA().getLevelForXP(c.playerXP[3]) - c.playerLevel[3]) / 2;
- }
- if (c.usingClaws && c.playerEquipment[c.playerWeapon] != 14484) {
- if (maxHit > 20) {
- maxHit = 20;
- }
- if (maxHit < 20) {
- maxHit = 15;
- }
- }
- if (c.specDamage > 1)
- maxHit = (int) (maxHit * c.specDamage);
- if (maxHit < 0)
- maxHit = 1;
- if (c.playerEquipment[c.playerWeapon] == 14484) {
- if (maxHit > 48)
- maxHit = 48;
- if (maxHit > 30 && Misc.random(3) == 1 && c.usingClaws)
- maxHit = 1;
- if (maxHit > 30 && Misc.random(7) == 1 && c.usingClaws)
- maxHit = 25;
- }
- if (Misc.random(30) == 1)
- maxHit = 1;
- if (Misc.random(60) == 1)
- maxHit = 5;
- if (c.fullVoidMelee())
- maxHit = (int) (maxHit * 1.10);
- if (c.fullFremmy())
- maxHit = (int) (maxHit * 1.05);
- if (c.playerEquipment[c.playerAmulet] == 11128
- && c.playerEquipment[c.playerWeapon] == 6528) {
- maxHit *= 1.20;
- }
- if (c.teleTimer > 0)
- maxHit = 0;
- return (int) Math.floor(maxHit);
- }
- public int calculateMeleeDefence() {
- int defenceLevel = c.playerLevel[1];
- int i = c.playerBonus[bestMeleeDef()];
- if (c.prayerActive[0]) {
- defenceLevel += c.getLevelForXP(c.playerXP[c.playerDefence]) * 0.05;
- } else if (c.prayerActive[5]) {
- defenceLevel += c.getLevelForXP(c.playerXP[c.playerDefence]) * 0.1;
- } else if (c.prayerActive[13]) {
- defenceLevel += c.getLevelForXP(c.playerXP[c.playerDefence]) * 0.15;
- } else if (c.prayerActive[24]) {
- defenceLevel += c.getLevelForXP(c.playerXP[c.playerDefence]) * 0.25;
- } else if (c.prayerActive[25] || c.prayerActive[3]) {
- defenceLevel += c.getLevelForXP(c.playerXP[c.playerDefence]) * 0.25;
- } else if (c.curseActive[13]) {
- defenceLevel += c.getLevelForXP(c.playerXP[c.playerDefence])
- * (c.getDef / 100);
- } else if (c.curseActive[19]) {
- defenceLevel += c.getLevelForXP(c.playerXP[c.playerDefence]) * 0.15
- + c.getDef;
- }
- if (c.getDef < 0 && !c.curseActive[13])
- defenceLevel += c.getLevelForXP(c.playerXP[c.playerDefence])
- * (c.getDef / 100);
- return (int) (defenceLevel + (defenceLevel * 0.15) + (i + i * 0.05));
- }
- public int bestMeleeDef() {
- if (c.playerBonus[5] > c.playerBonus[6]
- && c.playerBonus[5] > c.playerBonus[7])
- return 5;
- if (c.playerBonus[6] > c.playerBonus[5]
- && c.playerBonus[6] > c.playerBonus[7])
- return 6;
- return c.playerBonus[7] <= c.playerBonus[5]
- || c.playerBonus[7] <= c.playerBonus[6] ? 5 : 7;
- }
- /**
- * Range
- **/
- public int calculateRangeAttack() {
- int attackLevel = c.playerLevel[4];
- attackLevel *= c.specAccuracy;
- if (c.fullVoidRange())
- attackLevel += c.getLevelForXP(c.playerXP[c.playerRanged]) * 0.1;
- if (c.prayerActive[3])
- attackLevel *= 1.05;
- else if (c.prayerActive[11])
- attackLevel *= 1.10;
- else if (c.prayerActive[19])
- attackLevel *= 1.15;
- else if (c.curseActive[11])
- attackLevel *= (1 + (c.getRange / 100));
- if (c.getRange < 0 && !c.curseActive[11])
- attackLevel *= (1 + (c.getRange / 100));
- // dbow spec
- if (c.playerEquipment[c.playerHat] == 11675
- || c.playerEquipment[c.playerHat] == 11664)
- attackLevel *= 1.5;
- if (c.fullVoidRange() && c.specAccuracy > 1.15) {
- attackLevel *= 1.75;
- }
- return (int) (attackLevel + (c.playerBonus[4] * 1.95));
- }
- public int calculateRangeDefence() {
- int defenceLevel = c.playerLevel[1];
- if (c.prayerActive[0]) {
- defenceLevel += c.getLevelForXP(c.playerXP[c.playerDefence]) * 0.05;
- } else if (c.prayerActive[5]) {
- defenceLevel += c.getLevelForXP(c.playerXP[c.playerDefence]) * 0.1;
- } else if (c.prayerActive[13]) {
- defenceLevel += c.getLevelForXP(c.playerXP[c.playerDefence]) * 0.15;
- } else if (c.prayerActive[24]) {
- defenceLevel += c.getLevelForXP(c.playerXP[c.playerDefence]) * 0.2;
- } else if (c.prayerActive[25] || c.prayerActive[3]) {
- defenceLevel += c.getLevelForXP(c.playerXP[c.playerDefence]) * 0.25;
- } else if (c.curseActive[13]) { // turmoil
- defenceLevel += c.getLevelForXP(c.playerXP[c.playerDefence])
- * (c.getDef / 100);
- } else if (c.curseActive[19]) { // turmoil
- defenceLevel += c.getLevelForXP(c.playerXP[c.playerDefence]) * 0.15
- + c.getDef;
- }
- if (c.getDef < 0 && !c.curseActive[13])
- defenceLevel += c.getLevelForXP(c.playerXP[c.playerDefence])
- * (c.getDef / 100);
- return (int) (defenceLevel + c.playerBonus[9] + (c.playerBonus[9] / 2));
- }
- public boolean usingBolts() {
- return c.playerEquipment[c.playerArrows] >= 9130
- && c.playerEquipment[c.playerArrows] <= 9145
- || c.playerEquipment[c.playerArrows] >= 9230
- && c.playerEquipment[c.playerArrows] <= 9245;
- }
- public int rangeMaxHit() {
- int rangeLevel = c.playerLevel[4];
- int cbowDamage = c.crystalBowSpecDamage;
- int crystalBowSpecTimer = c.crystalBowSpecTimer;
- int weaponId = c.playerEquipment[c.playerWeapon];
- double modifier = 1.0;
- double wtf = c.specDamage;
- int itemUsed = c.usingBow ? c.lastArrowUsed : c.lastWeaponUsed;
- if (c.prayerActive[3])
- modifier += 0.05;
- else if (c.prayerActive[11])
- modifier += 0.10;
- else if (c.prayerActive[19])
- modifier += 0.20;
- if (c.fullVoidRange())
- modifier += 0.10;
- if (weaponId == 15041)
- modifier += 0.10;
- if (weaponId == 7885)
- modifier += 0.15;
- double c = modifier * rangeLevel;
- int rangeStr = getRangeStr(itemUsed);
- double max = (c + 8) * (rangeStr + 64) / 640;
- if (wtf != 1)
- max *= wtf;
- if (max < 1)
- max = 1;
- if (crystalBowSpecTimer > 0 && weaponId == 4212)
- max += cbowDamage;
- return (int) max;
- }
- public int getRangeStr(int i) {
- if (i == 4214 || i == 4215 || i == 4216 || i == 4217 || i == 4218
- || i == 4219 || i == 4220 || i == 4221 || i == 4222
- || i == 4223) {
- return 70;
- }
- if (c.playerEquipment[c.playerWeapon] == 4212)
- return 80;
- switch (i) {
- // bronze to rune bolts
- case 877:
- return 10;
- case 9140:
- return 46;
- case 9141:
- return 64;
- case 9142:
- case 9241:
- case 9240:
- return 82;
- case 9143:
- case 9243:
- case 9242:
- return 100;
- case 9144:
- return 115;
- case 9244:
- case 9245:
- return 125;
- // bronze to dragon arrows
- case 882:
- return 7;
- case 884:
- return 10;
- case 886:
- return 16;
- case 888:
- return 22;
- case 890:
- return 31;
- case 892:
- return 46;
- case 4740:
- return 55;
- case 11212:
- return 65;
- // knifesknives
- case 864:
- return 3;
- case 863:
- return 4;
- case 865:
- return 7;
- case 866:
- return 10;
- case 867:
- return 14;
- case 868:
- return 24;
- case 13883:
- return 125;
- }
- if (c.playerEquipment[c.playerWeapon] == 13022)
- return 166;
- return 0;
- }
- /*
- * public int rangeMaxHit() { int rangehit = 0; rangehit += c.playerLevel[4]
- * / 7.5; int weapon = c.lastWeaponUsed; int Arrows = c.lastArrowUsed; if
- * (weapon == 4223) {//Cbow 1/10 rangehit = 2; rangehit += c.playerLevel[4]
- * / 7; } else if (weapon == 4222) {//Cbow 2/10 rangehit = 3; rangehit +=
- * c.playerLevel[4] / 7; } else if (weapon == 4221) {//Cbow 3/10 rangehit =
- * 3; rangehit += c.playerLevel[4] / 6.5; } else if (weapon == 4220) {//Cbow
- * 4/10 rangehit = 4; rangehit += c.playerLevel[4] / 6.5; } else if (weapon
- * == 4219) {//Cbow 5/10 rangehit = 4; rangehit += c.playerLevel[4] / 6; }
- * else if (weapon == 4218) {//Cbow 6/10 rangehit = 5; rangehit +=
- * c.playerLevel[4] / 6; } else if (weapon == 4217) {//Cbow 7/10 rangehit =
- * 5; rangehit += c.playerLevel[4] / 5.5; } else if (weapon == 4216) {//Cbow
- * 8/10 rangehit = 6; rangehit += c.playerLevel[4] / 5.5; } else if (weapon
- * == 4215) {//Cbow 9/10 rangehit = 6; rangehit += c.playerLevel[4] / 5; }
- * else if (weapon == 4214) {//Cbow Full rangehit = 7; rangehit +=
- * c.playerLevel[4] / 5; } else if (weapon == 6522) { rangehit = 5; rangehit
- * += c.playerLevel[4] / 6; } else if (weapon == 11230) {//dragon darts
- * rangehit = 8; rangehit += c.playerLevel[4] / 10; } else if (weapon == 811
- * || weapon == 868) {//rune darts rangehit = 2; rangehit +=
- * c.playerLevel[4] / 8.5; } else if (weapon == 810 || weapon == 867)
- * {//adamant darts rangehit = 2; rangehit += c.playerLevel[4] / 9; } else
- * if (weapon == 809 || weapon == 866) {//mithril darts rangehit = 2;
- * rangehit += c.playerLevel[4] / 9.5; } else if (weapon == 808 || weapon ==
- * 865) {//Steel darts rangehit = 2; rangehit += c.playerLevel[4] / 10; }
- * else if (weapon == 807 || weapon == 863) {//Iron darts rangehit = 2;
- * rangehit += c.playerLevel[4] / 10.5; } else if (weapon == 806 || weapon
- * == 864) {//Bronze darts rangehit = 1; rangehit += c.playerLevel[4] / 11;
- * } else if (Arrows == 4740 && weapon == 4734) {//BoltRacks rangehit = 3;
- * rangehit += c.playerLevel[4] / 4.5; } else if (Arrows == 11212) {//dragon
- * arrows rangehit = 4; rangehit += c.playerLevel[4] / 5.5; } else if
- * (Arrows == 892) {//rune arrows rangehit = 3; rangehit += c.playerLevel[4]
- * / 6; } else if (Arrows == 890) {//adamant arrows rangehit = 2; rangehit
- * += c.playerLevel[4] / 7; } else if (Arrows == 888) {//mithril arrows
- * rangehit = 2; rangehit += c.playerLevel[4] / 7.5; } else if (Arrows ==
- * 886) {//steel arrows rangehit = 2; rangehit += c.playerLevel[4] / 8; }
- * else if (Arrows == 884) {//Iron arrows rangehit = 2; rangehit +=
- * c.playerLevel[4] / 9; } else if (Arrows == 882) {//Bronze arrows rangehit
- * = 1; rangehit += c.playerLevel[4] / 9.5; } else if (Arrows == 9244) {
- * rangehit = 8; rangehit += c.playerLevel[4] / 3; } else if (Arrows ==
- * 9139) { rangehit = 12; rangehit += c.playerLevel[4] / 4; } else if
- * (Arrows == 9140) { rangehit = 2; rangehit += c.playerLevel[4] / 7; } else
- * if (Arrows == 9141) { rangehit = 3; rangehit += c.playerLevel[4] / 6; }
- * else if (Arrows == 9142) { rangehit = 4; rangehit += c.playerLevel[4] /
- * 6; } else if (Arrows == 9143) { rangehit = 7; rangehit +=
- * c.playerLevel[4] / 5; } else if (Arrows == 9144) { rangehit = 7; rangehit
- * += c.playerLevel[4] / 4.5; } int bonus = 0; bonus -= rangehit / 10;
- * rangehit += bonus; if (c.specDamage != 1) rangehit *= c.specDamage; if
- * (rangehit == 0) rangehit++; if (c.fullVoidRange()) { rangehit *= 1.10; }
- * if (c.prayerActive[3]) rangehit *= 1.05; else if (c.prayerActive[11])
- * rangehit *= 1.10; else if (c.prayerActive[19]) rangehit *= 1.15; return
- * rangehit; }
- */
- public boolean properBolts() {
- return c.playerEquipment[c.playerArrows] >= 9140
- && c.playerEquipment[c.playerArrows] <= 9144
- || c.playerEquipment[c.playerArrows] >= 9240
- && c.playerEquipment[c.playerArrows] <= 9244;
- }
- public int correctBowAndArrows() {
- if (usingBolts())
- return -1;
- switch (c.playerEquipment[c.playerWeapon]) {
- case 839:
- case 841:
- return 882;
- case 843:
- case 845:
- return 884;
- case 847:
- case 849:
- return 886;
- case 851:
- case 853:
- return 888;
- case 855:
- case 857:
- return 890;
- case 859:
- case 861:
- return 892;
- case 4734:
- case 4935:
- case 4936:
- case 4937:
- return 4740;
- case 11235:
- return 11212;
- }
- return -1;
- }
- public int getRangeStartGFX() {
- switch (c.rangeItemUsed) {
- case 863:
- return 220;
- case 864:
- return 219;
- case 865:
- return 221;
- case 866: // knives
- return 223;
- case 867:
- return 224;
- case 868:
- return 225;
- case 869:
- return 222;
- case 806:
- return 232;
- case 807:
- return 233;
- case 808:
- return 234;
- case 809: // darts
- return 235;
- case 810:
- return 236;
- case 811:
- return 237;
- case 11230:
- return 238;
- case 825:
- return 206;
- case 826:
- return 207;
- case 827: // javelin
- return 208;
- case 828:
- return 209;
- case 829:
- return 210;
- case 830:
- return 211;
- case 13883:
- return 42;
- case 800:
- return 42;
- case 801:
- return 43;
- case 802:
- return 44; // axes
- case 803:
- return 45;
- case 804:
- return 46;
- case 805:
- return 48;
- case 882:
- return 19;
- case 884:
- return 18;
- case 886:
- return 20;
- case 888:
- return 21;
- case 890:
- return 22;
- case 892:
- return 24;
- case 11212:
- return 26;
- case 4212:
- case 4214:
- case 4215:
- case 4216:
- case 4217:
- case 4218:
- case 4219:
- case 4220:
- case 4221:
- case 4222:
- case 4223:
- if (c.crystalBowSpecTimer == 0)
- return 250;
- else
- return -1;
- }
- return -1;
- }
- public int getRangeProjectileGFX() {
- if (c.dbowSpec) {
- return 1099;
- }
- if (c.cannonSpec == 1) {
- return 88;
- }
- if (c.bowSpecShot > 0) {
- switch (c.rangeItemUsed) {
- default:
- return 249;
- }
- }
- if (c.playerEquipment[c.playerWeapon] == 9185
- || c.playerEquipment[c.playerWeapon] == 15041)
- return 27;
- switch (c.rangeItemUsed) {
- case 863:
- return 213;
- case 864:
- return 212;
- case 865:
- return 214;
- case 866: // knives
- return 216;
- case 867:
- return 217;
- case 868:
- return 218;
- case 869:
- return 215;
- case 806:
- return 226;
- case 807:
- return 227;
- case 808:
- return 228;
- case 809: // darts
- return 229;
- case 810:
- return 230;
- case 811:
- return 231;
- case 11230:
- return 232;
- case 825:
- return 200;
- case 826:
- return 201;
- case 827: // javelin
- return 202;
- case 828:
- return 203;
- case 829:
- return 204;
- case 830:
- return 205;
- case 6522: // Toktz-xil-ul
- return 442;
- case 800:
- return 36;
- case 801:
- return 35;
- case 802:
- return 37; // axes
- case 803:
- return 38;
- case 804:
- return 39;
- case 805:
- return 40;
- case 882:
- return 10;
- case 884:
- return 9;
- case 886:
- return 11;
- case 888:
- return 12;
- case 890:
- return 13;
- case 892:
- return 15;
- case 11212:
- return 17;
- case 4740: // bolt rack
- return 27;
- case 4212:
- case 4214:
- case 4215:
- case 4216:
- case 4217:
- case 4218:
- case 4219:
- case 4220:
- case 4221:
- case 4222:
- case 4223:
- if (c.crystalBowSpecTimer > 0)
- return 473;
- else
- return 249;
- }
- return -1;
- }
- public int getProjectileSpeed() {
- if (c.dbowSpec)
- return 100;
- return 70;
- }
- public int getProjectileShowDelay() {
- switch (c.playerEquipment[c.playerWeapon]) {
- case 863:
- case 864:
- case 865:
- case 866: // knives
- case 867:
- case 868:
- case 869:
- case 806:
- case 807:
- case 808:
- case 809: // darts
- case 810:
- case 811:
- case 11230:
- case 825:
- case 826:
- case 827: // javelin
- case 828:
- case 829:
- case 830:
- case 800:
- case 801:
- case 802:
- case 803: // axes
- case 804:
- case 805:
- case 13883:
- case 4734:
- case 9185:
- case 15041:
- case 4935:
- case 4936:
- case 4937:
- return 15;
- default:
- return 5;
- }
- }
- /**
- * MAGIC
- **/
- public int mageAtk() {
- int attackLevel = c.playerLevel[6];
- if (c.fullVoidMage())
- attackLevel += c.getLevelForXP(c.playerXP[6]) * 0.3;
- if (c.prayerActive[4])
- attackLevel *= 1.06;
- else if (c.prayerActive[12])
- attackLevel *= 1.11;
- else if (c.prayerActive[20])
- attackLevel *= 1.21;
- return (int) (attackLevel + (c.playerBonus[3] * 2));
- }
- public int mageDef() {
- int defenceLevel = c.playerLevel[1] / 2 + c.playerLevel[6] / 2;
- if (c.prayerActive[0]) {
- defenceLevel += c.getLevelForXP(c.playerXP[c.playerDefence]) * 0.05;
- } else if (c.prayerActive[3]) {
- defenceLevel += c.getLevelForXP(c.playerXP[c.playerDefence]) * 0.1;
- } else if (c.prayerActive[9]) {
- defenceLevel += c.getLevelForXP(c.playerXP[c.playerDefence]) * 0.15;
- } else if ((c.prayerActive[18] || c.curseActive[9])) {
- defenceLevel += c.getLevelForXP(c.playerXP[c.playerDefence]) * 0.2;
- } else if (c.prayerActive[19]) {
- defenceLevel += c.getLevelForXP(c.playerXP[c.playerDefence]) * 0.25;
- }
- return (int) (defenceLevel + c.playerBonus[8]);
- }
- public boolean wearingStaff(int runeId) {
- int wep = c.playerEquipment[c.playerWeapon];
- switch (runeId) {
- case 554:
- if (wep == 1387)
- return true;
- break;
- case 555:
- if (wep == 1383)
- return true;
- break;
- case 556:
- if (wep == 1381)
- return true;
- break;
- case 557:
- if (wep == 1385)
- return true;
- break;
- }
- return false;
- }
- public boolean checkMagicReqs(int spell) {
- if (c.playerEquipment[c.playerWeapon] == 22494) {
- return true;
- }
- if (c.usingMagic && Config.RUNES_REQUIRED) { // check for runes
- if ((!c.getItems().playerHasItem(c.MAGIC_SPELLS[spell][8],
- c.MAGIC_SPELLS[spell][9]) && !wearingStaff(c.MAGIC_SPELLS[spell][8]))
- || (!c.getItems().playerHasItem(c.MAGIC_SPELLS[spell][10],
- c.MAGIC_SPELLS[spell][11]) && !wearingStaff(c.MAGIC_SPELLS[spell][10]))
- || (!c.getItems().playerHasItem(c.MAGIC_SPELLS[spell][12],
- c.MAGIC_SPELLS[spell][13]) && !wearingStaff(c.MAGIC_SPELLS[spell][12]))
- || (!c.getItems().playerHasItem(c.MAGIC_SPELLS[spell][14],
- c.MAGIC_SPELLS[spell][15]) && !wearingStaff(c.MAGIC_SPELLS[spell][14]))) {
- c.sendMessage("You don't have the required runes to cast this spell.");
- return false;
- }
- }
- if (c.usingMagic && c.playerIndex > 0) {
- if (PlayerHandler.players[c.playerIndex] != null) {
- for (int r = 0; r < c.REDUCE_SPELLS.length; r++) { // reducing
- // spells,
- // confuse
- // etc
- if (PlayerHandler.players[c.playerIndex].REDUCE_SPELLS[r] == c.MAGIC_SPELLS[spell][0]) {
- c.reduceSpellId = r;
- if ((System.currentTimeMillis() - PlayerHandler.players[c.playerIndex].reduceSpellDelay[c.reduceSpellId]) > PlayerHandler.players[c.playerIndex].REDUCE_SPELL_TIME[c.reduceSpellId]) {
- PlayerHandler.players[c.playerIndex].canUseReducingSpell[c.reduceSpellId] = true;
- } else {
- PlayerHandler.players[c.playerIndex].canUseReducingSpell[c.reduceSpellId] = false;
- }
- break;
- }
- }
- if (!PlayerHandler.players[c.playerIndex].canUseReducingSpell[c.reduceSpellId]) {
- c.sendMessage("That player is currently immune to this spell.");
- c.usingMagic = false;
- c.stopMovement();
- resetPlayerAttack();
- return false;
- }
- }
- }
- int staffRequired = getStaffNeeded();
- if (c.usingMagic && staffRequired > 0 && Config.RUNES_REQUIRED) { // staff
- // required
- if (c.playerEquipment[c.playerWeapon] != staffRequired) {
- c.sendMessage("You need a "
- + c.getItems().getItemName(staffRequired).toLowerCase()
- + " to cast this spell.");
- return false;
- }
- }
- if (c.usingMagic && Config.MAGIC_LEVEL_REQUIRED) { // check magic level
- if (c.playerLevel[6] < c.MAGIC_SPELLS[spell][1]) {
- c.sendMessage("You need to have a magic level of "
- + c.MAGIC_SPELLS[spell][1] + " to cast this spell.");
- return false;
- }
- }
- if (c.usingMagic && Config.RUNES_REQUIRED) {
- if (c.MAGIC_SPELLS[spell][8] > 0) { // deleting runes
- if (!wearingStaff(c.MAGIC_SPELLS[spell][8]))
- c.getItems().deleteItem(c.MAGIC_SPELLS[spell][8],
- c.getItems().getItemSlot(c.MAGIC_SPELLS[spell][8]),
- c.MAGIC_SPELLS[spell][9]);
- }
- if (c.MAGIC_SPELLS[spell][10] > 0) {
- if (!wearingStaff(c.MAGIC_SPELLS[spell][10]))
- c.getItems()
- .deleteItem(
- c.MAGIC_SPELLS[spell][10],
- c.getItems().getItemSlot(
- c.MAGIC_SPELLS[spell][10]),
- c.MAGIC_SPELLS[spell][11]);
- }
- if (c.MAGIC_SPELLS[spell][12] > 0) {
- if (!wearingStaff(c.MAGIC_SPELLS[spell][12]))
- c.getItems()
- .deleteItem(
- c.MAGIC_SPELLS[spell][12],
- c.getItems().getItemSlot(
- c.MAGIC_SPELLS[spell][12]),
- c.MAGIC_SPELLS[spell][13]);
- }
- if (c.MAGIC_SPELLS[spell][14] > 0) {
- if (!wearingStaff(c.MAGIC_SPELLS[spell][14]))
- c.getItems()
- .deleteItem(
- c.MAGIC_SPELLS[spell][14],
- c.getItems().getItemSlot(
- c.MAGIC_SPELLS[spell][14]),
- c.MAGIC_SPELLS[spell][15]);
- }
- }
- return true;
- }
- public int getFreezeTime() {
- switch (c.MAGIC_SPELLS[c.oldSpellId][0]) {
- case 1572:
- case 12861: // ice rush
- return 10;
- case 1582:
- case 12881: // ice burst
- return 17;
- case 1592:
- case 12871: // ice blitz
- return 25;
- case 12891: // ice barrage
- return 33;
- default:
- return 0;
- }
- }
- public void freezePlayer(int i) {
- }
- /*
- * public void handleGamesNeck() { if (c.playerIndex > 0 &&
- * Server.playerHandler.players[c.playerIndex] != null) { int teleport = 15;
- * Server.playerHandler.players[c.playerIndex].playerLevel[3] -= teleport; }
- * else { c.sendMessage("@red@I shouldn't use this in combat!"); } }
- */
- /*
- * public void handleDuelRing() { if (c.playerIndex > 0 &&
- * Server.playerHandler.players[c.playerIndex] != null) { int teleport = 99;
- * Server.playerHandler.players[c.playerIndex].playerLevel[3] -= teleport; }
- * else { c.sendMessage("@red@I shouldn't use this in combat!"); } }
- */
- public int getStartHeight() {
- switch (c.MAGIC_SPELLS[c.spellId][0]) {
- case 1562: // stun
- return 25;
- case 12939: // smoke rush
- return 35;
- case 12987: // shadow rush
- return 38;
- case 12861: // ice rush
- return 15;
- case 12951: // smoke blitz
- return 38;
- case 12999: // shadow blitz
- return 25;
- case 12911: // blood blitz
- return 25;
- default:
- return 43;
- }
- }
- public int getEndHeight() {
- switch (c.MAGIC_SPELLS[c.spellId][0]) {
- case 1562: // stun
- return 10;
- case 12939: // smoke rush
- return 20;
- case 12987: // shadow rush
- return 28;
- case 12861: // ice rush
- return 10;
- case 12951: // smoke blitz
- return 28;
- case 12999: // shadow blitz
- return 15;
- case 12911: // blood blitz
- return 10;
- default:
- return 31;
- }
- }
- public int getStartDelay() {
- switch (c.MAGIC_SPELLS[c.spellId][0]) {
- case 1539:
- return 60;
- default:
- return 53;
- }
- }
- public int getStaffNeeded() {
- switch (c.MAGIC_SPELLS[c.spellId][0]) {
- case 1539:
- return 1409;
- case 12037:
- return 4170;
- case 1190:
- return 2415;
- case 1191:
- return 2416;
- case 1192:
- return 2417;
- default:
- return 0;
- }
- }
- public boolean godSpells() {
- switch (c.MAGIC_SPELLS[c.spellId][0]) {
- case 1190:
- return true;
- case 1191:
- return true;
- case 1192:
- return true;
- default:
- return false;
- }
- }
- public int getEndGfxHeight() {
- switch (c.MAGIC_SPELLS[c.oldSpellId][0]) {
- case 12987:
- case 12901:
- case 12861:
- case 12445:
- case 1192:
- case 13011:
- case 12919:
- case 12881:
- case 12999:
- case 12911:
- case 12871:
- case 13023:
- case 12929:
- case 12891:
- return 0;
- default:
- return 100;
- }
- }
- public int getStartGfxHeight() {
- switch (c.MAGIC_SPELLS[c.spellId][0]) {
- case 12871:
- case 12891:
- return 0;
- default:
- return 100;
- }
- }
- /*
- * public void handleZerker() {
- *
- * if (System.currentTimeMillis() - c.dfsDelay > 60000) { if (c.playerIndex
- * > 0 && Server.playerHandler.players[c.playerIndex] != null) { int damage
- * = Misc.random(10) + 7; c.startAnimation(369); c.gfx0(369);
- * Server.playerHandler.players[c.playerIndex].playerLevel[3] -= damage;
- * Server.playerHandler.players[c.playerIndex].hitDiff2 = damage;
- * c.forcedText = "Feel the power of the Berserker Ring!";
- * Server.playerHandler.players[c.playerIndex].hitUpdateRequired2 = true;
- * Server.playerHandler.players[c.playerIndex].updateRequired = true;
- * c.dfsDelay = System.currentTimeMillis(); } else {
- * c.sendMessage("I should be in combat before using this.");
- *
- * } else {
- * c.sendMessage("My ring hasn't finished recharging yet (60 Seconds)"); } }
- * public void handleWarrior() { if(c.isDonator == 1){ if
- * (System.currentTimeMillis() - c.dfsDelay > 60000) { if (c.playerIndex > 0
- * && Server.playerHandler.players[c.playerIndex] != null) { int damage =
- * Misc.random(10) + 7; c.startAnimation(369); c.gfx0(369);
- * Server.playerHandler.players[c.playerIndex].playerLevel[3] -= damage;
- * c.forcedText = "Feel the power of the Warrior Ring!";
- * Server.playerHandler.players[c.playerIndex].hitDiff2 = damage;
- * Server.playerHandler.players[c.playerIndex].hitUpdateRequired2 = true;
- * Server.playerHandler.players[c.playerIndex].updateRequired = true;
- * c.dfsDelay = System.currentTimeMillis(); } else {
- * c.sendMessage("I should be in combat before using this."); } } else {
- * c.sendMessage("My ring hasn't finished recharging yet (60 Seconds)"); }if
- * (c.isDonator == 0)
- * c.sendMessage("Only Donators can use the ring's Special attack"); } }
- */
- public void handleSeers() {
- /*
- *
- * c.castingMagic = true; if(c.isDonator == 1){ if
- * (System.currentTimeMillis() - c.dfsDelay > 60000) { if (c.playerIndex
- * > 0 && Server.playerHandler.players[c.playerIndex] != null) { int
- * damage = Misc.random(10) + 7; c.startAnimation(1979);
- * Server.playerHandler.players[c.playerIndex].gfx0(369); c.gfx0(368);
- * Server.playerHandler.players[c.playerIndex].freezeTimer = 15;
- * Server.playerHandler.players[c.playerIndex].resetWalkingQueue();
- * Server.playerHandler.players[c.playerIndex].frozenBy = c.playerId;
- * Server.playerHandler.players[c.playerIndex].playerLevel[3] -= damage;
- * c.forcedText = ("Feel the power of the Seers Ring!");
- * Server.playerHandler.players[c.playerIndex].hitDiff2 = damage;
- *
- * Server.playerHandler.players[c.playerIndex].hitUpdateRequired2 =
- * true; Server.playerHandler.players[c.playerIndex].updateRequired =
- * true; c.dfsDelay = System.currentTimeMillis(); } else {
- * c.sendMessage("I should be in combat before using this."); } } else {
- * c.sendMessage("My ring hasn't finished recharging yet (60 Seconds)");
- * }if (c.isDonator == 0)
- */
- // c.sendMessage("Spec comes back soon");
- }
- public void Deflect(int damage, int i) {
- if (damage > 0 && PlayerHandler.players[i].curseActive[7]
- || PlayerHandler.players[i].curseActive[8]
- || PlayerHandler.players[i].curseActive[9]) {
- int recDamage = damage / 6;
- if (!c.getHitUpdateRequired()) {
- damage = damage / 7;
- c.setHitDiff(recDamage);
- c.recoilHits = recDamage;
- c.setHitUpdateRequired(true);
- } else if (!c.getHitUpdateRequired2()) {
- damage = damage / 7;
- c.setHitDiff2(recDamage);
- c.setHitUpdateRequired2(true);
- }
- c.dealDamage(recDamage);
- damage = damage / 7;
- c.updateRequired = true;
- }
- }
- public void applyRecoil(int damage, int i) {
- if (damage > 0
- && PlayerHandler.players[i].playerEquipment[c.playerRing] == 2550) {
- int recDamage = damage / 10 + 1;
- if (!c.getHitUpdateRequired()) {
- c.setHitDiff(recDamage);
- c.setHitUpdateRequired(true);
- } else if (!c.getHitUpdateRequired2()) {
- c.setHitDiff2(recDamage);
- c.setHitUpdateRequired2(true);
- }
- c.dealDamage(recDamage);
- c.updateRequired = true;
- }
- }
- public int getBonusAttack(int i) {
- switch (NPCHandler.npcs[i].npcType) {
- case 2883:
- return Misc.random(50) + 30;
- case 2026:
- case 2027:
- case 2029:
- case 2030:
- return Misc.random(50) + 30;
- }
- return 0;
- }
- public void handleGmaulPlayer() {
- if (c.playerIndex > 0) {
- Client o = (Client) PlayerHandler.players[c.playerIndex];
- if (c.goodDistance(c.getX(), c.getY(), o.getX(), o.getY(),
- getRequiredDistance())) {
- if (checkReqs()) {
- if (checkSpecAmount(4153)) {
- boolean hit = Misc.random(calculateMeleeAttack()) > Misc
- .random(o.getCombat().calculateMeleeDefence());
- int damage = 0;
- c.specDamage = 1.0;
- c.specAccuracy = 3.5;
- int lvlForXP = c.getLevelForXP(c.playerXP[2]);
- if (hit)
- damage = Misc.random(calculateMeleeMaxHit());
- if (c.playerEquipment[c.playerHat] == 11665) {
- damage *= 10 / 9;
- }
- if ((o.prayerActive[18] || o.curseActive[9])
- && System.currentTimeMillis()
- - o.protMeleeDelay > 1500)
- damage *= .6;
- damage *= 0.95;
- applyPlayerHit(c.playerIndex, damage);
- c.startAnimation(1667);
- c.gfx100(340);
- o.updateRequired = true;
- o.getPA().requestUpdates();
- }
- }
- }
- }
- }
- public boolean armaNpc(int i) {
- switch (NPCHandler.npcs[i].npcType) {
- case 6222:
- case 2559:
- case 2560:
- case 6223:
- case 6225:
- case 6227:
- case 2561:
- return true;
- }
- return false;
- }
- /**
- * Used to grab the other player's information.
- */
- public int magicDefence(Client player) {
- return PVPMagic.getInstance().Defence(player);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment