Make game gates unwalkable during a game (fixes #312)

This commit is contained in:
Alejandro 2020-01-24 20:22:52 +02:00
parent b425bb6856
commit 191ef7afad
2 changed files with 20 additions and 15 deletions

View File

@ -1,6 +1,7 @@
package com.eu.habbo.habbohotel.items.interactions.games.battlebanzai.gates; package com.eu.habbo.habbohotel.items.interactions.games.battlebanzai.gates;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.games.Game;
import com.eu.habbo.habbohotel.games.GameState; import com.eu.habbo.habbohotel.games.GameState;
import com.eu.habbo.habbohotel.games.GameTeam; import com.eu.habbo.habbohotel.games.GameTeam;
import com.eu.habbo.habbohotel.games.GameTeamColors; import com.eu.habbo.habbohotel.games.GameTeamColors;
@ -28,17 +29,19 @@ public class InteractionBattleBanzaiGate extends InteractionGameGate {
} }
@Override @Override
public boolean isWalkable() { public void onWalk(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId());
if (room == null)
return false;
return (this.getExtradata() == null || this.getExtradata().isEmpty() || Integer.valueOf(this.getExtradata()) < 5) && ((room.getGame(BattleBanzaiGame.class))) == null || ((BattleBanzaiGame) (room.getGame(BattleBanzaiGame.class))).state.equals(GameState.IDLE);
} }
@Override @Override
public void onWalk(RoomUnit roomUnit, Room room, Object[] objects) throws Exception { public boolean isWalkable() {
Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId());
if (room == null) return false;
Game game = room.getGame(BattleBanzaiGame.class);
return game == null || game.getState() == GameState.IDLE;
} }
//TODO: Move to upper class //TODO: Move to upper class

View File

@ -1,5 +1,7 @@
package com.eu.habbo.habbohotel.items.interactions.games.freeze.gates; package com.eu.habbo.habbohotel.items.interactions.games.freeze.gates;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.games.Game;
import com.eu.habbo.habbohotel.games.GameState; import com.eu.habbo.habbohotel.games.GameState;
import com.eu.habbo.habbohotel.games.GameTeam; import com.eu.habbo.habbohotel.games.GameTeam;
import com.eu.habbo.habbohotel.games.GameTeamColors; import com.eu.habbo.habbohotel.games.GameTeamColors;
@ -27,18 +29,18 @@ public class InteractionFreezeGate extends InteractionGameGate {
} }
@Override @Override
public boolean isWalkable() { public void onWalk(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
if (this.getRoomId() == 0)
return false;
return (this.getExtradata().isEmpty() ||
Integer.valueOf(this.getExtradata()) < 5);
//((Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getGame(FreezeGame.class))) == null ||
//!((FreezeGame)(Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getGame(FreezeGame.class))).isRunning;
} }
@Override @Override
public void onWalk(RoomUnit roomUnit, Room room, Object[] objects) throws Exception { public boolean isWalkable() {
Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId());
if (room == null) return false;
Game game = room.getGame(FreezeGame.class);
return game == null || game.getState() == GameState.IDLE;
} }
@Override @Override