moons-ta-client 1.1.9 → 1.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -51,7 +51,7 @@ export class TAClient extends CustomEventEmitter {
51
51
  oneofKind: "connect",
52
52
  connect: {
53
53
  clientVersion: versionCode,
54
- uiVersion: this.uiVersion ?? 0
54
+ uiVersion: this.uiVersion ?? 0,
55
55
  },
56
56
  },
57
57
  });
@@ -195,8 +195,8 @@ export class TAClient extends CustomEventEmitter {
195
195
  type: Response_ResponseType.Fail,
196
196
  respondingToPacketId: packet.id,
197
197
  details: {
198
- oneofKind: undefined
199
- }
198
+ oneofKind: undefined,
199
+ },
200
200
  },
201
201
  });
202
202
  }
@@ -263,7 +263,7 @@ export class TAClient extends CustomEventEmitter {
263
263
  type: {
264
264
  oneofKind: "modifyGameplay",
265
265
  modifyGameplay: {
266
- modifier: Command_ModifyGameplay_Modifier.InvertColors
266
+ modifier: Command_ModifyGameplay_Modifier.InvertColors,
267
267
  },
268
268
  },
269
269
  }, userIds);
@@ -273,7 +273,7 @@ export class TAClient extends CustomEventEmitter {
273
273
  type: {
274
274
  oneofKind: "modifyGameplay",
275
275
  modifyGameplay: {
276
- modifier: Command_ModifyGameplay_Modifier.InvertHandedness
276
+ modifier: Command_ModifyGameplay_Modifier.InvertHandedness,
277
277
  },
278
278
  },
279
279
  }, userIds);
@@ -302,6 +302,7 @@ export class TAClient extends CustomEventEmitter {
302
302
  join: {
303
303
  tournamentId,
304
304
  password: "",
305
+ modList: [],
305
306
  },
306
307
  },
307
308
  });
@@ -332,7 +333,7 @@ export class TAClient extends CustomEventEmitter {
332
333
  oneofKind: "loadSong",
333
334
  loadSong: {
334
335
  levelId,
335
- customHostUrl: ""
336
+ customHostUrl: "",
336
337
  },
337
338
  },
338
339
  }, userIds, timeout);
@@ -348,7 +349,7 @@ export class TAClient extends CustomEventEmitter {
348
349
  preloadImageForStreamSync: {
349
350
  fileId: uuidv4(),
350
351
  data: bitmap,
351
- compressed: false
352
+ compressed: false,
352
353
  },
353
354
  },
354
355
  }, userIds);
@@ -368,7 +369,7 @@ export class TAClient extends CustomEventEmitter {
368
369
  showTimer: !!timer,
369
370
  timeout: timer ?? 0,
370
371
  canClose: canClose,
371
- options
372
+ options,
372
373
  },
373
374
  },
374
375
  }, userIds, timer ? timer * 1000 : timer);
@@ -377,6 +378,24 @@ export class TAClient extends CustomEventEmitter {
377
378
  }
378
379
  return response;
379
380
  };
381
+ refundAttempts = async (tournamentId, qualifierId, mapId, platformId, count) => {
382
+ const response = await this.sendRequest({
383
+ type: {
384
+ oneofKind: "refundAttempts",
385
+ refundAttempts: {
386
+ tournamentId,
387
+ eventId: qualifierId,
388
+ mapId,
389
+ platformId,
390
+ count,
391
+ },
392
+ },
393
+ });
394
+ if (response.length <= 0) {
395
+ throw new Error("Server timed out, or no users responded");
396
+ }
397
+ return response;
398
+ };
380
399
  // --- Packet Handler --- //
