hive-bedrock-api 1.0.0 → 1.0.2

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.
@@ -21,6 +21,7 @@ export declare const formats: {
21
21
  sky: (game: SingleGameFormat | null) => SingleGameFormat | null;
22
22
  sg: (game: SingleGameFormat | null) => SingleGameFormat | null;
23
23
  wars: (game: SingleGameFormat | null) => SingleGameFormat | null;
24
+ grav: (game: SingleGameFormat | null) => SingleGameFormat | null;
24
25
  bridge: (game: SingleGameFormat | null) => SingleGameFormat | null;
25
26
  };
26
27
  export declare function gameFormatArray(gameType: GAME, games: SingleGameFormat[]): (SingleGameFormat | null)[];
@@ -56,13 +56,13 @@ exports.formats = (_a = {
56
56
  if ("first_played" in game)
57
57
  game.first_played = new Date(game.first_played * 1000);
58
58
  if ("played" in game && "victories" in game) {
59
- game.losses = (_b = (_a = game.played) !== null && _a !== void 0 ? _a : 0 - game.victories) !== null && _b !== void 0 ? _b : 0;
59
+ game.losses = ((_a = game.played) !== null && _a !== void 0 ? _a : 0) - ((_b = game.victories) !== null && _b !== void 0 ? _b : 0);
60
60
  game.win_percentage = game.victories / game.played;
61
61
  if (isNaN(game.win_percentage))
62
62
  game.win_percentage = 0;
63
63
  }
64
64
  if ("kills" in game && "deaths" in game)
65
- game.kdr = parseFloat(((_d = (_c = game.kills) !== null && _c !== void 0 ? _c : 0 / game.deaths) !== null && _d !== void 0 ? _d : 0).toFixed(2));
65
+ game.kdr = parseFloat((((_c = game.kills) !== null && _c !== void 0 ? _c : 0) / ((_d = game.deaths) !== null && _d !== void 0 ? _d : 0)).toFixed(2));
66
66
  return __assign({ id: gameType }, game);
67
67
  }
68
68
  },
