Beispiel #1
0
        public override bool CreateConfigurationMenu(ExtensionParameter extensionParameter, ref Dictionary <String, Object> Parameters)
        {
            ImGui.TextDisabled("Condition Info");
            ImGuiExtension.ToolTipWithText("(?)", "This condition will return true if any of the selected player's resistances\nare reduced by more than or equal to the specified amount.\nReduced max resistance modifiers are taken into effect automatically (e.g. -res map mods).");


            base.CreateConfigurationMenu(extensionParameter, ref Parameters);

            CheckCold = ImGuiExtension.Checkbox("Cold", CheckCold);
            Parameters[CheckColdString] = CheckCold.ToString();

            CheckFire = ImGuiExtension.Checkbox("Fire", CheckFire);
            Parameters[CheckFireString] = CheckFire.ToString();

            CheckLightning = ImGuiExtension.Checkbox("Lightning", CheckLightning);
            Parameters[CheckLightningString] = CheckLightning.ToString();

            CheckChaos = ImGuiExtension.Checkbox("Chaos", CheckChaos);
            Parameters[CheckChaosString] = CheckChaos.ToString();

            ResistanceThreshold = ImGuiExtension.IntSlider("Resistance Threshold", ResistanceThreshold, 0, 125);
            Parameters[ResistanceThresholdString] = ResistanceThreshold.ToString();

            return(true);
        }
Beispiel #2
0
        public override bool CreateConfigurationMenu(ExtensionParameter extensionParameter, ref Dictionary <String, Object> Parameters)
        {
            ImGui.TextDisabled("Condition Info");
            ImGuiExtension.ToolTipWithText("(?)", "This condition will return true if the player's energy shield percentage is above/below the specified amount.");

            base.CreateConfigurationMenu(extensionParameter, ref Parameters);

            int radioTarget = IsAbove ? 0 : 1;

            if (ImGui.RadioButton("Above Percentage", ref radioTarget, 0))
            {
                IsAbove = true;
            }
            if (ImGui.RadioButton("Below Percentage", ref radioTarget, 1))
            {
                IsAbove = false;
            }

            Parameters[IsAboveString] = IsAbove.ToString();

            Percentage = ImGuiExtension.IntSlider("Energy Shield Percentage", Percentage, 1, 100);
            Parameters[PercentageString] = Percentage.ToString();

            return(true);
        }
        public override bool CreateConfigurationMenu(ExtensionParameter extensionParameter, ref Dictionary <String, Object> Parameters)
        {
            ImGui.TextDisabled("Condition Info");
            ImGuiExtension.ToolTipWithText("(?)", "This condition is used to determine if we can use a specific flask.\nIt will ensure that health/hybrid/mana potions are not used when we are at full health/mana.\nThis will also ensure that we do not use up reserved uses.");

            base.CreateConfigurationMenu(extensionParameter, ref Parameters);

            TimerName = ImGuiExtension.InputText("Timer Name", TimerName, 30, ImGuiInputTextFlags.AlwaysInsertMode);
            ImGuiExtension.ToolTipWithText("(?)", "Name for this timer. Make sure this is unique.");
            Parameters[TimerNameString] = TimerName.ToString();

            var tempTimerLength = ImGuiExtension.InputText("Time Elapsed (ms)", TimeElapsed.ToString(), 30, ImGuiInputTextFlags.AlwaysInsertMode);

            if (Int32.TryParse(tempTimerLength, out int convertedTimerLength))
            {
                TimeElapsed = convertedTimerLength;
            }
            ImGuiExtension.ToolTipWithText("(?)", "True if timer has run longer than specified time\n1000 ms = 1 sec");
            Parameters[TimeElapsedString] = TimeElapsed.ToString();

            TrueIfStopped = ImGuiExtension.Checkbox("True if stopped", TrueIfStopped);
            ImGuiExtension.ToolTipWithText("(?)", "When enabled, returns true if timer is stopped (or never started)");
            Parameters[TrueIfStoppedString] = TrueIfStopped.ToString();

            return(true);
        }
Beispiel #4
0
        public override bool CreateConfigurationMenu(ExtensionParameter extensionParameter, ref Dictionary <String, Object> Parameters)
        {
            ImGui.TextDisabled("Condition Info");
            ImGuiExtension.ToolTipWithText("(?)", "This condition will return true if the player has any of the selected ailments or a minimum of the specified corrupted blood stacks.");

            base.CreateConfigurationMenu(extensionParameter, ref Parameters);

            RemFrozen = ImGuiExtension.Checkbox("Frozen", RemFrozen);
            Parameters[RemFrozenString] = RemFrozen.ToString();

            RemBurning = ImGuiExtension.Checkbox("Burning", RemBurning);
            Parameters[RemBurningString] = RemBurning.ToString();

            RemShocked = ImGuiExtension.Checkbox("Shocked", RemShocked);
            Parameters[RemShockedString] = RemShocked.ToString();

            RemCurse = ImGuiExtension.Checkbox("Curse", RemCurse);
            Parameters[RemCurseString] = RemCurse.ToString();

            RemPoison = ImGuiExtension.Checkbox("Poison", RemPoison);
            Parameters[RemPoisonString] = RemPoison.ToString();

            RemBleed = ImGuiExtension.Checkbox("Bleed", RemBleed);
            Parameters[RemBleedString] = RemBleed.ToString();

            CorruptCount = ImGuiExtension.IntSlider("Corruption Count", CorruptCount, 0, 20);
            Parameters[CorruptCountString] = CorruptCount.ToString();

            IgnoreInfiniteTimer = ImGuiExtension.Checkbox("Ignore Infinite Timer", IgnoreInfiniteTimer);
            Parameters[IgnoreInfiniteTimerString] = IgnoreInfiniteTimer.ToString();
            return(true);
        }
