Exemplo n.º 1
0
        private void AddItemButton_Click(object sender, System.EventArgs e)
        {
            NewObjectForm objectForm = new NewObjectForm(true);

            objectForm.SetLabel("$SELECT_TYPE_AND_NAME");
            ActorItemAddOption optionControl = new ActorItemAddOption();

            objectForm.LoadOption(optionControl);

            if (objectForm.ShowDialog() == DialogResult.OK)
            {
                ActorTypes type  = optionControl.GetSelectedType();
                ActorEntry entry = actors.CreateActorEntry(type, objectForm.GetInputText());

                TreeNode node = new TreeNode(entry.EntityName);
                node.Text = entry.EntityName;
                node.Tag  = entry;

                TreeNode child = new TreeNode("Extra Data");
                child.Tag = actors.ExtraData[entry.DataID];
                node.Nodes.Add(child);
                items.Nodes.Add(node);
            }

            objectForm.Dispose();
        }
Exemplo n.º 2
0
        public void Update()
        {
            var numEntries =
                _game.Process.ReadUInt64(
                    _game.Process.GetModuleBasedOffset("ffxiv_dx11.exe", _game.Definitions.ActorTable));

            _currentEntries = new ActorEntry[numEntries];

            for (ulong i = 0; i < numEntries; i++)
            {
                ulong offset = 8 + (i * 8);

                var address = new Pointer(_game.Process, _game.Definitions.ActorTable + offset, 0);

                _currentEntries[i] = new ActorEntry
                {
                    Offset     = address,
                    ActorID    = _game.Process.ReadUInt32(address + _game.Definitions.ActorID),
                    Name       = _game.Process.ReadString(address + _game.Definitions.Name),
                    DataId     = _game.Process.ReadUInt32(address + _game.Definitions.BnpcBase),
                    OwnerID    = _game.Process.ReadUInt32(address + _game.Definitions.OwnerID),
                    ModelChara = _game.Process.ReadUInt16(address + _game.Definitions.ModelChara),
                    Job        = _game.Process.ReadByte(address + _game.Definitions.Job),
                    Level      = _game.Process.ReadByte(address + _game.Definitions.Level),
                    World      = _game.Process.ReadByte(address + _game.Definitions.World),
                    HomeWorld  = _game.Process.ReadByte(address + _game.Definitions.HomeWorld),
                    CompanyTag = _game.Process.ReadString(address + _game.Definitions.CompanyTag),
                    ObjectKind = (ObjectKind)_game.Process.ReadByte(address + _game.Definitions.ObjectKind),
                    SubKind    = _game.Process.ReadByte(address + _game.Definitions.SubKind),
                    StatusID   = _game.Process.ReadByte(address + _game.Definitions.Status),
                    HPCurrent  = _game.Process.ReadUInt32(address + _game.Definitions.HPCurrent),
                    HPMax      = _game.Process.ReadUInt32(address + _game.Definitions.HPMax),
                    MPCurrent  = _game.Process.ReadUInt32(address + _game.Definitions.MPCurrent),
                    GPCurrent  = _game.Process.ReadUInt16(address + _game.Definitions.GPCurrent),
                    GPMax      = _game.Process.ReadUInt16(address + _game.Definitions.GPMax),
                    CPCurrent  = _game.Process.ReadUInt16(address + _game.Definitions.CPCurrent),
                    CPMax      = _game.Process.ReadUInt16(address + _game.Definitions.CPMax),

                    Appearance = new ActorAppearance()
                    {
                        Customize = _game.Process.ReadBytes(address + _game.Definitions.Customize, 26),
                    }
                };
            }
        }
