Exemplo n.º 1
0
    def __init__(self) -> None:
        self.OffsetSlider = Options.Slider(
            Caption="Level Offset",
            Description=
            ("A constant offset applied to the intended enemy levels, before any randomization."
             ),
            StartingValue=0,
            MinValue=-50,
            MaxValue=50,
            Increment=1)
        self.MinSlider = Options.Slider(
            Caption="Max Decrease",
            Description=(
                "The maximum amount an enemy's level can be randomly decreased."
                " Note that a level cannot be decreased below 0."),
            StartingValue=5,
            MinValue=0,
            MaxValue=50,
            Increment=1)
        self.MaxSlider = Options.Slider(
            Caption="Max Increase",
            Description=
            "The maximum amount an enemy's level can be randomly increased.",
            StartingValue=5,
            MinValue=0,
            MaxValue=50,
            Increment=1)

        self.Options = [self.OffsetSlider, self.MinSlider, self.MaxSlider]
Exemplo n.º 2
0
    def __init__(self) -> None:
        self.ScalingObject = unrealsdk.FindObject(
            "ConstantAttributeValueResolver",
            "GD_Balance_HealthAndDamage.HealthAndDamage.Att_UniversalBalanceScaler:ConstantAttributeValueResolver_0"
        )

        self.Options = [
            Options.Slider(
                Caption="BL2 Scaling",
                Description=
                "The game's base scaling value (multiplied by 100). 113 means every level the numbers get 13% higher.",
                StartingValue=113,
                MinValue=0,
                MaxValue=500,
                Increment=1,
                IsHidden=Game.GetCurrent() != Game.BL2),
            Options.Slider(
                Caption="TPS Scaling",
                Description=
                "The game's base scaling value (multiplied by 100). 111 means every level the numbers get 11% higher.",
                StartingValue=111,
                MinValue=0,
                MaxValue=500,
                Increment=1,
                IsHidden=Game.GetCurrent() != Game.TPS)
        ]

        self.ScalingSlider = cast(
            Options.Slider, self.Options[1 if self.Options[0].IsHidden else 0])
Exemplo n.º 3
0
 def __init__(self) -> None:
     self.ForceOption = Options.Boolean(
         "Force Offline Mode",
         "Forces your game to never connect to SHiFT.", False)
     self.WarningOption = Options.Boolean(
         "Hide Offline Warning",
         "Automatically hides the offline mode warning.", True)
     self.Options = [self.ForceOption, self.WarningOption]
Exemplo n.º 4
0
    def __init__(self) -> None:
        self.Options = []
        self.OptionRestrictionMap = {}

        for r_set in ALL_RESTRICTION_SETS:
            self.Options.append(
                Options.Nested(r_set.Name, r_set.Description,
                               r_set.UsedOptions))
            enabled = Options.Boolean(
                "Enable " + r_set.Name,
                "Should this restriction set be enabled.", False)
            self.OptionRestrictionMap[enabled] = r_set
            self.Options.append(enabled)
Exemplo n.º 5
0
    def __init__(self) -> None:
        self.UsedOptions = []
        self.ArtifactOptionMap = {}
        self.FlashNameOptionMap = {}

        current_game = Game.GetCurrent()
        for manu in ALL_MANUFACTURERS:
            can_be_shown = current_game in manu.SupportedGames
            option = Options.Boolean(
                Caption=manu.Name,
                Description=f"Should you be able to equip {manu.Name} items.",
                StartingValue=True,
                Choices=self.AllowChoices,
                IsHidden=not can_be_shown)
            self.UsedOptions.append(option)

            # Just to prevent bandit and scav from overwriting each other
            if can_be_shown:
                if manu.Artifact is not None:
                    self.ArtifactOptionMap[manu.Artifact] = option
                self.FlashNameOptionMap[manu.FlashLabelName] = option

        self.AllegianceRelics = Options.Boolean(
            Caption="Allegiance Relics",
            Description=
            ("Should you be able to equip allegiance relics. You will only be able to equip ones"
             " that boost manufacturers you're already allowed to equip."),
            StartingValue=False,
            Choices=self.AllowChoices,
            IsHidden=current_game != Game.BL2)

        self.UseableItems = Options.Boolean(
            Caption="Ignore Usable Items",
            Description=
            ("Should you be able to use useable items regardless of their manufacturer. This"
             " includes things such as health vials, oxygen, SDUs, shield boosters, and more."
             ),
            StartingValue=True)

        self.WeaponsOnly = Options.Boolean(
            Caption="Weapons Only",
            Description=
            "Only prevent equipping weapons. This overwrites the previous two options.",
            StartingValue=False)

        self.UsedOptions.append(self.AllegianceRelics)
        self.UsedOptions.append(self.UseableItems)
        self.UsedOptions.append(self.WeaponsOnly)
