mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2025-01-18 15:36:27 +01:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
e6bb8157b2
3
sqlupdates/Update 3_5_3 to 3_5_4.sql
Normal file
3
sqlupdates/Update 3_5_3 to 3_5_4.sql
Normal file
@ -0,0 +1,3 @@
|
||||
--New bot walking settings
|
||||
INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('hotel.bot.limit.walking.distance', '1');
|
||||
INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('hotel.bot.limit.walking.distance.radius', '5');
|
@ -27,6 +27,8 @@ public class Bot implements Runnable {
|
||||
|
||||
public static final String NO_CHAT_SET = "${bot.skill.chatter.configuration.text.placeholder}";
|
||||
public static String[] PLACEMENT_MESSAGES = "Yo!;Hello I'm a real party animal!;Hello!".split(";");
|
||||
public static boolean BOT_LIMIT_WALKING_DISTANCE = true;
|
||||
public static int BOT_WALKING_DISTANCE_RADIUS = 5;
|
||||
|
||||
private final ArrayList<String> chatLines;
|
||||
private transient int id;
|
||||
@ -137,30 +139,26 @@ public class Bot implements Runnable {
|
||||
@Override
|
||||
public void run() {
|
||||
if (this.needsUpdate) {
|
||||
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("UPDATE bots SET name = ?, motto = ?, figure = ?, gender = ?, user_id = ?, room_id = ?, x = ?, y = ?, z = ?, rot = ?, dance = ?, freeroam = ?, chat_lines = ?, chat_auto = ?, chat_random = ?, chat_delay = ?, effect = ?, bubble_id = ? WHERE id = ?")) {
|
||||
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("UPDATE bots SET name = ?, motto = ?, figure = ?, gender = ?, user_id = ?, room_id = ?, dance = ?, freeroam = ?, chat_lines = ?, chat_auto = ?, chat_random = ?, chat_delay = ?, effect = ?, bubble_id = ? WHERE id = ?")) {
|
||||
statement.setString(1, this.name);
|
||||
statement.setString(2, this.motto);
|
||||
statement.setString(3, this.figure);
|
||||
statement.setString(4, this.gender.toString());
|
||||
statement.setInt(5, this.ownerId);
|
||||
statement.setInt(6, this.room == null ? 0 : this.room.getId());
|
||||
statement.setInt(7, this.roomUnit == null ? 0 : this.roomUnit.getX());
|
||||
statement.setInt(8, this.roomUnit == null ? 0 : this.roomUnit.getY());
|
||||
statement.setDouble(9, this.roomUnit == null ? 0 : this.roomUnit.getZ());
|
||||
statement.setInt(10, this.roomUnit == null ? 0 : this.roomUnit.getBodyRotation().getValue());
|
||||
statement.setInt(11, this.roomUnit == null ? 0 : this.roomUnit.getDanceType().getType());
|
||||
statement.setString(12, this.canWalk ? "1" : "0");
|
||||
statement.setInt(7, this.roomUnit == null ? 0 : this.roomUnit.getDanceType().getType());
|
||||
statement.setString(8, this.canWalk ? "1" : "0");
|
||||
StringBuilder text = new StringBuilder();
|
||||
for (String s : this.chatLines) {
|
||||
text.append(s).append("\r");
|
||||
}
|
||||
statement.setString(13, text.toString());
|
||||
statement.setString(14, this.chatAuto ? "1" : "0");
|
||||
statement.setString(15, this.chatRandom ? "1" : "0");
|
||||
statement.setInt(16, this.chatDelay);
|
||||
statement.setInt(17, this.effect);
|
||||
statement.setInt(18, this.bubble);
|
||||
statement.setInt(19, this.id);
|
||||
statement.setString(9, text.toString());
|
||||
statement.setString(10, this.chatAuto ? "1" : "0");
|
||||
statement.setString(11, this.chatRandom ? "1" : "0");
|
||||
statement.setInt(12, this.chatDelay);
|
||||
statement.setInt(13, this.effect);
|
||||
statement.setInt(14, this.bubble);
|
||||
statement.setInt(15, this.id);
|
||||
statement.execute();
|
||||
this.needsUpdate = false;
|
||||
} catch (SQLException e) {
|
||||
@ -174,7 +172,15 @@ public class Bot implements Runnable {
|
||||
if (allowBotsWalk && this.canWalk) {
|
||||
if (!this.roomUnit.isWalking()) {
|
||||
if (this.roomUnit.getWalkTimeOut() < Emulator.getIntUnixTimestamp() && this.followingHabboId == 0) {
|
||||
this.roomUnit.setGoalLocation(this.room.getRandomWalkableTile());
|
||||
this.roomUnit.setGoalLocation(
|
||||
Bot.BOT_LIMIT_WALKING_DISTANCE
|
||||
? this.room.getRandomWalkableTilesAround(
|
||||
this.getRoomUnit(),
|
||||
this.room.getLayout().getTile(this.roomUnit.getX(), this.roomUnit.getY()),
|
||||
Bot.BOT_WALKING_DISTANCE_RADIUS)
|
||||
: this.room.getRandomWalkableTile()
|
||||
);
|
||||
|
||||
int timeOut = Emulator.getRandom().nextInt(20) * 2;
|
||||
this.roomUnit.setWalkTimeOut((timeOut < 10 ? 5 : timeOut) + Emulator.getIntUnixTimestamp());
|
||||
}
|
||||
@ -497,4 +503,36 @@ public class Bot implements Runnable {
|
||||
this.roomUnit.statusUpdate(true);
|
||||
}
|
||||
|
||||
public void onPlaceUpdate() {
|
||||
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("UPDATE bots SET name = ?, motto = ?, figure = ?, gender = ?, user_id = ?, room_id = ?, x = ?, y = ?, z = ?, rot = ?, dance = ?, freeroam = ?, chat_lines = ?, chat_auto = ?, chat_random = ?, chat_delay = ?, effect = ?, bubble_id = ? WHERE id = ?")) {
|
||||
statement.setString(1, this.name);
|
||||
statement.setString(2, this.motto);
|
||||
statement.setString(3, this.figure);
|
||||
statement.setString(4, this.gender.toString());
|
||||
statement.setInt(5, this.ownerId);
|
||||
statement.setInt(6, this.room == null ? 0 : this.room.getId());
|
||||
statement.setInt(7, this.roomUnit == null ? 0 : this.roomUnit.getX());
|
||||
statement.setInt(8, this.roomUnit == null ? 0 : this.roomUnit.getY());
|
||||
statement.setDouble(9, this.roomUnit == null ? 0 : this.roomUnit.getZ());
|
||||
statement.setInt(10, this.roomUnit == null ? 0 : this.roomUnit.getBodyRotation().getValue());
|
||||
statement.setInt(11, this.roomUnit == null ? 0 : this.roomUnit.getDanceType().getType());
|
||||
statement.setString(12, this.canWalk ? "1" : "0");
|
||||
StringBuilder text = new StringBuilder();
|
||||
for (String s : this.chatLines) {
|
||||
text.append(s).append("\r");
|
||||
}
|
||||
statement.setString(13, text.toString());
|
||||
statement.setString(14, this.chatAuto ? "1" : "0");
|
||||
statement.setString(15, this.chatRandom ? "1" : "0");
|
||||
statement.setInt(16, this.chatDelay);
|
||||
statement.setInt(17, this.effect);
|
||||
statement.setInt(18, this.bubble);
|
||||
statement.setInt(19, this.id);
|
||||
statement.execute();
|
||||
} catch (SQLException e) {
|
||||
LOGGER.error("Caught SQL exception", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ public class BotManager {
|
||||
roomUnit.setRotation(RoomUserRotation.SOUTH);
|
||||
roomUnit.setLocation(location);
|
||||
|
||||
double stackHeight = location.getStackHeight();
|
||||
double stackHeight = room.getTopHeightAt(location.x, location.y);
|
||||
roomUnit.setPreviousLocationZ(stackHeight);
|
||||
roomUnit.setZ(stackHeight);
|
||||
|
||||
@ -136,7 +136,7 @@ public class BotManager {
|
||||
roomUnit.setCanWalk(room.isAllowBotsWalk());
|
||||
bot.setRoomUnit(roomUnit);
|
||||
bot.setRoom(room);
|
||||
bot.needsUpdate(true);
|
||||
bot.onPlaceUpdate();
|
||||
room.addBot(bot);
|
||||
Emulator.getThreading().run(bot);
|
||||
room.sendComposer(new RoomUsersComposer(bot).compose());
|
||||
|
@ -168,6 +168,7 @@ public class ItemManager {
|
||||
this.interactionsList.add(new ItemInteraction("youtube", InteractionYoutubeTV.class));
|
||||
this.interactionsList.add(new ItemInteraction("jukebox", InteractionJukeBox.class));
|
||||
this.interactionsList.add(new ItemInteraction("switch", InteractionSwitch.class));
|
||||
this.interactionsList.add(new ItemInteraction("switch_remote_control", InteractionSwitchRemoteControl.class));
|
||||
this.interactionsList.add(new ItemInteraction("fx_box", InteractionFXBox.class));
|
||||
this.interactionsList.add(new ItemInteraction("blackhole", InteractionBlackHole.class));
|
||||
this.interactionsList.add(new ItemInteraction("effect_toggle", InteractionEffectToggle.class));
|
||||
|
@ -85,15 +85,16 @@ public class InteractionPressurePlate extends InteractionDefault {
|
||||
if (tiles == null) return;
|
||||
|
||||
for (RoomTile tile : tiles) {
|
||||
boolean hasHabbos = room.hasHabbosAt(tile.x, tile.y);
|
||||
if (!hasHabbos && this.requiresAllTilesOccupied()) {
|
||||
THashSet<RoomUnit> tileHasHabboOrBot = room.getHabbosAndBotsAt(tile.x, tile.y);
|
||||
if (tileHasHabboOrBot.isEmpty() && this.requiresAllTilesOccupied()) {
|
||||
occupied = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (hasHabbos) {
|
||||
if (!tileHasHabboOrBot.isEmpty()) {
|
||||
occupied = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
this.setExtradata(occupied ? "1" : "0");
|
||||
|
@ -0,0 +1,53 @@
|
||||
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.rooms.Room;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class InteractionSwitchRemoteControl extends InteractionDefault {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(InteractionSwitchRemoteControl.class);
|
||||
|
||||
public InteractionSwitchRemoteControl(ResultSet set, Item baseItem) throws SQLException {
|
||||
super(set, baseItem);
|
||||
}
|
||||
|
||||
public InteractionSwitchRemoteControl(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) {
|
||||
super(id, userId, item, extradata, limitedStack, limitedSells);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isUsable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(GameClient client, Room room, Object[] objects) throws Exception {
|
||||
if (room != null) {
|
||||
super.onClick(client, room, objects);
|
||||
|
||||
if (this.getExtradata().isEmpty())
|
||||
this.setExtradata("0");
|
||||
|
||||
if (this.getBaseItem().getStateCount() > 0) {
|
||||
int currentState = 0;
|
||||
|
||||
try {
|
||||
currentState = Integer.parseInt(this.getExtradata());
|
||||
} catch (NumberFormatException e) {
|
||||
LOGGER.error("Incorrect extradata ({}) for item ID ({}) of type ({})", this.getExtradata(), this.getId(), this.getBaseItem().getName());
|
||||
}
|
||||
|
||||
this.setExtradata("" + (currentState + 1) % this.getBaseItem().getStateCount());
|
||||
this.needsUpdate(true);
|
||||
|
||||
room.updateItemState(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1224,7 +1224,8 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
foundRightHolder[0] = habbo.getRoomUnit().getRightsLevel() != RoomRightLevels.NONE;
|
||||
}
|
||||
|
||||
if (habbo.getRoomUnit().getHandItem() > 0 && millis - habbo.getRoomUnit().getHandItemTimestamp() > (Room.HAND_ITEM_TIME * 1000)) {
|
||||
// The handitem is no longer automatically removed from a user. We can set `Room.HAND_ITEM_TIME` to `0` as a configuration option to prevent it from being removed. (verified on Oct 15, 2024)
|
||||
if (Room.HAND_ITEM_TIME > 0 && habbo.getRoomUnit().getHandItem() > 0 && millis - habbo.getRoomUnit().getHandItemTimestamp() > (Room.HAND_ITEM_TIME * 1000L)) {
|
||||
this.giveHandItem(habbo, 0);
|
||||
}
|
||||
|
||||
@ -1269,7 +1270,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
if (Emulator.getConfig().getBoolean("hotel.rooms.deco_hosting")) {
|
||||
//Check if the user isn't the owner id
|
||||
if (this.ownerId != habbo.getHabboInfo().getId()) {
|
||||
//Check if the time already have 1 minute (120 / 2 = 60s)
|
||||
//Check if the time already have 1 minute (120 / 2 = 60s)
|
||||
if (habbo.getRoomUnit().getTimeInRoom() >= 120) {
|
||||
AchievementManager.progressAchievement(this.ownerId, Emulator.getGameEnvironment().getAchievementManager().getAchievement("RoomDecoHosting"));
|
||||
habbo.getRoomUnit().resetTimeInRoom();
|
||||
@ -1498,11 +1499,10 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
if (unit.hasStatus(RoomUnitStatus.MOVE))
|
||||
continue;
|
||||
|
||||
RoomTile tile = tileInFront.copy();
|
||||
tile.setStackHeight(unit.getZ() + zOffset);
|
||||
double newZ = unit.getZ() + zOffset;
|
||||
|
||||
if (roomUserRolledEvent != null && unit.getRoomUnitType() == RoomUnitType.USER) {
|
||||
roomUserRolledEvent = new UserRolledEvent(getHabbo(unit), roller, tile);
|
||||
roomUserRolledEvent = new UserRolledEvent(getHabbo(unit), roller, tileInFront);
|
||||
Emulator.getPluginManager().fireEvent(roomUserRolledEvent);
|
||||
|
||||
if (roomUserRolledEvent.isCancelled())
|
||||
@ -1517,10 +1517,10 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
RideablePet riding = rollingHabbo.getHabboInfo().getRiding();
|
||||
if (riding != null) {
|
||||
RoomUnit ridingUnit = riding.getRoomUnit();
|
||||
tile.setStackHeight(ridingUnit.getZ() + zOffset);
|
||||
newZ = ridingUnit.getZ() + zOffset;
|
||||
rolledUnitIds.add(ridingUnit.getId());
|
||||
updatedUnit.remove(ridingUnit);
|
||||
messages.add(new RoomUnitOnRollerComposer(ridingUnit, roller, ridingUnit.getCurrentLocation(), ridingUnit.getZ(), tile, tile.getStackHeight(), room));
|
||||
messages.add(new RoomUnitOnRollerComposer(ridingUnit, roller, ridingUnit.getCurrentLocation(), ridingUnit.getZ(), tileInFront, newZ, room));
|
||||
isRiding = true;
|
||||
}
|
||||
}
|
||||
@ -1529,7 +1529,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
usersRolledThisTile.add(unit.getId());
|
||||
rolledUnitIds.add(unit.getId());
|
||||
updatedUnit.remove(unit);
|
||||
messages.add(new RoomUnitOnRollerComposer(unit, roller, unit.getCurrentLocation(), unit.getZ() + (isRiding ? 1 : 0), tile, tile.getStackHeight() + (isRiding ? 1 : 0), room));
|
||||
messages.add(new RoomUnitOnRollerComposer(unit, roller, unit.getCurrentLocation(), unit.getZ() + (isRiding ? 1 : 0), tileInFront, newZ + (isRiding ? 1 : 0), room));
|
||||
|
||||
if (itemsOnRoller.isEmpty()) {
|
||||
HabboItem item = room.getTopItemAt(tileInFront.x, tileInFront.y);
|
||||
@ -2091,7 +2091,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
|
||||
for (Pet pet : toRemovePets) {
|
||||
removedPets.add(pet);
|
||||
|
||||
|
||||
pet.removeFromRoom();
|
||||
|
||||
Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(pet.getUserId());
|
||||
@ -3635,7 +3635,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
HabboItem item = this.getTopItemAt(x, y);
|
||||
|
||||
if (item != null)
|
||||
return (item.getZ() + Item.getCurrentHeight(item));
|
||||
return (item.getZ() + Item.getCurrentHeight(item) - (item.getBaseItem().allowSit() ? 1 : 0));
|
||||
else
|
||||
return this.layout.getHeightAtSquare(x, y);
|
||||
}
|
||||
@ -3697,7 +3697,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
|
||||
if (x < 0 || y < 0 || this.layout == null)
|
||||
return calculateHeightmap ? Short.MAX_VALUE : 0.0;
|
||||
|
||||
|
||||
if (Emulator.getPluginManager().isRegistered(FurnitureStackHeightEvent.class, true)) {
|
||||
FurnitureStackHeightEvent event = Emulator.getPluginManager().fireEvent(new FurnitureStackHeightEvent(x, y, this));
|
||||
if(event.hasPluginHelper()) {
|
||||
@ -3849,6 +3849,37 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
return null;
|
||||
}
|
||||
|
||||
public RoomTile getRandomWalkableTilesAround(RoomUnit roomUnit, RoomTile tile, int radius) {
|
||||
if (!layout.tileExists(tile.x, tile.y)) {
|
||||
tile = layout.getTile(roomUnit.getX(), roomUnit.getY());
|
||||
this.getBot(roomUnit).needsUpdate(true);
|
||||
}
|
||||
|
||||
List<RoomTile> walkableTiles = new ArrayList<>();
|
||||
|
||||
int minX = Math.max(0, tile.x - radius);
|
||||
int minY = Math.max(0, tile.y - radius);
|
||||
int maxX = Math.min(this.getLayout().getMapSizeX() - 1, tile.x + radius);
|
||||
int maxY = Math.min(this.getLayout().getMapSizeY() - 1, tile.y + radius);
|
||||
|
||||
for (int x = minX; x <= maxX; x++) {
|
||||
for (int y = minY; y <= maxY; y++) {
|
||||
RoomTile candidateTile = this.getLayout().getTile((short) x, (short) y);
|
||||
|
||||
if (candidateTile != null && candidateTile.getState() != RoomTileState.BLOCKED && candidateTile.getState() != RoomTileState.INVALID) {
|
||||
walkableTiles.add(candidateTile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (walkableTiles.isEmpty()) {
|
||||
return tile;
|
||||
}
|
||||
|
||||
Collections.shuffle(walkableTiles);
|
||||
return walkableTiles.get(0);
|
||||
}
|
||||
|
||||
public Habbo getHabbo(String username) {
|
||||
for (Habbo habbo : this.getHabbos()) {
|
||||
if (habbo.getHabboInfo().getUsername().equalsIgnoreCase(username))
|
||||
@ -3907,6 +3938,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
}
|
||||
|
||||
for (Habbo habbo : this.getHabbos()) {
|
||||
if (habbo == null) { continue; }
|
||||
if (!habbo.getHabboStats().ignoreBots)
|
||||
habbo.getClient().sendResponse(message);
|
||||
}
|
||||
@ -4022,7 +4054,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
return;
|
||||
|
||||
this.sendComposer(new RoomRemoveRightsListComposer(this, userId).compose());
|
||||
|
||||
|
||||
if (this.rights.remove(userId)) {
|
||||
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("DELETE FROM room_rights WHERE room_id = ? AND user_id = ?")) {
|
||||
statement.setInt(1, this.id);
|
||||
@ -4533,7 +4565,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
if (tile == null || tile.state == RoomTileState.INVALID) {
|
||||
return FurnitureMovementError.INVALID_MOVE;
|
||||
}
|
||||
|
||||
|
||||
rotation %= 8;
|
||||
if (this.hasRights(habbo) || this.getGuildRightLevel(habbo).isEqualOrGreaterThan(RoomRightLevels.GUILD_RIGHTS) || habbo.hasPermission(Permission.ACC_MOVEROTATE)) {
|
||||
return FurnitureMovementError.NONE;
|
||||
@ -4553,7 +4585,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
|
||||
for (HabboItem area : this.getRoomSpecialTypes().getItemsOfType(InteractionBuildArea.class)) {
|
||||
if (((InteractionBuildArea) area).inSquare(tile) && ((InteractionBuildArea) area).isBuilder(habbo.getHabboInfo().getUsername())) {
|
||||
return FurnitureMovementError.NONE;
|
||||
return FurnitureMovementError.NONE;
|
||||
}
|
||||
}
|
||||
|
||||
@ -4945,4 +4977,4 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
THashSet<RoomUnit> roomUnits = getRoomUnits();
|
||||
return roomUnits.stream().filter(unit -> unit.getCurrentLocation() == tile).collect(Collectors.toSet());
|
||||
}
|
||||
}
|
||||
}
|
@ -617,7 +617,7 @@ public class RoomLayout {
|
||||
for (short j = tile.y; j <= (tile.y + (length - 1)); j++) {
|
||||
RoomTile t = this.getTile(i, j);
|
||||
|
||||
if (t == null || t.state == RoomTileState.INVALID) {
|
||||
if (t == null || t.getState() == RoomTileState.INVALID) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -627,11 +627,16 @@ public class RoomLayout {
|
||||
for (short j = tile.y; j <= (tile.y + (width - 1)); j++) {
|
||||
RoomTile t = this.getTile(i, j);
|
||||
|
||||
if (t == null || t.state == RoomTileState.INVALID) {
|
||||
if (t == null || t.getState() == RoomTileState.INVALID) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (rotation == 1 || rotation == 3 || rotation == 5 || rotation == 7) {
|
||||
RoomTile t = this.getTile(tile.x, tile.y);
|
||||
if (t == null || t.getState() == RoomTileState.INVALID) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -662,9 +667,14 @@ public class RoomLayout {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (rotation == 1 || rotation == 3 || rotation == 5 || rotation == 7) {
|
||||
RoomTile t = this.getTile(tile.x, tile.y);
|
||||
if (t != null) {
|
||||
pointList.add(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return pointList;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ public class CatalogBuyItemAsGiftEvent extends MessageHandler {
|
||||
int itemId = this.packet.readInt();
|
||||
String extraData = this.packet.readString();
|
||||
String username = this.packet.readString();
|
||||
String message = this.packet.readString();
|
||||
String message = Emulator.getGameEnvironment().getWordFilter().filter(this.packet.readString(), this.client.getHabbo());
|
||||
int spriteId = this.packet.readInt();
|
||||
int color = this.packet.readInt();
|
||||
int ribbonId = this.packet.readInt();
|
||||
|
@ -130,10 +130,6 @@ public class CatalogBuyItemEvent extends MessageHandler {
|
||||
}
|
||||
});
|
||||
|
||||
if (badgeFound[0]) {
|
||||
this.client.getHabbo().getClient().sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.ALREADY_HAVE_BADGE));
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -21,8 +21,8 @@ public class RequestGuildBuyEvent extends MessageHandler {
|
||||
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
String name = this.packet.readString();
|
||||
String description = this.packet.readString();
|
||||
String name = Emulator.getGameEnvironment().getWordFilter().filter(this.packet.readString(), this.client.getHabbo());
|
||||
String description = Emulator.getGameEnvironment().getWordFilter().filter(this.packet.readString(), this.client.getHabbo());
|
||||
|
||||
if(name.length() > 29 || description.length() > 254)
|
||||
return;
|
||||
|
@ -24,8 +24,8 @@ public class GuildForumPostThreadEvent extends MessageHandler {
|
||||
public void handle() throws Exception {
|
||||
int guildId = this.packet.readInt();
|
||||
int threadId = this.packet.readInt();
|
||||
String subject = this.packet.readString();
|
||||
String message = this.packet.readString();
|
||||
String subject = Emulator.getGameEnvironment().getWordFilter().filter(this.packet.readString(), this.client.getHabbo());
|
||||
String message = Emulator.getGameEnvironment().getWordFilter().filter(this.packet.readString(), this.client.getHabbo());
|
||||
|
||||
Guild guild = Emulator.getGameEnvironment().getGuildManager().getGuild(guildId);
|
||||
|
||||
|
@ -10,6 +10,9 @@ import com.eu.habbo.messages.outgoing.rooms.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class RoomSettingsSaveEvent extends MessageHandler {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(RoomSettingsSaveEvent.class);
|
||||
|
||||
@ -55,6 +58,7 @@ public class RoomSettingsSaveEvent extends MessageHandler {
|
||||
int usersMax = this.packet.readInt();
|
||||
int categoryId = this.packet.readInt();
|
||||
StringBuilder tags = new StringBuilder();
|
||||
Set<String> uniqueTags = new HashSet<>();
|
||||
int count = Math.min(this.packet.readInt(), 2);
|
||||
for (int i = 0; i < count; i++) {
|
||||
String tag = this.packet.readString();
|
||||
@ -63,7 +67,10 @@ public class RoomSettingsSaveEvent extends MessageHandler {
|
||||
this.client.sendResponse(new RoomEditSettingsErrorComposer(room.getId(), RoomEditSettingsErrorComposer.TAGS_TOO_LONG, ""));
|
||||
return;
|
||||
}
|
||||
tags.append(tag).append(";");
|
||||
if(!uniqueTags.contains(tag)) {
|
||||
uniqueTags.add(tag);
|
||||
tags.append(tag).append(";");
|
||||
}
|
||||
}
|
||||
|
||||
if (!Emulator.getGameEnvironment().getWordFilter().filter(tags.toString(), this.client.getHabbo()).equals(tags.toString())) {
|
||||
|
@ -18,7 +18,7 @@ public class PostItSaveDataEvent extends MessageHandler {
|
||||
public void handle() throws Exception {
|
||||
int itemId = this.packet.readInt();
|
||||
String color = this.packet.readString();
|
||||
String text = this.packet.readString().replace(((char) 9) + "", "");
|
||||
String text = Emulator.getGameEnvironment().getWordFilter().filter(this.packet.readString().replace(((char) 9) + "", ""), this.client.getHabbo());
|
||||
|
||||
if (text.length() > Emulator.getConfig().getInt("postit.charlimit")) {
|
||||
ScripterManager.scripterDetected(this.client, Emulator.getTexts().getValue("scripter.warning.sticky.size").replace("%username%", this.client.getHabbo().getHabboInfo().getUsername()).replace("%amount%", text.length() + "").replace("%limit%", Emulator.getConfig().getInt("postit.charlimit") + ""));
|
||||
@ -51,7 +51,8 @@ public class PostItSaveDataEvent extends MessageHandler {
|
||||
if (color.isEmpty())
|
||||
color = PostItColor.YELLOW.hexColor;
|
||||
|
||||
item.setUserId(room.getOwnerId());
|
||||
// Removed on Oct 15th, 2024: The owner of this item should not be altered when editing the text of a post-it. The original owner must always remain unchanged.
|
||||
// item.setUserId(room.getOwnerId());
|
||||
item.setExtradata(color + " " + text);
|
||||
item.needsUpdate(true);
|
||||
room.updateItem(item);
|
||||
|
@ -3,7 +3,14 @@ package com.eu.habbo.messages.incoming.rooms.pets;
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.pets.MonsterplantPet;
|
||||
import com.eu.habbo.habbohotel.pets.Pet;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
import com.eu.habbo.messages.incoming.MessageHandler;
|
||||
import com.eu.habbo.threading.runnables.RoomUnitWalkToLocation;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ScratchPetEvent extends MessageHandler {
|
||||
|
||||
@ -11,21 +18,34 @@ public class ScratchPetEvent extends MessageHandler {
|
||||
public void handle() throws Exception {
|
||||
final int petId = this.packet.readInt();
|
||||
|
||||
if (this.client.getHabbo().getHabboInfo().getCurrentRoom() == null) {
|
||||
final Habbo habbo = this.client.getHabbo();
|
||||
if (habbo == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
final Pet pet = this.client.getHabbo().getHabboInfo().getCurrentRoom().getPet(petId);
|
||||
final Room room = habbo.getHabboInfo().getCurrentRoom();
|
||||
if (room == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
final Pet pet = room.getPet(petId);
|
||||
if (pet == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.client.getHabbo().getHabboStats().petRespectPointsToGive > 0 || pet instanceof MonsterplantPet) {
|
||||
pet.scratched(this.client.getHabbo());
|
||||
if (habbo.getHabboStats().petRespectPointsToGive > 0 || pet instanceof MonsterplantPet) {
|
||||
|
||||
// Update the stats to the database.
|
||||
Emulator.getThreading().run(pet);
|
||||
List<Runnable> tasks = new ArrayList<>();
|
||||
tasks.add(() -> {
|
||||
pet.scratched(habbo);
|
||||
Emulator.getThreading().run(pet);
|
||||
});
|
||||
|
||||
RoomTile closestTile = habbo.getRoomUnit().getClosestAdjacentTile(pet.getRoomUnit().getX(), pet.getRoomUnit().getY(), true);
|
||||
if (closestTile != null) {
|
||||
habbo.getRoomUnit().setGoalLocation(closestTile);
|
||||
Emulator.getThreading().run(new RoomUnitWalkToLocation(habbo.getRoomUnit(), closestTile, room, tasks, tasks));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,10 @@ public class RoomUserGiveRespectEvent extends MessageHandler {
|
||||
public void handle() throws Exception {
|
||||
int userId = this.packet.readInt();
|
||||
|
||||
if (userId == client.getHabbo().getHabboInfo().getId()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.client.getHabbo().getHabboStats().respectPointsToGive > 0) {
|
||||
Habbo target = this.client.getHabbo().getHabboInfo().getCurrentRoom().getHabbo(userId);
|
||||
|
||||
|
@ -9,7 +9,7 @@ import com.eu.habbo.plugin.events.users.UserSavedMottoEvent;
|
||||
public class SaveMottoEvent extends MessageHandler {
|
||||
@Override
|
||||
public void handle() throws Exception {
|
||||
String motto = this.packet.readString();
|
||||
String motto = Emulator.getGameEnvironment().getWordFilter().filter(this.packet.readString(), this.client.getHabbo());
|
||||
UserSavedMottoEvent event = new UserSavedMottoEvent(this.client.getHabbo(), this.client.getHabbo().getHabboInfo().getMotto(), motto);
|
||||
Emulator.getPluginManager().fireEvent(event);
|
||||
motto = event.newMotto;
|
||||
|
@ -1,7 +1,6 @@
|
||||
package com.eu.habbo.messages.outgoing.rooms.items;
|
||||
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionGift;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionMusicDisc;
|
||||
import com.eu.habbo.habbohotel.items.interactions.*;
|
||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||
import com.eu.habbo.messages.ServerMessage;
|
||||
import com.eu.habbo.messages.outgoing.MessageComposer;
|
||||
@ -23,7 +22,7 @@ public class AddFloorItemComposer extends MessageComposer {
|
||||
this.response.appendInt(this.item instanceof InteractionGift ? ((((InteractionGift) this.item).getColorId() * 1000) + ((InteractionGift) this.item).getRibbonId()) : (this.item instanceof InteractionMusicDisc ? ((InteractionMusicDisc) this.item).getSongId() : 1));
|
||||
this.item.serializeExtradata(this.response);
|
||||
this.response.appendInt(-1);
|
||||
this.response.appendInt(this.item.isUsable());
|
||||
this.response.appendInt(this.item instanceof InteractionTeleport || this.item instanceof InteractionSwitch || this.item instanceof InteractionSwitchRemoteControl || this.item instanceof InteractionVendingMachine || this.item instanceof InteractionInformationTerminal || this.item instanceof InteractionPostIt|| this.item instanceof InteractionPuzzleBox ? 2 : this.item.isUsable() ? 1 : 0);
|
||||
this.response.appendInt(this.item.getUserId());
|
||||
this.response.appendString(this.itemOwnerName);
|
||||
return this.response;
|
||||
|
@ -1,7 +1,6 @@
|
||||
package com.eu.habbo.messages.outgoing.rooms.items;
|
||||
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionGift;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionMusicDisc;
|
||||
import com.eu.habbo.habbohotel.items.interactions.*;
|
||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||
import com.eu.habbo.messages.ServerMessage;
|
||||
import com.eu.habbo.messages.outgoing.MessageComposer;
|
||||
@ -45,7 +44,7 @@ public class RoomFloorItemsComposer extends MessageComposer {
|
||||
this.response.appendInt(item instanceof InteractionGift ? ((((InteractionGift) item).getColorId() * 1000) + ((InteractionGift) item).getRibbonId()) : (item instanceof InteractionMusicDisc ? ((InteractionMusicDisc) item).getSongId() : 1));
|
||||
item.serializeExtradata(this.response);
|
||||
this.response.appendInt(-1);
|
||||
this.response.appendInt(item.isUsable() ? 1 : 0);
|
||||
this.response.appendInt(item instanceof InteractionTeleport || item instanceof InteractionSwitch || item instanceof InteractionSwitchRemoteControl || item instanceof InteractionVendingMachine || item instanceof InteractionInformationTerminal || item instanceof InteractionPostIt || item instanceof InteractionPuzzleBox ? 2 : item.isUsable() ? 1 : 0);
|
||||
this.response.appendInt(item.getUserId());
|
||||
}
|
||||
return this.response;
|
||||
|
@ -25,7 +25,6 @@ import com.eu.habbo.habbohotel.users.clothingvalidation.ClothingValidationManage
|
||||
import com.eu.habbo.habbohotel.users.HabboInventory;
|
||||
import com.eu.habbo.habbohotel.users.HabboManager;
|
||||
import com.eu.habbo.habbohotel.users.subscriptions.SubscriptionHabboClub;
|
||||
import com.eu.habbo.habbohotel.users.subscriptions.SubscriptionManager;
|
||||
import com.eu.habbo.habbohotel.wired.WiredHandler;
|
||||
import com.eu.habbo.habbohotel.wired.highscores.WiredHighscoreManager;
|
||||
import com.eu.habbo.messages.PacketManager;
|
||||
@ -100,6 +99,8 @@ public class PluginManager {
|
||||
BotManager.MAXIMUM_NAME_LENGTH = Emulator.getConfig().getInt("hotel.bot.max.namelength");
|
||||
BotManager.MAXIMUM_CHAT_SPEED = Emulator.getConfig().getInt("hotel.bot.max.chatdelay");
|
||||
Bot.PLACEMENT_MESSAGES = Emulator.getConfig().getValue("hotel.bot.placement.messages", "Yo!;Hello I'm a real party animal!;Hello!").split(";");
|
||||
Bot.BOT_LIMIT_WALKING_DISTANCE = Emulator.getConfig().getBoolean("hotel.bot.limit.walking.distance", true);
|
||||
Bot.BOT_WALKING_DISTANCE_RADIUS = Emulator.getConfig().getInt("hotel.bot.limit.walking.distance.radius", 5);
|
||||
|
||||
HabboInventory.MAXIMUM_ITEMS = Emulator.getConfig().getInt("hotel.inventory.max.items");
|
||||
Messenger.MAXIMUM_FRIENDS = Emulator.getConfig().getInt("hotel.users.max.friends", 300);
|
||||
|
@ -34,9 +34,14 @@ public class RoomUnitTeleport implements Runnable {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (roomUnit == null || roomUnit.getRoom() == null || room.getLayout() == null || roomUnit.isLeavingTeleporter)
|
||||
if (roomUnit == null || roomUnit.getRoom() == null || room.getLayout() == null)
|
||||
return;
|
||||
|
||||
if (roomUnit.isLeavingTeleporter) {
|
||||
roomUnit.isWiredTeleporting = false;
|
||||
return;
|
||||
}
|
||||
|
||||
RoomTile lastLocation = this.roomUnit.getCurrentLocation();
|
||||
RoomTile newLocation = this.room.getLayout().getTile((short) this.x, (short) this.y);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user