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 ($timers) {
                $income_timer = $timers->getIncomeTimer();
                if ($fn->isTimeSet($income_timer)) {
                    UserTimers::stopIncomeTimer($user->getID());
                }
            }
        }
        header("Location: {$serverRoot}shoprealestatelist.php?action=sell&error=false&itemID=" . $reID . "&purchasePrice=" . $purchasePrice);
        exit;
    } else {
        //	echo "{$serverRoot}shoprealestatelist.php?action=buy&error=true&previousQuanity=".$userOwnedQuantity."&quantity=".$quantity."&itemID=".$reID."&purchasePrice=".$_REQUEST['purchasePrice'];
        // header("Location: {$serverRoot}shoprealestatelist.php?action=buy&error=true&itemID=".$reID."&purchasePrice=".$purchasePrice);
        header("Location: {$serverRoot}shoprealestatelist.php?action=buy&error=true&previousQuanity=" . $userOwnedQuantity . "&quantity=" . $quantity . "&itemID=" . $reID . "&purchasePrice=" . $_REQUEST['purchasePrice']);
        exit;
    }
}
Exemple #2
0
 $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)) {
         $health_timer = $timers_in_seconds->getHealthTimer();
         if ($health_timer < 0) {
             UserTimers::updateHealthTimer($_SESSION['userID']);
             $health_timer = 0;
         }
     } else {
         UserTimers::updateHealthTimer($_SESSION['userID']);
     }
 } else {
     if ($fn->isTimeSet(trim($health_timer_diff))) {
         UserTimers::stopHealthTimer($_SESSION['userID']);