Beispiel #5
0
        public override bool CreateConfigurationMenu(ExtensionParameter extensionParameter, ref Dictionary <String, Object> Parameters)
        {
            ImGui.TextDisabled("Vaal Skills");

            ImGui.Spacing();
            ImGui.Separator();
            ImGui.Spacing();

            useVaalHaste = ImGuiExtension.Checkbox("Vaal Haste", useVaalHaste);
            Parameters[useHasteString] = useVaalHaste.ToString();
            ImGui.SameLine();

            useVaalGrace = ImGuiExtension.Checkbox("Vaal Grace", useVaalGrace);
            Parameters[useDodgeString] = useVaalGrace.ToString();
            ImGui.SameLine();

            useVaalClarity = ImGuiExtension.Checkbox("Vaal Clarity", useVaalClarity);
            Parameters[useNoManaString] = useVaalClarity.ToString();
            ImGui.SameLine();

            useVaalReave = ImGuiExtension.Checkbox("Vaal Reave", useVaalReave);
            Parameters[useAoeExtenderString] = useVaalReave.ToString();
            ImGui.SameLine();


            ImGui.Spacing();
            ImGui.Separator();
            ImGui.Spacing();
            ImGuiExtension.ToolTipWithText("(?)", "This action is used to configure Vaal Skills");
            Key = (int)ImGuiExtension.HotkeySelector("Hotkey", (Keys)Key);
            ImGuiExtension.ToolTipWithText("(?)", "Hotkey to press for the first Vaal Skill.");
            Parameters[keyString] = Key.ToString();
            return(true);
        }
Beispiel #6
0
        public override bool CreateConfigurationMenu(ExtensionParameter extensionParameter, ref Dictionary <string, object> Parameters)
        {
            Invert = ImGuiExtension.Checkbox("Invert", Invert);
            ImGuiExtension.ToolTipWithText("(?)", "Check this box to invert the returned value of this condition.\nFor Example when enabled, if the condition returns true when in hideout, it would now return true when NOT in hideout.");
            Parameters[InvertString] = Invert.ToString();

            return(true);
        }
 public override bool CreateConfigurationMenu(ExtensionParameter extensionParameter, ref Dictionary <String, Object> Parameters)
 {
     ImGui.TextDisabled("Action Info");
     ImGuiExtension.ToolTipWithText("(?)", "This action is used to send a hotkey to the game.");
     Key = (int)ImGuiExtension.HotkeySelector("Hotkey", (Keys)Key);
     ImGuiExtension.ToolTipWithText("(?)", "Hotkey to press for this action.");
     Parameters[keyString] = Key.ToString();
     return(true);
 }
        public override bool CreateConfigurationMenu(ExtensionParameter extensionParameter, ref Dictionary <String, Object> Parameters)
        {
            ImGui.TextDisabled("Action Info");
            ImGuiExtension.ToolTipWithText("(?)", "This action is used to use a specific flask.\nFlask Hotkey will be pulled from plugin settings.");

            FlaskIndex = ImGuiExtension.IntSlider("Flask Index", FlaskIndex, 1, 5);
            ImGuiExtension.ToolTipWithText("(?)", "Index for flask to be used (1= farthest left, 5 = farthest right)");
            Parameters[flaskIndexString] = FlaskIndex.ToString();
            return(true);
        }
Beispiel #9
0
        public override bool CreateConfigurationMenu(ExtensionParameter extensionParameter, ref Dictionary <String, Object> Parameters)
        {
            ImGui.TextDisabled("Condition Info");
            ImGuiExtension.ToolTipWithText("(?)", "This condition is used to determine if we have the flask buff up already.");

            base.CreateConfigurationMenu(extensionParameter, ref Parameters);

            FlaskIndex = ImGuiExtension.IntSlider("Flask Index", FlaskIndex, 1, 5);
            Parameters[flaskIndexString] = FlaskIndex.ToString();
            return(true);
        }
Beispiel #10
0
        public override bool CreateConfigurationMenu(ExtensionParameter extensionParameter, ref Dictionary <String, Object> Parameters)
        {
            ImGui.TextDisabled("Condition Info");
            ImGuiExtension.ToolTipWithText("(?)", "This condition is used to determine if we can use a specific skill.\nSkill name can be obtained through DevTree by looking through the player's actor component, then actor skills list.");

            base.CreateConfigurationMenu(extensionParameter, ref Parameters);

            SkillName = ImGuiExtension.InputText("Skill Name", SkillName, 100, ImGuiInputTextFlags.AllowTabInput);
            Parameters[skillNameString] = SkillName.ToString();

            return(true);
        }
Beispiel #11
0
        public override bool CreateConfigurationMenu(ExtensionParameter extensionParameter, ref Dictionary <String, Object> Parameters)
        {
            ImGui.TextDisabled("Condition Info");
            ImGuiExtension.ToolTipWithText("(?)", "This condition will return true if the player has been moving longer than the specified time.");

            base.CreateConfigurationMenu(extensionParameter, ref Parameters);

            MsMoving = ImGuiExtension.IntSlider("Time spent moving (ms)", (int)MsMoving, 0, 10000);
            ImGuiExtension.ToolTipWithText("(?)", "Player must remain moving for this configured number of milliseconds (1000ms = 1 sec) before this condition returns true");
            Parameters[msMovingString] = MsMoving.ToString();
            return(true);
        }
        public override bool CreateConfigurationMenu(ExtensionParameter extensionParameter, ref Dictionary <String, Object> Parameters)
        {
            ImGui.TextDisabled("Condition Info");
            ImGuiExtension.ToolTipWithText("(?)", "This condition is used to determine if we can use a specific flask.\nIt will ensure that health/hybrid/mana potions are not used when we are at full health/mana.\nThis will also ensure that we do not use up reserved uses.");

            base.CreateConfigurationMenu(extensionParameter, ref Parameters);

            FlaskIndex = ImGuiExtension.IntSlider("Flask Index", FlaskIndex, 1, 5);
            Parameters[flaskIndexString] = FlaskIndex.ToString();
            ReservedUses = ImGuiExtension.IntSlider("Reserved Uses", ReservedUses, 0, 5);
            Parameters[reserveUsesString] = ReservedUses.ToString();
            return(true);
        }
        public override bool CreateConfigurationMenu(ExtensionParameter extensionParameter, ref Dictionary<String, Object> Parameters)
        {



            ImGui.TextDisabled("Condition Info");
            ImGuiExtension.ToolTipWithText("(?)", "Hotkey to check for pressed down state");

            base.CreateConfigurationMenu(extensionParameter, ref Parameters);

            Key = (int)ImGuiExtension.HotkeySelector("Hotkey", (Keys)Key);
            ImGuiExtension.ToolTipWithText("(?)", "Hotkey to press for this action.");
            Parameters[keyString] = Key.ToString();

            return true;
        }
