Beispiel #1
0
    /**
     * Diverse
     */
    protected static function page_diverse()
    {
        // hent totalt resultat i poker for siste 30 dager
        $date = ess::$b->date->get();
        $date->modify("-30 days");
        $date->setTime(0, 0, 0);
        $result = \Kofradia\DB::get()->query("\n\t\t\tSELECT SUM(CONVERT(poker_prize - poker_cash, SIGNED) * IF((poker_winner = 1 AND poker_starter_up_id = up_id) OR (poker_winner = 2 AND poker_challenger_up_id = up_id), 1, -1)) sum_result\n\t\t\tFROM poker, users_players\n\t\t\tWHERE poker_time_start >= " . $date->format("U") . " AND up_u_id = " . page_min_side::$active_user->id . " AND (up_id = poker_starter_up_id OR up_id = poker_challenger_up_id) AND poker_state = 4");
        $poker_result = $result->fetchColumn(0);
        OFC::embed("stats_poker", "graphs/poker?up_id=" . page_min_side::$active_player->id, "100%", 250);
        OFC::embed("stats_poker_num", "graphs/pokernum?up_id=" . page_min_side::$active_player->id, "100%", 250);
        echo '
	<div class="bg1_c">
		<h1 class="bg1">Pokerbevegelse siste 30 dager<span class="left2"></span><span class="right2"></span></h1>
		<div class="bg1">
			<p class="c">Totalt resultat siste 30 dager: ' . game::format_cash($poker_result) . '</p>
			<p><span id="stats_poker"></span></p>
			<p><span id="stats_poker_num"></span></p>
		</div>
	</div>';
    }
Beispiel #2
0
<?php

require "base.php";
if (isset($_GET['data_file'])) {
    OFC::embed("stats", $_GET['data_file'], "100%", 400);
}
echo '
<h1>Stats</h1>
<form action="" method="get">
	<p>
		<select name="data_file" onchange="this.form.submit()">
			<option>Velg..</option>
			<option value="graphs/users">Antall nye og døde brukere siste periode</option>
			<option value="graphs/record_online">Rekord for antall pålogget</option>
			<option value="graphs/hits">Sidevisninger siste periode</option>
			<option value="graphs/rank">Rankaktivitet siste periode</option>
			<option value="graphs/rank_avg">Gjennomsnittlig rankaktivitet per bruker siste periode</option>
		</select>
	</p>
