Ejemplo n.º 1
0
        private void Parse(DataReader reader)
        {
            reader.Assert(0L, "Unexpected data found when reading IGCCorePart header");

            model = reader.ReadString(13);
            reader.Skip(1);

            icon        = reader.ReadString(13);
            name        = reader.ReadString(25);
            description = reader.ReadString(200);
            group       = reader.ReadShort();
            techtree    = new Techtree(reader);

            reader.Assert((byte)0xCC, "Unexpected data found after Techtree in IGCCorePart");
            reader.Assert((byte)0xCC, "Unexpected data found after Techtree in IGCCorePart");

            mass           = reader.ReadFloat();
            sigmod         = reader.ReadFloat();
            uid            = reader.ReadUShort();
            specUID        = uid;
            overriding_uid = reader.ReadShort();
            parttype       = reader.ReadShort();
            usemask        = new BitArray(reader.ReadBytes(2));
            slot           = reader.ReadString(13);

            reader.Assert((byte)0xCC, "Unexpected data found at end of IGCCorePart");
            reader.Assert((byte)0xCC, "Unexpected data found at end of IGCCorePart");
            reader.Assert((byte)0xCC, "Unexpected data found at end of IGCCorePart");
        }
Ejemplo n.º 2
0
        private void Parse(DataReader reader)
        {
            reader.Assert(0L, 0, "UNKNOWN", "Part", "First 4 bytes");

            model = reader.ReadString(13);
            reader.Assert((byte)0xCC, 0, "Model: " + model, "UNKNOWN PART", "Model");

            icon        = reader.ReadString(13);
            name        = reader.ReadString(25);
            description = reader.ReadString(200);
            group       = reader.ReadShort();
            techtree    = new Techtree(reader);

            reader.Assert((ushort)0xCCCC, 0, name, "UNKNOWN PART", "Techtree");

            mass           = reader.ReadFloat();
            sigmod         = reader.ReadFloat();
            uid            = reader.ReadUShort();
            specUID        = uid;
            overriding_uid = reader.ReadShort();
            parttype       = reader.ReadShort();
            usemask        = new BitArray(reader.ReadBytes(2));
            slot           = reader.ReadString(13);

            string PartTypeName = PartType.GetName(typeof(PartType), parttype);

            //reader.Assert((byte)0xCC, uid, name, PartTypeName, "Slot");
            reader.Skip(1);
            reader.Assert((ushort)0xCCCC, uid, name, PartTypeName, "Slot");
        }
