package electrosphere.net;

import electrosphere.entity.types.creature.CreatureUtils;
import electrosphere.entity.Entity;
import electrosphere.logger.LoggerInterface;
import electrosphere.net.parser.net.message.EntityMessage;

/**
 *
 * @author amaterasu
 */
public class NetUtils {
    
    public static final int DEFAULT_PORT = 34251;
    
    static int port = DEFAULT_PORT;
    static String address = "127.0.0.1";
    
//    public static EntityMessage createSpawnEntityMessage(Entity e){
//        EntityMessage rVal = EntityMessage.constructCreateMessage(e.getId(), CreatureUtils.getCreatureType(e), 0.0f, 0.0f, 0.0f);
//        return rVal;
//    }
    
    public static EntityMessage createSetCreatureControllerIdEntityMessage(Entity e){
        LoggerInterface.loggerNetworking.DEBUG("Entity " + e.getId() + " set controller id: " + CreatureUtils.getControllerPlayerId(e));
        EntityMessage rVal = EntityMessage.constructsetPropertyMessage(e.getId(), System.currentTimeMillis(), 0, CreatureUtils.getControllerPlayerId(e));
        return rVal;
    }

    public static int getPort() {
        return port;
    }

    public static String getAddress() {
        return address;
    }

    public static void setPort(int port) {
        NetUtils.port = port;
    }

    public static void setAddress(String address) {
        NetUtils.address = address;
    }
    
    
}
