コード例 #1
0
<?php

session_start();
include_once "../classes/User.php";
include_once "../classes/RealEstate.php";
include_once "../properties/serverproperties.php";
include_once '../properties/constants.php';
include_once '../classes/UserTimers.php';
include_once "../classes/Item.php";
include_once '../classes/common_functions.php';
$fn = new common_functions();
$actionToDo = $_REQUEST['actionToDo'];
$userCash = $_REQUEST['userCash'];
$reID = $_REQUEST['realEstateID'];
$realEstate = RealEstate::getRealEstate($reID);
$incomeChange = $realEstate->getIncome();
$purchasePrice = $_REQUEST['purchasePrice'];
$quantity = 1;
$userOwnedQuantity = 0;
$user = User::getUser($_SESSION['userID']);
if (isset($_GET['quantity'])) {
    $quantity = $_GET['quantity'];
    $userOwnedQuantity = $_GET['previousQuanity'];
    $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;
        }
コード例 #2
0
ファイル: updateTimer.php プロジェクト: ng2k12/MercInc
 if (count($allUpkeepItems) > 0) {
     while ($playerCash + $PlayerNetIncome < 0) {
         if ($allUpkeepItems[$count]['quantity'] > 0) {
             $amount = 0;
             echo $PlayerNetIncome . " < " . $playerCash . "<br>";
             $id = $allUpkeepItems[$count]['id'];
             echo $id . "<-id<br>";
             $upkeep = $allUpkeepItems[$count]['upkeep'];
             echo $upkeep . "<-upkeep<br>";
             if ($allUpkeepItems[$count]['type'] == 'item') {
                 $amount = $allUpkeepItems[$count]['price'];
                 $user->decrementUserItem($id, 1);
                 $user->updateUserCash($amount * SELL_RATIO);
             } else {
                 if ($allUpkeepItems[$count]['type'] == 'realEstate') {
                     $realEstate = RealEstate::getRealEstate($id);
                     $incomeChange = $realEstate->getIncome();
                     $amount = $allUpkeepItems[$count]['price'] + INCREASE_REAL_ESTATE_PERCENTAGE * $allUpkeepItems[$count]['price'] * $allUpkeepItems[$count]['quantity'];
                     $user->decrementUserRealEstate($id, 1);
                     $user->updateUserCashAndIncome($amount * SELL_RATIO, $incomeChange * -1);
                 }
             }
             echo $amount . "<-amount<br>";
             $user->decrementUserUpkeep($upkeep);
             $playerCash += $amount * SELL_RATIO;
             echo $playerCash . "<-player cash<br>";
             $PlayerUpkeep -= $upkeep;
             echo $PlayerUpkeep . "<-player upkeep<br>";
             $PlayerNetIncome = $PlayerIncome - $PlayerUpkeep;
             echo $PlayerNetIncome . "<-player net income<br>";
             $allUpkeepItems[$count]['quantity']--;
コード例 #3
0
ファイル: shoprealestatelist.php プロジェクト: ng2k12/MercInc
 for $<?php 
                echo $realEstatePrice * 0.6;
                ?>
.</p>		
 	</div>
 </div>
<?php 
            }
        }
    }
} else {
    if (isset($_GET['status']) && $_GET['status'] == "refill") {
        global $userRealEstateIDsToQuantity;
        global $user;
        $estateId = $_GET['itemID'];
        $estate_data = RealEstate::getRealEstate($estateId);
        $estate_name = $estate_data->getName();
        $originalPrice = $estate_data->getPrice();
        $quantity = 0;
        if ($userRealEstateIDsToQuantity && array_key_exists($estateId, $userRealEstateIDsToQuantity)) {
            $quantity = $userRealEstateIDsToQuantity[$estateId];
        }
        $estatePrice = $originalPrice + INCREASE_REAL_ESTATE_PERCENTAGE * $originalPrice * $quantity;
        $previousQuanity = $_GET['previousQuanity'];
        $buy_quantity = $_GET['quantity'];
        $realEstatePrice = $_GET['purchasePrice'];
        $requestURL = $serverRoot . 'backend/shoprealestateaction.php?actionToDo=buy&previousQuanity=' . $previousQuanity . '&quantity=' . $buy_quantity . '&userCash=' . $user->getCash() . '&purchasePrice=' . $realEstatePrice . '&realEstateID=' . $estateId . '&originalPrice=' . $originalPrice;
        echo '
		<div class="successmessage">
    		<p class="successfailuremessage"><span class="success line_height_3" >Congratuations! </span> You have successfully bought <span class="cost">$' . $_GET['cash'] . '</span> for <strong>' . $_GET['diamonds'] . '</strong> Diamonds<a href="' . $requestURL . '" class="notification_domission">Buy Estate</a></p>
    	</div>';