🔹 small updates

This commit is contained in:
duckietm 2025-02-05 14:36:19 +01:00
parent 65069510e7
commit 57aa3c14cd
3 changed files with 29 additions and 41 deletions

View File

@ -366,7 +366,6 @@ public final class MarketPlace {
THashSet<MarketPlaceOffer> offers = new THashSet<>();
offers.addAll(client.getHabbo().getInventory().getMarketplaceItems());
synchronized (client.getHabbo().getInventory()) {
for (MarketPlaceOffer offer : offers) {
if (offer.getState().equals(MarketPlaceState.SOLD)) {
client.getHabbo().getInventory().removeMarketplaceOffer(offer);
@ -376,7 +375,6 @@ public final class MarketPlace {
Emulator.getThreading().run(offer);
}
}
}
offers.clear();

View File

@ -4,7 +4,6 @@ import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient;
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.RoomUnit;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.messages.ServerMessage;
@ -13,7 +12,6 @@ import com.eu.habbo.threading.runnables.CannonResetCooldownAction;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
public class InteractionCannon extends HabboItem {
public boolean cooldown = false;
@ -46,41 +44,33 @@ public class InteractionCannon extends HabboItem {
return false;
}
@Override
public void onClick(GameClient client, Room room, Object[] objects) throws Exception {
super.onClick(client, room, objects);
if (room == null)
return;
if (room == null) return;
RoomTile tile = room.getLayout().getTile(this.getX(), this.getY());
RoomTile fuseTile = room.getLayout().getTileInFront(tile, this.getRotation());
List<RoomTile> tiles = room.getLayout().getTilesAround(fuseTile);
tiles.remove(room.getLayout().getTileInFront(tile, (this.getRotation() + 7) % 8));
tiles.remove(room.getLayout().getTileInFront(tile, (this.getRotation() + 5) % 8));
boolean conditionClient = (client != null);
boolean conditionTile = (tiles.contains(client != null ? client.getHabbo().getRoomUnit().getCurrentLocation() : null));
boolean conditionWalk = (client != null && client.getHabbo().getRoomUnit().canWalk());
if (!this.cooldown && conditionClient && conditionTile && conditionWalk) {
client.getHabbo().getRoomUnit().setCanWalk(false);
client.getHabbo().getRoomUnit().setGoalLocation(client.getHabbo().getRoomUnit().getCurrentLocation());
client.getHabbo().getRoomUnit().lookAtPoint(fuseTile);
client.getHabbo().getRoomUnit().statusUpdate(true);
if (client != null) {
RoomUnit roomUnit = client.getHabbo().getRoomUnit();
int rotation = this.getRotation();
int dx = (rotation == 4) ? -1 : (rotation == 0) ? 2 : 0;
int dy = (rotation == 2) ? 2 : (rotation == 6) ? -1 : 0;
int x = this.getX() + dx;
int y = this.getY() + dy;
if (roomUnit.getX() == x && roomUnit.getY() == y) {
this.shoot(room, client);
}
} else {
this.shoot(room, null);
}
}
private void shoot(Room room, GameClient client) {
this.cooldown = true;
this.setExtradata(this.getExtradata().equals("1") ? "0" : "1");
room.updateItemState(this);
Emulator.getThreading().run(new CannonKickAction(this, room, client), 750);
Emulator.getThreading().run(new CannonResetCooldownAction(this), 2000);
}
}
@Override
public void onWalk(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {

View File

@ -330,7 +330,7 @@ public class RoomUnit {
zHeight += room.getLayout().getHeightAtSquare(next.x, next.y);
}
Optional<HabboItem> stackHelper = this.room.getItemsAt(next).stream().filter(i -> i instanceof InteractionTileWalkMagic).findAny();
Optional<HabboItem> stackHelper = room.getItemsAt(next).stream().filter(i -> i instanceof InteractionTileWalkMagic).findAny();
if (stackHelper.isPresent()) {
zHeight = stackHelper.get().getZ();
}