From 62ffa14c40099efa994e93ca7b9b1dfedb923592 Mon Sep 17 00:00:00 2001 From: Beny Date: Thu, 15 Oct 2020 13:40:01 +0200 Subject: [PATCH] Football fixes --- .../games/football/InteractionFootball.java | 13 +++++-------- .../football/goals/InteractionFootballGoal.java | 2 +- .../com/eu/habbo/habbohotel/rooms/RoomUnit.java | 4 ++-- .../rooms/items/FloorItemOnRollerComposer.java | 2 +- 4 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/InteractionFootball.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/InteractionFootball.java index 9c81282d..f64b0ade 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/InteractionFootball.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/InteractionFootball.java @@ -7,10 +7,7 @@ import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.interactions.InteractionPushable; import com.eu.habbo.habbohotel.items.interactions.games.InteractionGameTeamItem; import com.eu.habbo.habbohotel.items.interactions.games.football.goals.InteractionFootballGoal; -import com.eu.habbo.habbohotel.rooms.Room; -import com.eu.habbo.habbohotel.rooms.RoomTile; -import com.eu.habbo.habbohotel.rooms.RoomUnit; -import com.eu.habbo.habbohotel.rooms.RoomUserRotation; +import com.eu.habbo.habbohotel.rooms.*; import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.messages.outgoing.rooms.items.ItemStateComposer; import com.eu.habbo.util.pathfinding.Rotation; @@ -32,7 +29,7 @@ public class InteractionFootball extends InteractionPushable { @Override public int getWalkOnVelocity(RoomUnit roomUnit, Room room) { - if (roomUnit.getPath().isEmpty() && roomUnit.tilesWalked() == 2) + if (roomUnit.getPath().isEmpty() && roomUnit.tilesWalked() == 2 && this.getExtradata().equals("1")) return 0; if (roomUnit.getPath().size() == 0 && roomUnit.tilesWalked() == 1) @@ -43,7 +40,7 @@ public class InteractionFootball extends InteractionPushable { @Override public int getWalkOffVelocity(RoomUnit roomUnit, Room room) { - if (roomUnit.getPath().size() == 0) + if (roomUnit.getPath().size() == 0 && roomUnit.tilesWalked() == 0) return 6; return 1; @@ -152,9 +149,9 @@ public class InteractionFootball extends InteractionPushable { @Override public boolean validMove(Room room, RoomTile from, RoomTile to) { - if (to == null) return false; + if (to == null || to.state == RoomTileState.INVALID) return false; HabboItem topItem = room.getTopItemAt(to.x, to.y, this); - return !(!room.getLayout().tileWalkable(to.x, to.y) || (topItem != null && (!topItem.getBaseItem().allowStack() || topItem.getBaseItem().allowSit() || topItem.getBaseItem().allowLay()))); + return (topItem == null || topItem.getBaseItem().allowStack()); } //Events diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/goals/InteractionFootballGoal.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/goals/InteractionFootballGoal.java index 7386b365..a3ef5202 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/goals/InteractionFootballGoal.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/games/football/goals/InteractionFootballGoal.java @@ -26,7 +26,7 @@ public class InteractionFootballGoal extends InteractionGameTeamItem { @Override public boolean isWalkable() { - return true; + return this.getBaseItem().allowWalk(); } @Override 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 71ed1ad9..24ab4b58 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnit.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnit.java @@ -512,14 +512,14 @@ public class RoomUnit { this.startLocation = this.currentLocation; if (goalLocation != null && !noReset) { + boolean isWalking = this.hasStatus(RoomUnitStatus.MOVE); this.goalLocation = goalLocation; this.findPath(); ///< Quadral: this is where we start formulating a path if (!this.path.isEmpty()) { - this.tilesWalked = 0; + this.tilesWalked = isWalking ? this.tilesWalked : 0; this.cmdSit = false; } else { this.goalLocation = this.currentLocation; - } } } diff --git a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/FloorItemOnRollerComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/FloorItemOnRollerComposer.java index 9c35e5a8..3a10e281 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/FloorItemOnRollerComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/rooms/items/FloorItemOnRollerComposer.java @@ -58,7 +58,7 @@ public class FloorItemOnRollerComposer extends MessageComposer { this.response.appendString(Double.toString(this.oldLocation != null ? this.newZ : (this.item.getZ() + this.heightOffset))); this.response.appendInt(this.roller != null ? this.roller.getId() : -1); - if(this.oldLocation != null) { + if(this.oldLocation == null) { this.item.onMove(this.room, this.room.getLayout().getTile(this.item.getX(), this.item.getY()), this.newLocation); this.item.setX(this.newLocation.x); this.item.setY(this.newLocation.y);