Esempio n. 1
0
if (!isset($_GET['action'])) {
    $_GET['action'] = '';
}
$NO_CONTINUE = 0;
// podgruzim nachalnye moduli:
// podkljuchenija k baze dannyh:
require_once 'modules/config.php';
$sid = mysql_real_escape_string($sid);
//require_once ('modules/f_defend.php');
//defend();
// funkcii igry
require_once 'modules/f_game.php';
// teperq nado aurorizirovatq, obnovtq sid
require_once 'modules/autorize.php';
// tak kak avtorizacija navernjaka uspeshna, dostaem vsja infu igroka
$p = get_pl_info($LOGIN, 'all');
///////////////////////////////////////
// konstanty
include_once 'modules/constants.php';
///////////////////////////////////
// obnovlenie togdato...
if (isset($_GET['action'])) {
    $action = $_GET['action'];
} else {
    $action = '';
}
$tm = 1;
$time = time();
include 'modules/s_sys_pl_temperature.php';
if ($action == 'attack' || $action == 'do_dmg' || substr($action, 0, 3) == 'use' || substr($action, 0, 4) == 'take' || substr($action, 0, 4) == 'drop' || substr($action, 0, 4) == 'cast' || substr($action, 0, 4) == 'cast' || $action == 'go_to_loc' || $time - $p['last'][0] == 0) {
    $tm += $T;
<?php 
//echo 'included<br/><pre>';
// vsjakoe -
// potushim kostry
do_mysql("UPDATE items SET on_take = 'off' WHERE realname LIKE 'i.o.sta.fireplace%' AND on_take = 'on' AND on_use < '" . time() . "';");
// udalenija staryh -
// esli ostalisq starye, ih nado udalitq, no eshe i s lokacii vykinutq
$a = do_mysql("SELECT login FROM session WHERE puttime < NOW() - INTERVAL '10' MINUTE");
// perebor
while ($del = mysql_fetch_assoc($a)) {
    $del_loc = get_pl_info($del['login'], 'location');
    do_mysql("UPDATE players SET active = '0' WHERE login = '******'login'] . "';");
    do_mysql("DELETE FROM session WHERE login = '******'login'] . "';");
}
// vosstonovlenie zhizni u npc
// u ljudej po ihnim lichnym dannym
// npc tolqko te chto v karte
$map = substr($p['location'], 0, 4);
include_once 'modules/f_upd_affected.php';
include_once 'modules/f_get_affected.php';
// na skolqko
/*$mon = get_month();
  $q = do_mysql ("SELECT life_regen FROM gamesys WHERE month = '".$mon."';");
  $all['life_regen'] = mysql_result ($q, 0);*/
if (!$all['life_regen']) {
    $all['life_regen'] = $time - 30;
}
$lp = floor(($time - $all['life_regen']) / 5);
$treg = $all['life_regen'] + $lp * 5;
if (!$treg) {
    $treg = $time;
<?php 
// igrok v lokacii
$pl = get_pl_info($inloc[$i], 'main');
// nachnem s presta
if ($pl['status1'][0] == 0) {
    $f .= '';
}
if ($pl['status1'][0] == 1) {
    $f .= '!';
}
if ($pl['status1'][0] == 2) {
    $f .= '#';
}
// raskraska po statusu
if ($pl['status1'][1] != 1) {
    $span1 = '<span class="';
    if ($pl['status1'][1] == 0) {
        $span1 .= 'blue">';
    }
    if ($pl['status1'][1] == 2) {
        $span1 .= 'yellow">';
    }
    $span1e = '</span>';
}
if ($pl['status1'][2] != 0) {
    $span2 = '<span class="';
    if ($pl['status1'][2] == 1) {
        $span2 .= 'red">';
    } elseif ($pl['status1'][3] == 1) {
        $span2 .= 'green">';
    } elseif ($pl['status1'][4] == 1) {
     $tp['classof'] = $p['classof'];
     $tp['rase'] = $p['rase'];
     $tp['clan'] = $p['clan'];
     $tp['status1'] = $p['status1'];
     $tp['gender'] = $p['gender'];
     $tp['age'] = $p['age'];
     $tp['regtime'] = $p['regtime'];
     $tp['monsterkill'] = $p['monsterkill'];
     $tp['playerkill'] = $p['playerkill'];
     $tp['kbmonster'] = $p['kbmonster'];
     $tp['kbplayer'] = $p['kbplayer'];
     $tp['name'] = $p['name'];
     $tp['marry'] = $p['marry'];
 } else {
     $log = $to;
     $tp = get_pl_info($log, 'main');
     if (!$tp) {
         put_error('нету такого игрока');
     }
 }
 // bibliografija
 $q = do_mysql("SELECT * FROM anketa WHERE id_player = '" . $tp['id_player'] . "';");
 $an = mysql_fetch_assoc($q);
 $f = gen_header('инфо');
 $f .= '<div class="y" id="sgfdal"><b>' . $an['letter'] . ' ' . $tp['name'] . '</b>:</div><p>';
 if ($an['avatar']) {
     $f .= '<img src="smile/avatar/a_' . $an['avatar'] . '" alt="Av"/><br/>';
 }
 switch ($tp['gender']) {
     case 'male':
         $f .= 'муж. ';
function teleport($who, $loc_go)
{
    # get_pl_info(), do_mysql();, get_npc_info();, loc();, put_error();, delete_from_loc();, add_to_loc();, addjournal();
    require_once 'modules/f_get_pl_info.php';
    require_once 'modules/f_get_npc_info.php';
    require_once 'modules/f_loc.php';
    require_once 'modules/f_add_to_loc.php';
    // proverka dannyh
    //$who = preg_replace ('/[^a-z\._0-9]/i', '', $who);
    //$loc_go = preg_replace ('/[^a-z0-9\|]/i', '', $loc_go);
    global $LOGIN;
    $id;
    $pi = is_player($who);
    if ($pi) {
        $id = $pi;
        $login = $who;
        $lq = do_mysql("SELECT location FROM players WHERE id_player = '" . $id . "';");
        $loc = mysql_result($lq, 0);
        //$loc = get_pl_info ($login, 'location');
        $qg = do_mysql("SELECT gender FROM players WHERE id_player = '" . $id . "';");
        $gender = mysql_result($qg, 0);
        $n = 0;
        // proverka na boj -
        $q = do_mysql("SELECT in_battle FROM players WHERE id_player = '" . $id . "';");
        $inb = mysql_result($q, 0);
        $qg = do_mysql("SELECT name FROM players WHERE id_player = '" . $id . "';");
        $name = mysql_result($qg, 0);
    } else {
        if (substr($who, 0, 2) == 'n.') {
            $id = is_npc(substr($who, 2));
            if (!$id) {
                return 0;
            }
            $loc = get_npc_info($who, 'location');
            $alo = do_mysql("SELECT name FROM npc WHERE id_npc = '" . $id . "';");
            $login = mysql_result($alo, 0);
            $name = $login;
            $n = 1;
        }
    }
    // karta na kotoroj stoit
    $map_is = substr($loc, 0, 4);
    // karta toj loki, na kotoruju poidut
    $map_will = substr($loc_go, 0, 4);
    // ESLI NA DRUGUJU KARU
    if ($map_is != $map_will) {
        // a eshe ustanovim flag show_info, po kotoromu potom opredelim, nado li pokazatq vstupitelqnyj tekst k loakacci
        $show_info = 1;
    } else {
        // voobshem eto tazhe lokacija
        // vstupitelqnyj tekst ne pisatqi
        $show_info = 0;
    }
    global $NEWMAP;
    $NEWMAP = 1;
    if (!loc($loc_go, 'locinfo')) {
        return 0;
    }
    // sotrem byvshij inloc
    add_to_loc($loc_go, $who);
    //////////////////////////////
    // pitomec
    $an = do_mysql("SELECT name, fullname FROM npc WHERE belongs = '" . $login . "' AND location = '" . $loc . "' AND move <> 0;");
    $an = mysql_fetch_assoc($an);
    if ($an['fullname']) {
        $pit = ' и ' . $an['name'] . ' ';
        add_to_loc($loc_go, $an['fullname']);
    } else {
        $pit = '';
    }
    if (substr($who, 0, 2) == 'n.') {
        $map = substr($loc_go, 0, 4);
        do_mysql("UPDATE npc SET location = '" . $loc_go . "', map = '" . $map . "' WHERE id_npc = '" . $id . "';");
    } else {
        do_mysql("UPDATE players SET location = '" . $loc_go . "' WHERE id_player = '" . $id . "';");
    }
    $loc2 = 'l.' . $loc;
    // formiruem soobshenie.
    if ($pit) {
        $gone = 'исчезли';
        $come = 'появиись';
    } else {
        if (!isset($gender)) {
            // dlja npc, esliimja konchaetsja na 'a', to skorej vsego devushka
            $len = strlen($login);
            $len2 = $len - 1;
            if (substr($login, $len2) == 'а') {
                $gone = 'исчезла';
                $come = 'появилась';
            } else {
                $gone = 'исчез';
                $come = 'появился';
            }
        } else {
            if ($gender == 'male') {
                $gone = 'исчез';
                $come = 'появился';
            }
            if ($gender == 'female') {
                $gone = 'исчезлa';
                $come = 'появилась';
            }
        }
    }
    // proverim $n, esli 1 to eto npc i nado vsem pisatq, esli net to perehodjashemu ne nado
    if ($n) {
        $need = 1;
    } else {
        $need = 0;
    }
    // v byvshuju lokaciju
    add_journal('<p>' . $name . '' . $pit . ' ' . $gone . '!</p>', 'l.' . $loc, $need);
    // v novuju
    add_journal('<p>' . $come . ' ' . $name . '' . $pit . '</p>', 'l.' . $loc_go, $need);
    $p = get_pl_info($who, 'all');
    $NEWMAP = 1;
    include 'modules/s_loadmaps.php';
    // zagruzim kartu
    unset($p);
    //echo '<br/>show info = '.$show_info.'<br/>';
    //echo 'n = '.$n.'<br/>';
    //echo 'settings 4 = '.$p['settings'][4].'<br/>';
    // takzhe, esli showinfo = 1, perehodjashemu chelu pokazatq info toj karty
    if ($show_info && !$n && $who == $LOGIN) {
        global $p;
        do_mysql("UPDATE gamesys SET life_regen = 0;");
        if ($p['settings'][4] == 1) {
            $lg = loc($loc_go, 'locinfo');
            // kartinki v locpics/(nazvanie karty).jpg
            $map = substr($loc_go, 0, 4);
            $mapi = gen_header($lg[1]);
            $mapi .= '<div class="y" id="adg"><b>' . $lg[1] . '</div>';
            if (file_exists('modules/locpics/' . $map . '.JPEG')) {
                $mapi .= '<p><img src="modules/locpics/' . $map . '.JPEG" alt="."/></p>';
            }
            // teperq infa
            // '/mapinfo/'.$map.'.mapi'
            if (file_exists('modules/mapinfo/' . $map . '.txt')) {
                $mapi .= '<p>';
                $mapi .= file_get_contents('modules/mapinfo/' . $map . '.txt');
                $mapi .= '</p>';
            } else {
                $mapi .= '<p>нет информации</p>';
            }
            global $sid;
            $mapi .= '<p><a class="blue" href="game.php?sid=' . $sid . '">в игру</a></p>';
            $mapi .= gen_footer();
            exit($mapi);
        }
    }
}
         $to = $inb[$i]['fullname'];
     } else {
         continue;
     }
 }
 if (!$to) {
     continue;
 }
 if (substr($to, 0, 2) == 'n.') {
     include_once 'modules/f_get_npc_info.php';
     $op = get_npc_info($to, 'all');
     $npc_har = get_npc_battle_har($to);
     $lvl = round($op['exp'] / 20);
 } elseif (is_player($to)) {
     include_once 'modules/f_get_pl_info.php';
     $op = get_pl_info($to, 'all');
     $npc_har = get_pl_battle_har($to);
     $lvl = $op['stats'][0];
 }
 if ($op['location'] != $p['location']) {
     include 'modules/f_end_battle.php';
     end_battle($LOGIN);
     continue;
 }
 $md = $lvl - $p['stats'][0];
 if ($md < -1) {
     $clr = '#696969';
 } else {
     if ($md == -1) {
         $clr = '#31F3F5';
     } else {
function make_die($who)
{
    // $who = preg_replace ('/[^a-z\._0-9]/i', '', $who);
    $id = is_npc($who);
    $n = 0;
    if ($id) {
        $n = 1;
        $q = do_mysql("SELECT name FROM npc WHERE id_npc = '" . $id . "';");
        $name = mysql_result($q, 0);
        $q = do_mysql("SELECT location FROM npc WHERE id_npc = '" . $id . "';");
    } else {
        $id = is_player($who);
        if (!$id) {
            return 0;
        }
        $q = do_mysql("SELECT name FROM players WHERE id_player = '" . $id . "';");
        $name = mysql_result($q, 0);
        $q = do_mysql("SELECT location FROM players WHERE id_player = '" . $id . "';");
    }
    $loc_who = mysql_result($q, 0);
    add_journal($name . ' погиб', 'l.' . $loc_who);
    // dlja kazhdogo po raznomu
    include_once 'modules/f_end_battle.php';
    // okonchitq bitvu
    end_battle($who);
    if (!$n) {
        $p = get_pl_info($who, 'all');
        // sozdatq trup:
        include_once 'modules/f_create_dead_body.php';
        create_dead_body($who);
        // takzhe vypadut i veshi v trup
        //===========================================
        //if ($p['rase'] == 1 && $p['qlvl'] < 10) $loc = 'rele|2x11';  // ostavim do luchshih vremen
        //if ($p['rase'] == 2 && $p['qlvl'] < 10) $loc = 'epf1|4x1';
        //if ($p['rase'] == 3 && $p['qlvl'] < 10) $loc = 'nvsh|5x1';
        if ($p['qlvl'] == 0) {
            $loc = 'novc|1x1';
        } else {
            $loc = 'rele|2x11';
        }
        if ($p['karma'] < -99) {
            $loc = 'pris|1x1';
        }
        //===========================================
        /* potom ostalqnye */
        // statusy vernem na normalqnyj urovenq
        $p['status1'] = '01000';
        // zhiznq 10:
        if ($p['qlvl'] > 0) {
            $life = '10|' . $p['life'][1];
        } else {
            $life = $p['life'][1] . '|' . $p['life'][1];
        }
        do_mysql("UPDATE players SET status1 = '" . $p['status1'] . "', life = '" . $life . "' WHERE id_player = '" . $id . "';");
        include_once 'modules/f_teleport.php';
        teleport($who, $loc);
    } else {
        include_once 'modules/f_real_name.php';
        // sozdatq trup:
        include_once 'modules/f_create_dead_body.php';
        create_dead_body($who);
        // takzhe vypadut i veshi v trup
        // udalitq nafig
        do_mysql("DELETE FROM npc WHERE id_npc = '" . $id . "';");
        $rfn = real_name($who);
        global $pl_map;
        include 'modules/mapinfo/load_' . $pl_map . '.php';
        //print_r ($npc);
        //echo '<br/>'.$rfn;
        if (!isset($npc)) {
            return 1;
        }
        if (array_key_exists($rfn, $npc)) {
            //echo "exists";
            // $npc podkljuchen v faile s_loadmaps.php
            // znachit nado vernutq
            $time = time();
            $time += 300;
            $nacti = 'npc|' . $rfn . '|' . $time;
            $act = do_mysql("SELECT actions FROM maps WHERE map = '" . $pl_map . "';");
            $act = mysql_result($act, 0);
            //echo '<br/>act = '.$act.'<br/>';
            $subc = substr_count($act, $rfn);
            $itmp = explode(':', $npc[$rfn]);
            if ($itmp[2] > $subc) {
                if (!$act) {
                    $act = $nacti;
                } else {
                    $act .= '~' . $nacti;
                }
                //echo 'act = '.$act.'<br/>';
                do_mysql("UPDATE maps SET actions = '" . $act . "' WHERE map = '" . $pl_map . "';");
            }
        }
    }
}