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

Commit 31f68eb

Browse files
authored
Rando v2 (#19)
* Improve rando significantly * Improve naming
1 parent e479c66 commit 31f68eb

File tree

7 files changed

+465
-368
lines changed

7 files changed

+465
-368
lines changed

Python/init.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import bl2sdk
2+
import os
23

34
def log(s):
45
s = str(s)
@@ -7,6 +8,9 @@ def log(s):
78
bl2sdk.Log(s)
89
print = log
910

11+
if os.getcwd().split('\\')[-1] == 'Win32':
12+
os.chdir(os.getcwd() + '\\Plugins\\Python')
13+
1014
class BL2MOD():
1115
_Enabled = False
1216
Name = ""
@@ -21,8 +25,7 @@ def Disable(self):
2125
bl2sdk.BL2MOD = BL2MOD
2226
bl2sdk.Mods = []
2327

24-
# import commander_wannabe
25-
# import rando
28+
import randomizer
2629

2730
def LoadModList(caller, function, parms, result):
2831
caller.SetStoreHeader("Mods", 0, "By Abahbob", "Mod Manager")
@@ -37,15 +40,15 @@ def LoadModList(caller, function, parms, result):
3740
caller.PostContentLoaded(True)
3841
return False
3942

40-
# bl2sdk.RemoveEngineHook("Function WillowGame.MarketplaceGFxMovie.OnDownloadableContentListRead", "InjectMods")
41-
# bl2sdk.RegisterEngineHook("Function WillowGame.MarketplaceGFxMovie.OnDownloadableContentListRead", "InjectMods", LoadModList)
43+
bl2sdk.RemoveEngineHook("WillowGame.MarketplaceGFxMovie.OnDownloadableContentListRead", "InjectMods")
44+
bl2sdk.RegisterEngineHook("WillowGame.MarketplaceGFxMovie.OnDownloadableContentListRead", "InjectMods", LoadModList)
4245

4346
def process_hook(caller, function, parms, result):
4447
pc = bl2sdk.GetEngine().GamePlayers[0]
4548
ControllerId = parms.popInt()
4649
ukey = parms.popFName()
4750
event = parms.popByte()
48-
if ukey.GetName() == 'Enter':
51+
if ukey == 'Enter':
4952
if event == 0:
5053
selected_object = caller.GetSelectedObject()
5154
mod = selected_object.GetString(caller.Prop_offeringId)
@@ -62,8 +65,8 @@ def process_hook(caller, function, parms, result):
6265
return False
6366
return True
6467

65-
# bl2sdk.RemoveEngineHook("Function WillowGame.MarketplaceGFxMovie.ShopInputKey", "OpenModMenu")
66-
# bl2sdk.RegisterEngineHook("Function WillowGame.MarketplaceGFxMovie.ShopInputKey", "OpenModMenu", process_hook)
68+
bl2sdk.RemoveEngineHook("WillowGame.MarketplaceGFxMovie.ShopInputKey", "OpenModMenu")
69+
bl2sdk.RegisterEngineHook("WillowGame.MarketplaceGFxMovie.ShopInputKey", "OpenModMenu", process_hook)
6770

6871

6972
def ReplaceDLCWithMods(caller, stack, result, function):
@@ -73,18 +76,17 @@ def ReplaceDLCWithMods(caller, stack, result, function):
7376
bNew = stack.popULong()
7477
if Caption == "$WillowMenu.WillowScrollingListDataProviderFrontEnd.DLC":
7578
Caption = "MODS"
76-
print(Caption)
7779
caller.AddListItem(EventID, Caption, bDisabled, bNew)
7880
stack.SkipFunction()
7981
return False
8082

8183

8284
def HookMainMenuPopulateForMods(caller, stack, result, function):
83-
bl2sdk.RegisterScriptHook("Function WillowGame.WillowScrollingList.AddListItem", "ReplaceDLCWithMods", ReplaceDLCWithMods)
85+
bl2sdk.RegisterScriptHook("WillowGame.WillowScrollingList.AddListItem", "ReplaceDLCWithMods", ReplaceDLCWithMods)
8486
caller.Populate(stack.popObject())
85-
bl2sdk.RemoveScriptHook("Function WillowGame.WillowScrollingList.AddListItem", "ReplaceDLCWithMods")
87+
bl2sdk.RemoveScriptHook("WillowGame.WillowScrollingList.AddListItem", "ReplaceDLCWithMods")
8688
stack.SkipFunction()
8789
return False
8890

89-
# bl2sdk.RemoveEngineHook("Function WillowGame.WillowScrollingListDataProviderFrontEnd.Populate", "HookMainMenuPopulateForMods")
90-
# bl2sdk.RegisterScriptHook("Function WillowGame.WillowScrollingListDataProviderFrontEnd.Populate", "HookMainMenuPopulateForMods", HookMainMenuPopulateForMods)
91+
bl2sdk.RemoveEngineHook("WillowGame.WillowScrollingListDataProviderFrontEnd.Populate", "HookMainMenuPopulateForMods")
92+
bl2sdk.RegisterScriptHook("WillowGame.WillowScrollingListDataProviderFrontEnd.Populate", "HookMainMenuPopulateForMods", HookMainMenuPopulateForMods)

Python/rando.py

Lines changed: 0 additions & 317 deletions
This file was deleted.

0 commit comments

Comments
 (0)