Package utility

Examples of utility.GamePacket


        responseCode = Constants.SMSG_KILL_ANIMAL;
    }

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


        responseCode = Constants.SMSG_BUY_PLANT;
    }

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

        responseCode = Constants.SMSG_WEATHER_PREDICTION;
    }

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

        responseCode = Constants.SMSG_JOIN_PVE_WORLD;
    }

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

//        if (status == 0) {//The player could join this world.
//            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.getAvatar().getEnvPosition());
//                packet.addString(env.getAvatar().getAvatarType());
//            }
//        }

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

        responseCode = Constants.SMSG_DELETE_WORLD;
    }

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

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

        responseCode = Constants.SMSG_CHART_BIOMASS;
    }

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

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

        responseCode = Constants.SMSG_SHOP_LIST_PLANT;
    }

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

        if (allPlantType != null) {
            packet.addShort16((short) allPlantType.size());

            for (PlantType pt : allPlantType) {
                packet.addShort16((short) pt.getID());
                packet.addString(pt.getSpeciesName());
                packet.addString(pt.getDescription());
                packet.addString(pt.getCategory());
                packet.addShort16((short) pt.getCost());

                String predatorList = "";
                for (SpeciesType predator : pt.getPredatorList(Constants.ORGANISM_TYPE_ANIMAL)) {
                    predatorList += predator.getSpeciesName() + ", ";
                }
                if (predatorList.endsWith(", ")) {
                    predatorList = predatorList.substring(0, predatorList.lastIndexOf(","));
                }

                packet.addString(predatorList);
                packet.addInt32(pt.getModelID());
                packet.addInt32((int) pt.getAvgBiomass());
            }
        }

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

        responseCode = Constants.SMSG_CURE_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_UPDATE_ANIMAL_TARGET;
    }

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

        responseCode = Constants.SMSG_UPDATE_ONLINE_PLAYERS;
    }

    @Override
    public byte[] constructResponseInBytes() {
        GamePacket packet = new GamePacket(responseCode);
        packet.addShort16((short) 0);
        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.