public static void setButtonForAttackStyle(Player p, int interfaceId) { if (interfaceId == -1) { return; } AttackStyle av = p.getAttackStyle(); AttackStyle.CombatSkill type = av.getSkill(); AttackStyle.CombatStyle type2 = av.getStyle(); int slot = av.getSlot(); switch (interfaceId) { case 92: // Unarmed if (type.Equals(AttackStyle.CombatSkill.ACCURATE) || slot == 0) { p.getPackets().sendConfig(43, 0); } else if (type.Equals(AttackStyle.CombatSkill.AGGRESSIVE) || slot == 1) { p.getPackets().sendConfig(43, 1); } else if (type.Equals(AttackStyle.CombatSkill.DEFENSIVE) || slot == 2 || slot == 3) { p.getPackets().sendConfig(43, 2); av.setSlot(2); } break; case 93: // Whip attack interface. if (type.Equals(AttackStyle.CombatSkill.ACCURATE) || slot == 0) { p.getPackets().sendConfig(43, 0); } else if (type.Equals(AttackStyle.CombatSkill.CONTROLLED) || slot == 1) { p.getPackets().sendConfig(43, 1); } else if (type.Equals(AttackStyle.CombatSkill.DEFENSIVE) || slot == 2 || slot == 3) { p.getPackets().sendConfig(43, 2); av.setSlot(2); } break; case 89: // Dagger attack interface. if (type.Equals(AttackStyle.CombatSkill.ACCURATE) || slot == 0) { p.getPackets().sendConfig(43, 0); } else if ((type.Equals(AttackStyle.CombatSkill.AGGRESSIVE) && type2.Equals(AttackStyle.CombatStyle.STAB)) || slot == 1) { p.getPackets().sendConfig(43, 1); } else if ((type.Equals(AttackStyle.CombatSkill.AGGRESSIVE) && type2.Equals(AttackStyle.CombatStyle.SLASH))) { p.getPackets().sendConfig(43, 2); } else if (type.Equals(AttackStyle.CombatSkill.DEFENSIVE) || slot == 2 || slot == 3) { p.getPackets().sendConfig(43, 3); av.setSlot(3); } break; case 82: // Longsword/scimitar attack interface. if (type.Equals(AttackStyle.CombatSkill.ACCURATE) || slot == 0) { p.getPackets().sendConfig(43, 0); } else if (type.Equals(AttackStyle.CombatSkill.AGGRESSIVE) && type2.Equals(AttackStyle.CombatStyle.SLASH) || slot == 1) { p.getPackets().sendConfig(43, 1); } else if (type.Equals(AttackStyle.CombatSkill.AGGRESSIVE) && type2.Equals(AttackStyle.CombatStyle.CRUSH)) { p.getPackets().sendConfig(43, 2); } else if (type.Equals(AttackStyle.CombatSkill.DEFENSIVE) || slot == 2 || slot == 3) { p.getPackets().sendConfig(43, 3); av.setSlot(3); } break; case 78: // Claw attack interface. if (type.Equals(AttackStyle.CombatSkill.ACCURATE) || slot == 0) { p.getPackets().sendConfig(43, 0); } else if (type.Equals(AttackStyle.CombatSkill.AGGRESSIVE) || slot == 1) { p.getPackets().sendConfig(43, 1); } else if (type.Equals(AttackStyle.CombatSkill.CONTROLLED)) { p.getPackets().sendConfig(43, 2); } else if (type.Equals(AttackStyle.CombatSkill.DEFENSIVE) || slot == 2 || slot == 3) { p.getPackets().sendConfig(43, 3); av.setSlot(3); } break; case 81: // Godsword attack interface. if (type.Equals(AttackStyle.CombatSkill.ACCURATE) || slot == 0) { p.getPackets().sendConfig(43, 0); } else if (type.Equals(AttackStyle.CombatSkill.AGGRESSIVE) || slot == 1) { p.getPackets().sendConfig(43, 1); } else if (type.Equals(AttackStyle.CombatSkill.CONTROLLED)) { p.getPackets().sendConfig(43, 2); } else if (type.Equals(AttackStyle.CombatSkill.DEFENSIVE) || slot == 2 || slot == 3) { p.getPackets().sendConfig(43, 3); av.setSlot(3); } break; case 88: // Mace attack interface. if (type.Equals(AttackStyle.CombatSkill.ACCURATE) || slot == 0) { p.getPackets().sendConfig(43, 0); } else if (type.Equals(AttackStyle.CombatSkill.AGGRESSIVE) || slot == 1) { p.getPackets().sendConfig(43, 1); } else if (type.Equals(AttackStyle.CombatSkill.CONTROLLED)) { p.getPackets().sendConfig(43, 2); } else if (type.Equals(AttackStyle.CombatSkill.DEFENSIVE) || slot == 2 || slot == 3) { p.getPackets().sendConfig(43, 3); av.setSlot(3); } break; case 76: // Granite maul attack interface. if (type.Equals(AttackStyle.CombatSkill.ACCURATE) || slot == 0) { p.getPackets().sendConfig(43, 0); } else if (type.Equals(AttackStyle.CombatSkill.AGGRESSIVE) || slot == 1) { p.getPackets().sendConfig(43, 1); } else if (type.Equals(AttackStyle.CombatSkill.DEFENSIVE) || slot == 2 || slot == 3) { p.getPackets().sendConfig(43, 2); av.setSlot(2); } break; case 77: // Bow attack interface. if (type2.Equals(AttackStyle.CombatStyle.RANGE_ACCURATE) || slot == 0) { p.getPackets().sendConfig(43, 0); } else if (type2.Equals(AttackStyle.CombatStyle.RANGE_RAPID) || slot == 1) { p.getPackets().sendConfig(43, 1); } else if (type2.Equals(AttackStyle.CombatStyle.RANGE_DEFENSIVE) || slot == 2 || slot == 3) { p.getPackets().sendConfig(43, 2); av.setSlot(2); } break; case 75: // Battleaxe attack interface. if (type.Equals(AttackStyle.CombatSkill.ACCURATE) || slot == 0) { p.getPackets().sendConfig(43, 0); } else if (type.Equals(AttackStyle.CombatSkill.AGGRESSIVE) && type2.Equals(AttackStyle.CombatStyle.SLASH) || slot == 1) { p.getPackets().sendConfig(43, 1); } else if (type.Equals(AttackStyle.CombatSkill.AGGRESSIVE) && type2.Equals(AttackStyle.CombatStyle.CRUSH)) { p.getPackets().sendConfig(43, 2); } else if (type.Equals(AttackStyle.CombatSkill.DEFENSIVE) || slot == 2 || slot == 3) { p.getPackets().sendConfig(43, 3); av.setSlot(3); } break; case 91: // Thrown weapon if (type2.Equals(AttackStyle.CombatStyle.RANGE_ACCURATE) || slot == 0) { p.getPackets().sendConfig(43, 0); } else if (type2.Equals(AttackStyle.CombatStyle.RANGE_RAPID) || slot == 1) { p.getPackets().sendConfig(43, 1); } else if (type2.Equals(AttackStyle.CombatStyle.RANGE_DEFENSIVE) || slot == 2 || slot == 3) { p.getPackets().sendConfig(43, 2); av.setSlot(2); } break; case 85: // Spear if (type.Equals(AttackStyle.CombatSkill.ACCURATE) || slot == 0) { p.getPackets().sendConfig(43, 0); } else if (type.Equals(AttackStyle.CombatSkill.AGGRESSIVE) || slot == 1) { p.getPackets().sendConfig(43, 1); } else if (type.Equals(AttackStyle.CombatSkill.DEFENSIVE) || slot == 2 || slot == 3) { p.getPackets().sendConfig(43, 2); av.setSlot(2); } break; case 90: // Staff interface if (type.Equals(AttackStyle.CombatSkill.ACCURATE) || slot == 0) { p.getPackets().sendConfig(43, 0); } else if (type.Equals(AttackStyle.CombatSkill.AGGRESSIVE) || slot == 1) { p.getPackets().sendConfig(43, 1); } else if (type.Equals(AttackStyle.CombatSkill.DEFENSIVE) || slot == 2 || slot == 3) { p.getPackets().sendConfig(43, 2); av.setSlot(2); } break; } }
public static double getRangeMaxHit(Player p, int bow, int arrow) { double hit = 0; double a = p.getSkills().getCurLevel(Skills.SKILL.RANGE); double b = 1.00; double c = 0; int d = getRangeStrength(p); int prayer = p.getPrayers().getRangePrayer(); if (prayer == 1) { b *= 1.05; } else if (prayer == 2) { b *= 1.10; } else if (prayer == 3) { b *= 1.15; } if (wearingRangeVoid(p)) { b *= 1.15; } c = (a * b); if (p.getAttackStyle().getStyle().Equals(AttackStyle.CombatStyle.RANGE_ACCURATE)) { c += 3.00; } hit = ((c + 8) * (d + 64) / 640); return Math.Floor(hit); }
public static void configureButton(Player p, int interfaceId, int button) { AttackStyle av = p.getAttackStyle(); switch (interfaceId) { case 92: // Unarmed attack interface. switch (button) { case 2: // Punch (Attack XP) - Crush av.setSkill(AttackStyle.CombatSkill.ACCURATE); av.setStyle(AttackStyle.CombatStyle.CRUSH); av.setSlot(0); break; case 3: // Kick (Strength XP) - Crush av.setSkill(AttackStyle.CombatSkill.AGGRESSIVE); av.setStyle(AttackStyle.CombatStyle.CRUSH); av.setSlot(1); break; case 4: // Block (Defence XP) - Crush av.setSkill(AttackStyle.CombatSkill.DEFENSIVE); av.setStyle(AttackStyle.CombatStyle.CRUSH); av.setSlot(2); break; } break; case 93: // Whip attack interface. switch (button) { case 2: // Flick (Attack XP) - Slash av.setSkill(AttackStyle.CombatSkill.ACCURATE); av.setStyle(AttackStyle.CombatStyle.SLASH); av.setSlot(0); break; case 3: // Lash (Shared XP) - Slash av.setSkill(AttackStyle.CombatSkill.CONTROLLED); av.setStyle(AttackStyle.CombatStyle.SLASH); av.setSlot(1); break; case 4: // Deflect (Defence XP) - Slash av.setSkill(AttackStyle.CombatSkill.DEFENSIVE); av.setStyle(AttackStyle.CombatStyle.SLASH); av.setSlot(2); break; } break; case 89: // Dagger attack interface. switch (button) { case 2: // Stab (Attack XP) - Stab av.setSkill(AttackStyle.CombatSkill.ACCURATE); av.setStyle(AttackStyle.CombatStyle.STAB); av.setSlot(0); break; case 3: // Lunge (Strength XP) - Stab av.setSkill(AttackStyle.CombatSkill.AGGRESSIVE); av.setStyle(AttackStyle.CombatStyle.STAB); av.setSlot(1); break; case 4: // Slash (Strength XP) - Slash av.setSkill(AttackStyle.CombatSkill.AGGRESSIVE); av.setStyle(AttackStyle.CombatStyle.SLASH); av.setSlot(2); break; case 5: // Block (Defence XP) - Stab av.setSkill(AttackStyle.CombatSkill.DEFENSIVE); av.setStyle(AttackStyle.CombatStyle.STAB); av.setSlot(3); break; } break; case 82: // Longsword/scimitar attack interface. switch (button) { case 2: // Chop (Attack XP) - Slash av.setSkill(AttackStyle.CombatSkill.ACCURATE); av.setStyle(AttackStyle.CombatStyle.SLASH); av.setSlot(0); break; case 3: // Slash (Strength XP) - Slash av.setSkill(AttackStyle.CombatSkill.AGGRESSIVE); av.setStyle(AttackStyle.CombatStyle.SLASH); av.setSlot(1); break; case 4: // Smash (Strength XP) - Crush av.setSkill(AttackStyle.CombatSkill.AGGRESSIVE); av.setStyle(AttackStyle.CombatStyle.CRUSH); av.setSlot(2); break; case 5: // Block (Defence XP) - Slash av.setSkill(AttackStyle.CombatSkill.DEFENSIVE); av.setStyle(AttackStyle.CombatStyle.SLASH); av.setSlot(3); break; } break; case 78: // Claw attack interface. switch (button) { case 2: // Chop (Attack XP) - Slash av.setSkill(AttackStyle.CombatSkill.ACCURATE); av.setStyle(AttackStyle.CombatStyle.SLASH); av.setSlot(0); break; case 5: // Slash (Strength XP) - Slash av.setSkill(AttackStyle.CombatSkill.AGGRESSIVE); av.setStyle(AttackStyle.CombatStyle.SLASH); av.setSlot(1); break; case 4: // Lunge (Shared XP) - Stab av.setSkill(AttackStyle.CombatSkill.CONTROLLED); av.setStyle(AttackStyle.CombatStyle.STAB); av.setSlot(2); break; case 3: // Block (Defence XP) - Slash av.setSkill(AttackStyle.CombatSkill.DEFENSIVE); av.setStyle(AttackStyle.CombatStyle.SLASH); av.setSlot(3); break; } break; case 81: // Godsword attack interface. switch (button) { case 2: // Chop (Attack XP) - Slash av.setSkill(AttackStyle.CombatSkill.ACCURATE); av.setStyle(AttackStyle.CombatStyle.SLASH); av.setSlot(0); break; case 3: // Slash (Strength XP) - Slash av.setSkill(AttackStyle.CombatSkill.AGGRESSIVE); av.setStyle(AttackStyle.CombatStyle.SLASH); av.setSlot(1); break; case 4: // Lunge (Shared XP) - Stab av.setSkill(AttackStyle.CombatSkill.CONTROLLED); av.setStyle(AttackStyle.CombatStyle.STAB); av.setSlot(2); break; case 5: // Block (Defence XP) - Slash av.setSkill(AttackStyle.CombatSkill.DEFENSIVE); av.setStyle(AttackStyle.CombatStyle.SLASH); av.setSlot(3); break; } break; case 88: // Mace attack interface. switch (button) { case 2: // Pound (Attack XP) - Crush av.setSkill(AttackStyle.CombatSkill.ACCURATE); av.setStyle(AttackStyle.CombatStyle.CRUSH); av.setSlot(0); break; case 3: // Pummel (Strength XP) - Crush av.setSkill(AttackStyle.CombatSkill.AGGRESSIVE); av.setStyle(AttackStyle.CombatStyle.CRUSH); av.setSlot(1); break; case 4: // Spike (Shared XP) - Stab av.setSkill(AttackStyle.CombatSkill.CONTROLLED); av.setStyle(AttackStyle.CombatStyle.STAB); av.setSlot(2); break; case 5: // Block (Defence XP) - Crush av.setSkill(AttackStyle.CombatSkill.DEFENSIVE); av.setStyle(AttackStyle.CombatStyle.CRUSH); av.setSlot(3); break; } break; case 76: // Granite maul attack interface. switch (button) { case 2: // Pound (Attack XP) - Crush av.setSkill(AttackStyle.CombatSkill.ACCURATE); av.setStyle(AttackStyle.CombatStyle.CRUSH); av.setSlot(0); break; case 4: // Pummel (Strength XP) - Crush av.setSkill(AttackStyle.CombatSkill.AGGRESSIVE); av.setStyle(AttackStyle.CombatStyle.CRUSH); av.setSlot(1); break; case 3: // Block (Defence XP) - Crush av.setSkill(AttackStyle.CombatSkill.DEFENSIVE); av.setStyle(AttackStyle.CombatStyle.CRUSH); av.setSlot(2); break; } break; case 77: // Bow attack interface. switch (button) { case 2: // Accurate (Range XP) - Accurate av.setSkill(AttackStyle.CombatSkill.RANGE); av.setStyle(AttackStyle.CombatStyle.RANGE_ACCURATE); av.setSlot(0); break; case 4: // Rapid (Range XP) - Rapid av.setSkill(AttackStyle.CombatSkill.RANGE); av.setStyle(AttackStyle.CombatStyle.RANGE_RAPID); av.setSlot(1); break; case 3: // Longrange (Range XP) - Defensive av.setSkill(AttackStyle.CombatSkill.RANGE); av.setStyle(AttackStyle.CombatStyle.RANGE_DEFENSIVE); av.setSlot(2); break; } break; case 75: // Battleaxe attack interface. switch (button) { case 2: // Chop (Attack XP) - Slash av.setSkill(AttackStyle.CombatSkill.ACCURATE); av.setStyle(AttackStyle.CombatStyle.SLASH); av.setSlot(0); break; case 5: // Hack (Strength XP) - Slash av.setSkill(AttackStyle.CombatSkill.AGGRESSIVE); av.setStyle(AttackStyle.CombatStyle.SLASH); av.setSlot(1); break; case 4: // Smash (Strength XP) - Crush av.setSkill(AttackStyle.CombatSkill.AGGRESSIVE); av.setStyle(AttackStyle.CombatStyle.CRUSH); av.setSlot(2); break; case 3: // Block (Defence XP) - Slash av.setSkill(AttackStyle.CombatSkill.DEFENSIVE); av.setStyle(AttackStyle.CombatStyle.SLASH); av.setSlot(3); break; } break; case 91: // Thrown weapon switch (button) { case 2: // Accurate (Range XP) - Accurate av.setSkill(AttackStyle.CombatSkill.RANGE); av.setStyle(AttackStyle.CombatStyle.RANGE_ACCURATE); av.setSlot(0); break; case 4: // Rapid (Range XP) - Rapid av.setSkill(AttackStyle.CombatSkill.RANGE); av.setStyle(AttackStyle.CombatStyle.RANGE_RAPID); av.setSlot(1); break; case 3: // Longrange (Range XP) - Defensive av.setSkill(AttackStyle.CombatSkill.RANGE); av.setStyle(AttackStyle.CombatStyle.RANGE_DEFENSIVE); av.setSlot(2); break; } break; case 85: // Spear switch (button) { case 2: // Bash (Attack XP) - Crush av.setSkill(AttackStyle.CombatSkill.ACCURATE); av.setStyle(AttackStyle.CombatStyle.CRUSH); av.setSlot(0); break; case 4: // Pound (Strength XP) - Crush av.setSkill(AttackStyle.CombatSkill.AGGRESSIVE); av.setStyle(AttackStyle.CombatStyle.CRUSH); av.setSlot(1); break; case 3: // Block (Defense XP) - Crush av.setSkill(AttackStyle.CombatSkill.DEFENSIVE); av.setStyle(AttackStyle.CombatStyle.CRUSH); av.setSlot(2); break; } break; case 90: // Staff interface switch (button) { case 2: // Bash (Attack XP) - Crush av.setSkill(AttackStyle.CombatSkill.ACCURATE); av.setStyle(AttackStyle.CombatStyle.CRUSH); av.setSlot(0); break; case 4: // Pound (Strength XP) - Crush av.setSkill(AttackStyle.CombatSkill.AGGRESSIVE); av.setStyle(AttackStyle.CombatStyle.CRUSH); av.setSlot(1); break; case 3: // Focus (Defense XP) - Crush av.setSkill(AttackStyle.CombatSkill.DEFENSIVE); av.setStyle(AttackStyle.CombatStyle.CRUSH); av.setSlot(2); break; } break; } }
public static double getPlayerMaxHit(Player player, int strBonusIncrease) { AttackStyle.CombatSkill fightType = player.getAttackStyle().getSkill(); double myCurStrength = (double)player.getSkills().getCurLevel(Skills.SKILL.STRENGTH); double myEquipStrengthBonus = (double)(player.getEquipment().getBonus(Equipment.BONUS.STRENGTH) + strBonusIncrease); double fightingStyle = 0; double powerMultiplier = 1; double dharokModifier = 1; double damageMultiplier = 1; int strPrayer = player.getPrayers().getStrengthPrayer(); if (strPrayer == 1) { powerMultiplier += 0.05; } else if (strPrayer == 2) { powerMultiplier += 0.1; } else if (strPrayer == 3) { powerMultiplier += 0.15; } else if (player.getPrayers().getSuperPrayer() == 1) { powerMultiplier += 0.18; } else if (player.getPrayers().getSuperPrayer() == 2) { powerMultiplier += 0.23; } if (wearingMeleeVoid(player)) { damageMultiplier += 0.1; } else if (wearingDharok(player) && misc.random(3) == 0) { dharokModifier = misc.random((int)((player.getSkills().getGreaterLevel(Skills.SKILL.HITPOINTS) - player.getSkills().getCurLevel(Skills.SKILL.HITPOINTS)) * 0.1)); } if (fightType.Equals(AttackStyle.CombatSkill.AGGRESSIVE)) { fightingStyle = 3; } else if (fightType.Equals(AttackStyle.CombatSkill.CONTROLLED)) { fightingStyle = 1; } double cumulativeStrength = ((myCurStrength) * (powerMultiplier) + fightingStyle) * dharokModifier; double maxHit = ((13 + (cumulativeStrength) + (myEquipStrengthBonus / 8) + ((cumulativeStrength * myEquipStrengthBonus) / 64)) * damageMultiplier); // NEW MAX HIT FORMULA maxHit = maxHit / 10; //this is temporary because I haven't yet fully implemented the huge damage system. return maxHit; }