Example #1
0
        public Power(MpqFile file)
        {
            var stream = file.Open();

            this.Header      = new Header(stream);
            LuaName          = stream.ReadString(64, true);
            stream.Position += 4;   // pad 1
            Powerdef         = new PowerDef(stream);
            stream.Position  = 440; // Seems like theres a bit of a gap - DarkLotus
            I0                   = stream.ReadValueS32();
            I1                   = stream.ReadValueS32();
            Chararray2           = stream.ReadString(256, true);
            ScriptFormulaCount   = stream.ReadValueS32();
            ScriptFormulaDetails = stream.ReadSerializedData <ScriptFormulaDetails>();
            stream.Position     += (3 * 4);
            i3                   = stream.ReadValueS32();
            stream.Position     += (3 * 4);

            // TODO: please fix this - use our serializable-data readers instead! /raist
            // TODO add a class for complied script so it can be deserialized properly. - DarkLotus
            // none of the .pow appear to have any data here, and stream position appears to be correct, unsure - DarkLotus
            var serCompliedScript = stream.GetSerializedDataPointer();

            if (serCompliedScript.Size > 0)
            {
                long x = stream.Position;
                stream.Position = serCompliedScript.Offset + 16;
                var buf = new byte[serCompliedScript.Size];
                stream.Read(buf, 0, serCompliedScript.Size);
                stream.Position = x;
                CompliedScript.AddRange(buf);
            }
            SNOQuestMetaData = stream.ReadValueS32();
            stream.Close();
        }
Example #2
0
        public Power(MpqFile file)
        {
            var stream = file.Open();   
            this.Header = new Header(stream);
            LuaName = stream.ReadString(64, true);
            stream.Position += 4; // pad 1
            Powerdef = new PowerDef(stream);
            stream.Position = 440; // Seems like theres a bit of a gap - DarkLotus
            I0 = stream.ReadValueS32();
            I1 = stream.ReadValueS32();
            Chararray2 = stream.ReadString(256, true);
            ScriptFormulaCount = stream.ReadValueS32();
            ScriptFormulaDetails = stream.ReadSerializedData<ScriptFormulaDetails>();
            stream.Position += (3 * 4);
            i3 = stream.ReadValueS32();
            stream.Position += (3 * 4);

            // TODO: please fix this - use our serializable-data readers instead! /raist
            // TODO add a class for complied script so it can be deserialized properly. - DarkLotus
            // none of the .pow appear to have any data here, and stream position appears to be correct, unsure - DarkLotus
            var serCompliedScript = stream.GetSerializedDataPointer();
            if (serCompliedScript.Size > 0)
            {
                long x = stream.Position;
                stream.Position = serCompliedScript.Offset + 16;
                var buf = new byte[serCompliedScript.Size];
                stream.Read(buf, 0, serCompliedScript.Size);
                stream.Position = x;
                CompliedScript.AddRange(buf);
            }
            SNOQuestMetaData = stream.ReadValueS32();
            stream.Close();
        }
Example #3
0
        public Power(MpqFile file)
        {
            var stream = file.Open();   
            this.Header = new Header(stream);
            LuaName = stream.ReadString(64, true);
            stream.Position += 4; // pad 1
            Powerdef = new PowerDef(stream);
            stream.Position = 440; // Seems like theres a bit of a gap - DarkLotus
            I0 = stream.ReadValueS32();
            I1 = stream.ReadValueS32();
            Chararray2 = stream.ReadString(256, true);
            ScriptFormulaCount = stream.ReadValueS32();
            ScriptFormulaDetails = stream.ReadSerializedData<ScriptFormulaDetails>();
            stream.Position += (3 * 4);
            i3 = stream.ReadValueS32();
            stream.Position += (3 * 4);

            CompiledScript = System.Text.Encoding.ASCII.GetString(stream.ReadSerializedByteArray());
            SNOQuestMetaData = stream.ReadValueS32();
            stream.Close();
        }
Example #4
0
        public Power(MpqFile file)
        {
            var stream = file.Open();

            this.Header      = new Header(stream);
            LuaName          = stream.ReadString(64, true);
            stream.Position += 4;   // pad 1
            Powerdef         = new PowerDef(stream);
            stream.Position  = 440; // Seems like theres a bit of a gap - DarkLotus
            I0                   = stream.ReadValueS32();
            I1                   = stream.ReadValueS32();
            Chararray2           = stream.ReadString(256, true);
            ScriptFormulaCount   = stream.ReadValueS32();
            ScriptFormulaDetails = stream.ReadSerializedData <ScriptFormulaDetails>();
            stream.Position     += (3 * 4);
            i3                   = stream.ReadValueS32();
            stream.Position     += (3 * 4);

            CompiledScript   = System.Text.Encoding.ASCII.GetString(stream.ReadSerializedByteArray());
            SNOQuestMetaData = stream.ReadValueS32();
            stream.Close();
        }