From 5fecc3ec12c533d43babfa683e4750ca9caa4375 Mon Sep 17 00:00:00 2001 From: Harmonic Date: Fri, 31 May 2019 11:02:22 -0400 Subject: [PATCH 1/6] Update README.md --- README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 0a3e4bb0..1df67672 100644 --- a/README.md +++ b/README.md @@ -11,10 +11,12 @@ TheGeneral's own words were "dont like it then dont use it". We did not like wha Arcturus Morningstar is released under the [GNU General Public License v3](https://www.gnu.org/licenses/gpl-3.0.txt). ## Versions ## -![image](https://img.shields.io/badge/VERSION-2.1.0-orange.svg?style=for-the-badge&logo=appveyor) -![image](https://img.shields.io/badge/STATUS-unstable-critical.svg?style=for-the-badge&logo=appveyor) +![image](https://img.shields.io/badge/STATUS-STABLE-blue.svg?style=for-the-badge&logo=appveyor) +Stable Version: **2.0.0** -Compiled Download: Has not yet reached a Release Candidate. +Compiled Download: https://git.krews.org/morningstar/Arcturus-Community/releases + +UnStable Version: **2.1.0** Client build: **PRODUCTION-201611291003-338511768** From 00deb264c085c589deeb3a5433cfb99a74c86098 Mon Sep 17 00:00:00 2001 From: Harmonic Date: Fri, 31 May 2019 11:04:24 -0400 Subject: [PATCH 2/6] Update README.md --- README.md | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/README.md b/README.md index 1df67672..c145f88e 100644 --- a/README.md +++ b/README.md @@ -12,12 +12,8 @@ Arcturus Morningstar is released under the [GNU General Public License v3](https ## Versions ## ![image](https://img.shields.io/badge/STATUS-STABLE-blue.svg?style=for-the-badge&logo=appveyor) -Stable Version: **2.0.0** - +![image](https://img.shields.io/badge/VERSION-2.0.0-success.svg?style=for-the-badge&logo=appveyor) Compiled Download: https://git.krews.org/morningstar/Arcturus-Community/releases - -UnStable Version: **2.1.0** - Client build: **PRODUCTION-201611291003-338511768** ## Reporting problems ## From cf175e30468ebe1fe3129308e6cd4d84a56c2f3a Mon Sep 17 00:00:00 2001 From: Harmonic Date: Fri, 31 May 2019 11:04:47 -0400 Subject: [PATCH 3/6] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index c145f88e..b294174a 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,9 @@ Arcturus Morningstar is released under the [GNU General Public License v3](https ## Versions ## ![image](https://img.shields.io/badge/STATUS-STABLE-blue.svg?style=for-the-badge&logo=appveyor) + ![image](https://img.shields.io/badge/VERSION-2.0.0-success.svg?style=for-the-badge&logo=appveyor) + Compiled Download: https://git.krews.org/morningstar/Arcturus-Community/releases Client build: **PRODUCTION-201611291003-338511768** From b05a36a508008f6849a9677ccb0aab128965c7b7 Mon Sep 17 00:00:00 2001 From: Harmonic Date: Fri, 31 May 2019 11:05:05 -0400 Subject: [PATCH 4/6] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b294174a..763ac232 100644 --- a/README.md +++ b/README.md @@ -12,10 +12,10 @@ Arcturus Morningstar is released under the [GNU General Public License v3](https ## Versions ## ![image](https://img.shields.io/badge/STATUS-STABLE-blue.svg?style=for-the-badge&logo=appveyor) - ![image](https://img.shields.io/badge/VERSION-2.0.0-success.svg?style=for-the-badge&logo=appveyor) Compiled Download: https://git.krews.org/morningstar/Arcturus-Community/releases + Client build: **PRODUCTION-201611291003-338511768** ## Reporting problems ## From 4047d1aa43348a0da333291e4863bade733fe3b2 Mon Sep 17 00:00:00 2001 From: Harmonic Date: Fri, 31 May 2019 11:09:42 -0400 Subject: [PATCH 5/6] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 763ac232..b9d405d0 100644 --- a/README.md +++ b/README.md @@ -11,8 +11,8 @@ TheGeneral's own words were "dont like it then dont use it". We did not like wha Arcturus Morningstar is released under the [GNU General Public License v3](https://www.gnu.org/licenses/gpl-3.0.txt). ## Versions ## -![image](https://img.shields.io/badge/STATUS-STABLE-blue.svg?style=for-the-badge&logo=appveyor) ![image](https://img.shields.io/badge/VERSION-2.0.0-success.svg?style=for-the-badge&logo=appveyor) +![image](https://img.shields.io/badge/STATUS-STABLE-blue.svg?style=for-the-badge&logo=appveyor) Compiled Download: https://git.krews.org/morningstar/Arcturus-Community/releases From 6eccf01f6ee3c03cfb0af783f9bfb8fb41949d70 Mon Sep 17 00:00:00 2001 From: KrewsOrg Date: Sun, 9 Jun 2019 00:13:23 +0100 Subject: [PATCH 6/6] Fixed Pathfinder. Credits to Quadral. Note this is a test. --- src/main/java/com/eu/habbo/Emulator.java | 12 -- .../eu/habbo/habbohotel/rooms/RoomLayout.java | 110 ++++++------------ .../eu/habbo/habbohotel/rooms/RoomTile.java | 14 +++ .../eu/habbo/habbohotel/rooms/RoomUnit.java | 26 +++-- .../rooms/users/RoomUserWalkEvent.java | 41 +++++-- 5 files changed, 100 insertions(+), 103 deletions(-) diff --git a/src/main/java/com/eu/habbo/Emulator.java b/src/main/java/com/eu/habbo/Emulator.java index af521b00..506b10c4 100644 --- a/src/main/java/com/eu/habbo/Emulator.java +++ b/src/main/java/com/eu/habbo/Emulator.java @@ -97,12 +97,6 @@ public final class Emulator { Emulator.runtime = Runtime.getRuntime(); Emulator.config = new ConfigurationManager("config.ini"); - - if (Emulator.getConfig().getValue("username").isEmpty()) { - Emulator.getLogging().logErrorLine("Please make sure you enter your forum login details!"); - Thread.sleep(2000); - } - Emulator.database = new Database(Emulator.getConfig()); Emulator.config.loaded = true; Emulator.config.loadFromDatabase(); @@ -123,12 +117,6 @@ public final class Emulator { Emulator.rconServer.initializePipeline(); Emulator.rconServer.connect(); Emulator.badgeImager = new BadgeImager(); - // Removed Wesleys Camera Server lol. - /* if (Emulator.getConfig().getBoolean("camera.enabled")) - { - Emulator.getThreading().run(new CameraClientAutoReconnect()); - } - */ Emulator.getLogging().logStart("Habbo Hotel Emulator has succesfully loaded."); Emulator.getLogging().logStart("You're running: " + Emulator.version); Emulator.getLogging().logStart("System launched in: " + (System.nanoTime() - startTime) / 1e6 + "ms. Using: " + (Runtime.getRuntime().availableProcessors() * 2) + " threads!"); diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomLayout.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomLayout.java index 7da2e518..258d023b 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomLayout.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomLayout.java @@ -253,42 +253,29 @@ public class RoomLayout { return this.roomTiles[x][y].state == RoomTileState.INVALID; } - public RoomTileState getStateAt(short x, short y) { - return this.roomTiles[x][y].state; - } - public String getRelativeMap() { return this.heightmap.replace("\r\n", "\r"); - } + }//re + /// Pathfinder Reworked By Quadral, thanks buddy!! You Saved Morningstar <3 public final Deque findPath(RoomTile oldTile, RoomTile newTile, RoomTile goalLocation, RoomUnit roomUnit) { + if (this.room == null || !this.room.isLoaded() || oldTile == null || newTile == null || oldTile.equals(newTile) || newTile.state == RoomTileState.INVALID) + return new LinkedList<>(); LinkedList openList = new LinkedList<>(); - try { - if (this.room == null || !this.room.isLoaded() || oldTile == null || newTile == null || oldTile.equals(newTile) || newTile.state == RoomTileState.INVALID) - return openList; - - List closedList = new LinkedList<>(); - - openList.add(oldTile.copy()); - - long startMillis = System.currentTimeMillis(); - while (true) { - if (System.currentTimeMillis() - startMillis > 50) { - return new LinkedList<>(); - } - - RoomTile current = this.lowestFInOpen(openList); - openList.remove(current); - - if ((current.x == newTile.x) && (current.y == newTile.y)) { - return this.calcPath(this.findTile(openList, oldTile.x, oldTile.y), current); - } - - List adjacentNodes = this.getAdjacent(openList, current, newTile); - - for (RoomTile currentAdj : adjacentNodes) { - if (closedList.contains(currentAdj)) continue; + List closedList = new LinkedList<>(); + RoomTile current; + openList.add(oldTile.copy()); + while (!openList.isEmpty()) { + current = this.lowestFInOpen(openList); + if ((current.x == newTile.x) && (current.y == newTile.y)) { + return this.calcPath(this.findTile(openList, oldTile.x, oldTile.y), current); + } + closedList.add(current); + openList.remove(current); + List adjacentNodes = this.getAdjacent(openList, current, newTile); + for (RoomTile currentAdj : adjacentNodes) { + if (closedList.contains(currentAdj)) continue; if (roomUnit.canOverrideTile(currentAdj) || (currentAdj.state != RoomTileState.BLOCKED && currentAdj.x == doorX && currentAdj.y == doorY)) { currentAdj.setPrevious(current); currentAdj.sethCosts(this.findTile(openList, newTile.x, newTile.y)); @@ -296,50 +283,31 @@ public class RoomLayout { openList.add(currentAdj); continue; } - - //If the tile is sitable or layable and its not our goal tile, we cannot walk over it. - if (!currentAdj.equals(goalLocation) && (currentAdj.state == RoomTileState.BLOCKED || currentAdj.state == RoomTileState.SIT || currentAdj.state == RoomTileState.LAY)) { - closedList.add(currentAdj); - openList.remove(currentAdj); - continue; - } - ////if (!room.getLayout().tileWalkable((short) currentAdj.x, (short) currentAdj.y)) continue; - - //Height difference. - double height = currentAdj.getStackHeight() - current.getStackHeight(); - - //If we are not allowed to fall and the height difference is bigger than the maximum stepheight, continue. - if (!ALLOW_FALLING && height < -MAXIMUM_STEP_HEIGHT) continue; - - //If the step difference is bigger than the maximum step height, continue. - if (currentAdj.state == RoomTileState.OPEN && height > MAXIMUM_STEP_HEIGHT) continue; - - //Check if the tile has habbos. - if (currentAdj.hasUnits() && (!this.room.isAllowWalkthrough() || currentAdj.equals(goalLocation))) { - closedList.add(currentAdj); - openList.remove(currentAdj); - continue; - } - - //if (room.hasPetsAt(currentAdj.x, currentAdj.y)) continue; - - if (!openList.contains(currentAdj)) { - currentAdj.setPrevious(current); - currentAdj.sethCosts(this.findTile(openList, newTile.x, newTile.y)); - currentAdj.setgCosts(current); - openList.add(currentAdj); - } else if (currentAdj.getgCosts() > currentAdj.calculategCosts(current)) { - currentAdj.setPrevious(current); - currentAdj.setgCosts(current); - } + if ((currentAdj.state == RoomTileState.BLOCKED) || ((currentAdj.state == RoomTileState.SIT || currentAdj.state == RoomTileState.LAY) && !currentAdj.equals(goalLocation))) { + closedList.add(currentAdj); + openList.remove(currentAdj); + continue; } - if (openList.isEmpty()) { - return new LinkedList<>(); + double height = currentAdj.getStackHeight() - current.getStackHeight(); + if (!ALLOW_FALLING && height < -MAXIMUM_STEP_HEIGHT) continue; + if (currentAdj.state == RoomTileState.OPEN && height > MAXIMUM_STEP_HEIGHT) continue; + if (currentAdj.hasUnits() && (!this.room.isAllowWalkthrough() || currentAdj.equals(goalLocation))) { + closedList.add(currentAdj); + openList.remove(currentAdj); + continue; + } + if (!openList.contains(currentAdj)) { + currentAdj.setPrevious(current); + currentAdj.sethCosts(this.findTile(openList, newTile.x, newTile.y)); + currentAdj.setgCosts(current); + openList.add(currentAdj); + } else if (currentAdj.getgCosts() > currentAdj.calculategCosts(current)) { + currentAdj.setPrevious(current); + currentAdj.setgCosts(current); } } - } catch (Exception e) { - Emulator.getLogging().logErrorLine(e); } + // System.out.println("Invalid Path."); return new LinkedList<>(); } @@ -605,8 +573,6 @@ public class RoomLayout { } public boolean fitsOnMap(RoomTile tile, int width, int length, int rotation) { - THashSet pointList = new THashSet<>(width * length, 0.1f); - if (tile != null) { if (rotation == 0 || rotation == 4) { for (short i = tile.x; i <= (tile.x + (width - 1)); i++) { diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomTile.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomTile.java index 61d1db47..d3978d8d 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomTile.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomTile.java @@ -47,6 +47,20 @@ public class RoomTile { this.units = tile.units; } + public RoomTile() + { + x = 0; + y = 0; + z = 0; + this.stackHeight = 0; + this.state = RoomTileState.INVALID; + this.allowStack = false; + this.diagonally = false; + this.gCosts = 0; + this.hCosts = 0; + this.units = null; + } + public double getStackHeight() { return this.stackHeight; } diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnit.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnit.java index d369d23a..07809406 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnit.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnit.java @@ -227,17 +227,15 @@ public class RoomUnit { //if(!(this.path.size() == 0 && canSitNextTile)) { - if (!room.tileWalkable(next.x, next.y) && !overrideChecks) { + if (!room.tileWalkable(next)) { this.room = room; this.findPath(); - if (!this.path.isEmpty()) { - next = this.path.pop(); - item = room.getTopItemAt(next.x, next.y); - } else { + if (this.path.isEmpty()) { this.status.remove(RoomUnitStatus.MOVE); return false; } + next = (RoomTile)this.path.pop(); } } @@ -465,14 +463,15 @@ public class RoomUnit { public void setGoalLocation(RoomTile goalLocation) { if (goalLocation != null) { - if (goalLocation.state != RoomTileState.INVALID) { + // if (goalLocation.state != RoomTileState.INVALID) { this.setGoalLocation(goalLocation, false); } - } + //} } public void setGoalLocation(RoomTile goalLocation, boolean noReset) { - if (Emulator.getPluginManager().isRegistered(RoomUnitSetGoalEvent.class, false)) { + if (Emulator.getPluginManager().isRegistered(RoomUnitSetGoalEvent.class, false)) + { Event event = new RoomUnitSetGoalEvent(this.room, this, goalLocation); Emulator.getPluginManager().fireEvent(event); @@ -480,16 +479,18 @@ public class RoomUnit { return; } + /// Set start location this.startLocation = this.currentLocation; if (goalLocation != null && !noReset) { this.goalLocation = goalLocation; - this.findPath(); + this.findPath(); ///< Quadral: this is where we start formulating a path if (!this.path.isEmpty()) { this.tilesWalked = 0; this.cmdSit = false; } else { this.goalLocation = this.currentLocation; + } } } @@ -524,8 +525,11 @@ public class RoomUnit { this.room = room; } - public void findPath() { - if (this.room != null && this.room.getLayout() != null && this.goalLocation != null && (this.goalLocation.isWalkable() || this.room.canSitOrLayAt(this.goalLocation.x, this.goalLocation.y) || this.canOverrideTile(this.goalLocation))) { + public void findPath() + { + if (this.room != null && this.room.getLayout() != null && this.goalLocation != null && (this.goalLocation.isWalkable() || this.room.canSitOrLayAt(this.goalLocation.x, this.goalLocation.y) || this.canOverrideTile(this.goalLocation))) + { + this.path = this.room.getLayout().findPath(this.currentLocation, this.goalLocation, this.goalLocation, this); } } diff --git a/src/main/java/com/eu/habbo/messages/incoming/rooms/users/RoomUserWalkEvent.java b/src/main/java/com/eu/habbo/messages/incoming/rooms/users/RoomUserWalkEvent.java index ea675a1c..08966a11 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/rooms/users/RoomUserWalkEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/rooms/users/RoomUserWalkEvent.java @@ -15,20 +15,28 @@ import gnu.trove.set.hash.THashSet; public class RoomUserWalkEvent extends MessageHandler { @Override - public void handle() throws Exception { - if (this.client.getHabbo().getHabboInfo().getCurrentRoom() != null) { - int x = this.packet.readInt(); - int y = this.packet.readInt(); + public void handle() throws Exception + { + if (this.client.getHabbo().getHabboInfo().getCurrentRoom() != null) + { + int x = this.packet.readInt(); ///< Position X + int y = this.packet.readInt(); ///