<?php // fail torgovli // imja veshi include_once 'modules/f_trade_param.php'; /////////////////////////////////////// // npc $npc = preg_replace('/[^a-z0-9:\\._]/i', '', $_GET['npc']); $nid = is_npc($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'; $tr = do_mysql("SELECT name, drop2, location FROM npc WHERE id_npc = '" . $nid . "';"); $tr = mysql_fetch_assoc($tr); if ($tr['location'] != $p['location']) { put_g_error('рядом твкого нету'); } $trade = explode('|', $tr['drop2']); /////////////////////////////////////// $show = 15; $f = gen_header('торг'); // osnovnaja if ($trade[0] == '*') { $trade[0] = '%'; } $q = do_mysql("SELECT COUNT(*) FROM items WHERE belongs = '" . $LOGIN . "' AND is_in = 'inv' AND type LIKE '" . $trade[0] . "';"); $c = mysql_result($q, 0); $c2 = count($torg);
} $count_i = mysql_result($q, 0); if ($count > $count_i) { $count = $count_i; } if (!$count) { $count = 1; } $iq = do_mysql("SELECT name FROM items WHERE fullname = '" . $item . "';"); $itname = mysql_result($iq, 0); include_once 'modules/f_add_item_to_loc.php'; // esli kidaetsja vse: if ($count == $count_i) { add_item_to_loc($p['location'], $item); } else { include_once 'modules/f_decrease_misc.php'; include_once 'modules/f_create_item_m.php'; include_once 'modules/f_real_name.php'; $rn = real_name($item); $nitem = create_item_m($rn, $count); decrease_misc($item, $count); add_item_to_loc($p['location'], $nitem); } if ($p['gender'] == 'male') { $vz = 'бросил'; } else { $vz = 'бросила'; } add_journal('<p>' . $p['name'] . ' ' . $vz . ' ' . $itname . ' (' . $count . ')</p>', 'l.' . $p['location']); $NO_CONTINUE = 1; include 'modules/s_journal.php';
$item = preg_replace('/[^a-z0-9\\._]/i', '', $item); require_once 'modules/f_take_item.php'; // ona sdelaet bolqshinstvo raboty $c = 1; if (isset($_GET['all'])) { // togda dan realname $q = do_mysql("SELECT fullname FROM items WHERE realname = '" . $item . "' AND location = '" . $p['location'] . "';"); while ($it = mysql_fetch_assoc($q)) { take_item($it['fullname'], $LOGIN); } $rfn = $item; } else { take_item($item, $LOGIN); // esli prodolzhaetsja znachit vzjali // nado zanesti v spisok ozhidanija veshej na pojavlenie $rfn = real_name($item); } //echo 'real name = '.$rfn.'<br/>'; 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); //echo '<br/>act = '.$act.'<br/>'; $subc = substr_count($act, $rfn); $itmp = explode(':', $items[$rfn]); if ($itmp[2] > $subc) { if (!$act) {
} if ($_GET['part'] == 2) { // teperq sobstvenno vse i delaem $scroll = preg_replace('/[^a-z0-9_\\.]/i', '', $_GET['to']); include_once 'modules/f_has_item.php'; if (!has_item($scroll, $LOGIN)) { put_error('netu etogo svitka'); } // proverim estq li u igroka pustoj svitok: include_once 'modules/f_has_count.php'; include_once 'modules/f_delete_count.php'; if (!has_count('i.q.que.scroll', 1, $LOGIN)) { put_g_error('при себе надо иметь пустой свиток для записи'); } // udaljaem - delete_count('i.q.que.scroll', 1, $LOGIN); // berem nazvanie svitka include_once 'modules/f_real_name.php'; $rn = real_name($scroll); // berem cebnu svitka $q = do_mysql("SELECT price FROM items WHERE fullname = '" . $scroll . "';"); $price = mysql_result($q, 0); if (rand(0, $price / 10) <= $p['skills'][30]) { // sozdaem svitok include_once 'modules/f_gain_item.php'; gain_item($rn, 1, $LOGIN); add_journal('вы скопировали свиток', $LOGIN); } else { add_journal('вы испортили пустой свиток', $LOGIN); } }
$rec['i.f.tra.chistotel.i.f.tra.chistec'] = 'i.f.dri.nor.kok_mojd'; $rec['i.f.tra.mak_opiumnyj.i.f.tra.len'] = 'i.f.dri.alc.opiuml'; $rec['i.f.tra.anis.i.f.tra.akonit_protivojadnyj'] = 'i.f.dri.nor.protivojadie'; $rec['i.f.tra.nezabudka_lesnaja.i.f.tra.mjata'] = 'i.f.dri.nor.unfsvezh'; $rec['i.f.tra.djavesil.i.f.tra.shipovnik_sobachij'] = 'i.f.dri.nor.tea_terap'; $rec['i.f.tra.goroshek_myshinyj.i.f.tra.ogurec_posevnoj'] = 'i.f.dri.nor.goblinskoe_zelqe'; $rec['i.f.tra.mak_opiumnyj.i.f.tra.jachmenq'] = 'i.f.dri.alc.pivo_lsd'; $rec['i.f.tra.len.i.f.tra.klever_lugovoj'] = 'i.f.dri.nor.tin_burn'; $rec['i.f.tra.gorec_vqjuwijsja.i.f.tra.jesparcet_peschanyj'] = 'i.f.dri.nor.tea_wisdom'; $rec['i.f.tra.ukrop.i.f.tra.cikorij'] = 'i.f.dri.nor.mix'; $rec['i.f.tra.zaraziha_belaja.i.f.tra.zhivuchka_polzuchaja'] = 'i.f.dri.nor.tea_hren'; $rec['i.f.tra.valeriana.i.f.tra.mak_opiumnyj'] = 'i.f.dri.nor.otv_moon'; // teperq vyberaem, kak varitq budem - po receptu, ili himija include_once 'modules/f_real_name.php'; $rtra1 = real_name($tra1); $rtra2 = real_name($tra2); // imeetsja li trava v nuizhnom kolichestve dlja takoj butyli. $c = $wat['on_take']; include_once 'modules/f_has_count.php'; if (!has_count($rtra1, $c, $LOGIN) || !has_count($rtra2, $c, $LOGIN)) { put_g_error('нехватает трав для получения отвара используя столько много воды. На одну порцию надо две травы (по одной разной)'); } // berem harakteristiku travy $q = do_mysql("SELECT on_use FROM items WHERE fullname = '" . $tra1 . "';"); $tra1_i = mysql_result($q, 0); $tra1_i = explode('~', $tra1_i); $q = do_mysql("SELECT on_use FROM items WHERE fullname = '" . $tra2 . "';"); $tra2_i = mysql_result($q, 0); $tra2_i = explode('~', $tra2_i); $tn = $rtra1 . '.' . $rtra2; $mult;
exit_msg('кострище', $f); } else { $to = mysql_real_escape_string(strip_tags($_GET['to'])); if (substr($to, 0, 12) != 'i.f.foo.raw_' && substr($to, 0, 12) != 'i.f.foo.fish') { put_g_error('Жарить можно сырую рыбу и мясо. ты та что суешь?'); } // v ostalqnyh sluchajah zharim // berem ves veshi - include_once 'modules/f_get_weight.php'; $wgh = get_weight($to); // udaljaem syrqe include_once 'modules/f_delete_item.php'; delete_item($to); // smotrim che eto takoe bylo - include_once 'modules/f_real_name.php'; $to = real_name($to); // dalee, berem shans prigotovitq // on raven 100 - ves * 10 + navyk * 10. // esli ves > 30, on raven navyku prigotovlenija // esli navyk 0, shans 0 $chanse = 0; if ($wgh < 30) { $chanse = 100 - $wgh * 10 + $p['skills'][37] * 10; } else { $chanse = $p['skills'][37]; } if (!$p['skills'][37]) { $chanse = 0; } // proverjaem vyshlo li prigotovitq - if (rand(0, 100) <= $chanse) {
<?php // fail razgovora npc // proverjaem, estq li fail ragovora $npc = preg_replace('/[^a-z0-9\\._]/i', '', $_GET['npc']); if (!isset($_GET['part'])) { $part = 'start'; } else { $part = preg_replace('/[^a-z0-9_]/i', '', $_GET['part']); } $nid = is_npc($npc); $q = do_mysql("SELECT COUNT(*) FROM npc WHERE id_npc = '" . $nid . "' AND location = '" . $p['location'] . "' AND type = 's';"); if (!mysql_num_rows($q)) { put_g_error('с вами рядом такого нет!'); } include_once 'modules/f_real_name.php'; $rnpc = real_name($npc); $fn = str_replace('.', '_', $rnpc); if (substr($npc, 2, 1) == 't') { if (!file_exists('modules/npc/t/sf_' . $fn . '.php')) { include 'modules/s_trade.php'; } include 'modules/npc/t/sf_' . $fn . '.php'; } else { if (!file_exists('modules/npc/s/sf_' . $fn . '.php')) { put_error('файла разговора ' . $fn . ' не найденно'); } include 'modules/npc/s/sf_' . $fn . '.php'; } //-------------------- // kvest esli estq $q = do_mysql("SELECT quest FROM npc WHERE id_npc = '" . $nid . "';");
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 . "';"); } } } }
function impl_msg_handler_by_name($file, $vars, $Class) { fwrite($file, ENTER); foreach ($vars as $name => $type) { // $ctrl_type = soui_control_type($type); $var_name = camel_case(real_name($name, $type)); if ($type == 'button') { $func_name = "On" . $var_name . "Click"; $func = make_function_no_param($func_name, $Class); fwrite($file, ENTER . "{$func}" . ENTER); fwrite($file, "{" . ENTER); fwrite($file, "}" . ENTER); } else { if ($type == 'combobox') { $func_name = "On" . $var_name . "SelChanged"; $func = make_function($func_name, "SOUI::EventArgs *pEvt", $Class); fwrite($file, ENTER . "{$func}" . ENTER); fwrite($file, "{" . ENTER); fwrite($file, TAB . "if(!isLayoutInited()) return;" . ENTER); fwrite($file, TAB . "EventCBSelChange* pEvtOfCB = (EventCBSelChange*)pEvt;" . ENTER); fwrite($file, TAB . "if(pEvtOfCB == 0) return;" . ENTER); fwrite($file, TAB . "int nCurSel = pEvtOfCB->nCurSel;" . ENTER); fwrite($file, TAB . "if(nCurSel == -1) return;" . TWO_ENTER); fwrite($file, TAB . "// do something" . ENTER); fwrite($file, "}" . ENTER); } else { if ($type == 'listbox') { $func_name = "On" . $var_name . "SelChanged"; $func = make_function($func_name, "SOUI::EventArgs *pEvt", $Class); fwrite($file, ENTER . "{$func}" . ENTER); fwrite($file, "{" . ENTER); fwrite($file, TAB . "if(!isLayoutInited()) return;" . ENTER); fwrite($file, TAB . "EventLBSelChanged* pEvtOfLB = (EventLBSelChanged*)pEvt;" . ENTER); fwrite($file, TAB . "if(pEvtOfLB == 0) return;" . ENTER); fwrite($file, TAB . "int nCurSel = pEvtOfLB->nNewSel;" . ENTER); fwrite($file, TAB . "if(nCurSel == -1) return;" . TWO_ENTER); fwrite($file, TAB . "// do something" . ENTER); fwrite($file, "}" . ENTER); } } } } }