update readme w sql, roll back dllpath, set moddir

This commit is contained in:
2023-05-02 09:56:52 -07:00
parent c8674f1f34
commit f8714b7012
4 changed files with 46 additions and 10 deletions

View File

@@ -62,6 +62,7 @@
] call attendanceTracker_fnc_logMissionEvent;
}],
["PlayerDisconnected", {
// NOTE: HandleDisconnect returns a DIFFERENT _id than PlayerDisconnected and above handlers, so we can't use it here
params ["_id", "_uid", "_name", "_jip", "_owner", "_idstr"];
[format ["(EventHandler) HandleDisconnect fired: %1", _this], "DEBUG"] call attendanceTracker_fnc_log;

View File

@@ -1 +1,37 @@
# 17th-attendanceTracker
## Setup
**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.
```sql
CREATE TABLE `attendancelog` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`timestamp` DATETIME NOT NULL,
`event_hash` VARCHAR(100) NOT NULL DEFAULT md5(concat(`server_name`,`mission_name`,`author`,`mission_start`)) 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',
`mission_start` DATETIME NOT NULL,
`mission_name` VARCHAR(100) NULL DEFAULT NULL COLLATE 'utf8mb3_general_ci',
`briefing_name` VARCHAR(100) NULL DEFAULT NULL COLLATE 'utf8mb3_general_ci',
`mission_name_source` VARCHAR(100) NULL DEFAULT NULL COLLATE 'utf8mb3_general_ci',
`on_load_name` VARCHAR(100) NULL DEFAULT NULL COLLATE 'utf8mb3_general_ci',
`author` VARCHAR(100) NULL DEFAULT NULL COLLATE 'utf8mb3_general_ci',
`server_name` VARCHAR(100) NOT NULL COLLATE 'utf8mb3_general_ci',
`server_profile` VARCHAR(100) NOT NULL COLLATE 'utf8mb3_general_ci',
PRIMARY KEY (`id`) USING BTREE
)
COLLATE='utf8mb3_general_ci'
ENGINE=InnoDB
AUTO_INCREMENT=383
;
```
Finally, copy `config.example.json` to `config.json` and update it with your database credentials.

Binary file not shown.

View File

@@ -15,7 +15,6 @@ import (
"fmt"
"log"
"os"
"path/filepath"
"strconv"
"strings"
"time"
@@ -28,7 +27,7 @@ var EXTENSION_VERSION string = "0.0.1"
var extensionCallbackFnc C.extensionCallback
// file paths
var ADDON_FOLDER string = getDir() + "\\@17thAttendanceTracker"
var ADDON_FOLDER string = getDir() + "\\@AttendanceTracker"
var LOG_FILE string = ADDON_FOLDER + "\\attendanceTracker.log"
var CONFIG_FILE string = ADDON_FOLDER + "\\config.json"
@@ -77,16 +76,16 @@ func loadConfig() {
functionName := "loadConfig"
// get location of this dll
dllPath, err := filepath.Abs(os.Args[0])
if err != nil {
writeLog(functionName, fmt.Sprintf(`["Error getting DLL path: %v", "ERROR"]`, err))
return
}
// dllPath, err := filepath.Abs(os.Args[0])
// if err != nil {
// writeLog(functionName, fmt.Sprintf(`["Error getting DLL path: %v", "ERROR"]`, err))
// return
// }
// set the addon directory to the parent directory of the dll
ADDON_FOLDER = filepath.Dir(dllPath)
LOG_FILE = ADDON_FOLDER + "\\attendanceTracker.log"
CONFIG_FILE = ADDON_FOLDER + "\\config.json"
// ADDON_FOLDER = filepath.Dir(dllPath)
// LOG_FILE = ADDON_FOLDER + "\\attendanceTracker.log"
// CONFIG_FILE = ADDON_FOLDER + "\\config.json"
file, err := os.Open(CONFIG_FILE)
if err != nil {