Esempio n. 1
0
    $sql = "UPDATE `users` SET `gold` = (`gold` - '" . $_GET['transfur'] . "' ) WHERE `username` = '" . $_SESSION['username'] . "' ";
    $result = db_query($sql);
    echo mysql_error();
    redirect("Money transfured", "viewuser.php?user="******"index";
require_once "includes/widgets/header.php";
$sql = 'SELECT * FROM `users` WHERE `id` = "' . $_REQUEST['user'] . '" LIMIT 1';
$result = $db->query($sql);
if ($result->numRows() == 0) {
    $tpl->error("User not found.");
}
while ($row = $result->fetchRow()) {
    startBox($row['username'], BOX_GREEN);
    echo "<strong>Gold:</strong> " . $row['gold'] . "<br />";
    $temp = get_turns($row['username']);
    $total_turns = intval($temp['total_turns']);
    echo "<strong>Total Turns</strong>: {$total_turns} <br/>";
    echo "<strong>Slaves owned</strong>";
    $result2 = $db->query("SELECT * FROM slaves WHERE user = '******'username'] . "'");
    echo "<ul>";
    if ($result2->numRows() == 0) {
        echo "<li>No slaves owned.</li>";
    } else {
        while ($row2 = mysql_fetch_array($result2)) {
            popup("<li>" . $row2['name'] . "</li>", "view_slave.php?slave= " . $row2['name']);
        }
    }
    echo "</ul>";
    $ranking = intval($total_turns * $row['gold'] / 10000);
    popup("<strong>Player Ranking</strong>: ", "help.php?topic=rankings");
Esempio n. 2
0
        } else {
            echo "You have </strong>" . count_rows($result) . "</strong> businsesses, nice going.";
            echo "<br /><br /><strong>Overall</strong>: Good";
        }
        break;
    case 'financial':
        if (\libAllure\Session::getUser()->getData('gold') <= 0) {
            echo "We are in debt! Try raising some more cash.";
            echo "<br /><br /><strong>Overall</strong>: Bad";
        } else {
            echo "We are not in debt, but make more money!";
            echo "<br /><br /><strong>Overall</strong>: Good";
        }
        break;
    case 'rankings':
        $turns = get_turns($_SESSION['username']);
        $rank = intval($turns['total_turns'] * $user->getData('gold') / 10000);
        if ($rank <= 20) {
            echo "You're rank is only <strong>" . $rank . "</strong>, you aught to try and improve this... Try making more money.";
            echo "<br /><br /><strong>Overall</strong>: Bad";
        } else {
            echo "You've got a rank of <strong>" . $rank . "</strong>, keep going!";
            echo "<br /><br /><strong>Overall</strong>: Good";
        }
        break;
    default:
        echo "Your {$advisor} advisor is currently not avalible.";
        break;
}
?>
Esempio n. 3
0
    $work_multiplier = 30;
    $worked = $new_gold = $not_enough_energy = $use_second_description = null;
    $is_logged_in = is_logged_in();
    $worked = intval(in('worked'));
    $recommended_to_work = 10;
    // Store or retrieve the last value of turns worked.
    if ($worked && is_numeric($worked)) {
        set_setting('turns_worked', $worked);
        $recommended_to_work = $worked;
    } else {
        $last_worked = get_setting('turns_worked');
        $recommended_to_work = $last_worked ? $last_worked : 10;
    }
    // Work only if the work was requested, not just if the setting was set.
    if ($worked > 0) {
        $turns = get_turns($char_id);
        if ($worked > $turns) {
            $not_enough_energy = true;
        } else {
            $new_gold = $worked * $work_multiplier;
            // *** calc amount worked ***
            add_gold($char_id, $new_gold);
            $turns = subtractTurns($char_id, $worked);
            $use_second_description = true;
        }
    }
    $gold = get_gold($char_id);
    // Get the current/final gold.
    $gold_display = number_format($gold);
    display_page('work.tpl', 'Working in the Village', get_certain_vars(get_defined_vars(), array()), array('quickstat' => 'player'));
}
Esempio n. 4
0
 public function turns()
 {
     return get_turns($this->id());
     //return $this->vo->turns;
 }
Esempio n. 5
0
function change_turns($char_id, $amount)
{
    $amount = (int) $amount;
    if ($amount) {
        // Ignore zero
        // These PDO parameters must be split into amount1 and amount2 because otherwise PDO gets confused.  See github issue 147.
        query("UPDATE players set turns = (CASE WHEN turns + :amount < 0 THEN 0 ELSE turns + :amount2 END) where player_id = :char_id", array(':amount' => array($amount, PDO::PARAM_INT), ':amount2' => array($amount, PDO::PARAM_INT), ':char_id' => $char_id));
    }
    return get_turns($char_id);
}