function is_admin()
 {
     if (is_in() && user_data('email') == '*****@*****.**') {
         return true;
     }
     return false;
 }
Пример #2
0
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;
    }
}
function get_npc_battle_har($npc)
{
    //$npc = preg_replace ('/[^a-z\._0-9]/i', '', $npc);
    $id = is_npc($npc);
    $q = do_mysql("SELECT chanse FROM npc WHERE id_npc = '" . $id . "';");
    if (!mysql_num_rows($q)) {
        include 'modules/s_main.php';
    }
    $c = mysql_result($q, 0);
    $c = explode('~', $c);
    include_once 'modules/f_get_affected.php';
    $aff = get_affected($npc);
    if (is_in('osleplen', $aff)) {
        for ($i = 0; $i < 10; $i++) {
            $с[$i] = round($с[$i] / 2);
        }
    }
    return $c;
}
Пример #4
0
function gen_footer()
{
    $f2 = '';
    // profilirovanie scenarija:
    global $TIME_START;
    $stop_time = gettime();
    $diff_time = substr($stop_time - $TIME_START, 0, 6);
    $f2 .= '<p><small>' . $diff_time . 'сек.</small></p>';
    $f2 .= '<div class="y" id="ladh654">&#169;_himura_</div>';
    $f2 .= '</body></html>';
    // pqjanstvo
    global $AFF;
    if (is_in('pqjan', $AFF)) {
        global $f;
        $c = strlen($f);
        $sym = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9');
        //for ($i = 0; $i < $c; $i++)
        //  if ($f[$i] >= 'А' && $f[$i] <= 'Я' || $f[$i] >= 'а' && $f[$i] <= 'я') $f[$i] = $sym[((int)$f[$i] % 10)];
        $temp = $f;
        $temp = str_replace('Э', '0', $temp);
        $temp = str_replace('Ю', '1', $temp);
        $temp = str_replace('Я', '2', $temp);
        $temp = str_replace('Ж', '3', $temp);
        $temp = str_replace('Ч', '4', $temp);
        $temp = str_replace('Ш', '5', $temp);
        $temp = str_replace('Ц', '6', $temp);
        $temp = str_replace('э', '7', $temp);
        $temp = str_replace('ю', '8', $temp);
        $temp = str_replace('Я', '9', $temp);
        $temp = str_replace('ж', '0', $temp);
        $temp = str_replace('ч', '1', $temp);
        $temp = str_replace('ш', '2', $temp);
        $temp = str_replace('щ', '3', $temp);
        $temp = str_replace('б', '4', $temp);
        $temp = str_replace('в', '5', $temp);
        $temp = str_replace('г', '6', $temp);
        $temp = str_replace('д', '7', $temp);
        $temp = str_replace('з', '8', $temp);
        $temp = str_replace('й', '9', $temp);
        $temp = str_replace('л', '0', $temp);
        $temp = str_replace('м', '1', $temp);
        $temp = str_replace('н', '2', $temp);
        $temp = str_replace('п', '3', $temp);
        $temp = str_replace('р', '4', $temp);
        $temp = str_replace('т', '5', $temp);
        $temp = str_replace('ф', '6', $temp);
        $temp = str_replace('ц', '7', $temp);
        $temp = str_replace('ъ', '8', $temp);
        $temp = str_replace('у', '9', $temp);
        $temp = str_replace('ь', '0', $temp);
        $temp = str_replace('Б', '1', $temp);
        $temp = str_replace('В', '2', $temp);
        $temp = str_replace('Г', '3', $temp);
        $temp = str_replace('Д', '4', $temp);
        $temp = str_replace('З', '5', $temp);
        $temp = str_replace('И', '6', $temp);
        $temp = str_replace('Й', '7', $temp);
        $temp = str_replace('Л', '8', $temp);
        $temp = str_replace('П', '9', $temp);
        $temp = str_replace('Р', '0', $temp);
        $temp = str_replace('Ф', '1', $temp);
        $temp = str_replace('Ц', '2', $temp);
        $temp = str_replace('Ъ', '3', $temp);
        $temp = str_replace('Ы', '4', $temp);
        $temp = str_replace('Ь', '5', $temp);
        $temp = str_replace('у', '6', $temp);
        $temp = str_replace('и', '7', $temp);
        $temp = str_replace('с', '8', $temp);
        $temp = str_replace('х', '9', $temp);
        $temp = str_replace('У', '0', $temp);
        $temp = str_replace('С', '1', $temp);
        $temp = str_replace('Х', '2', $temp);
        $temp = str_replace('Н', '3', $temp);
        $f = $temp;
    }
    global $dbcnx;
    mysql_close($dbcnx);
    return $f2;
}
Пример #5
0
 } else {
     if ($ext == 'm3u') {
         require THEME_PATH . '/header.php';
         echo $qrcode;
         echo str_replace('index.php?f=' . $id, '#m3u_link', $templates['dialog_share']);
         echo $call_qrcode;
         require THEME_PATH . '/footer.php';
     } else {
         if (is_in($ext, 'FILES_TO_ECHO') !== false) {
             require THEME_PATH . '/header.php';
             echo $qrcode;
             echo '<pre>' . htmlspecialchars(file_get_contents($f)) . '</pre>';
             echo $call_qrcode;
             require THEME_PATH . '/footer.php';
         } else {
             if (is_in($ext, 'FILES_TO_RETURN') !== false || $type == 'text/plain' && empty($ext)) {
                 header('Content-type: ' . $type . '; charset=utf-8');
                 header('Content-Transfer-Encoding: binary');
                 header('Content-Length: ' . filesize($f));
                 readfile($f);
             } else {
                 header('Content-type: ' . $type);
                 header('Content-Transfer-Encoding: binary');
                 header('Content-Length: ' . filesize($f));
                 # lance le téléchargement des fichiers non affichables
                 header('Content-Disposition: attachment; filename="' . _basename($f) . '"');
                 readfile($f);
             }
         }
     }
 }
