def _on_main_menu(caller: unrealsdk.UObject, function: unrealsdk.UFunction, params: unrealsdk.FStruct) -> bool: unrealsdk.RegisterMod(_OptionsWrapper()) unrealsdk.RemoveHook("WillowGame.FrontendGFxMovie.Start", "OptionsWrapper") return True
def _OnMainMenu(caller: unrealsdk.UObject, function: unrealsdk.UFunction, params: unrealsdk.FStruct) -> bool: instance = _AsyncUtil() unrealsdk.RegisterMod(instance) if __name__ == "__main__": for i in range(len(unrealsdk.Mods)): if unrealsdk.Mods[i].Name == instance.Name: unrealsdk.Mods.remove(instance) unrealsdk.Mods[i] = instance break unrealsdk.RemoveHook("WillowGame.FrontendGFxMovie.Start", "AsyncUtil") return True
self.old_z = pc.Pawn.Location.Z return True @Hook("WillowGame.WillowPlayerInput.DuckPressed") def handle_duck(self, caller: unrealsdk.UObject, function: unrealsdk.UFunction, params: unrealsdk.FStruct): pc = bl2tools.get_player_controller() self.old_z = pc.Pawn.Location.Z if pc.bInSprintState: self.slide_duration = 2.0 if pc.bCrouchToggle: if caller.bHoldDuck: self.b_update = True caller.bHoldDuck = False pc.bDuck = 0 return False else: self.b_update = True caller.bHoldDuck = True pc.bDuck = 1 return False else: self.b_update = True pc.bDuck = 1 return False else: return True unrealsdk.RegisterMod(Sliding())
if os.path.exists(self.ENABLED_FILE): self.Status = "Enabled" self.SettingsInputs["Enter"] = "Disable" self.Enable() def Enable(self) -> None: def BlockCall(caller: unrealsdk.UObject, function: unrealsdk.UFunction, params: unrealsdk.FStruct) -> bool: return False unrealsdk.RegisterHook("WillowGame.FrontendGFxMovie.ShowMOTD", "AdBlock", BlockCall) unrealsdk.RegisterHook( "WillowGame.WillowPlayerController.CanAcessOakUpsell", "AdBlock", BlockCall) open(self.ENABLED_FILE, "a").close() def Disable(self) -> None: try: os.remove(self.ENABLED_FILE) except FileNotFoundError: pass unrealsdk.RemoveHook("WillowGame.FrontendGFxMovie.ShowMOTD", "AdBlock") unrealsdk.RemoveHook( "WillowGame.WillowPlayerController.CanAcessOakUpsell", "AdBlock") unrealsdk.RegisterMod(NoAds())
Name = "PyImgui" Author = "Juso" Version = pyd_imgui.__version__ Description = "A library with pybinds for Imgui." Types = ModTypes.Library Priority = ModPriorities.Library SettingsInputs = {} Status = "Enabled" if _d3d9_success else "Error" def Enable(self) -> None: super().Enable() global color_scheme color_scheme = self.Options[0].CurrentValue Options = [_color_styles] def ModOptionChanged(self, option: OptionManager.Options.Base, new_value: Any) -> None: global color_scheme color_scheme = new_value _instance = GUI() unrealsdk.RegisterMod(GUI()) _instance.Enable() if not _d3d9_success: Exception("Something went wrong while hooking DX9!")
if cmd == "exec": binaries = self.FILE_PATH while os.path.basename(binaries).lower() != "binaries": binaries = os.path.abspath(os.path.join(binaries, "..")) exec_file = os.path.join( binaries, args[1].lstrip("/").lstrip("\\")) # this is case-sensitive if not os.path.isfile(exec_file): # we could not find the file return True with open(exec_file) as fp: for line in fp: # type: str if line.lower().startswith("set") \ and unrealsdk.FindObject("MaterialInstanceConstant", line.split()[1]) is not None: try: _exec_skins(line) except Exception as e: unrealsdk.Log(e) elif cmd == "set": if len(args) >= 4: if unrealsdk.FindObject("MaterialInstanceConstant", args[1]) is not None: _exec_skins(params.Command) return True if __name__.startswith("Mods"): SkinFixInstance = SkinFix() unrealsdk.RegisterMod(SkinFixInstance) RegisterHooks(SkinFixInstance)
"How often should loot be dropped from the same Lootpool.", 1, 0, 100, 1), ] def __init__(self): self.multiplier = 0 def Enable(self): def Loot(caller: UObject, function: UFunction, params: FStruct) -> bool: for _ in range(self.multiplier): unrealsdk.DoInjectedCallNext() caller.DropLootOnDeath(params.Killer, params.DamageType, params.DamageTypeDefinition) return True unrealsdk.RegisterHook("WillowGame.WillowPawn.DropLootOnDeath", "LootHook", Loot) def Disable(self): unrealsdk.RemoveHook("WillowGame.WillowPawn.DropLootOnDeath", "LootHook") def ModOptionChanged(self, option, newValue): if option in self.Options: if option.Caption == "Drop Multiplier": self.multiplier = newValue unrealsdk.RegisterMod(DropChanceMultiplier())
unrealsdk.RegisterHook("WillowGame.WillowPawn.TakeDamage", "TakeDamageHook", PawnDamageHook) def Disable(self): unrealsdk.RemoveHook("WillowGame.WillowPawn.Died", "KillHook") unrealsdk.RemoveHook("WillowGame.WillowPawn.TakeDamage", "TakeDamageHook") BBInstance = Bossbar() def KilledHook(caller: unrealsdk.UObject, function: unrealsdk.UFunction, params: unrealsdk.FStruct) -> bool: BBInstance.HandleKill(caller, function, params) return True def PawnDamageHook(caller: unrealsdk.UObject, function: unrealsdk.UFunction, params: unrealsdk.FStruct) -> bool: if BBInstance.boss_pawn is None: if caller.IsChampion() or caller.IsBoss(): BBInstance.boss_pawn = caller BBInstance.InitBar() # elif BBInstance.bar_active: # GetEngine().GetCurrentWorldInfo().GRI.UpdateBossBarInfo() return True unrealsdk.RegisterMod(BBInstance)
if len(file.split()) > 1: cls = str(file.split()[0]) obj = os.path.splitext(str(file.split()[1]))[0] WeaponType = FindObject(cls, obj) with open(os.path.join(root, file), "r") as f: settings = json.load(f) self.change_MeshFOV( settings["FirstPersonMeshFOV"], WeaponType) for attr, value in settings.items(): try: self.change_ViewOffset( attr, value, WeaponType) except: pass else: with open(os.path.join(root, file), "r") as f: settings = json.load(f) for attr, value in settings.items(): try: self.change_RelativeRotation( attr, value) except: pass unrealsdk.RegisterMod(Viewmodel()) # IronsightsRotation (Pitch=425,Yaw=-603,Roll=-128) WillowPlayerPawn # Use this for an inspection mod
with open(os.path.join(self.path, "Maps", f"{name}.json")) as fp: map_dict: dict = json.load(fp) return list(map_dict.keys()) return [] def load_map(self, name: str, curr_map: str) -> None: """ Load a custom map from a given .json file. :param name: The name of the .json map file. :return: """ if os.path.isfile(os.path.join(self.path, "Maps", f"{name}.json")): with open(os.path.join(self.path, "Maps", f"{name}.json")) as fp: map_dict = json.load(fp) else: unrealsdk.Log( f"Map {os.path.join(self.path, 'Maps', f'{name}.json')} does not exist!" ) return load_this = map_dict.get(curr_map, None) if not load_this: # No Map data for currently loaded map found! return placeablehelper.load_map( load_this) # Finally, load the actual map from data dict unrealsdk.RegisterMod(MapLoader())
def event(caller: unrealsdk.UObject, function: unrealsdk.UFunction, params: unrealsdk.FStruct) -> bool: if caller.Group: for acts in caller.Group.TalkActs: try: for data in acts.TalkData: data.TalkAkEvent = random.choice(self.ak_events) except: pass return True unrealsdk.RegisterHook("WillowGame.WillowDialogAct_Talk.Activate", f"{__file__}Talk", talk) unrealsdk.RegisterHook( "GearboxFramework.Behavior_TriggerDialogEvent.ApplyBehaviorToContext", f"{__file__}Event", event) unrealsdk.RegisterHook("WillowGame.WillowHUD.CreateWeaponScopeMovie", f"{__file__}TalkMapLoaded", map_loaded) def Disable(self): unrealsdk.RemoveHook("WillowGame.WillowDialogAct_Talk.Activate", f"{__file__}Talk") unrealsdk.RemoveHook( "GearboxFramework.Behavior_TriggerDialogEvent.ApplyBehaviorToContext", f"{__file__}Event") unrealsdk.RemoveHook("WillowGame.WillowHUD.CreateWeaponScopeMovie", f"{__file__}TalkMapLoaded") unrealsdk.RegisterMod(DialogRando())
Version: str = "1.2" Types = unrealsdk.ModTypes.Utility Description: str = "Adds a keybind option to the game that allows you to teleport all loot on the ground to your " \ f"current location. By default the key is binded to ENTER.\n\n{Version}" Author: str = "Juso" Keybinds: List[KeybindManager.Keybind] = [KeybindManager.Keybind("Teleport Loot To Me", Key="Enter")] SaveEnabledState: EnabledSaveType = EnabledSaveType.LoadWithSettings def GameInputPressed(self, bind: KeybindManager.Keybind, event: KeybindManager.InputEvent) -> None: if event != KeybindManager.InputEvent.Released: return if bind.Name == "Teleport Loot To Me": pawn = get_player_controller().Pawn location = (pawn.Location.X, pawn.Location.Y, pawn.Location.Z) for Pickup in get_player_controller().GetWillowGlobals().PickupList: Pickup.Location = location Pickup.AdjustPickupPhysicsAndCollisionForBeingDropped() lst: List[float, float, float] = list(location) lst[2] += 10 location = tuple(lst) def Enable(self): super().Enable() def Disable(self): super().Disable() unrealsdk.RegisterMod(BGOOBL())
PC.ConsoleCommand("set " + Move + " AnimName Melee", 0) PC.ConsoleCommand( "set " + Move + " EndingCondition EC_OnBlendOut", 0) PC.ConsoleCommand("set " + Move + " AnimSet None", 0) PC.ConsoleCommand("camera 1st", 0) PC.Behavior_Melee() unrealsdk.GetEngine().GetCurrentWorldInfo( ).MyEmitterPool.ClearAllPoolComponents() def GameInputPressed(self, input): if input.Name == "Next Emote": self._animation += 1 self.FeedbackEmote() elif input.Name == "Previous Emote": self._animation -= 1 self.FeedbackEmote() if input.Name == "Play Emote": self.PlayEmote() if input.Name == "Stop Emote": self.StopEmote() def Enable(self): self.ForceLoad() def Disable(self): pass unrealsdk.RegisterMod(Emotes())
return True unrealsdk.RegisterHook( "WillowGame.WillowDamageTypeDefinition.DisplayRecentDamageForPlayer", "TrueDamageLogger", DisplayRecentDamageForPlayer) def Disable(self) -> None: unrealsdk.RemoveHook( "WillowGame.WillowDamageTypeDefinition.DisplayRecentDamageForPlayer", "TrueDamageLogger") instance = TrueDamageLogger() if __name__ != "__main__": unrealsdk.RegisterMod(instance) else: unrealsdk.Log(f"[{instance.Name}] Manually loaded") for i in range(len(unrealsdk.Mods)): mod = unrealsdk.Mods[i] if unrealsdk.Mods[i].Name == instance.Name: unrealsdk.Mods[i].Disable() unrealsdk.RegisterMod(instance) unrealsdk.Mods.remove(instance) unrealsdk.Mods[i] = instance unrealsdk.Log( f"[{instance.Name}] Disabled and removed last instance") break else: unrealsdk.Log(f"[{instance.Name}] Could not find previous instance")
if self.CurrentlyEnabledChild is not None: self.DisableChild(self.CurrentlyEnabledChild) self.CurrentlyEnabledChild = child child.Status = "Enabled" child.SettingsInputs["Enter"] = "Disable" child.Enable() def DisableChild(self, child: SideMissionRandomizerChild) -> None: child.Status = "Disabled" child.SettingsInputs["Enter"] = "Enable" # Just in case for some reason this isn't the same as 'child' if self.CurrentlyEnabledChild is not None: self.CurrentlyEnabledChild.Status = "Disabled" self.CurrentlyEnabledChild.SettingsInputs["Enter"] = "Enable" self.CurrentlyEnabledChild = None self.RevertMissionsToDefaults() def RemoveChild(self, child: SideMissionRandomizerChild) -> None: if self.CurrentlyEnabledChild == child: self.DisableChild(child) unrealsdk.Mods.remove(child) self.SeedInfo.remove(child.SMRSeed) self.SaveSeedInfo() SMRParent: SideMissionRandomizerParent = SideMissionRandomizerParent() unrealsdk.RegisterMod(SMRParent)
@Hook("WillowGame.VehicleSpawnStationTerminal.UnlockForOtherUsers") def EndLoad(self, caller: unrealsdk.UObject, function: unrealsdk.UFunction, params: unrealsdk.FStruct) -> bool: self.calc_driver_cam() return True def GameInputPressed(self, bind: KeybindManager.Keybind): if bind.Name == "Driver Cam": self.is_first_person = not self.is_first_person self.calc_driver_cam() def calc_driver_cam(self): pc = bl2tools.get_player_controller() if pc and pc.Pawn: vh = bl2tools.get_obj_path_name(pc.CharacterClass).lower() if not self.is_first_person: vh = "default" for char, data in self.settings.items(): if char not in vh: continue for cam, attrs in data.items(): if not unrealsdk.FindObject("PassengerCameraDefinition", cam): continue for att in attrs: bl2tools.console_command(f"set {cam} {att}") unrealsdk.RegisterMod(FPDriver())
f" - Multiplayer does not work;\n" \ f"<font color=\"#A83232\">Note</font>:" \ f" Do not activate the <font color=\"#D9CA27\">'Fewer Cutscenes'</font>" \ f" .ini edit in BLCMM> Tools> Setup Game Files for Mods! This will disable many 'hotfix'" \ f" like features from Exodus, including the loading of your items.\n\n" \ f"Same goes for the <font color=\"#D9CA27\">'-nomoviestartup'</font>" \ f" flag that you can set to BL2 Launch Options in Steam," \ f" do not use this." title = f"{self.Name} V.:{self.Version} Notes" pc.GFxUIManager.ShowTrainingDialog(version_notes, title, 4) @staticmethod def check_willow_engine_ini() -> bool: ini_path = os.path.join(os.path.expanduser("~"), "Documents", "my games", "Borderlands 2", "WillowGame", "Config") try: with open(os.path.join(ini_path, "WillowEngine.ini"), "r") as f: for line in f: if "bforcenomovies=true" in line.lower(): return False return True except Exception as e: unrealsdk.Log(e) return True if __name__.startswith("Mods"): unrealsdk.RegisterMod(ConstructorMain())