From Werewolf Wiki
Jump to navigation Jump to search

The player_win event is called once per player in the game that did not disconnect (idle/quit), and is used to determine whether they had a team and/or individual win. Additional metadata may be attached to the player record which will show up in that player's game stats; this is used to mark lovers for example.

Event callback

def on_player_win(event: Event, cli: IRCClient, var: module, nick: str, role: str, winner: str, survived: bool) -> None
  • prevent_default has no effect for this event
  • event: The event object
  • cli: The IRC connection
  • var: Reference to the src.settings module
  • nick: Player whose win status is being checked
  • role: The player's final role
  • winner: The listed winner for the game, values include villagers, wolves, monsters, or @ followed by a player's nickname for a fool win.
  • survived: True if the player was alive at the end of the game

Event data

    "won": bool,
    "iwon": bool,
    "special": list(str)

Modify won and iwon appropriately to set a team or individual win for the player. It is initialized based on the winning team and whether the player's role was wolf-aligned, true neutral, or neither. Strings may be added to the special list to tag the player with additional metadata to be recorded in the database for that game.