Beispiel #14
0
        public override bool CreateConfigurationMenu(ExtensionParameter extensionParameter, ref Dictionary <String, Object> Parameters)
        {
            ImGui.TextDisabled("Action Info");
            ImGuiExtension.ToolTipWithText("(?)", "This timer is used to begin or end a specific timer");
            TimerName = ImGuiExtension.InputText("Timer Name", TimerName, 30, ImGuiInputTextFlags.AlwaysInsertMode);
            ImGuiExtension.ToolTipWithText("(?)", "Name for this timer");
            Parameters[TimerNameString] = TimerName.ToString();

            var selectedOption = ForceStop ? 1 : 0;

            ImGui.RadioButton("Start Timer", ref selectedOption, 0);
            ImGui.RadioButton("End Timer", ref selectedOption, 1);
            ForceStop = selectedOption == 1;
            Parameters[ForceStopString] = ForceStop.ToString();

            return(true);
        }
Beispiel #15
0
        public override bool CreateConfigurationMenu(ExtensionParameter extensionParameter, ref Dictionary <String, Object> Parameters)
        {
            ImGui.TextDisabled("Condition Info");
            ImGuiExtension.ToolTipWithText("(?)", "This condition will return true if the player has any of the selected ailments or a minimum of the specified corrupted blood stacks.");

            base.CreateConfigurationMenu(extensionParameter, ref Parameters);
            var buffList       = GetEnumList <BuffEnums>().ToList();
            var buffListSearch = buffList.Where(x => x.Contains(SearchString)).ToList();

            HasBuffReady = ImGuiExtension.ComboBox("Buff List", HasBuffReady, buffListSearch);
            Parameters[SearchingBuff] = HasBuffReady.ToString();

            SearchString = ImGuiExtension.InputText("Filter Buffs", SearchString, 32, ImGuiInputTextFlags.AllowTabInput);
            Parameters[SearchStringString] = SearchString.ToString();

            RemainingDuration = ImGuiExtension.IntSlider("Remaining Duration", RemainingDuration, 0, 4000);
            ImGuiExtension.ToolTipWithText("(?)", "Includes buffs with duration longer than specified. Set to 0 to ignore duration.");
            Parameters[RemainingDurationString] = RemainingDuration.ToString();

            MinimumCharges = ImGuiExtension.IntSlider("Minimum Charges", MinimumCharges, 0, 20);
            ImGuiExtension.ToolTipWithText("(?)", "Includes buffs with charges greater or equal to specified value. Set to 0 to ignore charges.");
            Parameters[MinimumChargesString] = MinimumCharges.ToString();
            return(true);
        }
