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


PHP is_player函数代码示例

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


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

示例1: crit

function crit($login)
{
    //$login = preg_replace ('/[^a-z-0-9_\.]/i', '', $login);
    $id = is_player($login);
    if (!$id) {
        include_once 'modules/f_get_npc_info.php';
        $life = get_npc_info($login, 'life');
        $life = explode('|', $life);
        $cr = round(100 - $life[0] / $life[1] * 100);
        if (rand(0, 100) <= $cr) {
            return 2;
        } else {
            return 1;
        }
    }
    $p = do_mysql("SELECT life, skills FROM players WHERE id_player = '" . $id . "';");
    $p = mysql_fetch_assoc($p);
    $p['skills'] = explode('|', $p['skills']);
    $p['life'] = explode('|', $p['life']);
    $cr = round(100 - $p['life'][0] / $p['life'][1] * 100 + $p['skills'][0]);
    include_once 'modules/f_get_affected.php';
    $aff = get_affected($login);
    if (is_in('ispugan', $aff)) {
        return 1;
    }
    if (rand(0, 100) <= $cr) {
        return 2;
    } else {
        return 1;
    }
}
开发者ID:nadvamir,项目名称:forgotten-story-mmorpg,代码行数:31,代码来源:f_crit.php

示例2: check_reagents

function check_reagents($spell, $login)
{
    //$spell = preg_replace ('/[^a-z0-9_]/i', '', $spell);
    //$login = preg_replace ('/[^a-z0-9_]/i', '', $login);
    if (!is_player($login)) {
        return 0;
    }
    // spisok reagentov:
    $q = do_mysql("SELECT reagents FROM magic WHERE fullname = '" . $spell . "';");
    if (!mysql_num_rows($q)) {
        return 0;
    }
    $rea = mysql_result($q, 0);
    if (!$rea) {
        return 1;
    }
    $rea = explode('|', $rea);
    // funkcija kotoroj proverim:
    include_once 'modules/f_has_misc_count.php';
    $c = count($rea);
    $has = 1;
    for ($i = 0; $i < $c; $i++) {
        $rea[$i] = explode(':', $rea[$i]);
        // esli menqshe - 0
        if (has_misc_count($rea[$i][0], $rea[$i][1], $login) < 1) {
            $has = 0;
        }
    }
    return $has;
}
开发者ID:nadvamir,项目名称:forgotten-story-mmorpg,代码行数:30,代码来源:f_check_reagents.php

示例3: healer_stop_b

function healer_stop_b($healer, $patient, $cost)
{
    //$healer = preg_replace ('/[^a-z0-9_\.]/i', '', $healer);
    //$patient = preg_replace ('/[^a-z0-9_]/i', '', $patient);
    $cost = preg_replace('/[^0-9]/', '', $cost);
    $id = is_player($patient);
    $nid = is_npc($healer);
    $q = do_mysql("SELECT location, money, status1 FROM players WHERE id_player = '" . $id . "';");
    $p = mysql_fetch_assoc($q);
    $q = do_mysql("SELECT location FROM npc WHERE id_npc = '" . $nid . "';");
    $loc = mysql_result($q, 0);
    if ($p['location'] != $loc) {
        return 0;
    }
    if (!$p['status1'][2] && !$p['status1'][3] && !$p['status1'][4]) {
        exit_msg('целительство', 'вы итак полностью здоровы!');
    }
    $price = $cost;
    if ($p['money'] < $price) {
        exit_msg('целительство', 'у вас нехватает денег, надо ' . $price . ' серебра!');
    }
    $p['money'] -= $price;
    $p['status1'][2] = 0;
    $p['status1'][3] = 0;
    $p['status1'][4] = 0;
    do_mysql("UPDATE players SET money = '" . $p['money'] . "', status1 = '" . $p['status1'] . "' WHERE id_player = '" . $id . "';");
    exit_msg('целительство', 'вaши раны залечены! цена: ' . $price . ' серебра.');
}
开发者ID:nadvamir,项目名称:forgotten-story-mmorpg,代码行数:28,代码来源:f_healer_stop_b.php

示例4: get_affected

