Esempio n. 1
0
        private void buttonLoadPlayerShip_Click(object sender, EventArgs e)
        {
            if (treePlayerShipsRig.SelectedNode == null)
            {
                return;
            }
            Ship ship = (Ship)treePlayerShipsRig.SelectedNode.Tag;

            ship.Model.ClearSlotDuplicates();

            saRig = new SpaceshipRig();
            saRig.LoadShip(ship);
            FillRig();
            SpaceShipParameters Params = new SpaceShipParameters();

            Params.rig = saRig;
            Params.CalculateParameters();
            textSaBottomLine.Text = Params.BottomLineString();
        }
Esempio n. 2
0
    public static SpaceshipRig RigForPlayer(int playerId)
    {
        SpaceshipRig  tRig = null;
        string        q    = SpaceshipRigQuery(0, playerId, "", false);
        SqlDataReader r    = DataConnection.GetReader(q);

        if (r.HasRows)
        {
            r.Read();
            tRig = new SpaceshipRig(r);
        }
        r.Close();
        if (tRig != null)
        {
            return(tRig);
        }


        List <Ship> ships = Ship.PlayerShips(playerId);

        if (ships.Count == 0)
        {
            return(null);
        }
        tRig = new SpaceshipRig();
        tRig.LoadShip(ships[0]);

        var moduleList = ShipModule.PlayerModules(playerId);

        tRig.LoadModules(moduleList);

        List <CrewOfficer> officers = CrewOfficer.OfficersForPlayer(playerId, true);

        officers.Add(new CrewOfficer(playerId));
        tRig.LoadOfficers(officers);
        return(tRig);
    }