Esempio n. 1
0
class MapLoader(SDKMod):
    Name: str = "Borderlands 2 Map Reloader"
    Version: str = "1.1"
    Author: str = "FromDarkHell"
    Description: str = "Quickly farm items and save quit at a button press!\n\nLocation Restore: Whether to restore location on quickload"
    Types: ModTypes = ModTypes.Utility
    SaveEnabledState: EnabledSaveType = EnabledSaveType.LoadWithSettings

    Keybinds: List[ModMenu.Keybind] = [
        ModMenu.Keybind("Quickload w/o Saving", "F7"),
        ModMenu.Keybind("Quickload w/ Saving", "F8"),
        ModMenu.Keybind("Toggle Location Restore", "F10"),
        ModMenu.Keybind("Save Location", "F5"),
    ]

    def __init__(self):
        # It might be a good idea to restore our position after a load.
        self.restoreLocation = True
        self.loading = False
        self.consistentLocation = False
        self.toggledLocation = False
        # Store some data that we can use to reload the map
        self.SelectedDifficulty = 0
        self.OverpoweredLevel = 0
        self.Coords = [0, 0, 0]  # X, Y, Z
        self.Rotation = [0, 0, 0]  # Pitch, Roll, Yaw

    def GameInputPressed(self, input) -> None:
        name = input.Name
        if name == "Quickload w/o Saving":
            _ReloadCurrentMap(True)
        elif name == "Quickload w/ Saving":
            _ReloadCurrentMap(False)
        elif name == "Toggle Location Restore":
            self.restoreLocation = not self.restoreLocation
            state = "Location restoration is now {}".format(
                "enabled" if self.restoreLocation else "disabled")
            Log(f"[Map Loader] {state}")
            _DisplayFeedback(state)
        elif name == "Save Location":
            self.toggledLocation = True
            self.consistentLocation = not self.consistentLocation
            state = "Save Location is now {}".format(
                "enabled (Saves on quickload quit)" if self.
                consistentLocation else "disabled")
            Log(f"[Map Loader] {state}")
            _DisplayFeedback(state)

    def Enable(self) -> None:
        super().Enable()

    def Disable(self) -> None:
        ModMenu.RemoveHooks(self)
Esempio n. 2
0
def _edit_giant_prefix(arguments: Sequence[Any]) -> None:
    """Set the name prefix for Giants and log a message to console."""
    try:
        GiantPrefix.CurrentValue = arguments[0] if isinstance(arguments, list) else arguments.name
        ModMenu.SaveModSettings(_mod_instance)
        Log(f"Reign Of Giants Giant Name: {GiantPrefix.CurrentValue}")
    except IndexError:
        Log("Must specify a name, e.g.: giantsname Teensie Weensie")
Esempio n. 3
0
def _edit_giant_scale(arguments: Sequence[Any]) -> None:
    """Set the scale for Giants and log a message to console."""
    try:
        GiantScale.CurrentValue = float(arguments[0] if isinstance(arguments, list) else arguments.size)
        ModMenu.SaveModSettings(_mod_instance)
        Log(f"Reign Of Giants Giant Size: {GiantScale.CurrentValue}")
    except (IndexError, ValueError):
        Log("Must specify a valid number, e.g.: giantssize 0.5")
Esempio n. 4
0
def _SavePosition():
    mapName = _GetMapName()

    positions = _Positions.CurrentValue.get(mapName, [None, None, None])
    positions[_Position] = _GetPosition(_GetPlayerController())

    _Positions.CurrentValue[mapName] = positions
    ModMenu.SaveModSettings(_ModInstance)

    _Feedback(f"Saved Position {_Position + 1}")
Esempio n. 5
0
def _ToggleDamageNumbers():
    _DamageNumbers.CurrentValue = not _DamageNumbers.CurrentValue
    ModMenu.SaveModSettings(_ModInstance)

    CallPostEdit(False)
    if _DamageNumbers.CurrentValue:
        _DamageNumberParticleSystem.Emitters = _DamageNumberEmitters
        _Feedback("Damage Numbers: On")
    else:
        _DamageNumberParticleSystem.Emitters = _NoDamageNumberEmitters
        _Feedback("Damage Numbers: Off")
    CallPostEdit(True)
Esempio n. 6
0
def _toggle_cheat_mode() -> None:
    """Toggle cheat mode and log a message to console."""
    CheatMode.CurrentValue = not CheatMode.CurrentValue
    ModMenu.SaveModSettings(_mod_instance)
    Log("Reign Of Giants Cheat Mode: " + ("On" if CheatMode.CurrentValue else "Off"))