Beispiel #16
0
        public bool Render()
        {
            TriggerComposite.Name = ImGuiExtension.InputText("Trigger Name", TriggerComposite.Name, 50, ImGuiInputTextFlags.AlwaysInsertMode);

            bool shouldPerformClear = false;
            int  radioTarget        = (int)TriggerComposite.Type;

            shouldPerformClear |= ImGui.RadioButton("PrioritySelector", ref radioTarget, (int)TriggerType.PrioritySelector);
            ImGuiExtension.ToolTipWithText("(?)", "A PrioritySelector runs a list of composites in order from first to last until one of the composites returns true.");

            ImGui.SameLine();
            shouldPerformClear |= ImGui.RadioButton("Sequence", ref radioTarget, (int)TriggerType.Sequence);
            ImGuiExtension.ToolTipWithText("(?)", "A Sequence runs a list of composites in order from first to last until one of the composites returns false.");

            shouldPerformClear |= ImGui.RadioButton("Decorator", ref radioTarget, (int)TriggerType.Decorator);
            ImGuiExtension.ToolTipWithText("(?)", "A Decorator will run its child if all conditions return true.\nThink of this as an if condition.");

            ImGui.SameLine();
            var choseAction = ImGui.RadioButton("Action", ref radioTarget, (int)TriggerType.Action);

            ImGuiExtension.ToolTipWithText("(?)", "An action is a final point in a behavior tree.\nActions can return true or false.\nAll branches MUST end in an action.");

            if (choseAction && TriggerComposite.Children != null && TriggerComposite.Children.Any() || // If we chose action, make sure we don't have any children
                (TriggerType)radioTarget == TriggerType.Decorator && TriggerComposite.Children != null && TriggerComposite.Children.Count > 1)    // if we chose decorator, make sure we don't have more than 1 child
            {
                OpenOKMenu = true;
                OKMessage  = "Trigger has too many children to change to this type.\nRemove unnecessary children and try again.";

                // Reset everything so the below logic can remain the same
                shouldPerformClear = false;
                choseAction        = false;
                radioTarget        = (int)TriggerComposite.Type;
            }

            if (shouldPerformClear || choseAction)
            {
                ActiveWorkingTriggerCondition = null;
                TriggerComposite.Action       = null;
                SelectedOption1 = -1;
                SelectedOption2 = -1;
            }

            // Save off the selected type into the composite
            TriggerComposite.Type = (TriggerType)radioTarget;

            // There is no configuration unless we are an action or decorator
            if (TriggerComposite.Type == TriggerType.Action || TriggerComposite.Type == TriggerType.Decorator)
            {
                if (ImGui.TreeNodeEx("Configuration", ImGuiTreeNodeFlags.Leaf))
                {
                    if (TriggerComposite.Type == TriggerType.Action)
                    {
                        // TODO: HashSet is not guaranteed ordered. This should be fixed later
                        var filterList = ExtensionParameter.Plugin.ExtensionCache.ActionFilterList.ToList();
                        FilterOption = ImGuiExtension.ComboBox("Filter Type", FilterOption, filterList);

                        var actionList = ExtensionParameter.Plugin.ExtensionCache.ActionList;
                        if (filterList[FilterOption] != ExtensionComponentFilterType.None)
                        {
                            actionList = actionList.Where(x => x.GetFilterTypes().Contains(filterList[FilterOption])).ToList();
                        }

                        int previouslySelectedAction = SelectedOption1;
                        SelectedOption1 = ImGuiExtension.ComboBox("Action List", SelectedOption1, actionList.Select(x => x.Owner + ": " + x.Name).ToList());
                        if (SelectedOption1 >= 0)
                        {
                            // If we do not have an extension action cached OR we swapped actions... initialize values
                            if (ActiveWorkingExtensionAction == null || previouslySelectedAction != SelectedOption1)
                            {
                                var action = actionList[SelectedOption1];
                                if (TriggerComposite.Action == null)
                                {
                                    TriggerComposite.Action = new TriggerAction(action.Owner, action.Name);
                                }

                                ActiveWorkingExtensionAction = action.GetAction();
                            }

                            // Render the menu and ensure the parameters get saved to the action
                            ActiveWorkingExtensionAction.CreateConfigurationMenu(ExtensionParameter, ref TriggerComposite.Action.Parameters);
                        }
                    }
                    else if (TriggerComposite.Type == TriggerType.Decorator)
                    {
                        TriggerComposite.AlwaysContinue = ImGuiExtension.Checkbox("Always Continue", TriggerComposite.AlwaysContinue);
                        ImGuiExtension.ToolTipWithText("(?)", "When enabled, the decorator will not end a sequence, even if its child fails.");

                        SelectedOption1 = ImGuiExtension.ComboBox("Conditions", SelectedOption1, TriggerComposite.ConditionList.Select(x => x.Owner + ": " + x.Name).ToList());
                        if (ImGui.Button("AddCondition"))
                        {
                            //if (ActiveWorkingTriggerCondition == null)
                            //{
                            ActiveWorkingTriggerCondition = new TriggerCondition();
                            //}

                            ImGui.OpenPopup("Add Condition");
                        }

                        var selectedCondition = TriggerComposite.ConditionList.ElementAtOrDefault(SelectedOption1);
                        if (selectedCondition != null)
                        {
                            ImGui.SameLine();

                            if (ImGui.Button("Edit"))
                            {
                                //if (ActiveWorkingTriggerCondition == null)
                                //{
                                ActiveWorkingTriggerCondition = new TriggerCondition(selectedCondition);
                                EditedTriggerCondition        = selectedCondition;
                                //}

                                ImGui.OpenPopup("Add Condition");
                            }

                            ImGui.SameLine();

                            if (ImGui.Button("Remove"))
                            {
                                TriggerComposite.ConditionList.Remove(TriggerComposite.ConditionList[SelectedOption1]);
                            }
                        }

                        RenderAddConditionMenu();
                    }
                    ImGui.TreePop();
                }
            }

            if (ImGui.Button("Save Trigger"))
            {
                // Validation
                if (TriggerComposite.Name == null || TriggerComposite.Name.Length == 0)
                {
                    OpenOKMenu = true;
                    OKMessage  = "Must give a trigger name.";
                }
                else
                {
                    if (EditedTrigger != null)
                    {
                        // We are editing. Copy everything from the new trigger to the old instance
                        EditedTrigger.Name          = TriggerComposite.Name;
                        EditedTrigger.Type          = TriggerComposite.Type;
                        EditedTrigger.Children      = TriggerComposite.Children;
                        EditedTrigger.ConditionList = TriggerComposite.ConditionList;
                        EditedTrigger.Action        = TriggerComposite.Action;
                        // Finally, clear out our TriggerCompsite. Otherwise, the caller will think we are adding a new trigger
                        TriggerComposite = null;
                    }
                    return(false);
                }
            }


            ImGui.SameLine();

            if (ImGui.Button("Cancel trigger"))
            {
                TriggerComposite = null;
                return(false);
            }

            if (OpenOKMenu)
            {
                ImGui.OpenPopup("OK Menu");
                OpenOKMenu = false;
            }

            bool testOpen = true;

            if (ImGui.BeginPopupModal("OK Menu", ref testOpen, ImGuiWindowFlags.AlwaysAutoResize))
            {
                ImGui.TextDisabled(OKMessage);
                if (ImGui.SmallButton("OK"))
                {
                    ImGui.CloseCurrentPopup();
                }
                ImGui.EndPopup();
            }

            return(true);
        }
        public override bool CreateConfigurationMenu(ExtensionParameter extensionParameter, ref Dictionary <String, Object> Parameters)
        {
            ImGui.TextDisabled("Condition Info");
            ImGuiExtension.ToolTipWithText("(?)", "This condition will return true if any of the selected player's resistances\nare reduced by more than or equal to the specified amount.\nReduced max resistance modifiers are taken into effect automatically (e.g. -res map mods).");


            base.CreateConfigurationMenu(extensionParameter, ref Parameters);

            MinimumMonsterCount = ImGuiExtension.IntSlider("Minimum Monster Count", MinimumMonsterCount, 1, 50);
            Parameters[MinimumMonsterCountString] = MinimumMonsterCount.ToString();

            MaxDistance = ImGuiExtension.FloatSlider("Maximum Distance", MaxDistance, 1.0f, 5000.0f);
            Parameters[MaxDistanceString] = MaxDistance.ToString();

            PreviewDistance = ImGuiExtension.Checkbox("Preview distance", PreviewDistance);

            if (PreviewDistance)
            {
                //extensionParameter.Plugin.PlayerHelper.DrawSquareToWorld(extensionParameter.Plugin.GameController.Player.Pos, MaxDistance);
            }

            ImGui.Spacing();
            ImGui.Separator();
            ImGui.Spacing();

            ColdResistanceThreshold = ImGuiExtension.IntSlider("Cold Resist Above", ColdResistanceThreshold, 0, 75);
            Parameters[ColdResistanceThresholdString] = ColdResistanceThreshold.ToString();

            FireResistanceThreshold = ImGuiExtension.IntSlider("Fire Resist Above", FireResistanceThreshold, 0, 75);
            Parameters[FireResistanceThresholdString] = FireResistanceThreshold.ToString();

            LightningResistanceThreshold = ImGuiExtension.IntSlider("Lightning Resist Above", LightningResistanceThreshold, 0, 75);
            Parameters[LightningResistanceThresholdString] = LightningResistanceThreshold.ToString();

            ChaosResistanceThreshold = ImGuiExtension.IntSlider("Chaos Resist Above", ChaosResistanceThreshold, 0, 75);
            Parameters[ChaosResistanceThresholdString] = ChaosResistanceThreshold.ToString();

            ImGui.Spacing();
            ImGui.Separator();
            ImGui.Spacing();

            CountWhiteMonsters = ImGuiExtension.Checkbox("White Monsters", CountWhiteMonsters);
            Parameters[CountWhiteMonstersString] = CountWhiteMonsters.ToString();

            CountRareMonsters = ImGuiExtension.Checkbox("Rare Monsters", CountRareMonsters);
            Parameters[CountRareMonstersString] = CountRareMonsters.ToString();

            CountMagicMonsters = ImGuiExtension.Checkbox("Magic Monsters", CountMagicMonsters);
            Parameters[CountMagicMonstersString] = CountMagicMonsters.ToString();

            CountUniqueMonsters = ImGuiExtension.Checkbox("Unique Monsters", CountUniqueMonsters);
            Parameters[CountUniqueMonstersString] = CountUniqueMonsters.ToString();

            ImGui.Spacing();
            ImGui.Separator();
            ImGui.Spacing();

            MonsterHealthPercentThreshold = ImGuiExtension.IntSlider("Monster Health Percent", MonsterHealthPercentThreshold, 0, 100);
            Parameters[MonsterHealthPercentThresholdString] = MonsterHealthPercentThreshold.ToString();

            MonsterAboveHealthThreshold = ImGuiExtension.Checkbox("Above Health Threshold", MonsterAboveHealthThreshold);
            Parameters[MonsterAboveHealthThresholdString] = MonsterAboveHealthThreshold.ToString();

            return(true);
        }
        public override bool CreateConfigurationMenu(ExtensionParameter extensionParameter, ref Dictionary <String, Object> Parameters)
        {
            ImGui.TextDisabled("Action Info");
            ImGuiExtension.ToolTipWithText("(?)", "This action is used to use a specific type(s) of flask.\nFlask Hotkey will be pulled from plugin settings.\nFlask types will be pulled from the file /config/flaskinfo.json");

            useLife = ImGuiExtension.Checkbox("Life", useLife);
            Parameters[useLifeString] = useLife.ToString();

            ImGui.SameLine();
            useMana = ImGuiExtension.Checkbox("Mana", useMana);
            Parameters[useManaString] = useMana.ToString();

            ImGui.SameLine();
            useHybrid = ImGuiExtension.Checkbox("Hybrid", useHybrid);
            Parameters[useHybridString] = useHybrid.ToString();

            useInstant = ImGuiExtension.Checkbox("Use Instant", useInstant);
            ImGuiExtension.ToolTipWithText("(?)", "This only makes sense to use with life/mana/hybrid flasks");

            Parameters[useInstantString] = useInstant.ToString();

            ImGui.Spacing();
            ImGui.Separator();
            ImGui.Spacing();

            useDefense = ImGuiExtension.Checkbox("Defense", useDefense);
            Parameters[useDefenseString] = useDefense.ToString();


            ImGui.SameLine();
            useOffense = ImGuiExtension.Checkbox("Offense", useOffense);
            Parameters[useOffenseString] = useOffense.ToString();

            useUtility = ImGuiExtension.Checkbox("Utility", useUtility);
            Parameters[useUtilityString] = useUtility.ToString();

            ImGui.SameLine();
            useSpeedrun = ImGuiExtension.Checkbox("Speedrun", useSpeedrun);
            Parameters[useSpeedrunString] = useSpeedrun.ToString();

            useUnique = ImGuiExtension.Checkbox("Unique", useUnique);
            Parameters[useUniqueString] = useUnique.ToString();

            useOffenseAndSpeedrun = ImGuiExtension.Checkbox("Offense and Speedrun", useOffenseAndSpeedrun);
            Parameters[useOffenseAndSpeedrunString] = useOffenseAndSpeedrun.ToString();

            ImGui.Spacing();
            ImGui.Separator();
            ImGui.Spacing();

            usePoison = ImGuiExtension.Checkbox("Poison", usePoison);
            Parameters[usePoisonString] = usePoison.ToString();

            ImGui.SameLine();
            useFreeze = ImGuiExtension.Checkbox("Freeze", useFreeze);
            Parameters[useFreezeString] = useFreeze.ToString();

            useIgnite = ImGuiExtension.Checkbox("Ignite", useIgnite);
            Parameters[useIgniteString] = useIgnite.ToString();

            ImGui.SameLine();
            useShock = ImGuiExtension.Checkbox("Shock", useShock);
            Parameters[useShockString] = useShock.ToString();

            useBleed = ImGuiExtension.Checkbox("Bleed", useBleed);
            Parameters[useBleedString] = useBleed.ToString();

            ImGui.SameLine();
            useCurse = ImGuiExtension.Checkbox("Curse", useCurse);
            Parameters[useCurseString] = useCurse.ToString();

            ImGui.Spacing();
            ImGui.Separator();
            ImGui.Spacing();

            reserveFlaskCharges = ImGuiExtension.IntSlider("Reserved Charges", reserveFlaskCharges, 0, 5);
            Parameters[reserveFlaskChargesString] = reserveFlaskCharges.ToString();

            return(true);
        }
        public override void DrawSettings()
        {
            //base.DrawSettings();

            ImGuiTreeNodeFlags collapsingHeaderFlags = ImGuiTreeNodeFlags.CollapsingHeader;

            if (ImGui.TreeNodeEx("Plugin Options", collapsingHeaderFlags))
            {
                Settings.EnableInHideout.Value = ImGuiExtension.Checkbox("Enable in Hideout", Settings.EnableInHideout);
                ImGui.Separator();
                Settings.TicksPerSecond.Value = ImGuiExtension.IntSlider("Ticks Per Second", Settings.TicksPerSecond); ImGuiExtension.ToolTipWithText("(?)", "Determines how many times the plugin checks flasks every second.\nLower for less resources, raise for faster response (but higher chance to chug potions).");
                ImGui.Separator();
                Settings.Debug.Value = ImGuiExtension.Checkbox("Debug Mode", Settings.Debug);
                ImGui.Separator();
                Settings.BossingModeToggle.Value = ImGuiExtension.Checkbox("Disable Defensive and Offensive Flasking", Settings.BossingModeToggle);
                ImGui.Separator();
                Settings.BossingModeHotkey.Value = ImGuiExtension.HotkeySelector("BossingModeHotkey", Settings.BossingModeHotkey.Value);
                ImGui.TreePop();
            }


            if (ImGui.TreeNodeEx("Flask Options", collapsingHeaderFlags))
            {
                if (ImGui.TreeNode("Individual Flask Settings"))
                {
                    for (int i = 0; i < 5; i++)
                    {
                        FlaskSetting currentFlask = Settings.FlaskSettings[i];
                        if (ImGui.TreeNode("Flask " + (i + 1) + " Settings"))
                        {
                            currentFlask.Enabled.Value      = ImGuiExtension.Checkbox("Enable", currentFlask.Enabled);
                            currentFlask.Hotkey.Value       = ImGuiExtension.HotkeySelector("Hotkey", currentFlask.Hotkey);
                            currentFlask.ReservedUses.Value =
                                ImGuiExtension.IntSlider("Reserved Uses", currentFlask.ReservedUses);
                            ImGuiExtension.ToolTipWithText("(?)",
                                                           "The absolute number of uses reserved on a flask.\nSet to 1 to always have 1 use of the flask available for manual use.");
                            ImGui.TreePop();
                        }
                    }

                    ImGui.TreePop();
                }

                if (ImGui.TreeNode("Health and Mana"))
                {
                    Settings.AutoFlask.Value = ImGuiExtension.Checkbox("Enable", Settings.AutoFlask);

                    ImGuiExtension.SpacedTextHeader("Settings");
                    Settings.ForceBubblingAsInstantOnly.Value =
                        ImGuiExtension.Checkbox("Force Bubbling as Instant only", Settings.ForceBubblingAsInstantOnly);
                    ImGuiExtension.ToolTipWithText("(?)",
                                                   "When enabled, flasks with the Bubbling mod will only be used as an instant flask.");
                    Settings.ForcePanickedAsInstantOnly.Value =
                        ImGuiExtension.Checkbox("Force Panicked as Instant only", Settings.ForcePanickedAsInstantOnly);
                    ImGuiExtension.ToolTipWithText("(?)",
                                                   "When enabled, flasks with the Panicked mod will only be used as an instant flask. \nNote, Panicked will not be used until under 35%% with this enabled."); //
                    ImGuiExtension.SpacedTextHeader("Health Flask");
                    Settings.HPPotion.Value        = ImGuiExtension.IntSlider("Min Life % Auto HP Flask", Settings.HPPotion);
                    Settings.InstantHPPotion.Value =
                        ImGuiExtension.IntSlider("Min Life % Auto Instant HP Flask", Settings.InstantHPPotion);
                    Settings.DisableLifeSecUse.Value =
                        ImGuiExtension.Checkbox("Disable Life/Hybrid Flask Offensive/Defensive Usage",
                                                Settings.DisableLifeSecUse);

                    ImGuiExtension.SpacedTextHeader("Mana Flask");
                    ImGui.Spacing();
                    Settings.ManaPotion.Value =
                        ImGuiExtension.IntSlider("Min Mana % Auto Mana Flask", Settings.ManaPotion);
                    Settings.InstantManaPotion.Value = ImGuiExtension.IntSlider("Min Mana % Auto Instant MP Flask",
                                                                                Settings.InstantManaPotion);
                    Settings.MinManaFlask.Value =
                        ImGuiExtension.IntSlider("Min Mana Auto Mana Flask", Settings.MinManaFlask);
                    ImGui.TreePop();
                }

                if (ImGui.TreeNode("Remove Ailments"))
                {
                    Settings.RemAilment.Value = ImGuiExtension.Checkbox("Enable", Settings.RemAilment);

                    ImGuiExtension.SpacedTextHeader("Ailments");
                    Settings.RemFrozen.Value = ImGuiExtension.Checkbox("Frozen", Settings.RemFrozen);
                    ImGui.SameLine();
                    Settings.RemBurning.Value = ImGuiExtension.Checkbox("Burning", Settings.RemBurning);
                    Settings.RemShocked.Value = ImGuiExtension.Checkbox("Shocked", Settings.RemShocked);
                    ImGui.SameLine();
                    Settings.RemCurse.Value  = ImGuiExtension.Checkbox("Cursed", Settings.RemCurse);
                    Settings.RemPoison.Value = ImGuiExtension.Checkbox("Poison", Settings.RemPoison);
                    ImGui.SameLine();
                    Settings.RemBleed.Value     = ImGuiExtension.Checkbox("Bleed", Settings.RemBleed);
                    Settings.CorruptCount.Value =
                        ImGuiExtension.IntSlider("Corrupting Blood Stacks", Settings.CorruptCount);
                    ImGui.TreePop();
                }

                if (ImGui.TreeNode("Speed Flasks"))
                {
                    Settings.SpeedFlaskEnable.Value = ImGuiExtension.Checkbox("Enable", Settings.SpeedFlaskEnable);

                    ImGuiExtension.SpacedTextHeader("Flasks");
                    Settings.QuicksilverFlaskEnable.Value =
                        ImGuiExtension.Checkbox("Quicksilver Flask", Settings.QuicksilverFlaskEnable);
                    Settings.SilverFlaskEnable.Value =
                        ImGuiExtension.Checkbox("Silver Flask", Settings.SilverFlaskEnable);

                    ImGuiExtension.SpacedTextHeader("Settings");
                    Settings.MinMsPlayerMoving.Value =
                        ImGuiExtension.IntSlider("Milliseconds Spent Moving", Settings.MinMsPlayerMoving);
                    ImGuiExtension.ToolTipWithText("(?)",
                                                   "Milliseconds spent moving before flask will be used.\n1000 milliseconds = 1 second");
                    ImGui.TreePop();
                }

                if (ImGui.TreeNode("Defensive Flasks"))
                {
                    Settings.DefensiveFlaskEnable.Value =
                        ImGuiExtension.Checkbox("Enable", Settings.DefensiveFlaskEnable);
                    ImGui.Spacing();
                    ImGui.Separator();
                    Settings.HPPercentDefensive.Value =
                        ImGuiExtension.IntSlider("Min Life %", Settings.HPPercentDefensive);
                    Settings.ESPercentDefensive.Value =
                        ImGuiExtension.IntSlider("Min ES %", Settings.ESPercentDefensive);
                    Settings.OffensiveAsDefensiveEnable.Value =
                        ImGuiExtension.Checkbox("Use offensive flasks for defense",
                                                Settings.OffensiveAsDefensiveEnable);
                    ImGui.Separator();

                    Settings.DefensiveMonsterCount.Value =
                        ImGuiExtension.IntSlider("Monster Count", Settings.DefensiveMonsterCount);
                    Settings.DefensiveMonsterDistance.Value =
                        ImGuiExtension.IntSlider("Monster Distance", Settings.DefensiveMonsterDistance);
                    Settings.DefensiveCountNormalMonsters.Value =
                        ImGuiExtension.Checkbox("Normal Monsters", Settings.DefensiveCountNormalMonsters);
                    Settings.DefensiveCountRareMonsters.Value =
                        ImGuiExtension.Checkbox("Rare Monsters", Settings.DefensiveCountRareMonsters);
                    Settings.DefensiveCountMagicMonsters.Value =
                        ImGuiExtension.Checkbox("Magic Monsters", Settings.DefensiveCountMagicMonsters);
                    Settings.DefensiveCountUniqueMonsters.Value =
                        ImGuiExtension.Checkbox("Unique Monsters", Settings.DefensiveCountUniqueMonsters);
                    Settings.DefensiveIgnoreFullHealthUniqueMonsters.Value =
                        ImGuiExtension.Checkbox("Ignore Full Health Unique Monsters", Settings.DefensiveIgnoreFullHealthUniqueMonsters);
                    ImGui.TreePop();
                }

                if (ImGui.TreeNode("Offensive Flasks"))
                {
                    Settings.OffensiveFlaskEnable.Value =
                        ImGuiExtension.Checkbox("Enable", Settings.OffensiveFlaskEnable);
                    ImGui.Spacing();
                    ImGui.Separator();
                    Settings.HPPercentOffensive.Value =
                        ImGuiExtension.IntSlider("Min Life %", Settings.HPPercentOffensive);
                    Settings.ESPercentOffensive.Value =
                        ImGuiExtension.IntSlider("Min ES %", Settings.ESPercentOffensive);
                    ImGui.Separator();
                    Settings.OffensiveMonsterCount.Value =
                        ImGuiExtension.IntSlider("Monster Count", Settings.OffensiveMonsterCount);
                    Settings.OffensiveMonsterDistance.Value =
                        ImGuiExtension.IntSlider("Monster Distance", Settings.OffensiveMonsterDistance);
                    Settings.OffensiveCountNormalMonsters.Value =
                        ImGuiExtension.Checkbox("Normal Monsters", Settings.OffensiveCountNormalMonsters);
                    Settings.OffensiveCountRareMonsters.Value =
                        ImGuiExtension.Checkbox("Rare Monsters", Settings.OffensiveCountRareMonsters);
                    Settings.OffensiveCountMagicMonsters.Value =
                        ImGuiExtension.Checkbox("Magic Monsters", Settings.OffensiveCountMagicMonsters);
                    Settings.OffensiveCountUniqueMonsters.Value =
                        ImGuiExtension.Checkbox("Unique Monsters", Settings.OffensiveCountUniqueMonsters);
                    Settings.OffensiveIgnoreFullHealthUniqueMonsters.Value =
                        ImGuiExtension.Checkbox("Ignore Full Health Unique Monsters", Settings.OffensiveIgnoreFullHealthUniqueMonsters);
                    ImGui.TreePop();
                }

                ImGui.TreePop();
            }
        }