381
400
  handlePacket = (packet) => {
382
401
  this.stateManager.handlePacket(packet);
@@ -397,14 +416,18 @@ export class TAClient extends CustomEventEmitter {
397
416
  // }
398
417
  if (packet.packet.oneofKind === "command") {
399
418
  const command = packet.packet.command;
400
- if (command.type.oneofKind === 'discordAuthorize') {
419
+ if (command.type.oneofKind === "discordAuthorize") {
401
420
  this.emit("authorizationRequestedFromServer", command.type.discordAuthorize);
402
421
  }
403
422
  }
404
- else if (packet.packet.oneofKind === 'request') {
423
+ else if (packet.packet.oneofKind === "request") {
405
424
  const request = packet.packet.request;
406
- if (request.type.oneofKind === 'loadSong') {
407
- this.emit("loadSongRequested", [packet.id, packet.from, request.type.loadSong]);
425
+ if (request.type.oneofKind === "loadSong") {
426
+ this.emit("loadSongRequested", [
427
+ packet.id,
428
+ packet.from,
429
+ request.type.loadSong,
430
+ ]);
408
431
  }
409
432
  }
410
433
  else if (packet.packet.oneofKind === "response") {
@@ -543,6 +566,9 @@ export class TAClient extends CustomEventEmitter {
543
566
  else if (push.data.oneofKind === "realtimeScore") {
544
567
  this.emit("realtimeScore", push.data.realtimeScore);
545
568
  }
569
+ else if (push.data.oneofKind === "qualifierScoreSubmtited") {
570
+ this.emit("qualifierScoreSubmitted", push.data.qualifierScoreSubmtited);
571
+ }
546
572
  }
547
573
  };
548
574
  // --- State Actions --- //
@@ -584,7 +610,7 @@ export class TAClient extends CustomEventEmitter {
584
610
  addUserToMatch: {
585
611
  tournamentId,
586
612
  matchId,
587
- userId
613
+ userId,
588
614
  },
589
615
  },
590
616
  });
@@ -600,7 +626,7 @@ export class TAClient extends CustomEventEmitter {
600
626
  removeUserFromMatch: {
601
627
  tournamentId,
602
628
  matchId,
603
- userId
629
+ userId,
604
630
  },
605
631
  },
606
632
  });
@@ -616,7 +642,7 @@ export class TAClient extends CustomEventEmitter {
616
642
  setMatchLeader: {
617
643
  tournamentId,
618
644
  matchId,
619
- userId
645
+ userId,
620
646
  },
621
647
  },
622
648
  });
@@ -632,7 +658,7 @@ export class TAClient extends CustomEventEmitter {
632
658
  setMatchMap: {
633
659
  tournamentId,
634
660
  matchId,
635
- map
661
+ map,
636
662
  },
637
663
  },
638
664
  });
@@ -678,7 +704,7 @@ export class TAClient extends CustomEventEmitter {
678
704
  setQualifierName: {
679
705
  tournamentId,
680
706
  qualifierId,
681
- qualifierName
707
+ qualifierName,
682
708
  },
683
709
  },
684
710
  });
@@ -694,7 +720,7 @@ export class TAClient extends CustomEventEmitter {
694
720
  setQualifierImage: {
695
721
  tournamentId,
696
722
  qualifierId,
697
- qualifierImage
723
+ qualifierImage,
698
724
  },
699
725
  },
700
726
  });
@@ -710,7 +736,7 @@ export class TAClient extends CustomEventEmitter {
710
736
  setQualifierInfoChannel: {
711
737
  tournamentId,
712
738
  qualifierId,
713
- infoChannel
739
+ infoChannel,
714
740
  },
715
741
  },
716
742
  });
@@ -726,7 +752,7 @@ export class TAClient extends CustomEventEmitter {
726
752
  setQualifierFlags: {
727
753
  tournamentId,
728
754
  qualifierId,
729
- qualifierFlags
755
+ qualifierFlags,
730
756
  },
731
757
  },
732
758
  });
@@ -742,7 +768,7 @@ export class TAClient extends CustomEventEmitter {
742
768
  setQualifierLeaderboardSort: {
743
769
  tournamentId,
744
770
  qualifierId,
745
- qualifierLeaderboardSort
771
+ qualifierLeaderboardSort,
746
772
  },
747
773
  },
748
774
  });
@@ -758,7 +784,7 @@ export class TAClient extends CustomEventEmitter {
758
784
  addQualifierMaps: {
759
785
  tournamentId,
760
786
  qualifierId,
761
- maps
787
+ maps,
762
788
  },
763
789
  },
764
790
  });
@@ -774,7 +800,7 @@ export class TAClient extends CustomEventEmitter {
774
800
  updateQualifierMap: {
775
801
  tournamentId,
776
802
  qualifierId,
777
- map
803
+ map,
778
804
  },
779
805
  },
780
806
  });
@@ -790,7 +816,7 @@ export class TAClient extends CustomEventEmitter {
790
816
  removeQualifierMap: {
791
817
  tournamentId,
792
818
  qualifierId,
793
- mapId
819
+ mapId,
794
820
  },
795
821
  },
796
822
  });
