PyVic2WarAnalyzer
Python module to analyze Victoria 2 save files.
See the documentation in https://pyvic2waranalyzer.readthedocs.io/en/stable
Installing
pip install pyvic2waranalyzer
This module is a little bit heavy because I included a localisation file from victoria 2 to translate the country tags.
You can disable the localisation or change the localisation folder if you want to use your own files.
Code examples
import pyvic2waranalyzer as vic2
save = vic2.GameFile(lang="english") # 'lang' only available when you use localisation files
save = vic2.GameFile(localisation_folder=None) # If you want to disable it
save = vic2.GameFile(localisation_folder="relative/path/to/your/localisation_folder") # If you want to change the directory of the localisation folder
war = save.scan("save game.v2")
for w in war:
print("War name", w.name)
print("Wargoal", w.wargoal)
print("Battles", w.battles) # list of battles
print("Started in", w.actor)
print("Attackers", w.attackers) # list of attackers
print("Defenders", w.defenders) # list of defenders
for b in w.battles:
print("Battle name", b.name)
print("result", b.result) # If attacker won it's true else false
print("attacker army", b.attackerArmy)
print("defender army", b.defenderArmy)
print("attacker losses", b.attackerLosses)
print("defender losses", b.defender.Losses)
print("total losses", b.total_losses)
# You can also do
for w in save.war:
print("War name", w.name)
print("Wargoal", w.wargoal)
print("Battles", w.battles) # list of battles
print("Started in", w.actor)
print("Attackers", w.attackers) # list of attacker
print("Defenders", w.defenders) # list of defenders
for b in w.battles:
print("Battle name", b.name)
print("result", b.result) # If attacker won it's true else false
print("attacker army", b.attackerArmy)
print("defender army", b.defenderArmy)
print("attacker losses", b.attackerLosses)
print("defender losses", b.defender.Losses)
print("total losses", b.total_losses)
Release files for pyvic2waranalyzer 1.4.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyvic2waranalyzer-1.4.4.tar.gz | 1.3 MB | Details |
Release files / pyvic2waranalyzer-1.4.4.tar.gz
| Download URL | pyvic2waranalyzer-1.4.4.tar.gz |
|---|---|
| Size | 1.3 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fd0827bd1b363288fba95a3aa86e7f1a93595d925304b6bd2c93c398c974e8ee
|
|
BLAKE2b-256 checksum How to use checksums |
3700f4d7e97f30f1f763379e934b68ba02491f312a35d4127c8c134398e6ecd0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.1 requests/2.21.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.7.0
|