Examples of GamePacket


Examples of utility.GamePacket

        responseCode = Constants.SMSG_UPDATE_PLANT_BIOMASS;
    }

    @Override
    public byte[] constructResponseInBytes() {
        GamePacket packet = new GamePacket(responseCode);
        packet.addShort16(plantID);
        packet.addShort16(biomass);
        packet.addShort16(targetBiomass);
        packet.addShort16(targetTime);

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

Examples of utility.GamePacket

    }

    @Override
    public byte[] constructResponseInBytes() {
        //If clients get this response, it does nothing.
        GamePacket packet = new GamePacket(responseCode);
        packet.addShort16((short) 0);
        return packet.getBytes();
    }
View Full Code Here

Examples of utility.GamePacket

        responseCode = Constants.SMSG_CHANGE_FUNCTIONAL_PARAMETERS;
    }

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

//        if (status == 0) {
//            packet.addShort16((short) parameterList.size());
//
//            for (short parameter : parameterList.keySet()) {
//                packet.addShort16(parameter);
//                packet.addFloat(parameterList.get(parameter));
//            }
//        }

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

Examples of utility.GamePacket

        responseCode = Constants.SMSG_CHANGE_AVATAR;
    }

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

        if (status == 0) {
            packet.addInt32(avatar.getID());
            packet.addShort16((short) avatar.getLevel());
            packet.addInt32(ExpTable.getExp(avatar.getLevel() - 1));
            packet.addInt32(ExpTable.getExpToAdvance(avatar.getLevel()));
            packet.addInt32(avatar.getExperience());
            packet.addInt32(avatar.getCurrency());
        }

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

Examples of utility.GamePacket

        responseCode = Constants.SMSG_UPDATE_ANIMAL_COORDINATE;
    }

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

Examples of utility.GamePacket

        this.worldList = worldList;
    }

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

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

        if (worldList != null) {
            for (World w : worldList) {
                packet.addShort16(w.getAccessType());
                packet.addShort16((short) 1);
                packet.addString(w.getGameName());
                packet.addShort16((short) w.getEnvironments().size());
                packet.addShort16((short) w.getMaxPlayers());
                packet.addString(w.getEnvType());
            }
        }

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

Examples of utility.GamePacket

        responseCode = Constants.SMSG_JOIN_PVP_WORLD;
    }

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

        if (status == 0) {//The player could join this world.
            if (world != null) {
                packet.addString(world.getGameName());
                packet.addString(world.getEnvType());
                packet.addShort16((short) world.getEnvironments().size());
                for (Environment env : world.getEnvironments()) {
//                    packet.addString(env.getAvatar().getPlayer().getUsername());
//                    packet.addShort16((short) env.getEnvRow());
//                    packet.addShort16((short) env.getEnvColumn());
//                    packet.addString(env.getAvatar().getAvatarType());
                }
            } else {
                System.out.println("World is null");
            }

        }

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

Examples of utility.GamePacket

        responseCode = Constants.SMSG_READY;
    }

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

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

Examples of utility.GamePacket

        responseCode = Constants.SMSG_AUTH;
    }

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

        if (status == 0) {
            packet.addInt32(player.getID());
            packet.addString(player.getUsername());

            packet.addShort16((short) avatarList.size());
            for (Avatar avatar : avatarList) {
                packet.addInt32(avatar.getID());
                packet.addString(player.getUsername());
                packet.addShort16((short) avatar.getLevel());
                packet.addInt32(avatar.getCurrency());
                packet.addString(player.getLastLogout());
            }

            packet.addShort16((short) worldList.size());
            for (World world : worldList) {
                packet.addInt32(world.getID());
                packet.addString(world.getGameName());
               
                boolean isNew = world.getPlayTime() == 0;
                packet.addBoolean(isNew);

                if (!isNew) {
                    packet.addShort16((short) world.getYear());
                    packet.addShort16((short) world.getMonth());
                    packet.addInt32((int) world.getPlayTime());
                    packet.addInt32(scoreList.get(worldList.indexOf(world)));
                }
            }
        }

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

Examples of utility.GamePacket

        responseCode = Constants.SMSG_START_TO_READY_GAME;
    }

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

        return packet.getBytes();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.