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


PHP getLevel函数代码示例

本文整理汇总了PHP中getLevel函数的典型用法代码示例。如果您正苦于以下问题:PHP getLevel函数的具体用法?PHP getLevel怎么用?PHP getLevel使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: actionSearch

 public function actionSearch()
 {
     $request = \Yii::$app->request;
     $start = $request->get('iDisplayStart');
     $limit = $request->get('iDisplayLength');
     $andWhere = [];
     $order = '';
     $id_phone_name = $request->get('id_phone_name');
     if ($request->get('id_phone_name') != '') {
         // 电话、ID、姓名
         if (is_numeric($id_phone_name)) {
             if (strlen($id_phone_name . '') == 11) {
                 $andWhere[] = ["=", "phone", $id_phone_name];
             } else {
                 $andWhere[] = ["=", "id", $id_phone_name];
             }
         } else {
             $andWhere[] = ["like", "json_extract(info,'\$.real_name')", $id_phone_name];
         }
     } else {
         User::getInstance()->searchWhere($andWhere, $request->get(), $order);
     }
     $list = User::getInstance()->lists($start, $limit, $andWhere, $order);
     $count = User::getInstance()->count($andWhere);
     foreach ($list as $k => $v) {
         $list[$k]['info'] = json_decode($v['info']);
         $list[$k]['info']->level = getLevel($list[$k]['info']->level);
         $list[$k]['info']->is_marriage = getMarriage($list[$k]['info']->is_marriage);
         $list[$k]['sex'] = getSex($list[$k]['sex']);
     }
     $data = ['draw' => \Yii::$app->request->get('sEcho'), 'recordsTotal' => $count, 'recordsFiltered' => $count, 'data' => $list];
     $this->renderAjax($data, false);
 }
开发者ID:xswolf,项目名称:baihey,代码行数:33,代码来源:MemberController.php

示例2: checkHelperLevel

function checkHelperLevel($dbmysql)
{
    $level = getLevel($dbmysql);
    // Benutzerdaten speichern
    $sql_stmt = "UPDATE user SET Level='" . $level . " '" . "WHERE User_ID=" . $_SESSION['userid'] . " AND Level!=" . $level;
    $dbmysql->query($sql_stmt);
}
开发者ID:beckybettinger,项目名称:eventure,代码行数:7,代码来源:checkLevel.php

示例3: checkLoggedIn

function checkLoggedIn()
{
    // if logged in:
    if (isset($_SESSION['user_id']) && $_SESSION['user_id'] > 0) {
        $user = array("username" => getUsername(), "wood" => calcCurrentResources()["wood"], "iron" => calcCurrentResources()["iron"], "clay" => calcCurrentResources()["clay"], "level" => getLevel(), "villagers_in_use" => getVillagers(), "max_villagers" => getMaxVillagers());
    } else {
        // not logged in:
        $user = null;
    }
    return $user;
}
开发者ID:STEENBRINK,项目名称:PO_Informatica,代码行数:11,代码来源:reference.php

示例4: getLevel

function getLevel($level, $arr, $current = 0)
{
    $ret = array();
    foreach ($arr as $key => $value) {
        if ($current >= $level) {
            $ret[$key] = is_array($value) ? getLevel($level, $value, $current + 1) : $value;
        } else {
            if (is_array($value)) {
                $ret = array_merge($ret, getLevel($level, $value, $current + 1));
            }
        }
    }
    return $ret;
}
开发者ID:bshaffer,项目名称:Symplist,代码行数:14,代码来源:NavigationHelper.php

示例5: get_username

    }
}
$is_not_logged_in = !$is_logged_in;
$username = get_username();
$user_id = get_user_id();
// Player counts.
$stats = membership_and_combat_stats($sql);
$player_count = $stats['player_count'];
$players_online = $stats['players_online'];
$header = render_html_for_header('Live By the Sword', 'main-body', $is_index = true);
// render_html_for_header Writes out the html,head,meta,title,css,js.
$version = 'NW Version 1.7.1 2009.11.22';
// Display main iframe page unless logged in.
$main_src = 'main.php';
if ($is_logged_in) {
    $level = getLevel($username);
    $main_src = 'list_all_players.php';
    if ($level == 1) {
        $main_src = 'tutorial.php';
    } elseif ($level < 6) {
        $main_src = 'attack_player.php';
    }
}
$parts = get_certain_vars(get_defined_vars(), array('vicious_killer'));
if (!$is_logged_in) {
    echo render_template('splash2.tpl', $parts);
    // Non-logged in template.
} else {
    echo render_template('index.tpl', $parts);
    // Logged in template.
}
开发者ID:ninjajerry,项目名称:ninjawars,代码行数:31,代码来源:index.php

