Skip to content
This repository was archived by the owner on Jan 1, 2025. It is now read-only.

Commit 16a3eaf

Browse files
authored
Rename from bl2sdk to unrealsdk (#60)
1 parent 1c7d972 commit 16a3eaf

39 files changed

+5896
-5896
lines changed

Mods/BackpackManager/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from bl2sdk import *
1+
from unrealsdk import *
22
from ..ModManager import BL2MOD, RegisterMod
33
from ..OptionManager import Options
44

Mods/Commander/__init__.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import bl2sdk
1+
import unrealsdk
22
import sys
33
import os
44
import math
@@ -74,9 +74,9 @@ def GameInputRebound(self, name, key):
7474

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

79-
DefaultGameInfo = bl2sdk.FindObject(
79+
DefaultGameInfo = unrealsdk.FindObject(
8080
"WillowCoopGameInfo", "WillowGame.Default__WillowCoopGameInfo"
8181
)
8282
"""A reference to the WillowCoopGameInfo template object."""
@@ -134,7 +134,7 @@ def HalveGameSpeed(self):
134134
speed = self.DefaultGameInfo.GameSpeed
135135
if speed > 0.0625:
136136
speed /= 2
137-
worldInfo = bl2sdk.GetEngine().GetCurrentWorldInfo()
137+
worldInfo = unrealsdk.GetEngine().GetCurrentWorldInfo()
138138
worldInfo.TimeDilation = speed
139139
self.DefaultGameInfo.GameSpeed = speed
140140
self.Feedback("Game Speed: " + str(Fraction(speed)))
@@ -143,21 +143,21 @@ def DoubleGameSpeed(self):
143143
speed = self.DefaultGameInfo.GameSpeed
144144
if speed < 32:
145145
speed *= 2
146-
worldInfo = bl2sdk.GetEngine().GetCurrentWorldInfo()
146+
worldInfo = unrealsdk.GetEngine().GetCurrentWorldInfo()
147147
worldInfo.TimeDilation = speed
148148
self.DefaultGameInfo.GameSpeed = speed
149149
self.Feedback("Game Speed: " + str(Fraction(speed)))
150150

151151
def ResetGameSpeed(self):
152-
worldInfo = bl2sdk.GetEngine().GetCurrentWorldInfo()
152+
worldInfo = unrealsdk.GetEngine().GetCurrentWorldInfo()
153153
worldInfo.TimeDilation = 1.0
154154
self.DefaultGameInfo.GameSpeed = 1.0
155155
self.Feedback("Game Speed: 1")
156156

157157
def ToggleHUD(self):
158158
self.ConsoleCommand("ToggleHUD")
159159

160-
DamageNumberEmitterObject = bl2sdk.FindObject(
160+
DamageNumberEmitterObject = unrealsdk.FindObject(
161161
"ParticleSystem", "FX_CHAR_Damage_Matrix.Particles.Part_Dynamic_Number"
162162
)
163163
DamageNumberEmitters = list(DamageNumberEmitterObject.Emitters)
@@ -190,7 +190,7 @@ def ToggleDamageNumbers(self):
190190
self.Feedback("Damage Numbers: Off")
191191

192192
def GetMapName(self):
193-
return bl2sdk.GetEngine().GetCurrentWorldInfo().GetMapName(True)
193+
return unrealsdk.GetEngine().GetCurrentWorldInfo().GetMapName(True)
194194

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

244244
def TogglePlayersOnly(self):
245245
# Get the current WorldInfo object from the engine.
246-
worldInfo = bl2sdk.GetEngine().GetCurrentWorldInfo()
246+
worldInfo = unrealsdk.GetEngine().GetCurrentWorldInfo()
247247
# Get the WorldInfo's current players only state.
248248
playersOnly = worldInfo.bPlayersOnly
249249

Mods/General/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from importlib import reload
33
from sys import modules
44

5-
import bl2sdk
5+
import unrealsdk
66

77
class DefaultMod(BL2MOD):
88

@@ -20,7 +20,7 @@ def SettingsInputPressed(self, name):
2020
for mod in list(modules.keys()):
2121
if mod.startswith('Mods.'):
2222
del modules[mod]
23-
bl2sdk.Mods = []
23+
unrealsdk.Mods = []
2424
modules["Mods"] = reload(modules["Mods"])
2525
elif name == "Help":
2626
webbrowser.open("https://github.com/bl-sdk/BL2-Python-Plugins/wiki")

Mods/Grenadoer/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import bl2sdk
1+
import unrealsdk
22

33
from ..ModManager import BL2MOD, RegisterMod
44

@@ -19,11 +19,11 @@ def GameInputPressed(self, input):
1919
pressed in-game."""
2020
if input.Name == "Swap Grenade":
2121
inventoryManager = (
22-
bl2sdk.GetEngine().GamePlayers[0].Actor.GetPawnInventoryManager()
22+
unrealsdk.GetEngine().GamePlayers[0].Actor.GetPawnInventoryManager()
2323
)
2424
for inventory in inventoryManager.Backpack:
2525
if (
26-
inventory.Class == bl2sdk.FindClass("WillowGrenadeMod")
26+
inventory.Class == unrealsdk.FindClass("WillowGrenadeMod")
2727
and inventory.Mark == 2
2828
):
2929
inventoryManager.ReadyBackpackInventory(inventory, 0)

Mods/KeybindManager.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import bl2sdk
2-
from bl2sdk import *
1+
import unrealsdk
2+
from unrealsdk import *
33
from collections import namedtuple
44

55
from .Util import getLoadedMods
@@ -11,11 +11,11 @@
1111
def HookInitKeyBinding(caller: UObject, function: UFunction, params: FStruct) -> bool:
1212
for mod in getLoadedMods():
1313
if mod.Keybinds:
14-
tag = f"bl2sdk.seperator.{mod.Name}"
14+
tag = f"unrealsdk.seperator.{mod.Name}"
1515
caller.AddKeyBindEntry(tag, tag, mod.Name)
1616
for GameInput in mod.Keybinds:
1717
InputName, InputKey = GameInput
18-
tag = f"bl2sdk.input.{mod.Name}.{InputName}"
18+
tag = f"unrealsdk.input.{mod.Name}.{InputName}"
1919
caller.AddKeyBindEntry(tag, tag, f" {InputName}")
2020
return True
2121

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

4646
for keyBind in caller.KeyBinds:
47-
if keyBind.Tag.startswith("bl2sdk"):
48-
if keyBind.Tag.startswith("bl2sdk.seperator"):
47+
if keyBind.Tag.startswith("unrealsdk"):
48+
if keyBind.Tag.startswith("unrealsdk.seperator"):
4949
keyBind.Object.SetString("value", "")
5050
keyBind.Object.SetVisible(False)
5151
else:
5252
for mod in getLoadedMods():
5353
if mod.Name == keyBind.Tag.split('.')[2]:
5454
for GameInput in mod.Keybinds:
55-
if keyBind.Tag == f"bl2sdk.input.{mod.Name}.{GameInput[0]}":
55+
if keyBind.Tag == f"unrealsdk.input.{mod.Name}.{GameInput[0]}":
5656
keyBind.CurrentKey = GameInput[1]
5757
if keyBind.CurrentKey != "None":
5858
for mod in getLoadedMods():
@@ -74,7 +74,7 @@ def HookOnPopulateKeys(caller: UObject, function: UFunction, params: FStruct) ->
7474

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

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

8585
for bind in caller.KeyBinds:
86-
if bind.Tag.startswith("bl2sdk") and bind.Tag in PreviousKeyBinds.keys() and PreviousKeyBinds[bind.Tag] != bind.CurrentKey:
86+
if bind.Tag.startswith("unrealsdk") and bind.Tag in PreviousKeyBinds.keys() and PreviousKeyBinds[bind.Tag] != bind.CurrentKey:
8787
for mod in getLoadedMods():
8888
if mod.Name == bind.Tag.split('.')[2]:
8989
for GameInput in mod.Keybinds:
90-
if bind.Tag == f"bl2sdk.input.{mod.Name}.{GameInput[0]}":
90+
if bind.Tag == f"unrealsdk.input.{mod.Name}.{GameInput[0]}":
9191
GameInput[1] = bind.CurrentKey
9292
mod.GameInputRebound(GameInput[0], bind.CurrentKey)
9393

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

108108

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

Mods/Legacy/__init__.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import bl2sdk
1+
import unrealsdk
22
import os
33
import sys
44
import json
@@ -61,7 +61,7 @@ def Populate():
6161
# We will be either locating or creating a mod object for this file.
6262
mod = None
6363
# Iterate over each existing mod in the menu.
64-
for existingMod in bl2sdk.Mods:
64+
for existingMod in unrealsdk.Mods:
6565
# If the mod is a legacy mod and has the same file name as our
6666
# own, we will be using that.
6767
if type(existingMod) is LegacyMod and existingMod.Filename == filename:
@@ -281,7 +281,7 @@ def Execute(self):
281281

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

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

345345
# When the insert key is pressed, reset our list of ignored files, then
346346
# re-populate the SDK's mods menu.
@@ -353,4 +353,4 @@ def SettingsInputPressed(self, name):
353353
# On launch, load our settings.
354354
LegacyMod.LoadSettings()
355355
# Add a hook to populate the SDK's mod menu each time it is opened.
356-
bl2sdk.ModMenuOpened.append(LegacyMod.Populate)
356+
unrealsdk.ModMenuOpened.append(LegacyMod.Populate)

Mods/ModManager.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import bl2sdk
1+
import unrealsdk
22
import webbrowser
33
from enum import Enum
44
import sys
@@ -195,7 +195,7 @@ def getModModule(mod):
195195
except AttributeError: continue
196196
return modModule
197197

198-
bl2sdk.Mods = []
198+
unrealsdk.Mods = []
199199

200200
def RegisterMod(mod: BL2MOD):
201201
modModule = getModModule(mod)
@@ -208,7 +208,7 @@ def RegisterMod(mod: BL2MOD):
208208
for optionName, optionValue in options.items():
209209
for option in mod.Options:
210210
if optionName in option.Caption:
211-
if type(option) != bl2sdk.Options.Hidden:
211+
if type(option) != unrealsdk.Options.Hidden:
212212
if isinstance(optionValue, bool):
213213
option.CurrentValue = optionValue
214214
elif isinstance(optionValue, str):
@@ -222,10 +222,10 @@ def RegisterMod(mod: BL2MOD):
222222
for GameInput in mod.Keybinds:
223223
if keybindName == GameInput[0]:
224224
GameInput[1] = str(keybind)
225-
bl2sdk.Mods.append(mod)
225+
unrealsdk.Mods.append(mod)
226226

227227

228-
bl2sdk.BL2MOD = BL2MOD
229-
bl2sdk.ModTypes = ModTypes
230-
bl2sdk.ModMenuOpened = []
231-
bl2sdk.RegisterMod = RegisterMod
228+
unrealsdk.BL2MOD = BL2MOD
229+
unrealsdk.ModTypes = ModTypes
230+
unrealsdk.ModMenuOpened = []
231+
unrealsdk.RegisterMod = RegisterMod

Mods/ModMenuManager.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import bl2sdk
2-
from bl2sdk import *
1+
import unrealsdk
2+
from unrealsdk import *
33
import mypy
44

55

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

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

68-
mod = bl2sdk.Mods[modIndex]
68+
mod = unrealsdk.Mods[modIndex]
6969

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

128128
def HookMainMenuPopulateForMods(caller: UObject, function: UFunction, params: FStruct) -> bool:
129-
for modFunc in bl2sdk.ModMenuOpened:
129+
for modFunc in unrealsdk.ModMenuOpened:
130130
try:
131131
modFunc()
132132
except:
@@ -153,7 +153,7 @@ def HookModSelected(caller: UObject, function: UFunction, params: FStruct) -> bo
153153
except TypeError:
154154
return
155155

156-
mod = bl2sdk.Mods[modIndex]
156+
mod = unrealsdk.Mods[modIndex]
157157

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

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

Mods/OptionManager.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import bl2sdk
2-
from bl2sdk import *
1+
import unrealsdk
2+
from unrealsdk import *
33
import json
44

55
from .Util import getLoadedMods
@@ -89,7 +89,7 @@ def CurrentValue(self, value):
8989
storeModSettings()
9090

9191

92-
bl2sdk.Options = Options
92+
unrealsdk.Options = Options
9393

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

Mods/Quickload/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from bl2sdk import *
1+
from unrealsdk import *
22

33

44
class MapLoader(BL2MOD):

0 commit comments

Comments
 (0)