Exemplo n.º 6
0
class BackpackManager(SDKMod):
    Name: str = "Backpack Manager"
    Author = "FromDarkHell"
    Description: str = "Customize the size of your character's backpack on the fly!"
    Version: str = "1.1"

    Types: ModTypes = ModTypes.Gameplay
    SaveEnabledState: EnabledSaveType = EnabledSaveType.LoadWithSettings

    BackpackSize: Options.Slider = Options.Slider(
        "Backpack",
        "Change the size of your character's backpack<br>Default is 39", 39, 0,
        200, 1)
    Options = [BackpackSize]

    @Hook("WillowGame.WillowHUD.CreateWeaponScopeMovie")
    def _GameLoad(self, caller: unrealsdk.UObject,
                  function: unrealsdk.UFunction,
                  params: unrealsdk.FStruct) -> bool:
        PC = unrealsdk.GetEngine().GamePlayers[0].Actor
        if PC and PC.Pawn:
            PC.Pawn.InvManager.InventorySlotMax_Misc = self.BackpackSize.CurrentValue
        return True

    def ModOptionChanged(self, option, newValue) -> None:
        if option == self.BackpackSize:
            PC = unrealsdk.GetEngine().GamePlayers[0].Actor
            if PC and PC.Pawn:
                PC.Pawn.InvManager.InventorySlotMax_Misc = newValue
Exemplo n.º 7
0
 def __init__(self) -> None:
     self.MinDamageSlider = Options.Slider(
         Description=
         "The minimum amount of zeros a damage number has to have before it is logged to console.",
         Caption="Minimum Zeros",
         StartingValue=6,
         MinValue=0,
         MaxValue=40,
         Increment=1)
     self.Options = [self.MinDamageSlider]
Exemplo n.º 8
0
    def __init__(self) -> None:
        super().__init__()

        self._DurationOption = Options.Slider(
            Caption=f"{self.Name} Duration",
            Description=
            ("The duration of the effect."
             " If the duration is longer than the interval, additional redemptions will restart"
             " the duration timer."),
            StartingValue=self.Duration,
            MinValue=0,
            MaxValue=600,
            Increment=1)
        self.Options.append(self._DurationOption)
Exemplo n.º 9
0
    def __init__(self) -> None:
        self.MultiplierSlider = Options.Slider(
            Caption="Multiplier",
            Description="The amount to multiply spawns by.",
            StartingValue=1,
            MinValue=1,
            MaxValue=25,
            Increment=1)
        self.SpawnLimitSpinner = Options.Spinner(
            Caption="Spawn Limit",
            Description=
            ("How to handle the spawn limit."
             f" {SpawnLimitType.Standard}: Don't change it;"
             f" {SpawnLimitType.Linear}: Increase linearly with the multiplier;"
             f" {SpawnLimitType.Unlimited}: Remove it."),
            StartingValue=SpawnLimitType.Linear.value,
            Choices=[t.value for t in SpawnLimitType],
        )
        self.OldMultiplier = self.MultiplierSlider.CurrentValue

        self.Options = [self.MultiplierSlider, self.SpawnLimitSpinner]

        self.CurrentPopMaster = None
        self.OriginalLimit = 100
