Compare commits
10 Commits
6e59026141
...
06efcfddeb
Author | SHA1 | Date | |
---|---|---|---|
![]() |
06efcfddeb | ||
![]() |
259a717b42 | ||
![]() |
bed68e1618 | ||
![]() |
55d0c15e57 | ||
![]() |
450cddfbf1 | ||
![]() |
603a2d6e33 | ||
![]() |
d1ff6687d6 | ||
![]() |
3332bc7f9c | ||
![]() |
31fd5f2b31 | ||
![]() |
3cafc02a02 |
4
Database Updates/UpdateDatabase_Banners.sql
Normal file
4
Database Updates/UpdateDatabase_Banners.sql
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
ALTER TABLE `users`
|
||||||
|
ADD COLUMN `background_id` INT(11) NOT NULL DEFAULT 0 AFTER `machine_id`,
|
||||||
|
ADD COLUMN `background_stand_id` INT(11) NOT NULL DEFAULT 0 AFTER `background_id`,
|
||||||
|
ADD COLUMN `background_overlay_id` INT(11) NOT NULL DEFAULT 0 AFTER `background_stand_id`;
|
@ -1,2 +1,2 @@
|
|||||||
--New permission
|
--New permission
|
||||||
ALTER TABLE `permissions` ADD COLUMN `acc_unignorable` ENUM('0','1') NOT NULL DEFAULT '0' AFTER `acc_infinite_friends`;
|
ALTER TABLE `permissions` ADD COLUMN `acc_unignorable` ENUM('0','1') NOT NULL DEFAULT '0';
|
||||||
|
2
Emulator/.idea/misc.xml
generated
2
Emulator/.idea/misc.xml
generated
@ -8,5 +8,5 @@
|
|||||||
</list>
|
</list>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="openjdk-21" project-jdk-type="JavaSDK" />
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_23" default="true" project-jdk-name="openjdk-23" project-jdk-type="JavaSDK" />
|
||||||
</project>
|
</project>
|
@ -25,6 +25,9 @@ public class RoomUserPetComposer extends MessageComposer {
|
|||||||
this.response.appendInt(this.habbo.getHabboInfo().getId());
|
this.response.appendInt(this.habbo.getHabboInfo().getId());
|
||||||
this.response.appendString(this.habbo.getHabboInfo().getUsername());
|
this.response.appendString(this.habbo.getHabboInfo().getUsername());
|
||||||
this.response.appendString("");
|
this.response.appendString("");
|
||||||
|
this.response.appendInt(0);
|
||||||
|
this.response.appendInt(0);
|
||||||
|
this.response.appendInt(0);
|
||||||
this.response.appendString(this.petType + " " + this.race + " " + this.color + " 2 2 -1 0 3 -1 0");
|
this.response.appendString(this.petType + " " + this.race + " " + this.color + " 2 2 -1 0 3 -1 0");
|
||||||
this.response.appendInt(this.habbo.getRoomUnit().getId());
|
this.response.appendInt(this.habbo.getRoomUnit().getId());
|
||||||
this.response.appendInt(this.habbo.getRoomUnit().getX());
|
this.response.appendInt(this.habbo.getRoomUnit().getX());
|
||||||
|
@ -26,14 +26,27 @@ public class SetSpeedCommand extends Command {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newSpeed < -1 || newSpeed > Emulator.getConfig().getInt("hotel.rollers.speed.maximum")) {
|
// First check against the config bounds
|
||||||
|
int configMax = Emulator.getConfig().getInt("hotel.rollers.speed.maximum");
|
||||||
|
if (newSpeed < -1 || newSpeed > configMax) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_setspeed.bounds"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_setspeed.bounds"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Enforce maximum speed of 10 regardless of config.
|
||||||
|
if (newSpeed > 10) {
|
||||||
|
newSpeed = 10;
|
||||||
|
gameClient.getHabbo().whisper("Speed cannot be set above 10. Setting speed to 10.", RoomChatMessageBubbles.ALERT);
|
||||||
|
}
|
||||||
|
|
||||||
room.setRollerSpeed(newSpeed);
|
room.setRollerSpeed(newSpeed);
|
||||||
|
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_setspeed").replace("%oldspeed%", oldSpeed + "").replace("%newspeed%", newSpeed + ""), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(
|
||||||
|
Emulator.getTexts().getValue("commands.succes.cmd_setspeed")
|
||||||
|
.replace("%oldspeed%", oldSpeed + "")
|
||||||
|
.replace("%newspeed%", newSpeed + ""),
|
||||||
|
RoomChatMessageBubbles.ALERT
|
||||||
|
);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -700,6 +700,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.sendComposer(new UpdateStackHeightComposer(this, updatedTiles).compose());
|
this.sendComposer(new UpdateStackHeightComposer(this, updatedTiles).compose());
|
||||||
this.updateTiles(updatedTiles);
|
this.updateTiles(updatedTiles);
|
||||||
for (RoomTile tile : updatedTiles) {
|
for (RoomTile tile : updatedTiles) {
|
||||||
@ -1188,6 +1189,47 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isOnRoller(RoomUnit unit) {
|
||||||
|
RoomTile currentTile = unit.getCurrentLocation();
|
||||||
|
// Iterate over all rollers in the room.
|
||||||
|
for (HabboItem roller : this.roomSpecialTypes.getRollers().values()) {
|
||||||
|
if (roller.getX() == currentTile.x && roller.getY() == currentTile.y) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private final Map<RoomUnit, LoopTracker> loopTrackers = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
private static class LoopTracker {
|
||||||
|
double x, y, z;
|
||||||
|
int counter;
|
||||||
|
RoomTile nextTile;
|
||||||
|
|
||||||
|
public LoopTracker(double x, double y, double z, RoomTile nextTile) {
|
||||||
|
this.x = x;
|
||||||
|
this.y = y;
|
||||||
|
this.z = z;
|
||||||
|
this.counter = 0;
|
||||||
|
this.nextTile = nextTile;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSamePosition(double newX, double newY, double newZ) {
|
||||||
|
// Use an epsilon for double comparison if necessary.
|
||||||
|
final double EPSILON = 0.001;
|
||||||
|
return Math.abs(newX - x) < EPSILON && Math.abs(newY - y) < EPSILON && Math.abs(newZ - z) < EPSILON;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update(double newX, double newY, double newZ, RoomTile nextTile) {
|
||||||
|
this.x = newX;
|
||||||
|
this.y = newY;
|
||||||
|
this.z = newZ;
|
||||||
|
this.counter = 0;
|
||||||
|
this.nextTile = nextTile;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void cycle() {
|
private void cycle() {
|
||||||
this.cycleOdd = !this.cycleOdd;
|
this.cycleOdd = !this.cycleOdd;
|
||||||
this.cycleTimestamp = System.currentTimeMillis();
|
this.cycleTimestamp = System.currentTimeMillis();
|
||||||
@ -1237,6 +1279,98 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
final long millis = System.currentTimeMillis();
|
final long millis = System.currentTimeMillis();
|
||||||
|
|
||||||
for (Habbo habbo : this.currentHabbos.values()) {
|
for (Habbo habbo : this.currentHabbos.values()) {
|
||||||
|
RoomUnit unit = habbo.getRoomUnit();
|
||||||
|
if (!unit.hasStatus(RoomUnitStatus.MOVE) && isOnRoller(unit)) {
|
||||||
|
double curX = unit.getX();
|
||||||
|
double curY = unit.getY();
|
||||||
|
double curZ = unit.getZ();
|
||||||
|
|
||||||
|
LoopTracker tracker = loopTrackers.computeIfAbsent(unit, u -> {
|
||||||
|
RoomTile nextTile = null;
|
||||||
|
for (InteractionRoller roller : this.roomSpecialTypes.getRollers().values()) {
|
||||||
|
RoomTile rollerTile = this.getLayout().getTile((short) roller.getX(), (short) roller.getY());
|
||||||
|
RoomTile potentialNextTile = this.getLayout().getTileInFront(rollerTile, roller.getRotation());
|
||||||
|
if (potentialNextTile != null) {
|
||||||
|
nextTile = potentialNextTile;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new LoopTracker(curX, curY, curZ, nextTile);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (tracker.isSamePosition(curX, curY, curZ)) {
|
||||||
|
InteractionRoller currentRoller = null;
|
||||||
|
RoomTile currentTile = this.getLayout().getTile((short) curX, (short) curY);
|
||||||
|
for (InteractionRoller roller : this.roomSpecialTypes.getRollers().values()) {
|
||||||
|
if (roller.getX() == currentTile.x && roller.getY() == currentTile.y) {
|
||||||
|
currentRoller = roller;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RoomTile currentCalculatedNextTile = null;
|
||||||
|
if (currentRoller != null) {
|
||||||
|
RoomTile rollerTile = this.getLayout().getTile((short) currentRoller.getX(), (short) currentRoller.getY());
|
||||||
|
currentCalculatedNextTile = this.getLayout().getTileInFront(rollerTile, currentRoller.getRotation());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currentTile != null && unit.getGoal() != null) {
|
||||||
|
double distanceToGoal = Math.hypot(unit.getGoal().x - currentTile.x, unit.getGoal().y - currentTile.y);
|
||||||
|
final double ACCEPTABLE_DISTANCE = 0.5; // adjust as needed
|
||||||
|
if (distanceToGoal <= ACCEPTABLE_DISTANCE) {
|
||||||
|
tracker.update(curX, curY, curZ, currentCalculatedNextTile);
|
||||||
|
tracker.counter = 0;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean nextTileHasRoller = false;
|
||||||
|
if (currentCalculatedNextTile != null) {
|
||||||
|
for (InteractionRoller roller : this.roomSpecialTypes.getRollers().values()) {
|
||||||
|
if (roller.getX() == currentCalculatedNextTile.x && roller.getY() == currentCalculatedNextTile.y) {
|
||||||
|
nextTileHasRoller = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currentCalculatedNextTile != null && !nextTileHasRoller) {
|
||||||
|
tracker.update(curX, curY, curZ, currentCalculatedNextTile);
|
||||||
|
tracker.counter = 0;
|
||||||
|
} else {
|
||||||
|
if (unit.getGoal() != null && tracker.nextTile != null &&
|
||||||
|
unit.getGoal().x == tracker.nextTile.x && unit.getGoal().y == tracker.nextTile.y) {
|
||||||
|
tracker.counter = 0;
|
||||||
|
} else {
|
||||||
|
tracker.counter++;
|
||||||
|
int loopThreshold = Math.max(10, 3 + this.getRollerSpeed());
|
||||||
|
if (tracker.counter >= loopThreshold) {
|
||||||
|
RoomTile doorTile = this.getLayout().getDoorTile();
|
||||||
|
unit.setBodyRotation(RoomUserRotation.values()[this.getLayout().getDoorDirection()]);
|
||||||
|
unit.setHeadRotation(RoomUserRotation.values()[this.getLayout().getDoorDirection()]);
|
||||||
|
this.teleportRoomUnitToLocation(unit, doorTile.x, doorTile.y, doorTile.z);
|
||||||
|
tracker.counter = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
InteractionRoller currentRoller = null;
|
||||||
|
RoomTile currentTile = this.getLayout().getTile((short) curX, (short) curY);
|
||||||
|
for (InteractionRoller roller : this.roomSpecialTypes.getRollers().values()) {
|
||||||
|
if (roller.getX() == currentTile.x && roller.getY() == currentTile.y) {
|
||||||
|
currentRoller = roller;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
RoomTile nextTile = null;
|
||||||
|
if (currentRoller != null) {
|
||||||
|
RoomTile rollerTile = this.getLayout().getTile((short) currentRoller.getX(), (short) currentRoller.getY());
|
||||||
|
nextTile = this.getLayout().getTileInFront(rollerTile, currentRoller.getRotation());
|
||||||
|
}
|
||||||
|
tracker.update(curX, curY, curZ, nextTile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!foundRightHolder[0]) {
|
if (!foundRightHolder[0]) {
|
||||||
foundRightHolder[0] = habbo.getRoomUnit().getRightsLevel() != RoomRightLevels.NONE;
|
foundRightHolder[0] = habbo.getRoomUnit().getRightsLevel() != RoomRightLevels.NONE;
|
||||||
}
|
}
|
||||||
@ -1288,7 +1422,6 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
this.sendComposer(new RoomUserIgnoredComposer(habbo, RoomUserIgnoredComposer.UNIGNORED).compose());
|
this.sendComposer(new RoomUserIgnoredComposer(habbo, RoomUserIgnoredComposer.UNIGNORED).compose());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Substract 1 from the chatCounter every odd cycle, which is every (500ms * 2).
|
|
||||||
if (this.cycleOdd && habbo.getHabboStats().chatCounter.get() > 0) {
|
if (this.cycleOdd && habbo.getHabboStats().chatCounter.get() > 0) {
|
||||||
habbo.getHabboStats().chatCounter.decrementAndGet();
|
habbo.getHabboStats().chatCounter.decrementAndGet();
|
||||||
}
|
}
|
||||||
@ -1368,6 +1501,22 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<InteractionRoller> rollers = new ArrayList<>(this.roomSpecialTypes.getRollers().values());
|
||||||
|
|
||||||
|
rollers.sort((r1, r2) -> {
|
||||||
|
double angle1 = Math.toRadians(r1.getRotation() * 45);
|
||||||
|
double angle2 = Math.toRadians(r2.getRotation() * 45);
|
||||||
|
|
||||||
|
double vx1 = Math.cos(angle1);
|
||||||
|
double vy1 = Math.sin(angle1);
|
||||||
|
double vx2 = Math.cos(angle2);
|
||||||
|
double vy2 = Math.sin(angle2);
|
||||||
|
|
||||||
|
double proj1 = r1.getX() * vx1 + r1.getY() * vy1;
|
||||||
|
double proj2 = r2.getX() * vx2 + r2.getY() * vy2;
|
||||||
|
|
||||||
|
return Double.compare(proj1, proj2);
|
||||||
|
});
|
||||||
if (this.rollerSpeed != -1 && this.rollerCycle >= this.rollerSpeed) {
|
if (this.rollerSpeed != -1 && this.rollerCycle >= this.rollerSpeed) {
|
||||||
this.rollerCycle = 0;
|
this.rollerCycle = 0;
|
||||||
|
|
||||||
@ -1396,7 +1545,6 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// itemsOnRoller.addAll(this.getItemsAt(rollerTile));
|
|
||||||
itemsOnRoller.remove(roller);
|
itemsOnRoller.remove(roller);
|
||||||
|
|
||||||
if (!rollerTile.hasUnits() && itemsOnRoller.isEmpty())
|
if (!rollerTile.hasUnits() && itemsOnRoller.isEmpty())
|
||||||
@ -1661,7 +1809,6 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private boolean cycleRoomUnit(RoomUnit unit, RoomUnitType type) {
|
private boolean cycleRoomUnit(RoomUnit unit, RoomUnitType type) {
|
||||||
boolean update = unit.needsStatusUpdate();
|
boolean update = unit.needsStatusUpdate();
|
||||||
if (unit.hasStatus(RoomUnitStatus.SIGN)) {
|
if (unit.hasStatus(RoomUnitStatus.SIGN)) {
|
||||||
@ -3003,6 +3150,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
|
|
||||||
return pets;
|
return pets;
|
||||||
}
|
}
|
||||||
|
|
||||||
public THashSet<Habbo> getHabbosAt(short x, short y) {
|
public THashSet<Habbo> getHabbosAt(short x, short y) {
|
||||||
return this.getHabbosAt(this.layout.getTile(x, y));
|
return this.getHabbosAt(this.layout.getTile(x, y));
|
||||||
}
|
}
|
||||||
@ -3087,8 +3235,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
roomUnit.setZ(z);
|
roomUnit.setZ(z);
|
||||||
roomUnit.setPreviousLocationZ(z);
|
roomUnit.setPreviousLocationZ(z);
|
||||||
this.updateRoomUnit(roomUnit);
|
this.updateRoomUnit(roomUnit);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4907,6 +5054,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public FurnitureMovementError slideFurniTo(HabboItem item, RoomTile tile, int rotation) {
|
public FurnitureMovementError slideFurniTo(HabboItem item, RoomTile tile, int rotation) {
|
||||||
|
|
||||||
RoomTile oldLocation = this.layout.getTile(item.getX(), item.getY());
|
RoomTile oldLocation = this.layout.getTile(item.getX(), item.getY());
|
||||||
|
|
||||||
HabboItem topItem = this.getTopItemAt(tile.x, tile.y);
|
HabboItem topItem = this.getTopItemAt(tile.x, tile.y);
|
||||||
@ -4930,6 +5078,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
item.setRotation(rotation);
|
item.setRotation(rotation);
|
||||||
|
|
||||||
//Place at new position
|
//Place at new position
|
||||||
|
|
||||||
if (magicTile) {
|
if (magicTile) {
|
||||||
item.setZ(tile.z);
|
item.setZ(tile.z);
|
||||||
item.setExtradata("" + item.getZ() * 100);
|
item.setExtradata("" + item.getZ() * 100);
|
||||||
|
@ -48,12 +48,24 @@ public class RoomChatMessage implements Runnable, ISerialize, DatabaseLoggable {
|
|||||||
} else {
|
} else {
|
||||||
this.message = message.packet.readString();
|
this.message = message.packet.readString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.habbo = message.client.getHabbo();
|
||||||
|
this.roomUnitId = this.habbo.getRoomUnit().getId();
|
||||||
|
|
||||||
|
RoomChatMessageBubbles userBubble = this.habbo.getHabboStats().chatColor;
|
||||||
|
|
||||||
|
int bubbleId = message.packet.readInt();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.bubble = RoomChatMessageBubbles.getBubble(message.packet.readInt());
|
this.bubble = RoomChatMessageBubbles.getBubble(bubbleId);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
this.bubble = RoomChatMessageBubbles.NORMAL;
|
this.bubble = RoomChatMessageBubbles.NORMAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (userBubble != null && this.bubble.isOverridable()) {
|
||||||
|
this.bubble = userBubble;
|
||||||
|
}
|
||||||
|
|
||||||
this.RoomChatColour = message.packet.readString();
|
this.RoomChatColour = message.packet.readString();
|
||||||
|
|
||||||
if (!message.client.getHabbo().hasPermission(Permission.ACC_ANYCHATCOLOR)) {
|
if (!message.client.getHabbo().hasPermission(Permission.ACC_ANYCHATCOLOR)) {
|
||||||
@ -65,13 +77,9 @@ public class RoomChatMessage implements Runnable, ISerialize, DatabaseLoggable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.habbo = message.client.getHabbo();
|
|
||||||
this.roomUnitId = this.habbo.getRoomUnit().getId();
|
|
||||||
this.unfilteredMessage = this.message;
|
this.unfilteredMessage = this.message;
|
||||||
this.timestamp = Emulator.getIntUnixTimestamp();
|
this.timestamp = Emulator.getIntUnixTimestamp();
|
||||||
|
|
||||||
this.checkEmotion();
|
this.checkEmotion();
|
||||||
|
|
||||||
this.filter();
|
this.filter();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,6 +42,9 @@ public class HabboInfo implements Runnable {
|
|||||||
private int lastOnline;
|
private int lastOnline;
|
||||||
private int homeRoom;
|
private int homeRoom;
|
||||||
private boolean online;
|
private boolean online;
|
||||||
|
private int InfostandBg;
|
||||||
|
private int InfostandStand;
|
||||||
|
private int InfostandOverlay;
|
||||||
private int loadingRoom;
|
private int loadingRoom;
|
||||||
private Room currentRoom;
|
private Room currentRoom;
|
||||||
private int roomQueueId;
|
private int roomQueueId;
|
||||||
@ -72,8 +75,8 @@ public class HabboInfo implements Runnable {
|
|||||||
this.rank = Emulator.getGameEnvironment().getPermissionsManager().getRank(set.getInt("rank"));
|
this.rank = Emulator.getGameEnvironment().getPermissionsManager().getRank(set.getInt("rank"));
|
||||||
|
|
||||||
if (this.rank == null) {
|
if (this.rank == null) {
|
||||||
LOGGER.error("No existing rank found with id {}. Make sure an entry in the permissions table exists.", set.getInt("rank"));
|
LOGGER.error("No existing rank found with id " + set.getInt("rank") + ". Make sure an entry in the permissions table exists.");
|
||||||
LOGGER.warn("{} has an invalid rank with id {}. Make sure an entry in the permissions table exists.", this.username, set.getInt("rank"));
|
LOGGER.warn(this.username + " has an invalid rank with id " + set.getInt("rank") + ". Make sure an entry in the permissions table exists.");
|
||||||
this.rank = Emulator.getGameEnvironment().getPermissionsManager().getRank(1);
|
this.rank = Emulator.getGameEnvironment().getPermissionsManager().getRank(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,6 +86,9 @@ public class HabboInfo implements Runnable {
|
|||||||
this.lastOnline = set.getInt("last_online");
|
this.lastOnline = set.getInt("last_online");
|
||||||
this.machineID = set.getString("machine_id");
|
this.machineID = set.getString("machine_id");
|
||||||
this.online = false;
|
this.online = false;
|
||||||
|
this.InfostandBg = set.getInt("background_id");
|
||||||
|
this.InfostandStand = set.getInt("background_stand_id");
|
||||||
|
this.InfostandOverlay = set.getInt("background_overlay_id");
|
||||||
this.currentRoom = null;
|
this.currentRoom = null;
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
LOGGER.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
@ -270,6 +276,29 @@ public class HabboInfo implements Runnable {
|
|||||||
this.motto = motto;
|
this.motto = motto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getInfostandBg() {
|
||||||
|
return InfostandBg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInfostandBg(int infostandBg) {
|
||||||
|
InfostandBg = infostandBg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getInfostandStand() {
|
||||||
|
return InfostandStand;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInfostandStand(int infostandStand) {
|
||||||
|
InfostandStand = infostandStand;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getInfostandOverlay() {
|
||||||
|
return InfostandOverlay;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInfostandOverlay(int infostandOverlay) {
|
||||||
|
InfostandOverlay = infostandOverlay;
|
||||||
|
}
|
||||||
public Rank getRank() {
|
public Rank getRank() {
|
||||||
return this.rank;
|
return this.rank;
|
||||||
}
|
}
|
||||||
@ -537,7 +566,7 @@ public class HabboInfo implements Runnable {
|
|||||||
public void run() {
|
public void run() {
|
||||||
this.saveCurrencies();
|
this.saveCurrencies();
|
||||||
|
|
||||||
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("UPDATE users SET motto = ?, online = ?, look = ?, gender = ?, credits = ?, last_login = ?, last_online = ?, home_room = ?, ip_current = ?, `rank` = ?, machine_id = ?, username = ? WHERE id = ?")) {
|
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("UPDATE users SET motto = ?, online = ?, look = ?, gender = ?, credits = ?, last_login = ?, last_online = ?, home_room = ?, ip_current = ?, `rank` = ?, machine_id = ?, username = ?, background_id = ?, background_stand_id = ?, background_overlay_id = ? WHERE id = ?")) {
|
||||||
statement.setString(1, this.motto);
|
statement.setString(1, this.motto);
|
||||||
statement.setString(2, this.online ? "1" : "0");
|
statement.setString(2, this.online ? "1" : "0");
|
||||||
statement.setString(3, this.look);
|
statement.setString(3, this.look);
|
||||||
@ -550,7 +579,10 @@ public class HabboInfo implements Runnable {
|
|||||||
statement.setInt(10, this.rank != null ? this.rank.getId() : 1);
|
statement.setInt(10, this.rank != null ? this.rank.getId() : 1);
|
||||||
statement.setString(11, this.machineID);
|
statement.setString(11, this.machineID);
|
||||||
statement.setString(12, this.username);
|
statement.setString(12, this.username);
|
||||||
statement.setInt(13, this.id);
|
statement.setInt(13, this.InfostandBg);
|
||||||
|
statement.setInt(14, this.InfostandStand);
|
||||||
|
statement.setInt(15, this.InfostandOverlay);
|
||||||
|
statement.setInt(16, this.id);
|
||||||
statement.executeUpdate();
|
statement.executeUpdate();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
LOGGER.error("Caught SQL exception", e);
|
LOGGER.error("Caught SQL exception", e);
|
||||||
|
@ -270,7 +270,18 @@ public class SubscriptionHabboClub extends Subscription {
|
|||||||
HabboInfo habboInfo = Emulator.getGameEnvironment().getHabboManager().getHabboInfo(userId);
|
HabboInfo habboInfo = Emulator.getGameEnvironment().getHabboManager().getHabboInfo(userId);
|
||||||
|
|
||||||
if (habboInfo == null) {
|
if (habboInfo == null) {
|
||||||
SubscriptionManager.LOGGER.error("HabboInfo is null for user #" + userId);
|
SubscriptionManager.LOGGER.error("HabboInfo is null for user #" + userId + ". Removing subscription.");
|
||||||
|
|
||||||
|
// Remove subscription from the database
|
||||||
|
try (PreparedStatement removeStatement = connection.prepareStatement(
|
||||||
|
"DELETE FROM users_subscriptions WHERE user_id = ? AND subscription_type = ?")) {
|
||||||
|
removeStatement.setInt(1, userId);
|
||||||
|
removeStatement.setString(2, Subscription.HABBO_CLUB);
|
||||||
|
removeStatement.executeUpdate();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
SubscriptionManager.LOGGER.error("SQL exception when trying to remove subscription for user #" + userId, e);
|
||||||
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,8 +44,8 @@ public class WiredHandler {
|
|||||||
private static final Logger LOGGER = LoggerFactory.getLogger(WiredHandler.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(WiredHandler.class);
|
||||||
|
|
||||||
//Configuration. Loaded from database & updated accordingly.
|
//Configuration. Loaded from database & updated accordingly.
|
||||||
public static int MAXIMUM_FURNI_SELECTION = 5;
|
public static int MAXIMUM_FURNI_SELECTION = Emulator.getConfig().getInt("hotel.wired.furni.selection.count", 5);
|
||||||
public static int TELEPORT_DELAY = 500;
|
public static int TELEPORT_DELAY = Emulator.getConfig().getInt("wired.effect.teleport.delay", 500);;
|
||||||
|
|
||||||
private static GsonBuilder gsonBuilder = null;
|
private static GsonBuilder gsonBuilder = null;
|
||||||
|
|
||||||
|
@ -136,6 +136,19 @@ public class WiredHighscoreManager {
|
|||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (scoreType == WiredHighscoreScoreType.LONGESTTIME) {
|
||||||
|
return highscores
|
||||||
|
.collect(Collectors.groupingBy(h -> h.getUsers().hashCode()))
|
||||||
|
.entrySet()
|
||||||
|
.stream()
|
||||||
|
.map(e -> e.getValue().stream()
|
||||||
|
.max(Comparator.comparingInt(WiredHighscoreRow::getValue))
|
||||||
|
.orElse(null))
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.sorted(Comparator.comparingInt(WiredHighscoreRow::getValue).reversed())
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,8 @@ package com.eu.habbo.habbohotel.wired.highscores;
|
|||||||
public enum WiredHighscoreScoreType {
|
public enum WiredHighscoreScoreType {
|
||||||
PERTEAM(0),
|
PERTEAM(0),
|
||||||
MOSTWIN(1),
|
MOSTWIN(1),
|
||||||
CLASSIC(2);
|
CLASSIC(2),
|
||||||
|
LONGESTTIME(3);
|
||||||
|
|
||||||
public final int type;
|
public final int type;
|
||||||
|
|
||||||
|
@ -320,6 +320,7 @@ public class PacketManager {
|
|||||||
this.registerHandler(Incoming.ChangeNameCheckUsernameEvent, ChangeNameCheckUsernameEvent.class);
|
this.registerHandler(Incoming.ChangeNameCheckUsernameEvent, ChangeNameCheckUsernameEvent.class);
|
||||||
this.registerHandler(Incoming.ConfirmChangeNameEvent, ConfirmChangeNameEvent.class);
|
this.registerHandler(Incoming.ConfirmChangeNameEvent, ConfirmChangeNameEvent.class);
|
||||||
this.registerHandler(Incoming.ChangeChatBubbleEvent, ChangeChatBubbleEvent.class);
|
this.registerHandler(Incoming.ChangeChatBubbleEvent, ChangeChatBubbleEvent.class);
|
||||||
|
this.registerHandler(Incoming.ChangeInfostandBgEvent, ChangeInfostandBgEvent.class);
|
||||||
this.registerHandler(Incoming.UpdateUIFlagsEvent, UpdateUIFlagsEvent.class);
|
this.registerHandler(Incoming.UpdateUIFlagsEvent, UpdateUIFlagsEvent.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -353,6 +353,7 @@ public class Incoming {
|
|||||||
|
|
||||||
public static final int TradeCancelEvent = 2341;
|
public static final int TradeCancelEvent = 2341;
|
||||||
public static final int ChangeChatBubbleEvent = 1030;
|
public static final int ChangeChatBubbleEvent = 1030;
|
||||||
|
public static final int ChangeInfostandBgEvent = 1031;
|
||||||
public static final int LoveLockStartConfirmEvent = 3775;
|
public static final int LoveLockStartConfirmEvent = 3775;
|
||||||
|
|
||||||
public static final int HotelViewRequestLTDAvailabilityEvent = 410;
|
public static final int HotelViewRequestLTDAvailabilityEvent = 410;
|
||||||
|
@ -0,0 +1,24 @@
|
|||||||
|
package com.eu.habbo.messages.incoming.users;
|
||||||
|
|
||||||
|
import com.eu.habbo.messages.incoming.MessageHandler;
|
||||||
|
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserDataComposer;
|
||||||
|
|
||||||
|
public class ChangeInfostandBgEvent extends MessageHandler {
|
||||||
|
@Override
|
||||||
|
public void handle() throws Exception {
|
||||||
|
int backgroundImage = this.packet.readInt();
|
||||||
|
int backgroundStand = this.packet.readInt();
|
||||||
|
int backgroundOverlay = this.packet.readInt();
|
||||||
|
|
||||||
|
this.client.getHabbo().getHabboInfo().setInfostandBg(backgroundImage);
|
||||||
|
this.client.getHabbo().getHabboInfo().setInfostandStand(backgroundStand);
|
||||||
|
this.client.getHabbo().getHabboInfo().setInfostandOverlay(backgroundOverlay);
|
||||||
|
this.client.getHabbo().getHabboInfo().run();
|
||||||
|
|
||||||
|
if (this.client.getHabbo().getHabboInfo().getCurrentRoom() != null) {
|
||||||
|
this.client.getHabbo().getHabboInfo().getCurrentRoom().sendComposer(new RoomUserDataComposer(this.client.getHabbo()).compose());
|
||||||
|
} else {
|
||||||
|
this.client.sendResponse(new RoomUserDataComposer(this.client.getHabbo()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -33,6 +33,9 @@ public class RoomPetComposer extends MessageComposer implements TIntObjectProced
|
|||||||
this.response.appendInt(pet.getId());
|
this.response.appendInt(pet.getId());
|
||||||
this.response.appendString(pet.getName());
|
this.response.appendString(pet.getName());
|
||||||
this.response.appendString("");
|
this.response.appendString("");
|
||||||
|
this.response.appendInt(0);
|
||||||
|
this.response.appendInt(0);
|
||||||
|
this.response.appendInt(0);
|
||||||
if (pet instanceof IPetLook) {
|
if (pet instanceof IPetLook) {
|
||||||
this.response.appendString(((IPetLook) pet).getLook());
|
this.response.appendString(((IPetLook) pet).getLook());
|
||||||
} else {
|
} else {
|
||||||
@ -59,8 +62,4 @@ public class RoomPetComposer extends MessageComposer implements TIntObjectProced
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TIntObjectMap<Pet> getPets() {
|
|
||||||
return pets;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -20,10 +20,9 @@ public class RoomUserDataComposer extends MessageComposer {
|
|||||||
this.response.appendString(this.habbo.getHabboInfo().getGender().name() + "");
|
this.response.appendString(this.habbo.getHabboInfo().getGender().name() + "");
|
||||||
this.response.appendString(this.habbo.getHabboInfo().getMotto());
|
this.response.appendString(this.habbo.getHabboInfo().getMotto());
|
||||||
this.response.appendInt(this.habbo.getHabboStats().getAchievementScore());
|
this.response.appendInt(this.habbo.getHabboStats().getAchievementScore());
|
||||||
|
this.response.appendInt(this.habbo.getHabboInfo().getInfostandBg());
|
||||||
|
this.response.appendInt(this.habbo.getHabboInfo().getInfostandStand());
|
||||||
|
this.response.appendInt(this.habbo.getHabboInfo().getInfostandOverlay());
|
||||||
return this.response;
|
return this.response;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Habbo getHabbo() {
|
|
||||||
return habbo;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,9 @@ public class RoomUsersComposer extends MessageComposer {
|
|||||||
this.response.appendInt(this.habbo.getHabboInfo().getId());
|
this.response.appendInt(this.habbo.getHabboInfo().getId());
|
||||||
this.response.appendString(this.habbo.getHabboInfo().getUsername());
|
this.response.appendString(this.habbo.getHabboInfo().getUsername());
|
||||||
this.response.appendString(this.habbo.getHabboInfo().getMotto());
|
this.response.appendString(this.habbo.getHabboInfo().getMotto());
|
||||||
|
this.response.appendInt(this.habbo.getHabboInfo().getInfostandBg());
|
||||||
|
this.response.appendInt(this.habbo.getHabboInfo().getInfostandStand());
|
||||||
|
this.response.appendInt(this.habbo.getHabboInfo().getInfostandOverlay());
|
||||||
this.response.appendString(this.habbo.getHabboInfo().getLook());
|
this.response.appendString(this.habbo.getHabboInfo().getLook());
|
||||||
this.response.appendInt(this.habbo.getRoomUnit().getId()); //Room Unit ID
|
this.response.appendInt(this.habbo.getRoomUnit().getId()); //Room Unit ID
|
||||||
this.response.appendInt(this.habbo.getRoomUnit().getX());
|
this.response.appendInt(this.habbo.getRoomUnit().getX());
|
||||||
@ -70,6 +73,9 @@ public class RoomUsersComposer extends MessageComposer {
|
|||||||
this.response.appendInt(habbo.getHabboInfo().getId());
|
this.response.appendInt(habbo.getHabboInfo().getId());
|
||||||
this.response.appendString(habbo.getHabboInfo().getUsername());
|
this.response.appendString(habbo.getHabboInfo().getUsername());
|
||||||
this.response.appendString(habbo.getHabboInfo().getMotto());
|
this.response.appendString(habbo.getHabboInfo().getMotto());
|
||||||
|
this.response.appendInt(habbo.getHabboInfo().getInfostandBg());
|
||||||
|
this.response.appendInt(habbo.getHabboInfo().getInfostandStand());
|
||||||
|
this.response.appendInt(habbo.getHabboInfo().getInfostandOverlay());
|
||||||
this.response.appendString(habbo.getHabboInfo().getLook());
|
this.response.appendString(habbo.getHabboInfo().getLook());
|
||||||
this.response.appendInt(habbo.getRoomUnit().getId()); //Room Unit ID
|
this.response.appendInt(habbo.getRoomUnit().getId()); //Room Unit ID
|
||||||
this.response.appendInt(habbo.getRoomUnit().getX());
|
this.response.appendInt(habbo.getRoomUnit().getX());
|
||||||
@ -98,6 +104,9 @@ public class RoomUsersComposer extends MessageComposer {
|
|||||||
this.response.appendInt(0 - this.bot.getId());
|
this.response.appendInt(0 - this.bot.getId());
|
||||||
this.response.appendString(this.bot.getName());
|
this.response.appendString(this.bot.getName());
|
||||||
this.response.appendString(this.bot.getMotto());
|
this.response.appendString(this.bot.getMotto());
|
||||||
|
this.response.appendInt(0);
|
||||||
|
this.response.appendInt(0);
|
||||||
|
this.response.appendInt(0);
|
||||||
this.response.appendString(this.bot.getFigure());
|
this.response.appendString(this.bot.getFigure());
|
||||||
this.response.appendInt(this.bot.getRoomUnit().getId());
|
this.response.appendInt(this.bot.getRoomUnit().getId());
|
||||||
this.response.appendInt(this.bot.getRoomUnit().getX());
|
this.response.appendInt(this.bot.getRoomUnit().getX());
|
||||||
@ -125,6 +134,9 @@ public class RoomUsersComposer extends MessageComposer {
|
|||||||
this.response.appendInt(0 - bot.getId());
|
this.response.appendInt(0 - bot.getId());
|
||||||
this.response.appendString(bot.getName());
|
this.response.appendString(bot.getName());
|
||||||
this.response.appendString(bot.getMotto());
|
this.response.appendString(bot.getMotto());
|
||||||
|
this.response.appendInt(0);
|
||||||
|
this.response.appendInt(0);
|
||||||
|
this.response.appendInt(0);
|
||||||
this.response.appendString(bot.getFigure());
|
this.response.appendString(bot.getFigure());
|
||||||
this.response.appendInt(bot.getRoomUnit().getId());
|
this.response.appendInt(bot.getRoomUnit().getId());
|
||||||
this.response.appendInt(bot.getRoomUnit().getX());
|
this.response.appendInt(bot.getRoomUnit().getX());
|
||||||
@ -150,20 +162,4 @@ public class RoomUsersComposer extends MessageComposer {
|
|||||||
}
|
}
|
||||||
return this.response;
|
return this.response;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Habbo getHabbo() {
|
|
||||||
return habbo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Collection<Habbo> getHabbos() {
|
|
||||||
return habbos;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Bot getBot() {
|
|
||||||
return bot;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Collection<Bot> getBots() {
|
|
||||||
return bots;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
@ -81,7 +81,7 @@ The robust Plugin System included in the original Arcturus release is also inclu
|
|||||||
- ArpyAge
|
- ArpyAge
|
||||||
- Mikkel
|
- Mikkel
|
||||||
- Rodolfo
|
- Rodolfo
|
||||||
- Rasmus
|
- Rasmus - for selling me the banners and height code
|
||||||
- Kitt Mustang
|
- Kitt Mustang
|
||||||
- Snaiker
|
- Snaiker
|
||||||
- nttzx
|
- nttzx
|
||||||
|
Loading…
x
Reference in New Issue
Block a user