mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2025-01-18 23:46:28 +01:00
Merge branch 'dev' of https://git.krews.org/morningstar/Arcturus-Community into dev
This commit is contained in:
commit
af21a8fbd6
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>com.eu.habbo</groupId>
|
||||
<artifactId>Habbo</artifactId>
|
||||
<version>2.5.0</version>
|
||||
<version>3.0.0</version>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
@ -35,8 +35,8 @@ public final class Emulator {
|
||||
private static final String OS_NAME = System.getProperty("os.name");
|
||||
private static final String CLASS_PATH = System.getProperty("java.class.path");
|
||||
|
||||
public final static int MAJOR = 2;
|
||||
public final static int MINOR = 5;
|
||||
public final static int MAJOR = 3;
|
||||
public final static int MINOR = 0;
|
||||
public final static int BUILD = 0;
|
||||
public final static String PREVIEW = "Beta 1";
|
||||
|
||||
|
@ -10,6 +10,7 @@ import com.eu.habbo.habbohotel.pets.PetCommand;
|
||||
import com.eu.habbo.habbohotel.pets.PetVocalsType;
|
||||
import com.eu.habbo.habbohotel.pets.RideablePet;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomRightLevels;
|
||||
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserTypingComposer;
|
||||
import com.eu.habbo.plugin.events.users.UserCommandEvent;
|
||||
import com.eu.habbo.plugin.events.users.UserExecuteCommandEvent;
|
||||
@ -72,7 +73,7 @@ public class CommandHandler {
|
||||
for (String s : command.keys) {
|
||||
if (s.toLowerCase().equals(parts[0].toLowerCase())) {
|
||||
boolean succes = false;
|
||||
if (command.permission == null || gameClient.getHabbo().hasPermission(command.permission, gameClient.getHabbo().getHabboInfo().getCurrentRoom() != null && (gameClient.getHabbo().getHabboInfo().getCurrentRoom().hasRights(gameClient.getHabbo())) || gameClient.getHabbo().hasPermission(Permission.ACC_PLACEFURNI) || (gameClient.getHabbo().getHabboInfo().getCurrentRoom() != null && gameClient.getHabbo().getHabboInfo().getCurrentRoom().getGuildId() > 0 && gameClient.getHabbo().getHabboInfo().getCurrentRoom().guildRightLevel(gameClient.getHabbo()) >= 2))) {
|
||||
if (command.permission == null || gameClient.getHabbo().hasPermission(command.permission, gameClient.getHabbo().getHabboInfo().getCurrentRoom() != null && (gameClient.getHabbo().getHabboInfo().getCurrentRoom().hasRights(gameClient.getHabbo())) || gameClient.getHabbo().hasPermission(Permission.ACC_PLACEFURNI) || (gameClient.getHabbo().getHabboInfo().getCurrentRoom() != null && gameClient.getHabbo().getHabboInfo().getCurrentRoom().getGuildId() > 0 && gameClient.getHabbo().getHabboInfo().getCurrentRoom().getGuildRightLevel(gameClient.getHabbo()).isEqualOrGreaterThan(RoomRightLevels.GUILD_RIGHTS)))) {
|
||||
try {
|
||||
UserExecuteCommandEvent userExecuteCommandEvent = new UserExecuteCommandEvent(gameClient.getHabbo(), command, parts);
|
||||
Emulator.getPluginManager().fireEvent(userExecuteCommandEvent);
|
||||
@ -319,4 +320,4 @@ public class CommandHandler {
|
||||
commands.clear();
|
||||
LOGGER.info("Command Handler -> Disposed!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.commands;
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomRightLevels;
|
||||
|
||||
public class EjectAllCommand extends Command {
|
||||
public EjectAllCommand() {
|
||||
@ -14,7 +15,7 @@ public class EjectAllCommand extends Command {
|
||||
Room room = gameClient.getHabbo().getHabboInfo().getCurrentRoom();
|
||||
|
||||
if (room != null) {
|
||||
if (room.isOwner(gameClient.getHabbo()) || (room.hasGuild() && room.guildRightLevel(gameClient.getHabbo()) == 3)) {
|
||||
if (room.isOwner(gameClient.getHabbo()) || (room.hasGuild() && room.getGuildRightLevel(gameClient.getHabbo()).equals(RoomRightLevels.GUILD_ADMIN))) {
|
||||
room.ejectAll(gameClient.getHabbo());
|
||||
}
|
||||
}
|
||||
|
@ -141,6 +141,7 @@ public class ItemManager {
|
||||
this.interactionsList.add(new ItemInteraction("puzzle_box", InteractionPuzzleBox.class));
|
||||
this.interactionsList.add(new ItemInteraction("hopper", InteractionHopper.class));
|
||||
this.interactionsList.add(new ItemInteraction("costume_hopper", InteractionCostumeHopper.class));
|
||||
this.interactionsList.add(new ItemInteraction("effect_gate", InteractionEffectGate.class));
|
||||
this.interactionsList.add(new ItemInteraction("club_hopper", InteractionHabboClubHopper.class));
|
||||
this.interactionsList.add(new ItemInteraction("club_gate", InteractionHabboClubGate.class));
|
||||
this.interactionsList.add(new ItemInteraction("club_teleporttile", InteractionHabboClubTeleportTile.class));
|
||||
|
@ -0,0 +1,85 @@
|
||||
package com.eu.habbo.habbohotel.items.interactions;
|
||||
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.interfaces.ConditionalGate;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
import com.eu.habbo.threading.runnables.CloseGate;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class InteractionEffectGate extends InteractionDefault implements ConditionalGate {
|
||||
|
||||
// List of Habboween costumes according to http://www.habboxwiki.com/Costumes
|
||||
private static final List<Integer> defaultAllowedEnables = new ArrayList<>(Arrays.asList(
|
||||
114, // Strong Arms
|
||||
115, // Ringmaster Costume
|
||||
116, // Fly Head
|
||||
117, // Executioner Hood
|
||||
118, // Evil Clown Paint
|
||||
135 // Marionette
|
||||
));
|
||||
|
||||
public InteractionEffectGate(ResultSet set, Item baseItem) throws SQLException {
|
||||
super(set, baseItem);
|
||||
this.setExtradata("0");
|
||||
}
|
||||
|
||||
public InteractionEffectGate(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) {
|
||||
super(id, userId, item, extradata, limitedStack, limitedSells);
|
||||
this.setExtradata("0");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWalkable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canWalkOn(RoomUnit roomUnit, Room room, Object[] objects) {
|
||||
if (roomUnit == null || room == null)
|
||||
return false;
|
||||
|
||||
String customparams = this.getBaseItem().getCustomParams().trim();
|
||||
|
||||
if (!customparams.isEmpty()) {
|
||||
return Arrays.asList(customparams.split(";"))
|
||||
.contains(Integer.valueOf(roomUnit.getEffectId()).toString());
|
||||
}
|
||||
|
||||
return defaultAllowedEnables.contains(roomUnit.getEffectId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
|
||||
super.onWalkOn(roomUnit, room, objects);
|
||||
|
||||
if (this.canWalkOn(roomUnit, room, objects)) {
|
||||
this.setExtradata("1");
|
||||
room.updateItemState(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(GameClient client, Room room, Object[] objects) throws Exception {
|
||||
super.onClick(client, room, objects);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWalkOff(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
|
||||
super.onWalkOff(roomUnit, room, objects);
|
||||
|
||||
Emulator.getThreading().run(new CloseGate(this, room), 1000);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRejected(RoomUnit roomUnit, Room room, Object[] objects) {
|
||||
|
||||
}
|
||||
}
|
@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions;
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.interfaces.ConditionalGate;
|
||||
import com.eu.habbo.habbohotel.permissions.Permission;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
||||
@ -13,7 +14,7 @@ import com.eu.habbo.threading.runnables.CloseGate;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class InteractionGuildGate extends InteractionGuildFurni {
|
||||
public class InteractionGuildGate extends InteractionGuildFurni implements ConditionalGate {
|
||||
public InteractionGuildGate(ResultSet set, Item baseItem) throws SQLException {
|
||||
super(set, baseItem);
|
||||
this.setExtradata("0");
|
||||
@ -61,4 +62,9 @@ public class InteractionGuildGate extends InteractionGuildFurni {
|
||||
this.setExtradata("0");
|
||||
room.updateItemState(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRejected(RoomUnit roomUnit, Room room, Object[] objects) {
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions;
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.interfaces.ConditionalGate;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
@ -12,7 +13,7 @@ import com.eu.habbo.threading.runnables.CloseGate;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class InteractionHabboClubGate extends InteractionDefault {
|
||||
public class InteractionHabboClubGate extends InteractionDefault implements ConditionalGate {
|
||||
public InteractionHabboClubGate(ResultSet set, Item baseItem) throws SQLException {
|
||||
super(set, baseItem);
|
||||
this.setExtradata("0");
|
||||
@ -42,14 +43,6 @@ public class InteractionHabboClubGate extends InteractionDefault {
|
||||
if (this.canWalkOn(roomUnit, room, objects)) {
|
||||
this.setExtradata("1");
|
||||
room.updateItemState(this);
|
||||
} else {
|
||||
Habbo habbo = room.getHabbo(roomUnit);
|
||||
|
||||
if (habbo != null) {
|
||||
habbo.getClient().sendResponse(new CustomNotificationComposer(CustomNotificationComposer.GATE_NO_HC));
|
||||
}
|
||||
|
||||
roomUnit.setGoalLocation(roomUnit.getCurrentLocation());
|
||||
}
|
||||
}
|
||||
|
||||
@ -70,4 +63,14 @@ public class InteractionHabboClubGate extends InteractionDefault {
|
||||
|
||||
Emulator.getThreading().run(new CloseGate(this, room), 1000);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRejected(RoomUnit roomUnit, Room room, Object[] objects) {
|
||||
if (roomUnit == null || room == null)
|
||||
return;
|
||||
|
||||
room.getHabbo(roomUnit).getClient().sendResponse(
|
||||
new CustomNotificationComposer(CustomNotificationComposer.GATE_NO_HC)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,8 @@
|
||||
package com.eu.habbo.habbohotel.items.interactions.interfaces;
|
||||
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
|
||||
public interface ConditionalGate {
|
||||
public void onRejected(RoomUnit roomUnit, Room room, Object[] objects);
|
||||
}
|
@ -4,7 +4,6 @@ import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomLayout;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||
@ -33,15 +32,36 @@ public class WiredConditionTriggerOnFurni extends InteractionWiredCondition {
|
||||
|
||||
@Override
|
||||
public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) {
|
||||
if (roomUnit == null) return false;
|
||||
if (roomUnit == null)
|
||||
return false;
|
||||
|
||||
this.refresh();
|
||||
|
||||
if (this.items.isEmpty())
|
||||
return false;
|
||||
|
||||
THashSet<HabboItem> itemsAtUser = room.getItemsAt(roomUnit.getCurrentLocation());
|
||||
return this.items.stream().anyMatch(itemsAtUser::contains);
|
||||
/*
|
||||
* 1. If a Habbo IS NOT walking we only have to check if the Habbo is on one of the selected tiles.
|
||||
* 2. If a Habbo IS walking we have to check if the next tile in the walking path is one of the selected items
|
||||
* */
|
||||
if (!roomUnit.isWalking()) {
|
||||
THashSet<HabboItem> itemsAtUser = room.getItemsAt(roomUnit.getCurrentLocation());
|
||||
return this.items.stream().anyMatch(itemsAtUser::contains);
|
||||
} else {
|
||||
RoomTile firstTileInPath = room.getLayout()
|
||||
.findPath(roomUnit.getCurrentLocation(), roomUnit.getGoal(), roomUnit.getGoal(), roomUnit)
|
||||
.peek();
|
||||
|
||||
if (firstTileInPath == null)
|
||||
return false;
|
||||
|
||||
return this.items
|
||||
.stream()
|
||||
.anyMatch(conditionItem -> conditionItem
|
||||
.getOccupyingTiles(room.getLayout())
|
||||
.contains(firstTileInPath)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -64,7 +84,7 @@ public class WiredConditionTriggerOnFurni extends InteractionWiredCondition {
|
||||
String[] data = set.getString("wired_data").split(";");
|
||||
|
||||
for (String s : data) {
|
||||
HabboItem item = room.getHabboItem(Integer.valueOf(s));
|
||||
HabboItem item = room.getHabboItem(Integer.parseInt(s));
|
||||
|
||||
if (item != null) {
|
||||
this.items.add(item);
|
||||
|
@ -19,6 +19,7 @@ import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class WiredEffectBotWalkToFurni extends InteractionWiredEffect {
|
||||
public static final WiredEffectType type = WiredEffectType.BOT_MOVE;
|
||||
@ -116,9 +117,14 @@ public class WiredEffectBotWalkToFurni extends InteractionWiredEffect {
|
||||
Bot bot = bots.get(0);
|
||||
this.items.removeIf(item -> item == null || item.getRoomId() != this.getRoomId() || Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(item.getId()) == null);
|
||||
|
||||
// wtf was that
|
||||
if (this.items.size() > 0) {
|
||||
HabboItem item = this.items.get(Emulator.getRandom().nextInt(this.items.size()));
|
||||
// Bots shouldn't walk to the tile they are already standing on
|
||||
List<HabboItem> possibleItems = this.items.stream()
|
||||
.filter(item -> !room.getBotsOnItem(item).contains(bot))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// Get a random tile of possible tiles to walk to
|
||||
if (possibleItems.size() > 0) {
|
||||
HabboItem item = possibleItems.get(Emulator.getRandom().nextInt(possibleItems.size()));
|
||||
|
||||
if (item.getRoomId() != 0 && item.getRoomId() == bot.getRoom().getId()) {
|
||||
bot.getRoomUnit().setGoalLocation(room.getLayout().getTile(item.getX(), item.getY()));
|
||||
|
@ -73,7 +73,6 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.awt.*;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
@ -3864,20 +3863,27 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: Return Enum
|
||||
public int guildRightLevel(Habbo habbo) {
|
||||
public RoomRightLevels getGuildRightLevel(Habbo habbo) {
|
||||
if (this.guild > 0 && habbo.getHabboStats().hasGuild(this.guild)) {
|
||||
Guild guild = Emulator.getGameEnvironment().getGuildManager().getGuild(this.guild);
|
||||
|
||||
if (Emulator.getGameEnvironment().getGuildManager().getOnlyAdmins(guild).get(habbo.getHabboInfo().getId()) != null)
|
||||
return 3;
|
||||
return RoomRightLevels.GUILD_ADMIN;
|
||||
|
||||
if (guild.getRights()) {
|
||||
return 2;
|
||||
return RoomRightLevels.GUILD_RIGHTS;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return RoomRightLevels.NONE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Deprecated since 2.5.0. Use {@link #getGuildRightLevel(Habbo)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public int guildRightLevel(Habbo habbo) {
|
||||
return this.getGuildRightLevel(habbo).level;
|
||||
}
|
||||
|
||||
public boolean isOwner(Habbo habbo) {
|
||||
@ -3994,16 +4000,9 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
} else if (this.hasRights(habbo) && !this.hasGuild()) {
|
||||
flatCtrl = RoomRightLevels.RIGHTS;
|
||||
} else if (this.hasGuild()) {
|
||||
int level = this.guildRightLevel(habbo);
|
||||
|
||||
if (level == 3) {
|
||||
flatCtrl = RoomRightLevels.GUILD_ADMIN;
|
||||
} else if (level == 2) {
|
||||
flatCtrl = RoomRightLevels.GUILD_RIGHTS;
|
||||
}
|
||||
flatCtrl = this.getGuildRightLevel(habbo);
|
||||
}
|
||||
|
||||
|
||||
habbo.getClient().sendResponse(new RoomRightsComposer(flatCtrl));
|
||||
habbo.getRoomUnit().setStatus(RoomUnitStatus.FLAT_CONTROL, flatCtrl.level + "");
|
||||
habbo.getRoomUnit().setRightsLevel(flatCtrl);
|
||||
@ -4445,7 +4444,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
}
|
||||
|
||||
rotation %= 8;
|
||||
if (this.hasRights(habbo) || this.guildRightLevel(habbo) >= 2 || habbo.hasPermission(Permission.ACC_MOVEROTATE)) {
|
||||
if (this.hasRights(habbo) || this.getGuildRightLevel(habbo).isEqualOrGreaterThan(RoomRightLevels.GUILD_RIGHTS) || habbo.hasPermission(Permission.ACC_MOVEROTATE)) {
|
||||
return FurnitureMovementError.NONE;
|
||||
}
|
||||
|
||||
@ -4560,7 +4559,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
}
|
||||
|
||||
public FurnitureMovementError placeWallFurniAt(HabboItem item, String wallPosition, Habbo owner) {
|
||||
if (!(this.hasRights(owner) || this.guildRightLevel(owner) >= 2)) {
|
||||
if (!(this.hasRights(owner) || this.getGuildRightLevel(owner).isEqualOrGreaterThan(RoomRightLevels.GUILD_RIGHTS))) {
|
||||
return FurnitureMovementError.NO_RIGHTS;
|
||||
}
|
||||
|
||||
@ -4800,4 +4799,4 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||
THashSet<RoomUnit> roomUnits = getRoomUnits();
|
||||
return roomUnits.stream().filter(unit -> unit.getCurrentLocation() == tile).collect(Collectors.toSet());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -531,14 +531,14 @@ public class RoomManager {
|
||||
habbo.hasPermission(Permission.ACC_ENTERANYROOM) ||
|
||||
room.hasRights(habbo) ||
|
||||
(room.getState().equals(RoomState.INVISIBLE) && room.hasRights(habbo)) ||
|
||||
(room.hasGuild() && room.guildRightLevel(habbo) > 2)) {
|
||||
(room.hasGuild() && room.getGuildRightLevel(habbo).isGreaterThan(RoomRightLevels.GUILD_RIGHTS))) {
|
||||
this.openRoom(habbo, room, doorLocation);
|
||||
} else if (room.getState() == RoomState.LOCKED) {
|
||||
boolean rightsFound = false;
|
||||
|
||||
synchronized (room.roomUnitLock) {
|
||||
for (Habbo current : room.getHabbos()) {
|
||||
if (room.hasRights(current) || current.getHabboInfo().getId() == room.getOwnerId() || (room.hasGuild() && room.guildRightLevel(current) >= 2)) {
|
||||
if (room.hasRights(current) || current.getHabboInfo().getId() == room.getOwnerId() || (room.hasGuild() && room.getGuildRightLevel(current).isEqualOrGreaterThan(RoomRightLevels.GUILD_RIGHTS))) {
|
||||
current.getClient().sendResponse(new DoorbellAddUserComposer(habbo.getHabboInfo().getUsername()));
|
||||
rightsFound = true;
|
||||
}
|
||||
@ -875,7 +875,7 @@ public class RoomManager {
|
||||
|
||||
habbo.getClient().sendResponse(new RoomUsersGuildBadgesComposer(guildBadges));
|
||||
|
||||
if (room.hasRights(habbo) || (room.hasGuild() && room.guildRightLevel(habbo) >= 2)) {
|
||||
if (room.hasRights(habbo) || (room.hasGuild() && room.getGuildRightLevel(habbo).isEqualOrGreaterThan(RoomRightLevels.GUILD_RIGHTS))) {
|
||||
if (!room.getHabboQueue().isEmpty()) {
|
||||
for (Habbo waiting : room.getHabboQueue().valueCollection()) {
|
||||
habbo.getClient().sendResponse(new DoorbellAddUserComposer(waiting.getHabboInfo().getUsername()));
|
||||
@ -1555,4 +1555,4 @@ public class RoomManager {
|
||||
this.duration = duration;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -36,4 +36,20 @@ public enum RoomRightLevels {
|
||||
RoomRightLevels(int level) {
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
public boolean equals(RoomRightLevels level) {
|
||||
return this.level == level.level;
|
||||
}
|
||||
|
||||
public boolean isEqualOrGreaterThan(RoomRightLevels level) {
|
||||
return this.level >= level.level;
|
||||
}
|
||||
|
||||
public boolean isGreaterThan(RoomRightLevels level) {
|
||||
return this.level > level.level;
|
||||
}
|
||||
|
||||
public boolean isLessThan(RoomRightLevels level) {
|
||||
return this.level < level.level;
|
||||
}
|
||||
}
|
||||
|
@ -3,16 +3,13 @@ package com.eu.habbo.habbohotel.rooms;
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.bots.Bot;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionGuildGate;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionHabboClubGate;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWater;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWaterItem;
|
||||
import com.eu.habbo.habbohotel.items.interactions.*;
|
||||
import com.eu.habbo.habbohotel.items.interactions.interfaces.ConditionalGate;
|
||||
import com.eu.habbo.habbohotel.pets.Pet;
|
||||
import com.eu.habbo.habbohotel.pets.RideablePet;
|
||||
import com.eu.habbo.habbohotel.users.DanceType;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||
import com.eu.habbo.messages.outgoing.generic.alerts.CustomNotificationComposer;
|
||||
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserStatusComposer;
|
||||
import com.eu.habbo.plugin.Event;
|
||||
import com.eu.habbo.plugin.events.roomunit.RoomUnitLookAtPointEvent;
|
||||
@ -301,17 +298,16 @@ public class RoomUnit {
|
||||
if (item != habboItem || !RoomLayout.pointInSquare(item.getX(), item.getY(), item.getX() + item.getBaseItem().getWidth() - 1, item.getY() + item.getBaseItem().getLength() - 1, this.getX(), this.getY())) {
|
||||
if (item.canWalkOn(this, room, null)) {
|
||||
item.onWalkOn(this, room, new Object[]{this.getCurrentLocation(), next});
|
||||
} else if (item instanceof InteractionGuildGate || item instanceof InteractionHabboClubGate) {
|
||||
} else if (item instanceof ConditionalGate) {
|
||||
this.setRotation(oldRotation);
|
||||
this.tilesWalked--;
|
||||
this.setGoalLocation(this.currentLocation);
|
||||
this.status.remove(RoomUnitStatus.MOVE);
|
||||
room.sendComposer(new RoomUserStatusComposer(this).compose());
|
||||
|
||||
if (item instanceof InteractionHabboClubGate && habbo != null) {
|
||||
habbo.getClient().sendResponse(new CustomNotificationComposer(CustomNotificationComposer.GATE_NO_HC));
|
||||
if (habbo != null) {
|
||||
((ConditionalGate) item).onRejected(this, this.getRoom(), new Object[]{});
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
|
@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.items.interactions.InteractionMoodLight;
|
||||
import com.eu.habbo.habbohotel.modtool.ScripterManager;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomMoodlightData;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomRightLevels;
|
||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||
import com.eu.habbo.messages.incoming.MessageHandler;
|
||||
import com.eu.habbo.messages.outgoing.rooms.items.MoodLightDataComposer;
|
||||
@ -20,7 +21,7 @@ public class MoodLightSaveSettingsEvent extends MessageHandler {
|
||||
public void handle() throws Exception {
|
||||
Room room = this.client.getHabbo().getHabboInfo().getCurrentRoom();
|
||||
|
||||
if ((room.getGuildId() <= 0 && room.guildRightLevel(this.client.getHabbo()) < 2) && !room.hasRights(this.client.getHabbo()))
|
||||
if ((room.getGuildId() <= 0 && room.getGuildRightLevel(this.client.getHabbo()).isLessThan(RoomRightLevels.GUILD_RIGHTS)) && !room.hasRights(this.client.getHabbo()))
|
||||
return;
|
||||
|
||||
int id = this.packet.readInt();
|
||||
|
@ -4,6 +4,7 @@ import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionMoodLight;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomMoodlightData;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomRightLevels;
|
||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||
import com.eu.habbo.messages.incoming.MessageHandler;
|
||||
|
||||
@ -12,7 +13,7 @@ public class MoodLightTurnOnEvent extends MessageHandler {
|
||||
public void handle() throws Exception {
|
||||
Room room = this.client.getHabbo().getHabboInfo().getCurrentRoom();
|
||||
|
||||
if ((room.getGuildId() > 0 && room.guildRightLevel(this.client.getHabbo()) < 2) && !room.hasRights(this.client.getHabbo()))
|
||||
if ((room.getGuildId() > 0 && room.getGuildRightLevel(this.client.getHabbo()).isLessThan(RoomRightLevels.GUILD_RIGHTS)) && !room.hasRights(this.client.getHabbo()))
|
||||
return;
|
||||
|
||||
for (HabboItem moodLight : room.getRoomSpecialTypes().getItemsOfType(InteractionMoodLight.class)) {
|
||||
|
@ -3,6 +3,7 @@ package com.eu.habbo.messages.incoming.rooms.items;
|
||||
import com.eu.habbo.habbohotel.permissions.Permission;
|
||||
import com.eu.habbo.habbohotel.rooms.FurnitureMovementError;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomRightLevels;
|
||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||
import com.eu.habbo.messages.incoming.MessageHandler;
|
||||
import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertComposer;
|
||||
@ -16,7 +17,7 @@ public class MoveWallItemEvent extends MessageHandler {
|
||||
if (room == null)
|
||||
return;
|
||||
|
||||
if (!room.hasRights(this.client.getHabbo()) && !this.client.getHabbo().hasPermission(Permission.ACC_PLACEFURNI) && !(room.getGuildId() > 0 && room.guildRightLevel(this.client.getHabbo()) >= 2)) {
|
||||
if (!room.hasRights(this.client.getHabbo()) && !this.client.getHabbo().hasPermission(Permission.ACC_PLACEFURNI) && !(room.getGuildId() > 0 && room.getGuildRightLevel(this.client.getHabbo()).isEqualOrGreaterThan(RoomRightLevels.GUILD_RIGHTS))) {
|
||||
this.client.sendResponse(new BubbleAlertComposer(BubbleAlertKeys.FURNITURE_PLACEMENT_ERROR.key, FurnitureMovementError.NO_RIGHTS.errorCode));
|
||||
return;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.catalog.CatalogItem;
|
||||
import com.eu.habbo.habbohotel.catalog.CatalogPage;
|
||||
import com.eu.habbo.habbohotel.permissions.Permission;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomRightLevels;
|
||||
import com.eu.habbo.messages.incoming.MessageHandler;
|
||||
import com.eu.habbo.messages.outgoing.catalog.AlertPurchaseFailedComposer;
|
||||
import com.eu.habbo.messages.outgoing.catalog.PurchaseOKComposer;
|
||||
@ -35,7 +36,7 @@ public class BuyRoomPromotionEvent extends MessageHandler {
|
||||
if (this.client.getHabbo().getHabboInfo().canBuy(item)) {
|
||||
Room room = Emulator.getGameEnvironment().getRoomManager().getRoom(roomId);
|
||||
|
||||
if (!(room.isOwner(this.client.getHabbo()) || room.hasRights(this.client.getHabbo()) || room.guildRightLevel(this.client.getHabbo()) == 3)) {
|
||||
if (!(room.isOwner(this.client.getHabbo()) || room.hasRights(this.client.getHabbo()) || room.getGuildRightLevel(this.client.getHabbo()).equals(RoomRightLevels.GUILD_ADMIN))) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -4,22 +4,22 @@ import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||
|
||||
public class CloseGate implements Runnable {
|
||||
private final HabboItem guildGate;
|
||||
private final HabboItem gate;
|
||||
private final Room room;
|
||||
|
||||
public CloseGate(HabboItem guildGate, Room room) {
|
||||
this.guildGate = guildGate;
|
||||
public CloseGate(HabboItem gate, Room room) {
|
||||
this.gate = gate;
|
||||
this.room = room;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (this.guildGate.getRoomId() == this.room.getId()) {
|
||||
if (this.gate.getRoomId() == this.room.getId()) {
|
||||
if (this.room.isLoaded()) {
|
||||
if (this.room.getHabbosAt(this.guildGate.getX(), this.guildGate.getY()).isEmpty()) {
|
||||
this.guildGate.setExtradata("0");
|
||||
this.room.updateItem(this.guildGate);
|
||||
this.guildGate.needsUpdate(true);
|
||||
if (this.room.getHabbosAt(this.gate.getX(), this.gate.getY()).isEmpty()) {
|
||||
this.gate.setExtradata("0");
|
||||
this.room.updateItem(this.gate);
|
||||
this.gate.needsUpdate(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user