Ejemplo n.º 3
0
 public Faction(string name, Techtree techtree)
 {
     Name                 = name;
     Techtree             = techtree;
     WorldspaceUnits      = new List <WorldspaceUnit>();
     WorldspaceStructures = new List <WorldspaceStructure>();
     Units                = new List <Unit>();
     Buildings            = new List <Building>();
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Loads the IGCCoreMissile values from the specified DataReader
 /// </summary>
 /// <param name="reader">The DataReader from which to read the IGCCoreMissile</param>
 private void Parse(DataReader reader)
 {
     reader.Assert(0L, "Invalid header found while trying to parse IGCCoreMissile");
     reader.Assert(0L, "Invalid header found while trying to parse IGCCoreMissile");
     stats_s1 = reader.ReadFloat();
     stats_s2 = reader.ReadFloat();
     ldbmp    = reader.ReadString(13);
     reader.Seek(13);
     reader.Skip(2);
     stats_s3 = reader.ReadFloat();
     stats_s4 = reader.ReadFloat();
     stats_s5 = reader.ReadFloat();
     cost     = reader.ReadInt();
     reader.Assert((int)0, "Unexpected data found while trying to parse IGCCoreMissile");
     model = reader.ReadString(13);
     reader.Assert((byte)0xCC, "Unexpected data found while trying to parse IGCCoreMissile");
     type        = reader.ReadString(13);
     name        = reader.ReadString(25);
     description = reader.ReadString(200);
     group       = reader.ReadShort();
     techtree    = new Techtree(reader);
     reader.Assert((byte)0xCD, "Unexpected data found while trying to parse IGCCoreMissile");
     reader.Assert((byte)0xCD, "Unexpected data found while trying to parse IGCCoreMissile");
     sigmod    = reader.ReadFloat();
     mass      = reader.ReadFloat();
     usemask   = new BitArray(reader.ReadBytes(2));
     amount    = reader.ReadUShort();
     stats_s16 = reader.ReadFloat();
     AC        = reader.ReadByte();
     reader.Assert((byte)0xCD, "Unexpected data found while trying to parse IGCCoreMissile");
     uid            = reader.ReadUShort();
     special_effect = reader.ReadUShort();
     icon           = reader.ReadString(13);
     reader.Assert((byte)0xCD, "Unexpected data found while trying to parse IGCCoreMissile");
     stats_s7            = reader.ReadFloat();  // accel
     stats_s8            = reader.ReadFloat();  // turn radius
     stats_s9            = reader.ReadFloat();  // launch velocity
     stats_s10           = reader.ReadFloat();  // lock time
     stats_s11           = reader.ReadFloat();  // ready time
     stats_s12           = reader.ReadFloat();  // max lock
     stats_s13           = reader.ReadFloat();  // CM resistance
     stats_s14           = reader.ReadFloat();  // salvo ratio
     stats_s15           = reader.ReadFloat();  // lock radius
     stats_damage        = reader.ReadFloat();
     stats_unused1       = reader.ReadFloat();  // 0 Checked
     stats_damage_radius = reader.ReadFloat();
     stats_unused2       = reader.ReadFloat();  // 0 Checked
     DM        = reader.ReadUShort();
     stats_ss3 = reader.ReadUShort();           //sound launch
     stats_ss4 = reader.ReadUShort();           //sound flight
     reader.Assert((byte)0xCD, "Unexpected footer found while trying to parse IGCCoreMissile");
     reader.Assert((byte)0xCD, "Unexpected footer found while trying to parse IGCCoreMissile");
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Loads the IGCCoreMissile values from the specified DataReader
        /// </summary>
        /// <param name="reader">The DataReader from which to read the IGCCoreMissile</param>
        private void Parse(DataReader reader)
        {
            reader.Assert(0L, 0, "UNKNOWN", "Part: Missile", "First 8 bytes");
            reader.Assert(0L, 0, "UNKNOWN", "Part: Missile", "2nd 8 bytes");

            stats_s1 = reader.ReadFloat();
            stats_s2 = reader.ReadFloat();
            ldbmp    = reader.ReadString(13);
            reader.Seek(13);
            reader.Assert((ushort)0xCCCC, 0, "Unknown", "Part: Missile", "13-byte spacer after LDBMP");
            stats_s3 = reader.ReadFloat();
            stats_s4 = reader.ReadFloat();
            stats_s5 = reader.ReadFloat();
            cost     = reader.ReadInt();
            reader.Assert((int)0, uid, "UNKNOWN", "Part: Missile", "Cost");
            model = reader.ReadString(13);
            reader.Assert((byte)0xCC, 0, "UNKNOWN", "Part: Missile", "Model");
            type        = reader.ReadString(13);
            name        = reader.ReadString(25);
            description = reader.ReadString(200);
            group       = reader.ReadShort();
            techtree    = new Techtree(reader);
            reader.Assert((ushort)0xCDCD, 0, name, "Part: Missile", "Techtree");
            sigmod    = reader.ReadFloat();
            mass      = reader.ReadFloat();
            usemask   = new BitArray(reader.ReadBytes(2));
            amount    = reader.ReadUShort();
            stats_s16 = reader.ReadFloat();
            AC        = reader.ReadByte();
            reader.Assert((byte)0xCD, 0, name, "Part: Missile", "AC");
            uid            = reader.ReadUShort();
            special_effect = reader.ReadUShort();
            icon           = reader.ReadString(13);
            reader.Assert((byte)0xCD, uid, name, "Part: Missile", "Icon");
            stats_s7            = reader.ReadFloat();  // accel
            stats_s8            = reader.ReadFloat();  // turn radius
            stats_s9            = reader.ReadFloat();  // launch velocity
            stats_s10           = reader.ReadFloat();  // lock time
            stats_s11           = reader.ReadFloat();  // ready time
            stats_s12           = reader.ReadFloat();  // max lock
            stats_s13           = reader.ReadFloat();  // CM resistance
            stats_s14           = reader.ReadFloat();  // salvo ratio
            stats_s15           = reader.ReadFloat();  // lock radius
            stats_damage        = reader.ReadFloat();
            stats_unused1       = reader.ReadFloat();  // 0 Checked
            stats_damage_radius = reader.ReadFloat();
            stats_unused2       = reader.ReadFloat();  // 0 Checked
            DM        = reader.ReadUShort();
            stats_ss3 = reader.ReadUShort();           //sound launch
            stats_ss4 = reader.ReadUShort();           //sound flight
            reader.Assert((ushort)0xCDCD, uid, name, "Part: Missile", "Flight Sound");
        }
Ejemplo n.º 6
0
 private void Parse(DataReader reader)
 {
     pcRED   = reader.ReadFloat();           // all zero = percent RGBA
     pcGreen = reader.ReadFloat();
     pcBlue  = reader.ReadFloat();
     pcAlpha = reader.ReadFloat();
     reader.Assert((byte)0xCC, "Unexpected data encountered after colours in IGCCoreMine");
     reader.Assert((byte)0xCC, "Unexpected data encountered after colours in IGCCoreMine");
     reader.Assert((byte)0xCC, "Unexpected data encountered after colours in IGCCoreMine");
     reader.Assert((byte)0xCC, "Unexpected data encountered after colours in IGCCoreMine");
     stats_s1 = reader.ReadFloat();            // rate rotation
     reader.Skip(13);
     icon = reader.ReadString(13);             // Length [13]; //fxmine
     reader.Assert((byte)0xCC, "Unexpected data encountered after icon in IGCCoreMine");
     reader.Assert((byte)0xCC, "Unexpected data encountered after icon in IGCCoreMine");
     stats_s2       = reader.ReadFloat();       // load time
     stats_duration = reader.ReadFloat();
     stats_s3       = reader.ReadFloat();       // sig
     cost           = reader.ReadInt();
     reader.Assert((byte)0, "Unexpected data encountered after cost in IGCCoreMine");
     reader.Assert((byte)0, "Unexpected data encountered after cost in IGCCoreMine");
     reader.Assert((byte)0, "Unexpected data encountered after cost in IGCCoreMine");
     reader.Assert((byte)0, "Unexpected data encountered after cost in IGCCoreMine");
     model = reader.ReadString(13);            // Length [13];// inactive & loadout bmp (prefix with 'l')
     reader.Assert((byte)0xCC, "Unexpected data encountered after model in IGCCoreMine");
     type        = reader.ReadString(13);      // Length [13]; //part
     name        = reader.ReadString(25);      // Length [25];
     description = reader.ReadString(200);     // Length [200];
     group       = reader.ReadShort();
     techtree    = new Techtree(reader);
     reader.Assert((byte)0xCD, "Unexpected data encountered after techtree in IGCCoreMine");
     reader.Assert((byte)0xCD, "Unexpected data encountered after techtree in IGCCoreMine");
     sigmod   = reader.ReadFloat();                // ship sig%
     mass     = reader.ReadFloat();                // mass
     usemask  = new BitArray(reader.ReadBytes(2)); //usemask	(2)
     amount   = reader.ReadUShort();               //cargo payload
     stats_s6 = reader.ReadFloat();                // hitpoints
     AC       = (IGCArmorClass)reader.ReadByte();  // OB
     reader.Assert((byte)0xCD, "Unexpected data encountered after ArmorClass in IGCCoreMine");
     uid = reader.ReadUShort();
     reader.Assert((short)0, "Unexpected data encountered after uid in IGCCoreMine");
     ukbmp = reader.ReadString(13);             // length [13]; // icon bmp
     reader.Assert((byte)0xCD, "Unexpected data encountered after ukbmp in IGCCoreMine");
     stats_radius    = reader.ReadFloat();
     stats_damage    = reader.ReadFloat();
     stats_endurance = reader.ReadFloat(); // endurance
     DM = reader.ReadByte();               // 10
     reader.Assert((byte)0xCD, "Unexpected data encountered at end of IGCCoreMine");
     reader.Assert((byte)0xCD, "Unexpected data encountered at end of IGCCoreMine");
     reader.Assert((byte)0xCD, "Unexpected data encountered at end of IGCCoreMine");
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Reads an IGCCoreProbe from the specified DataReader
 /// </summary>
 /// <param name="reader">The DataReader from which to read the IGCCoreProbe</param>
 private void Parse(DataReader reader)
 {
     reader.Assert(0L, "Invalid header found while trying to parse IGCCoreProbe");
     reader.Assert(0L, "Invalid header found while trying to parse IGCCoreProbe");
     stats_s1 = reader.ReadFloat();
     stats_s2 = reader.ReadFloat();
     model    = reader.ReadString(13);
     model1   = reader.ReadString(13);
     reader.Assert((byte)0xCC, "Unexpected data found while trying to parse IGCCoreProbe");
     reader.Assert((byte)0xCC, "Unexpected data found while trying to parse IGCCoreProbe");
     stats_s3 = reader.ReadFloat();
     stats_s4 = reader.ReadFloat();
     sigmod   = reader.ReadFloat();
     cost     = reader.ReadInt();
     reader.Assert((int)0, "Unexpected data found while trying to parse IGCCoreProbe");
     ukbmp = reader.ReadString(13);
     reader.Assert((byte)0xCC, "Unexpected data found while trying to parse IGCCoreProbe");
     type        = reader.ReadString(13);
     name        = reader.ReadString(25);
     description = reader.ReadString(200);
     group       = reader.ReadShort();
     techtree    = new Techtree(reader);
     reader.Assert((byte)0xCD, "Unexpected data found while trying to parse IGCCoreProbe");
     reader.Assert((byte)0xCD, "Unexpected data found while trying to parse IGCCoreProbe");
     stats_s5 = reader.ReadFloat();
     mass     = reader.ReadFloat();
     usemask  = new BitArray(reader.ReadBytes(2));
     amount   = reader.ReadUShort();
     stats_s7 = reader.ReadFloat();
     AC       = (IGCArmorClass)reader.ReadByte();
     reader.Assert((byte)0xCD, "Unexpected data found while trying to parse IGCCoreProbe");
     uid       = reader.ReadUShort();
     stats_ss3 = new BitArray(reader.ReadBytes(2));
     icon      = reader.ReadString(13);
     reader.Assert((byte)0xCD, "Unexpected data found while trying to parse IGCCoreProbe");
     stats_s8         = reader.ReadFloat();
     stats_s9         = reader.ReadFloat();
     stats_s10        = reader.ReadFloat();
     stats_s11        = reader.ReadFloat();
     stats_ss4        = reader.ReadShort();
     stats_projectile = reader.ReadShort();
     stats_sound      = reader.ReadShort();
     reader.Assert((byte)0xCD, "Unexpected data found while trying to parse IGCCoreProbe");
     reader.Assert((byte)0xCD, "Unexpected data found while trying to parse IGCCoreProbe");
     stats_activation_delay = reader.ReadFloat();
 }
Ejemplo n.º 8
0
        /// <summary>
        /// Parses the IGCCoreCiv from the specified DataReader
        /// </summary>
        /// <param name="reader">The DataReader to use to read the IGCCoreCiv</param>
        private void Parse(DataReader reader)
        {
            ukf[0] = reader.ReadFloat();
            ukf[1] = reader.ReadFloat();

            name     = reader.ReadString(25);
            model    = reader.ReadString(13);
            obj      = reader.ReadString(13);
            techtree = new Techtree(reader);
            reader.Assert((byte)0xCD, 0, name, "Faction", "Techtree");
            factors = new Factors(reader);

            suk     = reader.ReadUShort();
            uid     = reader.ReadUShort();
            gar_uid = reader.ReadUShort();
            reader.Assert((ushort)0xCDCD, uid, name, "Faction", "Garrison UID");
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Parses the IGCCoreCiv from the specified DataReader
        /// </summary>
        /// <param name="reader">The DataReader to use to read the IGCCoreCiv</param>
        private void Parse(DataReader reader)
        {
            ukf[0] = reader.ReadFloat();
            ukf[1] = reader.ReadFloat();

            name     = reader.ReadString(25);
            model    = reader.ReadString(13);
            obj      = reader.ReadString(13);
            techtree = new Techtree(reader);
            reader.Assert((byte)0xCD, string.Concat("Unexpected value found when reading IGCCoreCiv ", name));
            factors = new Factors(reader);

            suk     = reader.ReadUShort();
            uid     = reader.ReadUShort();
            gar_uid = reader.ReadUShort();
            reader.Assert((byte)0xCD, string.Concat("Unexpected end bytes found when reading IGCCoreCiv ", name));
            reader.Assert((byte)0xCD, string.Concat("Unexpected end bytes found when reading IGCCoreCiv ", name));
        }
Ejemplo n.º 10
0
        public void Parse(DataReader reader)
        {
            cost          = reader.ReadInt();
            research_time = reader.ReadInt();
            model         = reader.ReadString(13);
            reader.ReadByte();

            icon        = reader.ReadString(13);
            name        = reader.ReadString(25);
            description = reader.ReadString(200);
            group       = reader.ReadByte();
            zero        = reader.ReadByte();
            techtree    = new Techtree(reader);
            reader.Assert((ushort)0xCDCD, 0, name, "Station", "Techtree");

            stats_s1      = reader.ReadFloat();
            stats_s2      = reader.ReadFloat();
            stats_s3      = reader.ReadFloat();
            stats_s4      = reader.ReadFloat();
            stats_s5      = reader.ReadFloat();
            stats_s6      = reader.ReadFloat();
            stats_income  = reader.ReadInt();
            stats_s7      = reader.ReadFloat();
            techtreelocal = new BitArray(reader.ReadBytes(50));
            //            //
            uid            = reader.ReadUShort();
            overriding_uid = reader.ReadShort();
            ACHull         = reader.ReadByte();
            ACShld         = reader.ReadByte();
            AbilityBitMask = new BitArray(reader.ReadBytes(2));
            buildon        = (BuildOn)Enum.Parse(typeof(BuildOn), reader.ReadUShort().ToString());
            type           = reader.ReadByte();
            reader.Assert((byte)0xCD, uid, name, "Station", "Type");

            stats_ss0 = reader.ReadUShort();

            for (int i = 0; i < 13; i++)
            {
                sounds[i] = reader.ReadUShort();
            }
            uk3         = reader.ReadBytes(13);
            constructor = reader.ReadString(25);
        }
Ejemplo n.º 11
0
 /// <summary>
 /// Reads an IGCCoreProbe from the specified DataReader
 /// </summary>
 /// <param name="reader">The DataReader from which to read the IGCCoreProbe</param>
 private void Parse(DataReader reader)
 {
     reader.Assert(0L, 0, "UNKNOWN", "Part: Probe", "First 8 bytes");
     reader.Assert(0L, 0, "UNKNOWN", "Part: Probe", "Second 8 bytes");
     stats_s1 = reader.ReadFloat();
     stats_s2 = reader.ReadFloat();
     model    = reader.ReadString(13);
     model1   = reader.ReadString(13);
     reader.Assert((ushort)0xCCCC, 0, "Model: " + model, "Part: Probe", "Model1");
     stats_s3 = reader.ReadFloat();
     stats_s4 = reader.ReadFloat();
     sigmod   = reader.ReadFloat();
     cost     = reader.ReadInt();
     reader.Assert((int)0, 0, "UNKNOWN", "Part: Probe", "Cost");
     ukbmp = reader.ReadString(13);
     reader.Assert((byte)0xCC, 0, "UNKNOWN", "Part: Probe", "UKBMP");
     type        = reader.ReadString(13);
     name        = reader.ReadString(25);
     description = reader.ReadString(200);
     group       = reader.ReadShort();
     techtree    = new Techtree(reader);
     reader.Assert((ushort)0xCDCD, 0, name, "Part: Probe", "Techtree");
     stats_s5 = reader.ReadFloat();
     mass     = reader.ReadFloat();
     usemask  = new BitArray(reader.ReadBytes(2));
     amount   = reader.ReadUShort();
     stats_s7 = reader.ReadFloat();
     AC       = (IGCArmorClass)reader.ReadByte();
     reader.Assert((byte)0xCD, 0, name, "Part: Probe", "Armour Class");
     uid       = reader.ReadUShort();
     stats_ss3 = new BitArray(reader.ReadBytes(2));
     icon      = reader.ReadString(13);
     reader.Assert((byte)0xCD, uid, name, "Part: Probe", "Icon");
     stats_s8         = reader.ReadFloat();
     stats_s9         = reader.ReadFloat();
     stats_s10        = reader.ReadFloat();
     stats_s11        = reader.ReadFloat();
     stats_ss4        = reader.ReadShort();
     stats_projectile = reader.ReadShort();
     stats_sound      = reader.ReadShort();
     reader.Assert((ushort)0xCDCD, uid, name, "Part: Probe", "Sound");
     stats_activation_delay = reader.ReadFloat();
 }
Ejemplo n.º 12
0
        /// <summary>
        /// Parses an IGCCoreDevel from the specified DataReader
        /// </summary>
        /// <param name="reader">The DataReader from which to read this IGCCoreDevel</param>
        private void Parse(DataReader reader)
        {
            cost          = reader.ReadUInt();
            research_time = reader.ReadUInt();
            model         = reader.ReadString(13);
            reader.Assert((byte)0xCC, 0, "Model: " + model, "Development", "Model");
            icon        = reader.ReadString(13);
            name        = reader.ReadString(25);
            description = reader.ReadString(200);
            reader.Assert((byte)0, 0, name, "Development", "Description");

            root_tree = reader.ReadByte();
            techtree  = new Techtree(reader);
            reader.Assert((ushort)0xCDCD, 0, name, "Development", "Techtree");
            factors = new Factors(reader);

            uid = reader.ReadUShort();
            cat = reader.ReadUShort();
        }
Ejemplo n.º 13
0
 private void Parse(DataReader reader)
 {
     pcRED   = reader.ReadFloat();           // all zero = percent RGBA
     pcGreen = reader.ReadFloat();
     pcBlue  = reader.ReadFloat();
     pcAlpha = reader.ReadFloat();
     reader.Assert((uint)0xCCCCCCCC, 0, "UNKNOWN", "Part: Mine", "RGBA Colours");
     stats_s1 = reader.ReadFloat();            // rate rotation
     reader.Skip(13);
     icon = reader.ReadString(13);             // Length [13]; //fxmine
     reader.Assert((ushort)0xCCCC, 0, "UNKNOWN", "Part: Mine", "Icon");
     stats_s2       = reader.ReadFloat();      // load time
     stats_duration = reader.ReadFloat();
     stats_s3       = reader.ReadFloat();      // sig
     cost           = reader.ReadInt();
     reader.Assert((int)0, 0, "UNKNOWN", "Part: Mine", "Cost");
     model = reader.ReadString(13);            // Length [13];// inactive & loadout bmp (prefix with 'l')
     reader.Assert((byte)0xCC, 0, "UNKNOWN", "Part: Mine", "Model");
     type        = reader.ReadString(13);      // Length [13]; //part
     name        = reader.ReadString(25);      // Length [25];
     description = reader.ReadString(200);     // Length [200];
     group       = reader.ReadShort();
     techtree    = new Techtree(reader);
     reader.Assert((ushort)0xCDCD, 0, name, "Part: Mine", "Techtree");
     sigmod   = reader.ReadFloat();                // ship sig%
     mass     = reader.ReadFloat();                // mass
     usemask  = new BitArray(reader.ReadBytes(2)); //usemask	(2)
     amount   = reader.ReadUShort();               //cargo payload
     stats_s6 = reader.ReadFloat();                // hitpoints
     AC       = (IGCArmorClass)reader.ReadByte();  // OB
     reader.Assert((byte)0xCD, 0, name, "Part: Mine", "Armour Class");
     uid = reader.ReadUShort();
     reader.Assert((short)0, uid, name, "Part: Mine", "UID");
     ukbmp = reader.ReadString(13);             // length [13]; // icon bmp
     reader.Assert((byte)0xCD, uid, name, "Part: Mine", "UKBMP");
     stats_radius    = reader.ReadFloat();
     stats_damage    = reader.ReadFloat();
     stats_endurance = reader.ReadFloat(); // endurance
     DM = reader.ReadByte();               // 10
     reader.Assert((byte)0xCD, uid, name, "Part: Mine", "Damage Index");
     reader.Assert((ushort)0xCDCD, uid, name, "Part: Mine", "Damage Index");
 }
Ejemplo n.º 14
0
        /// <summary>
        /// Parses an IGCCoreDevel from the specified DataReader
        /// </summary>
        /// <param name="reader">The DataReader from which to read this IGCCoreDevel</param>
        private void Parse(DataReader reader)
        {
            cost          = reader.ReadUInt();
            research_time = reader.ReadUInt();
            model         = reader.ReadString(13);
            reader.Assert((byte)0xCC, "Unexpected value encountered when parsing IGCCoreDevel");
            icon        = reader.ReadString(13);
            name        = reader.ReadString(25);
            description = reader.ReadString(200);
            reader.Skip(1);

            root_tree = reader.ReadByte();
            techtree  = new Techtree(reader);
            reader.Assert((byte)0xCD, string.Concat("Unexpected value encountered after techtree when parsing IGCCoreDevel ", name));
            reader.Assert((byte)0xCD, string.Concat("Unexpected value encountered after techtree when parsing IGCCoreDevel ", name));
            factors = new Factors(reader);

            uid = reader.ReadUShort();
            cat = reader.ReadUShort();
        }
Ejemplo n.º 15
0
 private void Parse(DataReader reader)
 {
     pcRED    = reader.ReadFloat();
     pcGreen  = reader.ReadFloat();
     pcBlue   = reader.ReadFloat();
     pcAlpha  = reader.ReadFloat();
     stats_s1 = reader.ReadFloat();             // radius
     stats_s2 = reader.ReadFloat();             // rate rotation
     reader.Skip(13);
     icon = reader.ReadString(13);              // Length [13];
     reader.Assert((byte)0xCC, "Unexpected data found after icon in IGCCoreCounter");
     reader.Assert((byte)0xCC, "Unexpected data found after icon in IGCCoreCounter");
     stats_s3 = reader.ReadFloat();           // load time
     stats_s4 = reader.ReadFloat();           // life span
     stats_s5 = reader.ReadFloat();           // sigfloating
     stats_s6 = reader.ReadInt();             // cost
     stats_s7 = reader.ReadInt();             // build time (seconds)
     model    = reader.ReadString(13);        // Length[13];
     reader.Skip(1);
     type        = reader.ReadString(13);     // Length [13]; //part
     name        = reader.ReadString(25);     // Length [25];
     description = reader.ReadString(200);    // Length [200];
     group       = reader.ReadShort();
     techtree    = new Techtree(reader);
     reader.Assert((byte)0xCD, "Unexpected data found after techtree in IGCCoreCounter");
     reader.Assert((byte)0xCD, "Unexpected data found after techtree in IGCCoreCounter");
     sigmod    = reader.ReadFloat();                // sig mod (%)
     mass      = reader.ReadFloat();                // mass
     usemask   = new BitArray(reader.ReadBytes(2)); //2
     amount    = reader.ReadUShort();               //1 - todo
     stats_s10 = reader.ReadFloat();                // hitpoints
     AC        = (IGCArmorClass)reader.ReadByte();  // 0B default (part)
     reader.Assert((byte)0xCD, "Unexpected data found after AC in IGCCoreCounter");
     uid       = reader.ReadUShort();
     stats_ss2 = reader.ReadUShort();           //0
     ukbmp     = reader.ReadString(13);         // Length [13];
     reader.Assert((byte)0xCD, "Unexpected data found after ukbmp in IGCCoreCounter");
     stats_s11 = reader.ReadFloat();            // strength
 }
Ejemplo n.º 16
0
 private void Parse(DataReader reader)
 {
     pcRED    = reader.ReadFloat();
     pcGreen  = reader.ReadFloat();
     pcBlue   = reader.ReadFloat();
     pcAlpha  = reader.ReadFloat();
     stats_s1 = reader.ReadFloat();           // radius
     stats_s2 = reader.ReadFloat();           // rate rotation
     reader.Skip(13);
     icon = reader.ReadString(13);            // Length [13];
     reader.Assert((ushort)0xCCCC, 0, "UNKNOWN", "Part: Counter", "Icon");
     stats_s3 = reader.ReadFloat();           // load time
     stats_s4 = reader.ReadFloat();           // life span
     stats_s5 = reader.ReadFloat();           // sigfloating
     stats_s6 = reader.ReadInt();             // cost
     stats_s7 = reader.ReadInt();             // build time (seconds)
     model    = reader.ReadString(13);        // Length[13];
     reader.Assert((byte)0xCC, 0, "Model: " + model, "Part: Counter", "Model");
     type        = reader.ReadString(13);     // Length [13]; //part
     name        = reader.ReadString(25);     // Length [25];
     description = reader.ReadString(200);    // Length [200];
     group       = reader.ReadShort();
     techtree    = new Techtree(reader);
     reader.Assert((ushort)0xCDCD, 0, name, "Part: Counter", "Techtree");
     sigmod    = reader.ReadFloat();                // sig mod (%)
     mass      = reader.ReadFloat();                // mass
     usemask   = new BitArray(reader.ReadBytes(2)); //2
     amount    = reader.ReadUShort();               //1 - todo
     stats_s10 = reader.ReadFloat();                // hitpoints
     AC        = (IGCArmorClass)reader.ReadByte();  // 0B default (part)
     reader.Assert((byte)0xCD, 0, name, "Part: Counter", "Armour Class");
     uid       = reader.ReadUShort();
     stats_ss2 = reader.ReadUShort();           //0
     ukbmp     = reader.ReadString(13);         // Length [13];
     reader.Assert((byte)0xCD, uid, name, "Part: Counter", "ukbmp");
     stats_s11 = reader.ReadFloat();            // strength
 }
Ejemplo n.º 17
0
        public void Parse(DataReader reader)
        {
            cost = reader.ReadInt();
            reader.Assert((int)0, 0, "UNKNOWN", "Ship", "Cost");
            model = reader.ReadString(13);             // Length 13;
            reader.Assert((byte)0, 0, "Model: " + model, "Ship", "Model");

            icon        = reader.ReadString(13);  // Length 13;
            name        = reader.ReadString(25);  // Length 25;
            description = reader.ReadString(200); //Length 200;
            zero        = reader.ReadByte();      // Length 1;
            group       = reader.ReadByte();      // Length 1;
            techtree    = new Techtree(reader);   // Length 100;
            reader.Assert((short)0, 0, name, "Ship", "Techtree");

            stats_s1       = reader.ReadFloat();   // mass
            stats_s2       = reader.ReadFloat();   // sig%
            stats_s3       = reader.ReadFloat();   // speed
            stats_s4       = reader.ReadFloat();   // SAX = MaxRollRate in radians
            stats_s5       = reader.ReadFloat();   // SAY = MaxPitchRate in radians
            stats_s6       = reader.ReadFloat();   // SAZ = MaxYawRate in radians
            stats_s7       = reader.ReadFloat();   // SBX = DriftRoll (unit ?)
            stats_s8       = reader.ReadFloat();   // SBY = DriftPitch (unit ?)
            stats_s9       = reader.ReadFloat();   // SBZ = DriftYaw  (unit ?)
            stats_s10      = reader.ReadFloat();   // max thrust
            stats_s11      = reader.ReadFloat();   // STM (side thrust multiplier)
            stats_s12      = reader.ReadFloat();   // RTM (reverse thrust multiplier)
            stats_s13      = reader.ReadFloat();   // scan
            stats_s14      = reader.ReadFloat();   // fuel
            stats_s15      = reader.ReadFloat();   // lock mode (ecm)
            stats_s16      = reader.ReadFloat();   // scale
            stats_s17      = reader.ReadFloat();   // energy
            stats_s18      = reader.ReadFloat();   // recharge
            stats_s19      = reader.ReadFloat();   // rip time
            stats_s20      = reader.ReadFloat();   // rip cost
            stats_ss1      = reader.ReadUShort();  // ammo capacity
            uid            = reader.ReadUShort();  // confirmed
            overriding_uid = reader.ReadShort();   // -1 if none
            nb_parts       = reader.ReadByte();    // Length 1; part size = 30
            mnt_nbwpslots  = reader.ReadByte();    // Length 1
            stats_hp       = reader.ReadFloat();
            reader.Assert((ushort)0x021C, uid, name, "Ship", "Hitpoints");

            AC = reader.ReadByte();
            reader.Assert((byte)0, uid, name, "Ship", "Armour Class");
            stats_ld1 = reader.ReadUShort();             // missiles capacity
            stats_ld2 = reader.ReadUShort();             // pack capacity
            stats_ld3 = reader.ReadUShort();             // CM capacity
            for (int i = 0; i < 14; i++)
            {
                def_loadout[i] = reader.ReadShort();                 // Length 14; -1 or part uid
            }
            hullability = new BitArray(reader.ReadBytes(2));
            reader.Skip(14);             // all zero

            for (int i = 0; i < 8; i++)
            {
                can_use[i] = new BitArray(reader.ReadBytes(2));                 // Length 8; usage masks,see IGCShipUseMasks
            }
            Sound_Interior       = reader.ReadUShort();
            Sound_Exterior       = reader.ReadUShort();
            Sound_ThrustInterior = reader.ReadUShort();
            Sound_ThrustExterior = reader.ReadUShort();
            Sound_TurnInterior   = reader.ReadUShort();
            Sound_TurnExterior   = reader.ReadUShort();
            reader.Assert((short)0, uid, name, "Ship", "Exterior Turn Sound");

            parts = new IGCCoreShipMP[nb_parts];
            for (int i = 0; i < nb_parts; i++)
            {
                IGCCoreShipMP Part = new IGCCoreShipMP(reader);
                parts[i] = Part;                 // Length 20
            }
        }
Ejemplo n.º 18
0
        /// <summary>
        /// Determines whether or not this ship can mount the specified part
        /// </summary>
        /// <param name="part"></param>
        /// <returns></returns>
        public bool CanMountPart(IGCCorePart part, ShipSlots slot)
        {
            if (part == null)
            {
                return(CanUseSlot(slot));
            }

            bool     Result   = false;
            BitArray SlotMask = null;

            // Find which SlotMask we need to compare
            int MaskIndex = -1;

            switch (part.ModuleType)
            {
            case AGCObjectType.AGC_ChaffType:
                if (slot == ShipSlots.Chaff || (int)slot > 15)
                {
                    MaskIndex = (int)ShipUseMasks.Counter;
                }
                break;

            case AGCObjectType.AGC_MineType:
                if (slot == ShipSlots.Pack || (int)slot > 15)
                {
                    MaskIndex = (int)ShipUseMasks.Pack;
                }
                break;

            case AGCObjectType.AGC_MissileType:
                if (slot == ShipSlots.Missile || (int)slot > 15)
                {
                    MaskIndex = (int)ShipUseMasks.Missile;
                }
                break;

            case AGCObjectType.AGC_ProbeType:
                if (slot == ShipSlots.Pack || (int)slot > 15)
                {
                    MaskIndex = (int)ShipUseMasks.Pack;
                }
                break;

            case AGCObjectType.AGC_PartType:
                switch (part.PartType)
                {
                case PartType.Afterburner:
                    if (slot == ShipSlots.Booster || (int)slot > 15)
                    {
                        MaskIndex = (int)ShipUseMasks.Booster;
                    }
                    break;

                case PartType.Cloak:
                    if (slot == ShipSlots.Cloak || (int)slot > 15)
                    {
                        MaskIndex = (int)ShipUseMasks.Cloak;
                    }
                    break;

                case PartType.Shield:
                    if (slot == ShipSlots.Shield || (int)slot > 15)
                    {
                        MaskIndex = (int)ShipUseMasks.Shield;
                    }
                    break;

                case PartType.Pack:
                    if ((int)slot < 16)                                     // You can't mount ammo or fuel in bays
                    {
                        return(false);
                    }
                    else
                    {
                        SlotMask = new BitArray(16, true);
                    }
                    break;

                case PartType.Weapon:
                    int Slot = (int)slot;
                    if (Slot >= 8 && Slot < 16)
                    {
                        return(false);
                    }

                    if (Slot < 8)
                    {
                        if (_ship.WeaponMounts.Length == 0)
                        {
                            return(false);
                        }

                        if (Slot < 4)
                        {
                            SlotMask = (BitArray)_ship.WeaponMounts[Slot].PartMask.Clone();
                        }
                        else
                        {
                            SlotMask = (BitArray)_ship.WeaponMounts[GetWeaponCount() + (Slot - 4)].PartMask.Clone();
                        }
                    }
                    else
                    {
                        SlotMask = new BitArray(16, true);
                    }
                    break;

                default:
                    break;
                }
                break;

            default:
                break;
            }

            // Get the required slot mask for comparison if it isn't a gun/turret
            if (SlotMask == null)
            {
                if (MaskIndex == -1)
                {
                    return(false);
                }
                SlotMask = (BitArray)_ship.UseMasks[MaskIndex].Clone();
            }

            SlotMask.And(part.UseMask);
            // Check if part matches the slot mask
            if (Techtree.BitArrayEquals(SlotMask, part.UseMask) || (int)slot > 15)
            {                   // Part can be mounted. Is it available?
                BitArray CurrentDefs = _team.CalculateDefs();
                CurrentDefs.And(part.Techtree.Pres);
                if (part.Techtree.PreEquals(CurrentDefs))
                {
                    Result = true;
                }
            }

            return(Result);
        }