hive-bedrock-api 0.1.0-beta.4 → 0.1.0-beta.6

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.
@@ -41,23 +41,26 @@ exports.formats = (_a = {
41
41
  return player;
42
42
  },
43
43
  default: function (gameType, game) {
44
+ var _a, _b, _c, _d;
44
45
  if (!game)
45
46
  return null;
46
47
  if ("index" in game && game.index == 2147483646)
47
48
  return null;
48
- if ("xp" in game) {
49
- game.level = (0, calculateLevel_1.default)(game.xp, GAME_INFO_1.GAME.CaptureTheFlag);
49
+ if (!("index" in game)) {
50
+ if ("xp" in game) {
51
+ game.level = (0, calculateLevel_1.default)(game.xp, gameType);
52
+ }
53
+ else
54
+ return null;
50
55
  }
51
- else
52
- return null;
53
56
  if ("first_played" in game)
54
57
  game.first_played = new Date(game.first_played * 1000);
55
58
  if ("played" in game && "victories" in game) {
56
- game.losses = game.played - game.victories;
57
- game.win_percentage = parseFloat((game.victories / game.played).toFixed(2));
59
+ game.losses = (_b = (_a = game.played) !== null && _a !== void 0 ? _a : 0 - game.victories) !== null && _b !== void 0 ? _b : 0;
60
+ game.win_percentage = game.victories / game.played;
58
61
  }
59
62
  if ("kills" in game && "deaths" in game)
60
- game.kdr = parseFloat((game.kills / game.deaths).toFixed(2));
63
+ game.kdr = parseFloat(((_d = (_c = game.kills) !== null && _c !== void 0 ? _c : 0 / game.deaths) !== null && _d !== void 0 ? _d : 0).toFixed(2));
61
64
  return __assign({ id: gameType }, game);
62
65
  }
63
66
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hive-bedrock-api",
3
- "version": "0.1.0-beta.4",
3
+ "version": "0.1.0-beta.6",
4
4
  "description": "An API wrapper for the Hive Minecraft Bedrock Edition server.",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",