Package networking.request

Source Code of networking.request.RequestMoveAnimal

package networking.request;

import java.io.IOException;

import networking.response.ResponseMoveAnimal;
import utility.DataReader;
import worldManager.gameEngine.GameEngine;

/**
*
* @author Xuyuan
*/
public class RequestMoveAnimal extends GameRequest {

    // Data
    private int animalID;
    private int zoneID;
    private int xTarg;
    private int yTarg;
    // Responses
    private ResponseMoveAnimal responseMoveAnimal;

    public RequestMoveAnimal() {
        responses.add(responseMoveAnimal = new ResponseMoveAnimal());
    }

    @Override
    public void parse() throws IOException {
        animalID = DataReader.readShort(dataInput);
        zoneID = DataReader.readShort(dataInput);
        xTarg = DataReader.readShort(dataInput);
        yTarg = DataReader.readShort(dataInput);
    }

    @Override
    public void doBusiness() throws Exception {
        GameEngine gameEngine = client.getWorld().getGameEngine();

        if (gameEngine != null) {
            gameEngine.run();
            gameEngine.updateAnimalTarget(animalID, zoneID, xTarg, yTarg);
        }
    }
}
TOP

Related Classes of networking.request.RequestMoveAnimal

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.