Add command to extract play time from save

Add command that extracts play time (and players) from the currently
running save to the recorded instance statistics.  This is useful for
getting correct play time statistics when an existing save game is
imported.
This commit is contained in:
Hornwitser committed 2022-07-13 00:31:02 +02:00
1 parent 0245ccd16c
commit 08e7434d24
8 files changed
+86 -3

No files matched your search

+8 -1
View File
@@ -668,6 +668,13 @@ messages.exportData = new Request({
forwardTo: "instance",
});
messages.extractPlayers = new Request({
type: "extract_players",
links: ["control-master", "master-slave", "slave-instance"],
permission: "core.instance.extract_players",
forwardTo: "instance",
});
messages.stopInstance = new Request({
type: "stop_instance",
links: ["control-master", "master-slave", "slave-instance"],
@@ -1331,7 +1338,7 @@ messages.playerEvent = new Event({
eventRequired: ["instance_id", "type", "name"],
eventProperties: {
"instance_id": { type: "integer" },
"type": { type: "string", enum: ["join", "leave"] },
"type": { type: "string", enum: ["join", "leave", "import"] },
"name": { type: "string" },
"reason": { type: "string" },
"stats": PlayerStats.jsonSchema,
+2 -2
View File
@@ -206,7 +206,7 @@ class BaseInstancePlugin {
* Invoked when a player either joins or leaves the instance.
*
* @param {Object} event - Information about the event.
* @param {string} event.type - Either "join" or "leave".
* @param {string} event.type - Either "join", "leave" or "import".
* @param {string} event.name - Name of the player that joined/left.
* @param {string=} event.reason -
* Only present for type "leave". Reason for player leaving the
@@ -502,7 +502,7 @@ class BaseMasterPlugin {
*
* @param {Object} instance - the instance it occured on.
* @param {Object} event - Information about the event.
* @param {string} event.type - Either "join" or "leave".
* @param {string} event.type - Either "join", "leave" or "import".
* @param {string} event.name - Name of the player that joined/left.
* @param {string=} event.reason -
* Only present for type "leave". Reason for player leaving the
+5
View File
@@ -475,6 +475,11 @@ definePermission({
title: "Export locale and icons",
description: "Export the the locale and icons from an instance and upload it to the master.",
});
definePermission({
name: "core.instance.extract_players",
title: "Extract player stats from running save",
description: "Run extraction to create a user for each player in the save and set the play time from the save.",
});
definePermission({
name: "core.instance.start",
title: "Start instance",