Go to file
2022-12-21 15:22:44 +11:00
codegen.py Should have done this a long time ago too 2022-12-21 15:22:44 +11:00
decode.py Should have done this a long time ago too 2022-12-21 15:22:44 +11:00
encode.py Should have done this a long time ago too 2022-12-21 15:22:44 +11:00
README Should have done this a long time ago too 2022-12-21 15:22:44 +11:00
shared.py Should have done this a long time ago too 2022-12-21 15:22:44 +11:00
tables.py Should have done this a long time ago too 2022-12-21 15:22:44 +11:00

Rank Code Personal Database.

How to use:
Currently there is no real UI, so start by running python in this dir and `import codegen`.
Config file is in ~/.config/swat.cfg. If you want it somewhere else, open codegen.py and edit line 6. Do this BEFORE `import codegen`. If you've already imported it, quit python and reopen it.

Setup:
Execute `codegen.add_user('{YOUR IGN}')`. This will create the config file if it doesn't exist. You can add as many users as you like if you want to have multiple profiles for whatever reason (I cannot think of a reason, I just added it for fun).
When you run it later, it will automatically load the conf.

General use:
To load a code, use `codegen.read_code('0000-0000-0000-0000')`. You can put it in without the hyphens, also you can use anything in there, doesn't have to be hyphens. I recommend having something in between because it's helpful for checking the code is right.
To load a bunch of codes at once, do `codegen.mass_add()`, it just calls `read_code` in a loop. It stops if you give it a blank line.

To generate codes, use `codegen.generate('class/line')`, where you give it class/gun/armour/trait/spec/talent. Look in tables.py for the names you should be using; it is not case sensitive, at least. Also gun is optional unless it's mav/wm. (Note if you try to gen the wrong gun on a class, my gen will not stop you. The code will probably be invalid 🤷.)

To check your progress, use `codegen.ranks()`. It's not very pretty yet, it's a work in progress.

All of these operate on `codegen.active_profile`, which is a number. If you look at `codegen.conf`, you can see the numbers associated with each name(s). Set `codegen.active_profile={NUM}` to switch. I'll make a thing for that later too.

Every time you feed a code into it, it will automatically save your progress. You can manually override that if you want (with `codegen.read_code({CODE},False)`), and manually call `codegen.save_conf()` after. I don't know why you would want this, maybe the file write is very slow or something. Or you're putting in cheated codes and you don't want to save them. It will still update your running config but it just won't update the file so when you restart it it'll be gone.