function get_affected($name)
{
    //$name = preg_replace ('/[^a-z\._0-9]/i', '', $name);
    // pokachto tolqko chelam:
    $id = is_player($name);
    if ($id) {
        $q = do_mysql("SELECT affected FROM players WHERE id_player = '" . $id . "';");
        $a = mysql_result($q, 0);
    } else {
        $id = is_npc($name);
        if (!$id) {
            return 0;
        }
        $q = do_mysql("SELECT affected FROM npc WHERE id_npc = '" . $id . "';");
        if (!mysql_num_rows($q)) {
            return 0;
        }
        $a = mysql_result($q, 0);
    }
    if (!$a) {
        return 0;
    }
    $a = explode('|', $a);
    $c = count($a);
    for ($i = 0; $i < $c; $i++) {
        $a[$i] = explode(':', $a[$i]);
        $arr[] = $a[$i][0];
    }
    return $arr;
}
开发者ID:nadvamir,项目名称:forgotten-story-mmorpg,代码行数:30,代码来源:f_get_affected.php

示例5: get_loc

function get_loc($who, $stor, $depth = 1)
{
    // lokacija
    $id = is_player($who);
    if ($id) {
        $lq = do_mysql("SELECT location FROM players WHERE id_player = '" . $id . "';");
        $loc = mysql_result($lq, 0);
    } else {
        include_once 'modules/f_get_npc_info.php';
        $loc = get_npc_info($who, 'location');
    }
    $near = loc($loc, 'near');
    $lc = $near[$stor][0];
    if (!$lc) {
        return 0;
    }
    if ($depth == 2) {
        unset($near);
        $near = loc($lc, 'near');
    }
    if (!isset($near[$stor][0])) {
        return 0;
    }
    return $near[$stor][0];
}
开发者ID:nadvamir,项目名称:forgotten-story-mmorpg,代码行数:25,代码来源:f_get_loc.php

示例6: decr_abstr_misc

function decr_abstr_misc($prot, $who, $count, $other = 0)
{
    //$prot = preg_replace ('/[^a-z0-9_\.]/i', '', $prot);
    $count = preg_replace('/[^0-9]/', '', $count);
    //$who = preg_replace ('/[^a-z0-9_]/i', '', $who);
    if (!is_player($who)) {
        return 0;
    }
    if ($count < 1) {
        return 0;
    }
    $q = do_mysql("SELECT on_take FROM items WHERE belongs = '" . $who . "' AND is_in = 'inv' AND realname = '" . $prot . "' AND type = 'm';");
    if (!mysql_num_rows($q)) {
        return 0;
    }
    $ci = mysql_result($q, 0);
    if ($ci < $count) {
        return 0;
    }
    $ci -= $count;
    if ($ci) {
        do_mysql("UPDATE items SET on_take = '" . $ci . "' WHERE  belongs = '" . $who . "' AND is_in = 'inv' AND realname = '" . $prot . "';");
    } else {
        include_once 'modules/f_delete_item.php';
        $q = do_mysql("SELECT fullname FROM items WHERE belongs = '" . $who . "' AND is_in = 'inv' AND realname = '" . $prot . "' AND type = 'm';");
        $item = mysql_result($q, 0);
        delete_item($item);
    }
    return 1;
}
开发者ID:nadvamir,项目名称:forgotten-story-mmorpg,代码行数:30,代码来源:f_decr_abstr_misc.php

示例7: heal

function heal($healer, $patient, $cost)
{
    //$healer = preg_replace ('/[^a-z0-9_\.]/i', '', $healer);
    //$patient = preg_replace ('/[^a-z0-9_]/i', '', $patient);
    $cost = preg_replace('/[^0-9]/', '', $cost);
    $id = is_player($patient);
    $nid = is_npc($healer);
    $q = do_mysql("SELECT location, money, life, status1 FROM players WHERE id_player = '" . $id . "';");
    $p = mysql_fetch_assoc($q);
    $q = do_mysql("SELECT location FROM npc WHERE id_npc = '" . $nid . "';");
    $loc = mysql_result($q, 0);
    if ($p['location'] != $loc) {
        return 0;
    }
    $p['life'] = explode('|', $p['life']);
    if ($p['life'][0] == $p['life'][1]) {
        exit_msg('целительство', 'вы итак полностью здоровы!');
    }
    $price = ceil(($p['life'][1] - $p['life'][0]) / 100) * $cost;
    if ($p['money'] < $price) {
        exit_msg('целительство', 'у вас нехватает денег, надо ' . $price . ' серебра!');
    }
    $p['money'] -= $price;
    $nlife = $p['life'][1] . '|' . $p['life'][1];
    $p['status1'][2] = 0;
    $p['status1'][3] = 0;
    $p['status1'][4] = 0;
    do_mysql("UPDATE players SET money = '" . $p['money'] . "', life = '" . $nlife . "', status1 = '" . $p['status1'] . "' WHERE id_player = '" . $id . "';");
    exit_msg('целительство', 'вы выздоровили! цена: ' . $price . ' серебра.');
}
开发者ID:nadvamir,项目名称:forgotten-story-mmorpg,代码行数:30,代码来源:f_heal.php

