This commit is contained in:
Alejandro 2020-01-27 22:38:41 +02:00
parent 913ca752ba
commit 9b062bd760
5 changed files with 24 additions and 8 deletions

View File

@ -38,8 +38,6 @@ public class InteractionGate extends HabboItem {
@Override @Override
public void onClick(GameClient client, Room room, Object[] objects) throws Exception { public void onClick(GameClient client, Room room, Object[] objects) throws Exception {
super.onClick(client, room, objects);
boolean isWired = (objects.length >= 2 && objects[1] instanceof WiredEffectType && objects[1] == WiredEffectType.TOGGLE_STATE); boolean isWired = (objects.length >= 2 && objects[1] instanceof WiredEffectType && objects[1] == WiredEffectType.TOGGLE_STATE);
if (client != null && !room.hasRights(client.getHabbo()) && !isWired) if (client != null && !room.hasRights(client.getHabbo()) && !isWired)
return; return;
@ -54,6 +52,8 @@ public class InteractionGate extends HabboItem {
room.updateTile(room.getLayout().getTile(this.getX(), this.getY())); room.updateTile(room.getLayout().getTile(this.getX(), this.getY()));
this.needsUpdate(true); this.needsUpdate(true);
room.updateItemState(this); room.updateItemState(this);
super.onClick(client, room, new Object[]{"TOGGLE_OVERRIDE"});
} }
public void onWalk(RoomUnit roomUnit, Room room, Object[] objects) throws Exception { public void onWalk(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {

View File

@ -80,6 +80,8 @@ public class InteractionPuzzleBox extends HabboItem {
room.scheduledComposers.add(new FloorItemOnRollerComposer(this, null, tile, 0, room).compose()); room.scheduledComposers.add(new FloorItemOnRollerComposer(this, null, tile, 0, room).compose());
room.scheduledTasks.add(() -> client.getHabbo().getRoomUnit().setGoalLocation(boxLocation)); room.scheduledTasks.add(() -> client.getHabbo().getRoomUnit().setGoalLocation(boxLocation));
this.needsUpdate(true); this.needsUpdate(true);
super.onClick(client, room, new Object[]{"TOGGLE_OVERRIDE"});
} }
@Override @Override

View File

@ -83,6 +83,12 @@ public class InteractionTeleport extends HabboItem {
if (this.roomUnitID == unit.getId() && unit.getCurrentLocation().equals(currentLocation)) { if (this.roomUnitID == unit.getId() && unit.getCurrentLocation().equals(currentLocation)) {
startTeleport(room, habbo); startTeleport(room, habbo);
walkable = true; walkable = true;
try {
super.onClick(client, room, new Object[]{"TOGGLE_OVERRIDE"});
} catch (Exception e) {
e.printStackTrace();
}
} else if (unit.getCurrentLocation().equals(currentLocation) || unit.getCurrentLocation().equals(infrontTile)) { } else if (unit.getCurrentLocation().equals(currentLocation) || unit.getCurrentLocation().equals(infrontTile)) {
// set state 1 and walk on item // set state 1 and walk on item
this.roomUnitID = unit.getId(); this.roomUnitID = unit.getId();
@ -133,9 +139,7 @@ public class InteractionTeleport extends HabboItem {
@Override @Override
public void onClick(GameClient client, Room room, Object[] objects) throws Exception { public void onClick(GameClient client, Room room, Object[] objects) throws Exception {
super.onClick(client, room, objects); if (room != null && client != null && objects != null && objects.length <= 1) {
if (room != null && client != null && objects.length <= 1) {
tryTeleport(client, room); tryTeleport(client, room);
} }
} }

View File

@ -62,6 +62,8 @@ public class InteractionVendingMachine extends HabboItem {
room.giveEffect(client.getHabbo(), this.getBaseItem().getEffectM(), -1); room.giveEffect(client.getHabbo(), this.getBaseItem().getEffectM(), -1);
if (this.getBaseItem().getEffectF() > 0 && client.getHabbo().getHabboInfo().getGender() == HabboGender.F) if (this.getBaseItem().getEffectF() > 0 && client.getHabbo().getHabboInfo().getGender() == HabboGender.F)
room.giveEffect(client.getHabbo(), this.getBaseItem().getEffectF(), -1); room.giveEffect(client.getHabbo(), this.getBaseItem().getEffectF(), -1);
super.onClick(client, room, new Object[]{"TOGGLE_OVERRIDE"});
} }
} else { } else {
if (!tile.isWalkable() && tile.state != RoomTileState.SIT && tile.state != RoomTileState.LAY) { if (!tile.isWalkable() && tile.state != RoomTileState.SIT && tile.state != RoomTileState.LAY) {

View File

@ -9,6 +9,7 @@ import com.eu.habbo.habbohotel.items.FurnitureType;
import com.eu.habbo.habbohotel.items.IEventTriggers; import com.eu.habbo.habbohotel.items.IEventTriggers;
import com.eu.habbo.habbohotel.items.Item; import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.*; import com.eu.habbo.habbohotel.items.interactions.*;
import com.eu.habbo.habbohotel.items.interactions.games.InteractionGameTimer;
import com.eu.habbo.habbohotel.rooms.Room; import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomLayout; import com.eu.habbo.habbohotel.rooms.RoomLayout;
import com.eu.habbo.habbohotel.rooms.RoomTile; import com.eu.habbo.habbohotel.rooms.RoomTile;
@ -20,7 +21,6 @@ import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserDanceComposer; import com.eu.habbo.messages.outgoing.rooms.users.RoomUserDanceComposer;
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserDataComposer; import com.eu.habbo.messages.outgoing.rooms.users.RoomUserDataComposer;
import com.eu.habbo.messages.outgoing.users.UpdateUserLookComposer; import com.eu.habbo.messages.outgoing.users.UpdateUserLookComposer;
import com.eu.habbo.util.figure.FigureUtil;
import gnu.trove.set.hash.THashSet; import gnu.trove.set.hash.THashSet;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.math3.util.Pair; import org.apache.commons.math3.util.Pair;
@ -34,6 +34,13 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
public abstract class HabboItem implements Runnable, IEventTriggers { public abstract class HabboItem implements Runnable, IEventTriggers {
private static Class[] TOGGLING_INTERACTIONS = new Class[]{
InteractionGameTimer.class,
InteractionWired.class,
InteractionWiredHighscore.class,
InteractionMultiHeight.class
};
private int id; private int id;
private int userId; private int userId;
private int roomId; private int roomId;
@ -283,8 +290,9 @@ public abstract class HabboItem implements Runnable, IEventTriggers {
} }
} }
if ((this.getBaseItem().getStateCount() > 1 && !(this instanceof InteractionDice)) || Arrays.asList(HabboItem.TOGGLING_INTERACTIONS).contains(this.getClass()) || (objects != null && objects.length == 1 && objects[0].equals("TOGGLE_OVERRIDE"))) {
WiredHandler.handle(WiredTriggerType.STATE_CHANGED, client.getHabbo().getRoomUnit(), room, new Object[]{this}); WiredHandler.handle(WiredTriggerType.STATE_CHANGED, client.getHabbo().getRoomUnit(), room, new Object[]{this});
}
} }
} }