示例6: runBountyExchange

function runBountyExchange($username, $defender)
{
    //  *** BOUNTY EQUATION ***
    $user_id = get_user_id($username);
    $defender_id = get_user_id($defender);
    // *** Bounty Increase equation: (attacker's level - defender's level) / an increment, rounded down ***
    $levelRatio = floor((getLevel($user_id) - getLevel($defender_id)) / 10);
    $bountyIncrease = min(25, max($levelRatio * 25, 0));
    //Avoids negative increases, max of 30 gold, min of 0
    $bountyForAttacker = rewardBounty($user_id, $defender_id);
    //returns a value if bounty rewarded.
    if ($bountyForAttacker) {
        // *** Reward bounty whenever available. ***
        return "You have received the {$bountyForAttacker} gold bounty on {$defender}'s head for your deeds!";
        $bounty_msg = "You have valiantly slain the wanted criminal, {$defender}! For your efforts, you have been awarded {$bountyForAttacker} gold!";
        sendMessage("Village Doshin", $username, $bounty_msg);
    } else {
        if ($bountyIncrease > 0) {
            // *** If Defender has no bounty and there was a level difference. ***
            addBounty($user_id, $bountyIncrease);
            return "Your victim was much weaker than you. The townsfolk are angered. A bounty of {$bountyIncrease} gold has been placed on your head!";
        } else {
            return null;
        }
    }
}
开发者ID:reillo,项目名称:ninjawars,代码行数:26,代码来源:commands.php

示例7: subtractKills

                subtractKills($username, getLevel($username) * 5);
                addLevel($username, 1);
                addStrength($username, 5);
                addTurns($username, 50);
                addHealth($username, 100);
            } else {
                echo "You do not have enough kills to proceed at this time.<br>\n";
            }
        }
    } else {
        if ($nextlevel > $MAX_LEVEL) {
            $msg = "You enter the dojo as one of the elite ninja. No trainer has anything left to teach you.<br>\n";
        } else {
            if (getKills($username) < getLevel($username) * 5) {
                $msg = "Your trainer finds you lacking. You are instructed to prove your might against more ninja before you return.<br>\n";
            } else {
                echo "<form id=\"level_up\" action=\"dojo.php\" method=\"post\" name=\"level_up\">\n";
                echo "<div>\n";
                echo "<br>Do you wish to upgrade to level " . $nextlevel . "?<br>\n";
                echo "<input id=\"upgrade\" type=\"hidden\" value=\"1\" name=\"upgrade\">\n";
                echo "<input type=\"submit\" value=\"Upgrade\" class=\"formButton\"><br>\n";
                echo "</div>\n";
                echo "</form>\n";
            }
        }
    }
    echo "Your current level is " . getLevel($username) . ".  <br>Your current kills are " . getKills($username) . ".<br><br>\n";
    echo "Level " . (getLevel($username) + 1) . " requires " . getLevel($username) * 5 . " kills.<br><br>\n";
    echo $msg;
}
include SERVER_ROOT . "interface/footer.php";
开发者ID:ninjajerry,项目名称:ninjawars,代码行数:31,代码来源:dojo.php

示例8: saveUserData

function saveUserData($dbmysql)
{
    $level = getLevel($dbmysql);
    // Benutzerdaten speichern
    $sql_stmt = "UPDATE user SET EMail='" . $_POST['f_email'] . "', " . "Usergroup='0', " . "Vorname='" . $_POST['f_vorname'] . "', " . "Name='" . $_POST['f_name'] . "', " . "Adresse='" . $_POST['f_adresse'] . "', " . "PLZ='" . $_POST['f_plz'] . "', " . "Ort='" . $_POST['f_ort'] . "', " . "Telefon='" . $_POST['f_telefon'] . "', " . "Level='" . $level . "', " . "Geburtsdatum=STR_TO_DATE('" . $_POST['f_geburtsdatum'] . "','%d.%m.%Y') " . "WHERE User_ID=" . $_SESSION['userid'];
    if ($resupd = $dbmysql->query($sql_stmt)) {
        getUserData($dbmysql);
    }
}
开发者ID:beckybettinger,项目名称:eventure,代码行数:9,代码来源:registerUser.php

