mirror of
https://github.com/2006-Scape/2006Scape.git
synced 2026-07-07 00:32:06 +00:00
Projectile clipping, PassDoor fix (#176)
* Numbered packet sizes. Corrected sound packet length to 6 from 5. Corrected sound packet in server. Teleport sound now plays correctly. Corrected modern teleport animation playthrough. Removed redundant teleport delay. * Changed sendSound packet size back to 5 and removed type attribute to maintain compatibility with Parabot. * After running around an object to attack the player will no longer wait a number of ticks to start attacking again. Fixed an issue where walkTo being called from CycleEvents would not execute correctly. Player will no longer face a killed npc after it respawns. Added projectile clipping. Added a new algorithm for player->player/npc following that accounts for projectile clipping.
This commit is contained in:
committed by
Daniel Ginovker
parent
a4e4b89d99
commit
c827d46ca0
@@ -21,6 +21,7 @@ import redone.game.content.music.sound.CombatSounds;
|
||||
import redone.game.content.music.sound.SoundList;
|
||||
import redone.game.content.skills.slayer.SlayerRequirements;
|
||||
import redone.game.items.ItemAssistant;
|
||||
import redone.game.npcs.Npc;
|
||||
import redone.game.npcs.NpcHandler;
|
||||
import redone.game.players.Client;
|
||||
import redone.game.players.Player;
|
||||
@@ -430,21 +431,91 @@ public class CombatAssistant {
|
||||
}
|
||||
}
|
||||
|
||||
public void attackingNpcTick() {
|
||||
int i = c.npcIndex;
|
||||
if (i > 0 && NpcHandler.npcs[i] != null) {
|
||||
if (NpcHandler.npcs[i].isDead) {
|
||||
c.npcIndex = 0;
|
||||
c.followId2 = 0;
|
||||
c.faceNpc(0);
|
||||
return;
|
||||
}
|
||||
|
||||
boolean projectile = c.usingBow || c.usingMagic || c.usingRangeWeapon;
|
||||
if (projectile && !PathFinder.isProjectilePathClear(c.absX, c.absY, c.heightLevel, NpcHandler.npcs[i].absX, NpcHandler.npcs[i].absY)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!c.goodDistance(c.getX(), c.getY(), NpcHandler.npcs[i].getX(), NpcHandler.npcs[i].getY(), 2) && RangeData.usingHally(c) && !c.usingRangeWeapon && !c.usingBow && !c.usingMagic
|
||||
|| !c.goodDistance(c.getX(), c.getY(), NpcHandler.npcs[i].getX(), NpcHandler.npcs[i].getY(), 4) && c.usingRangeWeapon&& !c.usingBow && !c.usingMagic
|
||||
|| !c.goodDistance(c.getX(), c.getY(), NpcHandler.npcs[i].getX(), NpcHandler.npcs[i].getY(), 1)&& !c.usingRangeWeapon && !RangeData.usingHally(c) && !c.usingBow && !c.usingMagic
|
||||
|| !c.goodDistance(c.getX(), c.getY(), NpcHandler.npcs[i].getX(), NpcHandler.npcs[i].getY(), 8) && (c.usingBow || c.usingMagic)) {
|
||||
return;
|
||||
} else {
|
||||
c.stopMovement();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void attackingPlayerTick() {
|
||||
int i = c.playerIndex;
|
||||
if (i > 0 && PlayerHandler.players[i] != null) {
|
||||
if (PlayerHandler.players[i].isDead) {
|
||||
c.playerIndex = 0;
|
||||
c.followId = 0;
|
||||
c.faceNpc(0);
|
||||
return;
|
||||
}
|
||||
|
||||
boolean projectile = c.usingBow || c.usingMagic || c.usingRangeWeapon;
|
||||
if (projectile && !PathFinder.isProjectilePathClear(c.absX, c.absY, c.heightLevel, PlayerHandler.players[i].absX, PlayerHandler.players[i].absY)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!c.goodDistance(c.getX(), c.getY(),
|
||||
PlayerHandler.players[i].getX(),
|
||||
PlayerHandler.players[i].getY(), 4)
|
||||
&& c.usingRangeWeapon
|
||||
&& !c.usingBow
|
||||
&& !c.usingMagic
|
||||
|| !c.goodDistance(c.getX(), c.getY(),
|
||||
PlayerHandler.players[i].getX(),
|
||||
PlayerHandler.players[i].getY(), 2)
|
||||
&& !c.usingRangeWeapon
|
||||
&& RangeData.usingHally(c)
|
||||
&& !c.usingBow
|
||||
&& !c.usingMagic
|
||||
|| !c.goodDistance(c.getX(), c.getY(),
|
||||
PlayerHandler.players[i].getX(),
|
||||
PlayerHandler.players[i].getY(),
|
||||
getRequiredDistance())
|
||||
&& !c.usingRangeWeapon
|
||||
&& !RangeData.usingHally(c)
|
||||
&& !c.usingBow
|
||||
&& !c.usingMagic
|
||||
|| !c.goodDistance(c.getX(), c.getY(),
|
||||
PlayerHandler.players[i].getX(),
|
||||
PlayerHandler.players[i].getY(), 10)
|
||||
&& (c.usingBow || c.usingMagic)) {
|
||||
return;
|
||||
} else {
|
||||
c.stopMovement();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void attackNpc(int i) {
|
||||
// int equippedWeapon = c.playerEquipment[c.playerWeapon];
|
||||
// final int npcId = NPCHandler.npcs[i].npcType;
|
||||
if (NpcHandler.npcs[i] != null) {
|
||||
Npc npc = NpcHandler.npcs[i];
|
||||
if (NpcHandler.npcs[i].isDead || NpcHandler.npcs[i].MaxHP <= 0) {
|
||||
c.usingMagic = false;
|
||||
c.faceUpdate(0);
|
||||
c.npcIndex = 0;
|
||||
return;
|
||||
}
|
||||
if (c.absY == 3228 && NpcHandler.npcs[i].absY == 3227) {
|
||||
resetPlayerAttack();
|
||||
return;
|
||||
}
|
||||
if (c.absY == 3224 && NpcHandler.npcs[i].absY == 3225) {
|
||||
/*if (c.absY == 3224 && NpcHandler.npcs[i].absY == 3225) {
|
||||
resetPlayerAttack();
|
||||
return;
|
||||
}
|
||||
@@ -459,7 +530,7 @@ public class CombatAssistant {
|
||||
if (c.absX == 3252 && c.absY > 3254 && c.absY < 3272 || c.absY == 3254 && c.absX > 3252 && c.absX < 3265) {
|
||||
resetPlayerAttack();
|
||||
return;
|
||||
}
|
||||
}*/
|
||||
if (c.usingMagic && MagicData.MAGIC_SPELLS[c.spellId][0] == 1171) {
|
||||
if (!NpcHandler.isUndead(i)) {
|
||||
c.getActionSender().sendMessage("This spell only affects skeletons, zombies, ghosts and shades.");
|
||||
@@ -546,12 +617,13 @@ public class CombatAssistant {
|
||||
c.getActionSender().sendMessage("This monster was not spawned for you.");
|
||||
return;
|
||||
}
|
||||
|
||||
c.followId2 = i;
|
||||
c.followId = 0;
|
||||
if (c.attackTimer <= 0) {
|
||||
boolean usingBow = false;
|
||||
c.usingBow = false;
|
||||
c.usingRangeWeapon = false;
|
||||
boolean usingArrows = false;
|
||||
boolean usingOtherRangeWeapons = false;
|
||||
boolean usingCross = c.playerEquipment[c.playerWeapon] == 9185;
|
||||
c.bonusAttack = 0;
|
||||
c.rangeItemUsed = 0;
|
||||
@@ -563,13 +635,13 @@ public class CombatAssistant {
|
||||
if (c.spellId > 0) {
|
||||
c.usingMagic = true;
|
||||
}
|
||||
c.attackTimer = getAttackDelay();
|
||||
|
||||
c.specAccuracy = 1.0;
|
||||
c.specDamage = 1.0;
|
||||
if (!c.usingMagic) {
|
||||
for (int bowId : RangeData.BOWS) {
|
||||
if (c.playerEquipment[c.playerWeapon] == bowId) {
|
||||
usingBow = true;
|
||||
c.usingBow = true;
|
||||
for (int arrowId : RangeData.ARROWS) {
|
||||
if (c.playerEquipment[c.playerArrows] == arrowId) {
|
||||
usingArrows = true;
|
||||
@@ -580,44 +652,41 @@ public class CombatAssistant {
|
||||
|
||||
for (int otherRangeId : RangeData.OTHER_RANGE_WEAPONS) {
|
||||
if (c.playerEquipment[c.playerWeapon] == otherRangeId) {
|
||||
usingOtherRangeWeapons = true;
|
||||
c.usingRangeWeapon = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (armaNpc(i) && !usingCross && !usingBow && !c.usingMagic
|
||||
&& !RangeData.usingCrystalBow(c) && !usingOtherRangeWeapons) {
|
||||
if (armaNpc(i) && !usingCross && !c.usingBow && !c.usingMagic
|
||||
&& !RangeData.usingCrystalBow(c) && !c.usingRangeWeapon) {
|
||||
resetPlayerAttack();
|
||||
return;
|
||||
}
|
||||
if (usingOtherRangeWeapons || usingBow
|
||||
if (c.usingRangeWeapon || c.usingBow
|
||||
&& Constants.combatSounds
|
||||
&& NpcHandler.npcs[i].npcType < 3177
|
||||
&& NpcHandler.npcs[i].npcType > 3180) {
|
||||
c.getActionSender().sendSound(SoundList.SHOOT_ARROW,
|
||||
100, 0);
|
||||
}
|
||||
if (!c.goodDistance(c.getX(), c.getY(), NpcHandler.npcs[i].getX(), NpcHandler.npcs[i].getY(), 2) && RangeData.usingHally(c) && !usingOtherRangeWeapons && !usingBow && !c.usingMagic || !c.goodDistance(c.getX(), c.getY(), NpcHandler.npcs[i].getX(), NpcHandler.npcs[i].getY(), 4)
|
||||
&& usingOtherRangeWeapons
|
||||
&& !usingBow
|
||||
&& !c.usingMagic
|
||||
|| !c.goodDistance(c.getX(), c.getY(),
|
||||
NpcHandler.npcs[i].getX(),
|
||||
NpcHandler.npcs[i].getY(), 1)
|
||||
&& !usingOtherRangeWeapons
|
||||
&& !RangeData.usingHally(c)
|
||||
&& !usingBow
|
||||
&& !c.usingMagic
|
||||
|| !c.goodDistance(c.getX(), c.getY(),
|
||||
NpcHandler.npcs[i].getX(),
|
||||
NpcHandler.npcs[i].getY(), 8)
|
||||
&& (usingBow || c.usingMagic)) {
|
||||
c.attackTimer = 2;
|
||||
|
||||
boolean projectile = c.usingBow || c.usingMagic || c.usingRangeWeapon;
|
||||
|
||||
if (projectile && !PathFinder.isProjectilePathClear(c.absX, c.absY, c.heightLevel, npc.absX, npc.absY)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!c.goodDistance(c.getX(), c.getY(), NpcHandler.npcs[i].getX(), NpcHandler.npcs[i].getY(), 2) && RangeData.usingHally(c) && !c.usingRangeWeapon && !c.usingBow && !c.usingMagic
|
||||
|| !c.goodDistance(c.getX(), c.getY(), NpcHandler.npcs[i].getX(), NpcHandler.npcs[i].getY(), 4) && c.usingRangeWeapon && !c.usingBow && !c.usingMagic
|
||||
|| !c.goodDistance(c.getX(), c.getY(), NpcHandler.npcs[i].getX(), NpcHandler.npcs[i].getY(), 1)&& !c.usingRangeWeapon && !RangeData.usingHally(c) && !c.usingBow && !c.usingMagic
|
||||
|| !c.goodDistance(c.getX(), c.getY(), NpcHandler.npcs[i].getX(), NpcHandler.npcs[i].getY(), 8) && (c.usingBow || c.usingMagic)) {
|
||||
return;
|
||||
} else {
|
||||
c.stopMovement();
|
||||
}
|
||||
|
||||
if (!usingCross
|
||||
&& !usingArrows
|
||||
&& usingBow
|
||||
&& c.usingBow
|
||||
&& (c.playerEquipment[c.playerWeapon] < 4212 || c.playerEquipment[c.playerWeapon] > 4223)) {
|
||||
c.getActionSender().sendMessage(
|
||||
"There is no ammo left in your quiver.");
|
||||
@@ -626,7 +695,7 @@ public class CombatAssistant {
|
||||
return;
|
||||
}
|
||||
if (RangeData.correctBowAndArrows(c) < c.playerEquipment[c.playerArrows]
|
||||
&& Constants.CORRECT_ARROWS && usingBow
|
||||
&& Constants.CORRECT_ARROWS && c.usingBow
|
||||
&& !RangeData.usingCrystalBow(c)
|
||||
&& c.playerEquipment[c.playerWeapon] != 9185) {
|
||||
c.getItemAssistant();
|
||||
@@ -653,30 +722,14 @@ public class CombatAssistant {
|
||||
return;
|
||||
}
|
||||
|
||||
if (usingBow
|
||||
if (c.usingBow
|
||||
|| c.usingMagic
|
||||
|| usingOtherRangeWeapons
|
||||
|| c.usingRangeWeapon
|
||||
|| c.goodDistance(c.getX(), c.getY(),
|
||||
NpcHandler.npcs[i].getX(),
|
||||
NpcHandler.npcs[i].getY(), 2) && RangeData.usingHally(c)) {
|
||||
c.stopMovement();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Npc projectiles
|
||||
*/
|
||||
if (PlayerAssistant.pathBlocked(c, NpcHandler.npcs[i])) {
|
||||
if((c.usingBow || c.usingMagic || usingOtherRangeWeapons || c.autocasting)) {
|
||||
PathFinder.getPathFinder().findRoute(c, NpcHandler.npcs[i].getX(), NpcHandler.npcs[i].getY(), true, 8, 8);
|
||||
if(!c.usingBow && !c.usingMagic && !usingOtherRangeWeapons && !c.autocasting) {
|
||||
PathFinder.getPathFinder().findRoute(c,NpcHandler.npcs[i].getX(), NpcHandler.npcs[i].getY(), true, 1, 1);
|
||||
c.attackTimer = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!checkMagicReqs(c.spellId)) {
|
||||
c.stopMovement();
|
||||
@@ -685,6 +738,7 @@ public class CombatAssistant {
|
||||
}
|
||||
|
||||
c.faceUpdate(i);
|
||||
c.attackTimer = getAttackDelay();
|
||||
NpcHandler.npcs[i].underAttackBy = c.playerId;
|
||||
NpcHandler.npcs[i].lastDamageTaken = System.currentTimeMillis();
|
||||
if (c.usingSpecial && !c.usingMagic) {
|
||||
@@ -729,7 +783,7 @@ public class CombatAssistant {
|
||||
}
|
||||
c.lastWeaponUsed = c.playerEquipment[c.playerWeapon];
|
||||
c.lastArrowUsed = c.playerEquipment[c.playerArrows];
|
||||
if (!usingBow && !c.usingMagic && !usingOtherRangeWeapons) { // melee
|
||||
if (!c.usingBow && !c.usingMagic && !c.usingRangeWeapon) { // melee
|
||||
// hit
|
||||
// delay
|
||||
c.hitDelay = getHitDelay();
|
||||
@@ -737,7 +791,7 @@ public class CombatAssistant {
|
||||
c.oldNpcIndex = i;
|
||||
}
|
||||
|
||||
if (usingBow && !usingOtherRangeWeapons && !c.usingMagic
|
||||
if (c.usingBow && !c.usingRangeWeapon && !c.usingMagic
|
||||
|| usingCross) { // range hit delay
|
||||
if (usingCross) {
|
||||
c.usingBow = true;
|
||||
@@ -763,7 +817,7 @@ public class CombatAssistant {
|
||||
fireProjectileNpc();
|
||||
}
|
||||
|
||||
if (usingOtherRangeWeapons && !c.usingMagic && !usingBow) { // knives,
|
||||
if (c.usingRangeWeapon && !c.usingMagic && !c.usingBow) { // knives,
|
||||
// darts,
|
||||
// etc
|
||||
// hit
|
||||
@@ -813,7 +867,7 @@ public class CombatAssistant {
|
||||
}
|
||||
}
|
||||
|
||||
if (usingBow && Constants.CRYSTAL_BOW_DEGRADES) { // crystal
|
||||
if (c.usingBow && Constants.CRYSTAL_BOW_DEGRADES) { // crystal
|
||||
// bow
|
||||
// degrading
|
||||
if (c.playerEquipment[c.playerWeapon] == 4212) { // new
|
||||
@@ -871,13 +925,13 @@ public class CombatAssistant {
|
||||
int equippedWeapon = c.playerEquipment[c.playerWeapon];
|
||||
|
||||
if (PlayerHandler.players[i] != null) {
|
||||
|
||||
if (c.usingMagic && MagicData.MAGIC_SPELLS[c.spellId][0] == 1171) {
|
||||
c.getActionSender().sendMessage("This spell only affects skeletons, zombies, ghosts and shades, not humans.");
|
||||
resetPlayerAttack();
|
||||
c.stopMovement();
|
||||
return;
|
||||
}
|
||||
|
||||
if (c.usingMagic && MagicData.MAGIC_SPELLS[c.spellId][0] == 1171) {
|
||||
c.getActionSender().sendMessage("This spell only affects skeletons, zombies, ghosts and shades, not humans.");
|
||||
resetPlayerAttack();
|
||||
c.stopMovement();
|
||||
return;
|
||||
}
|
||||
|
||||
if (CastleWars.isInCw(PlayerHandler.players[i])
|
||||
&& CastleWars.isInCw(c)) {
|
||||
@@ -935,9 +989,7 @@ public class CombatAssistant {
|
||||
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.projectileStage = 0;
|
||||
if (c.absX == PlayerHandler.players[i].absX
|
||||
@@ -953,7 +1005,7 @@ public class CombatAssistant {
|
||||
if (!c.usingMagic) {
|
||||
for (int bowId : RangeData.BOWS) {
|
||||
if (c.playerEquipment[c.playerWeapon] == bowId) {
|
||||
usingBow = true;
|
||||
c.usingBow = true;
|
||||
for (int arrowId : RangeData.ARROWS) {
|
||||
if (c.playerEquipment[c.playerArrows] == arrowId) {
|
||||
usingArrows = true;
|
||||
@@ -964,7 +1016,7 @@ public class CombatAssistant {
|
||||
|
||||
for (int otherRangeId : RangeData.OTHER_RANGE_WEAPONS) {
|
||||
if (c.playerEquipment[c.playerWeapon] == otherRangeId) {
|
||||
usingOtherRangeWeapons = true;
|
||||
c.usingRangeWeapon = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -975,7 +1027,7 @@ public class CombatAssistant {
|
||||
if (c.spellId > 0) {
|
||||
c.usingMagic = true;
|
||||
}
|
||||
c.attackTimer = getAttackDelay();
|
||||
|
||||
|
||||
if (c.duelRule[9]) {
|
||||
boolean canUseWeapon = false;
|
||||
@@ -991,12 +1043,13 @@ public class CombatAssistant {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (c.duelRule[2] && (usingBow || usingOtherRangeWeapons)) {
|
||||
|
||||
if (c.duelRule[2] && (c.usingBow || c.usingRangeWeapon)) {
|
||||
c.getActionSender().sendMessage(
|
||||
"Range has been disabled in this duel!");
|
||||
return;
|
||||
}
|
||||
if (c.duelRule[3] && !usingBow && !usingOtherRangeWeapons
|
||||
if (c.duelRule[3] && !c.usingBow && !c.usingRangeWeapon
|
||||
&& !c.usingMagic) {
|
||||
c.getActionSender().sendMessage(
|
||||
"Melee has been disabled in this duel!");
|
||||
@@ -1010,34 +1063,40 @@ public class CombatAssistant {
|
||||
return;
|
||||
}
|
||||
|
||||
boolean projectile = c.usingBow || c.usingMagic || c.usingRangeWeapon;
|
||||
|
||||
if (projectile && !PathFinder.isProjectilePathClear(c.absX, c.absY, c.heightLevel, PlayerHandler.players[i].absX, PlayerHandler.players[i].absY)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!c.goodDistance(c.getX(), c.getY(),
|
||||
PlayerHandler.players[i].getX(),
|
||||
PlayerHandler.players[i].getY(), 4)
|
||||
&& usingOtherRangeWeapons
|
||||
&& !usingBow
|
||||
&& c.usingRangeWeapon
|
||||
&& !c.usingBow
|
||||
&& !c.usingMagic
|
||||
|| !c.goodDistance(c.getX(), c.getY(),
|
||||
PlayerHandler.players[i].getX(),
|
||||
PlayerHandler.players[i].getY(), 2)
|
||||
&& !usingOtherRangeWeapons
|
||||
PlayerHandler.players[i].getX(),
|
||||
PlayerHandler.players[i].getY(), 2)
|
||||
&& !c.usingRangeWeapon
|
||||
&& RangeData.usingHally(c)
|
||||
&& !usingBow
|
||||
&& !c.usingBow
|
||||
&& !c.usingMagic
|
||||
|| !c.goodDistance(c.getX(), c.getY(),
|
||||
PlayerHandler.players[i].getX(),
|
||||
PlayerHandler.players[i].getY(),
|
||||
getRequiredDistance())
|
||||
&& !usingOtherRangeWeapons
|
||||
PlayerHandler.players[i].getX(),
|
||||
PlayerHandler.players[i].getY(),
|
||||
getRequiredDistance())
|
||||
&& !c.usingRangeWeapon
|
||||
&& !RangeData.usingHally(c)
|
||||
&& !usingBow
|
||||
&& !c.usingBow
|
||||
&& !c.usingMagic
|
||||
|| !c.goodDistance(c.getX(), c.getY(),
|
||||
PlayerHandler.players[i].getX(),
|
||||
PlayerHandler.players[i].getY(), 10)
|
||||
&& (usingBow || c.usingMagic)) {
|
||||
PlayerHandler.players[i].getX(),
|
||||
PlayerHandler.players[i].getY(), 10)
|
||||
&& (c.usingBow || c.usingMagic)) {
|
||||
// c.getPacketDispatcher().sendMessage("Setting attack timer to 1");
|
||||
c.attackTimer = 1;
|
||||
if (!usingBow && !c.usingMagic && !usingOtherRangeWeapons
|
||||
//c.attackTimer = 1;
|
||||
if (!c.usingBow && !c.usingMagic && !c.usingRangeWeapon
|
||||
&& c.freezeTimer > 0) {
|
||||
resetPlayerAttack();
|
||||
}
|
||||
@@ -1046,7 +1105,7 @@ public class CombatAssistant {
|
||||
|
||||
if (!usingCross
|
||||
&& !usingArrows
|
||||
&& usingBow
|
||||
&& c.usingBow
|
||||
&& (c.playerEquipment[c.playerWeapon] < 4212 || c.playerEquipment[c.playerWeapon] > 4223)
|
||||
&& !c.usingMagic) {
|
||||
c.getActionSender().sendMessage(
|
||||
@@ -1056,7 +1115,7 @@ public class CombatAssistant {
|
||||
return;
|
||||
}
|
||||
if (RangeData.correctBowAndArrows(c) < c.playerEquipment[c.playerArrows]
|
||||
&& Constants.CORRECT_ARROWS && usingBow
|
||||
&& Constants.CORRECT_ARROWS && c.usingBow
|
||||
&& !RangeData.usingCrystalBow(c)
|
||||
&& c.playerEquipment[c.playerWeapon] != 9185
|
||||
&& !c.usingMagic) {
|
||||
@@ -1065,12 +1124,12 @@ public class CombatAssistant {
|
||||
c.getActionSender().sendMessage(
|
||||
"You can't use "
|
||||
+ ItemAssistant.getItemName(
|
||||
c.playerEquipment[c.playerArrows])
|
||||
.toLowerCase()
|
||||
c.playerEquipment[c.playerArrows])
|
||||
.toLowerCase()
|
||||
+ "s with a "
|
||||
+ ItemAssistant.getItemName(
|
||||
c.playerEquipment[c.playerWeapon])
|
||||
.toLowerCase() + ".");
|
||||
c.playerEquipment[c.playerWeapon])
|
||||
.toLowerCase() + ".");
|
||||
c.stopMovement();
|
||||
resetPlayerAttack();
|
||||
return;
|
||||
@@ -1084,25 +1143,11 @@ public class CombatAssistant {
|
||||
return;
|
||||
}
|
||||
|
||||
if (usingBow || c.usingMagic || usingOtherRangeWeapons
|
||||
if (c.usingBow || c.usingMagic || c.usingRangeWeapon
|
||||
|| RangeData.usingHally(c)) {
|
||||
c.stopMovement();
|
||||
}
|
||||
|
||||
/**
|
||||
* Player projectiles
|
||||
*/
|
||||
if(PlayerAssistant.pathBlocked(c, o)) {
|
||||
if((c.usingBow || c.usingMagic || usingOtherRangeWeapons || c.autocasting)) {
|
||||
PathFinder.getPathFinder().findRoute(c, o.absX, o.absY, true, 8, 8);
|
||||
if(!c.usingBow && !c.usingMagic && !usingOtherRangeWeapons && !c.autocasting) {
|
||||
PathFinder.getPathFinder().findRoute(c, o.absX, o.absY, true, 1, 1);
|
||||
c.attackTimer = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!checkMagicReqs(c.spellId)) {
|
||||
c.stopMovement();
|
||||
resetPlayerAttack();
|
||||
@@ -1116,7 +1161,7 @@ public class CombatAssistant {
|
||||
&& FightPits.getState(c) == null) {
|
||||
if (!c.attackedPlayers.contains(c.playerIndex)
|
||||
&& !PlayerHandler.players[c.playerIndex].attackedPlayers
|
||||
.contains(c.playerId)) {
|
||||
.contains(c.playerId)) {
|
||||
c.attackedPlayers.add(c.playerIndex);
|
||||
c.isSkulled = true;
|
||||
c.skullTimer = Constants.SKULL_TIMER;
|
||||
@@ -1183,24 +1228,26 @@ public class CombatAssistant {
|
||||
0);
|
||||
}
|
||||
}
|
||||
|
||||
c.attackTimer = getAttackDelay();
|
||||
PlayerHandler.players[i].underAttackBy = c.playerId;
|
||||
PlayerHandler.players[i].logoutDelay = System.currentTimeMillis();
|
||||
PlayerHandler.players[i].singleCombatDelay = System.currentTimeMillis();
|
||||
PlayerHandler.players[i].killerId = c.playerId;
|
||||
c.lastArrowUsed = 0;
|
||||
c.rangeItemUsed = 0;
|
||||
if (!usingBow && !c.usingMagic && !usingOtherRangeWeapons) { // melee
|
||||
// hit
|
||||
// delay;
|
||||
if (!c.usingBow && !c.usingMagic && !c.usingRangeWeapon) { // melee
|
||||
// hit
|
||||
// delay;
|
||||
c.followId = PlayerHandler.players[c.playerIndex].playerId;
|
||||
c.getPlayerAssistant().followPlayer();
|
||||
//c.getPlayerAssistant().followPlayer();
|
||||
c.hitDelay = getHitDelay();
|
||||
c.delayedDamage = Misc.random(meleeMaxHit());
|
||||
c.projectileStage = 0;
|
||||
c.oldPlayerIndex = i;
|
||||
}
|
||||
|
||||
if (usingBow && !usingOtherRangeWeapons && !c.usingMagic
|
||||
if (c.usingBow && !c.usingRangeWeapon && !c.usingMagic
|
||||
|| usingCross) { // range hit delay
|
||||
if (c.playerEquipment[c.playerWeapon] >= 4212
|
||||
&& c.playerEquipment[c.playerWeapon] <= 4223) {
|
||||
@@ -1219,7 +1266,7 @@ public class CombatAssistant {
|
||||
|
||||
c.usingBow = true;
|
||||
c.followId = PlayerHandler.players[c.playerIndex].playerId;
|
||||
c.getPlayerAssistant().followPlayer();
|
||||
//c.getPlayerAssistant().followPlayer();
|
||||
c.lastWeaponUsed = c.playerEquipment[c.playerWeapon];
|
||||
c.lastArrowUsed = c.playerEquipment[c.playerArrows];
|
||||
c.gfx100(RangeData.getRangeStartGFX(c));
|
||||
@@ -1229,12 +1276,12 @@ public class CombatAssistant {
|
||||
fireProjectilePlayer();
|
||||
}
|
||||
|
||||
if (usingOtherRangeWeapons) { // knives, darts, etc hit delay
|
||||
if (c.usingRangeWeapon) { // knives, darts, etc hit delay
|
||||
c.rangeItemUsed = c.playerEquipment[c.playerWeapon];
|
||||
c.getItemAssistant().deleteEquipment();
|
||||
c.usingRangeWeapon = true;
|
||||
c.followId = PlayerHandler.players[c.playerIndex].playerId;
|
||||
c.getPlayerAssistant().followPlayer();
|
||||
//c.getPlayerAssistant().followPlayer();
|
||||
c.gfx100(RangeData.getRangeStartGFX(c));
|
||||
if (c.fightMode == 2) {
|
||||
c.attackTimer--;
|
||||
@@ -1307,42 +1354,42 @@ public class CombatAssistant {
|
||||
}
|
||||
}
|
||||
|
||||
if (usingBow && Constants.CRYSTAL_BOW_DEGRADES) { // crystal
|
||||
// bow
|
||||
// degrading
|
||||
if (c.usingBow && Constants.CRYSTAL_BOW_DEGRADES) { // crystal
|
||||
// bow
|
||||
// degrading
|
||||
if (c.playerEquipment[c.playerWeapon] == 4212) { // new
|
||||
// crystal
|
||||
// bow
|
||||
// becomes
|
||||
// full
|
||||
// bow
|
||||
// on
|
||||
// the
|
||||
// first
|
||||
// shot
|
||||
// crystal
|
||||
// bow
|
||||
// becomes
|
||||
// full
|
||||
// bow
|
||||
// on
|
||||
// the
|
||||
// first
|
||||
// shot
|
||||
c.getItemAssistant().wearItem(4214, 1, 3);
|
||||
}
|
||||
if (c.crystalBowArrowCount >= 250) {
|
||||
switch (c.playerEquipment[c.playerWeapon]) {
|
||||
|
||||
case 4223: // 1/10 bow
|
||||
c.getItemAssistant().wearItem(-1, 1, 3);
|
||||
c.getActionSender().sendMessage(
|
||||
"Your crystal bow has fully degraded.");
|
||||
if (!c.getItemAssistant().addItem(4207, 1)) {
|
||||
Server.itemHandler.createGroundItem(c, 4207,
|
||||
c.getX(), c.getY(), 1, c.getId());
|
||||
}
|
||||
c.crystalBowArrowCount = 0;
|
||||
break;
|
||||
case 4223: // 1/10 bow
|
||||
c.getItemAssistant().wearItem(-1, 1, 3);
|
||||
c.getActionSender().sendMessage(
|
||||
"Your crystal bow has fully degraded.");
|
||||
if (!c.getItemAssistant().addItem(4207, 1)) {
|
||||
Server.itemHandler.createGroundItem(c, 4207,
|
||||
c.getX(), c.getY(), 1, c.getId());
|
||||
}
|
||||
c.crystalBowArrowCount = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
c.getItemAssistant().wearItem(
|
||||
++c.playerEquipment[c.playerWeapon], 1, 3);
|
||||
c.getActionSender().sendMessage(
|
||||
"Your crystal bow degrades.");
|
||||
c.crystalBowArrowCount = 0;
|
||||
break;
|
||||
default:
|
||||
c.getItemAssistant().wearItem(
|
||||
++c.playerEquipment[c.playerWeapon], 1, 3);
|
||||
c.getActionSender().sendMessage(
|
||||
"Your crystal bow degrades.");
|
||||
c.crystalBowArrowCount = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,31 +51,37 @@ public class MagicTeleports {
|
||||
|
||||
public static final boolean MAGIC_LEVEL_REQUIRED = true, RUNES_REQUIRED = true;
|
||||
|
||||
public static boolean teleportCheck(Client player) {
|
||||
if (player.teleTimer > 0) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void paddewwaTeleport(Client player) {
|
||||
if (System.currentTimeMillis() - player.lastCast < 5000) {
|
||||
return;
|
||||
}
|
||||
RandomEventHandler.addRandom(player);
|
||||
if (RUNES_REQUIRED) {
|
||||
if (!CastRequirements.hasRunes(player, new int[][]{{LAW_RUNE, 2}, {FIRE_RUNE, 1}, {AIR_RUNE, 1}})) {
|
||||
player.getActionSender().sendMessage("You don't have the required runes to cast this spell.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (MAGIC_LEVEL_REQUIRED) {
|
||||
if (player.playerLevel[player.playerMagic] < 54) {
|
||||
player.getActionSender().sendMessage("You need a magic level of 54 to cast this spell.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
CastRequirements.deleteRunes(player, new int[][]{{LAW_RUNE, 2}, {FIRE_RUNE, 1}, {AIR_RUNE, 1}});
|
||||
player.getPlayerAssistant().startTeleport(PADDEWWA_X + Misc.random(2), PADDEWWA_Y - Misc.random(2), 0, "ancient");
|
||||
player.lastCast = System.currentTimeMillis();
|
||||
player.getPlayerAssistant().addSkillXP(64, player.playerMagic);
|
||||
if (!teleportCheck(player)) {
|
||||
return;
|
||||
}
|
||||
RandomEventHandler.addRandom(player);
|
||||
if (RUNES_REQUIRED) {
|
||||
if (!CastRequirements.hasRunes(player, new int[][]{{LAW_RUNE, 2}, {FIRE_RUNE, 1}, {AIR_RUNE, 1}})) {
|
||||
player.getActionSender().sendMessage("You don't have the required runes to cast this spell.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (MAGIC_LEVEL_REQUIRED) {
|
||||
if (player.playerLevel[player.playerMagic] < 54) {
|
||||
player.getActionSender().sendMessage("You need a magic level of 54 to cast this spell.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
CastRequirements.deleteRunes(player, new int[][]{{LAW_RUNE, 2}, {FIRE_RUNE, 1}, {AIR_RUNE, 1}});
|
||||
player.getPlayerAssistant().startTeleport(PADDEWWA_X + Misc.random(2), PADDEWWA_Y - Misc.random(2), 0, "ancient");
|
||||
player.getPlayerAssistant().addSkillXP(64, player.playerMagic);
|
||||
}
|
||||
|
||||
public static void senntisenTeleport(Client player) {
|
||||
if (System.currentTimeMillis() - player.lastCast < 5000) {
|
||||
if (!teleportCheck(player)) {
|
||||
return;
|
||||
}
|
||||
RandomEventHandler.addRandom(player);
|
||||
@@ -93,12 +99,11 @@ public class MagicTeleports {
|
||||
}
|
||||
CastRequirements.deleteRunes(player, new int[][]{{LAW_RUNE, 2}, {SOUL_RUNE, 1}});
|
||||
player.getPlayerAssistant().startTeleport(SENNTISTEN_X + Misc.random(1), SENNTISTEN_Y - Misc.random(1), 0, "ancient");
|
||||
player.lastCast = System.currentTimeMillis();
|
||||
player.getPlayerAssistant().addSkillXP(70, player.playerMagic);
|
||||
}
|
||||
|
||||
public static void kharyllTeleport(Client player) {
|
||||
if (System.currentTimeMillis() - player.lastCast < 5000) {
|
||||
if (!teleportCheck(player)) {
|
||||
return;
|
||||
}
|
||||
RandomEventHandler.addRandom(player);
|
||||
@@ -116,60 +121,57 @@ public class MagicTeleports {
|
||||
}
|
||||
CastRequirements.deleteRunes(player, new int[][]{{LAW_RUNE, 2}, {BLOOD_RUNE, 1}});
|
||||
player.getPlayerAssistant().startTeleport(KHARYRLL_X, KHARYRLL_Y, 0, "ancient");
|
||||
player.lastCast = System.currentTimeMillis();
|
||||
player.getPlayerAssistant().addSkillXP(76, player.playerMagic);
|
||||
}
|
||||
|
||||
public static void lassarTeleport(Client player) {
|
||||
if (System.currentTimeMillis() - player.lastCast < 5000) {
|
||||
if (!teleportCheck(player)) {
|
||||
return;
|
||||
}
|
||||
RandomEventHandler.addRandom(player);
|
||||
if (RUNES_REQUIRED) {
|
||||
if (!CastRequirements.hasRunes(player, new int[][]{{LAW_RUNE, 2}, {WATER_RUNE, 4}})) {
|
||||
player.getActionSender().sendMessage("You don't have the required runes to cast this spell.");
|
||||
return;
|
||||
}
|
||||
RandomEventHandler.addRandom(player);
|
||||
if (RUNES_REQUIRED) {
|
||||
if (!CastRequirements.hasRunes(player, new int[][]{{LAW_RUNE, 2}, {WATER_RUNE, 4}})) {
|
||||
player.getActionSender().sendMessage("You don't have the required runes to cast this spell.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (MAGIC_LEVEL_REQUIRED) {
|
||||
if (player.playerLevel[player.playerMagic] < 72) {
|
||||
player.getActionSender().sendMessage("You need a magic level of 72 to cast this spell.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
CastRequirements.deleteRunes(player, new int[][]{{LAW_RUNE, 2}, {WATER_RUNE, 4}});
|
||||
player.getPlayerAssistant().startTeleport(LASSAR_X + Misc.random(2), LASSAR_Y - Misc.random(2), 0, "ancient");
|
||||
player.lastCast = System.currentTimeMillis();
|
||||
player.getPlayerAssistant().addSkillXP(82, player.playerMagic);
|
||||
}
|
||||
if (MAGIC_LEVEL_REQUIRED) {
|
||||
if (player.playerLevel[player.playerMagic] < 72) {
|
||||
player.getActionSender().sendMessage("You need a magic level of 72 to cast this spell.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
CastRequirements.deleteRunes(player, new int[][]{{LAW_RUNE, 2}, {WATER_RUNE, 4}});
|
||||
player.getPlayerAssistant().startTeleport(LASSAR_X + Misc.random(2), LASSAR_Y - Misc.random(2), 0, "ancient");
|
||||
player.getPlayerAssistant().addSkillXP(82, player.playerMagic);
|
||||
}
|
||||
|
||||
public static void dareeyakTeleport(Client player) {
|
||||
if (System.currentTimeMillis() - player.lastCast < 5000) {
|
||||
return;
|
||||
}
|
||||
RandomEventHandler.addRandom(player);
|
||||
if (RUNES_REQUIRED) {
|
||||
if (!CastRequirements.hasRunes(player, new int[][]{{LAW_RUNE, 2}, {FIRE_RUNE, 3}, {AIR_RUNE, 2}})) {
|
||||
player.getActionSender().sendMessage("You don't have the required runes to cast this spell.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (MAGIC_LEVEL_REQUIRED) {
|
||||
if (player.playerLevel[player.playerMagic] < 78) {
|
||||
player.getActionSender().sendMessage("You need a magic level of 78 to cast this spell.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
CastRequirements.deleteRunes(player, new int[][]{{LAW_RUNE, 2}, {FIRE_RUNE, 3}, {AIR_RUNE, 2}});
|
||||
player.getPlayerAssistant().startTeleport(
|
||||
DAREEYAK_X + Misc.random(1),
|
||||
DAREEYAK_Y - Misc.random(1), 0, "ancient");
|
||||
player.lastCast = System.currentTimeMillis();
|
||||
player.getPlayerAssistant().addSkillXP(88, player.playerMagic);
|
||||
if (!teleportCheck(player)) {
|
||||
return;
|
||||
}
|
||||
RandomEventHandler.addRandom(player);
|
||||
if (RUNES_REQUIRED) {
|
||||
if (!CastRequirements.hasRunes(player, new int[][]{{LAW_RUNE, 2}, {FIRE_RUNE, 3}, {AIR_RUNE, 2}})) {
|
||||
player.getActionSender().sendMessage("You don't have the required runes to cast this spell.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (MAGIC_LEVEL_REQUIRED) {
|
||||
if (player.playerLevel[player.playerMagic] < 78) {
|
||||
player.getActionSender().sendMessage("You need a magic level of 78 to cast this spell.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
CastRequirements.deleteRunes(player, new int[][]{{LAW_RUNE, 2}, {FIRE_RUNE, 3}, {AIR_RUNE, 2}});
|
||||
player.getPlayerAssistant().startTeleport(
|
||||
DAREEYAK_X + Misc.random(1),
|
||||
DAREEYAK_Y - Misc.random(1), 0, "ancient");
|
||||
player.getPlayerAssistant().addSkillXP(88, player.playerMagic);
|
||||
}
|
||||
|
||||
public static void carrallangarTeleport(Client player) {
|
||||
if (System.currentTimeMillis() - player.lastCast < 5000) {
|
||||
if (!teleportCheck(player)) {
|
||||
return;
|
||||
}
|
||||
RandomEventHandler.addRandom(player);
|
||||
@@ -189,12 +191,11 @@ public class MagicTeleports {
|
||||
}
|
||||
CastRequirements.deleteRunes(player, new int[][]{{LAW_RUNE, 2}, {SOUL_RUNE, 2}});
|
||||
player.getPlayerAssistant().startTeleport(CARRALLANGAR_X + Misc.random(2), CARRALLANGAR_Y - Misc.random(2), 0, "ancient");
|
||||
player.lastCast = System.currentTimeMillis();
|
||||
player.getPlayerAssistant().addSkillXP(94, player.playerMagic);
|
||||
}
|
||||
|
||||
public static void annakarlTeleport(Client player) {
|
||||
if (System.currentTimeMillis() - player.lastCast < 5000) {
|
||||
if (!teleportCheck(player)) {
|
||||
return;
|
||||
}
|
||||
RandomEventHandler.addRandom(player);
|
||||
@@ -212,224 +213,214 @@ public class MagicTeleports {
|
||||
}
|
||||
CastRequirements.deleteRunes(player, new int[][]{{LAW_RUNE, 2}, {BLOOD_RUNE, 2}});
|
||||
player.getPlayerAssistant().startTeleport(ANNAKARL_X + Misc.random(1), ANNAKARL_Y - Misc.random(1), 0, "ancient");
|
||||
player.lastCast = System.currentTimeMillis();
|
||||
player.getPlayerAssistant().addSkillXP(100, player.playerMagic);
|
||||
}
|
||||
|
||||
public static void ghorrockTeleport(Client player) {
|
||||
if (System.currentTimeMillis() - player.lastCast < 5000) {
|
||||
if (!teleportCheck(player)) {
|
||||
return;
|
||||
}
|
||||
RandomEventHandler.addRandom(player);
|
||||
if (RUNES_REQUIRED) {
|
||||
if (!CastRequirements.hasRunes(player, new int[][]{{LAW_RUNE, 2}, {WATER_RUNE, 8}})) {
|
||||
player.getActionSender().sendMessage("You don't have the required runes to cast this spell.");
|
||||
return;
|
||||
}
|
||||
RandomEventHandler.addRandom(player);
|
||||
if (RUNES_REQUIRED) {
|
||||
if (!CastRequirements.hasRunes(player, new int[][]{{LAW_RUNE, 2}, {WATER_RUNE, 8}})) {
|
||||
player.getActionSender().sendMessage("You don't have the required runes to cast this spell.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (MAGIC_LEVEL_REQUIRED) {
|
||||
if (player.playerLevel[player.playerMagic] < 96) {
|
||||
player.getActionSender().sendMessage("You need a magic level of 96 to cast this spell.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
CastRequirements.deleteRunes(player, new int[][]{{LAW_RUNE, 2}, {WATER_RUNE, 8}});
|
||||
player.getPlayerAssistant().startTeleport(GHORROCK_X + Misc.random(3),
|
||||
GHORROCK_Y - Misc.random(3), 0, "ancient");
|
||||
player.lastCast = System.currentTimeMillis();
|
||||
player.getPlayerAssistant().addSkillXP(106, player.playerMagic);
|
||||
}
|
||||
if (MAGIC_LEVEL_REQUIRED) {
|
||||
if (player.playerLevel[player.playerMagic] < 96) {
|
||||
player.getActionSender().sendMessage("You need a magic level of 96 to cast this spell.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
CastRequirements.deleteRunes(player, new int[][]{{LAW_RUNE, 2}, {WATER_RUNE, 8}});
|
||||
player.getPlayerAssistant().startTeleport(GHORROCK_X + Misc.random(3),
|
||||
GHORROCK_Y - Misc.random(3), 0, "ancient");
|
||||
player.getPlayerAssistant().addSkillXP(106, player.playerMagic);
|
||||
}
|
||||
|
||||
public static void varrockTeleport(Client player) {
|
||||
if (System.currentTimeMillis() - player.lastCast < 5000) {
|
||||
return;
|
||||
}
|
||||
RandomEventHandler.addRandom(player);
|
||||
if (RUNES_REQUIRED) {
|
||||
if (!CastRequirements.hasRunes(player, new int[][]{{LAW_RUNE, 1}, {FIRE_RUNE, 1}, {AIR_RUNE, 3}})) {
|
||||
player.getActionSender().sendMessage("You don't have the required runes to cast this spell.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (MAGIC_LEVEL_REQUIRED) {
|
||||
if (player.playerLevel[player.playerMagic] < 25) {
|
||||
player.getActionSender().sendMessage("You need a magic level of 25 to cast this spell.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
CastRequirements.deleteRunes(player, new int[][]{{LAW_RUNE, 1}, {FIRE_RUNE, 1}, {AIR_RUNE, 3}});
|
||||
player.getPlayerAssistant().startTeleport(VARROCK_X + Misc.random(2), VARROCK_Y - Misc.random(2), 0, "modern");
|
||||
player.lastCast = System.currentTimeMillis();
|
||||
player.getPlayerAssistant().addSkillXP(35, player.playerMagic);
|
||||
if (!teleportCheck(player)) {
|
||||
return;
|
||||
}
|
||||
RandomEventHandler.addRandom(player);
|
||||
if (RUNES_REQUIRED) {
|
||||
if (!CastRequirements.hasRunes(player, new int[][]{{LAW_RUNE, 1}, {FIRE_RUNE, 1}, {AIR_RUNE, 3}})) {
|
||||
player.getActionSender().sendMessage("You don't have the required runes to cast this spell.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (MAGIC_LEVEL_REQUIRED) {
|
||||
if (player.playerLevel[player.playerMagic] < 25) {
|
||||
player.getActionSender().sendMessage("You need a magic level of 25 to cast this spell.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
CastRequirements.deleteRunes(player, new int[][]{{LAW_RUNE, 1}, {FIRE_RUNE, 1}, {AIR_RUNE, 3}});
|
||||
player.getPlayerAssistant().startTeleport(VARROCK_X + Misc.random(2), VARROCK_Y - Misc.random(2), 0, "modern");
|
||||
player.getPlayerAssistant().addSkillXP(35, player.playerMagic);
|
||||
}
|
||||
|
||||
public static void lumbridgeTeleport(Client player) {
|
||||
if (System.currentTimeMillis() - player.lastCast < 5000) {
|
||||
return;
|
||||
}
|
||||
RandomEventHandler.addRandom(player);
|
||||
if (RUNES_REQUIRED) {
|
||||
if (!CastRequirements.hasRunes(player, new int[][]{{LAW_RUNE, 1}, {EARTH_RUNE, 1}, {AIR_RUNE, 3}})) {
|
||||
player.getActionSender().sendMessage("You don't have the required runes to cast this spell.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (MAGIC_LEVEL_REQUIRED) {
|
||||
if (player.playerLevel[player.playerMagic] < 32) {
|
||||
player.getActionSender().sendMessage("You need a magic level of 32 to cast this spell.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
CastRequirements.deleteRunes(player, new int[][]{{LAW_RUNE, 1}, {EARTH_RUNE, 1}, {AIR_RUNE, 3}});
|
||||
player.getPlayerAssistant().startTeleport(LUMBRIDGE_X, LUMBRIDGE_Y, 0, "modern");
|
||||
player.lastCast = System.currentTimeMillis();
|
||||
player.getPlayerAssistant().addSkillXP(35, player.playerMagic);
|
||||
if (!teleportCheck(player)) {
|
||||
return;
|
||||
}
|
||||
RandomEventHandler.addRandom(player);
|
||||
if (RUNES_REQUIRED) {
|
||||
if (!CastRequirements.hasRunes(player, new int[][]{{LAW_RUNE, 1}, {EARTH_RUNE, 1}, {AIR_RUNE, 3}})) {
|
||||
player.getActionSender().sendMessage("You don't have the required runes to cast this spell.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (MAGIC_LEVEL_REQUIRED) {
|
||||
if (player.playerLevel[player.playerMagic] < 32) {
|
||||
player.getActionSender().sendMessage("You need a magic level of 32 to cast this spell.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
CastRequirements.deleteRunes(player, new int[][]{{LAW_RUNE, 1}, {EARTH_RUNE, 1}, {AIR_RUNE, 3}});
|
||||
player.getPlayerAssistant().startTeleport(LUMBRIDGE_X, LUMBRIDGE_Y, 0, "modern");
|
||||
player.getPlayerAssistant().addSkillXP(35, player.playerMagic);
|
||||
}
|
||||
|
||||
public static void faladorTeleport(Client player) {
|
||||
if (System.currentTimeMillis() - player.lastCast < 5000) {
|
||||
return;
|
||||
}
|
||||
RandomEventHandler.addRandom(player);
|
||||
if (RUNES_REQUIRED) {
|
||||
if (!CastRequirements.hasRunes(player, new int[][]{{LAW_RUNE, 1}, {WATER_RUNE, 1}, {AIR_RUNE, 3}})) {
|
||||
player.getActionSender().sendMessage("You don't have the required runes to cast this spell.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (MAGIC_LEVEL_REQUIRED) {
|
||||
if (player.playerLevel[player.playerMagic] < 37) {
|
||||
player.getActionSender().sendMessage("You need a magic level of 37 to cast this spell.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
CastRequirements.deleteRunes(player, new int[][]{{LAW_RUNE, 1}, {WATER_RUNE, 1}, {AIR_RUNE, 3}});
|
||||
player.getPlayerAssistant().startTeleport(FALADOR_X + Misc.random(4), FALADOR_Y - Misc.random(4), 0, "modern");
|
||||
player.lastCast = System.currentTimeMillis();
|
||||
player.getPlayerAssistant().addSkillXP(48, player.playerMagic);
|
||||
/*if (!teleportCheck(player)) {
|
||||
return;
|
||||
}*/
|
||||
RandomEventHandler.addRandom(player);
|
||||
if (RUNES_REQUIRED) {
|
||||
if (!CastRequirements.hasRunes(player, new int[][]{{LAW_RUNE, 1}, {WATER_RUNE, 1}, {AIR_RUNE, 3}})) {
|
||||
player.getActionSender().sendMessage("You don't have the required runes to cast this spell.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (MAGIC_LEVEL_REQUIRED) {
|
||||
if (player.playerLevel[player.playerMagic] < 37) {
|
||||
player.getActionSender().sendMessage("You need a magic level of 37 to cast this spell.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
CastRequirements.deleteRunes(player, new int[][]{{LAW_RUNE, 1}, {WATER_RUNE, 1}, {AIR_RUNE, 3}});
|
||||
player.getPlayerAssistant().startTeleport(FALADOR_X + Misc.random(4), FALADOR_Y - Misc.random(4), 0, "modern");
|
||||
player.getPlayerAssistant().addSkillXP(48, player.playerMagic);
|
||||
}
|
||||
|
||||
public static void camelotTeleport(Client player) {
|
||||
if (System.currentTimeMillis() - player.lastCast < 5000) {
|
||||
if (!teleportCheck(player)) {
|
||||
return;
|
||||
}
|
||||
RandomEventHandler.addRandom(player);
|
||||
if (RUNES_REQUIRED) {
|
||||
if (!CastRequirements.hasRunes(player, new int[][]{{LAW_RUNE, 1}, {AIR_RUNE, 5}})) {
|
||||
player.getActionSender().sendMessage("You don't have the required runes to cast this spell.");
|
||||
return;
|
||||
}
|
||||
RandomEventHandler.addRandom(player);
|
||||
if (RUNES_REQUIRED) {
|
||||
if (!CastRequirements.hasRunes(player, new int[][]{{LAW_RUNE, 1}, {AIR_RUNE, 5}})) {
|
||||
player.getActionSender().sendMessage("You don't have the required runes to cast this spell.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (MAGIC_LEVEL_REQUIRED) {
|
||||
if (player.playerLevel[player.playerMagic] < 45) {
|
||||
player.getActionSender().sendMessage("You need a magic level of 45 to cast this spell.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
CastRequirements.deleteRunes(player, new int[][]{{LAW_RUNE, 1}, {AIR_RUNE, 5}});
|
||||
// 2757, 3479
|
||||
player.getPlayerAssistant().startTeleport(CAMELOT_X + Misc.random(1), CAMELOT_Y - Misc.random(1), 0, "modern");
|
||||
player.lastCast = System.currentTimeMillis();
|
||||
player.getPlayerAssistant().addSkillXP(55.5, player.playerMagic);
|
||||
}
|
||||
if (MAGIC_LEVEL_REQUIRED) {
|
||||
if (player.playerLevel[player.playerMagic] < 45) {
|
||||
player.getActionSender().sendMessage("You need a magic level of 45 to cast this spell.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
CastRequirements.deleteRunes(player, new int[][]{{LAW_RUNE, 1}, {AIR_RUNE, 5}});
|
||||
// 2757, 3479
|
||||
player.getPlayerAssistant().startTeleport(CAMELOT_X + Misc.random(1), CAMELOT_Y - Misc.random(1), 0, "modern");
|
||||
player.getPlayerAssistant().addSkillXP(55.5, player.playerMagic);
|
||||
}
|
||||
|
||||
public static void ardougneTeleport(Client player) {
|
||||
if (System.currentTimeMillis() - player.lastCast < 5000) {
|
||||
if (!teleportCheck(player)) {
|
||||
return;
|
||||
}
|
||||
RandomEventHandler.addRandom(player);
|
||||
if (RUNES_REQUIRED) {
|
||||
if (!CastRequirements.hasRunes(player, new int[][]{{LAW_RUNE, 2}, {WATER_RUNE, 2}})) {
|
||||
player.getActionSender().sendMessage("You don't have the required runes to cast this spell.");
|
||||
return;
|
||||
}
|
||||
RandomEventHandler.addRandom(player);
|
||||
if (RUNES_REQUIRED) {
|
||||
if (!CastRequirements.hasRunes(player, new int[][]{{LAW_RUNE, 2}, {WATER_RUNE, 2}})) {
|
||||
player.getActionSender().sendMessage("You don't have the required runes to cast this spell.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (MAGIC_LEVEL_REQUIRED) {
|
||||
if (player.playerLevel[player.playerMagic] < 51) {
|
||||
player.getActionSender().sendMessage("You need a magic level of 51 to cast this spell.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
CastRequirements.deleteRunes(player, new int[][]{{LAW_RUNE, 2}, {WATER_RUNE, 2}});
|
||||
player.getPlayerAssistant().startTeleport(ARDOUGNE_X + Misc.random(4),
|
||||
ARDOUGNE_Y - Misc.random(4), 0, "modern");
|
||||
player.lastCast = System.currentTimeMillis();
|
||||
player.getPlayerAssistant().addSkillXP(61, player.playerMagic);
|
||||
}
|
||||
if (MAGIC_LEVEL_REQUIRED) {
|
||||
if (player.playerLevel[player.playerMagic] < 51) {
|
||||
player.getActionSender().sendMessage("You need a magic level of 51 to cast this spell.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
CastRequirements.deleteRunes(player, new int[][]{{LAW_RUNE, 2}, {WATER_RUNE, 2}});
|
||||
player.getPlayerAssistant().startTeleport(ARDOUGNE_X + Misc.random(4),
|
||||
ARDOUGNE_Y - Misc.random(4), 0, "modern");
|
||||
player.getPlayerAssistant().addSkillXP(61, player.playerMagic);
|
||||
}
|
||||
|
||||
public static void watchTowerTeleport(Client player) {
|
||||
if (System.currentTimeMillis() - player.lastCast < 5000) {
|
||||
if (!teleportCheck(player)) {
|
||||
return;
|
||||
}
|
||||
RandomEventHandler.addRandom(player);
|
||||
if (RUNES_REQUIRED) {
|
||||
if (!CastRequirements.hasRunes(player, new int[][]{{LAW_RUNE, 2}, {EARTH_RUNE, 2}})) {
|
||||
player.getActionSender().sendMessage("You don't have the required runes to cast this spell.");
|
||||
return;
|
||||
}
|
||||
RandomEventHandler.addRandom(player);
|
||||
if (RUNES_REQUIRED) {
|
||||
if (!CastRequirements.hasRunes(player, new int[][]{{LAW_RUNE, 2}, {EARTH_RUNE, 2}})) {
|
||||
player.getActionSender().sendMessage("You don't have the required runes to cast this spell.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (MAGIC_LEVEL_REQUIRED) {
|
||||
if (player.playerLevel[player.playerMagic] < 58) {
|
||||
player.getActionSender().sendMessage(
|
||||
"You need a magic level of 58 to cast this spell.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
CastRequirements.deleteRunes(player, new int[][]{{LAW_RUNE, 2}, {EARTH_RUNE, 2}});
|
||||
player.getPlayerAssistant().startTeleport(WATCHTOWER_X, WATCHTOWER_Y, 1, "modern");
|
||||
player.lastCast = System.currentTimeMillis();
|
||||
player.getPlayerAssistant().addSkillXP(68, player.playerMagic);
|
||||
}
|
||||
if (MAGIC_LEVEL_REQUIRED) {
|
||||
if (player.playerLevel[player.playerMagic] < 58) {
|
||||
player.getActionSender().sendMessage(
|
||||
"You need a magic level of 58 to cast this spell.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
CastRequirements.deleteRunes(player, new int[][]{{LAW_RUNE, 2}, {EARTH_RUNE, 2}});
|
||||
player.getPlayerAssistant().startTeleport(WATCHTOWER_X, WATCHTOWER_Y, 1, "modern");
|
||||
player.getPlayerAssistant().addSkillXP(68, player.playerMagic);
|
||||
}
|
||||
|
||||
public static void trollhiemTeleport(Client player) {
|
||||
if (System.currentTimeMillis() - player.lastCast < 5000) {
|
||||
if (!teleportCheck(player)) {
|
||||
return;
|
||||
}
|
||||
RandomEventHandler.addRandom(player);
|
||||
if (RUNES_REQUIRED) {
|
||||
if (!CastRequirements.hasRunes(player, new int[][]{{LAW_RUNE, 2}, {FIRE_RUNE, 2}})) {
|
||||
player.getActionSender().sendMessage("You don't have the required runes to cast this spell.");
|
||||
return;
|
||||
}
|
||||
RandomEventHandler.addRandom(player);
|
||||
if (RUNES_REQUIRED) {
|
||||
if (!CastRequirements.hasRunes(player, new int[][]{{LAW_RUNE, 2}, {FIRE_RUNE, 2}})) {
|
||||
player.getActionSender().sendMessage("You don't have the required runes to cast this spell.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (MAGIC_LEVEL_REQUIRED) {
|
||||
if (player.playerLevel[player.playerMagic] < 61) {
|
||||
player.getActionSender().sendMessage("You need a magic level of 61 to cast this spell.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
CastRequirements.deleteRunes(player, new int[][]{{LAW_RUNE, 2}, {FIRE_RUNE, 2}});
|
||||
player.getPlayerAssistant().startTeleport(2892 + Misc.random(2),
|
||||
3679 - Misc.random(2), 0, "modern");
|
||||
player.lastCast = System.currentTimeMillis();
|
||||
player.getPlayerAssistant().addSkillXP(68, player.playerMagic);
|
||||
}
|
||||
if (MAGIC_LEVEL_REQUIRED) {
|
||||
if (player.playerLevel[player.playerMagic] < 61) {
|
||||
player.getActionSender().sendMessage("You need a magic level of 61 to cast this spell.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
CastRequirements.deleteRunes(player, new int[][]{{LAW_RUNE, 2}, {FIRE_RUNE, 2}});
|
||||
player.getPlayerAssistant().startTeleport(2892 + Misc.random(2),
|
||||
3679 - Misc.random(2), 0, "modern");
|
||||
player.getPlayerAssistant().addSkillXP(68, player.playerMagic);
|
||||
}
|
||||
|
||||
public static void apeAtollTeleport(Client player) {
|
||||
if (System.currentTimeMillis() - player.lastCast < 5000) {
|
||||
return;
|
||||
}
|
||||
RandomEventHandler.addRandom(player);
|
||||
if (RUNES_REQUIRED) {
|
||||
if (!CastRequirements.hasRunes(player, new int[][]{{LAW_RUNE, 2}, {FIRE_RUNE, 2}, {WATER_RUNE, 2}}) || !player.getItemAssistant().playerHasItem(BANANA, 1)) {
|
||||
player.getActionSender().sendMessage("You don't have the required items to cast this spell.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (player.questPoints < 19) {
|
||||
player.getActionSender().sendMessage("You need " + 19 + " quest points to teleport here.");
|
||||
return;
|
||||
}
|
||||
if (MAGIC_LEVEL_REQUIRED) {
|
||||
if (player.playerLevel[player.playerMagic] < 64) {
|
||||
player.getActionSender().sendMessage("You need a magic level of 64 to cast this spell.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
CastRequirements.deleteRunes(player, new int[][]{{LAW_RUNE, 2}, {FIRE_RUNE, 2}, {WATER_RUNE, 2}});
|
||||
player.getItemAssistant().deleteItem2(BANANA, 1);
|
||||
player.getPlayerAssistant().startTeleport(2798 + Misc.random(1), 2798 - Misc.random(1), 1, "modern");
|
||||
player.lastCast = System.currentTimeMillis();
|
||||
player.getPlayerAssistant().addSkillXP(76, player.playerMagic);
|
||||
if (!teleportCheck(player)) {
|
||||
return;
|
||||
}
|
||||
RandomEventHandler.addRandom(player);
|
||||
if (RUNES_REQUIRED) {
|
||||
if (!CastRequirements.hasRunes(player, new int[][]{{LAW_RUNE, 2}, {FIRE_RUNE, 2}, {WATER_RUNE, 2}}) || !player.getItemAssistant().playerHasItem(BANANA, 1)) {
|
||||
player.getActionSender().sendMessage("You don't have the required items to cast this spell.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (player.questPoints < 19) {
|
||||
player.getActionSender().sendMessage("You need " + 19 + " quest points to teleport here.");
|
||||
return;
|
||||
}
|
||||
if (MAGIC_LEVEL_REQUIRED) {
|
||||
if (player.playerLevel[player.playerMagic] < 64) {
|
||||
player.getActionSender().sendMessage("You need a magic level of 64 to cast this spell.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
CastRequirements.deleteRunes(player, new int[][]{{LAW_RUNE, 2}, {FIRE_RUNE, 2}, {WATER_RUNE, 2}});
|
||||
player.getItemAssistant().deleteItem2(BANANA, 1);
|
||||
player.getPlayerAssistant().startTeleport(2798 + Misc.random(1), 2798 - Misc.random(1), 1, "modern");
|
||||
player.getPlayerAssistant().addSkillXP(76, player.playerMagic);
|
||||
}
|
||||
}
|
||||
@@ -36,6 +36,7 @@ public class GateHandler {
|
||||
|
||||
private static void openDoubleGate(Client player, int objectId, int objectId2, int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4, int face1, int face2) {
|
||||
if (isGate(objectId) && isGate(objectId2) && gateAmount == 0) {
|
||||
// open gate from default map object
|
||||
spawnGate(-1, x3, y3, player.heightLevel, 0);
|
||||
spawnGate(-1, x4, y4, player.heightLevel, 0);
|
||||
spawnGate(objectId, x1, y1, player.heightLevel, face1);
|
||||
@@ -47,6 +48,7 @@ public class GateHandler {
|
||||
ObjectManager.doubleGateTicks(player, objectId, x3, y3, x1, y1, x2, y2, player.heightLevel, face2, gateTicks);
|
||||
ObjectManager.doubleGateTicks(player, objectId2, x4, y4, x1, y1, x2, y2, player.heightLevel, face2, gateTicks);
|
||||
} else if (isGate(objectId) && isGate(objectId2) && gateAmount == 2) {
|
||||
// close gate back to default
|
||||
ObjectManager.doubleGateTicks(player, objectId, x3, y3, x1, y1, x2, y2, player.heightLevel, face2, 0);
|
||||
ObjectManager.doubleGateTicks(player, objectId2, x4, y4, x1, y1, x2, y2, player.heightLevel, face2, 0);
|
||||
}
|
||||
|
||||
@@ -20,13 +20,17 @@ public class PassDoor {
|
||||
client.getActionSender().sendMessage("You must wait longer to pass this door.");
|
||||
return false;
|
||||
}
|
||||
client.getActionSender().object(objectType, client.objectX, client.objectY, height, face1, type);
|
||||
|
||||
final int objX = client.objectX;
|
||||
final int objY = client.objectY;
|
||||
|
||||
client.getActionSender().object(objectType, objX, objY, height, face1, type);
|
||||
client.getPlayerAssistant().walkTo(x, y);
|
||||
client.stopPlayer = true;
|
||||
CycleEventHandler.getSingleton().addEvent(client, new CycleEvent() {
|
||||
@Override
|
||||
public void execute(CycleEventContainer container) {
|
||||
client.getActionSender().object(objectType, client.objectX, client.objectY, height, face2, type);
|
||||
client.getActionSender().object(objectType, objX, objY, height, face2, type);
|
||||
container.stop();
|
||||
}
|
||||
|
||||
@@ -96,6 +100,7 @@ public class PassDoor {
|
||||
if (Position.checkPosition(client, 3108, 3162, 0)) {
|
||||
passThroughDoor(client, objectType, 2, 1, 9, -1, -1, 0);
|
||||
} else if (Position.checkPosition(client, 3107, 3163, 0)) {
|
||||
// wizz tower
|
||||
passThroughDoor(client, objectType, 2, 1, 9, -1, -1, 0);
|
||||
} else {
|
||||
if (client.heightLevel == 0) {
|
||||
|
||||
@@ -26,6 +26,7 @@ import redone.game.content.combat.magic.MagicTeleports;
|
||||
import redone.game.content.combat.prayer.PrayerData;
|
||||
import redone.game.content.combat.prayer.PrayerDrain;
|
||||
import redone.game.content.combat.range.DwarfCannon;
|
||||
import redone.game.content.combat.range.RangeData;
|
||||
import redone.game.content.consumables.Food;
|
||||
import redone.game.content.consumables.Potions;
|
||||
import redone.game.content.guilds.impl.RangersGuild;
|
||||
@@ -62,6 +63,7 @@ import redone.game.items.impl.PotionMixing;
|
||||
import redone.game.items.impl.Teles;
|
||||
import redone.game.items.impl.Weight;
|
||||
import redone.game.npcs.NpcActions;
|
||||
import redone.game.npcs.NpcHandler;
|
||||
import redone.game.objects.ObjectsActions;
|
||||
import redone.game.players.antimacro.AntiBotting;
|
||||
import redone.game.shops.ShopAssistant;
|
||||
@@ -394,6 +396,10 @@ public class Client extends Player {
|
||||
currentTask = CycleEventHandler.getSingleton().addEvent(this, event, ticksBetweenExecution);
|
||||
}
|
||||
|
||||
public CycleEventContainer getCurrentTask() {
|
||||
return currentTask;
|
||||
}
|
||||
|
||||
public void endCurrentTask() {
|
||||
if (currentTask != null && currentTask.isRunning()) {
|
||||
currentTask.stop();
|
||||
@@ -1069,11 +1075,11 @@ public class Client extends Player {
|
||||
teleTimer = 0;
|
||||
getPlayerAssistant().changeLocation();
|
||||
}
|
||||
if (teleTimer == 5) {
|
||||
if (teleTimer == 4) {
|
||||
teleTimer--;
|
||||
getPlayerAssistant().processTeleport();
|
||||
}
|
||||
if (teleTimer == 9 && teleGfx > 0) {
|
||||
if (teleTimer == 7 && teleGfx > 0) {
|
||||
teleTimer--;
|
||||
gfx100(teleGfx);
|
||||
}
|
||||
@@ -1091,6 +1097,9 @@ public class Client extends Player {
|
||||
}
|
||||
}
|
||||
|
||||
combatAssistant.attackingNpcTick();
|
||||
combatAssistant.attackingPlayerTick();
|
||||
|
||||
if (attackTimer > 0) {
|
||||
attackTimer--;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ public abstract class Player {
|
||||
{2035, 0}
|
||||
};
|
||||
|
||||
public long lastCast = 0, homeTele, lastDesert, eventTimer, lastRunRecovery,
|
||||
public long homeTele, lastDesert, eventTimer, lastRunRecovery,
|
||||
lastButton, lastFire, lastLight, muteTime, waitTime, miscTimer,
|
||||
ladderTimer, webSlashDelay, climbDelay, lastReport = 0,
|
||||
lastPlayerMove, lastPoison, lastPoisonSip, poisonImmune, lastSpear,
|
||||
|
||||
@@ -555,7 +555,7 @@ public class PlayerAssistant {
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < path.length; i++) {
|
||||
if (!Region.getClipping(path[i][0], path[i][1], path[i][2], path[i][3], path[i][4]) && !Region.blockedShot(path[i][0], path[i][1], path[i][2])) {
|
||||
if (!Region.getClipping(path[i][0], path[i][1], path[i][2], path[i][3], path[i][4])/* && !Region.blockedShot(path[i][0], path[i][1], path[i][2])*/) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -641,11 +641,11 @@ public class PlayerAssistant {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < path.length; i++) {
|
||||
/*for (int i = 0; i < path.length; i++) {
|
||||
if (!Region.blockedShot(path[i][0], path[i][1], path[i][2])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -756,9 +756,6 @@ public class PlayerAssistant {
|
||||
"You are teleblocked and can't teleport.");
|
||||
return;
|
||||
}
|
||||
if (Constants.SOUND) {
|
||||
player.getActionSender().sendSound(SoundList.TELEPORT, 100, 0);
|
||||
}
|
||||
if (SkillHandler.isSkilling(player)) {
|
||||
player.getActionSender().sendMessage(
|
||||
"You can't teleport while skilling!");
|
||||
@@ -782,9 +779,12 @@ public class PlayerAssistant {
|
||||
player.teleHeight = height;
|
||||
// client.resetShaking();
|
||||
player.isTeleporting = true;
|
||||
if (Constants.SOUND) {
|
||||
player.getActionSender().sendSound(SoundList.TELEPORT, 100, 700);
|
||||
}
|
||||
if (teleportType.equalsIgnoreCase("modern")) {
|
||||
player.startAnimation(714);
|
||||
player.teleTimer = 11;
|
||||
player.startAnimation(714, 10);
|
||||
player.teleTimer = 10;
|
||||
player.teleGfx = 308;
|
||||
player.teleEndAnimation = 715;
|
||||
}
|
||||
@@ -2081,6 +2081,42 @@ public class PlayerAssistant {
|
||||
player.newLocation = 0;
|
||||
}
|
||||
|
||||
public int[] getFollowLocation(int x, int y) {
|
||||
int[] nonDiags = {0, 2, 4, 6};
|
||||
int[][] nodes = {
|
||||
{ x + Misc.directionDeltaX[nonDiags[0]], y + Misc.directionDeltaY[nonDiags[0]] },
|
||||
{ x + Misc.directionDeltaX[nonDiags[1]], y + Misc.directionDeltaY[nonDiags[1]] },
|
||||
{ x + Misc.directionDeltaX[nonDiags[2]], y + Misc.directionDeltaY[nonDiags[2]] },
|
||||
{ x + Misc.directionDeltaX[nonDiags[3]], y + Misc.directionDeltaY[nonDiags[3]] }
|
||||
};
|
||||
|
||||
int bestX = 0;
|
||||
int bestY = 0;
|
||||
double bestDist = 99999;
|
||||
|
||||
boolean projectile = player.usingMagic || player.usingBow || player.usingRangeWeapon;
|
||||
|
||||
for (int i = 0; i < nodes.length; i++) {
|
||||
double dist = Misc.distance(player.absX, player.absY, nodes[i][0], nodes[i][1]);
|
||||
if (dist < bestDist) {
|
||||
if (PathFinder.getPathFinder().accessible(player.absX, player.absY, player.heightLevel, nodes[i][0], nodes[i][1])) {
|
||||
if (!projectile || PathFinder.isProjectilePathClear(nodes[i][0], nodes[i][1], player.heightLevel, x, y)) {
|
||||
bestDist = dist;
|
||||
bestX = nodes[i][0];
|
||||
bestY = nodes[i][1];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (bestX == 0 && bestY == 0) {
|
||||
bestX = x;
|
||||
bestY = y;
|
||||
}
|
||||
|
||||
return new int[] {bestX, bestY};
|
||||
}
|
||||
|
||||
public void followPlayer() {
|
||||
if (PlayerHandler.players[player.followId] == null
|
||||
|| PlayerHandler.players[player.followId].isDead) {
|
||||
@@ -2097,7 +2133,7 @@ public class PlayerAssistant {
|
||||
int otherX = PlayerHandler.players[player.followId].getX();
|
||||
int otherY = PlayerHandler.players[player.followId].getY();
|
||||
|
||||
boolean sameSpot = player.absX == otherX && player.absY == otherY;
|
||||
/*boolean sameSpot = player.absX == otherX && player.absY == otherY;
|
||||
if (sameSpot)
|
||||
stepAway();
|
||||
|
||||
@@ -2115,7 +2151,7 @@ public class PlayerAssistant {
|
||||
|| player.autocasting || player.spellId > 0)
|
||||
&& mageDistance;
|
||||
boolean playerRanging = player.usingRangeWeapon && rangeWeaponDistance;
|
||||
boolean playerBowOrCross = player.usingBow && bowDistance;
|
||||
boolean playerBowOrCross = player.usingBow && bowDistance;*/
|
||||
|
||||
if (!player.goodDistance(otherX, otherY, player.getX(), player.getY(),
|
||||
25)) {
|
||||
@@ -2123,8 +2159,12 @@ public class PlayerAssistant {
|
||||
resetFollow();
|
||||
return;
|
||||
}
|
||||
|
||||
int[] follow = getFollowLocation(otherX, otherY);
|
||||
player.faceUpdate(player.followId + 32768);
|
||||
if (!sameSpot) {
|
||||
PathFinder.getPathFinder().findRoute(player, follow[0], follow[1], false, 1, 1);
|
||||
|
||||
/*if (!sameSpot) {
|
||||
if (player.playerIndex > 0 && !player.usingSpecial
|
||||
&& player.inWild()) {
|
||||
if (player.usingSpecial && (playerRanging || playerBowOrCross)) {
|
||||
@@ -2194,30 +2234,28 @@ public class PlayerAssistant {
|
||||
playerWalk(otherX - 1, otherY + 1);
|
||||
}
|
||||
}
|
||||
player.faceUpdate(player.followId + 32768);
|
||||
player.faceUpdate(player.followId + 32768);*/
|
||||
}
|
||||
|
||||
public void followNpc() {
|
||||
if (NpcHandler.npcs[player.followId] == null
|
||||
|| NpcHandler.npcs[player.followId].isDead) {
|
||||
resetFollow();
|
||||
return;
|
||||
}
|
||||
Npc npc = NpcHandler.npcs[player.followId2];
|
||||
if (npc.isDead) {
|
||||
if (npc == null || npc.isDead) {
|
||||
return;
|
||||
}
|
||||
|
||||
int otherX = NpcHandler.npcs[player.followId2].getX();
|
||||
int otherY = NpcHandler.npcs[player.followId2].getY();
|
||||
if (!player.goodDistance(otherX, otherY, player.getX(), player.getY(),
|
||||
25)) {
|
||||
int x = NpcHandler.npcs[player.followId2].getX();
|
||||
int y = NpcHandler.npcs[player.followId2].getY();
|
||||
if (!player.goodDistance(x, y, player.getX(), player.getY(),25)) {
|
||||
player.followId2 = 0;
|
||||
resetFollow();
|
||||
return;
|
||||
}
|
||||
player.faceUpdate(player.followId2 + 32768);
|
||||
if (otherX == player.absX && otherY == player.absY) {
|
||||
|
||||
int[] follow = getFollowLocation(x, y);
|
||||
player.faceUpdate(player.followId2);
|
||||
PathFinder.getPathFinder().findRoute(player, follow[0], follow[1], false, 1, 1);
|
||||
|
||||
/*if (otherX == player.absX && otherY == player.absY) {
|
||||
int r = Misc.random(3);
|
||||
switch (r) {
|
||||
case 0:
|
||||
@@ -2251,8 +2289,7 @@ public class PlayerAssistant {
|
||||
} else if (otherX > player.getX() && otherY < player.getY()) {
|
||||
playerWalk(otherX - 1, otherY + 1);
|
||||
}
|
||||
}
|
||||
player.faceUpdate(player.followId2 + 32768);
|
||||
}*/
|
||||
}
|
||||
|
||||
public int getRunningMove(int i, int j) {
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.net.InetSocketAddress;
|
||||
|
||||
import redone.Constants;
|
||||
import redone.Server;
|
||||
import redone.event.CycleEventHandler;
|
||||
import redone.game.content.minigames.castlewars.CastleWars;
|
||||
import redone.game.npcs.Npc;
|
||||
import redone.game.npcs.NpcHandler;
|
||||
@@ -158,19 +159,21 @@ public class PlayerHandler {
|
||||
continue;
|
||||
}
|
||||
|
||||
players[i].preProcessing();
|
||||
|
||||
while (players[i].processQueuedPackets()) {
|
||||
;
|
||||
}
|
||||
|
||||
players[i].process();
|
||||
players[i].postProcessing();
|
||||
players[i].getNextPlayerMovement();
|
||||
|
||||
players[i].preProcessing();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (int i = 0; i < PlayerHandler.players.length; i++) {
|
||||
if (players[i] == null || !players[i].isActive) {
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user