dev #38

Merged
lopar merged 22 commits from dev into master 2021-02-03 08:56:49 +00:00
13 changed files with 148 additions and 168 deletions
Showing only changes of commit 538047f36f - Show all commits

View File

@ -1,4 +1,7 @@
<?php <?php
use Battles\Template;
session_start(); session_start();
require_once 'functions.php'; require_once 'functions.php';
//require_once 'cave/cave_bots.php'; //require_once 'cave/cave_bots.php';
@ -906,7 +909,7 @@ $standingon = $map[$y * 2][$x * 2];
foreach ($party as $k => $v) { foreach ($party as $k => $v) {
$map[$v['y'] * 2][$v['x'] * 2] = "u/" . $v['user']; $map[$v['y'] * 2][$v['x'] * 2] = "u/" . $v['user'];
} }
\Battles\Template::header('cave'); Template::header('cave');
?> ?>
<style> <style>
body { body {
@ -1675,7 +1678,7 @@ function drawmap($map1, $players, $x, $y, $direction)
} }
} else { } else {
if ($i == 1) { if ($i == 1) {
$ret .= "<img width=\"65\" height=\"80\" src=\"/i/dungeon/objects/$o.gif\" style=\"position: absolute; left: 0px; top: 110px\" />"; $ret .= "<img width=\"65\" height=\"80\" src=\"/i/dungeon/objects/$o.gif\" style=\"position: absolute; left: 0; top: 110px\" />";
} }
if ($i == 2) { if ($i == 2) {
$ret .= "<img width=\"43\" height=\"56\" src=\"/i/dungeon/objects/$o.gif\" style=\"position: absolute; left: 17px; top: 90px\" />"; $ret .= "<img width=\"43\" height=\"56\" src=\"/i/dungeon/objects/$o.gif\" style=\"position: absolute; left: 17px; top: 90px\" />";
@ -1948,7 +1951,7 @@ progress_update();
<a href=\"javascript:top.AddToPrivate('$v[login]', top.CtrlPress)\"><img src=\"i/lock.gif\" title=\"Приват\" border=\"0\" /></a> <a href=\"inf.php?$v[user]\" target=_blank title=\"Информация о $v[login]\">$v[login]</a> [$usr[level]]<a href='inf.php?$v[user]' target='_blank'><img src='/i/inf.gif' border=0></a></td> <a href=\"javascript:top.AddToPrivate('$v[login]', top.CtrlPress)\"><img src=\"i/lock.gif\" title=\"Приват\" border=\"0\" /></a> <a href=\"inf.php?$v[user]\" target=_blank title=\"Информация о $v[login]\">$v[login]</a> [$usr[level]]<a href='inf.php?$v[user]' target='_blank'><img src='/i/inf.gif' border=0></a></td>
<td background=\"/i/bg_scroll_05.gif\" nowrap style=\"font-size:9px\"> <td background=\"/i/bg_scroll_05.gif\" nowrap style=\"font-size:9px\">
<div style=\"position: relative;padding-left:5px\"> <div style=\"position: relative;padding-left:5px\">
<table cellspacing=\"0\" cellpadding=\"0\" style='line-height: 1'><td nowrap style=\"font-size:9px\" style=\"position: relative\"><SPAN " . ($v["user"] == $user["id"] ? "id=\"HP\"" : "") . " style='position: absolute; left: 5; z-index: 1; font-weight: bold; color: #FFFFFF'>" . ($v["user"] == $user["id"] ? "<span id=\"hp_value\">" : "") . "$usr[hp]" . ($v["user"] == $user["id"] ? "</span>" : "") . "/$usr[maxhp]</SPAN><img src=\"/i/1green.gif\" alt=\"Уровень жизни\" " . ($v["user"] == $user["id"] ? "name=\"HP1\"" : "") . " width=\"$wd\" height=\"9\" " . ($v["user"] == $user["id"] ? "id=\"HP1\"" : "") . "><img src=\"/i/bk_life_loose.gif\" alt=\"Уровень жизни\" " . ($v["user"] == $user["id"] ? "name=\"HP2\"" : "") . " width=\"" . (120 - $wd) . "\" height=\"9\" " . ($v["user"] == $user["id"] ? "id=\"HP2\"" : "") . "></td></table></div></td> <table cellspacing=\"0\" cellpadding=\"0\" style='line-height: 1'><td nowrap style=\"font-size:9px\" style=\"position: relative\"><SPAN " . ($v["user"] == $user["id"] ? "id=\"HP\"" : "") . " style='position: absolute; left: 5px; z-index: 1; font-weight: bold; color: #FFFFFF'>" . ($v["user"] == $user["id"] ? "<span id=\"hp_value\">" : "") . "$usr[hp]" . ($v["user"] == $user["id"] ? "</span>" : "") . "/$usr[maxhp]</SPAN><img src=\"/i/1green.gif\" alt=\"Уровень жизни\" " . ($v["user"] == $user["id"] ? "name=\"HP1\"" : "") . " width=\"$wd\" height=\"9\" " . ($v["user"] == $user["id"] ? "id=\"HP1\"" : "") . "><img src=\"/i/bk_life_loose.gif\" alt=\"Уровень жизни\" " . ($v["user"] == $user["id"] ? "name=\"HP2\"" : "") . " width=\"" . (120 - $wd) . "\" height=\"9\" " . ($v["user"] == $user["id"] ? "id=\"HP2\"" : "") . "></td></table></div></td>
<td background=\"/i/bg_scroll_05.gif\" align=\"center\"></td> <td background=\"/i/bg_scroll_05.gif\" align=\"center\"></td>
<td background=\"/i/bg_scroll_05.gif\" align=\"center\">"; <td background=\"/i/bg_scroll_05.gif\" align=\"center\">";
if ($v["user"] == $user["id"] && $user["id"] == $user["caveleader"]) echo "<IMG src=\"/i/lead1.gif\" width=24 height=15><A href=\"#\" onClick=\"findlogin('Выберите персонажа которого хотите выгнать','cave.php', 'kill')\"><IMG alt=\"Выгнать супостата\" src=\"/i/ico_kill_member1.gif\" WIDTH=\"14\" HEIGHT=\"17\"></A>&nbsp;<A href=\"#\" onClick=\"findlogin( 'Выберите персонажа которому хотите передать лидерство','cave.php', 'change')\"><IMG alt=\"Новый царь\" src=\"/i/ico_change_leader1.gif\" WIDTH=\"14\" HEIGHT=\"17\"></A>"; if ($v["user"] == $user["id"] && $user["id"] == $user["caveleader"]) echo "<IMG src=\"/i/lead1.gif\" width=24 height=15><A href=\"#\" onClick=\"findlogin('Выберите персонажа которого хотите выгнать','cave.php', 'kill')\"><IMG alt=\"Выгнать супостата\" src=\"/i/ico_kill_member1.gif\" WIDTH=\"14\" HEIGHT=\"17\"></A>&nbsp;<A href=\"#\" onClick=\"findlogin( 'Выберите персонажа которому хотите передать лидерство','cave.php', 'change')\"><IMG alt=\"Новый царь\" src=\"/i/ico_change_leader1.gif\" WIDTH=\"14\" HEIGHT=\"17\"></A>";

87
ch.php
View File

@ -1,4 +1,7 @@
<?php <?php
use Battles\Template;
session_start(); session_start();
require_once 'functions.php'; require_once 'functions.php';
@ -108,7 +111,7 @@ if (isset($_GET['online']) && $_GET['online'] != null) {
$ch4 = '_passive'; $ch4 = '_passive';
$ch5 = '_passive'; $ch5 = '_passive';
} }
\Battles\Template::header(sprintf('%s (%s)', $rooms[$user->room], mysql_num_rows($data))); Template::header(sprintf('%s (%s)', $rooms[$user->room], mysql_num_rows($data)));
?> ?>
<script> <script>
function fastshow(content) { function fastshow(content) {
@ -163,25 +166,24 @@ if (isset($_GET['online']) && $_GET['online'] != null) {
top.rld(); top.rld();
</script> </script>
<center> <div>
<? if (!$_GET['rms']) { ?> <? if (!$_GET['rms']) { ?>
<div id="fixednew" <div id="fixednew" style="position: fixed; margin: 0; padding: 0; z-index: 9; width: 100%; text-align: center; overflow: auto;">
style="position: fixed; margin: 0; padding: 0; z-index: 9; width: 100%; text-align: center; overflow: auto;">
<table border="0" cellpadding="0" cellspacing="0"> <table border="0" cellpadding="0" cellspacing="0">
<tbody> <tbody>
<tr> <tr>
<td><img align="left" <td><img align="left"
onclick="this.src='i/buttons/ch1_passive.jpg'; location.href='ch.php?online='+Math.random();" onclick="this.src='i/buttons/ch1_passive.jpg'; location.href='ch.php?online='+Math.random();"
src="i/buttons/ch1<?= $ch1; ?>.jpg"/></td> src="i/buttons/ch1<?= $ch1; ?>.jpg"/>
<? if (!empty($user['klan'])) { ?> <? if (!empty($user['klan'])) { ?>
<td><img align="left" title="Соклановцы" style="cursor: pointer;" <td><img align="left" title="Соклановцы" style="cursor: pointer;"
onclick="location.href='ch.php?online='+Math.random()+'&amp;chview=5';" onclick="location.href='ch.php?online='+Math.random()+'&amp;chview=5';"
src="i/buttons/ch5<?= $ch5; ?>.jpg"/></td> src="i/buttons/ch5<?= $ch5; ?>.jpg"/>
<? } ?> <? } ?>
</tr>
</tbody> </tbody>
</table> </table>
</div><br/><br/><br/> </div>
<br><br><br>
<? } ?> <? } ?>
<div id="mmoves" <div id="mmoves"
style="background-color: #FFFFCC; visibility:hidden; overflow: visible; position: absolute; border-color: #666666; border-style: solid; border-width: 0; padding: 0; white-space: nowrap; display: block; vertical-align: middle; word-wrap: break-word;"></div> style="background-color: #FFFFCC; visibility:hidden; overflow: visible; position: absolute; border-color: #666666; border-style: solid; border-width: 0; padding: 0; white-space: nowrap; display: block; vertical-align: middle; word-wrap: break-word;"></div>
@ -195,53 +197,50 @@ if (isset($_GET['online']) && $_GET['online'] != null) {
} }
?> ?>
<? echo '<br />' . $ttl . '<br />'; ?> <? echo '<br />' . $ttl . '<br />'; ?>
</center> </div>
<table border=0> <div>
<tr> <script>
<td nowrap> <?php
<script> while ($row = $data->fetch_assoc()) {
<?php if ($row['in_battle'] > 0) {
while ($row = $data->fetch_assoc()) { $in_battle = 1;
if ($row['in_battle'] > 0) { } else {
$in_battle = 1; $in_battle = 0;
} else { }
$in_battle = 0; if ($row['invis'] > 0 && $row['id'] == $_SESSION['uid']) {
$row['login2'] = $row['login'] . "</a> (невидимка)";
}
if ($row['invis'] == 0 || $row['id'] == $_SESSION['uid']) {
if (!empty($row['action'])) {
function stripslashes_deep($text)
{
while (strstr($text, "\\")) {
$text = stripslashes($text);
}
return $text;
} }
if ($row['invis'] > 0 && $row['id'] == $_SESSION['uid']) {
$row['login2'] = $row['login'] . "</a> (невидимка)";
}
if ($row['invis'] == 0 || $row['id'] == $_SESSION['uid']) {
if (!empty($row['action'])) {
function stripslashes_deep($text)
{
while (strstr($text, "\\")) {
$text = stripslashes($text);
}
return $text;
}
$rrr = $row['action']; $rrr = $row['action'];
$act = explode("<>:<>", $rrr); $act = explode("<>:<>", $rrr);
$aa = htmlspecialchars(stripslashes_deep($act[1])); $aa = htmlspecialchars(stripslashes_deep($act[1]));
$aa = preg_replace("/afk ", "", $aa) $aa = preg_replace("/afk ", "", $aa)
$aa = preg_replace("/dnd ", "", $aa); $aa = preg_replace("/dnd ", "", $aa);
$aa = preg_replace("/buy ", "", $aa); $aa = preg_replace("/buy ", "", $aa);
$aa = preg_replace("/sell ", "", $aa); $aa = preg_replace("/sell ", "", $aa);
$act_line = " <span onmouseover=\"fastshow(\'$aa\')\" onmouseout=\"hideshow()\"><b><small>{$act[0]}</small></b></span> "; $act_line = " <span onmouseover=\"fastshow(\'$aa\')\" onmouseout=\"hideshow()\"><b><small>{$act[0]}</small></b></span> ";
} else $act_line = ''; } else $act_line = '';
echo 'w(\'', $row['login'], '\',', $row['id'], ',', $in_battle, ',\'', $row['align'], '\',\'' . $row['klan'] . '\', \'' . $act_line . '\',\'', $row['level'], '\',\'', $row['slp'], '\',\'', $row['trv'], '\',\'', '\',\'', $row['login2'], '\');'; echo 'w(\'', $row['login'], '\',', $row['id'], ',', $in_battle, ',\'', $row['align'], '\',\'' . $row['klan'] . '\', \'' . $act_line . '\',\'', $row['level'], '\',\'', $row['slp'], '\',\'', $row['trv'], '\',\'', '\',\'', $row['login2'], '\');';
} }
} }
?> ?>
</script> </script>
</td> </div>
</tr>
</table>
<?php <?php
if (!$_GET['room']) { if (!$_GET['room']) {
?> ?>
<SCRIPT>document.write('<INPUT TYPE=checkbox onclick="if(this.checked == true) { top.OnlineStop = false; } else { top.OnlineStop = true; }" ' + (top.OnlineStop ? '' : 'checked') + '> Обновлять автомат.') <SCRIPT>document.write('<INPUT TYPE=checkbox onclick="if(this.checked == true) { top.OnlineStop = false; } else { top.OnlineStop = true; }" ' + (top.OnlineStop ? '' : 'checked') + '> Обновлять автомат.')
</SCRIPT></body></html> </SCRIPT>
<?php <?php
exit; exit;
} }

View File

@ -12,7 +12,6 @@ class DBPDO
{ {
public $pdo; public $pdo;
private $error;
private static $_instance = null; private static $_instance = null;
function __construct() function __construct()
@ -46,8 +45,7 @@ class DBPDO
$this->pdo = new PDO($dsn, $user, $password, array(PDO::ATTR_PERSISTENT => true)); $this->pdo = new PDO($dsn, $user, $password, array(PDO::ATTR_PERSISTENT => true));
return true; return true;
} catch (PDOException $e) { } catch (PDOException $e) {
$this->error = $e->getMessage(); die($e->getMessage());
die($this->error);
} }
} else { } else {
$this->pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); $this->pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);

View File

@ -1,7 +1,11 @@
<?php <?php
use Battles\Template;
use Battles\User;
session_start(); session_start();
require_once "functions.php"; require_once "functions.php";
$user = $user ?? new \Battles\User($_SESSION['uid']); $user = $user ?? new User($_SESSION['uid']);
function secs2hrs($s, $short = 0) function secs2hrs($s, $short = 0)
{ {
@ -66,7 +70,7 @@ if (in_array($user->room, Config::$canalenters)) {
$cavedata = [620 => ['x1' => 3, 'y1' => 2, 'dir1' => 2]]; $cavedata = [620 => ['x1' => 3, 'y1' => 2, 'dir1' => 2]];
$podzemdata = [621 => ['name1' => 'Проклятый Рудник', 'name2' => 'Проклятого Рудника']]; $podzemdata = [621 => ['name1' => 'Проклятый Рудник', 'name2' => 'Проклятого Рудника']];
$warning = $_GET["warning"] ?? ''; $warning = $_GET["warning"] ?? '';
\Battles\Template::header('enter_cave'); Template::header('enter_cave');
if ($warning) { if ($warning) {
echo sprintf('<b style="color: #f80000">%s</b>', $warning); echo sprintf('<b style="color: #f80000">%s</b>', $warning);
} }
@ -130,7 +134,7 @@ if (in_array($user->room, Config::$canalenters)) {
if ($wawe == 0) { if ($wawe == 0) {
echo "<FORM id='REQUEST'> echo "<FORM id='REQUEST'>
<FIELDSET style='padding-left: 5; width=50%; color:#000000;'><LEGEND><B> Группа </B> </LEGEND> <FIELDSET style='padding-left: 5px; width=50%; color:#000000;'><LEGEND><B> Группа </B> </LEGEND>
<table> <table>
<tr> <tr>
<td>Комментарий</td> <td>Комментарий</td>
@ -149,7 +153,7 @@ if (in_array($user->room, Config::$canalenters)) {
</FORM>"; </FORM>";
} else { } else {
echo "<FORM id='REQUEST'> echo "<FORM id='REQUEST'>
<FIELDSET style='padding-left: 5; width=50%'> <FIELDSET style='padding-left: 5px; width=50%'>
<LEGEND><B> Группа </B> </LEGEND>"; <LEGEND><B> Группа </B> </LEGEND>";
if ($nawe == 1) { if ($nawe == 1) {
echo "<INPUT style=\"font-size:12px;\" type='submit' name='start' value='Начать' /> &nbsp;"; echo "<INPUT style=\"font-size:12px;\" type='submit' name='start' value='Начать' /> &nbsp;";
@ -258,11 +262,10 @@ if (in_array($user->room, Config::$canalenters)) {
?> ?>
<TR> <TR>
<TD> <TD></TD>
</TD>
</TR> </TR>
<TR height=1> <TR>
<TD height=1 colspan=2><SPAN></SPAN></TD> <TD colspan=2></TD>
</TR> </TR>
</TABLE> </TABLE>
<?php <?php
@ -436,7 +439,6 @@ if (in_array($user->room, Config::$canalenters)) {
?> ?>
<TD nowrap valign=top> <TD nowrap valign=top>
<BR> <BR>
<DIV align=right> <DIV align=right>
<INPUT style="font-size:12px;" onClick="document.location.href='enter_cave.php?<?= time(); ?>'" <INPUT style="font-size:12px;" onClick="document.location.href='enter_cave.php?<?= time(); ?>'"
@ -444,13 +446,10 @@ if (in_array($user->room, Config::$canalenters)) {
<input style="font-size: 12px;" type="button" value="Вернуться" <input style="font-size: 12px;" type="button" value="Вернуться"
onclick="document.location.href='enter_cave.php?ext=1';"/> onclick="document.location.href='enter_cave.php?ext=1';"/>
</DIV> </DIV>
</TD> </TABLE>
</TR></TBODY></TABLE> </TABLE>
</TD> <div id="goto" style="text-align:right;white-space:nowrap">&nbsp;</div>
</TR> <br><br>
</TABLE>
<div id="goto" style="text-align:right;white-space:nowrap">&nbsp;</div>
<br><br>
<?php <?php
} else { } else {
header("location: main.php"); header("location: main.php");

View File

@ -1,4 +1,7 @@
<?php <?php
use Battles\Template;
session_start(); session_start();
if (empty($_SESSION['uid'])) { if (empty($_SESSION['uid'])) {
exit; exit;
@ -110,10 +113,10 @@ if ($_GET['res']) {
addchp('<b style="color:#990000">Внимание!</b> <b>' . $user["login"] . '</b>, поднял предмет "' . $gss['name'] . '".', '{[]}' . Nick::id($user["id"])->short() . '{[]}'); addchp('<b style="color:#990000">Внимание!</b> <b>' . $user["login"] . '</b>, поднял предмет "' . $gss['name'] . '".', '{[]}' . Nick::id($user["id"])->short() . '{[]}');
echo "<font style='color:#990000'>Вы подняли <b>'" . $gss['name'] . "'</b>.</font>"; echo "<font style='color:#990000'>Вы подняли <b>'" . $gss['name'] . "'</b>.</font>";
} else { } else {
echo "&nbsp;<font style='font-size:12px; color:cc0000;'>Кто-то оказался быстрее!</font>"; echo "&nbsp;<font style='font-size:12px; color:#cc0000;'>Кто-то оказался быстрее!</font>";
} }
} }
\Battles\Template::header('Лес'); Template::header('Лес');
?> ?>
<script src="i/forest/char1.32.js"></script> <script src="i/forest/char1.32.js"></script>
<script src="i/forest/funcs1.6.js"></script> <script src="i/forest/funcs1.6.js"></script>
@ -197,7 +200,7 @@ if ($_GET['res']) {
<? if ($les_login['room'] == 'G8') { ?> <? if ($les_login['room'] == 'G8') { ?>
<input class=btn style="width:150px;height:20" type="button" <input class=btn style="width:150px;height:20px;" type="button"
value="Выйти из леса" onclick="location.href='?go=vixod';"/><br/> value="Выйти из леса" onclick="location.href='?go=vixod';"/><br/>
<br/> <br/>
<? } ?> <? } ?>

View File

@ -1105,7 +1105,7 @@ function SolveExp($at_id, $def_id, $damage)
$expmf = 1; $expmf = 1;
} }
return round((($baseexp[$def['level']]) * ($def_cost[0] / (($at_cost[0] + $def_cost[0]) / 2)) * ($damage / $def['maxhp']) * $expmf * $mfit * $mfbot * $mfbot2) / 3, 0); return round((($baseexp[$def['level']]) * ($def_cost[0] / (($at_cost[0] + $def_cost[0]) / 2)) * ($damage / $def['maxhp']) * $expmf * $mfit * $mfbot * $mfbot2) / 3);
} }
/** /**

View File

@ -1,7 +1,12 @@
<?php <?php
use Battles\Template;
use Battles\User;
session_start(); session_start();
require_once "functions.php"; require_once "functions.php";
$user = $user ?? new \Battles\User($_SESSION['uid']); $user = $user ?? new User($_SESSION['uid']);
class hellround class hellround
{ {
@ -29,7 +34,7 @@ $hr = new hellround;
$mytrip = $hr->is_in_trip($user['id']); $mytrip = $hr->is_in_trip($user['id']);
$tr = $hr->get_par($mytrip); $tr = $hr->get_par($mytrip);
\Battles\Template::header('hell'); Template::header('hell');
if ($mytrip > 0) { if ($mytrip > 0) {
?> ?>
@ -67,23 +72,23 @@ if ($mytrip > 0) {
<TABLE border=0 width=100% cellspacing="0" cellpadding="0"> <TABLE border=0 width=100% cellspacing="0" cellpadding="0">
<td align=left> <td align=left>
<INPUT TYPE="button" onclick="location.href = 'hell.php?start=1';" value="НАЧАТЬ ПОХОД" name="strah"> <INPUT TYPE="button" onclick="location.href = 'hell.php?start=1';" value="НАЧАТЬ ПОХОД" name="strah">
</td>
<td align=right> <td align=right>
<INPUT TYPE="button" onclick="location.href = 'city.php?bps=1';" value="Вернуться" name="strah"> <INPUT TYPE="button" onclick="location.href = 'city.php?bps=1';" value="Вернуться" name="strah">
</table> </table>
</form>
<FORM method=POST> <FORM method=POST>
<h3>Врата Ада</h3> <h3>Врата Ада</h3>
<center><font color=red><B><?= $err ?></B></font><BR> <div style="text-align: center; color: #f80000; font-weight: bold;"><?= $err ?></div>
<i>Отродья хаоса лезут отовсюду... Наплывы слуг хаоса не прекращаються не на минуту! Окажи посильную помощь <i>Отродья хаоса лезут отовсюду... Наплывы слуг хаоса не прекращаються не на минуту! Окажи посильную помощь
в войне с Хаосом! Будь доблестен сердцем и душей!</i></center> в войне с Хаосом! Будь доблестен сердцем и душей!</i>
<BR> <BR>
<center> <div style="text-align: center;">
<fieldset style="width:50%;"> <fieldset style="width:50%;">
<legend> <legend>
Общий ТОП Общий ТОП
</legend> </legend>
</center>
<? <?
$select = mysql_query("SELECT DISTINCT `owner` FROM `hellround_pohod` ORDER by (SELECT SUM(`volna`) FROM `hellround_pohod` WHERE `owner` = `owner`) DESC LIMIT 10;"); $select = mysql_query("SELECT DISTINCT `owner` FROM `hellround_pohod` ORDER by (SELECT SUM(`volna`) FROM `hellround_pohod` WHERE `owner` = `owner`) DESC LIMIT 10;");
while ($f = mysql_fetch_array($select)) { while ($f = mysql_fetch_array($select)) {
@ -91,7 +96,7 @@ if ($mytrip > 0) {
echo "&nbsp; " . $i . ". " . Nick::id($f[0])->full(1) . "<BR>"; echo "&nbsp; " . $i . ". " . Nick::id($f[0])->full(1) . "<BR>";
} }
?> ?>
<center>
</fieldset> </fieldset>
<fieldset style="width:50%;"> <fieldset style="width:50%;">
<legend>Личный ТОП</legend> <legend>Личный ТОП</legend>
@ -105,7 +110,7 @@ if ($mytrip > 0) {
?> ?>
</fieldset> </fieldset>
</center> </div>
</FORM> </FORM>
<? <?
} }

View File

@ -1,4 +1,4 @@
{ {
":susel:":"/i/smile/susel.gif", ":susel:":"/i/smile/susel.gif",
":ponder:":"/i/smile/ponder.gif", ":ponder:":"/i/smile/ponder.gif"
} }

View File

@ -44,7 +44,7 @@ function foundmagictype (mtypes) {
if(doubl) { if(doubl) {
return 0 return 0
}; }
return found; return found;
} }
return 0; return 0;
@ -53,8 +53,8 @@ function foundmagictype (mtypes) {
function crtmagic(mtype, title, body, subm) { function crtmagic(mtype, title, body, subm) {
mtype = foundmagictype(mtype); mtype = foundmagictype(mtype);
var names = new Array('neitral',17, 6, 14, 17, 14, 7,0,0, 3, 'fire', 57, 30, 33, 20, 21, 14, 11, 12, 0, 'water', 57, 30, 33, 20, 21, 14, 11, 12, 0, 'air', 57, 30, 33, 20, 21, 14, 11, 12, 0, 'earth', 57,30, 33, 20, 21, 14, 11, 12, 0, 'white', 51, 25, 46, 44, 44, 10, 5, 5, 0, 'gray', 51, 25, 46, 44, 44, 10, 5, 5, 0, 'black', 51, 25, 46, 44, 44, 10, 5, 5, 0); var names = ['neitral',17, 6, 14, 17, 14, 7,0,0, 3, 'fire', 57, 30, 33, 20, 21, 14, 11, 12, 0, 'water', 57, 30, 33, 20, 21, 14, 11, 12, 0, 'air', 57, 30, 33, 20, 21, 14, 11, 12, 0, 'earth', 57,30, 33, 20, 21, 14, 11, 12, 0, 'white', 51, 25, 46, 44, 44, 10, 5, 5, 0, 'gray', 51, 25, 46, 44, 44, 10, 5, 5, 0, 'black', 51, 25, 46, 44, 44, 10, 5, 5, 0];
var colors = new Array('B1A993', 'DDD5BF', 'ACA396', 'D3CEC8', '96B0C6', 'BDCDDB', 'AEC0C9', 'CFE1EA', 'AAA291', 'D5CDBC', 'BCBBB6', 'EFEEE9', '969592', 'DADADA', '72726B', 'A6A6A0'); var colors = ['B1A993', 'DDD5BF', 'ACA396', 'D3CEC8', '96B0C6', 'BDCDDB', 'AEC0C9', 'CFE1EA', 'AAA291', 'D5CDBC', 'BCBBB6', 'EFEEE9', '969592', 'DADADA', '72726B', 'A6A6A0'];
while(body.indexOf('#IMGSRC#') >= 0) body = body.replace('#IMGSRC#', 'i/misc/dmagic/'+names[mtype*10]+'_30.gif'); while(body.indexOf('#IMGSRC#') >= 0) body = body.replace('#IMGSRC#', 'i/misc/dmagic/'+names[mtype*10]+'_30.gif');
var s = '<table width="250" border="0" align="center" cellpadding="0" cellspacing="0">'+ var s = '<table width="250" border="0" align="center" cellpadding="0" cellspacing="0">'+
@ -78,7 +78,7 @@ function crtmagic(mtype, title, body, subm) {
'<td width="100%">'+ '<td width="100%">'+
'<table width="100%" border="0" cellspacing="0" cellpadding="0">'+ '<table width="100%" border="0" cellspacing="0" cellpadding="0">'+
'<tr><td bgcolor="#'+colors[mtype*2]+'"'+(names[mtype*10+9]?' style="padding-top: '+names[mtype*10+9]+'"':'')+' >'+ '<tr><td bgcolor="#'+colors[mtype*2]+'"'+(names[mtype*10+9]?' style="padding-top: '+names[mtype*10+9]+'"':'')+' >'+
'<table border=0 width=100% cellspacing="0" cellpadding="0"><td style="padding-left: 20" align=center><B>'+title+ '<table border=0 width=100% cellspacing="0" cellpadding="0"><td style="padding-left: 20px;" align=center><B>'+title+
'</td><td width=20 align=right valign=top style="cursor: pointer" onclick="closehint();"><img src="i/clear.gif" width=13 height=13 alt="">&nbsp;</td></table>'+ '</td><td width=20 align=right valign=top style="cursor: pointer" onclick="closehint();"><img src="i/clear.gif" width=13 height=13 alt="">&nbsp;</td></table>'+
'</td></tr>'+ '</td></tr>'+
'<tr>'+ '<tr>'+

View File

@ -1,4 +1,7 @@
<?php <?php
use Battles\Template;
ob_start("ob_gzhandler"); ob_start("ob_gzhandler");
session_start(); session_start();
require_once "functions.php"; require_once "functions.php";
@ -294,7 +297,7 @@ if (isset($_GET['exitlaba'])) {
header('Location: labirint.php'); header('Location: labirint.php');
} }
} }
\Battles\Template::header('Вход в Лабиринты'); Template::header('Вход в Лабиринты');
?> ?>
<div style="float: right;"> <div style="float: right;">
<input type="button" onclick="location.href='lab_enter.php';" value="Обновить"> <input type="button" onclick="location.href='lab_enter.php';" value="Обновить">
@ -417,7 +420,7 @@ while ($pl = mysql_fetch_array($sp)) {
<td valign="top"> <td valign="top">
<form id="from" autocomplete="off" name="from" <form id="from" autocomplete="off" name="from"
action="lab_enter.php?pz1=<? echo mt_rand(1000000, 99999999); ?>" method="post"> action="lab_enter.php?pz1=<? echo mt_rand(1000000, 99999999); ?>" method="post">
<fieldset style='padding-left: 5; width=50%'> <fieldset style='padding-left: 5px; width=50%'>
<legend><b> Группа </b></legend> <legend><b> Группа </b></legend>
Тип похода: Тип похода:
<select name="type_gors" style="margin-left:7px;" id="type_gors"> <select name="type_gors" style="margin-left:7px;" id="type_gors">

View File

@ -106,7 +106,7 @@ if ($user['battle'] > 0) {
mysql_query("UPDATE `inventory` SET `duration` = `duration`+1 WHERE `id` = '" . $us['kol'] . "' LIMIT 1;"); mysql_query("UPDATE `inventory` SET `duration` = `duration`+1 WHERE `id` = '" . $us['kol'] . "' LIMIT 1;");
addch("<img src=i/magic/vampir.gif>{$golod} &quot;{$user['login']}&quot; {$action} на &quot;{$target}&quot;, но {$otvet} достойный отпор вампиру."); addch("<img src=i/magic/vampir.gif>{$golod} &quot;{$user['login']}&quot; {$action} на &quot;{$target}&quot;, но {$otvet} достойный отпор вампиру.");
} else { } else {
mysql_query("UPDATE `users` SET `hp` = '" . (round(($user['hp'] / 2), 0)) . "' WHERE `id` = '" . $user['id'] . "';"); mysql_query("UPDATE `users` SET `hp` = '" . (round($user['hp'] / 2)) . "' WHERE `id` = '" . $user['id'] . "';");
mysql_query("UPDATE `inventory` SET `duration` = `duration`+1 WHERE `id` = '" . $us['kol'] . "' LIMIT 1;"); mysql_query("UPDATE `inventory` SET `duration` = `duration`+1 WHERE `id` = '" . $us['kol'] . "' LIMIT 1;");
addch("<img src=i/magic/vampir.gif>{$golod} &quot;{$user['login']}&quot; {$action} на &quot;{$target}&quot;, но {$otvet} достойный отпор вампиру."); addch("<img src=i/magic/vampir.gif>{$golod} &quot;{$user['login']}&quot; {$action} на &quot;{$target}&quot;, но {$otvet} достойный отпор вампиру.");
$jert = $us; $jert = $us;

View File

@ -1,12 +1,15 @@
<?php <?php
use Battles\Bank; use Battles\Bank;
use Battles\Database\DBPDO;
use Battles\GameLogs; use Battles\GameLogs;
use Battles\Template; use Battles\Template;
use Battles\User;
session_start(); session_start();
require_once("functions.php"); require_once("functions.php");
$d = db::c()->query('SELECT SUM(`massa`) FROM `inventory` WHERE `dressed` = 0 AND `owner` = ?i', $_SESSION['uid'])->fetch_assoc(); $user = $user ?? new User($_SESSION['uid']);
$db = new DBPDO();
define('GRAV_LIMIT', 32); define('GRAV_LIMIT', 32);
define('GRAV_COST', 30); define('GRAV_COST', 30);
define('REPAIR_STATUS', [ define('REPAIR_STATUS', [
@ -21,12 +24,14 @@ $itemId = $_POST['itemId'] ?? null;
$gravirovkaRemove = $_POST['gravirovka_remove'] ?? null; $gravirovkaRemove = $_POST['gravirovka_remove'] ?? null;
$action = $_POST['action'] ?? null; $action = $_POST['action'] ?? null;
$goto = $_POST['goto'] ?? null; $goto = $_POST['goto'] ?? null;
$remont_query = null;
$gravirovka_query = null;
// Гравировка 30 кред. Максимум 32 символа. // Гравировка 30 кред. Максимум 32 символа.
if ($gravirovkaText && $itemId) { if ($gravirovkaText && $itemId) {
if ($user->money >= GRAV_COST) { if ($user->money >= GRAV_COST) {
if (iconv_strlen($gravirovkaText) <= GRAV_LIMIT) { if (iconv_strlen($gravirovkaText) <= GRAV_LIMIT) {
db::c()->query('UPDATE `inventory` SET `text` = "?s" WHERE `dressed` = 0 AND `setsale` = 0 AND `owner` = ?i AND `id` = ?i', $gravirovkaText, $_SESSION['uid'], $itemId); $db->execute('UPDATE inventory SET text = ? WHERE dressed_slot = 0 AND on_sale = 0 AND owner_id = ? AND id = ?', [$gravirovkaText, $user->id, $itemId]);
$user->money -= GRAV_COST; $user->money -= GRAV_COST;
Bank::setWalletMoney($user->money, $user->id); Bank::setWalletMoney($user->money, $user->id);
$status = REPAIR_STATUS['OK_GRAV_ADDED']; $status = REPAIR_STATUS['OK_GRAV_ADDED'];
@ -40,7 +45,7 @@ if ($gravirovkaText && $itemId) {
// Снять гравировку. // Снять гравировку.
if ($gravirovkaRemove) { if ($gravirovkaRemove) {
if ($user->money >= GRAV_COST) { if ($user->money >= GRAV_COST) {
db::c()->query('UPDATE `inventory` SET `text` = ?n WHERE `dressed` = 0 AND `setsale` = 0 AND `id` = ?i AND `owner` = ?i', null, $gravirovkaRemove, $_SESSION['uid']); $db->execute('UPDATE inventory SET text = null WHERE dressed_slot = 0 AND on_sale = 0 AND owner_id = ? AND id = ?', [$user->id, $itemId]);
$user->money -= GRAV_COST; $user->money -= GRAV_COST;
Bank::setWalletMoney($user->money, $user->id); Bank::setWalletMoney($user->money, $user->id);
$status = REPAIR_STATUS['OK_GRAV_REMOVED']; $status = REPAIR_STATUS['OK_GRAV_REMOVED'];
@ -49,28 +54,29 @@ if ($gravirovkaRemove) {
} }
} }
// Ремонт 0,5 кред за единицу. // Ремонт 0,5 кред за единицу.
// Пока что лимит ремонта поставлен на 25. Дальше можно обыграть.
if ($action == 'repair' && $itemId) { if ($action == 'repair' && $itemId) {
$q = db::c()->query('SELECT `name`, `duration` FROM `inventory` WHERE id = ?i', $itemId)->fetch_assoc(); $q = $db->ofetch('SELECT name, durability FROM inventory WHERE item_id = ?', $itemId);
if ($user->money > ceil($q['duration'] / 2)) { if ($user->money > ceil($q->duration / 2)) {
db::c()->query('UPDATE `inventory` SET `maxdur` = `maxdur` - 1, `duration` = 0 WHERE `dressed` = 0 AND `setsale` = 0 AND `id` = ?i AND `owner` = ?i', $itemId, $_SESSION['uid']); $db->execute('UPDATE inventory SET duration = 25 WHERE dressed_slot = 0 AND on_sale = 0 AND owner_id = ? AND id = ?', [$user->id, $itemId]);
$user->money -= ceil($q['duration'] / 2); $user->money -= ceil($q->duration / 2);
Bank::setWalletMoney($user->money, $user->id); Bank::setWalletMoney($user->money, $user->id);
GameLogs::addUserLog($user->id, 'Отремонтирован предмет «' . $q['name'] . '» id:(' . $itemId . ') за ' . ceil($q['duration'] / 2) . ' кр.'); GameLogs::addUserLog($user->id, 'Отремонтирован предмет «' . $q->name . '» id:(' . $itemId . ') за ' . ceil($q->duration / 2) . ' кр.');
$status = REPAIR_STATUS['OK_REPAIRED']; $status = REPAIR_STATUS['OK_REPAIRED'];
} else { } else {
$status = REPAIR_STATUS['ERROR_NO_MONEY']; $status = REPAIR_STATUS['ERROR_NO_MONEY'];
} }
} }
if ($goto == 'remont') { if ($goto == 'remont') {
$remont_query = db::c()->query('SELECT `id`,`name`,`img`,`duration`,`maxdur` FROM `inventory` WHERE `type` < 12 AND `dressed` = 0 AND `isrep` = 1 AND `setsale` = 0 AND `duration` > 0 AND `owner` = ?i ORDER BY `update` DESC', $_SESSION['uid']); $remont_query = $db->ofetchAll('SELECT item_id, name, image, durability FROM inventory WHERE item_type < 12 AND dressed_slot = 0 AND on_sale = 0 AND durability < 25 AND owner_id = ? ORDER BY name', $user->id);
} }
if ($goto == 'gravirovka') { if ($goto == 'gravirovka') {
$gravirovka_query = db::c()->query('SELECT `id`,`name`,`img`,`text` FROM `inventory` WHERE `owner` = ?i AND `dressed` = 0 AND `type` = 3 AND `name` NOT LIKE "?S" AND `setsale` = 0 OR `text` <> "?s" AND `owner` = ?i AND `dressed` = 0 AND `setsale` = 0 ORDER by `update` DESC', $_SESSION['uid'], '%Букет%', '', $_SESSION['uid']); $gravirovka_query = $db->ofetchAll('SELECT item_id, name, image, text FROM inventory WHERE owner_id = ? AND dressed_slot = 0 AND item_type = 3 AND name NOT LIKE "%Букет%" AND on_sale = 0 OR text IS NOT NULL AND owner_id = ? AND dressed_slot = 0 AND on_sale = 0 ORDER BY name', [$user->id, $user->id]);
} }
Template::header('Кузня'); Template::header('Кузня');
?> ?>
<link href="css/secondary.css" rel="stylesheet"/> <link href="css/secondary.css" rel="stylesheet"/>
<script src="js/main.js"></script> <script src="js/main.js"></script>
<h1>Ремонтная мастерская</h1> <h1>Ремонтная мастерская</h1>
<a href=# onclick=hrefToFrame('city.php?cp')> ← выйти из мастерской</a><br> <a href=# onclick=hrefToFrame('city.php?cp')> ← выйти из мастерской</a><br>
<div class="appblock appblock-main"> <div class="appblock appblock-main">
@ -102,89 +108,49 @@ Template::header('Кузня');
<?php endif; ?> <?php endif; ?>
</div> </div>
<?php if ($goto == 'remont'): <?php if ($goto == 'remont'):
while ($row = $remont_query->fetch_assoc()): ?> $i = 0;
while ($i < count($remont_query)): ?>
<div class="appblock"> <div class="appblock">
<span class="legend"><?= $row['name'] ?></span> <span class="legend"><?= $remont_query[$i]->name ?></span>
<span class="wrap">Состояние предмета<span class="num"><?= $row['duration'] ?>/<?= $row['maxdur'] ?></span></span> <span class="wrap">Состояние предмета<span class="num"><?= $remont_query[$i]->duration ?>/25</span></span>
<span class="wrap">Стоимость услуги<span class="num"><?= ceil($row['duration'] / 2) ?></span></span> <span class="wrap">Стоимость услуги<span class="num"><?= ceil($remont_query[$i]->duration / 2) ?></span></span>
<div style="text-align: center"> <div style="text-align: center">
<img src="i/sh/<?= $row['img'] ?>"> <img src="i/sh/<?= $remont_query[$i]->img ?>" alt="item">
<form method="post"> <form method="post">
<input type="hidden" name="itemId" value="<?= $row['id'] ?>"> <input type="hidden" name="itemId" value="<?= $remont_query[$i]->id ?>">
<input type="hidden" name="action" value="repair"> <input type="hidden" name="action" value="repair">
<input type="submit" value="Ремонт"> <input type="submit" value="Ремонт">
</form> </form>
</div> </div>
</div> </div>
<?php endwhile; endif; ?> <?php $i++; endwhile;
unset($i); endif; ?>
<?php if ($goto == 'gravirovka'): <?php if ($goto == 'gravirovka'):
while ($row = $gravirovka_query->fetch_assoc()): ?> $i = 0;
while ($i < count($gravirovka_query)): ?>
<div class="appblock"> <div class="appblock">
<span class="legend"><?= $row['name'] ?></span> <span class="legend"><?= $gravirovka_query[$i]->name ?></span>
<span class="wrap">Стоимость услуги<span class="num">30</span></span> <span class="wrap">Стоимость услуги<span class="num">30</span></span>
<div style="text-align: center"> <div style="text-align: center">
<?php if (empty($row['text'])): ?> <?php if (empty($gravirovka_query[$i]->text)): ?>
<form method="post" id="gravirovka"> <form method="post" id="gravirovka">
<input maxlength="32" placeholder="Текст гравировки" name="gravirovka_text"> <label>
<br><img src="i/sh/<?= $row['img'] ?>"><br> <input maxlength="32" placeholder="Текст гравировки" name="gravirovka_text">
<input type="hidden" name="itemId" value="<?= $row['id'] ?>"> </label>
<br><img src="i/sh/<?= $gravirovka_query[$i]->img ?>" alt="item"><br>
<input type="hidden" name="itemId" value="<?= $gravirovka_query[$i]->id ?>">
<input type="submit" value="Добавить надпись"> <input type="submit" value="Добавить надпись">
</form> </form>
<?php else: ?> <?php else: ?>
<form method="post" id="gravirovka"> <form method="post" id="gravirovka">
<input value="<?= $row['text'] ?>" readonly title> <input value="<?= $gravirovka_query[$i]->text ?>" readonly title>
<br><img src="i/sh/<?= $row['img'] ?>"><br> <br><img src="i/sh/<?= $gravirovka_query[$i]->img ?>" alt="item"><br>
<input type="hidden" name="gravirovka_remove" value="<?= $row['id'] ?>"> <input type="hidden" name="gravirovka_remove" value="<?= $gravirovka_query[$i]->id ?>">
<input type="submit" value="Удалить надпись"> <input type="submit" value="Удалить надпись">
</form> </form>
<?php endif; ?> <?php endif; ?>
</div> </div>
</div> </div>
<?php endwhile; endif; ?> <?php $i++; endwhile;
unset($i); endif; ?>
<?php
if ($goto == 'modding') {
$data = mysql_query("SELECT * FROM `inventory` WHERE `type` < 12 AND `type` != 3 AND `owner` = '{$_SESSION['uid']}' AND `dressed` = 0 AND `name` NOT LIKE '% (мф)%' AND `name` NOT LIKE '%Букет%' AND `setsale`=0 ORDER by `update` DESC; ");
while ($row = mysql_fetch_array($data)) {
?>
<TR bgcolor=<?= $color ?>>
<TD align=center><IMG SRC="i/sh/<?= $row['img'] ?>" BORDER=0>";
<BR>
<small>
<A HREF="?razdel=3&mf=<?= $row['id'] ?>"
onClick="if(!confirm('Вы действительно хотите модифицировать эту вещь?')){ return false;}">Модифицировать
за <?= $row['cost'] ?> кр.</A><BR>
</small>
<TD valign=top><?php #showitem($row) ?>
<?php
}
}
if ($goto == 'podgon') {
$data = mysql_query("SELECT * FROM `inventory` WHERE `type` < 12 AND `type` != 3 AND `owner` = '{$user['id']}' AND `dressed` = 0 AND `modif`='1' AND `podgon`<'5' AND `name` NOT LIKE '%Букет%' AND `setsale`=0 ORDER by `update` DESC; ");
while ($row = mysql_fetch_array($data)) {
?>
<TR bgcolor=<?= $color ?>>
<TD align=center><IMG SRC="i/sh/<?= $row['img'] ?>" BORDER=0>";
<BR>
<small>
<?
if ($row['point'] > 0) {
$babki = round(($row['point'] / 2), 0);
$cost_t = 'Реп';
} else {
$babki = round(($row['cost'] / 2), 0);
$cost_t = 'Кр';
}
?>
<A HREF="?razdel=4&podgon=<?= $row['id'] ?>"
onclick="if(!confirm('Вы действительно хотите подогнать эту вещь?')){ return false;}">Подогнать
за <?= $babki ?> <?= $cost_t ?>.</A><BR>
</small>
<TD valign=top><?php #showitem($row) ?>
<?php
}
}
?>
</TABLE>

View File

@ -1,7 +1,11 @@
<?php <?php
use Battles\Template;
use Battles\User;
session_start(); session_start();
require_once "functions.php"; require_once "functions.php";
$user = $user ?? new \Battles\User($_SESSION['uid']); $user = $user ?? new User($_SESSION['uid']);
if ($user->level < 4 && $user->level > 10) { if ($user->level < 4 && $user->level > 10) {
header('location: main.php?act=none'); header('location: main.php?act=none');
exit; exit;
@ -11,7 +15,7 @@ if ($user->room == 403) {
header('Location: canalizaciya.php'); header('Location: canalizaciya.php');
exit; exit;
} }
\Battles\Template::header('Вход в водосток'); Template::header('Вход в водосток');
?> ?>
<style> <style>
legend { legend {
@ -73,7 +77,7 @@ if ($user->room == 403) {
if ($wawe == 0) { if ($wawe == 0) {
echo "<FORM id='REQUEST'> echo "<FORM id='REQUEST'>
<FIELDSET style='padding-left: 5; width=50%; color:#000000;'> <FIELDSET style='padding-left: 5px; width=50%; color:#000000;'>
<LEGEND><B> Группа </B> </LEGEND> <LEGEND><B> Группа </B> </LEGEND>
Комментарий <INPUT style=\"font-size:12px;\" TYPE=text NAME=cmt maxlength=40 size=40><BR> Комментарий <INPUT style=\"font-size:12px;\" TYPE=text NAME=cmt maxlength=40 size=40><BR>
Пароль&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <INPUT style=\"font-size:12px;\" TYPE=password NAME=pass maxlength=6 size=40><BR> Пароль&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <INPUT style=\"font-size:12px;\" TYPE=password NAME=pass maxlength=6 size=40><BR>
@ -85,7 +89,7 @@ if ($user->room == 403) {
} else { } else {
print"<FORM id='REQUEST'> print"<FORM id='REQUEST'>
<FIELDSET style='padding-left: 5; width=50%'> <FIELDSET style='padding-left: 5px; width=50%'>
<LEGEND><B> Группа </B> </LEGEND>"; <LEGEND><B> Группа </B> </LEGEND>";
if ($nawe == 1) { if ($nawe == 1) {
echo "<INPUT style=\"font-size:12px;\" type='submit' name='start' value='Начать'> &nbsp;"; echo "<INPUT style=\"font-size:12px;\" type='submit' name='start' value='Начать'> &nbsp;";