Package networking.request

Source Code of networking.request.RequestUpdateAnimalTarget

package networking.request;

import java.io.IOException;

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

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

    // Data
    private int animalID;
    private int zoneID;
    private int xTarg;
    private int yTarg;
    // Responses
    private ResponseUpdateAnimalTarget responseUpdateAnimalTarget;

    public RequestUpdateAnimalTarget() {
        responses.add(responseUpdateAnimalTarget = new ResponseUpdateAnimalTarget());
    }

    @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.RequestUpdateAnimalTarget

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.