Skip to content

Commit

Permalink
chore: format stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
itschip committed Sep 3, 2024
1 parent 43fea82 commit 6a37cc7
Show file tree
Hide file tree
Showing 15 changed files with 12,976 additions and 10,358 deletions.
142 changes: 71 additions & 71 deletions apps/game/server/bridge/ndcore/ndcore-server.ts
Original file line number Diff line number Diff line change
@@ -1,86 +1,86 @@
import { config } from '@npwd/config/server';
import PlayerService from '../../players/player.service';
import { mainLogger } from '../../sv_logger';
import { Strategy } from '../framework-strategy';
import { config } from "@npwd/config/server";
import PlayerService from "../../players/player.service";
import { mainLogger } from "../../sv_logger";
import { Strategy } from "../framework-strategy";

type NDPlayer = {
id: number;
source: number;
identifier: string;
nickname: string;
user: string;
roles: unknown;
name: string;
firstname: string;
lastname: string;
fullname: string;
dob: string;
gender: string;
phonenumber: string;
cash: number;
bank: number;
groups: unknown;
job: string;
jobInfo: unknown;
label: string;
rankName: string;
rank: number;
metadata: unknown;
inventory: unknown;
id: number;
source: number;
identifier: string;
nickname: string;
user: string;
roles: unknown;
name: string;
firstname: string;
lastname: string;
fullname: string;
dob: string;
gender: string;
phonenumber: string;
cash: number;
bank: number;
groups: unknown;
job: string;
jobInfo: unknown;
label: string;
rankName: string;
rank: number;
metadata: unknown;
inventory: unknown;
};

// and this phone was supposed to be a 100% standalone my ass
export class NDCoreFramework implements Strategy {
constructor() {
mainLogger.info('Loading NDCore bridge....');
constructor() {
mainLogger.info("Loading NDCore bridge....");

config.general.useResourceIntegration = true;
config.database.identifierColumn = 'charid';
config.database.phoneNumberColumn = 'phonenumber';
config.database.playerTable = 'nd_characters';
config.database.identifierType = 'license';
}
config.general.useResourceIntegration = true;
config.database.identifierColumn = "charid";
config.database.phoneNumberColumn = "phonenumber";
config.database.playerTable = "nd_characters";
config.database.identifierType = "license";
}

init(): void {
on('ND:characterLoaded', async (player: NDPlayer) => {
const playerIdent = player.id;
const phoneNumber = player?.phonenumber;
const playerSrc = player.source;
init(): void {
on("ND:characterLoaded", async (player: NDPlayer) => {
const playerIdent = player.id;
const phoneNumber = player?.phonenumber;
const playerSrc = player.source;

await PlayerService.handleNewPlayerEvent({
identifier: playerIdent.toString(),
source: playerSrc,
phoneNumber: phoneNumber ?? null,
firstname: player.firstname,
lastname: player.lastname,
});
});
await PlayerService.handleNewPlayerEvent({
identifier: playerIdent.toString(),
source: playerSrc,
phoneNumber: phoneNumber ?? null,
firstname: player.firstname,
lastname: player.lastname,
});
});

on('ND:characterUnloaded', async (source: number) => {
await PlayerService.handleUnloadPlayerEvent(source);
});
on("ND:characterUnloaded", async (source: number) => {
await PlayerService.handleUnloadPlayerEvent(source);
});

mainLogger.info('NDCore bridge initialized');
}
mainLogger.info("NDCore bridge initialized");
}

onStart(): void {
on('onServerResourceStart', async (resource: string) => {
const NDCore = global.exports['ND_Core'];
onStart(): void {
on("onServerResourceStart", async (resource: string) => {
const NDCore = global.exports["ND_Core"];

if (resource === GetCurrentResourceName()) {
const onlinePlayers = NDCore.getPlayers() as NDPlayer[];
for (const player of onlinePlayers) {
const phoneNumber = player?.phonenumber;
if (resource === GetCurrentResourceName()) {
const onlinePlayers = NDCore.getPlayers() as NDPlayer[];
for (const player of onlinePlayers) {
const phoneNumber = player?.phonenumber;

await PlayerService.handleNewPlayerEvent({
source: player.source,
identifier: player.id.toString(),
phoneNumber: phoneNumber ?? null,
firstname: player.firstname,
lastname: player.lastname,
});
}
}
});
}
await PlayerService.handleNewPlayerEvent({
source: player.source,
identifier: player.id.toString(),
phoneNumber: phoneNumber ?? null,
firstname: player.firstname,
lastname: player.lastname,
});
}
}
});
}
}
Loading

0 comments on commit 6a37cc7

Please sign in to comment.