Skip to content

Tool to decode/encode weakauras string to JSON and back

Notifications You must be signed in to change notification settings

geexmmo/python-weakauras-tool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WeakAuras String Encoder/Decoder as wrapper for lua in Python

Based on encode/decode functions of WeakAuras2 and wago.io

WeakAura strings version 2 is supported (retailversion tested only): https://github.com/WeakAuras/WeakAuras2/blob/main/WeakAuras/Transmission.lua#L270 https://github.com/WeakAuras/WeakAuras2/blob/main/WeakAuras/Transmission.lua#L299

  -- encoding format:
  -- version 0: simple b64 string, compressed with LC and serialized with AS
  -- version 1: b64 string prepended with "!", compressed with LD and serialized with AS
  -- version 2+: b64 string prepended with !WA:N! (where N is encode version)
  --   compressed with LD and serialized with LS

Table of Contents

About

Script decodes WeakAura2 export strings into JSON or encodes JSON into WeakAura2 string invoking corresponding decode.lua or encode.lua in lua folder

Getting Started

Get env and python requirements, only requirement is Lupa, CPython integration of Lua or LuaJit runtimes:

python3 -m venv ./
pip install -r requirements.txt

Usage

Modify import_string and action inside docode-wa.py in main

python wa_tool.py

or to decode wa string from command-line pass wa string as argument:

python wa_tool.py '!WA:2!YourEncodedString'

or load as module:

>>> from wa_tool import run_lua
>>> run_lua('decode','!WA:2!YourEncodedString')
>>> (outputhere)
>>> run_lua('encode','{ "m": "d", "s": "5.17.0", "v": 1421 }')
>>> (outputhere)

About

Tool to decode/encode weakauras string to JSON and back

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published