Search in sources :

Example 1 with PlayerDesignMessage

use of org.apollo.game.message.impl.PlayerDesignMessage in project apollo by apollo-rsps.

the class PlayerDesignMessageDecoder method decode.

@Override
public PlayerDesignMessage decode(GamePacket packet) {
    GamePacketReader reader = new GamePacketReader(packet);
    int genderIntValue = (int) reader.getUnsigned(DataType.BYTE);
    int[] style = new int[7];
    for (int i = 0; i < style.length; i++) {
        style[i] = (int) reader.getUnsigned(DataType.BYTE);
    }
    int[] color = new int[5];
    for (int i = 0; i < color.length; i++) {
        color[i] = (int) reader.getUnsigned(DataType.BYTE);
    }
    Gender gender = genderIntValue == Gender.MALE.toInteger() ? Gender.MALE : Gender.FEMALE;
    return new PlayerDesignMessage(new Appearance(gender, style, color));
}
Also used : PlayerDesignMessage(org.apollo.game.message.impl.PlayerDesignMessage) GamePacketReader(org.apollo.net.codec.game.GamePacketReader) Gender(org.apollo.game.model.entity.setting.Gender) Appearance(org.apollo.game.model.Appearance)

Example 2 with PlayerDesignMessage

use of org.apollo.game.message.impl.PlayerDesignMessage in project apollo by apollo-rsps.

the class PlayerDesignMessageDecoder method decode.

@Override
public PlayerDesignMessage decode(GamePacket packet) {
    GamePacketReader reader = new GamePacketReader(packet);
    int genderIntValue = (int) reader.getUnsigned(DataType.BYTE);
    int[] style = new int[7];
    for (int i = 0; i < style.length; i++) {
        style[i] = (int) reader.getUnsigned(DataType.BYTE);
    }
    int[] color = new int[5];
    for (int i = 0; i < color.length; i++) {
        color[i] = (int) reader.getUnsigned(DataType.BYTE);
    }
    Gender gender = genderIntValue == Gender.MALE.toInteger() ? Gender.MALE : Gender.FEMALE;
    return new PlayerDesignMessage(new Appearance(gender, style, color));
}
Also used : PlayerDesignMessage(org.apollo.game.message.impl.PlayerDesignMessage) GamePacketReader(org.apollo.net.codec.game.GamePacketReader) Gender(org.apollo.game.model.entity.setting.Gender) Appearance(org.apollo.game.model.Appearance)

Aggregations

PlayerDesignMessage (org.apollo.game.message.impl.PlayerDesignMessage)2 Appearance (org.apollo.game.model.Appearance)2 Gender (org.apollo.game.model.entity.setting.Gender)2 GamePacketReader (org.apollo.net.codec.game.GamePacketReader)2