@@ -107,7 +107,11 @@ exports.formats = (_a = {
107
107
  _a[GAME_INFO_1.GAME.TreasureWars] = function (game) {
108
108
  return game;
109
109
  },
110
+ _a[GAME_INFO_1.GAME.Gravity] = function (game) {
111
+ return game;
112
+ },
110
113
  _a[GAME_INFO_1.GAME.TheBridge] = function (game) {
114
+ var _a, _b;
111
115
  if (!game)
112
116
  return null;
113
117
  if ("m_solo_deaths" in game) {
@@ -130,6 +134,12 @@ exports.formats = (_a = {
130
134
  game.victories = game.m_solo_victories;
131
135
  delete game.m_solo_victories;
132
136
  }
137
+ if ("played" in game && "victories" in game) {
138
+ game.losses = (_b = (_a = game.played) !== null && _a !== void 0 ? _a : 0 - game.victories) !== null && _b !== void 0 ? _b : 0;
139
+ game.win_percentage = game.victories / game.played;
140
+ if (isNaN(game.win_percentage))
141
+ game.win_percentage = 0;
142
+ }
133
143
  return game;
134
144
  },
135
145
  _a);
@@ -37,6 +37,7 @@ export type API_GAME_STATS<M extends API_BASE_GAME_ALL | API_BASE_GAME_MONTHLY |
37
37
  [GAME.JustBuild]: M & API_GAME_BUILD;
38
38
  [GAME.BlockParty]: M & API_GAME_PARTY;
39
39
  [GAME.TheBridge]: M & API_GAME_BRIDGE;
40
+ [GAME.Gravity]: M & API_GAME_GRAV;
40
41
  };
41
42
  export type API_LB_STATS<G extends GAME> = API_GAME_STATS<API_BASE_LB>[G];
42
43
  export type API_GAME_STATS_ALL<G extends GAME> = API_GAME_STATS<API_BASE_GAME_ALL>[G];
@@ -168,3 +169,8 @@ export interface API_GAME_BRIDGE {
168
169
  goals: number;
169
170
  kills: number;
170
171
  }
172
+ export interface API_GAME_GRAV {
173
+ deaths: number;
174
+ maps_completed: number;
175
+ maps_completed_without_dying: number;
176
+ }
@@ -1,4 +1,4 @@
1
- import { API_BASE_GAME_ALL, API_BASE_GAME_MONTHLY, API_BASE_LB, API_GAME_BRIDGE, API_GAME_BUILD, API_GAME_CTF, API_GAME_DR, API_GAME_DROP, API_GAME_GROUND, API_GAME_HIDE, API_GAME_MURDER, API_GAME_PARTY, API_GAME_SG, API_GAME_SKY, API_GAME_WARS, API_USER_MAIN } from "./API";
1
+ import { API_BASE_GAME_ALL, API_BASE_GAME_MONTHLY, API_BASE_LB, API_GAME_BRIDGE, API_GAME_BUILD, API_GAME_CTF, API_GAME_DR, API_GAME_DROP, API_GAME_GRAV, API_GAME_GROUND, API_GAME_HIDE, API_GAME_MURDER, API_GAME_PARTY, API_GAME_SG, API_GAME_SKY, API_GAME_WARS, API_USER_MAIN } from "./API";
2
2
  import { GAME } from "./GAME_INFO";
3
3
  export type REQUEST_ALL = {
4
4
  [G in GAME]: GAME_STATS_ALL<G>;
@@ -22,6 +22,7 @@ export type GAME_STATS<M extends BASE_GAME_ALL | BASE_GAME_MONTHLY | BASE_LB> =
22
22
  [GAME.JustBuild]: M & GAME_BUILD;
23
23
  [GAME.BlockParty]: M & GAME_PARTY;
24
24
  [GAME.TheBridge]: M & GAME_BRIDGE;
25
+ [GAME.Gravity]: M & GAME_GRAV;
25
26
  };
26
27
  export type LB_STATS<G extends GAME> = GAME_STATS<BASE_LB>[G];
27
28
  export type GAME_STATS_ALL<G extends GAME> = GAME_STATS<BASE_GAME_ALL>[G];
@@ -80,3 +81,5 @@ export interface GAME_PARTY extends API_GAME_PARTY {
80
81
  export interface GAME_BRIDGE extends API_GAME_BRIDGE {
81
82
  kdr: number;
82
83
  }
84
+ export interface GAME_GRAV extends API_GAME_GRAV {
85
+ }
@@ -10,7 +10,8 @@ export declare enum GAME {
10
10
  GroundWars = "ground",
11
11
  JustBuild = "build",
12
12
  BlockParty = "party",
13
- TheBridge = "bridge"
13
+ TheBridge = "bridge",
14
+ Gravity = "grav"
14
15
  }
15
16
  interface GAME_INFO_TYPE {
16
17
  id: string;
@@ -16,6 +16,7 @@ var GAME;
16
16
  GAME["JustBuild"] = "build";
17
17
  GAME["BlockParty"] = "party";
18
18
  GAME["TheBridge"] = "bridge";
19
+ GAME["Gravity"] = "grav";
19
20
  })(GAME || (exports.GAME = GAME = {}));
20
21
  exports.GAME_INFO = (_a = {},
21
22
  _a[GAME.TreasureWars] = {
@@ -102,4 +103,11 @@ exports.GAME_INFO = (_a = {},
102
103
  incrementCap: null,
103
104
  prestige: false,
104
105
  },
106
+ _a[GAME.Gravity] = {
107
+ id: GAME.Gravity,
108
+ maxLevel: 25,
109
+ increment: 150,
110
+ incrementCap: null,
111
+ prestige: false,
112
+ },
105
113
  _a);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hive-bedrock-api",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
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",