Exemplo n.º 10
0
    def __init__(self) -> None:
        self.UsedOptions = []
        self.RarityOptionMap = {}

        current_game = Game.GetCurrent()
        for rarity in ALL_RARITIES:
            can_be_shown = current_game in rarity.SupportedGames
            option = Options.Boolean(
                Caption=rarity.Name,
                Description=f"Should you be able to equip {rarity.Name} items.",
                StartingValue=True,
                Choices=self.AllowChoices,
                IsHidden=not can_be_shown)
            self.UsedOptions.append(option)

            # Just to prevent seraph/glitch from overwriting each other
            if can_be_shown:
                self.RarityOptionMap[rarity.Value] = option
Exemplo n.º 11
0
    def __init__(self) -> None:
        preset_option = Options.Hidden("Presets", StartingValue=[])
        self.Options = [preset_option] + ALL_OPTIONS  # type: ignore

        # Load settings once for the set of presets
        LoadModSettings(self)

        self.CheatPresetManager = PresetManager(preset_option, ALL_CHEATS)

        # This is a kind of hacky way for the preset manager to interface with the keybinds system
        # Output from the preset manager is html-escaped, the keybind menu doesn't use html, so this
        #  stuff all has to convert it
        def AddPresetKeybind(name: str) -> None:
            self.Keybinds.append(Keybind(html.unescape(name)))
            SaveModSettings(self)

        def RenamePresetKeybind(oldName: str, newName: str) -> None:
            for bind in self.Keybinds:
                if bind.Name == html.unescape(oldName):
                    bind.Name = html.unescape(newName)
            SaveModSettings(self)

        def RemovePresetKeybind(name: str) -> None:
            for bind in self.Keybinds:
                if bind.Name == html.unescape(name):
                    self.Keybinds.remove(bind)
            SaveModSettings(self)

        self.CheatPresetManager.AddKeybind = AddPresetKeybind  # type: ignore
        self.CheatPresetManager.RenameKeybind = RenamePresetKeybind  # type: ignore
        self.CheatPresetManager.RemoveKeybind = RemovePresetKeybind  # type: ignore
        self.CheatPresetManager.SaveOptions = lambda: SaveModSettings(
            self)  # type: ignore

        self.Keybinds = []
        for cheat in ALL_CHEATS:
            self.Keybinds.append(Keybind(cheat.KeybindName))

        for preset in self.CheatPresetManager.PresetList:
            self.Keybinds.append(Keybind(html.unescape(preset.Name)))

        # Load settings again to fill in the keybinds
        LoadModSettings(self)
        self._initalized = True
Exemplo n.º 12
0
    def __init__(self) -> None:
        """
        Creates the effect - make sure to call this method if you overwrite it. Does not take args.
        """
        super().__init__()

        self._IntervalOption = Options.Slider(
            Caption=f"{self.Name} Interval",
            Description=
            ("The minimum interval between activations, in seconds."
             " If the reward is redeemed twice within the interval, it will only activate a"
             " second time once it expires."),
            StartingValue=self.Interval,
            MinValue=0,
            MaxValue=600,
            Increment=1)
        self.Options.append(self._IntervalOption)

        self._Queue = []
Exemplo n.º 13
0
    def __init__(self) -> None:
        self.UsedOptions = []
        self.WeaponOptionMap = {}
        self.ItemOptionMap = {}

        current_game = Game.GetCurrent()
        for item_type in ALL_WEAPON_TYPES + ALL_ITEM_TYPES:
            can_be_shown = current_game in item_type.SupportedGames
            option = Options.Boolean(
                Caption=item_type.Name,
                Description=f"Should you be able to equip {item_type.Name}.",
                StartingValue=True,
                Choices=self.AllowChoices,
                IsHidden=not can_be_shown)
            self.UsedOptions.append(option)

            # Just to prevent relics/oz kits from overwriting each other
            if can_be_shown:
                if isinstance(item_type, WeaponType):
                    self.WeaponOptionMap[item_type.Value] = option
                else:
                    self.ItemOptionMap[item_type.Class] = option
