Welcome to PyVic2WarAnalyzer’s documentation!

I created this module because I was bored and because I wanted to make a discord bot with it.

Classes and methods

Pyvic2waranalyzer.main

class pyvic2waranalyzer.main.GameFile(localisation_folder=['text.csv'], lang='English')[source]

Initializes the parser

Parameters
  • localisation_folder (str or list or None) – Indicates a localisation folder with .csv files.

  • lang (str) – Indicates the language to translate.

scan(filename)[source]

Scan the save file, returns a list of War

Parameters

filename (str or bytes) –

Returns

Return type

List[War]

Pyvic2waranalyzer.utils

class pyvic2waranalyzer.utils.types.Battle(name: Optional[str] = None, location: Optional[int] = None, result: Optional[bool] = None, defender: Optional[str] = None, attacker: Optional[str] = None, attackerLosses: int = 0, defenderLosses: int = 0, attackerLeader: Optional[str] = None, defenderLeader: Optional[str] = None)[source]

Represents a battle in a War

name

Indicates the battle name, aka the province name

Type

str

location

Indicates a province id

Type

int

result

Indicates if the attacker won the battle or else

Type

bool

defender
Type

str

attacker
Type

str

attackerLosses
Type

int

defenderLosses
Type

int

attackerLeader
Type

str

defenderLeader
Type

str

attackerArmy
Type

List[Unit]

defenderArmy
Type

List[Unit]

property total_army: int

All forces from a Battle

property total_losses: int

All losses from a Battle

class pyvic2waranalyzer.utils.types.OriginalWargoal(state: Optional[int] = None, casus_belli: Optional[str] = None, actor: Optional[str] = None, receiver: Optional[str] = None, country: Optional[str] = None)[source]

Represents an original wargoal in a War

state

A province id from ‘take state’ CB.

Type

int

casus_belli

The name of the casus belli.

Type

str

country

The name of the country which the actor wants to liberate.

Type

str

actor

The country which made this wargoal.

Type

str

receiver

The country which received this wargoal.

Type

str

class pyvic2waranalyzer.utils.types.Unit(soldier: Optional[str] = None, number: int = 0)[source]

Represents a unit in a Battle

soldier

Type of the unit.

Type

str

number

Number of soldiers in the unit.

Type

int

asdict()[source]

Returns a dict with the type of soldier and number of it.

Returns

Return type

dict

class pyvic2waranalyzer.utils.types.UnitList(*args)[source]

Represents a list of units in a Battle

asdict()[source]

Returns a dict with all soldiers in a battle and numbers of them.

Returns

Return type

dict

class pyvic2waranalyzer.utils.types.War(name: Optional[str] = None, action: Optional[str] = None)[source]

Represents a war between 2 nations or more

attackers

All attackers.

Type

list

defenders

All defenders.

Type

list

battles

A list of all battles in that war.

Type

List[Battle]

wargoals

A list of wargoals.

Type

List[Wargoal or OriginalWargoal]

action
Type

str

property total_army: int

All forces from a War

property total_losses: int

All losses from a War

class pyvic2waranalyzer.utils.types.Wargoal(state: Optional[int] = None, casus_belli: Optional[str] = None, actor: Optional[str] = None, receiver: Optional[str] = None, date: Optional[str] = None, is_fulfilled: Optional[bool] = None, score: Optional[float] = None, change: Optional[float] = None, country: Optional[str] = None)[source]

Represents a wargoal in a War

state

A province id from ‘take state’ CB.

Type

int

casus_belli

The name of the casus belli.

Type

str

actor

The country which made this wargoal.

Type

str

country

The name of the country which the actor wants to liberate.

Type

str

receiver

The country which received this wargoal.

Type

str

date

Wargoal date.

Type

str

is_fulfilled

May not be present, only if it’s an active war.

Type

bool

score

May not be present, only if it’s an active war.

Type

float

change

May not be present, only if it’s an active war.

Type

float

Indices and tables