Arcturus-Community/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/extra/WiredExtraUnseen.java

87 lines
2.4 KiB
Java
Raw Normal View History

2018-07-06 15:30:00 +02:00
package com.eu.habbo.habbohotel.items.interactions.wired.extra;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredExtra;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomTile;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.messages.ServerMessage;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
2019-05-26 20:14:53 +02:00
public class WiredExtraUnseen extends InteractionWiredExtra {
2018-07-06 15:30:00 +02:00
public List<Integer> seenList = new ArrayList<>();
2019-05-26 20:14:53 +02:00
public WiredExtraUnseen(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 WiredExtraUnseen(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 boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) {
2018-07-06 15:30:00 +02:00
return false;
}
@Override
2019-05-26 20:14:53 +02:00
public String getWiredData() {
2018-07-06 15:30:00 +02:00
return null;
}
@Override
2019-05-26 20:14:53 +02:00
public void serializeWiredData(ServerMessage message, Room room) {
2018-07-06 15:30:00 +02:00
}
@Override
2019-05-26 20:14:53 +02:00
public void loadWiredData(ResultSet set, Room room) throws SQLException {
2018-07-06 15:30:00 +02:00
}
@Override
2019-05-26 20:14:53 +02:00
public void onPickUp() {
2018-07-06 15:30:00 +02:00
this.seenList.clear();
}
@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 onMove(Room room, RoomTile oldLocation, RoomTile newLocation) {
2018-07-06 15:30:00 +02:00
super.onMove(room, oldLocation, newLocation);
this.seenList.clear();
}
2019-05-26 20:14:53 +02:00
public InteractionWiredEffect getUnseenEffect(List<InteractionWiredEffect> effects) {
2018-07-06 15:30:00 +02:00
List<InteractionWiredEffect> unseenEffects = new ArrayList<>();
2019-05-26 20:14:53 +02:00
for (InteractionWiredEffect effect : effects) {
if (!this.seenList.contains(effect.getId())) {
2018-07-06 15:30:00 +02:00
unseenEffects.add(effect);
}
}
InteractionWiredEffect effect = null;
2019-05-26 20:14:53 +02:00
if (!unseenEffects.isEmpty()) {
2018-07-06 15:30:00 +02:00
effect = unseenEffects.get(0);
2019-05-26 20:14:53 +02:00
} else {
2018-07-06 15:30:00 +02:00
this.seenList.clear();
2019-05-26 20:14:53 +02:00
if (!effects.isEmpty()) {
2018-07-06 15:30:00 +02:00
effect = effects.get(0);
}
}
2019-05-26 20:14:53 +02:00
if (effect != null) {
2018-07-06 15:30:00 +02:00
this.seenList.add(effect.getId());
}
return effect;
}
}