mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-23 07:20:50 +01:00
Merge branch 'dev' of https://git.krews.org/morningstar/Arcturus-Community into dev222
This commit is contained in:
commit
e25efd3d83
@ -113,15 +113,19 @@ public class BotManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!room.hasHabbosAt(location.x, location.y) && !location.isWalkable() && location.state != RoomTileState.SIT)
|
if (room.hasHabbosAt(location.x, location.y) || (!location.isWalkable() && location.state != RoomTileState.SIT && location.state != RoomTileState.LAY))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
RoomUnit roomUnit = new RoomUnit();
|
RoomUnit roomUnit = new RoomUnit();
|
||||||
roomUnit.setRotation(RoomUserRotation.SOUTH);
|
roomUnit.setRotation(RoomUserRotation.SOUTH);
|
||||||
roomUnit.setLocation(location);
|
roomUnit.setLocation(location);
|
||||||
HabboItem topItem = room.getTopItemAt(location.x, location.y);
|
HabboItem topItem = room.getTopItemAt(location.x, location.y);
|
||||||
roomUnit.setZ(roomUnit.getCurrentLocation().getStackHeight());
|
|
||||||
roomUnit.setPreviousLocationZ(roomUnit.getCurrentLocation().getStackHeight());
|
double topItemHeight = 0;
|
||||||
|
if (topItem != null) topItemHeight = Item.getCurrentHeight(topItem);
|
||||||
|
roomUnit.setPreviousLocationZ(roomUnit.getCurrentLocation().getStackHeight() - topItemHeight);
|
||||||
|
|
||||||
|
|
||||||
roomUnit.setPathFinderRoom(room);
|
roomUnit.setPathFinderRoom(room);
|
||||||
roomUnit.setRoomUnitType(RoomUnitType.BOT);
|
roomUnit.setRoomUnitType(RoomUnitType.BOT);
|
||||||
roomUnit.setCanWalk(room.isAllowBotsWalk());
|
roomUnit.setCanWalk(room.isAllowBotsWalk());
|
||||||
@ -136,7 +140,6 @@ public class BotManager {
|
|||||||
bot.onPlace(habbo, room);
|
bot.onPlace(habbo, room);
|
||||||
|
|
||||||
if (topItem != null) {
|
if (topItem != null) {
|
||||||
roomUnit.setZ(topItem.getBaseItem().allowSit() ? topItem.getZ() : topItem.getZ() + Item.getCurrentHeight(topItem));
|
|
||||||
try {
|
try {
|
||||||
topItem.onWalkOn(bot.getRoomUnit(), room, null);
|
topItem.onWalkOn(bot.getRoomUnit(), room, null);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -5,6 +5,7 @@ import com.eu.habbo.core.Logging;
|
|||||||
import com.eu.habbo.habbohotel.users.Habbo;
|
import com.eu.habbo.habbohotel.users.Habbo;
|
||||||
import com.eu.habbo.messages.PacketManager;
|
import com.eu.habbo.messages.PacketManager;
|
||||||
import com.eu.habbo.messages.ServerMessage;
|
import com.eu.habbo.messages.ServerMessage;
|
||||||
|
import com.eu.habbo.messages.incoming.MessageHandler;
|
||||||
import com.eu.habbo.messages.outgoing.MessageComposer;
|
import com.eu.habbo.messages.outgoing.MessageComposer;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
@ -17,12 +18,12 @@ import java.util.ArrayList;
|
|||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
public class GameClient {
|
public class GameClient {
|
||||||
|
|
||||||
public final ConcurrentHashMap<Integer, Integer> incomingPacketCounter = new ConcurrentHashMap<>(25);
|
public final ConcurrentHashMap<Integer, Integer> incomingPacketCounter = new ConcurrentHashMap<>(25);
|
||||||
private final Channel channel;
|
private final Channel channel;
|
||||||
public long lastPacketCounterCleared = Emulator.getIntUnixTimestamp();
|
public long lastPacketCounterCleared = Emulator.getIntUnixTimestamp();
|
||||||
private Habbo habbo;
|
private Habbo habbo;
|
||||||
private String machineId = "";
|
private String machineId = "";
|
||||||
|
public final ConcurrentHashMap<Class<? extends MessageHandler>, Long> messageTimestamps = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
public GameClient(Channel channel) {
|
public GameClient(Channel channel) {
|
||||||
this.channel = channel;
|
this.channel = channel;
|
||||||
|
@ -91,8 +91,11 @@ public abstract class Game implements Runnable {
|
|||||||
|
|
||||||
GameTeam team = this.getTeamForHabbo(habbo);
|
GameTeam team = this.getTeamForHabbo(habbo);
|
||||||
if (team != null && team.isMember(habbo)) {
|
if (team != null && team.isMember(habbo)) {
|
||||||
team.removeMember(habbo.getHabboInfo().getGamePlayer());
|
if (habbo.getHabboInfo().getGamePlayer() != null) {
|
||||||
habbo.getHabboInfo().getGamePlayer().reset();
|
team.removeMember(habbo.getHabboInfo().getGamePlayer());
|
||||||
|
habbo.getHabboInfo().getGamePlayer().reset();
|
||||||
|
}
|
||||||
|
|
||||||
habbo.getHabboInfo().setCurrentGame(null);
|
habbo.getHabboInfo().setCurrentGame(null);
|
||||||
habbo.getHabboInfo().setGamePlayer(null);
|
habbo.getHabboInfo().setGamePlayer(null);
|
||||||
habbo.getClient().sendResponse(new GuideSessionPartnerIsPlayingComposer(false));
|
habbo.getClient().sendResponse(new GuideSessionPartnerIsPlayingComposer(false));
|
||||||
@ -101,23 +104,6 @@ public abstract class Game implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
boolean deleteGame = true;
|
|
||||||
for (GameTeam team : this.teams.values())
|
|
||||||
{
|
|
||||||
if (team.getMembers().size() > 0 )
|
|
||||||
{
|
|
||||||
deleteGame = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (deleteGame)
|
|
||||||
{
|
|
||||||
this.room.deleteGame(this);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ public class GameTeam {
|
|||||||
for (GamePlayer player : this.members) {
|
for (GamePlayer player : this.members) {
|
||||||
if (player == null || player.getHabbo() == null) continue;
|
if (player == null || player.getHabbo() == null) continue;
|
||||||
|
|
||||||
player.getHabbo().getHabboInfo().getGamePlayer().reset();
|
if (player.getHabbo().getHabboInfo().getGamePlayer() != null) player.getHabbo().getHabboInfo().getGamePlayer().reset();
|
||||||
player.getHabbo().getHabboInfo().setCurrentGame(null);
|
player.getHabbo().getHabboInfo().setCurrentGame(null);
|
||||||
player.getHabbo().getHabboInfo().setGamePlayer(null);
|
player.getHabbo().getHabboInfo().setGamePlayer(null);
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,7 @@ import com.eu.habbo.habbohotel.items.interactions.games.tag.bunnyrun.Interaction
|
|||||||
import com.eu.habbo.habbohotel.items.interactions.games.tag.icetag.InteractionIceTagField;
|
import com.eu.habbo.habbohotel.items.interactions.games.tag.icetag.InteractionIceTagField;
|
||||||
import com.eu.habbo.habbohotel.items.interactions.games.tag.icetag.InteractionIceTagPole;
|
import com.eu.habbo.habbohotel.items.interactions.games.tag.icetag.InteractionIceTagPole;
|
||||||
import com.eu.habbo.habbohotel.items.interactions.games.tag.rollerskate.InteractionRollerskateField;
|
import com.eu.habbo.habbohotel.items.interactions.games.tag.rollerskate.InteractionRollerskateField;
|
||||||
|
import com.eu.habbo.habbohotel.items.interactions.pets.*;
|
||||||
import com.eu.habbo.habbohotel.items.interactions.totems.InteractionTotemHead;
|
import com.eu.habbo.habbohotel.items.interactions.totems.InteractionTotemHead;
|
||||||
import com.eu.habbo.habbohotel.items.interactions.totems.InteractionTotemLegs;
|
import com.eu.habbo.habbohotel.items.interactions.totems.InteractionTotemLegs;
|
||||||
import com.eu.habbo.habbohotel.items.interactions.totems.InteractionTotemPlanet;
|
import com.eu.habbo.habbohotel.items.interactions.totems.InteractionTotemPlanet;
|
||||||
|
@ -77,42 +77,44 @@ public class YoutubeManager {
|
|||||||
|
|
||||||
long millis = System.currentTimeMillis();
|
long millis = System.currentTimeMillis();
|
||||||
|
|
||||||
ExecutorService youtubeDataLoaderPool = Executors.newFixedThreadPool(10);
|
Emulator.getThreading().run(() -> {
|
||||||
|
ExecutorService youtubeDataLoaderPool = Executors.newFixedThreadPool(10);
|
||||||
|
|
||||||
Emulator.getLogging().logStart("YouTube Manager -> Loading...");
|
Emulator.getLogging().logStart("YouTube Manager -> Loading...");
|
||||||
|
|
||||||
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT * FROM youtube_playlists")) {
|
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT * FROM youtube_playlists")) {
|
||||||
try (ResultSet set = statement.executeQuery()) {
|
try (ResultSet set = statement.executeQuery()) {
|
||||||
while (set.next()) {
|
while (set.next()) {
|
||||||
final int itemId = set.getInt("item_id");
|
final int itemId = set.getInt("item_id");
|
||||||
final String playlistId = set.getString("playlist_id");
|
final String playlistId = set.getString("playlist_id");
|
||||||
|
|
||||||
youtubeDataLoaderPool.submit(() -> {
|
youtubeDataLoaderPool.submit(() -> {
|
||||||
ArrayList<YoutubePlaylist> playlists = this.playlists.getOrDefault(itemId, new ArrayList<>());
|
ArrayList<YoutubePlaylist> playlists = this.playlists.getOrDefault(itemId, new ArrayList<>());
|
||||||
|
|
||||||
YoutubePlaylist playlist = this.getPlaylistDataById(playlistId);
|
YoutubePlaylist playlist = this.getPlaylistDataById(playlistId);
|
||||||
if (playlist != null) {
|
if (playlist != null) {
|
||||||
playlists.add(playlist);
|
playlists.add(playlist);
|
||||||
} else {
|
} else {
|
||||||
Emulator.getLogging().logErrorLine("Failed to load YouTube playlist: " + playlistId);
|
Emulator.getLogging().logErrorLine("Failed to load YouTube playlist: " + playlistId);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.playlists.put(itemId, playlists);
|
this.playlists.put(itemId, playlists);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Emulator.getLogging().logSQLException(e);
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
|
||||||
Emulator.getLogging().logSQLException(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
youtubeDataLoaderPool.shutdown();
|
youtubeDataLoaderPool.shutdown();
|
||||||
try {
|
try {
|
||||||
youtubeDataLoaderPool.awaitTermination(60, TimeUnit.SECONDS);
|
youtubeDataLoaderPool.awaitTermination(60, TimeUnit.SECONDS);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
Emulator.getLogging().logStart("YouTube Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
|
Emulator.getLogging().logStart("YouTube Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public YoutubePlaylist getPlaylistDataById(String playlistId) {
|
public YoutubePlaylist getPlaylistDataById(String playlistId) {
|
||||||
|
@ -1,16 +1,11 @@
|
|||||||
package com.eu.habbo.habbohotel.items.interactions;
|
package com.eu.habbo.habbohotel.items.interactions;
|
||||||
|
|
||||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
|
||||||
import com.eu.habbo.habbohotel.items.Item;
|
import com.eu.habbo.habbohotel.items.Item;
|
||||||
import com.eu.habbo.habbohotel.rooms.Room;
|
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
|
||||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
|
||||||
import com.eu.habbo.messages.ServerMessage;
|
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
||||||
public class InteractionTrophy extends HabboItem {
|
public class InteractionTrophy extends InteractionDefault {
|
||||||
public InteractionTrophy(ResultSet set, Item baseItem) throws SQLException {
|
public InteractionTrophy(ResultSet set, Item baseItem) throws SQLException {
|
||||||
super(set, baseItem);
|
super(set, baseItem);
|
||||||
}
|
}
|
||||||
@ -18,41 +13,4 @@ public class InteractionTrophy extends HabboItem {
|
|||||||
public InteractionTrophy(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) {
|
public InteractionTrophy(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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void serializeExtradata(ServerMessage serverMessage) {
|
|
||||||
serverMessage.appendInt((this.isLimited() ? 256 : 0));
|
|
||||||
serverMessage.appendString(this.getExtradata());
|
|
||||||
super.serializeExtradata(serverMessage);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canWalkOn(RoomUnit roomUnit, Room room, Object[] objects) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isWalkable() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClick(GameClient client, Room room, Object[] objects) throws Exception {
|
|
||||||
super.onClick(client, room, objects);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onWalk(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onWalkOff(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -83,11 +83,10 @@ public class InteractionVendingMachine extends HabboItem {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Runnable> onSuccess = new ArrayList<>();
|
|
||||||
List<Runnable> onFail = new ArrayList<>();
|
|
||||||
|
|
||||||
RoomTile finalTile = tile;
|
RoomTile finalTile = tile;
|
||||||
onSuccess.add(() -> {
|
client.getHabbo().getRoomUnit().setGoalLocation(tile);
|
||||||
|
|
||||||
|
Emulator.getThreading().run(new RoomUnitWalkToLocation(client.getHabbo().getRoomUnit(), tile, room, () -> {
|
||||||
this.setExtradata("1");
|
this.setExtradata("1");
|
||||||
room.scheduledComposers.add(new FloorItemUpdateComposer(this).compose());
|
room.scheduledComposers.add(new FloorItemUpdateComposer(this).compose());
|
||||||
|
|
||||||
@ -98,7 +97,7 @@ public class InteractionVendingMachine extends HabboItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Emulator.getThreading().run(() -> {
|
Emulator.getThreading().run(() -> {
|
||||||
Runnable procedure = () -> {
|
client.getHabbo().getRoomUnit().setMoveBlockingTask(Emulator.getThreading().run(() -> {
|
||||||
if (client.getHabbo().getRoomUnit().getCurrentLocation().equals(finalTile)) {
|
if (client.getHabbo().getRoomUnit().getCurrentLocation().equals(finalTile)) {
|
||||||
this.rotateToMachine(client.getHabbo().getRoomUnit());
|
this.rotateToMachine(client.getHabbo().getRoomUnit());
|
||||||
room.sendComposer(new RoomUserStatusComposer(client.getHabbo().getRoomUnit()).compose());
|
room.sendComposer(new RoomUserStatusComposer(client.getHabbo().getRoomUnit()).compose());
|
||||||
@ -117,14 +116,9 @@ public class InteractionVendingMachine extends HabboItem {
|
|||||||
} catch (InterruptedException | ExecutionException e) {
|
} catch (InterruptedException | ExecutionException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
};
|
}, 300));
|
||||||
|
|
||||||
client.getHabbo().getRoomUnit().setMoveBlockingTask(Emulator.getThreading().run(procedure, 300));
|
|
||||||
}, 250);
|
}, 250);
|
||||||
});
|
}, null));
|
||||||
|
|
||||||
client.getHabbo().getRoomUnit().setGoalLocation(tile);
|
|
||||||
Emulator.getThreading().run(new RoomUnitWalkToLocation(client.getHabbo().getRoomUnit(), tile, room, onSuccess, onFail));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ public class InteractionFreezeTile extends HabboItem {
|
|||||||
@Override
|
@Override
|
||||||
public boolean canStackAt(Room room, List<Pair<RoomTile, THashSet<HabboItem>>> itemsAtLocation) {
|
public boolean canStackAt(Room room, List<Pair<RoomTile, THashSet<HabboItem>>> itemsAtLocation) {
|
||||||
for (Pair<RoomTile, THashSet<HabboItem>> set : itemsAtLocation) {
|
for (Pair<RoomTile, THashSet<HabboItem>> set : itemsAtLocation) {
|
||||||
if (!set.getValue().isEmpty()) return false;
|
if (set.getValue() != null && !set.getValue().isEmpty()) return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.canStackAt(room, itemsAtLocation);
|
return super.canStackAt(room, itemsAtLocation);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package com.eu.habbo.habbohotel.items.interactions;
|
package com.eu.habbo.habbohotel.items.interactions.pets;
|
||||||
|
|
||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||||
@ -33,7 +33,7 @@ public class InteractionMonsterPlantSeed extends HabboItem {
|
|||||||
public static int randomRarityLevel() {
|
public static int randomRarityLevel() {
|
||||||
int number = Emulator.getRandom().nextInt(66);
|
int number = Emulator.getRandom().nextInt(66);
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (int i = 1; i <= 11; i++) {
|
for (int i = 1; i < 11; i++) {
|
||||||
count += 11 - i;
|
count += 11 - i;
|
||||||
if (number <= count) {
|
if (number <= count) {
|
||||||
return i;
|
return i;
|
@ -1,4 +1,4 @@
|
|||||||
package com.eu.habbo.habbohotel.items.interactions;
|
package com.eu.habbo.habbohotel.items.interactions.pets;
|
||||||
|
|
||||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||||
import com.eu.habbo.habbohotel.items.Item;
|
import com.eu.habbo.habbohotel.items.Item;
|
@ -1,4 +1,4 @@
|
|||||||
package com.eu.habbo.habbohotel.items.interactions;
|
package com.eu.habbo.habbohotel.items.interactions.pets;
|
||||||
|
|
||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
import com.eu.habbo.habbohotel.achievements.AchievementManager;
|
import com.eu.habbo.habbohotel.achievements.AchievementManager;
|
@ -1,8 +1,9 @@
|
|||||||
package com.eu.habbo.habbohotel.items.interactions;
|
package com.eu.habbo.habbohotel.items.interactions.pets;
|
||||||
|
|
||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
import com.eu.habbo.habbohotel.achievements.AchievementManager;
|
import com.eu.habbo.habbohotel.achievements.AchievementManager;
|
||||||
import com.eu.habbo.habbohotel.items.Item;
|
import com.eu.habbo.habbohotel.items.Item;
|
||||||
|
import com.eu.habbo.habbohotel.items.interactions.InteractionDefault;
|
||||||
import com.eu.habbo.habbohotel.pets.Pet;
|
import com.eu.habbo.habbohotel.pets.Pet;
|
||||||
import com.eu.habbo.habbohotel.pets.PetTasks;
|
import com.eu.habbo.habbohotel.pets.PetTasks;
|
||||||
import com.eu.habbo.habbohotel.rooms.Room;
|
import com.eu.habbo.habbohotel.rooms.Room;
|
@ -1,7 +1,8 @@
|
|||||||
package com.eu.habbo.habbohotel.items.interactions;
|
package com.eu.habbo.habbohotel.items.interactions.pets;
|
||||||
|
|
||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
import com.eu.habbo.habbohotel.items.Item;
|
import com.eu.habbo.habbohotel.items.Item;
|
||||||
|
import com.eu.habbo.habbohotel.items.interactions.InteractionDefault;
|
||||||
import com.eu.habbo.habbohotel.pets.Pet;
|
import com.eu.habbo.habbohotel.pets.Pet;
|
||||||
import com.eu.habbo.habbohotel.pets.PetTasks;
|
import com.eu.habbo.habbohotel.pets.PetTasks;
|
||||||
import com.eu.habbo.habbohotel.rooms.Room;
|
import com.eu.habbo.habbohotel.rooms.Room;
|
@ -1,7 +1,8 @@
|
|||||||
package com.eu.habbo.habbohotel.items.interactions;
|
package com.eu.habbo.habbohotel.items.interactions.pets;
|
||||||
|
|
||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
import com.eu.habbo.habbohotel.items.Item;
|
import com.eu.habbo.habbohotel.items.Item;
|
||||||
|
import com.eu.habbo.habbohotel.items.interactions.InteractionDefault;
|
||||||
import com.eu.habbo.habbohotel.pets.Pet;
|
import com.eu.habbo.habbohotel.pets.Pet;
|
||||||
import com.eu.habbo.habbohotel.pets.PetTasks;
|
import com.eu.habbo.habbohotel.pets.PetTasks;
|
||||||
import com.eu.habbo.habbohotel.rooms.Room;
|
import com.eu.habbo.habbohotel.rooms.Room;
|
@ -62,7 +62,7 @@ public class WiredEffectChangeFurniDirection extends InteractionWiredEffect {
|
|||||||
RoomTile targetTile = room.getLayout().getTileInFront(room.getLayout().getTile(entry.getKey().getX(), entry.getKey().getY()), entry.getValue().getValue());
|
RoomTile targetTile = room.getLayout().getTileInFront(room.getLayout().getTile(entry.getKey().getX(), entry.getKey().getY()), entry.getValue().getValue());
|
||||||
|
|
||||||
int count = 1;
|
int count = 1;
|
||||||
while ((targetTile == null || !targetTile.getAllowStack() || targetTile.state == RoomTileState.INVALID) && count < 8) {
|
while ((targetTile == null || !targetTile.getAllowStack() || targetTile.state == RoomTileState.INVALID || targetTile.state == RoomTileState.BLOCKED) && count < 8) {
|
||||||
entry.setValue(this.nextRotation(entry.getValue()));
|
entry.setValue(this.nextRotation(entry.getValue()));
|
||||||
targetTile = room.getLayout().getTileInFront(room.getLayout().getTile(entry.getKey().getX(), entry.getKey().getY()), entry.getValue().getValue());
|
targetTile = room.getLayout().getTileInFront(room.getLayout().getTile(entry.getKey().getX(), entry.getKey().getY()), entry.getValue().getValue());
|
||||||
count++;
|
count++;
|
||||||
|
@ -44,6 +44,9 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect {
|
|||||||
THashSet<RoomTile> tilesToUpdate = new THashSet<>(this.settings.size());
|
THashSet<RoomTile> tilesToUpdate = new THashSet<>(this.settings.size());
|
||||||
//this.refresh();
|
//this.refresh();
|
||||||
|
|
||||||
|
if(this.settings.isEmpty())
|
||||||
|
return false;
|
||||||
|
|
||||||
for (WiredMatchFurniSetting setting : this.settings) {
|
for (WiredMatchFurniSetting setting : this.settings) {
|
||||||
HabboItem item = room.getHabboItem(setting.itemId);
|
HabboItem item = room.getHabboItem(setting.itemId);
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
@ -126,7 +129,6 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect {
|
|||||||
|
|
||||||
if (slideAnimation && t != null) {
|
if (slideAnimation && t != null) {
|
||||||
room.sendComposer(new FloorItemOnRollerComposer(item, null, t, offsetZ, room).compose());
|
room.sendComposer(new FloorItemOnRollerComposer(item, null, t, offsetZ, room).compose());
|
||||||
room.updateTiles(room.getLayout().getTilesAt(room.getLayout().getTile(item.getX(), item.getY()), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), item.getRotation()));
|
|
||||||
} else {
|
} else {
|
||||||
room.updateItem(item);
|
room.updateItem(item);
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,10 @@ package com.eu.habbo.habbohotel.pets;
|
|||||||
|
|
||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
import com.eu.habbo.habbohotel.items.Item;
|
import com.eu.habbo.habbohotel.items.Item;
|
||||||
import com.eu.habbo.habbohotel.items.interactions.InteractionNest;
|
import com.eu.habbo.habbohotel.items.interactions.pets.InteractionNest;
|
||||||
import com.eu.habbo.habbohotel.items.interactions.InteractionPetDrink;
|
import com.eu.habbo.habbohotel.items.interactions.pets.InteractionPetDrink;
|
||||||
import com.eu.habbo.habbohotel.items.interactions.InteractionPetFood;
|
import com.eu.habbo.habbohotel.items.interactions.pets.InteractionPetFood;
|
||||||
import com.eu.habbo.habbohotel.items.interactions.InteractionPetToy;
|
import com.eu.habbo.habbohotel.items.interactions.pets.InteractionPetToy;
|
||||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||||
import gnu.trove.map.hash.THashMap;
|
import gnu.trove.map.hash.THashMap;
|
||||||
import gnu.trove.set.hash.THashSet;
|
import gnu.trove.set.hash.THashSet;
|
||||||
|
@ -3,10 +3,10 @@ package com.eu.habbo.habbohotel.pets;
|
|||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||||
import com.eu.habbo.habbohotel.items.Item;
|
import com.eu.habbo.habbohotel.items.Item;
|
||||||
import com.eu.habbo.habbohotel.items.interactions.InteractionNest;
|
import com.eu.habbo.habbohotel.items.interactions.pets.InteractionNest;
|
||||||
import com.eu.habbo.habbohotel.items.interactions.InteractionPetDrink;
|
import com.eu.habbo.habbohotel.items.interactions.pets.InteractionPetDrink;
|
||||||
import com.eu.habbo.habbohotel.items.interactions.InteractionPetFood;
|
import com.eu.habbo.habbohotel.items.interactions.pets.InteractionPetFood;
|
||||||
import com.eu.habbo.habbohotel.items.interactions.InteractionPetToy;
|
import com.eu.habbo.habbohotel.items.interactions.pets.InteractionPetToy;
|
||||||
import com.eu.habbo.habbohotel.pets.actions.*;
|
import com.eu.habbo.habbohotel.pets.actions.*;
|
||||||
import com.eu.habbo.habbohotel.rooms.Room;
|
import com.eu.habbo.habbohotel.rooms.Room;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.eu.habbo.habbohotel.pets.actions;
|
package com.eu.habbo.habbohotel.pets.actions;
|
||||||
|
|
||||||
import com.eu.habbo.habbohotel.items.interactions.InteractionPetBreedingNest;
|
import com.eu.habbo.habbohotel.items.interactions.pets.InteractionPetBreedingNest;
|
||||||
import com.eu.habbo.habbohotel.pets.Pet;
|
import com.eu.habbo.habbohotel.pets.Pet;
|
||||||
import com.eu.habbo.habbohotel.pets.PetAction;
|
import com.eu.habbo.habbohotel.pets.PetAction;
|
||||||
import com.eu.habbo.habbohotel.pets.PetTasks;
|
import com.eu.habbo.habbohotel.pets.PetTasks;
|
||||||
|
@ -19,6 +19,10 @@ import com.eu.habbo.habbohotel.items.interactions.games.battlebanzai.Interaction
|
|||||||
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.tag.InteractionTagField;
|
import com.eu.habbo.habbohotel.items.interactions.games.tag.InteractionTagField;
|
||||||
import com.eu.habbo.habbohotel.items.interactions.games.tag.InteractionTagPole;
|
import com.eu.habbo.habbohotel.items.interactions.games.tag.InteractionTagPole;
|
||||||
|
import com.eu.habbo.habbohotel.items.interactions.pets.InteractionNest;
|
||||||
|
import com.eu.habbo.habbohotel.items.interactions.pets.InteractionPetBreedingNest;
|
||||||
|
import com.eu.habbo.habbohotel.items.interactions.pets.InteractionPetDrink;
|
||||||
|
import com.eu.habbo.habbohotel.items.interactions.pets.InteractionPetFood;
|
||||||
import com.eu.habbo.habbohotel.items.interactions.wired.extra.WiredBlob;
|
import com.eu.habbo.habbohotel.items.interactions.wired.extra.WiredBlob;
|
||||||
import com.eu.habbo.habbohotel.messenger.MessengerBuddy;
|
import com.eu.habbo.habbohotel.messenger.MessengerBuddy;
|
||||||
import com.eu.habbo.habbohotel.permissions.Permission;
|
import com.eu.habbo.habbohotel.permissions.Permission;
|
||||||
@ -566,6 +570,9 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
HabboItem lowestChair = this.getLowestChair(tile);
|
HabboItem lowestChair = this.getLowestChair(tile);
|
||||||
THashSet<HabboItem> items = this.getItemsAt(tile);
|
THashSet<HabboItem> items = this.getItemsAt(tile);
|
||||||
if (items == null) return RoomTileState.INVALID;
|
if (items == null) return RoomTileState.INVALID;
|
||||||
|
|
||||||
|
if (items.stream().anyMatch(i -> i.getBaseItem().allowLay())) return RoomTileState.LAY;
|
||||||
|
|
||||||
for (HabboItem item : items) {
|
for (HabboItem item : items) {
|
||||||
if (exclude != null && item == exclude) continue;
|
if (exclude != null && item == exclude) continue;
|
||||||
|
|
||||||
@ -576,10 +583,10 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
if (lowestItem == null || lowestItem.getZ() < item.getZ()) {
|
if (lowestItem == null || lowestItem.getZ() < item.getZ()) {
|
||||||
lowestItem = item;
|
lowestItem = item;
|
||||||
|
|
||||||
result = this.checkStateForItem(lowestItem);
|
result = this.checkStateForItem(lowestItem, tile);
|
||||||
} else if (lowestItem.getZ() == item.getZ()) {
|
} else if (lowestItem.getZ() == item.getZ()) {
|
||||||
if (result == RoomTileState.OPEN) {
|
if (result == RoomTileState.OPEN) {
|
||||||
result = this.checkStateForItem(item);
|
result = this.checkStateForItem(item, tile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -589,7 +596,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private RoomTileState checkStateForItem(HabboItem item) {
|
private RoomTileState checkStateForItem(HabboItem item, RoomTile tile) {
|
||||||
RoomTileState result = RoomTileState.BLOCKED;
|
RoomTileState result = RoomTileState.BLOCKED;
|
||||||
|
|
||||||
if (item.isWalkable()) {
|
if (item.isWalkable()) {
|
||||||
@ -604,6 +611,11 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
result = RoomTileState.LAY;
|
result = RoomTileState.LAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RoomTileState overriddenState = item.getOverrideTileState(tile, this);
|
||||||
|
if (overriddenState != null) {
|
||||||
|
result = overriddenState;
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -844,10 +856,11 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (this.loaded) {
|
if (this.loaded) {
|
||||||
if (!this.traxManager.disposed()) {
|
|
||||||
this.traxManager.dispose();
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
|
if (!this.traxManager.disposed()) {
|
||||||
|
this.traxManager.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
this.roomCycleTask.cancel(false);
|
this.roomCycleTask.cancel(false);
|
||||||
this.scheduledTasks.clear();
|
this.scheduledTasks.clear();
|
||||||
this.scheduledComposers.clear();
|
this.scheduledComposers.clear();
|
||||||
@ -927,12 +940,16 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.wordQuiz = "";
|
try {
|
||||||
this.yesVotes = 0;
|
this.wordQuiz = "";
|
||||||
this.noVotes = 0;
|
this.yesVotes = 0;
|
||||||
this.updateDatabaseUserCount();
|
this.noVotes = 0;
|
||||||
this.preLoaded = true;
|
this.updateDatabaseUserCount();
|
||||||
this.layout = null;
|
this.preLoaded = true;
|
||||||
|
this.layout = null;
|
||||||
|
} catch (Exception e) {
|
||||||
|
Emulator.getLogging().logErrorLine(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Emulator.getPluginManager().fireEvent(new RoomUnloadedEvent(this));
|
Emulator.getPluginManager().fireEvent(new RoomUnloadedEvent(this));
|
||||||
@ -2368,6 +2385,9 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public HabboItem getHabboItem(int id) {
|
public HabboItem getHabboItem(int id) {
|
||||||
|
if (this.roomItems == null || this.roomSpecialTypes == null)
|
||||||
|
return null; // room not loaded completely
|
||||||
|
|
||||||
HabboItem item;
|
HabboItem item;
|
||||||
synchronized (this.roomItems) {
|
synchronized (this.roomItems) {
|
||||||
item = this.roomItems.get(id);
|
item = this.roomItems.get(id);
|
||||||
@ -2586,13 +2606,15 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
this.sendComposer(new RoomUserRemoveComposer(habbo.getRoomUnit()).compose());
|
this.sendComposer(new RoomUserRemoveComposer(habbo.getRoomUnit()).compose());
|
||||||
}
|
}
|
||||||
|
|
||||||
HabboItem item = this.getTopItemAt(habbo.getRoomUnit().getX(), habbo.getRoomUnit().getY());
|
if (habbo.getRoomUnit().getCurrentLocation() != null) {
|
||||||
|
HabboItem item = this.getTopItemAt(habbo.getRoomUnit().getX(), habbo.getRoomUnit().getY());
|
||||||
|
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
try {
|
try {
|
||||||
item.onWalkOff(habbo.getRoomUnit(), this, new Object[]{});
|
item.onWalkOff(habbo.getRoomUnit(), this, new Object[]{});
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Emulator.getLogging().logErrorLine(e);
|
Emulator.getLogging().logErrorLine(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4344,6 +4366,8 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
if (!this.layout.fitsOnMap(tile, item.getBaseItem().getWidth(), item.getBaseItem().getLength(), rotation))
|
if (!this.layout.fitsOnMap(tile, item.getBaseItem().getWidth(), item.getBaseItem().getLength(), rotation))
|
||||||
return FurnitureMovementError.INVALID_MOVE;
|
return FurnitureMovementError.INVALID_MOVE;
|
||||||
|
|
||||||
|
if (item instanceof InteractionStackHelper) return FurnitureMovementError.NONE;
|
||||||
|
|
||||||
THashSet<RoomTile> occupiedTiles = this.layout.getTilesAt(tile, item.getBaseItem().getWidth(), item.getBaseItem().getLength(), rotation);
|
THashSet<RoomTile> occupiedTiles = this.layout.getTilesAt(tile, item.getBaseItem().getWidth(), item.getBaseItem().getLength(), rotation);
|
||||||
for (RoomTile t : occupiedTiles) {
|
for (RoomTile t : occupiedTiles) {
|
||||||
|
|
||||||
@ -4352,24 +4376,20 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
if (this.hasPetsAt(t.x, t.y)) return FurnitureMovementError.TILE_HAS_PETS;
|
if (this.hasPetsAt(t.x, t.y)) return FurnitureMovementError.TILE_HAS_PETS;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean magicTile = item instanceof InteractionStackHelper;
|
List<Pair<RoomTile, THashSet<HabboItem>>> tileFurniList = new ArrayList<>();
|
||||||
|
for (RoomTile t : occupiedTiles) {
|
||||||
|
tileFurniList.add(Pair.create(t, this.getItemsAt(t)));
|
||||||
|
|
||||||
if (!magicTile) {
|
HabboItem topItem = this.getTopItemAt(t.x, t.y, item);
|
||||||
List<Pair<RoomTile, THashSet<HabboItem>>> tileFurniList = new ArrayList<>();
|
if (topItem != null && !topItem.getBaseItem().allowStack() && !t.getAllowStack()) {
|
||||||
for (RoomTile t : occupiedTiles) {
|
|
||||||
tileFurniList.add(Pair.create(t, this.getItemsAt(t)));
|
|
||||||
|
|
||||||
HabboItem topItem = this.getTopItemAt(t.x, t.y, item);
|
|
||||||
if (topItem != null && !topItem.getBaseItem().allowStack() && !t.getAllowStack()) {
|
|
||||||
return FurnitureMovementError.CANT_STACK;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!item.canStackAt(this, tileFurniList)) {
|
|
||||||
return FurnitureMovementError.CANT_STACK;
|
return FurnitureMovementError.CANT_STACK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!item.canStackAt(this, tileFurniList)) {
|
||||||
|
return FurnitureMovementError.CANT_STACK;
|
||||||
|
}
|
||||||
|
|
||||||
return FurnitureMovementError.NONE;
|
return FurnitureMovementError.NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4451,26 +4471,31 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
|
|
||||||
boolean magicTile = item instanceof InteractionStackHelper;
|
boolean magicTile = item instanceof InteractionStackHelper;
|
||||||
|
|
||||||
|
Optional<HabboItem> stackHelper = this.getItemsAt(tile).stream().filter(i -> i instanceof InteractionStackHelper).findAny();
|
||||||
|
|
||||||
//Check if can be placed at new position
|
//Check if can be placed at new position
|
||||||
THashSet<RoomTile> occupiedTiles = this.layout.getTilesAt(tile, item.getBaseItem().getWidth(), item.getBaseItem().getLength(), rotation);
|
THashSet<RoomTile> occupiedTiles = this.layout.getTilesAt(tile, item.getBaseItem().getWidth(), item.getBaseItem().getLength(), rotation);
|
||||||
if (topItem != item) {
|
|
||||||
for (RoomTile t : occupiedTiles) {
|
if (!stackHelper.isPresent()) {
|
||||||
HabboItem tileTopItem = this.getTopItemAt(t.x, t.y);
|
if (topItem != item) {
|
||||||
if (!magicTile && ((tileTopItem != null && tileTopItem != item ? (t.state.equals(RoomTileState.INVALID) || !t.getAllowStack() || !tileTopItem.getBaseItem().allowStack()) : this.calculateTileState(t, item).equals(RoomTileState.INVALID))))
|
for (RoomTile t : occupiedTiles) {
|
||||||
return FurnitureMovementError.CANT_STACK;
|
HabboItem tileTopItem = this.getTopItemAt(t.x, t.y);
|
||||||
if (this.hasHabbosAt(t.x, t.y)) return FurnitureMovementError.TILE_HAS_HABBOS;
|
if (!magicTile && ((tileTopItem != null && tileTopItem != item ? (t.state.equals(RoomTileState.INVALID) || !t.getAllowStack() || !tileTopItem.getBaseItem().allowStack()) : this.calculateTileState(t, item).equals(RoomTileState.INVALID))))
|
||||||
if (this.hasBotsAt(t.x, t.y)) return FurnitureMovementError.TILE_HAS_BOTS;
|
return FurnitureMovementError.CANT_STACK;
|
||||||
if (this.hasPetsAt(t.x, t.y)) return FurnitureMovementError.TILE_HAS_PETS;
|
if (this.hasHabbosAt(t.x, t.y)) return FurnitureMovementError.TILE_HAS_HABBOS;
|
||||||
|
if (this.hasBotsAt(t.x, t.y)) return FurnitureMovementError.TILE_HAS_BOTS;
|
||||||
|
if (this.hasPetsAt(t.x, t.y)) return FurnitureMovementError.TILE_HAS_PETS;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
List<Pair<RoomTile, THashSet<HabboItem>>> tileFurniList = new ArrayList<>();
|
List<Pair<RoomTile, THashSet<HabboItem>>> tileFurniList = new ArrayList<>();
|
||||||
for (RoomTile t : occupiedTiles) {
|
for (RoomTile t : occupiedTiles) {
|
||||||
tileFurniList.add(Pair.create(t, this.getItemsAt(t)));
|
tileFurniList.add(Pair.create(t, this.getItemsAt(t)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!magicTile && !item.canStackAt(this, tileFurniList)) {
|
if (!magicTile && !item.canStackAt(this, tileFurniList)) {
|
||||||
return FurnitureMovementError.CANT_STACK;
|
return FurnitureMovementError.CANT_STACK;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
THashSet<RoomTile> oldOccupiedTiles = this.layout.getTilesAt(this.layout.getTile(item.getX(), item.getY()), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), item.getRotation());
|
THashSet<RoomTile> oldOccupiedTiles = this.layout.getTilesAt(this.layout.getTile(item.getX(), item.getY()), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), item.getRotation());
|
||||||
@ -4491,8 +4516,16 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
}
|
}
|
||||||
//Place at new position
|
//Place at new position
|
||||||
|
|
||||||
double height = this.getStackHeight(tile.x, tile.y, false, item);
|
double height;
|
||||||
if (item.equals(topItem) && tile.x == item.getX() && tile.y == item.getY()) height = item.getZ();
|
|
||||||
|
if (stackHelper.isPresent()) {
|
||||||
|
height = stackHelper.get().getExtradata().isEmpty() ? Double.valueOf("0.0") : (Double.valueOf(stackHelper.get().getExtradata()) / 100);
|
||||||
|
} else if (item.equals(topItem) && tile.x == item.getX() && tile.y == item.getY()) {
|
||||||
|
height = item.getZ();
|
||||||
|
} else {
|
||||||
|
height = this.getStackHeight(tile.x, tile.y, false, item);
|
||||||
|
}
|
||||||
|
|
||||||
if(height > 40d) return FurnitureMovementError.CANT_STACK;
|
if(height > 40d) return FurnitureMovementError.CANT_STACK;
|
||||||
|
|
||||||
item.setX(tile.x);
|
item.setX(tile.x);
|
||||||
|
@ -265,41 +265,48 @@ public class RoomLayout {
|
|||||||
public final Deque<RoomTile> findPath(RoomTile oldTile, RoomTile newTile, RoomTile goalLocation, RoomUnit roomUnit, boolean isWalktroughRetry) {
|
public final Deque<RoomTile> findPath(RoomTile oldTile, RoomTile newTile, RoomTile goalLocation, RoomUnit roomUnit, boolean isWalktroughRetry) {
|
||||||
if (this.room == null || !this.room.isLoaded() || oldTile == null || newTile == null || oldTile.equals(newTile) || newTile.state == RoomTileState.INVALID)
|
if (this.room == null || !this.room.isLoaded() || oldTile == null || newTile == null || oldTile.equals(newTile) || newTile.state == RoomTileState.INVALID)
|
||||||
return new LinkedList<>();
|
return new LinkedList<>();
|
||||||
|
|
||||||
LinkedList<RoomTile> openList = new LinkedList<>();
|
LinkedList<RoomTile> openList = new LinkedList<>();
|
||||||
List<RoomTile> closedList = new LinkedList<>();
|
List<RoomTile> closedList = new LinkedList<>();
|
||||||
RoomTile current;
|
|
||||||
openList.add(oldTile.copy());
|
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);
|
|
||||||
|
|
||||||
|
while (!openList.isEmpty()) {
|
||||||
|
RoomTile 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);
|
closedList.add(current);
|
||||||
openList.remove(current);
|
openList.remove(current);
|
||||||
List<RoomTile> adjacentNodes = this.getAdjacent(openList, current, newTile);
|
|
||||||
|
List<RoomTile> adjacentNodes = this.getAdjacent(openList, current, newTile, roomUnit);
|
||||||
for (RoomTile currentAdj : adjacentNodes) {
|
for (RoomTile currentAdj : adjacentNodes) {
|
||||||
if (closedList.contains(currentAdj)) continue;
|
if (closedList.contains(currentAdj)) continue;
|
||||||
if (roomUnit.canOverrideTile(currentAdj) || (currentAdj.state != RoomTileState.BLOCKED && currentAdj.x == doorX && currentAdj.y == doorY)) {
|
|
||||||
currentAdj.setPrevious(current);
|
if (roomUnit.canOverrideTile(currentAdj) || (currentAdj.state != RoomTileState.BLOCKED && currentAdj.x == doorX && currentAdj.y == doorY)) {
|
||||||
currentAdj.sethCosts(this.findTile(openList, newTile.x, newTile.y));
|
currentAdj.setPrevious(current);
|
||||||
currentAdj.setgCosts(current);
|
currentAdj.sethCosts(this.findTile(openList, newTile.x, newTile.y));
|
||||||
openList.add(currentAdj);
|
currentAdj.setgCosts(current);
|
||||||
continue;
|
openList.add(currentAdj);
|
||||||
}
|
continue;
|
||||||
if ((currentAdj.state == RoomTileState.BLOCKED) || ((currentAdj.state == RoomTileState.SIT || currentAdj.state == RoomTileState.LAY) && !currentAdj.equals(goalLocation))) {
|
}
|
||||||
|
|
||||||
|
if (currentAdj.state == RoomTileState.BLOCKED || ((currentAdj.state == RoomTileState.SIT || currentAdj.state == RoomTileState.LAY) && !currentAdj.equals(goalLocation))) {
|
||||||
closedList.add(currentAdj);
|
closedList.add(currentAdj);
|
||||||
openList.remove(currentAdj);
|
openList.remove(currentAdj);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
double height = currentAdj.getStackHeight() - current.getStackHeight();
|
double height = currentAdj.getStackHeight() - current.getStackHeight();
|
||||||
if (!ALLOW_FALLING && height < -MAXIMUM_STEP_HEIGHT) continue;
|
if (!ALLOW_FALLING && height < -MAXIMUM_STEP_HEIGHT) continue;
|
||||||
if (currentAdj.state == RoomTileState.OPEN && height > MAXIMUM_STEP_HEIGHT) continue;
|
if (currentAdj.state == RoomTileState.OPEN && height > MAXIMUM_STEP_HEIGHT) continue;
|
||||||
|
|
||||||
if (currentAdj.hasUnits() && ((!isWalktroughRetry && !this.room.isAllowWalkthrough()) || currentAdj.equals(goalLocation))) {
|
if (currentAdj.hasUnits() && ((!isWalktroughRetry && !this.room.isAllowWalkthrough()) || currentAdj.equals(goalLocation))) {
|
||||||
closedList.add(currentAdj);
|
closedList.add(currentAdj);
|
||||||
openList.remove(currentAdj);
|
openList.remove(currentAdj);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!openList.contains(currentAdj)) {
|
if (!openList.contains(currentAdj)) {
|
||||||
currentAdj.setPrevious(current);
|
currentAdj.setPrevious(current);
|
||||||
currentAdj.sethCosts(this.findTile(openList, newTile.x, newTile.y));
|
currentAdj.sethCosts(this.findTile(openList, newTile.x, newTile.y));
|
||||||
@ -311,9 +318,8 @@ public class RoomLayout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// System.out.println("Invalid Path.");
|
|
||||||
|
|
||||||
if (!this.room.isAllowWalkthrough()) {
|
if (!this.room.isAllowWalkthrough() && !isWalktroughRetry) {
|
||||||
return this.findPath(oldTile, newTile, goalLocation, roomUnit, true);
|
return this.findPath(oldTile, newTile, goalLocation, roomUnit, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -335,7 +341,7 @@ public class RoomLayout {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Deque<RoomTile> calcPath(RoomTile start, RoomTile goal) {
|
public Deque<RoomTile> calcPath(RoomTile start, RoomTile goal) {
|
||||||
LinkedList<RoomTile> path = new LinkedList<>();
|
LinkedList<RoomTile> path = new LinkedList<>();
|
||||||
if (start == null)
|
if (start == null)
|
||||||
return path;
|
return path;
|
||||||
@ -364,13 +370,13 @@ public class RoomLayout {
|
|||||||
return cheapest;
|
return cheapest;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<RoomTile> getAdjacent(List<RoomTile> openList, RoomTile node, RoomTile nextTile) {
|
private List<RoomTile> getAdjacent(List<RoomTile> openList, RoomTile node, RoomTile nextTile, RoomUnit unit) {
|
||||||
short x = node.x;
|
short x = node.x;
|
||||||
short y = node.y;
|
short y = node.y;
|
||||||
List<RoomTile> adj = new LinkedList<>();
|
List<RoomTile> adj = new LinkedList<>();
|
||||||
if (x > 0) {
|
if (x > 0) {
|
||||||
RoomTile temp = this.findTile(openList, (short) (x - 1), y);
|
RoomTile temp = this.findTile(openList, (short) (x - 1), y);
|
||||||
if (temp != null && temp.state != RoomTileState.BLOCKED && temp.state != RoomTileState.INVALID) {
|
if (this.canWalkOn(temp, unit)) {
|
||||||
if (temp.state != RoomTileState.SIT || nextTile.getStackHeight() - node.getStackHeight() <= 2.0) {
|
if (temp.state != RoomTileState.SIT || nextTile.getStackHeight() - node.getStackHeight() <= 2.0) {
|
||||||
temp.isDiagonally(false);
|
temp.isDiagonally(false);
|
||||||
if (!adj.contains(temp))
|
if (!adj.contains(temp))
|
||||||
@ -380,7 +386,7 @@ public class RoomLayout {
|
|||||||
}
|
}
|
||||||
if (x < this.mapSizeX) {
|
if (x < this.mapSizeX) {
|
||||||
RoomTile temp = this.findTile(openList, (short) (x + 1), y);
|
RoomTile temp = this.findTile(openList, (short) (x + 1), y);
|
||||||
if (temp != null && temp.state != RoomTileState.BLOCKED && temp.state != RoomTileState.INVALID) {
|
if (this.canWalkOn(temp, unit)) {
|
||||||
if (temp.state != RoomTileState.SIT || nextTile.getStackHeight() - node.getStackHeight() <= 2.0) {
|
if (temp.state != RoomTileState.SIT || nextTile.getStackHeight() - node.getStackHeight() <= 2.0) {
|
||||||
temp.isDiagonally(false);
|
temp.isDiagonally(false);
|
||||||
if (!adj.contains(temp))
|
if (!adj.contains(temp))
|
||||||
@ -390,7 +396,7 @@ public class RoomLayout {
|
|||||||
}
|
}
|
||||||
if (y > 0) {
|
if (y > 0) {
|
||||||
RoomTile temp = this.findTile(openList, x, (short) (y - 1));
|
RoomTile temp = this.findTile(openList, x, (short) (y - 1));
|
||||||
if (temp != null && temp.state != RoomTileState.BLOCKED && temp.state != RoomTileState.INVALID) {
|
if (this.canWalkOn(temp, unit)) {
|
||||||
if (temp.state != RoomTileState.SIT || nextTile.getStackHeight() - node.getStackHeight() <= 2.0) {
|
if (temp.state != RoomTileState.SIT || nextTile.getStackHeight() - node.getStackHeight() <= 2.0) {
|
||||||
temp.isDiagonally(false);
|
temp.isDiagonally(false);
|
||||||
if (!adj.contains(temp))
|
if (!adj.contains(temp))
|
||||||
@ -400,7 +406,7 @@ public class RoomLayout {
|
|||||||
}
|
}
|
||||||
if (y < this.mapSizeY) {
|
if (y < this.mapSizeY) {
|
||||||
RoomTile temp = this.findTile(openList, x, (short) (y + 1));
|
RoomTile temp = this.findTile(openList, x, (short) (y + 1));
|
||||||
if (temp != null && temp.state != RoomTileState.BLOCKED && temp.state != RoomTileState.INVALID) {
|
if (this.canWalkOn(temp, unit)) {
|
||||||
if (temp.state != RoomTileState.SIT || nextTile.getStackHeight() - node.getStackHeight() <= 2.0) {
|
if (temp.state != RoomTileState.SIT || nextTile.getStackHeight() - node.getStackHeight() <= 2.0) {
|
||||||
temp.isDiagonally(false);
|
temp.isDiagonally(false);
|
||||||
if (!adj.contains(temp))
|
if (!adj.contains(temp))
|
||||||
@ -414,7 +420,7 @@ public class RoomLayout {
|
|||||||
RoomTile offY = this.findTile(openList, x, (short) (y + 1));
|
RoomTile offY = this.findTile(openList, x, (short) (y + 1));
|
||||||
if (offX != null && offY != null && (offX.isWalkable() || offY.isWalkable())) {
|
if (offX != null && offY != null && (offX.isWalkable() || offY.isWalkable())) {
|
||||||
RoomTile temp = this.findTile(openList, (short) (x + 1), (short) (y + 1));
|
RoomTile temp = this.findTile(openList, (short) (x + 1), (short) (y + 1));
|
||||||
if (temp != null && temp.state != RoomTileState.BLOCKED && temp.state != RoomTileState.INVALID) {
|
if (this.canWalkOn(temp, unit)) {
|
||||||
if (temp.state != RoomTileState.SIT || nextTile.getStackHeight() - node.getStackHeight() <= 2.0) {
|
if (temp.state != RoomTileState.SIT || nextTile.getStackHeight() - node.getStackHeight() <= 2.0) {
|
||||||
temp.isDiagonally(true);
|
temp.isDiagonally(true);
|
||||||
if (!adj.contains(temp))
|
if (!adj.contains(temp))
|
||||||
@ -428,7 +434,7 @@ public class RoomLayout {
|
|||||||
RoomTile offY = this.findTile(openList, x, (short) (y - 1));
|
RoomTile offY = this.findTile(openList, x, (short) (y - 1));
|
||||||
if (offX != null && offY != null && (offX.isWalkable() || offY.isWalkable())) {
|
if (offX != null && offY != null && (offX.isWalkable() || offY.isWalkable())) {
|
||||||
RoomTile temp = this.findTile(openList, (short) (x - 1), (short) (y - 1));
|
RoomTile temp = this.findTile(openList, (short) (x - 1), (short) (y - 1));
|
||||||
if (temp != null && temp.state != RoomTileState.BLOCKED && temp.state != RoomTileState.INVALID) {
|
if (this.canWalkOn(temp, unit)) {
|
||||||
if (temp.state != RoomTileState.SIT || nextTile.getStackHeight() - node.getStackHeight() <= 2.0) {
|
if (temp.state != RoomTileState.SIT || nextTile.getStackHeight() - node.getStackHeight() <= 2.0) {
|
||||||
temp.isDiagonally(true);
|
temp.isDiagonally(true);
|
||||||
if (!adj.contains(temp))
|
if (!adj.contains(temp))
|
||||||
@ -442,7 +448,7 @@ public class RoomLayout {
|
|||||||
RoomTile offY = this.findTile(openList, x, (short) (y + 1));
|
RoomTile offY = this.findTile(openList, x, (short) (y + 1));
|
||||||
if (offX != null && offY != null && (offX.isWalkable() || offY.isWalkable())) {
|
if (offX != null && offY != null && (offX.isWalkable() || offY.isWalkable())) {
|
||||||
RoomTile temp = this.findTile(openList, (short) (x - 1), (short) (y + 1));
|
RoomTile temp = this.findTile(openList, (short) (x - 1), (short) (y + 1));
|
||||||
if (temp != null && temp.state != RoomTileState.BLOCKED && temp.state != RoomTileState.INVALID) {
|
if (this.canWalkOn(temp, unit)) {
|
||||||
if (temp.state != RoomTileState.SIT || nextTile.getStackHeight() - node.getStackHeight() <= 2.0) {
|
if (temp.state != RoomTileState.SIT || nextTile.getStackHeight() - node.getStackHeight() <= 2.0) {
|
||||||
temp.isDiagonally(true);
|
temp.isDiagonally(true);
|
||||||
if (!adj.contains(temp))
|
if (!adj.contains(temp))
|
||||||
@ -456,7 +462,7 @@ public class RoomLayout {
|
|||||||
RoomTile offY = this.findTile(openList, x, (short) (y - 1));
|
RoomTile offY = this.findTile(openList, x, (short) (y - 1));
|
||||||
if (offX != null && offY != null && (offX.isWalkable() || offY.isWalkable())) {
|
if (offX != null && offY != null && (offX.isWalkable() || offY.isWalkable())) {
|
||||||
RoomTile temp = this.findTile(openList, (short) (x + 1), (short) (y - 1));
|
RoomTile temp = this.findTile(openList, (short) (x + 1), (short) (y - 1));
|
||||||
if (temp != null && temp.state != RoomTileState.BLOCKED && temp.state != RoomTileState.INVALID) {
|
if (this.canWalkOn(temp, unit)) {
|
||||||
if (temp.state != RoomTileState.SIT || nextTile.getStackHeight() - node.getStackHeight() <= 2.0) {
|
if (temp.state != RoomTileState.SIT || nextTile.getStackHeight() - node.getStackHeight() <= 2.0) {
|
||||||
temp.isDiagonally(true);
|
temp.isDiagonally(true);
|
||||||
if (!adj.contains(temp))
|
if (!adj.contains(temp))
|
||||||
@ -469,6 +475,10 @@ public class RoomLayout {
|
|||||||
return adj;
|
return adj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean canWalkOn(RoomTile tile, RoomUnit unit) {
|
||||||
|
return tile != null && (unit.canOverrideTile(tile) || (tile.state != RoomTileState.BLOCKED && tile.state != RoomTileState.INVALID));
|
||||||
|
}
|
||||||
|
|
||||||
public void moveDiagonally(boolean value) {
|
public void moveDiagonally(boolean value) {
|
||||||
this.CANMOVEDIAGONALY = value;
|
this.CANMOVEDIAGONALY = value;
|
||||||
}
|
}
|
||||||
@ -545,10 +555,14 @@ public class RoomLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<RoomTile> getTilesAround(RoomTile tile, int directionOffset) {
|
public List<RoomTile> getTilesAround(RoomTile tile, int directionOffset) {
|
||||||
List<RoomTile> tiles = new ArrayList<>(8);
|
return getTilesAround(tile, directionOffset, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<RoomTile> getTilesAround(RoomTile tile, int directionOffset, boolean diagonal) {
|
||||||
|
List<RoomTile> tiles = new ArrayList<>(diagonal ? 8 : 4);
|
||||||
|
|
||||||
if (tile != null) {
|
if (tile != null) {
|
||||||
for (int i = 0; i < 8; i++) {
|
for (int i = 0; i < 8; i += (diagonal ? 1 : 2)) {
|
||||||
RoomTile t = this.getTileInFront(tile, (i + directionOffset) % 8);
|
RoomTile t = this.getTileInFront(tile, (i + directionOffset) % 8);
|
||||||
if (t != null) {
|
if (t != null) {
|
||||||
tiles.add(t);
|
tiles.add(t);
|
||||||
|
@ -596,7 +596,7 @@ public class RoomManager {
|
|||||||
habbo.getRoomUnit().clearStatus();
|
habbo.getRoomUnit().clearStatus();
|
||||||
if (habbo.getRoomUnit().getCurrentLocation() == null) {
|
if (habbo.getRoomUnit().getCurrentLocation() == null) {
|
||||||
habbo.getRoomUnit().setLocation(doorLocation != null ? doorLocation : room.getLayout().getDoorTile());
|
habbo.getRoomUnit().setLocation(doorLocation != null ? doorLocation : room.getLayout().getDoorTile());
|
||||||
habbo.getRoomUnit().setZ(habbo.getRoomUnit().getCurrentLocation().getStackHeight());
|
if (habbo.getRoomUnit().getCurrentLocation() != null) habbo.getRoomUnit().setZ(habbo.getRoomUnit().getCurrentLocation().getStackHeight());
|
||||||
|
|
||||||
if (doorLocation == null) {
|
if (doorLocation == null) {
|
||||||
habbo.getRoomUnit().setBodyRotation(RoomUserRotation.values()[room.getLayout().getDoorDirection()]);
|
habbo.getRoomUnit().setBodyRotation(RoomUserRotation.values()[room.getLayout().getDoorDirection()]);
|
||||||
@ -713,21 +713,23 @@ public class RoomManager {
|
|||||||
if (!room.getCurrentHabbos().isEmpty()) {
|
if (!room.getCurrentHabbos().isEmpty()) {
|
||||||
|
|
||||||
Collection<Habbo> habbosToSendEnter = room.getCurrentHabbos().values();
|
Collection<Habbo> habbosToSendEnter = room.getCurrentHabbos().values();
|
||||||
|
Collection<Habbo> visibleHabbos = room.getHabbos();
|
||||||
|
|
||||||
if (Emulator.getPluginManager().isRegistered(HabboAddedToRoomEvent.class, false)) {
|
if (Emulator.getPluginManager().isRegistered(HabboAddedToRoomEvent.class, false)) {
|
||||||
HabboAddedToRoomEvent event = Emulator.getPluginManager().fireEvent(new HabboAddedToRoomEvent(habbo, room, habbosToSendEnter));
|
HabboAddedToRoomEvent event = Emulator.getPluginManager().fireEvent(new HabboAddedToRoomEvent(habbo, room, habbosToSendEnter, visibleHabbos));
|
||||||
habbosToSendEnter = event.habbosToSendEnter;
|
habbosToSendEnter = event.habbosToSendEnter;
|
||||||
|
visibleHabbos = event.visibleHabbos;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Habbo habboToSendEnter : habbosToSendEnter) {
|
for (Habbo habboToSendEnter : habbosToSendEnter) {
|
||||||
GameClient client = habboToSendEnter.getClient();
|
GameClient client = habboToSendEnter.getClient();
|
||||||
if (client != null) {
|
if (client != null) {
|
||||||
client.sendResponse(new RoomUsersComposer(habbo).compose());
|
client.sendResponse(new RoomUsersComposer(habbo).compose());
|
||||||
habboToSendEnter.getClient().sendResponse(new RoomUserStatusComposer(habbo.getRoomUnit()).compose());
|
client.sendResponse(new RoomUserStatusComposer(habbo.getRoomUnit()).compose());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Habbo h : room.getHabbos()) {
|
for (Habbo h : visibleHabbos) {
|
||||||
if (!h.getRoomUnit().isInvisible()) {
|
if (!h.getRoomUnit().isInvisible()) {
|
||||||
habbos.add(h);
|
habbos.add(h);
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,10 @@ import com.eu.habbo.habbohotel.items.interactions.games.football.scoreboards.Int
|
|||||||
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.gates.InteractionFreezeGate;
|
import com.eu.habbo.habbohotel.items.interactions.games.freeze.gates.InteractionFreezeGate;
|
||||||
import com.eu.habbo.habbohotel.items.interactions.games.freeze.scoreboards.InteractionFreezeScoreboard;
|
import com.eu.habbo.habbohotel.items.interactions.games.freeze.scoreboards.InteractionFreezeScoreboard;
|
||||||
|
import com.eu.habbo.habbohotel.items.interactions.pets.InteractionNest;
|
||||||
|
import com.eu.habbo.habbohotel.items.interactions.pets.InteractionPetDrink;
|
||||||
|
import com.eu.habbo.habbohotel.items.interactions.pets.InteractionPetFood;
|
||||||
|
import com.eu.habbo.habbohotel.items.interactions.pets.InteractionPetToy;
|
||||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||||
import com.eu.habbo.habbohotel.wired.WiredConditionType;
|
import com.eu.habbo.habbohotel.wired.WiredConditionType;
|
||||||
import com.eu.habbo.habbohotel.wired.WiredEffectType;
|
import com.eu.habbo.habbohotel.wired.WiredEffectType;
|
||||||
|
@ -28,6 +28,7 @@ import gnu.trove.set.hash.THashSet;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class RoomUnit {
|
public class RoomUnit {
|
||||||
public boolean isWiredTeleporting = false;
|
public boolean isWiredTeleporting = false;
|
||||||
@ -290,7 +291,7 @@ public class RoomUnit {
|
|||||||
if (item != null) {
|
if (item != null) {
|
||||||
if (item != habboItem || !RoomLayout.pointInSquare(item.getX(), item.getY(), item.getX() + item.getBaseItem().getWidth() - 1, item.getY() + item.getBaseItem().getLength() - 1, this.getX(), this.getY())) {
|
if (item != habboItem || !RoomLayout.pointInSquare(item.getX(), item.getY(), item.getX() + item.getBaseItem().getWidth() - 1, item.getY() + item.getBaseItem().getLength() - 1, this.getX(), this.getY())) {
|
||||||
if (item.canWalkOn(this, room, null)) {
|
if (item.canWalkOn(this, room, null)) {
|
||||||
item.onWalkOn(this, room, null);
|
item.onWalkOn(this, room, new Object[]{this.getCurrentLocation(), next});
|
||||||
} else if (item instanceof InteractionGuildGate || item instanceof InteractionHabboClubGate) {
|
} else if (item instanceof InteractionGuildGate || item instanceof InteractionHabboClubGate) {
|
||||||
this.setRotation(oldRotation);
|
this.setRotation(oldRotation);
|
||||||
this.tilesWalked--;
|
this.tilesWalked--;
|
||||||
@ -305,7 +306,7 @@ public class RoomUnit {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
item.onWalk(this, room, null);
|
item.onWalk(this, room, new Object[]{this.getCurrentLocation(), next});
|
||||||
}
|
}
|
||||||
|
|
||||||
zHeight += item.getZ();
|
zHeight += item.getZ();
|
||||||
@ -714,6 +715,9 @@ public class RoomUnit {
|
|||||||
public boolean canOverrideTile(RoomTile tile) {
|
public boolean canOverrideTile(RoomTile tile) {
|
||||||
if (tile == null || room == null || room.getLayout() == null) return false;
|
if (tile == null || room == null || room.getLayout() == null) return false;
|
||||||
|
|
||||||
|
if (room.getItemsAt(tile).stream().anyMatch(i -> i.canOverrideTile(this, room, tile)))
|
||||||
|
return true;
|
||||||
|
|
||||||
int tileIndex = (room.getLayout().getMapSizeY() * tile.y) + tile.x + 1;
|
int tileIndex = (room.getLayout().getMapSizeY() * tile.y) + tile.x + 1;
|
||||||
return this.overridableTiles.contains(tileIndex);
|
return this.overridableTiles.contains(tileIndex);
|
||||||
}
|
}
|
||||||
@ -726,6 +730,8 @@ public class RoomUnit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void removeOverrideTile(RoomTile tile) {
|
public void removeOverrideTile(RoomTile tile) {
|
||||||
|
if (room == null || room.getLayout() == null) return;
|
||||||
|
|
||||||
int tileIndex = (room.getLayout().getMapSizeY() * tile.y) + tile.x + 1;
|
int tileIndex = (room.getLayout().getMapSizeY() * tile.y) + tile.x + 1;
|
||||||
this.overridableTiles.remove(tileIndex);
|
this.overridableTiles.remove(tileIndex);
|
||||||
}
|
}
|
||||||
@ -750,6 +756,10 @@ public class RoomUnit {
|
|||||||
return topItem == null || (!(topItem instanceof InteractionWater) && !(topItem instanceof InteractionWaterItem));
|
return topItem == null || (!(topItem instanceof InteractionWater) && !(topItem instanceof InteractionWaterItem));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public RoomTile getClosestTile(List<RoomTile> tiles) {
|
||||||
|
return tiles.stream().min(Comparator.comparingDouble(a -> a.distance(this.getCurrentLocation()))).orElse(null);
|
||||||
|
}
|
||||||
|
|
||||||
public RoomTile getClosestAdjacentTile(short x, short y, boolean diagonal) {
|
public RoomTile getClosestAdjacentTile(short x, short y, boolean diagonal) {
|
||||||
RoomTile baseTile = room.getLayout().getTile(x, y);
|
RoomTile baseTile = room.getLayout().getTile(x, y);
|
||||||
|
|
||||||
@ -768,10 +778,12 @@ public class RoomUnit {
|
|||||||
rotations.add(RoomUserRotation.SOUTH_WEST.getValue());
|
rotations.add(RoomUserRotation.SOUTH_WEST.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
return rotations.stream()
|
return this.getClosestTile(
|
||||||
.map(rotation -> room.getLayout().getTileInFront(baseTile, rotation))
|
rotations.stream()
|
||||||
.filter(t -> t != null && t.isWalkable() && !room.hasHabbosAt(t.x, t.y))
|
.map(rotation -> room.getLayout().getTileInFront(baseTile, rotation))
|
||||||
.min(Comparator.comparingDouble(a -> a.distance(this.getCurrentLocation()))).orElse(null);
|
.filter(t -> t != null && t.isWalkable() && (this.getCurrentLocation().equals(t) || !room.hasHabbosAt(t.x, t.y)))
|
||||||
|
.collect(Collectors.toList())
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ScheduledFuture getMoveBlockingTask() {
|
public ScheduledFuture getMoveBlockingTask() {
|
||||||
|
@ -261,7 +261,7 @@ public class TraxManager implements Disposable {
|
|||||||
|
|
||||||
public InteractionMusicDisc fromItemId(int itemId) {
|
public InteractionMusicDisc fromItemId(int itemId) {
|
||||||
for (InteractionMusicDisc musicDisc : this.songs) {
|
for (InteractionMusicDisc musicDisc : this.songs) {
|
||||||
if (musicDisc.getId() == itemId) {
|
if (musicDisc != null && musicDisc.getId() == itemId) {
|
||||||
return musicDisc;
|
return musicDisc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,10 +10,7 @@ import com.eu.habbo.habbohotel.items.IEventTriggers;
|
|||||||
import com.eu.habbo.habbohotel.items.Item;
|
import com.eu.habbo.habbohotel.items.Item;
|
||||||
import com.eu.habbo.habbohotel.items.interactions.*;
|
import com.eu.habbo.habbohotel.items.interactions.*;
|
||||||
import com.eu.habbo.habbohotel.items.interactions.games.InteractionGameTimer;
|
import com.eu.habbo.habbohotel.items.interactions.games.InteractionGameTimer;
|
||||||
import com.eu.habbo.habbohotel.rooms.Room;
|
import com.eu.habbo.habbohotel.rooms.*;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomLayout;
|
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
|
||||||
import com.eu.habbo.habbohotel.wired.WiredEffectType;
|
import com.eu.habbo.habbohotel.wired.WiredEffectType;
|
||||||
import com.eu.habbo.habbohotel.wired.WiredHandler;
|
import com.eu.habbo.habbohotel.wired.WiredHandler;
|
||||||
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
|
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
|
||||||
@ -25,12 +22,14 @@ import gnu.trove.set.hash.THashSet;
|
|||||||
import org.apache.commons.lang3.ArrayUtils;
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
import org.apache.commons.math3.util.Pair;
|
import org.apache.commons.math3.util.Pair;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Deque;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public abstract class HabboItem implements Runnable, IEventTriggers {
|
public abstract class HabboItem implements Runnable, IEventTriggers {
|
||||||
@ -487,4 +486,30 @@ public abstract class HabboItem implements Runnable, IEventTriggers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean invalidatesToRoomKick() { return false; }
|
public boolean invalidatesToRoomKick() { return false; }
|
||||||
|
|
||||||
|
public List<RoomTile> getOccupyingTiles(RoomLayout layout) {
|
||||||
|
List<RoomTile> tiles = new ArrayList<>();
|
||||||
|
|
||||||
|
Rectangle rect = RoomLayout.getRectangle(this.getX(), this.getY(), this.getBaseItem().getWidth(), this.getBaseItem().getLength(), this.getRotation());
|
||||||
|
|
||||||
|
for (int i = rect.x; i < rect.x + rect.getWidth(); i++) {
|
||||||
|
for (int j = rect.y; j < rect.y + rect.getHeight(); j++) {
|
||||||
|
tiles.add(layout.getTile((short) i, (short) j));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return tiles;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RoomTile getOverrideGoalTile(RoomUnit unit, Room room, RoomTile tile) {
|
||||||
|
return tile;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RoomTileState getOverrideTileState(RoomTile tile, Room room) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean canOverrideTile(RoomUnit unit, Room room, RoomTile tile) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -139,12 +139,11 @@ public class WiredHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (InteractionWiredCondition condition : conditions) {
|
for (InteractionWiredCondition condition : conditions) {
|
||||||
if ((condition.operator() == WiredConditionOperator.OR && matchedConditions.contains(condition.getType())) ||
|
if (!((condition.operator() == WiredConditionOperator.OR && matchedConditions.contains(condition.getType())) ||
|
||||||
(condition.operator() == WiredConditionOperator.AND && condition.execute(roomUnit, room, stuff))) {
|
(condition.operator() == WiredConditionOperator.AND && condition.execute(roomUnit, room, stuff))) &&
|
||||||
condition.activateBox(room);
|
!Emulator.getPluginManager().fireEvent(new WiredConditionFailedEvent(room, roomUnit, trigger, condition)).isCancelled()) {
|
||||||
} else {
|
|
||||||
if (!Emulator.getPluginManager().fireEvent(new WiredConditionFailedEvent(room, roomUnit, trigger, condition)).isCancelled())
|
return false;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -171,6 +171,20 @@ public class PacketManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final MessageHandler handler = handlerClass.newInstance();
|
||||||
|
|
||||||
|
if (handler.getRatelimit() > 0) {
|
||||||
|
if (client.messageTimestamps.containsKey(handlerClass) && System.currentTimeMillis() - client.messageTimestamps.get(handlerClass) < handler.getRatelimit()) {
|
||||||
|
if (PacketManager.DEBUG_SHOW_PACKETS) {
|
||||||
|
Emulator.getLogging().logPacketLine("[" + Logging.ANSI_CYAN + "CLIENT" + Logging.ANSI_RESET + "][" + packet.getMessageId() + "][" + Logging.ANSI_RED + "RATELIMITED" + Logging.ANSI_RESET + "] => " + packet.getMessageBody());
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
client.messageTimestamps.put(handlerClass, System.currentTimeMillis());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (PacketManager.DEBUG_SHOW_PACKETS)
|
if (PacketManager.DEBUG_SHOW_PACKETS)
|
||||||
Emulator.getLogging().logPacketLine("[" + Logging.ANSI_CYAN + "CLIENT" + Logging.ANSI_RESET + "][" + packet.getMessageId() + "] => " + packet.getMessageBody());
|
Emulator.getLogging().logPacketLine("[" + Logging.ANSI_CYAN + "CLIENT" + Logging.ANSI_RESET + "][" + packet.getMessageId() + "] => " + packet.getMessageBody());
|
||||||
|
|
||||||
@ -178,8 +192,6 @@ public class PacketManager {
|
|||||||
System.out.println(("[" + Logging.ANSI_CYAN + "CLIENT" + Logging.ANSI_RESET + "][" + client.getHabbo().getHabboInfo().getUsername() + "][" + packet.getMessageId() + "] => " + packet.getMessageBody()));
|
System.out.println(("[" + Logging.ANSI_CYAN + "CLIENT" + Logging.ANSI_RESET + "][" + client.getHabbo().getHabboInfo().getUsername() + "][" + packet.getMessageId() + "] => " + packet.getMessageBody()));
|
||||||
}
|
}
|
||||||
|
|
||||||
final MessageHandler handler = handlerClass.newInstance();
|
|
||||||
|
|
||||||
handler.client = client;
|
handler.client = client;
|
||||||
handler.packet = packet;
|
handler.packet = packet;
|
||||||
|
|
||||||
|
@ -9,4 +9,8 @@ public abstract class MessageHandler {
|
|||||||
public boolean isCancelled = false;
|
public boolean isCancelled = false;
|
||||||
|
|
||||||
public abstract void handle() throws Exception;
|
public abstract void handle() throws Exception;
|
||||||
|
|
||||||
|
public int getRatelimit() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
@ -58,6 +58,11 @@ public class FloorPlanEditorSaveEvent extends MessageHandler {
|
|||||||
|
|
||||||
if (mapRows.length > 64) errors.add("${notification.floorplan_editor.error.message.too_large_height}");
|
if (mapRows.length > 64) errors.add("${notification.floorplan_editor.error.message.too_large_height}");
|
||||||
else if (Arrays.stream(mapRows).anyMatch(l -> l.length() > 64 || l.length() == 0)) errors.add("${notification.floorplan_editor.error.message.too_large_width}");
|
else if (Arrays.stream(mapRows).anyMatch(l -> l.length() > 64 || l.length() == 0)) errors.add("${notification.floorplan_editor.error.message.too_large_width}");
|
||||||
|
|
||||||
|
if (errors.length() > 0) {
|
||||||
|
this.client.sendResponse(new BubbleAlertComposer(BubbleAlertKeys.FLOORPLAN_EDITOR_ERROR.key, errors.toString()));
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int doorX = this.packet.readInt();
|
int doorX = this.packet.readInt();
|
||||||
|
@ -14,6 +14,7 @@ import java.util.List;
|
|||||||
|
|
||||||
public class MoodLightSaveSettingsEvent extends MessageHandler {
|
public class MoodLightSaveSettingsEvent extends MessageHandler {
|
||||||
public static List<String> MOODLIGHT_AVAILABLE_COLORS = Arrays.asList("#74F5F5,#0053F7,#E759DE,#EA4532,#F2F851,#82F349,#000000".split(","));
|
public static List<String> MOODLIGHT_AVAILABLE_COLORS = Arrays.asList("#74F5F5,#0053F7,#E759DE,#EA4532,#F2F851,#82F349,#000000".split(","));
|
||||||
|
public static int MIN_BRIGHTNESS = (int) Math.floor(0.3 * 0xFF);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handle() throws Exception {
|
public void handle() throws Exception {
|
||||||
@ -33,7 +34,7 @@ public class MoodLightSaveSettingsEvent extends MessageHandler {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (brightness > 0xFF || brightness <= (0.3 * 0xFF)) {
|
if (brightness > 0xFF || brightness < MIN_BRIGHTNESS) {
|
||||||
ScripterManager.scripterDetected(this.client, "User tried to set a moodlight's brightness to out-of-bounds ([76, 255]): " + brightness);
|
ScripterManager.scripterDetected(this.client, "User tried to set a moodlight's brightness to out-of-bounds ([76, 255]): " + brightness);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package com.eu.habbo.messages.incoming.rooms.items;
|
|||||||
|
|
||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
import com.eu.habbo.habbohotel.items.interactions.InteractionDice;
|
import com.eu.habbo.habbohotel.items.interactions.InteractionDice;
|
||||||
import com.eu.habbo.habbohotel.items.interactions.InteractionMonsterPlantSeed;
|
import com.eu.habbo.habbohotel.items.interactions.pets.InteractionMonsterPlantSeed;
|
||||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWired;
|
import com.eu.habbo.habbohotel.items.interactions.InteractionWired;
|
||||||
import com.eu.habbo.habbohotel.pets.MonsterplantPet;
|
import com.eu.habbo.habbohotel.pets.MonsterplantPet;
|
||||||
import com.eu.habbo.habbohotel.rooms.Room;
|
import com.eu.habbo.habbohotel.rooms.Room;
|
||||||
@ -12,7 +12,6 @@ import com.eu.habbo.messages.outgoing.rooms.items.RemoveFloorItemComposer;
|
|||||||
import com.eu.habbo.messages.outgoing.rooms.pets.PetPackageComposer;
|
import com.eu.habbo.messages.outgoing.rooms.pets.PetPackageComposer;
|
||||||
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserStatusComposer;
|
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserStatusComposer;
|
||||||
import com.eu.habbo.threading.runnables.QueryDeleteHabboItem;
|
import com.eu.habbo.threading.runnables.QueryDeleteHabboItem;
|
||||||
import gnu.trove.set.hash.THashSet;
|
|
||||||
|
|
||||||
public class ToggleFloorItemEvent extends MessageHandler {
|
public class ToggleFloorItemEvent extends MessageHandler {
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,11 +1,15 @@
|
|||||||
package com.eu.habbo.messages.incoming.rooms.items.youtube;
|
package com.eu.habbo.messages.incoming.rooms.items.youtube;
|
||||||
|
|
||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
|
import com.eu.habbo.habbohotel.items.YoutubeManager;
|
||||||
import com.eu.habbo.habbohotel.items.interactions.InteractionYoutubeTV;
|
import com.eu.habbo.habbohotel.items.interactions.InteractionYoutubeTV;
|
||||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||||
import com.eu.habbo.messages.incoming.MessageHandler;
|
import com.eu.habbo.messages.incoming.MessageHandler;
|
||||||
|
import com.eu.habbo.messages.outgoing.handshake.ConnectionErrorComposer;
|
||||||
import com.eu.habbo.messages.outgoing.rooms.items.youtube.YoutubeDisplayListComposer;
|
import com.eu.habbo.messages.outgoing.rooms.items.youtube.YoutubeDisplayListComposer;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class YoutubeRequestPlaylists extends MessageHandler {
|
public class YoutubeRequestPlaylists extends MessageHandler {
|
||||||
@Override
|
@Override
|
||||||
public void handle() throws Exception {
|
public void handle() throws Exception {
|
||||||
@ -17,7 +21,15 @@ public class YoutubeRequestPlaylists extends MessageHandler {
|
|||||||
if (item instanceof InteractionYoutubeTV) {
|
if (item instanceof InteractionYoutubeTV) {
|
||||||
InteractionYoutubeTV tv = (InteractionYoutubeTV) item;
|
InteractionYoutubeTV tv = (InteractionYoutubeTV) item;
|
||||||
|
|
||||||
this.client.sendResponse(new YoutubeDisplayListComposer(itemId, Emulator.getGameEnvironment().getItemManager().getYoutubeManager().getPlaylistsForItemId(item.getBaseItem().getId()), tv.currentPlaylist));
|
ArrayList<YoutubeManager.YoutubePlaylist> playlists = Emulator.getGameEnvironment().getItemManager().getYoutubeManager().getPlaylistsForItemId(item.getBaseItem().getId());
|
||||||
|
|
||||||
|
if (playlists == null) {
|
||||||
|
Emulator.getLogging().logErrorLine("No YouTube playlists set for base item #" + item.getBaseItem().getId());
|
||||||
|
this.client.sendResponse(new ConnectionErrorComposer(1000));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.client.sendResponse(new YoutubeDisplayListComposer(itemId, playlists, tv.currentPlaylist));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.eu.habbo.messages.incoming.rooms.pets;
|
package com.eu.habbo.messages.incoming.rooms.pets;
|
||||||
|
|
||||||
import com.eu.habbo.habbohotel.items.interactions.InteractionPetBreedingNest;
|
import com.eu.habbo.habbohotel.items.interactions.pets.InteractionPetBreedingNest;
|
||||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||||
import com.eu.habbo.messages.incoming.MessageHandler;
|
import com.eu.habbo.messages.incoming.MessageHandler;
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.eu.habbo.messages.incoming.rooms.pets;
|
package com.eu.habbo.messages.incoming.rooms.pets;
|
||||||
|
|
||||||
import com.eu.habbo.habbohotel.items.interactions.InteractionPetBreedingNest;
|
import com.eu.habbo.habbohotel.items.interactions.pets.InteractionPetBreedingNest;
|
||||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||||
import com.eu.habbo.messages.incoming.MessageHandler;
|
import com.eu.habbo.messages.incoming.MessageHandler;
|
||||||
|
|
||||||
|
@ -11,8 +11,14 @@ import com.eu.habbo.habbohotel.users.HabboItem;
|
|||||||
import com.eu.habbo.messages.incoming.MessageHandler;
|
import com.eu.habbo.messages.incoming.MessageHandler;
|
||||||
import com.eu.habbo.messages.outgoing.rooms.users.RoomUnitOnRollerComposer;
|
import com.eu.habbo.messages.outgoing.rooms.users.RoomUnitOnRollerComposer;
|
||||||
import com.eu.habbo.plugin.events.users.UserIdleEvent;
|
import com.eu.habbo.plugin.events.users.UserIdleEvent;
|
||||||
|
import gnu.trove.set.hash.THashSet;
|
||||||
|
|
||||||
public class RoomUserWalkEvent extends MessageHandler {
|
public class RoomUserWalkEvent extends MessageHandler {
|
||||||
|
@Override
|
||||||
|
public int getRatelimit() {
|
||||||
|
return 500;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handle() throws Exception {
|
public void handle() throws Exception {
|
||||||
if (this.client.getHabbo().getHabboInfo().getCurrentRoom() != null) {
|
if (this.client.getHabbo().getHabboInfo().getCurrentRoom() != null) {
|
||||||
@ -115,6 +121,23 @@ public class RoomUserWalkEvent extends MessageHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
THashSet<HabboItem> items = room.getItemsAt(tile);
|
||||||
|
|
||||||
|
if (items.size() > 0) {
|
||||||
|
for (HabboItem item : items) {
|
||||||
|
RoomTile overriddenTile = item.getOverrideGoalTile(roomUnit, room, tile);
|
||||||
|
|
||||||
|
if (overriddenTile == null) {
|
||||||
|
return; // null cancels the entire event
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!overriddenTile.equals(tile) && overriddenTile.isWalkable()) {
|
||||||
|
tile = overriddenTile;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// This is where we set the end location and begin finding a path
|
// This is where we set the end location and begin finding a path
|
||||||
if (tile.isWalkable() || room.canSitOrLayAt(tile.x, tile.y)) {
|
if (tile.isWalkable() || room.canSitOrLayAt(tile.x, tile.y)) {
|
||||||
if (roomUnit.getMoveBlockingTask() != null) roomUnit.getMoveBlockingTask().get();
|
if (roomUnit.getMoveBlockingTask() != null) roomUnit.getMoveBlockingTask().get();
|
||||||
|
@ -46,7 +46,7 @@ public class UserProfileComposer extends MessageComposer {
|
|||||||
this.response.appendString(this.habboInfo.getUsername());
|
this.response.appendString(this.habboInfo.getUsername());
|
||||||
this.response.appendString(this.habboInfo.getLook());
|
this.response.appendString(this.habboInfo.getLook());
|
||||||
this.response.appendString(this.habboInfo.getMotto());
|
this.response.appendString(this.habboInfo.getMotto());
|
||||||
this.response.appendString(new SimpleDateFormat("dd-MM-yyyy HH:mm:ss").format(new Date(this.habboInfo.getAccountCreated() * 1000L)));
|
this.response.appendString(new SimpleDateFormat("dd-MM-yyyy").format(new Date(this.habboInfo.getAccountCreated() * 1000L)));
|
||||||
|
|
||||||
int achievementScore = 0;
|
int achievementScore = 0;
|
||||||
if (this.habbo != null) {
|
if (this.habbo != null) {
|
||||||
|
@ -8,13 +8,14 @@ import java.util.Collection;
|
|||||||
public class HabboAddedToRoomEvent extends UserEvent {
|
public class HabboAddedToRoomEvent extends UserEvent {
|
||||||
|
|
||||||
public final Room room;
|
public final Room room;
|
||||||
public final Collection<Habbo> habbosToSendEnter;
|
public Collection<Habbo> habbosToSendEnter;
|
||||||
|
public Collection<Habbo> visibleHabbos;
|
||||||
|
|
||||||
|
public HabboAddedToRoomEvent(Habbo habbo, Room room, Collection<Habbo> habbosToSendEnter, Collection<Habbo> visibleHabbos) {
|
||||||
public HabboAddedToRoomEvent(Habbo habbo, Room room, Collection<Habbo> habbosToSendEnter) {
|
|
||||||
super(habbo);
|
super(habbo);
|
||||||
|
|
||||||
this.room = room;
|
this.room = room;
|
||||||
this.habbosToSendEnter = habbosToSendEnter;
|
this.habbosToSendEnter = habbosToSendEnter;
|
||||||
|
this.visibleHabbos = visibleHabbos;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package com.eu.habbo.threading.runnables;
|
|||||||
|
|
||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
import com.eu.habbo.habbohotel.achievements.AchievementManager;
|
import com.eu.habbo.habbohotel.achievements.AchievementManager;
|
||||||
import com.eu.habbo.habbohotel.items.interactions.InteractionPetFood;
|
import com.eu.habbo.habbohotel.items.interactions.pets.InteractionPetFood;
|
||||||
import com.eu.habbo.habbohotel.pets.GnomePet;
|
import com.eu.habbo.habbohotel.pets.GnomePet;
|
||||||
import com.eu.habbo.habbohotel.pets.Pet;
|
import com.eu.habbo.habbohotel.pets.Pet;
|
||||||
import com.eu.habbo.habbohotel.pets.PetTasks;
|
import com.eu.habbo.habbohotel.pets.PetTasks;
|
||||||
|
@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.rooms.Room;
|
|||||||
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class RoomUnitWalkToLocation implements Runnable {
|
public class RoomUnitWalkToLocation implements Runnable {
|
||||||
@ -14,6 +15,18 @@ public class RoomUnitWalkToLocation implements Runnable {
|
|||||||
private List<Runnable> targetReached;
|
private List<Runnable> targetReached;
|
||||||
private List<Runnable> failedReached;
|
private List<Runnable> failedReached;
|
||||||
|
|
||||||
|
public RoomUnitWalkToLocation(RoomUnit walker, RoomTile goalTile, Room room, Runnable targetReached, Runnable failedReached) {
|
||||||
|
this.walker = walker;
|
||||||
|
this.goalTile = goalTile;
|
||||||
|
this.room = room;
|
||||||
|
|
||||||
|
this.targetReached = new ArrayList<>();
|
||||||
|
if (targetReached != null) this.targetReached.add(targetReached);
|
||||||
|
|
||||||
|
this.failedReached = new ArrayList<>();
|
||||||
|
if (failedReached != null) this.targetReached.add(failedReached);
|
||||||
|
}
|
||||||
|
|
||||||
public RoomUnitWalkToLocation(RoomUnit walker, RoomTile goalTile, Room room, List<Runnable> targetReached, List<Runnable> failedReached) {
|
public RoomUnitWalkToLocation(RoomUnit walker, RoomTile goalTile, Room room, List<Runnable> targetReached, List<Runnable> failedReached) {
|
||||||
this.walker = walker;
|
this.walker = walker;
|
||||||
this.goalTile = goalTile;
|
this.goalTile = goalTile;
|
||||||
|
Loading…
Reference in New Issue
Block a user