From f35002779bdbb74dedd57c0691c6039adc146d93 Mon Sep 17 00:00:00 2001 From: Matthijs Kuiper Date: Fri, 12 Jan 2018 00:50:59 +0100 Subject: Uncomment weapon stats lines --- html/includes/weaponstats.php | 390 +++++++++++++++++++++--------------------- html/pages/match_player.php | 21 +-- 2 files changed, 207 insertions(+), 204 deletions(-) diff --git a/html/includes/weaponstats.php b/html/includes/weaponstats.php index 80238b3..ff97685 100644 --- a/html/includes/weaponstats.php +++ b/html/includes/weaponstats.php @@ -1,210 +1,212 @@ 'Y'"; - - if ($_pid == 0 and $_mid != 0) { - $sql_weapons = "SELECT w.matchid, - w.pid AS playerid, - w.weapon, - SUM(w.kills) AS kills, - SUM(w.shots) AS shots, - SUM(w.hits) AS hits, - SUM(w.damage) AS damage, - AVG(w.acc) AS acc, - pi.name AS playername, - pi.country AS country, - pi.banned AS banned, - wn.id AS weaponid, - wn.name AS weaponname, - wn.image AS weaponimg, - wn.sequence AS sequence, - wn.hide AS hideweapon + global $gamename, $gid; + + $sql_weapons = "SELECT w.matchid, + w.pid AS playerid, + w.weapon, + w.kills, + w.shots, + w.hits, + w.damage, + w.acc, + pi.name AS playername, + pi.country AS country, + pi.banned AS banned, + wn.id AS weaponid, + wn.name AS weaponname, + wn.image AS weaponimg, + wn.sequence AS sequence + FROM uts_weapons AS wn, + uts_weaponstats AS w + LEFT JOIN uts_pinfo AS pi + ON w.pid = pi.id + WHERE w.matchid = '$_mid' + AND w.pid = '$_pid' + AND (wn.id = w.weapon) + AND wn.hide <> 'Y'"; + + if ($_pid == 0 and $_mid != 0) { + $sql_weapons = "SELECT w.matchid, + w.pid AS playerid, + w.weapon, + SUM(w.kills) AS kills, + SUM(w.shots) AS shots, + SUM(w.hits) AS hits, + SUM(w.damage) AS damage, + AVG(w.acc) AS acc, + pi.name AS playername, + pi.country AS country, + pi.banned AS banned, + wn.id AS weaponid, + wn.name AS weaponname, + wn.image AS weaponimg, + wn.sequence AS sequence, + wn.hide AS hideweapon FROM uts_weapons AS wn, uts_weaponstats AS w - LEFT JOIN uts_pinfo AS pi - ON w.pid = pi.id - WHERE w.matchid = '$_mid' - AND (wn.id = w.weapon) - AND wn.hide <> 'Y' - GROUP BY w.pid, - w.weapon"; - } - - $q_weapons = mysql_query($sql_weapons) or die(mysql_error()); - while ($r_weapons = zero_out(mysql_fetch_array($q_weapons))) { - $weaponid = intval($r_weapons['weaponid']); - $playerid = intval($r_weapons['playerid']); - // Don't include banned players - if ($r_weapons['banned'] != 'Y') $psort[$playerid] = strtolower($r_weapons['playername']); - - if ($r_weapons['damage'] > 1000000) $r_weapons['damage'] = round($r_weapons['damage'] / 1000, 0) .'K'; -// if ($r_weapons['damage'] > 1000) $r_weapons['damage'] = round($r_weapons['damage'] / 1000, 0) .'K'; - - $wd[$playerid]['playername'] = $r_weapons['playername']; - $wd[$playerid]['country'] = $r_weapons['country']; - $wd[$playerid]['banned'] = $r_weapons['banned']; - $wd[$playerid][$weaponid]['kills'] = $r_weapons['kills']; - $wd[$playerid][$weaponid]['shots'] = $r_weapons['shots']; - $wd[$playerid][$weaponid]['hits'] = $r_weapons['hits']; - $wd[$playerid][$weaponid]['damage'] = $r_weapons['damage']; - $wd[$playerid][$weaponid]['acc'] = ((!empty($r_weapons['acc'])) ? get_dp($r_weapons['acc']) : ''); - - if (!isset($wsort[$weaponid]) and $r_weapons['hideweapon'] != 'Y') { - $wsort[$weaponid] = intval($r_weapons['sequence']); - $weapons[$weaponid]['name'] = $r_weapons['weaponname']; - $weapons[$weaponid]['image'] = $r_weapons['weaponimg']; - $weapons[$weaponid]['sequence'] = $r_weapons['sequence']; - } - } - if (!isset($psort)) return; - - asort($psort); - asort($wsort); - - $playercol = 1; - if (count($wsort) < 3) { - $one = true; - $colspan = 5; - if (count($psort) == 1) { - $playercol = 0; - } - } else { - $one = false; - $colspan = 1; - } - - echo' - - - - - '; - - if ($one) { - ws_header($wsort, $weapons, $colspan, $one, $playercol); - - echo ''; - foreach($wsort as $wid => $bar) { - for ($i = 1; $i <= $colspan; $i++) { - switch($i) { - case 1: $extra = 'Kills'; break; - case 2: $extra = 'Shots'; break; - case 3: $extra = 'Hits'; break; - case 4: $extra = 'Acc'; break; - case 5: $extra = 'Dmg'; break; - } - $extra = ''. $extra .''; - echo ''; - } - } - echo ''; - - $i = 0; - foreach($psort as $pid => $foo) { - $i++; - echo ''; - if ($playercol) { - echo ' - '; - } - foreach($wsort as $wid => $bar) { - ws_cell($wd, $pid, $wid, 'kills', $i); - ws_cell($wd, $pid, $wid, 'shots', $i); - ws_cell($wd, $pid, $wid, 'hits', $i); - ws_cell($wd, $pid, $wid, 'acc', $i); - ws_cell($wd, $pid, $wid, 'damage', $i); - } - echo ''; - } - } - - if (!$one) { - ws_block($wd, $weapons, $wsort, $psort, $colspan, $playercol, $one, $_mid, $gamename, 'Kills', 'kills'); - //ws_block($wd, $weapons, $wsort, $psort, $colspan, $playercol, $one, $_mid, $gamename, 'Shots', 'shots'); - //ws_block($wd, $weapons, $wsort, $psort, $colspan, $playercol, $one, $_mid, $gamename, 'Hits', 'hits'); - ws_block($wd, $weapons, $wsort, $psort, $colspan, $playercol, $one, $_mid, $gamename, 'Damage', 'damage'); - ws_block($wd, $weapons, $wsort, $psort, $colspan, $playercol, $one, $_mid, $gamename, 'Accuracy', 'acc'); - } - - echo '
'.htmlentities($title).'
'.$extra.'
'.FormatPlayerName($wd[$pid]['country'], $pid, $wd[$pid]['playername'], $gid, $gamename).'
'; + LEFT JOIN uts_pinfo AS pi + ON w.pid = pi.id + WHERE w.matchid = '$_mid' + AND (wn.id = w.weapon) + AND wn.hide <> 'Y' + GROUP BY w.pid, + w.weapon"; + } + + $q_weapons = mysql_query($sql_weapons) or die(mysql_error()); + while ($r_weapons = zero_out(mysql_fetch_array($q_weapons))) { + $weaponid = intval($r_weapons['weaponid']); + $playerid = intval($r_weapons['playerid']); + + // Don't include banned players + if ($r_weapons['banned'] != 'Y') $psort[$playerid] = strtolower($r_weapons['playername']); + + if ($r_weapons['damage'] > 1000000) $r_weapons['damage'] = round($r_weapons['damage'] / 1000, 0) .'K'; + // if ($r_weapons['damage'] > 1000) $r_weapons['damage'] = round($r_weapons['damage'] / 1000, 0) .'K'; + + $wd[$playerid]['playername'] = $r_weapons['playername']; + $wd[$playerid]['country'] = $r_weapons['country']; + $wd[$playerid]['banned'] = $r_weapons['banned']; + $wd[$playerid][$weaponid]['kills'] = $r_weapons['kills']; + $wd[$playerid][$weaponid]['shots'] = $r_weapons['shots']; + $wd[$playerid][$weaponid]['hits'] = $r_weapons['hits']; + $wd[$playerid][$weaponid]['damage'] = $r_weapons['damage']; + $wd[$playerid][$weaponid]['acc'] = ((!empty($r_weapons['acc'])) ? get_dp($r_weapons['acc']) : ''); + + if (!isset($wsort[$weaponid]) and $r_weapons['hideweapon'] != 'Y') { + $wsort[$weaponid] = intval($r_weapons['sequence']); + $weapons[$weaponid]['name'] = $r_weapons['weaponname']; + $weapons[$weaponid]['image'] = $r_weapons['weaponimg']; + $weapons[$weaponid]['sequence'] = $r_weapons['sequence']; + } + } + if (!isset($psort)) return; + + asort($psort); + asort($wsort); + + $playercol = 1; + if (count($wsort) < 3) { + $one = true; + $colspan = 5; + if (count($psort) == 1) { + $playercol = 0; + } + } else { + $one = false; + $colspan = 1; + } + + echo ' + + + + + '; + + if ($one) { + ws_header($wsort, $weapons, $colspan, $one, $playercol); + + echo ''; + foreach($wsort as $wid => $bar) { + for ($i = 1; $i <= $colspan; $i++) { + switch($i) { + case 1: $extra = 'Kills'; break; + case 2: $extra = 'Shots'; break; + case 3: $extra = 'Hits'; break; + case 4: $extra = 'Acc'; break; + case 5: $extra = 'Dmg'; break; + } + $extra = ''. $extra .''; + echo ''; + } + } + echo ''; + + $i = 0; + foreach($psort as $pid => $foo) { + $i++; + echo ''; + if ($playercol) { + echo ''; + } + foreach($wsort as $wid => $bar) { + ws_cell($wd, $pid, $wid, 'kills', $i); + ws_cell($wd, $pid, $wid, 'shots', $i); + ws_cell($wd, $pid, $wid, 'hits', $i); + ws_cell($wd, $pid, $wid, 'acc', $i); + ws_cell($wd, $pid, $wid, 'damage', $i); + } + echo ''; + } + } else { + ws_block($wd, $weapons, $wsort, $psort, $colspan, $playercol, $one, $_mid, $gamename, 'Kills', 'kills'); + ws_block($wd, $weapons, $wsort, $psort, $colspan, $playercol, $one, $_mid, $gamename, 'Shots', 'shots'); + ws_block($wd, $weapons, $wsort, $psort, $colspan, $playercol, $one, $_mid, $gamename, 'Hits', 'hits'); + ws_block($wd, $weapons, $wsort, $psort, $colspan, $playercol, $one, $_mid, $gamename, 'Damage', 'damage'); + ws_block($wd, $weapons, $wsort, $psort, $colspan, $playercol, $one, $_mid, $gamename, 'Accuracy', 'acc'); + } + + echo '
'.htmlentities($title).'
'.$extra.'
'.FormatPlayerName($wd[$pid]['country'], $pid, $wd[$pid]['playername'], $gid, $gamename) + .'
'; } function ws_header(&$wsort, &$weapons, $colspan, $one, $playercol) { - echo ''; - if ($playercol and $playercol != -1) echo ''; - if ($playercol == -1) echo ' '; - foreach($wsort as $wid => $bar) { - if (!empty($weapons[$wid]['image'])) { - $content = ''.$weapons[$wid]['name'].''; - } else { - $content = ''.$weapons[$wid]['name'].''; - } - echo ''.$content.''; - - } - echo ''; + echo ''; + if ($playercol and $playercol != -1) echo ''; + if ($playercol == -1) echo ' '; + + foreach($wsort as $wid => $bar) { + if (!empty($weapons[$wid]['image'])) { + $content = ''.$weapons[$wid]['name'].''; + } else { + $content = ''.$weapons[$wid]['name'].''; + } + echo ''.$content.''; + + } + echo ''; } function ws_cell(&$wd, $pid, $wid, $field, $i) { - $content = ''; - if (isset($wd[$pid][$wid][$field])) $content = $wd[$pid][$wid][$field]; - $class = ($i % 2) ? 'grey' : 'grey2'; - echo ' - '.$content.''; + $content = ''; + if (isset($wd[$pid][$wid][$field])) $content = $wd[$pid][$wid][$field]; + $class = ($i % 2) ? 'grey' : 'grey2'; + echo ' + '.$content.''; } function ws_block(&$wd, &$weapons, &$wsort, &$psort, &$colspan, $playercol, $one,$_mid, $gamename, $caption, $field) { - global $gamename, $gid; - if (count($psort) != 1) { - echo ' - - - - - '.$caption.' - '; - ws_header($wsort, $weapons, $colspan, $one, $playercol); - } - if (count($psort) == 1) { - $playercol = -1; - if ($field == 'kills') ws_header($wsort, $weapons, $colspan, $one, $playercol); - } - - $i = 0; - foreach($psort as $pid => $foo) { - $i++; - echo ''; - if ($playercol and $playercol != -1) echo ''.FormatPlayerName($wd[$pid]['country'], $pid, $wd[$pid]['playername'], $gid, $gamename).''; - if ($playercol == -1) echo ''.$caption.''; - foreach($wsort as $wid => $bar) { - ws_cell($wd, $pid, $wid, $field, $i); - } - echo ''; - } + global $gamename, $gid; + if (count($psort) != 1) { + echo ' + + + + + '.$caption.' + '; + ws_header($wsort, $weapons, $colspan, $one, $playercol); + } + if (count($psort) == 1) { + $playercol = -1; + if ($field == 'kills') ws_header($wsort, $weapons, $colspan, $one, $playercol); + } + + $i = 0; + foreach($psort as $pid => $foo) { + $i++; + echo ''; + if ($playercol and $playercol != -1) echo ''.FormatPlayerName($wd[$pid]['country'], $pid, $wd[$pid]['playername'], $gid, $gamename).''; + if ($playercol == -1) echo ''.$caption.''; + foreach($wsort as $wid => $bar) { + ws_cell($wd, $pid, $wid, $field, $i); + } + echo ''; + } } ?> diff --git a/html/pages/match_player.php b/html/pages/match_player.php index 664bc88..63755e0 100755 --- a/html/pages/match_player.php +++ b/html/pages/match_player.php @@ -132,7 +132,7 @@ if ($sql_firstblood[firstblood] == $pid) { $firstblood = "No"; } -echo' +echo ' '.$firstblood.' '.$r_gsumm[spree_double].' @@ -156,19 +156,20 @@ $r_pings = small_query("SELECT lowping, avgping, highping FROM uts_player WHERE if ($r_pings and $r_pings['lowping']) { echo '
- - - +
Pings
+ + + - - - + + + - - - + + +
Pings
MinAvgMaxMinAvgMax
'.ceil($r_pings['lowping']).''.ceil($r_pings['avgping']).''.ceil($r_pings['highping']).''.ceil($r_pings['lowping']).''.ceil($r_pings['avgping']).''.ceil($r_pings['highping']).'
'; } -- cgit