Esempio n. 1
0
            public void Write(Stream stream)
            {
                using (BinaryWriter writer = new BinaryWriter(stream)) {
                    writer.Write(Extension); // type identifier
                    writer.Write(VersionMajor);
                    writer.Write(VersionMinor);

                    writer.Write(Entity.GetNameIndex());
                    if (Entity.m_modelGUID != 0)
                    {
                        FindLogic.Combo.ModelAsset modelInfo = Info.m_models[Entity.m_modelGUID];
                        writer.Write(modelInfo.GetName());
                    }
                    else
                    {
                        writer.Write("null");
                    }

                    if (Entity.m_effectGUID != 0)
                    {
                        FindLogic.Combo.EffectInfoCombo effectInfo = Info.m_effects[Entity.m_effectGUID];
                        writer.Write(effectInfo.GetName());
                    }
                    else
                    {
                        writer.Write("null");
                    }

                    writer.Write(teResourceGUID.Index(Entity.m_GUID));
                    writer.Write(teResourceGUID.Index(Entity.m_modelGUID));
                    writer.Write(teResourceGUID.Index(Entity.m_effectGUID));

                    if (Entity.Children == null)
                    {
                        writer.Write(0);
                        return;
                    }

                    writer.Write(Entity.Children.Count(x => x.m_defGUID != 0));
                    foreach (FindLogic.Combo.ChildEntityReference childEntityReference in Entity.Children.Where(x => x.m_defGUID != 0))
                    {
                        FindLogic.Combo.EntityAsset childEntityInfo = Info.m_entities[childEntityReference.m_defGUID];

                        writer.Write(childEntityInfo.GetName());
                        writer.Write(childEntityReference.m_hardpointGUID);
                        writer.Write(childEntityReference.m_identifier);
                        writer.Write(teResourceGUID.Index(childEntityReference.m_hardpointGUID));
                        writer.Write(teResourceGUID.Index(childEntityReference.m_identifier));
                        if (childEntityReference.m_hardpointGUID != 0)
                        {
                            writer.Write(OverwatchModel.IdToString("hardpoint", teResourceGUID.Index(childEntityReference.m_hardpointGUID)));
                        }
                        else
                        {
                            writer.Write("null"); // erm, k
                        }
                    }
                }
            }
Esempio n. 2
0
            public void Write(Stream output, FindLogic.Combo.EntityInfoNew entity, FindLogic.Combo.ComboInfo info)
            {
                using (BinaryWriter writer = new BinaryWriter(output)) {
                    writer.Write(new string(Identifier));
                    writer.Write(VersionMajor);
                    writer.Write((ushort)1);  // todo

                    writer.Write(entity.GetNameIndex());
                    if (entity.Model != 0)
                    {
                        FindLogic.Combo.ModelInfoNew modelInfo = info.Models[entity.Model];
                        writer.Write(modelInfo.GetName());
                    }
                    else
                    {
                        writer.Write("null");
                    }
                    if (entity.Effect != 0)
                    {
                        FindLogic.Combo.EffectInfoCombo effectInfo = info.Effects[entity.Effect];
                        writer.Write(effectInfo.GetName());
                    }
                    else
                    {
                        writer.Write("null");
                    }
                    writer.Write(GUID.Index(entity.GUID));
                    writer.Write(GUID.Index(entity.Model));
                    writer.Write(GUID.Index(entity.Effect));

                    if (entity.Children == null)
                    {
                        writer.Write(0);
                        return;
                    }
                    writer.Write(entity.Children.Count(x => x.GUID != 0));
                    foreach (FindLogic.Combo.ChildEntityReferenceNew childEntityReference in entity.Children.Where(x => x.GUID != 0))
                    {
                        FindLogic.Combo.EntityInfoNew childEntityInfo = info.Entities[childEntityReference.GUID];

                        writer.Write(childEntityInfo.GetName());
                        writer.Write(childEntityReference.Hardpoint);
                        writer.Write(childEntityReference.Variable);
                        writer.Write(GUID.Index(childEntityReference.Hardpoint));
                        writer.Write(GUID.Index(childEntityReference.Variable));
                        if (childEntityReference.Hardpoint != 0)
                        {
                            writer.Write(Model.OWModelWriter14.IdToString("hardpoint", GUID.Index(childEntityReference.Hardpoint)));
                        }
                        else
                        {
                            writer.Write("null"); // erm, k
                        }
                    }
                }
            }