Beispiel #20
0
        private ProfileMenuAction CreateTreeForComposite(TriggerComposite parent, TriggerComposite composite, int depth)
        {
            String typeTag = "";

            if (composite.Type == TriggerType.Action)
            {
                typeTag = "[A]";
            }
            else if (composite.Type == TriggerType.Decorator)
            {
                typeTag = "[D]";
            }
            else if (composite.Type == TriggerType.PrioritySelector)
            {
                typeTag = "[P]";
            }
            else if (composite.Type == TriggerType.Sequence)
            {
                typeTag = "[S]";
            }

            string label = depth + ":" + typeTag + composite.Name;

            ImGui.PushID("Composite" + depth + label);
            try
            {
                Vector4 chosenColor = GreenColor;
                if (!ValidateTree(composite, out string error))
                {
                    chosenColor = RedColor;
                }

                if (composite.Type == TriggerType.Action)
                {
                    // Push an ID so everything below remains unique
                    ImGuiNative.igIndent(1.0f);

                    var profileAction = CreateTriggerTextWithPopupMenu(label, chosenColor, parent, composite);
                    if (profileAction == ProfileMenuAction.Edit)
                    {
                        ImGui.OpenPopup(TriggerMenuLabel);
                        NewTriggerMenu = new TriggerMenu(Plugin.ExtensionParameter, parent, composite);
                    }
                    else if (profileAction == ProfileMenuAction.ExportTree)
                    {
                        LoadSaveTrigger = composite;
                        forceOpenSave   = true;
                    }
                    else if (profileAction != ProfileMenuAction.None)
                    {
                        // Pass it up, maybe someone above knows how to deal with it
                        return(profileAction);
                    }

                    RenderTriggerMenu();
                    ImGuiNative.igUnindent(1.0f);
                }
                else if (ImGui.TreeNodeEx("", ImGuiTreeNodeFlags.OpenOnArrow | ImGuiTreeNodeFlags.DefaultOpen))
                {
                    ImGui.SameLine();

                    var profileAction = CreateTriggerTextWithPopupMenu(label, chosenColor, parent, composite);
                    if (profileAction == ProfileMenuAction.Edit)
                    {
                        ImGui.OpenPopup(TriggerMenuLabel);
                        NewTriggerMenu = new TriggerMenu(Plugin.ExtensionParameter, parent, composite);
                    }
                    else if (profileAction == ProfileMenuAction.ImportTree)
                    {
                        forceOpenLoad   = true;
                        LoadSaveTrigger = composite;
                    }
                    else if (profileAction == ProfileMenuAction.ExportTree)
                    {
                        forceOpenSave   = true;
                        LoadSaveTrigger = composite;
                    }
                    else if (profileAction != ProfileMenuAction.None)
                    {
                        // Pass it up, maybe someone above knows how to deal with it
                        return(profileAction);
                    }

                    // Decorators can only have one child
                    if (composite.Type != TriggerType.Decorator || (composite.Children == null || composite.Children.Count == 0))
                    {
                        if (ImGui.Button("+"))
                        {
                            ImGui.OpenPopup(TriggerMenuLabel);
                            NewTriggerMenu = new TriggerMenu(Plugin.ExtensionParameter, composite);
                        }
                        ImGuiExtension.ToolTipWithText("(?)", "Add Child");
                    }

                    if (composite.Children != null && composite.Children.Any())
                    {
                        List <TriggerComposite> childrenToRemove   = new List <TriggerComposite>();
                        List <TriggerComposite> childrenToMoveUp   = new List <TriggerComposite>();
                        List <TriggerComposite> childrenToMoveDown = new List <TriggerComposite>();
                        foreach (var child in composite.Children)
                        {
                            var childAction = CreateTreeForComposite(composite, child, depth + 1);
                            if (childAction == ProfileMenuAction.Remove)
                            {
                                childrenToRemove.Add(child);
                            }
                            else if (childAction == ProfileMenuAction.MoveUp)
                            {
                                childrenToMoveUp.Add(child);
                            }
                            else if (childAction == ProfileMenuAction.MoveDown)
                            {
                                childrenToMoveDown.Add(child);
                            }
                        }
                        // Remove all children who were requested deletion
                        childrenToRemove.ForEach(x => composite.Children.Remove(x));
                        childrenToMoveUp.ForEach(x =>
                        {
                            var index = composite.Children.IndexOf(x);
                            composite.Children.Remove(x);
                            composite.Children.Insert(Math.Max(0, index - 1), x);
                        });
                        childrenToMoveDown.ForEach(x =>
                        {
                            var index = composite.Children.IndexOf(x);
                            composite.Children.Remove(x);
                            composite.Children.Insert(index + 1, x);
                        });
                    }

                    RenderTriggerMenu();

                    ImGui.TreePop();
                }
                else
                {
                    // Tree is closed, but we still want to display the text.
                    ImGui.SameLine();
                    var profileAction = CreateTriggerTextWithPopupMenu(label, chosenColor, parent, composite);
                    if (profileAction == ProfileMenuAction.Edit)
                    {
                        ImGui.OpenPopup(TriggerMenuLabel);
                        NewTriggerMenu = new TriggerMenu(Plugin.ExtensionParameter, parent, composite);
                    }
                    else if (profileAction == ProfileMenuAction.ImportTree)
                    {
                        forceOpenLoad   = true;
                        LoadSaveTrigger = composite;
                    }
                    else if (profileAction == ProfileMenuAction.ExportTree)
                    {
                        forceOpenSave   = true;
                        LoadSaveTrigger = composite;
                    }
                    else if (profileAction != ProfileMenuAction.None)
                    {
                        // Pass it up, maybe someone above knows how to deal with it
                        return(profileAction);
                    }

                    RenderTriggerMenu();
                }
            }
            finally
            {
                // Just to make sure we pop the ID, no matter if we return early
                ImGui.PopID();
            }

            return(ProfileMenuAction.None);
        }
