connect_errno) { $output = "Connect failed: " . $mysqli->connect_error; } else { $query = "SELECT * FROM civbe_virtues ORDER BY id ASC"; if ($virtues = $mysqli->query($query)) { $query = "SELECT * FROM civbe_synergies ORDER BY id ASC"; if ($synergies = $mysqli->query($query)) { $output = apDisplayVirtuePicker($virtues,$synergies); $synergies->free(); } /* free result set */ $virtues->free(); } } $mysqli->close(); //file_put_contents($file, $output); } else $output = file_get_contents($file); return $output; function apDisplayVirtuePicker($virtues, $synergies) { $width = 1006; $height = 653; $treeWidth = 230; $tierHeight = 182; $firstX = 119; $firstY = 114; $firstTopSynergyX = 115; $firstTopSynergyY = 69; $firstSideSynergyX = 44; $firstSideSynergyY = 94; $synergyX = 75; $synergyY = 9; $normalX = 60; $normalY = 62; $virtueWidth = 45; $virtueHeight = 43; $synergyWidth = 24; $synergyHeight = 24; $firstTierCounterY = 105; $firstTierCounterX = 70; $tierCounterHeight = 9; $tierCounterWidth = 16; $tierHeight = 182; $tierWidth = 16; $tierGap = 3; $firstCatCounterX = 89; $firstCatCounterY = 95; $catCounterWidth = 15; $catCounterHeight = 11; $catWidth = 225; $catHeight = 11; $catGap = 5; $output = ' '; //$virtuesEnabled = array(); $virtuesLeadTo = array(); $virtuesPrereq = array(); $virtuesLookup = array(); $virtueOutput = ''; while ($virtue = $virtues->fetch_assoc()) { //$virtuesEnabled['virtue' . $virtue['id']] = $virtue['enabled']; $virtuesLeadTo['virtue' . $virtue['id']] = $virtue['enables']; $virtuesPrereq['virtue' . $virtue['id']] = $virtue['prereqs']; $virtuesLookup[$virtue['virtue']] = 'virtue' . $virtue['id']; $category = strtolower($virtue['cat']); if($category === 'might') $tree = 0; else if($category === 'prosperity') $tree = 1; else if($category === 'knowledge') $tree = 2; else if($category === 'industry') $tree = 3; if($virtue['tier'] === '3') $tierClass = ' tier3'; else if($virtue['tier'] === '2') $tierClass = ' tier2'; else if($virtue['tier'] === '1') $tierClass = ' tier1'; else $tierClass = ''; $treeOffset = $firstX + ($tree * $treeWidth); $tierOffset = $firstY + (($virtue['tier'] - 1) * $tierHeight); $xPos = $treeOffset + (($virtue['col'] - 1) * $normalX); $yPos = $tierOffset + (($virtue['row'] - ((($virtue['tier'] - 1) * 3)) - 1) * $normalY); //echo $virtue['virtue'] . ' yPos(' . $yPos . '): toff(' . $tierOffset . ') + (row(' . $virtue['row'] . ') - (((tier(' . $tierOffset . ' - 1) * 3)) - 1) * normalY(' . $normalY . ')
'; if($virtue['num'] === '1') $isEnabled = ' class="glowBorderEnabled"'; else $isEnabled = ''; $virtueOutput .= ' '; } $synergyOutput = ''; while ($synergy = $synergies->fetch_assoc()) { $type = strtolower($synergy['type']); if($type === 'tier') $num = $synergy['tier']; else $num = ''; $yPos = $firstTopSynergyY; if($type === 'tier') { $xPos = $firstSideSynergyX; $yPos = $firstSideSynergyY + (($synergy['tier'] - 1) * ($tierHeight + 2)) + (($synergy['num'] - ($synergy['virtues'] / 2)) * $synergyY); } else if ($type === 'might') { $xPos = $firstTopSynergyX + (($synergy['tier'] - 1) * $synergyX); } else if ($type === 'prosperity') { $xPos = $firstTopSynergyX + (($synergy['tier'] - 1) * $synergyX) + $treeWidth; } else if ($type === 'knowledge') { $xPos = $firstTopSynergyX + (($synergy['tier'] - 1) * $synergyX) + (2 * $treeWidth); } else if ($type === 'industry') { $xPos = $firstTopSynergyX + (($synergy['tier'] - 1) * $synergyX) + (3 * $treeWidth); } if($synergy['tier'] == 3) $tierClass = ' tier3'; else $tierClass = ''; $synergyOutput .= ' '; } $output .= '
Total:
0
Next:
20
I hate vB with a passion ... but it's working now. Let me know if you spot anything weird ...
Comment