Arcturus-Community/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionColorWheel.java

79 lines
2.4 KiB
Java
Raw Normal View History

2018-07-06 15:30:00 +02:00
package com.eu.habbo.habbohotel.items.interactions;
import com.eu.habbo.Emulator;
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.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.outgoing.rooms.items.WallItemUpdateComposer;
import com.eu.habbo.threading.runnables.RandomDiceNumber;
import java.sql.ResultSet;
import java.sql.SQLException;
2019-05-26 20:14:53 +02:00
public class InteractionColorWheel extends HabboItem {
2018-07-06 15:30:00 +02:00
private Runnable rollTaks;
2019-05-26 20:14:53 +02:00
public InteractionColorWheel(ResultSet set, Item baseItem) throws SQLException {
2018-07-06 15:30:00 +02:00
super(set, baseItem);
}
2019-05-26 20:14:53 +02:00
public InteractionColorWheel(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) {
2018-07-06 15:30:00 +02:00
super(id, userId, item, extradata, limitedStack, limitedSells);
}
@Override
2019-05-26 20:14:53 +02:00
public void serializeExtradata(ServerMessage serverMessage) {
2018-07-06 15:30:00 +02:00
serverMessage.appendInt((this.isLimited() ? 256 : 0));
serverMessage.appendString(this.getExtradata());
super.serializeExtradata(serverMessage);
}
@Override
2019-05-26 20:14:53 +02:00
public boolean canWalkOn(RoomUnit roomUnit, Room room, Object[] objects) {
2018-07-06 15:30:00 +02:00
return true;
}
@Override
2019-05-26 20:14:53 +02:00
public boolean isWalkable() {
2018-07-06 15:30:00 +02:00
return false;
}
@Override
2019-05-26 20:14:53 +02:00
public void onClick(GameClient client, Room room, Object[] objects) throws Exception {
2018-07-06 15:30:00 +02:00
super.onClick(client, room, objects);
if (!room.hasRights(client.getHabbo()))
return;
2022-01-18 21:36:21 +01:00
if (this.rollTaks == null && !this.getExtradata().equalsIgnoreCase("-1")) {
2018-07-06 15:30:00 +02:00
this.setExtradata("-1");
room.sendComposer(new WallItemUpdateComposer(this).compose());
Emulator.getThreading().run(this);
Emulator.getThreading().run(new RandomDiceNumber(this, room, this.getBaseItem().getStateCount()), 3000);
}
}
@Override
2019-05-26 20:14:53 +02:00
public void onWalk(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
2018-07-06 15:30:00 +02:00
}
@Override
2019-05-26 20:14:53 +02:00
public void onWalkOn(RoomUnit client, Room room, Object[] objects) throws Exception {
2018-07-06 15:30:00 +02:00
}
@Override
2019-05-26 20:14:53 +02:00
public void onWalkOff(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
2018-07-06 15:30:00 +02:00
super.onWalkOff(roomUnit, room, objects);
}
2019-05-26 20:14:53 +02:00
public void clearRunnable() {
2018-07-06 15:30:00 +02:00
this.rollTaks = null;
}
}