Esempio n. 7
0
        RemoveHook( "Engine.Pawn.ApplyBalanceDefinitionCustomizations",                        "ReignOfGiants" )
        RemoveHook( "WillowGame.WillowAIPawn.ReplicatedEvent",                                 "ReignOfGiants" )
        RemoveHook( "WillowGame.WillowAIPawn.AILevelUp",                                       "ReignOfGiants" )
        RemoveHook( "WillowGame.Behavior_Transform.ApplyBehaviorToContext",                    "ReignOfGiants" )
        RemoveHook( "WillowGame.WillowAIPawn.Died",                                            "ReignOfGiants" )

        if CommandExtensions is None:
            RemoveHook("Engine.PlayerController.ConsoleCommand", "ReignOfGiants")
        else:
            CommandExtensions.UnregisterConsoleCommand("giantscheat")
            CommandExtensions.UnregisterConsoleCommand("giantssize")
            CommandExtensions.UnregisterConsoleCommand("giantsname")

        RemoveHook( "WillowGame.WillowGameViewportClient.Tick", "ReignOfGiants.RequestGiants"  )
        RemoveHook( "WillowGame.WillowGameViewportClient.Tick", "ReignOfGiants.UpdatePawns"    )
        RemoveHook( "WillowGame.WillowGameViewportClient.Tick", "ReignOfGiants.GigantizePawns" )


_mod_instance = ReignOfGiants()

if __name__ == "__main__":
    for mod in Mods:
        if mod.Name == _mod_instance.Name:
            if mod.IsEnabled:
                mod.Disable()
            Mods.remove(mod)
            _mod_instance.__class__.__module__ = mod.__class__.__module__
            break

ModMenu.RegisterMod(_mod_instance)
Esempio n. 8
0
 def __init__(self):
     ModMenu.LoadModSettings(self)
Esempio n. 9
0
        _FinishSaveGameLoad(GetEngine().GamePlayers[0].Actor, None, None)

        _RegisterHook(_FinishSaveGameLoad)
        _RegisterHook(_ClientSetSkillGrade)
        _RegisterHook(_ClientIncrementOverpowerLevel)
        _RegisterHook(_ClientOnExpLevelChange)
        _RegisterHook(_OnPlaythroughCompleted)
        _RegisterHook(_NotifyTeleported, "WillowGame.WillowPlayerPawn")
        _RegisterHook(_OnClose, "WillowGame.CustomizationGFxMovie")
        _RegisterHook(_OnClose, "WillowGame.CharacterSelectionReduxGFxMovie")
        _RegisterHook(_InventoryReadied, "WillowGame.WillowInventoryManager")
        _RegisterHook(_RemoveFromInventory,
                      "WillowGame.WillowInventoryManager")
        _RegisterHook(_SwitchQuickSlot, "WillowGame.WillowInventoryManager")

    def Disable(self):
        _RemoveHook(_FinishSaveGameLoad)
        _RemoveHook(_ClientSetSkillGrade)
        _RemoveHook(_ClientIncrementOverpowerLevel)
        _RemoveHook(_ClientOnExpLevelChange)
        _RemoveHook(_OnPlaythroughCompleted)
        _RemoveHook(_NotifyTeleported, "WillowGame.WillowPlayerPawn")
        _RemoveHook(_OnClose, "WillowGame.CustomizationGFxMovie")
        _RemoveHook(_OnClose, "WillowGame.CharacterSelectionReduxGFxMovie")
        _RemoveHook(_InventoryReadied, "WillowGame.WillowInventoryManager")
        _RemoveHook(_RemoveFromInventory, "WillowGame.WillowInventoryManager")
        _RemoveHook(_SwitchQuickSlot, "WillowGame.WillowInventoryManager")


ModMenu.RegisterMod(LiveFeed())
Esempio n. 10
0
 def Disable(self) -> None:
     ModMenu.RemoveHooks(self)