@@ -821,7 +847,7 @@ export class TAClient extends CustomEventEmitter {
821
847
  addAuthorizedUser: {
822
848
  tournamentId,
823
849
  discordId,
824
- permissionFlags
850
+ permissionFlags,
825
851
  },
826
852
  },
827
853
  });
@@ -836,7 +862,7 @@ export class TAClient extends CustomEventEmitter {
836
862
  oneofKind: "removeAuthorizedUser",
837
863
  removeAuthorizedUser: {
838
864
  tournamentId,
839
- discordId
865
+ discordId,
840
866
  },
841
867
  },
842
868
  });
@@ -865,7 +891,7 @@ export class TAClient extends CustomEventEmitter {
865
891
  oneofKind: "getDiscordInfo",
866
892
  getDiscordInfo: {
867
893
  tournamentId,
868
- discordId
894
+ discordId,
869
895
  },
870
896
  },
871
897
  });
@@ -879,7 +905,7 @@ export class TAClient extends CustomEventEmitter {
879
905
  type: {
880
906
  oneofKind: "getBotTokensForUser",
881
907
  getBotTokensForUser: {
882
- ownerDiscordId
908
+ ownerDiscordId,
883
909
  },
884
910
  },
885
911
  });
@@ -893,7 +919,7 @@ export class TAClient extends CustomEventEmitter {
893
919
  type: {
894
920
  oneofKind: "generateBotToken",
895
921
  generateBotToken: {
896
- username
922
+ username,
897
923
  },
898
924
  },
899
925
  });
@@ -907,7 +933,7 @@ export class TAClient extends CustomEventEmitter {
907
933
  type: {
908
934
  oneofKind: "revokeBotToken",
909
935
  revokeBotToken: {
910
- botTokenGuid
936
+ botTokenGuid,
911
937
  },
912
938
  },
913
939
  });
@@ -936,7 +962,7 @@ export class TAClient extends CustomEventEmitter {
936
962
  oneofKind: "setTournamentName",
937
963
  setTournamentName: {
938
964
  tournamentId,
939
- tournamentName
965
+ tournamentName,
940
966
  },
941
967
  },
942
968
  });
@@ -951,7 +977,7 @@ export class TAClient extends CustomEventEmitter {
951
977
  oneofKind: "setTournamentImage",
952
978
  setTournamentImage: {
953
979
  tournamentId,
954
- tournamentImage
980
+ tournamentImage,
955
981
  },
956
982
  },
957
983
  });
@@ -966,7 +992,7 @@ export class TAClient extends CustomEventEmitter {
966
992
  oneofKind: "setTournamentEnableTeams",
967
993
  setTournamentEnableTeams: {
968
994
  tournamentId,
969
- enableTeams
995
+ enableTeams,
970
996
  },
971
997
  },
972
998
  });
@@ -981,7 +1007,7 @@ export class TAClient extends CustomEventEmitter {
981
1007
  oneofKind: "setTournamentEnablePools",
982
1008
  setTournamentEnablePools: {
983
1009
  tournamentId,
984
- enablePools
1010
+ enablePools,
985
1011
  },
986
1012
  },
987
1013
  });
@@ -996,7 +1022,7 @@ export class TAClient extends CustomEventEmitter {
996
1022
  oneofKind: "setTournamentShowTournamentButton",
997
1023
  setTournamentShowTournamentButton: {
998
1024
  tournamentId,
999
- showTournamentButton
1025
+ showTournamentButton,
1000
1026
  },
1001
1027
  },
1002
1028
  });
@@ -1011,7 +1037,7 @@ export class TAClient extends CustomEventEmitter {
1011
1037
  oneofKind: "setTournamentShowQualifierButton",
1012
1038
  setTournamentShowQualifierButton: {
1013
1039
  tournamentId,
1014
- showQualifierButton
1040
+ showQualifierButton,
1015
1041
  },
1016
1042
  },
1017
1043
  });
@@ -1026,7 +1052,7 @@ export class TAClient extends CustomEventEmitter {
1026
1052
  oneofKind: "setTournamentAllowUnauthorizedView",
1027
1053
  setTournamentAllowUnauthorizedView: {
1028
1054
  tournamentId,
1029
- allowUnauthorizedView
1055
+ allowUnauthorizedView,
1030
1056
  },
1031
1057
  },
1032
1058
  });
