mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-22 23:10:52 +01:00
Custom stacking setting to stack bigger items on top of smaller ones
This commit is contained in:
parent
098d6a6684
commit
fa0f58b87f
@ -91,3 +91,6 @@ INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('hotel.mannequin.name.defa
|
|||||||
|
|
||||||
-- RCON: Change Username
|
-- RCON: Change Username
|
||||||
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('rcon.alert.user.change_username', 'You can change your username. Click on yourself to change it.');
|
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('rcon.alert.user.change_username', 'You can change your username. Click on yourself to change it.');
|
||||||
|
|
||||||
|
-- Custom Stacking Setting
|
||||||
|
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('custom.stacking.enabled', '0');
|
||||||
|
@ -3,9 +3,7 @@ package com.eu.habbo.messages.incoming.catalog.recycler;
|
|||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
import com.eu.habbo.habbohotel.items.interactions.InteractionGift;
|
import com.eu.habbo.habbohotel.items.interactions.InteractionGift;
|
||||||
import com.eu.habbo.habbohotel.permissions.Permission;
|
import com.eu.habbo.habbohotel.permissions.Permission;
|
||||||
import com.eu.habbo.habbohotel.rooms.Room;
|
import com.eu.habbo.habbohotel.rooms.*;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomChatMessage;
|
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
|
||||||
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.inventory.AddHabboItemComposer;
|
import com.eu.habbo.messages.outgoing.inventory.AddHabboItemComposer;
|
||||||
@ -58,7 +56,15 @@ public class OpenRecycleBoxEvent extends MessageHandler {
|
|||||||
|
|
||||||
if (item.getRoomId() == 0) {
|
if (item.getRoomId() == 0) {
|
||||||
room.updateTile(room.getLayout().getTile(item.getX(), item.getY()));
|
room.updateTile(room.getLayout().getTile(item.getX(), item.getY()));
|
||||||
room.sendComposer(new UpdateStackHeightComposer(item.getX(), item.getY(), room.getStackHeight(item.getX(), item.getY(), true)).compose());
|
RoomLayout roomLayout = room.getLayout();
|
||||||
|
short z = (short)room.getStackHeight(item.getX(), item.getY(), true);
|
||||||
|
if(roomLayout != null) {
|
||||||
|
RoomTile roomTile = roomLayout.getTile(item.getX(), item.getY());
|
||||||
|
if(roomTile != null) {
|
||||||
|
z = roomTile.z;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
room.sendComposer(new UpdateStackHeightComposer(item.getX(), item.getY(), z, room.getStackHeight(item.getX(), item.getY(), true)).compose());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ public class RedeemClothingEvent extends MessageHandler {
|
|||||||
RoomTile tile = this.client.getHabbo().getHabboInfo().getCurrentRoom().getLayout().getTile(item.getX(), item.getY());
|
RoomTile tile = this.client.getHabbo().getHabboInfo().getCurrentRoom().getLayout().getTile(item.getX(), item.getY());
|
||||||
this.client.getHabbo().getHabboInfo().getCurrentRoom().removeHabboItem(item);
|
this.client.getHabbo().getHabboInfo().getCurrentRoom().removeHabboItem(item);
|
||||||
this.client.getHabbo().getHabboInfo().getCurrentRoom().updateTile(tile);
|
this.client.getHabbo().getHabboInfo().getCurrentRoom().updateTile(tile);
|
||||||
this.client.getHabbo().getHabboInfo().getCurrentRoom().sendComposer(new UpdateStackHeightComposer(tile.x, tile.y, tile.relativeHeight()).compose());
|
this.client.getHabbo().getHabboInfo().getCurrentRoom().sendComposer(new UpdateStackHeightComposer(tile.x, tile.y, tile.z, tile.relativeHeight()).compose());
|
||||||
this.client.getHabbo().getHabboInfo().getCurrentRoom().sendComposer(new RemoveFloorItemComposer(item, true).compose());
|
this.client.getHabbo().getHabboInfo().getCurrentRoom().sendComposer(new RemoveFloorItemComposer(item, true).compose());
|
||||||
Emulator.getThreading().run(new QueryDeleteHabboItem(item.getId()));
|
Emulator.getThreading().run(new QueryDeleteHabboItem(item.getId()));
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ public class RedeemItemEvent extends MessageHandler {
|
|||||||
RoomTile t = room.getLayout().getTile(item.getX(), item.getY());
|
RoomTile t = room.getLayout().getTile(item.getX(), item.getY());
|
||||||
t.setStackHeight(room.getStackHeight(item.getX(), item.getY(), false));
|
t.setStackHeight(room.getStackHeight(item.getX(), item.getY(), false));
|
||||||
room.updateTile(t);
|
room.updateTile(t);
|
||||||
room.sendComposer(new UpdateStackHeightComposer(item.getX(), item.getY(), t.relativeHeight()).compose());
|
room.sendComposer(new UpdateStackHeightComposer(item.getX(), item.getY(), t.z, t.relativeHeight()).compose());
|
||||||
Emulator.getThreading().run(new QueryDeleteHabboItem(item.getId()));
|
Emulator.getThreading().run(new QueryDeleteHabboItem(item.getId()));
|
||||||
|
|
||||||
switch (furniRedeemEvent.currencyID) {
|
switch (furniRedeemEvent.currencyID) {
|
||||||
|
@ -62,7 +62,7 @@ public class PetPackageNameEvent extends MessageHandler {
|
|||||||
room.sendComposer(new RemoveFloorItemComposer(item).compose());
|
room.sendComposer(new RemoveFloorItemComposer(item).compose());
|
||||||
RoomTile tile = room.getLayout().getTile(item.getX(), item.getY());
|
RoomTile tile = room.getLayout().getTile(item.getX(), item.getY());
|
||||||
room.updateTile(room.getLayout().getTile(item.getX(), item.getY()));
|
room.updateTile(room.getLayout().getTile(item.getX(), item.getY()));
|
||||||
room.sendComposer(new UpdateStackHeightComposer(tile.x, tile.y, tile.relativeHeight()).compose());
|
room.sendComposer(new UpdateStackHeightComposer(tile.x, tile.y, tile.z, tile.relativeHeight()).compose());
|
||||||
item.setUserId(0);
|
item.setUserId(0);
|
||||||
} else {
|
} else {
|
||||||
this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR));
|
this.client.sendResponse(new AlertPurchaseFailedComposer(AlertPurchaseFailedComposer.SERVER_ERROR));
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.eu.habbo.messages.outgoing.rooms;
|
package com.eu.habbo.messages.outgoing.rooms;
|
||||||
|
|
||||||
|
import com.eu.habbo.Emulator;
|
||||||
import com.eu.habbo.habbohotel.rooms.Room;
|
import com.eu.habbo.habbohotel.rooms.Room;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
||||||
import com.eu.habbo.messages.ServerMessage;
|
import com.eu.habbo.messages.ServerMessage;
|
||||||
@ -22,10 +23,17 @@ public class RoomRelativeMapComposer extends MessageComposer {
|
|||||||
for (short x = 0; x < this.room.getLayout().getMapSizeX(); x++) {
|
for (short x = 0; x < this.room.getLayout().getMapSizeX(); x++) {
|
||||||
RoomTile t = this.room.getLayout().getTile(x, y);
|
RoomTile t = this.room.getLayout().getTile(x, y);
|
||||||
|
|
||||||
if (t != null)
|
if (t != null) {
|
||||||
|
if(Emulator.getConfig().getBoolean("custom.stacking.enabled")) {
|
||||||
|
this.response.appendShort((short) (t.z * 256.0));
|
||||||
|
}
|
||||||
|
else {
|
||||||
this.response.appendShort(t.relativeHeight());
|
this.response.appendShort(t.relativeHeight());
|
||||||
else
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
this.response.appendShort(Short.MAX_VALUE);
|
this.response.appendShort(Short.MAX_VALUE);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.eu.habbo.messages.outgoing.rooms;
|
package com.eu.habbo.messages.outgoing.rooms;
|
||||||
|
|
||||||
|
import com.eu.habbo.Emulator;
|
||||||
import com.eu.habbo.habbohotel.rooms.Room;
|
import com.eu.habbo.habbohotel.rooms.Room;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
||||||
import com.eu.habbo.messages.ServerMessage;
|
import com.eu.habbo.messages.ServerMessage;
|
||||||
@ -10,14 +11,16 @@ import gnu.trove.set.hash.THashSet;
|
|||||||
public class UpdateStackHeightComposer extends MessageComposer {
|
public class UpdateStackHeightComposer extends MessageComposer {
|
||||||
private int x;
|
private int x;
|
||||||
private int y;
|
private int y;
|
||||||
|
private short z;
|
||||||
private double height;
|
private double height;
|
||||||
|
|
||||||
private THashSet<RoomTile> updateTiles;
|
private THashSet<RoomTile> updateTiles;
|
||||||
private Room room;
|
private Room room;
|
||||||
|
|
||||||
public UpdateStackHeightComposer(int x, int y, double height) {
|
public UpdateStackHeightComposer(int x, int y, short z, double height) {
|
||||||
this.x = x;
|
this.x = x;
|
||||||
this.y = y;
|
this.y = y;
|
||||||
|
this.z = z;
|
||||||
this.height = height;
|
this.height = height;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,8 +43,13 @@ public class UpdateStackHeightComposer extends MessageComposer {
|
|||||||
updateTiles.remove(t); // remove it from the set
|
updateTiles.remove(t); // remove it from the set
|
||||||
this.response.appendByte((int) t.x);
|
this.response.appendByte((int) t.x);
|
||||||
this.response.appendByte((int) t.y);
|
this.response.appendByte((int) t.y);
|
||||||
|
if(Emulator.getConfig().getBoolean("custom.stacking.enabled")) {
|
||||||
|
this.response.appendShort((short) (t.z * 256.0));
|
||||||
|
}
|
||||||
|
else {
|
||||||
this.response.appendShort(t.relativeHeight());
|
this.response.appendShort(t.relativeHeight());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
//send the remaining tiles in a new message
|
//send the remaining tiles in a new message
|
||||||
this.room.sendComposer(new UpdateStackHeightComposer(this.room, updateTiles).compose());
|
this.room.sendComposer(new UpdateStackHeightComposer(this.room, updateTiles).compose());
|
||||||
return this.response;
|
return this.response;
|
||||||
@ -51,14 +59,24 @@ public class UpdateStackHeightComposer extends MessageComposer {
|
|||||||
for (RoomTile t : this.updateTiles) {
|
for (RoomTile t : this.updateTiles) {
|
||||||
this.response.appendByte((int) t.x);
|
this.response.appendByte((int) t.x);
|
||||||
this.response.appendByte((int) t.y);
|
this.response.appendByte((int) t.y);
|
||||||
|
if(Emulator.getConfig().getBoolean("custom.stacking.enabled")) {
|
||||||
|
this.response.appendShort((short) (t.z * 256.0));
|
||||||
|
}
|
||||||
|
else {
|
||||||
this.response.appendShort(t.relativeHeight());
|
this.response.appendShort(t.relativeHeight());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.response.appendByte(1);
|
this.response.appendByte(1);
|
||||||
this.response.appendByte(this.x);
|
this.response.appendByte(this.x);
|
||||||
this.response.appendByte(this.y);
|
this.response.appendByte(this.y);
|
||||||
|
if(Emulator.getConfig().getBoolean("custom.stacking.enabled")) {
|
||||||
|
this.response.appendShort((short) (this.z * 256.0));
|
||||||
|
}
|
||||||
|
else {
|
||||||
this.response.appendShort((int) (this.height));
|
this.response.appendShort((int) (this.height));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return this.response;
|
return this.response;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,6 @@ class RemoveFloorItemTask implements Runnable {
|
|||||||
this.room.removeHabboItem(this.item);
|
this.room.removeHabboItem(this.item);
|
||||||
this.room.updateTile(tile);
|
this.room.updateTile(tile);
|
||||||
this.room.sendComposer(new RemoveFloorItemComposer(this.item, true).compose());
|
this.room.sendComposer(new RemoveFloorItemComposer(this.item, true).compose());
|
||||||
this.room.sendComposer(new UpdateStackHeightComposer(this.item.getX(), this.item.getY(), tile.relativeHeight()).compose());
|
this.room.sendComposer(new UpdateStackHeightComposer(this.item.getX(), this.item.getY(), tile.z, tile.relativeHeight()).compose());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user