示例8: is_inloc

function is_inloc($login, $who)
{
    //$login = mysql_real_escape_string ($login);
    //$who = mysql_real_escape_string ($who);
    // lokacija igroka
    $id = is_player($login);
    if ($id) {
        $q = do_mysql("SELECT location FROM players WHERE id_player = '" . $id . "';");
    } else {
        $q = do_mysql("SELECT location FROM npc WHERE id_npc = '" . is_npc($login) . "';");
    }
    if (!mysql_num_rows($q)) {
        return 0;
    }
    $loc = mysql_result($q, 0);
    $id = is_player($who);
    if ($id) {
        $q = do_mysql("SELECT location FROM players WHERE id_player = '" . $id . "';");
    } else {
        $q = do_mysql("SELECT location FROM npc WHERE id_npc = '" . is_npc($who) . "';");
    }
    if (!mysql_num_rows($q)) {
        return 0;
    }
    $loc2 = mysql_result($q, 0);
    if ($loc == $loc2) {
        return 1;
    }
    return 0;
}
开发者ID:nadvamir,项目名称:forgotten-story-mmorpg,代码行数:30,代码来源:f_is_inloc.php

示例9: start_blood

function start_blood($name)
{
    //$name = preg_replace ('/[^a-z0-9_\.]/i', '', $name);
    $id = is_player($name);
    if ($id) {
        $q = do_mysql("SELECT status1 FROM players WHERE id_player = '" . $id . "';");
        $st = mysql_result($q, 0);
        $st[2] = 1;
        do_mysql("UPDATE players SET status1 = '" . $st . "' WHERE id_player = '" . $id . "';");
        // regeneracija sposobna so vremenem pereborotq krovotechenie:
        $q = do_mysql("SELECT skills, last FROM players WHERE id_player = '" . $id . "';");
        $r = mysql_fetch_assoc($q);
        $r['skills'] = explode('|', $r['skills']);
        $r['last'] = explode('|', $r['last']);
        if ($r['skills'][5] > 0) {
            $time = time();
            $plus = 130 - 10 * $r['skills'][5];
            if ($plus < 30) {
                $plus = 30;
            }
            $r['last'][5] = $time + $plus;
            $last = $r['last'][0] . '|' . $r['last'][1] . '|' . $r['last'][2] . '|' . $r['last'][3] . '|' . $r['last'][4] . '|' . $r['last'][5] . '|' . $r['last'][6] . '|' . $r['last'][7] . '|' . $r['last'][8];
            do_mysql("UPDATE players SET last = '" . $last . "' WHERE id_player = '" . $id . "';");
        }
        return 1;
    }
    // proverjatq na npc nenado set_affected proverit
    include_once 'modules/f_set_affected.php';
    set_affected($name, 'krovotechenie');
    return 1;
}
开发者ID:nadvamir,项目名称:forgotten-story-mmorpg,代码行数:31,代码来源:f_start_blood.php

示例10: use_reagents

function use_reagents($spell, $login)
{
    //$spell = preg_replace ('/[^a-z0-9_]/i', '', $spell);
    //$login = preg_replace ('/[^a-z0-9_]/i', '', $login);
    if (!is_player($login)) {
        return 0;
    }
    // spisok reagentov:
    $q = do_mysql("SELECT reagents FROM magic WHERE fullname = '" . $spell . "';");
    if (!mysql_num_rows($q)) {
        return 0;
    }
    $rea = mysql_result($q, 0);
    if (!$rea) {
        return 1;
    }
    $rea = explode('|', $rea);
    // funkcija kotoroj udalim:
    include_once 'modules/f_decr_abstr_misc.php';
    $c = count($rea);
    for ($i = 0; $i < $c; $i++) {
        $rea[$i] = explode(':', $rea[$i]);
        decr_abstr_misc($rea[$i][0], $login, $rea[$i][1]);
    }
    return 1;
}
开发者ID:nadvamir,项目名称:forgotten-story-mmorpg,代码行数:26,代码来源:f_use_reagents.php

示例11: upd_last_cast

