gddecoder


Namegddecoder JSON
Version 1.1.0 PyPI version JSON
download
home_pagehttps://github.com/NodusLorden/gddecoder
SummaryLib for work this Geometry Dash levels
upload_time2023-07-15 17:26:32
maintainer
docs_urlNone
authorLordNodus
requires_python>=3.11
license
keywords geometrydash python
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # gddecoder
Lib for work this Geometry Dash levels


## Start
```py
from gddecoder import *

levels = LocalLevels()
```
If you need to work with a save file that is not in the standard path
```py
levels = LocalLevels("path/to/file/CCLocalLevels.dat")
```
`LocalLevels` is list of levels, to get the level, use the `levels.get_level()` method or standard list syntax `levels[n]`.

```py
level1 = levels.get_level(10)
level2 = levels.get_level("first level")
level3 = level[10]
```

`levels[n]` don't support levels names, ~~level["first level"]~~.

## Change levels
Level is `dict`. To refer to a key in a level, you can use the name of the key that matches the name of the key in the game's save file, or use the `LevelSettings` enum.

```py
level["k2"] = "test level"
level[LevelSettings.objects_count] = 800
```

### Some programs

Print names of all levels:
```py
from  gddecoder import *


levels = LocalLevels()

for lvl in levels:
    print(lvl[LevelSettings.name])
```

Counting the total number of jumps in levels:
```py
from gddecoder import *


levels = LocalLevels()

jumps = 0

for lvl in levels:

    # test because the level may not have jumps
    if LevelSettings.jumps in lvl:
        jumps += lvl[LevelSettings.jumps]

print(jumps)
```

## Editor

Level has method `get_editor`, it return Editor object.
```py
editor = level.get_editor()
```

Editor object has attribute `blocks` and `colors`. Other properties are stored as in a dictionary. Use `EditorSettings` enum or game key.
```py
# set 2 player mode
editor[EditorSettings.two_player_mode] = True
# get 20 block in level
blocks = editor.blocks[19]
# get bg Color
color_bg = editor.colors[1000]
```

## Blocks

Blocks are also dictionaries. Use `BlockSettings` enum.
```py
block = editor.blocks[9]
block[BlockSettings.x] = 30
block[BlockSettings.y] = 15
```

### Add block
```py
editor.blocks.add(Block(
    {
        BlockSettings.id: 1,
        BlockSettings.x: 15,
        BlockSettings.y: 15,
    }
))
```

### Block duplication
```py
editor.blocks.add(Block(
    editor.blocks[9]
))
```

### Set groups
`Groups` is set.
```py
block = editor.blocks[9]
block[BlockSettings.groups] = Groups([1, 2, 10])
```
```py
block[BlockSettings.groups].add(14)
```
```py
block[BlockSettings.groups].pop(10)
```

### Colors
The block stores only the color channel of the block as an int. To change a color, you need to change the corresponding color in `editor.colors` and then assign it to the block.