Exemplo n.º 3
0
        private void LoadActors()
        {
            //Setup a list of nodes based on category
            TreeNode ArmourFolder  = new TreeNode("Armours");
            TreeNode WeaponsFolder = new TreeNode("Weapons");
            TreeNode ItemsFolder   = new TreeNode("Items");
            TreeNode EnemyFolder   = new TreeNode("Enemies");

            if (!Directory.Exists(Runtime.BotwGamePath))
            {
                bool IsValid = NotifySetGamePath();
                if (!IsValid) //Give up loading it if it's wrong
                {
                    return;
                }
            }

            Dictionary <string, TreeNode>  ActorIDS = new Dictionary <string, TreeNode>();
            Dictionary <string, ActorInfo> Actors   = new Dictionary <string, ActorInfo>();

            if (File.Exists($"{Runtime.BotwGamePath}{ActorInfoTable}"))
            {
                var byml = EveryFileExplorer.YAZ0.Decompress($"{Runtime.BotwGamePath}{ActorInfoTable}");
                var actorInfoProductRoot = ByamlExt.Byaml.ByamlFile.FastLoadN(new MemoryStream(byml)).RootNode;

                if (actorInfoProductRoot.ContainsKey("Actors"))
                {
                    foreach (var actor in actorInfoProductRoot["Actors"])
                    {
                        ActorInfo info = new ActorInfo(actor);
                        if (info.Name != string.Empty)
                        {
                            Actors.Add(info.Name, info);
                        }
                    }
                }
            }

            //Parse message data for our actor names, and additional info to add to the editor

            Console.WriteLine("msbtEXT " + File.Exists($"{Runtime.BotwGamePath}{ActorMessageData}"));
            Console.WriteLine($"{Runtime.BotwGamePath}{ActorMessageData}");

            if (File.Exists($"{Runtime.BotwGamePath}{ActorMessageData}"))
            {
                var msgPack = SARCExt.SARC.UnpackRamN(File.Open($"{Runtime.BotwGamePath}{ActorMessageData}", FileMode.Open));

                //Get the other sarc inside
                foreach (var pack in msgPack.Files)
                {
                    var msgProductPack = SARCExt.SARC.UnpackRamN(EveryFileExplorer.YAZ0.Decompress(pack.Value));

                    //Folders are setup with actors
                    foreach (var msbtFile in msgProductPack.Files)
                    {
                        using (var stream = new MemoryStream(msbtFile.Value))
                        {
                            MSBT msbt = new MSBT();
                            if (!msbt.Identify(stream))
                            {
                                continue;
                            }

                            msbt.Load(new MemoryStream(msbtFile.Value));


                            //Get our labels and match up with our actors
                            if (msbt.header.Label1 != null)
                            {
                                for (int i = 0; i < msbt.header.Label1.Labels.Count; i++)
                                {
                                    var lbl = msbt.header.Label1.Labels[i];

                                    if (lbl.Name.Contains("_Name"))
                                    {
                                        string actorName = lbl.Name.Replace("_Name", string.Empty);
                                        if (Actors.ContainsKey(actorName))
                                        {
                                            Actors[actorName].MessageFile = Path.GetFileNameWithoutExtension(msbtFile.Key);
                                            Actors[actorName].MessageName = lbl.String.GetText(msbt.header.StringEncoding);
                                        }
                                    }
                                    if (lbl.Name.Contains("_Desc"))
                                    {
                                        string actorName = lbl.Name.Replace("_Desc", string.Empty);
                                        if (Actors.ContainsKey(actorName))
                                        {
                                            Actors[actorName].MessageFile        = Path.GetFileNameWithoutExtension(msbtFile.Key);
                                            Actors[actorName].MessageDescription = lbl.String.GetText(msbt.header.StringEncoding);
                                        }
                                    }
                                }
                            }

                            msbt.Unload();
                        }
                    }
                }
            }

            Dictionary <string, TreeNode> Categories = new Dictionary <string, TreeNode>();

            foreach (var info in Actors)
            {
                if (info.Value.MessageName != string.Empty)
                {
                    //Temp atm. Use message file name for organing
                    string catgeory = info.Value.MessageFile;

                    if (!Categories.ContainsKey(catgeory))
                    {
                        TreeNode node = new TreeNode(catgeory);
                        editor.AddNode(node);
                        Categories.Add(catgeory, node);
                    }

                    ActorEntry entry = new ActorEntry();
                    entry.Info = info.Value;
                    entry.Text = info.Value.MessageName;
                    Categories[catgeory].Nodes.Add(entry);
                    entry.ReloadActorProperties();
                }
            }

            Categories.Clear();
            GC.Collect();
        }