summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthijs Kuiper <info@matthijskuiper.nl>2018-01-09 01:50:33 +0100
committerMatthijs Kuiper <info@matthijskuiper.nl>2018-01-09 01:50:33 +0100
commit30f8587ad035053578d6b7bf75c3b418ea083c21 (patch)
treedda962fe680196e5daa8d9b60822afe095329bc6
parent3a58cb2802c8be14f78015105afe759b1c7ce692 (diff)
Fix pu_boots error
-rw-r--r--html/includes/renderer-general-import.php110
-rwxr-xr-xhtml/pages/match_info_other.php13
-rwxr-xr-xhtml/pages/players_info.php6
3 files changed, 60 insertions, 69 deletions
diff --git a/html/includes/renderer-general-import.php b/html/includes/renderer-general-import.php
index fbe62fc..6b642f1 100644
--- a/html/includes/renderer-general-import.php
+++ b/html/includes/renderer-general-import.php
@@ -5,32 +5,31 @@ Retrieve player names & player teams
Pretty much utstats code re-used
@return $playernames, $playerteams (arrays based on pid)
*/
-function getPlayerTeam() {
+function getPlayerTeam() {
global $matchid;
-
+
$playernames = array();
$playerteams = array();
-
+
$uid = mysql_real_escape_string($uid);
-
+
// Get List of Player IDs and Process What They Have Done
$sql_player = "SELECT p.playerid,p.team,i.name FROM uts_player p JOIN uts_pinfo i ON p.pid = i.id WHERE p.matchid=$matchid";
$q_player = mysql_query($sql_player) or die(mysql_error());
-
+
while ($r_player = mysql_fetch_array($q_player)) {
$playerid = $r_player['playerid'];
$playername = $r_player['name'];
$playerteam = $r_player['team'];
$playernames[$playerid] = $playername;
- $playerteams[$playerid] = $playerteam;
+ $playerteams[$playerid] = $playerteam;
}
-
+
$r_team = small_query("SELECT COUNT(DISTINCT team) FROM uts_player WHERE matchid=$matchid");
$teams = $r_team[0];
-
- return array($playernames,$playerteams,$teams);
+ return array($playernames,$playerteams,$teams);
}
/*
@@ -38,7 +37,6 @@ 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());
@@ -46,16 +44,14 @@ function getGameStartEndRatio($uid) {
$time_gameend = mysql_result($q_logdom,1);
//$time_ratio_correction = ($time_gameend-$time_gamestart)/1200;
$time_ratio_correction = TIMERATIO; // based on hardcore mode
-
+
return array($time_gamestart, $time_gameend, $time_ratio_correction);
}
function generateTeamLabels() {
-
return array('Red Team', 'Blue Team', 'Green Team', 'Gold Team');
}
-
/*
Generate the chart with pickups
*/
@@ -67,71 +63,69 @@ function renderDataPickups($uid,$team=true,$playerRedWins=true,$topFraggers) {
global $renderer_heigth;
$uid = mysql_real_escape_string($uid);
-
- $q_pickups = mysql_query("SELECT SUM(pu_belt), SUM(pu_keg), SUM(pu_pads), SUM(pu_armour), SUM(pu_amp) FROM uts_player as p WHERE matchid = ".mysql_real_escape_string($matchid)." GROUP BY team") or die(mysql_error());
-
+
+ $q_pickups = mysql_query("SELECT SUM(pu_belt), SUM(pu_keg), SUM(pu_pads), SUM(pu_armour), SUM(pu_amp) FROM uts_player as p WHERE matchid = ".mysql_real_escape_string($matchid)." GROUP BY team") or die(mysql_error());
+
while($r_pickups = mysql_fetch_row($q_pickups)) {
$preData[] = $r_pickups;
}
-
+
$pickupitems = array('belt','keg','pads','armour','amp');
$itemsPickedUp = array();
-
+
if($team || $playerRedWins) {
$teamOneId = 0;
- $teamTwoId = 1;
+ $teamTwoId = 1;
} else {
$teamOneId = 1;
- $teamTwoId = 0;
+ $teamTwoId = 0;
}
-
+
// Process data to convert these to percentages
// Normal numbers don't plot nicely (fe. pads getting much higher pickups due to lower spawn time
- for($i=0;$i<count($pickupitems);$i++) {
-
+ for($i=0;$i<count($pickupitems);$i++) {
if($preData[0][$i]>0) {
$percValue = round($preData[0][$i]/($preData[0][$i]+$preData[1][$i])*100,0);
-
+
$data[$teamOneId][] = $percValue;
$data[$teamTwoId][] = 100-$percValue;
- $itemsPickedUp[] = $pickupitems[$i];
-
+ $itemsPickedUp[] = $pickupitems[$i];
+
} else if($preData[1][$i]>0) {
$data[$teamOneId][] = 0;
$data[$teamTwoId][] = 100;
- $itemsPickedUp[] = $pickupitems[$i];
+ $itemsPickedUp[] = $pickupitems[$i];
}
-
}
-
+
if(count($itemsPickedUp)>2) {
if($team)
$labels = generateTeamLabels();
else
$labels = generateLabelsFraggers($topFraggers);
-
+
$charttype = $team?RENDERER_CHART_ITEMS_TEAMPICKUPS:RENDERER_CHART_ITEMS_PLAYERPICKUPS;
-
+
// Save team score over team for teams
- mysql_query("INSERT INTO uts_chartdata (mid,chartid,data,labels,categories) VALUES (".$matchid.", ".$charttype.",
- '".mysql_real_escape_string(gzencode(serialize($data)))."',
- '".mysql_real_escape_string(gzencode(serialize($labels)))."',
+ mysql_query("INSERT INTO uts_chartdata (mid,chartid,data,labels,categories) VALUES (".$matchid.", ".$charttype.",
+ '".mysql_real_escape_string(gzencode(serialize($data)))."',
+ '".mysql_real_escape_string(gzencode(serialize($labels)))."',
'".mysql_real_escape_string(gzencode(serialize($itemsPickedUp)))."')") or die(mysql_error());
}
}
-/**
+/*
Generate labels for the fraggers
*/
function generateLabelsFraggers($topFraggers) {
global $playernames;
-
+
$labels = array();
-
- foreach($topFraggers as $fragger) {
+
+ foreach($topFraggers as $fragger) {
$labels[] = substr($playernames[$fragger],0,18);
}
-
+
return $labels;
}
@@ -139,30 +133,30 @@ function generateLabelsFraggers($topFraggers) {
Helper function to sort array on key, based on solution from the interwebs
*/
function array_sort($array, $on) {
- $new_array = array();
- $sortable_array = array();
-
- if (count($array) > 0) {
- foreach ($array as $k => $v) {
- if (is_array($v)) {
- foreach ($v as $k2 => $v2) {
- if ($k2 == $on) {
- $sortable_array[$k] = $v2;
- }
- }
- } else {
- $sortable_array[$k] = $v;
- }
+ $new_array = array();
+ $sortable_array = array();
+
+ if (count($array) > 0) {
+ foreach ($array as $k => $v) {
+ if (is_array($v)) {
+ foreach ($v as $k2 => $v2) {
+ if ($k2 == $on) {
+ $sortable_array[$k] = $v2;
+ }
}
+ } else {
+ $sortable_array[$k] = $v;
+ }
+ }
- asort($sortable_array);
+ asort($sortable_array);
- foreach ($sortable_array as $k => $v) {
- $new_array[$k] = $array[$k];
- }
+ foreach ($sortable_array as $k => $v) {
+ $new_array[$k] = $array[$k];
}
+ }
- return $new_array;
+ return $new_array;
}
?>
diff --git a/html/pages/match_info_other.php b/html/pages/match_info_other.php
index 7f9cf18..b92ae74 100755
--- a/html/pages/match_info_other.php
+++ b/html/pages/match_info_other.php
@@ -5,7 +5,7 @@ include('includes/weaponstats.php');
weaponstats($mid, NULL);
echo '<br>
-<table class = "zebra box" border="0" cellpadding="0" cellspacing="0" width="700">
+<table class="zebra box" border="0" cellpadding="0" cellspacing="0" width="700">
<tbody>
<tr>
<th class="heading" colspan="11" align="center">Special Events</th>
@@ -70,7 +70,7 @@ if ((strpos($gamename, '(insta)') === false) && (strpos($gamename, "Last Man Sta
$contentTable = "";
$sql_pickups = "SELECT p.pid, pi.name, p.country, SUM(p.pu_pads) AS pu_pads, SUM(p.pu_armour) AS pu_armour, SUM(p.pu_keg) AS pu_keg,
- SUM(p.pu_invis) AS pu_invis, SUM(p.pu_belt) AS pu_belt, SUM(p.pu_amp) AS pu_amp, SUM(p.pu_boots) AS pu_boots
+ SUM(p.pu_invis) AS pu_invis, SUM(p.pu_belt) AS pu_belt, SUM(p.pu_amp) AS pu_amp
FROM uts_player as p, uts_pinfo AS pi
WHERE p.pid = pi.id AND pi.banned <> 'Y' AND matchid = $mid
GROUP BY pid, p.country
@@ -85,8 +85,9 @@ if ((strpos($gamename, '(insta)') === false) && (strpos($gamename, "Last Man Sta
$r_pname = $r_pickups[name];
$myurl = urlencode($r_pname);
- if(!$anyPickups && ($r_pickups[pu_pads] > 0 || $r_pickups[pu_armour] > 0 || $r_pickups[pu_keg] > 0 || $r_pickups[pu_invis] > 0 || $r_pickups[pu_belt] > 0 || $r_pickups[pu_amp] > 0 || $r_pickups[pu_boots] > 0))
+ if (!$anyPickups && ($r_pickups[pu_pads] > 0 || $r_pickups[pu_armour] > 0 || $r_pickups[pu_keg] > 0 || $r_pickups[pu_invis] > 0 || $r_pickups[pu_belt] > 0 || $r_pickups[pu_amp] > 0)) {
$anyPickups = true;
+ }
$contentTable .= '
<tr class="clickableRow" href="./?p=matchp&amp;mid='.$mid.'&amp;pid='.$r_pickups['pid'].'">
@@ -97,13 +98,12 @@ if ((strpos($gamename, '(insta)') === false) && (strpos($gamename, "Last Man Sta
<td align="center">'.$r_pickups[pu_invis].'</td>
<td align="center">'.$r_pickups[pu_belt].'</td>
<td align="center">'.$r_pickups[pu_amp].'</td>
- <td align="center">'.$r_pickups[pu_boots].'</td>
</tr>';
}
if ($anyPickups) {
echo '</tbody></table><br>
- <table class = "zebra box" border="0" cellpadding="0" cellspacing="0" width="700">
+ <table class="zebra box" border="0" cellpadding="0" cellspacing="0" width="700">
<tbody><tr>
<th class="heading" colspan="8" align="center">Pickups Summary</th>
</tr>
@@ -115,14 +115,13 @@ if ((strpos($gamename, '(insta)') === false) && (strpos($gamename, "Last Man Sta
<th class="smheading" align="center" width="71">Invisibility</th>
<th class="smheading" align="center" width="71">Shield<br>Belt</th>
<th class="smheading" align="center" width="71">Damage Amp</th>
- <th class="smheading" align="center" width="71">Antigrav Boots</th>
</tr>';
echo $contentTable;
}
}
-echo'</tbody></table>';
+echo '</tbody></table>';
/*
// To add when forum widget is available
diff --git a/html/pages/players_info.php b/html/pages/players_info.php
index e0e4546..a23f4fd 100755
--- a/html/pages/players_info.php
+++ b/html/pages/players_info.php
@@ -267,10 +267,10 @@ if ($sql_firstblood[fbcount] || $sql_multis[spree_double] || $sql_multis[spree_m
}
$r_pickups = zero_out(small_query("SELECT SUM(pu_pads) AS pu_pads, SUM(pu_armour) AS pu_armour, SUM(pu_keg) AS pu_keg,
- SUM(pu_invis) AS pu_invis, SUM(pu_belt) AS pu_belt, SUM(pu_amp) AS pu_amp, SUM(pu_boots) AS pu_boots
+ SUM(pu_invis) AS pu_invis, SUM(pu_belt) AS pu_belt, SUM(pu_amp) AS pu_amp
FROM uts_player WHERE pid = '$pid'"));
-if ($r_pickups[pu_pads] || $r_pickups[pu_armour] || $r_pickups[pu_keg] || $r_pickups[pu_invis] || $r_pickups[pu_belt] || $r_pickups[pu_amp] ) {
+if ($r_pickups[pu_pads] || $r_pickups[pu_armour] || $r_pickups[pu_keg] || $r_pickups[pu_invis] || $r_pickups[pu_belt]) {
echo '
<table class="zebra box" border="0" cellpadding="0" cellspacing="0" width="700">
<tbody>
@@ -284,7 +284,6 @@ if ($r_pickups[pu_pads] || $r_pickups[pu_armour] || $r_pickups[pu_keg] || $r_p
<th class="smheading" align="center" width="80">Invisibility</th>
<th class="smheading" align="center" width="80">Shield Belt</th>
<th class="smheading" align="center" width="80">Damage Amp</th>
- <th class="smheading" align="center" width="80">Antigrav Boots</th>
</tr>
<tr>
<td align="center">'.$r_pickups[pu_pads].'</td>
@@ -293,7 +292,6 @@ if ($r_pickups[pu_pads] || $r_pickups[pu_armour] || $r_pickups[pu_keg] || $r_p
<td align="center">'.$r_pickups[pu_invis].'</td>
<td align="center">'.$r_pickups[pu_belt].'</td>
<td align="center">'.$r_pickups[pu_amp].'</td>
- <td align="center">'.$r_pickups[pu_boots].'</td>
</tr>
</tbody></table>
<br>';