PythonAPI - Battle
Working with "battle" methods is only possible after entering a battle (for a situation when an event is triggered, see the "events" methods), otherwise methods do not return anything as information they handle is only available in battle. To handle events you need to use "events.onSFMEvent" (see the description below in the "events" methods), returned parameters of this event are "eventName" (an event name), "eventData" (a dict with event parameters).
Available methods:
battle
getPlayersInfo()
getPlayerInfo(playerId)
getSelfPlayerInfo()
getPlayerInfoByName(name)
getPlayerShipInfo(playerId)
getPlayerByVehicleId(shipID)
getAmmoParams(ammoID)
isVehicleBurning(shipID)
isVehicleFlooding(shipID)
isBattleStarted()
battle.getPlayersInfo()
This function returns a dict, where keys are "playerID", and values are dict "PlayerInfo" with various information about the player.
To view the result, you can pass it to the "World_of_Warships\profile\python.log" file via "print", or write it in a separate file "open('filename', 'w')".
battle.getPlayerInfo(playerId)
This function returns an object with player information.
The input parameter is playerId (the player’s ID). The returned value is PlayerInfo.
battle.getSelfPlayerInfo()
This function returns an object with information about the player. The returned value is PlayerInfo.
battle.getPlayerInfoByName(name)
This function returns an object with information about the player.
The input parameter is name (the player’s nickname). The returned value is PlayerInfo.
battle.getPlayerShipInfo(playerId)
This function returns an object with information about the player’s ship.
The input parameter is playerId (the player’s ID). The returned value is ShipInfo.
battle.getPlayerByVehicleId(shipID)
This function returns an object with information about the player.
The input parameter is shipId (the ship’s ID). The returned value is PlayerInfo.
battle.getAmmoParams(ammoID)
This function returns an object with information about the shell.
The input parameter is ammoId (the shell ID, this value can be obtained in the event handler function "events.onReceiveShellInfo(func)" (see the description in the "events" methods).
battle.isVehicleBurning(shipID)
This function returns True if the ship is on fire, or False if it isn’t; for example, you can use it in the event handler function "events.onReceiveShellInfo(func)" (see the description in the "events" methods).
The input parameter is ID (the ship ID).
battle.isVehicleFlooding(shipID)
This function returns True if a shell hitting the ship caused flooding, or False if it’s not the case; it is recommended to use it in the same way as "isVehicleBurning".
The input parameter is ID (the ship ID).
battle.isBattleStarted()
This function returns True if the battle has started.