@pma-network/shared-server 0.0.8 → 0.0.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.
@@ -1,8 +1,7 @@
1
1
  import { Player } from "@nativewrappers/server";
2
- import type { ItemName } from "@redm-types/Inventory";
3
- import type { NotificationVariant, PMAPartialNotification } from "@redm-types/Notifications";
4
2
  import type { CommonAbstractPMAPlayer } from "../types/CommonAbstractPMAPlayer";
5
- import type { CallSign, PlayerJob, PlayerUID } from "../types/SharedTypes";
3
+ import type { CommonNotificationVariant, CommonPMAPartialNotification } from "../types/CommonNotifications";
4
+ import type { CallSign, ItemName, PlayerJob, PlayerUID } from "../types/SharedTypes";
6
5
  export declare class CommonPMAPlayer extends Player implements CommonAbstractPMAPlayer {
7
6
  #private;
8
7
  /**
@@ -20,8 +19,8 @@ export declare class CommonPMAPlayer extends Player implements CommonAbstractPMA
20
19
  constructor(source: number);
21
20
  constructor(pma_player: CommonAbstractPMAPlayer);
22
21
  ensure_init(): void;
23
- send_notification(title?: string, description?: string, variant?: NotificationVariant, duration?: number): void;
24
- send_notification_object(partial: PMAPartialNotification): void;
22
+ send_notification(title?: string, description?: string, variant?: CommonNotificationVariant, duration?: number): void;
23
+ send_notification_object(partial: CommonPMAPartialNotification): void;
25
24
  get_sex(): number;
26
25
  get_height(): number;
27
26
  get_dob(): string;
@@ -2,6 +2,7 @@ var __defProp = Object.defineProperty;
2
2
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
3
  import { Player } from "@nativewrappers/server";
4
4
  import { framework_name } from "../utils/FrameworkName";
5
+ import { pma_get_player_from_id } from "../utils/GlobalOverrides";
5
6
  class CommonPMAPlayer extends Player {
6
7
  static {
7
8
  __name(this, "CommonPMAPlayer");
@@ -43,7 +44,10 @@ class CommonPMAPlayer extends Player {
43
44
  // Ensure we initialize the player whenever we're doing something that needs it.
44
45
  ensure_init() {
45
46
  if (!this.#pma_player) {
46
- this.#pma_player = exports[framework_name].from_source(this.Source);
47
+ this.#pma_player = globalThis.pma_get_player_from_id ? (
48
+ // @ts-ignore: we override this in GlobalOverrides
49
+ globalThis.pma_get_player_from_id(this.Source)
50
+ ) : pma_get_player_from_id(this.Source);
47
51
  }
48
52
  }
49
53
  send_notification(title, description, variant = "default", duration = 5e3) {
package/index.d.ts CHANGED
@@ -1,7 +1,9 @@
1
1
  export * from "./CommonPMA";
2
2
  export * from "./utils/CooldownTracker";
3
3
  export * from "./utils/FrameworkName";
4
+ export * from "./utils/GlobalOverrides";
4
5
  export * from "./utils/InfractionsWrapper";
5
6
  export * from "./types/CommonAbstractPMAPlayer";
7
+ export * from "./types/CommonNotifications";
6
8
  export * from "./types/SharedTypes";
7
9
  export * from "./class/CommonPMAPlayer";
package/index.js CHANGED
@@ -1,7 +1,9 @@
1
1
  export * from "./CommonPMA";
2
2
  export * from "./utils/CooldownTracker";
3
3
  export * from "./utils/FrameworkName";
4
+ export * from "./utils/GlobalOverrides";
4
5
  export * from "./utils/InfractionsWrapper";
5
6
  export * from "./types/CommonAbstractPMAPlayer";
7
+ export * from "./types/CommonNotifications";
6
8
  export * from "./types/SharedTypes";
7
9
  export * from "./class/CommonPMAPlayer";
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "Dillon Skaggs <AvarianKnight>"
6
6
  ],
7
7
  "type": "module",
8
- "version": "0.0.8",
8
+ "version": "0.0.11",
9
9
  "files": [
10
10
  "./**/*.js",
11
11
  "./**/*.d.ts"
@@ -0,0 +1,12 @@
1
+ export type Position = "top-left" | "top-center" | "top-right" | "middle-left" | "middle" | "middle-right" | "bottom-left" | "bottom-center" | "bottom-right";
2
+ export type CommonNotificationVariant = "default" | "error" | "success";
3
+ export type CommonPMAPartialNotification = Omit<CommonPMANotification, "id">;
4
+ export type CommonPMANotification = {
5
+ id: number;
6
+ title?: string;
7
+ body?: string;
8
+ variant: CommonNotificationVariant;
9
+ duration?: number;
10
+ position?: Position;
11
+ timeout?: number;
12
+ };
File without changes
@@ -0,0 +1,3 @@
1
+ import type { CommonPMAPlayer } from "../class/CommonPMAPlayer";
2
+ import type { Source } from "../types/SharedTypes";
3
+ export declare function pma_get_player_from_id(source: Source): CommonPMAPlayer;
@@ -0,0 +1,11 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ import { framework_name } from "./FrameworkName";
4
+ function pma_get_player_from_id(source) {
5
+ return exports[framework_name].from_source(source);
6
+ }
7
+ __name(pma_get_player_from_id, "pma_get_player_from_id");
8
+ globalThis.pma_get_player_from_id = pma_get_player_from_id;
9
+ export {
10
+ pma_get_player_from_id
11
+ };