function upd_last_cast($pl, $spell)
{
    //$pl = preg_replace ('/[^a-z0-9_]/i', '', $pl);
    //$spell = preg_replace ('/[^a-z0-9_]/i', '', $spell);
    $now = time();
    $id = is_player($pl);
    if (!$id) {
        put_error('npc cant cast spell');
    }
    $q = do_mysql("SELECT last FROM players WHERE id_player = '" . $id . "';");
    $last = mysql_result($q, 0);
    $last = explode('|', $last);
    // vremja zaklinanija:
    $q = do_mysql("SELECT timewait FROM magic WHERE fullname = '" . $spell . "';");
    if (!mysql_num_rows($q)) {
        put_error('there are no such spell: ' . $spell . '');
    }
    $tw = mysql_result($q, 0);
    $last[3] = $now + $tw;
    // obrabotka effektami:
    #include_once ('modules/f_get_affected.php');
    // effecty:
    #$aff = get_affected ($LOGIN);
    // primer: if (is_in ('oglushen', $aff)) $last[3] += 10;
    $nlast = $last[0] . '|' . $last[1] . '|' . $last[2] . '|' . $last[3] . '|' . $last[4] . '|' . $last[5] . '|' . $last[6] . '|' . $last[7] . '|' . $last[8];
    do_mysql("UPDATE players SET last = '" . $nlast . "' WHERE id_player = '" . $id . "';");
    return 1;
}
开发者ID:nadvamir,项目名称:forgotten-story-mmorpg,代码行数:28,代码来源:f_upd_last_cast.php

示例12: use_mana

function use_mana($spell, $login)
{
    //$spell = preg_replace ('/[^a-z0-9_]/i', '', $spell);
    //$login = preg_replace ('/[^a-z0-9_]/i', '', $login);
    $q = do_mysql("SELECT mana FROM magic WHERE fullname = '" . $spell . "';");
    if (!mysql_num_rows($q)) {
        return 0;
    }
    $minus = mysql_result($q, 0);
    $id = is_player($login);
    $q = do_mysql("SELECT mana FROM players WHERE id_player = '" . $id . "';");
    if (!mysql_num_rows($q)) {
        return 0;
    }
    $mana = mysql_result($q, 0);
    $mana = explode('|', $mana);
    $mana[0] -= $minus;
    if ($mana[0] < 0) {
        return 0;
    }
    // many nehvatilo.
    $nmana = $mana[0] . '|' . $mana[1];
    do_mysql("UPDATE players SET mana = '" . $nmana . "' WHERE id_player = '" . $id . "';");
    return 1;
}
开发者ID:nadvamir,项目名称:forgotten-story-mmorpg,代码行数:25,代码来源:f_use_mana.php

示例13: teach_magic_from_sc

function teach_magic_from_sc($scroll, $npc, $login)
{
    //$scroll = preg_replace ('/[^a-z0-9_\.]/i', '', $scroll);
    //$npc = preg_replace ('/[^a-z0-9_\.]/i', '', $npc);
    //$login = preg_replace ('/[^a-z0-9_]/i', '', $login);
    $nid = is_npc($npc);
    $id = is_player($login);
    // v odnoj li lokacii
    $q = do_mysql("SELECT location FROM npc WHERE id_npc = '" . $nid . "';");
    if (!mysql_num_rows($q)) {
        return 0;
    }
    $loc1 = mysql_result($q, 0);
    $q = do_mysql("SELECT location FROM players WHERE id_player = '" . $id . "';");
    if (!mysql_num_rows($q)) {
        return 0;
    }
    $loc2 = mysql_result($q, 0);
    if ($loc1 != $loc2) {
        return 0;
    }
    include_once 'modules/f_has_item.php';
    if (!has_item($scroll, $login)) {
        put_g_error('у вас нету свитка!');
    }
    $q = do_mysql("SELECT on_take, price FROM items WHERE fullname = '" . $scroll . "' AND type = 's';");
    if (!mysql_num_rows($q)) {
        return 0;
    }
    $spell = mysql_fetch_assoc($q);
    // neumeet li on uzhe
    include_once 'modules/f_has_magic.php';
    if (has_magic($spell['on_take'], $login)) {
        put_g_error('вы уже умеете это заклинание!');
    }
    // cenu vyschitaem:
    $q = do_mysql("SELECT money FROM players WHERE id_player = '" . $id . "';");
    $money = mysql_result($q, 0);
    $cost = $spell['price'] * 10;
    if ($money < $cost) {
        put_g_error('нехватает серебра, нужно ' . $cost . ' серебреных!');
    }
    $money -= $cost;
    // dobavljaem zakl:
    $q = do_mysql("SELECT magic FROM players WHERE id_player = '" . $id . "';");
    $magic = mysql_result($q, 0);
    if (!$magic) {
        $magic = $spell['on_take'];
    } else {
        $magic .= '|' . $spell['on_take'];
    }
    // obnovim dannye:
    do_mysql("UPDATE players SET magic = '" . $magic . "', money = '" . $money . "' WHERE id_player = '" . $id . "';");
    // udaljaem svitok
    include_once 'modules/f_delete_item.php';
    delete_item($scroll);
    $q = do_mysql("SELECT name FROM magic WHERE fullname = '" . $spell['on_take'] . "';");
    $name = mysql_result($q, 0);
    exit_msg('магия', 'вы выучили заклинание ' . $name . ' за ' . $cost . ' серебреных!');
}
开发者ID:nadvamir,项目名称:forgotten-story-mmorpg,代码行数:60,代码来源:f_teach_magic_from_sc.php

