Encode your binary data into a list of DND spells.
basednd encodes and decodes binary data in following steps:
- Convert the binary data into a list of bytes.
- Transform each byte into its decimal representation and pad it to 3 digits with leading zeros.
a->097
- For each digit, randomly select a spell from its corresponding level.
097->Acid Splash,Wish,Simulacrum
- Concatenate the spell names with two spaces between them.
Acid Splash Wish Simulacrum
- If a language is specified, the spell names will be translated into that language.
- e.g.
zhwill translate the above encoded string into酸液飞溅 祝愿术 拟像术.
- e.g.
- Split the encoded string by two spaces.
- For each spell name, find the corresponding spell level
- Group the spell levels into 3-digit numbers.
- Convert the 3-digit numbers into bytes.
lib/: Contains the implementation ofbasedndin different languages.node: A simple prototype implementation in Node.js.
spells.db: A sqlite3 file contains the list of DND spells with i18n support.- table
spell:id: Unique Integer IDname: Name of the spelllevel: Level of the spell (0 for cantrip)school: School of the spell
- table
i18n:lang: Language code (e.g.zh)orig: Original English texttran: Translated text
- table
All the code in this repository is licensed under the MIT license.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you shall be licensed as above, without any additional terms or conditions.
Currently, the database is built based on mythril-forge/vanilla-spells. If you find any missing spells or incorrect information, please open an issue or PR to fix it.
Contributions on adding more languages are also welcome. Only zh is partial supported for now.
If you want to implement basednd in another language, feel free to open a PR. The implementation should be able to encode and decode binary data.