mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-23 07:20:50 +01:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
a3a906095c
@ -40,7 +40,7 @@ public final class Emulator {
|
|||||||
public static final String ANSI_YELLOW = "\u001B[33m";
|
public static final String ANSI_YELLOW = "\u001B[33m";
|
||||||
|
|
||||||
|
|
||||||
public final static String PREVIEW = "Stable";
|
public final static String PREVIEW = "RC-3";
|
||||||
|
|
||||||
public static final String version = "Arcturus Morningstar" + " " + MAJOR + "." + MINOR + "." + BUILD + " " + PREVIEW;
|
public static final String version = "Arcturus Morningstar" + " " + MAJOR + "." + MINOR + "." + BUILD + " " + PREVIEW;
|
||||||
private static final String logo =
|
private static final String logo =
|
||||||
|
@ -42,7 +42,7 @@ public class WiredEffectTeleport extends InteractionWiredEffect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void teleportUnitToTile(RoomUnit roomUnit, RoomTile tile) {
|
public static void teleportUnitToTile(RoomUnit roomUnit, RoomTile tile) {
|
||||||
if (roomUnit == null || tile == null)
|
if (roomUnit == null || tile == null || roomUnit.isWiredTeleporting)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Room room = roomUnit.getRoom();
|
Room room = roomUnit.getRoom();
|
||||||
@ -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);
|
||||||
|
|
||||||
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()));
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
|
|
||||||
public class RoomUnit {
|
public class RoomUnit {
|
||||||
|
public boolean isWiredTeleporting = false;
|
||||||
private final ConcurrentHashMap<RoomUnitStatus, String> status;
|
private final ConcurrentHashMap<RoomUnitStatus, String> status;
|
||||||
private final THashMap<String, Object> cacheable;
|
private final THashMap<String, Object> cacheable;
|
||||||
public boolean canRotate = true;
|
public boolean canRotate = true;
|
||||||
|
@ -194,9 +194,7 @@ public class WiredHandler {
|
|||||||
if (effect != null && effect.canExecute(millis)) {
|
if (effect != null && effect.canExecute(millis)) {
|
||||||
executed = true;
|
executed = true;
|
||||||
if (!effect.requiresTriggeringUser() || (roomUnit != null && effect.requiresTriggeringUser())) {
|
if (!effect.requiresTriggeringUser() || (roomUnit != null && effect.requiresTriggeringUser())) {
|
||||||
Emulator.getThreading().run(new Runnable() {
|
Emulator.getThreading().run(() -> {
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
if (room.isLoaded()) {
|
if (room.isLoaded()) {
|
||||||
try {
|
try {
|
||||||
if (!effect.execute(roomUnit, room, stuff)) return;
|
if (!effect.execute(roomUnit, room, stuff)) return;
|
||||||
@ -207,7 +205,6 @@ public class WiredHandler {
|
|||||||
|
|
||||||
effect.activateBox(room);
|
effect.activateBox(room);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}, effect.getDelay() * 500);
|
}, effect.getDelay() * 500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@ public class RoomUnitTeleport implements Runnable {
|
|||||||
this.y = y;
|
this.y = y;
|
||||||
this.z = z;
|
this.z = z;
|
||||||
this.newEffect = newEffect;
|
this.newEffect = newEffect;
|
||||||
|
roomUnit.isWiredTeleporting = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -53,6 +54,7 @@ public class RoomUnitTeleport implements Runnable {
|
|||||||
ServerMessage teleportMessage = new RoomUnitOnRollerComposer(this.roomUnit, t, this.room).compose();
|
ServerMessage teleportMessage = new RoomUnitOnRollerComposer(this.roomUnit, t, this.room).compose();
|
||||||
this.roomUnit.setLocation(t);
|
this.roomUnit.setLocation(t);
|
||||||
this.room.sendComposer(teleportMessage);
|
this.room.sendComposer(teleportMessage);
|
||||||
|
roomUnit.isWiredTeleporting = false;
|
||||||
|
|
||||||
this.room.updateHabbosAt(t.x, t.y);
|
this.room.updateHabbosAt(t.x, t.y);
|
||||||
this.room.updateBotsAt(t.x, t.y);
|
this.room.updateBotsAt(t.x, t.y);
|
||||||
|
Loading…
Reference in New Issue
Block a user