示例9: unlink

        unlink($_FILES["torrent"]["tmp_name"]);
        stdfoot();
        die;
    }
} else {
    $status = 0;
}
$uploadtpl = new bTemplate();
/*
Mod by losmi -sticky torrent
*/
$query = "SELECT * FROM {$TABLE_PREFIX}sticky";
$rez = do_sqlquery($query, true);
$rez = mysql_fetch_assoc($rez);
$rez_level = $rez['level'];
$current_level = getLevel($CURUSER['id_level']);
$level_ok = false;
if ($CURUSER["uid"] > 1 && $current_level >= $rez_level && $CURUSER['can_upload'] == 'yes') {
    $uploadtpl->set("LEVEL_OK", true, FALSE);
} else {
    $uploadtpl->set("LEVEL_OK", false, TRUE);
}
unset($rez);
/*
Mod by losmi -sticky torrent
*/
/*
Mod by losmi -visible torrent
*/
$query = "SELECT * FROM {$TABLE_PREFIX}visible";
$rez = do_sqlquery($query, true);
开发者ID:r4kib,项目名称:cyberfun-xbtit,代码行数:31,代码来源:upload.php

示例10: in

$target = in('target');
$selfTarget = in('selfTarget');
$item = in('item');
$give = in('give');
$victim_alive = true;
$using_item = true;
$starting_turns = getTurns($username);
$username_turns = $starting_turns;
$username_level = getLevel($username);
$item_count = $sql->QueryItem("SELECT sum(amount) FROM inventory WHERE owner = '{$username}' AND lower(item)=lower('{$item}')");
$ending_turns = null;
if ($selfTarget) {
    $target = $username;
}
$targets_turns = $target ? getTurns($target) : false;
$targets_level = $target ? getLevel($target) : NULL;
$target_hp = $sql->QueryItem("SELECT health FROM players WHERE uname = '{$target}'");
$target_status = getStatus($target);
$target_ip = $sql->QueryItem("SELECT ip FROM players WHERE uname = '{$target}'");
$gold_mod = NULL;
$result = NULL;
$max_power_increase = 10;
$level_difference = $targets_level - $players_level;
$level_check = $username_level - $targets_level;
$near_level_power_increase = nearLevelPowerIncrease($level_difference, $max_power_increase);
$turns_to_take = null;
// *** Take at least one turn away even on failure.
if ($give == "on" || $give == "Give") {
    $turn_cost = 0;
    $using_item = false;
}
开发者ID:ninjajerry,项目名称:ninjawars,代码行数:31,代码来源:inventory_mod.php

示例11: in

