Rebuild SCUM plugin data ownership
This commit is contained in:
@@ -1,15 +0,0 @@
|
||||
SELECT
|
||||
'active-task' AS activityType,
|
||||
CAST(task.id AS TEXT) AS activityId,
|
||||
CAST(task.user_profile_id AS TEXT) AS userProfileId,
|
||||
CAST(task.map_id AS TEXT) AS mapId,
|
||||
available.task_data_asset_path AS subject,
|
||||
task.sequence_index AS sequenceIndex,
|
||||
NULL AS occurredAt,
|
||||
CASE WHEN available.was_ever_completed = 1 THEN 'completed-before' ELSE 'active' END AS state
|
||||
FROM active_task active
|
||||
JOIN tracking_data_set task ON task.id = active.id
|
||||
JOIN available_task available ON available.id = active.available_task_id
|
||||
WHERE (:userProfileId IS NULL OR CAST(task.user_profile_id AS TEXT) = :userProfileId)
|
||||
ORDER BY task.id DESC
|
||||
LIMIT COALESCE(:limit, 500)
|
||||
@@ -1,18 +0,0 @@
|
||||
SELECT
|
||||
CAST(flag.element_id AS TEXT) AS flagId,
|
||||
CAST(flag.element_id AS TEXT) AS entityId,
|
||||
CAST(element.base_id AS TEXT) AS baseId,
|
||||
CAST(element.owner_profile_id AS TEXT) AS ownerProfileId,
|
||||
CAST(owner.prisoner_id AS TEXT) AS ownerPlayerId,
|
||||
CAST(flag.overtaker_user_profile_id AS TEXT) AS overtakerProfileId,
|
||||
datetime(flag.overtake_end_time, 'unixepoch') AS overtakeEndTime,
|
||||
element.location_x AS x,
|
||||
element.location_y AS y,
|
||||
element.location_z AS z
|
||||
FROM base_element_flag flag
|
||||
JOIN base_element element ON element.element_id = flag.element_id
|
||||
LEFT JOIN user_profile owner ON owner.id = element.owner_profile_id
|
||||
WHERE (:flagId IS NULL OR CAST(flag.element_id AS TEXT) = :flagId)
|
||||
AND (:ownerProfileId IS NULL OR CAST(element.owner_profile_id AS TEXT) = :ownerProfileId)
|
||||
ORDER BY flag.element_id
|
||||
LIMIT COALESCE(:limit, 500)
|
||||
@@ -1,14 +0,0 @@
|
||||
SELECT
|
||||
'finished-timed-gift' AS giftType,
|
||||
CAST(gift.user_profile_id AS TEXT) || ':' || CAST(gift.map_id AS TEXT) || ':' || CAST(gift.spawn_time AS TEXT) AS giftId,
|
||||
CAST(gift.user_profile_id AS TEXT) AS userProfileId,
|
||||
CAST(gift.map_id AS TEXT) AS mapId,
|
||||
gift.spawn_time AS spawnTime,
|
||||
datetime(gift.spawn_time, 'unixepoch') AS spawnAt,
|
||||
COALESCE(profile.name, user.name, '') AS displayName
|
||||
FROM finished_timed_gift_spawner gift
|
||||
LEFT JOIN user_profile profile ON profile.id = gift.user_profile_id
|
||||
LEFT JOIN user ON user.id = profile.user_id
|
||||
WHERE (:userProfileId IS NULL OR CAST(gift.user_profile_id AS TEXT) = :userProfileId)
|
||||
ORDER BY gift.spawn_time DESC
|
||||
LIMIT COALESCE(:limit, 500)
|
||||
@@ -1,62 +0,0 @@
|
||||
SELECT
|
||||
'player' AS subjectType,
|
||||
CAST(profile.id AS TEXT) AS subjectId,
|
||||
CAST(profile.id AS TEXT) AS userProfileId,
|
||||
CAST(prisoner.id AS TEXT) AS gamePlayerId,
|
||||
NULL AS vehicleId,
|
||||
NULL AS baseId,
|
||||
entity.location_x AS x,
|
||||
entity.location_y AS y,
|
||||
entity.location_z AS z,
|
||||
datetime(prisoner.last_save_time, 'unixepoch') AS observedAt
|
||||
FROM user_profile profile
|
||||
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
|
||||
WHERE (:subjectType IS NULL OR :subjectType = 'player')
|
||||
UNION ALL
|
||||
SELECT
|
||||
'vehicle' AS subjectType,
|
||||
CAST(spawner.vehicle_entity_id AS TEXT) AS subjectId,
|
||||
NULL AS userProfileId,
|
||||
NULL AS gamePlayerId,
|
||||
CAST(spawner.vehicle_entity_id AS TEXT) AS vehicleId,
|
||||
NULL AS baseId,
|
||||
entity.location_x AS x,
|
||||
entity.location_y AS y,
|
||||
entity.location_z AS z,
|
||||
datetime(spawner.vehicle_last_access_time, 'unixepoch') AS observedAt
|
||||
FROM vehicle_spawner spawner
|
||||
JOIN entity ON entity.id = spawner.vehicle_entity_id
|
||||
WHERE (:subjectType IS NULL OR :subjectType = 'vehicle')
|
||||
UNION ALL
|
||||
SELECT
|
||||
'base' AS subjectType,
|
||||
CAST(base.id AS TEXT) AS subjectId,
|
||||
CAST(base.owner_user_profile_id AS TEXT) AS userProfileId,
|
||||
NULL AS gamePlayerId,
|
||||
NULL AS vehicleId,
|
||||
CAST(base.id AS TEXT) AS baseId,
|
||||
base.location_x AS x,
|
||||
base.location_y AS y,
|
||||
0 AS z,
|
||||
NULL AS observedAt
|
||||
FROM base
|
||||
WHERE (:subjectType IS NULL OR :subjectType = 'base')
|
||||
UNION ALL
|
||||
SELECT
|
||||
'flag' AS subjectType,
|
||||
CAST(flag.element_id AS TEXT) AS subjectId,
|
||||
CAST(element.owner_profile_id AS TEXT) AS userProfileId,
|
||||
CAST(owner.prisoner_id AS TEXT) AS gamePlayerId,
|
||||
NULL AS vehicleId,
|
||||
CAST(element.base_id AS TEXT) AS baseId,
|
||||
element.location_x AS x,
|
||||
element.location_y AS y,
|
||||
element.location_z AS z,
|
||||
datetime(flag.overtake_end_time, 'unixepoch') AS observedAt
|
||||
FROM base_element_flag flag
|
||||
JOIN base_element element ON element.element_id = flag.element_id
|
||||
LEFT JOIN user_profile owner ON owner.id = element.owner_profile_id
|
||||
WHERE (:subjectType IS NULL OR :subjectType = 'flag')
|
||||
LIMIT COALESCE(:limit, 500)
|
||||
@@ -1,15 +0,0 @@
|
||||
SELECT
|
||||
CAST(member.squad_id AS TEXT) AS squadId,
|
||||
CAST(member.user_profile_id AS TEXT) AS userProfileId,
|
||||
CAST(profile.prisoner_id AS TEXT) AS gamePlayerId,
|
||||
user.id AS steamId,
|
||||
COALESCE(profile.name, user.name, '') AS displayName,
|
||||
CAST(member.rank AS TEXT) AS rank,
|
||||
CASE WHEN member.rank = 4 THEN 1 ELSE 0 END AS isLeader
|
||||
FROM squad_member member
|
||||
JOIN user_profile profile ON profile.id = member.user_profile_id
|
||||
LEFT JOIN user ON user.id = profile.user_id
|
||||
WHERE (:squadId IS NULL OR CAST(member.squad_id AS TEXT) = :squadId)
|
||||
AND (:userProfileId IS NULL OR CAST(member.user_profile_id AS TEXT) = :userProfileId)
|
||||
ORDER BY member.squad_id, member.rank DESC, profile.name
|
||||
LIMIT COALESCE(:limit, 500)
|
||||
@@ -1,19 +0,0 @@
|
||||
SELECT
|
||||
CAST(s.id AS TEXT) AS squadId,
|
||||
COALESCE(s.name, '') AS name,
|
||||
CAST(leader.user_profile_id AS TEXT) AS leaderProfileId,
|
||||
CAST(leader_profile.prisoner_id AS TEXT) AS leaderPlayerId,
|
||||
COUNT(member.id) AS memberCount,
|
||||
s.score AS score,
|
||||
s.member_limit AS memberLimit,
|
||||
s.last_member_login_time AS lastMemberLoginTime,
|
||||
s.last_member_logout_time AS lastMemberLogoutTime
|
||||
FROM squad s
|
||||
LEFT JOIN squad_member member ON member.squad_id = s.id
|
||||
LEFT JOIN squad_member leader ON leader.squad_id = s.id AND leader.rank = 4
|
||||
LEFT JOIN user_profile leader_profile ON leader_profile.id = leader.user_profile_id
|
||||
WHERE (:squadId IS NULL OR CAST(s.id AS TEXT) = :squadId)
|
||||
AND (:search IS NULL OR COALESCE(s.name, '') LIKE '%' || :search || '%')
|
||||
GROUP BY s.id
|
||||
ORDER BY s.score DESC, s.id
|
||||
LIMIT COALESCE(:limit, 500)
|
||||
@@ -1,28 +0,0 @@
|
||||
SELECT
|
||||
CAST(up.id AS TEXT) AS userProfileId,
|
||||
u.id AS steamId,
|
||||
CAST(p.id AS TEXT) AS gamePlayerId,
|
||||
COALESCE(up.name, u.name, '') AS displayName,
|
||||
up.fame_points AS famePoints,
|
||||
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,
|
||||
e.location_x AS x,
|
||||
e.location_y AS y,
|
||||
e.location_z AS z,
|
||||
datetime(p.last_save_time, 'unixepoch') AS lastSaveTime,
|
||||
up.last_login_time AS lastLoginTime,
|
||||
up.last_logout_time AS lastLogoutTime,
|
||||
p.is_alive AS isAlive
|
||||
FROM user_profile up
|
||||
JOIN user u ON u.id = up.user_id
|
||||
LEFT JOIN prisoner p ON p.id = up.prisoner_id
|
||||
LEFT JOIN prisoner_entity pe ON pe.prisoner_id = p.id
|
||||
LEFT JOIN entity e ON e.id = pe.entity_id
|
||||
LEFT JOIN bank_account_registry account ON account.account_owner_user_profile_id = up.id
|
||||
LEFT JOIN bank_account_registry_currencies currency ON currency.bank_account_id = account.id
|
||||
WHERE (:userProfileId IS NULL OR CAST(up.id AS TEXT) = :userProfileId)
|
||||
AND (:steamId IS NULL OR u.id = :steamId)
|
||||
AND (:search IS NULL OR COALESCE(up.name, u.name, '') LIKE '%' || :search || '%')
|
||||
GROUP BY up.id
|
||||
ORDER BY up.last_login_time DESC
|
||||
LIMIT COALESCE(:limit, 500)
|
||||
@@ -1,16 +0,0 @@
|
||||
SELECT
|
||||
CAST(spawner.vehicle_entity_id AS TEXT) AS vehicleId,
|
||||
CAST(spawner.vehicle_entity_id AS TEXT) AS entityId,
|
||||
entity.class AS className,
|
||||
spawner.vehicle_alias AS label,
|
||||
entity.location_x AS x,
|
||||
entity.location_y AS y,
|
||||
entity.location_z AS z,
|
||||
datetime(spawner.vehicle_last_access_time, 'unixepoch') AS lastAccessTime,
|
||||
spawner.is_vehicle_functional AS isFunctional
|
||||
FROM vehicle_spawner spawner
|
||||
JOIN entity ON entity.id = spawner.vehicle_entity_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 || '%')
|
||||
ORDER BY spawner.vehicle_last_access_time DESC
|
||||
LIMIT COALESCE(:limit, 500)
|
||||
Reference in New Issue
Block a user