示例#1
0
        static TES5.Group make_tes5_doors(List <door_> lst)
        {
            TES5.Group grup = new TES5.Group("DOOR");

            TES5.Record marker = new TES5.Record("DOOR");
            marker.addField(new TES5.Field("EDID", Text.editor_id("teleport_marker")));

            marker_id = marker.id;
            grup.addRecord(marker);

            foreach (door_ d in lst)
            {
                // Make Normal version
                TES5.Record r = new TES5.Record("DOOR", d.id);
                r.addField(new TES5.Field("EDID", Text.editor_id(d.id)));
                r.addField(new TES5.Field("FULL", Text.zstring(d.full_name)));
                r.addField(new TES5.Field("MODL", Text.model_path(d.model_path)));

                // Make Portal version
                TES5.Record r_load = new TES5.Record("DOOR", d.id + "_zload");
                r_load.addField(new TES5.Field("EDID", Text.editor_id(d.id + "_zload")));
                r_load.addField(new TES5.Field("FULL", Text.zstring(d.full_name)));
                r_load.addField(new TES5.Field("MODL", Text.model_path(d.model_path.ToLower().Replace(".nif", "_zload.nif"))));

                grup.addRecord(r);
                grup.addRecord(r_load);

                ModelConverter.convert(d.model_path, "door_load", true);
                ModelConverter.convert(d.model_path, "door_anim", true);
            }

            return(grup);
        }
示例#2
0
        protected TES5.Group convert(string file)
        {
            List <OBJ_STRUCT> lst = get_lst(file);

            TES5.Group grup = new TES5.Group(TYPE);

            foreach (OBJ_STRUCT obj in lst)
            {
                TES5.Record r = new TES5.Record(TYPE, obj.editor_id);

                if (obj.editor_id != null)
                {
                    r.addField(new TES5.Field("EDID", Text.editor_id(obj.editor_id)));
                }
                if (obj.game_name != null)
                {
                    r.addField(new TES5.Field("FULL", Text.zstring(obj.game_name)));
                }
                if (obj.model_path != null)
                {
                    r.addField(new TES5.Field("MODL", Text.model_path(obj.model_path)));
                }

                grup.addRecord(r);
            }

            return(grup);
        }
示例#3
0
        public TES5.Group convert(string file, bool ignoreFurniture = false)
        {
            List <OBJ_STRUCT> lst = get_lst(file);

            TES5.Group grup = new TES5.Group(TYPE);

            foreach (OBJ_STRUCT obj in lst)
            {
                TES5.Record r = new TES5.Record(TYPE, obj.editor_id);

                bool isFurn = false;
                if (!ignoreFurniture)
                {
                    isFurn = FURN.consider(obj.model_path, r);
                }

                r.addField(new TES5.Field("EDID", Text.editor_id(obj.editor_id)));
                if (obj.game_name != null && !isFurn)
                {
                    r.addField(new TES5.Field("FULL", Text.zstring(obj.game_name)));
                }
                if (obj.model_path != null)
                {
                    r.addField(new TES5.Field("MODL", Text.model_path(obj.model_path)));
                }

                grup.addRecord(r);
                ModelConverter.convert(obj.model_path, "stat", true);
            }

            return(grup);
        }
示例#4
0
        public static TES5.Group convert(string file)
        {
            TES5.Group fact = new TES5.Group("FACT");

            TES3.ESM.open(file);

            while (TES3.ESM.find("FACT"))
            {
                TES3.Record f3 = new TES3.Record();
                f3.read();

                string editor_id = f3.find_first("NAME").readString();
                string full_name = f3.find_first("NAME") != null?f3.find_first("NAME").readString() : null;

                TES5.Record f5 = new TES5.Record("FACT", editor_id);

                if (full_name != null)
                {
                    f5.addField(new TES5.Field("FULL", Text.zstring(full_name)));
                }

                List <TES3.SubRecord> ANAMs = f3.find_all("ANAM", true);
                List <TES3.SubRecord> INTVs = f3.find_all("INTV", true);

                foreach (TES3.SubRecord intv in INTVs)
                {
                    int reaction = intv.getData().ReadInt32();
                    if (reaction <= -3) // make hostile
                    {
                        reaction = 1;
                    }
                    else if (reaction > -3 && reaction <= 1)
                    {
                        reaction = 0;
                    }
                    else if (reaction >= 2)
                    {
                        reaction = 2;
                    }
                }

                uint flags = 0;
                flags = BinaryFlag.set(flags, 0x8000);
                f5.addField(new TES5.Field("DATA", Binary.toBin(flags)));
                fact.addRecord(f5);
            }


            TES3.ESM.close();

            return(fact);
        }
