mirror of
https://github.com/2006-Scape/2006Scape.git
synced 2026-07-03 00:31:51 +00:00
Noclip fix thanks to ethan
This commit is contained in:
@@ -8,6 +8,7 @@ import java.util.Scanner;
|
||||
import com.rebotted.GameEngine;
|
||||
import com.rebotted.game.objects.Objects;
|
||||
import com.rebotted.game.players.Player;
|
||||
import com.rebotted.world.clip.Region;
|
||||
|
||||
|
||||
public class Doors {
|
||||
@@ -68,6 +69,18 @@ public class Doors {
|
||||
//todo: improvment: if player manage to get to door then open the door.
|
||||
if(player.distanceToPoint(x, y) > 1) return false;
|
||||
|
||||
/**
|
||||
* Here we shall remove the clipping from the door
|
||||
* We can't add the clipping back when it is closed, because we apparently never update the d.open value....
|
||||
*/
|
||||
if(d != null) {
|
||||
if(d.open == 0) {
|
||||
Region.removeClipping(x, y, z);
|
||||
} else {
|
||||
//Region.addClipping(x, y, z, 0);
|
||||
}
|
||||
}
|
||||
|
||||
int xAdjustment = 0, yAdjustment = 0;
|
||||
if (d.type == 0) {
|
||||
if (d.open == 0) {
|
||||
|
||||
@@ -130,19 +130,26 @@ public class Walking implements PacketType {
|
||||
player.mageAllowed = true;
|
||||
}
|
||||
|
||||
if(player.openDuel) {
|
||||
Client o = (Client) PlayerHandler.players[player.duelingWith];
|
||||
if(o != null) {
|
||||
o.getDueling().declineDuel();
|
||||
}
|
||||
player.getDueling().declineDuel();
|
||||
}
|
||||
if((player.duelStatus >= 1 && player.duelStatus <= 4) || player.duelStatus == 6) {
|
||||
if(player.duelStatus == 6) {
|
||||
player.getDueling().claimStakedItems();
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (player.WildernessWarning == false && player.wildLevel > 0) {
|
||||
player.resetWalkingQueue();
|
||||
player.WildernessWarning = true;
|
||||
player.getPacketSender().sendFrame126("WARNING!", 6940);
|
||||
player.getPacketSender().showInterface(1908);
|
||||
}
|
||||
|
||||
if (player.openDuel) {
|
||||
Client o = (Client) PlayerHandler.players[player.duelingWith];
|
||||
if (o != null) {
|
||||
o.getDueling().declineDuel();
|
||||
}
|
||||
player.getDueling().declineDuel();
|
||||
}
|
||||
if ((player.duelStatus >= 1 && player.duelStatus <= 4) || player.duelStatus == 6) {
|
||||
if (player.duelStatus == 6) {
|
||||
player.getDueling().claimStakedItems();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.respawnTimer > 3) {
|
||||
return;
|
||||
@@ -153,49 +160,36 @@ public class Walking implements PacketType {
|
||||
if (packetType == 248) {
|
||||
packetSize -= 14;
|
||||
}
|
||||
player.newWalkCmdSteps = (packetSize - 5) / 2;
|
||||
if (++player.newWalkCmdSteps > player.walkingQueueSize) {
|
||||
player.newWalkCmdSteps = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
int steps = (packetSize - 5) / 2;
|
||||
player.getNewWalkCmdX()[0] = player.getNewWalkCmdY()[0] = 0;
|
||||
|
||||
int firstStepX, firstStepY;
|
||||
int realX = 0;
|
||||
int realY = 0;
|
||||
|
||||
if (player.clickToTele) {
|
||||
firstStepX = player.getInStream().readSignedWordBigEndianA();
|
||||
} else {
|
||||
realX = player.getInStream().readSignedWordBigEndianA();
|
||||
firstStepX = realX - player.getMapRegionX() * 8;
|
||||
int[][] path = new int[steps][2];
|
||||
int firstStepX = player.getInStream().readSignedWordBigEndianA();
|
||||
for (int i = 0; i < steps; i++) {
|
||||
path[i][0] = player.getInStream().readSignedByte();
|
||||
path[i][1] = player.getInStream().readSignedByte();
|
||||
}
|
||||
for (int i = 1; i < player.newWalkCmdSteps; i++) {
|
||||
player.getNewWalkCmdX()[i] = player.getInStream().readSignedByte();
|
||||
player.getNewWalkCmdY()[i] = player.getInStream().readSignedByte();
|
||||
}
|
||||
|
||||
if (player.clickToTele) {
|
||||
firstStepY = player.getInStream().readSignedWordBigEndian();
|
||||
} else {
|
||||
realY = player.getInStream().readSignedWordBigEndian();
|
||||
firstStepY = realY - player.getMapRegionY() * 8;
|
||||
int firstStepY = player.getInStream().readSignedWordBigEndian();
|
||||
int x = firstStepX;
|
||||
int y = firstStepY;
|
||||
player.setNewWalkCmdIsRunning(player.isRunning2 && player.playerEnergy > 0);
|
||||
for (int i = 0; i < steps; i++) {
|
||||
path[i][0] += firstStepX;
|
||||
path[i][1] += firstStepY;
|
||||
x = path[i][0];
|
||||
y = path[i][1];
|
||||
}
|
||||
|
||||
if (!player.clickToTele) {
|
||||
if (player.distanceToPoint(realX, realY) > 30) {
|
||||
if (player.distanceToPoint(x, y) > 30) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
//System.out.println("Player has requested to walk to: "+x+","+y);
|
||||
player.getPlayerAssistant().playerWalk(x, y);
|
||||
|
||||
|
||||
player.setNewWalkCmdIsRunning(player.getInStream().readSignedByteC() == 1 && player.playerEnergy > 0);
|
||||
for (int i1 = 0; i1 < player.newWalkCmdSteps; i1++) {
|
||||
if (player.clickToTele)
|
||||
player.getPlayerAssistant().movePlayer(player.getNewWalkCmdX()[i1] + firstStepX, player.getNewWalkCmdY()[i1] + firstStepY, player.heightLevel);
|
||||
player.getNewWalkCmdX()[i1] += firstStepX;
|
||||
player.getNewWalkCmdY()[i1] += firstStepY;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -62,6 +62,27 @@ public class Region {
|
||||
clips[height][x - regionAbsX][y - regionAbsY] |= shift;
|
||||
}
|
||||
|
||||
private void removeClip(int x, int y, int height) {
|
||||
final int regionAbsX = (id >> 8) * 64;
|
||||
final int regionAbsY = (id & 0xff) * 64;
|
||||
if (clips[height] == null) {
|
||||
clips[height] = new int[64][64];
|
||||
}
|
||||
clips[height][x - regionAbsX][y - regionAbsY] = 0;
|
||||
}
|
||||
|
||||
public static void removeClipping(int x, int y, int height) {
|
||||
final int regionX = x >> 3;
|
||||
final int regionY = y >> 3;
|
||||
final int regionId = ((regionX / 8) << 8) + (regionY / 8);
|
||||
for (Region r : regions) {
|
||||
if (r.id() == regionId) {
|
||||
r.removeClip(x, y, height);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addProjectileClip(int x, int y, int height, int shift) {
|
||||
int regionAbsX = (id >> 8) * 64;
|
||||
int regionAbsY = (id & 0xff) * 64;
|
||||
|
||||
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user