wmwpy package¶
Subpackages¶
- wmwpy.classes package
- Subpackages
- Submodules
- wmwpy.classes.level module
- wmwpy.classes.object module
ObjectObject.HDObject.TabHDObject.spritesObject.shapesObject.UVsObject.VertIndicesObject.defaultPropertiesObject.propertiesObject.nameObject.idObject.frameObject.object_packObject.scaleObject.PhotoImageObject.SAFE_MODEObject.TypeObject.backgroundObject.background_PhotoImageObject.copy()Object.export()Object.filenameObject.foregroundObject.foreground_PhotoImageObject.frameObject.getAnimation()Object.getLevelXML()Object.getOffset()Object.getProperties()Object.imageObject.offsetObject.readXML()Object.rotateImage()Object.rotatePoint()Object.saveGIF()Object.scaleObject.setProperty()Object.typeObject.updateProperties()
Shape
- wmwpy.classes.sprite module
SpriteSprite.HDSprite.TabHDSprite.propertiesSprite.animationsSprite.scaleSprite.AnimationSprite.SAFE_MODESprite.TEMPLATESprite.angleSprite.animationSprite.export()Sprite.filenameSprite.fpsSprite.frameSprite.framesSprite.getAnimation()Sprite.gridSizeSprite.imageSprite.isBackgroundSprite.posSprite.readXML()Sprite.saveGIF()Sprite.setAnimation()Sprite.visible
- wmwpy.classes.imagelist module
- wmwpy.classes.location module
- wmwpy.classes.database module
- Module contents
DatabaseImagelistLayoutLevelLevel.HDLevel.TabHDLevel.object_packLevel.objectsLevel.challengesLevel.roomLevel.ChallengeLevel.IMAGE_FORMATLevel.IMAGE_TEMPLATELevel.PhotoImageLevel.XML_TEMPLATELevel.addObject()Level.challengesLevel.export()Level.getObject()Level.getObjectById()Level.imageLevel.objectsLevel.propertiesLevel.read()Level.scaleLevel.size
LocationObjectObject.HDObject.TabHDObject.spritesObject.shapesObject.UVsObject.VertIndicesObject.defaultPropertiesObject.propertiesObject.nameObject.idObject.frameObject.object_packObject.scaleObject.PhotoImageObject.SAFE_MODEObject.TypeObject.backgroundObject.background_PhotoImageObject.copy()Object.export()Object.filenameObject.foregroundObject.foreground_PhotoImageObject.frameObject.getAnimation()Object.getLevelXML()Object.getOffset()Object.getProperties()Object.imageObject.offsetObject.readXML()Object.rotateImage()Object.rotatePoint()Object.saveGIF()Object.scaleObject.setProperty()Object.typeObject.updateProperties()
SpriteSprite.HDSprite.TabHDSprite.propertiesSprite.animationsSprite.scaleSprite.AnimationSprite.SAFE_MODESprite.TEMPLATESprite.angleSprite.animationSprite.animationsSprite.export()Sprite.filenameSprite.fpsSprite.frameSprite.framesSprite.getAnimation()Sprite.gridSizeSprite.imageSprite.isBackgroundSprite.posSprite.readXML()Sprite.saveGIF()Sprite.setAnimation()Sprite.visibleSprite.xml
TextureSettingsWidget
- wmwpy.object_packs package
- wmwpy.utils package
- Subpackages
- Submodules
- wmwpy.utils.XMLTools module
- wmwpy.utils.color module
- wmwpy.utils.filesystem module
- wmwpy.utils.gif module
- wmwpy.utils.imageprocessing module
- wmwpy.utils.logging_utils module
- wmwpy.utils.path module
- wmwpy.utils.rotate module
- wmwpy.utils.textures module
- wmwpy.utils.waltex module
- Module contents
Submodules¶
wmwpy.game module¶
- class wmwpy.game.Game(gamepath: str, assets: str = '/assets', db: str = '/Data/water.db', profile: str | None = None, baseassets: str = '/', platform: Literal['android', 'ios'] = 'android', load_callback: Callable[[int, str, int], Any] | None = None, level_materials: dict[str, dict[Literal['rgb', 'type', 'image', 'outlined', 'outline_thickness', 'outline_color', 'outline_ignore_materials'], str | tuple[int, int, int] | bool | int | float | list[str]]] | None = None)[source]¶
Bases:
objectThe wmwpy Game object.
- gamepath¶
The path to the game directory on disk.
- Type:
str
- assets¶
The relative path from the game directory to the assets folder (e.g. ‘/assets’).
- Type:
str
- baseassets¶
The base assets path inside the assets folder, e.g. ‘/Perry’ in WMP.
- Type:
str
- db¶
The path to the database file.
- Type:
str
- profile¶
The path to the profile in WMW2.
- Type:
str
- platform¶
The platform this extracted game is on.
- Type:
Literal[‘android’,’ios’]
- object_pack¶
The ObjectPack for this game.
- Type:
- Database(path: str | None = None) Database[source]¶
Load the game database.
- Parameters:
path (str, optional) – Path to the database file. Defaults to
Game.db.- Returns:
Game Database object.
- Return type:
- FileManifest(writeFile: bool = True, filename: str = '/FileManifest.txt')[source]¶
Generate the
FileManifest.txtfile needed for some games, such as WMM. This just generates a text file with the paths to every file in theassetsfolder (which includes theFileManifest.txtfile).- Parameters:
writeFile (bool, optional) – Write the manifest to the
FileManifest.txtfile. Defaults to True.filename (str, optional) – Filename for FileManifest.txt. Defaults to ‘filename’.
- Returns:
Contents of
FileManifest.txt- Return type:
str
- Imagelist(imagelist: str | None = None, HD=False, TabHD=False, save_images=False)[source]¶
Load imagelist
- Parameters:
imagelist (str) – Path to
.imagelistfile. Defaults to NoneHD (bool, optional) – Use HD images. Defaults to False.
TabHD (bool, optional) – Use TabHD images. Defaults to False.
save_images (bool, optional) – Whether to save all the images in the filesystem. Note: it can take longer to load if this is True. Defaults to False.
- Returns:
Imagelist object.
- Return type:
- Level(xmlPath: str | None = None, imagePath: str | None = None, load_callback: Callable[[int, str, int], Any] | None = None, ignore_errors: bool = False, HD=False, TabHD=False, object_pack: ObjectPack | None = None)[source]¶
Load Level
- Parameters:
this (type) – description
xmlPath (str, optional) – Path to xml file. Defaults to None.
imagePath (str, optional) – Path to image file. Defaults to None.
load_callback (Callable[[int, str, int], Any], optional) – A callback function to be called while loading the level. Defaults to None.
ignore_errors (bool, optional) – Whether to ignore errors while loading the level. Defaults to False.
HD (bool, optional) – Use HD images. Defaults to False.
TabHD (bool, optional) – Use TabHD images. Defaults to False.
object_pack (classes.objectpack.pack.ObjectPack, optional) – The object pack to use. Defaults to the game object pack.
- Returns:
wmwpy Level object.
- Return type:
- Location(location: str) Location[source]¶
Load Location in
WMW2- Parameters:
location (str) – The path to the location xml file.
- Returns:
wmwpy Location object.
- Return type:
- Object(object: str, HD: bool = False, TabHD: bool = False, object_pack=None, **kwargs)[source]¶
Load object
- Parameters:
object (str) – Path to
.hsobject file.HD (bool, optional) – Use HD images. Defaults to False.
TabHD (bool, optional) – Use TabHD images. Defaults to False.
object_pack (classes.objectpack.pack.ObjectPack, optional) – The object pack to use. Defaults to the game object pack.
- Returns:
Where’s My Water? object.
- Return type:
- Sprite(sprite: str, HD=False, TabHD=False, **kwargs)[source]¶
Loads sprite.
- Parameters:
sprite (str) – Path to
.spritefile.HD (bool, optional) – Use HD images. Defaults to False.
TabHD (bool, optional) – Use TabHD images. Defaults to False.
- Returns:
Sprite object.
- Return type:
- Texture(texture: str | File, HD=False, TabHD=False)[source]¶
Get image texture. Doesn’t matter if it’s a
.walteximage or not.- Parameters:
texture (str) – Path to image file.
HD (bool, optional) – Use HD image. Defaults to False.
TabHD (bool, optional) – Use TabHD image. Defaults to False.
- Returns:
Texture object.
- Return type:
utils.textures.Texture
- dump(folder=None, callback: Callable[[int, str, int], Any] | None = None)[source]¶
Dump the contents of the filesystem to the specified directory
- Parameters:
folder (str, optional) – Path to output directory. Defaults to original path.
callback (Callable[[int, str, int], Any], optional) – A callback function to be ran while dumping the filesystem. Defaults to None.
- game = 'WMW'¶
wmwpy.gameobject module¶
- class wmwpy.gameobject.GameObject(filesystem: Filesystem | Folder | None = None, gamepath: str | None = None, assets: str = '/assets', baseassets: str = '/')[source]¶
Bases:
object- get_file(file: bytes | File | BytesIO | str, template: str | BytesIO | None = None) BytesIO | str[source]¶
Get file
- Parameters:
file (bytes | wmwpy.utils.filesystem.File | io.BytesIO | str) – Content of file. Can be bytes, wmwpy File, str (contents of file) or file-like object.
template (str | io.BytesIO, optional) – Fallback for file if file == None. Defaults to ‘’
- Raises:
TypeError – File can only be ‘str’, ‘bytes’, or file-like object.
- Returns:
New file object or str.
- Return type:
io.BytesIO | str
- truePos(pos: tuple[int, int] = (0, 0), obj_size: tuple[int, int] = (0, 0), parent_size: tuple[int, int] = (0, 0), offset: tuple[int, int] = (0, 0), obj_anchor: Literal['center', 'c', 'n', 'ne', 'e', 'se', 's', 'sw', 'w', 'nw'] = 'center', parent_anchor: Literal['center', 'c', 'n', 'ne', 'e', 'se', 's', 'sw', 'w', 'nw'] = 'center', scale: int = 1) tuple[int, int][source]¶
Get the true position of an object inside a larger object.
- Parameters:
pos (tuple[x,y], optional) – The position of the object. Defaults to (0,0).
obj_size (tuple[width,height], optional) – The size of the object. Defaults to (0,0).
parent_size (tuple[width,height], optional) – The size of the parent. Defaults to (0,0).
offset (tuple[x,y], optional) – An offset. Defaults to (0,0).
obj_anchor (Literal["center", "c", "n", "ne", "e", "se", "s", "sw", "w", "nw"], optional) – The object anchor. Defaults to ‘center’.
parent_anchor (Literal["center", "c", "n", "ne", "e", "se", "s", "sw", "w", "nw"], optional) – The parent anchor. Defaults to ‘center’.
scale (int, optional) – A scale for the position. Defaults to 1.
- Raises:
TypeError – Invalid anchor.
- Returns:
The new position.
- Return type:
tuple[int,int]
wmwpy.gametemplate module¶
- class wmwpy.gametemplate.WMH(gamepath: str, assets: str = '/assets', db: str = '/Data/water-Lite.db', profile: str | None = None, baseassets: str = '/', load_callback: Callable[[int, str, int], Any] | None = None)[source]¶
Bases:
Game- game = 'WMH'¶
- class wmwpy.gametemplate.WMM(gamepath: str, assets: str = '/assets', db: str = '/Mickey/Data/perry.db', profile: str | None = None, baseassets: str = '/Mickey/', load_callback: Callable[[int, str, int], Any] | None = None)[source]¶
Bases:
Game- game = 'WMM'¶
- class wmwpy.gametemplate.WMMF(gamepath: str, assets: str = '/assets', db: str = '/Mickey/Data/perry-Lite.db', profile: str | None = None, baseassets: str = '/Mickey/', load_callback: Callable[[int, str, int], Any] | None = None)[source]¶
Bases:
WMM- game = 'WMMF'¶
- class wmwpy.gametemplate.WMP(gamepath: str, assets: str = '/assets', db: str = '/Perry/Data/water.db', profile: str | None = None, baseassets: str = '/Perry/', load_callback: Callable[[int, str, int], Any] | None = None)[source]¶
Bases:
Game- game = 'WMP'¶
- class wmwpy.gametemplate.WMPF(gamepath: str, assets: str = '/assets', db: str = '/Perry/Data/water-Lite.db', profile: str | None = None, baseassets: str = '/Perry/', load_callback: Callable[[int, str, int], Any] | None = None)[source]¶
Bases:
WMP- game = 'WMPF'¶
- class wmwpy.gametemplate.WMS(gamepath: str, assets: str = '/Content', db: str = '/Perry/Data/water-Lite.db', profile: str | None = None, baseassets: str = '/Perry/', load_callback: Callable[[int, str, int], Any] | None = None)[source]¶
Bases:
WMPF- game = 'WMS'¶
- class wmwpy.gametemplate.WMW(gamepath: str, assets: str = '/assets', db: str = '/Data/water.db', profile: str | None = None, baseassets: str = '/', load_callback: Callable[[int, str, int], Any] | None = None)[source]¶
Bases:
Game- game = 'WMW'¶
- class wmwpy.gametemplate.WMW2(gamepath: str, assets: str = '/assets', db: str = '/Water/Data/perry.db', profile: str = '/Water/Data/factory_profile.json', baseassets: str = '/Water/', load_callback: Callable[[int, str, int], Any] | None = None)[source]¶
Bases:
Game- game = 'WMW2'¶
- class wmwpy.gametemplate.WMWF(gamepath: str, assets: str = '/assets', db: str = '/Data/water-Lite.db', profile: str | None = None, baseassets: str = '/', load_callback: Callable[[int, str, int], Any] | None = None)[source]¶
Bases:
WMW- game = 'WMWF'¶
- class wmwpy.gametemplate.WMWFXYY(gamepath: str, assets: str = '/assets', db: str = '/Perry/Data/water.db', profile: str | None = None, baseassets: str = '/Perry/', load_callback: Callable[[int, str, int], Any] | None = None, databasekey=None)[source]¶
Bases:
Game- game = 'WMWFXYY'¶
- class wmwpy.gametemplate.WMXYY(gamepath: str, assets: str = '/assets', db: str = '/Perry/Data/water.db', profile: str | None = None, baseassets: str = '/Perry/', load_callback: Callable[[int, str, int], Any] | None = None, databasekey=None)[source]¶
Bases:
Game- game = 'WMXYY'¶
- wmwpy.gametemplate.register_game(name: str, class_: Game)[source]¶
Register a game template
- Parameters:
name (str) – Name of the game. E.G. ‘WMW’
class (Game) – A class that has been inherited by the
Gameobject.
- Raises:
TypeError – class has to be inherited by Game
TypeError – name must be a string
NameError – game already exists
Module contents¶
- class wmwpy.Game(gamepath: str, assets: str = '/assets', db: str = '/Data/water.db', profile: str | None = None, baseassets: str = '/', platform: Literal['android', 'ios'] = 'android', load_callback: Callable[[int, str, int], Any] | None = None, level_materials: dict[str, dict[Literal['rgb', 'type', 'image', 'outlined', 'outline_thickness', 'outline_color', 'outline_ignore_materials'], str | tuple[int, int, int] | bool | int | float | list[str]]] | None = None)[source]¶
Bases:
objectThe wmwpy Game object.
- gamepath¶
The path to the game directory on disk.
- Type:
str
- assets¶
The relative path from the game directory to the assets folder (e.g. ‘/assets’).
- Type:
str
- baseassets¶
The base assets path inside the assets folder, e.g. ‘/Perry’ in WMP.
- Type:
str
- db¶
The path to the database file.
- Type:
str
- profile¶
The path to the profile in WMW2.
- Type:
str
- platform¶
The platform this extracted game is on.
- Type:
Literal[‘android’,’ios’]
- object_pack¶
The ObjectPack for this game.
- Type:
- Database(path: str | None = None) Database[source]¶
Load the game database.
- Parameters:
path (str, optional) – Path to the database file. Defaults to
Game.db.- Returns:
Game Database object.
- Return type:
- FileManifest(writeFile: bool = True, filename: str = '/FileManifest.txt')[source]¶
Generate the
FileManifest.txtfile needed for some games, such as WMM. This just generates a text file with the paths to every file in theassetsfolder (which includes theFileManifest.txtfile).- Parameters:
writeFile (bool, optional) – Write the manifest to the
FileManifest.txtfile. Defaults to True.filename (str, optional) – Filename for FileManifest.txt. Defaults to ‘filename’.
- Returns:
Contents of
FileManifest.txt- Return type:
str
- Imagelist(imagelist: str | None = None, HD=False, TabHD=False, save_images=False)[source]¶
Load imagelist
- Parameters:
imagelist (str) – Path to
.imagelistfile. Defaults to NoneHD (bool, optional) – Use HD images. Defaults to False.
TabHD (bool, optional) – Use TabHD images. Defaults to False.
save_images (bool, optional) – Whether to save all the images in the filesystem. Note: it can take longer to load if this is True. Defaults to False.
- Returns:
Imagelist object.
- Return type:
- Level(xmlPath: str | None = None, imagePath: str | None = None, load_callback: Callable[[int, str, int], Any] | None = None, ignore_errors: bool = False, HD=False, TabHD=False, object_pack: ObjectPack | None = None)[source]¶
Load Level
- Parameters:
this (type) – description
xmlPath (str, optional) – Path to xml file. Defaults to None.
imagePath (str, optional) – Path to image file. Defaults to None.
load_callback (Callable[[int, str, int], Any], optional) – A callback function to be called while loading the level. Defaults to None.
ignore_errors (bool, optional) – Whether to ignore errors while loading the level. Defaults to False.
HD (bool, optional) – Use HD images. Defaults to False.
TabHD (bool, optional) – Use TabHD images. Defaults to False.
object_pack (classes.objectpack.pack.ObjectPack, optional) – The object pack to use. Defaults to the game object pack.
- Returns:
wmwpy Level object.
- Return type:
- Location(location: str) Location[source]¶
Load Location in
WMW2- Parameters:
location (str) – The path to the location xml file.
- Returns:
wmwpy Location object.
- Return type:
- Object(object: str, HD: bool = False, TabHD: bool = False, object_pack=None, **kwargs)[source]¶
Load object
- Parameters:
object (str) – Path to
.hsobject file.HD (bool, optional) – Use HD images. Defaults to False.
TabHD (bool, optional) – Use TabHD images. Defaults to False.
object_pack (classes.objectpack.pack.ObjectPack, optional) – The object pack to use. Defaults to the game object pack.
- Returns:
Where’s My Water? object.
- Return type:
- Sprite(sprite: str, HD=False, TabHD=False, **kwargs)[source]¶
Loads sprite.
- Parameters:
sprite (str) – Path to
.spritefile.HD (bool, optional) – Use HD images. Defaults to False.
TabHD (bool, optional) – Use TabHD images. Defaults to False.
- Returns:
Sprite object.
- Return type:
- Texture(texture: str | File, HD=False, TabHD=False)[source]¶
Get image texture. Doesn’t matter if it’s a
.walteximage or not.- Parameters:
texture (str) – Path to image file.
HD (bool, optional) – Use HD image. Defaults to False.
TabHD (bool, optional) – Use TabHD image. Defaults to False.
- Returns:
Texture object.
- Return type:
utils.textures.Texture
- dump(folder=None, callback: Callable[[int, str, int], Any] | None = None)[source]¶
Dump the contents of the filesystem to the specified directory
- Parameters:
folder (str, optional) – Path to output directory. Defaults to original path.
callback (Callable[[int, str, int], Any], optional) – A callback function to be ran while dumping the filesystem. Defaults to None.
- game = 'WMW'¶
- wmwpy.load(gamepath: str, platform: Literal['android', 'ios'] = 'android', game: str = 'WMW', assets: str | None = None, db: str | None = None, profile: str | None = None, baseassets: str | None = None, load_callback: Callable[[int, str, int], Any] | None = None) Game[source]¶
load game
- Parameters:
gamepath (str) – Folder to extracted game.
platform (Literal['android', 'ios'], optional) – What platform this game is for. Can be ‘android’ or ‘ios’. Defaults to ‘android’.
game (str, optional) – Which game is being loaded. A full list of games is in
gametemplate.GAMES. Defaults to ‘WMW’.assets (str, optional) – Relative path to assets folder. Defaults to ‘/assets’.
db (str, optional) – Relative path to database file from assets folder. Defaults to ‘/Data/water.db’.
profile (str, optional) – Relative path to profile file in WMW2. Defaults to
None.baseassets (str, optional) – Base assets path within the assets folder, e.g. ‘/perry/’ in wmp. Defaults to ‘/’.
load_callback (Callable[[int, str, int], Any], optional) – A callback function to be ran while loading the game. Defaults to
None.