Add vending machines without sides

This commit is contained in:
Alejandro 2020-02-06 01:16:51 +02:00
parent b87cbd398b
commit df8f80f9cb
3 changed files with 30 additions and 1 deletions

View File

@ -178,6 +178,7 @@ public class ItemManager {
this.interactionsList.add(new ItemInteraction("effect_tile_group", InteractionEffectTile.class)); this.interactionsList.add(new ItemInteraction("effect_tile_group", InteractionEffectTile.class));
this.interactionsList.add(new ItemInteraction("crackable_subscription_box", InteractionRedeemableSubscriptionBox.class)); this.interactionsList.add(new ItemInteraction("crackable_subscription_box", InteractionRedeemableSubscriptionBox.class));
this.interactionsList.add(new ItemInteraction("random_state", InteractionRandomState.class)); this.interactionsList.add(new ItemInteraction("random_state", InteractionRandomState.class));
this.interactionsList.add(new ItemInteraction("vendingmachine_no_sides", InteractionNoSidesVendingMachine.class));
this.interactionsList.add(new ItemInteraction("game_timer", InteractionGameTimer.class)); this.interactionsList.add(new ItemInteraction("game_timer", InteractionGameTimer.class));

View File

@ -0,0 +1,24 @@
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.users.Habbo;
import java.sql.ResultSet;
import java.sql.SQLException;
public class InteractionNoSidesVendingMachine extends InteractionVendingMachine {
public InteractionNoSidesVendingMachine(ResultSet set, Item baseItem) throws SQLException {
super(set, baseItem);
}
public InteractionNoSidesVendingMachine(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells) {
super(id, userId, item, extradata, limitedStack, limitedSells);
}
@Override
public RoomTile getRequiredTile(Habbo habbo, Room room) {
return habbo.getRoomUnit().getClosestAdjacentTile(this.getX(), this.getY(), true);
}
}

View File

@ -46,7 +46,7 @@ public class InteractionVendingMachine extends HabboItem {
super.onClick(client, room, objects); super.onClick(client, room, objects);
if (client != null) { if (client != null) {
RoomTile tile = getSquareInFront(room.getLayout(), this); RoomTile tile = this.getRequiredTile(client.getHabbo(), room);
if (tile != null) { if (tile != null) {
if (tile.equals(client.getHabbo().getRoomUnit().getCurrentLocation())) { if (tile.equals(client.getHabbo().getRoomUnit().getCurrentLocation())) {
@ -207,4 +207,8 @@ public class InteractionVendingMachine extends HabboItem {
public void giveVendingMachineItem(Habbo habbo, Room room) { public void giveVendingMachineItem(Habbo habbo, Room room) {
Emulator.getThreading().run(new RoomUnitGiveHanditem(habbo.getRoomUnit(), room, this.getBaseItem().getRandomVendingItem())); Emulator.getThreading().run(new RoomUnitGiveHanditem(habbo.getRoomUnit(), room, this.getBaseItem().getRandomVendingItem()));
} }
public RoomTile getRequiredTile(Habbo habbo, Room room) {
return getSquareInFront(room.getLayout(), this);
}
} }