This commit is contained in:
Alejandro 2019-06-05 00:47:27 +03:00
commit b2d18e7486
12 changed files with 175 additions and 279 deletions

View File

@ -15,4 +15,11 @@ ADD COLUMN `has_gotten_default_saved_searches` tinyint(1) NOT NULL DEFAULT 0 AFT
ALTER TABLE `support_tickets` ALTER TABLE `support_tickets`
ADD COLUMN `group_id` int(11) NOT NULL AFTER `category`, ADD COLUMN `group_id` int(11) NOT NULL AFTER `category`,
ADD COLUMN `thread_id` int(11) NOT NULL AFTER `group_id`, ADD COLUMN `thread_id` int(11) NOT NULL AFTER `group_id`,
ADD COLUMN `comment_id` int(11) NOT NULL AFTER `thread_id`; ADD COLUMN `comment_id` int(11) NOT NULL AFTER `thread_id`;
ALTER TABLE `pet_actions`
ADD COLUMN `can_swim` enum('1','0') NULL DEFAULT '0' AFTER `random_actions`;
UPDATE `pet_actions` SET `can_swim` = '1' WHERE `pet_type` = 9 OR `pet_type` = 14 OR `pet_type` = 23 OR `pet_type` = 24 OR `pet_type` = 25 OR `pet_type` = 28 OR `pet_type` = 29 OR `pet_type` = 30 OR `pet_type` = 32;
UPDATE `items_base` SET `customparams` = '30,60,120,180,300,600', `interaction_type` = 'game_timer', `interaction_modes_count` = 1 WHERE `item_name` IN ('fball_counter','bb_counter','es_counter');

View File

@ -129,8 +129,6 @@ public abstract class Game implements Runnable {
Emulator.getPluginManager().fireEvent(gameStartedEvent); Emulator.getPluginManager().fireEvent(gameStartedEvent);
} }
WiredHandler.handle(WiredTriggerType.GAME_STARTS, null, this.room, new Object[]{this});
for (HabboItem item : this.room.getRoomSpecialTypes().getItemsOfType(WiredBlob.class)) { for (HabboItem item : this.room.getRoomSpecialTypes().getItemsOfType(WiredBlob.class)) {
item.setExtradata("0"); item.setExtradata("0");
this.room.updateItem(item); this.room.updateItem(item);

View File

@ -2,19 +2,12 @@ package com.eu.habbo.habbohotel.games;
public enum GameTeamColors { public enum GameTeamColors {
RED(0), NONE(0),
RED(1),
GREEN(1), GREEN(2),
BLUE(3),
YELLOW(4),
BLUE(2),
YELLOW(3),
NONE(4),
ONE(5), ONE(5),
TWO(6), TWO(6),
@ -41,6 +34,6 @@ public enum GameTeamColors {
} }
} }
return RED; return NONE;
} }
} }

View File

@ -143,11 +143,10 @@ public class BattleBanzaiGame extends Game {
if (total >= this.tileCount && this.tileCount != 0) { if (total >= this.tileCount && this.tileCount != 0) {
for (InteractionGameTimer timer : room.getRoomSpecialTypes().getGameTimers().values()) { for (InteractionGameTimer timer : room.getRoomSpecialTypes().getGameTimers().values()) {
if (timer.isRunning()) if (timer.isRunning()) {
timer.setRunning(false); timer.endGame(room);
}
} }
InteractionGameTimer.endGames(room, true);
} }
} catch (Exception e) { } catch (Exception e) {
Emulator.getLogging().logErrorLine(e); Emulator.getLogging().logErrorLine(e);

View File

@ -211,4 +211,8 @@ public class Item {
public double[] getMultiHeights() { public double[] getMultiHeights() {
return this.multiHeights; return this.multiHeights;
} }
public String getCustomParams() {
return customParams;
}
} }

View File

