Package networking.response

Source Code of networking.response.ResponseJoinPvEWorld

package networking.response;

import metadata.Constants;

import model.World;
import utility.GamePacket;

/**
*
* @author Xuyuan
*/
public class ResponseJoinPvEWorld extends GameResponse {

    private short status;
    private World world;

    public ResponseJoinPvEWorld() {
        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();
    }

    public void setStatus(short status) {
        this.status = status;
    }

    public void setWorld(World world) {
        this.world = world;
    }
}
TOP

Related Classes of networking.response.ResponseJoinPvEWorld

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.