Add equipping clothing when walking on furni

This commit is contained in:
Alejandro 2019-08-01 23:05:01 +03:00
parent 4389a19ae5
commit ad3002209d
3 changed files with 27 additions and 0 deletions

View File

@ -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 '';

View File

@ -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; }
}

View File

@ -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