Esempio n. 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);
        }
Esempio n. 2
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);
        }
Esempio n. 3
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);
        }
Esempio n. 4
0
        public static TES5.Group convert(string file)
        {
            TES5.Group LIGH_GRP = new TES5.Group("LIGH");
            TES3.ESM.open(file);

            while (TES3.ESM.find("LIGH"))
            {
                TES3.LIGH l3 = new TES3.LIGH();
                l3.read();

                TES5.LIGH l        = new TES5.LIGH(l3.editor_id);
                TES5.LIGH l_shadow = new TES5.LIGH(l3.editor_id + "_shadow");

                TES5.LIGH[] ls = new TES5.LIGH[2] {
                    l, l_shadow
                };

                for (int i = 0; i < 2; i++)
                {
                    TES5.LIGH l5 = ls[i];

                    l5.model = l3.model;

                    l5.Radius = l3.radius; // TODO: Better Replacement?

                    l5.Time   = (int)l3.time;
                    l5.Value  = l3.value;
                    l5.r      = l3.red;
                    l5.g      = l3.green;
                    l5.b      = l3.blue;
                    l5.Weight = l3.weight;

                    // l5.Dynamic = l3.Dynamic; // Not in CK?
                    l5.carried = l3.Can_Carry;

                    l5.Flicker = l3.Flicker;
                    //l5.FlickerSlow = l3.Flicker_Slow; // FlickerSlow not in CK
                    l5.Pulse = l3.Pulse;

                    if (l3.model == null)
                    {
                        // if no model then make it shadow-less
                    }
                    else
                    {
                        //l5.Omnidirectional = true; // if model present make it shadow casting omni-directinal

                        if (i == 1)
                        {
                            l5.Omnidirectional = true;
                        }

                        ModelConverter.convert(l3.model, "stat", true); // and convert model
                    }

                    l5.pack();
                    LIGH_GRP.addRecord(l5);
                    TypeIndex.getInstance().put(l5.editor_id, TypeIndex.TYPE.LIGH); // Mark self as LIGH
                }
            }

            TES3.ESM.close();
            return(LIGH_GRP);
        }