From c6ea16fe7db3d843a555d4440e1a8450daff43f9 Mon Sep 17 00:00:00 2001 From: Mikkel Friis Date: Fri, 25 Sep 2020 04:41:16 +0200 Subject: [PATCH] mannequin fix for jackets --- .../interactions/InteractionMannequin.java | 38 ++++++++++--------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMannequin.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMannequin.java index 2901a7b9..cc291a67 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMannequin.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/InteractionMannequin.java @@ -60,26 +60,30 @@ public class InteractionMannequin extends HabboItem { @Override public void onClick(GameClient client, Room room, Object[] objects) throws Exception { - String[] lookCode = this.getExtradata().split(":")[1].split("\\."); + String lookCode = this.getExtradata().split(":")[1]; + String newFigure = ""; - StringBuilder look = new StringBuilder(); - for (String part : client.getHabbo().getHabboInfo().getLook().split("\\.")) { - String type = part.split("-")[0]; - - boolean found = false; - for (String s : lookCode) { - if (s.contains(type)) { - found = true; - look.append(s).append("."); - } - } - - if (!found) { - look.append(part).append("."); - } + for (String playerFigurePart : client.getHabbo().getHabboInfo().getLook().split("\\.")) { + if (!playerFigurePart.startsWith("ch") && !playerFigurePart.startsWith("lg")) + newFigure += playerFigurePart + "."; } - client.getHabbo().getHabboInfo().setLook(look.substring(0, look.length() - 1)); + if (lookCode.isEmpty()) return; + String newFigureParts = lookCode; + + for (String newFigurePart : newFigureParts.split("\\.")) { + if (newFigurePart.startsWith("hd")) + newFigureParts = newFigureParts.replace(newFigurePart, ""); + } + + if (newFigureParts.equals("")) return; + + final String figure = newFigure + newFigureParts; + + if (figure.length() > 512) + return; + + client.getHabbo().getHabboInfo().setLook(figure); room.sendComposer(new RoomUserDataComposer(client.getHabbo()).compose()); client.sendResponse(new UserDataComposer(client.getHabbo())); }