Skip to main content

Victoria 2 War Analyzer written in Python!

Project description

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)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyvic2waranalyzer-1.4.4.tar.gz (1.3 MB view details)

Uploaded Source

File details

Details for the file pyvic2waranalyzer-1.4.4.tar.gz.

File metadata

  • Download URL: pyvic2waranalyzer-1.4.4.tar.gz
  • Upload date:
  • Size: 1.3 MB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for pyvic2waranalyzer-1.4.4.tar.gz
Algorithm Hash digest
SHA256 fd0827bd1b363288fba95a3aa86e7f1a93595d925304b6bd2c93c398c974e8ee
MD5 316855a8c5159bbddc3be5efad4130be
BLAKE2b-256 3700f4d7e97f30f1f763379e934b68ba02491f312a35d4127c8c134398e6ecd0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page