_images/pyzora.svg

The RingSecret class#

Related module: pyzora.ring_secret

class pyzora.ring_secret.RingSecret(*args, **kwargs)#

Bases: BaseSecret

A ring secret. Ring secrets can be used to transfer a player’s ring collection from one game to another.

You can check if a ring is contained in a secret with the ‘in’ keyword.

For example, if you want to check if the player already has the Friendship Ring, you can do this :

if FRIENDSHIP in secret:

do_whatever_you_want()

property rings#

Get the rings stored in the secret as an integer.

Type:

int, AllRings or NoRings

property ring_count#

Count how many rings the player has.

classmethod load(secret: bytearray | bytes | str, region: GameRegion) RingSecret#

Load a secret encoded with a certain region.

Parameters:
  • secret (str or bytearray) – The secret string/byte array to decode (if secret is an instance of str, then it will be parsed prior to loading).

  • region (GameRegion) – The region to use when loading the secret.

Raises:
  • SecretError – if the given data is not 15 bytes long (only if used with bytes or bytearray, since strings will be parsed and reduced to 15 bytes).

  • NotARingCodeError – if the given data is not for a ring secret.

  • ChecksumError – if the given data’s checksum doesn’t match the expected one.

Returns:

A secret based on the data contained in secret.

Return type:

RingSecret

to_list()#

Return self as a list of ring types.