mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2025-01-18 23:46:28 +01:00
Merge branch 'wired-condition-fix-#907' into 'dev'
Fixed wired condition trigger on furni #907 See merge request morningstar/Arcturus-Community!331
This commit is contained in:
commit
d9c7795337
@ -4,7 +4,6 @@ import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredCondition;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomLayout;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||
@ -33,15 +32,36 @@ public class WiredConditionTriggerOnFurni extends InteractionWiredCondition {
|
||||
|
||||
@Override
|
||||
public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) {
|
||||
if (roomUnit == null) return false;
|
||||
if (roomUnit == null)
|
||||
return false;
|
||||
|
||||
this.refresh();
|
||||
|
||||
if (this.items.isEmpty())
|
||||
return false;
|
||||
|
||||
/*
|
||||
* 1. If a Habbo IS NOT walking we only have to check if the Habbo is on one of the selected tiles.
|
||||
* 2. If a Habbo IS walking we have to check if the next tile in the walking path is one of the selected items
|
||||
* */
|
||||
if (!roomUnit.isWalking()) {
|
||||
THashSet<HabboItem> itemsAtUser = room.getItemsAt(roomUnit.getCurrentLocation());
|
||||
return this.items.stream().anyMatch(itemsAtUser::contains);
|
||||
} else {
|
||||
RoomTile firstTileInPath = room.getLayout()
|
||||
.findPath(roomUnit.getCurrentLocation(), roomUnit.getGoal(), roomUnit.getGoal(), roomUnit)
|
||||
.peek();
|
||||
|
||||
if (firstTileInPath == null)
|
||||
return false;
|
||||
|
||||
return this.items
|
||||
.stream()
|
||||
.anyMatch(conditionItem -> conditionItem
|
||||
.getOccupyingTiles(room.getLayout())
|
||||
.contains(firstTileInPath)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -64,7 +84,7 @@ public class WiredConditionTriggerOnFurni extends InteractionWiredCondition {
|
||||
String[] data = set.getString("wired_data").split(";");
|
||||
|
||||
for (String s : data) {
|
||||
HabboItem item = room.getHabboItem(Integer.valueOf(s));
|
||||
HabboItem item = room.getHabboItem(Integer.parseInt(s));
|
||||
|
||||
if (item != null) {
|
||||
this.items.add(item);
|
||||
|
Loading…
Reference in New Issue
Block a user