PHP User::updateUserStamina Examples

PHP User::updateUserStamina - 2 examples found. These are the top rated real world PHP examples of User::updateUserStamina extracted from open source projects. You can rate examples to help us improve the quality of examples.
Example #1
0
                $refill_health = $playerHealthMax;
            }
            if (User::updateUserHealth($_SESSION['userID'], $refill_health)) {
                echo "success";
            }
        } else {
            echo "failure";
        }
    }
    if (isset($_GET['request_timer']) && $_GET['request_timer'] == "stamina_timer") {
        if (isset($_GET['operation'])) {
            UserTimers::stopStaminaTimer($_SESSION['userID']);
            exit;
        }
        $request_timer = $_GET['request_timer'];
        $increment_value = $_GET['increment_value'];
        //if(UserTimers::incremenStaminaTimer($_SESSION['userID'], $increment_value * STAMINA_INCREASE_TIME)){
        if (UserTimers::updateStaminaTimer($_SESSION['userID'])) {
            $playerStamina++;
            $refill_stamina = $playerStamina;
            if ($playerStamina > $playerStaminaMax) {
                $refill_stamina = $playerStaminaMax;
            }
            if (User::updateUserStamina($_SESSION['userID'], $refill_stamina)) {
                echo "success";
            }
        } else {
            echo "failure";
        }
    }
}
Example #2
0
    }
    if ($playerStaminaMax > $playerStamina) {
        $stamina_mins = floor($stamina_timer / 60);
        $stamina_seconds = $stamina_timer % 60;
        $stamina_increment = floor($stamina_mins / $stamina_increase_timer);
        if ($stamina_increment > 0) {
            $new_stamina = $stamina_increment + $playerStamina;
            if ($new_stamina >= $playerStaminaMax) {
                if (UserTimers::stopStaminaTimer($_SESSION['userID'])) {
                    User::updateUserStamina($_SESSION['userID'], $playerStaminaMax);
                    $stamina_timer = 0;
                    $playerStamina = $playerStaminaMax;
                }
            } else {
                if (UserTimers::incremenStaminaTimer($_SESSION['userID'], $stamina_increment * $stamina_increase_timer)) {
                    User::updateUserStamina($_SESSION['userID'], $new_stamina);
                    $playerStamina = $new_stamina;
                    $stamina_timer -= $stamina_increment * $stamina_increase_timer * 60;
                }
            }
        }
    }
}
if (trim($playerName) == "" || $playerType == "") {
    if ($playerLevel >= 3 && strrpos($_SERVER['REQUEST_URI'], "choosemission.php") < 1 && strrpos($_SERVER['REQUEST_URI'], "chooseclasspage.php") < 1 && strpos($_SERVER['REQUEST_URI'], "chooseplayername.php") < 1) {
        if (!$playerName) {
            header("Location: {$serverRoot}chooseplayername.php");
            exit;
        } else {
            if (!$playerType) {
                header("Location: {$serverRoot}chooseclasspage.php");