Exemplo n.º 14
0
    def SetDefaultOptions(self) -> None:
        self.DetailedOption = Options.Boolean(
            "Detailed Part Names",
            "Should part names include the weapon and part type they're for rather than just"
            " the manufacturer.", False)
        self.FontSizeOption = Options.Slider(
            "Font Size",
            "What font size should the parts text use. Decrease this if text is getting cut off.",
            14, 8, 24, 1)
        self.RemoveOption = Options.Boolean(
            "Remove Descriptions",
            "Should the default descriptions be removed to create more space for the part"
            " descriptions.", False)

        self.Options = [
            self.DetailedOption,
            self.FontSizeOption,
            self.RemoveOption,
            ItemClassOption(
                "Weapons",
                "WillowWeapon",
                (PartOption("Accessory", True, ("Accessory1PartDefinition", )),
                 PartOption("2nd Accessory", False,
                            ("Accessory2PartDefinition", )),
                 PartOption("Barrel", True, ("BarrelPartDefinition", )),
                 PartOption("Body", False, ("BodyPartDefinition", )),
                 PartOption("Element", False, ("ElementalPartDefinition", )),
                 PartOption("Grip", True, ("GripPartDefinition", )),
                 PartOption("Material", False, ("MaterialPartDefinition", )),
                 PartOption("Sight", True, ("SightPartDefinition", )),
                 PartOption("Stock", True, ("StockPartDefinition", )),
                 PartOption("Type", False, ("WeaponTypeDefinition", ))),
            ),
            ItemClassOption("Shields", "WillowShield", (
                PartOption("Accessory",
                           False, ("DeltaItemPartDefinition", )),
                PartOption(
                    "Battery",
                    True, ("BetaItemPartDefinition", )),
                PartOption("Body", True, ("AlphaItemPartDefinition", )),
                PartOption(
                    "Capacitor",
                    True, ("GammaItemPartDefinition", )),
                PartOption("Material", False,
                           ("MaterialItemPartDefinition", )),
                PartOption("Type", False,
                           ("ItemDefinition", )),
                PartOption(
                    "Extras", True,
                    ("EpsilonItemPartDefinition", "ZetaItemPartDefinition",
                     "EtaItemPartDefinition", "ThetaItemPartDefinition"),
                    "Should parts in slots that aren't normally used be shown if they contain a part."
                ))),
            ItemClassOption("Grenades", "WillowGrenadeMod",
                            (PartOption("Accessory", False,
                                        ("DeltaItemPartDefinition", )),
                             PartOption("Blast Radius", True,
                                        ("ZetaItemPartDefinition", )),
                             PartOption("Child Count", True,
                                        ("EtaItemPartDefinition", )),
                             PartOption("Damage", False,
                                        ("EpsilonItemPartDefinition", )),
                             PartOption("Delivery", True,
                                        ("BetaItemPartDefinition", )),
                             PartOption("Material", False,
                                        ("MaterialItemPartDefinition", )),
                             PartOption("Payload", False,
                                        ("AlphaItemPartDefinition", )),
                             PartOption("Status Damage", False,
                                        ("ThetaItemPartDefinition", )),
                             PartOption("Trigger", True,
                                        ("GammaItemPartDefinition", )),
                             PartOption("Type", False, ("ItemDefinition", )))),
            ItemClassOption("Class Mods", "WillowClassMod", (
                PartOption("Specialization", True,
                           ("AlphaItemPartDefinition", )),
                PartOption("Primary", True, ("BetaItemPartDefinition", )),
                PartOption(
                    "Secondary",
                    True, ("GammaItemPartDefinition", )),
                PartOption("Penalty", True, ("MaterialItemPartDefinition", )),
                PartOption("Type", False, ("ItemDefinition", )),
                PartOption(
                    "Extras", True,
                    ("DeltaItemPartDefinition", "EpsilonItemPartDefinition",
                     "ZetaItemPartDefinition", "EtaItemPartDefinition",
                     "ThetaItemPartDefinition"),
                    "Should parts in slots that aren't normally used be shown if they contain a part."
                ))),
            ItemClassOption(
                "Relics",
                "WillowArtifact",
                (
                    PartOption("Body", False, ("EtaItemPartDefinition", )),
                    PartOption("Upgrade", True, ("ThetaItemPartDefinition", )),
                    # These are the various relic enable effect parts
                    # There isn't really a pattern to them so go with the slot name
                    PartOption("Alpha", False, ("AlphaItemPartDefinition", )),
                    PartOption("Beta", False, ("BetaItemPartDefinition", )),
                    PartOption("Gamma", False, ("GammaItemPartDefinition", )),
                    PartOption("Delta", False, ("DeltaItemPartDefinition", )),
                    PartOption("Epsilon", False,
                               ("EpsilonItemPartDefinition", )),
                    PartOption("Zeta", False, ("ZetaItemPartDefinition", )),
                    PartOption("Type", False, ("ItemDefinition", )),
                    PartOption(
                        "Extras", True, ("MaterialItemPartDefinition", ),
                        "Should parts in slots that aren't normally used be shown if they contain a part."
                    )),
                IsHidden=Game.GetCurrent() != Game.BL2),
            ItemClassOption(
                "Oz Kits",
                "WillowArtifact",
                (
                    PartOption("Body", False, ("EtaItemPartDefinition", )),
                    PartOption("Upgrade", True, ("ThetaItemPartDefinition", )),
                    # These are the various relic enable effect parts
                    # There isn't really a pattern to them so go with the slot name
                    PartOption("Alpha", False, ("AlphaItemPartDefinition", )),
                    PartOption("Beta", False, ("BetaItemPartDefinition", )),
                    PartOption("Gamma", False, ("GammaItemPartDefinition", )),
                    PartOption("Delta", False, ("DeltaItemPartDefinition", )),
                    PartOption("Epsilon", False,
                               ("EpsilonItemPartDefinition", )),
                    PartOption("Zeta", False, ("ZetaItemPartDefinition", )),
                    PartOption("Type", False, ("ItemDefinition", )),
                    PartOption(
                        "Extras", True, ("MaterialItemPartDefinition", ),
                        "Should parts in slots that aren't normally used be shown if they contain a part."
                    )),
                IsHidden=Game.GetCurrent() != Game.TPS)
        ]