@ -25,7 +25,6 @@ import com.eu.habbo.habbohotel.items.interactions.games.football.scoreboards.Int
import com.eu.habbo.habbohotel.items.interactions.games.freeze.InteractionFreezeBlock; import com.eu.habbo.habbohotel.items.interactions.games.freeze.InteractionFreezeBlock;
import com.eu.habbo.habbohotel.items.interactions.games.freeze.InteractionFreezeExitTile; import com.eu.habbo.habbohotel.items.interactions.games.freeze.InteractionFreezeExitTile;
import com.eu.habbo.habbohotel.items.interactions.games.freeze.InteractionFreezeTile; import com.eu.habbo.habbohotel.items.interactions.games.freeze.InteractionFreezeTile;
import com.eu.habbo.habbohotel.items.interactions.games.freeze.InteractionFreezeTimer;
import com.eu.habbo.habbohotel.items.interactions.games.freeze.gates.InteractionFreezeGateBlue; import com.eu.habbo.habbohotel.items.interactions.games.freeze.gates.InteractionFreezeGateBlue;
import com.eu.habbo.habbohotel.items.interactions.games.freeze.gates.InteractionFreezeGateGreen; import com.eu.habbo.habbohotel.items.interactions.games.freeze.gates.InteractionFreezeGateGreen;
import com.eu.habbo.habbohotel.items.interactions.games.freeze.gates.InteractionFreezeGateRed; import com.eu.habbo.habbohotel.items.interactions.games.freeze.gates.InteractionFreezeGateRed;
@ -168,11 +167,11 @@ public class ItemManager {
this.interactionsList.add(new ItemInteraction("effect_vendingmachine", InteractionEffectVendingMachine.class)); this.interactionsList.add(new ItemInteraction("effect_vendingmachine", InteractionEffectVendingMachine.class));
this.interactionsList.add(new ItemInteraction("crackable_monster", InteractionMonsterCrackable.class)); this.interactionsList.add(new ItemInteraction("crackable_monster", InteractionMonsterCrackable.class));
this.interactionsList.add(new ItemInteraction("snowboard_slope", InteractionSnowboardSlope.class)); this.interactionsList.add(new ItemInteraction("snowboard_slope", InteractionSnowboardSlope.class));
this.interactionsList.add(new ItemInteraction("timer", InteractionGameTimer.class));
this.interactionsList.add(new ItemInteraction("pressureplate_group", InteractionGroupPressurePlate.class)); this.interactionsList.add(new ItemInteraction("pressureplate_group", InteractionGroupPressurePlate.class));
this.interactionsList.add(new ItemInteraction("effect_tile_group", InteractionEffectTile.class)); this.interactionsList.add(new ItemInteraction("effect_tile_group", InteractionEffectTile.class));
this.interactionsList.add(new ItemInteraction("crackable_subscription_box", InteractionRedeemableSubscriptionBox.class)); this.interactionsList.add(new ItemInteraction("crackable_subscription_box", InteractionRedeemableSubscriptionBox.class));
this.interactionsList.add(new ItemInteraction("game_timer", InteractionGameTimer.class));
this.interactionsList.add(new ItemInteraction("wf_trg_walks_on_furni", WiredTriggerHabboWalkOnFurni.class)); this.interactionsList.add(new ItemInteraction("wf_trg_walks_on_furni", WiredTriggerHabboWalkOnFurni.class));
this.interactionsList.add(new ItemInteraction("wf_trg_walks_off_furni", WiredTriggerHabboWalkOffFurni.class)); this.interactionsList.add(new ItemInteraction("wf_trg_walks_off_furni", WiredTriggerHabboWalkOffFurni.class));
@ -292,9 +291,6 @@ public class ItemManager {
this.interactionsList.add(new ItemInteraction("wf_highscore", InteractionWiredHighscore.class)); this.interactionsList.add(new ItemInteraction("wf_highscore", InteractionWiredHighscore.class));
//battlebanzai_pyramid
//battlebanzai_puck extends pushable
this.interactionsList.add(new ItemInteraction("battlebanzai_timer", InteractionBattleBanzaiTimer.class));
this.interactionsList.add(new ItemInteraction("battlebanzai_tile", InteractionBattleBanzaiTile.class)); this.interactionsList.add(new ItemInteraction("battlebanzai_tile", InteractionBattleBanzaiTile.class));
this.interactionsList.add(new ItemInteraction("battlebanzai_random_teleport", InteractionBattleBanzaiTeleporter.class)); this.interactionsList.add(new ItemInteraction("battlebanzai_random_teleport", InteractionBattleBanzaiTeleporter.class));
this.interactionsList.add(new ItemInteraction("battlebanzai_sphere", InteractionBattleBanzaiSphere.class)); this.interactionsList.add(new ItemInteraction("battlebanzai_sphere", InteractionBattleBanzaiSphere.class));
@ -316,7 +312,6 @@ public class ItemManager {
this.interactionsList.add(new ItemInteraction("freeze_block", InteractionFreezeBlock.class)); this.interactionsList.add(new ItemInteraction("freeze_block", InteractionFreezeBlock.class));
this.interactionsList.add(new ItemInteraction("freeze_tile", InteractionFreezeTile.class)); this.interactionsList.add(new ItemInteraction("freeze_tile", InteractionFreezeTile.class));
this.interactionsList.add(new ItemInteraction("freeze_exit", InteractionFreezeExitTile.class)); this.interactionsList.add(new ItemInteraction("freeze_exit", InteractionFreezeExitTile.class));
this.interactionsList.add(new ItemInteraction("freeze_timer", InteractionFreezeTimer.class));
this.interactionsList.add(new ItemInteraction("freeze_gate_blue", InteractionFreezeGateBlue.class)); this.interactionsList.add(new ItemInteraction("freeze_gate_blue", InteractionFreezeGateBlue.class));

View File

@ -17,80 +17,120 @@ import com.eu.habbo.messages.ServerMessage;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
public abstract class InteractionGameTimer extends HabboItem implements Runnable { public class InteractionGameTimer extends HabboItem implements Runnable {
private int[] TIMER_INTERVAL_STEPS = new int[] { 30, 60, 120, 180, 300, 600 };
private int baseTime = 0; private int baseTime = 0;
private int timeNow = 0; private int timeNow = 0;
private boolean isRunning = false; private boolean isRunning = false;
private boolean isPaused = false; private boolean isPaused = false;
private boolean threadActive = false; private boolean threadActive = false;
public enum InteractionGameTimerAction {
START_STOP(1),
INCREASE_TIME(2);
private int action;
InteractionGameTimerAction(int action) {
this.action = action;
}
public int getAction() {
return action;
}
public static InteractionGameTimerAction getByAction(int action) {
if (action == 1) return START_STOP;
if (action == 2) return INCREASE_TIME;
return START_STOP;
}
}
public InteractionGameTimer(ResultSet set, Item baseItem) throws SQLException { public InteractionGameTimer(ResultSet set, Item baseItem) throws SQLException {
super(set, baseItem); super(set, baseItem);
String[] data = set.getString("extra_data").split("\t"); parseCustomParams(baseItem);
if (data.length >= 2) { try {
this.baseTime = Integer.valueOf(data[1]); String[] data = set.getString("extra_data").split("\t");
this.timeNow = this.baseTime;
if (data.length >= 2) {
this.baseTime = Integer.valueOf(data[1]);
this.timeNow = this.baseTime;
}
if (data.length >= 1) {
this.setExtradata(data[0] + "\t0");
}
} }
catch (Exception e) {
if (data.length >= 1) { this.baseTime = TIMER_INTERVAL_STEPS[0];
this.setExtradata(data[0]); this.timeNow = this.baseTime;
} }
} }
public InteractionGameTimer(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) { public InteractionGameTimer(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells); super(id, userId, item, extradata, limitedStack, limitedSells);
parseCustomParams(item);
} }
public static void endGamesIfLastTimer(Room room) { public void parseCustomParams(Item baseItem) {
boolean gamesActive = false; try {
for (InteractionGameTimer timer : room.getRoomSpecialTypes().getGameTimers().values()) { String[] intervalSteps = baseItem.getCustomParams().split(",");
if (timer.isRunning()) int[] finalSteps = new int[intervalSteps.length];
gamesActive = true; for (int i = 0; i < intervalSteps.length; i++) {
finalSteps[i] = Integer.parseInt(intervalSteps[i]);
}
TIMER_INTERVAL_STEPS = finalSteps;
} }
catch (Exception e) {
if (!gamesActive) { Emulator.getLogging().logErrorLine(e);
endGames(room);
} }
} }
public static void endGames(Room room) { public void endGame(Room room) {
endGames(room, false); this.isRunning = false;
} this.isPaused = false;
public static void endGames(Room room, boolean overrideTriggerWired) { for (Game game : room.getGames()) {
if (!game.getState().equals(GameState.IDLE)) {
boolean triggerWired = false;
//end existing games
for (Class<? extends Game> gameClass : Emulator.getGameEnvironment().getRoomManager().getGameTypes()) {
Game game = InteractionGameTimer.getOrCreateGame(room, gameClass);
if (!game.state.equals(GameState.IDLE)) {
triggerWired = true;
game.onEnd(); game.onEnd();
game.stop(); game.stop();
} }
} }
}
if (triggerWired) { private void createNewGame(Room room) {
WiredHandler.handle(WiredTriggerType.GAME_ENDS, null, room, new Object[]{}); for(Class<? extends Game> gameClass : Emulator.getGameEnvironment().getRoomManager().getGameTypes()) {
Game existingGame = room.getGame(gameClass);
if (existingGame != null) {
existingGame.initialise();
} else {
try {
Game game = gameClass.getDeclaredConstructor(Room.class).newInstance(room);
room.addGame(game);
game.initialise();
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
}
}
} }
} }
public static Game getOrCreateGame(Room room, Class<? extends Game> gameClass) { private void pause(Room room) {
Game game = (gameClass.cast(room.getGame(gameClass))); for (Game game : room.getGames()) {
game.pause();
if (game == null) {
try {
game = gameClass.getDeclaredConstructor(Room.class).newInstance(room);
room.addGame(game);
} catch (Exception e) {
Emulator.getLogging().logErrorLine(e);
}
} }
}
return game; private void unpause(Room room) {
for (Game game : room.getGames()) {
game.unpause();
}
} }
@Override @Override
@ -117,27 +157,31 @@ public abstract class InteractionGameTimer extends HabboItem implements Runnable
this.timeNow--; this.timeNow--;
room.updateItem(this); room.updateItem(this);
} else { } else {
this.isRunning = false;
this.isPaused = false;
this.threadActive = false; this.threadActive = false;
endGamesIfLastTimer(room); this.endGame(room);
WiredHandler.handle(WiredTriggerType.GAME_ENDS, null, room, new Object[]{});
} }
} }
@Override @Override
public void onPickUp(Room room) { public void onPickUp(Room room) {
this.setExtradata("0"); this.endGame(room);
this.setExtradata(this.baseTime + "\t" + this.baseTime);
this.needsUpdate(true);
} }
@Override @Override
public void onPlace(Room room) { public void onPlace(Room room) {
if (this.baseTime == 0) { if (this.baseTime < this.TIMER_INTERVAL_STEPS[0]) {
this.baseTime = 30; this.baseTime = this.TIMER_INTERVAL_STEPS[0];
this.timeNow = this.baseTime;
} }
this.timeNow = this.baseTime;
this.setExtradata(this.timeNow + "\t" + this.baseTime); this.setExtradata(this.timeNow + "\t" + this.baseTime);
room.updateItem(this); room.updateItem(this);
this.needsUpdate(true);
super.onPlace(room); super.onPlace(room);
} }
@ -163,126 +207,84 @@ public abstract class InteractionGameTimer extends HabboItem implements Runnable
@Override @Override
public void onClick(GameClient client, Room room, Object[] objects) throws Exception { public void onClick(GameClient client, Room room, Object[] objects) throws Exception {
if (this.getExtradata().isEmpty()) { if (this.getExtradata().isEmpty()) {
this.setExtradata("0"); this.setExtradata("0\t" + this.TIMER_INTERVAL_STEPS[0]);
} }
// if wired triggered it // if wired triggered it
if (objects.length >= 2 && objects[1] instanceof WiredEffectType && !this.isRunning) { if (objects.length >= 2 && objects[1] instanceof WiredEffectType) {
endGamesIfLastTimer(room); if(!(!this.isRunning || this.isPaused))
return;
for (Class<? extends Game> gameClass : Emulator.getGameEnvironment().getRoomManager().getGameTypes()) { boolean wasPaused = this.isPaused;
Game game = getOrCreateGame(room, gameClass); this.endGame(room);
if (!game.isRunning) {
game.initialise(); if(wasPaused) {
} WiredHandler.handle(WiredTriggerType.GAME_ENDS, null, room, new Object[]{});
} }
timeNow = this.baseTime; this.createNewGame(room);
this.timeNow = this.baseTime;
this.isRunning = true; this.isRunning = true;
this.isPaused = false;
room.updateItem(this); room.updateItem(this);
WiredHandler.handle(WiredTriggerType.GAME_STARTS, null, room, new Object[]{}); WiredHandler.handle(WiredTriggerType.GAME_STARTS, null, room, new Object[]{});
if (!this.threadActive) { if (!this.threadActive) {
this.threadActive = true; this.threadActive = true;
Emulator.getThreading().run(this); Emulator.getThreading().run(this, 1000);
} }
} else if (client != null) { } else if (client != null) {
if (!(room.hasRights(client.getHabbo()) || client.getHabbo().hasPermission(Permission.ACC_ANYROOMOWNER))) if (!(room.hasRights(client.getHabbo()) || client.getHabbo().hasPermission(Permission.ACC_ANYROOMOWNER)))
return; return;
int state = 1; InteractionGameTimerAction state = InteractionGameTimerAction.START_STOP;
if (objects.length >= 1 && objects[0] instanceof Integer) { if (objects.length >= 1 && objects[0] instanceof Integer) {
state = (Integer) objects[0]; state = InteractionGameTimerAction.getByAction((int) objects[0]);
} }
switch (state) { switch (state) {
case 1: case START_STOP:
if (this.isRunning) { if (this.isRunning) { // a game has been started
this.isPaused = !this.isPaused; this.isPaused = !this.isPaused;
if (this.isPaused) {
boolean allPaused = this.isPaused; this.pause(room);
for (InteractionGameTimer timer : room.getRoomSpecialTypes().getGameTimers().values()) { } else {
if (!timer.isPaused) this.unpause(room);
allPaused = false;
}
for (Class<? extends Game> gameClass : Emulator.getGameEnvironment().getRoomManager().getGameTypes()) {
Game game = getOrCreateGame(room, gameClass);
if (allPaused) {
game.pause();
} else {
game.unpause();
}
}
if (!this.isPaused) {
this.isRunning = true;
timeNow = this.baseTime;
room.updateItem(this);
if (!this.threadActive) { if (!this.threadActive) {
this.threadActive = true; this.threadActive = true;
Emulator.getThreading().run(this); Emulator.getThreading().run(this);
} }
} }
} } else {
this.isPaused = false;
if (!this.isRunning) {
endGamesIfLastTimer(room);
for (Class<? extends Game> gameClass : Emulator.getGameEnvironment().getRoomManager().getGameTypes()) {
Game game = getOrCreateGame(room, gameClass);
game.initialise();
}
WiredHandler.handle(WiredTriggerType.GAME_STARTS, null, room, new Object[]{});
this.isRunning = true; this.isRunning = true;
timeNow = this.baseTime; this.timeNow = this.baseTime;
room.updateItem(this); room.updateItem(this);
this.createNewGame(room);
WiredHandler.handle(WiredTriggerType.GAME_STARTS, null, room, new Object[]{this});
if (!this.threadActive) { if (!this.threadActive) {
this.threadActive = true; this.threadActive = true;
Emulator.getThreading().run(this); Emulator.getThreading().run(this, 1000);
} }
} }
break; break;
case 2: case INCREASE_TIME:
if (!this.isRunning) { if (!this.isRunning) {
this.increaseTimer(room); this.increaseTimer(room);
return; } else if (this.isPaused) {
this.endGame(room);
this.increaseTimer(room);
WiredHandler.handle(WiredTriggerType.GAME_ENDS, null, room, new Object[]{});
} }
if (this.isPaused) {
this.isPaused = false;
this.isRunning = false;
timeNow = this.baseTime;
room.updateItem(this);
endGamesIfLastTimer(room);
}
break;
case 3:
this.isPaused = false;
this.isRunning = false;
timeNow = this.baseTime;
room.updateItem(this);
boolean gamesActive = false;
for (InteractionGameTimer timer : room.getRoomSpecialTypes().getGameTimers().values()) {
if (timer.isRunning())
gamesActive = true;
}
if (!gamesActive) {
endGames(room);
}
break; break;
} }
} }
@ -299,33 +301,24 @@ public abstract class InteractionGameTimer extends HabboItem implements Runnable
if (this.isRunning) if (this.isRunning)
return; return;
this.needsUpdate(true); int baseTime = -1;
switch (this.baseTime) { if (this.timeNow != this.baseTime) {
case 0: baseTime = this.baseTime;
this.baseTime = 30; } else {
break; for (int step : this.TIMER_INTERVAL_STEPS) {
case 30: if (this.timeNow < step) {
this.baseTime = 60; baseTime = step;
break; break;
case 60: }
this.baseTime = 120; }
break;
case 120:
this.baseTime = 180;
break;
case 180:
this.baseTime = 300;
break;
case 300:
this.baseTime = 600;
break;
//case 600: this.baseTime = 0; break;
default: if (baseTime == -1) baseTime = this.TIMER_INTERVAL_STEPS[0];
this.baseTime = 30;
} }
this.baseTime = baseTime;
this.setExtradata(this.timeNow + "\t" + this.baseTime);
this.timeNow = this.baseTime; this.timeNow = this.baseTime;
room.updateItem(this); room.updateItem(this);
this.needsUpdate(true); this.needsUpdate(true);
@ -333,11 +326,9 @@ public abstract class InteractionGameTimer extends HabboItem implements Runnable
@Override @Override
public String getDatabaseExtraData() { public String getDatabaseExtraData() {
return this.getExtradata() + "\t" + this.baseTime; return this.getExtradata();
} }
public abstract Class<? extends Game> getGameType();
@Override @Override
public boolean allowWiredResetState() { public boolean allowWiredResetState() {
return true; return true;
@ -350,12 +341,4 @@ public abstract class InteractionGameTimer extends HabboItem implements Runnable
public void setRunning(boolean running) { public void setRunning(boolean running) {
isRunning = running; isRunning = running;
} }
public int getTimeNow() {
return timeNow;
}
public void setTimeNow(int timeNow) {
this.timeNow = timeNow;
}
} }

View File

@ -1,41 +0,0 @@
package com.eu.habbo.habbohotel.items.interactions.games.battlebanzai;
import com.eu.habbo.habbohotel.games.Game;
import com.eu.habbo.habbohotel.games.battlebanzai.BattleBanzaiGame;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.games.InteractionGameTimer;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import java.sql.ResultSet;
import java.sql.SQLException;
public class InteractionBattleBanzaiTimer extends InteractionGameTimer {
public InteractionBattleBanzaiTimer(ResultSet set, Item baseItem) throws SQLException {
super(set, baseItem);
}
public InteractionBattleBanzaiTimer(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells);
}
@Override
public Class<? extends Game> getGameType() {
return BattleBanzaiGame.class;
}
@Override
public boolean canWalkOn(RoomUnit roomUnit, Room room, Object[] objects) {
return false;
}
@Override
public boolean isWalkable() {
return false;
}
@Override
public void onWalk(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
}
}

View File

@ -1,48 +0,0 @@
package com.eu.habbo.habbohotel.items.interactions.games.freeze;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.games.Game;
import com.eu.habbo.habbohotel.games.freeze.FreezeGame;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.games.InteractionGameTimer;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import java.sql.ResultSet;
import java.sql.SQLException;
public class InteractionFreezeTimer extends InteractionGameTimer {
public InteractionFreezeTimer(ResultSet set, Item baseItem) throws SQLException {
super(set, baseItem);
}
public InteractionFreezeTimer(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells);
}
@Override
public boolean canWalkOn(RoomUnit roomUnit, Room room, Object[] objects) {
return false;
}
@Override
public boolean isWalkable() {
return false;
}
@Override
public void onWalk(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
}
@Override
public void onClick(GameClient client, Room room, Object[] objects) throws Exception {
super.onClick(client, room, objects);
}
@Override
public Class<? extends Game> getGameType() {
return FreezeGame.class;
}
}

