diff --git a/CHANGELOG.md b/CHANGELOG.md index 66a2a20..231daec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,17 @@ The format is based on [Keep a Changelog][keep a changelog] and this project adh ## [Released] +## [0.4.0] - 2021-03-25 + +### Added +- getCurrentWorldInfo function +- getCurrentGameInfo function +- getSkillManager function +- getActionSkill function +- getVaultHunterClassName function +- missing functions to all array + + ## [0.3.2] - 2021-03-22 ### Added @@ -67,6 +78,7 @@ The format is based on [Keep a Changelog][keep a changelog] and this project adh [unreleased]: https://github.com/RLNT/bl2_eridium/compare/v1.0.0...HEAD [released]: https://github.com/RLNT/bl2_eridium/releases +[0.4.0]: https://github.com/RLNT/bl2_eridium/compare/v0.3.2...v0.4.0 [0.3.2]: https://github.com/RLNT/bl2_eridium/compare/v0.3.1...v0.3.2 [0.3.1]: https://github.com/RLNT/bl2_eridium/compare/v0.3.0...v0.3.1 [0.3.0]: https://github.com/RLNT/bl2_eridium/compare/v0.2.0...v0.3.0 diff --git a/__init__.py b/__init__.py index c05c44c..ab90ddc 100644 --- a/__init__.py +++ b/__init__.py @@ -2,7 +2,7 @@ import unrealsdk import sys import webbrowser -from typing import Any, Dict, cast +from typing import Any, Dict, Optional, cast from Mods.EridiumLib import debug, keys from Mods.EridiumLib.keys import KeyBinds @@ -40,8 +40,14 @@ "log", "isClient", "getCurrentPlayerController", + "getCurrentWorldInfo", + "getCurrentGameInfo", + "getSkillManager", + "getActionSkill", + "getVaultHunterClassName", + "getLatestVersion", + "isLatestRelease", "EridiumMod", - "missions", "keys", "debug", # redistributed modules @@ -52,7 +58,7 @@ "socket", "ssl", ] -__version__ = "0.3.2" +__version__ = "0.4.0" def log(mod: SDKMod, *args: Any) -> None: @@ -69,6 +75,45 @@ def getCurrentPlayerController() -> unrealsdk.UObject: return cast(unrealsdk.UObject, unrealsdk.GetEngine().GamePlayers[0].Actor) +def getCurrentWorldInfo() -> unrealsdk.UObject: + """Returns the current world info.""" + return cast(unrealsdk.UObject, unrealsdk.GetEngine().GetCurrentWorldInfo()) + + +def getCurrentGameInfo() -> unrealsdk.UObject: + """Returns the current game info.""" + return cast(unrealsdk.UObject, getCurrentWorldInfo().Game) + + +def getSkillManager() -> unrealsdk.UObject: + """Returns the global skill manager from the game info.""" + return cast(unrealsdk.UObject, getCurrentGameInfo().GetSkillManager()) + + +def getActionSkill(PC: Optional[unrealsdk.UObject] = None) -> unrealsdk.UObject: + """ + Returns the action skill of a player controller. + A player controller can be passed in. + If no player controller is passed in, the local player will be used. + """ + if PC is None: + PC = getCurrentPlayerController() + + return cast(unrealsdk.UObject, PC.PlayerSkillTree.GetActionSkill()) + + +def getVaultHunterClassName(PC: Optional[unrealsdk.UObject] = None) -> str: + """ + Returns the class name of a Vault Hunter of a player controller. + A player controller can be passed in. + If no player controller is passed in, the local player will be used. + """ + if PC is None: + PC = getCurrentPlayerController() + + return str(PC.PlayerClass.CharacterNameId.CharacterClassId.ClassName) + + def getLatestVersion(repo: str) -> str: response = requests.get(f"https://api.github.com/repos/{repo}/releases") response.raise_for_status() diff --git a/modinfo.json b/modinfo.json index faf9d91..4722747 100644 --- a/modinfo.json +++ b/modinfo.json @@ -1,28 +1,26 @@ { - "mods": [ - { - "name": "EridiumLib", - "authors": ["Chronophylos", "Relentless"], - "description": [ - "Holds utility functions for some mods.\n", - "\n", - "Everything related to versions and their release notes can be found in the [changelog](https://github.com/RLNT/bl2_eridium/blob/main/CHANGELOG.md).\n", - "If you found a bug or you have a feature request, please use our issue tracker linked below.\n", - "In case you need support, please join our [Discord](https://discordapp.com/invite/Q3qxws6)." - ], - "tagline": "Holds utility functions for some mods.", - "types": ["Library"], - "supports": ["BL2", "TPS"], - "issues": "https://github.com/RLNT/bl2_eridium/issues", - "source": "https://github.com/RLNT/bl2_eridium", - "latest": "0.3.2", - "versions": { - "0.3.2": "https://github.com/RLNT/bl2_eridium/releases/tag/v0.3.2" - }, - "license": [ - "GNU Lesser General Public License v2.1", - "https://github.com/RLNT/bl2_eridium/blob/main/LICENSE" - ] - } - ] + "mods": [ + { + "name": "EridiumLib", + "authors": ["Chronophylos", "Relentless"], + "description": [ + "Holds utility functions for some mods.\n", + "\n", + "Everything related to versions and their release notes can be found in the [changelog](https://github.com/RLNT/bl2_eridium/blob/main/CHANGELOG.md).\n", + "If you found a bug or you have a feature request, please use our issue tracker linked below.\n", + "In case you need support, please join our [Discord](https://discordapp.com/invite/Q3qxws6)." + ], + "tagline": "Holds utility functions for some mods.", + "types": ["Library"], + "supports": ["BL2", "TPS"], + "issues": "https://github.com/RLNT/bl2_eridium/issues", + "source": "https://github.com/RLNT/bl2_eridium", + "latest": "0.4.0", + "versions": { + "0.4.0": "https://github.com/RLNT/bl2_eridium/releases/tag/v0.4.0", + "0.3.2": "https://github.com/RLNT/bl2_eridium/releases/tag/v0.3.2" + }, + "license": ["GNU Lesser General Public License v2.1", "https://github.com/RLNT/bl2_eridium/blob/main/LICENSE"] + } + ] }