diff --git a/2006Redone Server/src/com/rebotted/game/globalworldobjects/Doors.java b/2006Redone Server/src/com/rebotted/game/globalworldobjects/Doors.java index c8aeeab4..1a2f14d5 100644 --- a/2006Redone Server/src/com/rebotted/game/globalworldobjects/Doors.java +++ b/2006Redone Server/src/com/rebotted/game/globalworldobjects/Doors.java @@ -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) { diff --git a/2006Redone Server/src/com/rebotted/net/packets/impl/Walking.java b/2006Redone Server/src/com/rebotted/net/packets/impl/Walking.java index c8ff9812..eee1da88 100644 --- a/2006Redone Server/src/com/rebotted/net/packets/impl/Walking.java +++ b/2006Redone Server/src/com/rebotted/net/packets/impl/Walking.java @@ -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; - } } -} +} \ No newline at end of file diff --git a/2006Redone Server/src/com/rebotted/world/clip/Region.java b/2006Redone Server/src/com/rebotted/world/clip/Region.java index 8f54d0a6..f3ca988e 100644 --- a/2006Redone Server/src/com/rebotted/world/clip/Region.java +++ b/2006Redone Server/src/com/rebotted/world/clip/Region.java @@ -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; diff --git a/CompiledServer/production/2006rebotted/com/rebotted/game/globalworldobjects/Doors.class b/CompiledServer/production/2006rebotted/com/rebotted/game/globalworldobjects/Doors.class index df29308f..41e4ec2e 100644 Binary files a/CompiledServer/production/2006rebotted/com/rebotted/game/globalworldobjects/Doors.class and b/CompiledServer/production/2006rebotted/com/rebotted/game/globalworldobjects/Doors.class differ diff --git a/CompiledServer/production/2006rebotted/com/rebotted/game/items/ItemAssistant.class b/CompiledServer/production/2006rebotted/com/rebotted/game/items/ItemAssistant.class index 70f706fd..58a2a13e 100644 Binary files a/CompiledServer/production/2006rebotted/com/rebotted/game/items/ItemAssistant.class and b/CompiledServer/production/2006rebotted/com/rebotted/game/items/ItemAssistant.class differ diff --git a/CompiledServer/production/2006rebotted/com/rebotted/net/packets/impl/Walking.class b/CompiledServer/production/2006rebotted/com/rebotted/net/packets/impl/Walking.class index 32f02d67..bb1e73ef 100644 Binary files a/CompiledServer/production/2006rebotted/com/rebotted/net/packets/impl/Walking.class and b/CompiledServer/production/2006rebotted/com/rebotted/net/packets/impl/Walking.class differ diff --git a/CompiledServer/production/2006rebotted/com/rebotted/world/clip/Region.class b/CompiledServer/production/2006rebotted/com/rebotted/world/clip/Region.class index 2c6efe9c..081593a8 100644 Binary files a/CompiledServer/production/2006rebotted/com/rebotted/world/clip/Region.class and b/CompiledServer/production/2006rebotted/com/rebotted/world/clip/Region.class differ