🔘 alllow/disallow PETS/BOTS Selector Users Area

This commit is contained in:
duckietm
2026-03-06 13:05:09 +01:00
parent b0a0da455c
commit c066d1af1b
@@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings; import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
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.rooms.RoomUnitType;
import com.eu.habbo.habbohotel.wired.WiredEffectType; import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.habbohotel.wired.core.WiredContext; import com.eu.habbo.habbohotel.wired.core.WiredContext;
import com.eu.habbo.habbohotel.wired.core.WiredManager; import com.eu.habbo.habbohotel.wired.core.WiredManager;
@@ -17,6 +18,7 @@ import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
public class WiredEffectUsersArea extends InteractionWiredEffect { public class WiredEffectUsersArea extends InteractionWiredEffect {
public static final WiredEffectType type = WiredEffectType.USERS_AREA_SELECTOR; public static final WiredEffectType type = WiredEffectType.USERS_AREA_SELECTOR;
@@ -27,6 +29,8 @@ public class WiredEffectUsersArea extends InteractionWiredEffect {
private int areaHeight = 0; private int areaHeight = 0;
private boolean filterExisting = false; private boolean filterExisting = false;
private boolean invert = false; private boolean invert = false;
private boolean excludeBots = false;
private boolean excludePets = false;
public WiredEffectUsersArea(ResultSet set, Item baseItem) throws SQLException { public WiredEffectUsersArea(ResultSet set, Item baseItem) throws SQLException {
super(set, baseItem); super(set, baseItem);
@@ -46,6 +50,8 @@ public class WiredEffectUsersArea extends InteractionWiredEffect {
List<RoomUnit> usersInArea = new ArrayList<>(); List<RoomUnit> usersInArea = new ArrayList<>();
for (RoomUnit unit : room.getRoomUnits()) { for (RoomUnit unit : room.getRoomUnits()) {
if (excludeBots && unit.getRoomUnitType() == RoomUnitType.BOT) continue;
if (excludePets && unit.getRoomUnitType() == RoomUnitType.PET) continue;
int x = unit.getX(); int x = unit.getX();
int y = unit.getY(); int y = unit.getY();
boolean inArea = x >= rootX && x <= maxX && y >= rootY && y <= maxY; boolean inArea = x >= rootX && x <= maxX && y >= rootY && y <= maxY;
@@ -74,6 +80,8 @@ public class WiredEffectUsersArea extends InteractionWiredEffect {
this.areaHeight = params[3]; this.areaHeight = params[3];
this.filterExisting = params.length >= 5 && params[4] == 1; this.filterExisting = params.length >= 5 && params[4] == 1;
this.invert = params.length >= 6 && params[5] == 1; this.invert = params.length >= 6 && params[5] == 1;
this.excludeBots = params.length >= 7 && params[6] == 1;
this.excludePets = params.length >= 8 && params[7] == 1;
this.setDelay(settings.getDelay()); this.setDelay(settings.getDelay());
return true; return true;
@@ -91,7 +99,7 @@ public class WiredEffectUsersArea extends InteractionWiredEffect {
@Override @Override
public String getWiredData() { public String getWiredData() {
return WiredManager.getGson().toJson(new JsonData(rootX, rootY, areaWidth, areaHeight, filterExisting, invert, getDelay())); return WiredManager.getGson().toJson(new JsonData(rootX, rootY, areaWidth, areaHeight, filterExisting, invert, excludeBots, excludePets, getDelay()));
} }
@Override @Override
@@ -106,6 +114,8 @@ public class WiredEffectUsersArea extends InteractionWiredEffect {
this.areaHeight = data.height; this.areaHeight = data.height;
this.filterExisting = data.filterExisting; this.filterExisting = data.filterExisting;
this.invert = data.invert; this.invert = data.invert;
this.excludeBots = data.excludeBots;
this.excludePets = data.excludePets;
this.setDelay(data.delay); this.setDelay(data.delay);
} }
} }
@@ -118,6 +128,8 @@ public class WiredEffectUsersArea extends InteractionWiredEffect {
this.areaHeight = 0; this.areaHeight = 0;
this.filterExisting = false; this.filterExisting = false;
this.invert = false; this.invert = false;
this.excludeBots = false;
this.excludePets = false;
this.setDelay(0); this.setDelay(0);
} }
@@ -131,13 +143,15 @@ public class WiredEffectUsersArea extends InteractionWiredEffect {
message.appendInt(this.getId()); message.appendInt(this.getId());
message.appendString(""); message.appendString("");
message.appendInt(6); message.appendInt(8);
message.appendInt(this.rootX); message.appendInt(this.rootX);
message.appendInt(this.rootY); message.appendInt(this.rootY);
message.appendInt(this.areaWidth); message.appendInt(this.areaWidth);
message.appendInt(this.areaHeight); message.appendInt(this.areaHeight);
message.appendInt(this.filterExisting ? 1 : 0); message.appendInt(this.filterExisting ? 1 : 0);
message.appendInt(this.invert ? 1 : 0); message.appendInt(this.invert ? 1 : 0);
message.appendInt(this.excludeBots ? 1 : 0);
message.appendInt(this.excludePets ? 1 : 0);
message.appendInt(0); message.appendInt(0);
message.appendInt(this.getType().code); message.appendInt(this.getType().code);
@@ -157,15 +171,19 @@ public class WiredEffectUsersArea extends InteractionWiredEffect {
int height; int height;
boolean filterExisting; boolean filterExisting;
boolean invert; boolean invert;
boolean excludeBots;
boolean excludePets;
int delay; int delay;
JsonData(int rootX, int rootY, int width, int height, boolean filterExisting, boolean invert, int delay) { JsonData(int rootX, int rootY, int width, int height, boolean filterExisting, boolean invert, boolean excludeBots, boolean excludePets, int delay) {
this.rootX = rootX; this.rootX = rootX;
this.rootY = rootY; this.rootY = rootY;
this.width = width; this.width = width;
this.height = height; this.height = height;
this.filterExisting = filterExisting; this.filterExisting = filterExisting;
this.invert = invert; this.invert = invert;
this.excludeBots = excludeBots;
this.excludePets = excludePets;
this.delay = delay; this.delay = delay;
} }
} }