wmwpy package¶
Subpackages¶
- wmwpy.classes package
- Subpackages
- Submodules
- wmwpy.classes.level module
- wmwpy.classes.object module
Object
Object.HD
Object.TabHD
Object.sprites
Object.shapes
Object.UVs
Object.VertIndices
Object.defaultProperties
Object.properties
Object.name
Object.id
Object.frame
Object.object_pack
Object.scale
Object.PhotoImage
Object.SAFE_MODE
Object.Type
Object.background
Object.background_PhotoImage
Object.copy()
Object.export()
Object.filename
Object.foreground
Object.foreground_PhotoImage
Object.frame
Object.getAnimation()
Object.getLevelXML()
Object.getOffset()
Object.getProperties()
Object.image
Object.offset
Object.readXML()
Object.rotateImage()
Object.rotatePoint()
Object.saveGIF()
Object.scale
Object.setProperty()
Object.type
Object.updateProperties()
Shape
- wmwpy.classes.sprite module
Sprite
Sprite.HD
Sprite.TabHD
Sprite.properties
Sprite.animations
Sprite.scale
Sprite.Animation
Sprite.SAFE_MODE
Sprite.TEMPLATE
Sprite.angle
Sprite.animation
Sprite.export()
Sprite.filename
Sprite.fps
Sprite.frame
Sprite.frames
Sprite.getAnimation()
Sprite.gridSize
Sprite.image
Sprite.isBackground
Sprite.pos
Sprite.readXML()
Sprite.saveGIF()
Sprite.setAnimation()
Sprite.visible
- wmwpy.classes.imagelist module
- wmwpy.classes.location module
- wmwpy.classes.database module
- Module contents
Database
Imagelist
Layout
Level
Level.HD
Level.TabHD
Level.object_pack
Level.objects
Level.challenges
Level.room
Level.Challenge
Level.IMAGE_FORMAT
Level.IMAGE_TEMPLATE
Level.PhotoImage
Level.XML_TEMPLATE
Level.addObject()
Level.challenges
Level.export()
Level.getObject()
Level.getObjectById()
Level.image
Level.objects
Level.properties
Level.read()
Level.scale
Level.size
Location
Object
Object.HD
Object.TabHD
Object.sprites
Object.shapes
Object.UVs
Object.VertIndices
Object.defaultProperties
Object.properties
Object.name
Object.id
Object.frame
Object.object_pack
Object.scale
Object.PhotoImage
Object.SAFE_MODE
Object.Type
Object.background
Object.background_PhotoImage
Object.copy()
Object.export()
Object.filename
Object.foreground
Object.foreground_PhotoImage
Object.frame
Object.getAnimation()
Object.getLevelXML()
Object.getOffset()
Object.getProperties()
Object.image
Object.offset
Object.readXML()
Object.rotateImage()
Object.rotatePoint()
Object.saveGIF()
Object.scale
Object.setProperty()
Object.type
Object.updateProperties()
Sprite
Sprite.HD
Sprite.TabHD
Sprite.properties
Sprite.animations
Sprite.scale
Sprite.Animation
Sprite.SAFE_MODE
Sprite.TEMPLATE
Sprite.angle
Sprite.animation
Sprite.animations
Sprite.export()
Sprite.filename
Sprite.fps
Sprite.frame
Sprite.frames
Sprite.getAnimation()
Sprite.gridSize
Sprite.image
Sprite.isBackground
Sprite.pos
Sprite.readXML()
Sprite.saveGIF()
Sprite.setAnimation()
Sprite.visible
Sprite.xml
TextureSettings
Widget
- 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:
object
The 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.txt
file needed for some games, such as WMM. This just generates a text file with the paths to every file in theassets
folder (which includes theFileManifest.txt
file).- Parameters:
writeFile (bool, optional) – Write the manifest to the
FileManifest.txt
file. 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
.imagelist
file. 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
.hs
object 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
.sprite
file.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
.waltex
image 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
Game
object.
- 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:
object
The 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.txt
file needed for some games, such as WMM. This just generates a text file with the paths to every file in theassets
folder (which includes theFileManifest.txt
file).- Parameters:
writeFile (bool, optional) – Write the manifest to the
FileManifest.txt
file. 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
.imagelist
file. 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
.hs
object 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
.sprite
file.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
.waltex
image 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
.