Football fixes

This commit is contained in:
Beny 2020-10-15 13:40:01 +02:00
parent 67c1a3dea7
commit 62ffa14c40
4 changed files with 9 additions and 12 deletions

View File

@ -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.InteractionPushable;
import com.eu.habbo.habbohotel.items.interactions.games.InteractionGameTeamItem; 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.items.interactions.games.football.goals.InteractionFootballGoal;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.*;
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.users.HabboItem; import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.messages.outgoing.rooms.items.ItemStateComposer; import com.eu.habbo.messages.outgoing.rooms.items.ItemStateComposer;
import com.eu.habbo.util.pathfinding.Rotation; import com.eu.habbo.util.pathfinding.Rotation;
@ -32,7 +29,7 @@ public class InteractionFootball extends InteractionPushable {
@Override @Override
public int getWalkOnVelocity(RoomUnit roomUnit, Room room) { 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; return 0;
if (roomUnit.getPath().size() == 0 && roomUnit.tilesWalked() == 1) if (roomUnit.getPath().size() == 0 && roomUnit.tilesWalked() == 1)
@ -43,7 +40,7 @@ public class InteractionFootball extends InteractionPushable {
@Override @Override
public int getWalkOffVelocity(RoomUnit roomUnit, Room room) { public int getWalkOffVelocity(RoomUnit roomUnit, Room room) {
if (roomUnit.getPath().size() == 0) if (roomUnit.getPath().size() == 0 && roomUnit.tilesWalked() == 0)
return 6; return 6;
return 1; return 1;
@ -152,9 +149,9 @@ public class InteractionFootball extends InteractionPushable {
@Override @Override
public boolean validMove(Room room, RoomTile from, RoomTile to) { 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); 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 //Events

View File

@ -26,7 +26,7 @@ public class InteractionFootballGoal extends InteractionGameTeamItem {
@Override @Override
public boolean isWalkable() { public boolean isWalkable() {
return true; return this.getBaseItem().allowWalk();
} }
@Override @Override

View File

@ -512,14 +512,14 @@ public class RoomUnit {
this.startLocation = this.currentLocation; this.startLocation = this.currentLocation;
if (goalLocation != null && !noReset) { if (goalLocation != null && !noReset) {
boolean isWalking = this.hasStatus(RoomUnitStatus.MOVE);
this.goalLocation = goalLocation; this.goalLocation = goalLocation;
this.findPath(); ///< Quadral: this is where we start formulating a path this.findPath(); ///< Quadral: this is where we start formulating a path
if (!this.path.isEmpty()) { if (!this.path.isEmpty()) {
this.tilesWalked = 0; this.tilesWalked = isWalking ? this.tilesWalked : 0;
this.cmdSit = false; this.cmdSit = false;
} else { } else {
this.goalLocation = this.currentLocation; this.goalLocation = this.currentLocation;
} }
} }
} }

View File

@ -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.appendString(Double.toString(this.oldLocation != null ? this.newZ : (this.item.getZ() + this.heightOffset)));
this.response.appendInt(this.roller != null ? this.roller.getId() : -1); 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.onMove(this.room, this.room.getLayout().getTile(this.item.getX(), this.item.getY()), this.newLocation);
this.item.setX(this.newLocation.x); this.item.setX(this.newLocation.x);
this.item.setY(this.newLocation.y); this.item.setY(this.newLocation.y);