Esempio n. 3
0
            public void Write(Stream stream)
            {
                using (BinaryWriter writer = new BinaryWriter(stream)) {
                    writer.Write(Extension);  // type identifier
                    writer.Write(VersionMajor);
                    writer.Write(VersionMinor);

                    writer.Write(Entity.GetNameIndex());
                    if (Entity.Model != 0)
                    {
                        FindLogic.Combo.ModelInfoNew modelInfo = Info.Models[Entity.Model];
                        writer.Write(modelInfo.GetName());
                    }
                    else
                    {
                        writer.Write("null");
                    }
                    if (Entity.RootEffect != 0)
                    {
                        FindLogic.Combo.EffectInfoCombo effectInfo = Info.Effects[Entity.RootEffect];
                        writer.Write(effectInfo.GetName());
                    }
                    else
                    {
                        writer.Write("null");
                    }
                    writer.Write(teResourceGUID.Index(Entity.GUID));
                    writer.Write(teResourceGUID.Index(Entity.Model));
                    writer.Write(teResourceGUID.Index(Entity.RootEffect));

                    if (Entity.Children == null)
                    {
                        writer.Write(0);
                        return;
                    }
                    writer.Write(Entity.Children.Count(x => x.GUID != 0));
                    foreach (FindLogic.Combo.ChildEntityReferenceNew childEntityReference in Entity.Children.Where(x => x.GUID != 0))
                    {
                        FindLogic.Combo.EntityInfoNew childEntityInfo = Info.Entities[childEntityReference.GUID];

                        writer.Write(childEntityInfo.GetName());
                        writer.Write(childEntityReference.Hardpoint);
                        writer.Write(childEntityReference.Variable);
                        writer.Write(teResourceGUID.Index(childEntityReference.Hardpoint));
                        writer.Write(teResourceGUID.Index(childEntityReference.Variable));
                        if (childEntityReference.Hardpoint != 0)
                        {
                            writer.Write(OverwatchModel.IdToString("hardpoint", teResourceGUID.Index(childEntityReference.Hardpoint)));
                        }
                        else
                        {
                            writer.Write("null"); // erm, k
                        }
                    }
                }
            }
Esempio n. 4
0
        public static void SaveEffect(ICLIFlags flags, string path, FindLogic.Combo.ComboInfo info, ulong effect)
        {
            Effect.OWEffectWriter           effectWriter = new Effect.OWEffectWriter();
            FindLogic.Combo.EffectInfoCombo effectInfo   = info.Effects[effect];
            string effectDirectory = Path.Combine(path, "Effects", effectInfo.GetName());
            string effectFile      = Path.Combine(effectDirectory, $"{effectInfo.GetNameIndex()}{effectWriter.Format}");

            CreateDirectoryFromFile(effectFile);

            SaveEffectExtras(flags, effectDirectory, info, effectInfo.Effect, out Dictionary <ulong, HashSet <FindLogic.Combo.VoiceLineInstanceInfo> > svceLines);

            using (Stream effectOutputStream = File.OpenWrite(effectFile)) {
                effectOutputStream.SetLength(0);
                effectWriter.Write(effectOutputStream, effectInfo, info, svceLines);
            }
        }
Esempio n. 5
0
        public static void SaveEffect(ICLIFlags flags, string path, SaveContext context, ulong effect)
        {
            FindLogic.Combo.EffectInfoCombo effectInfo = context.m_info.m_effects[effect];
            string effectDirectory = Path.Combine(path, "Effects", effectInfo.GetName());

            SaveEffectExtras(flags, effectDirectory, context, effectInfo.Effect, out Dictionary <ulong, HashSet <FindLogic.Combo.VoiceLineInstanceInfo> > svceLines);

            Effect.OverwatchEffect output = new Effect.OverwatchEffect(context.m_info, effectInfo, svceLines);
            string effectFile             = Path.Combine(effectDirectory, $"{effectInfo.GetNameIndex()}.{output.Extension}");

            CreateDirectoryFromFile(effectFile);

            using (Stream effectOutputStream = File.OpenWrite(effectFile)) {
                effectOutputStream.SetLength(0);
                output.Write(effectOutputStream);
            }
        }