diff options
| author | randommonk <randommonk@gmail.com> | 2018-01-04 22:52:54 +0000 |
|---|---|---|
| committer | randommonk <randommonk@gmail.com> | 2018-01-04 23:06:03 +0000 |
| commit | dfc4e20b8e9ca57340e24143539498fb82527697 (patch) | |
| tree | 50cdec1c1e650e6ca8f0d055b401b2c893e43124 /html/includes | |
| parent | 66b162b5f01c996fd8a5cd4e570e31f8483cdffa (diff) | |
Bumped version to 4.3. Added jpgraph stats developed by killerEye
Diffstat (limited to 'html/includes')
51 files changed, 35827 insertions, 9 deletions
diff --git a/html/includes/config.php b/html/includes/config.php index 7b086f6..2e52f98 100755 --- a/html/includes/config.php +++ b/html/includes/config.php @@ -16,7 +16,8 @@ $import_homedir = ''; // Use the MySQL temporary tables feature?
// Available since MySQL 3.23 - requires CREATE TEMPORARY TABLE privilege since 4.0.2
-$import_use_temporary_tables = true; // set to true if available
+// No longer supported from utstats version 4.3 onwards. Left here for historical purposes.
+$import_use_temporary_tables = false; // Do not set to true unless all jpgraph import changes have been disabled.
// Use temporary heap tables?
// This will (at any cost) keep the entire table in RAM and may speed and/or fuck things up
@@ -183,4 +184,62 @@ $ftp_passive[$i] = true; // Use passive transfer mode for this connection? $ftp_delete[$i] = true; // Delete logs after download?
*/
+// This section is for stats graphs as of version 4.3
+$renderer_folder = "renderings";
+$renderer_width = 350;
+$renderer_heigth = 250;
+$renderer_color['team'][0][0] = '#ff3333'; // team red color 1
+$renderer_color['team'][0][1] = '#cc0000'; // team red color 2
+$renderer_color['team'][1][0] = '#0080ff'; // team blue color 1
+$renderer_color['team'][1][1] = '#0000cc'; // team blue color 2
+$renderer_color['team'][2][0] = '#88d8b0'; // team green color 1
+$renderer_color['team'][2][1] = '#009f50'; // team green color 2
+$renderer_color['team'][3][0] = '#ffeead'; // team gold color 1
+$renderer_color['team'][3][1] = '#e5b021'; // team gold color 2
+$renderer_color['player'][0][0] = '#a7d848'; // player 1 color 1
+$renderer_color['player'][0][1] = '#98be44'; // player 1 color 2
+$renderer_color['player'][1][0] = '#6ccdd0'; // player 2 color 1
+$renderer_color['player'][1][1] = '#66af9f'; // player 2 color 2
+$renderer_color['player'][2][0] = '#ffce59'; // player 3 color 1
+$renderer_color['player'][2][1] = '#ffa65a'; // player 3 color 2
+$renderer_color['player'][3][0] = '#fba263'; // player 4 color 1
+$renderer_color['player'][3][1] = '#eb7254'; // player 4 color 2
+$renderer_color['player'][4][0] = '#fb6370 '; // player 5 color 1
+$renderer_color['player'][4][1] = '#fb6363'; // player 5 color 2
+$renderer_color['background'] = '#262626';// background color 1
+$renderer_color['band'][0] = '#666666';// band color 1
+$renderer_color['band'][1] = '#515151';// band color 2
+$renderer_color['heading'] = '#bbdeff';// font heading
+$renderer_color['font'] = '#999999';// font other
+$renderer_color['amp'] = '#aa02db';// color amp
+$renderer_color_transparancy = 0.3;// color amp
+
+define("TIMERATIO", 1.09863333333333333333333333333333333333333333333333333333333);
+
+define("RENDERER_CHARTTYPE_LINE", "line");
+define("RENDERER_CHARTTYPE_COLUMN", "column");
+define("RENDERER_CHARTTYPE_BAR", "bar");
+define("RENDERER_CHARTTYPE_LINESTEP", "linestep");
+define("RENDERER_CHARTTYPE_LINECOLUMN", "linecolumn");
+define("RENDERER_CHARTTYPE_LINESTEPCOLUMN", "linestepcolumn");
+define("RENDERER_CHARTTYPE_RADAR", "radar");
+
+define("RENDERER_CHART_CTF_TEAMSCORE", 10);
+define("RENDERER_CHART_CTF_GRABBREAKDOWN", 11);
+
+define("RENDERER_CHART_DOM_SCOREDERIV", 21);
+
+define("RENDERER_CHART_FRAGS_TEAMSCORE", 90);
+define("RENDERER_CHART_FRAGS_TEAMDERIV", 91);
+define("RENDERER_CHART_FRAGS_TEAMNORMAL", 92);
+define("RENDERER_CHART_FRAGS_PLAYERSCORE", 93);
+define("RENDERER_CHART_FRAGS_PLAYERDERIV", 94);
+define("RENDERER_CHART_FRAGS_PLAYERNORMAL", 95);
+define("RENDERER_CHART_FRAGS_PLAYERSCORE5", 96);
+define("RENDERER_CHART_FRAGS_PLAYERNORMAL5", 97);
+
+define("RENDERER_CHART_ITEMS_TEAMPICKUPS", 100);
+define("RENDERER_CHART_ITEMS_PLAYERPICKUPS", 101);
+define("RENDERER_CHART_ITEMS_AMPRUNS", 102);
+
?>
diff --git a/html/includes/css/themes/tooltipster-light.css b/html/includes/css/themes/tooltipster-light.css new file mode 100644 index 0000000..945aa69 --- /dev/null +++ b/html/includes/css/themes/tooltipster-light.css @@ -0,0 +1,12 @@ +.tooltipster-light { + border-radius: 5px; + border: 1px solid #cccccc; + background: #ededed; + color: #666666; +} +.tooltipster-light .tooltipster-content { + font-family: Arial, sans-serif; + font-size: 14px; + line-height: 16px; + padding: 8px 10px; +}
\ No newline at end of file diff --git a/html/includes/css/themes/tooltipster-noir.css b/html/includes/css/themes/tooltipster-noir.css new file mode 100644 index 0000000..548b245 --- /dev/null +++ b/html/includes/css/themes/tooltipster-noir.css @@ -0,0 +1,12 @@ +.tooltipster-noir { + border-radius: 0px; + border: 3px solid #2c2c2c; + background: #fff; + color: #2c2c2c; +} +.tooltipster-noir .tooltipster-content { + font-family: 'Georgia', serif; + font-size: 14px; + line-height: 16px; + padding: 8px 10px; +}
\ No newline at end of file diff --git a/html/includes/css/themes/tooltipster-punk.css b/html/includes/css/themes/tooltipster-punk.css new file mode 100644 index 0000000..0b7362c --- /dev/null +++ b/html/includes/css/themes/tooltipster-punk.css @@ -0,0 +1,12 @@ +.tooltipster-punk { + border-radius: 5px; + border-bottom: 3px solid #f71169; + background: #2a2a2a; + color: #fff; +} +.tooltipster-punk .tooltipster-content { + font-family: 'Courier', monospace; + font-size: 14px; + line-height: 16px; + padding: 8px 10px; +}
\ No newline at end of file diff --git a/html/includes/css/themes/tooltipster-shadow.css b/html/includes/css/themes/tooltipster-shadow.css new file mode 100644 index 0000000..e869c5e --- /dev/null +++ b/html/includes/css/themes/tooltipster-shadow.css @@ -0,0 +1,12 @@ +.tooltipster-shadow { + border-radius: 5px; + background: #fff; + box-shadow: 0px 0px 14px rgba(0,0,0,0.3); + color: #2c2c2c; +} +.tooltipster-shadow .tooltipster-content { + font-family: 'Arial', sans-serif; + font-size: 14px; + line-height: 16px; + padding: 8px 10px; +}
\ No newline at end of file diff --git a/html/includes/css/tooltipster.css b/html/includes/css/tooltipster.css new file mode 100644 index 0000000..14c70d0 --- /dev/null +++ b/html/includes/css/tooltipster.css @@ -0,0 +1,283 @@ +/* This is the default Tooltipster theme (feel free to modify or duplicate and create multiple themes!): */ +.tooltipster-default { + border-radius: 5px; + border: 1px solid #1e1e1e; + background: -webkit-linear-gradient(#3b383b, #1e1e1e); /* For Safari 5.1 to 6.0 */ + background: -o-linear-gradient(#3b383b, #1e1e1e); /* For Opera 11.1 to 12.0 */ + background: -moz-linear-gradient(#3b383b, #1e1e1e); /* For Firefox 3.6 to 15 */ + background: linear-gradient(#3b383b, #1e1e1e); /* Standard syntax */ + color: #fff; + cursor: pointer; + -webkit-box-shadow: 10px 10px 26px -10px rgba(0,0,0,0.75); + -moz-box-shadow: 10px 10px 26px -10px rgba(0,0,0,0.75); + box-shadow: 10px 10px 26px -10px rgba(0,0,0,0.75); + max-width: 400px; +} + +/* Use this next selector to style things like font-size and line-height: */ +.tooltipster-default .tooltipster-content { + font-family: GothamLight, sans-serif; + font-size: 14px; + line-height: 16px; + padding: 8px 10px; + overflow: hidden; +} + +/* This next selector defines the color of the border on the outside of the arrow. This will automatically match the color and size of the border set on the main tooltip styles. Set display: none; if you would like a border around the tooltip but no border around the arrow */ +.tooltipster-default .tooltipster-arrow .tooltipster-arrow-border { + /* border-color: ... !important; */ +} + + +/* If you're using the icon option, use this next selector to style them */ +.tooltipster-icon { + cursor: pointer; + margin-left: 4px; +} + + + + + + + + +/* This is the base styling required to make all Tooltipsters work */ +.tooltipster-base { + padding: 0; + font-size: 0; + line-height: 0; + position: absolute; + left: 0; + top: 0; + z-index: 9999999; + pointer-events: none; + width: auto; + overflow: visible; + +} +.tooltipster-base .tooltipster-content { + overflow: hidden; +} + + +/* These next classes handle the styles for the little arrow attached to the tooltip. By default, the arrow will inherit the same colors and border as what is set on the main tooltip itself. */ +.tooltipster-arrow { + display: block; + text-align: center; + width: 100%; + height: 100%; + position: absolute; + top: 0; + left: 0; + z-index: -1; +} +.tooltipster-arrow span, .tooltipster-arrow-border { + display: block; + width: 0; + height: 0; + position: absolute; +} +.tooltipster-arrow-top span, .tooltipster-arrow-top-right span, .tooltipster-arrow-top-left span { + border-left: 8px solid transparent !important; + border-right: 8px solid transparent !important; + border-top: 8px solid; + bottom: -7px; +} +.tooltipster-arrow-top .tooltipster-arrow-border, .tooltipster-arrow-top-right .tooltipster-arrow-border, .tooltipster-arrow-top-left .tooltipster-arrow-border { + border-left: 9px solid transparent !important; + border-right: 9px solid transparent !important; + border-top: 9px solid; + bottom: -7px; +} + +.tooltipster-arrow-bottom span, .tooltipster-arrow-bottom-right span, .tooltipster-arrow-bottom-left span { + border-left: 8px solid transparent !important; + border-right: 8px solid transparent !important; + border-bottom: 8px solid; + top: -7px; +} +.tooltipster-arrow-bottom .tooltipster-arrow-border, .tooltipster-arrow-bottom-right .tooltipster-arrow-border, .tooltipster-arrow-bottom-left .tooltipster-arrow-border { + border-left: 9px solid transparent !important; + border-right: 9px solid transparent !important; + border-bottom: 9px solid; + top: -7px; +} +.tooltipster-arrow-top span, .tooltipster-arrow-top .tooltipster-arrow-border, .tooltipster-arrow-bottom span, .tooltipster-arrow-bottom .tooltipster-arrow-border { + left: 0; + right: 0; + margin: 0 auto; +} +.tooltipster-arrow-top-left span, .tooltipster-arrow-bottom-left span { + left: 6px; +} +.tooltipster-arrow-top-left .tooltipster-arrow-border, .tooltipster-arrow-bottom-left .tooltipster-arrow-border { + left: 5px; +} +.tooltipster-arrow-top-right span, .tooltipster-arrow-bottom-right span { + right: 6px; +} +.tooltipster-arrow-top-right .tooltipster-arrow-border, .tooltipster-arrow-bottom-right .tooltipster-arrow-border { + right: 5px; +} +.tooltipster-arrow-left span, .tooltipster-arrow-left .tooltipster-arrow-border { + border-top: 8px solid transparent !important; + border-bottom: 8px solid transparent !important; + border-left: 8px solid; + top: 50%; + margin-top: -7px; + right: -7px; +} +.tooltipster-arrow-left .tooltipster-arrow-border { + border-top: 9px solid transparent !important; + border-bottom: 9px solid transparent !important; + border-left: 9px solid; + margin-top: -8px; +} +.tooltipster-arrow-right span, .tooltipster-arrow-right .tooltipster-arrow-border { + border-top: 8px solid transparent !important; + border-bottom: 8px solid transparent !important; + border-right: 8px solid; + top: 50%; + margin-top: -7px; + left: -7px; +} +.tooltipster-arrow-right .tooltipster-arrow-border { + border-top: 9px solid transparent !important; + border-bottom: 9px solid transparent !important; + border-right: 9px solid; + margin-top: -8px; +} + + +/* Some CSS magic for the awesome animations - feel free to make your own custom animations and reference it in your Tooltipster settings! */ + +.tooltipster-fade { + opacity: 0; + -webkit-transition-property: opacity; + -moz-transition-property: opacity; + -o-transition-property: opacity; + -ms-transition-property: opacity; + transition-property: opacity; +} +.tooltipster-fade-show { + opacity: 1; +} + +.tooltipster-grow { + -webkit-transform: scale(0,0); + -moz-transform: scale(0,0); + -o-transform: scale(0,0); + -ms-transform: scale(0,0); + transform: scale(0,0); + -webkit-transition-property: -webkit-transform; + -moz-transition-property: -moz-transform; + -o-transition-property: -o-transform; + -ms-transition-property: -ms-transform; + transition-property: transform; + -webkit-backface-visibility: hidden; +} +.tooltipster-grow-show { + -webkit-transform: scale(1,1); + -moz-transform: scale(1,1); + -o-transform: scale(1,1); + -ms-transform: scale(1,1); + transform: scale(1,1); + -webkit-transition-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1); + -webkit-transition-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1.15); + -moz-transition-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1.15); + -ms-transition-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1.15); + -o-transition-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1.15); + transition-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1.15); +} + +.tooltipster-swing { + opacity: 0; + -webkit-transform: rotateZ(4deg); + -moz-transform: rotateZ(4deg); + -o-transform: rotateZ(4deg); + -ms-transform: rotateZ(4deg); + transform: rotateZ(4deg); + -webkit-transition-property: -webkit-transform, opacity; + -moz-transition-property: -moz-transform; + -o-transition-property: -o-transform; + -ms-transition-property: -ms-transform; + transition-property: transform; +} +.tooltipster-swing-show { + opacity: 1; + -webkit-transform: rotateZ(0deg); + -moz-transform: rotateZ(0deg); + -o-transform: rotateZ(0deg); + -ms-transform: rotateZ(0deg); + transform: rotateZ(0deg); + -webkit-transition-timing-function: cubic-bezier(0.230, 0.635, 0.495, 1); + -webkit-transition-timing-function: cubic-bezier(0.230, 0.635, 0.495, 2.4); + -moz-transition-timing-function: cubic-bezier(0.230, 0.635, 0.495, 2.4); + -ms-transition-timing-function: cubic-bezier(0.230, 0.635, 0.495, 2.4); + -o-transition-timing-function: cubic-bezier(0.230, 0.635, 0.495, 2.4); + transition-timing-function: cubic-bezier(0.230, 0.635, 0.495, 2.4); +} + +.tooltipster-fall { + top: 0; + -webkit-transition-property: top; + -moz-transition-property: top; + -o-transition-property: top; + -ms-transition-property: top; + transition-property: top; + -webkit-transition-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1); + -webkit-transition-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1.15); + -moz-transition-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1.15); + -ms-transition-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1.15); + -o-transition-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1.15); + transition-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1.15); +} +.tooltipster-fall-show { +} +.tooltipster-fall.tooltipster-dying { + -webkit-transition-property: all; + -moz-transition-property: all; + -o-transition-property: all; + -ms-transition-property: all; + transition-property: all; + top: 0px !important; + opacity: 0; +} + +.tooltipster-slide { + left: -40px; + -webkit-transition-property: left; + -moz-transition-property: left; + -o-transition-property: left; + -ms-transition-property: left; + transition-property: left; + -webkit-transition-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1); + -webkit-transition-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1.15); + -moz-transition-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1.15); + -ms-transition-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1.15); + -o-transition-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1.15); + transition-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1.15); +} +.tooltipster-slide.tooltipster-slide-show { +} +.tooltipster-slide.tooltipster-dying { + -webkit-transition-property: all; + -moz-transition-property: all; + -o-transition-property: all; + -ms-transition-property: all; + transition-property: all; + left: 0px !important; + opacity: 0; +} + + +/* CSS transition for when contenting is changing in a tooltip that is still open. The only properties that will NOT transition are: width, height, top, and left */ +.tooltipster-content-changing { + opacity: 0.5; + -webkit-transform: scale(1.1, 1.1); + -moz-transform: scale(1.1, 1.1); + -o-transform: scale(1.1, 1.1); + -ms-transform: scale(1.1, 1.1); + transform: scale(1.1, 1.1); +} diff --git a/html/includes/domstats.php b/html/includes/domstats.php new file mode 100644 index 0000000..dbdd3f7 --- /dev/null +++ b/html/includes/domstats.php @@ -0,0 +1,719 @@ +<?php +require_once 'jpgraph/jpgraph.php'; +require_once 'jpgraph/jpgraph_scatter.php'; +require_once 'jpgraph/jpgraph_mgraph.php'; +require_once 'jpgraph/jpgraph_bar.php'; +require_once 'jpgraph/jpgraph_line.php'; +require_once 'jpgraph/jpgraph_radar.php'; + +/* +Retrieve player names & player teams +Pretty much utstats code re-used +@return $playernames, $playerteams (arrays based on pid) +*/ +function getPlayerTeam($uid) { + + $playernames = array(); + $playerteams = array(); + + // Get List of Player IDs and Process What They Have Done + $sql_player = "SELECT DISTINCT col4 FROM uts_temp_$uid WHERE col1 = 'player' AND col2 = 'rename' AND col4 <> ''"; + $q_player = mysql_query($sql_player) or die(mysql_error()); + + while ($r_player = mysql_fetch_array($q_player)) { + $playerid = $r_player[col4]; + + // Get players last name used + $r_player2 = small_query("SELECT col3 FROM uts_temp_$uid WHERE col1 = 'player' AND col2 = 'rename' AND col4 = $playerid ORDER BY id DESC LIMIT 0,1"); + $playername = addslashes($r_player2[col3]); + + // Get players last team + $r_player3 = small_query("SELECT col4 FROM uts_temp_$uid WHERE col1 = 'player' AND col2 = 'TeamChange' AND col3 = $playerid AND col4 != 255 ORDER BY id DESC LIMIT 0,1"); + $playerteam = $r_player3[col4]; + + $playernames[$playerid] = $playername; + $playerteams[$playerid] = $playerteam; + } + + return array($playernames,$playerteams); + +} + +/* +Get time game starts, game ends, and ratio compared to real time +@return $time_gamestart, $time_gameend, $time_ratio_correction (difference in ut time & real time, typically 110%) +*/ +function getGameStartEndRatio($uid) { + + // gather game start & end time + $q_logdom = mysql_query("SELECT col0 FROM uts_temp_$uid WHERE col1='game_start' OR col1='game_end' ORDER BY id ASC")or die(mysql_error()); + + $time_gamestart = mysql_result($q_logdom,0); + $time_gameend = mysql_result($q_logdom,1); + $time_ratio_correction = ($time_gameend-$time_gamestart)/1200; + + return array($time_gamestart, $time_gameend, $time_ratio_correction); +} + +/* +Helper function to create the temporary table used for dom stats +*/ +function createEmptyTempTable($table_name) { + + $sqlCreateTable = " + CREATE TEMPORARY TABLE `$table_name` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `cp` varchar(254) NOT NULL, + `teamid` int(11) NOT NULL, + `playerid` int(11) NOT NULL, + `playername` varchar(254) NOT NULL, + `start` float NOT NULL, + `end` float NOT NULL, + `time` float NOT NULL, + `scoret0` float NOT NULL, + `scoret1` float NOT NULL, + `realTimeEnd` float NOT NULL, + PRIMARY KEY (`id`) + ) ENGINE=MyISAM + "; + mysql_query($sqlCreateTable) or die(mysql_error()); +} + +/* +Create & populate the dom stats table +@return name of temporary table +*/ +function generateTempTable($uid) { + global $playernames; + global $playerteams; + global $time_gamestart; + global $time_gameend; + global $time_ratio_correction; + + $tempTableName = "uts_tempidom_".$uid; + + createEmptyTempTable($tempTableName); + + // iterate over cp's. also capture game-end event as a quick hack to also do final iteration over final cp + $q_logdom = mysql_query("SELECT * FROM uts_temp_$uid WHERE col1='controlpoint_capture' OR col1='game_end' ORDER BY col1, col2, id ASC")or die(mysql_error()); + + $prev_time = 0; + + // dynamicly create insert query to populate the table in 1 go, instead of multiple database calls + $insertQuery = "INSERT INTO $tempTableName (cp, teamid, playerid, playername, start, end, time,scoret0,scoret1,realTimeEnd) VALUES"; + + // basically loop over all capture events per CP. Each time calculate how long the previous owner had the point and translate this to dom points + while($r_logdom = mysql_fetch_array($q_logdom)) { + $points[0] = 0; + $points[1] = 0; + $ticks[0] = 0; + $ticks[1] = 0; + + $start_time = $prev_time; + + $r_cp = $r_logdom['col2']; + $r_time = $r_logdom['col0']; + + // skip first capture event - no dom points given at start of map since no-one has cp + if($prev_time > 0) { + + // if switching to other cp + if($prev_cp != $r_cp) { + $end_time = $time_gameend; // take game end time to calculate time cp was taken, since it's the last time it's taken + extra tick for end time + + } else { + $end_time = $r_time; + } + + $time_diff = ($end_time - $start_time); + + // point has to be yours for at least a second before it starts to add points + if($time_diff >= 1) { + + // after this second, it will start to add points during each time the timer runs (= each second) + // thus, first run of timer is ceil of start time + // also, floor of end time since having the point after the timer ran, but not until the next tick = no points + // timing in log does not account for gamespeed, typically 1.1 ratio, which is corrected in these times + // test was done to save the actual tick times based upon the dom_points stats event (happens each 5 ticks), but this doesn't result in significant better results to be worth the effort + + // save amount of timer 'ticks' that generate a score of 0.2 + $ticks[$r_teamid] = (floor($end_time/$time_ratio_correction)-ceil($start_time/$time_ratio_correction)); + + } + + // if no tick happened, insert the event with 0 points + if($ticks[$r_teamid]==0) { + + $realTimeEnd=($start_time-$time_gamestart)/$time_ratio_correction/60; + $insertQuery .= " ('$prev_cp', '$r_teamid', '$r_pid', '$r_pname', '$start_time', '$end_time', '$time_diff', '".$points[0]."', '".$points[1]."', '$realTimeEnd'),"; + + // if ticks happened, i |
