function exit_from_craft($add_query = '', $exit = 1, $userid = 0, $block = 0) { global $user_id; if ($userid == 0) { $userid = $user_id; } if ($exit == 1) { craft_DelFunc($userid); myquery("delete from craft_build_rab where user_id={$userid}"); myquery("delete from craft_user_func where user_id={$userid}"); } else { myquery("update craft_build_rab set date_rab=0,dlit=0,eliksir=0,`add`=0 where user_id={$userid}"); } /*myquery("update craft_build_lumberjack set user_id=0, end_time=0 where user_id=$userid"); myquery("update craft_build_stonemason set user_id=0, end_time=0 where user_id=$userid"); myquery("update craft_build_lumberjack set reserve_user_id=0, reserve_time=0 where reserve_user_id=$userid"); myquery("update craft_build_stonemason set reserve_user_id=0, reserve_time=0 where reserve_user_id=$userid");*/ myquery("update craft_build_mining set user_id=0, end_time=0 where user_id={$userid}"); if ($add_query != '') { $str_query = "update game_users set user_id={$userid}"; $str_query .= $add_query; $str_query .= ' where user_id=' . $userid; myquery($str_query); } if ($exit == 1) { set_craft_delay($userid, $block); ForceFunc($userid, 5); } }
function exit_quest() { global $user_id; ForceFunc($user_id, 5); ?> <meta http-equiv="refresh" content="10"> <?php }
function arcomage_user($char, $player, $money) { global $user_id; $id = $player['user_id']; list($map_id) = mysql_fetch_array(myquery("SELECT map_name FROM game_users_map WHERE user_id={$id}")); $map = mysql_fetch_array(myquery("SELECT * FROM game_maps WHERE id={$map_id}")); if ($map['name'] == 'Арена Хаоса') { return ''; } if ($map['dolina'] == 1) { return ''; } list($map_id) = mysql_fetch_array(myquery("SELECT map_name FROM game_users_map WHERE user_id={$user_id}")); $map = mysql_fetch_array(myquery("SELECT * FROM game_maps WHERE id={$map_id}")); if ($map['name'] == 'Арена Хаоса') { return ''; } if ($map['dolina'] == 1) { return ''; } if (played_arco($player['user_id']) != 0) { //нельзя нападать на игроков в две башни return 'Игрок играет в Две Башни'; } $r = mt_rand(1, 5); if ($r == 1) { $tower_win = 50; $resource_win = 150; $tower = 10; $wall = 5; $bricks = 10; $gems = 10; $monsters = 10; $bricks_add = 2; $gems_add = 2; $monsters_add = 2; } elseif ($r == 2) { $tower_win = 100; $resource_win = 100; $tower = 20; $wall = 15; $bricks = 15; $gems = 15; $monsters = 15; $bricks_add = 1; $gems_add = 1; $monsters_add = 1; } elseif ($r == 3) { $tower_win = 150; $resource_win = 250; $tower = 30; $wall = 20; $bricks = 20; $gems = 20; $monsters = 20; $bricks_add = 5; $gems_add = 5; $monsters_add = 5; } elseif ($r == 4) { $tower_win = 100; $resource_win = 300; $tower = 20; $wall = 10; $bricks = 20; $gems = 20; $monsters = 20; $bricks_add = 3; $gems_add = 3; $monsters_add = 3; } else { $tower_win = 200; $resource_win = 150; $tower = 20; $wall = 20; $bricks = 20; $gems = 20; $monsters = 20; $bricks_add = 2; $gems_add = 2; $monsters_add = 2; } $nachalo = time(); myquery("DELETE FROM arcomage_call WHERE user_id='{$user_id}'"); myquery("DELETE FROM arcomage_call WHERE user_id='{$id}'"); $ins = myquery("insert into arcomage (hod,tower_win,resource_win,money,timehod,user1, user1_name, user2, user2_name) values (1,'{$tower_win}','{$resource_win}','{$money}', {$nachalo}, {$user_id}, '" . $char['name'] . "', {$id}, '" . $player['name'] . "')"); $uid = mysql_insert_id(); myquery("DELETE FROM arcomage_users WHERE user_id='{$user_id}'"); myquery("DELETE FROM arcomage_users_cards WHERE user_id='{$user_id}'"); $ins = myquery("insert into arcomage_users (arcomage_id,user_id,tower,wall,bricks,gems,monsters,bricks_add,gems_add,monsters_add,func,hod) values ('{$uid}','{$user_id}','{$tower}','{$wall}','{$bricks}','{$gems}','{$monsters}','{$bricks_add}','{$gems_add}','{$monsters_add}','6',{$nachalo})"); $is = mysql_insert_id(); $charboy = mysql_fetch_array(myquery("SELECT * FROM arcomage_users WHERE id='{$is}'")); for ($n = 1; $n <= 5; $n++) { $new_card = get_new_card($charboy, 0); $ins = myquery("insert into arcomage_users_cards (arcomage_id,user_id,card_id) values ('{$uid}','{$user_id}','{$new_card}')"); } myquery("DELETE FROM arcomage_users WHERE user_id='{$id}'"); myquery("DELETE FROM arcomage_users_cards WHERE user_id='{$id}'"); $ins = myquery("insert into arcomage_users (arcomage_id,user_id,tower,wall,bricks,gems,monsters,bricks_add,gems_add,monsters_add,func,hod) values ('{$uid}','{$id}','{$tower}','{$wall}','{$bricks}','{$gems}','{$monsters}','{$bricks_add}','{$gems_add}','{$monsters_add}','7',{$nachalo})"); $is = mysql_insert_id(); $charboy = mysql_fetch_array(myquery("SELECT * FROM arcomage_users WHERE id='{$is}'")); for ($n = 1; $n <= 5; $n++) { $new_card = get_new_card($charboy, 0); $ins = myquery("insert into arcomage_users_cards (arcomage_id,user_id,card_id) values ('{$uid}','{$id}','{$new_card}')"); } set_delay_reason_id($user_id, 10); set_delay_reason_id($id, 10); // Пробный setLocation("arcomage.php"); // Попробуем так забросить противника в бой. Тут есть потенциальные проблемы. // Т.к. точно ли мы уверены, что игрок находится в тех режимах, из которых можно выйти в бой. А мы его форсируем. ForceFunc($id, 4); return ''; }
} break; } $add_query = ""; if ($fault == 0) { if (domain_name == 'testing.rpg.su' or domain_name == 'localhost') { $dlit = 5; } else { $dlit = max(120, 600 - getCraftLevel($user_id, 10) * 20); } craft_setFunc($user_id, 10); set_delay_reason_id($user_id, 34); $build_id = 'founder'; myquery("DELETE FROM craft_build_rab WHERE user_id={$user_id}"); myquery("INSERT INTO craft_build_rab (user_id,build_id,date_rab,dlit) VALUES ({$user_id},'{$build_id}'," . time() . ",{$dlit})"); ForceFunc($user_id, func_craft); setLocation("../craft.php"); } else { $mes = 'Неудача, ты неправильно ' . echo_sex('сбалансировал', 'сбалансировала') . ' тепло печи или насыщенность состава, все материалы потрачены впустую.'; myquery("UPDATE craft_build_founder SET state=0,nas=0,teplo=0,res_id=0,col_res=0,col_coal=0,col_water=0 WHERE user_id={$user_id}"); if (domain_name == 'localhost') { $option = 19; } else { $option = 18; } $url = 'town.php?option=' . $option . '&part4&add=18&mes=' . $mes; setLocation($url); exit_from_craft($add_query, 1); } } else { echo 'Ты не можешь начать работу на плавильне, так как введён неверный код!<br><br><br><br>';
<IMG SRC="http://<?php echo img_domain; ?> /shops/shop/it_47.jpg" WIDTH=56 HEIGHT=69 ALT=""></TD> <TD> <IMG SRC="http://<?php echo img_domain; ?> /shops/shop/it_48.jpg" WIDTH=135 HEIGHT=69 ALT=""></TD> <TD> <IMG SRC="http://<?php echo img_domain; ?> /shops/shop/it_49.jpg" WIDTH=46 HEIGHT=69 ALT=""></TD> </TR> </TABLE> <?php set_delay_reason_id($user_id, 3); ForceFunc($user_id, 3); } else { echo 'На этой гексе нет торговцев'; } show_debug($char['name']); ?> </BODY> </HTML> <?php mysql_close(); if (function_exists("save_debug")) { save_debug(); }
private function del_combat_user() { //удаляет признак о переводе игрока на скрипт боя, чтобы при след.обновлении экрана игрока перекидывало бы на act.php combat_delFunc($this->char['user_id']); ForceFunc($this->char['user_id'], 5); }
if (substr_count($data, $ch) > 0) { $_SESSION['use'][$i][$j] = 1; } } } } OpenTable('title'); echo '<p align=left>'; //выход в СЗ if (isset($exit_puzzle)) { //../../main.php?func=main if (isset($_SESSION['sud'])) { unset($_SESSION['sud']); } //myquery("update game_users set func='',hod=0,delay_reason='Игра' where user_id=".$user_id.""); ForceFunc($user_id, 5); set_delay_reason_id($user_id, 1); echo '<script>location.replace("../../act.php?func=main")</script>'; //top.window.frames.game. echo '</p>'; OpenTable('close'); exit; } //elseif($char['func']!='qengine_puzzle') //myquery("update game_users set func='qengine_puzzle',hod=0,delay_reason='Решает головоломку' where user_id=".$user_id.""); $quest = mysql_fetch_array(myquery("SELECT * FROM quest_engine_users WHERE user_id='{$user_id}' AND quest_type=601 AND par1_value=" . $char['map_name'] . " AND par2_value=" . $char['map_xpos'] . " AND par3_value=" . $char['map_ypos'] . "")); //если задание уже выполнено if ($quest['done'] == 1 or $quest['done'] == 2) { QuoteTable('open'); echo '<div align=center><font color=red size=4>Здесь ничего нет.</font></div>'; QuoteTable('close');
function combat_insert($char = 0, $user_id = 0, $combat_id, $type, $side, $hod = 1, $join = 0, $svit = 0, $k_komu = 0, $k_map_exp = 1, $k_map_gp = 1, $skill = 0, $func = 5, $delay, $no_rejoin = 0, $full_stats = 0) { if ($char == 0 and $user_id == 0) { return 0; } if ($char == 0) { $check_user = myquery("SELECT * FROM game_users WHERE user_id=" . $user_id . ""); if (mysql_num_rows($check_user) > 0) { $char = mysql_fetch_array($check_user); } else { $char = mysql_fetch_array(myquery("SELECT * FROM game_users_archive WHERE user_id=" . $user_id . "")); } } $user_id = $char['user_id']; $injury = ceil($char['injury'] / 13); //Определим травму игрока list($pol) = mysql_fetch_array(myquery("SELECT sex FROM game_users_data WHERE user_id=" . $user_id . "")); if ($skill == 0) { $skill = take_skills($user_id); } myquery("DELETE FROM combat_users WHERE user_id=" . $user_id . ""); myquery("DELETE FROM combat_users_exp WHERE user_id=" . $user_id . ""); //Восстановим жизни, ману, энергию, если надо if ($full_stats == 1) { $char['HP'] = $char['HP_MAX']; $char['MP'] = $char['MP_MAX']; $char['STM'] = $char['STM_MAX']; } $k_exp = skill_exp_effect($skill['MS_EXP'], $type) * $k_map_exp; $k_gp = skill_gp_effect($skill['MS_GP'], $type) * $k_map_gp; if ($svit > 0) { $k_exp = 0; if ($svit > 1) { $k_gp = 0; } } myquery("INSERT INTO combat_users (\n\t\tcombat_id,user_id,npc,time_last_active,name,clevel,reinc,side,\n\t\tHP,MP,STM,STR,DEX,SPD,VIT,NTL,PIE,HP_MAX,MP_MAX,STM_MAX,lucky,injury,\n\t\tk_komu,k_exp,k_gp,pol,avatar,sklon,race,clan_id,`join`,HP_start,hod_start,\n\t\tclass_type,class_level,MS_WEAPON,MS_KULAK,MS_PARIR,MS_ART,MS_LUK,MS_THROW,MS_BERSERK,MS_PRUDENCE,MS_VAMPIRE,MS_SPIKES,NPC_DEFENCE) \n\t\tVALUES (" . $combat_id . "," . $user_id . ",0," . time() . ",'" . $char['name'] . "'," . $char['clevel'] . "," . $char['reinc'] . "," . $side . ",\n\t\t" . $char['HP'] . "," . $char['MP'] . "," . $char['STM'] . "," . $char['STR'] . "," . $char['DEX'] . "," . $char['SPD'] . "," . $char['VIT'] . "," . $char['NTL'] . "," . $char['PIE'] . ",\t\t\t\n\t\t" . $char['HP_MAX'] . "," . $char['MP_MAX'] . "," . $char['STM_MAX'] . ",'" . $char['lucky'] . "','" . $injury . "',\n\t\t" . $k_komu . "," . $k_exp . "," . $k_gp . ",'" . $pol . "','" . $char['avatar'] . "','" . $char['sklon'] . "',\n\t\t'" . mysql_result(myquery("SELECT name FROM game_har WHERE id=" . $char['race'] . ""), 0, 0) . "'," . $char['clan_id'] . "," . $join . "," . $char['HP_MAX'] . ",'" . $hod . "',\n\t\t" . $skill['class_type'] . "," . $skill['class_level'] . "," . $skill['MS_WEAPON'] . "," . $skill['MS_KULAK'] . "," . $skill['MS_PARIR'] . "," . $skill['MS_ART'] . "," . $skill['MS_LUK'] . "," . $skill['MS_THROW'] . ",\n\t\t" . $skill['MS_BERSERK'] . "," . $skill['MS_PRUDENCE'] . "," . $skill['MS_VAMPIRE'] . "," . $skill['MS_SPIKES'] . "," . $skill['NPC_DEFENCE'] . ")\n\t\t"); combat_setFunc($user_id, $func, $combat_id); set_delay_reason_id($user_id, $delay); //Отработаем действие навыка "Паладин" if ($skill['PALADIN'] > 0) { $r = mt_rand(1, 100); if ($r <= $skill['PALADIN'] + 5) { if ($hod == 0) { $hod = 1; } $effect = $skill['PALADIN'] * 5; insert_fast_effect($user_id, $user_id, $combat_id, $hod + $join, 41, $effect); } } if ($no_rejoin == 1) { list($host) = mysql_fetch_array(myquery("SELECT host FROM game_users_active WHERE user_id=" . $user_id . "")); list($host_more) = mysql_fetch_array(myquery("SELECT host_more FROM game_users_active_host WHERE user_id=" . $user_id . "")); myquery("INSERT INTO combat_lose_user (combat_id,user_id,host,host_more) VALUES (" . $combat_id . "," . $user_id . "," . $host . ",'" . $host_more . "')"); } //Проверим - надо ли вести лог боя $check1 = 0; $check2 = 0; if ($hod == 1) { $check = myquery("SELECT * FROM combat_users WHERE npc=1 AND combat_id=" . $combat_id . ""); if (mysql_num_rows($check) == 0) { $check1 = 1; } } else { $check = myquery("SELECT * FROM game_combats_users WHERE boy=" . $combat_id . ""); if (mysql_num_rows($check) > 0) { $check2 = 1; } } if ($check1 == 1 or $check2 == 1) { myquery("INSERT INTO game_combats_users (boy, user_id, side) VALUES (" . $combat_id . ", " . $user_id . ", " . $side . ")"); } $sel_arco = myquery("SELECT * FROM arcomage_users WHERE user_id=" . $user_id . ""); if (mysql_num_rows($sel_arco) > 0) { $arco = mysql_fetch_array($sel_arco); myquery("DELETE FROM arcomage WHERE id='" . $arco['arcomage_id'] . "'"); myquery("DELETE FROM arcomage_users_cards WHERE arcomage_id='" . $arco['arcomage_id'] . "'"); myquery("DELETE FROM arcomage_history WHERE arcomage_id='" . $arco['arcomage_id'] . "'"); myquery("DELETE FROM arcomage_users WHERE arcomage_id='" . $arco['arcomage_id'] . "'"); } myquery("DELETE FROM arcomage_call WHERE user_id=" . $user_id . ""); ForceFunc($user_id, 1); }
$ress = mysql_fetch_array(myquery("SELECT * FROM craft_resource WHERE id=" . $eliksir[$i]['resource'][$j]['id'] . "")); list($kol) = mysql_fetch_array(myquery("SELECT col FROM craft_resource_user WHERE user_id={$user_id} AND res_id=" . $eliksir[$i]['resource'][$j]['id'] . "")); $change_weight = $change_weight + $eliksir[$i]['resource'][$j]['kol'] * $ress['weight']; if ($kol > $eliksir[$i]['resource'][$j]['kol']) { myquery("UPDATE craft_resource_user SET col=GREATEST(0,col-" . $eliksir[$i]['resource'][$j]['kol'] . ") WHERE user_id={$user_id} AND res_id=" . $eliksir[$i]['resource'][$j]['id'] . ""); } else { myquery("DELETE FROM craft_resource_user WHERE user_id={$user_id} AND res_id=" . $eliksir[$i]['resource'][$j]['id'] . ""); } } if (!$from_house) { myquery("UPDATE game_users SET CW=CW-{$change_weight}-" . $gp * money_weight . ",GP=GP-{$gp} WHERE user_id={$user_id}"); setGP($user_id, -$gp, 66); } else { myquery("UPDATE game_users SET CW=CW-{$change_weight} WHERE user_id={$user_id}"); } ForceFunc($user_id, 2); if (!$from_house) { setLocation("../craft.php"); } else { echo '<script>top.window.frames.game.location.replace("../craft.php?house");</script>'; } } else { echo 'Ты не можешь сварить это зелье!<br><br><br><br>'; if (!$from_house) { echo '<a href="../act.php" target="game">Выйти из Лаборатории</a>'; } } } else { echo 'Для начала работы введи указанный ниже код <br>и нажми кнопку "Начать варку зелий"<br>'; echo '<br><img src="../captcha_new/index.php?' . time() . '">'; echo '<form autocomplete="off" action="" method="POST" name="captcha"><br>