Package utility

Examples of utility.GamePacket


        responseCode = Constants.SMSG_TARGET_REWARD;
    }

    @Override
    public byte[] constructResponseInBytes() {
        GamePacket packet = new GamePacket(responseCode);
        packet.addInt32(target_id);
        packet.addShort16(type);
        packet.addInt32(amount);
        return packet.getBytes();
    }
View Full Code Here


        responseCode = Constants.SMSG_CHAT;
    }

    @Override
    public byte[] constructResponseInBytes() {
        GamePacket packet = new GamePacket(responseCode);
        packet.addShort16(status);
        packet.addShort16(type);

        if (type == 0) {
            packet.addString(name);
            packet.addString(message);
        } else {
            packet.addString(message);
        }
        return packet.getBytes();
    }
View Full Code Here

        responseCode = Constants.SMSG_UPDATE_ANIMAL_OWNER;
    }

    @Override
    public byte[] constructResponseInBytes() {
        GamePacket packet = new GamePacket(responseCode);
        packet.addShort16(animalID);
        packet.addShort16(newAvatarID);
        return packet.getBytes();
    }
View Full Code Here

        responseCode = Constants.SMSG_REVEAL_PLANT_DISEASE;
    }

    @Override
    public byte[] constructResponseInBytes() {
        GamePacket packet = new GamePacket(responseCode);
        packet.addShort16(plantID);
        packet.addShort16(diseaseID);
        return packet.getBytes();
    }
View Full Code Here

        responseCode = Constants.SMSG_HIGH_SCORE;
    }

    @Override
    public byte[] constructResponseInBytes() {
        GamePacket packet = new GamePacket(responseCode);
        packet.addShort16(type);
        packet.addShort16((short) scoreList.size());

        for (String[] score : scoreList) {
            packet.addString(score[0]);
            packet.addInt32(Integer.parseInt(score[1]));
        }

        packet.addShort16((short) totalScoreList.size());

        for (String[] score : totalScoreList) {
            packet.addString(score[0]);
            packet.addInt32(Integer.parseInt(score[1]));
        }

        packet.addShort16((short) currentScoreList.size());

        for (String[] score : currentScoreList) {
            packet.addString(score[0]);
            packet.addInt32(Integer.parseInt(score[1]));
        }

        return packet.getBytes();
    }
View Full Code Here

        this.status = status;
    }

    @Override
    public byte[] constructResponseInBytes() {
        GamePacket packet = new GamePacket(responseCode);
        packet.addShort16(status);

        return packet.getBytes();
    }
View Full Code Here

        responseCode = Constants.SMSG_START_GAME;
    }

    @Override
    public byte[] constructResponseInBytes() {
        GamePacket packet = new GamePacket(responseCode);
        packet.addBoolean(status);

        return packet.getBytes();
    }
View Full Code Here

        this.onlinePlayers = onlinePlayers;
    }

    @Override
    public byte[] constructResponseInBytes() {
        GamePacket packet = new GamePacket(responseCode);
        packet.addShort16((short) onlinePlayers.size());

        for (Player player : onlinePlayers) {
            packet.addInt32(player.getID());
            packet.addString(player.getUsername());
        }

        return packet.getBytes();
    }
View Full Code Here

        responseCode = Constants.SMSG_SET_USER_PRIMARY_AVATAR;
    }

    @Override
    public byte[] constructResponseInBytes() {
        GamePacket packet = new GamePacket(responseCode);
        packet.addShort16(isTrue);
        return packet.getBytes();
    }
View Full Code Here

        responseCode = Constants.SMSG_UPDATE_PLANT_NO_LIGHT_COUNT;
    }

    @Override
    public byte[] constructResponseInBytes() {
        GamePacket packet = new GamePacket(responseCode);
        packet.addShort16(plantID);
        packet.addShort16(noLightCount);
        return packet.getBytes();
    }
View Full Code Here

TOP

Related Classes of utility.GamePacket

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.