Esempio n. 11
0
class Commander(ModMenu.SDKMod):
    Name: str = "Commander"
    Version: str = "2.1"
    Description: str = "Perform various changes to the game using key bindings."
    Author: str = "mopioid"
    Types: ModTypes = ModTypes.Gameplay

    Options: List[ModMenu.Options.Base] = [
        _Positions, _DamageNumbers, _ClientTeleporting, _ClientSpeedPermissions
    ]
    SaveEnabledState: ModMenu.EnabledSaveType = ModMenu.EnabledSaveType.LoadWithSettings

    Keybinds: List[ModMenu.Keybind] = [
        ModMenu.Keybind( "Toggle Third Person",   "Equals",       OnPress=_ToggleThirdPerson   ),
        ModMenu.Keybind( "Halve Game Speed",      "LeftBracket",  OnPress=_HalveGameSpeed      ),
        ModMenu.Keybind( "Double Game Speed",     "RightBracket", OnPress=_DoubleGameSpeed     ),
        ModMenu.Keybind( "Reset Game Speed",      "None",         OnPress=_ResetGameSpeed      ),
        ModMenu.Keybind( "Toggle World Freeze",   "Backslash",    OnPress=_TogglePlayersOnly   ),
        ModMenu.Keybind( "Toggle HUD",            "Semicolon",    OnPress=_ToggleHUD           ),
        ModMenu.Keybind( "Toggle Damage Numbers", "Quote",        OnPress=_ToggleDamageNumbers ),
        ModMenu.Keybind( "Save Position",         "Period",       OnPress=_SavePosition        ),
        ModMenu.Keybind( "Restore Position",      "Comma",        OnPress=_RestorePosition     ),
        ModMenu.Keybind( "Select Position",       "Slash",        OnPress=_SelectPosition      ),
        ModMenu.Keybind( "Teleport Forward",      "Up",           OnPress=_MoveForward         ),
        ModMenu.Keybind( "Quit Without Saving",   "End",          OnPress=_QuitWithoutSaving   ),
    ]
    
    def Enable(self):
        super().Enable()
        if not _DamageNumbers.CurrentValue:
            _DamageNumberParticleSystem.Emitters = _NoDamageNumberEmitters

    def Disable(self):
        super().Disable()
        _DamageNumberParticleSystem.Emitters = _DamageNumberEmitters

    @ClientMethod
    def ClientApplyGameSpeed(self, speed, PC = None):
        _ApplyGameSpeed(speed)

    @ClientMethod
    def ClientApplyPlayersOnly(self, playersOnly, PC = None):
        _ApplyPlayersOnly(playersOnly)

    @ClientMethod
    def ClientApplyPosition(self, position, name, PC = None):
        _ApplyPosition(_GetPlayerController(), position)
        if name is not None:
            _Feedback(f"Restored Position " + name)

    @ClientMethod
    def ClientFeedback(self, feedback, PC = None):
        _Feedback(feedback)

    @ServerMethod
    def ServerRequestPosition(self, position, name, PC = None):
        if _ClientTeleporting.CurrentValue == "Allow":
            _ApplyPosition(PC, position)
            self.ClientApplyPosition(position, name, PC)
        else:
            self.ClientFeedback("Only session host may teleport players.", PC)

    @ServerMethod
    def ServerRequestGameSpeed(self, speed, PC = None):
        if _ClientSpeedPermissions.CurrentValue:
            _ApplyGameSpeed(speed)
        else:
            self.ClientFeedback("Only session host may modify game speed.", PC)

    @ServerMethod
    def ServerRequestPlayersOnly(self, playersOnly, PC = None):
        if _ClientSpeedPermissions.CurrentValue:
            _ApplyPlayersOnly(playersOnly)
        else:
            self.ClientFeedback("Only session host may toggle game freeze.", PC)
Esempio n. 12
0
        if _ClientTeleporting.CurrentValue == "Allow":
            _ApplyPosition(PC, position)
            self.ClientApplyPosition(position, name, PC)
        else:
            self.ClientFeedback("Only session host may teleport players.", PC)

    @ServerMethod
    def ServerRequestGameSpeed(self, speed, PC = None):
        if _ClientSpeedPermissions.CurrentValue:
            _ApplyGameSpeed(speed)
        else:
            self.ClientFeedback("Only session host may modify game speed.", PC)

    @ServerMethod
    def ServerRequestPlayersOnly(self, playersOnly, PC = None):
        if _ClientSpeedPermissions.CurrentValue:
            _ApplyPlayersOnly(playersOnly)
        else:
            self.ClientFeedback("Only session host may toggle game freeze.", PC)


_ModInstance = Commander()
ModMenu.RegisterMod(_ModInstance)

for mapName, positions in _Positions.CurrentValue.items():
    if type(positions) is dict:
        _Positions.CurrentValue[mapName] = [positions, None, None]
    else:
        break
ModMenu.SaveModSettings(_ModInstance)
Esempio n. 13
0
        Pipeline = params.Pipeline
    )

    global _total_damage
    _total_damage += damage

    return True


_continuous_option = ModMenu.Options.Slider(
    Caption = "Continuous Time Window",
    Description = "The number of seconds over which DPS should be averaged in continuous mode",
    StartingValue = 3.0, MinValue = 0.5, MaxValue = 12, Increment = 0.5
)

_continuous_keybind = ModMenu.Keybind("Show/Hide Continuous Average")
_accumulator_keybind = ModMenu.Keybind("Start/Stop/Clear Accumulator")

class DPSMeter(ModMenu.SDKMod):
    Name: str = "DPS Meter"
    Version: str = "1.0"
    Description: str = "Provides means of estimating damage dealt per second."
    Author: str = "mopioid"
    Types: ModMenu.ModTypes = ModMenu.ModTypes.Utility

    SaveEnabledState: ModMenu.EnabledSaveType = ModMenu.EnabledSaveType.LoadOnMainMenu

    Options: Sequence[ModMenu.Options.Base] = [_continuous_option]

    Keybinds: Sequence[ModMenu.Keybind] = [_continuous_keybind, _accumulator_keybind]