mirror of
https://github.com/indig0fox/Arma3-AttendanceTracker.git/
synced 2025-12-08 09:51:47 -06:00
Compare commits
3 Commits
fc53ecb770
...
v1.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
737416965e
|
|||
|
05946c0ebf
|
|||
|
79fb39b154
|
5
.gitignore
vendored
5
.gitignore
vendored
@@ -1,6 +1,5 @@
|
|||||||
|
|
||||||
*.log
|
*.log
|
||||||
|
|
||||||
\@17thAttendanceTracker/config.json
|
|
||||||
|
|
||||||
*.bak
|
*.bak
|
||||||
|
|
||||||
|
\@AttendanceTracker/config.json
|
||||||
|
|||||||
@@ -3,5 +3,5 @@
|
|||||||
"mysqlPort": 3306,
|
"mysqlPort": 3306,
|
||||||
"mysqlUser": "root",
|
"mysqlUser": "root",
|
||||||
"mysqlPassword": "root",
|
"mysqlPassword": "root",
|
||||||
"mysqlDatabase": "db"
|
"mysqlDatabase": "arma3_attendance"
|
||||||
}
|
}
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"mysqlHost": "127.0.0.1",
|
|
||||||
"mysqlPort": 12730,
|
|
||||||
"mysqlUser": "root",
|
|
||||||
"mysqlPassword": "i&Lz8A3RuPcY5b326ALXgjl",
|
|
||||||
"mysqlDatabase": "testdb"
|
|
||||||
}
|
|
||||||
146
README.md
146
README.md
@@ -1,74 +1,102 @@
|
|||||||
# 17th-attendanceTracker
|
# Arma 3 Attendance Tracker
|
||||||
|
|
||||||
## Setup
|
## Setup
|
||||||
|
|
||||||
**You will need a running MySQL or MariaDB instance.**
|
**You will need a running MySQL or MariaDB instance.**
|
||||||
|
|
||||||
Create a database with a name of your choosing. Then, run the following SQL command against it to create a table.
|
The following SQL commands will set up the necessary tables for the application. You can run them from the MySQL command line or from a tool like phpMyAdmin.
|
||||||
|
|
||||||
|
*In future, an ORM will be used to set this up automatically.*
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
-- a3server.attendancelog definition
|
CREATE DATABASE `arma3_attendance` /*!40100 DEFAULT CHARACTER SET utf8mb3 */;
|
||||||
|
|
||||||
CREATE TABLE `attendance` (
|
USE `arma3_attendance`;
|
||||||
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
|
||||||
`join_time` DATETIME NULL DEFAULT NULL,
|
|
||||||
`disconnect_time` DATETIME NULL DEFAULT NULL,
|
|
||||||
`mission_hash` VARCHAR(100) NULL DEFAULT '' COLLATE 'utf8mb3_general_ci',
|
|
||||||
`event_type` VARCHAR(100) NOT NULL COLLATE 'utf8mb3_general_ci',
|
|
||||||
`player_id` VARCHAR(30) NOT NULL COLLATE 'utf8mb3_general_ci',
|
|
||||||
`player_uid` VARCHAR(100) NOT NULL COLLATE 'utf8mb3_general_ci',
|
|
||||||
`profile_name` VARCHAR(100) NOT NULL COLLATE 'utf8mb3_general_ci',
|
|
||||||
`steam_name` VARCHAR(100) NULL DEFAULT NULL COLLATE 'utf8mb3_general_ci',
|
|
||||||
`is_jip` TINYINT(4) NULL DEFAULT NULL,
|
|
||||||
`role_description` VARCHAR(100) NULL DEFAULT NULL COLLATE 'utf8mb3_general_ci',
|
|
||||||
PRIMARY KEY (`id`) USING BTREE
|
|
||||||
)
|
|
||||||
COLLATE='utf8mb3_general_ci'
|
|
||||||
ENGINE=InnoDB
|
|
||||||
AUTO_INCREMENT=5868
|
|
||||||
;
|
|
||||||
|
|
||||||
|
|
||||||
-- a3server.`missions` definition
|
|
||||||
|
|
||||||
|
-- a3server.missions definition
|
||||||
CREATE TABLE `missions` (
|
CREATE TABLE `missions` (
|
||||||
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
`mission_name` VARCHAR(100) NOT NULL COLLATE 'utf8mb3_general_ci',
|
`world_id` int(11) DEFAULT NULL,
|
||||||
`mission_name_source` VARCHAR(100) NULL DEFAULT NULL COLLATE 'utf8mb3_general_ci',
|
`mission_hash` varchar(100) NOT NULL DEFAULT '',
|
||||||
`briefing_name` VARCHAR(100) NULL DEFAULT NULL COLLATE 'utf8mb3_general_ci',
|
`mission_name` varchar(100) NOT NULL,
|
||||||
`on_load_name` VARCHAR(100) NULL DEFAULT NULL COLLATE 'utf8mb3_general_ci',
|
`mission_name_source` varchar(100) DEFAULT NULL,
|
||||||
`author` VARCHAR(100) NULL DEFAULT NULL COLLATE 'utf8mb3_general_ci',
|
`briefing_name` varchar(100) DEFAULT NULL,
|
||||||
`server_name` VARCHAR(100) NULL DEFAULT NULL COLLATE 'utf8mb3_general_ci',
|
`on_load_name` varchar(100) DEFAULT NULL,
|
||||||
`server_profile` VARCHAR(100) NULL DEFAULT NULL COLLATE 'utf8mb3_general_ci',
|
`author` varchar(100) DEFAULT NULL,
|
||||||
`mission_start` DATETIME NULL DEFAULT NULL,
|
`server_name` varchar(100) DEFAULT NULL,
|
||||||
`mission_hash` VARCHAR(100) NULL DEFAULT NULL COLLATE 'utf8mb3_general_ci',
|
`server_profile` varchar(100) DEFAULT NULL,
|
||||||
PRIMARY KEY (`id`) USING BTREE
|
`mission_start` datetime DEFAULT NULL COMMENT 'In UTC',
|
||||||
)
|
PRIMARY KEY (`id`),
|
||||||
COLLATE='utf8mb3_general_ci'
|
KEY `mission_hash` (`mission_hash`)
|
||||||
ENGINE=InnoDB
|
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb3;
|
||||||
;
|
|
||||||
|
-- arma3_attendance.attendance definition
|
||||||
|
CREATE TABLE `attendance` (
|
||||||
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`join_time` datetime DEFAULT NULL COMMENT 'Stored in UTC',
|
||||||
|
`disconnect_time` datetime DEFAULT NULL COMMENT 'Stored in UTC',
|
||||||
|
`mission_hash` varchar(100) DEFAULT NULL,
|
||||||
|
`event_type` varchar(100) NOT NULL,
|
||||||
|
`player_id` varchar(30) NOT NULL,
|
||||||
|
`player_uid` varchar(100) NOT NULL,
|
||||||
|
`profile_name` varchar(100) NOT NULL,
|
||||||
|
`steam_name` varchar(100) DEFAULT NULL,
|
||||||
|
`is_jip` tinyint(4) DEFAULT NULL,
|
||||||
|
`role_description` varchar(100) DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`id`) USING BTREE,
|
||||||
|
KEY `mission_hash` (`mission_hash`),
|
||||||
|
CONSTRAINT `attendance_ibfk_1` FOREIGN KEY (`mission_hash`) REFERENCES `missions` (`mission_hash`) ON UPDATE CASCADE
|
||||||
|
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb3;
|
||||||
|
|
||||||
|
|
||||||
|
-- a3server.worlds definition
|
||||||
-- a3server.`worlds` definition
|
|
||||||
|
|
||||||
CREATE TABLE `worlds` (
|
CREATE TABLE `worlds` (
|
||||||
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
`author` VARCHAR(100) NULL DEFAULT NULL COLLATE 'utf8mb3_general_ci',
|
`author` varchar(100) DEFAULT NULL,
|
||||||
`display_name` VARCHAR(100) NULL DEFAULT NULL COLLATE 'utf8mb3_general_ci',
|
`display_name` varchar(100) DEFAULT NULL,
|
||||||
`world_name` VARCHAR(100) NOT NULL COLLATE 'utf8mb3_general_ci',
|
`world_name` varchar(100) NOT NULL,
|
||||||
`world_name_original` VARCHAR(100) NULL DEFAULT NULL COLLATE 'utf8mb3_general_ci',
|
`world_name_original` varchar(100) DEFAULT NULL,
|
||||||
`world_size` INT(11) NULL DEFAULT NULL,
|
`world_size` int(11) DEFAULT NULL,
|
||||||
`latitude` FLOAT NULL DEFAULT NULL,
|
`latitude` float DEFAULT NULL,
|
||||||
`longitude` FLOAT NULL DEFAULT NULL,
|
`longitude` float DEFAULT NULL,
|
||||||
`workshop_id` VARCHAR(50) NULL DEFAULT NULL COLLATE 'utf8mb3_general_ci',
|
`workshop_id` varchar(50) DEFAULT NULL,
|
||||||
PRIMARY KEY (`id`) USING BTREE
|
PRIMARY KEY (`id`),
|
||||||
)
|
UNIQUE KEY `world_name` (`world_name`)
|
||||||
COLLATE='utf8mb3_general_ci'
|
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb3;
|
||||||
ENGINE=InnoDB
|
|
||||||
AUTO_INCREMENT=2
|
|
||||||
;
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Finally, copy `config.example.json` to `config.json` and update it with your database credentials.
|
Finally, copy `config.example.json` to `config.json` and update it with your database credentials and path.
|
||||||
|
|
||||||
|
## QUERIES
|
||||||
|
|
||||||
|
### Show missions with attendance
|
||||||
|
|
||||||
|
This will retrieve a view showing all missions with attendance data, sorted by the most recent mission joins first. Mission events without a mission disconnect_time (due to server crash or in-progress mission) will be ignored.
|
||||||
|
|
||||||
|
```sql
|
||||||
|
select
|
||||||
|
a.server_profile as Server,
|
||||||
|
a.briefing_name as "Mission Name",
|
||||||
|
a.mission_start as "Start Time",
|
||||||
|
b.display_name as "World",
|
||||||
|
c.profile_name as "Player Name",
|
||||||
|
c.player_uid as "Player UID",
|
||||||
|
TIMESTAMPDIFF(
|
||||||
|
MINUTE,
|
||||||
|
c.join_time,
|
||||||
|
c.disconnect_time
|
||||||
|
) as "Play Time (m)",
|
||||||
|
c.join_time as "Join Time",
|
||||||
|
c.disconnect_time as "Leave Time"
|
||||||
|
from missions a
|
||||||
|
LEFT JOIN worlds b ON a.world_id = b.id
|
||||||
|
LEFT JOIN attendance c ON a.mission_hash = c.mission_hash
|
||||||
|
where
|
||||||
|
c.event_type = 'Mission'
|
||||||
|
AND c.disconnect_time IS NOT NULL
|
||||||
|
AND TIMESTAMPDIFF(
|
||||||
|
MINUTE,
|
||||||
|
c.join_time,
|
||||||
|
c.disconnect_time
|
||||||
|
) > 0
|
||||||
|
```
|
||||||
|
|||||||
@@ -3,5 +3,5 @@
|
|||||||
"mysqlPort": 3306,
|
"mysqlPort": 3306,
|
||||||
"mysqlUser": "root",
|
"mysqlUser": "root",
|
||||||
"mysqlPassword": "root",
|
"mysqlPassword": "root",
|
||||||
"mysqlDatabase": "db"
|
"mysqlDatabase": "arma3_attendance"
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
$ENV:GOARCH = "amd64"
|
$ENV:GOARCH = "amd64"
|
||||||
$ENV:CGO_ENABLED = 1
|
$ENV:CGO_ENABLED = 1
|
||||||
go1.16.4 build -o AttendanceTracker_x64.dll -buildmode=c-shared .
|
go1.16.4 build -o ../@AttendanceTracker/AttendanceTracker_x64.dll -buildmode=c-shared .
|
||||||
Binary file not shown.
Binary file not shown.
@@ -1,7 +0,0 @@
|
|||||||
freeExtension "AttendanceTracker";
|
|
||||||
"AttendanceTracker" callExtension "connectDB";
|
|
||||||
sleep 2;
|
|
||||||
"attendanceTracker" callExtension ["logAttendance", ["{""playerUID"": ""76561197991996737"", ""roleDescription"": ""NULL"", ""missionNameSource"": ""aaaltisaiatk"", ""eventType"": ""ConnectedMission"", ""briefingName"": ""aaaltisaiatk"", ""profileName"": ""IndigoFox"", ""serverName"": ""IndigoFox on DESKTOP-6B2U0AT"", ""steamName"": ""IndigoFox"", ""onLoadName"": ""NULL"", ""missionName"": ""aaaltisaiatk"", ""isJIP"": false, ""author"": ""IndigoFox"", ""missionStart"": ""1682549469590908300""}"]]
|
|
||||||
"attendanceTracker" callExtension ["logAttendance", ["{""playerUID"": ""76561197991996737"", ""roleDescription"": ""NULL"", ""missionNameSource"": ""aaaltisaiatk"", ""eventType"": ""ConnectedServer"", ""briefingName"": ""aaaltisaiatk"", ""profileName"": ""IndigoFox"", ""serverName"": ""IndigoFox on DESKTOP-6B2U0AT"", ""steamName"": ""IndigoFox"", ""onLoadName"": ""NULL"", ""missionName"": ""aaaltisaiatk"", ""isJIP"": false, ""author"": ""IndigoFox"", ""missionStart"": ""1682549469590908300""}"]]
|
|
||||||
sleep 15;
|
|
||||||
exit;
|
|
||||||
Reference in New Issue
Block a user