mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-23 15:20:52 +01:00
Merge branch 'revert-b8a69990' into 'dev'
Revert "Merge branch 'feature/packet-1094' into 'dev'" See merge request morningstar/Arcturus-Community!367
This commit is contained in:
commit
282f8b6bba
@ -3,7 +3,6 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
|
|||||||
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.InteractionWiredCondition;
|
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
|
||||||
import com.eu.habbo.habbohotel.items.interactions.wired.interfaces.InteractionWiredMatchFurniSettings;
|
|
||||||
import com.eu.habbo.habbohotel.rooms.Room;
|
import com.eu.habbo.habbohotel.rooms.Room;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||||
@ -17,7 +16,7 @@ import gnu.trove.set.hash.THashSet;
|
|||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
||||||
public class WiredConditionMatchStatePosition extends InteractionWiredCondition implements InteractionWiredMatchFurniSettings {
|
public class WiredConditionMatchStatePosition extends InteractionWiredCondition {
|
||||||
public static final WiredConditionType type = WiredConditionType.MATCH_SSHOT;
|
public static final WiredConditionType type = WiredConditionType.MATCH_SSHOT;
|
||||||
|
|
||||||
private THashSet<WiredMatchFurniSetting> settings;
|
private THashSet<WiredMatchFurniSetting> settings;
|
||||||
@ -199,24 +198,4 @@ public class WiredConditionMatchStatePosition extends InteractionWiredCondition
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public THashSet<WiredMatchFurniSetting> getMatchFurniSettings() {
|
|
||||||
return this.settings;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean shouldMatchState() {
|
|
||||||
return this.state;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean shouldMatchRotation() {
|
|
||||||
return this.direction;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean shouldMatchPosition() {
|
|
||||||
return this.position;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@ package com.eu.habbo.habbohotel.items.interactions.wired.conditions;
|
|||||||
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.InteractionWiredCondition;
|
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
|
||||||
import com.eu.habbo.habbohotel.items.interactions.wired.interfaces.InteractionWiredMatchFurniSettings;
|
|
||||||
import com.eu.habbo.habbohotel.rooms.Room;
|
import com.eu.habbo.habbohotel.rooms.Room;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||||
@ -17,7 +16,7 @@ import gnu.trove.set.hash.THashSet;
|
|||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
||||||
public class WiredConditionNotMatchStatePosition extends InteractionWiredCondition implements InteractionWiredMatchFurniSettings {
|
public class WiredConditionNotMatchStatePosition extends InteractionWiredCondition {
|
||||||
public static final WiredConditionType type = WiredConditionType.NOT_MATCH_SSHOT;
|
public static final WiredConditionType type = WiredConditionType.NOT_MATCH_SSHOT;
|
||||||
|
|
||||||
private THashSet<WiredMatchFurniSetting> settings;
|
private THashSet<WiredMatchFurniSetting> settings;
|
||||||
@ -190,24 +189,4 @@ public class WiredConditionNotMatchStatePosition extends InteractionWiredConditi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public THashSet<WiredMatchFurniSetting> getMatchFurniSettings() {
|
|
||||||
return this.settings;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean shouldMatchState() {
|
|
||||||
return this.state;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean shouldMatchRotation() {
|
|
||||||
return this.rotation;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean shouldMatchPosition() {
|
|
||||||
return this.position;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,6 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
|
|||||||
import com.eu.habbo.habbohotel.games.GameTeamColors;
|
import com.eu.habbo.habbohotel.games.GameTeamColors;
|
||||||
import com.eu.habbo.habbohotel.items.Item;
|
import com.eu.habbo.habbohotel.items.Item;
|
||||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
|
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
|
||||||
import com.eu.habbo.habbohotel.items.interactions.wired.interfaces.InteractionWiredMatchFurniSettings;
|
|
||||||
import com.eu.habbo.habbohotel.rooms.*;
|
import com.eu.habbo.habbohotel.rooms.*;
|
||||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||||
import com.eu.habbo.habbohotel.wired.WiredEffectType;
|
import com.eu.habbo.habbohotel.wired.WiredEffectType;
|
||||||
@ -25,7 +24,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
public class WiredEffectMatchFurni extends InteractionWiredEffect implements InteractionWiredMatchFurniSettings {
|
public class WiredEffectMatchFurni extends InteractionWiredEffect {
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(WiredEffectMatchFurni.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(WiredEffectMatchFurni.class);
|
||||||
|
|
||||||
private static final WiredEffectType type = WiredEffectType.MATCH_SSHOT;
|
private static final WiredEffectType type = WiredEffectType.MATCH_SSHOT;
|
||||||
@ -242,26 +241,6 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect implements Int
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public THashSet<WiredMatchFurniSetting> getMatchFurniSettings() {
|
|
||||||
return this.settings;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean shouldMatchState() {
|
|
||||||
return this.state;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean shouldMatchRotation() {
|
|
||||||
return this.direction;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean shouldMatchPosition() {
|
|
||||||
return this.position;
|
|
||||||
}
|
|
||||||
|
|
||||||
static class JsonData {
|
static class JsonData {
|
||||||
boolean state;
|
boolean state;
|
||||||
boolean direction;
|
boolean direction;
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
package com.eu.habbo.habbohotel.items.interactions.wired.interfaces;
|
|
||||||
|
|
||||||
import com.eu.habbo.habbohotel.wired.WiredMatchFurniSetting;
|
|
||||||
import gnu.trove.set.hash.THashSet;
|
|
||||||
|
|
||||||
public interface InteractionWiredMatchFurniSettings {
|
|
||||||
public THashSet<WiredMatchFurniSetting> getMatchFurniSettings();
|
|
||||||
public boolean shouldMatchState();
|
|
||||||
public boolean shouldMatchRotation();
|
|
||||||
public boolean shouldMatchPosition();
|
|
||||||
}
|
|
@ -65,7 +65,6 @@ import com.eu.habbo.messages.incoming.unknown.RequestResolutionEvent;
|
|||||||
import com.eu.habbo.messages.incoming.unknown.UnknownEvent1;
|
import com.eu.habbo.messages.incoming.unknown.UnknownEvent1;
|
||||||
import com.eu.habbo.messages.incoming.users.*;
|
import com.eu.habbo.messages.incoming.users.*;
|
||||||
import com.eu.habbo.messages.incoming.wired.WiredConditionSaveDataEvent;
|
import com.eu.habbo.messages.incoming.wired.WiredConditionSaveDataEvent;
|
||||||
import com.eu.habbo.messages.incoming.wired.WiredApplySetConditionsEvent;
|
|
||||||
import com.eu.habbo.messages.incoming.wired.WiredEffectSaveDataEvent;
|
import com.eu.habbo.messages.incoming.wired.WiredEffectSaveDataEvent;
|
||||||
import com.eu.habbo.messages.incoming.wired.WiredTriggerSaveDataEvent;
|
import com.eu.habbo.messages.incoming.wired.WiredTriggerSaveDataEvent;
|
||||||
import com.eu.habbo.plugin.EventHandler;
|
import com.eu.habbo.plugin.EventHandler;
|
||||||
@ -580,7 +579,6 @@ public class PacketManager {
|
|||||||
this.registerHandler(Incoming.WiredTriggerSaveDataEvent, WiredTriggerSaveDataEvent.class);
|
this.registerHandler(Incoming.WiredTriggerSaveDataEvent, WiredTriggerSaveDataEvent.class);
|
||||||
this.registerHandler(Incoming.WiredEffectSaveDataEvent, WiredEffectSaveDataEvent.class);
|
this.registerHandler(Incoming.WiredEffectSaveDataEvent, WiredEffectSaveDataEvent.class);
|
||||||
this.registerHandler(Incoming.WiredConditionSaveDataEvent, WiredConditionSaveDataEvent.class);
|
this.registerHandler(Incoming.WiredConditionSaveDataEvent, WiredConditionSaveDataEvent.class);
|
||||||
this.registerHandler(Incoming.WiredApplySetConditionsEvent, WiredApplySetConditionsEvent.class);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void registerUnknown() throws Exception {
|
void registerUnknown() throws Exception {
|
||||||
|
@ -155,7 +155,6 @@ public class Incoming {
|
|||||||
public static final int RequestInventoryItemsEvent = 3150;
|
public static final int RequestInventoryItemsEvent = 3150;
|
||||||
public static final int ModToolRoomAlertEvent = 3842;
|
public static final int ModToolRoomAlertEvent = 3842;
|
||||||
public static final int WiredEffectSaveDataEvent = 2281;
|
public static final int WiredEffectSaveDataEvent = 2281;
|
||||||
public static final int WiredApplySetConditionsEvent = 3373;
|
|
||||||
public static final int CheckPetNameEvent = 2109;
|
public static final int CheckPetNameEvent = 2109;
|
||||||
public static final int SecureLoginEvent = 2419;
|
public static final int SecureLoginEvent = 2419;
|
||||||
public static final int BotSaveSettingsEvent = 2624;
|
public static final int BotSaveSettingsEvent = 2624;
|
||||||
|
@ -1,103 +0,0 @@
|
|||||||
package com.eu.habbo.messages.incoming.wired;
|
|
||||||
|
|
||||||
import com.eu.habbo.habbohotel.items.interactions.wired.interfaces.InteractionWiredMatchFurniSettings;
|
|
||||||
import com.eu.habbo.habbohotel.rooms.FurnitureMovementError;
|
|
||||||
import com.eu.habbo.habbohotel.rooms.Room;
|
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomTileState;
|
|
||||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
|
||||||
import com.eu.habbo.messages.incoming.MessageHandler;
|
|
||||||
import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertComposer;
|
|
||||||
import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertKeys;
|
|
||||||
import com.eu.habbo.messages.outgoing.rooms.items.FloorItemOnRollerComposer;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
public class WiredApplySetConditionsEvent extends MessageHandler {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getRatelimit() {
|
|
||||||
return 500;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void handle() throws Exception {
|
|
||||||
int itemId = this.packet.readInt();
|
|
||||||
|
|
||||||
// Executing Habbo has to be in a Room
|
|
||||||
if (!this.client.getHabbo().getRoomUnit().isInRoom()) {
|
|
||||||
this.client.sendResponse(new BubbleAlertComposer(
|
|
||||||
BubbleAlertKeys.FURNITURE_PLACEMENT_ERROR.key,
|
|
||||||
FurnitureMovementError.NO_RIGHTS.errorCode
|
|
||||||
));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Room room = this.client.getHabbo().getHabboInfo().getCurrentRoom();
|
|
||||||
|
|
||||||
if (room != null) {
|
|
||||||
|
|
||||||
// Executing Habbo should be able to edit wireds
|
|
||||||
if (room.hasRights(this.client.getHabbo()) || room.isOwner(this.client.getHabbo())) {
|
|
||||||
|
|
||||||
List<HabboItem> wireds = new ArrayList<>();
|
|
||||||
wireds.addAll(room.getRoomSpecialTypes().getConditions());
|
|
||||||
wireds.addAll(room.getRoomSpecialTypes().getEffects());
|
|
||||||
|
|
||||||
// Find the item with the given ID in the room
|
|
||||||
Optional<HabboItem> item = wireds.stream()
|
|
||||||
.filter(wired -> wired.getId() == itemId)
|
|
||||||
.findFirst();
|
|
||||||
|
|
||||||
// If the item exists
|
|
||||||
if (item.isPresent()) {
|
|
||||||
HabboItem wiredItem = item.get();
|
|
||||||
|
|
||||||
// The item should have settings to match furni state, position and rotation
|
|
||||||
if (wiredItem instanceof InteractionWiredMatchFurniSettings) {
|
|
||||||
|
|
||||||
InteractionWiredMatchFurniSettings wired = (InteractionWiredMatchFurniSettings) wiredItem;
|
|
||||||
|
|
||||||
// Try to apply the set settings to each item
|
|
||||||
wired.getMatchFurniSettings().forEach(setting -> {
|
|
||||||
HabboItem matchItem = room.getHabboItem(setting.item_id);
|
|
||||||
|
|
||||||
// Match state
|
|
||||||
if (wired.shouldMatchState() && matchItem.allowWiredResetState()) {
|
|
||||||
if (!setting.state.equals(" ") && !matchItem.getExtradata().equals(setting.state)) {
|
|
||||||
matchItem.setExtradata(setting.state);
|
|
||||||
room.updateItemState(matchItem);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
RoomTile oldLocation = room.getLayout().getTile(matchItem.getX(), matchItem.getY());
|
|
||||||
double oldZ = matchItem.getZ();
|
|
||||||
|
|
||||||
// Match Position & Rotation
|
|
||||||
if(wired.shouldMatchRotation() && !wired.shouldMatchPosition()) {
|
|
||||||
if(matchItem.getRotation() != setting.rotation && room.furnitureFitsAt(oldLocation, matchItem, setting.rotation, false) == FurnitureMovementError.NONE) {
|
|
||||||
room.moveFurniTo(matchItem, oldLocation, setting.rotation, null, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(wired.shouldMatchPosition()) {
|
|
||||||
boolean slideAnimation = !wired.shouldMatchRotation() || matchItem.getRotation() == setting.rotation;
|
|
||||||
RoomTile newLocation = room.getLayout().getTile((short) setting.x, (short) setting.y);
|
|
||||||
int newRotation = wired.shouldMatchRotation() ? setting.rotation : matchItem.getRotation();
|
|
||||||
|
|
||||||
if(newLocation != null && newLocation.state != RoomTileState.INVALID && (newLocation != oldLocation || newRotation != matchItem.getRotation()) && room.furnitureFitsAt(newLocation, matchItem, newRotation, true) == FurnitureMovementError.NONE) {
|
|
||||||
if(room.moveFurniTo(matchItem, newLocation, newRotation, null, !slideAnimation) == FurnitureMovementError.NONE) {
|
|
||||||
if(slideAnimation) {
|
|
||||||
room.sendComposer(new FloorItemOnRollerComposer(matchItem, null, oldLocation, oldZ, newLocation, matchItem.getZ(), 0, room).compose());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user