$student_id = $_POST['id']; } } $game_type = "memory"; if (isset($_POST['game_type'])) { $game_type = $_POST['game_type']; } $difficulty = "easy"; if (isset($_POST['difficulty'])) { $difficulty = $_POST['difficulty']; } $the5results = get_last5_results($student_id, $game_type, $difficulty); $most_played = get_most_played($student_id); $memorygrowthrate = getGrowthRate($student_id, "memory", "easy"); $spellinggrowthrate = getGrowthRate($student_id, "spelling", "easy"); $mathsgrowthrate = getGrowthRate($student_id, "maths", "easy"); $lowestgame = getLowestGame($student_id); ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>Home Page</title> <!-- Tell the browser to be responsive to screen width --> <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"> <!-- Bootstrap 3.3.5 --> <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css"> <link rel="stylesheet" href="bootstrap/css/custom.css"> <!-- Font Awesome --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
function getMaxPopulation(&$objUser) { $population = array(); $iAllianceId = $objUser->get_stat(KINGDOM); $strRace = $objUser->get_stat(RACE); $arrBuilds = $objUser->get_builds(); // Base Housing Capacities include_once 'inc/functions/build.php'; $arrBuildVars = getBuildingVariables($strRace); $homes_hold = $arrBuildVars['housing'][1]; $extra_hold = $arrBuildVars['housing'][2]; $hideouts_hold = $arrBuildVars['housing'][12]; // Maximum number of homes that will house population if ($strRace != "Mori Hai") { $max_homes = floor($arrBuilds[LAND] * 0.3); } else { $max_homes = floor($arrBuilds[LAND] * 0.45); } if ($arrBuilds[HOMES] >= $max_homes) { $arrBuilds[HOMES] = $max_homes; } // Various other buildings house population too $other_buildings = $arrBuilds[FARMS] + $arrBuilds[WALLS] + $arrBuilds[WEAPONRIES] + $arrBuilds[GUILDS] + $arrBuilds[MINES] + $arrBuilds[MARKETS] + $arrBuilds[LABS] + $arrBuilds[CHURCHES] + $arrBuilds[GUARDHOUSES] + $arrBuilds[BANKS] + $arrBuilds[ACADEMIES] + $arrBuilds[YARDS]; // Hideouts (is the same as other for most races) $hideouts = $arrBuilds[HIDEOUTS]; // Raw Housing Capacity of Buildings $homes = $arrBuilds[HOMES] * $homes_hold; $hideouts *= $hideouts_hold; $other_buildings *= $extra_hold; $other_buildings += $hideouts; $total_room = $homes + $other_buildings; // Population Spell Bonus (Elendian) $spellBonuses = getSpellBonuses($objUser); $spell_bonus = round($total_room * $spellBonuses['population'], 0); // Research Bonus - New code January 09, 2008, Martel $arrResearch = getResearchBonuses($objUser->get_alliance()); $research_bonus = round($total_room * $arrResearch['population']); // Population Fame bonus $arrFameBonuses = getFameBonuses($objUser); $fame_bonus = round($total_room * $arrFameBonuses['population']); // Total Population $total = floor($homes + $fame_bonus + $spell_bonus + $research_bonus + $other_buildings); // Max Citizens $arrPopulation = getPopulation($objUser); $max_citizens = floor($total - $arrPopulation['total_army']); // Total Citizens (How many citzizens there can be after update) $total_citizens = $arrPopulation['citizens']; // Get Growthrate $growthrate = getGrowthRate($objUser); $total_citizens = floor($total_citizens * $growthrate); if ($total_citizens > $max_citizens) { $total_citizens = $max_citizens; } if ($total_citizens < 200) { $total_citizens = 200; } $population['homes'] = $homes; // raw capacity of homes $population['extra_homes'] = $other_buildings; // raw of other buildings $population['total_raw'] = $total_room; $population['fame_bonus'] = $fame_bonus; $population['spell_bonus'] = $spell_bonus; $population['research_bonus'] = $research_bonus; $population['max_citizens'] = $max_citizens; $population['growth_rate'] = $growthrate; $population['total_citizens'] = $total_citizens; $population['total'] = $total; // total max population return $population; }