2018-07-06 15:30:00 +02:00
|
|
|
package com.eu.habbo.messages.outgoing.users;
|
|
|
|
|
|
|
|
import com.eu.habbo.Emulator;
|
|
|
|
import com.eu.habbo.habbohotel.catalog.ClothItem;
|
|
|
|
import com.eu.habbo.habbohotel.users.Habbo;
|
|
|
|
import com.eu.habbo.messages.ServerMessage;
|
|
|
|
import com.eu.habbo.messages.outgoing.MessageComposer;
|
|
|
|
import com.eu.habbo.messages.outgoing.Outgoing;
|
|
|
|
import gnu.trove.procedure.TIntProcedure;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
2019-05-26 20:14:53 +02:00
|
|
|
public class UserClothesComposer extends MessageComposer {
|
2018-07-06 15:30:00 +02:00
|
|
|
private final ArrayList<Integer> idList = new ArrayList<>();
|
|
|
|
private final ArrayList<String> nameList = new ArrayList<>();
|
|
|
|
|
2019-05-26 20:14:53 +02:00
|
|
|
public UserClothesComposer(Habbo habbo) {
|
|
|
|
habbo.getInventory().getWardrobeComponent().getClothing().forEach(new TIntProcedure() {
|
2018-07-06 15:30:00 +02:00
|
|
|
@Override
|
2019-05-26 20:14:53 +02:00
|
|
|
public boolean execute(int value) {
|
2018-07-06 15:30:00 +02:00
|
|
|
ClothItem item = Emulator.getGameEnvironment().getCatalogManager().clothing.get(value);
|
|
|
|
|
2019-05-26 20:14:53 +02:00
|
|
|
if (item != null) {
|
|
|
|
for (Integer j : item.setId) {
|
2019-03-18 02:22:00 +01:00
|
|
|
UserClothesComposer.this.idList.add(j);
|
2018-07-06 15:30:00 +02:00
|
|
|
}
|
|
|
|
|
2019-03-18 02:22:00 +01:00
|
|
|
UserClothesComposer.this.nameList.add(item.name);
|
2018-07-06 15:30:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2019-05-26 20:14:53 +02:00
|
|
|
public ServerMessage compose() {
|
2018-07-06 15:30:00 +02:00
|
|
|
this.response.init(Outgoing.UserClothesComposer);
|
|
|
|
this.response.appendInt(this.idList.size());
|
|
|
|
this.idList.forEach(this.response::appendInt);
|
|
|
|
this.response.appendInt(this.nameList.size());
|
|
|
|
this.nameList.forEach(this.response::appendString);
|
|
|
|
return this.response;
|
|
|
|
}
|
|
|
|
}
|