$totalQuantity = $quantity + $userOwnedQuantity; if ($quantity > 1) { $originalPrice = $_GET['originalPrice']; $totalPurchasePrice = 0; for ($i = $userOwnedQuantity + 1; $i <= $totalQuantity; $i++) { $price = $originalPrice + INCREASE_REAL_ESTATE_PERCENTAGE * $originalPrice * $i; $totalPurchasePrice += $price; } $purchasePrice = $totalPurchasePrice; } } if ($actionToDo == 'buy' && $userCash >= $purchasePrice) { $timers = UserTimers::getTimers($_SESSION['userID']); if ($timers) { $income_timer = $timers->getIncomeTimer(); if (!$fn->isTimeSet($income_timer)) { UserTimers::updateIncomeTimer($user->getID()); } } $incomeChange *= $quantity; $user->incrementUserRealEstate($reID, $quantity); $user->updateUserCashAndIncome($purchasePrice * -1, $incomeChange); header("Location: {$serverRoot}shoprealestatelist.php?action=buy&error=false&previousQuanity=" . $userOwnedQuantity . "&quantity=" . $quantity . "&itemID=" . $reID . "&purchasePrice=" . $purchasePrice); exit; } else { if ($actionToDo == 'sell') { $sellBasePrice = $_REQUEST['sellBasePrice']; $user->decrementUserRealEstate($reID, 1); $user->updateUserCashAndIncome($sellBasePrice * SELL_RATIO, $incomeChange * -1); if (!Item::getHasItem($_SESSION['userID']) && !RealEstate::getHasRealEstate($_SESSION['userID'])) { $timers = UserTimers::getTimers($_SESSION['userID']);
if ($playerNextExperiencePoints != 0) { $expBarValue = ceil(($playerExp - $previousExperiencePoints) / ($playerNextExperiencePoints - $previousExperiencePoints) * 100); } $timers = UserTimers::getTimers($_SESSION['userID']); if ($timers) { $income_timer = 0; $health_timer = 0; $energy_timer = 0; $stamina_timer = 0; $income_timer_diff = $timers->getIncomeTimer(); $health_timer_diff = $timers->getHealthTimer(); $energy_timer_diff = $timers->getEnergyTimer(); $stamina_timer_diff = $timers->getStaminaTimer(); $timers_in_seconds = UserTimers::getTimersInSeconds($_SESSION['userID']); if ($PlayerNetIncome != 0) { if ($fn->isTimeSet($income_timer_diff)) { $income_timer = $timers_in_seconds->getIncomeTimer(); if ($income_timer < 0) { UserTimers::updateIncomeTimer($_SESSION['userID']); $income_timer = 0; } } else { UserTimers::updateIncomeTimer($_SESSION['userID']); } } else { if ($fn->isTimeSet($income_timer_diff)) { UserTimers::stopIncomeTimer($_SESSION['userID']); } } if ($playerHealth < $playerHealthMax) { if ($fn->isTimeSet($health_timer_diff)) {