Code:
package com.rs2hd.combat;
import com.rs2hd.model.Equipment;
import com.rs2hd.model.Item;
import com.rs2hd.model.Player;
import com.rs2hd.util.Misc;
import com.rs2hd.net.Packet;
import com.rs2hd.model.*;
import com.rs2hd.Constants;
import com.rs2hd.model.ChatMessage;
import com.rs2hd.*;
/**
* Handles PvP.
* @author JC
*
*/
public class PlayerCombat {
private Player p;
public PlayerCombat(Player p) {
this.p = p;
}
public boolean Defence(Player p) {
int BestAttack = p.getSkills().getLevelForXp(1) + Misc.random(10);
if ((Misc.random(BestAttack)) <= 3) {
return true;
}
return false;
}
public void attackPlayer(Player p) {
try {
for(Player p2 : World.getInstance().getPlayerList()) {
if(p == null || p2 == null) {
System.out.println("p/p2 = null");
return;
}
int rangeDamage = Misc.random(p.MaxHitRange());
int rangeDamage2 = Misc.random(p.MaxHitRange());
int meleeDamage = Misc.random(p.MaxHitMelee());
int vengDamage = Misc.random(p2.MaxHitMelee());
int meleeDamage2 = Misc.random(p.MaxHitMelee());
if(p2.getIndex() == p.enemyIndex) {
if(p2.isDead || p2.deathDelay > 0 && p2.getSkills().getLevel(3) <= 0) {
p.faceId(p2);
p.resetAttack();
return;
}
if(p.isDead || p.deathDelay > 0 && p.getSkills().getLevel(3) <= 0) {
p.resetAttack();
return;
}
if(p2.isDisconnected()) {
p.resetAttack();
return;
}
if(p.SafeZone()) {
p.faceId(p2);
p.sm("Please move to a PvP area to attack.");
p.resetAttack();
return;
}
if(p2.SafeZone()) {
p.faceId(p2);
p.sm("This player must be in a PvP area to be attacked.");
p.resetAttack();
return;
}
if (p.isInWildRange(p) == false && !p.bountyArea()) {
p.sm("You need to move deeper into the wilderness!");
p.resetAttack();
p.faceId(p2);
return;
}
if (p.inEdgePk() && p2.inEdgePk() || !p.multiZone() && !p2.multiZone()) {
if(p2.getIndex() == p.enemyIndex) {
if (p.combatWith != p2.getIndex() && p.combatWith != 0) {
p.sm("You are already in combat.");
p.resetAttack();
p.resetPvP = true;
p.faceId(p2);
return;
}
if (p2.combatWith != p.getIndex() && p2.combatWith != 0) {
p.sm("That player is already in combat.");
p.resetAttack();
p.resetPvP = true;
p.faceId(p2);
return;
}
}
}
if(p.resetPvP == true) {
p.resetAttack();
p.resetPvP = false;
return;
}
if(Misc.getDistance(p.getLocation().getX(), p.getLocation().getY(), p2.getLocation().getX(), p2.getLocation().getY()) <= getDistance(p)) {
if(!p.usingSpecial) { //If not using Specials
if(!usingRange(p)) { //Melee
if(p.combatDelay == 0) {
if (p2.veng == true) {
p2.forceChat("Taste Vengeance!");
p.hit(((meleeDamage/4)*3));
p2.veng = false;
}
p.faceId(p2);
if (p.sDefence(p)) {
p2.hit(meleeDamage);
} else {
p2.hit(0);
}
p.combatDelay = getCombatDelay(p);
p.animate(getCombatAnim(p));
p2.animate(403);
p2.cmbResetTimer = 8;
p2.combatWith = p.getIndex();
if(p2.autoRetaliate == 0){
p2.attackingPlayer = true;
p2.faceId(p);
}
}
} else { //Range
p.getWalkingQueue().reset();
if(p.combatDelay == 0) {
if(p.getEquipment().get(3).getDefinition().getId() == 11235) {
p.faceId(p2);
p.tele(p.getLocation().getX(), p.getLocation().getY(), 0);
if (p.sRDefence(p)) {
p2.hit(rangeDamage);
} else {
p2.hit(0);
}
if (p.sRDefence(p)) {
p2.hit(rangeDamage2);
} else {
p2.hit(0);
}
p2.cmbResetTimer = 8;
p2.combatWith = p.getIndex();
p.combatDelay = getCombatDelay(p);
p.animate(getCombatAnim(p));
}
if(p.getEquipment().get(3).getDefinition().getId() == 4675 || p.getEquipment().get(3).getDefinition().getId() == 13867) {
p.faceId(p2);
p.tele(p.getLocation().getX(), p.getLocation().getY(), 0);
p2.cmbResetTimer = 8;
p2.combatWith = p.getIndex();
p.combatDelay = 10;
if (p.barrage == 0 || p.barrage == 1 || p.barrage == 2) {
p.sm("Please choise a spell to cast.");
}
if (p.barrage == 5 && p.getEquipment().get(3).getDefinition().getId() == 13867) {
if (p.MDefence(p)) {
p2.hit(Misc.random(32));
p2.miasmicspec = 70;
p2.sm("You feel tired.");
p2.graphics(1854, 0);
p.graphics(1853, 0);
} else {
p2.graphics(85, 100);
}
p.animate(1979);
}
if (p.barrage == 3) {
if (p.MDefence(p)) {
int hitblood = Misc.random(29);
p2.hit(hitblood);
p.getSkills().addHp(hitblood/4);
p.sm("You absorve some of enemy health.");
p2.graphics(377, 0);
} else {
p2.graphics(85, 100);
}
p.animate(1979);
}
if (p.barrage == 4) {
if (p.MDefence(p)) {
if (p2.freezeDelay != 0) {
p2.graphics(1677, 100);
p2.hit(Misc.random(30));
}
if (p2.freezeDelay == 0) {
p2.sm("You have been frozen!");
p.sm("You freeze the enemy!");
p2.freezeDelay = 30;
p2.graphics(369, 0);
p2.hit(Misc.random(30));
}
} else {
p2.graphics(85, 100);
}
p.animate(1979);
}
} else { //If not using item # 11235 or magic
if(p.getEquipment().get(3).getDefinition().getId() == 9185) {
if(Misc.random(10) == 1) { p.faceId(p2);
p.tele(p.getLocation().getX(), p.getLocation().getY(), 0);
p2.hit(rangeDamage + Misc.random(30));
p2.graphics(756, 0);
p2.cmbResetTimer = 8;
p2.combatWith = p.getIndex();
p.combatDelay = getCombatDelay(p);
p.animate(getCombatAnim(p));
p2.animate(403);
return;
}
}
if (p.getEquipment().get(3).getDefinition().getId() != 11235) {
p.faceId(p2);
p.tele(p.getLocation().getX(), p.getLocation().getY(), 0);
if (p.sRDefence(p)) {
p2.hit(rangeDamage);
} else {
p2.hit(0);
}
p2.cmbResetTimer = 8;
p2.combatWith = p.getIndex();
p.combatDelay = getCombatDelay(p);
p.animate(getCombatAnim(p));
}
}
}
}
} else { //If using Specials.
if(!usingRange(p)) { //Melee
if(p.combatDelay == 0) {
if (p.getEquipment().get(3).getDefinition().getId() == 14484 && p.specialAmount >= 50) { //Dragon Claws
p.faceId(p2);
p.graphics(1950, 0);
p.animate(10961, 0);
p2.animate(403);
int dclaw1 = meleeDamage/2;
int dclaw2 = meleeDamage/4;
int dclaw3 = meleeDamage/4;
if (p.Defence(p)) {
p2.hit(meleeDamage);
} else {
p2.hit(20);
}
if (p.Defence(p)) {
p2.hit(dclaw1);
} else {
p2.hit(10);
}
if (p.Defence(p)) {
p2.hit(dclaw2);
} else {
p2.hit(5);
}
if (p.Defence(p)) {
p2.hit(dclaw3);
} else {
p2.hit(5);
}
p2.combatWith = p.getIndex();
p.combatDelay = getCombatDelay(p);
p2.cmbResetTimer = 8;
p.specialAmount -= p.getSpecialAmount();
p.usingSpecial = false;
} else if(p.getEquipment().get(3).getDefinition().getId() == 13899 && p.specialAmount >= 25) { //Vesta's long
p.faceId(p2);
p.animate(10502, 0);
p2.animate(403);
//p.VestaSpecial();
int specialDamage = Misc.random((int) (p.MaxHitMelee() * 1.20));
if (p.Defence(p)) {
p2.hit(specialDamage);
} else {
p2.hit(0);
}
p2.combatWith = p.getIndex();
p.combatDelay = getCombatDelay(p);
p2.cmbResetTimer = 8;
p.specialAmount -= 25;
p.usingSpecial = false;
} else if(p.getEquipment().get(3).getDefinition().getId() == 13905 && p.specialAmount >= 50) { //Vesta's spear
p.faceId(p2);
p2.animate(403);
p.animate(10499, 0);
p.graphics(1835, 0);
int specialDamage = Misc.random((int) (p.MaxHitMelee() * 1.20));
if (p.Defence(p)) {
p2.hit(specialDamage);
} else {
p2.hit(0);
}
p2.combatWith = p.getIndex();
p.combatDelay = getCombatDelay(p);
p2.cmbResetTimer = 8;
p.specialAmount -= p.getSpecialAmount();
p.usingSpecial = false;
} else if(p.getEquipment().get(3).getDefinition().getId() == 4151 && p.specialAmount >= 50) { //Abyssal Whip
p.faceId(p2);
p2.animate(403);
p2.graphics(341, 100);
p.animate(1658, 0);
if (p.Defence(p)) {
p2.hit(meleeDamage);
} else {
p2.hit(0);
}
p2.combatWith = p.getIndex();
p.combatDelay = getCombatDelay(p);
p2.cmbResetTimer = 8;
p.specialAmount -= 50;
p.usingSpecial = false;
} else if(p.getEquipment().get(3).getDefinition().getId() == 5698 && p.specialAmount >= 25) { //Dragon dagger (p++)
p.faceId(p2);
p2.animate(403);
p.graphics(252, 100);
p.animate(1062, 0);
if (p.Defence(p)) {
p2.hit(meleeDamage);
} else {
p2.hit(0);
}
if (p.Defence(p)) {
p2.hit(meleeDamage2);
} else {
p2.hit(0);
}
p2.combatWith = p.getIndex();
p.combatDelay = getCombatDelay(p);
p2.cmbResetTimer = 8;
p.specialAmount -= 25;
p.usingSpecial = false;
} else if(p.getEquipment().get(3).getDefinition().getId() == 11730 && p.specialAmount >= 100) { //Saradomin sword
p.faceId(p2);
p2.animate(403);
p.graphics(1224, 0);
p2.graphics(1194, 0);
p.animate(7072, 0);
if (p.Defence(p)) {
p2.hit(meleeDamage);
} else {
p2.hit(0);
}
if (p.Defence(p)) {
p2.hit(meleeDamage2);
} else {
p2.hit(0);
}
p2.combatWith = p.getIndex();
p.combatDelay = getCombatDelay(p);
p2.cmbResetTimer = 8;
p.specialAmount -= 100;
p.usingSpecial = false;
} else if(p.getEquipment().get(3).getDefinition().getId() == 11694 && p.specialAmount >= 50) { //Armadyl Godsword
p.faceId(p2);
p2.animate(403);
p.graphics(1222, 0);
p.animate(7074, 0);
int specialDamage = Misc.random((int) (p.MaxHitMelee() * 1.25));
if (p.Defence(p)) {
p2.hit(specialDamage);
} else {
p2.hit(0);
}
p2.combatWith = p.getIndex();
p.combatDelay = getCombatDelay(p);
p2.cmbResetTimer = 8;
p.specialAmount -= 50;
p.usingSpecial = false;
} else if(p.getEquipment().get(3).getDefinition().getId() == 11696 && p.specialAmount >= 100) { //Bandos Godsword
p.faceId(p2);
p2.animate(403);
p.graphics(1223, 0);
p.animate(7073, 0);
int specialDamage = Misc.random((int) (p.MaxHitMelee() * 1.10));
if (p.Defence(p)) {
p2.hit(specialDamage);
} else {
p2.hit(0);
}
p2.combatWith = p.getIndex();
p.combatDelay = getCombatDelay(p);
p2.cmbResetTimer = 8;
p.specialAmount -= 100;
p.usingSpecial = false;
} else if(p.getEquipment().get(3).getDefinition().getId() == 11698 && p.specialAmount >= 50) { //Saradomin Godsword
p.faceId(p2);
p2.animate(403);
p.graphics(1220, 0);
p.animate(7071, 0);
if (p.Defence(p)) {
p2.hit(meleeDamage);
} else {
p2.hit(0);
}
p2.combatWith = p.getIndex();
p.combatDelay = getCombatDelay(p);
p2.cmbResetTimer = 8;
p.specialAmount -= 50;
p.usingSpecial = false;
} else if(p.getEquipment().get(3).getDefinition().getId() == 11700 && p.specialAmount >= 50) { //Zamorak Godsword
p.faceId(p2);
p2.animate(403);
p.graphics(1221, 0);
p.animate(7070, 0);
if (p.Defence(p)) {
p2.hit(meleeDamage);
} else {
p2.hit(0);
}
p2.combatWith = p.getIndex();
p.combatDelay = getCombatDelay(p);
p2.cmbResetTimer = 8;
p.specialAmount -= 50;
p.usingSpecial = false;
} else if(p.getEquipment().get(3).getDefinition().getId() == 1305 && p.specialAmount >= 25) { //Dragon longsword
p.faceId(p2);
int specialDamage = Misc.random((int) (p.MaxHitMelee() * 1.20));
if (p.Defence(p)) {
p2.hit(specialDamage);
} else {
p2.hit(0);
}
p.graphics(248, 100);
p.animate(1058, 0);
p2.combatWith = p.getIndex();
p.combatDelay = getCombatDelay(p);
p2.cmbResetTimer = 8;
p.specialAmount -= 100;
p.usingSpecial = false;
} else if(p.getEquipment().get(3).getDefinition().getId() == 4587 && p.specialAmount >= 50) { //Dragon scimitar
p.faceId(p2);
p.graphics(347, 100);
p.animate(2081, 0);
int specialDamage = Misc.random((int) (p.MaxHitMelee() * 1.20));
if (p.Defence(p)) {
p2.hit(specialDamage);
} else {
p2.hit(0);
}
p2.combatWith = p.getIndex();
p.combatDelay = getCombatDelay(p);
p2.cmbResetTimer = 8;
p.specialAmount -= 50;
p.usingSpecial = false;
} else if(p.getEquipment().get(3).getDefinition().getId() == 3204 && p.specialAmount >= 100) { //Dragon halberd
p.faceId(p2);
p.graphics(282, 100);
p2.graphics(254, 0);
p2.animate(403);
p.animate(1665, 0);
if (p.Defence(p)) {
p2.hit(meleeDamage);
} else {
p2.hit(0);
}
if (p.Defence(p)) {
p2.hit(meleeDamage2);
} else {
p2.hit(0);
}
p2.combatWith = p.getIndex();
p.combatDelay = getCombatDelay(p);
p2.cmbResetTimer = 8;
p.specialAmount -= 100;
p.usingSpecial = false;
} else if(p.getEquipment().get(3).getDefinition().getId() == 1434 && p.specialAmount >= 40) { //Dragon mace
p.faceId(p2);
p.graphics(251, 100);
p.animate(1060, 0);
if (p.Defence(p)) {
p2.hit(meleeDamage);
} else {
p2.hit(0);
}
p2.animate(403);
p2.combatWith = p.getIndex();
p.combatDelay = getCombatDelay(p);
p2.cmbResetTimer = 8;
p.specialAmount -= 40;
p.usingSpecial = false;
} else if(p.getEquipment().get(3).getDefinition().getId() == 7158 && p.specialAmount >= 50) { //Dragon 2h
p.faceId(p2);
p.graphics(559, 0);
p.animate(3157, 0);
if (p.Defence(p)) {
p2.hit(meleeDamage);
} else {
p2.hit(0);
}
p2.combatWith = p.getIndex();
p2.animate(403);
p.combatDelay = getCombatDelay(p);
p2.cmbResetTimer = 8;
p.specialAmount -= 50;
p.usingSpecial = false;
} else if(p.getEquipment().get(3).getDefinition().getId() == 10887 && p.specialAmount >= 50) { //Barrelchest anchor
p.faceId(p2);
p.graphics(1027, 0);
p2.animate(403);
p.animate(5870, 0);
if (p.Defence(p)) {
p2.hit(meleeDamage);
} else {
p2.hit(0);
}
p2.combatWith = p.getIndex();
p.combatDelay = getCombatDelay(p);
p2.cmbResetTimer = 8;
p.specialAmount -= 50;
p.usingSpecial = false;
} else if(p.getEquipment().get(3).getDefinition().getId() == 13902 && p.specialAmount >= 50) { //Statius warhammer
p.faceId(p2);
p2.animate(403);
p.graphics(1840, 0);
p.animate(10505, 0);
int specialDamage = Misc.random((int) (p.MaxHitMelee() * 1.30));
if (p.Defence(p)) {
p2.hit(specialDamage);
} else {
p2.hit(0);
}
p2.combatWith = p.getIndex();
p.combatDelay = getCombatDelay(p);
p2.cmbResetTimer = 8;
p.specialAmount -= 50;
p.usingSpecial = false;
} else {
p.faceId(p2);
p.specialAmount -= p.getSpecialAmount();
p2.cmbResetTimer = 8;
p2.combatWith = p.getIndex();
p.usingSpecial = false;
p.combatDelay = getCombatDelay(p);
if(p2.veng == true) {
p.hit((int)((meleeDamage/4)*3));
p2.forceChat("Taste Vengeance!");
p2.veng = false;
}
p2.animate(403);
}
}
} else { //range
if(p.combatDelay == 0) {
if (p.getEquipment().get(3).getDefinition().getId() == 11235 && p.specialAmount >= 55) { //Dark Bow
p.graphics(1099, 0);
p2.graphics(1099, 0);
p2.graphics(1100, 100);
p.graphics(1111, 100);
p.tele(p.getLocation().getX(), p.getLocation().getY(), 0);
p2.cmbResetTimer = 8;
p2.combatWith = p.getIndex();
p.combatDelay = getCombatDelay(p);
p.animate(getCombatAnim(p));
p.specialAmount -= p.getSpecialAmount();
p.usingSpecial = false;
p.faceId(p2);
int specialDamage = Misc.random((int) (p.MaxHitRange() * 1.50));
int specialDamage2 = Misc.random((int) (p.MaxHitRange() * 1.50));
if (p.RDefence(p)) {
p2.hit(specialDamage);
} else {
p2.hit(7);
}
if (p.RDefence(p)) {
p2.hit(specialDamage2);
} else {
p2.hit(9);
}
} else { //If not using item # 11235
if (p.specialAmount >= 55) {
p.specialAmount -= 55;
p.usingSpecial = false;
p.faceId(p2);
p2.hit(rangeDamage);
p.tele(p.getLocation().getX(), p.getLocation().getY(), 0);
p2.cmbResetTimer = 8;
p2.combatWith = p.getIndex();
p.combatDelay = getCombatDelay(p);
p.animate(getCombatAnim(p));
p2.animate(403);
}
}
}
}
}
}
}
}
} catch (Exception e) { //Stops Exceptions from happening and crashing the server.
if(p != null)
p.resetAttack();
System.out.println("PlayerCombat.java Error" +e);
} // End of Exception
} //End of AttackPlayer();
public int getCombatDelay(Player p) {
if(p.getEquipment().get(3) == null) {
return 20*p.miasmicdelay;
}
switch(p.getEquipment().get(3).getDefinition().getId()) {
case 806: // Start of Darts
case 807:
case 808:
case 809:
case 810:
case 811:
case 11230:
case 863: // Start of Knifes
case 864:
case 865:
case 866:
case 867:
case 868:
case 869:
return 3*p.miasmicdelay;
case 841: // Start of Shortbows
case 843:
case 849:
case 853:
case 857:
case 861:
case 4734: // Start of Karil's Cross & X-bow
case 4934:
case 4935:
case 4936:
case 4937:
return 4*p.miasmicdelay;
case 1321: // Start of Scimitars
case 1323:
case 1325:
case 1327:
case 1329:
case 1331:
case 1333:
case 4587:
case 6611:
case 11998:
case 746: // Start of Daggers
case 747:
case 1213:
case 1215:
case 5696: // Start of Daggers(p++)
case 5698:
case 6597:
case 4151: // Whip & Sara Sword
case 11730:
return 5*p.miasmicdelay;
case 1420: // Start of Maces
case 1422:
case 1424:
case 1426:
case 1428:
case 1430:
case 1432:
case 1434:
case 6601:
case 7808:
case 8841:
case 11061:
case 839: // Start of Longbows
case 845:
case 847:
case 851:
case 855:
case 859:
case 1291: // Start of Longswords
case 1293:
case 1295:
case 1297:
case 1299:
case 1301:
case 1303:
case 1305:
case 6607:
case 13899:
case 1379: // Start of Staffs
case 1381:
case 1383:
case 1385:
case 1387:
case 2415: // Start of God Staffs & Iban's Staff & Slayer staff
case 2416:
case 2417:
case 1409:
case 4170:
case 1391: // Start of BattleStaffs
case 1393:
case 1395:
case 1397:
case 1399:
case 4710: // Start of Ahrim's Staff
case 4862:
case 4863:
case 4864:
case 4865:
case 9174: // Start of CrossBows
case 9176:
case 9177:
case 9179:
case 9181:
case 9183:
case 9185:
case 14484: // Dragon Claws
return 6*p.miasmicdelay;
case 1335: // Start of WarHammers
case 1337:
case 1339:
case 1341:
case 1343:
case 1345:
case 1347:
case 6613:
case 13902:
case 4747: // Start of Torag's Hammers
case 4958:
case 4959:
case 4960:
case 4861:
case 1363: // Start of BattleAxes
case 1365:
case 1367:
case 136:
case 1371:
case 1373:
case 1375:
case 1377:
case 6589:
case 7807:
case 4755: // Start of Verac's Flail
case 4982:
case 4983:
case 4984:
case 4985:
case 1237: // Start of Spears
case 1239:
case 1241:
case 1243:
case 1245:
case 1247:
case 1249:
case 7809:
case 11716:
case 13905:
case 5718: // Start of Spears(p++)
case 5720:
case 5722:
case 5724:
case 5726:
case 5728:
case 5730:
case 5736:
case 4726: // Start of Guthan's Warspear
case 4910:
case 4911:
case 4912:
case 4913:
case 3190: // Start of Halberds
case 3192:
case 3194:
case 3196:
case 3198:
case 3200:
case 3202:
case 3204:
case 6599:
return 7*p.miasmicdelay;
case 11694: // Start of GodSwords
case 11696:
case 11698:
case 11700:
case 1307: // Start of 2Hs
case 1309:
case 1311:
case 1313:
case 1315:
case 1317:
case 1319:
case 7158:
case 6609:
case 4718: // Start of Dharok's Greataxe
case 4886:
case 4887:
case 4888:
case 4889:
case 10887: // BarrelChest Anchor, Dark Bow, Granite Maul, Obby Maul
case 11235:
case 4153:
case 6528:
return 8*p.miasmicdelay;
default:
return 20*p.miasmicdelay;
}
}
public int getDefAnim(Player p) {
if(p.getEquipment().get(3) == null) {
return 424;
}
if (p.getEquipment().get(3).getDefinition().getId() == -1) {
return 424;
}
if (p.getEquipment().get(3).getDefinition().getId() == 11696 || p.getEquipment().get(3).getDefinition().getId() == 11694 || p.getEquipment().get(3).getDefinition().getId() == 11698 || p.getEquipment().get(3).getDefinition().getId() == 11700 ||
p.getEquipment().get(3).getDefinition().getId() == 1307 ||
p.getEquipment().get(3).getDefinition().getId() == 1309 ||
p.getEquipment().get(3).getDefinition().getId() == 1311 ||
p.getEquipment().get(3).getDefinition().getId() == 1313 ||
p.getEquipment().get(3).getDefinition().getId() == 1315 ||
p.getEquipment().get(3).getDefinition().getId() == 1317 ||
p.getEquipment().get(3).getDefinition().getId() == 1319 || p.getEquipment().get(3).getDefinition().getId() == 11730) {
return 7050;
}
if (p.getEquipment().get(3).getDefinition().getId() == 14484 || p.getEquipment().get(3).getDefinition().getId() == 13902 || p.getEquipment().get(3).getDefinition().getId() == 13899 || p.getEquipment().get(3).getDefinition().getId() == 13905 ||
p.getEquipment().get(3).getDefinition().getId() == 13941 ||
p.getEquipment().get(3).getDefinition().getId() == 13666 ||
p.getEquipment().get(3).getDefinition().getId() == 11235 ||
p.getEquipment().get(3).getDefinition().getId() == 4734 ||
p.getEquipment().get(3).getDefinition().getId() == 4934 ||
p.getEquipment().get(3).getDefinition().getId() == 4935 ||
p.getEquipment().get(3).getDefinition().getId() == 4936 ||
p.getEquipment().get(3).getDefinition().getId() == 4937 ||
p.getEquipment().get(3).getDefinition().getId() == 9185 ||
p.getEquipment().get(3).getDefinition().getId() == 861) {
return 424;
}
if (p.getEquipment().get(3).getDefinition().getId() == 4151) {
return 1659;
}
if (p.getEquipment().get(3).getDefinition().getId() == 5698) {
return 403;
}
switch(p.getEquipment().get(5).getDefinition().getId()) {
case 8850:
case 8849:
case 8847:
case 8846:
case 8845:
case 8844:
return 4177;
case 11283:
case 11284:
return 1156;
default: return 403;
}
}
public int getCombatAnim(Player p) {
if(p.getEquipment().get(3) == null) {
return 451;
}
if (p.getEquipment().get(3).getDefinition().getId() == -1) {
return 422;
}
if (p.getEquipment().get(3).getDefinition().getId() == 14484) {
return 10501;
}
if (p.getEquipment().get(3).getDefinition().getId() == 4718) {
return 2067;
}
if (p.getEquipment().get(3).getDefinition().getId() >= 806 && p.getEquipment().get(3).getDefinition().getId() <= 811) {
return 582;
}
if (p.getEquipment().get(3).getDefinition().getId() == 11230) {
return 582;
}
if (p.getEquipment().get(3).getDefinition().getId() >= 863 && p.getEquipment().get(3).getDefinition().getId() <= 876) {
return 806;
}
if (p.getEquipment().get(3).getDefinition().getId() == 10581) {
return 402;
}
if (p.getEquipment().get(3).getDefinition().getId() == 4726) {
return 2080;
}
if (p.getEquipment().get(3).getDefinition().getId() == 6528) {
return 2661;
}
if (p.getEquipment().get(3).getDefinition().getId() == 4153) {
return 1665;
}
if (p.getEquipment().get(3).getDefinition().getId() == 4734) {
return 2075;
}
if (p.getEquipment().get(3).getDefinition().getId() == 9703) {
return 412;
}
if (p.getEquipment().get(3).getDefinition().getId() == 3204) {
return 440;
}
if (p.getEquipment().get(3).getDefinition().getId() == 11696 || p.getEquipment().get(3).getDefinition().getId() == 11694 || p.getEquipment().get(3).getDefinition().getId() == 11698 || p.getEquipment().get(3).getDefinition().getId() == 11700 ||
p.getEquipment().get(3).getDefinition().getId() == 1307 ||
p.getEquipment().get(3).getDefinition().getId() == 1309 ||
p.getEquipment().get(3).getDefinition().getId() == 1311 ||
p.getEquipment().get(3).getDefinition().getId() == 1313 ||
p.getEquipment().get(3).getDefinition().getId() == 1315 ||
p.getEquipment().get(3).getDefinition().getId() == 1317 ||
p.getEquipment().get(3).getDefinition().getId() == 1319 || p.getEquipment().get(3).getDefinition().getId() == 11730) {
return 7041;
}
for (int i = 9174; i < 9186; i++) {
if (p.getEquipment().get(3).getDefinition().getId() == i) {
return 4230;
}
}
for (int i = 1265; i < 1276; i++) {
if (p.getEquipment().get(3).getDefinition().getId() == i) {
return 401;
}
}
if (p.getEquipment().get(3).getDefinition().getId() == 4755) {
return 2062;
}
if (p.getEquipment().get(3).getDefinition().getId() == 10887) {
return 5865;
}
if (p.getEquipment().get(3).getDefinition().getId() == 4151) {
return 1658;
}
if (p.getEquipment().get(3).getDefinition().getId() == 5698) {
return 402;
}
switch(p.getEquipment().get(3).getDefinition().getId()) {
case 861:
case 11235:
case 4212:
case 4214:
return 426;
default: return 451;
}
}
public boolean usingRange(Player p) {
if(p.getEquipment().get(3) == null) {
return false;
}
switch(p.getEquipment().get(3).getDefinition().getId()) {
case 13867: return true;
case 4675: return true;
case 4212: return true;
case 4214: return true;
case 4734: return true;
case 11235: return true;
case 9185: return true;
case 861: return true;
case 0: return false;
case -1: return false;
default: return false;
}
}
public int getDistance(Player p) {
if(usingRange(p)) {
return 8;
} else {
return 1;
}
}
}//End of PlayerCombat.java