mannequin fix for jackets

This commit is contained in:
Mikkel Friis 2020-09-25 04:41:16 +02:00
parent 947d7a4ce7
commit c6ea16fe7d

View File

@ -60,26 +60,30 @@ public class InteractionMannequin 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 {
String[] lookCode = this.getExtradata().split(":")[1].split("\\."); String lookCode = this.getExtradata().split(":")[1];
String newFigure = "";
StringBuilder look = new StringBuilder(); for (String playerFigurePart : client.getHabbo().getHabboInfo().getLook().split("\\.")) {
for (String part : client.getHabbo().getHabboInfo().getLook().split("\\.")) { if (!playerFigurePart.startsWith("ch") && !playerFigurePart.startsWith("lg"))
String type = part.split("-")[0]; newFigure += playerFigurePart + ".";
boolean found = false;
for (String s : lookCode) {
if (s.contains(type)) {
found = true;
look.append(s).append(".");
}
} }
if (!found) { if (lookCode.isEmpty()) return;
look.append(part).append("."); String newFigureParts = lookCode;
}
for (String newFigurePart : newFigureParts.split("\\.")) {
if (newFigurePart.startsWith("hd"))
newFigureParts = newFigureParts.replace(newFigurePart, "");
} }
client.getHabbo().getHabboInfo().setLook(look.substring(0, look.length() - 1)); 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()); room.sendComposer(new RoomUserDataComposer(client.getHabbo()).compose());
client.sendResponse(new UserDataComposer(client.getHabbo())); client.sendResponse(new UserDataComposer(client.getHabbo()));
} }