当前位置: 首页>>代码示例>>PHP>>正文


PHP game::rank_info方法代码示例

本文整理汇总了PHP中game::rank_info方法的典型用法代码示例。如果您正苦于以下问题:PHP game::rank_info方法的具体用法?PHP game::rank_info怎么用?PHP game::rank_info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在game的用法示例。


在下文中一共展示了game::rank_info方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: while

		this.getParent("div").dispose();
	});');
    }
    echo '
		<div id="spillerhistorie" class="section' . (isset($_GET['side_up']) ? '' : ' hide') . '">
			<h2>Spillerhistorikk</h2>
			<table class="table ' . ($pagei_other_up->pages == 1 ? 'tablem' : 'tablemt') . '" style="width: 100%">
				<thead>
					<tr>
						<th>Spiller</th>
						<th>Status</th>
					</tr>
				</thead>
				<tbody>';
    while ($row = $result_other_up->fetch()) {
        $rank = game::rank_info($row['up_points'], $row['upr_rank_pos'], $row['up_access_level']);
        echo '
					<tr>
						<td>' . ($player->id == $row['up_id'] ? htmlspecialchars($row['up_name']) : game::profile_link($row['up_id'], $row['up_name'], $row['up_access_level'])) . '<br /><span style="font-size: 10px">' . $rank['name'] . '</span></td>
						<td style="font-size: 10px">
							Opprettet: ' . ess::$b->date->get($row['up_created_time'])->format() . '<br />' . ($row['up_access_level'] == 0 ? '
							Status: ' . ($row['up_deactivated_dead'] == 0 ? 'Deaktivert' : 'Død') . '<br />' : '
							Status: I live<br />') . '
							Sist pålogget: ' . ess::$b->date->get($row['up_last_online'])->format() . '
						</td>
					</tr>';
    }
    echo '
				</tbody>
			</table>' . ($pagei_other_up->pages > 1 ? '
			<p class="c">' . $pagei_other_up->pagenumbers() . '</p>' : '') . '
开发者ID:Kuzat,项目名称:kofradia,代码行数:31,代码来源:profil.php

