Package utility

Examples of utility.GamePacket


        responseCode = Constants.SMSG_VOTE_GAME_SCALE;
    }

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


        responseCode = Constants.SMSG_UPDATE_ANIMAL_BIOMASS;
    }

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

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

        responseCode = Constants.SMSG_BUY_ANIMAL;
    }

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

        this.worldList = worldList;
    }

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

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

        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

        responseCode = Constants.SMSG_UPDATE_ENV_SCORE;
    }

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

        responseCode = Constants.SMSG_REVEAL_ANIMAL_DISEASE;
    }

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

        responseCode = Constants.SMSG_SEARCH_PRIVATE_WORLD;
    }

    @Override
    public byte[] constructResponseInBytes() {
        GamePacket packet = new GamePacket(responseCode);
        packet.addShort16(status);
        if (status == 0) {
            packet.addString(world.getGameName());
            packet.addShort16((short) world.getGameMode());
        }
//        if (status == 0) {
//            if (world.getGameMode() == Constants.GAME_TYPE_PVP) {
//                packet.addShort16((short) 1);
//            } else if (world.getGameMode() == Constants.GAME_TYPE_PVE) {
//                packet.addShort16((short) 0);
//            }
//
//            packet.addString(world.getGameName());
//            packet.addString(world.getEnvType());
//            packet.addShort16((short) world.getNumEnvironments());
//            if (world.getEnvironments() != null) {
//                for (Environment env : world.getEnvironments()) {
//                    packet.addString(env.getAvatar().getPlayer().getUserName());
//                    if (world.getGameMode() == Constants.GAME_TYPE_PVP) {
//                        packet.addShort16((short) env.getEnvRow());
//                        packet.addShort16((short) env.getEnvColumn());
//                    } else if (world.getGameMode() == Constants.GAME_TYPE_PVE) {
//                        packet.addShort16((short) 0);
//                        pveMap = mapDAO.getPvEWorldMap(world.getWorldIdPk());
//                        packet.addShort16((short) pveMap.getPositionBasingOnRowAndCol(env.getEnvRow(), env.getEnvColumn()));
//                    }
//                    packet.addString(env.getAvatar().getAvatarType());
//                }
//            }
//        }

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

        responseCode = Constants.SMSG_UPDATE_ANIMAL_NO_WATER_COUNT;
    }

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

        responseCode = Constants.SMSG_SEE_PVP_ONLINE_PLAYERS;
    }

    @Override
    public byte[] constructResponseInBytes() {
        GamePacket packet = new GamePacket(responseCode);
        if (pvpPlayers != null) {
            numberOfPlayers = (short) pvpPlayers.size();
            packet.addShort16(numberOfPlayers);
            for (String player : pvpPlayers) {
                packet.addString(player);
            }
        }

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

        this.pvpWorlds = pvpWorlds;
    }

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

        for (World world : pvpWorlds) {
            packet.addString(world.getGameName());
            packet.addShort16((short) world.getEnvironments().size());
            packet.addShort16((short) world.getMaxPlayers());
            packet.addString(world.getEnvType());
        }

        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.