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

75 lines
2.3 KiB
Java
Raw Normal View History

2018-07-06 15:30:00 +02:00
package com.eu.habbo.habbohotel.items.interactions;
2018-12-22 11:39:00 +01:00
import com.eu.habbo.habbohotel.bots.Bot;
2018-07-06 15:30:00 +02:00
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
2018-12-22 11:39:00 +01:00
import com.eu.habbo.habbohotel.rooms.RoomUnitType;
2018-10-07 00:28:00 +02:00
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboGender;
2018-07-06 15:30:00 +02:00
import java.sql.ResultSet;
import java.sql.SQLException;
2019-05-26 20:14:53 +02:00
public class InteractionEffectTile extends InteractionPressurePlate {
public InteractionEffectTile(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 InteractionEffectTile(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);
}
2018-10-07 00:28:00 +02:00
@Override
2019-05-26 20:14:53 +02:00
public boolean canWalkOn(RoomUnit roomUnit, Room room, Object[] objects) {
2018-10-07 00:28:00 +02:00
return true;
}
@Override
2019-05-26 20:14:53 +02:00
public boolean isWalkable() {
2018-10-07 00:28:00 +02:00
return true;
}
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-10-07 00:28:00 +02:00
super.onWalkOff(roomUnit, room, objects);
}
@Override
2019-05-26 20:14:53 +02:00
public void onWalk(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
2018-11-17 14:28:00 +01:00
super.onWalk(roomUnit, room, objects);
}
2018-10-07 00:28:00 +02:00
2018-11-17 14:28:00 +01:00
@Override
2019-05-26 20:14:53 +02:00
public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
2018-11-17 14:28:00 +01:00
super.onWalkOn(roomUnit, room, objects);
2019-05-26 20:14:53 +02:00
if (roomUnit.getRoomUnitType() == RoomUnitType.USER) {
2018-12-22 11:39:00 +01:00
Habbo habbo = room.getHabbo(roomUnit);
2019-05-26 20:14:53 +02:00
if (habbo != null) {
2019-03-18 02:22:00 +01:00
this.giveEffect(room, roomUnit, habbo.getHabboInfo().getGender());
2018-12-22 11:39:00 +01:00
}
2019-05-26 20:14:53 +02:00
} else if (roomUnit.getRoomUnitType() == RoomUnitType.BOT) {
2018-12-22 11:39:00 +01:00
Bot bot = room.getBot(roomUnit);
2019-05-26 20:14:53 +02:00
if (bot != null) {
2019-03-18 02:22:00 +01:00
this.giveEffect(room, roomUnit, bot.getGender());
2018-12-22 11:39:00 +01:00
}
}
}
2019-05-26 20:14:53 +02:00
private void giveEffect(Room room, RoomUnit roomUnit, HabboGender gender) {
if (gender.equals(HabboGender.M)) {
2019-03-18 02:22:00 +01:00
room.giveEffect(roomUnit, this.getBaseItem().getEffectM(), -1);
2019-05-26 20:14:53 +02:00
} else {
2019-03-18 02:22:00 +01:00
room.giveEffect(roomUnit, this.getBaseItem().getEffectF(), -1);
2018-11-17 14:28:00 +01:00
}
2018-10-07 00:28:00 +02:00
}
@Override
2019-05-26 20:14:53 +02:00
public boolean isUsable() {
2018-10-07 00:28:00 +02:00
return false;
2018-07-06 15:30:00 +02:00
}
}