2018-07-06 15:30:00 +02:00
|
|
|
package com.eu.habbo.habbohotel.items.interactions;
|
|
|
|
|
|
|
|
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
|
|
|
import com.eu.habbo.habbohotel.items.Item;
|
|
|
|
import com.eu.habbo.habbohotel.rooms.Room;
|
|
|
|
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
|
|
|
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
2018-10-07 00:28:00 +02:00
|
|
|
import com.eu.habbo.habbohotel.users.HabboItem;
|
|
|
|
import com.eu.habbo.messages.ServerMessage;
|
2018-07-06 15:30:00 +02:00
|
|
|
|
|
|
|
import java.sql.ResultSet;
|
|
|
|
import java.sql.SQLException;
|
|
|
|
|
2018-10-07 00:28:00 +02:00
|
|
|
public class InteractionPressurePlate extends HabboItem
|
2018-07-06 15:30:00 +02:00
|
|
|
{
|
|
|
|
public InteractionPressurePlate(ResultSet set, Item baseItem) throws SQLException
|
|
|
|
{
|
|
|
|
super(set, baseItem);
|
|
|
|
}
|
|
|
|
|
|
|
|
public InteractionPressurePlate(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells)
|
|
|
|
{
|
|
|
|
super(id, userId, item, extradata, limitedStack, limitedSells);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean canWalkOn(RoomUnit roomUnit, Room room, Object[] objects)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean isWalkable()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onClick(GameClient client, Room room, Object[] objects) throws Exception
|
|
|
|
{
|
|
|
|
super.onClick(client, room, objects);
|
|
|
|
}
|
|
|
|
|
2018-10-07 00:28:00 +02:00
|
|
|
@Override
|
|
|
|
public void serializeExtradata(ServerMessage serverMessage)
|
|
|
|
{
|
|
|
|
serverMessage.appendInt((this.isLimited() ? 256 : 0));
|
|
|
|
serverMessage.appendString(this.getExtradata());
|
|
|
|
|
|
|
|
super.serializeExtradata(serverMessage);
|
|
|
|
}
|
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
@Override
|
|
|
|
public void onWalk(RoomUnit roomUnit, Room room, Object[] objects) throws Exception
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) throws Exception
|
|
|
|
{
|
|
|
|
super.onWalkOn(roomUnit, room, objects);
|
|
|
|
|
|
|
|
this.setExtradata("1");
|
2018-10-07 00:28:00 +02:00
|
|
|
|
|
|
|
if (this.getBaseItem().getWidth() > 1 || this.getBaseItem().getLength() > 1)
|
2018-09-28 21:25:00 +02:00
|
|
|
{
|
2018-10-07 00:28:00 +02:00
|
|
|
for (RoomTile tile : room.getLayout().getTilesAt(room.getLayout().getTile(this.getX(), this.getY()), this.getBaseItem().getWidth(), this.getBaseItem().getLength(), this.getRotation()))
|
2018-09-28 21:25:00 +02:00
|
|
|
{
|
2018-10-07 00:28:00 +02:00
|
|
|
if (!room.hasHabbosAt(tile.x, tile.y) && !roomUnit.getGoal().is(tile.x, tile.y))
|
|
|
|
{
|
|
|
|
this.setExtradata("0");
|
|
|
|
break;
|
|
|
|
}
|
2018-09-28 21:25:00 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
room.updateItemState(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onWalkOff(RoomUnit roomUnit, Room room, Object[] objects) throws Exception
|
|
|
|
{
|
|
|
|
super.onWalkOff(roomUnit, room, objects);
|
|
|
|
|
|
|
|
this.setExtradata("0");
|
|
|
|
room.updateItemState(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onMove(Room room, RoomTile oldLocation, RoomTile newLocation)
|
|
|
|
{
|
2018-12-22 11:39:00 +01:00
|
|
|
super.onMove(room, oldLocation, newLocation);
|
|
|
|
|
|
|
|
if (oldLocation != newLocation && oldLocation.getStackHeight() != newLocation.getStackHeight() && !room.hasHabbosAt(newLocation.x, newLocation.y))
|
|
|
|
{
|
|
|
|
this.setExtradata("0");
|
|
|
|
room.updateItemState(this);
|
|
|
|
}
|
2018-07-06 15:30:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean allowWiredResetState()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2018-12-22 11:39:00 +01:00
|
|
|
|
|
|
|
|
2018-07-06 15:30:00 +02:00
|
|
|
}
|