Beispiel #21
0
        public void Render()
        {
            if (ImGui.SmallButton("Reload"))
            {
                // Validate current tree
                var root = Plugin.Settings.LoadedProfile.Composite;
                if (root == null)
                {
                    // Warn the user that there is no profile to reload
                    StartNewOKMenu("No profile to reload.");
                }
                else
                {
                    if (!ValidateTree(Plugin.Settings.LoadedProfile.Composite, out string error))
                    {
                        StartNewOKMenu(error);
                    }
                    else
                    {
                        // Everything seems good. Load the tree
                        Plugin.CreateAndStartTreeFromLoadedProfile();
                    }
                }
            }
            ImGuiExtension.ToolTipWithText("(?)", "The tree MUST be reloaded in order for changes to take effect.");

            ImGui.SameLine();
            ImGui.Spacing();
            ImGui.SameLine();

            if (ImGui.SmallButton("Save") || forceOpenSave)
            {
                ImGui.OpenPopup("Save Profile");
            }

            RenderSaveProfileMenu();

            ImGui.SameLine();
            ImGui.Spacing();
            ImGui.SameLine();

            if (ImGui.SmallButton("Load") || forceOpenLoad)
            {
                ImGui.OpenPopup("Load Profile");
            }

            RenderLoadProfileMenu();

            ImGui.SameLine();
            ImGui.Spacing();
            ImGui.SameLine();

            if (ImGui.SmallButton("Clear") || Plugin.Settings.LoadedProfile == null)
            {
                Plugin.Settings.LoadedProfile = new Profile.LoadedProfile();
            }
            ImGuiExtension.ToolTipWithText("(?)", "Clear the tree to start over.");

            RenderOkMenu();

            ImGui.Spacing();
            ImGui.Separator();
            ImGui.Text("Loaded Tree");
            ImGui.Spacing();

            if (Plugin.Settings.LoadedProfile.Composite == null)
            {
                if (ImGui.Button("+"))
                {
                    ImGui.OpenPopup(TriggerMenuLabel);
                    NewTriggerMenu = new TriggerMenu(Plugin.ExtensionParameter, null);
                }
                ImGuiExtension.ToolTipWithText("(?)", "Add root");


                // If start profile is clicked, trigger menu is rendered
                RenderTriggerMenu();
            }
            else
            {
                var menuAction = CreateTreeForComposite(null, Plugin.Settings.LoadedProfile.Composite, 0);
                if (menuAction == ProfileMenuAction.Remove)
                {
                    // Was asked to remove the root node.
                    Plugin.Settings.LoadedProfile.Composite = null;
                }
            }
        }