private string GetAssetLink(
            string defName, UInt32 control, int element)
        {
            BINEntry entry = GetBINEntry(defName);

            if (entry != null)
            {
                DefinitionType def =
                    FileDatabase.Instance.Definitions.GetDefinition(
                        entry.Definition);

                def.ReadIn(entry);

                FableMod.ContentManagement.Control c =
                    def.FindControl(control);

                if (c != null)
                {
                    Member mbr = (Member)c.Members[element];

                    ContentObject o = ContentManager.Instance.FindEntry(
                        mbr.Link.To, mbr.Value);

                    if (o != null)
                    {
                        return(o.Name);
                    }
                }
            }

            return(null);
        }
Example #2
0
        private void ApplyScript(
            FableMod.ContentManagement.Control c,
            string script)
        {
            string[] lines = script.Split(
                new string[] { "\r\n" },
                StringSplitOptions.RemoveEmptyEntries);

            Member      memberCount = (Member)c.Members[0];
            ArrayMember memberLines = (ArrayMember)c.Members[1];

            memberCount.Value = (UInt32)lines.Length;
            memberLines.Elements.Clear();

            for (int i = 0; i < lines.Length; ++i)
            {
                MemberCollection mc = memberLines.CreateElement();

                ((Member)mc[0]).Value = lines[i];

                memberLines.Elements.Add(mc);
            }
        }
Example #3
0
        private string GetScript(FableMod.ContentManagement.Control c)
        {
            if (c == null)
            {
                return("");
            }

            Member      memberCount = (Member)c.Members[0];
            ArrayMember memberLines = (ArrayMember)c.Members[1];

            StringBuilder sb = new StringBuilder();

            uint count = (uint)memberCount.Value;

            for (int i = 0; i < count; ++i)
            {
                Member memberLine = (Member)memberLines.Elements[i][0];

                sb.AppendLine(memberLine.Value.ToString());
            }

            return(sb.ToString());
        }
Example #4
0
        public FormCutscene(BINEntry cutscene)
        {
            InitializeComponent();

            myCutscene = cutscene;

            Text = "Cutscene: " + myCutscene.Name;

            myDefType = ContentManager.Instance.Definitions.GetDefinition(
                myCutscene.Definition);

            myDefType.ReadIn(myCutscene);

            myMode1 = myDefType.FindControl(0x5A1E6CA9);
            myMode2 = myDefType.FindControl(0xC1CABAFF);
            myMode3 = myDefType.FindControl(0x4FC34512);

            textBox1.Text = GetScript(myMode1);
            textBox2.Text = GetScript(myMode2);
            textBox3.Text = GetScript(myMode3);

            myModified = false;
        }
        private void AssetLink(
            BINEntry entryDst,
            AssetTemplate assetItem, UInt32 assetId)
        {
            DefinitionType def =
                ContentManager.Instance.Definitions.GetDefinition(
                    entryDst.Definition);

            def.ReadIn(entryDst);

            FableMod.ContentManagement.Control c =
                def.FindControl(assetItem.ControlID);

            if (c != null)
            {
                ((Member)c.Members[assetItem.Element]).Value =
                    assetId.ToString();

                def.Write(entryDst);
            }

            def = null;
        }
        protected override void ShowSelectedEntry()
        {
            ContentManager mgr = ContentManager.Instance;

            ContentObject obj = mgr.FindEntry(
                LinkDestination.GameBINEntryName,
                Selected.Name);

            if (obj != null)
            {
                // Open the model.

                DefinitionType defType = mgr.Definitions.GetDefinition(
                    Selected.Definition);

                if (defType != null)
                {
                    defType.ReadIn(Selected);

                    FableMod.ContentManagement.Control c =
                        defType.FindControl(0xC8636B2E);

                    if (c != null && c.Members.Count == 5)
                    {
                        Member m = (Member)c.Members[1];

                        mgr.ShowEntry(
                            LinkDestination.ModelID,
                            m.Value,
                            true);
                    }

                    c       = null;
                    defType = null;
                }
            }
        }