diff --git a/sqlupdates/2_1_1_TO_2_2_0-RC-1.sql b/sqlupdates/2_1_1_TO_2_2_0-RC-1.sql index 2c51b344..e959f808 100644 --- a/sqlupdates/2_1_1_TO_2_2_0-RC-1.sql +++ b/sqlupdates/2_1_1_TO_2_2_0-RC-1.sql @@ -51,3 +51,6 @@ ALTER TABLE `users_pets` ADD COLUMN `mp_is_dead` tinyint(1) NOT NULL DEFAULT 0; ALTER TABLE `items` CHARACTER SET = utf8, COLLATE = utf8_general_ci; + +ALTER TABLE `items_base` +ADD COLUMN `clothing_on_walk` varchar(255) NOT NULL DEFAULT ''; diff --git a/src/main/java/com/eu/habbo/habbohotel/items/Item.java b/src/main/java/com/eu/habbo/habbohotel/items/Item.java index 8584e582..caf8932a 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/Item.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/Item.java @@ -33,6 +33,7 @@ public class Item { private TIntArrayList vendingItems; private double[] multiHeights; private String customParams; + private String clothingOnWalk; private ItemInteraction interactionType; @@ -93,6 +94,8 @@ public class Item { this.effectM = set.getShort("effect_id_male"); this.effectF = set.getShort("effect_id_female"); this.customParams = set.getString("customparams"); + this.clothingOnWalk = set.getString("clothing_on_walk"); + if (!set.getString("vending_ids").isEmpty()) { this.vendingItems = new TIntArrayList(); String[] vendingIds = set.getString("vending_ids").replace(";", ",").split(","); @@ -215,4 +218,6 @@ public class Item { public String getCustomParams() { return customParams; } + + public String getClothingOnWalk() { return clothingOnWalk; } } diff --git a/src/main/java/com/eu/habbo/habbohotel/users/HabboItem.java b/src/main/java/com/eu/habbo/habbohotel/users/HabboItem.java index 213b3124..5ac1bc7c 100644 --- a/src/main/java/com/eu/habbo/habbohotel/users/HabboItem.java +++ b/src/main/java/com/eu/habbo/habbohotel/users/HabboItem.java @@ -18,7 +18,11 @@ import com.eu.habbo.habbohotel.wired.WiredHandler; import com.eu.habbo.habbohotel.wired.WiredTriggerType; import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.outgoing.rooms.users.RoomUserDanceComposer; +import com.eu.habbo.messages.outgoing.rooms.users.RoomUserDataComposer; +import com.eu.habbo.messages.outgoing.users.UpdateUserLookComposer; +import com.eu.habbo.util.figure.FigureUtil; import gnu.trove.set.hash.THashSet; +import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.math3.util.Pair; import java.sql.Connection; @@ -26,6 +30,7 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; public abstract class HabboItem implements Runnable, IEventTriggers { @@ -294,6 +299,20 @@ public abstract class HabboItem implements Runnable, IEventTriggers { roomUnit.setDanceType(DanceType.NONE); room.sendComposer(new RoomUserDanceComposer(roomUnit).compose()); } + + if (!this.getBaseItem().getClothingOnWalk().isEmpty() && roomUnit.getPreviousLocation() != roomUnit.getGoal() && roomUnit.getGoal() == room.getLayout().getTile(this.x, this.y)) { + Habbo habbo = room.getHabbo(roomUnit); + + if (habbo != null && habbo.getClient() != null) { + String[] clothingKeys = Arrays.stream(this.getBaseItem().getClothingOnWalk().split("\\.")).map(k -> k.split("-")[0]).toArray(String[]::new); + habbo.getHabboInfo().setLook(String.join(".", Arrays.stream(habbo.getHabboInfo().getLook().split("\\.")).filter(k -> !ArrayUtils.contains(clothingKeys, k.split("-")[0])).toArray(String[]::new)) + "." + this.getBaseItem().getClothingOnWalk()); + + habbo.getClient().sendResponse(new UpdateUserLookComposer(habbo)); + if (habbo.getHabboInfo().getCurrentRoom() != null) { + habbo.getHabboInfo().getCurrentRoom().sendComposer(new RoomUserDataComposer(habbo).compose()); + } + } + } } @Override