Skip to content

Utilities

kw has both built-in and third-party utilities:

$ kw tool template <id> # Displays full information about the object with the specified ID in .ini format
$ kw tool template <id> -P # Displays the path to the file containing the object in the project
$ kw tool template <id> -c # Colorizes the text
$ kw tool template <name> -n # Searches by the Name field, not the ID

$ kw tool natives <code> # Displays a list of lines from blizzard.j and common.j that contain the specified code

$ kw tool icons <name> # Displays links and paths to icons with the specified name
$ kw tool icons <name> -c # Displays only icons from the classic version
$ kw tool icons <name> -r # Displays only icons from the reforged version

$ kw tool iconslist # Launches a website with a list of icons on localhost:8000
$ kw tool iconslist -c # The website will only contain icons from the classic version
$ kw tool iconslist -r # The website will only contain icons from the reforged version

$ kw tool balance # Creates HTML code for a page with object balances in the dist/balance/ folder
$ kw tool balance -s # Instead of creating the website, launches it on localhost:8000

$ kw tool parse <file> # Parses a file with objects (.ini, .json, .mini)

$ kw tool blp <arg1> <arg2> ... # Works with the blp-rs utility, see its arguments
$ kw tool imp <arg1> <arg2> ... # Works with the imp utility, see its arguments

Third-Party Utilities

You can create utilities in Python (or Load them with modules) in the tools folder:

tools/clear.py
from kuniwar.builder import Builder, BuildContext
import shutil

def clear(ctx: BuildContext):
shutil.rmtree('backups/')
shutil.rmtree('logs/')

def main():
Builder.end_build_signal.connect(clear)

The kuniwar library includes simple signals for the start and end of compilation, allowing you to automate various processes in your project. For example, in the example above, the logs/ and backups/ folders, which are automatically created by jasshelper, are deleted after compilation.

In general, you can edit any accessible part of the source code. For example, you can replace the standard ASCII art output when using the kw command in the project folder:

tools/ascii.py
from kuniwar.utils.ascii_arts import ASCII

ASCII.value = r"""
⣇⣿⠘⣿⣿⣿⡿⡿⣟⣟⢟⢟⢝⠵⡝⣿⡿⢂⣼⣿⣷⣌⠩⡫⡻⣝⠹⢿⣿⣷
⡆⣿⣆⠱⣝⡵⣝⢅⠙⣿⢕⢕⢕⢕⢝⣥⢒⠅⣿⣿⣿⡿⣳⣌⠪⡪⣡⢑⢝⣇
⡆⣿⣿⣦⠹⣳⣳⣕⢅⠈⢗⢕⢕⢕⢕⢕⢈⢆⠟⠋⠉⠁⠉⠉⠁⠈⠼⢐⢕⢽
⡗⢰⣶⣶⣦⣝⢝⢕⢕⠅⡆⢕⢕⢕⢕⢕⣴⠏⣠⡶⠛⡉⡉⡛⢶⣦⡀⠐⣕⢕
⡝⡄⢻⢟⣿⣿⣷⣕⣕⣅⣿⣔⣕⣵⣵⣿⣿⢠⣿⢠⣮⡈⣌⠨⠅⠹⣷⡀⢱⢕
⡝⡵⠟⠈⢀⣀⣀⡀⠉⢿⣿⣿⣿⣿⣿⣿⣿⣼⣿⢈⡋⠴⢿⡟⣡⡇⣿⡇⡀⢕
⡝⠁⣠⣾⠟⡉⡉⡉⠻⣦⣻⣿⣿⣿⣿⣿⣿⣿⣿⣧⠸⣿⣦⣥⣿⡇⡿⣰⢗⢄
⠁⢰⣿⡏⣴⣌⠈⣌⠡⠈⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣬⣉⣉⣁⣄⢖⢕⢕⢕
⡀⢻⣿⡇⢙⠁⠴⢿⡟⣡⡆⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣵⣵⣿
⡻⣄⣻⣿⣌⠘⢿⣷⣥⣿⠇⣿⣿⣿⣿⣿⣿⠛⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
⣷⢄⠻⣿⣟⠿⠦⠍⠉⣡⣾⣿⣿⣿⣿⣿⣿⢸⣿⣦⠙⣿⣿⣿⣿⣿⣿⣿⣿⠟
⡕⡑⣑⣈⣻⢗⢟⢞⢝⣻⣿⣿⣿⣿⣿⣿⣿⠸⣿⠿⠃⣿⣿⣿⣿⣿⣿⡿⠁⣠
⡝⡵⡈⢟⢕⢕⢕⢕⣵⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣶⣿⣿⣿⣿⣿⠿⠋⣀⣈⠙
⡝⡵⡕⡀⠑⠳⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠛⢉⡠⡲⡫⡪⡪⡣"""