SHARE
TWEET

Untitled

a guest Nov 19th, 2019 82 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function prettyPrint(settings) {
  2.   let player1;
  3.   let player2;
  4.  
  5.   if (settings.isTeams) {
  6.     let teams = {};
  7.     console.log(settings.players);
  8.     for (const player of settings.players) {
  9.       if (!(player.teamId in teams)) {
  10.         teams[player.teamId] = [];
  11.       }
  12.       teams[player.teamId].push(playerName(player));
  13.     }
  14.  
  15.     let team1 = 0;
  16.     let team2 = 1;
  17.  
  18.     for (let team_pos=0; team_pos<2; team_pos++) {
  19.         for (let i=team1+team_pos; i<4; i++) {
  20.             if (teams[i] != null) {
  21.                 if (team_pos == 0) {
  22.                     team1 = i;
  23.                 } else {
  24.                     team2 = i;
  25.                 }
  26.                 break;
  27.             }
  28.         }
  29.     }
  30.  
  31.     player1 = teams[team1].join(' & ');
  32.     player2 = teams[team2].join(' & ');
  33.   } else {
  34.     player1 = playerName(settings.players[0]);
  35.     player2 = playerName(settings.players[1]);
  36.   }
  37.  
  38.   return `${player1} vs ${player2} - ${slp.stages.getStageName(settings.stageId)}`;
  39. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top