示例#5
0
        static TES5.Record make_ltex(uint formid, string editor_id)
        {
            TES5.Record ltex = new TES5.Record("LTEX");
            ltex.addField(new TES5.Field("EDID", Text.editor_id("LAND_" + editor_id)));
            ltex.addField(new TES5.Field("TNAM", Binary.toBin(formid)));
            ltex.addField(new TES5.Field("HNAM", new byte[2] {
                2, 0
            }));
            ltex.addField(new TES5.Field("SNAM", new byte[1] {
                30
            }));

            return(ltex);
        }
示例#6
0
        static TES5.Record make_txst(string editor_id, string texture)
        {
            texture = texture.Replace(".tga", ".dds");

            string path = "morrowind\\";

            TES5.Record txset = new TES5.Record("TXST");
            txset.addField(new TES5.Field("EDID", Text.editor_id(editor_id)));
            txset.addField(new TES5.Field("OBND", new byte[12]));
            txset.addField(new TES5.Field("TX00", Text.zstring(path + texture)));
            txset.addField(new TES5.Field("TX01", Text.zstring(path + texture.Replace(".dds", "_n.dds"))));

            ushort flag = (ushort)BinaryFlag.set(0, 0x01);

            txset.addField(new TES5.Field("DNAM", Binary.toBin(flag)));

            return(txset);
        }
示例#7
0
        public static TES5.Group convert(string file_path, bool ignoreFurniture = false)
        {
            TES3.ESM.open(file_path);

            List <STRUCT_STAT> list_stat = new List <STRUCT_STAT>();

            while (TES3.ESM.find("STAT"))
            {
                TES3.Record stat = new TES3.Record();
                stat.read();

                STRUCT_STAT stat_ = new STRUCT_STAT();

                foreach (TES3.SubRecord srec in stat.subRecords)
                {
                    if (srec.isType("MODL"))
                    {
                        stat_.model_path = Text.trim(new string(srec.getData().ReadChars(srec.size)));
                        //stat_.model_path = stat_.model_path.Split('\\')[stat_.model_path.Split('\\').Length - 1];
                        //stat_.model_path = "morrowind\\" + stat_.model_path;
                        Log.info(stat_.model_path);
                    }

                    if (srec.isType("NAME"))
                    {
                        stat_.editor_id = Text.trim(new string(srec.getData().ReadChars(srec.size)));
                    }
                }



                list_stat.Add(stat_);
            }

            TES3.ESM.close();

            // Make TES5


            TES5.Group stat_grup = new TES5.Group("STAT");

            foreach (STRUCT_STAT stat in list_stat)
            {
                TES5.Record stat_tes5 = new TES5.Record("STAT", stat.editor_id, 0);
                stat_tes5.addField(new TES5.Field("EDID", Text.editor_id(stat.editor_id)));
                //stat_tes5.addField(new TES5.Field("OBND", new byte[12]));
                stat_tes5.addField(new TES5.Field("MODL", Text.model_path(stat.model_path)));

                MemoryStream mstream = new MemoryStream();
                BinaryWriter bw      = new BinaryWriter(mstream);
                bw.Write(90f);
                bw.Write(0);

                stat_tes5.addField(new TES5.Field("DNAM", mstream.ToArray()));

                if (!ignoreFurniture)
                {
                    Convert.FURN.consider(stat.model_path, stat_tes5);
                }
                stat_grup.addRecord(stat_tes5);


                ModelConverter.convert(stat.model_path, "stat", true);
            }


            return(stat_grup);
        }