diff --git a/Gameleap/code/mw4/Code/mw4print/db_schema.sql b/Gameleap/code/mw4/Code/mw4print/db_schema.sql new file mode 100644 index 00000000..52f4d563 --- /dev/null +++ b/Gameleap/code/mw4/Code/mw4print/db_schema.sql @@ -0,0 +1,135 @@ +-- mw4print MySQL database schema +-- Tables are created automatically by mw4print on first export. +-- This file documents the structure for reference. +-- +-- Prerequisites: create the database first, then configure mw4print.ini: +-- +-- [MySQLExport] +-- Enabled=1 +-- Host=192.168.1.100 +-- Port=3306 +-- Database=firestorm_stats +-- Username=mw4 +-- Password=yourpassword +-- ExportEvents=0 +-- +-- Run this script manually if you want to pre-create the tables, +-- or just let mw4print create them on first connect. + +CREATE TABLE IF NOT EXISTS `match` ( + `match_id` INT UNSIGNED NOT NULL AUTO_INCREMENT, + `match_time` DATETIME NOT NULL, + `server_name` VARCHAR(256) NOT NULL DEFAULT '', + `server_ip` VARCHAR(64) NOT NULL DEFAULT '', + `map_name` VARCHAR(128) NOT NULL DEFAULT '', + `scenario_name` VARCHAR(128) NOT NULL DEFAULT '', + `game_type` INT NOT NULL DEFAULT 0, + `game_type_name` VARCHAR(64) NOT NULL DEFAULT '', + `is_team_game` TINYINT(1) NOT NULL DEFAULT 0, + `player_count` INT NOT NULL DEFAULT 0, + `team_count` INT NOT NULL DEFAULT 0, + `team_scores` VARCHAR(64) NOT NULL DEFAULT '', -- comma-separated team totals: t0,t1,...,t7 + `game_length` INT NOT NULL DEFAULT 0, + `kill_limit` INT NOT NULL DEFAULT 0, -- 0 = no limit + `respawn_limit` INT NOT NULL DEFAULT 0, -- 0 = no limit + `friendly_fire` INT NOT NULL DEFAULT 0, -- percentage + `heat_on` TINYINT(1) NOT NULL DEFAULT 0, + `armor_mode` TINYINT(1) NOT NULL DEFAULT 0, + `unlimited_ammo` TINYINT(1) NOT NULL DEFAULT 0, + `is_night` TINYINT(1) NOT NULL DEFAULT 0, + `min_tonnage` INT NOT NULL DEFAULT 0, + `max_tonnage` INT NOT NULL DEFAULT 0, + PRIMARY KEY (`match_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- game_type values (from GameTypes.h): +-- 0 StockDestruction 1 StockTeamDestruction +-- 2 StockAttrition 3 StockTeamAttrition +-- 4 StockCaptureTheFlag 5 StockKingOfTheHill +-- 6 StockTeamKingOfTheHill 7 StockTerritories +-- 8 StockStealTheBacon 9 StockCaptureBase +-- 10 StockDestroyObjective 11 StockEscort +-- 12 StockMasterTrial 13 StockSiegeAssault +-- 14 StockCampaign 15 CustomDestruction +-- 16 CustomTeamDestruction 17 CustomAttrition +-- 18 CustomTeamAttrition 19 CustomCaptureTheFlag +-- 20 CustomKingOfTheHill 21 CustomTeamKingOfTheHill +-- 22 CustomTerritories 23 CustomStealTheBacon +-- 24 CustomCaptureBase 25 CustomDestroyObjective +-- 26 CustomEscort 27 CustomMasterTrial +-- 28 CustomSiegeAssault 29 CustomCampaign + + +CREATE TABLE IF NOT EXISTS `player_result` ( + `result_id` INT UNSIGNED NOT NULL AUTO_INCREMENT, + `match_id` INT UNSIGNED NOT NULL, + `player_name` VARCHAR(64) NOT NULL DEFAULT '', + `mech_name` VARCHAR(64) NOT NULL DEFAULT '', + `team` INT NOT NULL DEFAULT 0, -- 0-7; meaningless in FFA (team_count=0) + `score` INT NOT NULL DEFAULT 0, + `kills` INT NOT NULL DEFAULT 0, + `deaths` INT NOT NULL DEFAULT 0, + `is_bot` TINYINT(1) NOT NULL DEFAULT 0, + `pilot_decal` INT NOT NULL DEFAULT 0, -- decal index 0-63 + PRIMARY KEY (`result_id`), + KEY `match_id` (`match_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + + +CREATE TABLE IF NOT EXISTS `pvp` ( + `pvp_id` INT UNSIGNED NOT NULL AUTO_INCREMENT, + `match_id` INT UNSIGNED NOT NULL, + `attacker` VARCHAR(64) NOT NULL DEFAULT '', -- player_name of attacker + `victim` VARCHAR(64) NOT NULL DEFAULT '', -- player_name of victim + `kills` INT NOT NULL DEFAULT 0, -- times attacker killed victim + `score` INT NOT NULL DEFAULT 0, -- score attacker earned from victim + PRIMARY KEY (`pvp_id`), + KEY `match_id` (`match_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + + +-- Optional: populated only when ExportEvents=1 in mw4print.ini. +-- Can generate thousands of rows per match; off by default. +CREATE TABLE IF NOT EXISTS `event` ( + `event_id` INT UNSIGNED NOT NULL AUTO_INCREMENT, + `match_id` INT UNSIGNED NOT NULL, + `event_type` INT NOT NULL DEFAULT 0, -- CBucketManager::Bucket_Type (see below) + `actor` VARCHAR(64) NOT NULL DEFAULT '', + `target` VARCHAR(64) NOT NULL DEFAULT '', + `weapon` INT NOT NULL DEFAULT 0, + `body_zone` INT NOT NULL DEFAULT 0, -- DamageObject zone (see below) + `param` INT NOT NULL DEFAULT 0, -- context-dependent value + PRIMARY KEY (`event_id`), + KEY `match_id` (`match_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- event_type values (CBucketManager::Bucket_Type): +-- 0 KILL_LINK 1 DEATH_LINK +-- 2 KILLS 3 FRIENDLY_KILLS +-- 4 ENEMY_KILLS 5 KILLS_BY_TONNAGE +-- 6 FRIENDLY_KILLS_BY_TONNAGE 7 ENEMY_KILLS_BY_TONNAGE +-- 8 DEATHS 9 SUICIDES +-- 10 DAMAGE_INFLICT 11 FRIENDLY_DAMAGE_INFLICT +-- 12 ENEMY_DAMAGE_INFLICT 13 DAMAGE_RECEIVE +-- 14 FRIENDLY_DAMAGE_RECEIVE 15 ENEMY_DAMAGE_RECEIVE +-- 16 COMPONENT_KILLS 17 COMPONENT_DEATHS +-- 18 FRIENDLY_COMPONENT_KILLS 19 FRIENDLY_COMPONENT_DEATHS +-- 20 ENEMY_COMPONENT_KILLS 21 ENEMY_COMPONENT_DEATHS +-- 22 DFA 23 SHOTS_HIT +-- 24 SHOTS_FIRED 25 HEAD_SHOTS +-- 26 ARM_SHOTS 27 LEG_SHOTS +-- 28 TORSO_SHOTS 29 KILLS_PC +-- 30 KILLS_AI 31 BLANK +-- 32 SHUTDOWN_TIMER 33 OBJECTIVE +-- 34 OBJECTIVE_CONTESTED 35 OBJECTIVE_UNCONTESTED +-- 36 FLAGS_TAKEN 37 FLAGS_DROPPED +-- 38 FLAGS_CAPTURED 39 FLAG_HOLD_TIME +-- 40 TIME 41 ALIVE_PLAYERS +-- 42 DEAD_PLAYERS 43 CUSTOM +-- 44 ENEMY_TURRET_KILLS 45 FRIENDLY_TURRET_KILLS +-- 46 ENEMY_BUILDING_KILLS 47 FRIENDLY_BUILDING_KILLS + +-- body_zone values (DamageObject::DamageZone): +-- 0 LeftLeg 1 RightLeg 2 LeftArm 3 RightArm +-- 4 RightTorso 5 LeftTorso 6 CenterTorso 7 Head +-- 8 SpecialZone1 9 SpecialZone2