示例2: top

    /**
     * Vis toppliste
     */
    protected function top()
    {
        if (access::has("crewet") && !isset($_GET['update'])) {
            echo '
<p class="c"><a href="ranklist?update">Oppdater ranklista hvis det er feil i den &raquo;</a></p>';
        }
        // hent folka..
        $result = \Kofradia\DB::get()->query("\n\t\t\tSELECT up_id, up_name, up_access_level, up_points, up_last_online, up_profile_image_url, upr_rank_pos\n\t\t\tFROM users_players\n\t\t\t\tLEFT JOIN users_players_rank ON upr_up_id = up_id\n\t\t\tWHERE up_access_level < " . ess::$g['access_noplay'] . " AND up_access_level != 0\n\t\t\tORDER BY up_points DESC\n\t\t\tLIMIT 15");
        // hent familier hvor spilleren er medlem
        $result_ff = \Kofradia\DB::get()->query("\n\t\t\tSELECT ffm_up_id, ffm_priority, ff_id, ff_type, ff_name\n\t\t\tFROM\n\t\t\t\t(\n\t\t\t\t\tSELECT up_id\n\t\t\t\t\tFROM users_players\n\t\t\t\t\tWHERE up_access_level < " . ess::$g['access_noplay'] . " AND up_access_level != 0\n\t\t\t\t\tORDER BY up_points DESC\n\t\t\t\t\tLIMIT 15\n\t\t\t\t) ref\n\t\t\t\tJOIN ff_members ON ffm_up_id = up_id AND ffm_status = " . ff_member::STATUS_MEMBER . "\n\t\t\t\tJOIN ff ON ff_id = ffm_ff_id AND ff_type = 1 AND ff_inactive = 0\n\t\t\tORDER BY ff_name");
        $familier = array();
        while ($row = $result_ff->fetch()) {
            $pos = ff::$types[$row['ff_type']]['priority'][$row['ffm_priority']];
            $text = '<a href="' . ess::$s['relative_path'] . '/ff/?ff_id=' . $row['ff_id'] . '" title="' . htmlspecialchars($pos) . '">' . htmlspecialchars($row['ff_name']) . '</a>';
            $familier[$row['ffm_up_id']][] = $text;
        }
        ess::$b->page->add_css('
.ranklist_box {
	background-color: #1D1D1D;
	margin: 15px auto;
	overflow: hidden;
	padding-left: 10px;
	position: relative;
	/*width: 60%;*/
}
.ranklist_box .profile_image {
	float: left;
	margin: 0 10px 0 -10px;
	border: 0;
}
.ranklist_box_1 {
	max-height: 100px;
	min-height: 80px;
}
.ranklist_box_2 {
	min-height: 60px;
	max-height: 60px;
}
.ranklist_box_2 .profile_image {
	width: 80px;
}
.ranklist_pos {
	position: absolute;
	top: 10px;
	right: 10px;
	font-size: 30px;
}
.ranklist_box_2 .ranklist_pos { font-size: 20px }
.ranklist_player {
	position: absolute;
	top: 10px;
	left: 130px;
}
.ranklist_player img { display: none }
.ranklist_box_2 .ranklist_player { left: 90px }
.rp_up { font-size: 16px }
.rp_rank {
	display: block;
	padding-top: 5px;
	color: #555;
}
.rp_familie {
	position: absolute;
	bottom: 10px;
	right: 10px;
	text-align: right;
}
.rp_no_familie { color: #555 }');
        echo '
<div class="bg1_c small">
	<h1 class="bg1">Rangeringsoversikt<span class="left"></span><span class="right"></span></h1>
	<div class="bg1">';
        $e = 0;
        while ($row = $result->fetch()) {
            $e++;
            $rank = game::rank_info($row['up_points'], $row['upr_rank_pos'], $row['up_access_level']);
            echo '
		<p class="ranklist_box ranklist_box_' . ($e > 5 ? "2" : "1") . '">
			<img src="' . htmlspecialchars(player::get_profile_image_static($row['up_profile_image_url'])) . '" alt="Profilbilde" class="profile_image" />
			<span class="ranklist_pos">#' . $e . '</span>
			<span class="ranklist_player">
				<span class="rp_up">' . game::profile_link($row['up_id'], $row['up_name'], $row['up_access_level']) . '</span><br />
				<span class="rp_rank">' . $rank['name'] . '</span>
			</span>
			<span class="rp_familie">' . (!isset($familier[$row['up_id']]) ? '<i class="rp_no_familie">Ingen broderskap</i>' : implode(", ", $familier[$row['up_id']])) . '</span>
		</p>';
            if ($e == 15) {
                break;
            }
        }
        echo '
		<p class="c"><a href="ranklist?alle">Vis komplett liste &raquo;</a></p>
	</div>
</div>';
    }
开发者ID:Kuzat,项目名称:kofradia,代码行数:98,代码来源:ranklist.php

示例3: change_priority

    /**
     * Endre posisjon for et medlem
     */
    protected function change_priority()
    {
        ess::$b->page->add_title("Endre posisjon på medlem");
        // har ikke merket av en spiller?
        if (!isset($_REQUEST['up_id']) && !isset($_REQUEST['up_ids'])) {
            ess::$b->page->add_message("Du må merke en eller flere spillere.", "error");
            redirect::handle();
        }
        // kontroller medlemmene
        $up_ids = isset($_REQUEST['up_ids']) ? array_map("intval", explode(",", $_REQUEST['up_ids'])) : array_map("intval", (array) $_REQUEST['up_id']);
        $priority_list = array();
        $members = array();
        $rank_points_low = null;
        // rankpoengene til spilleren med dårligst rank
        foreach ($up_ids as $up_id) {
            // er ikke medlem?
            if (!isset($this->ff->members['members'][$up_id])) {
                ess::$b->page->add_message('Spilleren <user id="' . $up_id . '" /> er ikke medlem av ' . $this->ff->type['refobj'] . '.', "error");
                redirect::handle();
            }
            $member = $this->ff->members['members'][$up_id];
            // kan ikke endre posisjon på seg selv
            if ($member->id == login::$user->player->id && !$this->ff->mod) {
                ess::$b->page->add_message('Du kan ikke omplassere deg selv.');
                redirect::handle();
            }
            // eier kan ikke omplasseres
            if ($member->data['ffm_priority'] == 1 && !$this->ff->mod) {
                ess::$b->page->add_message(ucfirst($this->ff->type['priority'][1]) . " kan ikke omplasseres.");
                redirect::handle();
            }
            // har høyere prioritering?
            if ($member->data['ffm_priority'] <= $this->ff->uinfo->data['ffm_priority'] && !$this->ff->mod) {
                ess::$b->page->add_message('Du kan ikke omplassere <user id="' . $member->id . '" /> som har høyere eller samme posisjon som deg.', "error");
                redirect::handle();
            }
            // sett opp rank informasjon for spilleren
            if ($rank_points_low === null || $member->data['up_points'] < $rank_points_low) {
                $rank_points_low = $member->data['up_points'];
            }
            $members[] = $member;
            $priority_list[] = $member->data['ffm_priority'];
        }
        // ingen medlemmer?
        $c = count($members);
        if ($c == 0) {
            ess::$b->page->add_message("Du må merke en eller flere spillere.", "error");
            redirect::handle();
        }
        // sorter slik at medlemmene med høyest posisjon kommer først
        array_multisort($priority_list, $members);
        ksort($priority_list);
        // sett opp nåværende prioritering hvis det kun er 1 spiller eller alle har samme prioritering
        $priority_old = array_unique($priority_list);
        if (count($priority_old) == 1) {
            $priority_old = $priority_old[0];
        } else {
            $priority_old = null;
        }
        // rank info for den dårligste ranken
        $rank_info = game::rank_info($rank_points_low);
        $rank_number = $rank_info['number'];
        // hent oversikt over ledige plasser og fjern eier/medeier posisjon om nødvendig
        $limits_data = $this->ff->check_limits($members);
        if (!$this->ff->mod) {
            unset($limits_data['priorities'][1]);
            if ($this->ff->uinfo->data['ffm_priority'] > 1) {
                unset($limits_data['priorities'][2]);
            }
        }
        // valg posisjon?
        if ((isset($_POST['pick_priority']) || isset($_POST['priority'])) && validate_sid()) {
            // har ikke valgt posisjon?
            $priority = isset($_POST['priority']) && isset($limits_data['priorities'][$_POST['priority']]) ? $limits_data['priorities'][$_POST['priority']] : false;
            if (!isset($_POST['priority'])) {
                ess::$b->page->add_message("Du må velge en posisjon.", "error");
            } elseif (!$priority || $priority['max'] == -1 && !$this->ff->mod) {
                ess::$b->page->add_message("Ugyldig posisjon.", "error");
            } elseif ($rank_number < $priority['min_rank'] && !$this->ff->mod && $priority['priority'] != $priority_old) {
                ess::$b->page->add_message('En eller flere av spillerene valgt har ikke høy nok rank for å bli ' . $this->ff->type['priority'][$priority['priority']] . ".", "error");
            } elseif ($priority['free'] < $c && !$this->ff->mod && $priority['priority'] != $priority_old) {
                ess::$b->page->add_message("Det er ingen ledige plasser som " . $this->ff->type['priority'][$priority['priority']] . ".", "error");
            } elseif ($this->ff->type['parent'] && $priority['priority'] == 4 && $limits_data['priorities'][3]['members'] == 0) {
                ess::$b->page->add_message("Det finnes ingen spillere med posisjon {$this->ff->type['priority'][3]} du kan tilegne en {$this->ff->type['priority'][4]}. Du må først sette en spiller som {$this->ff->type['priority'][3]} før du kan sette en {$this->ff->type['priority'][4]}.", "error");
            } elseif ($priority['priority'] == $priority_old && (!$this->ff->type['parent'] || $priority['priority'] != 4)) {
                ess::$b->page->add_message("Du må velge en annen posisjon enn den som er satt.");
            } else {
                // fjern de som er valgt og som allerede har denne prioriteringen
                if ($priority_old === null && ($priority['priority'] != 4 || !$this->ff->type['parent'])) {
                    foreach ($members as $key => $member) {
                        if ($member->data['ffm_priority'] == $priority['priority']) {
                            unset($members[$key]);
                            unset($priority_list[$key]);
                        }
                    }
                    $c = count($members);
                }
//.........这里部分代码省略.........
开发者ID:Kuzat,项目名称:kofradia,代码行数:101,代码来源:medlemmer.php

示例4: page_up

    /**
     * Spillere tilhørende brukeren
     */
    protected static function page_up()
    {
        // hent spillerene tilhørende denne personen
        $pagei = new pagei(pagei::ACTIVE_GET, "side_up", pagei::PER_PAGE, 15);
        $result = $pagei->query("\n\t\t\tSELECT up_id, up_name, up_access_level, up_created_time, up_points, up_deactivated_time, up_hits, up_cash+up_bank money, upr_rank_pos\n\t\t\tFROM users_players\n\t\t\t\tLEFT JOIN users_players_rank ON upr_up_id = up_id\n\t\t\tWHERE up_u_id = " . page_min_side::$active_user->id . "\n\t\t\tORDER BY up_last_online DESC");
        echo '
		<div class="bg1_c">
			<h1 class="bg1">Spillere tilhørende brukeren<span class="left2"></span><span class="right2"></span></h1>
			<div class="bg1">
				<table class="table ' . ($pagei->pages == 1 ? 'tablem' : 'tablemt') . '" style="width: 100%">
					<thead>
						<tr>
							<th>Spiller</th>
							<th>Opprettet</th>
							<th>Rank</th>
							<th>Penger</th>
							<th>Visninger</th>
							<th>Status</th>
						</tr>
					</thead>
					<tbody>';
        while ($row = $result->fetch()) {
            $rank = game::rank_info($row['up_points'], $row['upr_rank_pos'], $row['up_access_level']);
            echo '
						<tr>
							<td>' . game::profile_link($row['up_id'], $row['up_name'], $row['up_access_level'], true, 'min_side?up_id=' . $row['up_id']) . '</td>
							<td>' . ess::$b->date->get($row['up_created_time'])->format() . '</td>
							<td>' . $rank['name'] . ($rank['orig'] ? '<br />(' . $rank['orig'] . ')' : '') . '</td>
							<td class="r">' . game::format_cash($row['money']) . '</td>
							<td class="r">' . game::format_number($row['up_hits']) . '</td>
							<td>' . ($row['up_access_level'] == 0 ? 'Deaktivert:<br />' . ess::$b->date->get($row['up_deactivated_time'])->format() : 'Status: I live') . '</td>
						</tr>';
        }
        echo '
					</tbody>
				</table>' . ($pagei->pages > 1 ? '
				<p class="c">' . $pagei->pagenumbers() . '</p>' : '') . '
			</div>
		</div>';
    }
开发者ID:Kuzat,项目名称:kofradia,代码行数:43,代码来源:min_side_user.php

示例5: increase_rank_static

 /**
  * Endre rankpoengene for en bestemt spiller
  * @param integer $points_change
  * @param player $up (evt. integer)
  * @param boolean $use_login skal vi oppdatere sesjonsinfo hvis dette er den innloggede spilleren?
  * @param boolean $silent ikke annonser svaret på f.eks. IRC
  * @param integer $points_change_rel
  * @param string $oppdrag_name navn for oppdragtrigger å identifisere funksjonen som gav poeng
  * @return integer rank pos change/boolean false 404
  */
 public static function increase_rank_static($points_change, $up, $use_login = false, $silent = null, $points_change_rel = null, $oppdrag_name = null)
 {
     // ikke behandle hvis antall poeng ikke endres
     if (!$points_change) {
         return;
     }
     // hent ut spillerid
     if (!is_numeric($up) && (!is_object($up) || !$up instanceof player)) {
         throw new HSException("Ukjent spiller.");
     }
     if (is_numeric($up)) {
         $up_id = $up;
         $up = player::get($up_id);
     } else {
         $up_id = $up->id;
     }
     // tilhører spilleren brukeren som er logget inn?
     $is_login = $use_login && login::$logged_in && $up_id == login::$user->player->id;
     // hent helt fersk spillerinfo
     $result = \Kofradia\DB::get()->query("\n\t\t\tSELECT up_name, up_access_level, up_points, upr_rank_pos\n\t\t\tFROM users_players\n\t\t\t\tLEFT JOIN users_players_rank ON upr_up_id = up_id\n\t\t\tWHERE up_id = {$up_id}");
     $row = $result->fetch();
     // sett opp info
     $points_change_rel = $points_change_rel === null ? $points_change : (int) $points_change_rel;
     $access_level = $row['up_access_level'];
     $points = $row['up_points'];
     $points_after = $points + $points_change;
     $points_after_rel = $points + $points_change_rel;
     $rank_pos = $row['upr_rank_pos'];
     $name = $row['up_name'];
     $pos_change = 0;
     $extra = "";
     // må ranklista oppdateres?
     if ($rank_pos === null) {
         ranklist::flush();
         // hent oppdatert plassering
         $result = \Kofradia\DB::get()->query("SELECT upr_rank_pos FROM users_players_rank WHERE upr_up_id = {$up_id}");
         $row = $result->fetch();
         // har fortsatt ikke plassering?
         if (!$row) {
             throw new HSException("Klarer ikke å finne korrekt rankplassering.");
         }
     }
     // ranken vi har nå
     $rank = game::rank_info($points);
     $rank_num_now = $rank['number'];
     // ranken vi kommer til å være på etter endring
     $rank_after = game::rank_info($points_after);
     $rank_num_after = $rank_after['number'];
     $invisible = $access_level >= ess::$g['access_noplay'] || $access_level == 0;
     // positiv forandring
     if ($points_change > 0) {
         // hent ny rankplassering
         $result = \Kofradia\DB::get()->query("\n\t\t\t\tSELECT MIN(upr_rank_pos)\n\t\t\t\tFROM users_players_rank\n\t\t\t\tWHERE upr_up_points > {$points} AND upr_up_points <= {$points_after} AND upr_up_access_level != 0 AND upr_up_access_level < " . ess::$g['access_noplay']);
         // endre rankplassering?
         $pos = $result->fetchColumn(0);
         if ($pos !== NULL) {
             #$extra = ", up_rank_pos = $pos";
             $pos_change = $rank_pos - $pos;
             if ($up) {
                 $up->data['upr_rank_pos'] -= $pos_change;
             }
         }
         // oppdater brukeren
         \Kofradia\DB::get()->exec("UPDATE users_players SET up_points = up_points + {$points_change}, up_points_rel = up_points_rel + {$points_change_rel}{$extra} WHERE up_id = {$up_id}");
         // oppdater ranklisten
         \Kofradia\DB::get()->exec("UPDATE users_players_rank SET upr_up_points = upr_up_points + {$points_change} WHERE upr_up_id = {$up_id}");
         // oppdater rankplasseringen til de vi går forbi
         #if (!$invisible) \Kofradia\DB::get()->exec("UPDATE users_players SET up_rank_pos = up_rank_pos + 1 WHERE up_points >= $points AND up_points < $points_after");
         ranklist::update();
     } elseif ($points_change < 0) {
         // hent ny rankplassering
         $result = \Kofradia\DB::get()->query("\n\t\t\t\tSELECT MAX(upr_rank_pos)\n\t\t\t\tFROM users_players_rank\n\t\t\t\tWHERE upr_up_points < {$points} AND upr_up_points > {$points_after} AND upr_up_access_level != 0 AND upr_up_access_level < " . ess::$g['access_noplay']);
         // endre rankplassering?
         $pos = $result->fetchColumn(0);
         if ($pos !== NULL) {
             $pos++;
             #$extra = ", up_rank_pos = $pos";
             $pos_change = $rank_pos - $pos;
             if ($up) {
                 $up->data['upr_rank_pos'] -= $pos_change;
             }
         }
         // oppdater brukeren
         \Kofradia\DB::get()->exec("UPDATE users_players SET up_points = up_points + {$points_change}, up_points_rel = up_points_rel + {$points_change_rel}{$extra} WHERE up_id = {$up_id}");
         // oppdater ranklisten
         \Kofradia\DB::get()->exec("UPDATE users_players_rank SET upr_up_points = upr_up_points + {$points_change} WHERE upr_up_id = {$up_id}");
         // oppdater rankplasseringen til de vi går forbi
         #if (!$invisible) \Kofradia\DB::get()->exec("UPDATE users_players SET up_rank_pos = GREATEST(1, up_rank_pos - 1) WHERE up_points < $points AND up_points >= $points_after");
         ranklist::update();
     }
//.........这里部分代码省略.........
开发者ID:Kuzat,项目名称:kofradia,代码行数:101,代码来源:class.player.php

示例6: array

$result = \Kofradia\DB::get()->query("\n\tSELECT\n\t\tusers_players.*,\n\t\tup_cash + up_bank AS money,\n\t\tu_email, u_online_ip,\n\t\tupr_rank_pos\n\tFROM users_players\n\t\tLEFT JOIN users_players_rank ON upr_up_id = up_id,\n\t\tusers\n\tWHERE up_id = {$up_id} AND up_u_id = u_id\n\tGROUP BY up_id");
if (!($player = $result->fetch())) {
    ajax::text("ERROR:404-USER", ajax::TYPE_404);
}
// hent FF
$result = \Kofradia\DB::get()->query("\n\tSELECT ffm_priority, ff_id, ff_name, ff_type\n\tFROM ff_members JOIN ff ON ffm_ff_id = ff_id\n\tWHERE ffm_up_id = {$up_id} AND ffm_status = 1 AND ff_inactive = 0\n\tORDER BY ff_name");
$ff = array();
while ($row = $result->fetch()) {
    $type = ff::$types[$row['ff_type']];
    $row['posisjon'] = ucfirst($type['priority'][$row['ffm_priority']]);
    $ff[] = $row;
}
// profilbildet
$profile_image = player::get_profile_image_static($player['up_profile_image_url']);
// ranken
$rank = game::rank_info($player['up_points'], $player['upr_rank_pos'], $player['up_access_level']);
#$rank_name = $rank['name'];
// statusen
$status = "";
// drept?
if ($player['up_access_level'] == 0 && $player['up_deactivated_dead'] != 0) {
    $status = '<span class="c_deactivated">[Død]</span>';
} else {
    $types = access::types($player['up_access_level']);
    if (!in_array("none", $types)) {
        $type = access::type($player['up_access_level']);
        $type_name = access::name($type);
        $class = access::html_class($type);
        $status = '<span class="' . $class . '">[' . htmlspecialchars($type_name) . ']</span>';
    }
    // nostat?
开发者ID:Kuzat,项目名称:kofradia,代码行数:31,代码来源:get_player_info.php

示例7: template_topic_reply_preview

    /**
     * Lag HTML for forhåndsvisning av et forumsvar
     * @param array $data
     * 
     * $data må inneholde:
     *
     * ft_id
     * fr_text
     * fr_last_edit [optional]
     * fr_last_edit_up_id [optional]
     * 
     * fr_up_id
     * up_name
     * up_access_level
     * up_points
     * upr_rank_pos
     * up_forum_signature
     * up_profile_image_url
     * 
     * fs_new [boolean, optional]
     */
    public static function template_topic_reply_preview($data)
    {
        if (!\login::$logged_in) {
            throw new \HSNotLoggedIn();
        }
        $date = \ess::$b->date->get();
        // sett opp ranken
        $rank = \game::rank_info($data['up_points'], $data['upr_rank_pos'], $data['up_access_level']);
        $rank = $rank['name'];
        $player_ff_position = '';
        $html = '
	<div class="forum_topic">
		<h2 class="forum_title"><a href="topic?id=' . $data['ft_id'] . '" class="forum_permlink r4">#XX</a> - ' . $date->format(\date::FORMAT_NOTIME) . ' <b>' . $date->format("H:i:s") . '</b> - Av ' . \game::profile_link($data['fr_up_id'], $data['up_name'], $data['up_access_level']) . $player_ff_position . (isset($data['fs_new']) && $data['fs_new'] ? ' <span class="fs_new">(Ny)</span>' : '') . '</h2>
		<p class="h_left"><a href="#default_header_wrap"><img src="' . STATIC_LINK . '/other/up.gif" title="Til toppen" /></a></p>
		<p class="h_right" style="text-transform: uppercase; margin: -17px 10px 0 !important; color: #DDD">Forhåndsvisning</p>';
        // profilbildet og rank
        $img = '
			<div class="forum_profile_image"><a href="' . \ess::$s['relative_path'] . '/p/' . $data['up_name'] . '/' . $data['fr_up_id'] . '"><img src="' . htmlspecialchars(\player::get_profile_image_static($data['up_profile_image_url'])) . '" class="profile_image" alt="" /><span class="forum_rank">' . $rank . '</span></a></div>';
        // innlegget
        $html .= '
		<div class="forum_text">' . $img . '
			' . \game::format_data($data['fr_text']) . '
		</div>';
        // signaturen
        $signatur = false;
        if (\login::$user->data['u_forum_show_signature']) {
            $signatur = \game::format_data($data['up_forum_signature']);
        }
        if (!empty($signatur)) {
            $html .= '
		<div class="forum_signature">' . $signatur . '</div>';
        }
        // sist endret
        if (!empty($data['fr_last_edit'])) {
            $html .= '
		<p class="forum_last_edit">Sist redigert av <user id="' . $data['fr_last_edit_up_id'] . '" /> ' . \ess::$b->date->get($data['fr_last_edit'])->format(\date::FORMAT_SEC) . '</p>';
        }
        $html .= '
	</div>';
        return $html;
    }
开发者ID:Kuzat,项目名称:kofradia,代码行数:62,代码来源:Category.php

示例8: get_fam_points_rank

 /**
  * Hent broderskapet med flest rangeringspoeng
  */
 public static function get_fam_points_rank()
 {
     // hent alle broderskapene
     $ff_list = self::get_ff_group("ff_type = " . self::TYPE_FAMILIE . " AND ff_inactive = 0 AND ff_is_crew = 0");
     // hent alle eiere og medeiere
     $result = \Kofradia\DB::get()->query("\n\t\t\tSELECT ffm_up_id, ffm_ff_id, ffm_priority\n\t\t\tFROM ff_members JOIN ff ON ffm_ff_id = ff_id AND ff_type != " . self::TYPE_FAMILIE . " AND ff_is_crew = 0 AND ff_inactive = 0\n\t\t\tWHERE ffm_priority <= 2 AND ffm_status = " . ff_member::STATUS_MEMBER);
     $list = array();
     while ($row = $result->fetch()) {
         $list[$row['ffm_up_id']][] = $row['ffm_priority'];
     }
     // tell opp poeng i alle FF
     $ff_points_most_count = 0;
     $ff_points_most = null;
     $ff_points = array();
     foreach ($ff_list as $ff) {
         $points_ff = 0;
         // disse 3 er bare for å bryte ned statistikken
         $points_up = 0;
         $points_kill = 0;
         foreach ($ff->members['members'] as $ffm) {
             // firmaer
             if (isset($list[$ffm->id])) {
                 foreach ($list[$ffm->id] as $pri) {
                     // eier = 3 poeng, medeier = 2 poeng
                     $p = $pri == 1 ? 3 : 2;
                     $points_ff += $p;
                 }
             }
             // hent rank
             $rank = game::rank_info($ffm->data['up_points'], $ffm->data['upr_rank_pos'], $ffm->data['up_access_level']);
             $points_up += $rank['number'];
             // ett poeng per rank for medlemmene
             // sjekk rank posisjon
             if ($rank['pos'] == 1) {
                 $points_up += 3;
             } elseif ($rank['pos'] <= 5) {
                 $points_up += 2;
             } elseif ($rank['pos'] <= 15) {
                 $points_up += 1;
             }
             // 1 poeng for Lucky Luciano
         }
         // 1 poeng per 5. drap
         $points_kill += floor(($ff->data['ff_attack_killed_num'] + $ff->data['ff_attack_bleed_num']) / 5);
         // minus 1 poeng per 2. spiller i broderskapet som er drept
         $points_kill -= floor(($ff->data['ff_attacked_killed_num'] + $ff->data['ff_attacked_bleed_num']) / 2);
         $points = $ff->data['ff_points'];
         $points += $points_ff + $points_up + $points_kill;
         $ff_points[] = $points;
         $ff->data['ff_points_sum'] = $points;
         $ff->data['ff_points_ff'] = $points_ff;
         $ff->data['ff_points_up'] = $points_up;
         $ff->data['ff_points_kill'] = $points_kill + $ff->data['ff_points'];
         // flest poeng?
         if ($points > $ff_points_most_count) {
             $ff_points_most_count = $points;
             $ff_points_most = $ff;
         }
     }
     // sorter FF etter poeng
     array_multisort($ff_points, SORT_DESC, SORT_NUMERIC, $ff_list);
     // sett opp med ID-er
     $ff_list_indexed = array();
     foreach ($ff_list as $ff) {
         $ff_list_indexed[$ff->id] = $ff;
     }
     // sjekk for all-time-high
     if ($ff_points_most) {
         hall_of_fame::trigger("familie_rank", $ff_points_most);
     }
     return $ff_list_indexed;
 }
开发者ID:Kuzat,项目名称:kofradia,代码行数:75,代码来源:class.ff.php

示例9: format_data

    public static function format_data($data, $type = "bb", $args = null)
    {
        global $_base;
        switch ($type) {
            case "bb":
            case "signature":
                // bb kode
                return game::bb_to_html($data);
                // bb-kode eller egendefinert tekst hvis bb-kode er tom
            // bb-kode eller egendefinert tekst hvis bb-kode er tom
            case "bb-opt":
                $bb = trim(game::bb_to_html($data));
                if ($bb == "") {
                    return $args;
                }
                return $bb;
            case "music_pre":
                return preg_replace('~\\[music\\](https?://.+?)\\[/music\\]~ieu', 'game::music_add(\'$1\')', $data);
            case "music_post":
                return game::music_replace($data);
            case "profile":
                $data = game::format_data($data, "music_pre");
                // sett opp ranken
                $rank = game::rank_info($args->data['up_points'], $args->data['upr_rank_pos'], $args->data['up_access_level']);
                // diverse bb koder
                $data = str_replace(array("[counter]", "[visits]", "[visitor]", "[rank]", "[bank]", "[cash]", "[money]", "[renter]", "[pm_ulest]", "[pengerank]"), array('<img src="&rpath;/counter?count=' . $args->data['up_profile_hits'] . '" alt="Antall visninger: ' . $args->data['up_profile_hits'] . '" />', $args->data['up_profile_hits'], game::profile_link(), $rank['orig'] ? $rank['orig'] : $rank['name'], game::format_cash($args->data['up_bank']), game::format_cash($args->data['up_cash']), game::format_cash($args->data['up_cash'] + $args->data['up_bank']), game::format_cash($args->data['up_interest_last']), game::format_number($args->user->data['u_inbox_new']), game::cash_name($args->data['up_cash'] + $args->data['up_bank'])), game::bb_to_html($data));
                // rankbar
                $type = false;
                $match_rank = preg_match("~\\[rank_(neste_tid|neste_dato|tid|dato)\\]~iu", $data);
                if (preg_match("~\\[rankbar( type=(1|2))?\\]~iu", $data, $type) || $match_rank) {
                    // høyeste rank?
                    if ($rank['need_points'] == 0) {
                        global $_game;
                        $prosent = $args->data['up_points'] / game::$ranks['items_number'][count(game::$ranks['items_number'])]['points'] * 100;
                        $rankbar_total = '
<div class="progressbar">
	<div class="progress"><p>' . game::format_num($prosent, 3) . ' %</p></div>
</div>';
                        $rankbar_total2 = '
<div class="progressbar" style="margin-top: 1em">
	<div class="progress"><p>' . game::format_num($prosent, 3) . ' %</p></div>
</div>';
                        $data = str_replace(array("[rankbar]", "[rankbar type=1]", "[rankbar type=2]", "[rank_tid]", "[rank_dato]", "[rank_neste_tid]", "[rank_neste_dato]"), array($rankbar_total . $rankbar_total2, $rankbar_total, $rankbar_total, "Oppnådd", "Oppnådd", "Oppnådd", "Oppnådd"), $data);
                    } else {
                        // i forhold til den høyeste ranken
                        global $_game;
                        // antall poeng for den høyeste ranken
                        $points_max = game::$ranks['items'];
                        end($points_max);
                        $points_max = current($points_max);
                        $points_max = $points_max['points'];
                        // hvor langt ifra er vi?
                        $percent_total = round($args->data['up_points'] / $points_max, 2) * 100;
                        #if ($percent_total > 100) $percent_total = 100;
                        if ($percent_total == 0) {
                            $percent_total = 0.01;
                        }
                        $rankbar_total = '
<div class="progressbar">
	<div class="progress" style="width: ' . floor($percent_total) . '%"><p>' . game::format_num($percent_total, 2) . ' % i forhold til høyeste rank.</p></div>
</div>';
                        // i forhold til neste rank
                        $points_rank = $args->data['up_points'] - $rank['points'];
                        $percent = round($points_rank / $rank['need_points'] * 100, 2);
                        #if ($percent  )
                        $rankbar_next = '
<div class="progressbar">
	<div class="progress" style="width: ' . floor($percent) . '%"><p>' . game::format_num($percent, 2) . ' % i forhold til neste rank</p></div>
</div>';
                        $rankbar_next2 = '
<div class="progressbar" style="margin-top: 1em">
	<div class="progress" style="width: ' . floor($percent) . '%"><p>' . game::format_num($percent, 2) . ' % i forhold til neste rank</p></div>
</div>';
                        // fiks bb kodene
                        $data = str_replace(array("[rankbar]", "[rankbar type=1]", "[rankbar type=2]"), array($rankbar_total . $rankbar_next2, $rankbar_total, $rankbar_next), $data);
                        // beregn antatt tid det tar å nå høyeste rank
                        if ($match_rank) {
                            // hent ut aktiviteten de siste X dagene
                            $expire = ess::$b->date->get();
                            $expire->modify("-21 days");
                            $expire = max($args->data['up_created_time'], $expire->format("U"));
                            // maks tid: siste 21 dager eller siden reg (om registrert innen 30 dager)
                            $result = \Kofradia\DB::get()->query("SELECT SUM(uhi_points) FROM users_hits WHERE uhi_up_id = {$args->id} AND uhi_secs_hour >= {$expire}");
                            $points = (int) $result->fetchColumn(0);
                            if ($points == 0) {
                                $data = str_replace(array("[rank_tid]", "[rank_dato]", "[rank_neste_tid]", "[rank_neste_dato]"), array("ukjent", "ukjent", "ukjent", "ukjent"), $data);
                            } else {
                                // antall sekunder poengene skal fordeles på
                                $time_elapsed = time() - $expire;
                                // beregn til neste rank og erstatt BB-kode
                                $need = $rank['points'] + $rank['need_points'] - $args->data['up_points'];
                                $time_left = $need / $points * $time_elapsed;
                                if ($time_left > 63072000) {
                                    $text_left = "over 2 år";
                                    $text_date = "om over 2 år";
                                } else {
                                    $text_left = game::timespan($time_left);
                                    $text_date = ess::$b->date->get($time_left + time())->format(date::FORMAT_NOTIME);
                                }
                                $data = str_replace(array("[rank_neste_tid]", "[rank_neste_dato]"), array($text_left, $text_date), $data);
//.........这里部分代码省略.........
开发者ID:Kuzat,项目名称:kofradia,代码行数:101,代码来源:class.game.php

示例10: show_beste_rankere

    /**
     * Vis beste rankere forrige periode
     */
    protected function show_beste_rankere()
    {
        $d = ess::$b->date->get();
        $a = $d->format("H") < 21 ? 2 : 1;
        $d->modify("-{$a} day");
        $d->setTime(21, 0, 0);
        $date_from = $d->format("U");
        $d->modify("+1 day");
        $date_to = $d->format("U");
        // hent statistikk
        $result = \Kofradia\DB::get()->query("\n\t\t\tSELECT up_id, up_name, up_access_level, sum_uhi_points, up_points, up_last_online, up_profile_image_url, upr_rank_pos\n\t\t\tFROM\n\t\t\t\t(\n\t\t\t\t\tSELECT uhi_up_id, SUM(uhi_points) sum_uhi_points\n\t\t\t\t\tFROM users_hits\n\t\t\t\t\t\tJOIN users_players ON up_id = uhi_up_id AND (up_access_level != 0 OR up_deactivated_time < {$date_to}) AND up_access_level < " . ess::$g['access_noplay'] . "\n\t\t\t\t\tWHERE uhi_secs_hour >= {$date_from} AND uhi_secs_hour < {$date_to}\n\t\t\t\t\tGROUP BY uhi_up_id\n\t\t\t\t\tHAVING sum_uhi_points > 0\n\t\t\t\t\tORDER BY sum_uhi_points DESC\n\t\t\t\t\tLIMIT 3\n\t\t\t\t) ref,\n\t\t\t\tusers_players\n\t\t\t\tLEFT JOIN users_players_rank ON upr_up_id = up_id\n\t\t\tWHERE uhi_up_id = up_id");
        if ($result->rowCount() == 0) {
            return;
        }
        $players = array();
        $up_list = array();
        while ($row = $result->fetch()) {
            $players[] = $row;
            $up_list[] = $row['up_id'];
        }
        // hent familier hvor spilleren er medlem
        $result_ff = \Kofradia\DB::get()->query("\n\t\t\tSELECT ffm_up_id, ffm_priority, ff_id, ff_type, ff_name\n\t\t\tFROM\n\t\t\t\tff_members\n\t\t\t\tJOIN ff ON ff_id = ffm_ff_id AND ff_type = 1 AND ff_inactive = 0\n\t\t\tWHERE ffm_up_id IN (" . implode(",", $up_list) . ") AND ffm_status = " . ff_member::STATUS_MEMBER . "\n\t\t\tORDER BY ff_name");
        $familier = array();
        while ($row = $result_ff->fetch()) {
            $pos = ff::$types[$row['ff_type']]['priority'][$row['ffm_priority']];
            $text = '<a href="' . ess::$s['relative_path'] . '/ff/?ff_id=' . $row['ff_id'] . '" title="' . htmlspecialchars($pos) . '">' . htmlspecialchars($row['ff_name']) . '</a>';
            $familier[$row['ffm_up_id']][] = $text;
        }
        $data = '
	<p>Beste rankere siste periode</p>';
        $e = 0;
        foreach ($players as $row) {
            $e++;
            $img = player::get_profile_image_static($row['up_profile_image_url']);
            $rank = game::rank_info($row['up_points'], $row['upr_rank_pos'], $row['up_access_level']);
            $data .= '
		<p class="ranklist_box">
			<a href="' . ess::$s['relative_path'] . '/p/' . rawurlencode($row['up_name']) . '" title="Vis profil"><img src="' . htmlspecialchars($img) . '" alt="Profilbilde" class="profile_image" /></a>
			<span class="ranklist_pos">#' . $e . '</span>
			<span class="ranklist_player">
				<span class="rp_up">' . game::profile_link($row['up_id'], $row['up_name'], $row['up_access_level']) . '</span><br />
				<span class="rp_rank">' . $rank['name'] . '</span>
			</span>
			<span class="rp_familie">' . (!isset($familier[$row['up_id']]) ? '<i class="rp_no_familie">Ingen broderskap</i>' : implode(", ", $familier[$row['up_id']])) . '</span>
		</p>';
            if ($e == 15) {
                break;
            }
        }
        $data .= '
	<p class="dark">En rankperiode er fra sist klokka var 21:00 og 24 timer før. De beste rankerene <a href="' . ess::$s['rpath'] . '/node/59">mottar bonus</a> for sin innsats.</p>';
        $this->put_box($data);
    }
开发者ID:Kuzat,项目名称:kofradia,代码行数:56,代码来源:forsiden.php

示例11: page_suggestion_handle

    /**
     * Behandle forslag av medlem
     */
    protected function page_suggestion_handle()
    {
        ess::$b->page->add_title("Foreslå en spiller som medlem");
        $player = false;
        // hvilken posisjon kan vi foreslå til?
        $limits = $this->ff->get_limits();
        $priority = isset($limits[4]) && $limits[4] >= 0 ? 4 : 3;
        // finne spiller?
        if (isset($_POST['player']) || isset($_REQUEST['up_id'])) {
            // hent spillerinformasjon
            $where = isset($_REQUEST['up_id']) ? 'up_id = ' . intval($_REQUEST['up_id']) : 'up_name = ' . \Kofradia\DB::quote($_POST['player']);
            $more = isset($_REQUEST['up_id']) ? '' : ' ORDER BY up_access_level = 0, up_last_online DESC LIMIT 1';
            $result = \Kofradia\DB::get()->query("\n\t\t\t\tSELECT up_id, up_name, up_access_level, up_points, upr_rank_pos, uc_time, uc_info, COUNT(IF(ff_is_crew = 0 AND ff_inactive = 0, 1, NULL)) ff_num\n\t\t\t\tFROM users_players\n\t\t\t\t\tLEFT JOIN users_players_rank ON upr_up_id = up_id\n\t\t\t\t\tJOIN users ON up_u_id = u_id\n\t\t\t\t\tLEFT JOIN users_contacts ON uc_u_id = u_id AND uc_contact_up_id = " . login::$user->player->id . " AND uc_type = 2\n\t\t\t\t\tLEFT JOIN ff_members ON ffm_up_id = up_id AND (ffm_status = 0 OR ffm_status = 1)\n\t\t\t\t\tLEFT JOIN ff ON ff_id = ffm_ff_id\n\t\t\t\tWHERE {$where}\n\t\t\t\tGROUP BY up_id{$more}");
            $row = $result->fetch();
            // fant ikke spilleren?
            if (!$row || !$row['up_id']) {
                ess::$b->page->add_message("Fant ikke spilleren med " . (isset($_REQUEST['up_id']) ? "id #" . intval($_REQUEST['up_id']) : "navn <b>" . htmlspecialchars($_POST['player']) . "</b>") . ".", "error");
            } else {
                // sett opp rank informasjon for spilleren
                $rank_info = game::rank_info($row['up_points'], $row['upr_rank_pos'], $row['up_access_level']);
                // er i FF?
                if (isset($this->ff->members['list'][$row['up_id']])) {
                    ess::$b->page->add_message('<user id="' . $row['up_id'] . '" /> er allerede foreslått, invitert eller medlem av ' . $this->ff->type['refobj'] . '.', "error");
                } elseif ($row['up_access_level'] == 0) {
                    ess::$b->page->add_message('<user id="' . $row['up_id'] . '" /> er død og kan ikke foreslås til ' . $this->ff->type['refobj'] . '.', "error");
                } elseif ($row['uc_time'] && !$this->ff->mod) {
                    $reason = game::bb_to_html($row['uc_info']);
                    $reason = empty($reason) ? '' : ' Begrunnelse: ' . $reason;
                    ess::$b->page->add_message('Denne spilleren blokkerte deg ' . ess::$b->date->get($row['uc_time'])->format() . '. Du kan derfor ikke foreslå spilleren til ' . $this->ff->type['refobj'] . '.' . $reason, "error");
                } elseif ($rank_info['number'] < $this->ff->get_priority_rank($priority)) {
                    ess::$b->page->add_message('<user id="' . $row['up_id'] . '" /> har ikke høy nok rank for å bli ' . $this->ff->type['priority'][$priority] . '. Må være minst ' . game::$ranks['items_number'][$this->ff->get_priority_rank($priority)]['name'] . '.', "error");
                } else {
                    $player = $row;
                }
            }
        }
        // har ikke funnet spiller?
        if (!$player || $_SERVER['REQUEST_METHOD'] == "GET") {
            // vis skjema for å finne spiller
            ess::$b->page->add_title("Velg spiller");
            echo '
<div class="section" style="width: 200px">
	<h1>Foreslå medlem til ' . $this->ff->type['refobj'] . '</h1>
	<p class="h_right"><a href="panel?ff_id=' . $this->ff->id . '">Tilbake</a></p>
	<boxes />
	<form action="" method="post">
		<p>Skriv inn navnet på spilleren du ønsker å foreslå som medlem til ' . $this->ff->type['refobj'] . '.</p>
		<p>' . ucfirst($this->ff->type['priority'][1]) . '/' . $this->ff->type['priority'][2] . ' vil få opp dette forslaget, og kan akseptere det slik at spilleren blir invitert som ' . $this->ff->type['priority'][$priority] . ($this->ff->type['parent'] ? ' underordnet deg' : '') . '.</p>
		<dl class="dd_right">
			<dt>Spiller</dt>
			<dd><input type="text" name="player" value="' . htmlspecialchars(postval("player", $player ? $player['up_name'] : '')) . '" class="styled w100" /></dd>
		</dl>
		<p class="c">
			' . show_sbutton("Finn spiller") . '
			<a href="panel?ff_id=' . $this->ff->id . '">Tilbake</a>
		</p>
	</form>
</div>';
            $this->ff->load_page();
        }
        // bekreftet?
        if (isset($_POST['confirm']) && validate_sid(false)) {
            // legg til forslag
            if ($this->ff->player_suggest($player['up_id'])) {
                ess::$b->page->add_message('<user id="' . $player['up_id'] . '" /> ble foreslått til ' . $this->ff->type['refobj'] . ' som ' . $this->ff->type['priority'][$priority] . ($this->ff->type['parent'] ? ' underordnet deg' : '') . '.');
                redirect::handle();
            } else {
                ess::$b->page->add_message("Noe gikk galt. Kunne ikke foreslå spilleren.", "error");
            }
        }
        // vis bekreftskjema
        ess::$b->page->add_title("Bekreft forslag");
        echo '
<div class="section" style="width: 220px">
	<h1>Bekreft forslag</h1>
	<p class="h_right"><a href="panel?ff_id=' . $this->ff->id . '&amp;a=suggestion">Tilbake</a></p>
	<boxes />
	<form action="" method="post">
		<input type="hidden" name="up_id" value="' . $player['up_id'] . '" />
		<input type="hidden" name="sid" value="' . login::$info['ses_id'] . '" />
		<p>Informasjon:</p>
		<dl class="dd_right">
			<dt>Spiller</dt>
			<dd>' . game::profile_link($player['up_id'], $player['up_name'], $player['up_access_level']) . '</dd>
			<dt>Posisjon</dt>
			<dd>' . ucfirst($this->ff->type['priority'][$priority]) . ($this->ff->type['parent'] ? ' underordnet <user id="' . $this->ff->uinfo->id . '" />' : '') . '</dd>
		</dl>
		<p class="c">
			' . show_sbutton("Bekreft forslag", 'name="confirm"') . '
			<a href="panel?ff_id=' . $this->ff->id . '&amp;a=suggestion">Tilbake</a>
		</p>
	</form>
</div>';
        $this->ff->load_page();
    }
开发者ID:Kuzat,项目名称:kofradia,代码行数:98,代码来源:panel.php

示例12: c_spiller

 /** Hent informasjon om en spiller */
 public function c_spiller()
 {
     global $_game;
     $player = $this->cmd_x[1];
     if (empty($player)) {
         $this->send_output("%bSyntax:%b !info spiller <spiller>");
     } else {
         if ($row = $this->hent_bruker_info($player, "up_id, up_name, up_points, up_last_online, up_hits, up_cash, up_b_id, up_bank, upr_rank_pos, up_access_level")) {
             $rank = game::rank_info($row['up_points'], $row['upr_rank_pos'], $row['up_access_level']);
             $real = $rank['orig'] ? '%b (' . $rank['orig'] . ')' : '';
             $rank = strip_tags($rank['name']) . $real;
             $last_online_delay = game::timespan($row['up_last_online'], game::TIME_ABS | game::TIME_SHORT | game::TIME_NOBOLD);
             $cash = game::format_cash($row['up_cash']);
             $bydel = game::$bydeler[$row['up_b_id']]['name'];
             $bank = game::format_cash($row['up_bank']);
             $hits = game::format_number($row['up_hits']);
             $this->send_output("Info for %b{$row['up_name']}%b (#{$row['up_id']}):");
             $this->send_output("Rank: %b{$rank}");
             $this->send_output("Bydel: %b{$bydel}");
             $this->send_output("Penger: %b{$cash}%b - I banken: %b{$bank}");
             $this->send_output("Sist pålogget: %b{$last_online_delay}");
             $this->send_output("Antall sidevisninger: %b{$hits}");
         } else {
             $this->send_output("%b{$player}%b finnes ikke!");
         }
     }
 }
开发者ID:Kuzat,项目名称:kofradia,代码行数:28,代码来源:class.irc_info.php

示例13: page_default

    /**
     * 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 }');
//.........这里部分代码省略.........
开发者ID:Kuzat,项目名称:kofradia,代码行数:101,代码来源:min_side_player.php


注:本文中的game::rank_info方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。