Keep SCUM data parsing plugin-owned

This commit is contained in:
npc0-hue
2026-09-09 10:13:47 +08:00
parent 4f20fcaf5b
commit 84380105fc
13 changed files with 149 additions and 402 deletions
@@ -3,7 +3,7 @@ SELECT
account.id AS subjectId,
CAST(profile.id AS TEXT) AS userProfileId,
CAST(prisoner.id AS TEXT) AS gamePlayerId,
NULL AS vehicleId,
CAST(mount.vehicle_entity_id AS TEXT) AS vehicleId,
CAST(entity.id AS TEXT) AS entityId,
NULL AS baseId,
entity.location_x AS x,
@@ -15,8 +15,10 @@ JOIN user account ON account.id = profile.user_id
JOIN prisoner ON prisoner.id = profile.prisoner_id
JOIN prisoner_entity ON prisoner_entity.prisoner_id = prisoner.id
JOIN entity ON entity.id = prisoner_entity.entity_id
LEFT JOIN prisoner_vehicle_mountee_info mount ON mount.prisoner_id = prisoner.id
WHERE (:subjectType IS NULL OR :subjectType = 'player')
AND (:subjectId IS NULL OR account.id = :subjectId)
AND (:activeWithinSeconds IS NULL OR profile.last_logout_time IS NULL OR profile.last_login_time > profile.last_logout_time OR prisoner.last_save_time >= CAST(strftime('%s', 'now') AS INTEGER) - :activeWithinSeconds OR profile.last_login_time >= strftime('%Y-%m-%dT%H:%M:%fZ', 'now', printf('-%d seconds', :activeWithinSeconds)))
UNION ALL
SELECT
'vehicle', CAST(spawner.vehicle_entity_id AS TEXT), NULL, NULL,
@@ -27,6 +29,7 @@ FROM vehicle_spawner spawner
JOIN entity ON entity.id = spawner.vehicle_entity_id
WHERE (:subjectType IS NULL OR :subjectType = 'vehicle')
AND (:subjectId IS NULL OR CAST(spawner.vehicle_entity_id AS TEXT) = :subjectId)
AND (:activeWithinSeconds IS NULL OR spawner.vehicle_last_access_time >= CAST(strftime('%s', 'now') AS INTEGER) - :activeWithinSeconds)
UNION ALL
SELECT
'base', CAST(base.id AS TEXT), CAST(base.owner_user_profile_id AS TEXT), NULL,
@@ -3,15 +3,19 @@ SELECT
account.id AS steamId,
CAST(prisoner.id AS TEXT) AS gamePlayerId,
COALESCE(NULLIF(profile.name, ''), NULLIF(account.name, ''), account.id) AS displayName,
account.last_direct_connection_address AS lastLoginIp,
account.creation_time AS registeredAt,
CAST(member.squad_id AS TEXT) AS squadId,
squad.name AS squadName,
profile.fame_points AS famePoints,
profile.money_balance AS moneyBalance,
MAX(CASE WHEN currency.currency_type = 1 THEN currency.account_balance END) AS normalBalance,
MAX(CASE WHEN currency.currency_type = 2 THEN currency.account_balance END) AS goldBalance,
entity.location_x AS x,
entity.location_y AS y,
entity.location_z AS z,
profile.last_login_time AS lastLoginTime,
profile.last_logout_time AS lastLogoutTime,
strftime('%Y-%m-%dT%H:%M:%SZ', prisoner.last_save_time, 'unixepoch') AS lastSaveTime
FROM user account
LEFT JOIN user_profile profile ON profile.user_id = account.id
@@ -25,6 +29,7 @@ LEFT JOIN bank_account_registry_currencies currency ON currency.bank_account_id
WHERE (:userProfileId IS NULL OR CAST(profile.id AS TEXT) = :userProfileId)
AND (:steamId IS NULL OR account.id = :steamId)
AND (:search IS NULL OR COALESCE(NULLIF(profile.name, ''), NULLIF(account.name, ''), account.id) LIKE '%' || :search || '%')
AND (:activeWithinSeconds IS NULL OR profile.last_logout_time IS NULL OR profile.last_login_time > profile.last_logout_time OR profile.last_login_time >= strftime('%Y-%m-%dT%H:%M:%fZ', 'now', printf('-%d seconds', :activeWithinSeconds)) OR prisoner.last_save_time >= CAST(strftime('%s', 'now') AS INTEGER) - :activeWithinSeconds)
GROUP BY account.id
ORDER BY profile.last_login_time DESC
LIMIT COALESCE(:limit, 500)
@@ -7,10 +7,19 @@ SELECT
entity.location_y AS y,
entity.location_z AS z,
strftime('%Y-%m-%dT%H:%M:%SZ', spawner.vehicle_last_access_time, 'unixepoch') AS lastAccessTime,
spawner.is_vehicle_functional AS isFunctional
spawner.is_vehicle_functional AS isFunctional,
1 AS existsInGame,
group_concat(DISTINCT CAST(mount.prisoner_id AS TEXT)) AS mountedPrisonerIds,
group_concat(DISTINCT CAST(mounted_profile.id AS TEXT)) AS mountedUserProfileIds,
group_concat(DISTINCT mounted_profile.user_id) AS mountedSteamIds
FROM vehicle_spawner spawner
JOIN entity ON entity.id = spawner.vehicle_entity_id
LEFT JOIN prisoner_vehicle_mountee_info mount ON mount.vehicle_entity_id = spawner.vehicle_entity_id
LEFT JOIN prisoner mounted_prisoner ON mounted_prisoner.id = mount.prisoner_id
LEFT JOIN user_profile mounted_profile ON mounted_profile.prisoner_id = mounted_prisoner.id
WHERE (:vehicleId IS NULL OR CAST(spawner.vehicle_entity_id AS TEXT) = :vehicleId)
AND (:search IS NULL OR spawner.vehicle_alias LIKE '%' || :search || '%' OR entity.class LIKE '%' || :search || '%')
AND (:activeWithinSeconds IS NULL OR spawner.vehicle_last_access_time >= CAST(strftime('%s', 'now') AS INTEGER) - :activeWithinSeconds)
GROUP BY spawner.vehicle_entity_id
ORDER BY spawner.vehicle_last_access_time DESC
LIMIT COALESCE(:limit, 500)