Skip to content

ModaqControl props

Alejandro edited this page Dec 22, 2021 · 5 revisions

IModaqControlProps

All IModaqControlProps fields are optional.

  • buildVersion: The version you want to show in the Help dialog.
  • customExport: Changes the export options to a single button in the top menu, and calls the onExport method when its clicked. This is passed in as an ICustomExport instance.
  • gameFormat: Format-specific rules for the game, such as the number of points per power or if overtime has bonuses. Passed in as an IGameFormat instance.
  • googleClientId: The client ID of the Google application the host uses to connect to Google Sheets. This is needed for loading and saving games to TJ Sheets and UCSD Sheets.
  • packet: The packet of questions as an IPacket instance.
  • persistState: Determines if the MODAQ control should persist its state locally between sessions. When users refresh the page, they will see the same packet and teams. This can only be set on the first render. Defaults to true.
  • players: The players in the game. This is passed in as an array of IPlayer.
  • storeName: The name of the localStorage field where the state is stored. State is only stored if persistState isn't set to false.
  • yappServiceUrl: The URL to the Yet Another Packet Parser (YAPP) server, which parses packets in the DOCX format for MODAQ to read. This is needed to read .docx packet files; otherwise, the packet either needs to be passed in through the packet prop, or the user has to choose a pre-parsed packet in the JSON format.

IBonus

  • answers: An array of answers for each bonus part. The length of this array must match the length of the parts and values arrays.
  • difficultyModifiers (optional): A character (e for easy, m for medium, h for hard) indicating the difficulty of a part. This must match the length of the parts array.
  • leadin: The leadin to the bonus.
  • values: The number of points each part is worth. This must match the length of the parts array.

ICustomExport

  • label: Label for the export button in the top menu.
  • onExport: The callback which is called when the export button is pressed. Returns a QBJ Match if the type is set to "QBJ", or an object containing the players, packet, and cycles if type is set to "Raw".
  • type: The type of custom export. Use "Raw" to get the raw game state (players, packet, cycles), or "QBJ" to get a QBJ Match.

IGameFormat

  • bonusesBounceBack: If false, then only the team who got the tossup (receiving team) can answer the bonus, and the reader will check each part that the team answers correctly. If true, then the other team can answer if the receiving team answers incorrectly. The reader will choose which team answered correctly from a dropdown.
  • displayName: The name of the game format to display in the New Game dialog.
  • minimumOvertimeQuestionCount: The minimum number of questions to play in overtime before a team can win.
  • negValue: The number of points to add when someone buzzes incorrectly. This value must be less than or equal to 0.
  • overtimeIncludesBonuses: If true, overtime rounds have a tossup and bonus cycle. If false, only tossups appear during overtime rounds.
  • powers: An array of { marker, points } pairs, where marker is the text used to mark something as in power (e.g. "(*)"), and points specifies how many points a correct answer is worth before that point in time. This array must be in descending order based on points, e.g. if there are powers for 20 and 15 points, the pair for the 20 point bonus must be the first element. An empty array means that there are no powers.
  • pronunciationGuideMarkers: A two-element array specifying the start and end of a pronunciation guide. For example, if a pronunciation guide looks like "(MOW-dak)", then this array would be ["(", ")"].
  • timeoutsAllowed: Currently unused. Will be used to track if timeouts are available in this format.
  • version: Which version the game format this is. Used to check compatibility with existing saved games.

IPacket

  • bonuses (optional): An array of IBonus bonus questions. This is optional since some formats omit bonuses.
  • tossups: An array of ITossup tossup questions.

IPlayer

  • isStarter: If the player is in the starting lineup, then set this to true. Set it to false otherwise.
  • name: Name of the player. This must be unique per team.
  • teamName: Name of the team. There must be two unique team names in the array of players.

ITossup

  • answer: Tossup answer.
  • question: Question text for the tossup.