## Save
Save to standart path:
```py
level.set_editor(editor)
levels.save()
```
For other path:
```py
level.set_editor(editor)
levels.save("other/path/file.dat")
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/NodusLorden/gddecoder",
    "name": "gddecoder",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": "",
    "keywords": "geometrydash python",
    "author": "LordNodus",
    "author_email": "LordNodus@mail.ru",
    "download_url": "https://files.pythonhosted.org/packages/ce/59/3847af7120b17832c55c3382d16d696a7732b8df8c41415502a6d2466055/gddecoder-1.1.0.tar.gz",
    "platform": null,
    "description": "# gddecoder\r\nLib for work this Geometry Dash levels\r\n\r\n\r\n## Start\r\n```py\r\nfrom gddecoder import *\r\n\r\nlevels = LocalLevels()\r\n```\r\nIf you need to work with a save file that is not in the standard path\r\n```py\r\nlevels = LocalLevels(\"path/to/file/CCLocalLevels.dat\")\r\n```\r\n`LocalLevels` is list of levels, to get the level, use the `levels.get_level()` method or standard list syntax `levels[n]`.\r\n\r\n```py\r\nlevel1 = levels.get_level(10)\r\nlevel2 = levels.get_level(\"first level\")\r\nlevel3 = level[10]\r\n```\r\n\r\n`levels[n]` don't support levels names, ~~level[\"first level\"]~~.\r\n\r\n## Change levels\r\nLevel is `dict`. To refer to a key in a level, you can use the name of the key that matches the name of the key in the game's save file, or use the `LevelSettings` enum.\r\n\r\n```py\r\nlevel[\"k2\"] = \"test level\"\r\nlevel[LevelSettings.objects_count] = 800\r\n```\r\n\r\n### Some programs\r\n\r\nPrint names of all levels:\r\n```py\r\nfrom  gddecoder import *\r\n\r\n\r\nlevels = LocalLevels()\r\n\r\nfor lvl in levels:\r\n    print(lvl[LevelSettings.name])\r\n```\r\n\r\nCounting the total number of jumps in levels:\r\n```py\r\nfrom gddecoder import *\r\n\r\n\r\nlevels = LocalLevels()\r\n\r\njumps = 0\r\n\r\nfor lvl in levels:\r\n\r\n    # test because the level may not have jumps\r\n    if LevelSettings.jumps in lvl:\r\n        jumps += lvl[LevelSettings.jumps]\r\n\r\nprint(jumps)\r\n```\r\n\r\n## Editor\r\n\r\nLevel has method `get_editor`, it return Editor object.\r\n```py\r\neditor = level.get_editor()\r\n```\r\n\r\nEditor object has attribute `blocks` and `colors`. Other properties are stored as in a dictionary. Use `EditorSettings` enum or game key.\r\n```py\r\n# set 2 player mode\r\neditor[EditorSettings.two_player_mode] = True\r\n# get 20 block in level\r\nblocks = editor.blocks[19]\r\n# get bg Color\r\ncolor_bg = editor.colors[1000]\r\n```\r\n\r\n## Blocks\r\n\r\nBlocks are also dictionaries. Use `BlockSettings` enum.\r\n```py\r\nblock = editor.blocks[9]\r\nblock[BlockSettings.x] = 30\r\nblock[BlockSettings.y] = 15\r\n```\r\n\r\n### Add block\r\n```py\r\neditor.blocks.add(Block(\r\n    {\r\n        BlockSettings.id: 1,\r\n        BlockSettings.x: 15,\r\n        BlockSettings.y: 15,\r\n    }\r\n))\r\n```\r\n\r\n### Block duplication\r\n```py\r\neditor.blocks.add(Block(\r\n    editor.blocks[9]\r\n))\r\n```\r\n\r\n### Set groups\r\n`Groups` is set.\r\n```py\r\nblock = editor.blocks[9]\r\nblock[BlockSettings.groups] = Groups([1, 2, 10])\r\n```\r\n```py\r\nblock[BlockSettings.groups].add(14)\r\n```\r\n```py\r\nblock[BlockSettings.groups].pop(10)\r\n```\r\n\r\n### Colors\r\nThe block stores only the color channel of the block as an int. To change a color, you need to change the corresponding color in `editor.colors` and then assign it to the block.\r\n\r\n\r\n## Save\r\nSave to standart path:\r\n```py\r\nlevel.set_editor(editor)\r\nlevels.save()\r\n```\r\nFor other path:\r\n```py\r\nlevel.set_editor(editor)\r\nlevels.save(\"other/path/file.dat\")\r\n```\r\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Lib for work this Geometry Dash levels",
    "version": "1.1.0",
    "project_urls": {
        "Documentation": "https://github.com/NodusLorden/gddecoder",
        "Homepage": "https://github.com/NodusLorden/gddecoder"
    },
    "split_keywords": [
        "geometrydash",
        "python"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ce593847af7120b17832c55c3382d16d696a7732b8df8c41415502a6d2466055",
                "md5": "4f024b3bfe4982996fe32a3ce7db771d",
                "sha256": "af83cc4b037ea276e52bd7b75347401ead28e625ffc1faec9c54bbe68c540639"
            },
            "downloads": -1,
            "filename": "gddecoder-1.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "4f024b3bfe4982996fe32a3ce7db771d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 11191,
            "upload_time": "2023-07-15T17:26:32",
            "upload_time_iso_8601": "2023-07-15T17:26:32.682017Z",
            "url": "https://files.pythonhosted.org/packages/ce/59/3847af7120b17832c55c3382d16d696a7732b8df8c41415502a6d2466055/gddecoder-1.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-15 17:26:32",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "NodusLorden",
    "github_project": "gddecoder",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "gddecoder"
}
        
Elapsed time: 0.09987s