🆕 Interaction Tile Green Walk Habbo
Credits to AlfreviD !
This commit is contained in:
parent
6f05de3635
commit
caddef0d69
@ -341,6 +341,10 @@ public class ItemManager {
|
|||||||
this.interactionsList.add(new ItemInteraction("totem_leg", InteractionTotemLegs.class));
|
this.interactionsList.add(new ItemInteraction("totem_leg", InteractionTotemLegs.class));
|
||||||
this.interactionsList.add(new ItemInteraction("totem_head", InteractionTotemHead.class));
|
this.interactionsList.add(new ItemInteraction("totem_head", InteractionTotemHead.class));
|
||||||
this.interactionsList.add(new ItemInteraction("totem_planet", InteractionTotemPlanet.class));
|
this.interactionsList.add(new ItemInteraction("totem_planet", InteractionTotemPlanet.class));
|
||||||
|
|
||||||
|
/* Habbo 2.0 * By AlfreviD */
|
||||||
|
|
||||||
|
this.interactionsList.add(new ItemInteraction("tile_walk_magic", InteractionTileWalkMagic.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -0,0 +1,55 @@
|
|||||||
|
package com.eu.habbo.habbohotel.items.interactions;
|
||||||
|
|
||||||
|
import com.eu.habbo.habbohotel.items.Item;
|
||||||
|
import com.eu.habbo.habbohotel.rooms.Room;
|
||||||
|
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
||||||
|
import com.eu.habbo.habbohotel.rooms.RoomTileState;
|
||||||
|
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||||
|
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||||
|
import com.eu.habbo.messages.ServerMessage;
|
||||||
|
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
|
||||||
|
public class InteractionTileWalkMagic extends HabboItem {
|
||||||
|
public InteractionTileWalkMagic(ResultSet set, Item baseItem) throws SQLException {
|
||||||
|
super(set, baseItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
public InteractionTileWalkMagic(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) {
|
||||||
|
super(id, userId, item, extradata, limitedStack, limitedSells);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canWalkOn(RoomUnit roomUnit, Room room, Object[] objects) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RoomTileState getOverrideTileState(RoomTile tile, Room room) {
|
||||||
|
return RoomTileState.OPEN;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void serializeExtradata(ServerMessage serverMessage) {
|
||||||
|
serverMessage.appendInt((this.isLimited() ? 256 : 0));
|
||||||
|
serverMessage.appendString(this.getExtradata());
|
||||||
|
|
||||||
|
super.serializeExtradata(serverMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canOverrideTile(RoomUnit unit, Room room, RoomTile tile) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isWalkable() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onWalk(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -640,6 +640,12 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
result = overriddenState;
|
result = overriddenState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Optional<HabboItem> stackHelper = this.getItemsAt(tile).stream().filter(itemS -> itemS instanceof InteractionTileWalkMagic).findAny();
|
||||||
|
|
||||||
|
if (stackHelper.isPresent()) {
|
||||||
|
result = RoomTileState.OPEN;
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3657,6 +3663,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
boolean canStack = true;
|
boolean canStack = true;
|
||||||
|
|
||||||
THashSet<HabboItem> stackHelpers = this.getItemsAt(InteractionStackHelper.class, x, y);
|
THashSet<HabboItem> stackHelpers = this.getItemsAt(InteractionStackHelper.class, x, y);
|
||||||
|
stackHelpers.addAll(this.getItemsAt(InteractionTileWalkMagic.class, x, y));
|
||||||
|
|
||||||
if (stackHelpers.size() > 0) {
|
if (stackHelpers.size() > 0) {
|
||||||
for (HabboItem item : stackHelpers) {
|
for (HabboItem item : stackHelpers) {
|
||||||
@ -4650,9 +4657,9 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
pluginHelper = event.hasPluginHelper();
|
pluginHelper = event.hasPluginHelper();
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean magicTile = item instanceof InteractionStackHelper;
|
boolean magicTile = item instanceof InteractionStackHelper || item instanceof InteractionTileWalkMagic;
|
||||||
|
|
||||||
Optional<HabboItem> stackHelper = this.getItemsAt(tile).stream().filter(i -> i instanceof InteractionStackHelper).findAny();
|
Optional<HabboItem> stackHelper = this.getItemsAt(tile).stream().filter(i -> i instanceof InteractionStackHelper || i instanceof InteractionTileWalkMagic).findAny();
|
||||||
|
|
||||||
//Check if can be placed at new position
|
//Check if can be placed at new position
|
||||||
THashSet<RoomTile> occupiedTiles = this.layout.getTilesAt(tile, item.getBaseItem().getWidth(), item.getBaseItem().getLength(), rotation);
|
THashSet<RoomTile> occupiedTiles = this.layout.getTilesAt(tile, item.getBaseItem().getWidth(), item.getBaseItem().getLength(), rotation);
|
||||||
@ -4660,7 +4667,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
|
|
||||||
HabboItem topItem = this.getTopItemAt(occupiedTiles, null);
|
HabboItem topItem = this.getTopItemAt(occupiedTiles, null);
|
||||||
|
|
||||||
if (!stackHelper.isPresent() && !pluginHelper) {
|
if ((stackHelper.isEmpty() && !pluginHelper)) {
|
||||||
if (oldLocation != tile) {
|
if (oldLocation != tile) {
|
||||||
for (RoomTile t : occupiedTiles) {
|
for (RoomTile t : occupiedTiles) {
|
||||||
HabboItem tileTopItem = this.getTopItemAt(t.x, t.y);
|
HabboItem tileTopItem = this.getTopItemAt(t.x, t.y);
|
||||||
|
@ -325,6 +325,12 @@ public class RoomUnit {
|
|||||||
zHeight += room.getLayout().getHeightAtSquare(next.x, next.y);
|
zHeight += room.getLayout().getHeightAtSquare(next.x, next.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Optional<HabboItem> stackHelper = this.room.getItemsAt(next).stream().filter(itemS -> itemS instanceof InteractionTileWalkMagic).findAny();
|
||||||
|
|
||||||
|
if (stackHelper.isPresent()) {
|
||||||
|
zHeight = stackHelper.get().getZ();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
this.setPreviousLocation(this.getCurrentLocation());
|
this.setPreviousLocation(this.getCurrentLocation());
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.eu.habbo.messages.incoming.rooms.items;
|
package com.eu.habbo.messages.incoming.rooms.items;
|
||||||
|
|
||||||
import com.eu.habbo.habbohotel.items.interactions.InteractionStackHelper;
|
import com.eu.habbo.habbohotel.items.interactions.InteractionStackHelper;
|
||||||
|
import com.eu.habbo.habbohotel.items.interactions.InteractionTileWalkMagic;
|
||||||
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.RoomTile;
|
||||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||||
@ -20,7 +21,7 @@ public class SetStackHelperHeightEvent extends MessageHandler {
|
|||||||
if (this.client.getHabbo().getHabboInfo().getId() == this.client.getHabbo().getHabboInfo().getCurrentRoom().getOwnerId() || this.client.getHabbo().getHabboInfo().getCurrentRoom().hasRights(this.client.getHabbo())) {
|
if (this.client.getHabbo().getHabboInfo().getId() == this.client.getHabbo().getHabboInfo().getCurrentRoom().getOwnerId() || this.client.getHabbo().getHabboInfo().getCurrentRoom().hasRights(this.client.getHabbo())) {
|
||||||
HabboItem item = this.client.getHabbo().getHabboInfo().getCurrentRoom().getHabboItem(itemId);
|
HabboItem item = this.client.getHabbo().getHabboInfo().getCurrentRoom().getHabboItem(itemId);
|
||||||
|
|
||||||
if (item instanceof InteractionStackHelper) {
|
if (item instanceof InteractionStackHelper || item instanceof InteractionTileWalkMagic) {
|
||||||
Room room = this.client.getHabbo().getHabboInfo().getCurrentRoom();
|
Room room = this.client.getHabbo().getHabboInfo().getCurrentRoom();
|
||||||
RoomTile itemTile = room.getLayout().getTile(item.getX(), item.getY());
|
RoomTile itemTile = room.getLayout().getTile(item.getX(), item.getY());
|
||||||
double stackerHeight = this.packet.readInt();
|
double stackerHeight = this.packet.readInt();
|
||||||
@ -49,6 +50,18 @@ public class SetStackHelperHeightEvent extends MessageHandler {
|
|||||||
item.setZ(height);
|
item.setZ(height);
|
||||||
item.setExtradata((int) (height * 100) + "");
|
item.setExtradata((int) (height * 100) + "");
|
||||||
item.needsUpdate(true);
|
item.needsUpdate(true);
|
||||||
|
|
||||||
|
if (item instanceof InteractionTileWalkMagic) {
|
||||||
|
for (RoomTile t : tiles) {
|
||||||
|
this.client.getHabbo().getHabboInfo().getCurrentRoom().updateHabbosAt(
|
||||||
|
t.x,
|
||||||
|
t.y,
|
||||||
|
this.client.getHabbo().getHabboInfo().getCurrentRoom().getHabbosAt(t.x, t.y)
|
||||||
|
);
|
||||||
|
this.client.getHabbo().getHabboInfo().getCurrentRoom().updateBotsAt(t.x, t.y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.client.getHabbo().getHabboInfo().getCurrentRoom().updateItem(item);
|
this.client.getHabbo().getHabboInfo().getCurrentRoom().updateItem(item);
|
||||||
this.client.getHabbo().getHabboInfo().getCurrentRoom().updateTiles(tiles);
|
this.client.getHabbo().getHabboInfo().getCurrentRoom().updateTiles(tiles);
|
||||||
this.client.getHabbo().getHabboInfo().getCurrentRoom().sendComposer(new UpdateStackHeightComposer(room, tiles).compose());
|
this.client.getHabbo().getHabboInfo().getCurrentRoom().sendComposer(new UpdateStackHeightComposer(room, tiles).compose());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user