Esempio n. 1
0
        public static void OnGUI()
        {
#if BUILD_CRUI
            ActionButton("Demo crUI", () => ModKit.crUI.Demo());
#endif
            if (Main.IsInGame)
            {
                BeginHorizontal();
                Space(25);
                Label("increment".cyan(), AutoWidth());
                var increment = IntTextField(ref settings.increment, null, Width(150));
                EndHorizontal();
                var mainChar = Game.Instance.Player.MainCharacter.Value;
                var kingdom  = KingdomState.Instance;
                HStack("Resources", 1,
                       () => {
                    var money = Game.Instance.Player.Money;
                    Label("Gold".cyan(), Width(150));
                    Label(money.ToString().orange().bold(), Width(200));
                    ActionButton($"Gain {increment}", () => Game.Instance.Player.GainMoney(increment), AutoWidth());
                    ActionButton($"Lose {increment}", () => {
                        var loss = Math.Min(money, increment);
                        Game.Instance.Player.GainMoney(-loss);
                    }, AutoWidth());
                },
                       () => {
                    var exp = mainChar.Progression.Experience;
                    Label("Experience".cyan(), Width(150));
                    Label(exp.ToString().orange().bold(), Width(200));
                    ActionButton($"Gain {increment}", () => {
                        Game.Instance.Player.GainPartyExperience(increment);
                    }, AutoWidth());
                },
                       () => {
                    var corruption = Game.Instance.Player.Corruption;
                    Label("Corruption".cyan(), Width(150));
                    Label(corruption.CurrentValue.ToString().orange().bold(), Width(200));
                    ActionButton($"Clear", () => corruption.Clear(), AutoWidth());
                    25.space();
                    Toggle("Disable Corruption", ref settings.toggleDisableCorruption);
                },
                       () => { }
                       );
            }
            Div(0, 25);
            HStack("Combat", 2,
                   () => BindableActionButton(RestAll),
                   () => BindableActionButton(RestSelected),
                   () => BindableActionButton(FullBuffPlease),
                   () => BindableActionButton(Empowered),
                   () => BindableActionButton(GoddesBuffs),
                   () => BindableActionButton(RemoveBuffs),
                   () => BindableActionButton(RemoveDeathsDoor),
                   () => BindableActionButton(KillAllEnemies),
                   //() => UI.BindableActionButton(SummonZoo),
                   () => BindableActionButton(LobotomizeAllEnemies),
                   () => { }
                   );
            Div(0, 25);
            HStack("Teleport", 2,
                   () => BindableActionButton(TeleportPartyToYou),
                   () => {
                Toggle("Enable Teleport Keys", ref settings.toggleTeleportKeysEnabled);
                Space(100);
                if (settings.toggleTeleportKeysEnabled)
                {
                    using (VerticalScope()) {
                        KeyBindPicker("TeleportMain", "Main Character", 0, 200);
                        KeyBindPicker("TeleportSelected", "Selected Chars", 0, 200);
                        KeyBindPicker("TeleportParty", "Whole Party", 0, 200);
                    }
                }
                Space(25);
                Label("You can enable hot keys to teleport members of your party to your mouse cursor on Area or the Global Map".green());
            });
            Div(0, 25);
            HStack("Common", 2,
                   () => BindableActionButton(GoToGlobalMap),
                   () => BindableActionButton(ChangeParty),
                   () => BindableActionButton(RerollPerception),
                   () => {
                BindableActionButton(RerollInteractionSkillChecks);
                Space(-75);
                Label("This resets all the skill check rolls for all interactable objects in the area".green());
            },
                   () => {
                NonBindableActionButton("Set Perception to 40", () => {
                    CheatsCommon.StatPerception();
                    Actions.RunPerceptionTriggers();
                });
            },
                   () => BindableActionButton(ChangWeather),
                   () => NonBindableActionButton("Give All Items", () => CheatsUnlock.CreateAllItems("")),
                   () => NonBindableActionButton("Identify All", () => Actions.IdentifyAll()),
                   () => { }
                   );
            Div(0, 25);
            HStack("Preview", 0, () => {
                Toggle("Dialog Results", ref settings.previewDialogResults);
                Space(25);
                Toggle("Dialog Alignment", ref settings.previewAlignmentRestrictedDialog);
                Space(25);
                Toggle("Random Encounters", ref settings.previewRandomEncounters);
                Space(25);
                Toggle("Events", ref settings.previewEventResults);
                Space(25);
                Toggle("Decrees", ref settings.previewDecreeResults);
                Space(25);
                Toggle("Relic Info", ref settings.previewRelicResults);
                Space(25);
                BindableActionButton(PreviewDialogResults);
            });
            Div(0, 25);
            HStack("Dialog", 1,
                   () => {
                Toggle("♥♥ ".red() + "Love is Free".bold() + " ♥♥".red(), ref settings.toggleAllowAnyGenderRomance, 300.width());
                25.space();
                Label("Allow ".green() + "any gender".color(RGBA.purple) + " " + "for any ".green() + "R".color(RGBA.red) + "o".orange() + "m".yellow() + "a".green() + "n".cyan() + "c".color(RGBA.rare) + "e".color(RGBA.purple));
            },
                   () => {
                Toggle("Jealousy Begone!".bold(), ref settings.toggleMultipleRomance, 300.width());
                25.space();
                Label("Allow ".green() + "multiple".color(RGBA.purple) + " romances at the same time".green());
            },
                   () => {
                Toggle("Friendship is Magic".bold(), ref settings.toggleFriendshipIsMagic, 300.width());
                25.space();
                Label("Experimental ".orange() + " your friends forgive even your most vile choices.".green());
            },
                   () => Toggle("Make Previously Chosen Answers More Clear", ref settings.toggleMakePreviousAnswersMoreClear),
                   () => {
                Toggle("Expand Dialog To Include Remote Companions".bold(), ref settings.toggleRemoteCompanionDialog);
                100.space();
                Label("Experimental".orange() + " Allow remote companions to make comments on dialog you are having.".green());
            },
                   () => {
                if (settings.toggleRemoteCompanionDialog)
                {
                    50.space();
                    Toggle("Include Former Companions", ref settings.toggleExCompanionDialog);
                    25.space();
                }
            },
                   () => {
                using (VerticalScope()) {
                    Toggle("Expand Answers For Conditional Responses", ref settings.toggleShowAnswersForEachConditionalResponse);
                    if (settings.toggleShowAnswersForEachConditionalResponse)
                    {
                        using (HorizontalScope()) {
                            50.space();
                            Toggle("Show Unavailable Responses", ref settings.toggleShowAllAnswersForEachConditionalResponse);
                        }
                    }
                }
                50.space();
                Label("Some responses such as comments about your mythic powers will always choose the first one by default. This will show a copy of the answer and the condition for each possible response that an NPC might make to you based on".green());
            },
#if DEBUG
                   () => {
                Toggle("Randomize NPC Responses To Dialog Choices", ref settings.toggleRandomizeCueSelections);
                50.space();
                Label("Some responses such as comments about your mythic powers will always choose the first one by default. This allows the game to mix things up a bit".green() + "\nWarning:".yellow().bold() + " this will introduce randomness to NPC responses to you in general and may lead to surprising or even wild outcomes".orange());
            },
#endif
                   () => Toggle("Disable Dialog Restrictions (Alignment)", ref settings.toggleDialogRestrictions),
                   () => Toggle("Disable Dialog Restrictions (Mythic Path)", ref settings.toggleDialogRestrictionsMythic),
                   () => Toggle("Ignore Event Solution Restrictions", ref settings.toggleIgnoreEventSolutionRestrictions),
#if DEBUG
                   () => Toggle("Disable Dialog Restrictions (Everything, Experimental)", ref settings.toggleDialogRestrictionsEverything),
#endif
                   () => { }
                   );
            Div(0, 25);
            HStack("Quality of Life", 1,
                   () => {
                Toggle("Allow Achievements While Using Mods", ref settings.toggleAllowAchievementsDuringModdedGame);
                Space(25);
                Label("This is intended for you to be able to enjoy the game while using mods that enhance your quality of life.  Please be mindful of the player community and avoid using this mod to trivialize earning prestige achievements like Sadistic Gamer. The author is in discussion with Owlcat about reducing the scope of achievement blocking to just these. Let's show them that we as players can mod and cheat responsibly.".orange());
            },
                   () => Toggle("Object Highlight Toggle Mode", ref settings.highlightObjectsToggle),
                   () => Toggle("Highlight Copyable Scrolls", ref settings.toggleHighlightCopyableScrolls),
                   () => { Toggle("Auto load Last Save on launch", ref settings.toggleAutomaticallyLoadLastSave); 25.space(); Label("Hold down shift during launch to bypass".green()); },
                   () => { Toggle($"Game Over Fix For {"LEEEROOOOOOOYYY JEEEENKINS!!!".color(RGBA.maroon)} omg he just ran in!", ref settings.toggleGameOverFixLeeerrroooooyJenkins); 25.space(); Label("Prevents dumb companions (that's you Greybor) from wiping the party by running running into the dragon room and dying...".green()); },
                   () => Toggle("Make Spell/Ability/Item Pop-Ups Wider ", ref settings.toggleWidenActionBarGroups),
                   () => {
                if (Toggle("Show Acronyms in Spell/Ability/Item Pop-Ups", ref settings.toggleShowAcronymsInSpellAndActionSlots))
                {
                    Main.SetNeedsResetGameUI();
                }
            },
                   () => {
                Toggle("Icky Stuff Begone!!!", ref settings.toggleReplaceModelMenu, AutoWidth());
                if (settings.toggleReplaceModelMenu)
                {
                    Space(25);
                    using (VerticalScope(Width(250))) {
                        Toggle("Spiders Begone!", ref settings.toggleSpiderBegone);
                        Toggle("Vescavors Begone!", ref settings.toggleVescavorsBegone);
                        Toggle("Retrievers Begone!", ref settings.toggleRetrieversBegone);
                        Toggle("Deraknis Begone!", ref settings.toggleDeraknisBegone);
                        Toggle("Deskari Begone!", ref settings.toggleDeskariBegone);
                    }
                }
                Space(25);
                Label("Some players find spiders and other swarms icky. This replaces them with something more pleasent".green());
            },
                   () => Toggle("Make tutorials not appear if disabled in settings", ref settings.toggleForceTutorialsToHonorSettings),
                   () => Toggle("Refill consumables in belt slots if in inventory", ref settings.togglAutoEquipConsumables),
                   () => {
                var modifier     = KeyBindings.GetBinding("InventoryUseModifier");
                var modifierText = modifier.Key == KeyCode.None ? "Modifer" : modifier.ToString();
                Toggle("Allow " + $"{modifierText} + Click".cyan() + " To Use Items In Inventory", ref settings.toggleShiftClickToUseInventorySlot);
                if (settings.toggleShiftClickToUseInventorySlot)
                {
                    Space(25);
                    ModifierPicker("InventoryUseModifier", "", 0);
                }
            },
                   () => {
                var modifier     = KeyBindings.GetBinding("ClickToTransferModifier");
                var modifierText = modifier.Key == KeyCode.None ? "Modifer" : modifier.ToString();
                Toggle("Allow " + $"{modifierText} + Click".cyan() + " To Transfer Entire Stack", ref settings.toggleShiftClickToFastTransfer);
                if (settings.toggleShiftClickToFastTransfer)
                {
                    Space(25);
                    ModifierPicker("ClickToTransferModifier", "", 0);
                }
            },
                   () => Toggle("Respec Refund Scrolls", ref settings.toggleRespecRefundScrolls),
                   () => {
                ActionButton("Clear Action Bar", () => Actions.ClearActionBar());
                50.space();
                Label("Make sure you have auto-fill turned off in settings or else this will just reset to default".green());
            },
                   () => ActionButton("Fix Incorrect Main Character", () => {
                var probablyPlayer = Game.Instance.Player?.Party?
                                     .Where(x => !x.IsCustomCompanion())
                                     .Where(x => !x.IsStoryCompanion()).ToList();
                if (probablyPlayer is { Count: 1 })
                {
                    var newMainCharacter = probablyPlayer.First();
                    Mod.Warn($"Promoting {newMainCharacter.CharacterName} to main character!");
                    if (Game.Instance != null)
                    {
                        Game.Instance.Player.MainCharacter = newMainCharacter;
                    }
                }
            }, AutoWidth()),
Esempio n. 2
0
        public static KeyBind EditKeyBind(string identifier, bool showHint = true, bool allowModifierOnly = false, params GUILayoutOption[] options)
        {
            if (Event.current.type == EventType.Layout)
            {
                KeyBindings.OnGUI();
            }
            var keyBind        = KeyBindings.GetBinding(identifier);
            var isEditing      = identifier == selectedIdentifier;
            var isEditingOther = selectedIdentifier != null && identifier != selectedIdentifier && oldValue != null;
            var label          = keyBind.IsEmpty ? (isEditing ? "Cancel" : "Bind") : keyBind.ToString().orange().bold();

            showHint = showHint && isEditing;
            var conflicts = keyBind.Conflicts();

            using (VerticalScope(options)) {
                Space(3.point());
                if (GL.Button(label, hotkeyStyle, AutoWidth()))
                {
                    if (isEditing || isEditingOther)
                    {
                        KeyBindings.SetBinding(selectedIdentifier, oldValue);
                        if (isEditing)
                        {
                            selectedIdentifier = null;
                            oldValue           = null;
                            return(KeyBindings.GetBinding(identifier));
                        }
                    }
                    selectedIdentifier = identifier;
                    oldValue           = keyBind;
                    keyBind            = new KeyBind(identifier);
                    KeyBindings.SetBinding(identifier, keyBind);
                }
                if (conflicts.Count() > 0)
                {
                    Label("conflicts".orange().bold() + "\n" + string.Join("\n", conflicts));
                }
                if (showHint)
                {
                    var hint = "";
                    if (keyBind.IsEmpty)
                    {
                        hint = oldValue == null ? "set key binding".green() : "press key".green();
                    }
                    Label(hint);
                }
            }
            if (isEditing && keyBind.IsEmpty && Event.current != null)
            {
                var isCtrlDown  = Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl);
                var isAltDown   = Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt);
                var isCmdDown   = Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt);
                var isShiftDown = Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift);
                var keyCode     = Event.current.keyCode;
                //Logger.Log($"    {keyCode.ToString()} ctrl:{isCtrlDown} alt:{isAltDown} cmd: {isCmdDown} shift: {isShiftDown}");
                if (keyCode == KeyCode.Escape || keyCode == KeyCode.Backspace)
                {
                    selectedIdentifier = null;
                    oldValue           = null;
                    //Logger.Log("   unbound");
                    return(KeyBindings.GetBinding(identifier));
                }
                if (Event.current.isKey && !keyCode.IsModifier())
                {
                    keyBind = new KeyBind(identifier, keyCode, isCtrlDown, isAltDown, isCmdDown, isShiftDown);
                    Mod.Trace($"    currentEvent isKey - bind: {keyBind}");
                    KeyBindings.SetBinding(identifier, keyBind);
                    selectedIdentifier = null;
                    oldValue           = null;
                    Input.ResetInputAxes();
                    return(keyBind);
                }

                // Allow raw modifier keys as keybinds
                if (Event.current.isKey && keyCode.IsModifier() && allowModifierOnly)
                {
                    keyBind = new KeyBind(identifier, keyCode, false, false, false, false);
                    Mod.Trace($"    currentEvent isKey - bind: {keyBind}");
                    KeyBindings.SetBinding(identifier, keyBind);
                    selectedIdentifier = null;
                    oldValue           = null;
                    Input.ResetInputAxes();
                    return(keyBind);
                }

                foreach (var mouseButton in allowedMouseButtons)
                {
                    if (Input.GetKey(mouseButton))
                    {
                        keyBind = new KeyBind(identifier, mouseButton, isCtrlDown, isAltDown, isCmdDown, isShiftDown);
                        KeyBindings.SetBinding(identifier, keyBind);
                        selectedIdentifier = null;
                        oldValue           = null;
                        Input.ResetInputAxes();
                        return(keyBind);
                    }
                }
            }
            return(keyBind);
        }