// View that clan name.
$clan_long_searched = in('clan_long_name', null, 'none');
// View that clan long name.
$new_clan_name = in('new_clan_name', '');
$sure = in('sure', '');
$kicked = in('kicked', '');
$person_invited = in('person_invited', '');
$clan_creation_level_requirement = 15;
$clan = null;
$viewer_level = 0;
if (!isset($username)) {
    echo "<p>You are not part of any clan.</p>";
} else {
    $clan = getClan($username);
    $player_clan_long_name = getClanLongName($username);
    $viewer_level = getLevel($username);
    $message = in('message');
    if ($message) {
        message_to_clan($message);
        echo "<div id='message-sent' class='ninja-notice'>Message sent.</div>";
    }
    if ($command == "new") {
        // *** Clan Creation Action ***
        if ($viewer_level > $clan_creation_level_requirement) {
            setClan($username, $username);
            $default_clan_name = "Clan_" . $username;
            renameClan($username, $default_clan_name);
            $command = "rename";
            // *** Shortcut to rename after. ***
            $clan = getClan($username);
            echo "<div class='notice'>You have created a new clan!</div><p>Name your clan: </p>\n";
开发者ID:ninjajerry,项目名称:ninjawars,代码行数:31,代码来源:clan.php

示例12: getMaps

<?php

// PICROSS
require __DIR__ . '/inc.functions.php';
$g_arrMaps = getMaps();
if (!($level = getLevelFromInput($map))) {
    $level = getLevel();
    $map = prepareMap($g_arrMaps[$level]);
}
$levelName = $level == 999 ? hashMap($map) : $level;
if (isset($_POST['cheat'])) {
    header('Content-type: text/json');
    exit(strtr(json_encode(array('map' => $map['map'])), ['x' => 1, '_' => 0]));
}
?>
<!doctype html>
<html>

<head>
	<meta name="viewport" content="width=device-width, initial-scale=1" />
	<title>PICROSS <?php 
echo $levelName;
?>
</title>
	<link rel="stylesheet" href="119.css" />
</head>

<body>
	<table id="picross">
		<thead>
			<tr>
开发者ID:rudiedirkx,项目名称:Games,代码行数:31,代码来源:119.php

示例13: runBountyExchange

function runBountyExchange($username, $defender)
{
    //  Bounty Increase equation: attacker'slevel-defender'slevel/5,roundeddown,times25goldperpoint
    $levelRatio = floor((getLevel($username) - getLevel($defender)) / 5);
    if ($levelRatio > 0) {
        $bountyIncrease = $levelRatio * 25;
    } else {
        $bountyIncrease = 0;
    }
    $bountyForAttacker = rewardBounty($username, $defender);
    //returns a value if bounty rewarded.
    if ($bountyForAttacker) {
        echo "You have received the {$bountyForAttacker} gold bounty on {$defender}'s head for your deeds!<br>\n";
        $bounty_msg = "You have valiantly slain the wanted criminal, {$defender}! For your efforts, you have been awarded {$bountyForAttacker} gold!";
        sendMessage("Village Doshin", $username, $bounty_msg);
    } else {
        if ($bountyIncrease > 0) {
            addBounty($username, $bountyIncrease);
            echo "Your victim was much weaker than you. The townsfolk are angered. A bounty of " . $bountyIncrease . " gold has been placed on your head!<br>\n";
        }
    }
}
开发者ID:ninjajerry,项目名称:ninjawars,代码行数:22,代码来源:commands.php

示例14: rand

     echo "The Guard sees you and prepares to defend!<br><br>\n";
     echo "<img src=\"images/characters/guard.png\" alt=\"Guard\">\n";
     $guard_attack = rand(1, $attacker_str + 10);
     // *** Guard Damage ***
     if (!subtractHealth($username, $guard_attack)) {
         echo "The Guard has slain you!<br>\n";
         echo "Go to the <a href=\"shrine.php\">shrine</a> to resurrect.<br>\n";
     } else {
         $guard_gold = rand(1, $attacker_str + 40);
         // *** Guard Gold ***
         addGold($username, $guard_gold);
         echo "The guard is defeated!<br>\n";
         echo "Guard does {$guard_attack} points of damage.<br>\n";
         echo "You have gained {$guard_gold} gold.<br>\n";
         if (getLevel($username) > 15) {
             $added_bounty = floor((getLevel($username) - 10) / 5);
             echo "You have slain a member of the military!  A bounty of " . $added_bounty * 10 . " gold has been placed on your head!<br>\n";
             addBounty($username, $added_bounty * 10);
         }
     }
 } else {
     if ($victim == "thief") {
         // Check the counter to see whether they've attacked a thief multiple times in a row.
         if (SESSION::is_set('counter')) {
             $counter = SESSION::get('counter');
         } else {
             $counter = 1;
         }
         $counter = $counter + 1;
         SESSION::set('counter', $counter);
         // Save the current state of the counter.
开发者ID:ninjajerry,项目名称:ninjawars,代码行数:31,代码来源:attack_npc.php

示例15: getStatus

    $target = $username;
    $link_back = "<a href=\"skills.php\">Skills</a>";
}
$user_ip = $_SESSION['ip'];
$username_status = getStatus($username);
$class = getClass($username);
$target_hp = getHealth($target);
$target_ip = $sql->QueryItem("SELECT ip FROM players WHERE uname = '{$target}'");
$target_turns = $sql->QueryItem("SELECT turns FROM players WHERE uname = '{$target}'");
$level = getLevel($username);
$covert = false;
$victim_alive = true;
$attacker_id = $username;
$starting_turns = getTurns($username);
$ending_turns = null;
$level_check = $level - getLevel($target);
if ($username_status && $status_array['Stealth']) {
    $attacker_id = "A Stealthed Ninja";
}
// TODO: Make attackLegal use self_use param.
// TODO: Make attackLegal also check that the skill can be used on an outside target.
// *** Checks the skill use legality, as long as the target isn't self.
$params = array('required_turns' => $turn_cost, 'ignores_stealth' => $ignores_stealth, 'self_use' => $self_use);
$AttackLegal = new AttackLegal($username, $target, $params);
$attack_allowed = $AttackLegal->check();
$attack_error = $AttackLegal->getError();
if ($attack_error) {
    // Use AttackLegal if not attacking self.
    echo "<div class='ninja-notice'>{$attack_error}</div>";
    // Display the reason for the attack failure.
} elseif (!$has_skill || $class == "" || $command == "") {
开发者ID:ninjajerry,项目名称:ninjawars,代码行数:31,代码来源:skills_mod.php


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