mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-30 01:50:50 +01:00
Merge branch '16-teleporters' into 'dev'
Resolve "Teleporters" See merge request morningstar/Arcturus-Community!5
This commit is contained in:
commit
faf050b1cc
@ -35,8 +35,8 @@ public class InteractionHabboClubTeleportTile extends InteractionTeleportTile
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean canUseTeleport(GameClient client, Room room)
|
public boolean canUseTeleport(GameClient client, Room room)
|
||||||
{
|
{
|
||||||
return client.getHabbo().getHabboStats().hasActiveClub();
|
return super.canUseTeleport(client, room) && client.getHabbo().getHabboStats().hasActiveClub();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -11,25 +11,31 @@ import com.eu.habbo.habbohotel.users.Habbo;
|
|||||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||||
import com.eu.habbo.messages.ServerMessage;
|
import com.eu.habbo.messages.ServerMessage;
|
||||||
import com.eu.habbo.messages.outgoing.rooms.items.ItemIntStateComposer;
|
import com.eu.habbo.messages.outgoing.rooms.items.ItemIntStateComposer;
|
||||||
|
import com.eu.habbo.threading.runnables.RoomUnitWalkToLocation;
|
||||||
import com.eu.habbo.threading.runnables.teleport.TeleportActionOne;
|
import com.eu.habbo.threading.runnables.teleport.TeleportActionOne;
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class InteractionTeleport extends HabboItem
|
public class InteractionTeleport extends HabboItem
|
||||||
{
|
{
|
||||||
private int targetId;
|
private int targetId;
|
||||||
private int targetRoomId;
|
private int targetRoomId;
|
||||||
private int roomUnitID = 0;
|
private int roomUnitID = -1;
|
||||||
|
private boolean walkable = false;
|
||||||
|
|
||||||
public InteractionTeleport(ResultSet set, Item baseItem) throws SQLException
|
public InteractionTeleport(ResultSet set, Item baseItem) throws SQLException
|
||||||
{
|
{
|
||||||
super(set, baseItem);
|
super(set, baseItem);
|
||||||
|
walkable = baseItem.allowWalk();
|
||||||
}
|
}
|
||||||
|
|
||||||
public InteractionTeleport(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells)
|
public InteractionTeleport(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells)
|
||||||
{
|
{
|
||||||
super(id, userId, item, extradata, limitedStack, limitedSells);
|
super(id, userId, item, extradata, limitedStack, limitedSells);
|
||||||
|
walkable = item.allowWalk();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -48,9 +54,81 @@ public class InteractionTeleport extends HabboItem
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isWalkable()
|
public boolean isWalkable() {
|
||||||
{
|
return walkable;
|
||||||
return true;
|
}
|
||||||
|
|
||||||
|
private void tryTeleport(GameClient client, Room room) {
|
||||||
|
/*
|
||||||
|
if user is on item, startTeleport
|
||||||
|
else if user is on infront, set state 1 and walk on item
|
||||||
|
else move to infront and interact
|
||||||
|
*/
|
||||||
|
|
||||||
|
Habbo habbo = client.getHabbo();
|
||||||
|
|
||||||
|
if(habbo == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
RoomUnit unit = habbo.getRoomUnit();
|
||||||
|
|
||||||
|
if(unit == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
RoomTile currentLocation = room.getLayout().getTile(this.getX(), this.getY());
|
||||||
|
|
||||||
|
if(currentLocation == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
RoomTile infrontTile = room.getLayout().getTileInFront(currentLocation, this.getRotation());
|
||||||
|
|
||||||
|
if(!canUseTeleport(client, room))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(this.roomUnitID == unit.getId() && unit.getCurrentLocation().equals(currentLocation)) {
|
||||||
|
startTeleport(room, habbo);
|
||||||
|
}
|
||||||
|
else if(unit.getCurrentLocation().equals(currentLocation) || unit.getCurrentLocation().equals(infrontTile)) {
|
||||||
|
// set state 1 and walk on item
|
||||||
|
this.roomUnitID = unit.getId();
|
||||||
|
this.setExtradata("1");
|
||||||
|
room.updateItem(this);
|
||||||
|
unit.setGoalLocation(infrontTile);
|
||||||
|
|
||||||
|
List<Runnable> onSuccess = new ArrayList<Runnable>();
|
||||||
|
List<Runnable> onFail = new ArrayList<Runnable>();
|
||||||
|
|
||||||
|
onSuccess.add(() -> {
|
||||||
|
walkable = this.getBaseItem().allowWalk();
|
||||||
|
room.updateTile(currentLocation);
|
||||||
|
tryTeleport(client, room);
|
||||||
|
});
|
||||||
|
|
||||||
|
onFail.add(() -> {
|
||||||
|
walkable = this.getBaseItem().allowWalk();
|
||||||
|
room.updateTile(currentLocation);
|
||||||
|
this.setExtradata("0");
|
||||||
|
room.updateItem(this);
|
||||||
|
this.roomUnitID = -1;
|
||||||
|
});
|
||||||
|
|
||||||
|
walkable = true;
|
||||||
|
room.updateTile(currentLocation);
|
||||||
|
unit.setGoalLocation(currentLocation);
|
||||||
|
Emulator.getThreading().run(new RoomUnitWalkToLocation(unit, currentLocation, room, onSuccess, onFail));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// walk to teleport and interact
|
||||||
|
List<Runnable> onSuccess = new ArrayList<Runnable>();
|
||||||
|
List<Runnable> onFail = new ArrayList<Runnable>();
|
||||||
|
|
||||||
|
onSuccess.add(() -> {
|
||||||
|
tryTeleport(client, room);
|
||||||
|
});
|
||||||
|
|
||||||
|
unit.setGoalLocation(infrontTile);
|
||||||
|
Emulator.getThreading().run(new RoomUnitWalkToLocation(unit, infrontTile, room, onSuccess, onFail));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -60,54 +138,12 @@ public class InteractionTeleport extends HabboItem
|
|||||||
|
|
||||||
if(room != null && client != null && objects.length <= 1)
|
if(room != null && client != null && objects.length <= 1)
|
||||||
{
|
{
|
||||||
RoomTile tile = room.getLayout().getTileInFront(room.getLayout().getTile(this.getX(), this.getY()), this.getRotation());
|
tryTeleport(client, room);
|
||||||
RoomTile teleportPosition = room.getLayout().getTile(this.getX(), this.getY());
|
|
||||||
|
|
||||||
if (tile != null && tile.equals(client.getHabbo().getRoomUnit().getCurrentLocation()))
|
|
||||||
{
|
|
||||||
if (!room.hasHabbosAt(this.getX(), this.getY()) && this.roomUnitID == 0)
|
|
||||||
{
|
|
||||||
room.sendComposer(new ItemIntStateComposer(this.getId(), 1).compose());
|
|
||||||
room.scheduledTasks.add(() -> {
|
|
||||||
if (client.getHabbo().getRoomUnit().isTeleporting) return;
|
|
||||||
this.roomUnitID = client.getHabbo().getRoomUnit().getId();
|
|
||||||
room.updateTile(teleportPosition);
|
|
||||||
client.getHabbo().getRoomUnit().setGoalLocation(room.getLayout().getTile(this.getX(), this.getY()));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (teleportPosition.equals(client.getHabbo().getRoomUnit().getCurrentLocation()) && tile != null && tile.state != RoomTileState.BLOCKED && tile.state != RoomTileState.INVALID)
|
|
||||||
{
|
|
||||||
this.startTeleport(room, client.getHabbo());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onWalk(RoomUnit roomUnit, Room room, Object[] objects) throws Exception
|
public void onWalk(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) throws Exception
|
|
||||||
{
|
|
||||||
super.onWalkOn(roomUnit, room, objects);
|
|
||||||
|
|
||||||
Habbo habbo = room.getHabbo(roomUnit);
|
|
||||||
|
|
||||||
if (habbo != null && habbo.getRoomUnit().getId() == this.roomUnitID)
|
|
||||||
{
|
|
||||||
if (habbo.getRoomUnit().getGoal().equals(room.getLayout().getTile(this.getX(), this.getY())))
|
|
||||||
{
|
|
||||||
this.startTeleport(room, habbo);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onWalkOff(RoomUnit roomUnit, Room room, Object[] objects) throws Exception
|
|
||||||
{
|
|
||||||
super.onWalkOff(roomUnit, room, objects);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -131,23 +167,10 @@ public class InteractionTeleport extends HabboItem
|
|||||||
{
|
{
|
||||||
this.targetId = 0;
|
this.targetId = 0;
|
||||||
this.targetRoomId = 0;
|
this.targetRoomId = 0;
|
||||||
|
this.roomUnitID = -1;
|
||||||
this.setExtradata("0");
|
this.setExtradata("0");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean canUseTeleport(GameClient client, Room room)
|
|
||||||
{
|
|
||||||
if(!this.getExtradata().equals("0"))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if(client.getHabbo().getRoomUnit().isTeleporting)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (client.getHabbo().getRoomUnit().getCurrentLocation().is(this.getX(), this.getY()))
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getTargetId()
|
public int getTargetId()
|
||||||
{
|
{
|
||||||
return this.targetId;
|
return this.targetId;
|
||||||
@ -174,17 +197,32 @@ public class InteractionTeleport extends HabboItem
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean canUseTeleport(GameClient client, Room room) {
|
||||||
|
|
||||||
|
Habbo habbo = client.getHabbo();
|
||||||
|
|
||||||
|
if(habbo == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
RoomUnit unit = habbo.getRoomUnit();
|
||||||
|
|
||||||
|
if(unit == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if(habbo.getHabboInfo().getRiding() != null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return this.roomUnitID == -1 || this.roomUnitID == unit.getId();
|
||||||
|
}
|
||||||
|
|
||||||
public void startTeleport(Room room, Habbo habbo)
|
public void startTeleport(Room room, Habbo habbo)
|
||||||
{
|
{
|
||||||
if (this.canUseTeleport(habbo.getClient(), room))
|
if(habbo.getRoomUnit().isTeleporting)
|
||||||
{
|
return;
|
||||||
this.roomUnitID = 0;
|
|
||||||
habbo.getRoomUnit().isTeleporting = true;
|
this.roomUnitID = -1;
|
||||||
//new TeleportInteraction(room, client, this).run();
|
habbo.getRoomUnit().isTeleporting = true;
|
||||||
this.setExtradata("1");
|
room.scheduledTasks.add(new TeleportActionOne(this, room, habbo.getClient()));
|
||||||
room.updateItem(this);
|
|
||||||
room.scheduledTasks.add(new TeleportActionOne(this, room, habbo.getClient()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -3,6 +3,7 @@ package com.eu.habbo.habbohotel.items.interactions;
|
|||||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||||
import com.eu.habbo.habbohotel.items.Item;
|
import com.eu.habbo.habbohotel.items.Item;
|
||||||
import com.eu.habbo.habbohotel.rooms.Room;
|
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.habbohotel.rooms.RoomUnit;
|
||||||
import com.eu.habbo.habbohotel.users.Habbo;
|
import com.eu.habbo.habbohotel.users.Habbo;
|
||||||
|
|
||||||
@ -27,17 +28,27 @@ public class InteractionTeleportTile extends InteractionTeleport
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isWalkable() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) throws Exception
|
public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) throws Exception
|
||||||
{
|
{
|
||||||
if (roomUnit != null)
|
if (roomUnit != null)
|
||||||
{
|
{
|
||||||
if (roomUnit.getGoal().is(this.getX(), this.getY()) && this.canWalkOn(roomUnit, room, objects))
|
RoomTile currentLocation = room.getLayout().getTile(this.getX(), this.getY());
|
||||||
|
|
||||||
|
if (roomUnit.getGoal().equals(currentLocation) && this.canWalkOn(roomUnit, room, objects))
|
||||||
{
|
{
|
||||||
Habbo habbo = room.getHabbo(roomUnit);
|
Habbo habbo = room.getHabbo(roomUnit);
|
||||||
|
|
||||||
if (habbo != null)
|
if (habbo != null)
|
||||||
{
|
{
|
||||||
|
if(!canUseTeleport(habbo.getClient(), room))
|
||||||
|
return;
|
||||||
|
|
||||||
if (!habbo.getRoomUnit().isTeleporting)
|
if (!habbo.getRoomUnit().isTeleporting)
|
||||||
{
|
{
|
||||||
this.startTeleport(room, habbo);
|
this.startTeleport(room, habbo);
|
||||||
@ -46,16 +57,4 @@ public class InteractionTeleportTile extends InteractionTeleport
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean canUseTeleport(GameClient client, Room room)
|
|
||||||
{
|
|
||||||
if(client.getHabbo().getRoomUnit().isTeleporting)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (client.getHabbo().getRoomUnit().getCurrentLocation().is(this.getX(), this.getY()))
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -692,8 +692,22 @@ public class RoomManager
|
|||||||
habbo.getRoomUnit().clearStatus();
|
habbo.getRoomUnit().clearStatus();
|
||||||
if (habbo.getRoomUnit().getCurrentLocation() == null)
|
if (habbo.getRoomUnit().getCurrentLocation() == null)
|
||||||
{
|
{
|
||||||
habbo.getRoomUnit().setLocation(room.getLayout().getDoorTile());
|
habbo.getRoomUnit().setLocation(doorLocation != null ? doorLocation : room.getLayout().getDoorTile());
|
||||||
|
habbo.getRoomUnit().setZ(habbo.getRoomUnit().getCurrentLocation().getStackHeight());
|
||||||
|
|
||||||
|
if(doorLocation == null) {
|
||||||
|
habbo.getRoomUnit().setBodyRotation(RoomUserRotation.values()[room.getLayout().getDoorDirection()]);
|
||||||
|
habbo.getRoomUnit().setHeadRotation(RoomUserRotation.values()[room.getLayout().getDoorDirection()]);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
habbo.getRoomUnit().isTeleporting = true;
|
||||||
|
HabboItem topItem = room.getTopItemAt(doorLocation.x, doorLocation.y);
|
||||||
|
if(topItem != null) {
|
||||||
|
habbo.getRoomUnit().setRotation(RoomUserRotation.values()[topItem.getRotation()]);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
habbo.getRoomUnit().setRoomUnitType(RoomUnitType.USER);
|
habbo.getRoomUnit().setRoomUnitType(RoomUnitType.USER);
|
||||||
if(room.isBanned(habbo))
|
if(room.isBanned(habbo))
|
||||||
{
|
{
|
||||||
@ -732,11 +746,6 @@ public class RoomManager
|
|||||||
|
|
||||||
habbo.getHabboInfo().setLoadingRoom(room.getId());
|
habbo.getHabboInfo().setLoadingRoom(room.getId());
|
||||||
|
|
||||||
if (habbo.getRoomUnit().isTeleporting)
|
|
||||||
{
|
|
||||||
habbo.getRoomUnit().setLocation(doorLocation);
|
|
||||||
}
|
|
||||||
|
|
||||||
habbo.getClient().sendResponse(new RoomModelComposer(room));
|
habbo.getClient().sendResponse(new RoomModelComposer(room));
|
||||||
|
|
||||||
if (!room.getWallPaint().equals("0.0"))
|
if (!room.getWallPaint().equals("0.0"))
|
||||||
@ -793,7 +802,7 @@ public class RoomManager
|
|||||||
}
|
}
|
||||||
habbo.getRoomUnit().isKicked = false;
|
habbo.getRoomUnit().isKicked = false;
|
||||||
|
|
||||||
if (!habbo.getRoomUnit().isTeleporting)
|
if (habbo.getRoomUnit().getCurrentLocation() == null && !habbo.getRoomUnit().isTeleporting)
|
||||||
{
|
{
|
||||||
|
|
||||||
RoomTile doorTile = room.getLayout().getTile(room.getLayout().getDoorX(), room.getLayout().getDoorY());
|
RoomTile doorTile = room.getLayout().getTile(room.getLayout().getDoorX(), room.getLayout().getDoorY());
|
||||||
|
@ -241,10 +241,9 @@ public class RoomUnit
|
|||||||
|
|
||||||
HabboItem item = room.getTopItemAt(next.x, next.y);
|
HabboItem item = room.getTopItemAt(next.x, next.y);
|
||||||
|
|
||||||
|
|
||||||
//if(!(this.path.size() == 0 && canSitNextTile))
|
//if(!(this.path.size() == 0 && canSitNextTile))
|
||||||
{
|
{
|
||||||
if (!room.tileWalkable(next.x, next.y) && !(item instanceof InteractionTeleport))
|
if (!room.tileWalkable(next.x, next.y))
|
||||||
{
|
{
|
||||||
this.room = room;
|
this.room = room;
|
||||||
this.findPath();
|
this.findPath();
|
||||||
@ -799,4 +798,8 @@ public class RoomUnit
|
|||||||
{
|
{
|
||||||
return this.invisible;
|
return this.invisible;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Room getRoom() {
|
||||||
|
return room;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,59 @@
|
|||||||
|
package com.eu.habbo.threading.runnables;
|
||||||
|
|
||||||
|
import com.eu.habbo.Emulator;
|
||||||
|
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.habbohotel.wired.WiredHandler;
|
||||||
|
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class RoomUnitWalkToLocation implements Runnable
|
||||||
|
{
|
||||||
|
private RoomUnit walker;
|
||||||
|
private RoomTile goalTile;
|
||||||
|
private Room room;
|
||||||
|
private List<Runnable> targetReached;
|
||||||
|
private List<Runnable> failedReached;
|
||||||
|
|
||||||
|
public RoomUnitWalkToLocation(RoomUnit walker, RoomTile goalTile, Room room, List<Runnable> targetReached, List<Runnable> failedReached)
|
||||||
|
{
|
||||||
|
this.walker = walker;
|
||||||
|
this.goalTile = goalTile;
|
||||||
|
this.room = room;
|
||||||
|
this.targetReached = targetReached;
|
||||||
|
this.failedReached = failedReached;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if(this.goalTile == null || this.walker == null || this.room == null || this.walker.getRoom() == null || this.walker.getRoom().getId() != this.room.getId()) {
|
||||||
|
onFail();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!this.walker.getGoal().equals(this.goalTile)) {
|
||||||
|
onFail();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this.walker.getCurrentLocation().equals(this.goalTile))
|
||||||
|
{
|
||||||
|
onSuccess();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Emulator.getThreading().run(this, 500);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onSuccess() {
|
||||||
|
for(Runnable r : this.targetReached)
|
||||||
|
Emulator.getThreading().run(r);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onFail() {
|
||||||
|
for(Runnable r : this.failedReached)
|
||||||
|
Emulator.getThreading().run(r);
|
||||||
|
}
|
||||||
|
}
|
@ -2,8 +2,7 @@ package com.eu.habbo.threading.runnables.teleport;
|
|||||||
|
|
||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||||
import com.eu.habbo.habbohotel.rooms.Room;
|
import com.eu.habbo.habbohotel.rooms.*;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
|
||||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||||
import com.eu.habbo.threading.runnables.HabboItemNewState;
|
import com.eu.habbo.threading.runnables.HabboItemNewState;
|
||||||
|
|
||||||
@ -31,11 +30,15 @@ class TeleportActionFive implements Runnable
|
|||||||
|
|
||||||
//if (!(this.currentTeleport instanceof InteractionTeleportTile))
|
//if (!(this.currentTeleport instanceof InteractionTeleportTile))
|
||||||
|
|
||||||
RoomTile tile = this.room.getLayout().getTileInFront(this.room.getLayout().getTile(this.currentTeleport.getX(), this.currentTeleport.getY()), this.currentTeleport.getRotation());
|
RoomTile currentLocation = this.room.getLayout().getTile(this.currentTeleport.getX(), this.currentTeleport.getY());
|
||||||
|
RoomTile tile = this.room.getLayout().getTileInFront(currentLocation, this.currentTeleport.getRotation());
|
||||||
|
|
||||||
if (tile != null)
|
if (tile != null)
|
||||||
{
|
{
|
||||||
|
this.client.getHabbo().getRoomUnit().setPreviousLocation(currentLocation);
|
||||||
|
this.client.getHabbo().getRoomUnit().setPreviousLocationZ(currentLocation.getStackHeight());
|
||||||
this.client.getHabbo().getRoomUnit().setGoalLocation(tile);
|
this.client.getHabbo().getRoomUnit().setGoalLocation(tile);
|
||||||
|
this.client.getHabbo().getRoomUnit().statusUpdate(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,15 +24,11 @@ class TeleportActionFour implements Runnable
|
|||||||
if (this.client.getHabbo().getHabboInfo().getCurrentRoom() != this.room)
|
if (this.client.getHabbo().getHabboInfo().getCurrentRoom() != this.room)
|
||||||
{
|
{
|
||||||
this.client.getHabbo().getRoomUnit().setCanWalk(true);
|
this.client.getHabbo().getRoomUnit().setCanWalk(true);
|
||||||
this.client.getHabbo().getRoomUnit().isTeleporting = false;
|
|
||||||
this.currentTeleport.setExtradata("0");
|
this.currentTeleport.setExtradata("0");
|
||||||
this.room.updateItem(this.currentTeleport);
|
this.room.updateItem(this.currentTeleport);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Emulator.getThreading().run(new TeleportActionFive(this.currentTeleport, this.room, this.client), 500);
|
Emulator.getThreading().run(new TeleportActionFive(this.currentTeleport, this.room, this.client), 500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
|
|||||||
import com.eu.habbo.habbohotel.items.interactions.InteractionTeleport;
|
import com.eu.habbo.habbohotel.items.interactions.InteractionTeleport;
|
||||||
import com.eu.habbo.habbohotel.items.interactions.InteractionTeleportTile;
|
import com.eu.habbo.habbohotel.items.interactions.InteractionTeleportTile;
|
||||||
import com.eu.habbo.habbohotel.rooms.Room;
|
import com.eu.habbo.habbohotel.rooms.Room;
|
||||||
|
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomUnitStatus;
|
import com.eu.habbo.habbohotel.rooms.RoomUnitStatus;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomUserRotation;
|
import com.eu.habbo.habbohotel.rooms.RoomUserRotation;
|
||||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||||
@ -50,7 +51,9 @@ class TeleportActionThree implements Runnable
|
|||||||
if(targetTeleport == null)
|
if(targetTeleport == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this.client.getHabbo().getRoomUnit().setLocation(targetRoom.getLayout().getTile(targetTeleport.getX(), targetTeleport.getY()));
|
RoomTile teleportLocation = targetRoom.getLayout().getTile(targetTeleport.getX(), targetTeleport.getY());
|
||||||
|
|
||||||
|
this.client.getHabbo().getRoomUnit().setLocation(teleportLocation);
|
||||||
this.client.getHabbo().getRoomUnit().getPath().clear();
|
this.client.getHabbo().getRoomUnit().getPath().clear();
|
||||||
this.client.getHabbo().getRoomUnit().removeStatus(RoomUnitStatus.MOVE);
|
this.client.getHabbo().getRoomUnit().removeStatus(RoomUnitStatus.MOVE);
|
||||||
this.client.getHabbo().getRoomUnit().setZ(targetTeleport.getZ());
|
this.client.getHabbo().getRoomUnit().setZ(targetTeleport.getZ());
|
||||||
@ -60,13 +63,13 @@ class TeleportActionThree implements Runnable
|
|||||||
if(targetRoom != this.room)
|
if(targetRoom != this.room)
|
||||||
{
|
{
|
||||||
this.room.sendComposer(new RoomUserRemoveComposer(this.client.getHabbo().getRoomUnit()).compose());
|
this.room.sendComposer(new RoomUserRemoveComposer(this.client.getHabbo().getRoomUnit()).compose());
|
||||||
Emulator.getGameEnvironment().getRoomManager().enterRoom(this.client.getHabbo(), targetRoom.getId(), "", Emulator.getConfig().getBoolean("hotel.teleport.locked.allowed"));
|
Emulator.getGameEnvironment().getRoomManager().enterRoom(this.client.getHabbo(), targetRoom.getId(), "", Emulator.getConfig().getBoolean("hotel.teleport.locked.allowed"), teleportLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
targetTeleport.setExtradata("2");
|
targetTeleport.setExtradata("2");
|
||||||
targetRoom.updateItem(targetTeleport);
|
targetRoom.updateItem(targetTeleport);
|
||||||
targetRoom.updateHabbo(this.client.getHabbo());
|
targetRoom.updateHabbo(this.client.getHabbo());
|
||||||
System.out.println(targetTeleport.getX() + " | " + targetTeleport.getY());
|
//System.out.println(targetTeleport.getX() + " | " + targetTeleport.getY());
|
||||||
this.client.getHabbo().getHabboInfo().setCurrentRoom(targetRoom);
|
this.client.getHabbo().getHabboInfo().setCurrentRoom(targetRoom);
|
||||||
//Emulator.getThreading().run(new HabboItemNewState(this.currentTeleport, this.room, "0"), 500);
|
//Emulator.getThreading().run(new HabboItemNewState(this.currentTeleport, this.room, "0"), 500);
|
||||||
Emulator.getThreading().run(new TeleportActionFour(targetTeleport, targetRoom, this.client), this.currentTeleport instanceof InteractionTeleportTile ? 0 : 500);
|
Emulator.getThreading().run(new TeleportActionFour(targetTeleport, targetRoom, this.client), this.currentTeleport instanceof InteractionTeleportTile ? 0 : 500);
|
||||||
|
Loading…
Reference in New Issue
Block a user