mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2025-01-18 23:46:28 +01:00
wired furni selection count fix
This commit is contained in:
parent
cdbae76e84
commit
774cf85926
@ -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());
|
||||
|
||||
|
@ -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());
|
||||
|
||||
|
@ -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());
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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());
|
||||
|
||||
|
@ -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());
|
||||
|
||||
|
@ -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());
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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());
|
||||
|
||||
|
@ -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());
|
||||
|
||||
|
@ -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()));
|
||||
|
@ -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()));
|
||||
|
@ -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) {
|
||||
|
@ -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();
|
||||
|
@ -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()));
|
||||
|
@ -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()));
|
||||
|
@ -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;
|
||||
@ -40,7 +46,7 @@ public class WiredEffectMoveRotateFurni extends InteractionWiredEffect {
|
||||
@Override
|
||||
public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) {
|
||||
// remove items that are no longer in the room
|
||||
this.items.removeIf( item -> Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(item.getId()) == null);
|
||||
this.items.removeIf(item -> Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(item.getId()) == null);
|
||||
|
||||
THashSet<RoomTile> tilesToUpdate = new THashSet<>(Math.min(this.items.size(), 10));
|
||||
|
||||
@ -53,10 +59,9 @@ 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) {
|
||||
if (this.direction == 0) {
|
||||
tilesToUpdate.addAll(room.getLayout().getTilesAt(room.getLayout().getTile(item.getX(), item.getY()), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), item.getRotation()));
|
||||
room.sendComposer(new FloorItemUpdateComposer(item).compose());
|
||||
for (RoomTile t : tilesToUpdate) {
|
||||
@ -135,7 +140,7 @@ public class WiredEffectMoveRotateFurni extends InteractionWiredEffect {
|
||||
}
|
||||
|
||||
if (validMove) {
|
||||
if(this.rotation > 0) {
|
||||
if (this.rotation > 0) {
|
||||
item.setX(newTile.x);
|
||||
item.setY(newTile.y);
|
||||
item.setZ(item.getZ() + offset);
|
||||
@ -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() {
|
||||
|
@ -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()));
|
||||
|
@ -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());
|
||||
|
@ -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()));
|
||||
|
Loading…
Reference in New Issue
Block a user