Arcturus-Community/src/main/java/com/eu/habbo/messages/outgoing/users/UserClothesComposer.java

53 lines
1.6 KiB
Java
Raw Normal View History

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;
public class UserClothesComposer extends MessageComposer
{
private final ArrayList<Integer> idList = new ArrayList<>();
private final ArrayList<String> nameList = new ArrayList<>();
public UserClothesComposer(Habbo habbo)
{
habbo.getInventory().getWardrobeComponent().getClothing().forEach(new TIntProcedure()
{
@Override
public boolean execute(int value)
{
ClothItem item = Emulator.getGameEnvironment().getCatalogManager().clothing.get(value);
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
public ServerMessage compose()
{
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;
}
}