Exemplo n.º 15
0
 def __init__(self) -> None:
     self.CheatOptions = [Options.Hidden("Disable One Shot Mode in TPS", StartingValue=False)]
Exemplo n.º 16
0
    def __init__(self) -> None:
        super().__init__()

        if Game.GetCurrent() == Game.BL2:
            optionSirenToggle = Options.Boolean(
                "Siren Skill Toggle", "Allows Maya to stop her Phaselock.", True
            )
            optionGunzerkerToggle = Options.Boolean(
                "Gunzerker Skill Toggle", "Allows Salvador to stop his Dual Wield.", True
            )
            optionCommandoToggle = Options.Boolean(
                "Commando Skill Toggle", "Allows Axton to recall his turrets.", True
            )
            optionAssassinToggle = Options.Boolean(
                "Assassin Skill Toggle", "Allows Zer0 to stop Decepti0n.", True
            )
            optionMechromancerToggle = Options.Boolean(
                "Mechromancer Skill Toggle", "Allows Gaige to recall her Deathtrap.", True
            )
            optionPsychoToggle = Options.Boolean(
                "Psycho Skill Toggle",
                "Allows Krieg to return from his Buzzaxe Rampage.",
                True,
            )

            self._classOptions = {
                "Siren": optionSirenToggle,
                "Gunzerker": optionGunzerkerToggle,
                "Commando": optionCommandoToggle,
                "Assassin": optionAssassinToggle,
                "Mechromancer": optionMechromancerToggle,
                "Psycho": optionPsychoToggle,
            }
        elif Game.GetCurrent() == Game.TPS:
            optionGladiatorToggle = Options.Boolean(
                "Gladiator Skill Toggle", "Allows Athena to stop her Kinetic Aspis.", True
            )
            optionEnforcerToggle = Options.Boolean(
                "Enforcer Skill Toggle", "Allows Wilhelm to recall Wolf and Saint.", True
            )
            optionLawbringerToggle = Options.Boolean(
                "Lawbringer Skill Toggle", "Allows Nisha to stop her showdown.", True
            )
            optionFragtrapToggle = Options.Boolean(
                "Fragtrap Skill Toggle", "Allows Claptrap to stop VaultHunter.EXE.", True
            )
            optionDoppelgangerToggle = Options.Boolean(
                "Doppelganger Skill Toggle", "Allows Jack to stop his Expendable Assets.", True
            )
            optionBaronessToggle = Options.Boolean(
                "Baroness Skill Toggle", "Allows Aurelia to stop Cold As Ice.", True
            )

            self._classOptions = {
                "Gladiator": optionGladiatorToggle,
                "Enforcer": optionEnforcerToggle,
                "Lawbringer": optionLawbringerToggle,
                "Fragtrap": optionFragtrapToggle,
                "Doppelganger": optionDoppelgangerToggle,
                "Baroness": optionBaronessToggle,
            }

        self.Options = [*self._classOptions.values()]

        self.Keybinds = [
            Keybind(
                "Deactivate Action Skill",
                "F",
                True,
                OnPress=self._skillDeactivationHotkey,
            )
        ]
