예제 #1
0
        void Awake()
        {
            _configChangeModeKey      = Config.Bind("Input", "LootKey", new KeyboardShortcut(KeyCode.L), "The key used to cycle between loot modes");
            _configLootmode           = Config.Bind("Options", "DefaultLootMode", LootOption.BlockTrash, "The default loot mode when the game starts.");
            _configBlockTrophiesTrash = Config.Bind("Options", "BlockTrophies", true, "Whether to block all trophies when in BlockTrash mode, in addition to the blocklist. You can also disable this and manually add trophy types to the trash list if you don't want to block all trophies.");
            _configTrashList          = Config.Bind("Options", "TrashList", String.Join(",", trash), "The default list of trash items used when in the BlockTrash mode, separated by commas and containing no spaces. You can view a list of everything here https://valheim.fandom.com/wiki/Localization but you MUST add a $ in front of each word");

            lootmode      = _configLootmode.Value;
            trash         = _configTrashList.Value.Split(',');
            blockTrophies = _configBlockTrophiesTrash.Value;

            Harmony.CreateAndPatchAll(typeof(AutopickupFilterValheimClientMod));
        }
예제 #2
0
        void Update()
        {
            if (IsDown(_configChangeModeKey.Value) && Player.m_localPlayer != null && !Console.IsVisible() && !TextInput.IsVisible() && !Minimap.InTextInput() && !Menu.IsVisible())
            {
                switch (lootmode)
                {
                case LootOption.BlockNone:
                    lootmode = LootOption.BlockTrash;
                    break;

                case LootOption.BlockTrash:
                    lootmode = LootOption.BlockAll;
                    break;

                case LootOption.BlockAll:
                    lootmode = LootOption.BlockNone;
                    break;

                default:
                    break;
                }

                foreach (var item in GameObject.FindObjectsOfType <ItemDrop>())
                {
                    switch (lootmode)
                    {
                    case LootOption.BlockNone:
                        item.m_autoPickup = true;
                        break;

                    case LootOption.BlockTrash:
                        item.m_autoPickup = !isTrash(name);
                        break;

                    case LootOption.BlockAll:
                        item.m_autoPickup = false;
                        break;

                    default:
                        break;
                    }
                }

                Player.m_localPlayer.Message(MessageHud.MessageType.TopLeft, "Autoloot filter set to " + lootmode);
            }
        }