View File

@ -31,6 +31,7 @@ public class PetData implements Comparable<PetData> {
public String[] actionsTired; public String[] actionsTired;
public String[] actionsRandom; public String[] actionsRandom;
public THashMap<PetVocalsType, THashSet<PetVocal>> petVocals; public THashMap<PetVocalsType, THashSet<PetVocal>> petVocals;
public boolean canSwim;
private int type; private int type;
private String name; private String name;
private List<PetCommand> petCommands; private List<PetCommand> petCommands;
@ -51,6 +52,7 @@ public class PetData implements Comparable<PetData> {
this.actionsHappy = set.getString("happy_actions").split(";"); this.actionsHappy = set.getString("happy_actions").split(";");
this.actionsTired = set.getString("tired_actions").split(";"); this.actionsTired = set.getString("tired_actions").split(";");
this.actionsRandom = set.getString("random_actions").split(";"); this.actionsRandom = set.getString("random_actions").split(";");
this.canSwim = set.getString("can_swim").equalsIgnoreCase("1");
this.reset(); this.reset();
} }

View File

@ -2147,6 +2147,10 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
return null; return null;
} }
public ConcurrentSet<Game> getGames() {
return this.games;
}
public int getUserCount() { public int getUserCount() {
return this.currentHabbos.size(); return this.currentHabbos.size();
} }
@ -4588,19 +4592,19 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
THashSet<RoomUnit> units = new THashSet<>(); THashSet<RoomUnit> units = new THashSet<>();
for (Habbo habbo : this.currentHabbos.values()) { for (Habbo habbo : this.currentHabbos.values()) {
if (habbo != null && habbo.getRoomUnit() != null && habbo.getRoomUnit().getRoom().getId() == this.getId()) { if (habbo != null && habbo.getRoomUnit() != null && habbo.getRoomUnit().getRoom() != null && habbo.getRoomUnit().getRoom().getId() == this.getId()) {
units.add(habbo.getRoomUnit()); units.add(habbo.getRoomUnit());
} }
} }
for (Pet pet : this.currentPets.valueCollection()) { for (Pet pet : this.currentPets.valueCollection()) {
if (pet != null && pet.getRoomUnit() != null && pet.getRoomUnit().getRoom().getId() == this.getId()) { if (pet != null && pet.getRoomUnit() != null && pet.getRoomUnit().getRoom() != null && pet.getRoomUnit().getRoom().getId() == this.getId()) {
units.add(pet.getRoomUnit()); units.add(pet.getRoomUnit());
} }
} }
for (Bot bot : this.currentBots.valueCollection()) { for (Bot bot : this.currentBots.valueCollection()) {
if (bot != null && bot.getRoomUnit() != null && bot.getRoomUnit().getRoom().getId() == this.getId()) { if (bot != null && bot.getRoomUnit() != null && bot.getRoomUnit().getRoom() != null && bot.getRoomUnit().getRoom().getId() == this.getId()) {
units.add(bot.getRoomUnit()); units.add(bot.getRoomUnit());
} }
} }

View File

@ -333,7 +333,7 @@ public class RoomUnit {
this.resetIdleTimer(); this.resetIdleTimer();
if (habbo != null) { if (habbo != null) {
HabboItem topItem = this.room.getTopItemAt(next.x, next.y); HabboItem topItem = room.getTopItemAt(next.x, next.y);
boolean isAtDoor = next.x == room.getLayout().getDoorX() && next.y == room.getLayout().getDoorY(); boolean isAtDoor = next.x == room.getLayout().getDoorX() && next.y == room.getLayout().getDoorY();
boolean publicRoomKicks = !room.isPublicRoom() || Emulator.getConfig().getBoolean("hotel.room.public.doortile.kick"); boolean publicRoomKicks = !room.isPublicRoom() || Emulator.getConfig().getBoolean("hotel.room.public.doortile.kick");