</form>
<p><span id="stats"></span></p>';
$_base->page->load();
Beispiel #3
0
    /**
     * Standard side - viser status for spilleren
     */
    protected static function page_default()
    {
        // kan ikke se?
        if (!page_min_side::$pstats) {
            echo '
	<p class="c">Du har ikke tilgang til å se denne siden.</p>';
            return;
        }
        global $_game;
        // rank
        $rank_need = 0;
        if (page_min_side::$active_player->rank['need_points'] == 0) {
            $rank_prosent = 100;
        } else {
            $rank_prosent = (page_min_side::$active_player->data['up_points'] - page_min_side::$active_player->rank['points']) / page_min_side::$active_player->rank['need_points'] * 100;
            $rank_need = page_min_side::$active_player->rank['need_points'] - page_min_side::$active_player->data['up_points'] + page_min_side::$active_player->rank['points'];
        }
        $rank_prosent_top = page_min_side::$active_player->data['up_points'] / game::$ranks['items_number'][count(game::$ranks['items_number'])]['points'] * 100;
        // hvor mange rankprosent må vi til for å ta igjen neste person?
        $result = \Kofradia\DB::get()->query("SELECT up_points FROM users_players WHERE up_access_level != 0 AND up_access_level < {$_game['access_noplay']} AND up_points > " . page_min_side::$active_player->data['up_points'] . " ORDER BY up_points LIMIT 1");
        $rank_user_next = false;
        $rank_user_prevnext = false;
        if ($next = $result->fetch()) {
            $points = $next['up_points'];
            $to = game::rank_info($points);
            if ($to['need_points'] == 0) {
                // totalt for spillet
                $percent = game::format_rank($points, "all");
                $rank_user_next = '<p>Du må oppnå ' . game::format_num($points) . ' poeng (' . $percent . ' rank for spillet totalt) for å ta igjen neste rangert spiller.</p>';
                // antall prosent vi trenger
                $rank_user_next .= '<p>Du trenger ' . game::format_num($points - page_min_side::$active_player->data['up_points']) . ' poeng (' . game::format_rank($points - page_min_side::$active_player->data['up_points'], $to) . ' rank).</p>';
            } else {
                $percent = game::format_number(($points - $to['points']) / $to['need_points'] * 100, 3);
                // samme rank?
                $same = page_min_side::$active_player->rank['id'] == $to['id'];
                $rank_user_next = '<p>Du må oppnå ' . game::format_num($points) . ' poeng (' . $percent . ' % ' . ($same ? 'på nåværende rank' : 'på ranken ' . $to['name']) . ') for å nå neste rangert spiller.</p>';
                if ($same) {
                    $rank_user_next .= '<p>Du trenger ' . game::format_num($points - page_min_side::$active_player->data['up_points']) . ' poeng (' . game::format_rank($points - page_min_side::$active_player->data['up_points'], $to) . ' rank).</p>';
                }
            }
            // finn ut hvor langt det er til forrige rankerte spiller
            $result = \Kofradia\DB::get()->query("SELECT up_points FROM users_players WHERE up_access_level != 0 AND up_access_level < {$_game['access_noplay']} AND up_id != " . page_min_side::$active_player->id . " AND up_points <= " . page_min_side::$active_player->data['up_points'] . " ORDER BY up_points DESC LIMIT 1");
            if ($row = $result->fetch()) {
                $rank_user_prevnext = round((page_min_side::$active_player->data['up_points'] - $row['up_points']) / ($next['up_points'] - $row['up_points']) * 100, 4);
            }
        }
        // finn ut tidspunkt for de forskjellige funksonene
        $status = array("krim" => page_min_side::$active_player->status_kriminalitet(), "utpressing" => page_min_side::$active_player->status_utpressing(), "gta" => page_min_side::$active_player->status_gta(), "lotto" => page_min_side::$active_player->status_lotto());
        // finn ut når vi kan gjøre forskjellige ting
        $wait = array("kriminalitet" => $status['krim']['wait_time'], "utpressing" => $status['utpressing']['wait_time'], "biltyveri" => $status['gta']['wait_time'], "lotto" => $status['lotto']['wait_time'], "forum_topic" => 0, "forum_reply" => 0, "fengsel" => 0);
        // forumene
        $wait['forum_reply'] = max(0, page_min_side::$active_user->data['u_forum_reply_time'] + game::$settings['delay_forum_reply']['value'] - time());
        $wait['forum_topic'] = max(0, page_min_side::$active_user->data['u_forum_topic_time'] + game::$settings['delay_forum_new']['value'] - time());
        if (page_min_side::$active_player->data['up_weapon_id']) {
            $wait['training'] = max(0, page_min_side::$active_player->data['up_weapon_training_next'] - time());
        }
        // for lav rank til å opprette forumtråder?
        if (page_min_side::$active_player->rank['number'] < 4) {
            $wait['forum_topic'] = -1;
        }
        // fengsel og bomberom
        $wait['fengsel'] = max(0, page_min_side::$active_player->data['up_fengsel_time'] - time());
        $wait['bomberom'] = max(0, page_min_side::$active_player->data['up_brom_expire'] - time());
        $wait['lock'] = max($wait['fengsel'], $wait['bomberom']);
        // sammendrag
        $status = array(array("Kriminalitet", max($wait['kriminalitet'], $wait['lock']), "kriminalitet"), array("Utpressing", max($wait['utpressing'], $wait['lock']), "utpressing"), array("Biltyveri", max($wait['biltyveri'], $wait['lock']), "gta/biltyveri"), array("Lotto", max($wait['lotto'], $wait['lock']), "lotto"), array("Forumemne", $wait['forum_topic'], "forum/"), array("Forumsvar", $wait['forum_reply'], "forum/"), array("Fengsel", $wait['lock'], "fengsel"));
        if (page_min_side::$active_player->data['up_weapon_id']) {
            $status[] = array("Våpentrening", max($wait['training'], $wait['lock']), "angrip");
        }
        // javascript funksjoner for status
        ess::$b->page->add_js_domready('
	var min_side_data = ' . js_encode($status) . ';
	var elm, c;
	for (var i = 0; i < min_side_data.length; i++)
	{
		elm = $("min_side_"+i);
		if (!elm) continue;
		
		c = new Countdown($("min_side_"+i));
		c.timesize = "partial",
		c.complete = function()
		{
			this.element.set("text", "Klar!");
			this.element.removeClass("status_venter").addClass("status_ny");
		};
	}');
        // css
        ess::$b->page->add_css('
.ms_space { margin-top: 2px }
.ms_space_bt { margin-bottom: 1em }
.status dd { text-align: right }
.status dd a { text-decoration: none; color: #CCFF00 }
a.status_ny { font-weight: bold }
a.status_klar:hover, a.status_ny:hover { color: #AAFF00; text-decoration: underline }
.status_venter { color: #888888 !important }
a.status_venter:hover { }
.split { height: 1px; background-color: #222222; overflow: hidden }');
        $health = page_min_side::$active_player->data['up_health'] / page_min_side::$active_player->data['up_health_max'] * 100;
        $energy = page_min_side::$active_player->data['up_energy'] / page_min_side::$active_player->data['up_energy_max'] * 100;
        $health = page_min_side::$active_player->get_health_percent();
        $energy = page_min_side::$active_player->get_energy_percent();
        $protection = page_min_side::$active_player->get_protection_percent();
        $training = page_min_side::$active_player->weapon ? page_min_side::$active_player->data['up_weapon_training'] * 100 : false;
        echo '
	<div class="col2_w">
		<div class="col_w left">
			<div class="col">' . (page_min_side::$active_player->active ? '
				<div class="bg1_c">
					<h1 class="bg1">Status<span class="left2"></span><span class="right2"></span></h1>
					<div class="ms_space ms_up_st progressbar' . ($health < 20 ? ' levelcrit' : ($health < 50 ? ' levelwarn' : '')) . '">
						<div class="progress" style="width: ' . round(min(100, $health)) . '%">
							<p>Helse: ' . ($health == 100 ? '100' : game::format_num($health, 2)) . ' %</p>
						</div>
					</div>
					<div class="ms_space ms_up_st progressbar' . ($energy < 20 ? ' levelcrit' : ($energy < 50 ? ' levelwarn' : '')) . '">
						<div class="progress" style="width: ' . round(min(100, $energy)) . '%">
							<p>Energi: ' . ($energy == 100 ? '100' : game::format_num($energy, 2)) . ' %</p>
						</div>
					</div>
					<div class="ms_space ms_up_st progressbar' . ($protection !== false ? $protection < 20 ? ' levelcrit' : ($protection < 50 ? ' levelwarn' : '') : '') . '">
						<div class="progress" style="width: ' . round(min(100, $protection)) . '%">
							<p>Beskyttelse: ' . ($protection === false ? 'Ingen' : ($protection == 100 ? '100' : game::format_num($protection, 2)) . ' %') . '</p>
						</div>
					</div>
					<div class="ms_space ms_up_st progressbar' . ($training !== false ? $training < 28 ? ' levelcrit' : ($training < 35 ? ' levelwarn' : '') : '') . '">
						<div class="progress" style="width: ' . round(min(100, $training)) . '%">
							<p><a href="' . ess::$s['relative_path'] . '/angrip">Våpentrening</a>: ' . ($training === false ? 'Ingen våpen' : ($training == 100 ? '100' : game::format_num($training, 2)) . ' %') . '</p>
						</div>
					</div>
					<div class="progressbar ms_space">
						<div class="progress" style="width: ' . round(min(100, page_min_side::$active_player->data['up_wanted_level'] / 10)) . '%">
							<p>Wanted nivå: ' . game::format_number(page_min_side::$active_player->data['up_wanted_level'] / 10, 1) . ' %</p>
						</div>
					</div>
				</div>' : '') . ($rank_prosent < 100 ? '
				<div class="bg1_c">
					<h1 class="bg1">Prosent til neste rank<span class="left2"></span><span class="right2"></span></h1>
					<div class="progressbar">
						<div class="progress" style="width: ' . round($rank_prosent) . '%">
							<p>' . game::format_number($rank_prosent, 3) . ' %' . ($rank_need > 0 ? ' (trenger ' . game::format_num($rank_need) . ' poeng)' : '') . '</p>
						</div>
					</div>
				</div>' : '') . '
				<div class="bg1_c">
					<h1 class="bg1">Prosent til høyeste rank<span class="left2"></span><span class="right2"></span></h1>
					<div class="progressbar">' . (page_min_side::$active_player->rank['number'] < 5 && !access::has("mod") ? '
						<p>Krever ranken <b>' . game::$ranks['items_number'][5]['name'] . '</b> eller høyere!</p>' : '
						<div class="progress" style="width: ' . min(round($rank_prosent_top), 100) . '%">
							<p>' . game::format_number($rank_prosent_top, 4) . ' % (' . game::format_num(page_min_side::$active_player->data['up_points']) . ' poeng)</p>
						</div>') . '
					</div>
				</div>
				<div class="bg1_c">
					<h1 class="bg1">Rangstige<span class="left2"></span><span class="right2"></span></h1>';
        $ranks = array_reverse(game::$ranks['items_number']);
        $active = page_min_side::$active_player->rank['number'];
        $split = false;
        foreach ($ranks as $rank) {
            if ($split) {
                echo '
						<div class="split"></div>';
            }
            if ($rank['number'] <= $active) {
                echo '
						<div class="progressbar_v"' . ($rank['number'] == $active ? ' style="font-weight: bold"' : '') . '>
							<p>' . $rank['number'] . ' - ' . $rank['name'] . '</p>
						</div>';
            } elseif ($rank['number'] == $active + 1) {
                echo '
						<div class="progressbar_v">
							<div class="progress" style="height: ' . round(100 - $rank_prosent) . '%">
								<p>' . $rank['number'] . ' - ' . $rank['name'] . '</p>
							</div>
						</div>';
            } else {
                echo '
						<div class="progressbar_v">
							<div class="progress">
								<p>' . $rank['number'] . ' - ' . $rank['name'] . '</p>
							</div>
						</div>';
            }
            $split = true;
        }
        echo '
				</div>
			</div>
		</div>
		<div class="col_w right">
			<div class="col">';
        if (page_min_side::$active_player->active) {
            echo '
				<div class="bg1_c">
					<h1 class="bg1">Status<span class="left2"></span><span class="right2"></span></h1>
					<div class="bg1">
						<dl class="dl_40 status">';
            foreach ($status as $key => $row) {
                echo '
							<dt>' . htmlspecialchars($row[0]) . '</dt>
							<dd>' . ($row[1] == -1 ? '<span class="status_venter">For lav rank</span>' : ($row[1] == 0 ? '<a href="' . htmlspecialchars($row[2]) . '" class="status_klar">Klar!</a>' : '<a href="' . htmlspecialchars($row[2]) . '" rel="' . $row[1] . '" id="min_side_' . $key . '" class="status_venter">' . game::timespan($row[1], 0, 5) . '</a>')) . '
							</dd>';
            }
            echo '
					</div>
				</div>';
        } elseif (page_min_side::$active_player->data['up_deactivated_dead'] != 0) {
            $instant = page_min_side::$active_player->data['up_deactivated_dead'] == 1;
            echo '
				<div class="bg1_c">
					<h1 class="bg1">Drept<span class="left2"></span><span class="right2"></span></h1>' . (access::has("mod") ? '
					<p class="h_right"><a href="' . htmlspecialchars(page_min_side::addr("activate")) . '">aktiver</a></p>' : '') . '
					<div class="bg1">
						<p>Denne spilleren ' . ($instant ? 'ble drept' : 'døde av skader') . (access::has("mod") ? $instant ? ' av <user id="' . page_min_side::$active_player->data['up_deactivated_up_id'] . '" />' : ' påført av <user id="' . page_min_side::$active_player->data['up_deactivated_up_id'] . '" />' : '') . ' ' . ess::$b->date->get(page_min_side::$active_player->data['up_deactivated_time'])->format(date::FORMAT_SEC) . '.</p>
					</div>
				</div>';
        } else {
            // deaktivert av seg selv?
            $deact_self = false;
            if (!empty(page_min_side::$active_player->data['up_deactivated_up_id'])) {
                $deact_self = page_min_side::$active_player->data['up_deactivated_up_id'] == page_min_side::$active_player->id;
                if (!$deact_self) {
                    $result = \Kofradia\DB::get()->query("SELECT u_id FROM users JOIN users_players ON u_id = up_u_id WHERE up_id = " . page_min_side::$active_player->data['up_deactivated_up_id']);
                    $row = $result->fetch();
                    unset($result);
                    if ($row && $row['u_id'] == page_min_side::$active_user->id) {
                        $deact_self = true;
                    }
                }
            }
            echo '
				<div class="bg1_c">
					<h1 class="bg1">Deaktivert<span class="left2"></span><span class="right2"></span></h1>' . (access::has("mod") ? '
					<p class="h_right"><a href="' . htmlspecialchars(page_min_side::addr("cdeact")) . '">rediger</a> <a href="' . htmlspecialchars(page_min_side::addr("activate")) . '">aktiver</a></p>' : '') . '
					<div class="bg1">' . ($deact_self ? '
						<p>Denne spilleren deaktiverte seg selv ' . ess::$b->date->get(page_min_side::$active_player->data['up_deactivated_time'])->format(date::FORMAT_SEC) . '.</p>' : '
						<p>Denne spilleren ble deaktivert ' . ess::$b->date->get(page_min_side::$active_player->data['up_deactivated_time'])->format(date::FORMAT_SEC) . (!page_min_side::$active_own ? ' av ' . (empty(page_min_side::$active_player->data['up_deactivated_up_id']) ? 'en ukjent bruker' : '<user id="' . page_min_side::$active_player->data['up_deactivated_up_id'] . '" />') : '') . '.</p>') . '
						<div class="p"><b>Begrunnelse:</b> ' . (empty(page_min_side::$active_player->data['up_deactivated_reason']) ? 'Ingen begrunnelse oppgitt.' : game::bb_to_html(page_min_side::$active_player->data['up_deactivated_reason'])) . '</div>' . (!page_min_side::$active_own && !$deact_self ? '
						<div class="p"><b>Intern informasjon:</b> ' . (access::has("mod") ? empty(page_min_side::$active_player->data['up_deactivated_note']) ? 'Ingen intern informasjon oppgitt.' : game::bb_to_html(page_min_side::$active_player->data['up_deactivated_note']) : 'Du har ikke tilgang til å se intern informasjon.') . '</div>' : '') . '
					</div>
				</div>';
        }
        echo '
				<div class="bg1_c">
					<h1 class="bg1">Avstand til neste rangert spiller<span class="left2"></span><span class="right2"></span></h1>
					<div class="bg1">
						' . ($rank_user_next ? $rank_user_next : '<p>Du er høyest rangert!</p>') . ($rank_user_prevnext ? '
						<div class="progressbar ms_space_bt">
							<div class="progress" style="width: ' . round($rank_user_prevnext) . '%">
								<p>Avstand forrige/neste spiller: ' . game::format_number($rank_user_prevnext, 4) . ' %</p>
							</div>
						</div>' : '') . '
					</div>
				</div>';
        if (page_min_side::$active_player->active) {
            OFC::embed("ranklevel_last_days", "graphs/ranklevel_last_days?up_id=" . page_min_side::$active_player->id, "100%", 150);
            echo '
				<div class="bg1_c">
					<h1 class="bg1">Ditt ranknivå siste dagene<span class="left2"></span><span class="right2"></span></h1>
					<div class="bg1" style="padding: 0 0 5px; background-color: #1A1A1A">
						<p style="font-size: 10px; margin: 5px">Denne grafen sammenlikner deg med de 10 beste rankerne de siste dagene.</p>
						<span id="ranklevel_last_days"></span>
					</div>
				</div>';
        }
        echo '
			</div>
		</div>
	</div>';
    }