@@ -1041,7 +1067,7 @@ export class TAClient extends CustomEventEmitter {
1041
1067
  oneofKind: "setTournamentScoreUpdateFrequency",
1042
1068
  setTournamentScoreUpdateFrequency: {
1043
1069
  tournamentId,
1044
- scoreUpdateFrequency
1070
+ scoreUpdateFrequency,
1045
1071
  },
1046
1072
  },
1047
1073
  });
@@ -1053,10 +1079,10 @@ export class TAClient extends CustomEventEmitter {
1053
1079
  setTournamentBannedMods = async (tournamentId, bannedMods) => {
1054
1080
  const response = await this.sendRequest({
1055
1081
  type: {
1056
- oneofKind: 'setTournamentBannedMods',
1082
+ oneofKind: "setTournamentBannedMods",
1057
1083
  setTournamentBannedMods: {
1058
1084
  tournamentId,
1059
- bannedMods
1085
+ bannedMods,
1060
1086
  },
1061
1087
  },
1062
1088
  });
@@ -1071,7 +1097,7 @@ export class TAClient extends CustomEventEmitter {
1071
1097
  oneofKind: "addTournamentTeam",
1072
1098
  addTournamentTeam: {
1073
1099
  tournamentId,
1074
- team
1100
+ team,
1075
1101
  },
1076
1102
  },
1077
1103
  });
@@ -1087,7 +1113,7 @@ export class TAClient extends CustomEventEmitter {
1087
1113
  setTournamentTeamName: {
1088
1114
  tournamentId,
1089
1115
  teamId,
1090
- teamName
1116
+ teamName,
1091
1117
  },
1092
1118
  },
1093
1119
  });
@@ -1103,7 +1129,7 @@ export class TAClient extends CustomEventEmitter {
1103
1129
  setTournamentTeamImage: {
1104
1130
  tournamentId,
1105
1131
  teamId,
1106
- teamImage
1132
+ teamImage,
1107
1133
  },
1108
1134
  },
1109
1135
  });
@@ -1118,7 +1144,7 @@ export class TAClient extends CustomEventEmitter {
1118
1144
  oneofKind: "removeTournamentTeam",
1119
1145
  removeTournamentTeam: {
1120
1146
  tournamentId,
1121
- teamId
1147
+ teamId,
1122
1148
  },
1123
1149
  },
1124
1150
  });
@@ -1133,7 +1159,7 @@ export class TAClient extends CustomEventEmitter {
1133
1159
  oneofKind: "addTournamentPool",
1134
1160
  addTournamentPool: {
1135
1161
  tournamentId,
1136
- pool
1162
+ pool,
1137
1163
  },
1138
1164
  },
1139
1165
  });
@@ -1149,7 +1175,7 @@ export class TAClient extends CustomEventEmitter {
1149
1175
  setTournamentPoolName: {
1150
1176
  tournamentId,
1151
1177
  poolId,
1152
- poolName
1178
+ poolName,
1153
1179
  },
1154
1180
  },
1155
1181
  });
@@ -1165,7 +1191,7 @@ export class TAClient extends CustomEventEmitter {
1165
1191
  addTournamentPoolMaps: {
1166
1192
  tournamentId,
1167
1193
  poolId,
1168
- maps
1194
+ maps,
1169
1195
  },
1170
1196
  },
1171
1197
  });
@@ -1181,7 +1207,7 @@ export class TAClient extends CustomEventEmitter {
1181
1207
  updateTournamentPoolMap: {
1182
1208
  tournamentId,
1183
1209
  poolId,
1184
- map
1210
+ map,
1185
1211
  },
1186
1212
  },
1187
1213
  });
@@ -1197,7 +1223,7 @@ export class TAClient extends CustomEventEmitter {
1197
1223
  removeTournamentPoolMap: {
1198
1224
  tournamentId,
1199
1225
  poolId,
1200
- mapId
1226
+ mapId,
1201
1227
  },
1202
1228
  },
1203
1229
  });
@@ -1212,7 +1238,7 @@ export class TAClient extends CustomEventEmitter {
1212
1238
  oneofKind: "removeTournamentPool",
1213
1239
  removeTournamentPool: {
1214
1240
  tournamentId,
1215
- poolId
1241
+ poolId,
1216
1242
  },
1217
1243
  },
1218
1244
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "moons-ta-client",
3
- "version": "1.1.9",
3
+ "version": "1.1.11",
4
4
  "type": "module",
5
5
  "main": "./dist/index.esm.js",
6
6
  "types": "./dist/index.d.ts",