function check_last_attack($pl, $re = 0)
{
    //$pl = preg_replace ('/[^a-z0-9_\.]/i', '', $pl);
    $now = time();
    $id = is_player($pl);
    if (!$id) {
        $id = is_npc($pl);
        // npc
        $q = do_mysql("SELECT lastattack, attack_speed FROM npc WHERE id_npc = '" . $id . "' AND lastattack < " . $now . " - attack_speed;");
        if (!mysql_num_rows($q)) {
            return 0;
        }
        $np = mysql_fetch_assoc($q);
        $time = $np['attack_speed'];
        $last = array();
        $last[1] = $np['lastattack'];
    } else {
        $q = do_mysql("SELECT last FROM players WHERE id_player = '" . $id . "';");
        $a = mysql_fetch_assoc($q);
        $last = $a['last'];
        $last = explode('|', $last);
        // ves oruzhija
        $q = do_mysql("SELECT weight FROM items WHERE belongs = '" . $pl . "' AND is_in = 'wea';");
        if (mysql_num_rows($q)) {
            $wgh = mysql_result($q, 0);
            $q = do_mysql("SELECT skills FROm players WHERE id_player = '" . $id . "';");
            $skills = mysql_result($q, 0);
            $skills = explode('|', $skills);
            $min = round($skills[0] / 15);
            $time = $wgh - $min;
            if ($time < 3) {
                $time = 3;
            }
        } else {
            $time = 2;
        }
    }
    if ($re) {
        $time = 0;
    }
    // teperq effektami eto vremja - uvelichim ili umenqqshim:
    include_once 'modules/f_get_affected.php';
    // effecty:
    $aff = get_affected($pl);
    if (is_in('oglushen', $aff)) {
        $time += 10;
    }
    if (is_in('odubel', $aff)) {
        $time += 10;
    }
    if (is_in('zamerz', $aff)) {
        $time += 10;
    }
    if (is_in('okamenel', $aff)) {
        $time += 10;
    }
    if (is_in('paralizovan', $aff)) {
        $time += 30;
    }
    if (is_in('ispugan', $aff)) {
        $time += 10000;
    }
    // esli eto otvetka, ostavim lishq vremja effekta
    if (is_in('zamedlen', $aff)) {
        $time *= 2;
    }
    if ($last[1] <= $now - $time) {
        return 1;
    }
    return 0;
}
     if (!isset($poll[$w])) {
         put_g_error('че?O_o');
     }
     $poll[$w] = explode('~', $poll[$w]);
     if (!isset($poll[$w][$i]) || !$poll[$w][$i]) {
         put_g_error('че?O_o');
     }
     $clan = $poll[$w][$i];
     $pol = string_drop($pol, $clan);
     if ($pol == '|') {
         $pol = '';
     }
     do_mysql("UPDATE clans SET politics = '" . $pol . "' WHERE clanname = '" . $p['clan'][0] . "';");
 } else {
     if (isset($_GET['clan'])) {
         if (is_in($_GET['clan'], $pol)) {
             put_g_error('такое имеется...');
         }
         $clan = preg_replace('/[^a-z_0-9]/i', '', $_GET['clan']);
         $q = do_mysql("SELECT clanname FROM clans WHERE clanname = '" . $clan . "';");
         if (!mysql_num_rows($q)) {
             put_g_error('несущетвует сей клан');
         }
         $a = preg_replace('/[^0-1]/', '', $_GET['alianse']);
         if (!$pol) {
             if ($a) {
                 $pol = '|' . $clan;
             } else {
                 $pol = $clan . '|';
             }
         } else {
function is_attack_successful($who, $to, $re = 0)
{
    // re oznachaet chto udar otvetnyj.
    // a esli udar otvetnyj, mozhno ne smotretq mozhet li on atakovatq, i ne fiksirovatq
    // etoj funkciej budem sravnivatq shansy
    include_once 'modules/f_get_chanses.php';
    // proverjaem effekty
    // esli odin iz paralizujushih, to vsegda kto-to proigraet/vyjgraet
    include_once 'modules/f_get_affected.php';
    $aff = get_affected($who);
    if (is_in('oglushen', $aff)) {
        return 0;
    }
    if (is_in('zamerz', $aff)) {
        return 0;
    }
    if (is_in('okamenel', $aff)) {
        return 0;
    }
    if (is_in('odubel', $aff)) {
        return 0;
    }
    if (is_in('paralizovan', $aff)) {
        return 0;
    }
    $aff = get_affected($to);
    if (is_in('oglushen', $aff)) {
        return 1;
    }
    if (is_in('zamerz', $aff)) {
        return 1;
    }
    if (is_in('okamenel', $aff)) {
        return 1;
    }
    if (is_in('odubel', $aff)) {
        return 1;
    }
    if (is_in('paralizovan', $aff)) {
        return 1;
    }
    $wid;
    $who_ranged = 0;
    $pi = is_player($who);
    if ($pi) {
        $wid = $pi;
        // berem informaciju igroka
        // shansy nanesti udar
        include_once 'modules/f_get_pl_battle_har.php';
        $who_har = get_pl_battle_har($who);
        // kakoe oruzhie. toestq rasschityvatq li po sisteme dalqnego boja ili blizhnego
        // esli who_ranged == 1,, to togda schitajutsja formuly luchnikov
        $q = do_mysql("SELECT fullname FROM items WHERE belongs = '" . $who . "' AND is_in = 'wea'");
        if (!mysql_num_rows($q)) {
            $who_ranged = 0;
        } else {
            $who_ranged = mysql_result($q, 0);
        }
        if (substr($who_ranged, 4, 3) == 'bow' || substr($who_ranged, 4, 3) == 'arb') {
            $who_ranged = 1;
        } else {
            $who_ranged = 0;
        }
        // zhiznq igroka dlja shansov (massiv)
        $q = do_mysql("SELECT life FROM players WHERE id_player = '" . $wid . "';");
        $who_life = mysql_result($q, 0);
        $who_life = explode('|', $who_life);
        // proverka onlajn:
        do_mysql("SELECT active FROM players WHERE id_player = '" . $wid . "';");
        $active = mysql_result($q, 0);
        if (!$active) {
            include_once 'modules/f_end_battle.php';
            end_battle($who);
        }
    } else {
        $wid = is_npc($who);
        if (!$wid) {
            return -1;
        }
        // informacija npc :
        include_once 'modules/f_get_npc_battle_har.php';
        $who_har = get_npc_battle_har($who);
        // napadatq s dali nemozhet npc
        // zhiznq npc dlja shansov (massiv)
        $q = do_mysql("SELECT life FROM npc WHERE id_npc = '" . $wid . "';");
        $who_life = mysql_result($q, 0);
        $who_life = explode('|', $who_life);
    }
    // proverka vremeni ataki
    include_once 'modules/f_check_last_attack.php';
    if (!check_last_attack($who, $re)) {
        return -1;
    }
    // esli ataka ne vovremja (s uchetom otvetki)
    //  obnovim posledniju ataku, takzhe s uchetom otvetki
    if (!$re) {
        // ne proverjaem estq li patrony, lenq, proverim v do_dmg
        include_once 'modules/f_upd_last_attack.php';
        upd_last_attack($who);
    } else {
        $aff = get_affected($to);
        if (is_in('ispugan', $aff)) {
            return 0;
        }
        // pri ispuge otvetka nevozmozhna
    }
    // harakteristika zawiwajusjago
    $tid;
    $pi = is_player($to);
    if ($pi) {
        $tid = $pi;
        // berem informaciju igroka
        // shansy nanesti udar
        include_once 'modules/f_get_pl_battle_har.php';
        $to_har = get_pl_battle_har($to);
        // estq li shit (1, 0)
        $q = do_mysql("SELECT COUNT(*) FROM items WHERE belongs = '" . $to . "' AND is_in = 'shi' AND type = 'x'");
        $to_shield = mysql_result($q, 0);
        // zhiznq igroka dlja shansov (massiv)
        $q = do_mysql("SELECT life FROM players WHERE id_player = '" . $tid . "';");
        $to_life = mysql_result($q, 0);
        $to_life = explode('|', $to_life);
        // proverka onlajn:
        do_mysql("SELECT active FROM players WHERE id_player = '" . $tid . "';");
        $active = mysql_result($q, 0);
        if (!$active) {
            include_once 'modules/f_end_battle.php';
            end_battle($to);
        }
    } else {
        $tid = is_npc($to);
        if (!$tid) {
            return -1;
        }
        // informacija npc :
        include_once 'modules/f_get_npc_battle_har.php';
        $to_har = get_npc_battle_har($to);
        // napadatq s dali nemozhet npc
        // zhiznq npc dlja shansov (massiv)
        $q = do_mysql("SELECT life FROM npc WHERE id_npc = '" . $tid . "';");
        $to_life = mysql_result($q, 0);
        $to_life = explode('|', $to_life);
    }
    // proschityvaem shansy -
    $ch = get_chanses($who_har, $who_life, $to_har, $to_life);
    // sluchajnoe chislo
    $rnd = rand(0, 100);
    if ($rnd <= $ch[1][1]) {
        // udar blokirovan:
        if ($who_ranged) {
            include_once 'modules/f_promah.php';
            promah($who);
        } else {
            include_once 'modules/f_block.php';
            block($to);
        }
        $NO = 1;
    } else {
        $ntdl = rand(0, 1);
        if ($ntdl == 0) {
            if ($who_ranged) {
                if (rand(0, 100) <= $ch[1][8]) {
                    // uklonimsja
                    include_once 'modules/f_uklon.php';
                    uklon($to);
                    $NO = 1;
                }
            } else {
                if (rand(0, 100) <= $ch[1][2]) {
                    // uklonimsja
                    include_once 'modules/f_uklon.php';
                    uklon($to);
                    $NO = 1;
                }
            }
        } else {
            if ($who_ranged) {
                if (rand(0, 100) <= $ch[1][3]) {
                    // pariruem
                    return 1;
                }
            } else {
                if (rand(0, 100) <= $ch[1][9]) {
                    // pariruem
                    return 1;
                }
            }
        }
    }
    if (isset($NO)) {
        // esli streljaem, nado rashodovatq strely, esli promahnulisq ili uklon. inache rashoduem v do_dmg
        if ($who_ranged) {
            // rashoduem odnu strelu
            include_once 'modules/f_decr_abstr_misc.php';
            if (!decr_abstr_misc('i.m.arr.arr', $who, 1)) {
                add_journal('нехватает припасoв!', $who);
            }
        }
        return 0;
    }
    //esli vse horosho, vozvrashjaem 2:
    return 2;
}
Пример #9
0
     $param = trade_param($torg[$i]);
     $name = $param[0];
     $cost = round($param[6] * $trade[1]);
     if (isset($numb)) {
         $cost *= $numb;
     }
     if (substr($torg[$i], 2, 1) == 'm') {
         $f .= $i + 1 . '. <a class="blue" href="game.php?sid=' . $sid . '&action=buy_misc&item=' . $torg[$i] . '&npc=' . $npc . '&start=' . $start . '&start2=' . $start2 . '">';
         $f .= $name . '</a>';
     } else {
         $f .= $i + 1 . '. <a class="blue" href="game.php?sid=' . $sid . '&action=buy&item=' . $it . '&count=1&npc=' . $npc . '&start=' . $start . '&start2=' . $start2 . '">';
         $f .= $name . '</a>';
         // dobavljaem ssylku na pokupku ukazanogo kolichestva
         $f .= ' (<a class="blue" href="game.php?sid=' . $sid . '&action=buy_c&item=' . $it . '&npc=' . $npc . '&start=' . $start . '&start2=' . $start2 . '">опт.</a>)';
     }
     if (is_in('~', $param[3])) {
         $f .= '[' . $param[3] . ']';
     }
     if (isset($numb)) {
         $f .= '[' . $numb . ']';
     }
     unset($numb);
     $f .= ' (ц: ' . $cost . ') | <a class="blue" href="game.php?sid=' . $sid . '&action=show_trade_i&item=' . $torg[$i] . '&npc=' . $npc . '&start=' . $start . '&start2=' . $start2 . '">?</a><br/>';
 }
 // teperq md'shnye ssylki dlja prosmotra
 $nw = floor($c2 / $show);
 for ($i = 0; $i <= $nw; $i++) {
     if ($i * $show == $start2) {
         $f .= $i + 1 . ' : ';
     } elseif ($i * $show < $c2) {
         $f .= '<a class="blue" href="game.php?sid=' . $sid . '&action=trade&npc=' . $npc . '&start=' . $start . '&start2=' . $i * $show . '">' . ($i + 1) . '</a> : ';
Пример #10
0
     $mbk = explode('~', $mbk);
     if (!is_in($spell, $mbk)) {
         put_error('заклинание не найдено');
     }
     $p['bd'][$num] = '5~' . $spell;
 } else {
     if ($_GET['bd'] == 6) {
         $spell = preg_replace('/[^a-z0-9_]/i', '', $_GET['spell']);
         if (!is_in($spell, $p['magic'])) {
             put_error('заклинание не найдено');
         }
         $p['bd'][$num] = '6~' . $spell;
     } else {
         if ($_GET['bd'] == 7) {
             $kombo = preg_replace('/[^a-z0-9_]/i', '', $_GET['kombo']);
             if (!is_in($kombo, $p['kombo_l'])) {
                 put_error('kombo не найдено');
             }
             $p['bd'][$num] = '7~' . $kombo;
         } else {
             if ($_GET['bd'] == 8) {
                 $item = preg_replace('/[^a-z0-9_\\.\\|]/i', '', $_GET['to']);
                 $q = do_mysql("SELECT realname FROM items WHERE fullname = '" . $item . "' AND belongs = '" . $LOGIN . "';");
                 if (!mysql_num_rows($q)) {
                     put_error('вещь не найдена');
                 }
                 $item = mysql_result($q, 0);
                 $p['bd'][$num] = '8~' . $item;
             } else {
                 if ($_GET['bd'] == 9) {
                     $skill = preg_replace('/[^0-9_]/i', '', $_GET['skill']);
function get_pl_battle_har($pl)
{
    //$pl = preg_replace ('/[^a-z0-9_]/i', '', $pl)
    $id = is_player($pl);
    $p = do_mysql("SELECT skills FROM players WHERE id_player = '" . $id . "';");
    $p = mysql_fetch_assoc($p);
    $p['skills'] = explode('|', $p['skills']);
    $q = do_mysql("SELECT fullname FROM items WHERE belongs = '" . $pl . "' AND is_in = 'wea';");
    if (!mysql_num_rows($q)) {
        $p['weapon'] = '';
    } else {
        $p['weapon'] = mysql_result($q, 0);
    }
    $q = do_mysql("SELECT fullname FROM items WHERE belongs = '" . $pl . "' AND is_in = 'shi';");
    if (!mysql_num_rows($q)) {
        $p['shield'] = '';
    } else {
        $p['shield'] = mysql_result($q, 0);
    }
    $tp = substr($p['weapon'], 4, 3);
    switch ($tp) {
        case 'swo':
            $numb = 7;
            break;
        case 'axe':
            $numb = 8;
            break;
        case 'ham':
            $numb = 9;
            break;
        case 'spe':
            $numb = 10;
            break;
        case 'bow':
            $numb = 11;
            break;
        case 'arb':
            $numb = 12;
            break;
        case 'kni':
            $numb = 13;
            break;
        case 'kli':
            $numb = 14;
            break;
        case 'tre':
        case 'wan':
            $numb = 15;
            break;
        default:
            $numb = 1;
            break;
    }
    $dvu = $dou = 0;
    if (strpos($p['weapon'], '.2h.') !== false) {
        $dvu = $p['skills'][40];
    }
    if (substr($p['shield'], 2, 1) == 'w') {
        $dou = $p['skills'][41];
    }
    $t[0] = $p['skills'][1] * 10 + $p['skills'][$numb] * 10 + $p['skills'][3] * 2 + $dou * 10 + $dvu * 10;
    # udar
    if ($tp == 'arb') {
        $t[1] = 0;
    }
    $t[1] = $p['skills'][1] * 10 + $p['skills'][$numb] * 10 + $p['skills'][3] * 5 + $dou * 10 + $dvu * 10;
    # blok
    $t[2] = $p['skills'][1] * 5 + $p['skills'][17] * 5 + $p['skills'][3] * 5;
    # uklon
    $t[3] = $p['skills'][1] * 10 + $p['skills'][18] * 10 + $p['skills'][3] * 2;
    # parirovanie
    $t[4] = $p['skills'][2] * 8 + $p['skills'][4] * 3 + $p['skills'][30];
    // pri primenenii dobavitq magija na 9 # uron magija
    $t[5] = $p['skills'][2] * 4 + $p['skills'][4] * 2 + $p['skills'][20] * 6 + $p['skills'][30];
    // pri primenenii dobavitq magija na 3 # ochki blok magija
    $t[6] = $p['skills'][2] * 8 + $p['skills'][4] * 2 + $p['skills'][21] * 8 + $p['skills'][30];
    // pri primenenii dobavitq magija na 3 # soprotivlenie magii
    $t[7] = $p['skills'][2] * 5 + $p['skills'][19] * 5 + $p['skills'][4] + $p['skills'][30] * 3;
    // pri ispolqzovanii dobavitq magija na 3; # uklon ot magii
    $t[8] = $p['skills'][1] * 3 + $p['skills'][3] * 3 + $p['skills'][17] * 3;
    # uklon ot strelqby
    $t[9] = $p['skills'][1] * 5 + $p['skills'][3] * 5 + $p['skills'][18] * 5;
    # parirovanija strelqby
    include_once 'modules/f_get_affected.php';
    $aff = get_affected($pl);
    if (is_in('osleplen', $aff)) {
        for ($i = 0; $i < 10; $i++) {
            $t[$i] = round($t[$i] / 2);
        }
    }
    return $t;
}
Пример #12
0
 function funcToMd($func, $heading = '##', $what = 'function', $class = false)
 {
     list($dc, $is_private) = $this->_getDc($func, $what);
     if (!$dc && $is_private) {
         // just skip undocumented private functions
         return false;
     }
     if ($dc && $dc->has('private')) {
         // skip private functions that are explicitely marked private
         return false;
     }
     if (!contains($func['modifiers'], 'public', 'protected', 'private')) {
         array_unshift($func['modifiers'], 'public');
     }
     $mod = implode(" ", $func['modifiers']);
     $args = array();
     $hash = md5($func['name']);
     $head = "\n{$heading} <a id='{$hash}'/>{$func['name']}\n";
     if (!$dc) {
         return $head . "\nNOT DOCUMENTED";
     }
     foreach ($func['parameter'] as $arg) {
         $args[$arg['name']] = (isset($arg['type']) ? "{$arg['type']} " : "") . $arg['name'] . (isset($arg['default']) ? "={$arg['default']}" : "");
     }
     if ($func['name'] == '__initialize') {
         $dc->EnsureDescription("This is WDF constructor equivalent");
     }
     if ($class) {
         $dc->EnsureTagDescription('override', "<OVERRIDE::{$class['name']}::{$func['name']}>");
         //log_if($func['name']=='WdfRender',"WdfRender",$dc,$class['name'],$func['name']);
     }
     $ret = $dc->getReturn();
     $comment = $dc->RenderAsMD();
     if ($dc->hasOne('internal', 'override', 'deprecated', 'shortcut', 'implements')) {
         return "{$head}{$comment}";
     }
     $definition = "\n\nDefinition: `{$mod} function {$func['name']}(" . implode(", ", $args) . ")`";
     $what = $what == 'function' ? "{$what} " : $what;
     $ret = !$ret ? 'NOT DOCUMENTED' : (!starts_with($ret->type, '<') ? "`{$ret->type}` {$ret->desc}" : "{$ret->type} {$ret->desc}");
     $return = "\n\nReturns: " . trim($ret);
     $arguments = array();
     foreach ($func['parameter'] as $arg) {
         $p = $dc->getParam($arg['name']);
         $def = isset($arg['default']) ? " [default: {$arg['default']}]" : "";
         $arguments[] = $p ? " * `{$p->type} {$p->var}` " . str_replace("\n", " ", $p->desc) : " * `{$arg['name']}{$def}` NOT DOCUMENTED";
         if ($is_private) {
             continue;
         }
         if (!$p) {
             $this->_warn("{$what}{$func['name']} MISSING @param {$arg['name']}", 'param');
         } else {
             if (preg_match('/[^a-z0-9_|]/i', $p->type)) {
                 $this->_warn("{$what}{$func['name']} PARAM {$arg['name']} weird TYPE {$p->type}", 'param');
             }
             if (!$p->desc) {
                 $this->_warn("{$what}{$func['name']} PARAM {$arg['name']} missing DESC", 'param');
             }
             if (count($p->typeArray) > 1) {
                 foreach ($p->typeArray as $t) {
                     if (!is_in($t, 'string', 'int', 'integer', 'bool', 'boolean', 'float', 'double', 'array', 'mixed', 'object')) {
                         $this->_warn("{$what}{$func['name']} PARAM {$arg['name']} part of mixed type is unlinkable: {$t}", 'param');
                     }
                 }
             }
         }
     }
     $arguments = count($arguments) > 0 ? "\n\nParameters:\n\n" . implode("\n\n", $arguments) : '';
     return "{$head}{$comment}{$definition}{$return}{$arguments}";
 }
Пример #13
0
     } while (0);
 } elseif (is_in($ext, 'FILES_TO_RETURN') !== false) {
     do {
         // lecture des fichiers audio
         if (isset($_GET['play']) && $_GET['play'] == 'audio') {
             $uri = uriWithoutGet();
             require_once THEME_PATH . '/share/files/audio.php';
             break;
         }
         header('Content-type: ' . $type . '; charset=utf-8');
         header('Content-Transfer-Encoding: binary');
         header('Content-Length: ' . filesize($f));
         readfile($f);
         break;
     } while (0);
 } elseif (is_in($ext, 'FILES_TO_OFFICE') !== false) {
     do {
         if (isset($_GET['read']) && $_GET['read'] == 'office') {
             $uri = uriWithoutGet();
             require_once THEME_PATH . '/share/files/office.php';
             break;
         }
         header('Content-type: ' . $type);
         header('Content-Transfer-Encoding: binary');
         header('Content-Length: ' . filesize($f));
         header('Content-Disposition: attachment; filename="' . basename($f) . '"');
         readfile($f);
     } while (0);
 } else {
     header('Content-type: ' . $type);
     header('Content-Transfer-Encoding: binary');
 if ($start >= $c) {
     $start = $c - $show;
 }
 if ($start < 0) {
     $start = 0;
 }
 $to = $start + $show;
 if ($to > $c) {
     $to = $c;
 }
 $i = $start;
 $ita = array();
 // massiv kuda budut pisatq veshi kotorye v rjukzake
 $q = do_mysql("SELECT fullname, name, on_take, on_drop, realname FROM items WHERE belongs = '" . $LOGIN . "' AND is_in = 'inv' " . $prt . " ORDER BY id_item;");
 while ($it = mysql_fetch_assoc($q)) {
     if (is_in($it['realname'], $ita)) {
         continue;
     }
     $ita[] = $it['realname'];
     $qfc = do_mysql("SELECT COUNT(*) FROM items WHERE belongs = '" . $LOGIN . "' AND is_in = 'inv' AND realname = '" . $it['realname'] . "';");
     $cmi = mysql_result($qfc, 0);
     $qua = substr($it['realname'], 8, 3);
     $qlist = '.bas.nor.fur.tun.bet.rar.eli.epi.leg.';
     if (strpos($qlist, $qua) === false) {
         $qua = 'blue';
     }
     $f .= $i + 1 . '. <a class="' . $qua . '" href="game.php?sid=' . $sid . '&action=use_item&item=' . $it['fullname'] . '">';
     $name = $it['name'];
     if (substr($it['fullname'], 2, 1) == 'm') {
         $cmi = $it['on_take'];
         $f .= $name . '</a> (' . $cmi . ') : <a class="blue" href="game.php?sid=' . $sid . '&action=showinfo&to=' . $it['fullname'] . '">?</a>';
        do_mysql("UPDATE players SET playerkill = playerkill + 1 WHERE id_player = '" . $p['id_player'] . "';");
        // dela s karmoj svjazanye
        $q = do_mysql("SELECT status1, karma, location, clan FROM players WHERE id_player = '" . $id . "';");
        $def = mysql_fetch_assoc($q);
        if ($def['status1'][0] != 1 && $def['status1'][0] != 2 && substr($def['location'], 0, 4) != 'pris' && substr($def['location'], 0, 3) != 'are') {
            // proverim togda vojnu klanovuju -
            $att['clan'] = $p['clan'];
            $def['clan'] = explode('|', $def['clan']);
            $q = do_mysql("SELECT politics FROM clans WHERE clanname = '" . $att['clan'][0] . "';");
            if (!mysql_num_rows($q)) {
                $pol = '';
            }
            $pol = mysql_result($q, 0);
            $pol = explode('|', $pol);
            // 0 - war
            if (!is_in($def['clan'][0], $pol[0])) {
                if ($p['karma'] > 0) {
                    $p['karma'] = -10;
                } else {
                    $p['karma'] -= 10;
                }
                $p['status1'][0] = 1;
                do_mysql("UPDATE players SET karma = '" . $p['karma'] . "', status1 = '" . $p['status1'] . "' WHERE id_player = '" . $p['id_player'] . "';");
            }
        }
    } else {
        do_mysql("UPDATE players SET monsterkill = monsterkill + 1 WHERE id_player = '" . $p['id_player'] . "';");
    }
    include_once 'modules/f_make_die.php';
    make_die($to);
}
Пример #16
0
function attack($who, $to)
{
    // prosto vnosit imena. esli nelzja dostatq, v funkcii nanesti uron bitva okonchitsja
    $id = is_player($who);
    if ($id) {
        if ($who == $to) {
            put_g_error('суицид кармически наказуем');
        }
        // berem spisok - imja, kto v boju uzhe:
        $whp = 1;
        $q = do_mysql("SELECT id_player, login, name, gender, location, in_battle, status1, last, clan FROM players WHERE id_player = '" . $id . "';");
        $att = mysql_fetch_assoc($q);
        $att['last'] = explode('|', $att['last']);
        // takzhe, vozqmem informaciju o prizvanyh i priruchenyh.
        $q = do_mysql("SELECT id_npc, fullname, name, in_battle FROM npc WHERE belongs = '" . $who . "';");
        if (mysql_num_rows($q)) {
            $whobel = mysql_fetch_assoc($q);
        }
    } else {
        $id = is_npc($who);
        if (!$id2) {
            return 0;
        }
        $whp = 0;
        // osnovnaja informacija monstra -
        $q = do_mysql("SELECT id_npc, fullname, name, location, in_battle FROM npc WHERE id_npc = '" . $id . "';");
        $att = mysql_fetch_assoc($q);
        // pokachto nebudem schitatq partii monstrov
    }
    // teperq na togo na kogo napadaet soberem informaciju
    $id2 = is_player($to);
    if ($id2) {
        $tp = 1;
        // berem spisok - imja, kto v boju uzhe:
        $q = do_mysql("SELECT id_player, login, name, in_battle, location, status1, clan, active FROM players WHERE id_player = '" . $id2 . "';");
        $def = mysql_fetch_assoc($q);
        if (!$def['active']) {
            return 0;
        }
        // takzhe, vozqmem informaciju o prizvanyh i priruchenyh.
        $q = do_mysql("SELECT id_npc, fullname, name, in_battle FROM npc WHERE belongs = '" . $to . "';");
        if (mysql_num_rows($q)) {
            $tobel = mysql_fetch_assoc($q);
        }
    } else {
        $id2 = is_npc($to);
        if (!$id2) {
            return 0;
        }
        $tp = 0;
        // osnovnaja informacija monstra -
        $q = do_mysql("SELECT id_npc, fullname, name, in_battle, type, location, belongs FROM npc WHERE id_npc = '" . $id2 . "';");
        $def = mysql_fetch_assoc($q);
        // napadatq na torgovcev i npc nelzja - tolqko na monstrov i zhivotnyh
        if ($def['type'] == 's' || $def['type'] == 't') {
            put_g_error('ну что тебе это существо плохого сделала то, а?');
        }
        // esli na svoegozhe napadaem, to bolqshe ne svoj zhe -
        if ($def['belongs'] == $who) {
            $def['belongs'] = '0';
            do_mysql("UPDATE npc SET belongs = '0' WHERE id_npc = '" . $id2 . "';");
        }
        // pokachto nebudem schitatq partii monstrov
    }
    // esli uzhe v boju, to nichego ne budem delatq
    if ($att['in_battle'] > 0 && $def['in_battle'] > 0 && $att['in_battle'] != $def['in_battle']) {
        return 1;
    }
    if ($att['in_battle'] > 0 && $att['in_battle'] == $def['in_battle']) {
        put_g_error('он на вашей стороне!');
    }
    if (!$att['in_battle']) {
        if (!$def['in_battle']) {
            $att['in_battle'] = 1;
            $def['in_battle'] = 2;
        } else {
            if ($def['in_battle'] == 1) {
                $att['in_battle'] = 2;
            } else {
                $att['in_battle'] = 1;
            }
        }
    } else {
        if ($att['in_battle'] == 1) {
            $def['in_battle'] = 2;
        } else {
            $def['in_battle'] = 1;
        }
    }
    // zony, svobodnye ot ataki:
    $toloc = $def['location'];
    if (substr($toloc, 0, 4) == 'rele' || substr($toloc, 0, 4) == 'elfc' || substr($toloc, 0, 4) == 'verg') {
        put_g_error('на этой локации атаковать нелзя');
    }
    if ($whp) {
        do_mysql("UPDATE players SET in_battle = '" . $att['in_battle'] . "' WHERE id_player = '" . $att['id_player'] . "';");
    } else {
        do_mysql("UPDATE npc SET in_battle = '" . $att['in_battle'] . "' WHERE id_npc = '" . $att['id_npc'] . "';");
    }
    if ($tp) {
        do_mysql("UPDATE players SET in_battle = '" . $def['in_battle'] . "' WHERE id_player = '" . $def['id_player'] . "';");
    } else {
        do_mysql("UPDATE npc SET in_battle = '" . $def['in_battle'] . "' WHERE id_npc = '" . $def['id_npc'] . "';");
    }
    // teperq pitomcy
    if (isset($whobel)) {
        $whobel['in_battle'] = $att['in_battle'];
        do_mysql("UPDATE npc SET in_battle = '" . $whobel['in_battle'] . "' WHERE id_npc = '" . $whobel['id_npc'] . "';");
    }
    if (isset($tobel)) {
        $tobel['in_battle'] = $def['in_battle'];
        do_mysql("UPDATE npc SET in_battle = '" . $tobel['in_battle'] . "' WHERE id_npc = '" . $tobel['id_npc'] . "';");
    }
    // dela s karmoj svjazanye
    if (isset($def['login']) && isset($att['login']) && $def['status1'][0] != 1 && $def['status1'][0] != 2 && substr($def['location'], 0, 4) != 'pris' && substr($def['location'], 0, 3) != 'are') {
        // proverim togda vojnu klanovuju -
        $att['clan'] = explode('|', $att['clan']);
        $def['clan'] = explode('|', $def['clan']);
        $q = do_mysql("SELECT politics FROM clans WHERE clanname = '" . $att['clan'][0] . "';");
        if (!mysql_num_rows($q)) {
            $pol = '';
        }
        $pol = mysql_result($q, 0);
        $pol = explode('|', $pol);
        // 0 - war
        if (!is_in($def['clan'][0], $pol[0])) {
            $att['status1'][0] = 1;
            $att['last'][4] = time();
            $att['last'] = implode('|', $att['last']);
            do_mysql("UPDATE players SET last = '" . $att['last'] . "', status1 = '" . $att['status1'] . "' WHERE id_player = '" . $att['id_player'] . "';");
        }
    }
    if (isset($att['login']) && $att['gender'] == 'female') {
        $attacked = 'напалa';
    } else {
        $attacked = 'напал';
    }
    add_journal($att['name'] . ' ' . $attacked . ' на ' . $def['name'] . '!', 'l.' . $att['location']);
    return 1;
}
// vzjal ili vzjala
if ($p['gender'] == 'male') {
    $vz = 'поднял';
} else {
    $vz = 'подняла';
}
add_journal($p['name'] . ' ' . $vz . ' ' . $iname . ' (' . $count . ')', 'l.' . $p['location']);
$rfn = $rn;
if (array_key_exists($rfn, $items)) {
    // $items podkljuchen v faile s_loadmaps.php
    // znachit nado vernutq
    $time = time();
    $time += 600;
    $nacti = 'item|' . $rfn . '|' . $time;
    $act = do_mysql("SELECT actions FROM maps WHERE map = '" . $pl_map . "';");
    $act = mysql_result($act, 0);
    if (!is_in($rfn, $act)) {
        $subc = substr_count($act, $rfn);
        $itmp = explode(':', $items[$rfn]);
        if ($itmp[2] > $subc) {
            if (!$act) {
                $act = $nacti;
            } else {
                $act .= '~' . $nacti;
            }
            do_mysql("UPDATE maps SET actions = '" . $act . "' WHERE map = '" . $pl_map . "';");
        }
    }
}
$NO_CONTINUE = 1;
include 'modules/s_journal.php';
Пример #18
0
                    $_Tpl_Menu_Entry->setParseValue("_ID", "me_" . $mtcc . "_" . $mlcc);
                    $_MENU_ENTRY .= "\n" . $_Tpl_Menu_Entry->renderTemplate("Menu_entry.html");
                }
                //if admin
            }
            //$MENU[$mtcc]['links'][$mlcc]['aktiv']==1
        }
        //for mlcc //links
        //add foot
        $_Tpl_Menu_Foot->setParseValue("_ID", $_ID);
        $_MENU_FOOT = $_Tpl_Menu_Foot->renderTemplate("Menu_foot.html");
    }
    //$MENU[$mtcc]['aktiv']==1
    //toggle in/out
    $_MENU_FOOT .= "<script language=\"javascript\" type=\"text/javascript\">\n //{$_ID}\n";
    if ($mtcc > 0 && is_in("s_" . $_ID, $menu_sections) || $_ID == "menu_tm") {
        //$user_is_expert &&
        $_MENU_FOOT .= "toggleSlide('" . $_ID . "','s_" . $_ID . "',0);";
    } else {
        $_MENU_FOOT .= "toggleSlide('" . $_ID . "','s_" . $_ID . "',1);";
    }
    $_MENU_FOOT .= "</script>\n";
    //hide section
    //create menu
    $_MENU .= $_MENU_HEAD . "\n" . $_MENU_ENTRY . "\n" . $_MENU_FOOT . "\n\n";
}
//for mtcc //topics
$_MENU .= "<div class=\"userinfo\"><!--a href=\"http://www.tellmatic.org\" target=\"blank\">" . TM_APPTEXT . "</a><br-->" . sprintf(___("Benutzer: %s"), $LOGIN->USER['name']) . " (" . $LOGIN->USER['style'] . " / " . $LOGIN->USER['lang'] . ")" . " " . ___("Zuletzt angemeldet:") . " " . date("F, D d-m-Y H:i:s", $LOGIN->USER['last_login']) . "<br>" . $_TIMEOUT . "</div>\n";
//some Cookie Testcode
if (DEBUG) {
    $_MENU .= '
  }*/
// a esli menqshe mana, to alkogolq
if ($do[1] < 0) {
    include_once 'modules/f_set_affected.php';
    set_affected($LOGIN, 'pqjan', $do[1] * -1);
    $q = do_mysql("SELECT affected FROM players WHERE id_player = '" . $p['id_player'] . "';");
    $p['affected'] = mysql_result($q, 0);
    $AFF = get_affected($LOGIN);
}
$f = '';
if (substr($item, 0, 7) == 'i.f.dri') {
    $f .= 'вы выпили ' . $itname . '!<br/>';
} else {
    $f .= 'вы съели ' . $itname . '!<br/>';
}
if (is_in('prokljat', $AFF)) {
    exit_msg('проклятие', 'древнее проклятие не дает вам восстановить сил!<br/> ');
}
// teperq proverim igroka
if ($p['life'][0] + (int) $do[0] >= $p['life'][1] && $do[0] > 0) {
    $p['life'][0] = $p['life'][1];
    $f .= 'ваша жизнь полностью восстановленна!<br/>';
} else {
    $p['life'][0] += $do[0];
    $f .= 'жизнь +' . $do[0] . '<br/>';
}
if ($p['mana'][0] + $do[1] >= $p['mana'][1] && $do[1]) {
    $p['mana'][0] = $p['mana'][1];
    $f .= 'ваша мана полностью восстановленна!<br/>';
} else {
    $p['mana'][0] += $do[1];
    $stn -= $jew[1];
    $stn -= $jew[2];
    $stn -= $jew[3];
}
$stn -= 4;
// nachalqnye
$stn -= $p['stats'][0] * 2;
// urovnevye
$skc += $p['stats'][6];
for ($i = 0; $i < 4; $i++) {
    ###  proverku na prjamoe ispolqzovanie navyka budem delatq potom
    if (!$p['skills'][$i]) {
        continue;
    }
    $cl = 'black';
    if ($i == 0 && is_in('jarostq', $AFF) || $i == 1 && is_in('skorostq', $AFF) || $i == 2 && is_in('prosvetlenie', $AFF) || $i == 3 && is_in('koordinacija', $AFF)) {
        $cl = 'blue';
    }
    $f .= $skn[$i] . ': <span class="' . $cl . '">' . $p['skills'][$i] . '</span>';
    $nop = 0;
    //if ((($stn - ($p['stats'][0] * 2)) * 4 > ($skc * 5)) && $p['stats'][0] > 1) $nop = 1;
    if ($p['stats'][0] > 1 && $stn / $skc > 4 / 5) {
        $nop = 1;
    }
    if ($p['stats'][6] && !$nop) {
        $f .= ' <a class="red" href="game.php?sid=' . $sid . '&action=incr_skill&skill=' . $i . '">+</a>';
    }
    if ($p['skills'][$i] > 1) {
        $f .= ' <a class="red" href="game.php?sid=' . $sid . '&action=decr_skill&skill=' . $i . '">-</a>';
    }
    if (file_exists('modules/skills/sk_' . $i . '.php')) {
}
include_once 'modules/f_comp_reaction.php';
$q = do_mysql("SELECT id_npc, fullname, in_battle FROM npc WHERE location = '" . $p['location'] . "' AND in_battle <> '0' AND in_battle <> '';");
while ($n = mysql_fetch_assoc($q)) {
    // dlja kazhdogo berem ego in_battle i napadaem na sluchajnogo
    $aff = get_affected($n['fullname']);
    if (is_in('oglushen', $aff)) {
        continue;
    }
    if (is_in('zamerz', $aff)) {
        continue;
    }
    if (is_in('okamenel', $aff)) {
        continue;
    }
    if (is_in('odubel', $aff)) {
        continue;
    }
    $tob = 0;
    if ($n['in_battle'] == 1) {
        $tob = 2;
    } else {
        $tob = 1;
    }
    $inb = array();
    $c = 0;
    $q2 = do_mysql("SELECT login FROM players WHERE location = '" . $p['location'] . "' AND in_battle = '" . $tob . "' AND active <> '0';");
    $c = mysql_num_rows($q2);
    while ($inb[] = mysql_fetch_assoc($q2)) {
    }
    $q2 = do_mysql("SELECT fullname FROM npc WHERE location = '" . $p['location'] . "' AND in_battle = '" . $tob . "';");
Пример #22
0
<?php 
// odetq vtoroe oruzhie esli estq takoj navyk
//
$item = preg_replace('/[^a-z0-9_\\.]/i', '', $_GET['weapon']);
$f = '';
if (!$p['skills'][41]) {
    put_g_error('вы неможете взять второе оружие - у вас нету этого навыка');
}
$q = do_mysql("SELECT name, is_in, type FROM items WHERE fullname = '" . $item . "';");
$is_in = mysql_fetch_assoc($q);
if ($is_in['type'] != 'w') {
    put_error('это не оружие: ' . $item);
}
// vmeste s dvuruchnym nelzja nichego:
if (is_in('.2h.', $p['weapon'])) {
    put_g_error('вместе с двуручным второе оружие не возьмешь');
}
if ($is_in['is_in'] == 'shi') {
    // mesto:
    $q = do_mysql("SELECT COUNT(*) FROM items WHERE belongs = '" . $LOGIN . "' AND is_in = 'inv' AND weight > 0;");
    $c = mysql_result($q, 0);
    if ($c > $I_SEP_C) {
        put_g_error('в рюгзаке нехватает места');
    }
    // snimem
    do_mysql("UPDATE items SET is_in = 'inv' WHERE fullname = '" . $item . "';");
    $f .= 'вы сняли ' . $is_in['name'] . '!';
} else {
    // znachit gdeto ne tam
    // proverim harakteristiku:
    $itinf = do_mysql("SELECT on_take FROM items WHERE fullname = '" . $item . "';");
Пример #23
0
 } else {
     if (!isset($_POST['password']) || isset($_POST['password']) && blur_password($_POST['password']) == $id) {
         if (isset($_GET['thumbs'])) {
             $f = get_thumbs_name($f);
         } else {
             $f = $_SESSION['upload_path'] . $f;
         }
         # normal mode or access granted
         if ($f && is_file($f)) {
             # file request => return file according to $behaviour var (see core.php)
             $type = _mime_content_type($f);
             $ext = strtolower(pathinfo($f, PATHINFO_EXTENSION));
             if (is_in($ext, 'FILES_TO_ECHO') !== false) {
                 echo '<pre>' . htmlspecialchars(file_get_contents($f)) . '</pre>';
             } else {
                 if (is_in($ext, 'FILES_TO_RETURN') !== false) {
                     header('Content-type: ' . $type . '; charset=utf-8');
                     header('Content-Transfer-Encoding: binary');
                     header('Content-Length: ' . filesize($f));
                     readfile($f);
                 } else {
                     header('Content-type: ' . $type);
                     header('Content-Transfer-Encoding: binary');
                     header('Content-Length: ' . filesize($f));
                     // lance le téléchargement des fichiers non affichables
                     header('Content-Disposition: attachment; filename="' . basename($f) . '"');
                     readfile($f);
                 }
             }
             # burn access ?
             burned($id);
function comp_reaction($off, $pass)
{
    //$off = preg_replace ('/[^a-z0-9_\.]/i', '', $off);
    //$pass = preg_replace ('/[^a-z0-9_\.]/i', '', $pass);
    include_once 'modules/f_get_affected.php';
    $aff = get_affected($off);
    if (is_in('oglushen', $aff)) {
        return 0;
    }
    if (is_in('zamerz', $aff)) {
        return 0;
    }
    if (is_in('okamenel', $aff)) {
        return 0;
    }
    if (is_in('odubel', $aff)) {
        return 0;
    }
    if (is_in('paralizovan', $aff)) {
        return 0;
    }
    $aff = get_affected($pass);
    if (is_in('oglushen', $aff)) {
        return 1;
    }
    if (is_in('zamerz', $aff)) {
        return 1;
    }
    if (is_in('okamenel', $aff)) {
        return 1;
    }
    if (is_in('odubel', $aff)) {
        return 1;
    }
    if (is_in('paralizovan', $aff)) {
        return 1;
    }
    $id = is_npc($off);
    if ($id) {
        $q = do_mysql("SELECT dex FROM npc WHERE id_npc = '" . $id . "';");
        if (!mysql_num_rows($q)) {
            return 0;
        }
        $rea_off = mysql_result($q, 0);
    } else {
        $id = is_player($off);
        $q = do_mysql("SELECT skills FROM players WHERE id_player = '" . $id . "';");
        if (!mysql_num_rows($q)) {
            return 0;
        }
        $off_s = mysql_result($q, 0);
        $off_s = explode('|', $off_s);
        $rea_off = $off_s[1];
    }
    $id = is_npc($pass);
    if (is_npc($pass)) {
        $q = do_mysql("SELECT rea FROM npc WHERE id_npc = '" . $id . "';");
        if (!mysql_num_rows($q)) {
            return 0;
        }
        $rea_pass = mysql_result($q, 0);
    } else {
        $id = is_player($pass);
        $q = do_mysql("SELECT skills FROM players WHERE id_player = '" . $id . "';");
        if (!mysql_num_rows($q)) {
            return 0;
        }
        $pass_s = mysql_result($q, 0);
        $pass_s = explode('|', $pass_s);
        $rea_pass = $pass_s[3];
    }
    $ch = $rea_off * 100 / ($rea_off + $rea_pass);
    if (rand(0, 100) <= $ch) {
        return 1;
    } else {
        return 0;
    }
}
Пример #25
0
     }
     $action = 'cast_from_book';
     $_GET['spell'] = $p['bd'][$bd][1];
     $_GET['book'] = $p['mbook'];
 } else {
     if ($p['bd'][$bd][0] == 6) {
         // magija po pamjati:
         if (!is_in($p['bd'][$bd][1], $p['magic'])) {
             put_g_error('вы незнаете этого заклинания.');
         }
         $action = 'cast_from_head';
         $_GET['spell'] = $p['bd'][$bd][1];
     } else {
         if ($p['bd'][$bd][0] == 7) {
             // kombo:
             if (!is_in($p['bd'][$bd][1], $p['kombo_l'])) {
                 put_g_error('откуда вы выдрали, что то комбо вам доступно?');
             }
             $action = 'use_kombo';
             $_GET['kombo'] = $p['bd'][$bd][1];
         } else {
             if ($p['bd'][$bd][0] == 8) {
                 // ispolqzovatq svitok ili q veshq.
                 // 1 - eto real name, po nemu nado otsleditq snachalo nastojashee imja, a potom use_item
                 $q = do_mysql("SELECT fullname FROM items WHERE realname = '" . $p['bd'][$bd][1] . "' AND belongs = '" . $LOGIN . "' AND is_in = 'inv';");
                 if (!mysql_num_rows($q)) {
                     put_g_error('все эгземпляры этой веши у вас закончились');
                 }
                 $_GET['item'] = mysql_result($q, 0);
                 $action = 'use_item';
             } else {
Пример #26
0
$count = preg_replace('/[^0-9]/', '', $_GET['count']);
$it = $item;
$pos = strpos($item, ':');
if ($pos !== false) {
    $numb = substr($item, 0, $pos);
    $item = substr($item, $pos + 1);
}
$npc = preg_replace('/[^a-z0-9\\._]/i', '', $_GET['npc']);
include_once 'modules/f_real_name.php';
$rn = real_name($npc);
$file_name = str_replace('.', '_', $rn);
if (!file_exists('modules/npc/t/t_' . $file_name . '.php')) {
    put_g_error('no trade file');
}
include 'modules/npc/t/t_' . $file_name . '.php';
if (!is_in($it, $torg)) {
    put_error('there is no such item with the trader');
}
// funkcija eta ponadobitsjam esli pridetsja cenu ustanovitq i td
include_once 'modules/f_trade_param.php';
// teperq proverim, estq li takaja veshq u prodovca
$nid = is_npc($npc);
$tr = do_mysql("SELECT drop2 FROM npc WHERE id_npc = '" . $nid . "';");
$tr = mysql_result($tr, 0);
$param = trade_param($item);
// teperq proverim, hvataet li deneg
$tr = explode('|', $tr);
$param[6] *= $tr[1];
$param[6] = round($param[6]);
$param[6] *= $count;
if (isset($numb)) {
     $n['life'][0] -= $lp * 10;
     $m = 1;
 }
 if (is_in('otravlen', $naff)) {
     //echo 'o ';
     //$n['life'][0] -= ($lp * (round ($n['life'][1] / 100)));
     $n['life'][0] -= $lp * 7;
     $m = 1;
 }
 if (is_in('gorit', $naff)) {
     //echo 'g ';
     //$n['life'][0] -= ($lp * (round ($n['life'][1] / 20)));
     $n['life'][0] -= $lp * 20;
     $m = 1;
 }
 if ($n['life'][0] < $n['life'][1] && !isset($m) && !is_in('prokljat', $naff) && !is_in('zarazhen', $naff)) {
     if ($n['life'][0] + $lp > $n['life'][1]) {
         $n['life'][0] = $n['life'][1];
     } else {
         $n['life'][0] += $lp;
     }
 }
 if ($n['life'][0] <= 0) {
     /*echo '<pre>sam umer!!! (жизнь +'.$lp.' была), при смерти '.$n['life'][0].'/'.$n['life'][1].'<br/>';
     print_r ($naff);
     echo 'сейчас '.$time.'сек униксовых,<br/>';
     echo 'а последний раз выполнялось когда было '.$all['life_regen'].'<br/>';
     echo 'treg: '.$treg.'<br/>';
     echo 'month: '.$mon.'<br/>';
     echo '<pre>';
     print_r ($TESTALL);*/
<?php 
// voda->rosa
include_once 'modules/f_has_count.php';
if (has_count('i.f.dri.nor.water', 1, $LOGIN) && is_in('fresh', $p['magic'])) {
    // udaljaem syrqe
    include_once 'modules/f_delete_count.php';
    delete_count('i.f.dri.nor.water', 1, $LOGIN);
    include_once 'modules/f_gain_item.php';
    gain_item('i.q.que.rosa', 1, $LOGIN);
}
// takzhe polnoe vosstanovlenie manny
$p['mana'][0] = $p['mana'][1];
$mana = $p['mana'][1] . '|' . $p['mana'][1];
do_mysql("UPDATE players SET mana = '" . $mana . "' WHERE id_player = '" . $p['id_player'] . "';");
Пример #29
0
 /**
  * Set body.
  *
  * @param  mixed $body
  * @return self
  */
 public final function setBody($body) : self
 {
     switch ($this->contentType) {
         // handle xml @todo
         case ContentType::XML:
             break;
             // handle json
         // handle json
         case ContentType::JSON:
             $json = new Json($body);
             // simply check for pretty print
             $app = app();
             if (is_in($app->request->params->get['pp'], ['1', 'true'])) {
                 $body = $json->encode(JSON_PRETTY_PRINT);
             } else {
                 $body = $json->encode();
             }
             if ($json->hasError()) {
                 throw new JsonException($json->getErrorMessage(), $json->getErrorCode());
             }
             break;
             // handle html
         // handle html
         case ContentType::HTML:
             // check for page title
             if ($pageTitle = get_global('page.title')) {
                 $body = preg_replace('~<title>(.*?)</title>~s', '<title>' . html_encode($pageTitle) . '</title>', $body, 1);
             }
             // check page description
             if ($pageDescription = get_global('page.description')) {
                 $body = preg_replace('~<meta\\s+name="description"\\s+content="(.*?)">~', '<meta\\s+name="description"\\s+content="' . html_encode($pageDescription) . '">', $body, 1);
             }
             break;
     }
     // can gzip?
     if (!empty($this->gzipOptions)) {
         $this->gzip->setData($body);
         if ($this->gzip->isDataMinlenOK()) {
             $body = $this->gzip->encode();
             $this->setHeader('Vary', 'Accept-Encoding');
             $this->setHeader('Content-Encoding', 'gzip');
         }
     }
     // content length
     $this->setContentLength(strlen($body));
     $this->body = $body;
     return $this;
 }
Пример #30
0
 if ($nom != 'index.html' && !empty($files[$fichier])) {
     $id = $files[$fichier];
     $class = '';
     $title = '';
     if (substr($id, 0, 1) == '*') {
         # add class burn id after access
         $class = 'burn';
         $title = e('The user can access this only one time', false);
     } elseif (strlen($id) > strlen(uniqid(true))) {
         # add class password protected
         $class = 'locked';
         $title = e('The user can access this only with the password', false);
     }
     $extension = strtolower(pathinfo($fichier, PATHINFO_EXTENSION));
     # adding view icon if needed
     if (is_in($extension, 'FILES_TO_RETURN') !== false) {
         if ($extension == 'jpg' || $extension == 'jpeg' || $extension == 'gif' || $extension == 'png' || $extension == 'svg') {
             if ($use_lightbox) {
                 $icone_visu = '<a class="visu" data-type="lightbox" data-group="lb" href="index.php?f=' . $id . '" title="' . e('View this share', false) . '" alt="' . $nom . '"><span class="icon-eye" ></span></a>';
             } else {
                 $icone_visu = '<a class="visu" target="_BLANK" href="index.php?f=' . $id . '" title="' . e('View this share', false) . '"><span class="icon-eye" ></span></a>';
             }
             if (!$click_on_link_to_download) {
                 $target = 'target="_BLANK"';
             } else {
                 $target = null;
             }
         } else {
             $icone_visu = '<a class="visu" target="_BLANK" href="index.php?f=' . $id . '&amp;view" title="' . e('View this file', false) . '"><span class="icon-eye" ></span></a>';
         }
     } else {