Beispiel #1
0
    Types: ModTypes = ModTypes.Utility
    SaveEnabledState: EnabledSaveType = EnabledSaveType.LoadWithSettings

    def __init__(self) -> None:
        # Convert from the legacy enabled file
        enabled_file = os.path.join(
            os.path.dirname(os.path.realpath(__file__)), "ENABLED")
        if os.path.exists(enabled_file):
            self.SettingsInputPressed("Enable")
            os.remove(enabled_file)

    def Enable(self) -> None:
        def BlockCall(caller: unrealsdk.UObject, function: unrealsdk.UFunction,
                      params: unrealsdk.FStruct) -> bool:
            return False

        unrealsdk.RegisterHook("WillowGame.FrontendGFxMovie.ShowMOTD",
                               self.Name, BlockCall)
        unrealsdk.RegisterHook(
            "WillowGame.WillowPlayerController.CanAcessOakUpsell", self.Name,
            BlockCall)

    def Disable(self) -> None:
        unrealsdk.RemoveHook("WillowGame.FrontendGFxMovie.ShowMOTD", self.Name)
        unrealsdk.RemoveHook(
            "WillowGame.WillowPlayerController.CanAcessOakUpsell", self.Name)


RegisterMod(NoAds())
Beispiel #2
0
    Types: ModTypes = ModTypes.Utility
    SaveEnabledState: EnabledSaveType = EnabledSaveType.LoadWithSettings

    DUMMY_AMOUNT: ClassVar[int] = 1

    def __init__(self) -> None:
        # Convert from the legacy enabled file
        enabled_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), "ENABLED")
        if os.path.exists(enabled_file):
            self.SettingsInputPressed("Enable")
            os.remove(enabled_file)

    def Enable(self) -> None:
        def HandleVerificationReceived(caller: unrealsdk.UObject, function: unrealsdk.UFunction, params: unrealsdk.FStruct) -> bool:
            PC = unrealsdk.GetEngine().GamePlayers[0].Actor
            for i in range(self.DUMMY_AMOUNT):
                obj = unrealsdk.ConstructObject(unrealsdk.FindClass("SparkServiceConfiguration"))
                PC.ServerRCon(f"set {PC.PathName(obj)} ServiceName Dummy_{i}")

            unrealsdk.RemoveHook("GearboxFramework.SparkInitializationProcess.HandleVerificationReceived", "FixHotfixes")
            return True

        unrealsdk.RegisterHook("GearboxFramework.SparkInitializationProcess.HandleVerificationReceived", "FixHotfixes", HandleVerificationReceived)

    def Disable(self) -> None:
        unrealsdk.RemoveHook("WillowGame.WillowGFxMoviePressStart.DoSparkAuthentication", "FixHotfixes")


RegisterMod(FixHotfixes())
Beispiel #3
0
        if Option != self.UpdatingOption:
            return

        # If you turn on updating and there are people close to vendors, start updating
        if newValue:
            if len(self.TouchingActors) > 0:
                AsyncUtil.RunEvery(self.UPDATE_DELAY, self.OnUpdate, self.Name)
        # If you turn off updating, stop updating and make sure all vendors are usable at no cost
        else:
            AsyncUtil.CancelFutureCallbacks(self.Name)
            for vendor in unrealsdk.FindAll("WillowVendingMachine"):
                if vendor.ShopType == 1 or vendor.ShopType == 2:
                    vendor.SetUsability(True, 1)
                    vendor.Behavior_ChangeUsabilityCost(1, 0, 0, 1)


instance = AltUseVendors()
if __name__ == "__main__":
    unrealsdk.Log(f"[{instance.Name}] Manually loaded")
    for mod in Mods:
        if mod.Name == instance.Name:
            if mod.IsEnabled:
                mod.Disable()
            Mods.remove(mod)
            unrealsdk.Log(f"[{instance.Name}] Removed last instance")

            # Fixes inspect.getfile()
            instance.__class__.__module__ = mod.__class__.__module__
            break
RegisterMod(instance)
Beispiel #4
0
def _console_command_hook(caller: unrealsdk.UObject,
                          function: unrealsdk.UFunction,
                          params: unrealsdk.FStruct) -> bool:
    return not _try_handle_command(params.Command)


unrealsdk.RegisterHook("Engine.PlayerController.ConsoleCommand", __name__,
                       _console_command_hook)

# load our builtin commands
from . import builtins  # noqa: F401, E402


# Provide an entry in the mods list just so users can see that this is loaded
class _CommandExtensions(SDKMod):
    Name: str = "Command Extensions"
    Author: str = "apple1417"
    Description: str = (
        "Adds a few new console commands, and provides functionality for other mods to do the same."
    )
    Version: str = f"{VersionMajor}.{VersionMinor}"

    Types: ModTypes = ModTypes.Library
    Priority = ModPriorities.Library

    Status: str = "<font color=\"#00FF00\">Loaded</font>"
    SettingsInputs: Dict[str, str] = {}


