Ejemplo n.º 1
0
        private void Mw_SelectedPrimaryItemValueChanged(object sender, int e)
        {
            if (_root == null)
            {
                return;
            }

            // Only human types have the weird multi-root "Item" representation thing.
            if (_root.Info.PrimaryType != XivItemType.human)
            {
                return;
            }

            // Body stuff is totally desynced.
            if (_root.Info.SecondaryType == XivItemType.body)
            {
                return;
            }

            if (e <= 0)
            {
                return;
            }
            if (e == (int)_root.Info.SecondaryId)
            {
                return;
            }


            // Change root to the new "number" root.
            var nRoot = new XivDependencyRootInfo()
            {
                PrimaryId     = _root.Info.PrimaryId,
                PrimaryType   = _root.Info.PrimaryType,
                SecondaryId   = e,
                SecondaryType = _root.Info.SecondaryType,
                Slot          = _root.Info.Slot
            };

            _lastNumber = e;

            // Switch display to that new root.
            SetRoot(nRoot.ToFullRoot());
        }
Ejemplo n.º 2
0
        public async Task <bool> SetRoot(XivDependencyRoot root, int defaultVariant = 0)
        {
            _root = root;
            if (_root == null)
            {
                return(false);
            }

            if (root.Info.PrimaryType == XivItemType.human)
            {
                if (_lastNumber > 0)
                {
                    if (_lastNumber != (int)root.Info.SecondaryId)
                    {
                        // Change root to the new "number" root.
                        var nRoot = new XivDependencyRootInfo()
                        {
                            PrimaryId     = _root.Info.PrimaryId,
                            PrimaryType   = _root.Info.PrimaryType,
                            SecondaryId   = _lastNumber,
                            SecondaryType = _root.Info.SecondaryType,
                            Slot          = _root.Info.Slot
                        };
                        _root = nRoot.ToFullRoot();
                    }
                }
                if (_root.Info.SecondaryId > 0)
                {
                    _lastNumber = (int)_root.Info.SecondaryId;
                }
            }

            SetLabel.Content  = XivItemTypes.GetSystemPrefix(root.Info.PrimaryType) + root.Info.PrimaryId.ToString().PadLeft(4, '0');
            SlotLabel.Content = Mdl.SlotAbbreviationDictionary.FirstOrDefault(x => x.Value == _root.Info.Slot).Key + "(" + _root.Info.Slot + ")";

            var items = await _root.GetAllItems();

            ItemNameBox.Text = "[" + items.Count + "] " + items[0].Name;

            var _modding = new Modding(XivCache.GameInfo.GameDirectory);
            var path     = _root.Info.GetRootFile();
            var mod      = await _modding.TryGetModEntry(path);

            if (mod == null)
            {
                ToggleButton.IsEnabled = false;
                ToggleButton.Content   = "Enable";
            }
            else
            {
                ToggleButton.IsEnabled = true;
                if (mod.enabled)
                {
                    ToggleButton.Content = "Disable";
                }
                else
                {
                    ToggleButton.Content = "Enable";
                }
            }

            return(await _vm.SetRoot(_root, defaultVariant));
        }