charsi


Namecharsi JSON
Version 2.2.0 PyPI version JSON
download
home_pageNone
SummaryA command-line tool to help game modders build string resources for Diablo II: Resurrected.
upload_time2025-09-04 05:00:56
maintainerNone
docs_urlNone
authorNone
requires_python<3.14,>=3.10
licenseMIT
keywords diablo2resurrected game modding
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <div align="center">
    <img src="https://raw.githubusercontent.com/garrett-he/charsi/main/docs/images/logo.png"/>
</div>

![license](https://img.shields.io/github/license/garrett-he/charsi)
![test](https://img.shields.io/github/actions/workflow/status/garrett-he/charsi/test.yml)
![version](https://img.shields.io/pypi/v/charsi)
![python](https://img.shields.io/pypi/pyversions/charsi)
![downloads](https://img.shields.io/pypi/dm/charsi)

# Charsi

A command-line tool to help game modders build string resources
for [Diablo II: Resurrected][1].

## Introduction

In the classic version of Diablo II, there was a very famous hacking tool called
[Maphack][2], which could easily configure texts displayed in game. Now in
Diablo II: Resurrected, you can directly modify the JSON files to change texts
in game, but the workload is high, and it's easy to make mistakes.

![charsi-icon](./docs/images/charsi-icon.png) [Charsi][3] is the blacksmith in
the Rogue Encampment in Act I of Diablo II, and can imbue any normal item of the
player's choice.

This tool named **charsi**, can imbue game strings with your recipes which are
in a format similar to Maphack configurations.

## Quickstart

1. Extract `item-names.json` file at `/data/local/lng/strings` from game data
   storage by [CascView](http://www.zezula.net/en/casc/main.html).

2. Write a recipe file `example.recipe` with following:

```
Text[qf1]: Example
```

3. Run the following command to build a new string table:

```
charsi build --recipe-file=example.recipe item-names.json > new-item-names.json
```

4. Replace file `/data/local/lng/strings/item-names.json`
   with `new-item-names.json` in your mods.

5. Check in game, item name `Khalim's Flail` has been replaced with `Example`.

## How to Use

There are three concepts in Charsi: **String Table**, **Instruction** and
**Recipe**.

### String Table

Represents JSON files extracted from game data, the target for modding.

### Instruction

Tells Charsi what to do when building string tables, is equivalent to a
configuration in the `d2maphack.cfg`.

Format of instructions is:

```
name[query][language]: arg1, arg2, ...
```

* name: Name of instruction
* query: Specify which strings to operate on
* language: Optional, specify which language to operate on
* arg1, arg2, ...: Arguments of instruction, separated by comma

Three ways to query strings:

1. Single string:
   ```
   Instruction[qf1]: ... # for Khalim's Flail
   ```

2. By range:
   ```
   Instruction[qf1~qhr]: ... # all Khalim's stuffs
   ```

3. Discrete
   ```
   Instruction[qey, qhr]: ... # Khalim's Eye and Heart
   ```

**Built-in Instructions**

* `Text`: Replace string texts
* `Color`: Set color of string text

**Customize Instructions**

Instructions are implemented by Lua scripts and put in directory `/instructions`

**APIs for Lua to implement instructions**

* `RegisterInstruction(name, fn)`: Register a new instruction.
* `UnregisterInstruction(name)`: Unregister an existing instruction.
* `InstructionRegistered(name)`: Check whether instruction is registered.

### Recipe

A collection of instruction for building string tables.

#### Recipe Tags

You can set tags of recipes in format:

```
## Tag-name: value
```

`## Language`: The default language of instructions in this recipe

### Commands

Build a string table with recipe:

```
charsi build --recipe-file=/path/to/recipe path/to/stringtable
```

Build string tables with manifest files:

```
charsi build-manfiest path/to/manifest
```

### Manifest

In JSON format like:

```json
[
    {
        "input": "/path/to/stringtable",
        "output": "/path/to/output",
        "recipes": [
            "/path/to/recipe1",
            "/path/to/recipe2",
            "..."
        ]
    }
]
```

### Directory Structure

* `/instructions/`: Lua scripts for instruction handlers

### Variables

* `{origin}`: Placeholder for original text

### Alias

You can set alias to a bunch of keys by putting files in `/alias/`.

## License

Copyright (C) 2022 Garrett HE <garrett.he@hotmail.com>

The GNU General Public License (GPL) version 3, see [LICENSE](./LICENSE).

[1]: https://diablo2.blizzard.com

[2]: https://diablo2.diablowiki.net/Maphack

[3]: https://diablo.fandom.com/wiki/Charsi

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "charsi",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<3.14,>=3.10",
    "maintainer_email": null,
    "keywords": "diablo2resurrected, game, modding",
    "author": null,
    "author_email": "Garrett HE <garrett.he@outlook.com>",
    "download_url": "https://files.pythonhosted.org/packages/da/22/4b8f4a53006662529fa96be386127852f71982d8da2033fa899e440b22d6/charsi-2.2.0.tar.gz",
    "platform": null,
    "description": "<div align=\"center\">\n    <img src=\"https://raw.githubusercontent.com/garrett-he/charsi/main/docs/images/logo.png\"/>\n</div>\n\n![license](https://img.shields.io/github/license/garrett-he/charsi)\n![test](https://img.shields.io/github/actions/workflow/status/garrett-he/charsi/test.yml)\n![version](https://img.shields.io/pypi/v/charsi)\n![python](https://img.shields.io/pypi/pyversions/charsi)\n![downloads](https://img.shields.io/pypi/dm/charsi)\n\n# Charsi\n\nA command-line tool to help game modders build string resources\nfor [Diablo II: Resurrected][1].\n\n## Introduction\n\nIn the classic version of Diablo II, there was a very famous hacking tool called\n[Maphack][2], which could easily configure texts displayed in game. Now in\nDiablo II: Resurrected, you can directly modify the JSON files to change texts\nin game, but the workload is high, and it's easy to make mistakes.\n\n![charsi-icon](./docs/images/charsi-icon.png) [Charsi][3] is the blacksmith in\nthe Rogue Encampment in Act I of Diablo II, and can imbue any normal item of the\nplayer's choice.\n\nThis tool named **charsi**, can imbue game strings with your recipes which are\nin a format similar to Maphack configurations.\n\n## Quickstart\n\n1. Extract `item-names.json` file at `/data/local/lng/strings` from game data\n   storage by [CascView](http://www.zezula.net/en/casc/main.html).\n\n2. Write a recipe file `example.recipe` with following:\n\n```\nText[qf1]: Example\n```\n\n3. Run the following command to build a new string table:\n\n```\ncharsi build --recipe-file=example.recipe item-names.json > new-item-names.json\n```\n\n4. Replace file `/data/local/lng/strings/item-names.json`\n   with `new-item-names.json` in your mods.\n\n5. Check in game, item name `Khalim's Flail` has been replaced with `Example`.\n\n## How to Use\n\nThere are three concepts in Charsi: **String Table**, **Instruction** and\n**Recipe**.\n\n### String Table\n\nRepresents JSON files extracted from game data, the target for modding.\n\n### Instruction\n\nTells Charsi what to do when building string tables, is equivalent to a\nconfiguration in the `d2maphack.cfg`.\n\nFormat of instructions is:\n\n```\nname[query][language]: arg1, arg2, ...\n```\n\n* name: Name of instruction\n* query: Specify which strings to operate on\n* language: Optional, specify which language to operate on\n* arg1, arg2, ...: Arguments of instruction, separated by comma\n\nThree ways to query strings:\n\n1. Single string:\n   ```\n   Instruction[qf1]: ... # for Khalim's Flail\n   ```\n\n2. By range:\n   ```\n   Instruction[qf1~qhr]: ... # all Khalim's stuffs\n   ```\n\n3. Discrete\n   ```\n   Instruction[qey, qhr]: ... # Khalim's Eye and Heart\n   ```\n\n**Built-in Instructions**\n\n* `Text`: Replace string texts\n* `Color`: Set color of string text\n\n**Customize Instructions**\n\nInstructions are implemented by Lua scripts and put in directory `/instructions`\n\n**APIs for Lua to implement instructions**\n\n* `RegisterInstruction(name, fn)`: Register a new instruction.\n* `UnregisterInstruction(name)`: Unregister an existing instruction.\n* `InstructionRegistered(name)`: Check whether instruction is registered.\n\n### Recipe\n\nA collection of instruction for building string tables.\n\n#### Recipe Tags\n\nYou can set tags of recipes in format:\n\n```\n## Tag-name: value\n```\n\n`## Language`: The default language of instructions in this recipe\n\n### Commands\n\nBuild a string table with recipe:\n\n```\ncharsi build --recipe-file=/path/to/recipe path/to/stringtable\n```\n\nBuild string tables with manifest files:\n\n```\ncharsi build-manfiest path/to/manifest\n```\n\n### Manifest\n\nIn JSON format like:\n\n```json\n[\n    {\n        \"input\": \"/path/to/stringtable\",\n        \"output\": \"/path/to/output\",\n        \"recipes\": [\n            \"/path/to/recipe1\",\n            \"/path/to/recipe2\",\n            \"...\"\n        ]\n    }\n]\n```\n\n### Directory Structure\n\n* `/instructions/`: Lua scripts for instruction handlers\n\n### Variables\n\n* `{origin}`: Placeholder for original text\n\n### Alias\n\nYou can set alias to a bunch of keys by putting files in `/alias/`.\n\n## License\n\nCopyright (C) 2022 Garrett HE <garrett.he@hotmail.com>\n\nThe GNU General Public License (GPL) version 3, see [LICENSE](./LICENSE).\n\n[1]: https://diablo2.blizzard.com\n\n[2]: https://diablo2.diablowiki.net/Maphack\n\n[3]: https://diablo.fandom.com/wiki/Charsi\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A command-line tool to help game modders build string resources for Diablo II: Resurrected.",
    "version": "2.2.0",
    "project_urls": {
        "changelog": "https://github.com/garrett-he/charsi/blob/main/CHANGELOG.md",
        "homepage": "https://github.com/garrett-he/charsi",
        "issues": "https://github.com/garrett-he/charsi/issues",
        "repository": "https://github.com/garrett-he/charsi.git"
    },
    "split_keywords": [
        "diablo2resurrected",
        " game",
        " modding"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "80cc00d4e67f002020b03ead7240abbeeb61e15ca991f7b040861e675f77f1a9",
                "md5": "6e8d335a54b5f8176e415024730924ac",
                "sha256": "2031b61358a71c82e11f0298132e952d97d821f0f00f8463f84bdd309f6d104b"
            },
            "downloads": -1,
            "filename": "charsi-2.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "6e8d335a54b5f8176e415024730924ac",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<3.14,>=3.10",
            "size": 9317,
            "upload_time": "2025-09-04T05:00:54",
            "upload_time_iso_8601": "2025-09-04T05:00:54.734580Z",
            "url": "https://files.pythonhosted.org/packages/80/cc/00d4e67f002020b03ead7240abbeeb61e15ca991f7b040861e675f77f1a9/charsi-2.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "da224b8f4a53006662529fa96be386127852f71982d8da2033fa899e440b22d6",
                "md5": "3b886e9b5d3b49a2d35ccd2836c97dde",
                "sha256": "8b5d807262088fc2548cc29073adb5500c20f8aec5c762a76c12ebf502645bd3"
            },
            "downloads": -1,
            "filename": "charsi-2.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "3b886e9b5d3b49a2d35ccd2836c97dde",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<3.14,>=3.10",
            "size": 129754,
            "upload_time": "2025-09-04T05:00:56",
            "upload_time_iso_8601": "2025-09-04T05:00:56.722538Z",
            "url": "https://files.pythonhosted.org/packages/da/22/4b8f4a53006662529fa96be386127852f71982d8da2033fa899e440b22d6/charsi-2.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-09-04 05:00:56",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "garrett-he",
    "github_project": "charsi",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "charsi"
}
        
Elapsed time: 1.58859s