Arcturus-Community/src/main/java/com/eu/habbo/messages/outgoing/rooms/UpdateStackHeightComposer.java

45 lines
1.4 KiB
Java
Raw Normal View History

2018-07-06 15:30:00 +02:00
package com.eu.habbo.messages.outgoing.rooms;
import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.outgoing.MessageComposer;
import com.eu.habbo.messages.outgoing.Outgoing;
import gnu.trove.set.hash.THashSet;
2019-05-26 20:14:53 +02:00
public class UpdateStackHeightComposer extends MessageComposer {
2018-07-06 15:30:00 +02:00
private int x;
private int y;
private double height;
private THashSet<RoomTile> updateTiles;
2019-05-26 20:14:53 +02:00
public UpdateStackHeightComposer(int x, int y, double height) {
2018-07-06 15:30:00 +02:00
this.x = x;
this.y = y;
this.height = height;
}
2019-05-26 20:14:53 +02:00
public UpdateStackHeightComposer(THashSet<RoomTile> updateTiles) {
2018-07-06 15:30:00 +02:00
this.updateTiles = updateTiles;
}
@Override
2019-05-26 20:14:53 +02:00
public ServerMessage compose() {
2018-07-06 15:30:00 +02:00
this.response.init(Outgoing.UpdateStackHeightComposer);
2019-05-26 20:14:53 +02:00
if (this.updateTiles != null) {
2018-07-06 15:30:00 +02:00
this.response.appendByte(this.updateTiles.size());
2019-05-26 20:14:53 +02:00
for (RoomTile t : this.updateTiles) {
2018-07-06 15:30:00 +02:00
this.response.appendByte((int) t.x);
this.response.appendByte((int) t.y);
2019-03-18 02:22:00 +01:00
this.response.appendShort(t.relativeHeight());
2018-07-06 15:30:00 +02:00
}
2019-05-26 20:14:53 +02:00
} else {
2018-07-06 15:30:00 +02:00
this.response.appendByte(1);
this.response.appendByte(this.x);
this.response.appendByte(this.y);
this.response.appendShort((int) (this.height));
}
return this.response;
}
}