Exemplo n.º 1
0
        public SolarSystem(Entity from, SolarSystemInfo info) : base(from)
        {
            if (typeID != 5)
            {
                throw new Exception("Trying to load a non-solar system item like one");
            }

            solarSystemInfo = info;
        }
Exemplo n.º 2
0
        public SolarSystem(Entity from, SolarSystemInfo info)
            : base(from)
        {
            if (typeID != 5)
            {
                throw new Exception("Trying to load a non-solar system item like one");
            }

            solarSystemInfo = info;
        }
Exemplo n.º 3
0
        public static SolarSystemInfo GetSolarSystemInfo(int solarSystemID)
        {
            MySqlDataReader reader = null;

            if (Database.Query(ref reader, "SELECT regionID, constellationID, x, y, z, xMin, yMin, zMin, xMax, yMax, zMax, luminosity, border, fringe, corridor, hub, international, regional, constellation, security, factionID, radius, sunTypeID, securityClass FROM mapsolarsystems WHERE solarSystemID=" + solarSystemID) == false)
            {
                throw new SolarSystemLoadException();
            }

            if (reader == null)
            {
                throw new SolarSystemLoadException();
            }

            if (reader.Read() == false)
            {
                reader.Close();
                throw new SolarSystemLoadException();
            }

            SolarSystemInfo info = new SolarSystemInfo();

            info.regionID = reader.GetInt32(0);
            info.constellationID = reader.GetInt32(1);
            info.x = reader.GetDouble(2);
            info.y = reader.GetDouble(3);
            info.z = reader.GetDouble(4);
            info.xMin = reader.GetDouble(5);
            info.yMin = reader.GetDouble(6);
            info.zMin = reader.GetDouble(7);
            info.xMax = reader.GetDouble(8);
            info.yMax = reader.GetDouble(9);
            info.zMax = reader.GetDouble(10);
            info.luminosity = reader.GetDouble(11);
            info.border = reader.GetBoolean(12);
            info.fringe = reader.GetBoolean(13);
            info.corridor = reader.GetBoolean(14);
            info.hub = reader.GetBoolean(15);
            info.international = reader.GetBoolean(16);
            info.regional = reader.GetBoolean(17);
            info.constellation = reader.GetBoolean(18);
            info.security = reader.GetDouble(19);
            info.factionID = reader.GetInt32(20);
            info.radius = reader.GetDouble(21);
            info.sunTypeID = reader.GetInt32(22);
            info.securityClass = reader.GetString(23);

            return info;
        }