Merge branch 'dev' into 'dev'

mannequin fix for jackets

See merge request morningstar/Arcturus-Community!303
This commit is contained in:
Harmonic 2020-09-25 17:02:15 -04:00
commit 0033fb79ff

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) {
look.append(part).append(".");
}
} }
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()); room.sendComposer(new RoomUserDataComposer(client.getHabbo()).compose());
client.sendResponse(new UserDataComposer(client.getHabbo())); client.sendResponse(new UserDataComposer(client.getHabbo()));
} }