Skip to content
This repository was archived by the owner on Jan 1, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Mods/BackpackManager/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from bl2sdk import *
from unrealsdk import *
from ..ModManager import BL2MOD, RegisterMod
from ..OptionManager import Options

Expand Down
18 changes: 9 additions & 9 deletions Mods/Commander/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import bl2sdk
import unrealsdk
import sys
import os
import math
Expand Down Expand Up @@ -74,9 +74,9 @@ def GameInputRebound(self, name, key):

def GetPlayerController(self):
"""Return the current WillowPlayerController object for the local player."""
return bl2sdk.GetEngine().GamePlayers[0].Actor
return unrealsdk.GetEngine().GamePlayers[0].Actor

DefaultGameInfo = bl2sdk.FindObject(
DefaultGameInfo = unrealsdk.FindObject(
"WillowCoopGameInfo", "WillowGame.Default__WillowCoopGameInfo"
)
"""A reference to the WillowCoopGameInfo template object."""
Expand Down Expand Up @@ -134,7 +134,7 @@ def HalveGameSpeed(self):
speed = self.DefaultGameInfo.GameSpeed
if speed > 0.0625:
speed /= 2
worldInfo = bl2sdk.GetEngine().GetCurrentWorldInfo()
worldInfo = unrealsdk.GetEngine().GetCurrentWorldInfo()
worldInfo.TimeDilation = speed
self.DefaultGameInfo.GameSpeed = speed
self.Feedback("Game Speed: " + str(Fraction(speed)))
Expand All @@ -143,21 +143,21 @@ def DoubleGameSpeed(self):
speed = self.DefaultGameInfo.GameSpeed
if speed < 32:
speed *= 2
worldInfo = bl2sdk.GetEngine().GetCurrentWorldInfo()
worldInfo = unrealsdk.GetEngine().GetCurrentWorldInfo()
worldInfo.TimeDilation = speed
self.DefaultGameInfo.GameSpeed = speed
self.Feedback("Game Speed: " + str(Fraction(speed)))

def ResetGameSpeed(self):
worldInfo = bl2sdk.GetEngine().GetCurrentWorldInfo()
worldInfo = unrealsdk.GetEngine().GetCurrentWorldInfo()
worldInfo.TimeDilation = 1.0
self.DefaultGameInfo.GameSpeed = 1.0
self.Feedback("Game Speed: 1")

def ToggleHUD(self):
self.ConsoleCommand("ToggleHUD")

DamageNumberEmitterObject = bl2sdk.FindObject(
DamageNumberEmitterObject = unrealsdk.FindObject(
"ParticleSystem", "FX_CHAR_Damage_Matrix.Particles.Part_Dynamic_Number"
)
DamageNumberEmitters = list(DamageNumberEmitterObject.Emitters)
Expand Down Expand Up @@ -190,7 +190,7 @@ def ToggleDamageNumbers(self):
self.Feedback("Damage Numbers: Off")

def GetMapName(self):
return bl2sdk.GetEngine().GetCurrentWorldInfo().GetMapName(True)
return unrealsdk.GetEngine().GetCurrentWorldInfo().GetMapName(True)

def GetRotationAndLocation(self):
# Assume our local player controller is the first in the engine's list.
Expand Down Expand Up @@ -243,7 +243,7 @@ def MoveForward(self):

def TogglePlayersOnly(self):
# Get the current WorldInfo object from the engine.
worldInfo = bl2sdk.GetEngine().GetCurrentWorldInfo()
worldInfo = unrealsdk.GetEngine().GetCurrentWorldInfo()
# Get the WorldInfo's current players only state.
playersOnly = worldInfo.bPlayersOnly

Expand Down
4 changes: 2 additions & 2 deletions Mods/General/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from importlib import reload
from sys import modules

import bl2sdk
import unrealsdk

class DefaultMod(BL2MOD):

Expand All @@ -20,7 +20,7 @@ def SettingsInputPressed(self, name):
for mod in list(modules.keys()):
if mod.startswith('Mods.'):
del modules[mod]
bl2sdk.Mods = []
unrealsdk.Mods = []
modules["Mods"] = reload(modules["Mods"])
elif name == "Help":
webbrowser.open("https://github.com/bl-sdk/BL2-Python-Plugins/wiki")
Expand Down
6 changes: 3 additions & 3 deletions Mods/Grenadoer/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import bl2sdk
import unrealsdk

from ..ModManager import BL2MOD, RegisterMod

Expand All @@ -19,11 +19,11 @@ def GameInputPressed(self, input):
pressed in-game."""
if input.Name == "Swap Grenade":
inventoryManager = (
bl2sdk.GetEngine().GamePlayers[0].Actor.GetPawnInventoryManager()
unrealsdk.GetEngine().GamePlayers[0].Actor.GetPawnInventoryManager()
)
for inventory in inventoryManager.Backpack:
if (
inventory.Class == bl2sdk.FindClass("WillowGrenadeMod")
inventory.Class == unrealsdk.FindClass("WillowGrenadeMod")
and inventory.Mark == 2
):
inventoryManager.ReadyBackpackInventory(inventory, 0)
Expand Down
22 changes: 11 additions & 11 deletions Mods/KeybindManager.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import bl2sdk
from bl2sdk import *
import unrealsdk
from unrealsdk import *
from collections import namedtuple

from .Util import getLoadedMods
Expand All @@ -11,11 +11,11 @@
def HookInitKeyBinding(caller: UObject, function: UFunction, params: FStruct) -> bool:
for mod in getLoadedMods():
if mod.Keybinds:
tag = f"bl2sdk.seperator.{mod.Name}"
tag = f"unrealsdk.seperator.{mod.Name}"
caller.AddKeyBindEntry(tag, tag, mod.Name)
for GameInput in mod.Keybinds:
InputName, InputKey = GameInput
tag = f"bl2sdk.input.{mod.Name}.{InputName}"
tag = f"unrealsdk.input.{mod.Name}.{InputName}"
caller.AddKeyBindEntry(tag, tag, f" {InputName}")
return True

Expand Down Expand Up @@ -44,15 +44,15 @@ def HookOnPopulateKeys(caller: UObject, function: UFunction, params: FStruct) ->
translationContext = GetEngine().GamePlayers[0].GetTranslationContext()

for keyBind in caller.KeyBinds:
if keyBind.Tag.startswith("bl2sdk"):
if keyBind.Tag.startswith("bl2sdk.seperator"):
if keyBind.Tag.startswith("unrealsdk"):
if keyBind.Tag.startswith("unrealsdk.seperator"):
keyBind.Object.SetString("value", "")
keyBind.Object.SetVisible(False)
else:
for mod in getLoadedMods():
if mod.Name == keyBind.Tag.split('.')[2]:
for GameInput in mod.Keybinds:
if keyBind.Tag == f"bl2sdk.input.{mod.Name}.{GameInput[0]}":
if keyBind.Tag == f"unrealsdk.input.{mod.Name}.{GameInput[0]}":
keyBind.CurrentKey = GameInput[1]
if keyBind.CurrentKey != "None":
for mod in getLoadedMods():
Expand All @@ -74,7 +74,7 @@ def HookOnPopulateKeys(caller: UObject, function: UFunction, params: FStruct) ->

def HookBindCurrentSelection(caller: UObject, function: UFunction, params: FStruct) -> bool:
selectedKeyBind = caller.KeyBinds[caller.CurrentKeyBindSelection]
if selectedKeyBind.Tag.startswith("bl2sdk.seperator"):
if selectedKeyBind.Tag.startswith("unrealsdk.seperator"):
return False

PreviousKeyBinds = {bind.Tag: bind.CurrentKey for bind in caller.KeyBinds}
Expand All @@ -83,11 +83,11 @@ def HookBindCurrentSelection(caller: UObject, function: UFunction, params: FStru
caller.BindCurrentSelection(params.Key)

for bind in caller.KeyBinds:
if bind.Tag.startswith("bl2sdk") and bind.Tag in PreviousKeyBinds.keys() and PreviousKeyBinds[bind.Tag] != bind.CurrentKey:
if bind.Tag.startswith("unrealsdk") and bind.Tag in PreviousKeyBinds.keys() and PreviousKeyBinds[bind.Tag] != bind.CurrentKey:
for mod in getLoadedMods():
if mod.Name == bind.Tag.split('.')[2]:
for GameInput in mod.Keybinds:
if bind.Tag == f"bl2sdk.input.{mod.Name}.{GameInput[0]}":
if bind.Tag == f"unrealsdk.input.{mod.Name}.{GameInput[0]}":
GameInput[1] = bind.CurrentKey
mod.GameInputRebound(GameInput[0], bind.CurrentKey)

Expand All @@ -107,7 +107,7 @@ def HookBindCurrentSelection(caller: UObject, function: UFunction, params: FStru


def HookDoBind(caller: UObject, function: UFunction, params: FStruct) -> bool:
if caller.KeyBinds[caller.CurrentKeyBindSelection].Tag.startswith("bl2sdk.seperator"):
if caller.KeyBinds[caller.CurrentKeyBindSelection].Tag.startswith("unrealsdk.seperator"):
return False
return True

Expand Down
12 changes: 6 additions & 6 deletions Mods/Legacy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import bl2sdk
import unrealsdk
import os
import sys
import json
Expand Down Expand Up @@ -61,7 +61,7 @@ def Populate():
# We will be either locating or creating a mod object for this file.
mod = None
# Iterate over each existing mod in the menu.
for existingMod in bl2sdk.Mods:
for existingMod in unrealsdk.Mods:
# If the mod is a legacy mod and has the same file name as our
# own, we will be using that.
if type(existingMod) is LegacyMod and existingMod.Filename == filename:
Expand Down Expand Up @@ -281,7 +281,7 @@ def Execute(self):

# We will be looking up the object responsible for storing hotfixes.
micropatch = None
for service in bl2sdk.FindObject(
for service in unrealsdk.FindObject(
"GearboxAccountData", "Transient.GearboxAccountData_1"
).Services:
# If the service's name is "micropatch" then it is the hotfix
Expand All @@ -302,7 +302,7 @@ def Execute(self):
micropatch.Values = []

# Obtain the current player controller object.
playerController = bl2sdk.GetEngine().GamePlayers[0].Actor
playerController = unrealsdk.GetEngine().GamePlayers[0].Actor
try:
# Use the controller to perform a console command executing the
# legacy mod file. We wrap this in a `try` statement to suppress the
Expand Down Expand Up @@ -340,7 +340,7 @@ def SettingsInputPressed(self, name):
elif name == "Hide Mod":
LegacyMod.IgnoredFiles.add(self.Filename)
LegacyMod.SaveSettings()
bl2sdk.Mods.remove(self)
unrealsdk.Mods.remove(self)

# When the insert key is pressed, reset our list of ignored files, then
# re-populate the SDK's mods menu.
Expand All @@ -353,4 +353,4 @@ def SettingsInputPressed(self, name):
# On launch, load our settings.
LegacyMod.LoadSettings()
# Add a hook to populate the SDK's mod menu each time it is opened.
bl2sdk.ModMenuOpened.append(LegacyMod.Populate)
unrealsdk.ModMenuOpened.append(LegacyMod.Populate)
16 changes: 8 additions & 8 deletions Mods/ModManager.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import bl2sdk
import unrealsdk
import webbrowser
from enum import Enum
import sys
Expand Down Expand Up @@ -195,7 +195,7 @@ def getModModule(mod):
except AttributeError: continue
return modModule

bl2sdk.Mods = []
unrealsdk.Mods = []

def RegisterMod(mod: BL2MOD):
modModule = getModModule(mod)
Expand All @@ -208,7 +208,7 @@ def RegisterMod(mod: BL2MOD):
for optionName, optionValue in options.items():
for option in mod.Options:
if optionName in option.Caption:
if type(option) != bl2sdk.Options.Hidden:
if type(option) != unrealsdk.Options.Hidden:
if isinstance(optionValue, bool):
option.CurrentValue = optionValue
elif isinstance(optionValue, str):
Expand All @@ -222,10 +222,10 @@ def RegisterMod(mod: BL2MOD):
for GameInput in mod.Keybinds:
if keybindName == GameInput[0]:
GameInput[1] = str(keybind)
bl2sdk.Mods.append(mod)
unrealsdk.Mods.append(mod)


bl2sdk.BL2MOD = BL2MOD
bl2sdk.ModTypes = ModTypes
bl2sdk.ModMenuOpened = []
bl2sdk.RegisterMod = RegisterMod
unrealsdk.BL2MOD = BL2MOD
unrealsdk.ModTypes = ModTypes
unrealsdk.ModMenuOpened = []
unrealsdk.RegisterMod = RegisterMod
14 changes: 7 additions & 7 deletions Mods/ModMenuManager.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import bl2sdk
from bl2sdk import *
import unrealsdk
from unrealsdk import *
import mypy


Expand All @@ -15,7 +15,7 @@ def LoadModList(caller: UObject, function: UFunction, params: FStruct) -> bool:
caller.SetStoreHeader("Mods", 0, "By Abahbob", "Mod Manager")

translationContext = GetEngine().GamePlayers[0].GetTranslationContext()
for idx, mod in enumerate(bl2sdk.Mods):
for idx, mod in enumerate(unrealsdk.Mods):
obj, _ = caller.CreateMarketplaceItem(())
obj.SetString(caller.Prop_offeringId, str(idx), translationContext)
obj.SetString(caller.Prop_contentTitleText, mod.Name, translationContext)
Expand Down Expand Up @@ -65,7 +65,7 @@ def HookShopInputKey(caller: UObject, function: UFunction, params: FStruct) -> b
except:
return False

mod = bl2sdk.Mods[modIndex]
mod = unrealsdk.Mods[modIndex]

if key in mod.SettingsInputs:
if event == 0:
Expand Down Expand Up @@ -126,7 +126,7 @@ def ReplaceDLCWithMods(caller: UObject, function: UFunction, params: FStruct) ->
""" An efficient function that notifies us when we're in the main menu to populate the DLC menu. """

def HookMainMenuPopulateForMods(caller: UObject, function: UFunction, params: FStruct) -> bool:
for modFunc in bl2sdk.ModMenuOpened:
for modFunc in unrealsdk.ModMenuOpened:
try:
modFunc()
except:
Expand All @@ -153,7 +153,7 @@ def HookModSelected(caller: UObject, function: UFunction, params: FStruct) -> bo
except TypeError:
return

mod = bl2sdk.Mods[modIndex]
mod = unrealsdk.Mods[modIndex]

inputs = mod.SettingsInputs.copy()
inputs["Escape"] = "Cancel"
Expand All @@ -176,7 +176,7 @@ def HookModSelected(caller: UObject, function: UFunction, params: FStruct) -> bo
RunHook("WillowGame.MarketplaceGFxMovie.extOnOfferingChanged","HookModSelected", HookModSelected)

def HookContentMenu(caller: UObject, function: UFunction, params: FStruct) -> bool:
WPCOwner = bl2sdk.GetEngine().GamePlayers[0].Actor
WPCOwner = unrealsdk.GetEngine().GamePlayers[0].Actor
caller.CheckDownloadableContentListCompleted(WPCOwner.GetMyControllerId(), True)
return False

Expand Down
6 changes: 3 additions & 3 deletions Mods/OptionManager.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import bl2sdk
from bl2sdk import *
import unrealsdk
from unrealsdk import *
import json

from .Util import getLoadedMods
Expand Down Expand Up @@ -89,7 +89,7 @@ def CurrentValue(self, value):
storeModSettings()


bl2sdk.Options = Options
unrealsdk.Options = Options

""" This function adds the `PLUGINS` menu into the options menu. """

Expand Down
2 changes: 1 addition & 1 deletion Mods/Quickload/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from bl2sdk import *
from unrealsdk import *


class MapLoader(BL2MOD):
Expand Down
2 changes: 1 addition & 1 deletion Mods/ReadOnly/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from bl2sdk import *
from unrealsdk import *
from ..ModManager import BL2MOD, RegisterMod
import math

Expand Down
6 changes: 3 additions & 3 deletions Mods/SaveManager.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
import json
from bl2sdk import *
import bl2sdk
from unrealsdk import *
import unrealsdk
from .Util import getLoadedMods

from .OptionManager import *
Expand All @@ -16,7 +16,7 @@ def storeModSettings():
modSettings["Options"] = {}
modSettings["Keybinds"] = {}
for setting in mod.Options:
if type(setting) is bl2sdk.Options.Spinner:
if type(setting) is unrealsdk.Options.Spinner:
currentVal = setting.Choices[setting.Choices.index(setting.CurrentValue)]
modSettings["Options"].update( {setting.Caption : currentVal } )
else:
Expand Down
Loading