Exemplo n.º 17
0
    def __init__(self) -> None:
        self.TaskOption = Options.Hidden(
            "Tasks",
            StartingValue={
                "OnMainMenu": {
                    "Tasks": []
                },
                "OnLaunch": {
                    "Comment": [
                        "Congratulations, you found the secret file where you can setup tasks to run on launch.",
                        " This is not editable ingame because exec-ing mods before the main menu tends to cause",
                        " a crash, but if you really want you can edit the `Tasks` array here at your own risk."
                    ],
                    "Tasks": []
                }
            })
        self.Options = [self.TaskOption]
        LoadModSettings(self)

        # Load from the legacy settings file
        config_file = os.path.join(os.path.dirname(GetSettingsFilePath(self)),
                                   "config.json")
        try:
            with open(config_file) as file:
                loaded_settings = json.load(file)

                try:
                    if loaded_settings["IsEnabled"]:
                        self.SettingsInputPressed("Enable")
                except KeyError:
                    pass

                try:
                    self.TaskOption.CurrentValue["OnMainMenu"][
                        "Tasks"] = loaded_settings["OnMainMenu"]["Tasks"]
                    self.TaskOption.CurrentValue["OnLaunch"][
                        "Tasks"] = loaded_settings["OnLaunch"]["Tasks"]
                except KeyError:
                    pass
            SaveModSettings(self)
            os.remove(config_file)
        except json.JSONDecodeError:
            os.remove(config_file)
        except FileNotFoundError:
            pass

        self.LaunchTasks = []
        self.MainMenuTasks = []

        any_errors = False
        for task in self.TaskOption.CurrentValue["OnMainMenu"]["Tasks"]:
            try:
                task_obj = Tasks.NAME_TASK_MAP[task["Type"]]()  # type: ignore
                success = task_obj.FromJSONSerializable(task["Value"])
                if not success:
                    any_errors = True
                    continue
                self.MainMenuTasks.append(task_obj)
            except KeyError:
                any_errors = True

        for task in self.TaskOption.CurrentValue["OnLaunch"]["Tasks"]:
            try:
                task_obj = Tasks.NAME_TASK_MAP[task["Type"]]()  # type: ignore
                success = task_obj.FromJSONSerializable(task["Value"])
                if not success:
                    any_errors = True
                    continue
                self.LaunchTasks.append(task_obj)
            except KeyError:
                any_errors = True

        if any_errors:
            UserFeedback.TrainingBox(
                "SDK Autorun Error",
                "One or more tasks was unable to be parsed and thus will be skipped."
            ).Show()

        if self.IsEnabled and not any_errors:
            self.Execute(self.LaunchTasks)

            def OnMainMenu(caller: unrealsdk.UObject,
                           function: unrealsdk.UFunction,
                           params: unrealsdk.FStruct) -> bool:
                self.Execute(self.MainMenuTasks)
                unrealsdk.RemoveHook("WillowGame.FrontendGFxMovie.Start",
                                     self.Name)
                return True

            unrealsdk.RegisterHook("WillowGame.FrontendGFxMovie.Start",
                                   self.Name, OnMainMenu)
Exemplo n.º 18
0
 def __init__(self) -> None:
     self.CompressOption = Options.Hidden("CompressSaves",
                                          StartingValue=True)
     self.Options = [self.CompressOption]