mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2025-01-31 04:12:37 +01:00
WIP: Fix WiredEffectTeleport
This commit is contained in:
parent
eb07ed91b2
commit
aec2626296
@ -63,6 +63,7 @@ public class WiredEffectTeleport extends InteractionWiredEffect {
|
|||||||
for (RoomTile optionalTile : optionalTiles) {
|
for (RoomTile optionalTile : optionalTiles) {
|
||||||
if (optionalTile.state != RoomTileState.INVALID && optionalTile.state != RoomTileState.BLOCKED) {
|
if (optionalTile.state != RoomTileState.INVALID && optionalTile.state != RoomTileState.BLOCKED) {
|
||||||
alternativeTile = optionalTile;
|
alternativeTile = optionalTile;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,30 +140,13 @@ public class WiredEffectTeleport extends InteractionWiredEffect {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) {
|
public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff) {
|
||||||
THashSet<HabboItem> items = new THashSet<>();
|
this.items.removeIf(item -> item == null || item.getRoomId() != this.getRoomId()
|
||||||
|
|| Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(item.getId()) == null);
|
||||||
for (HabboItem item : this.items) {
|
|
||||||
if (item.getRoomId() != this.getRoomId() || Emulator.getGameEnvironment().getRoomManager().getRoom(this.getRoomId()).getHabboItem(item.getId()) == null)
|
|
||||||
items.add(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (HabboItem item : items) {
|
|
||||||
this.items.remove(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this.items.isEmpty()) {
|
if (!this.items.isEmpty()) {
|
||||||
int i = Emulator.getRandom().nextInt(this.items.size()) + 1;
|
int i = Emulator.getRandom().nextInt(this.items.size());
|
||||||
int j = 1;
|
HabboItem item = this.items.get(i);
|
||||||
|
teleportUnitToTile(roomUnit, room.getLayout().getTile(item.getX(), item.getY()));
|
||||||
int tryCount = 0;
|
|
||||||
while (tryCount < this.items.size()) {
|
|
||||||
tryCount++;
|
|
||||||
HabboItem item = this.items.get((tryCount - 1 + i) % this.items.size());
|
|
||||||
|
|
||||||
teleportUnitToTile(roomUnit, room.getLayout().getTile(item.getX(), item.getY()));
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -220,6 +204,6 @@ public class WiredEffectTeleport extends InteractionWiredEffect {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected long requiredCooldown() {
|
protected long requiredCooldown() {
|
||||||
return 0;
|
return 50L;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user