Фиксы запросов

This commit is contained in:
lopar 2018-02-27 04:48:51 +02:00
parent d37c2eeb87
commit 6c31594e9b
3 changed files with 123 additions and 267 deletions

View File

@ -2,7 +2,7 @@
class fbattle class fbattle
{ {
var $status = integer; var $status = 0;
var $battle = array(); var $battle = array();
var $battle_data = array(); var $battle_data = array();
var $enemy = null; var $enemy = null;
@ -40,7 +40,7 @@ class fbattle
function fbattle($battle_id) function fbattle($battle_id)
{ {
global $mysql, $user, $_POST, $cavedata, $caverooms, $user, $cavebots, $party; global $mysql, $user, $_POST, $cavedata, $caverooms, $cavebots, $party;
// соединяем мускуль и юзера // соединяем мускуль и юзера
$this->mysql = $mysql; $this->mysql = $mysql;
$this->user = $user; $this->user = $user;
@ -123,10 +123,8 @@ class fbattle
if ($_POST['enemy'] > 0) { if ($_POST['enemy'] > 0) {
// ударяемся // ударяемся
$this->razmen_init($_POST['enemy'], $_POST['attack'], $_POST['defend']); $this->razmen_init($_POST['enemy'], $_POST['attack'], $_POST['defend']);
// header ("Location:main.php");
} }
if (isset($_GET['smena'], $_POST['smena'])) { if (isset($_GET['smena'], $_POST['smena'])) {
$sm = mysql_fetch_array(mysql_query('SELECT `id`, `login`, `battle`, `bot`, `hp` FROM `users` WHERE `login` = "' . mysql_real_escape_string($_POST['smena']) . '" AND `battle` = "' . $user['battle'] . '" AND `hp` > 0 LIMIT 1')); $sm = mysql_fetch_array(mysql_query('SELECT `id`, `login`, `battle`, `bot`, `hp` FROM `users` WHERE `login` = "' . mysql_real_escape_string($_POST['smena']) . '" AND `battle` = "' . $user['battle'] . '" AND `hp` > 0 LIMIT 1'));
if (isset($sm['id'])) { if (isset($sm['id'])) {
@ -662,28 +660,15 @@ class fbattle
$this->user_dress[8] += $bmfbron; $this->user_dress[8] += $bmfbron;
$this->user_dress[9] += $bmfbron; $this->user_dress[9] += $bmfbron;
//print_r($this->user);
//print_r($this->enemyhar);
// мои МФ в отношении противника
//mt_srand(microtime());
$mykrit = $this->user_dress[2] + $this->user['inta'] * 2.95 + $bmfkrit; $mykrit = $this->user_dress[2] + $this->user['inta'] * 2.95 + $bmfkrit;
//if($mykrit < 1) { $mykrit = 1; } elseif ($mykrit > 50) { $mykrit = 50; }
$heakrit = ($this->enemy_dress[3] + $this->enemyhar['inta'] * 2.75 + $this->enemyhar['lovk']) * 0 + $bmfakrit1; $heakrit = ($this->enemy_dress[3] + $this->enemyhar['inta'] * 2.75 + $this->enemyhar['lovk']) * 0 + $bmfakrit1;
//if($heakrit < 1) { $heakrit = 1; } elseif ($heakrit > 50) { $heakrit = 50; }
$myuvorot = $this->user_dress[4] + $this->user['lovk'] * 5 + $bmfuv; $myuvorot = $this->user_dress[4] + $this->user['lovk'] * 5 + $bmfuv;
//if($myuvorot < 1) { $myuvorot = 1; } elseif ($myuvorot > 50) { $myuvorot = 50; }
$heauvorot = $this->enemy_dress[5] + $this->enemyhar['lovk'] * 4 + $this->enemyhar['inta'] * 1.35 + $bmfauv1; $heauvorot = $this->enemy_dress[5] + $this->enemyhar['lovk'] * 4 + $this->enemyhar['inta'] * 1.35 + $bmfauv1;
//if($heauvorot < 1) { $heauvorot = 1; } elseif ($heauvorot > 50) { $heauvorot = 50; }
$mf['me'] = array( $mf['me'] = array(
'udar' => rand(floor($this->user['sila'] / 3) + 1 + $this->user_dress[0], floor($this->user['sila'] / 3) + 5 + $this->user_dress[1]) - mt_rand(0, $this->enemy_dress[5 + $myattack] / 1.25), 'udar' => rand(floor($this->user['sila'] / 3) + 1 + $this->user_dress[0], floor($this->user['sila'] / 3) + 5 + $this->user_dress[1]) - mt_rand(0, $this->enemy_dress[5 + $myattack] / 1.25),
//'krit' => (0-$this->enemy_dress[3]-floor($this->enemyhar['inta']*4)+$this->user_dress[2]+floor($this->user['inta']*4)), 'krit' => $mykrit / $heakrit * 100 - 100,
//'uvorot' => (0-$this->enemy_dress[5]-floor($this->enemyhar['lovk']*4)+$this->user_dress[4]+floor($this->user['lovk']*4)), 'uvorot' => $myuvorot / $heauvorot * 100 - 100
'krit' => $mykrit / $heakrit * 100 - 100, //(1-($heakrit+70)/($mykrit+70))*70, //(1 - $heakrit/$mykrit)*100, //
'uvorot' => $myuvorot / $heauvorot * 100 - 100 //(1-($heauvorot+80)/($myuvorot+80))*53, //(1 - $heauvorot/$myuvorot)*0.8*100, //
); );
if ($mf['me']['udar'] < 1) { if ($mf['me']['udar'] < 1) {
$mf['me']['udar'] = 1; $mf['me']['udar'] = 1;
@ -769,43 +754,33 @@ class fbattle
return $mf; return $mf;
} }
/*-------------------------------------------------------------------
выставляем команды, и противников/союзников
--------------------------------------------------------------------*/
/**
* Получаем тип оружия
* @param $idwep
* @return string
*/
function get_wep_type($idwep) function get_wep_type($idwep)
{ {
if ($idwep == 0 || $idwep == null || $idwep == '') { $wep = db::c()->query('SELECT `otdel` FROM `inventory` WHERE `id` = ?i', $idwep)->fetch_assoc();
return "kulak"; switch ($wep['otdel']) {
case 1: return "noj"; break;
case 11: return "topor"; break;
case 12: return "dubina"; break;
case 13: return "mech"; break;
case 14: return "priklad"; break; //???
default: return "kulak"; break;
} }
$wep = mysql_fetch_array(mysql_query('SELECT `otdel`,`minu` FROM `inventory` WHERE `id` = ' . $idwep . ' LIMIT 1;'));
if ($wep[0] == '1') {
return "noj";
} elseif ($wep[0] == '12') {
return "dubina";
} elseif ($wep[0] == '11') {
return "topor";
} elseif ($wep[0] == '13') {
return "mech";
} elseif ($wep[0] == 14) {
return "priklad";
} elseif ($wep[1] > 0) {
return "buket";
} else {
return "kulak";
}
} }
/*------------------------------------------------------------------- /**
считаем опыт * Процентник 1d100. Передавать значения от 1 до 100.
--------------------------------------------------------------------*/ * @param $persent
* @return bool
*/
function get_chanse($persent) function get_chanse($persent)
{ {
//srand(microtime()); if (rand(1, 100) <= $persent ) {
$mm = 1000000;
if (rand($mm, 100 * $mm) <= $persent * $mm) {
return true; return true;
} else { } else {
return false; return false;
@ -819,8 +794,7 @@ class fbattle
function razmen_log($type, $kuda, $chem, $uron, $kto, $c1, $pokomy, $c2, $hp, $maxhp) function razmen_log($type, $kuda, $chem, $uron, $kto, $c1, $pokomy, $c2, $hp, $maxhp)
{ {
$this->write_stat(nick5($kto, $c1) . "|++|" . nick5($pokomy, $c2) . "|++|" . $type . "|++|" . $uron . "|++|" . $kuda . "|++|" . $chem); $this->write_stat(nick5($kto, $c1) . "|++|" . nick5($pokomy, $c2) . "|++|" . $type . "|++|" . $uron . "|++|" . $kuda . "|++|" . $chem);
//print_R(func_get_args());
//echo $this->user['login']."------------------<br>";
if ($this->enemyhar['sex'] && $kto == $this->enemyhar['id']) { if ($this->enemyhar['sex'] && $kto == $this->enemyhar['id']) {
$sex1 = false; $sex1 = false;
} }
@ -1016,8 +990,6 @@ class fbattle
'3' => array(3, 4), '3' => array(3, 4),
'4' => array(4, 1) '4' => array(4, 1)
); );
/* $this->write_stat_block(nick5($this->user['id'],$this->my_class)."|++|".implode('/',$blocks[$def]));
$this->write_stat_block(nick5($enemy,$this->en_class)."|++|".implode('/',$blocks[$this->battle[$enemy][$this->user['id']][1]]));*/
switch ($komy) { switch ($komy) {
case "me" : case "me" :
if (!in_array($this->battle[$enemy][$this->user['id']][0], $blocks[$def])) { if (!in_array($this->battle[$enemy][$this->user['id']][0], $blocks[$def])) {
@ -1583,7 +1555,7 @@ class fbattle
///////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////
include "darkness_quest.php"; include "../darkness_quest.php";
$this->exp[$v] = round($this->exp[$v]); $this->exp[$v] = round($this->exp[$v]);
$dop_exp = check_proc($this->user['id']); $dop_exp = check_proc($this->user['id']);
@ -1835,9 +1807,30 @@ class fbattle
function solve_exp($at_id, $def_id, $damage) function solve_exp($at_id, $def_id, $damage)
{ {
require_once('exp_koef.php'); $mods = [
$baseexp = array( "perv" => 1.7,
"kulon" => 1.5,
"haos" => 2,
"alignprot" => 1.5,
"kulakpenalty" => 0.5,
"bloodb" => 3,
"btl_1" => 1,
"btl_2" => 0.5,
"btl_3" => 0,
"krov_oop" => 0.2,
"krov_bitv" => 30,
"krov_op" => 1.15,
"krov_sech" => 150,
"krovs_op" => 1.4,
"velikaya" => 40,
"vel_op'" => 1.1,
"velichayshaya" => 90,
"velich_op'" => 1.15,
"epohalnaya" => 200,
"epoh_op" => 1.35,
];
$baseexp = [
"0" => "5", "0" => "5",
"1" => "10", "1" => "10",
"2" => "20", "2" => "20",
@ -1854,7 +1847,7 @@ class fbattle
"13" => "1300", "13" => "1300",
"14" => "1400", "14" => "1400",
"15" => "1500" "15" => "1500"
); ];
if ($at_id > _BOTSEPARATOR_) { if ($at_id > _BOTSEPARATOR_) {
$bots = mysql_fetch_array(mysql_query('SELECT * FROM `bots` WHERE `id` = ' . $at_id . ' LIMIT 1;')); $bots = mysql_fetch_array(mysql_query('SELECT * FROM `bots` WHERE `id` = ' . $at_id . ' LIMIT 1;'));
$at_id = $bots['prototype']; $at_id = $bots['prototype'];
@ -1875,7 +1868,7 @@ class fbattle
// модификаторы опыта // модификаторы опыта
// 100% опыта // 100% опыта
$expmf = 2; $expmf = 1;
// 200% опыта // 200% опыта
//$expmf = 2; //$expmf = 2;
@ -1916,15 +1909,11 @@ class fbattle
if ($at['level'] > 1 && $kulak1[0] == 0 && $kulak2[0] == 0) { if ($at['level'] > 1 && $kulak1[0] == 0 && $kulak2[0] == 0) {
$expmf = $expmf * $mods['kulakpenalty']; $expmf = $expmf * $mods['kulakpenalty'];
} }
//if($at['level'] > 1 && $at_cost[0] < $at['level']*50) {
// $expmf = $expmf*0.7;
// } elseif($at['level'] > 1) {
// $expmf = $expmf*1.3;
// }
if ($this->battle_data['blood']) { if ($this->battle_data['blood']) {
$expmf = $expmf * $mods['bloodb']; $expmf = $expmf * $mods['bloodb'];
} }
//$expmf = $expmf+($at_cost[0]/10000);
if ($this->battle_data['type'] == 1) { if ($this->battle_data['type'] == 1) {
$btfl = fopen('/tmpdisk/' . $at_id . '.btl', 'r'); $btfl = fopen('/tmpdisk/' . $at_id . '.btl', 'r');
$contents = fread($btfl, filesize('/tmpdisk/' . $at_id . '.btl')); $contents = fread($btfl, filesize('/tmpdisk/' . $at_id . '.btl'));
@ -1963,11 +1952,7 @@ class fbattle
$mfit = 1.5; $mfit = 1.5;
} }
/*if ($bot_active == true) { $pls = count($this->t1) + count($this->t2);
$this->exp[$at_id] += ($baseexp[$def['level']])*($def_cost[0]/(($at_cost[0]+$def_cost[0])/2))*($damage/$def['maxhp'])*$expmf*$mfit*0.3;
}*/
$pls = count($this->t1) + count($this->t2);
if ($pls > 2) { if ($pls > 2) {
$mfbot = $bot_active == true ? 0.3 : 1; $mfbot = $bot_active == true ? 0.3 : 1;
$mfbot2 = $bot_def == true ? 0.7 : 1; $mfbot2 = $bot_def == true ? 0.7 : 1;
@ -1977,8 +1962,6 @@ class fbattle
} }
$expmf = 1; $expmf = 1;
$expek = ($baseexp[$def['level']]) * ($def_cost[0] / (($at_cost[0] + $def_cost[0]) / 2)) * ($damage / $def['maxhp']) * $expmf * $mfit * $mfbot * $mfbot2; $expek = ($baseexp[$def['level']]) * ($def_cost[0] / (($at_cost[0] + $def_cost[0]) / 2)) * ($damage / $def['maxhp']) * $expmf * $mfit * $mfbot * $mfbot2;
#echo "<br>|$expek| [".$def['level']."]".($baseexp[$def['level']])."*(".$def_cost[0]."/((".$at_cost[0]."+".$def_cost[0].")/2))*($damage/".$def['maxhp'].")*$expmf*$mfit*$mfbot*$mfbot2<br>";
#die();
return $expek; return $expek;
} }

View File

@ -14,82 +14,31 @@ include('functions.php');
include('cave/cave_bots.php'); include('cave/cave_bots.php');
$cavebots = $botnames; $cavebots = $botnames;
mysql_query("LOCK TABLES `bots` WRITE, `laba_obj` WRITE, `qst_user` WRITE, `qst` WRITE, `` WRITE, `battle` WRITE, `logs` WRITE, `users` WRITE, `inventory` WRITE, `magic` WRITE, `effects` WRITE, `online` WRITE, `clans` WRITE, `variables` WRITE, `logs_arena` WRITE, `cavebots` WRITE, `caveparties` WRITE"); db::c()->query('LOCK TABLES `bots` WRITE, `laba_obj` WRITE, `qst_user` WRITE, `qst` WRITE, `` WRITE, `battle` WRITE, `logs` WRITE, `users` WRITE, `inventory` WRITE, `magic` WRITE, `effects` WRITE, `online` WRITE, `clans` WRITE, `variables` WRITE, `logs_arena` WRITE, `cavebots` WRITE, `caveparties` WRITE');
if (isset($user['id'])) { if (isset($user['id'])) {
mysql_query("UPDATE `online` SET `real_time` = '" . time() . "' WHERE `id` = '{$user['id']}' LIMIT 1"); db::c()->query('UPDATE `online` SET `real_time` = ?i WHERE `id` = ?i', time(), $user['id']);
} }
//include('./classes/battle_old.class.php');
include('./classes/battle_new.class.php'); include('./classes/battle_new.class.php');
$fbattle = new fbattle($user['battle']); $fbattle = new fbattle($user['battle']);
?> ?>
<html> <html>
<head> <head>
<link rel="stylesheet" type="text/css" href="css/main.css"/> <link rel="stylesheet" href="css/main.css">
<meta content="text/html; charset=utf-8" http-equiv="Content-type"/> <meta charset="utf-8">
<meta http-equiv="Cache-Control" content="no-cache"/>
<meta http-equiv="PRAGMA" content="NO-CACHE"/>
<meta http-equiv="Expires" content="0"/>
<script type="text/javascript" src="js/ZeroClipboard.js"></script> <script type="text/javascript" src="js/ZeroClipboard.js"></script>
<script type="text/javascript" src="js/sl2.js"></script> <script type="text/javascript" src="js/sl2.js"></script>
<script type="text/javascript" src="js/ch.js"></script> <script type="text/javascript" src="js/ch.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src="js/tooltip.js"></script> <script src="js/tooltip.js"></script>
<link rel="stylesheet" type="text/css" href="css/tooltip.css"/> <link rel="stylesheet" type="text/css" href="css/tooltip.css"/>
<script>
function ajaxFightRefresh() {
$.ajax({
url: '/fbattle.php?batl=' + $('#batl').val() + '&ajax=true',
cache: false,
type: "GET",
dataType: "html",
success: function (html) {
$('#fightContent').html(html);
}
});
}
function ajaxFightGo() {
var sendForm = {};
sendForm['enemy1'] = $('#enemy1').val();
sendForm['batl'] = $('#batl').val();
if ($('#fightType').val() == 1) {
sendForm['attack'] = $("input:radio:checked[name=attack]").val();
sendForm['defend'] = $("input:radio:checked[name=defend]").val();
sendForm['enemy'] = $('#enemy').val();
}
$.ajax({
url: '/fbattle.php?batl=' + $('#batl').val() + '&ajax=true',
cache: false,
type: "POST",
dataType: "html",
data: sendForm,
success: function (html) {
$('#fightContent').html(html);
if (document.forms["battleform"].go) {
document.forms["battleform"].go.focus();
}
if (document.forms["battleform"].battle) {
document.forms["battleform"].battle.focus();
}
if (document.forms["battleform"].end) {
document.forms["battleform"].end.focus();
}
return false;
}
});
return true;
}
</script>
<SCRIPT> <SCRIPT>
function refreshPeriodic() { function refreshPeriodic() {
<?if($fbattle->battle) { ?>location.href = '<?=$_SERVER['PHP_SELF']?>?batl=<?=$_REQUEST['batl']?>';//reload(); <?php if($fbattle->battle) { ?>location.href = '<?=$_SERVER['PHP_SELF']?>?batl=<?=$_REQUEST['batl']?>';//reload();
<?}?> <?}?>
timerID = setTimeout("refreshPeriodic()", 20000); var timerID = setTimeout("refreshPeriodic()", 20000);
} }
timerID = setTimeout("refreshPeriodic()", 20000); timerID = setTimeout("refreshPeriodic()", 20000);
</SCRIPT> </SCRIPT>
<script> <script>
@ -131,8 +80,8 @@ $fbattle = new fbattle($user['battle']);
} }
function refreshPeriodic() { function refreshPeriodic() {
<? if($fbattle->battle) { ?>location.href = '<?=$_SERVER['PHP_SELF']?>?batl=<?=$_REQUEST['batl']?>'; <? } ?> <?php if($fbattle->battle) { ?>location.href = '<?=$_SERVER['PHP_SELF']?>?batl=<?=$_REQUEST['batl']?>'; <? } ?>
timerID = setTimeout("refreshPeriodic()", 30000); var timerID = setTimeout("refreshPeriodic()", 30000);
} }
timerID = setTimeout("refreshPeriodic()", 30000); timerID = setTimeout("refreshPeriodic()", 30000);
@ -140,7 +89,7 @@ $fbattle = new fbattle($user['battle']);
function checksubmit() { function checksubmit() {
var ajaxload = 1; var ajaxload = 1;
if (ajaxload > 0) { if (ajaxload > 0) {
var enemy = <? echo $fbattle->enemy; ?>; var enemy = <?=$fbattle->enemy;?>;
var batl = <?=($user['battle'] ? $user['battle'] : $_REQUEST['batl'])?>; var batl = <?=($user['battle'] ? $user['battle'] : $_REQUEST['batl'])?>;
var tac_at = $('input[name=attack]:checked').val(); var tac_at = $('input[name=attack]:checked').val();
var att = "&attack=" + $('input[name=attack]:checked').val(); var att = "&attack=" + $('input[name=attack]:checked').val();
@ -165,36 +114,6 @@ $fbattle = new fbattle($user['battle']);
} }
} }
function checksubmit_vip() {
var ajaxload = 1;
if (ajaxload > 0) {
var enemy = <? echo $fbattle->enemy; ?>;
var batl = <?=($user['battle'] ? $user['battle'] : $_REQUEST['batl'])?>;
var tac_at = <? echo mt_rand(1, 4); ?>;
var att = "&attack=" + tac_at + "";
var def = <? echo mt_rand(1, 4); ?>;
$("#A" + tac_at + "").attr("checked", "checked");
$("#D" + def + "").attr("checked", "checked");
if (tac_at > 0 && def > 0) {
$.ajax({
url: "fbattle.php",
type: "POST",
cache: false,
data: "batl=" + batl + "&myid=" + batl + att + "&defend=" + def + "&enemy=" + enemy + "",
success: function (html) {
$("body").html(html);
}
});
} else {
alert('Var error #1');
$("#at").prop("disabled", false);
}
} else {
document.f1.submit();
}
}
$("document").ready(function () { $("document").ready(function () {
$('#refresh').click(function () { $('#refresh').click(function () {
$.ajax({ $.ajax({
@ -209,66 +128,15 @@ $fbattle = new fbattle($user['battle']);
}); });
</script> </script>
<style type="text/css"> <style type="text/css">
.menu {
background-color: #d2d0d0;
border-color: #ffffff #626060 #626060 #ffffff;
border-style: solid;
border-width: 1px;
position: absolute;
left: 0px;
top: 0px;
visibility: hidden;
}
a.menuItem {
border: 0px solid #000000;
color: #003388;
display: block;
font-family: MS Sans Serif, Arial, Tahoma, sans-serif;
font-size: 8pt;
font-weight: bold;
padding: 2px 12px 2px 8px;
text-decoration: none;
}
a.menuItem:hover {
background-color: #a2a2a2;
color: #0066FF;
}
span { span {
font-family: Verdana, Arial, Helvetica, Tahoma, sans-serif; font-family: Verdana, Arial, Helvetica, Tahoma, sans-serif;
text-decoration: none; text-decoration: none;
font-weight: bold; font-weight: bold;
cursor: pointer; cursor: pointer;
} }
#hp_value {
font-family: Verdana, Arial, Helvetica, Tahoma, sans-serif;
text-decoration: none;
font-weight: normal;
}
.my_clip_button {
border: 0px solid #000000;
color: #003388;
display: block;
font-family: MS Sans Serif, Arial, Tahoma, sans-serif;
font-size: 8pt;
font-weight: bold;
padding: 2px 12px 2px 8px;
text-decoration: none;
}
.my_clip_button.hover {
background-color: #a2a2a2;
color: #0066FF;
}
</style> </style>
</head> </head>
<body onLoad="top.setHP(<?= $user['hp'] ?>,<?= $user['maxhp'] ?>)">
<body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 bgcolor=e2e0e0
onLoad="top.setHP(<?= $user['hp'] ?>,<?= $user['maxhp'] ?>)">
<div id="hint3" class="ahint"></div> <div id="hint3" class="ahint"></div>
<form action="<?= $_SERVER['PHP_SELF'] ?>" method="POST" name="f1" id="f1"> <form action="<?= $_SERVER['PHP_SELF'] ?>" method="POST" name="f1" id="f1">
<table width=100% cellspacing=0 cellpadding=0 border=0> <table width=100% cellspacing=0 cellpadding=0 border=0>
@ -281,14 +149,14 @@ $fbattle = new fbattle($user['battle']);
<table width=250 cellspacing=0 cellpadding=0> <table width=250 cellspacing=0 cellpadding=0>
<tr> <tr>
<td valign=top width=250 nowrap> <td valign=top width=250 nowrap>
<? echo showinf_pers($user['id'], 1, 1, 1); ?> <?php echo showinf_pers($user['id'], 1, 1, 1); ?>
</td> </td>
</tr> </tr>
</table> </table>
</td> </td>
<td valign=top width=80%> <td valign=top width=80%>
<? switch ($fbattle->return) { <?php switch ($fbattle->return) {
case 1 : case 1 :
?> ?>
<table width=100% cellspacing=0 cellpadding=0> <table width=100% cellspacing=0 cellpadding=0>
@ -296,9 +164,7 @@ $fbattle = new fbattle($user['battle']);
<td colspan=2><h3>Поединок</td> <td colspan=2><h3>Поединок</td>
</tr> </tr>
<tr> <tr>
<td> <td><font color=660000><b>Ваш ход</b></td>
<font color=660000><b>Ваш ход</b>
</td>
<td align=right>&nbsp;</td> <td align=right>&nbsp;</td>
</tr> </tr>
</table> </table>
@ -345,22 +211,30 @@ $fbattle = new fbattle($user['battle']);
<table cellspacing=0 cellpadding=0> <table cellspacing=0 cellpadding=0>
<tr> <tr>
<td> <td>
<input type="radio" id="A1" name="attack" value="1" onclick="setattack()"/><label for="A1">удар в голову</label> <input type="radio" id="A1" name="attack" value="1"
onclick="setattack()"/><label for="A1">удар в
голову</label>
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>
<input type="radio" id="A2" name="attack" value="2" onclick="setattack()"/><label for="A2">удар в корпус</label> <input type="radio" id="A2" name="attack" value="2"
onclick="setattack()"/><label for="A2">удар в
корпус</label>
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>
<input type="radio" id="A3" name="attack" value="3" onclick="setattack()"/><label for="A3">удар в пояс(пах)</label> <input type="radio" id="A3" name="attack" value="3"
onclick="setattack()"/><label for="A3">удар в
пояс(пах)</label>
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>
<input type="radio" id="A4" name="attack" value="4" onclick="setattack()"/><label for="A4">удар по ногам</label> <input type="radio" id="A4" name="attack" value="4"
onclick="setattack()"/><label for="A4">удар по
ногам</label>
</td> </td>
</tr> </tr>
</table> </table>
@ -370,22 +244,30 @@ $fbattle = new fbattle($user['battle']);
<table cellspacing=0 cellpadding=0> <table cellspacing=0 cellpadding=0>
<tr> <tr>
<td> <td>
<input type="radio" id="D1" name="defend" value="1" onclick="setdefend()"/><label for="D1">блок головы и корпуса</label> <input type="radio" id="D1" name="defend" value="1"
onclick="setdefend()"/><label for="D1">блок головы и
корпуса</label>
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>
<input type="radio" id="D2" name="defend" value="2" onclick="setdefend()"/><label for="D2">блок корпуса и пояса</label> <input type="radio" id="D2" name="defend" value="2"
onclick="setdefend()"/><label for="D2">блок корпуса и
пояса</label>
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>
<input type="radio" id="D3" name="defend" value="3" onclick="setdefend()"/><label for="D3">блок пояса и ног</label> <input type="radio" id="D3" name="defend" value="3"
onclick="setdefend()"/><label for="D3">блок пояса и
ног</label>
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>
<input type="radio" id="D4" name="defend" value="4" onclick="setdefend()"/><label for="D4">блок головы и ног</label> <input type="radio" id="D4" name="defend" value="4"
onclick="setdefend()"/><label for="D4">блок головы и
ног</label>
</td> </td>
</tr> </tr>
</table> </table>
@ -396,14 +278,18 @@ $fbattle = new fbattle($user['battle']);
<table cellspacing=0 cellpadding=0 width=100%> <table cellspacing=0 cellpadding=0 width=100%>
<tr> <tr>
<td align=center> <td align=center>
<input type="submit" name="go" value="Ударить!" onclick="this.disabled = true; checksubmit(); return false;" id="at"/> <input type="submit" name="go" value="Ударить!"
onclick="this.disabled = true; checksubmit(); return false;"
id="at"/>
</td><!--checksubmit(); --> </td><!--checksubmit(); -->
<td align=right> <td align=right>
<a onclick="location.href='<?= $_SERVER['PHP_SELF'] ?>?batl=<?= $_REQUEST['batl'] ?>';"> <a onclick="location.href='<?= $_SERVER['PHP_SELF'] ?>?batl=<?= $_REQUEST['batl'] ?>';">
<img src='i/ico_refresh.gif' width=16 height=19 style='cursor:pointer' alt='Обновить'> <img src='i/ico_refresh.gif' width=16 height=19
style='cursor:pointer' alt='Обновить'>
</a> </a>
<a onClick="findlogin('Сменить противника', 'fbattle.php?smena=1', 'smena'); "> <a onClick="findlogin('Сменить противника', 'fbattle.php?smena=1', 'smena'); ">
<img src='ico_change.gif' width=16 height=19 style='cursor:pointer' alt='Сменить противника'> <img src='ico_change.gif' width=16 height=19
style='cursor:pointer' alt='Сменить противника'>
</a> </a>
</td> </td>
</tr> </tr>
@ -413,7 +299,7 @@ $fbattle = new fbattle($user['battle']);
<input type="hidden" name="enemy" value="<?= $fbattle->enemy ?>"/> <input type="hidden" name="enemy" value="<?= $fbattle->enemy ?>"/>
</TABLE> </TABLE>
</CENTER> </CENTER>
<? <?
break; break;
case 2 : case 2 :
if (($user['hp'] > 0) && $fbattle->battle) { if (($user['hp'] > 0) && $fbattle->battle) {
@ -595,7 +481,7 @@ $fbattle = new fbattle($user['battle']);
<tr> <tr>
<td valign=top width=250 nowrap> <td valign=top width=250 nowrap>
<center> <center>
<? <?php
if ($fbattle->return == 1) { if ($fbattle->return == 1) {
echo showinf_pers($fbattle->enemy, 1, 1); echo showinf_pers($fbattle->enemy, 1, 1);
@ -641,12 +527,10 @@ $fbattle = new fbattle($user['battle']);
$fbattle->UpdateBattle(); $fbattle->UpdateBattle();
} }
} }
?> ?>
</td> </td>
</tr> </tr>
</table> </table>
</td> </td>
</tr> </tr>
</table> </table>

View File

@ -5765,15 +5765,15 @@ function dressitem2($id)
function star_sign($month, $day) function star_sign($month, $day)
{ {
$signs = array("10", "11", "12", "1", "2", "3", "4", "5", "6", "7", "8", "9"); $signs = ["10", "11", "12", "1", "2", "3", "4", "5", "6", "7", "8", "9"];
$signsstart = array(1 => 21, 2 => 20, 3 => 20, 4 => 20, 5 => 20, 6 => 20, 7 => 21, 8 => 22, 9 => 23, 10 => 23, 11 => 23, 12 => 23); $signsstart = [1 => 21, 2 => 20, 3 => 20, 4 => 20, 5 => 20, 6 => 20, 7 => 21, 8 => 22, 9 => 23, 10 => 23, 11 => 23, 12 => 23];
return $day < $signsstart[$month + 1] ? $signs[$month - 1] : $signs[$month % 12]; return $day < $signsstart[$month + 1] ? $signs[$month - 1] : $signs[$month % 12];
} }
function SolveExp($at_id, $def_id, $damage) function SolveExp($at_id, $def_id, $damage)
{ {
$mods = array('perv' => 1.7, 'kulon' => 1.5, 'haos' => 0.5, 'alignprot' => 1.5, 'kulakpenalty' => 0.5, 'bloodb' => 1.2, 'btl_1' => 1, 'btl_2' => 0.5, 'btl_3' => 0.05, 'krov_oop' => 0.2, 'krov_bitv' => 30, 'krov_op' => 1.15, 'krov_rez' => 70, 'krovr_op' => 1.25, 'krov_sech' => 150, 'krovs_op' => 1.4, 'velikaya' => 40, 'vel_op' => 1.1, 'velichayshaya' => 90, 'velich_op' => 1.15, 'epohalnaya' => 200, 'epoh_op' => 1.35); $mods = ['bloodb' => 1.2, 'btl_1' => 1, 'btl_2' => 0.5, 'btl_3' => 0.05];
$baseexp = array("0" => "2", "1" => "5", "2" => "10", "3" => "15", "4" => "30", "5" => "60", "6" => "90", "7" => "115", "8" => "300", "9" => "400", "10" => "500", "11" => "600", "12" => "700", "13" => "800", "14" => "900", "15" => "1000", "16" => "1100", "17" => "1200", "18" => "1300", "19" => "1400", "20" => "1500", "21" => "1600"); $baseexp = ["0" => "2", "1" => "5", "2" => "10", "3" => "15", "4" => "30", "5" => "60", "6" => "90", "7" => "115", "8" => "300", "9" => "400", "10" => "500", "11" => "600", "12" => "700", "13" => "800", "14" => "900", "15" => "1000", "16" => "1100", "17" => "1200", "18" => "1300", "19" => "1400", "20" => "1500", "21" => "1600"];
if ($at_id > _BOTSEPARATOR_) { if ($at_id > _BOTSEPARATOR_) {
$bots = mysql_fetch_array(mysql_query('SELECT * FROM `bots` WHERE `id` = "' . $at_id . '" LIMIT 1')); $bots = mysql_fetch_array(mysql_query('SELECT * FROM `bots` WHERE `id` = "' . $at_id . '" LIMIT 1'));
@ -5781,9 +5781,10 @@ function SolveExp($at_id, $def_id, $damage)
$bot_active = true; $bot_active = true;
} }
$at = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '" . $at_id . "' LIMIT 1")); $at = db::c()->query('SELECT `level` FROM `users` WHERE `id` = ?i', $at_id)->fetch_assoc();
$def = db::c()->query('SELECT `level` FROM `users` WHERE `id` = ?i', $def_id)->fetch_assoc();
$at_cost = mysql_fetch_array(mysql_query("SELECT 1+IFNULL((SELECT SUM(`cost`) FROM `inventory` WHERE `owner` = `users`.`id` AND `dressed` = 1), 0), `align` FROM `users` WHERE `id` = '" . $at_id . "' LIMIT 1")); $at_cost = mysql_fetch_array(mysql_query("SELECT 1+IFNULL((SELECT SUM(`cost`) FROM `inventory` WHERE `owner` = `users`.`id` AND `dressed` = 1), 0), `align` FROM `users` WHERE `id` = '" . $at_id . "' LIMIT 1"));
$kulak1 = mysql_fetch_array(mysql_query("SELECT SUM(`cost`) FROM `inventory` WHERE `owner` = '" . $at_id . "' AND `dressed` = 1 LIMIT 1")); $def_cost = mysql_fetch_array(mysql_query("SELECT 1+IFNULL((SELECT SUM(`cost`) FROM `inventory` WHERE `owner` = `users`.`id` AND `dressed` = 1), 0), `align` FROM `users` WHERE `id` = '" . $def_id . "' LIMIT 1"));
if ($at_id > _BOTSEPARATOR_) { if ($at_id > _BOTSEPARATOR_) {
$bat_raw = mysql_fetch_array(mysql_query("SELECT `battle` FROM `bots` WHERE `id` = '$at_id' LIMIT 1")); $bat_raw = mysql_fetch_array(mysql_query("SELECT `battle` FROM `bots` WHERE `id` = '$at_id' LIMIT 1"));
@ -5791,7 +5792,7 @@ function SolveExp($at_id, $def_id, $damage)
$bat_raw = mysql_fetch_array(mysql_query("SELECT `battle` FROM `users` WHERE `id` = '$at_id' LIMIT 1")); $bat_raw = mysql_fetch_array(mysql_query("SELECT `battle` FROM `users` WHERE `id` = '$at_id' LIMIT 1"));
} }
$bat = $bat_raw['battle']; $bat = $bat_raw['battle'];
$bt = mysql_fetch_array(mysql_query("SELECT * FROM `battle` WHERE `id` = '$bat' LIMIT 1")); $bt = db::c()->query('SELECT `blood`,`type`,`t1`,`t2` FROM `battle` WHERE `id` = ?i', $bat)->fetch_assoc();
if ($def_id > _BOTSEPARATOR_) { if ($def_id > _BOTSEPARATOR_) {
$bots = mysql_fetch_array(mysql_query('SELECT * FROM `bots` WHERE `id` = "' . $def_id . '" LIMIT 1')); $bots = mysql_fetch_array(mysql_query('SELECT * FROM `bots` WHERE `id` = "' . $def_id . '" LIMIT 1'));
@ -5799,34 +5800,8 @@ function SolveExp($at_id, $def_id, $damage)
$bot_def = true; $bot_def = true;
} }
$def = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '" . $def_id . "' LIMIT 1"));
$def_cost = mysql_fetch_array(mysql_query("SELECT 1+IFNULL((SELECT SUM(`cost`) FROM `inventory` WHERE `owner` = `users`.`id` AND `dressed` = 1), 0), `align` FROM `users` WHERE `id` = '" . $def_id . "' LIMIT 1"));
$kulak2 = mysql_fetch_array(mysql_query("SELECT SUM(`cost`) FROM `inventory` WHERE `owner` = '" . $def_id . "' AND `dressed` = 1 LIMIT 1"));
$expmf = 5;
if ($at['rybax'] == 0 && $at['sergi'] == 0 && $at['kulon'] == 0 && $at['bron'] == 0 && $at['r1'] == 0 && $at['r2'] == 0 && $at['r3'] == 0 && $at['helm'] == 0 && $at['perchi'] == 0 && $at['boots'] == 0 && $at['m1'] == 0 && $at['m2'] == 0 && $at['m3'] == 0 && $at['m4'] == 0 && $at['m5'] == 0 && $at['m6'] == 0 && $at['m7'] == 0 && $at['m8'] == 0 && $at['m9'] == 0 && $at['m10'] == 0 && $at['weap'] != 0 && $kulak1[0] < 17) {
$expmf = $expmf * $mods['perv'];
}
if ($at['rybax'] == 0 && $at['sergi'] == 0 && $at['bron'] == 0 && $at['helm'] == 0 && $at['perchi'] == 0 && $at['boots'] == 0 && $at['m1'] == 0 && $at['m2'] == 0 && $at['m3'] == 0 && $at['m4'] == 0 && $at['m5'] == 0 && $at['m6'] == 0 && $at['m7'] == 0 && $at['m8'] == 0 && $at['m9'] == 0 && $at['m10'] == 0 && $at['weap'] != 0 && $at['kulon'] != 0 && $at['r1'] != 0 && $at['r2'] != 0 && $at['r3'] != 0) {
$expmf = $expmf * $mods['kulon'];
}
if ($at['align'] == 4) {
$expmf = $expmf * $mods['haos'];
}
if (((int)$at['align'] == 6 && $def['align'] == 3) || ((int)$def['align'] == 6 && $at['align'] == 3)) {
$expmf = $expmf * $mods['alignprot'];
}
if ($at['level'] > 1 && $kulak1[0] == 0 && $kulak2[0] == 0) {
$expmf = $expmf * $mods['kulakpenalty'];
}
if ($bt['blood']) { if ($bt['blood']) {
$expmf = $expmf * $mods['bloodb']; $expmf = $mods['bloodb'];
} }
$filebtl = '/tmp/' . $at_id . '.btl'; $filebtl = '/tmp/' . $at_id . '.btl';
@ -5847,7 +5822,21 @@ function SolveExp($at_id, $def_id, $damage)
$expmf = $expmf * $exmod; $expmf = $expmf * $exmod;
} }
$standart = array("0" => 1, "1" => 1, "2" => 15, "3" => 111, "4" => 265, "5" => 526, "6" => 882, "7" => 919, "8" => 919, "9" => 919, "10" => 919, "11" => 919, "12" => 919, "13" => 919, "14" => 919, "15" => 919, "16" => 919, "17" => 919, "18" => 919, "19" => 919, "20" => 919, "21" => 919, "22" => 919, "23" => 919, "24" => 919, "25" => 919); $standart = [
"0" => 1,
"1" => 1,
"2" => 15,
"3" => 111,
"4" => 265,
"5" => 526,
"6" => 882,
"7" => 919,
"8" => 919,
"9" => 919,
"10" => 919,
"11" => 919,
"12" => 919,
"13" => 919, "14" => 919, "15" => 919, "16" => 919, "17" => 919, "18" => 919, "19" => 919, "20" => 919, "21" => 919, "22" => 919, "23" => 919, "24" => 919, "25" => 919];
$mfit = ($at_cost[0] / ($standart[$at['level']] / 3)); $mfit = ($at_cost[0] / ($standart[$at['level']] / 3));
if ($mfit < 0.8) { if ($mfit < 0.8) {