Merge branch 'dev' into 'dev'

multiple fixes

See merge request morningstar/Arcturus-Community!293
This commit is contained in:
Harmonic 2020-09-19 13:15:52 -04:00
commit 17af91536b
26 changed files with 109 additions and 61 deletions

View File

@ -7,9 +7,14 @@ import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.habbohotel.wired.WiredHandler;
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.incoming.rooms.users.RoomUserWalkEvent;
import com.eu.habbo.messages.outgoing.rooms.items.ItemIntStateComposer;
import com.eu.habbo.threading.runnables.RoomUnitWalkToLocation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.ResultSet;
import java.sql.SQLException;
@ -17,6 +22,8 @@ import java.util.ArrayList;
import java.util.List;
public class InteractionOneWayGate extends HabboItem {
private static final Logger LOGGER = LoggerFactory.getLogger(InteractionOneWayGate.class);
private boolean walkable = false;
public InteractionOneWayGate(ResultSet set, Item baseItem) throws SQLException {
@ -86,6 +93,8 @@ public class InteractionOneWayGate extends HabboItem {
RoomTile tile = room.getLayout().getTileInFront(room.getLayout().getTile(this.getX(), this.getY()), this.getRotation() + 4);
unit.setGoalLocation(tile);
Emulator.getThreading().run(new RoomUnitWalkToLocation(unit, tile, room, onFail, onFail));
Emulator.getThreading().run(() -> WiredHandler.handle(WiredTriggerType.WALKS_ON_FURNI, unit, room, new Object[]{this}), 500);
});
onFail.add(() -> {

View File

@ -137,8 +137,6 @@ public class WiredConditionFurniHaveFurni extends InteractionWiredCondition {
@Override
public boolean saveData(ClientMessage packet) {
this.items.clear();
int count;
packet.readInt();
@ -147,6 +145,9 @@ public class WiredConditionFurniHaveFurni extends InteractionWiredCondition {
packet.readString();
count = packet.readInt();
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false;
this.items.clear();
Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId());

View File

@ -154,14 +154,15 @@ public class WiredConditionFurniHaveHabbo extends InteractionWiredCondition {
@Override
public boolean saveData(ClientMessage packet) {
this.items.clear();
int count;
packet.readInt();
packet.readString();
count = packet.readInt();
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false;
this.items.clear();
Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId());

View File

@ -104,12 +104,13 @@ public class WiredConditionFurniTypeMatch extends InteractionWiredCondition {
@Override
public boolean saveData(ClientMessage packet) {
this.items.clear();
packet.readInt();
packet.readString();
int count = packet.readInt();
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false;
this.items.clear();
Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId());

View File

@ -67,8 +67,6 @@ public class WiredConditionMatchStatePosition extends InteractionWiredCondition
@Override
public boolean saveData(ClientMessage packet) {
this.settings.clear();
int count;
packet.readInt();
@ -84,6 +82,9 @@ public class WiredConditionMatchStatePosition extends InteractionWiredCondition
return true;
count = packet.readInt();
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false;
this.settings.clear();
for (int i = 0; i < count; i++) {
int itemId = packet.readInt();

View File

@ -123,16 +123,16 @@ public class WiredConditionNotFurniHaveFurni extends InteractionWiredCondition {
@Override
public boolean saveData(ClientMessage packet) {
this.items.clear();
int count;
packet.readInt();
this.all = packet.readInt() == 1;
packet.readString();
count = packet.readInt();
int count = packet.readInt();
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false;
this.items.clear();
Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId());

View File

@ -154,14 +154,14 @@ public class WiredConditionNotFurniHaveHabbo extends InteractionWiredCondition {
@Override
public boolean saveData(ClientMessage packet) {
this.items.clear();
int count;
packet.readInt();
packet.readString();
count = packet.readInt();
int count = packet.readInt();
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false;
this.items.clear();
Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId());

View File

@ -103,12 +103,13 @@ public class WiredConditionNotFurniTypeMatch extends InteractionWiredCondition {
@Override
public boolean saveData(ClientMessage packet) {
this.items.clear();
packet.readInt();
packet.readString();
int count = packet.readInt();
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false;
this.items.clear();
Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId());

View File

@ -142,9 +142,6 @@ public class WiredConditionNotMatchStatePosition extends InteractionWiredConditi
@Override
public boolean saveData(ClientMessage packet) {
this.settings.clear();
int count;
packet.readInt();
this.state = packet.readInt() == 1;
@ -158,7 +155,10 @@ public class WiredConditionNotMatchStatePosition extends InteractionWiredConditi
if (room == null)
return true;
count = packet.readInt();
int count = packet.readInt();
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false;
this.settings.clear();
for (int i = 0; i < count; i++) {
int itemId = packet.readInt();

View File

@ -105,12 +105,13 @@ public class WiredConditionNotTriggerOnFurni extends InteractionWiredCondition {
@Override
public boolean saveData(ClientMessage packet) {
this.items.clear();
packet.readInt();
packet.readString();
int count = packet.readInt();
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false;
this.items.clear();
Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId());

View File

@ -108,12 +108,13 @@ public class WiredConditionTriggerOnFurni extends InteractionWiredCondition {
@Override
public boolean saveData(ClientMessage packet) {
this.items.clear();
packet.readInt();
packet.readString();
int count = packet.readInt();
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false;
this.items.clear();
Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId());

View File

@ -57,6 +57,8 @@ public class WiredEffectBotTalk extends InteractionWiredEffect {
if (data.length == 2) {
this.botName = data[0];
if (data[1].length() > 64) return false;
this.message = data[1];
}

View File

@ -77,6 +77,8 @@ public class WiredEffectBotTalkToHabbo extends InteractionWiredEffect {
if (data.length == 2) {
this.botName = data[0];
if (data[1].length() > 64) return false;
this.message = data[1];
}

View File

@ -114,9 +114,10 @@ public class WiredEffectBotTeleport extends InteractionWiredEffect {
packet.readInt();
this.botName = packet.readString();
this.items.clear();
int count = packet.readInt();
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false;
this.items.clear();
for (int i = 0; i < count; i++) {
this.items.add(Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(packet.readInt()));

View File

@ -68,9 +68,10 @@ public class WiredEffectBotWalkToFurni extends InteractionWiredEffect {
packet.readInt();
this.botName = packet.readString();
this.items.clear();
int count = packet.readInt();
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false;
this.items.clear();
for (int i = 0; i < count; i++) {
this.items.add(Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(packet.readInt()));

View File

@ -162,14 +162,17 @@ public class WiredEffectChangeFurniDirection extends InteractionWiredEffect {
@Override
public boolean saveData(ClientMessage packet, GameClient gameClient) {
this.items.clear();
packet.readInt();
this.startRotation = RoomUserRotation.fromValue(packet.readInt());
this.rotateAction = packet.readInt();
packet.readString();
int furniCount = packet.readInt();
for (int i = 0; i < furniCount; i++) {
int count = packet.readInt();
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false;
this.items.clear();
for (int i = 0; i < count; i++) {
HabboItem item = gameClient.getHabbo().getHabboInfo().getCurrentRoom().getHabboItem(packet.readInt());
if (item != null) {

View File

@ -244,11 +244,6 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect {
@Override
public boolean saveData(ClientMessage packet, GameClient gameClient) {
this.settings.clear();
//packet.readInt();
int count;
packet.readInt();
this.state = packet.readInt() == 1;
@ -262,7 +257,10 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect {
if (room == null)
return true;
count = packet.readInt();
int count = packet.readInt();
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false;
this.settings.clear();
for (int i = 0; i < count; i++) {
int itemId = packet.readInt();

View File

@ -186,9 +186,10 @@ public class WiredEffectMoveFurniAway extends InteractionWiredEffect {
packet.readInt();
packet.readString();
this.items.clear();
int count = packet.readInt();
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false;
this.items.clear();
for (int i = 0; i < count; i++) {
this.items.add(Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(packet.readInt()));

View File

@ -304,9 +304,10 @@ public class WiredEffectMoveFurniTowards extends InteractionWiredEffect {
packet.readInt();
packet.readString();
this.items.clear();
int count = packet.readInt();
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false;
this.items.clear();
for (int i = 0; i < count; i++) {
this.items.add(Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(packet.readInt()));

View File

@ -17,6 +17,8 @@ import com.eu.habbo.messages.outgoing.rooms.items.FloorItemOnRollerComposer;
import com.eu.habbo.messages.outgoing.rooms.items.FloorItemUpdateComposer;
import gnu.trove.set.hash.THashSet;
import org.apache.commons.math3.util.Pair;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.awt.*;
import java.sql.ResultSet;
@ -24,6 +26,10 @@ import java.sql.SQLException;
import java.util.ArrayList;
public class WiredEffectMoveRotateFurni extends InteractionWiredEffect {
private static final Logger LOGGER = LoggerFactory.getLogger(WiredEffectMoveRotateFurni.class);
public static final WiredEffectType type = WiredEffectType.MOVE_ROTATE;
private final THashSet<HabboItem> items = new THashSet<>(WiredHandler.MAXIMUM_FURNI_SELECTION / 2);
private int direction;
@ -53,8 +59,7 @@ public class WiredEffectMoveRotateFurni extends InteractionWiredEffect {
//Verify if rotation result in a valid position
FurnitureMovementError rotateError = room.furnitureFitsAt(room.getLayout().getTile(item.getX(), item.getY()), item, newRotation);
if (item.getRotation() != newRotation && (rotateError.equals(FurnitureMovementError.TILE_HAS_HABBOS) || rotateError.equals(FurnitureMovementError.TILE_HAS_PETS) ||
rotateError.equals(FurnitureMovementError.TILE_HAS_BOTS) || rotateError.equals(FurnitureMovementError.NONE)))
{
rotateError.equals(FurnitureMovementError.TILE_HAS_BOTS) || rotateError.equals(FurnitureMovementError.NONE))) {
item.setRotation(newRotation);
if (this.direction == 0) {
tilesToUpdate.addAll(room.getLayout().getTilesAt(room.getLayout().getTile(item.getX(), item.getY()), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), item.getRotation()));
@ -144,8 +149,7 @@ public class WiredEffectMoveRotateFurni extends InteractionWiredEffect {
room.updateHabbosAt(t.x, t.y);
room.updateBotsAt(t.x, t.y);
}
}
else {
} else {
room.sendComposer(new FloorItemOnRollerComposer(item, null, newTile, offset, room).compose());
}
}
@ -268,6 +272,7 @@ public class WiredEffectMoveRotateFurni extends InteractionWiredEffect {
packet.readString();
int count = packet.readInt();
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count", 5)) return false;
this.items.clear();
for (int i = 0; i < count; i++) {
@ -282,6 +287,7 @@ public class WiredEffectMoveRotateFurni extends InteractionWiredEffect {
/**
* Returns a new rotation for an item based on the wired options
*
* @param item
* @return new rotation
*/
@ -306,6 +312,7 @@ public class WiredEffectMoveRotateFurni extends InteractionWiredEffect {
/**
* Returns the direction of movement based on the wired settings
*
* @return direction
*/
private RoomUserRotation getMovementDirection() {

View File

@ -131,9 +131,10 @@ public class WiredEffectTeleport extends InteractionWiredEffect {
packet.readInt();
packet.readString();
this.items.clear();
int count = packet.readInt();
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false;
this.items.clear();
for (int i = 0; i < count; i++) {
this.items.add(Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(packet.readInt()));

View File

@ -96,9 +96,10 @@ public class WiredEffectToggleFurni extends InteractionWiredEffect {
packet.readInt();
packet.readString();
this.items.clear();
int count = packet.readInt();
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false;
this.items.clear();
for (int i = 0; i < count; i++) {
HabboItem item = Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(packet.readInt());

View File

@ -87,9 +87,10 @@ public class WiredEffectTriggerStacks extends InteractionWiredEffect {
packet.readInt();
packet.readString();
this.items.clear();
int count = packet.readInt();
if (count > Emulator.getConfig().getInt("hotel.wired.furni.selection.count")) return false;
this.items.clear();
for (int i = 0; i < count; i++) {
this.items.add(Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(packet.readInt()));

View File

@ -3244,10 +3244,18 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
RoomChatMessage itemMessage = new RoomChatMessage(Emulator.getTexts().getValue(item.getBaseItem().getName() + ".message." + randomValue, item.getBaseItem().getName() + ".message." + randomValue + " not found!"), habbo, RoomChatMessageBubbles.getBubble(Emulator.getConfig().getInt(item.getBaseItem().getName() + ".message.bubble", RoomChatMessageBubbles.PARROT.getType())));
this.sendComposer(new RoomUserShoutComposer(itemMessage).compose());
this.sendComposer(new RoomUserTalkComposer(itemMessage).compose());
try {
item.onClick(habbo.getClient(), this, new Object[0]);
item.setExtradata("1");
updateItemState(item);
Emulator.getThreading().run(() -> {
item.setExtradata("0");
updateItemState(item);
}, 2000);
break;
} catch (Exception e) {
LOGGER.error("Caught exception", e);

View File

@ -527,10 +527,10 @@ public class RoomManager {
if (overrideChecks ||
room.isOwner(habbo) ||
room.getState() == RoomState.OPEN ||
room.getState() == RoomState.INVISIBLE ||
habbo.hasPermission(Permission.ACC_ANYROOMOWNER) ||
habbo.hasPermission(Permission.ACC_ENTERANYROOM) ||
room.hasRights(habbo) ||
(room.getState().equals(RoomState.INVISIBLE) && room.hasRights(habbo)) ||
(room.hasGuild() && room.guildRightLevel(habbo) > 2)) {
this.openRoom(habbo, room, doorLocation);
} else if (room.getState() == RoomState.LOCKED) {
@ -563,6 +563,9 @@ public class RoomManager {
habbo.getClient().sendResponse(new HotelViewComposer());
habbo.getHabboInfo().setLoadingRoom(0);
}
} else {
habbo.getClient().sendResponse(new HotelViewComposer());
habbo.getHabboInfo().setLoadingRoom(0);
}
}
@ -938,6 +941,8 @@ public class RoomManager {
if (room.getOwnerId() != habbo.getHabboInfo().getId()) {
AchievementManager.progressAchievement(room.getOwnerId(), Emulator.getGameEnvironment().getAchievementManager().getAchievement("RoomDecoHosting"), (int) Math.floor((Emulator.getIntUnixTimestamp() - habbo.getHabboStats().roomEnterTimestamp) / 60000));
}
habbo.getMessenger().connectionChanged(habbo, habbo.isOnline(), false);
}
}

View File

@ -240,7 +240,8 @@ public class Habbo implements Runnable {
return;
this.getHabboInfo().addCurrencyAmount(event.type, event.points);
if (this.client != null) this.client.sendResponse(new UserPointsComposer(this.client.getHabbo().getHabboInfo().getCurrencyAmount(type), event.points, event.type));
if (this.client != null)
this.client.sendResponse(new UserPointsComposer(this.client.getHabbo().getHabboInfo().getCurrencyAmount(type), event.points, event.type));
}
@ -436,9 +437,7 @@ public class Habbo implements Runnable {
public void respect(Habbo target) {
if (target != null && target != this.client.getHabbo())
{
if (target != null && target != this.client.getHabbo()) {
target.getHabboStats().respectPointsReceived++;
this.client.getHabbo().getHabboStats().respectPointsGiven++;
this.client.getHabbo().getHabboStats().respectPointsToGive--;
@ -449,6 +448,7 @@ public class Habbo implements Runnable {
AchievementManager.progressAchievement(target, Emulator.getGameEnvironment().getAchievementManager().getAchievement("RespectEarned"));
this.client.getHabbo().getHabboInfo().getCurrentRoom().unIdle(this.client.getHabbo());
this.client.getHabbo().getHabboInfo().getCurrentRoom().dance(this.client.getHabbo().getRoomUnit(), DanceType.NONE);
}
}