RegisterMod(_CommandExtensions())
Beispiel #5
0
    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)


_ModInstance = MapLoader()
RegisterMod(_ModInstance)
Beispiel #6
0
    SaveEnabledState: EnabledSaveType = EnabledSaveType.LoadWithSettings

    def __init__(self) -> None:
        # Convert from the legacy enabled file
        enabled_file = os.path.join(
            os.path.dirname(os.path.realpath(__file__)), "ENABLED")
        if os.path.exists(enabled_file):
            self.SettingsInputPressed("Enable")
            os.remove(enabled_file)

    def Enable(self) -> None:
        def DisplayOkBoxTextFromSpark(caller: unrealsdk.UObject,
                                      function: unrealsdk.UFunction,
                                      params: unrealsdk.FStruct) -> bool:
            if params.Section == "dlgCouldNotConnectSHiFT":
                caller.Close()
                return False
            return True

        unrealsdk.RegisterHook(
            "WillowGame.WillowGFxDialogBox.DisplayOkBoxTextFromSpark",
            self.Name, DisplayOkBoxTextFromSpark)

    def Disable(self) -> None:
        unrealsdk.RemoveHook(
            "WillowGame.WillowGFxDialogBox.DisplayOkBoxTextFromSpark",
            self.Name)


RegisterMod(NoOfflineWarning())
Beispiel #7
0
    Types: ModTypes = ModTypes.Utility
    SaveEnabledState: EnabledSaveType = EnabledSaveType.LoadWithSettings

    def __init__(self) -> None:
        # Convert from the legacy enabled file
        enabled_file = os.path.join(
            os.path.dirname(os.path.realpath(__file__)), "ENABLED")
        if os.path.exists(enabled_file):
            self.SettingsInputPressed("Enable")
            os.remove(enabled_file)

    def Enable(self) -> None:
        def DoSparkAuthentication(caller: unrealsdk.UObject,
                                  function: unrealsdk.UFunction,
                                  params: unrealsdk.FStruct) -> bool:
            caller.ShouldStartSparkInitialization = False
            return True

        unrealsdk.RegisterHook(
            "WillowGame.WillowGFxMoviePressStart.DoSparkAuthentication",
            self.Name, DoSparkAuthentication)

    def Disable(self) -> None:
        unrealsdk.RemoveHook(
            "WillowGame.WillowGFxMoviePressStart.DoSparkAuthentication",
            self.Name)


RegisterMod(ChatCrasher())
Beispiel #8
0
        key: The key of the callbacks to remove.
    """
    if key not in _CallbackMap:
        return False
    callbks = _CallbackMap[key]
    for time, val in _Callbacks.items():
        for callbk in val:
            if callbk in callbks:
                _Callbacks[time].remove(callbk)
    del _CallbackMap[key]
    return True


# Provide an entry in the mods list just so users can see that this is loaded
class _AsyncUtil(SDKMod):
    Name: str = "AsyncUtil"
    Author: str = "apple1417"
    Description: str = (
        "Provides functionality for other mods, but does not do anything by itself."
    )
    Version: str = f"{VersionMajor}.{VersionMinor}"

    Types: ModTypes = ModTypes.Library
    Priority = ModPriorities.Library

    Status: str = "<font color=\"#00FF00\">Loaded</font>"
    SettingsInputs: Dict[str, str] = {}


RegisterMod(_AsyncUtil())
Beispiel #9
0
from .Misc import ShowChatMessage as ShowChatMessage  # noqa F401
from .Misc import ShowHUDMessage as ShowHUDMessage  # noqa F401
from .OptionBox import OptionBox as OptionBox  # noqa F401
from .OptionBox import OptionBoxButton as OptionBoxButton  # noqa F401
from .OptionBox import OptionScrollType as OptionScrollType  # noqa F401
from .ReorderBox import ReorderBox as ReorderBox  # noqa F401
from .TextInputBox import TextInputBox as TextInputBox  # noqa F401
from .TrainingBox import TrainingBox as TrainingBox  # noqa F401

VersionMajor: int = 1
VersionMinor: int = 5


# Provide an entry in the mods list just so users can see that this is loaded
class _UserFeedback(SDKMod):
    Name: str = "UserFeedback"
    Author: str = "apple1417"
    Description: str = (
        "Provides functionality for other mods, but does not do anything by itself."
    )
    Version: str = f"{VersionMajor}.{VersionMinor}"

    Types: ModTypes = ModTypes.Library
    Priority = ModPriorities.Library

    Status: str = "<font color=\"#00FF00\">Loaded</font>"
    SettingsInputs: Dict[str, str] = {}


RegisterMod(_UserFeedback())
Beispiel #10
0
    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


RegisterMod(BackpackManager())