public static function nest() { $us = User::getUserById($_SESSION['id']); $nests = Nest::getUserNests($_SESSION['id']); $us['nests'] = $nests; View::$data['user'] = $us; if (empty($_SESSION['nestid'])) { $_SESSION['nestid'] = $nests[0]; } $nest = Nest::getNestsLevelID($_SESSION['nestid']); $barrackNextLevel = Barracks::getNextLevel($nest[1])->fetch_assoc(); $upgradeWater = $barrackNextLevel['water']; $upgradeFood = $barrackNextLevel['food']; $upgradeLevelTo = $barrackNextLevel['level']; View::$data["upgrade"]["water"] = $upgradeWater; View::$data["upgrade"]["food"] = $upgradeFood; View::$data["upgrade"]["levelto"] = $upgradeLevelTo; if (isset($_POST['Upgrade'])) { Barracks::upgradeBarracks($nest[0], $upgradeLevelTo, 2); header("Location: /MVCProject/buildings/nest"); exit; } $model = null; return new View($model); }
public static function profile($x, $y) { $us = User::getUserById($_SESSION['id']); View::$data['user'] = $us; if (isset($_POST['agrresion_type'])) { $agrresionType = $_POST['agrresion_type']; if ($agrresionType == 'Scout' && isset($_POST['numberOfScouts'])) { $scouts = $_POST['numberOfScouts']; } elseif ($agrresionType == 'Attack' && isset($_POST['numberOfAnt'], $_POST['numberOfBullAnt'])) { $ant = $_POST['numberOfAnt']; $bull = $_POST['numberOfBullAnt']; $ants = []; $ants[0] = $bull; $ants[1] = $ant; Action::sendArmy($x, $y, $ants); header("Location: /MVCProject/map/map"); exit; } } //Action::checkForBattleStart(); // Action::checkForTroopReturn(); $ants = Ants::getAntsByUserId($_SESSION['id']); $model = new MapProfileViewModel($x, $y, $ants); return new View($model); }
public function home() { echo "<h1>Home</h1>"; $us = User::getUserById($_SESSION['id']); $us['nests'] = Nest::getUserNests($_SESSION['id']); View::$data['user'] = $us; $battles = BattleReport::getBattles(); $model = new HomeViewModel($battles); return new View($model); }