/*
Copyright (C) 2005 David Green <green@couchpotato.net>

This file is part of I3J.

I3J is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

I3J is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with I3J; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

package com.aelfengard.i3.packet;

import java.util.List;

import com.aelfengard.i3.LPCUtils;
import com.aelfengard.i3.LPCMixed;
import com.aelfengard.i3.MudInfo;

public class StartupReq3Packet extends I3Packet {

    public static final String TOKEN = "startup-req-3";
    
    private LPCMixed originatorMudName = new LPCMixed("");
    private LPCMixed targetMudName = new LPCMixed("");
    private LPCMixed oldMudlistId = new LPCMixed(-1);
    private LPCMixed oldChanlistId = new LPCMixed(-1);
    private LPCMixed password = new LPCMixed(-1);
    private MudInfo mudInfo = new MudInfo();
    
    public StartupReq3Packet() {
        super(I3Packet.Type.STARTUP_REQ);
    }
    
    public StartupReq3Packet(List<LPCMixed> args) {
        this();
        originatorMudName = args.get(2);
        targetMudName = args.get(4);
        password = args.get(6);
        oldMudlistId = args.get(7);
        oldChanlistId = args.get(8);

        mudInfo.setPlayerPort(args.get(9));
        mudInfo.setMudLib(args.get(12));
        mudInfo.setBaseMudLib(args.get(13));
        mudInfo.setDriver(args.get(14));
        mudInfo.setMudType(args.get(15));
        mudInfo.setOpenStatus(args.get(16));
        mudInfo.setAdminEmail(args.get(17));
        mudInfo.setServices(args.get(18));
        mudInfo.setOtherData(args.get(19));
    }
    
    public List<LPCMixed> toList() {
        return LPCUtils.makeList(
                TOKEN,
                5, // spec says must be 5
                originatorMudName,
                0, // spec says must be 0
                targetMudName,
                0, // spec says must be 0
                password,
                oldMudlistId, // old_mudlist_id
                oldChanlistId, // old_chanlist_id
                mudInfo.getPlayerPort(),
                0, // imud_tcp_port
                0, // imud_udp_port
                mudInfo.getMudLib(),
                mudInfo.getBaseMudLib(),
                mudInfo.getDriver(),
                mudInfo.getMudType(),
                mudInfo.getOpenStatus(),
                mudInfo.getAdminEmail(),
                mudInfo.getServices(),
                mudInfo.getOtherData()
                );
    }

    public MudInfo getMudInfo() {
        return mudInfo;
    }
    

    public void setMudInfo(MudInfo mudInfo) {
        this.mudInfo = mudInfo;
    }
    

    public LPCMixed getOldChanlistId() {
        return oldChanlistId;
    }
    

    public void setOldChanlistId(LPCMixed oldChanlistId) {
        this.oldChanlistId = oldChanlistId;
    }
    

    public LPCMixed getOldMudlistId() {
        return oldMudlistId;
    }
    

    public void setOldMudlistId(LPCMixed oldMudlistId) {
        this.oldMudlistId = oldMudlistId;
    }
    

    public LPCMixed getOriginatorMudName() {
        return originatorMudName;
    }
    

    public void setOriginatorMudName(LPCMixed originatorMudName) {
        this.originatorMudName = originatorMudName;
    }
    

    public LPCMixed getPassword() {
        return password;
    }
    

    public void setPassword(LPCMixed password) {
        this.password = password;
    }
    

    public LPCMixed getTargetMudName() {
        return targetMudName;
    }
    

    public void setTargetMudName(LPCMixed targetMudName) {
        this.targetMudName = targetMudName;
    }
    

}