//Calculate the cost //get the left overs $leftOver = $GoldAmount % 1000; //any left over costs +1 gold coin if ($leftOver > 0) { $GoldAmount -= $leftOver; $GoldAmount += 1000; } //calculate the price $price = $GoldAmount / 1000; ###################################### ######### CHECK FINANCES ############# $finance->SetCurrency(CURRENCY_GOLD); $finance->SetAmount($price); //check if the user has enough balance if ($BalanceError = $finance->CheckBalance()) { if (is_array($BalanceError)) { //insufficient amount foreach ($BalanceError as $currency) { $ERRORS->Add("You do not have enough " . ucfirst($currency) . " Coins."); } } else { //technical error $ERRORS->Add('Error, the website failed to verify your account balance.'); } } unset($BalanceError); $ERRORS->Check('/index.php?page=purchase_gold'); #################################################################### ## The actual script begins here //construct the characters handler