Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
"oxInventoryEvents": {
"enabled": true,
"dataset": "default"
},
"qbxBankrobberyEvents": {
"enabled": false,
"dataset": "default"
}
}
}
20 changes: 19 additions & 1 deletion config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,23 @@
}
},
"default": { "enabled": false, "dataset": "default" }
},
"qbxBankrobberyEvents": {
"description": "qbx_bankrobbery events configuration.",
"type": "object",
"properties": {
"enabled": {
"description": "Enable qbx_bankrobbery events to be logged.",
"type": "boolean",
"default": false
},
"dataset": {
"description": "Dataset to use for qbx_bankrobbery events.",
"type": "string",
"default": "default"
}
},
"default": { "enabled": false, "dataset": "default" }
}
},
"required": [
Expand All @@ -144,7 +161,8 @@
"playerEvents",
"chatEvents",
"txAdminEvents",
"oxInventoryEvents"
"oxInventoryEvents",
"qbxBankrobberyEvents"
]
}
},
Expand Down
1 change: 1 addition & 0 deletions features/logs/server/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import './chat';
import './txadmin'
import './baseevents'
import './third-party/ox-inventory'
import './third-party/qbx-bankrobbery'

const levels = config.logs.levels.reduce<Record<string, number>>(
(acc, curr, idx) => {
Expand Down
97 changes: 97 additions & 0 deletions features/logs/server/third-party/qbx-bankrobbery.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
import { config } from "~/utils/common/config";
import { ingest } from "../logger";

if (config.logs.qbxBankrobberyEvents.enabled) {
const dataset = config.logs.qbxBankrobberyEvents.dataset;

onNet("qbx_bankrobbery:server:setBankState", (bankId: string | number) => {
const source = global.source;
const playerSource = source;
ingest(dataset, "info", "qbx_bankrobbery.robbery.started", {
playerSource,
playerName: GetPlayerName(source.toString()),
bankId,
bankType: typeof bankId === "number" ? "small" : bankId,
}, {
_internal_RESOURCE: "qbx_bankrobbery",
});
});

onNet("qbx_bankrobbery:server:callCops", (type: string, bank: string | number, coords: number[]) => {
const source = global.source;
const playerSource = source;
ingest(dataset, "info", "qbx_bankrobbery.alarm.triggered", {
playerSource,
playerName: GetPlayerName(source.toString()),
bankType: type,
bankId: bank,
coords,
}, {
_internal_RESOURCE: "qbx_bankrobbery",
});
});

onNet("qbx_bankrobbery:server:recieveItem", (type: string, bankId: string | number, lockerId: string | number) => {
const source = global.source;
const playerSource = source;
ingest(dataset, "info", "qbx_bankrobbery.loot.received", {
playerSource,
playerName: GetPlayerName(source.toString()),
bankType: type,
bankId,
lockerId,
}, {
_internal_RESOURCE: "qbx_bankrobbery",
});
});

onNet("qbx_bankrobbery:server:SetStationStatus", (key: string, isHit: boolean) => {
const source = global.source;
const playerSource = source;
ingest(dataset, "info", isHit ? "qbx_bankrobbery.powerStation.hit" : "qbx_bankrobbery.powerStation.restored", {
playerSource,
playerName: GetPlayerName(source.toString()),
stationKey: key,
isHit,
}, {
_internal_RESOURCE: "qbx_bankrobbery",
});
});

onNet("qbx_bankrobbery:server:removeElectronicKit", () => {
const source = global.source;
const playerSource = source;
ingest(dataset, "info", "qbx_bankrobbery.item.electronicKitUsed", {
playerSource,
playerName: GetPlayerName(source.toString()),
}, {
_internal_RESOURCE: "qbx_bankrobbery",
});
});

onNet("qbx_bankrobbery:server:removeBankCard", (number: number) => {
const source = global.source;
const playerSource = source;
ingest(dataset, "info", "qbx_bankrobbery.item.bankCardUsed", {
playerSource,
playerName: GetPlayerName(source.toString()),
cardNumber: number,
}, {
_internal_RESOURCE: "qbx_bankrobbery",
});
});

on("qbx_bankrobbery:server:setTimeout", () => {
ingest(dataset, "info", "qbx_bankrobbery.robbery.bigBankTimeoutStarted", {}, {
_internal_RESOURCE: "qbx_bankrobbery",
});
});

on("qbx_bankrobbery:server:SetSmallBankTimeout", (bankId: string | number) => {
ingest(dataset, "info", "qbx_bankrobbery.robbery.smallBankTimeoutStarted", {
bankId,
}, {
_internal_RESOURCE: "qbx_bankrobbery",
});
});
}
1 change: 1 addition & 0 deletions features/utils/common/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const ConfigSchema = object({
chatEvents: EventConfigSchema,
txAdminEvents: EventConfigSchema,
oxInventoryEvents: EventConfigSchema,
qbxBankrobberyEvents: EventConfigSchema,
}),
});

Expand Down