mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-27 00:40:52 +01:00
Added Sticky Limits to rooms (default 200 like habbo)
This commit is contained in:
parent
df2641f215
commit
78905c2a05
1
sqlupdates/2_3_1_TO_2_4_0-RC-1.sql
Normal file
1
sqlupdates/2_3_1_TO_2_4_0-RC-1.sql
Normal file
@ -0,0 +1 @@
|
|||||||
|
INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('hotel.room.stickies.max', '200');
|
@ -13,7 +13,9 @@ public enum FurnitureMovementError {
|
|||||||
TILE_HAS_BOTS("${room.error.cant_set_item}"),
|
TILE_HAS_BOTS("${room.error.cant_set_item}"),
|
||||||
MAX_DIMMERS("${room.error.max_dimmers}"),
|
MAX_DIMMERS("${room.error.max_dimmers}"),
|
||||||
MAX_SOUNDFURNI("${room.errors.max_soundfurni}"),
|
MAX_SOUNDFURNI("${room.errors.max_soundfurni}"),
|
||||||
MAX_ITEMS("${room.error.max_furniture}");
|
MAX_ITEMS("${room.error.max_furniture}"),
|
||||||
|
MAX_STICKIES("${room.error.max_stickies}");
|
||||||
|
|
||||||
|
|
||||||
public final String errorCode;
|
public final String errorCode;
|
||||||
|
|
||||||
|
@ -86,25 +86,19 @@ import java.util.concurrent.TimeUnit;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class Room implements Comparable<Room>, ISerialize, Runnable {
|
public class Room implements Comparable<Room>, ISerialize, Runnable {
|
||||||
public static final Comparator SORT_SCORE = new Comparator() {
|
public static final Comparator SORT_SCORE = (o1, o2) -> {
|
||||||
@Override
|
|
||||||
public int compare(Object o1, Object o2) {
|
|
||||||
|
|
||||||
if (!(o1 instanceof Room && o2 instanceof Room))
|
if (!(o1 instanceof Room && o2 instanceof Room))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return ((Room) o2).getScore() - ((Room) o1).getScore();
|
return ((Room) o2).getScore() - ((Room) o1).getScore();
|
||||||
}
|
|
||||||
};
|
};
|
||||||
public static final Comparator SORT_ID = new Comparator() {
|
public static final Comparator SORT_ID = (o1, o2) -> {
|
||||||
@Override
|
|
||||||
public int compare(Object o1, Object o2) {
|
|
||||||
|
|
||||||
if (!(o1 instanceof Room && o2 instanceof Room))
|
if (!(o1 instanceof Room && o2 instanceof Room))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return ((Room) o2).getId() - ((Room) o1).getId();
|
return ((Room) o2).getId() - ((Room) o1).getId();
|
||||||
}
|
|
||||||
};
|
};
|
||||||
private static final TIntObjectHashMap<RoomMoodlightData> defaultMoodData = new TIntObjectHashMap<>();
|
private static final TIntObjectHashMap<RoomMoodlightData> defaultMoodData = new TIntObjectHashMap<>();
|
||||||
//Configuration. Loaded from database & updated accordingly.
|
//Configuration. Loaded from database & updated accordingly.
|
||||||
@ -112,6 +106,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
public static int MAXIMUM_BOTS = 10;
|
public static int MAXIMUM_BOTS = 10;
|
||||||
public static int MAXIMUM_PETS = 10;
|
public static int MAXIMUM_PETS = 10;
|
||||||
public static int MAXIMUM_FURNI = 2500;
|
public static int MAXIMUM_FURNI = 2500;
|
||||||
|
public static int MAXIMUM_POSTITNOTES = 200;
|
||||||
public static int HAND_ITEM_TIME = 10;
|
public static int HAND_ITEM_TIME = 10;
|
||||||
public static int IDLE_CYCLES = 240;
|
public static int IDLE_CYCLES = 240;
|
||||||
public static int IDLE_CYCLES_KICK = 480;
|
public static int IDLE_CYCLES_KICK = 480;
|
||||||
@ -427,6 +422,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
if (this.itemCount() > Room.MAXIMUM_FURNI) {
|
if (this.itemCount() > Room.MAXIMUM_FURNI) {
|
||||||
Emulator.getLogging().logErrorLine("Room ID: " + this.getId() + " has exceeded the furniture limit (" + this.itemCount() + " > " + Room.MAXIMUM_FURNI + ").");
|
Emulator.getLogging().logErrorLine("Room ID: " + this.getId() + " has exceeded the furniture limit (" + this.itemCount() + " > " + Room.MAXIMUM_FURNI + ").");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized void loadWiredData(Connection connection) {
|
private synchronized void loadWiredData(Connection connection) {
|
||||||
@ -2556,6 +2552,25 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public THashSet<HabboItem> getPostItNotes() {
|
||||||
|
THashSet<HabboItem> items = new THashSet<>();
|
||||||
|
TIntObjectIterator<HabboItem> iterator = this.roomItems.iterator();
|
||||||
|
|
||||||
|
for (int i = this.roomItems.size(); i-- > 0; ) {
|
||||||
|
try {
|
||||||
|
iterator.advance();
|
||||||
|
} catch (Exception e) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (iterator.value().getBaseItem().getInteractionType().getType() == InteractionPostIt.class)
|
||||||
|
items.add(iterator.value());
|
||||||
|
}
|
||||||
|
|
||||||
|
return items;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public void addHabbo(Habbo habbo) {
|
public void addHabbo(Habbo habbo) {
|
||||||
synchronized (this.roomUnitLock) {
|
synchronized (this.roomUnitLock) {
|
||||||
habbo.getRoomUnit().setId(this.unitCounter);
|
habbo.getRoomUnit().setId(this.unitCounter);
|
||||||
@ -4340,6 +4355,8 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
return FurnitureMovementError.MAX_ITEMS;
|
return FurnitureMovementError.MAX_ITEMS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
rotation %= 8;
|
rotation %= 8;
|
||||||
if (this.hasRights(habbo) || this.guildRightLevel(habbo) >= 2 || habbo.hasPermission(Permission.ACC_MOVEROTATE)) {
|
if (this.hasRights(habbo) || this.guildRightLevel(habbo) >= 2 || habbo.hasPermission(Permission.ACC_MOVEROTATE)) {
|
||||||
return FurnitureMovementError.NONE;
|
return FurnitureMovementError.NONE;
|
||||||
|
@ -4,9 +4,12 @@ import com.eu.habbo.Emulator;
|
|||||||
import com.eu.habbo.habbohotel.achievements.AchievementManager;
|
import com.eu.habbo.habbohotel.achievements.AchievementManager;
|
||||||
import com.eu.habbo.habbohotel.items.interactions.InteractionPostIt;
|
import com.eu.habbo.habbohotel.items.interactions.InteractionPostIt;
|
||||||
import com.eu.habbo.habbohotel.items.interactions.InteractionStickyPole;
|
import com.eu.habbo.habbohotel.items.interactions.InteractionStickyPole;
|
||||||
|
import com.eu.habbo.habbohotel.rooms.FurnitureMovementError;
|
||||||
import com.eu.habbo.habbohotel.rooms.Room;
|
import com.eu.habbo.habbohotel.rooms.Room;
|
||||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||||
import com.eu.habbo.messages.incoming.MessageHandler;
|
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.inventory.RemoveHabboItemComposer;
|
import com.eu.habbo.messages.outgoing.inventory.RemoveHabboItemComposer;
|
||||||
import com.eu.habbo.messages.outgoing.rooms.items.AddWallItemComposer;
|
import com.eu.habbo.messages.outgoing.rooms.items.AddWallItemComposer;
|
||||||
|
|
||||||
@ -23,21 +26,27 @@ public class PostItPlaceEvent extends MessageHandler {
|
|||||||
HabboItem item = this.client.getHabbo().getInventory().getItemsComponent().getHabboItem(itemId);
|
HabboItem item = this.client.getHabbo().getInventory().getItemsComponent().getHabboItem(itemId);
|
||||||
|
|
||||||
if (item instanceof InteractionPostIt) {
|
if (item instanceof InteractionPostIt) {
|
||||||
room.addHabboItem(item);
|
if (room.getPostItNotes().size() < Room.MAXIMUM_POSTITNOTES) {
|
||||||
item.setExtradata("FFFF33");
|
room.addHabboItem(item);
|
||||||
item.setRoomId(this.client.getHabbo().getHabboInfo().getCurrentRoom().getId());
|
item.setExtradata("FFFF33");
|
||||||
item.setWallPosition(location);
|
item.setRoomId(this.client.getHabbo().getHabboInfo().getCurrentRoom().getId());
|
||||||
item.setUserId(this.client.getHabbo().getHabboInfo().getId());
|
item.setWallPosition(location);
|
||||||
item.needsUpdate(true);
|
item.setUserId(this.client.getHabbo().getHabboInfo().getId());
|
||||||
room.sendComposer(new AddWallItemComposer(item, this.client.getHabbo().getHabboInfo().getUsername()).compose());
|
item.needsUpdate(true);
|
||||||
this.client.getHabbo().getInventory().getItemsComponent().removeHabboItem(item);
|
room.sendComposer(new AddWallItemComposer(item, this.client.getHabbo().getHabboInfo().getUsername()).compose());
|
||||||
this.client.sendResponse(new RemoveHabboItemComposer(item.getGiftAdjustedId()));
|
this.client.getHabbo().getInventory().getItemsComponent().removeHabboItem(item);
|
||||||
item.setFromGift(false);
|
this.client.sendResponse(new RemoveHabboItemComposer(item.getGiftAdjustedId()));
|
||||||
Emulator.getThreading().run(item);
|
item.setFromGift(false);
|
||||||
|
Emulator.getThreading().run(item);
|
||||||
|
|
||||||
if (room.getOwnerId() != this.client.getHabbo().getHabboInfo().getId()) {
|
if (room.getOwnerId() != this.client.getHabbo().getHabboInfo().getId()) {
|
||||||
AchievementManager.progressAchievement(room.getOwnerId(), Emulator.getGameEnvironment().getAchievementManager().getAchievement("NotesReceived"));
|
AchievementManager.progressAchievement(room.getOwnerId(), Emulator.getGameEnvironment().getAchievementManager().getAchievement("NotesReceived"));
|
||||||
AchievementManager.progressAchievement(this.client.getHabbo().getHabboInfo().getId(), Emulator.getGameEnvironment().getAchievementManager().getAchievement("NotesLeft"));
|
AchievementManager.progressAchievement(this.client.getHabbo().getHabboInfo().getId(), Emulator.getGameEnvironment().getAchievementManager().getAchievement("NotesLeft"));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.client.sendResponse(new BubbleAlertComposer(BubbleAlertKeys.FURNITURE_PLACEMENT_ERROR.key, FurnitureMovementError.MAX_STICKIES.errorCode));
|
||||||
}
|
}
|
||||||
|
|
||||||
//this.client.sendResponse(new PostItStickyPoleOpenComposer(item));
|
//this.client.sendResponse(new PostItStickyPoleOpenComposer(item));
|
||||||
|
@ -91,6 +91,7 @@ public class PluginManager {
|
|||||||
Room.MAXIMUM_BOTS = Emulator.getConfig().getInt("hotel.max.bots.room");
|
Room.MAXIMUM_BOTS = Emulator.getConfig().getInt("hotel.max.bots.room");
|
||||||
Room.MAXIMUM_PETS = Emulator.getConfig().getInt("hotel.pets.max.room");
|
Room.MAXIMUM_PETS = Emulator.getConfig().getInt("hotel.pets.max.room");
|
||||||
Room.MAXIMUM_FURNI = Emulator.getConfig().getInt("hotel.room.furni.max", 2500);
|
Room.MAXIMUM_FURNI = Emulator.getConfig().getInt("hotel.room.furni.max", 2500);
|
||||||
|
Room.MAXIMUM_POSTITNOTES = Emulator.getConfig().getInt("hotel.room.stickies.max", 200);
|
||||||
Room.HAND_ITEM_TIME = Emulator.getConfig().getInt("hotel.rooms.handitem.time");
|
Room.HAND_ITEM_TIME = Emulator.getConfig().getInt("hotel.rooms.handitem.time");
|
||||||
Room.IDLE_CYCLES = Emulator.getConfig().getInt("hotel.roomuser.idle.cycles", 240);
|
Room.IDLE_CYCLES = Emulator.getConfig().getInt("hotel.roomuser.idle.cycles", 240);
|
||||||
Room.IDLE_CYCLES_KICK = Emulator.getConfig().getInt("hotel.roomuser.idle.cycles.kick", 480);
|
Room.IDLE_CYCLES_KICK = Emulator.getConfig().getInt("hotel.roomuser.idle.cycles.kick", 480);
|
||||||
|
Loading…
Reference in New Issue
Block a user