示例14: check_pl_exp

function check_pl_exp($login)
{
    //$login = preg_replace ('/[^a-z0-9_]/i', '', $login);
    $id = is_player($login);
    if (!$id) {
        return 0;
    }
    $q = do_mysql("SELECT stats FROM players WHERE id_player = '" . $id . "';");
    $stats = mysql_result($q, 0);
    $stats = explode('|', $stats);
    if ($stats[1] >= $stats[2]) {
        $q = do_mysql("SELECT skills, rase FROM players WHERE id_player = '" . $id . "';");
        $sk = mysql_fetch_assoc($q);
        $sk['skills'] = explode('|', $sk['skills']);
        switch ($sk['rase']) {
            case 1:
                $sk['skills'][0] += 1;
                $sk['skills'][2] += 1;
                break;
            case 2:
                $sk['skills'][1] += 1;
                $sk['skills'][3] += 1;
                break;
            case 3:
                $sk['skills'][0] += 1;
                $sk['skills'][3] += 1;
                break;
        }
        $sk['skills'] = implode('|', $sk['skills']);
        if (substr($sk['skills'], 0, 1) == '|') {
            $sk['skills'] = substr($sk['skills'], 1);
        }
        $stats[0] += 1;
        if ($stats[0] <= 12 || $stats[0] % 10 == 0) {
            $stats[3] += 1;
        }
        $stats[1] -= $stats[2];
        $stats[2] = 600 * $stats[0] * $stats[0] + 1000 * $stats[0];
        $nstats = $stats[0] . '|' . $stats[1] . '|' . $stats[2] . '|' . $stats[3] . '|' . $stats[4] . '|' . $stats[5] . '|' . $stats[6] . '|' . $stats[7];
        do_mysql("UPDATE players SET stats = '" . $nstats . "', skills = '" . $sk['skills'] . "' WHERE id_player = '" . $id . "';");
        add_journal('новый уровень: ' . $stats[0] . '!', $login);
        add_journal('вы получили очко навыка!', $login);
    }
    if ($stats[4] >= $stats[5]) {
        // poluchitq ochko opyta:
        $stats[6] += 1;
        $stats[4] -= $stats[5];
        $stats[7] += 1;
        $stats[5] = round((600 * $stats[0] * $stats[0] + 1000 * $stats[0]) / 9);
        $nstats = $stats[0] . '|' . $stats[1] . '|' . $stats[2] . '|' . $stats[3] . '|' . $stats[4] . '|' . $stats[5] . '|' . $stats[6] . '|' . $stats[7];
        do_mysql("UPDATE players SET stats = '" . $nstats . "' WHERE id_player = '" . $id . "';");
        add_journal('вы получили очко опыта!', $login);
    }
    return 1;
}
开发者ID:nadvamir,项目名称:forgotten-story-mmorpg,代码行数:55,代码来源:f_check_pl_exp.php

示例15: end_battle

function end_battle($who)
{
    $id = is_player($who);
    if ($id) {
        do_mysql("UPDATE players SET in_battle = '0' WHERE id_player = '" . $id . "';");
    } else {
        $id = is_npc($who);
        do_mysql("UPDATE npc SET in_battle = '0' WHERE id_npc = '" . $id . "';");
    }
    return 1;
}
开发者ID:nadvamir,项目名称:forgotten-story-mmorpg,代码行数:11,代码来源:f_end_battle.php


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