code-upload #1
2
.gitattributes
vendored
Normal file
2
.gitattributes
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
i/** filter=lfs diff=lfs merge=lfs -text
|
||||
img/** filter=lfs diff=lfs merge=lfs -text
|
18
.htaccess
Normal file
18
.htaccess
Normal file
@ -0,0 +1,18 @@
|
||||
# Disable access to this files
|
||||
<FilesMatch "\.(dat)$">
|
||||
Deny from all
|
||||
</FilesMatch>
|
||||
# Default startup page
|
||||
DirectoryIndex index.php
|
||||
# Disable output dirs
|
||||
Options -Indexes
|
||||
# UTF8 support
|
||||
AddDefaultCharset utf8
|
||||
<IfModule mod_charset.c>
|
||||
CharsetDisable on
|
||||
CharsetRecodeMultipartForms Off
|
||||
</IfModule>
|
||||
php_value default_charset UTF-8
|
||||
php_flag zlib.output_compression On
|
||||
FileETag none
|
||||
ErrorDocument 404 /engline/error/404.html
|
8
.idea/.gitignore
generated
vendored
Normal file
8
.idea/.gitignore
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Datasource local storage ignored files
|
||||
/../../../../../../:\Users\lopar\Downloads\AntiCombats\.idea/dataSources/
|
||||
/dataSources.local.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
6
.idea/dictionaries
generated
Normal file
6
.idea/dictionaries
generated
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectDictionaryState">
|
||||
<dictionary name="Lopar" />
|
||||
</component>
|
||||
</project>
|
10
.idea/misc.xml
generated
Normal file
10
.idea/misc.xml
generated
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="SvnConfiguration">
|
||||
<configuration>C:\Users\lopar.LIDOM\AppData\Roaming\Subversion</configuration>
|
||||
</component>
|
||||
<component name="VagrantProjectSettings">
|
||||
<option name="instanceFolder" value="" />
|
||||
<option name="provider" value="" />
|
||||
</component>
|
||||
</project>
|
22
README.md
22
README.md
@ -1,2 +1,24 @@
|
||||
# AntiBK
|
||||
|
||||
## Что тут у нас?
|
||||
Всё как вы любите и большинство не умеет:
|
||||
- База подключена через внешний класс и вызывается в одном месте.
|
||||
- Процентов на... ну как минимум половина всего переехала на сравнительно чистый ООП.
|
||||
- База в UTF8.
|
||||
- Всё организовано по папочкам.
|
||||
- Старый, неиспользованый, мусорный код отправлен в мусорку.
|
||||
|
||||
## Как запустить?
|
||||
В файле `/engine/config.php` прописать логин и пароль от базы данных.
|
||||
Саму базу можно найти в `/sql/Full.sql`.
|
||||
Разберётесь, не маленькие.
|
||||
|
||||
## Какой БК? Версия? Что, слабо сказать?
|
||||
В номерах БК я разбираюсь откровенно дерьмово, но это та версия, где штаны уже есть, но предметы ещё на прозрачном фоне, *если вы понимаете о чём я*.
|
||||
|
||||
## Демо! Демо покажи! Без демо не варик!
|
||||
Парни, вы нормальные? И так даром отдаю…
|
||||
|
||||
## О дéньгах, куда без них.
|
||||
Смотрите, давайте решим так. Движок берите — он хороший. Лучше большинства пабликов по чистоте кода.
|
||||
Если вам понравилось и вы захотите сказать мне спасибо, бросьте немного долларов на карту `5375 4188 0034 7809`.
|
3
admin/.htaccess
Normal file
3
admin/.htaccess
Normal file
@ -0,0 +1,3 @@
|
||||
Order deny,allow
|
||||
Deny from all
|
||||
Allow from 127.0.0.1
|
131
admin/ajax.php
Normal file
131
admin/ajax.php
Normal file
@ -0,0 +1,131 @@
|
||||
<?
|
||||
session_start();
|
||||
define('AntiBK', true);
|
||||
|
||||
include("../engline/config.php");
|
||||
include("../engline/dbsimple/Generic.php");
|
||||
include("../engline/data/data.php");
|
||||
include("../engline/functions/functions.php");
|
||||
|
||||
$guid = getGuid('ajax', '../');
|
||||
|
||||
$adb = DbSimple_Generic::connect($database['adb']);
|
||||
$adb->query("SET NAMES ? ",$database['db_encoding']);
|
||||
$adb->setErrorHandler("databaseErrorHandler");
|
||||
|
||||
$char = Char::initialization($guid, $adb);
|
||||
|
||||
$char->test->Guid('ajax', '../');
|
||||
$char->test->Admin('ajax', '../');
|
||||
|
||||
$do = getVar('do');
|
||||
|
||||
switch ($do)
|
||||
{
|
||||
/*Отображение типов предметов*/
|
||||
case 'showtypes':
|
||||
$section = getVar('section');
|
||||
|
||||
if (!$section)
|
||||
die('');
|
||||
|
||||
$types = $adb->selectCol("SELECT `type` AS ARRAY_KEY FROM `admin_item_create` WHERE `section` = ?s and `type` != 'lang';", $section);
|
||||
|
||||
$return = "<select class='field' name='type'><option value='' selected></option>";
|
||||
foreach ($types as $type => $n)
|
||||
$return .= "<option value='$type'>$type</option>";
|
||||
$return .= "</select><br>";
|
||||
die($return);
|
||||
break;
|
||||
/*Отображение полей предмета*/
|
||||
case 'showfields':
|
||||
$type = getVar('type');
|
||||
|
||||
if (!$type)
|
||||
die('');
|
||||
|
||||
$lang = $adb->selectRow("SELECT * FROM `admin_item_create` WHERE `type` = 'lang';");
|
||||
$fields = $adb->selectRow("SELECT * FROM `admin_item_create` WHERE `type` = ?s", $type);
|
||||
$table = "<table border='0'>";
|
||||
$a = 0;
|
||||
foreach ($fields as $field => $val)
|
||||
{
|
||||
if (!$val || $field == 'section' || $field == 'type')
|
||||
continue;
|
||||
|
||||
$title = $field;
|
||||
switch ($field)
|
||||
{
|
||||
case 'item_flags': $title .= " 1-Sellable, 2-Repairable, 4-Artefact, 8-Personal, 16-Left Hand"; break;
|
||||
case 'name': $return = "<font class='header'>Основные:<hr></font>$table"; $i = 0; $c = 7; break;
|
||||
case 'min_level': $return .= "</table><font class='header'>Требования:<hr></font>$table"; $i = 0; $c = 11; break;
|
||||
case 'add_str': $return .= "</table><font class='header'>Характеристики:<hr></font>$table"; $i = 0; $c = 9; break;
|
||||
case 'def_h':
|
||||
case 'def_a':
|
||||
case 'def_b':
|
||||
case 'def_l':
|
||||
case 'attack':
|
||||
case 'add_hit_min': if(!$a){$return .= "</table><font class='header'>Защита и урон:<hr></font>$table"; $i = 0; $c = 7; $a = 1;} break;
|
||||
case 'res_magic': $return .= "</table><font class='header'>Резисты:<hr></font>$table"; $i = 0; $c = 12; break;
|
||||
case 'mf_dmg': $return .= "</table><font class='header'>Мф удара:<hr></font>$table"; $i = 0; $c = 10; break;
|
||||
case 'mf_acrit': $return .= "</table><font class='header'>Мф усиления:<hr></font>$table"; $i = 0; $c = 9; break;
|
||||
case 'all_magic': $return .= "</table><font class='header'>Умения:<hr></font>$table"; $i = 0; $c = 12; break;
|
||||
case 'rep_magic': $return .= "</table><font class='header'>Подавления:<hr></font>$table"; $i = 0; $c = 7; break;
|
||||
case 'ch_sting': $return .= "</table><font class='header'>Шансы:<hr></font>$table"; $i = 0; $c = 10; break;
|
||||
case 'inc_count': $return .= "</table><font class='header'>Дополнительно:<hr></font>$table"; $i = 0; $c = 9; break;
|
||||
case 'description': $return .= '</tr><tr>'; break;
|
||||
}
|
||||
|
||||
switch ($field)
|
||||
{
|
||||
case 'name':
|
||||
case 'personal_owner':
|
||||
case 'img': $size = 150; break;
|
||||
case 'validity':
|
||||
case 'price':
|
||||
case 'price_euro': $size = 60; break;
|
||||
case 'description': $size = 300; break;
|
||||
default: $size = 30; break;
|
||||
}
|
||||
|
||||
$return .= "<td title='$title'>$lang[$field]:</td><td><input class='field' type='text' name='$field' style='width: ".$size."px;'></td>";
|
||||
$i++;
|
||||
if (!($i % $c))
|
||||
$return .= '</tr><tr>';
|
||||
}
|
||||
$return .= "</tr></table><input type='submit' name='create' value='Создать'>";
|
||||
die($return);
|
||||
break;
|
||||
/*Создание предмета*/
|
||||
case 'createitem':
|
||||
$fields = getVar('fields');
|
||||
$sql = array();
|
||||
$field = explode('$$', $fields);
|
||||
unset($field[count($field) - 1]);
|
||||
foreach ($field as $fill)
|
||||
{
|
||||
$f = explode('=', $fill);
|
||||
$sql[$f[0]] = $f[1];
|
||||
}
|
||||
$adb->query("INSERT INTO `item_template` (?#) VALUES (?a);",array_keys($sql), array_values($sql));
|
||||
die('complete');
|
||||
break;
|
||||
/*Удаление персонажа*/
|
||||
case 'delete_char':
|
||||
$d_guid = getVar('d_guid');
|
||||
$adb->query("DELETE FROM `character_bank` WHERE `guid` = ?d", $d_guid);
|
||||
$adb->query("DELETE FROM `character_bars` WHERE `guid` = ?d", $d_guid);
|
||||
$adb->query("DELETE FROM `character_effects` WHERE `guid` = ?d", $d_guid);
|
||||
$adb->query("DELETE FROM `character_equip` WHERE `guid` = ?d", $d_guid);
|
||||
$adb->query("DELETE FROM `character_info` WHERE `guid` = ?d", $d_guid);
|
||||
$adb->query("DELETE FROM `character_inventory` WHERE `guid` = ?d", $d_guid);
|
||||
$adb->query("DELETE FROM `character_sets` WHERE `guid` = ?d", $d_guid);
|
||||
$adb->query("DELETE FROM `character_stats` WHERE `guid` = ?d", $d_guid);
|
||||
$adb->query("DELETE FROM `characters` WHERE `guid` = ?d", $d_guid);
|
||||
$adb->query("DELETE FROM `history_auth` WHERE `guid` = ?d", $d_guid);
|
||||
$adb->query("DELETE FROM `history_mail` WHERE `guid` = ?d", $d_guid);
|
||||
$adb->query("DELETE FROM `history_items` WHERE `guid` = ?d", $d_guid);
|
||||
die('complete');
|
||||
break;
|
||||
}
|
||||
?>
|
13
admin/functions.php
Normal file
13
admin/functions.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?
|
||||
defined('AntiBK') or die('Доступ запрещен!');
|
||||
|
||||
function formatfilesize ($data)
|
||||
{
|
||||
// bytes
|
||||
if ($data < 1024) return $data.' bytes';
|
||||
// kilobytes
|
||||
else if ($data < 1024000) return round(($data / 1024), 1).' kb';
|
||||
// megabytes
|
||||
else return round(($data / 1024000), 1).' mb';
|
||||
}
|
||||
?>
|
BIN
admin/img/arrow_down.gif
Normal file
BIN
admin/img/arrow_down.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 949 B |
BIN
admin/img/arrow_up.gif
Normal file
BIN
admin/img/arrow_up.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 949 B |
BIN
admin/img/enter.gif
Normal file
BIN
admin/img/enter.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.1 KiB |
BIN
admin/img/logo.gif
Normal file
BIN
admin/img/logo.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.6 KiB |
BIN
admin/img/redo.png
Normal file
BIN
admin/img/redo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
61
admin/index.php
Normal file
61
admin/index.php
Normal file
@ -0,0 +1,61 @@
|
||||
<?
|
||||
session_start();
|
||||
define('AntiBK', true);
|
||||
|
||||
include("../engline/config.php");
|
||||
include("../engline/dbsimple/Generic.php");
|
||||
include("../engline/data/data.php");
|
||||
include("../engline/functions/functions.php");
|
||||
|
||||
$guid = getGuid('game', '../');
|
||||
|
||||
$adb = DbSimple_Generic::connect($database['adb']);
|
||||
$adb->query("SET NAMES ? ",$database['db_encoding']);
|
||||
$adb->setErrorHandler("databaseErrorHandler");
|
||||
|
||||
$char = Char::initialization($guid, $adb);
|
||||
|
||||
$char->test->Guid('game', '../');
|
||||
$char->test->Admin('game', '../');
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<title>Административная панель</title>
|
||||
<link rel="stylesheet" type="text/css" href="css.css">
|
||||
<script src="../scripts/jquery.js" type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
$(function (){
|
||||
$('#none').css('font-weight', 'bold');
|
||||
$('body').on('click', '.menu', function (){
|
||||
$('.menu').css('font-weight', 'normal');
|
||||
$(this).css('font-weight', 'bold');
|
||||
});
|
||||
$('[name=main]').attr('height', ($(window).height()-150));
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body bgColor="#3D3D3B">
|
||||
<table align="center" cellpadding="0" cellspacing="0" width="100%" height="100%" style="padding: 10px;">
|
||||
<tr><td align="center" colspan="2"><img src="img/enter.gif"><div align='right'>Здравствуйте, <strong><?echo $char->getLogin();?></strong> (<a href='javascript:window.close();' style='color: red; text-decoration: underline;'>Выход</a>)</div></td></tr>
|
||||
<tr height="100%">
|
||||
<td valign="top" width="240">
|
||||
<div class="white">Навигация</div><hr>
|
||||
<?
|
||||
$rows = $adb->select("SELECT * FROM `admin_menu` ORDER BY `id`;");
|
||||
foreach ($rows as $menu)
|
||||
{
|
||||
echo "<a href='main.php?act=$menu[href]' target='main' onclick='this.blur();' class='menu' id='$menu[href]'>$menu[name]</a><br>";
|
||||
if (in_array($menu['href'], array('coder', 'travm')))
|
||||
echo "<hr>";
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td valign="top">
|
||||
<div class="white" id="info">Информация</div><hr>
|
||||
<iframe src="main.php" width="100%" height="500" noresize frameborder="0" name="main"></iframe>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td colspan="2" align='center'><small>Powered by Madmunus</small></td></tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
40
admin/main.php
Normal file
40
admin/main.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?
|
||||
session_start();
|
||||
define('AntiBK', true);
|
||||
|
||||
include("../engline/config.php");
|
||||
include("../engline/dbsimple/Generic.php");
|
||||
include("../engline/data/data.php");
|
||||
include("../engline/functions/functions.php");
|
||||
include("functions.php");
|
||||
|
||||
$guid = getGuid('main', '../');
|
||||
|
||||
$adb = DbSimple_Generic::connect($database['adb']);
|
||||
$adb->query("SET NAMES ? ",$database['db_encoding']);
|
||||
$adb->setErrorHandler("databaseErrorHandler");
|
||||
|
||||
$char = Char::initialization($guid, $adb);
|
||||
|
||||
$char->test->Guid('main', '../');
|
||||
$char->test->Admin('main', '../');
|
||||
|
||||
$act = getVar('act', 'none');
|
||||
$acts = $adb->selectCol("SELECT `href` AS ARRAY_KEY, `name` FROM `admin_menu`;");
|
||||
$act = (array_key_exists($act, $acts)) ?$act :'none';
|
||||
?>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<script src="../scripts/jquery.js" type="text/javascript"></script>
|
||||
<script src="../scripts/show.js" type="text/javascript"></script>
|
||||
<link rel="stylesheet" type="text/css" href="style.css">
|
||||
</head>
|
||||
<script type="text/javascript">$('#info', parent.document).html('Информация: <?echo $acts[$act];?>');</script>
|
||||
<?
|
||||
switch ($act)
|
||||
{
|
||||
case 'none': echo "<center><img src='img/logo.gif'></center>"; break;
|
||||
case 'phpinfo': phpinfo(); break;
|
||||
default: include("module/$act.php"); break;
|
||||
}
|
||||
?>
|
40
admin/module/add.php
Normal file
40
admin/module/add.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?
|
||||
defined('AntiBK') or die("Доступ запрещен!");
|
||||
?>
|
||||
<script>
|
||||
$(function (){
|
||||
$('body').on('change', '[name=section]', function (){
|
||||
$('#types').html('');
|
||||
$('#fields').html('');
|
||||
$.post('ajax.php', {'do': 'showtypes', 'section': $(this).val()}, function (data){
|
||||
$('#types').html(data);
|
||||
});
|
||||
}).on('change', '[name=type]', function (){
|
||||
$('#fields').html('');
|
||||
$.post('ajax.php', {'do': 'showfields', 'type': $(this).val()}, function (data){
|
||||
$('#fields').html(data);
|
||||
});
|
||||
}).on('click', '[name=create]', function (){
|
||||
var fields = '';
|
||||
$('.field').each(function (){if ($(this).val()) fields += $(this).attr('name')+'='+$(this).val()+'$$';});
|
||||
$.post('ajax.php', {'do': 'createitem', 'fields': fields}, function (data){
|
||||
if (data == 'complete')
|
||||
alert('Предмет создан');
|
||||
else
|
||||
alert(data);
|
||||
});
|
||||
$('#fields').html('');
|
||||
$.post('ajax.php', {'do': 'showfields', 'type': $('[name=type]').val()}, function (data){
|
||||
$('#fields').html(data);
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
Тип предмета:
|
||||
<select class='field' name="section">
|
||||
<option value="" selected></option>
|
||||
<option value="item">item</option>
|
||||
<option value="thing">thing</option>
|
||||
</select>
|
||||
<font id='types'></font>
|
||||
<font id='fields'></font>
|
76
admin/module/chars.php
Normal file
76
admin/module/chars.php
Normal file
@ -0,0 +1,76 @@
|
||||
<?
|
||||
defined('AntiBK') or die("Доступ запрещен!");
|
||||
|
||||
$sort = getVar('sort', 'guid', 2);
|
||||
$sort_c = array(
|
||||
'guid' => 'ID',
|
||||
'login' => 'Логин',
|
||||
'admin_level' => 'Админ',
|
||||
'level' => 'Уровень',
|
||||
'exp' => 'Опыт',
|
||||
'money' => 'Деньги',
|
||||
'room' => 'Комната',
|
||||
'city' => 'Город'
|
||||
);
|
||||
$sort = (array_key_exists($sort, $sort_c)) ?$sort :'guid';
|
||||
?>
|
||||
<style>
|
||||
.remove {cursor: pointer;}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
function deleteChar (d_guid)
|
||||
{
|
||||
$.post('ajax.php', {'do': 'delete_char', 'd_guid': d_guid}, function (data){
|
||||
if (data == 'complete')
|
||||
$('tr#'+d_guid).hide();
|
||||
});
|
||||
}
|
||||
|
||||
$(function (){
|
||||
$('body').on('change', 'select[name=sort]', function (){
|
||||
$('form#sort').submit();
|
||||
}).on('click', 'img.remove', function (){
|
||||
deleteChar($(this).attr('id'));
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<form id="sort" action="" method="post">
|
||||
Сортировать по:
|
||||
<select class="small" name="sort">
|
||||
<?
|
||||
foreach ($sort_c as $key => $val)
|
||||
{
|
||||
$select = ($sort == $key) ?" selected" :"";
|
||||
echo "<option value='$key'$select>$val</option>";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</form>
|
||||
<table width="100%" border="1" cellspacing="0" cellpadding="3" align="center">
|
||||
<tr align="center">
|
||||
<?
|
||||
foreach ($sort_c as $key => $val)
|
||||
echo "<td><strong>$val</strong></td>";
|
||||
?>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<?
|
||||
$characters = $adb->select("SELECT `guid`, `login`, `level`, `exp`, `admin_level`, `money`, `city`, `room` FROM `characters` ORDER BY ?#", $sort);
|
||||
foreach ($characters as $character)
|
||||
{
|
||||
$bg = ($adb->selectCell("SELECT `guid` FROM `online` WHERE `guid` = ?d", $character['guid'])) ?"#00FFAA" :"#FFAAAA";
|
||||
$admin = ($character['admin_level']) ?"unlock.gif" :"del.gif";
|
||||
echo "<tr id='$character[guid]' style='background: $bg; text-align: center;'>"
|
||||
. "<td>$character[guid]</td>"
|
||||
. "<td>$character[login]</td>"
|
||||
. "<td><img src='../img/icon/$admin' width='14' height='14' border='0' alt='$character[admin_level] Уровень'></td>"
|
||||
. "<td>$character[level]</td>"
|
||||
. "<td>$character[exp]</td>"
|
||||
. "<td>".getMoney($character['money'])." кр.</td>"
|
||||
. "<td>".$char->city->getRoom($character['room'], $character['city'], 'name')."</td>"
|
||||
. "<td>".$char->city->getCity($character['city'], 'name')."</td>"
|
||||
. "<td width='14'><img src='../img/icon/clear.gif' width='14' height='14' border='0' alt='Удалить персонажа' id='$character[guid]' class='remove'></td>"
|
||||
. "</tr>";
|
||||
}
|
||||
?>
|
||||
</table>
|
40
admin/module/coder.php
Normal file
40
admin/module/coder.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?
|
||||
defined('AntiBK') or die("Доступ запрещен!");
|
||||
|
||||
$tac = getVar('tac', 1);
|
||||
$tot = getVar('tot');
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$(function (){
|
||||
$('body').on('change', 'input[name=tac]', function (){
|
||||
$('form#code').submit();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<table>
|
||||
<form method="post" id="code">
|
||||
<tr>
|
||||
<td>
|
||||
<input type="radio" name="tac" value="1"<?echo ($tac == 1) ?'checked' :''?>>B64 Encode
|
||||
<input type="radio" name="tac" value="2"<?echo ($tac == 2) ?'checked' :''?>>B64 Decode
|
||||
<input type="radio" name="tac" value="3"<?echo ($tac == 3) ?'checked' :''?>>MD5
|
||||
<input type="radio" name="tac" value="4"<?echo ($tac == 4) ?'checked' :''?>>SHA1
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
Текст: <input type="text" name="tot" size="100" value="<?echo $tot;?>"><br>
|
||||
</td>
|
||||
</tr>
|
||||
</form>
|
||||
</table>
|
||||
<?
|
||||
if (!$tot) die();
|
||||
switch ($tac)
|
||||
{
|
||||
case 1: echo "B64 Encode: <b>".base64_encode($tot)."</b>"; break;
|
||||
case 2: echo "B64 Decode: <b>".base64_decode($tot)."</b>"; break;
|
||||
case 3: echo "MD5: <b>".md5($tot)."</b>"; break;
|
||||
case 4: echo "SHA1: <b>".sha1($tot)."</b>"; break;
|
||||
}
|
||||
?>
|
23
admin/module/doc.php
Normal file
23
admin/module/doc.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?
|
||||
defined('AntiBK') or die ("Доступ запрещен!");
|
||||
|
||||
$rows = $adb->select("SELECT * FROM `admin_menu` ORDER BY `id`;");
|
||||
?>
|
||||
<div>
|
||||
Данная документация ещё не доработана, но всё же хотелось бы рассказать об основных функциях и фишках Админ Центра , что же приступим :).<br>
|
||||
<br>
|
||||
1) Основное меню:<br>
|
||||
Основное меню состоит из двух разделов 1 - Навигация : 2 - Информация.
|
||||
<br>
|
||||
<br>
|
||||
Навигация это , то меню где расположенны основные фишки такие как:<br><br>
|
||||
<?
|
||||
foreach ($rows as $menu)
|
||||
{
|
||||
echo "$menu[name]<br>";
|
||||
if (in_array ($menu['href'], array('doc', 'coder', 'travm', 'team2')))
|
||||
echo "<hr>";
|
||||
}
|
||||
?>
|
||||
<br>
|
||||
</div>
|
26
admin/module/hpmp.php
Normal file
26
admin/module/hpmp.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?
|
||||
defined('AntiBK') or die ("Доступ запрещен!");
|
||||
|
||||
$r_login = (isset($_POST['r_login'])) ?$_POST['r_login'] :"";
|
||||
$hp = (isset($_POST['hp'])) ?$_POST['hp'] :"";
|
||||
$mp = (isset($_POST['mp'])) ?$_POST['mp'] :"";
|
||||
?>
|
||||
<form method="post" action="">
|
||||
<strong>Логин</strong><br>
|
||||
<input type="text" name="r_login" size="25"><br>
|
||||
<strong>НР</strong><br>
|
||||
<input type="text" name="hp" size="25"><br>
|
||||
<strong>Манна</strong><br>
|
||||
<input type="text" name="mp" size="25"><br>
|
||||
<input type="submit" name="submit" value="Вылечить"></form>
|
||||
<?
|
||||
if (isset($_POST['r_login']) && isset($_POST['hp']) && isset($_POST['mp']))
|
||||
{
|
||||
$sql = $adb->query(" UPDATE `characters`
|
||||
SET `hp` = '$hp',
|
||||
`mp` = '$mp'
|
||||
WHERE `login` = '$login';
|
||||
");
|
||||
echo "Смена маны и здоровья прошли успешно";
|
||||
}
|
||||
?>
|
25
admin/module/kick.php
Normal file
25
admin/module/kick.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?
|
||||
defined('AntiBK') or die ("Доступ запрещен!");
|
||||
|
||||
$r_login = (isset($_POST['r_login'])) ?$_POST['r_login'] :"";
|
||||
?>
|
||||
<form method="post" action="">
|
||||
<strong>Логин</strong><br>
|
||||
<input type="text" name="r_login" size="25" value="<?echo $r_login;?>">
|
||||
<input type="submit" name="submit" value="Далее">
|
||||
</form>
|
||||
<?
|
||||
if (isset($_POST['r_login']) && $r_login == '')
|
||||
echo "Вы не ввели Логин.";
|
||||
else if ($r_login != '')
|
||||
{
|
||||
$sql = $adb->query(" UPDATE `characters`
|
||||
SET `battle` = '0',
|
||||
`battle_pos` = '',
|
||||
`battle_team` = '',
|
||||
`battle_opponent` = ''
|
||||
WHERE `login` = '$r_login';
|
||||
");
|
||||
echo "Персонаж вытащен из битвы";
|
||||
}
|
||||
?>
|
24
admin/module/kick_all.php
Normal file
24
admin/module/kick_all.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?
|
||||
defined('AntiBK') or die ("Доступ запрещен!");
|
||||
|
||||
$answer = (isset($_POST['answer'])) ?$_POST['answer'] :"";
|
||||
?>
|
||||
<form method="post" action="">
|
||||
<strong>Достать всех из битвы</strong><br>
|
||||
<select name="answer">
|
||||
<option value="no">Нет</option>
|
||||
<option value="yes">Да</option>
|
||||
</select>
|
||||
<input type="submit" name="submit" value="Далее"></form>
|
||||
<?
|
||||
if ($answer == 'yes')
|
||||
{
|
||||
$sql = $adb->query(" UPDATE `characters`
|
||||
SET `battle` = '0',
|
||||
`battle_pos` = '',
|
||||
`battle_team` = '',
|
||||
`battle_opponent` = '';
|
||||
");
|
||||
echo "Все персонажи вытащены из битвы.";
|
||||
}
|
||||
?>
|
79
admin/module/mer.php
Normal file
79
admin/module/mer.php
Normal file
@ -0,0 +1,79 @@
|
||||
<?
|
||||
if (!empty($name))
|
||||
{
|
||||
//$w0="INSERT INTO merit(muj,jena,svid_m,svid_j,templer,log) VALUES ($muj,$jena,$svid_m,$svid_j,$templer,$log)";
|
||||
$wo = "UPDATE merit set muj = '$muj' jena = '$jena' svid_m = '$svid_m' svid_j = '$svid_j' templer = 'templer' log = 'log' ";
|
||||
$res=mysql_query($w0);
|
||||
if ($res)
|
||||
{
|
||||
print "<center>";
|
||||
print "complite";
|
||||
print "<a href=?act=orden&ord=1&spell=18 class=us2>back</a>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "failed";
|
||||
echo mysql_error();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
?>
|
||||
<form action=?act=orden&ord=1&spell=18 name=add method="POST">
|
||||
<table border=0 width=500>
|
||||
<tr>
|
||||
<td>
|
||||
Имя Жениха:
|
||||
</td>
|
||||
<td>
|
||||
<input type=text name=muj class=new size=30>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
Имя Невесты:
|
||||
</td>
|
||||
<td>
|
||||
<input type=text name=jena class=new size=30>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
Имя первого свидетеля:
|
||||
</td>
|
||||
<td>
|
||||
<input type=text name=svid_m class=new size=30>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
Имя второго свидетеля
|
||||
</td>
|
||||
<td>
|
||||
<input type=text name=svid_j class=new size=30>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
Имя темплера проводяшего церемонию:
|
||||
</td>
|
||||
<td>
|
||||
<input type=text name=templer class=new size=30>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
Лог заключения:
|
||||
</td>
|
||||
<td>
|
||||
<input type=text name=log class=new size=30>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td>
|
||||
<input type=submit value="Создать" class=new>
|
||||
</td></tr>
|
||||
</table>
|
||||
</form>
|
||||
<?
|
||||
}
|
||||
?>
|
26
admin/module/metka.php
Normal file
26
admin/module/metka.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?
|
||||
defined('AntiBK') or die ("Доступ запрещен!");
|
||||
|
||||
$r_login = (isset($_POST['r_login'])) ?$_POST['r_login'] :"";
|
||||
$metka = (isset($_POST['metka'])) ?$_POST['metka'] :"";
|
||||
?>
|
||||
<form method="post" action="">
|
||||
<strong>Логин</strong><br>
|
||||
<input type="text" name="r_login" size="25"><br>
|
||||
<strong>Метка</strong><br>
|
||||
<input type="text" name="metka" size="25"><br>
|
||||
<input type="submit" name="submit" value="Далее"></form>
|
||||
<?
|
||||
if (isset($_POST['r_login']) && $r_login == '')
|
||||
echo "Вы не ввели Логин.";
|
||||
else if (isset($_POST['metka']) && $metka == '')
|
||||
echo "Вы не ввели Метку.";
|
||||
else if ($r_login != '' && $metka != '')
|
||||
{
|
||||
$sql = $adb->query(" UPDATE `characters`
|
||||
SET `metka` = '$metka'
|
||||
WHERE `login` = '$r_login';
|
||||
");
|
||||
echo "Персонаж проверен.";
|
||||
}
|
||||
?>
|
26
admin/module/new.php
Normal file
26
admin/module/new.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?
|
||||
defined('AntiBK') or die ("Доступ запрещен!");
|
||||
|
||||
$r_login = (isset($_POST['r_login'])) ?$_POST['r_login'] :"";
|
||||
$r_login_new = (isset($_POST['r_login_new'])) ?$_POST['r_login_new'] :"";
|
||||
|
||||
echo "<form method='post' action=''>"
|
||||
. "<strong>Логин</strong><br>"
|
||||
. "<input type='text' name='r_login' size='25' value='$r_login'><br>"
|
||||
. "<strong>Новый Логин</strong><br>"
|
||||
. "<input type='text' name='r_login_new' size='25' value='$r_login_new'><br>"
|
||||
. "<input type='submit' name='submit' value='Перебросить'></form>";
|
||||
|
||||
if (isset($_POST['r_login']) && $r_login == '')
|
||||
echo "Вы не ввели Логин.";
|
||||
else if (isset($_POST['r_login_new']) && $r_login_new == '')
|
||||
echo "Вы не ввели Новый Логин.";
|
||||
else if ($r_login != '' && $r_login_new != '')
|
||||
{
|
||||
$sql = $adb->query(" UPDATE `inv`
|
||||
SET `owner` = '$r_login_new'
|
||||
WHERE `owner` = '$r_login';
|
||||
");
|
||||
echo "Вещи были переброшены.";
|
||||
}
|
||||
?>
|
53
admin/module/online.php
Normal file
53
admin/module/online.php
Normal file
@ -0,0 +1,53 @@
|
||||
<?
|
||||
defined('AntiBK') or die("Доступ запрещен!");
|
||||
|
||||
$sort = getVar('sort', 'guid', 2);
|
||||
$sort_c = array(
|
||||
'guid' => 'Логин (ID)',
|
||||
'login_display' => 'Отображаемый логин',
|
||||
'last_time' => 'Последняя активность',
|
||||
'room' => 'Комната',
|
||||
'city' => 'Город'
|
||||
);
|
||||
$sort = (array_key_exists($sort, $sort_c)) ?$sort :'guid';
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$(function (){
|
||||
$('body').on('change', 'select[name=sort]', function (){
|
||||
$('form#sort').submit();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<form id="sort" action="" method="post">
|
||||
Сортировать по:
|
||||
<select class="small" name="sort">
|
||||
<?
|
||||
foreach ($sort_c as $key => $val)
|
||||
{
|
||||
$select = ($sort == $key) ?" selected" :"";
|
||||
echo "<option value='$key'$select>$val</option>";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</form>
|
||||
<table width="100%" border="1" cellspacing="0" cellpadding="3" align="center">
|
||||
<tr align="center">
|
||||
<?
|
||||
foreach ($sort_c as $key => $val)
|
||||
echo "<td><strong>$val</strong></td>";
|
||||
?>
|
||||
</tr>
|
||||
<?
|
||||
$online = $adb->select("SELECT `guid`, `login_display`, `last_time`, `city`, `room` FROM `online` ORDER BY ?#", $sort);
|
||||
foreach ($online as $character)
|
||||
{
|
||||
echo "<tr align='center'>"
|
||||
. "<td>".$char->getLogin('clan', $character['guid'])." ($character[guid])</td>"
|
||||
. "<td>$character[login_display]</td>"
|
||||
. "<td>".date("d-m-y H:i:s", $character['last_time'])."</td>"
|
||||
. "<td>".$char->city->getRoom($character['room'], $character['city'], 'name')."</td>"
|
||||
. "<td>".$char->city->getCity($character['city'], 'name')."</td>"
|
||||
. "</tr>";
|
||||
}
|
||||
?>
|
||||
</table>
|
48
admin/module/room.php
Normal file
48
admin/module/room.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?
|
||||
defined('AntiBK') or die ("Доступ запрещен!");
|
||||
|
||||
$room = (isset($_POST['room'])) ?$_POST['room'] :"";
|
||||
$log = (isset($_POST['log'])) ?$_POST['log'] :"";
|
||||
?>
|
||||
<form method="post" action="">
|
||||
<strong>Логин</strong><br>
|
||||
<input type="text" name="log" size="25"><br>
|
||||
<strong>Название комнаты </strong><br>
|
||||
<select name="room">
|
||||
<option value="Зал воинов">Зал воинов</option>
|
||||
<option value="Зал воинов 2">Зал воинов 2</option>
|
||||
<option value="Зал воинов 3">Зал воинов 3</option>
|
||||
<option value="Будуар">Будуар</option>
|
||||
<option value="Этаж 2">Этаж 2</option>
|
||||
<option value="Комната Знахаря">Комната Знахаря</option>
|
||||
<option value="Рыцарский Зал">Рыцарский Зал</option>
|
||||
<option value="Торговый Зал">Торговый Зал</option>
|
||||
<option value="Зал закона">Зал закона</option>
|
||||
<option value="Центральная Площадь">Центральная Площадь</option>
|
||||
<option value="Тюрма">Тюрма</option>
|
||||
<option value="Комиссионый магазин">Комиссионый магазин</option>
|
||||
<option value="Церковь">Церковь</option>
|
||||
<option value="Банк">Банк</option>
|
||||
<option value="Стелла Правосудия">Стелла Правосудия</option>
|
||||
<option value="Магазин">Магазин</option>
|
||||
<option value="Регистратура кланов">Регистратура кланов</option>
|
||||
<option value="Ремонтная мастерская">Ремонтная мастерская</option>
|
||||
<option value="Академия">Академия</option>
|
||||
<option value="работа">работа</option>
|
||||
<option value="Завод">Завод</option>
|
||||
<option value="Пруд">Пруд</option>
|
||||
<option value="Казино">Казино</option>
|
||||
<option value="Лотерея">Лотерея</option>
|
||||
<option value="Кости">Кости</option>
|
||||
<option value="Блек джек холл">Блек джек холл</option>
|
||||
<option value="Подвал">Подвал</option>
|
||||
<option value="Телеграф">Телеграф</option>
|
||||
</select>
|
||||
<input type="submit" name="submit" value="Сменить"></form>
|
||||
<?
|
||||
if (isset($_POST['login']) && isset($_POST['room']))
|
||||
{
|
||||
$sql = $adb->query("UPDATE `characters` SET `room` = '$room' WHERE `login` = '$log';");
|
||||
echo "Все сменено";
|
||||
}
|
||||
?>
|
45
admin/module/room_all.php
Normal file
45
admin/module/room_all.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?
|
||||
defined('AntiBK') or die ("Доступ запрещен!");
|
||||
|
||||
$room = (isset($_POST['room'])) ?$_POST['room'] :"";
|
||||
?>
|
||||
<form method="post" action="">
|
||||
<strong>Название комнаты </strong><br>
|
||||
<select name="room">
|
||||
<option value="Зал воинов">Зал воинов</option>
|
||||
<option value="Зал воинов 2">Зал воинов 2</option>
|
||||
<option value="Зал воинов 3">Зал воинов 3</option>
|
||||
<option value="Будуар">Будуар</option>
|
||||
<option value="Этаж 2">Этаж 2</option>
|
||||
<option value="Комната Знахаря">Комната Знахаря</option>
|
||||
<option value="Рыцарский Зал">Рыцарский Зал</option>
|
||||
<option value="Торговый Зал">Торговый Зал</option>
|
||||
<option value="Зал закона">Зал закона</option>
|
||||
<option value="Центральная Площадь">Центральная Площадь</option>
|
||||
<option value="Тюрма">Тюрма</option>
|
||||
<option value="Комиссионый магазин">Комиссионый магазин</option>
|
||||
<option value="Церковь">Церковь</option>
|
||||
<option value="Банк">Банк</option>
|
||||
<option value="Стелла Правосудия">Стелла Правосудия</option>
|
||||
<option value="Магазин">Магазин</option>
|
||||
<option value="Регистратура кланов">Регистратура кланов</option>
|
||||
<option value="Ремонтная мастерская">Ремонтная мастерская</option>
|
||||
<option value="Академия">Академия</option>
|
||||
<option value="работа">работа</option>
|
||||
<option value="Завод">Завод</option>
|
||||
<option value="Пруд">Пруд</option>
|
||||
<option value="Казино">Казино</option>
|
||||
<option value="Лотерея">Лотерея</option>
|
||||
<option value="Кости">Кости</option>
|
||||
<option value="Блек джек холл">Блек джек холл</option>
|
||||
<option value="Подвал">Подвал</option>
|
||||
<option value="Телеграф">Телеграф</option>
|
||||
</select>
|
||||
<input type="submit" name="submit" value="Сменить"></form>
|
||||
<?
|
||||
if (isset($_POST['room']))
|
||||
{
|
||||
$sql = $adb->query("UPDATE `characters` SET `room` = '$room';");
|
||||
echo "Все сменено";
|
||||
}
|
||||
?>
|
27
admin/module/stat_admin.php
Normal file
27
admin/module/stat_admin.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?
|
||||
defined('AntiBK') or die ("Доступ запрещен!");
|
||||
|
||||
$r_login = (isset($_POST['r_login'])) ?$_POST['r_login'] :"";
|
||||
$status = (isset($_POST['status'])) ?$_POST['status'] :"";
|
||||
$state = (isset($_POST['state'])) ?$_POST['state'] :"";
|
||||
?>
|
||||
<form method="post" action="">
|
||||
<strong>Логин</strong><br>
|
||||
<input type="text" name="r_login" size="25"><br>
|
||||
<strong>Статус</strong><br>
|
||||
<input type="text" name="status" size="25"><br>
|
||||
<strong>Подданство</strong><br>
|
||||
<input type="text" name="state" size="25"><br>
|
||||
<input type="submit" name="submit" value="Далее"></form>
|
||||
<?
|
||||
if (isset($_POST['r_login']) && $r_login == '')
|
||||
echo "Вы не ввели Логин.";
|
||||
else if ($r_login != '')
|
||||
{
|
||||
$sql = $adb->query("UPDATE `characters`
|
||||
SET `status` = '$status',
|
||||
`state` = '$state'
|
||||
WHERE `login` = '$login';");
|
||||
echo "Статус и подданство успешно изменены.";
|
||||
}
|
||||
?>
|
79
admin/module/team1.php
Normal file
79
admin/module/team1.php
Normal file
@ -0,0 +1,79 @@
|
||||
|
||||
<?php
|
||||
include "conf.php" ;
|
||||
//
|
||||
/*----Для айди персонажа--//
|
||||
|
||||
$connect = @mysql_connect($base_name,$base_user,$base_pass)or die ("Не возможно подключиться к Базе данных") ;
|
||||
|
||||
$db = @mysql_select_db($db_name,$connect) or die ("Невозможно выбрать Базу данных");
|
||||
$sql = "SELECT id, login FROM characters "; //ORDER BY id
|
||||
$result = @mysql_query($sql,$connect) or die ("Невозможно выполнить запрос");
|
||||
while ($row = mysql_fetch_array($result));
|
||||
|
||||
$login_use = $row['login'];
|
||||
|
||||
|
||||
//----Для айди персонажа--/*/
|
||||
|
||||
|
||||
if ($sort == "ip") {$s = " order by id";}
|
||||
if ($sort == "u") {$s = " order by username";}
|
||||
$connect = @mysql_connect($base_name,$base_user,$base_pass)or die ("Не возможно подключиться к Базе данных") ;
|
||||
|
||||
$db = @mysql_select_db($db_name,$connect) or die ("Невозможно выбрать Базу данных");
|
||||
$sql = "SELECT * FROM team1 "; //ORDER BY id
|
||||
$result = @mysql_query($sql,$connect) or die ("Невозможно выполнить запрос");
|
||||
while ($row = mysql_fetch_array($result)) {
|
||||
$i++;
|
||||
$t_end = $i%30;
|
||||
/*/echo " = t_end<br>";
|
||||
|
||||
if ($login_use = $login){
|
||||
$id_use= $id ;
|
||||
|
||||
} */
|
||||
if ($i == 1 or $t_end == 1) {
|
||||
|
||||
echo "<table width='270' border='1' cellspacing='0' cellpadding='3' align='centr'>
|
||||
<tr align='center'>
|
||||
<td width='20'><strong>#</strong></td>
|
||||
<td width='120' align='center'><strong>ID боя</strong></td>
|
||||
<td width='130' align='center'><strong>Логин</strong></td>
|
||||
<td width='150' align='center'>Дата подачи</strong></td>
|
||||
<td width='170' align='center'><strong>Незнаю</strong></td>
|
||||
<td width='180' align='center'><strong>Незнаю</strong></td>
|
||||
<td width='190' align='center'><strong>IP подачи</strong></td>
|
||||
|
||||
</tr>";
|
||||
|
||||
}
|
||||
$id = $row['battle_id '];
|
||||
$login = $row['player'];
|
||||
$login_display = $row['date'];
|
||||
$last_time = $row['hitted'];
|
||||
$room = $row['over'];
|
||||
$room = $row['ip'];
|
||||
|
||||
|
||||
echo " <tr>
|
||||
<td align='right'>$i</td>
|
||||
<td>$id</td>
|
||||
<td><a href='info.php?log=$login' target='_blank'><font color='darkgreen'>$login</font></a></td>
|
||||
<td>$login</td>
|
||||
|
||||
<td>$last_time</td>
|
||||
<td>$room</td>
|
||||
<td>$city</td>
|
||||
</tr>";
|
||||
|
||||
if ($t_end == 0) {echo "</table>";}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
79
admin/module/team2.php
Normal file
79
admin/module/team2.php
Normal file
@ -0,0 +1,79 @@
|
||||
|
||||
<?php
|
||||
include "conf.php" ;
|
||||
//
|
||||
/*----Для айди персонажа--//
|
||||
|
||||
$connect = @mysql_connect($base_name,$base_user,$base_pass)or die ("Не возможно подключиться к Базе данных") ;
|
||||
|
||||
$db = @mysql_select_db($db_name,$connect) or die ("Невозможно выбрать Базу данных");
|
||||
$sql = "SELECT id, login FROM characters "; //ORDER BY id
|
||||
$result = @mysql_query($sql,$connect) or die ("Невозможно выполнить запрос");
|
||||
while ($row = mysql_fetch_array($result));
|
||||
|
||||
$login_use = $row['login'];
|
||||
|
||||
|
||||
//----Для айди персонажа--/*/
|
||||
|
||||
|
||||
if ($sort == "ip") {$s = " order by id";}
|
||||
if ($sort == "u") {$s = " order by username";}
|
||||
$connect = @mysql_connect($base_name,$base_user,$base_pass)or die ("Не возможно подключиться к Базе данных") ;
|
||||
|
||||
$db = @mysql_select_db($db_name,$connect) or die ("Невозможно выбрать Базу данных");
|
||||
$sql = "SELECT * FROM team2 "; //ORDER BY id
|
||||
$result = @mysql_query($sql,$connect) or die ("Невозможно выполнить запрос");
|
||||
while ($row = mysql_fetch_array($result)) {
|
||||
$i++;
|
||||
$t_end = $i%30;
|
||||
/*/echo " = t_end<br>";
|
||||
|
||||
if ($login_use = $login){
|
||||
$id_use= $id ;
|
||||
|
||||
} */
|
||||
if ($i == 1 or $t_end == 1) {
|
||||
|
||||
echo "<table width='270' border='1' cellspacing='0' cellpadding='3' align='centr'>
|
||||
<tr align='center'>
|
||||
<td width='20'><strong>#</strong></td>
|
||||
<td width='120' align='center'><strong>ID боя</strong></td>
|
||||
<td width='130' align='center'><strong>Логин</strong></td>
|
||||
<td width='150' align='center'>Дата подачи</strong></td>
|
||||
<td width='170' align='center'><strong>Незнаю</strong></td>
|
||||
<td width='180' align='center'><strong>Незнаю</strong></td>
|
||||
<td width='190' align='center'><strong>IP подачи</strong></td>
|
||||
|
||||
</tr>";
|
||||
|
||||
}
|
||||
$id = $row['battle_id '];
|
||||
$login = $row['player'];
|
||||
$login_display = $row['date'];
|
||||
$last_time = $row['hitted'];
|
||||
$room = $row['over'];
|
||||
$room = $row['ip'];
|
||||
|
||||
|
||||
echo " <tr>
|
||||
<td align='right'>$i</td>
|
||||
<td>$id</td>
|
||||
<td><a href='info.php?log=$login' target='_blank'><font color='darkgreen'>$login</font></a></td>
|
||||
<td>$login</td>
|
||||
|
||||
<td>$last_time</td>
|
||||
<td>$room</td>
|
||||
<td>$city</td>
|
||||
</tr>";
|
||||
|
||||
if ($t_end == 0) {echo "</table>";}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
22
admin/module/travm.php
Normal file
22
admin/module/travm.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?
|
||||
defined('AntiBK') or die ("Доступ запрещен!");
|
||||
|
||||
$r_login = (isset($_POST['r_login'])) ?$_POST['r_login'] :"";
|
||||
?>
|
||||
<form method="post" action="">
|
||||
<strong>Логин</strong><br>
|
||||
<input type="text" name="r_login" size="25">
|
||||
<input type="submit" name="submit" value="Далее"></form>
|
||||
<?
|
||||
if (isset($_POST['r_login']))
|
||||
{
|
||||
$data = $adb->selectRow("SELECT `travm_old_stat`, `travm_stat` FROM `characters` WHERE `login` = '$r_login';") or die ("Персонаж не найден!");
|
||||
$o_stat = $data['travm_old_stat'];
|
||||
$t_stat = $data['travm_stat'];
|
||||
$sql = $adb->query(" UPDATE `characters`
|
||||
SET `$t_stat` = '$o_stat',
|
||||
`travm` = '0'
|
||||
WHERE `login` = '$who';
|
||||
");
|
||||
}
|
||||
?>
|
30
admin/module/travm_all.php
Normal file
30
admin/module/travm_all.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?
|
||||
defined('AntiBK') or die ("Доступ запрещен!");
|
||||
|
||||
$answer = (isset($_POST['answer'])) ?$_POST['answer'] :"";
|
||||
?>
|
||||
<form method="post" action="">
|
||||
<strong>Вылечить у всех травмы</strong><br>
|
||||
<select name="answer">
|
||||
<option value="no">Нет</option>
|
||||
<option value="yes">Да</option>
|
||||
</select>
|
||||
<input type="submit" name="submit" value="Далее"></form>
|
||||
<?
|
||||
if ($answer == 'yes')
|
||||
{
|
||||
$rows = $adb->select("SELECT `travm_old_stat`, `travm_stat`, `login` FROM `characters`;");
|
||||
foreach ($rows as $data)
|
||||
{
|
||||
$who = $data['login'];
|
||||
$o_stat = $data['travm_old_stat'];
|
||||
$t_stat = $data['travm_stat'];
|
||||
$sql = $adb->query(" UPDATE `characters`
|
||||
SET `$t_stat` = '$o_stat',
|
||||
`travm` = '0'
|
||||
WHERE `login` = '$who';
|
||||
");
|
||||
}
|
||||
echo "Все игроки вылечены.";
|
||||
}
|
||||
?>
|
37
admin/module/unwear.php
Normal file
37
admin/module/unwear.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?
|
||||
defined('AntiBK') or die ("Доступ запрещен!");
|
||||
|
||||
$r_login = (isset($_POST['r_login'])) ?$_POST['r_login'] :"";
|
||||
?>
|
||||
<form method="post" action="">
|
||||
<strong>Логин</strong><br>
|
||||
<input type="text" name="r_login" size="25">
|
||||
<input type="submit" name="submit" value="Далее"></form>
|
||||
<?
|
||||
if (isset($_POST['r_login']))
|
||||
{
|
||||
$sql1 = $adb->query("UPDATE `inv` SET `wear` = '0' WHERE `owner` = '$r_login';");
|
||||
$sql2 = $adb->query("UPDATE `characters`
|
||||
SET `helmet` = '0',
|
||||
`naruchi` = '0',
|
||||
`hand_r` = '0',
|
||||
`hand_r_free` = '1',
|
||||
`hand_r_type` = 'phisic',
|
||||
`armor` = '0',
|
||||
`poyas` = '0',
|
||||
`sergi` = '0',
|
||||
`amulet` = '0',
|
||||
`ring1` = '0',
|
||||
`ring2` = '0',
|
||||
`ring3` = '0',
|
||||
`perchi` = '0',
|
||||
`hand_l` = '0',
|
||||
`hand_l_free` = '1',
|
||||
`hand_l_type` = 'phisic',
|
||||
`pants` = '0',
|
||||
`boots` = '0'
|
||||
WHERE `login` = '$r_login';
|
||||
");
|
||||
echo "Персонаж вытащен из битвы";
|
||||
}
|
||||
?>
|
39
admin/module/unwear_all.php
Normal file
39
admin/module/unwear_all.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?
|
||||
defined('AntiBK') or die ("Доступ запрещен!");
|
||||
|
||||
$answer = (isset($_POST['answer'])) ?$_POST['answer'] :"";
|
||||
?>
|
||||
<form method="post" action="">
|
||||
<strong>Раздеть всех персонажей</strong><br>
|
||||
<select name="answer">
|
||||
<option value="no">Нет</option>
|
||||
<option value="yes">Да</option>
|
||||
</select>
|
||||
<input type="submit" name="submit" value="Далее"></form>
|
||||
<?
|
||||
if ($answer == 'yes')
|
||||
{
|
||||
$sql1 = $adb->query("UPDATE `inv` SET `wear` = '0';");
|
||||
$sql2 = $adb->query("UPDATE `characters`
|
||||
SET `helmet` = '0',
|
||||
`naruchi` = '0',
|
||||
`hand_r` = '0',
|
||||
`hand_r_free` = '1',
|
||||
`hand_r_type` = 'phisic',
|
||||
`armor` = '0',
|
||||
`poyas` = '0',
|
||||
`sergi` = '0',
|
||||
`amulet` = '0',
|
||||
`ring1` = '0',
|
||||
`ring2` = '0',
|
||||
`ring3` = '0',
|
||||
`perchi` = '0',
|
||||
`hand_l` = '0',
|
||||
`hand_l_free` = '1',
|
||||
`hand_l_type` = 'phisic',
|
||||
`pants` = '0',
|
||||
`boots` = '0'
|
||||
");
|
||||
echo "Все игроки раздеты.";
|
||||
}
|
||||
?>
|
27
admin/style.css
Normal file
27
admin/style.css
Normal file
@ -0,0 +1,27 @@
|
||||
BODY {margin: 0; background-color: #ffffff;}
|
||||
div {color: #000000; font-size: 12px; padding-left: 1px; padding-right: 1px; font-family: Arial;}
|
||||
div.white {color: #000000; font-weight: bolder; font-size: 13px; padding-left: 1px; padding-right: 1px; font-family: Times New Roman;}
|
||||
div.mic {color: #000000; font-size: 11px; font-family: Arial; text-decoration: none;}
|
||||
|
||||
td.head {margin: 0px; padding: 0px; background-color: #ffffff;}
|
||||
|
||||
input.main {border: 1px solid #666666; background: #ffffff; height: auto; font-size : 10px; width: 200px; color: #000000;}
|
||||
input.but {border: 1px solid #666666; background: #ffffff; height: auto; font-size : 10px; color: #000000; }
|
||||
|
||||
a:link {color: #000000; font-size: 12px; font-family: Arial; text-decoration: none;}
|
||||
a:visited {color: #000000; font-size: 12px; font-family: Arial; text-decoration: none;}
|
||||
a:hover {color: #000000; font-size: 12px; font-family: Arial; text-decoration: underline;}
|
||||
a.mic:link {color: #000000; font-size: 11px; font-family: Arial; text-decoration: none;}
|
||||
a.mic:visited {color: #000000; font-size: 11px; font-family: Arial; text-decoration: none;}
|
||||
a.mic:hover {color: #000000; font-size: 11px; font-family: Arial; text-decoration: none;}
|
||||
a.big:link {color: #003333; font-size: 20px; padding-left: 1px; padding-right: 1px; font-family: Arial; text-decoration: none;}
|
||||
a.big:visited {color: #003333; font-size: 20px; padding-left: 1px; padding-right: 1px; font-family: Arial; text-decoration: none;}
|
||||
a.big:hover {color: #003333; font-size: 20px; padding-left: 1px; padding-right: 1px; font-family: Arial; text-decoration: none;}
|
||||
a.undl {color: #FFFFBB; text-decoration: underline;}
|
||||
a.undl:hover {color: #FFFFFF; text-decoration: underline;}
|
||||
|
||||
.header {font-weight: bold; color: #FF7799;}
|
||||
.small {font-size: 11px;}
|
||||
.blok {width: 100%;}
|
||||
.submenu {position: absolute; visibility: hidden;}
|
||||
#mmoves {border: #666666 1px solid; padding: 2px; visibility: hidden; overflow: visible; white-space: nowrap; position: absolute; left: 0px; top: 0px; background-color: #ffffcc; z-index: 200; text-align: left; font-size: 15px;}
|
486
ajax.php
Normal file
486
ajax.php
Normal file
@ -0,0 +1,486 @@
|
||||
<?
|
||||
session_start();
|
||||
define('AntiBK', true);
|
||||
|
||||
include("engline/config.php");
|
||||
include("engline/data.php");
|
||||
include("engline/dbsimple/Generic.php");
|
||||
include("engline/functions/functions.php");
|
||||
include("engline/token/bootstrap.php");
|
||||
|
||||
$guid = getGuid('ajax');
|
||||
|
||||
if (!lpg_csrf_token($guid))
|
||||
toIndex('ajax');
|
||||
|
||||
$adb = DbSimple_Generic::connect($database['adb']);
|
||||
$adb->query("SET NAMES ? ",$database['db_encoding']);
|
||||
$adb->setErrorHandler("databaseErrorHandler");
|
||||
|
||||
$char = Char::initialization($guid, $adb);
|
||||
|
||||
$char->test->Guid('ajax');
|
||||
|
||||
$char_db = $char->getChar('char_db', '*');
|
||||
$char_stats = $char->getChar('char_stats', '*');
|
||||
$char_feat = array_merge($char_db, $char_stats);
|
||||
|
||||
$lang = $char->getLang();
|
||||
|
||||
$login = $char_feat['login'];
|
||||
$sex = $char_feat['sex'];
|
||||
$mass = $char_feat['mass'];
|
||||
$city = $char_feat['city'];
|
||||
$room = $char_feat['room'];
|
||||
$money = $char_feat['money'];
|
||||
|
||||
$do = getVar('do', '', 2);
|
||||
switch ($do)
|
||||
{
|
||||
case 'geterror':
|
||||
$char->error->getFormattedError($_POST['error'], $_POST['parameters']);
|
||||
die();
|
||||
break;
|
||||
case 'getroomname':
|
||||
$room = getVar('room');
|
||||
$name = $char->city->getRoom($room, $city, 'name');
|
||||
$name = "Вы перейдете в: <strong>$name</strong> (<a href='#' class='nick' onclick='return clear_solo();'>отмена</a>)";
|
||||
returnAjax($name);
|
||||
break;
|
||||
case 'showshapes':
|
||||
$available = getVar('available', 1);
|
||||
$shapes = $adb->select("SELECT * FROM `player_shapes` WHERE `sex` = ?s ORDER BY `id`;", $sex);
|
||||
$required = array('str', 'dex', 'con', 'vit', 'fire', 'water', 'air', 'earth', 'dark', 'light', 'int', 'wis', 'level', 'sword', 'axe', 'fail', 'knife');
|
||||
$return = "<table cellspacing='0' cellpadding='0' border='0' align='center'><tr>";
|
||||
$i = 0;
|
||||
foreach ($shapes as $shape)
|
||||
{
|
||||
$availabled = $char->checkShape($shape['id']);
|
||||
$requirement = "";
|
||||
$title = "";
|
||||
foreach ($required as $key)
|
||||
{
|
||||
if ($shape[$key] <= 0)
|
||||
continue;
|
||||
|
||||
if (!$requirement)
|
||||
$requirement = "$lang[min_stat]<br>";
|
||||
|
||||
$title .= (compare($shape[$key], $char_feat[$key], "• $lang[$key] $shape[$key]"))."<br>";
|
||||
}
|
||||
if ($availabled)
|
||||
{
|
||||
$return .= "<td class='shape'><a href='javascript:chooseShape($shape[id]);'><img src='img/chars/$shape[sex]/$shape[img]' alt='<strong>$lang[select_shape]</strong><br>$requirement$title' border='0' style='opacity: 0.6;' onmouseover=\"this.style.opacity = '1';\" onmouseout=\"this.style.opacity = '0.6';\"></a></td>";
|
||||
$i++;
|
||||
}
|
||||
else if (!$available)
|
||||
{
|
||||
$return .= "<td class='shape dis_shape'><img src='img/chars/$shape[sex]/$shape[img]' alt='$requirement$title' border='0' style='opacity: 0.6;'></td>";
|
||||
$i++;
|
||||
}
|
||||
|
||||
if ($i % 9 === 0)
|
||||
$return .= "</tr><tr>";
|
||||
}
|
||||
$return .= "</tr></table>";
|
||||
returnAjax($return);
|
||||
break;
|
||||
case 'chooseshape':
|
||||
$shape = getVar('shape', 0);
|
||||
|
||||
if (!$shape || !($char->checkShape($shape)))
|
||||
returnAjax('error', 215);
|
||||
|
||||
$char->setChar('char_db', array('shape' => "$sex/$shape.gif", 'next_shape' => (time() + 86400)));
|
||||
returnAjax('complete');
|
||||
break;
|
||||
/*Invetory*/
|
||||
case 'showinventory':
|
||||
$mail_guid = getVar('mail_guid');
|
||||
$section = getVar('section', 1);
|
||||
$type = getVar('type');
|
||||
switch ($type)
|
||||
{
|
||||
default:
|
||||
case 'inv':
|
||||
$rows = $adb->select("SELECT *
|
||||
FROM `character_inventory` AS `c`
|
||||
LEFT JOIN `item_template` AS `i`
|
||||
ON `c`.`item_entry` = `i`.`entry`
|
||||
WHERE `i`.`section` = ?s
|
||||
and `c`.`guid` = ?d
|
||||
and `c`.`wear` = '0'
|
||||
and `c`.`mailed` = '0'
|
||||
ORDER BY `c`.`last_update` DESC", $data['sections'][$section] ,$guid);
|
||||
break;
|
||||
case 'mail_to':
|
||||
$rows = $adb->select("SELECT *
|
||||
FROM `character_inventory` AS `c`
|
||||
LEFT JOIN `item_template` AS `i`
|
||||
ON `c`.`item_entry` = `i`.`entry`
|
||||
WHERE (`i`.`item_flags` & '1')
|
||||
and `c`.`wear` = '0'
|
||||
and `c`.`mailed` = '0'
|
||||
and `i`.`section` = ?s
|
||||
and `c`.`guid` = ?d
|
||||
and `i`.`price_euro` = '0'
|
||||
ORDER BY `c`.`last_update` DESC;", $data['sections'][$section] ,$guid);
|
||||
break;
|
||||
}
|
||||
if (count($rows) > 0)
|
||||
{
|
||||
$inventory = '';
|
||||
$i = 1;
|
||||
foreach ($rows as $item_info)
|
||||
{
|
||||
$inventory .= $char->equip->showItem($item_info, $type, $i, $mail_guid);
|
||||
$i = !$i;
|
||||
}
|
||||
returnAjax($inventory);
|
||||
}
|
||||
else
|
||||
returnAjax("<table width='100%' cellspacing='1' cellpadding='2' bgcolor='#A5A5A5'><tr><td bgcolor='#E2E0E0' align='center'>$lang[empty]</td></tr></table>");
|
||||
break;
|
||||
case 'sortinventory':
|
||||
$type = getVar('type');
|
||||
$section = getVar('section', 1, 7);
|
||||
$sort = ($_POST['num']) ?' DESC' :'';
|
||||
$items = $adb->selectCol("SELECT `c`.`id` AS ARRAY_KEY, `i`.?#
|
||||
FROM `character_inventory` AS `c`
|
||||
LEFT JOIN `item_template` AS `i`
|
||||
ON `c`.`item_entry` = `i`.`entry`
|
||||
WHERE `c`.`guid` = ?d
|
||||
and `c`.`wear` = '0'
|
||||
and `c`.`mailed` = '0'
|
||||
and `i`.`section` = ?s
|
||||
ORDER BY `i`.?#$sort", $type ,$guid ,$data['sections'][$section] ,$type);
|
||||
$i = 0;
|
||||
foreach ($items as $id => $value)
|
||||
{
|
||||
$adb->query("UPDATE `character_inventory` SET `last_update` = ?d WHERE `guid` = ?d and `id` = ?d", time() + $i ,$guid ,$id);
|
||||
$i++;
|
||||
}
|
||||
returnAjax('complete');
|
||||
break;
|
||||
case 'deleteitem':
|
||||
$item_id = getVar('id', 0);
|
||||
$dropall = getVar('dropall', 0);
|
||||
|
||||
if (checki($item_id))
|
||||
returnAjax('error', 213);
|
||||
|
||||
switch ($dropall)
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
if ($char->equip->deleteItem($item_id))
|
||||
{
|
||||
$mass = $char->getChar('char_stats', 'mass');
|
||||
returnAjax('complete', $mass, 1);
|
||||
}
|
||||
else
|
||||
returnAjax('error', 213);
|
||||
break;
|
||||
case 1:
|
||||
$item_entry = $adb->selectCell("SELECT `item_entry` FROM `character_inventory` WHERE `guid` = ?d and `id` = ?d", $guid ,$item_id) or returnAjax('error', 213);
|
||||
$items = $adb->select("SELECT `c`.`id`
|
||||
FROM `character_inventory` AS `c`
|
||||
LEFT JOIN `item_template` AS `i`
|
||||
ON `c`.`item_entry` = `i`.`entry`
|
||||
WHERE `c`.`guid` = ?d
|
||||
and `c`.`item_entry` = ?d
|
||||
and `c`.`wear` = '0'
|
||||
and `c`.`mailed` = '0';", $guid ,$item_entry) or returnAjax('error', 213);
|
||||
$i = 0;
|
||||
foreach ($items as $i_info)
|
||||
{
|
||||
if ($char->equip->deleteItem($i_info['id']))
|
||||
{
|
||||
$i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
returnAjax('error', 213);
|
||||
}
|
||||
$mass = $char->getChar('char_stats', 'mass');
|
||||
returnAjax('complete', $mass, $i, $item_entry);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'switchbars':
|
||||
$bar = getVar('bar');
|
||||
$type = getVar('type');
|
||||
$bars = $char->getChar('char_bars', 'stat', 'mod', 'power', 'def', 'btn', 'set') or returnAjax('error');
|
||||
foreach ($bars as $key => $value)
|
||||
{
|
||||
if ($value == 0)
|
||||
unset($bars[$key]);
|
||||
}
|
||||
asort ($bars);
|
||||
|
||||
if ($bar && in_array($bar, array_keys($bars)) && $type && count($bars) != 1)
|
||||
{
|
||||
$d_b_v = explode('|', $bars[$bar]);
|
||||
list ($d_b_n, $d_b_s) = array_values($d_b_v);
|
||||
if (($type == 'down' & $d_b_n != count($bars)) || ($type == 'up' & $d_b_n != 1))
|
||||
{
|
||||
$c_b_a = ($type == 'down') ?array_slice($bars, $d_b_n, 1) :array_slice($bars, $d_b_n - 2, 1);
|
||||
list($c_b_k) = array_keys($c_b_a);
|
||||
list($c_b_v) = array_values($c_b_a);
|
||||
$c_b_v = explode('|', $c_b_v);
|
||||
list($c_b_n, $c_b_s) = array_values($c_b_v);
|
||||
$d_b_n += ($type == 'down') ?1 :-1;
|
||||
$c_b_n += ($type == 'down') ?-1 :1;
|
||||
if ($char->setChar('char_bars', array($bar => $d_b_n.'|'.$d_b_s, $c_b_k => $c_b_n.'|'.$c_b_s)))
|
||||
{
|
||||
$bars = $char->getChar('char_bars', 'stat', 'mod', 'power', 'def', 'btn', 'set');
|
||||
foreach ($bars as $key => $value)
|
||||
{
|
||||
if ($value == 0)
|
||||
unset($bars[$key]);
|
||||
}
|
||||
asort($bars);
|
||||
returnAjax('complete', $bar, $char->showInventoryBar($bar, $bars[$bar], count($bars)), $c_b_k, ($char->showInventoryBar($c_b_k, $bars[$c_b_k], count($bars))));
|
||||
}
|
||||
}
|
||||
else
|
||||
returnAjax('error');
|
||||
}
|
||||
else
|
||||
returnAjax('error');
|
||||
break;
|
||||
case 'spoilerbar':
|
||||
$bar = getVar('bar');
|
||||
$barr = $char->getChar('char_bars', $bar) or returnAjax('error');
|
||||
$bar_v = explode('|', $barr);
|
||||
list($bar_n, $bar_s) = array_values($bar_v);
|
||||
if ($bar_s == 1)
|
||||
{
|
||||
$char->setChar('char_bars', $bar, $bar_n.'|0');
|
||||
returnAjax('hide');
|
||||
}
|
||||
else if ($bar_s == 0)
|
||||
{
|
||||
$char->setChar('char_bars', $bar, $bar_n.'|1');
|
||||
returnAjax('show');
|
||||
}
|
||||
break;
|
||||
case 'worksets':
|
||||
$type = getVar('type');
|
||||
$name = getVar('name');
|
||||
|
||||
if ($name == '')
|
||||
returnAjax('error', 222);
|
||||
|
||||
switch ($type)
|
||||
{
|
||||
case 'create':
|
||||
$cur_set = $char->getChar('char_equip', '*') or returnAjax('error', 221);
|
||||
$cur_set['name'] = $name;
|
||||
unset($cur_set['hand_r_free'], $cur_set['hand_r_type'], $cur_set['hand_l_free'], $cur_set['hand_l_type']);
|
||||
$adb->query("DELETE FROM `character_sets` WHERE `guid` = ?d and `name` = ?s", $guid ,$name);
|
||||
$adb->query("INSERT INTO `character_sets` (?#)
|
||||
VALUES (?a);", array_keys($cur_set), array_values($cur_set));
|
||||
returnAjax('complete', $char->getSetRow($name));
|
||||
break;
|
||||
case 'delete':
|
||||
$set = $adb->selectRow("SELECT * FROM `character_sets` WHERE `guid` = ?d and `name` = ?s", $guid ,$name) or returnAjax('error', 221);
|
||||
$adb->query("DELETE FROM `character_sets` WHERE `guid` = ?d and `name` = ?s", $guid ,$name);
|
||||
returnAjax('complete');
|
||||
break;
|
||||
case 'show':
|
||||
$set = $adb->selectRow("SELECT * FROM `character_sets` WHERE `guid` = ?d and `name` = ?s", $guid ,$name) or returnAjax('error', 221);
|
||||
$set['hand_l_s'] = "hand_l";
|
||||
$char_feat = $char->getChar('char_db', 'shape', 'guid');
|
||||
$char_feat['name'] = '';
|
||||
returnAjax('complete', $char->equip->getCharacterEquipped($set, $char_feat, 'smart'));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'increaseitemstat':
|
||||
$item_id = getVar('id', 0);
|
||||
$stat = getVar('stat');
|
||||
$count = getVar('count', 1);
|
||||
|
||||
if (checki($item_id))
|
||||
returnAjax('error', 213);
|
||||
|
||||
$i_info = $adb->selectRow("SELECT `c`.`inc_count_p`,
|
||||
`c`.?#,
|
||||
`i`.?#
|
||||
FROM `character_inventory` AS `c`
|
||||
LEFT JOIN `item_template` AS `i`
|
||||
ON `c`.`item_entry` = `i`.`entry`
|
||||
WHERE `c`.`guid` = ?d
|
||||
and `c`.`id` = ?d
|
||||
and `c`.`wear` = '0'
|
||||
and `c`.`mailed` = '0';", 'inc_'.$stat ,'add_'.$stat ,$guid ,$item_id) or returnAjax('error', 213);
|
||||
if ($i_info['inc_count_p'] - $count < 0)
|
||||
returnAjax('error', 216);
|
||||
|
||||
switch ($stat)
|
||||
{
|
||||
case 'str':
|
||||
case 'dex':
|
||||
case 'con':
|
||||
case 'int':
|
||||
$inc = $i_info['inc_'.$stat] + $count;
|
||||
$inc_p = $i_info['inc_count_p']-$count;
|
||||
$adb->query("UPDATE `character_inventory`
|
||||
SET ?# = ?d,
|
||||
`inc_count_p` = ?d,
|
||||
`last_update` = ?d
|
||||
WHERE `guid` = ?d
|
||||
and `id` = ?d", 'inc_'.$stat ,$inc ,$inc_p ,time() ,$guid ,$item_id);
|
||||
returnAjax('complete', $inc + $i_info['add_'.$stat], $inc_p);
|
||||
break;
|
||||
default: returnAjax('error', 219);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'loginbank':
|
||||
$credit = getVar('credit', 0);
|
||||
$pass = getVar('pass');
|
||||
$bank_info = $adb->selectRow("SELECT `guid`,
|
||||
`password`,
|
||||
`cash`,
|
||||
`euro`
|
||||
FROM `character_bank`
|
||||
WHERE `id` = ?d", $credit) or returnAjax('error', 303);
|
||||
if ($guid != $bank_info['guid'])
|
||||
returnAjax('error', 322);
|
||||
|
||||
if (SHA1($credit.':'.$pass) != $bank_info['password'])
|
||||
returnAjax('error', 302);
|
||||
|
||||
$_SESSION['bankСredit'] = $credit;
|
||||
returnAjax('complete', "<b>".getMoney($bank_info['cash'])."</b>кр. <b>".getMoney($bank_info['euro'])."</b>екр.<a href='javascript:UnLoginbank();'><img border='0' valign='bottom' width='13' height='9' title='$lang[credit_exit]' src='img/icon/close_bank.gif'></a>");
|
||||
break;
|
||||
case 'unloginbank':
|
||||
unset ($_SESSION['bankСredit']);
|
||||
$bank = $adb->selectCol("SELECT `id` FROM `character_bank` WHERE `guid` = ?d", $guid) or returnAjax('error');
|
||||
foreach ($bank as $num => $bank_id)
|
||||
{
|
||||
if (empty($credits))
|
||||
$credits = $bank_id;
|
||||
else
|
||||
$credits .= ",".$bank_id;
|
||||
}
|
||||
returnAjax("<a href=\"javascript:bank_open('$credits');\" class='nick' style='font-size: 7pt;'>$lang[credit_choose]</a>");
|
||||
break;
|
||||
/*Shop*/
|
||||
case 'getshoptitle':
|
||||
$section_shop = getVar('section_shop');
|
||||
returnAjax($lang[$data['sections_shop'][$section_shop][1]].$lang['shop_'.$section_shop]);
|
||||
break;
|
||||
case 'showshopsection':
|
||||
$flags = $char->city->getRoom($room, $city, 'flags');
|
||||
|
||||
if (!($flags & 2))
|
||||
returnAjax("<table width='100%' cellspacing='1' cellpadding='2' bgcolor='#A5A5A5'><tr><td bgcolor='#E2E0E0' align='center'>$lang[shop_no]</td></tr></table>");
|
||||
|
||||
$section_shop = getVar('section_shop', '', 7);
|
||||
$level_filter = getVar('level_filter', '', 7);
|
||||
$check_level = ($level_filter > 0 || $level_filter == '0');
|
||||
$name_filter = getVar('name_filter', '', 7);
|
||||
setCookie('level_filter', $level_filter, time() + 3600);
|
||||
setCookie('name_filter', $name_filter, time() + 3600);
|
||||
$rows = $adb->select("SELECT *
|
||||
FROM `item_template`
|
||||
WHERE `type` = ?s
|
||||
{and `min_level` = ?d}
|
||||
{and `name` LIKE (?)}
|
||||
{and !(`item_flags` & ?d)
|
||||
and `price_euro` = '0'}
|
||||
ORDER BY `min_level`;", $section_shop,
|
||||
(($check_level) ?$level_filter :DBSIMPLE_SKIP),
|
||||
(($name_filter) ?escapeLike($name_filter) :DBSIMPLE_SKIP),
|
||||
(($room != 'shop') ?4 :DBSIMPLE_SKIP));
|
||||
if (count($rows) > 0)
|
||||
{
|
||||
$section = '';
|
||||
$i = true;
|
||||
foreach ($rows as $item_info)
|
||||
{
|
||||
$section .= $char->equip->showItem($item_info, 'shop', $i);
|
||||
$i = !$i;
|
||||
}
|
||||
returnAjax($section);
|
||||
}
|
||||
else
|
||||
returnAjax("<table width='100%' cellspacing='1' cellpadding='2' bgcolor='#A5A5A5'><tr><td bgcolor='#E2E0E0' align='center'>$lang[shop_empty]</td></tr></table>");
|
||||
break;
|
||||
case 'buyitem':
|
||||
$item_entry = getVar('entry', 0);
|
||||
$count = getVar('count', 1);
|
||||
|
||||
if (checki($item_entry))
|
||||
returnAjax('error', 403);
|
||||
|
||||
$buycount = 0;
|
||||
$amount = $city.'-'.$room;
|
||||
$flags = $char->city->getRoom($room, $city, 'flags');
|
||||
|
||||
if (!($flags & 2))
|
||||
returnAjax('error', 403);
|
||||
|
||||
$i_info = $adb->selectRow("SELECT `name`,
|
||||
`price`,
|
||||
`price_euro`
|
||||
FROM `item_template`
|
||||
WHERE `entry` = ?d", $item_entry) or returnAjax('error', 403);
|
||||
list($name, $price, $price_euro) = array_values($i_info);
|
||||
|
||||
for ($i = 1; $i <= $count; $i++)
|
||||
{
|
||||
if ($price > 0 && !($char->changeMoney(-$price)))
|
||||
continue;
|
||||
|
||||
$money = $money - $price;
|
||||
|
||||
if (!($char->equip->addItem($item_entry)))
|
||||
returnAjax('error', 403);
|
||||
|
||||
$buycount++;
|
||||
}
|
||||
$mass = $char->getChar('char_stats', 'mass');
|
||||
if ($buycount != 0 && $price > 0)
|
||||
returnAjax('complete', getMoney($money), $mass, 400, "$name|".($price*$buycount)."|$buycount");
|
||||
else if ($buycount != 0 && $price_euro > 0)
|
||||
returnAjax('complete', getMoney($money), $mass, 401, "$name|".($price_euro*$buycount)."|$buycount");
|
||||
else
|
||||
returnAjax('error', 107);
|
||||
break;
|
||||
case 'sellitem':
|
||||
$item_id = getVar('id', 0);
|
||||
|
||||
if (checki($item_id))
|
||||
returnAjax('error', 213);
|
||||
|
||||
$i_info = $adb->selectRow("SELECT `i`.`name`,
|
||||
`i`.`mass`,
|
||||
`i`.`price`,
|
||||
`i`.`price_euro`,
|
||||
`c`.`tear_cur`, `c`.`tear_max`,
|
||||
`i`.`tear`
|
||||
FROM `character_inventory` AS `c`
|
||||
LEFT JOIN `item_template` AS `i`
|
||||
ON `c`.`item_entry` = `i`.`entry`
|
||||
WHERE (`i`.`item_flags` & '1')
|
||||
and `c`.`id` = ?d
|
||||
and `c`.`guid` = ?d
|
||||
and `c`.`wear` = '0'
|
||||
and `c`.`mailed` = '0';", $item_id ,$guid) or returnAjax('error', 213);
|
||||
$sell_price = $char->equip->getSellValue($i_info);
|
||||
$char->changeMoney($sell_price);
|
||||
$money = $money + $sell_price;
|
||||
if ($char->equip->deleteItem($item_id, 'sell'))
|
||||
{
|
||||
$mass = $char->getChar('char_stats', 'mass');
|
||||
returnAjax('complete', getMoney($money), $mass, 404, "$$i_info[name]|$sell_price");
|
||||
}
|
||||
else
|
||||
returnAjax('error', 213);
|
||||
break;
|
||||
}
|
||||
?>
|
216
ajax_chat.php
Normal file
216
ajax_chat.php
Normal file
@ -0,0 +1,216 @@
|
||||
<?
|
||||
session_start();
|
||||
define('AntiBK', true);
|
||||
|
||||
include("engline/config.php");
|
||||
include("engline/dbsimple/Generic.php");
|
||||
include("engline/functions/functions.php");
|
||||
|
||||
$guid = getGuid('ajax');
|
||||
|
||||
$adb = DbSimple_Generic::connect($database['adb']);
|
||||
$adb->query("SET NAMES ? ",$database['db_encoding']);
|
||||
$adb->setErrorHandler("databaseErrorHandler");
|
||||
|
||||
$char = Char::initialization($guid, $adb);
|
||||
|
||||
$char->test->Guid('ajax');
|
||||
$char->test->Afk();
|
||||
|
||||
$lang = $char->getLang();
|
||||
$char_db = $char->getChar('char_db', 'login', 'city', 'room', 'chat_shut', 'chat_filter', 'chat_sys', 'chat_update');
|
||||
ArrToVar($char_db);
|
||||
|
||||
$do = getVar('do', '', 2);
|
||||
switch ($do)
|
||||
{
|
||||
/*Talk*/
|
||||
case 'sendmessage':
|
||||
$h = getVar('h');
|
||||
|
||||
$commands = $adb->selectCol("SELECT `name` FROM `server_commands`;");
|
||||
$command = false;
|
||||
|
||||
if ((!$h && !is_numeric($h)) || $chat_shut)
|
||||
returnAjax('none');
|
||||
|
||||
$color = $char->getChar('char_info', 'color');
|
||||
|
||||
if ($h[0] == '/')
|
||||
{
|
||||
foreach ($commands as $num => $name)
|
||||
{
|
||||
if (utf8_substr($h, 0, utf8_strlen($name)) == $name && $char->chat->executeCommand($name, $h))
|
||||
returnAjax('complete');
|
||||
}
|
||||
}
|
||||
|
||||
$h = str_replace("\n", "", $h);
|
||||
$to = split(']', str_replace(array('to [', 'private ['), "]", $h));
|
||||
|
||||
if (isset($to[1]))
|
||||
{
|
||||
$h = preg_replace("/private \[$to[1]/", "private [", $h, 1);
|
||||
$to = str_replace(", ", ",", $to[1]);
|
||||
}
|
||||
else
|
||||
$to = '';
|
||||
|
||||
if (utf8_substr($h, 0, 4) == 'to [')
|
||||
$class = 'to';
|
||||
else if (utf8_substr($h, 0, 9) == 'private [')
|
||||
$class = 'private';
|
||||
else
|
||||
$class = 'all';
|
||||
|
||||
$char->setChar('char_db', array('afk' => 0));
|
||||
if ($adb->query("INSERT INTO `city_chat` (`sender`, `to`, `room`, `msg`, `class`, `date_stamp`, `city`)
|
||||
VALUES (?s, ?s, ?s, ?s, ?s, ?d, ?s)", $login ,$to ,$room ,"<font color=$color>$h</font>" ,$class ,time() ,$city))
|
||||
returnAjax('complete');
|
||||
else
|
||||
returnAjax('error');
|
||||
break;
|
||||
/*Users*/
|
||||
case 'refreshusers':
|
||||
$room_online = $adb->selectCell("SELECT COUNT(*) FROM `online` WHERE `city` = ?s and `room` = ?s", $city ,$room);
|
||||
$room_name = $char->city->getRoom($room, $city, 'name');
|
||||
$user_list = "<font style='color: #8f0000; font-size: 10pt; font-weight: bold;'>$room_name ($room_online)</font><br>";
|
||||
|
||||
$rows = $adb->select("SELECT `guid`,
|
||||
`last_time`
|
||||
FROM `online`
|
||||
WHERE `city` = ?s
|
||||
and `room` = ?s
|
||||
ORDER by `login_display`", $city ,$room);
|
||||
foreach ($rows as $online)
|
||||
{
|
||||
if ($char->test->Online($online['guid']))
|
||||
$user_list .= $char->getLogin('online', $online['guid']);
|
||||
}
|
||||
returnAjax($user_list);
|
||||
break;
|
||||
/*Msg*/
|
||||
case 'refreshmessage':
|
||||
$char->setChar('char_db', array('last_time' => time()));
|
||||
$char->setChar('online', array('last_time' => time()));
|
||||
$go = getVar('go');
|
||||
$send = "";
|
||||
|
||||
$last_t = (checks('last_t')) ?$_SESSION['last_t'] :0;
|
||||
$last_m = (checks('last_m')) ?$_SESSION['last_m'] :0;
|
||||
|
||||
if (!$last_t || $go)
|
||||
$last_m = $_SESSION['last_m'] = ($adb->selectCell("SELECT MAX(`id`) FROM `city_chat` WHERE `room` = ?s and `city` = ?s", $room ,$city)) - 5;
|
||||
|
||||
$rows = $adb->select("SELECT `msg`,
|
||||
`sender`,
|
||||
`to`,
|
||||
`class`,
|
||||
`date_stamp`,
|
||||
`id`
|
||||
FROM `city_chat`
|
||||
WHERE `id` > ?d
|
||||
and `room` = ?s
|
||||
and `city` = ?s", $last_m ,$room ,$city);
|
||||
foreach ($rows as $message)
|
||||
{
|
||||
list($msg, $sender, $to, $class, $_SESSION['last_t'], $_SESSION['last_m']) = array_values($message);
|
||||
$date = (bcsub(time(), $_SESSION['last_t']) <= 86400) ?date('H:i', $_SESSION['last_t']) :date('d.m.y H:i', $_SESSION['last_t']);
|
||||
$sender2 = str_replace(" ", "%20", $sender);
|
||||
$to2 = str_replace(" ", "%20", $to);
|
||||
$smiles = split(':', $msg);
|
||||
if ($class == 'private')
|
||||
{
|
||||
$sent = '';
|
||||
$names = split(',', $to);
|
||||
foreach ($names as $key => $name)
|
||||
{
|
||||
$name_link = ($name == $login) ?str_replace(" ", "%20", $sender) :str_replace(" ", "%20", $name);
|
||||
$name_title = ($name == $login) ?$sender :$name;
|
||||
if ($sent != '')
|
||||
$sent .= ', ';
|
||||
$sent .= "<a href=javascript:top.AddTo('$name_link'); title='$name_title'><span class='private'>$name</span></a>";
|
||||
}
|
||||
$msg = preg_replace("/private \[\]/", "<font class='private'>private [$sent]</font>", $msg, 1);
|
||||
}
|
||||
$msg = preg_replace("/private \[/", "<a href=javascript:top.AddTo('$to2'); title='$to'><font class='private'>private</font></a> [", $msg, 1);
|
||||
$i = 0;
|
||||
foreach ($smiles as $key => $value)
|
||||
{
|
||||
if (file_exists("img/smiles/$value.gif") && $i < 3)
|
||||
{
|
||||
$msg = preg_replace("/\:$value\:/", "<img src='img/smiles/$value.gif' border='0' style='cursor: pointer;'>", $msg, 1);
|
||||
$i++;
|
||||
}
|
||||
else if ($i >= 3)
|
||||
break;
|
||||
}
|
||||
|
||||
$msg_full = " [<a href=javascript:top.AddTo('$sender2');><span>$sender</span></a>] $msg<br>";
|
||||
|
||||
switch ($class)
|
||||
{
|
||||
case 'all':
|
||||
if (!$chat_filter)
|
||||
$send .= "<font class='date'>$date</font>$msg_full";
|
||||
break;
|
||||
case 'emotion':
|
||||
if (!$chat_filter)
|
||||
$send .= "<font class='date'>$date</font> <i><a href=javascript:top.AddTo('$sender2');><span>$sender</span></a> $msg</i><br>";
|
||||
break;
|
||||
case 'to':
|
||||
if ($to == $login || $sender == $login)
|
||||
$send .= "<font class='date2'>$date</font>$msg_full";
|
||||
else if (ereg(",", $to))
|
||||
{
|
||||
$characters = explode (',', $to);
|
||||
foreach ($characters as $key => $value)
|
||||
{
|
||||
if ($value == $login)
|
||||
$send .= "<font class='date2'>$date</font>$msg_full";
|
||||
}
|
||||
}
|
||||
else if (!$chat_filter)
|
||||
$send .= "<font class='date'>$date</font>$msg_full";
|
||||
break;
|
||||
case 'private':
|
||||
if ($to != $login && $sender == $login)
|
||||
$send .= "<font class='date'>$date</font>$msg_full";
|
||||
else if ($to == $login || $sender == $login)
|
||||
$send .= "<font class='date2'>$date</font>$msg_full";
|
||||
else if (ereg(",", $to))
|
||||
{
|
||||
$characters = explode (',', $to);
|
||||
foreach ($characters as $key => $value)
|
||||
{
|
||||
if ($value == $login)
|
||||
$send .= "<font class='date2'>$date</font>$msg_full";
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'sys':
|
||||
if ($to == $login && $chat_sys)
|
||||
$send .= "<font class='date2'>$date</font> <font color='red'>Внимание!</font> $msg<br>";
|
||||
break;
|
||||
}
|
||||
}
|
||||
returnAjax($send, $chat_update);
|
||||
break;
|
||||
case 'change_button':
|
||||
$but = getVar('but');
|
||||
$val = getVar('val');
|
||||
switch ($but)
|
||||
{
|
||||
default:
|
||||
$val = ($val == 'false' || $val === 0) ?0 :1;
|
||||
break;
|
||||
case 'slow':
|
||||
$val = ($val == 'false' || $val === 0) ?10 :60;
|
||||
$but = 'update';
|
||||
break;
|
||||
}
|
||||
$char->setChar('char_db', array('chat_'.$but => $val));
|
||||
returnAjax('complete');
|
||||
break;
|
||||
}
|
||||
?>
|
324
ajax_register.php
Normal file
324
ajax_register.php
Normal file
@ -0,0 +1,324 @@
|
||||
<?
|
||||
session_start();
|
||||
define('AntiBK', true);
|
||||
|
||||
include("engline/config.php");
|
||||
include("engline/data.php");
|
||||
include("engline/dbsimple/Generic.php");
|
||||
include("engline/functions/functions.php");
|
||||
|
||||
$adb = DbSimple_Generic::connect($database['adb']);
|
||||
$adb->query("SET NAMES ? ",$database['db_encoding']);
|
||||
$adb->setErrorHandler("databaseErrorHandler");
|
||||
|
||||
$register = $adb->selectCell("SELECT `registration` FROM `server_info`;");
|
||||
$register_error = 'Регистрация закрыта!<br><a href="index.php" class="us2">Вернуться на главную</a>';
|
||||
$reminder = $adb->selectCell("SELECT `reminder` FROM `server_info`;");
|
||||
$reminder_error = 'Восстановление пароля закрыто!<br><a href="../">Вернуться на главную</a>';
|
||||
|
||||
$do = getVar('do', '', 2);
|
||||
switch ($do)
|
||||
{
|
||||
case 'checkrem1':
|
||||
if (!$reminder)
|
||||
returnAjax('error', $reminder_error);
|
||||
|
||||
unset($_SESSION['rem_login']);
|
||||
$login = getVar('login');
|
||||
|
||||
if (utf8_strlen($login) < 2 || utf8_strlen($login) > 15 || preg_match("/[^a-zA-Zа-яА-Я\- ]/ui", $login))
|
||||
returnAjax('error', 'Логин не найден в базе.');
|
||||
else if (!($adb->selectCell("SELECT `guid` FROM `characters` WHERE `login` = ?s", $login)))
|
||||
returnAjax('error', "Логин \"$login\" не найден в базе.");
|
||||
|
||||
$_SESSION['rem_login'] = $login;
|
||||
returnAjax('complete');
|
||||
break;
|
||||
case 'checkrem2':
|
||||
if (!$reminder)
|
||||
returnAjax('error', $reminder_error);
|
||||
|
||||
if (!checks('rem_login'))
|
||||
returnAjax('error', 'Пройдите предыдущий шаг!');
|
||||
|
||||
$login = $_SESSION['rem_login'];
|
||||
$answer = getVar('answer');
|
||||
$birthday = getVar('birthday');
|
||||
$code = getVar('code');
|
||||
|
||||
$char_db = $adb->selectRow("SELECT `guid`, `mail` FROM `characters` WHERE `login` = ?s", $login);
|
||||
$char_info = $adb->selectRow("SELECT `secretquestion`, `secretanswer`, `birthday` FROM `character_info` WHERE `guid` = ?d", $char_db['guid']);
|
||||
|
||||
if ($char_info['secretquestion'] != '' && ($answer != $char_info['secretanswer']))
|
||||
returnAjax('error', 'Неверный ответ на секретный вопрос.');
|
||||
else if ($birthday != $char_info['birthday'])
|
||||
returnAjax('error', 'Неверно указан день рождения.');
|
||||
else if ($code != $_SESSION['secpic'])
|
||||
returnAjax('error', 'Ошибка введения кода.');
|
||||
|
||||
unset($_SESSION['rem_login'], $_SESSION['secpic']);
|
||||
/*Создание нового пароля*/
|
||||
$letters = "qazxswedcvfrtgbnhyujmkiolp1234567890QAZXSWEDCVFRTGBNHYUJMKIOLP";
|
||||
$max = 10;
|
||||
$password = null;
|
||||
while ($max--)
|
||||
$password .= $letters[rand(0, (strlen($letters) - 1))];
|
||||
/*Текст письма*/
|
||||
$msg = date('d.m.y H:i', time())."\n";
|
||||
$msg .= "Кто-то с IP: ".$_SERVER['REMOTE_ADDR']." попросил выслать пароль к персонажу \"$login\".\n";
|
||||
$msg .= "Т.к. в анкете у этого персонажа указан email: $char_db[mail], то вы и получили это письмо.\n";
|
||||
$msg .= "Login: $login\n";
|
||||
$msg .= "New password: $password\n\n--\n";
|
||||
$msg .= "Анти Бойцовский Клуб http://www.anticombats.com\n";
|
||||
$msg .= "P.S. Данное письмо сгенерировано автоматически, отвечать на него не нужно.\n";
|
||||
$msg .= "В целях безопасности, вашему аккаунту запрещены все передачи и выбрасывание предметов в течение суток с момента отправки письма.\n";
|
||||
|
||||
if (!(mail($char_db['mail'], "По вашей просьбе высылаем пароль к персонажу \"$login\"", $msg, 'From: reminder@anticombats.com', 'reminder@anticombats.com')))
|
||||
returnAjax('error', 'Не удалось отправить пароль на e-mail, указанный в анкете!');
|
||||
|
||||
$char = Char::initialization($char_db['guid'], $adb);
|
||||
|
||||
if ($char->setChar('char_db', array('password' => SHA1($char_db['guid'].':'.$password), 'next_change' => (time() + 259200))))
|
||||
returnAjax('complete');
|
||||
break;
|
||||
case 'checkstep1':
|
||||
if (!$register)
|
||||
returnAjax('error', $register_error);
|
||||
|
||||
if ($adb->selectCell("SELECT COUNT(*) FROM `history_auth` WHERE `action` = 2 and `ip` = ?s and `date` > ?s", $_SERVER['REMOTE_ADDR'], (time() - 3600)))
|
||||
returnAjax('error', "Недавно с вашего IP уже регистрировался персонаж. С одного IP адреса разрешена регистрация персонажей не чаще, чем раз в час. Попробуйте позже.");
|
||||
|
||||
unset($_SESSION['reg_login']);
|
||||
$login = getVar('login');
|
||||
$match = false;
|
||||
$file = file("regfail.dat");
|
||||
$mat = explode(',', $file[0]);
|
||||
$zapret = explode(',', $file[1]);
|
||||
foreach ($zapret as $value)
|
||||
{
|
||||
$check = '';
|
||||
for ($i = 0; $i < utf8_strlen($value); $i++)
|
||||
{
|
||||
$s = utf8_substr($value, $i, 1);
|
||||
$check .= "[".lowercase($s)."|".uppercase($s)."]+";
|
||||
}
|
||||
if (preg_match("/$check/ui", $login))
|
||||
returnAjax('error', "Все вариации логина $value запрещены.");
|
||||
}
|
||||
foreach ($mat as $value)
|
||||
{
|
||||
$check = '';
|
||||
for ($i = 0; $i < utf8_strlen($value); $i++)
|
||||
{
|
||||
$s = utf8_substr($value, $i, 1);
|
||||
$check .= "[".lowercase($s)."|".uppercase($s)."]+";
|
||||
}
|
||||
if (preg_match("/$check/ui", $login))
|
||||
returnAjax('error', 'Выберите, пожалуйста, другой логин.');
|
||||
}
|
||||
$check = 0;
|
||||
for ($i = 0; $i < utf8_strlen($login); $i++)
|
||||
{
|
||||
$s = utf8_substr($login, $i, 1);
|
||||
$check += ($s == ' ' || $s == '-') ?1 :0;
|
||||
|
||||
if ($i >= 2 && lowercase($s) == lowercase(utf8_substr($login, ($i-1), 1)) && lowercase($s) == lowercase(utf8_substr($login, ($i-2), 1)))
|
||||
returnAjax('error', 'Запрещено использование трех и более одинаковых символов подряд.');
|
||||
else if (($i == 0 || $i == (utf8_strlen($login) - 1)) && ($s == '-' || $s == ' '))
|
||||
returnAjax('error', 'Логин не может начинаться или заканчиваться пробелом или тире.');
|
||||
else if ($i >= 1 && in_array($s, mb_str_split(UPCASE)) && in_array(utf8_substr($login, ($i-1), 1), mb_str_split(LOCASE)))
|
||||
returnAjax('error', 'Логин не может содержать заглавную букву после обычной.');
|
||||
else if ($check > 2)
|
||||
returnAjax('error', 'Не более двух пробелов или тире.');
|
||||
}
|
||||
|
||||
if (utf8_strlen($login) < 2 || utf8_strlen($login) > 15 || preg_match("/[^a-zA-Zа-яА-Я\- ]/ui", $login))
|
||||
returnAjax('error', 'Логин не может быть короче 2-х символов и длинее 15-ти символов, и должен состоять только из букв русского и английского алфавита, а также из тире или пробела.');
|
||||
else if (preg_match("/[\-]+[\-]/ui", $login) || preg_match("/[\_]+[\_]/ui", $login) || preg_match("/[\ ]+[\ ]/ui", $login))
|
||||
returnAjax('error', 'Запрещено использовать два разделительных символа подряд.');
|
||||
else if (preg_match("/[a-zA-Z]/ui", $login) && preg_match("/[а-яА-Я]/ui", $login))
|
||||
returnAjax('error', 'В логине разрешено использовать только буквы одного алфавита русского или английского. Нельзя смешивать.');
|
||||
else if ($adb->selectCell("SELECT `guid` FROM `characters` WHERE `login` = ?s", $login))
|
||||
returnAjax('error', "Логин $login уже занят, выберите другой.");
|
||||
|
||||
$_SESSION['reg_login'] = $login;
|
||||
returnAjax('complete');
|
||||
break;
|
||||
case 'checkstep2':
|
||||
if (!$register)
|
||||
returnAjax('error', $register_error);
|
||||
|
||||
unset($_SESSION['reg_password']);
|
||||
$error = '';
|
||||
$password = getVar('password');
|
||||
$password_confirm = getVar('password_confirm');
|
||||
|
||||
if (!checks('reg_login'))
|
||||
$error .= '<br>Пройдите предыдущий шаг!';
|
||||
if (utf8_strlen($password) < 6 || utf8_strlen($password) > 30)
|
||||
$error .= '<br>Длина пароля не может быть меньше 6 символов или более 30 символов.';
|
||||
if ($password_confirm == '' || $password != $password_confirm)
|
||||
$error .= '<br>В анкете пароль нужно ввести дважды, для проверки. Во второй раз вы его ввели неверно, будьте внимательнее...';
|
||||
if ((preg_match("/[a-zA-Z]/ui", $password) && !preg_match("/[а-яА-Я0-9_]/ui", $password)) || (preg_match("/[а-яА-Я]/ui", $password) && !preg_match("/[a-zA-Z0-9_]/ui", $password)) || (preg_match("/[0-9_]/ui", $password) && !preg_match("/[a-zA-Zа-яА-Я]/ui", $password)))
|
||||
$error .= '<br>Пароль не должен содержать только буквы одной раскладки и одного регистра.';
|
||||
if (preg_match("/$_SESSION[reg_login]/ui", $password))
|
||||
$error .= '<br>Пароль не должен содержать части логина.';
|
||||
if ($error != '')
|
||||
returnAjax('error', $error);
|
||||
|
||||
$_SESSION['reg_password'] = $password;
|
||||
returnAjax('complete');
|
||||
break;
|
||||
case 'checkstep3':
|
||||
if (!$register)
|
||||
returnAjax('error', $register_error);
|
||||
|
||||
unset($_SESSION['reg_email'], $_SESSION['reg_secretquestion'], $_SESSION['reg_secretanswer']);
|
||||
$error = '';
|
||||
$email = getVar('email');
|
||||
$secretquestion = getVar('secretquestion');
|
||||
$secretanswer = getVar('secretanswer');
|
||||
|
||||
if (!checks('reg_login', 'reg_password'))
|
||||
$error .= '<br>Пройдите предыдущий шаг!';
|
||||
if (!preg_match("/^\w+[-_\.]*\w+@\w+-?\w+\.[a-z]{2,4}$/ui", $email))
|
||||
$error .= "<br>Вы указали явно ошибочный email ($email).";
|
||||
if (utf8_strlen($email) < 6 || utf8_strlen($email) > 50)
|
||||
$error .= '<br>Email не может быть короче 6-ти символов и длинее 50-ти символов.';
|
||||
if ($error != '')
|
||||
returnAjax('error', $error);
|
||||
|
||||
$_SESSION['reg_email'] = $email;
|
||||
$_SESSION['reg_secretquestion'] = $secretquestion;
|
||||
$_SESSION['reg_secretanswer'] = $secretanswer;
|
||||
returnAjax('complete');
|
||||
break;
|
||||
case 'checkstep4':
|
||||
if (!$register)
|
||||
returnAjax('error', $register_error);
|
||||
|
||||
unset($_SESSION['reg_name'], $_SESSION['reg_birth_day'], $_SESSION['reg_birth_month'], $_SESSION['reg_birth_year'], $_SESSION['reg_sex'], $_SESSION['reg_city'], $_SESSION['reg_icq'], $_SESSION['reg_hide_icq'], $_SESSION['reg_motto'], $_SESSION['reg_color']);
|
||||
$error = '';
|
||||
$name = getVar('name');
|
||||
$birth_day = getVar('birth_day');
|
||||
$birth_month = getVar('birth_month');
|
||||
$birth_year = getVar('birth_year');
|
||||
$sex = getVar('sex');
|
||||
$city_n = getVar('city_n');
|
||||
$city = getVar('city');
|
||||
$icq = getVar('icq');
|
||||
$hide_icq = getVar('hide_icq');
|
||||
$motto = getVar('motto');
|
||||
$color = getVar('color');
|
||||
|
||||
if (!checks('reg_login', 'reg_password', 'reg_email', 'reg_secretquestion', 'reg_secretanswer'))
|
||||
$error .= '<br>Пройдите предыдущий шаг!';
|
||||
if ($name == '' || preg_match("/[^a-zA-Zа-яА-Я0-9]/ui", $name))
|
||||
$error .= '<br>Вы не заполнили или не правильно заполнили обязательное поле "Ваше имя".';
|
||||
if ($birth_day == '' || $birth_month == '' || $birth_year == '')
|
||||
$error .= '<br>Ошибка в написании дня рождения.';
|
||||
if (preg_match("/[^a-zA-Zа-яА-Я0-9]/ui", $city))
|
||||
$error .= '<br>Город должен состоять только из букв русского и английского алфавита, а также из цифр.';
|
||||
if (preg_match("/[^0-9]/ui", $icq))
|
||||
$error .= '<br>Ошибка в номере ICQ.';
|
||||
if ($error != '')
|
||||
returnAjax('error', $error);
|
||||
|
||||
$_SESSION['reg_name'] = $name;
|
||||
$_SESSION['reg_birth_day'] = $birth_day;
|
||||
$_SESSION['reg_birth_month'] = $birth_month;
|
||||
$_SESSION['reg_birth_year'] = $birth_year;
|
||||
$_SESSION['reg_sex'] = $sex;
|
||||
$_SESSION['reg_city'] = ($city_n) ?$city_n :$city;
|
||||
$_SESSION['reg_icq'] = $icq;
|
||||
$_SESSION['reg_hide_icq'] = ($hide_icq == 'true') ?1 :0;
|
||||
$_SESSION['reg_motto'] = $motto;
|
||||
$_SESSION['reg_color'] = $color;
|
||||
returnAjax('complete');
|
||||
break;
|
||||
case 'checkstep5':
|
||||
if (!$register)
|
||||
returnAjax('error', $register_error);
|
||||
|
||||
$error = '';
|
||||
$rules1 = getVar('rules1');
|
||||
$rules2 = getVar('rules2');
|
||||
$code = getVar('code');
|
||||
|
||||
if (!checks('reg_login', 'reg_password', 'reg_email', 'reg_secretquestion', 'reg_secretanswer', 'reg_name', 'reg_birth_day', 'reg_birth_month', 'reg_birth_year', 'reg_sex', 'reg_city', 'reg_icq', 'reg_hide_icq', 'reg_motto', 'reg_color'))
|
||||
$error .= '<br>Пройдите предыдущий шаг!';
|
||||
if ($rules1 == 'false')
|
||||
$error .= '<br>Извините, без принятия правил нашего клуба, вы не можете зарегистрировать своего персонажа.';
|
||||
if ($rules2 == 'false')
|
||||
$error .= '<br>Извините, без принятия <u>Соглашения о предоставлении сервиса игры Бойцовский Клуб</u>, вы не можете зарегистрировать персонаж.';
|
||||
if ($code != $_SESSION['secpic'])
|
||||
$error .= '<br>Ошибка введения кода.';
|
||||
if ($error != '')
|
||||
returnAjax('error', $error);
|
||||
|
||||
$login = $_SESSION['reg_login'];
|
||||
$password = $_SESSION['reg_password'];
|
||||
$email = $_SESSION['reg_email'];
|
||||
$secretquestion = $_SESSION['reg_secretquestion'];
|
||||
$secretanswer = $_SESSION['reg_secretanswer'];
|
||||
$name = $_SESSION['reg_name'];
|
||||
$birthday = $_SESSION['reg_birth_day'].".".$_SESSION['reg_birth_month'].".".$_SESSION['reg_birth_year'];
|
||||
$sex = $_SESSION['reg_sex'];
|
||||
$town = $_SESSION['reg_city'];
|
||||
$icq = $_SESSION['reg_icq'];
|
||||
$hide_icq = $_SESSION['reg_hide_icq'];
|
||||
$motto = $_SESSION['reg_motto'];
|
||||
$color = $_SESSION['reg_color'];
|
||||
$city = (rand(1,2) == 1) ?'drm' :'low';
|
||||
unset($_SESSION['reg_login'], $_SESSION['reg_password'], $_SESSION['reg_email'], $_SESSION['reg_secretquestion'], $_SESSION['reg_secretanswer'], $_SESSION['reg_name'], $_SESSION['reg_birth_day'], $_SESSION['reg_birth_month'], $_SESSION['reg_birth_year'], $_SESSION['reg_sex'], $_SESSION['reg_city'], $_SESSION['reg_icq'], $_SESSION['reg_hide_icq'], $_SESSION['reg_motto'], $_SESSION['reg_color'], $_SESSION['secpic']);
|
||||
|
||||
if (($adb->selectCell("SELECT COUNT(*) FROM `characters` WHERE `login` = ?s", $login)) != 0)
|
||||
returnAjax('error', 'Персонаж уже создан.');
|
||||
|
||||
$guid = ($adb->selectCell("SELECT MAX(`guid`) FROM `characters`;")) + 1;
|
||||
$reg_password = SHA1($guid.':'.$password);
|
||||
// Основная база
|
||||
$adb->query("INSERT INTO `characters` (`guid`, `login`, `login_sec`, `password`, `mail`, `sex`, `city`, `shape`, `reg_ip`, `last_time`)
|
||||
VALUES (?d, ?s, ?s, ?s, ?s, ?s, ?s, ?s, ?s, ?d);", $guid, $login, $login, $reg_password, $email, $sex, $city, "$sex/0.gif", $_SERVER['REMOTE_ADDR'], time());
|
||||
// Дополнительная информация
|
||||
$adb->query("INSERT INTO `character_info` (`guid`, `name`, `icq`, `secretquestion`, `secretanswer`, `hide_icq`, `town`, `birthday`, `color`, `motto`, `state`, `date`)
|
||||
VALUES (?d, ?s, ?s, ?s, ?s, ?d, ?s, ?s, ?s, ?s, ?s, ?d);", $guid, $name, $icq, $secretquestion, $secretanswer, $hide_icq, $town, $birthday, $color, $motto, $city, time());
|
||||
// Характеристики
|
||||
$adb->query("INSERT INTO `character_stats` (`guid`)
|
||||
VALUES (?d);", $guid);
|
||||
$stats = $config['start']['stats'];
|
||||
$items = $config['start']['items'];
|
||||
unset($config['start']['stats'], $config['start']['items']);
|
||||
$char = Char::initialization($guid, $adb);
|
||||
$char->setChar('char_stats', $config['start']);
|
||||
$char->changeStats($stats);
|
||||
// Создание инвентаря
|
||||
$adb->query("INSERT INTO `character_equip` (`guid`)
|
||||
VALUES (?d);", $guid);
|
||||
// Создание баров
|
||||
$adb->query("INSERT INTO `character_bars` (`guid`)
|
||||
VALUES (?d);", $guid);
|
||||
// Эффекты
|
||||
$char->workEffect(1);
|
||||
// Предметы
|
||||
foreach ($items as $item)
|
||||
$char->equip->addItem($item, 'get');
|
||||
// История
|
||||
$char->history->Auth(2, $city);
|
||||
|
||||
if (checks('guid'))
|
||||
deleteSession();
|
||||
|
||||
$adb->query("DELETE FROM `online` WHERE `guid` = ?d", $guid);
|
||||
$adb->query("INSERT INTO `online` (`guid`, `login_display`, `sid`, `city`, `room`, `last_time`)
|
||||
VALUES (?d, ?s, ?s, ?s, ?s, ?d);", $guid, $login, session_id(), $city, 'novice', time());
|
||||
$char->setChar('char_db', array('last_go' => time()));
|
||||
$_SESSION['guid'] = $guid;
|
||||
$_SESSION['zayavka_c_m'] = 1;
|
||||
$_SESSION['zayavka_c_o'] = 1;
|
||||
$_SESSION['battle_ref'] = 0;
|
||||
$char->history->Auth(1, $city);
|
||||
returnAjax('complete');
|
||||
break;
|
||||
}
|
||||
?>
|
34
engline/config.php
Normal file
34
engline/config.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
defined('AntiBK') or die("Доступ запрещен!");
|
||||
|
||||
function copyright($year = 'auto')
|
||||
{
|
||||
if (intval($year) == 'auto') $year = date('Y');
|
||||
if (intval($year) == date('Y')) echo intval($year);
|
||||
if (intval($year) < date('Y')) echo intval($year) . ' - ' . date('Y');
|
||||
if (intval($year) > date('Y')) echo date('Y');
|
||||
}
|
||||
|
||||
$database = [
|
||||
// Настройки подключения к базе
|
||||
'adb' => 'mysql://root:password@localhost:3306/abk',
|
||||
// Кодировка баз данных
|
||||
'db_encoding' => 'utf8',
|
||||
];
|
||||
|
||||
$config = [
|
||||
'start' => [ //Создание персонажа
|
||||
'stats' => ['str' => 3, 'dex' => 3, 'con' => 3, 'vit' => 3],
|
||||
'ups' => 3,
|
||||
'skills' => 1,
|
||||
'maxmass' => 40,
|
||||
'hp_regen' => 500,
|
||||
'mp_regen' => 100,
|
||||
'mp_cons' => 100,
|
||||
'hitmin' => 1,
|
||||
'hitmax' => 3,
|
||||
'items' => [920, 1031]
|
||||
],
|
||||
'copyright' => '© '. copyright() .', «'. $_SERVER['HTTP_HOST'] .'»™<br>All rights reserved',
|
||||
];
|
||||
$GSM = 0;
|
139
engline/data.php
Normal file
139
engline/data.php
Normal file
@ -0,0 +1,139 @@
|
||||
<?
|
||||
defined('AntiBK') or die("Доступ запрещен!");
|
||||
|
||||
$data['colors'] = array(
|
||||
'black' => 'Черный',
|
||||
'blue' => 'Синий',
|
||||
'fuchsia' => 'Розовый',
|
||||
'grey' => 'Коричневый',
|
||||
'green' => 'Зеленый',
|
||||
'maroon' => 'Малиновый',
|
||||
'navy' => 'Морской',
|
||||
'olive' => 'Оливковый',
|
||||
'purple' => 'Фиолетовый',
|
||||
'teal' => 'Темно-зеленый',
|
||||
'orange' => 'Оранжевый',
|
||||
'chocolate' => 'Шоколадный',
|
||||
'darkkhaki' => 'Темно-желтый',
|
||||
'sandybrown'=> 'Темно-оранжевый'
|
||||
);
|
||||
|
||||
$data['month'] = array(
|
||||
'01' => 'Январь',
|
||||
'02' => 'Февраль',
|
||||
'03' => 'Март',
|
||||
'04' => 'Апрель',
|
||||
'05' => 'Май',
|
||||
'06' => 'Июнь',
|
||||
'07' => 'Июль',
|
||||
'08' => 'Август',
|
||||
'09' => 'Сентябрь',
|
||||
'10' => 'Октябрь',
|
||||
'11' => 'Ноябрь',
|
||||
'12' => 'Декабрь'
|
||||
);
|
||||
|
||||
$data['towns'] = array(
|
||||
'Москва', 'Санкт-Петербург', 'Абакан (Хакасия)', 'Азов', 'Аксай (Ростовская обл.)', 'Алания', 'Альметьевск', 'Амурск', 'Анадырь', 'Анапа', 'Ангарск (Иркутская обл.)',
|
||||
'Апатиты', 'Армавир', 'Архангельск', 'Асбест', 'Астрахань', 'Балашиха', 'Барнаул', 'Белгород', 'Беломорск (Карелия)', 'Березники (Пермская обл.)', 'Бийск',
|
||||
'Биробиджан', 'Благовещенск', 'Большой камень', 'Борисоглебск', 'Братск', 'Бронницы', 'Брянск', 'Ванино', 'Великие Луки', 'Великий Устюг', 'Верхняя Салда',
|
||||
'Владивосток', 'Владикавказ', 'Владимир', 'Волгоград', 'Волгодонск', 'Волжск', 'Вологда', 'Волхов (С.Птрбрг обл.)', 'Воронеж', 'Воскресенск', 'Воткинск', 'Выборг',
|
||||
'Вязьма (Смоленская обл.)', 'Вятские Поляны', 'Гаврилов-Ям', 'Геленджик', 'Георгиевск', 'Голицино (Московская обл.)', 'Губкин', 'Гусь-Хрустальный',
|
||||
'Дзержинск (Нижгрдск обл.)', 'Димитровград', 'Долгопрудный', 'Дубна', 'Дудинка (Эвенкская АО)', 'Ейск', 'Екатеринбург', 'Елабуга (Татарстан)', 'Елец (Липецкая обл.)',
|
||||
'Елизово', 'Железногорск', 'Жуков (Калужской обл.)', 'Жуковский', 'Заречный', 'Звенигород', 'Зеленогорск', 'Зеленоград', 'Зеленодольск', 'Златоуст', 'Иваново',
|
||||
'Ивантеевка (Мсквск обл.)', 'Ижевск', 'Иркутск', 'Ишим', 'Йошкар-Ола', 'Казань', 'Калининград', 'Калуга', 'Каменск-Уральский', 'Карталы', 'Кемерово',
|
||||
'Кинешма (Ивановская обл.)', 'Кириши ( С.Птрбрг обл.)', 'Киров', 'Кирово-Чепецк', 'Кисловодск', 'Ковров', 'Когалым', 'Коломна', 'Комсомольск-на-Амуре', 'Королев',
|
||||
'Костомукша', 'Кострома', 'Красногорск', 'Краснодар', 'Красноярск', 'Кронштадт', 'Кропоткин', 'Кумертау (Башкортостан)', 'Курган', 'Курск', 'Кустанай', 'Кызыл',
|
||||
'Липецк', 'Лыткарино (Московская обл.)', 'Люберцы', 'Магадан', 'Магнитогорск', 'Майкоп', 'Малоярославец', 'Махачкала', 'Медвежьегорск', 'Междуреченск (Кмрвск обл.)',
|
||||
'Менделеевск', 'Миасс', 'Миллерово (Ростовская обл.)', 'Минеральные Воды', 'Мичуринск (Тамбовская обл.)', 'Мурманск', 'Муром', 'Мытищи', 'Набережные Челны', 'Надым',
|
||||
'Нальчик', 'Находка', 'Невинномысск', 'Нефтекамск', 'Нефтеюганск', 'Нижневартовс', 'Нижнекамск', 'Нижний Новгород', 'Нижний Тагил', 'Николаевск-на-Амуре',
|
||||
'Николаевск', 'Новгород', 'Новокузнецк', 'Новомосковск', 'Новороссийск', 'Новосибирск', 'Новоуральск', 'Новочеркасск', 'Новый Уренгой', 'Норильск', 'Ноябрьск',
|
||||
'Нягань', 'Обнинск', 'Одинцово', 'Омск', 'Онега', 'Орел', 'Оренбург', 'Орск', 'Пенза', 'Первоуральск', 'Переславль-Залесский', 'Пермь', 'Петрозаводск',
|
||||
'Петропавловск-Камч.', 'Пластун (Приморский край)', 'Подольск', 'Полевской', 'Полярные Зори', 'Протвино', 'Псков', 'Пущино', 'Пятигорск', 'Радужный (Тюменская обл.)',
|
||||
'Ревда', 'Ржев', 'Ростов-на-Дону', 'Ростов-Ярославский', 'Рубцовск', 'Рязань', 'Салехард', 'Самара', 'Саранск', 'Саратов', 'Саров', 'Сасово', 'Себеж (Псковская обл.)',
|
||||
'Северодвинск', 'Северск (Томская обл.)', 'Сегежа', 'Семикаракорск', 'Сергиев Посад', 'Серов', 'Серпухов', 'Сестрорецк (С.Птрбрг обл.)', 'Смоленск', 'Снежинск',
|
||||
'Советская Гавань', 'Советский (Тюменская обл.)', 'Солнечногорск', 'Сосновый Бор', 'Сосновый Бор (С.Птрбрг обл.)', 'Сочи', 'Ставрополь', 'Старая Русса',
|
||||
'Старый Оскол', 'Стерлитамак (Башкортостан)', 'Стрежевой (Томская обл.)', 'Строгино', 'Сургут', 'Сызрань', 'Сыктывкар', 'Таганрог', 'Тамбов', 'Таруса', 'Тверь',
|
||||
'Тольятти', 'Томск', 'Трехгорный', 'Троицк', 'Туапсе', 'Тула', 'Тюмень', 'Удомля (Тверская обл.)', 'Улан-Удэ', 'Ульяновск', 'Уссурийск', 'Усть-Лабинск (Крсндрскй край)',
|
||||
'Уфа', 'Ухта', 'Фрязино', 'Хабаровск', 'Ханты-Мансийск', 'Химки', 'Холмск', 'Чебаркуль', 'Чебоксары', 'Челябинск', 'Череповец', 'Черкесск', 'Черноголовка',
|
||||
'Чернушка (Пермская обл.)', 'Черняховск (Клннгрдск обл.)', 'Чита', 'Шадринск (Курганская обл.)', 'Шатура', 'Шахты', 'Щелково (Московская обл.)', 'Электросталь',
|
||||
'Элиста', 'Энгельс', 'Южно-Сахалинск', 'Южноуральск', 'Юрга', 'Якутск', 'Ярославль', 'Азербайджан', 'Армения', 'Беларусь', 'Грузия', 'Казахстан', 'Кыргызстан',
|
||||
'Латвия', 'Литва', 'Таджикистан', 'Туркменистан', 'Узбекистан', 'Украина', 'Эстония', 'Германия/Germany', 'Израиль/Israel', 'Канада/Canada', 'США/USA',
|
||||
);
|
||||
|
||||
$data['room_flags'] = array(
|
||||
1 => 'fights',
|
||||
2 => 'shop'
|
||||
);
|
||||
|
||||
$data['item_flags'] = array(
|
||||
1 => 'Sellable',
|
||||
2 => 'Repairable',
|
||||
4 => 'Artefact',
|
||||
8 => 'Personal',
|
||||
16 => 'Left Hand'
|
||||
);
|
||||
|
||||
$data['sections'] = array(
|
||||
1 => 'item',
|
||||
2 => 'thing',
|
||||
3 => 'elix',
|
||||
4 => 'other'
|
||||
);
|
||||
|
||||
$data['sections_shop'] = array(
|
||||
'sell' => array('', 'NULL', 'shop_sell'),
|
||||
'knife' => array('shop', 'shop_weapon', 'shop_weapon'),
|
||||
'axe' => array('shop', 'shop_weapon', 'whitespace'),
|
||||
'fail' => array('shop', 'shop_weapon', 'whitespace'),
|
||||
'sword' => array('shop', 'shop_weapon', 'whitespace'),
|
||||
'staff' => array('shop', 'shop_weapon', 'whitespace'),
|
||||
'boots' => array('shop', 'shop_dress', 'shop_dress'),
|
||||
'shirt' => array('shop', 'shop_dress', 'whitespace'),
|
||||
'gloves' => array('shop', 'shop_dress', 'whitespace'),
|
||||
'light_armor' => array('shop', 'shop_dress', 'whitespace'),
|
||||
'heavy_armor' => array('shop', 'shop_dress', 'whitespace'),
|
||||
'helmet' => array('shop', 'shop_dress', 'whitespace'),
|
||||
'bracer' => array('shop', 'shop_dress', 'whitespace'),
|
||||
'belt' => array('shop', 'shop_dress', 'whitespace'),
|
||||
'pants' => array('shop', 'shop_dress', 'whitespace'),
|
||||
'shield' => array('shop', 'NULL', 'NULL'),
|
||||
'earring' => array('shop', 'shop_jewel', 'shop_jewel'),
|
||||
'amulet' => array('shop', 'shop_jewel', 'whitespace'),
|
||||
'ring' => array('shop', 'shop_jewel', 'whitespace'),
|
||||
'scroll' => array('shop', 'NULL', 'NULL')
|
||||
);
|
||||
|
||||
$behaviour = array(
|
||||
//Хар-ка |Мин.лвл
|
||||
'str' => 0,
|
||||
'dex' => 0,
|
||||
'con' => 0,
|
||||
'vit' => 0,
|
||||
'int' => 4,
|
||||
'wis' => 6,
|
||||
'spi' => 10
|
||||
);
|
||||
|
||||
$mastery = array(
|
||||
'phisic' => 1,
|
||||
'sword' => 1,
|
||||
'bow' => 1,
|
||||
'crossbow' => 1,
|
||||
'fail' => 1,
|
||||
'staff' => 4,
|
||||
'knife' => 1,
|
||||
'axe' => 1,
|
||||
'fire' => 4,
|
||||
'water' => 4,
|
||||
'air' => 4,
|
||||
'earth' => 4,
|
||||
'light' => 4,
|
||||
'gray' => 4,
|
||||
'dark' => 4
|
||||
);
|
||||
|
||||
define("DATE_FULL", date('d.m.y H:i:s'));
|
||||
define("DATE_NO_SEC", date('d.m.y H:i'));
|
||||
define("DATE_TIME", date('H:i'));
|
||||
?>
|
1361
engline/dbsimple/Generic.php
Normal file
1361
engline/dbsimple/Generic.php
Normal file
File diff suppressed because it is too large
Load Diff
290
engline/dbsimple/Ibase.php
Normal file
290
engline/dbsimple/Ibase.php
Normal file
@ -0,0 +1,290 @@
|
||||
<?php
|
||||
/**
|
||||
* DbSimple_Ibase: Interbase/Firebird database.
|
||||
* (C) Dk Lab, http://en.dklab.ru
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
* See http://www.gnu.org/copyleft/lesser.html
|
||||
*
|
||||
* Placeholders are emulated because of logging purposes.
|
||||
*
|
||||
* @author Dmitry Koterov, http://forum.dklab.ru/users/DmitryKoterov/
|
||||
* @author Konstantin Zhinko, http://forum.dklab.ru/users/KonstantinGinkoTit/
|
||||
*
|
||||
* @version 2.x $Id$
|
||||
*/
|
||||
require_once dirname(__FILE__) . '/Generic.php';
|
||||
|
||||
/**
|
||||
* Best transaction parameters for script queries.
|
||||
* They never give us update conflicts (unlike others)!
|
||||
* Used by default.
|
||||
*/
|
||||
define('IBASE_BEST_TRANSACTION', IBASE_COMMITTED + IBASE_WAIT + IBASE_REC_VERSION);
|
||||
define('IBASE_BEST_FETCH', IBASE_UNIXTIME);
|
||||
|
||||
/**
|
||||
* Database class for Interbase/Firebird.
|
||||
*/
|
||||
|
||||
class DbSimple_Ibase extends DbSimple_Generic_Database
|
||||
{
|
||||
var $DbSimple_Ibase_BEST_TRANSACTION = IBASE_BEST_TRANSACTION;
|
||||
var $DbSimple_Ibase_USE_NATIVE_PHOLDERS = true;
|
||||
var $fetchFlags = IBASE_BEST_FETCH;
|
||||
var $link;
|
||||
var $trans;
|
||||
var $prepareCache = array();
|
||||
|
||||
/**
|
||||
* constructor(string $dsn)
|
||||
* Connect to Interbase/Firebird.
|
||||
*/
|
||||
function DbSimple_Ibase($dsn)
|
||||
{
|
||||
$p = DbSimple_Generic::parseDSN($dsn);
|
||||
if (!is_callable('ibase_connect')) {
|
||||
return $this->_setLastError("-1", "Interbase/Firebird extension is not loaded", "ibase_connect");
|
||||
}
|
||||
$ok = $this->link = ibase_connect(
|
||||
$p['host'] . (empty($p['port'])? "" : ":".$p['port']) .':'.preg_replace('{^/}s', '', $p['path']),
|
||||
$p['user'],
|
||||
$p['pass'],
|
||||
isset($p['CHARSET']) ? $p['CHARSET'] : 'win1251',
|
||||
isset($p['BUFFERS']) ? $p['BUFFERS'] : 0,
|
||||
isset($p['DIALECT']) ? $p['DIALECT'] : 3,
|
||||
isset($p['ROLE']) ? $p['ROLE'] : ''
|
||||
);
|
||||
if (isset($p['TRANSACTION'])) $this->DbSimple_Ibase_BEST_TRANSACTION = eval($p['TRANSACTION'].";");
|
||||
$this->_resetLastError();
|
||||
if (!$ok) return $this->_setDbError('ibase_connect()');
|
||||
}
|
||||
|
||||
function _performEscape($s, $isIdent=false)
|
||||
{
|
||||
if (!$isIdent)
|
||||
return "'" . str_replace("'", "''", $s) . "'";
|
||||
else
|
||||
return '"' . str_replace('"', '_', $s) . '"';
|
||||
}
|
||||
|
||||
function _performTransaction($parameters=null)
|
||||
{
|
||||
if ($parameters === null) $parameters = $this->DbSimple_Ibase_BEST_TRANSACTION;
|
||||
$this->trans = @ibase_trans($parameters, $this->link);
|
||||
}
|
||||
|
||||
function& _performNewBlob($blobid=null)
|
||||
{
|
||||
$obj =& new DbSimple_Ibase_Blob($this, $blobid);
|
||||
return $obj;
|
||||
}
|
||||
|
||||
function _performGetBlobFieldNames($result)
|
||||
{
|
||||
$blobFields = array();
|
||||
for ($i=ibase_num_fields($result)-1; $i>=0; $i--) {
|
||||
$info = ibase_field_info($result, $i);
|
||||
if ($info['type'] === "BLOB") $blobFields[] = $info['name'];
|
||||
}
|
||||
return $blobFields;
|
||||
}
|
||||
|
||||
function _performGetPlaceholderIgnoreRe()
|
||||
{
|
||||
return '
|
||||
" (?> [^"\\\\]+|\\\\"|\\\\)* " |
|
||||
\' (?> [^\'\\\\]+|\\\\\'|\\\\)* \' |
|
||||
` (?> [^`]+ | ``)* ` | # backticks
|
||||
/\* .*? \*/ # comments
|
||||
';
|
||||
}
|
||||
|
||||
function _performCommit()
|
||||
{
|
||||
if (!is_resource($this->trans)) return false;
|
||||
$result = @ibase_commit($this->trans);
|
||||
if (true === $result) {
|
||||
$this->trans = null;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
function _performRollback()
|
||||
{
|
||||
if (!is_resource($this->trans)) return false;
|
||||
$result = @ibase_rollback($this->trans);
|
||||
if (true === $result) {
|
||||
$this->trans = null;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
function _performTransformQuery(&$queryMain, $how)
|
||||
{
|
||||
// If we also need to calculate total number of found rows...
|
||||
switch ($how) {
|
||||
// Prepare total calculation (if possible)
|
||||
case 'CALC_TOTAL':
|
||||
// Not possible
|
||||
return true;
|
||||
|
||||
// Perform total calculation.
|
||||
case 'GET_TOTAL':
|
||||
// TODO: GROUP BY ... -> COUNT(DISTINCT ...)
|
||||
$re = '/^
|
||||
(?> -- [^\r\n]* | \s+)*
|
||||
(\s* SELECT \s+) #1
|
||||
((?:FIRST \s+ \S+ \s+ (?:SKIP \s+ \S+ \s+)? )?) #2
|
||||
(.*?) #3
|
||||
(\s+ FROM \s+ .*?) #4
|
||||
((?:\s+ ORDER \s+ BY \s+ .*)?) #5
|
||||
$/six';
|
||||
$m = null;
|
||||
if (preg_match($re, $queryMain[0], $m)) {
|
||||
$queryMain[0] = $m[1] . $this->_fieldList2Count($m[3]) . " AS C" . $m[4];
|
||||
$skipHead = substr_count($m[2], '?');
|
||||
if ($skipHead) array_splice($queryMain, 1, $skipHead);
|
||||
$skipTail = substr_count($m[5], '?');
|
||||
if ($skipTail) array_splice($queryMain, -$skipTail);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function _performQuery($queryMain)
|
||||
{
|
||||
$this->_lastQuery = $queryMain;
|
||||
$this->_expandPlaceholders($queryMain, $this->DbSimple_Ibase_USE_NATIVE_PHOLDERS);
|
||||
|
||||
$hash = $queryMain[0];
|
||||
|
||||
if (!isset($this->prepareCache[$hash])) {
|
||||
$this->prepareCache[$hash] = @ibase_prepare((is_resource($this->trans) ? $this->trans : $this->link), $queryMain[0]);
|
||||
} else {
|
||||
// Prepare cache hit!
|
||||
}
|
||||
|
||||
$prepared = $this->prepareCache[$hash];
|
||||
if (!$prepared) return $this->_setDbError($queryMain[0]);
|
||||
$queryMain[0] = $prepared;
|
||||
$result = @call_user_func_array('ibase_execute', $queryMain);
|
||||
// ATTENTION!!!
|
||||
// WE MUST save prepared ID (stored in $prepared variable) somewhere
|
||||
// before returning $result because of ibase destructor. Now it is done
|
||||
// by $this->prepareCache. When variable $prepared goes out of scope, it
|
||||
// is destroyed, and memory for result also freed by PHP. Totally we
|
||||
// got "Invalud statement handle" error message.
|
||||
|
||||
if ($result === false) return $this->_setDbError($queryMain[0]);
|
||||
if (!is_resource($result)) {
|
||||
// Non-SELECT queries return number of affected rows, SELECT - resource.
|
||||
return @ibase_affected_rows((is_resource($this->trans) ? $this->trans : $this->link));
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
function _performFetch($result)
|
||||
{
|
||||
// Select fetch mode.
|
||||
$flags = $this->fetchFlags;
|
||||
if (empty($this->attributes['BLOB_OBJ'])) $flags = $flags | IBASE_TEXT;
|
||||
else $flags = $flags & ~IBASE_TEXT;
|
||||
|
||||
$row = @ibase_fetch_assoc($result, $flags);
|
||||
if (ibase_errmsg()) return $this->_setDbError($this->_lastQuery);
|
||||
if ($row === false) return null;
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
function _setDbError($query)
|
||||
{
|
||||
return $this->_setLastError(ibase_errcode(), ibase_errmsg(), $query);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class DbSimple_Ibase_Blob extends DbSimple_Generic_Blob
|
||||
{
|
||||
var $blob; // resourse link
|
||||
var $id;
|
||||
var $database;
|
||||
|
||||
function DbSimple_Ibase_Blob(&$database, $id=null)
|
||||
{
|
||||
$this->database =& $database;
|
||||
$this->id = $id;
|
||||
$this->blob = null;
|
||||
}
|
||||
|
||||
function read($len)
|
||||
{
|
||||
if ($this->id === false) return ''; // wr-only blob
|
||||
if (!($e=$this->_firstUse())) return $e;
|
||||
$data = @ibase_blob_get($this->blob, $len);
|
||||
if ($data === false) return $this->_setDbError('read');
|
||||
return $data;
|
||||
}
|
||||
|
||||
function write($data)
|
||||
{
|
||||
if (!($e=$this->_firstUse())) return $e;
|
||||
$ok = @ibase_blob_add($this->blob, $data);
|
||||
if ($ok === false) return $this->_setDbError('add data to');
|
||||
return true;
|
||||
}
|
||||
|
||||
function close()
|
||||
{
|
||||
if (!($e=$this->_firstUse())) return $e;
|
||||
if ($this->blob) {
|
||||
$id = @ibase_blob_close($this->blob);
|
||||
if ($id === false) return $this->_setDbError('close');
|
||||
$this->blob = null;
|
||||
} else {
|
||||
$id = null;
|
||||
}
|
||||
return $this->id ? $this->id : $id;
|
||||
}
|
||||
|
||||
function length()
|
||||
{
|
||||
if ($this->id === false) return 0; // wr-only blob
|
||||
if (!($e=$this->_firstUse())) return $e;
|
||||
$info = @ibase_blob_info($this->id);
|
||||
if (!$info) return $this->_setDbError('get length of');
|
||||
return $info[0];
|
||||
}
|
||||
|
||||
function _setDbError($query)
|
||||
{
|
||||
$hId = $this->id === null ? "null" : ($this->id === false ? "false" : $this->id);
|
||||
$query = "-- $query BLOB $hId";
|
||||
$this->database->_setDbError($query);
|
||||
}
|
||||
|
||||
// Called on each blob use (reading or writing).
|
||||
function _firstUse()
|
||||
{
|
||||
// BLOB is opened - nothing to do.
|
||||
if (is_resource($this->blob)) return true;
|
||||
// Open or create blob.
|
||||
if ($this->id !== null) {
|
||||
$this->blob = @ibase_blob_open($this->id);
|
||||
if ($this->blob === false) return $this->_setDbError('open');
|
||||
} else {
|
||||
$this->blob = @ibase_blob_create($this->database->link);
|
||||
if ($this->blob === false) return $this->_setDbError('create');
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
234
engline/dbsimple/Mysql.php
Normal file
234
engline/dbsimple/Mysql.php
Normal file
@ -0,0 +1,234 @@
|
||||
<?php
|
||||
/**
|
||||
* DbSimple_Mysql: MySQL database.
|
||||
* (C) Dk Lab, http://en.dklab.ru
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
* See http://www.gnu.org/copyleft/lesser.html
|
||||
*
|
||||
* Placeholders end blobs are emulated.
|
||||
*
|
||||
* @author Dmitry Koterov, http://forum.dklab.ru/users/DmitryKoterov/
|
||||
* @author Konstantin Zhinko, http://forum.dklab.ru/users/KonstantinGinkoTit/
|
||||
*
|
||||
* @version 2.x $Id$
|
||||
*/
|
||||
require_once dirname(__FILE__) . '/Generic.php';
|
||||
|
||||
|
||||
/**
|
||||
* Database class for MySQL.
|
||||
*/
|
||||
class DbSimple_Mysql extends DbSimple_Generic_Database
|
||||
{
|
||||
var $link;
|
||||
|
||||
/**
|
||||
* constructor(string $dsn)
|
||||
* Connect to MySQL.
|
||||
*/
|
||||
function DbSimple_Mysql($dsn)
|
||||
{
|
||||
$p = DbSimple_Generic::parseDSN($dsn);
|
||||
if (!is_callable('mysql_connect')) {
|
||||
return $this->_setLastError("-1", "MySQL extension is not loaded", "mysql_connect");
|
||||
}
|
||||
$ok = $this->link = @mysql_connect(
|
||||
$str = $p['host'] . (empty($p['port'])? "" : ":" . $p['port']),
|
||||
$p['user'],
|
||||
$p['pass'],
|
||||
true
|
||||
);
|
||||
$this->_resetLastError();
|
||||
if (!$ok) return $this->_setDbError('mysql_connect("' . $str . '", "' . $p['user'] . '")');
|
||||
$ok = @mysql_select_db(preg_replace('{^/}s', '', $p['path']), $this->link);
|
||||
if (!$ok) return $this->_setDbError('mysql_select_db()');
|
||||
if (isset($p["charset"])) {
|
||||
$this->query('SET NAMES ?', $p["charset"]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function _performEscape($s, $isIdent=false)
|
||||
{
|
||||
if (!$isIdent) {
|
||||
return "'" . mysql_real_escape_string($s, $this->link) . "'";
|
||||
} else {
|
||||
return "`" . str_replace('`', '``', $s) . "`";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function _performTransaction($parameters=null)
|
||||
{
|
||||
return $this->query('BEGIN');
|
||||
}
|
||||
|
||||
|
||||
function& _performNewBlob($blobid=null)
|
||||
{
|
||||
$obj =& new DbSimple_Mysql_Blob($this, $blobid);
|
||||
return $obj;
|
||||
}
|
||||
|
||||
|
||||
function _performGetBlobFieldNames($result)
|
||||
{
|
||||
$blobFields = array();
|
||||
for ($i=mysql_num_fields($result)-1; $i>=0; $i--) {
|
||||
$type = mysql_field_type($result, $i);
|
||||
if (strpos($type, "BLOB") !== false) $blobFields[] = mysql_field_name($result, $i);
|
||||
}
|
||||
return $blobFields;
|
||||
}
|
||||
|
||||
|
||||
function _performGetPlaceholderIgnoreRe()
|
||||
{
|
||||
return '
|
||||
" (?> [^"\\\\]+|\\\\"|\\\\)* " |
|
||||
\' (?> [^\'\\\\]+|\\\\\'|\\\\)* \' |
|
||||
` (?> [^`]+ | ``)* ` | # backticks
|
||||
/\* .*? \*/ # comments
|
||||
';
|
||||
}
|
||||
|
||||
|
||||
function _performCommit()
|
||||
{
|
||||
return $this->query('COMMIT');
|
||||
}
|
||||
|
||||
|
||||
function _performRollback()
|
||||
{
|
||||
return $this->query('ROLLBACK');
|
||||
}
|
||||
|
||||
|
||||
function _performTransformQuery(&$queryMain, $how)
|
||||
{
|
||||
// If we also need to calculate total number of found rows...
|
||||
switch ($how) {
|
||||
// Prepare total calculation (if possible)
|
||||
case 'CALC_TOTAL':
|
||||
$m = null;
|
||||
if (preg_match('/^(\s* SELECT)(.*)/six', $queryMain[0], $m)) {
|
||||
if ($this->_calcFoundRowsAvailable()) {
|
||||
$queryMain[0] = $m[1] . ' SQL_CALC_FOUND_ROWS' . $m[2];
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
// Perform total calculation.
|
||||
case 'GET_TOTAL':
|
||||
// Built-in calculation available?
|
||||
if ($this->_calcFoundRowsAvailable()) {
|
||||
$queryMain = array('SELECT FOUND_ROWS()');
|
||||
}
|
||||
// Else use manual calculation.
|
||||
// TODO: GROUP BY ... -> COUNT(DISTINCT ...)
|
||||
$re = '/^
|
||||
(?> -- [^\r\n]* | \s+)*
|
||||
(\s* SELECT \s+) #1
|
||||
(.*?) #2
|
||||
(\s+ FROM \s+ .*?) #3
|
||||
((?:\s+ ORDER \s+ BY \s+ .*?)?) #4
|
||||
((?:\s+ LIMIT \s+ \S+ \s* (?:, \s* \S+ \s*)? )?) #5
|
||||
$/six';
|
||||
$m = null;
|
||||
if (preg_match($re, $queryMain[0], $m)) {
|
||||
$query[0] = $m[1] . $this->_fieldList2Count($m[2]) . " AS C" . $m[3];
|
||||
$skipTail = substr_count($m[4] . $m[5], '?');
|
||||
if ($skipTail) array_splice($query, -$skipTail);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
function _performQuery($queryMain)
|
||||
{
|
||||
$this->_lastQuery = $queryMain;
|
||||
$this->_expandPlaceholders($queryMain, false);
|
||||
$result = @mysql_query($queryMain[0], $this->link);
|
||||
if ($result === false) return $this->_setDbError($queryMain[0]);
|
||||
if (!is_resource($result)) {
|
||||
if (preg_match('/^\s* INSERT \s+/six', $queryMain[0])) {
|
||||
// INSERT queries return generated ID.
|
||||
return @mysql_insert_id($this->link);
|
||||
}
|
||||
// Non-SELECT queries return number of affected rows, SELECT - resource.
|
||||
return @mysql_affected_rows($this->link);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
function _performFetch($result)
|
||||
{
|
||||
$row = @mysql_fetch_assoc($result);
|
||||
if (mysql_error()) return $this->_setDbError($this->_lastQuery);
|
||||
if ($row === false) return null;
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
function _setDbError($query)
|
||||
{
|
||||
if ($this->link) {
|
||||
return $this->_setLastError(mysql_errno($this->link), mysql_error($this->link), $query);
|
||||
} else {
|
||||
return $this->_setLastError(mysql_errno(), mysql_error(), $query);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function _calcFoundRowsAvailable()
|
||||
{
|
||||
$ok = version_compare(mysql_get_server_info($this->link), '4.0') >= 0;
|
||||
return $ok;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class DbSimple_Mysql_Blob extends DbSimple_Generic_Blob
|
||||
{
|
||||
// MySQL does not support separate BLOB fetching.
|
||||
var $blobdata = null;
|
||||
var $curSeek = 0;
|
||||
|
||||
function DbSimple_Mysql_Blob(&$database, $blobdata=null)
|
||||
{
|
||||
$this->blobdata = $blobdata;
|
||||
$this->curSeek = 0;
|
||||
}
|
||||
|
||||
function read($len)
|
||||
{
|
||||
$p = $this->curSeek;
|
||||
$this->curSeek = min($this->curSeek + $len, strlen($this->blobdata));
|
||||
return substr($this->blobdata, $this->curSeek, $len);
|
||||
}
|
||||
|
||||
function write($data)
|
||||
{
|
||||
$this->blobdata .= $data;
|
||||
}
|
||||
|
||||
function close()
|
||||
{
|
||||
return $this->blobdata;
|
||||
}
|
||||
|
||||
function length()
|
||||
{
|
||||
return strlen($this->blobdata);
|
||||
}
|
||||
}
|
||||
?>
|
321
engline/dbsimple/Postgresql.php
Normal file
321
engline/dbsimple/Postgresql.php
Normal file
@ -0,0 +1,321 @@
|
||||
<?php
|
||||
/**
|
||||
* DbSimple_Postgreql: PostgreSQL database.
|
||||
* (C) Dk Lab, http://en.dklab.ru
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
* See http://www.gnu.org/copyleft/lesser.html
|
||||
*
|
||||
* Placeholders are emulated because of logging purposes.
|
||||
*
|
||||
* @author Dmitry Koterov, http://forum.dklab.ru/users/DmitryKoterov/
|
||||
* @author Konstantin Zhinko, http://forum.dklab.ru/users/KonstantinGinkoTit/
|
||||
*
|
||||
* @version 2.x $Id$
|
||||
*/
|
||||
require_once dirname(__FILE__) . '/Generic.php';
|
||||
|
||||
|
||||
/**
|
||||
* Database class for PostgreSQL.
|
||||
*/
|
||||
class DbSimple_Postgresql extends DbSimple_Generic_Database
|
||||
{
|
||||
|
||||
var $DbSimple_Postgresql_USE_NATIVE_PHOLDERS = null;
|
||||
var $prepareCache = array();
|
||||
var $link;
|
||||
|
||||
/**
|
||||
* constructor(string $dsn)
|
||||
* Connect to PostgresSQL.
|
||||
*/
|
||||
function DbSimple_Postgresql($dsn)
|
||||
{
|
||||
$p = DbSimple_Generic::parseDSN($dsn);
|
||||
if (!is_callable('pg_connect')) {
|
||||
return $this->_setLastError("-1", "PostgreSQL extension is not loaded", "pg_connect");
|
||||
}
|
||||
|
||||
// Prepare+execute works only in PHP 5.1+.
|
||||
$this->DbSimple_Postgresql_USE_NATIVE_PHOLDERS = function_exists('pg_prepare');
|
||||
|
||||
$dsnWithoutPass =
|
||||
(!empty($p['host']) ? 'host='.$p['host'].' ' : '') .
|
||||
(!empty($p['port']) ? 'port=' . $p['port'] . ' ' : '') .
|
||||
'dbname=' . preg_replace('{^/}s', '', $p['path']) .' '.
|
||||
(!empty($p['user']) ? 'user='. $p['user'] : '');
|
||||
$ok = $this->link = @pg_connect(
|
||||
$dsnWithoutPass . " " . (!empty($p['pass']) ? 'password=' . $p['pass'] . ' ' : ''),
|
||||
PGSQL_CONNECT_FORCE_NEW
|
||||
);
|
||||
// We use PGSQL_CONNECT_FORCE_NEW, because in PHP 5.3 & PHPUnit
|
||||
// $this->prepareCache may be cleaned, but $this->link is still
|
||||
// not closed. So the next creation of DbSimple_Postgresql()
|
||||
// would use exactly the same connection as the previous, but with
|
||||
// empty $this->prepareCache, and it will generate "prepared statement
|
||||
// xxx already exists" error each time we execute the same statement
|
||||
// as in the previous calls.
|
||||
$this->_resetLastError();
|
||||
if (!$ok) return $this->_setDbError('pg_connect("' . $dsnWithoutPass . '") error');
|
||||
}
|
||||
|
||||
|
||||
function _performEscape($s, $isIdent=false)
|
||||
{
|
||||
if (!$isIdent)
|
||||
return "E'" . pg_escape_string($this->link, $s) . "'";
|
||||
else
|
||||
return '"' . str_replace('"', '_', $s) . '"';
|
||||
}
|
||||
|
||||
|
||||
function _performTransaction($parameters=null)
|
||||
{
|
||||
return $this->query('BEGIN');
|
||||
}
|
||||
|
||||
|
||||
function& _performNewBlob($blobid=null)
|
||||
{
|
||||
$obj =& new DbSimple_Postgresql_Blob($this, $blobid);
|
||||
return $obj;
|
||||
}
|
||||
|
||||
|
||||
function _performGetBlobFieldNames($result)
|
||||
{
|
||||
$blobFields = array();
|
||||
for ($i=pg_num_fields($result)-1; $i>=0; $i--) {
|
||||
$type = pg_field_type($result, $i);
|
||||
if (strpos($type, "BLOB") !== false) $blobFields[] = pg_field_name($result, $i);
|
||||
}
|
||||
return $blobFields;
|
||||
}
|
||||
|
||||
// TODO: Real PostgreSQL escape
|
||||
function _performGetPlaceholderIgnoreRe()
|
||||
{
|
||||
return '
|
||||
" (?> [^"\\\\]+|\\\\"|\\\\)* " |
|
||||
\' (?> [^\'\\\\]+|\\\\\'|\\\\)* \' |
|
||||
/\* .*? \*/ # comments
|
||||
';
|
||||
}
|
||||
|
||||
function _performGetNativePlaceholderMarker($n)
|
||||
{
|
||||
// PostgreSQL uses specific placeholders such as $1, $2, etc.
|
||||
return '$' . ($n + 1);
|
||||
}
|
||||
|
||||
function _performCommit()
|
||||
{
|
||||
return $this->query('COMMIT');
|
||||
}
|
||||
|
||||
|
||||
function _performRollback()
|
||||
{
|
||||
return $this->query('ROLLBACK');
|
||||
}
|
||||
|
||||
|
||||
function _performTransformQuery(&$queryMain, $how)
|
||||
{
|
||||
|
||||
// If we also need to calculate total number of found rows...
|
||||
switch ($how) {
|
||||
// Prepare total calculation (if possible)
|
||||
case 'CALC_TOTAL':
|
||||
// Not possible
|
||||
return true;
|
||||
|
||||
// Perform total calculation.
|
||||
case 'GET_TOTAL':
|
||||
// TODO: GROUP BY ... -> COUNT(DISTINCT ...)
|
||||
$re = '/^
|
||||
(?> -- [^\r\n]* | \s+)*
|
||||
(\s* SELECT \s+) #1
|
||||
(.*?) #2
|
||||
(\s+ FROM \s+ .*?) #3
|
||||
((?:\s+ ORDER \s+ BY \s+ .*?)?) #4
|
||||
((?:\s+ LIMIT \s+ \S+ \s* (?: OFFSET \s* \S+ \s*)? )?) #5
|
||||
$/six';
|
||||
$m = null;
|
||||
if (preg_match($re, $queryMain[0], $m)) {
|
||||
$queryMain[0] = $m[1] . $this->_fieldList2Count($m[2]) . " AS C" . $m[3];
|
||||
$skipTail = substr_count($m[4] . $m[5], '?');
|
||||
if ($skipTail) array_splice($queryMain, -$skipTail);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
function _performQuery($queryMain)
|
||||
{
|
||||
$this->_lastQuery = $queryMain;
|
||||
$isInsert = preg_match('/^\s* INSERT \s+/six', $queryMain[0]);
|
||||
|
||||
//
|
||||
// Note that in case of INSERT query we CANNOT work with prepare...execute
|
||||
// cache, because RULEs do not work after pg_execute(). This is a very strange
|
||||
// bug... To reproduce:
|
||||
// $DB->query("CREATE TABLE test(id SERIAL, str VARCHAR(10)) WITH OIDS");
|
||||
// $DB->query("CREATE RULE test_r AS ON INSERT TO test DO (SELECT 111 AS id)");
|
||||
// print_r($DB->query("INSERT INTO test(str) VALUES ('test')"));
|
||||
// In case INSERT + pg_execute() it returns new row OID (numeric) instead
|
||||
// of result of RULE query. Strange, very strange...
|
||||
//
|
||||
|
||||
if ($this->DbSimple_Postgresql_USE_NATIVE_PHOLDERS && !$isInsert) {
|
||||
// Use native placeholders only if PG supports them.
|
||||
$this->_expandPlaceholders($queryMain, true);
|
||||
$hash = md5($queryMain[0]);
|
||||
if (!isset($this->prepareCache[$hash])) {
|
||||
$prepared = @pg_prepare($this->link, $hash, $queryMain[0]);
|
||||
if ($prepared === false) return $this->_setDbError($queryMain[0]);
|
||||
else $this->prepareCache[$hash] = true;
|
||||
} else {
|
||||
// Prepare cache hit!
|
||||
}
|
||||
$result = pg_execute($this->link, $hash, array_slice($queryMain, 1));
|
||||
} else {
|
||||
// No support for native placeholders on INSERT query.
|
||||
$this->_expandPlaceholders($queryMain, false);
|
||||
$result = @pg_query($this->link, $queryMain[0]);
|
||||
}
|
||||
|
||||
if ($result === false) return $this->_setDbError($queryMain);
|
||||
if (!pg_num_fields($result)) {
|
||||
if ($isInsert) {
|
||||
// INSERT queries return generated OID (if table is WITH OIDs).
|
||||
//
|
||||
// Please note that unfortunately we cannot use lastval() PostgreSQL
|
||||
// stored function because it generates fatal error if INSERT query
|
||||
// does not contain sequence-based field at all. This error terminates
|
||||
// the current transaction, and we cannot continue to work nor know
|
||||
// if table contains sequence-updateable field or not.
|
||||
//
|
||||
// To use auto-increment functionality you must invoke
|
||||
// $insertedId = $DB->query("SELECT lastval()")
|
||||
// manually where it is really needed.
|
||||
//
|
||||
return @pg_last_oid($result);
|
||||
}
|
||||
// Non-SELECT queries return number of affected rows, SELECT - resource.
|
||||
return @pg_affected_rows($result);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
function _performFetch($result)
|
||||
{
|
||||
$row = @pg_fetch_assoc($result);
|
||||
if (pg_last_error($this->link)) return $this->_setDbError($this->_lastQuery);
|
||||
if ($row === false) return null;
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
function _setDbError($query)
|
||||
{
|
||||
return $this->_setLastError(null, $this->link? pg_last_error($this->link) : (is_array($query)? "Connection is not established" : $query), $query);
|
||||
}
|
||||
|
||||
function _getVersion()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class DbSimple_Postgresql_Blob extends DbSimple_Generic_Blob
|
||||
{
|
||||
var $blob; // resourse link
|
||||
var $id;
|
||||
var $database;
|
||||
|
||||
function DbSimple_Postgresql_Blob(&$database, $id=null)
|
||||
{
|
||||
$this->database =& $database;
|
||||
$this->database->transaction();
|
||||
$this->id = $id;
|
||||
$this->blob = null;
|
||||
}
|
||||
|
||||
function read($len)
|
||||
{
|
||||
if ($this->id === false) return ''; // wr-only blob
|
||||
if (!($e=$this->_firstUse())) return $e;
|
||||
$data = @pg_lo_read($this->blob, $len);
|
||||
if ($data === false) return $this->_setDbError('read');
|
||||
return $data;
|
||||
}
|
||||
|
||||
function write($data)
|
||||
{
|
||||
if (!($e=$this->_firstUse())) return $e;
|
||||
$ok = @pg_lo_write($this->blob, $data);
|
||||
if ($ok === false) return $this->_setDbError('add data to');
|
||||
return true;
|
||||
}
|
||||
|
||||
function close()
|
||||
{
|
||||
if (!($e=$this->_firstUse())) return $e;
|
||||
if ($this->blob) {
|
||||
$id = @pg_lo_close($this->blob);
|
||||
if ($id === false) return $this->_setDbError('close');
|
||||
$this->blob = null;
|
||||
} else {
|
||||
$id = null;
|
||||
}
|
||||
$this->database->commit();
|
||||
return $this->id? $this->id : $id;
|
||||
}
|
||||
|
||||
function length()
|
||||
{
|
||||
if (!($e=$this->_firstUse())) return $e;
|
||||
|
||||
@pg_lo_seek($this->blob, 0, PGSQL_SEEK_END);
|
||||
$len = @pg_lo_tell($this->blob);
|
||||
@pg_lo_seek($this->blob, 0, PGSQL_SEEK_SET);
|
||||
|
||||
if (!$len) return $this->_setDbError('get length of');
|
||||
return $len;
|
||||
}
|
||||
|
||||
function _setDbError($query)
|
||||
{
|
||||
$hId = $this->id === null? "null" : ($this->id === false? "false" : $this->id);
|
||||
$query = "-- $query BLOB $hId";
|
||||
$this->database->_setDbError($query);
|
||||
}
|
||||
|
||||
// Called on each blob use (reading or writing).
|
||||
function _firstUse()
|
||||
{
|
||||
// BLOB opened - do nothing.
|
||||
if (is_resource($this->blob)) return true;
|
||||
|
||||
// Open or create blob.
|
||||
if ($this->id !== null) {
|
||||
$this->blob = @pg_lo_open($this->database->link, $this->id, 'rw');
|
||||
if ($this->blob === false) return $this->_setDbError('open');
|
||||
} else {
|
||||
$this->id = @pg_lo_create($this->database->link);
|
||||
$this->blob = @pg_lo_open($this->database->link, $this->id, 'w');
|
||||
if ($this->blob === false) return $this->_setDbError('create');
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
?>
|
38
engline/error/404.html
Normal file
38
engline/error/404.html
Normal file
@ -0,0 +1,38 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Анти Бойцовский клуб</title>
|
||||
<link rel="SHORTCUT ICON" href="../img/favicon.ico" />
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta http-equiv="Content-Language" content="ru" />
|
||||
<style>
|
||||
body { background-color: #ffffff }
|
||||
.message {
|
||||
position:absolute;
|
||||
text-align:center;
|
||||
width:500px;
|
||||
height:50px;
|
||||
margin-top:505px;
|
||||
margin-left: 100px;
|
||||
font-size:20px;
|
||||
font-family:Arial;
|
||||
color: #4b7675;
|
||||
}
|
||||
.message a {
|
||||
color: navy;
|
||||
}
|
||||
.backimg {
|
||||
margin: auto;
|
||||
background: url('../engline/error/404.png') no-repeat top center;
|
||||
width: 830;
|
||||
height: 589;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div style="text-align: center;">
|
||||
<div class="backimg">
|
||||
<div class="message">Страница не найдена. <br>Вернитесь на <a href="../">главную страницу</a>.</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
BIN
engline/error/404.png
Normal file
BIN
engline/error/404.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
74
engline/functions/class_Bank.php
Normal file
74
engline/functions/class_Bank.php
Normal file
@ -0,0 +1,74 @@
|
||||
<?
|
||||
defined('AntiBK') or die("Доступ запрещен!");
|
||||
|
||||
class Bank extends Char
|
||||
{
|
||||
public $guid;
|
||||
public $db;
|
||||
public $char;
|
||||
function Init ($object)
|
||||
{
|
||||
$this->guid = $object->guid;
|
||||
$this->db = $object->db;
|
||||
$this->char = $object;
|
||||
}
|
||||
/*Начало работы с банковским счетом*/
|
||||
function Login ($id, $pass)
|
||||
{
|
||||
$seek = $this->db->selectRow("SELECT `guid`,
|
||||
`password`
|
||||
FROM `character_bank`
|
||||
WHERE `id` = ?d
|
||||
and `guid` = ?d", $id ,$this->guid);
|
||||
if (!$seek)
|
||||
return 303;
|
||||
|
||||
if ($this->guid != $seek['guid'])
|
||||
return 322;
|
||||
|
||||
if (SHA1($id.':'.$pass) != $seek['password'])
|
||||
return 302;
|
||||
|
||||
$_SESSION['bankСredit'] = $id;
|
||||
return 0;
|
||||
}
|
||||
/*Конец работы с банковским счетом*/
|
||||
function unLogin ()
|
||||
{
|
||||
unset($_SESSION['bankСredit']);
|
||||
}
|
||||
/*Увеличение/уменьшение денег в банке у персонажа*/
|
||||
function Money ($sum, $id, $type = '', $guid = 0)
|
||||
{
|
||||
if (checki($id) || !is_numeric($sum))
|
||||
$this->char->error->Map(326);
|
||||
|
||||
$sum = rdf($sum);
|
||||
|
||||
if ($sum == 0)
|
||||
$this->char->error->Map(325);
|
||||
|
||||
$guid = $this->getGuid($guid);
|
||||
switch ($type)
|
||||
{
|
||||
case 'euro':
|
||||
$money = $this->db->selectCell("SELECT `euro` FROM `character_bank` WHERE `id` = ?d and `guid` = ?d", $id ,$guid);
|
||||
|
||||
if (($money = rdf($money - $sum)) < 0)
|
||||
$this->char->error->Map(310, $sum);
|
||||
|
||||
$this->db->query("UPDATE `character_bank` SET `euro` = ?f WHERE `id` = ?d and `guid` = ?d", $money ,$id ,$guid);
|
||||
break;
|
||||
default:
|
||||
$money = $this->db->selectCell("SELECT `cash` FROM `character_bank` WHERE `id` = ?d and `guid` = ?d", $id ,$guid);
|
||||
|
||||
if (($money = rdf($money - $sum)) < 0)
|
||||
$this->char->error->Map(305, $sum);
|
||||
|
||||
$this->db->query("UPDATE `character_bank` SET `cash` = ?f WHERE `id` = ?d and `guid` = ?d", $money ,$id ,$guid);
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
?>
|
709
engline/functions/class_Char.php
Normal file
709
engline/functions/class_Char.php
Normal file
@ -0,0 +1,709 @@
|
||||
<?
|
||||
defined('AntiBK') or die("Доступ запрещен!");
|
||||
|
||||
class Char
|
||||
{
|
||||
public $guid;
|
||||
public $db;
|
||||
public $test;
|
||||
public $equip;
|
||||
public $city;
|
||||
public $mail;
|
||||
public $bank;
|
||||
public $chat;
|
||||
public $history;
|
||||
public $error;
|
||||
function& initialization ($guid, $adb)
|
||||
{
|
||||
$object = new Char;
|
||||
$object->guid = $guid;
|
||||
$object->db = $adb;
|
||||
$classes = array('test', 'equip', 'city', 'mail', 'bank', 'chat', 'history', 'error');
|
||||
foreach ($classes as $class)
|
||||
{
|
||||
$object->{$class} = new $class;
|
||||
}
|
||||
foreach ($classes as $class)
|
||||
{
|
||||
$object->{$class}->Init($object);
|
||||
}
|
||||
return $object;
|
||||
}
|
||||
/*Получение информации о персонаже*/
|
||||
function getChar ()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$a_num = func_num_args();
|
||||
$m_guid = (isset($args[2])) ?$args[2] :"-";
|
||||
|
||||
if (is_numeric($args[$a_num-1]))
|
||||
{
|
||||
$guid = $args[$a_num-1];
|
||||
unset($args[$a_num-1]);
|
||||
}
|
||||
else
|
||||
$guid = $this->guid;
|
||||
|
||||
$table = getTable($args[0]);
|
||||
unset($args[0]);
|
||||
|
||||
if ($args[1] == '*')
|
||||
return $this->db->selectRow("SELECT * FROM ?# WHERE `guid` = ?d", $table ,$guid);
|
||||
else if ($a_num == 2 || ($a_num == 3 && is_numeric($m_guid)))
|
||||
return $this->db->selectCell("SELECT ?# FROM ?# WHERE `guid` = ?d", $args ,$table ,$guid);
|
||||
else
|
||||
return $this->db->selectRow("SELECT ?# FROM ?# WHERE `guid` = ?d", $args ,$table ,$guid);
|
||||
}
|
||||
/*Обновление информации о персонаже*/
|
||||
function setChar ()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$a_num = func_num_args();
|
||||
|
||||
if (is_numeric($args[$a_num-1]))
|
||||
{
|
||||
$guid = $args[$a_num-1];
|
||||
unset($args[$a_num-1]);
|
||||
}
|
||||
else
|
||||
$guid = $this->guid;
|
||||
|
||||
$table = getTable($args[0]);
|
||||
unset($args[0]);
|
||||
|
||||
if ($a_num == 4 || ($a_num == 3 && !is_array($args[1])))
|
||||
return $this->db->query("UPDATE ?# SET ?# = ? WHERE `guid` = ?d", $table ,$args[1] ,$args[2] ,$guid);
|
||||
else
|
||||
return $this->db->query("UPDATE ?# SET ?a WHERE `guid` = ?d", $table ,$args[1] ,$guid);
|
||||
}
|
||||
/*Получение информации о языке*/
|
||||
function getLang ()
|
||||
{
|
||||
$lang = $this->db->selectCell("SELECT `language` FROM `server_info`;");
|
||||
return $this->db->selectCol("SELECT `key` AS ARRAY_KEY, ?# FROM `server_language`;", $lang);
|
||||
}
|
||||
/*Увеличение/уменьшение характеристики*/
|
||||
function changeStats ()
|
||||
{
|
||||
$stats = func_get_args();
|
||||
$a_num = func_num_args();
|
||||
|
||||
if (is_numeric($stats[$a_num-1]))
|
||||
{
|
||||
$guid = $stats[$a_num-1];
|
||||
unset($stats[$a_num-1]);
|
||||
}
|
||||
else
|
||||
$guid = $this->guid;
|
||||
|
||||
$stats = (is_array($stats[0])) ?$stats[0] :array($stats[0] => $stats[1]);
|
||||
foreach ($stats as $stat => $count)
|
||||
{
|
||||
switch ($stat)
|
||||
{
|
||||
case 'str':
|
||||
$this->db->query("UPDATE `character_stats`
|
||||
SET `str` = `str` + ?d,
|
||||
`hitmin` = `hitmin` + ?d,
|
||||
`hitmax` = `hitmax` + ?d
|
||||
WHERE `guid` = ?d", $count ,$count ,$count ,$guid);
|
||||
$this->statsBonus($stat);
|
||||
break;
|
||||
case 'dex':
|
||||
$mf_dodge = $count * 7;
|
||||
$mf_adodge = $count * 3;
|
||||
$this->db->query("UPDATE `character_stats`
|
||||
SET `dex` = `dex` + ?d,
|
||||
`mf_dodge` = `mf_dodge` + ?d,
|
||||
`mf_adodge` = `mf_adodge` + ?d
|
||||
WHERE `guid` = ?d", $count ,$mf_dodge ,$mf_adodge ,$guid);
|
||||
$this->statsBonus($stat);
|
||||
break;
|
||||
case 'con':
|
||||
$mf_crit = $count * 7;
|
||||
$mf_acrit = $count * 3;
|
||||
$this->db->query("UPDATE `character_stats`
|
||||
SET `con` = `con` + ?d,
|
||||
`mf_crit` = `mf_crit` + ?d,
|
||||
`mf_acrit` = `mf_acrit` + ?d
|
||||
WHERE `guid` = ?d", $count ,$mf_crit ,$mf_acrit ,$guid);
|
||||
$this->statsBonus($stat);
|
||||
break;
|
||||
case 'vit':
|
||||
$hp = $count * 6;
|
||||
$bron = rdf($count * 1.5);
|
||||
$this->db->query("UPDATE `character_stats`
|
||||
SET `vit` = `vit` + ?d,
|
||||
`hp` = `hp` + ?d,
|
||||
`hp_all` = `hp_all` + ?d,
|
||||
`maxmass` = `maxmass` + ?d,
|
||||
`res_sting` = `res_sting` + ?f,
|
||||
`res_slash` = `res_slash` + ?f,
|
||||
`res_crush` = `res_crush` + ?f,
|
||||
`res_sharp` = `res_sharp` + ?f,
|
||||
`res_fire` = `res_fire` + ?f,
|
||||
`res_water` = `res_water` + ?f,
|
||||
`res_air` = `res_air` + ?f,
|
||||
`res_earth` = `res_earth` + ?f,
|
||||
`res_light` = `res_light` + ?f,
|
||||
`res_gray` = `res_gray` + ?f,
|
||||
`res_dark` = `res_dark` + ?f
|
||||
WHERE `guid` = ?d", $count ,$hp ,$hp ,$count ,$bron ,$bron ,$bron ,$bron ,$bron ,$bron ,$bron ,$bron ,$bron ,$bron ,$bron ,$guid);
|
||||
$this->statsBonus($stat);
|
||||
break;
|
||||
case 'int':
|
||||
$mf = rdf($count * 0.5);
|
||||
$this->db->query("UPDATE `character_stats`
|
||||
SET `int` = `int` + ?d,
|
||||
`mf_fire` = `mf_fire` + ?f,
|
||||
`mf_water` = `mf_water` + ?f,
|
||||
`mf_air` = `mf_air` + ?f,
|
||||
`mf_earth` = `mf_earth` + ?f,
|
||||
`mf_light` = `mf_light` + ?f,
|
||||
`mf_gray` = `mf_gray` + ?f,
|
||||
`mf_dark` = `mf_dark` + ?f
|
||||
WHERE `guid` = ?d", $count ,$mf ,$mf ,$mf ,$mf ,$mf ,$mf ,$mf ,$guid);
|
||||
$this->statsBonus($stat);
|
||||
break;
|
||||
case 'wis':
|
||||
$mp = $count * 10;
|
||||
$this->db->query("UPDATE `character_stats`
|
||||
SET `wis` = `wis` + ?d,
|
||||
`mp` = `mp` + ?d,
|
||||
`mp_all` = `mp_all` + ?d
|
||||
WHERE `guid` = ?d", $count ,$mp ,$mp ,$guid);
|
||||
$this->statsBonus($stat);
|
||||
break;
|
||||
case 'spi':
|
||||
$this->db->query("UPDATE `character_stats`
|
||||
SET `spi` = `spi` + ?d
|
||||
WHERE `guid` = ?d", $count ,$guid);
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/*Увеличение/уменьшение кол-ва денег у персонажа*/
|
||||
function changeMoney ($sum, $guid = 0)
|
||||
{
|
||||
if (!is_numeric($sum))
|
||||
return false;
|
||||
|
||||
$sum = rdf($sum);
|
||||
|
||||
if ($sum == 0)
|
||||
return false;
|
||||
|
||||
$guid = $this->getGuid($guid);
|
||||
$money = $this->getChar('char_db', 'money');
|
||||
|
||||
if (($money = $money + $sum) < 0)
|
||||
return false;
|
||||
|
||||
$this->setChar('char_db', 'money', $money, $guid);
|
||||
return true;
|
||||
}
|
||||
/*Увеличение/уменьшение массы у персонажа*/
|
||||
function changeMass ($mass, $guid = 0)
|
||||
{
|
||||
if (checki($mass))
|
||||
return false;
|
||||
|
||||
$guid = $this->getGuid($guid);
|
||||
|
||||
$mass = $this->getChar('char_stats', 'mass') + rdf($mass);
|
||||
$this->setChar('char_stats', 'mass', $mass, $guid);
|
||||
return true;
|
||||
}
|
||||
/*Время востановления здоровья*/
|
||||
function setTimeToHPMP ($now, $all, $regen, $type, $guid = 0)
|
||||
{
|
||||
$guid = $this->getGuid($guid);
|
||||
if ($now > $all)
|
||||
$this->setChar('char_stats', array($type => $all, $type.'_cure' => 0), $guid);
|
||||
else
|
||||
{
|
||||
getCureValue($now, $all, $regen, $cure);
|
||||
$this->setChar('char_stats', $type.'_cure', $cure, $guid);
|
||||
}
|
||||
}
|
||||
/*Отображение дополнительной характеристики*/
|
||||
function showStatAddition ($type = 'skills')
|
||||
{
|
||||
global $added;
|
||||
$added = array('str' => 0, 'dex' => 0, 'con' => 0, 'int' => 0, 'sword' => 0, 'bow' => 0, 'crossbow' => 0, 'axe' => 0, 'fail' => 0, 'knife' => 0, 'staff' => 0, 'fire' => 0, 'water' => 0, 'air' => 0, 'earth' => 0, 'light' => 0, 'gray' => 0, 'dark' => 0);
|
||||
$items = $this->db->select("SELECT `i`.`add_str`, `c`.`inc_str`,
|
||||
`i`.`add_dex`, `c`.`inc_dex`,
|
||||
`i`.`add_con`, `c`.`inc_con`,
|
||||
`i`.`add_int`, `c`.`inc_int`,
|
||||
`i`.`all_mastery`,
|
||||
`i`.`sword`, `i`.`axe`,
|
||||
`i`.`bow`, `i`.`crossbow`,
|
||||
`i`.`fail`, `i`.`knife`,
|
||||
`i`.`staff`,
|
||||
`i`.`all_magic`,
|
||||
`i`.`fire`, `i`.`water`,
|
||||
`i`.`air`, `i`.`earth`,
|
||||
`i`.`light`, `i`.`gray`,
|
||||
`i`.`dark`
|
||||
FROM `character_inventory` AS `c`
|
||||
LEFT JOIN `item_template` AS `i`
|
||||
ON `c`.`item_entry` = `i`.`entry`
|
||||
WHERE `c`.`guid` = ?d
|
||||
and `c`.`wear` = '1';", $this->guid);
|
||||
foreach ($items as $dat)
|
||||
{
|
||||
$added['str'] += $dat['add_str'] + $dat['inc_str'];
|
||||
$added['dex'] += $dat['add_dex'] + $dat['inc_dex'];
|
||||
$added['con'] += $dat['add_con'] + $dat['inc_con'];
|
||||
$added['int'] += $dat['add_int'] + $dat['inc_int'];
|
||||
}
|
||||
|
||||
$travms = $this->db->select("SELECT `stats` FROM `character_travms` WHERE `guid` = ?d and `stats` != '';", $this->guid);
|
||||
foreach ($travms as $travm)
|
||||
{
|
||||
$stats = split(",", $travm['stats']);
|
||||
foreach ($stats as $stat)
|
||||
{
|
||||
$stat = split("=", $stat);
|
||||
|
||||
if (array_key_exists($stat[0], $added))
|
||||
$added[$stat[0]] += -$stat[1];
|
||||
}
|
||||
}
|
||||
|
||||
if ($type != 'skills')
|
||||
return;
|
||||
|
||||
foreach ($items as $dat)
|
||||
{
|
||||
$added['sword'] += $dat['sword'] + $dat['all_mastery'];
|
||||
$added['bow'] += $dat['bow'] + $dat['all_mastery'];
|
||||
$added['crossbow'] += $dat['crossbow'] + $dat['all_mastery'];
|
||||
$added['axe'] += $dat['axe'] + $dat['all_mastery'];
|
||||
$added['fail'] += $dat['fail'] + $dat['all_mastery'];
|
||||
$added['knife'] += $dat['knife'] + $dat['all_mastery'];
|
||||
$added['staff'] += $dat['staff'];
|
||||
$added['fire'] += $dat['fire'] + $dat['all_magic'];
|
||||
$added['water'] += $dat['water'] + $dat['all_magic'];
|
||||
$added['air'] += $dat['air'] + $dat['all_magic'];
|
||||
$added['earth'] += $dat['earth'] + $dat['all_magic'];
|
||||
$added['light'] += $dat['light'];
|
||||
$added['gray'] += $dat['gray'];
|
||||
$added['dark'] += $dat['dark'];
|
||||
}
|
||||
}
|
||||
/*Проверка доступности образа*/
|
||||
function checkShape ($id)
|
||||
{
|
||||
$shape = $this->db->selectRow("SELECT * FROM `player_shapes` WHERE `id` = ?d", $id);
|
||||
|
||||
if (!$shape)
|
||||
return false;
|
||||
|
||||
$char_db = $this->getChar('char_db', 'level', 'sex', 'next_shape');
|
||||
$char_stats = $this->getChar('char_stats', 'str', 'dex', 'con', 'vit', 'int', 'wis', 'sword', 'axe', 'fail', 'knife', 'fire', 'water', 'air', 'earth', 'light', 'dark');
|
||||
$char_feat = array_merge($char_db, $char_stats);
|
||||
|
||||
if ($char_feat['next_shape'] && $char_feat['next_shape'] > time())
|
||||
$this->error->Inventory(111, getFormatedTime($char_feat['next_shape']));
|
||||
|
||||
if ($shape['sex'] != $char_feat['sex'])
|
||||
return false;
|
||||
|
||||
unset($char_feat['sex'], $char_feat['next_shape']);
|
||||
foreach ($char_feat as $key => $value)
|
||||
{
|
||||
if ($shape[$key] > 0 && $shape[$key] > $value)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/*Отображение модуля инвентаря*/
|
||||
function showInventoryBar ($bar, $value, $max_num)
|
||||
{
|
||||
global $behaviour;
|
||||
$flag = explode('|', $value);
|
||||
$lang = $this->getLang();
|
||||
$char_stats = $this->getChar('char_stats', '*');
|
||||
$char_equip = $this->getChar('char_equip', 'hand_r', 'hand_l', 'hand_r', 'hand_r_type', 'hand_l_type');
|
||||
list($hand_r, $hand_l, $hand_r_type, $hand_l_type) = array_values($char_equip);
|
||||
$content = '';
|
||||
$link_text = '';
|
||||
$link = '';
|
||||
$flags = ($flag[1]) ?1 :0;
|
||||
$flags += ($flag[0] > 1) ?2 :0;
|
||||
$flags += ($flag[0] < $max_num) ?4 :0;
|
||||
switch ($bar)
|
||||
{
|
||||
default:
|
||||
case 'stat': /*Характеристики*/
|
||||
$level = $this->db->selectCell("SELECT `level` FROM `characters` WHERE `guid` = ?d", $this->guid);
|
||||
foreach ($behaviour as $key => $min_level)
|
||||
$content .= ($level >= $min_level) ?"$lang[$key] <b>$char_stats[$key]</b><br>" :"";
|
||||
$content .= ($char_stats['ups'] > 0) ?"<a class='nick' href='?action=skills'><b><small>+ $lang[ups]</small></b></a> " :"";
|
||||
$content .= ($char_stats['skills'] > 0) ?"• <a class='nick' href='?action=skills'><b><small> $lang[skills]</small></b></a>" :"";
|
||||
break;
|
||||
case 'mod': /*Модификаторы*/
|
||||
$hitmin = $char_stats['hitmin'];
|
||||
$hitmax = $char_stats['hitmax'];
|
||||
$hand_r_hitmin = $char_stats['hand_r_hitmin'];
|
||||
$hand_l_hitmin = $char_stats['hand_l_hitmin'];
|
||||
$hand_r_hitmax = $char_stats['hand_r_hitmax'];
|
||||
$hand_l_hitmax = $char_stats['hand_l_hitmax'];
|
||||
$hand_r_critp = $char_stats['hand_r_critp'];
|
||||
$hand_l_critp = $char_stats['hand_l_critp'];
|
||||
$hand_r_crit = $char_stats['hand_r_crit'];
|
||||
$hand_l_crit = $char_stats['hand_l_crit'];
|
||||
$hand_r_adodge = $char_stats['hand_r_adodge'];
|
||||
$hand_l_adodge = $char_stats['hand_l_adodge'];
|
||||
$mf_critp = $char_stats['mf_critp'];
|
||||
$mf_crit = $char_stats['mf_crit'];
|
||||
$mf_dodge = $char_stats['mf_dodge'];
|
||||
$mf_acrit = $char_stats['mf_acrit'];
|
||||
$mf_adodge = $char_stats['mf_adodge'];
|
||||
$mf_contr = $char_stats['mf_contr'];
|
||||
$mf_parry = $char_stats['mf_parry'];
|
||||
$mf_shieldb = $char_stats['mf_shieldb'];
|
||||
$hand_status_r = $this->equip->checkHandStatus('r');
|
||||
$hand_status_l = $this->equip->checkHandStatus('l');
|
||||
$show_r_udar = ($hand_status_r) ?($hand_r_hitmin + $hitmin + $char_stats[$hand_r_type])."-".($hand_r_hitmax + $hitmax + $char_stats[$hand_r_type]) :"";
|
||||
$show_l_udar = ($hand_status_l) ?(($hand_r != 0) ?" / " :"").($hand_l_hitmin + $hitmin + $char_stats[$hand_l_type])."-".($hand_l_hitmax + $hitmax + $char_stats[$hand_l_type]) :"";
|
||||
$show_r_cpower = ($hand_status_r) ?$hand_r_critp + $mf_critp :"";
|
||||
$show_l_cpower = ($hand_status_l) ?(($hand_r != 0) ?" / " :"").($hand_l_critp + $mf_critp) :"";
|
||||
$show_r_crit = ($hand_status_r) ?$hand_r_crit + $mf_crit :"";
|
||||
$show_l_crit = ($hand_status_l) ?(($hand_r != 0) ?" / " :"").($hand_l_crit + $mf_crit) :"";
|
||||
$show_r_adodge = ($hand_status_r) ?$hand_r_adodge + $mf_adodge :"";
|
||||
$show_l_adodge = ($hand_status_l) ?(($hand_r != 0) ?" / " :"").($hand_l_adodge + $mf_adodge) :"";
|
||||
$show_r_mastery = ($hand_status_r) ?$char_stats[$hand_r_type] + $char_stats['hand_r_'.$hand_r_type] :"";
|
||||
$show_l_mastery = ($hand_status_l) ?(($hand_r != 0) ?" / " :"").($char_stats[$hand_l_type] + $char_stats['hand_l_'.$hand_r_type]) :"";
|
||||
$content .= "$lang[damage] $show_r_udar$show_l_udar<br>"
|
||||
. "<span alt='$lang[mf_crit_m]'>$lang[mf_crit_i] $show_r_crit$show_l_crit</span><br>";
|
||||
$content .= ($hand_r_critp != 0 || $hand_l_critp != 0 || $mf_critp != 0) ?"<span alt='$lang[mf_critp_m]'>$lang[mf_critp_i] $show_r_cpower$show_l_cpower</span><br>" :"";
|
||||
$content .= "<span alt='$lang[mf_acrit_m]'>$lang[mf_acrit_i] $mf_acrit</span><br>"
|
||||
. "<span alt='$lang[mf_dodge_m]'>$lang[mf_dodge_i] $mf_dodge</span><br>"
|
||||
. "<span alt='$lang[mf_adodge_m]'>$lang[mf_adodge_i] $show_r_adodge$show_l_adodge</span><br>"
|
||||
. "<span alt='$lang[mf_contr_m]'>$lang[mf_contr_i] $mf_contr</span><br>"
|
||||
. "<span alt='$lang[mf_parry_m]'>$lang[mf_parry_i] $mf_parry</span><br>"
|
||||
. "<span alt='$lang[mf_shieldb_m]'>$lang[mf_shieldb_i] $mf_shieldb</span><br>";
|
||||
$content .= ($hand_r != 0 || $hand_l != 0) ?"<span alt='$lang[mastery_m]'>$lang[mastery] $show_r_mastery$show_l_mastery</span><br>" :"";
|
||||
break;
|
||||
case 'power': /*Мощность*/
|
||||
$mf_damage = array('sting', 'slash', 'crush', 'sharp');
|
||||
$mf_magic = array('fire', 'water', 'air', 'earth', 'light', 'gray', 'dark');
|
||||
foreach ($mf_damage as $key)
|
||||
{
|
||||
$plus_r = $char_stats['hand_r_'.$key] + $char_stats['mf_'.$key];
|
||||
$plus_l = $char_stats['hand_l_'.$key] + $char_stats['mf_'.$key];
|
||||
$show_r[$key] = ($this->equip->checkHandStatus('r')) ?(($plus_r > 0) ?'+' :'')."$plus_r" :"";
|
||||
$show_l[$key] = ($this->equip->checkHandStatus('l')) ?(($hand_r != 0) ?"% / ".(($plus_l > 0) ?'+' :'') :"").$plus_l :"";
|
||||
}
|
||||
foreach ($mf_damage as $key)
|
||||
$content .= ($char_stats['mf_'.$key] != 0 || $char_stats['hand_r_'.$key] != 0 || $char_stats['hand_l_'.$key] != 0) ?"<span alt='".$lang[$key.'_p']."'>".$lang[$key.'_i']." $show_r[$key]$show_l[$key]%</span><br>" :"";
|
||||
foreach ($mf_magic as $key)
|
||||
$content .= ($char_stats['mf_'.$key] != 0) ?"<span alt='".$lang[$key.'_p']."'>".$lang[$key.'_i']." ".(($char_stats['mf_'.$key] > 0) ?'+' :'')."".$char_stats['mf_'.$key]."%</span><br>" :"";
|
||||
break;
|
||||
case 'def': /*Защита*/
|
||||
$ress = array ('sting', 'slash', 'crush', 'sharp', 'fire', 'water', 'air', 'earth', 'light', 'dark', 'gray');
|
||||
foreach ($ress as $key)
|
||||
$content .= "<span alt='".$lang[$key.'_d']."'>".$lang[$key.'_i']." ".$char_stats['res_'.$key]."</span><br>";
|
||||
break;
|
||||
case 'btn': /*Кнопки*/
|
||||
$content .= " <input type='button' value='$lang[unwear_all]' class='btn' id='link' link='unwear_full' style='font-weight: bold; cursor: pointer;'><br>";
|
||||
break;
|
||||
case 'set': /*Комплекты*/
|
||||
$sets = $this->db->select("SELECT * FROM `character_sets` WHERE `guid` = ?d", $this->guid);
|
||||
$link_text = "запомнить";
|
||||
$link = "javascript:kmp();";
|
||||
$content .= "<div id='allsets'>";
|
||||
foreach ($sets as $set)
|
||||
$content .= $this->getSetRow($set['name']);
|
||||
$content .= "</div>";
|
||||
break;
|
||||
}
|
||||
$return = "<table width='100%' border='0' cellspacing='0' cellpadding='1' background='img/back.gif'><tr><td valign='middle'>";
|
||||
if ($flags & 1)
|
||||
$return .= "<img id='spoiler_$bar' width='11' height='9' alt='Скрыть' border='0' src='../img/minus.gif' style='cursor: pointer;' onclick=\"javascript:spoilerBar('$bar');\" />";
|
||||
else
|
||||
$return .= "<img id='spoiler_$bar' width='11' height='9' alt='Показать' border='0' src='../img/plus.gif' style='cursor: pointer;' onclick=\"javascript:spoilerBar('$bar');\" />";
|
||||
$return .= "</td>";
|
||||
$return .= "<td> </td><td bgcolor='#e2e0e0'><small> <b>".$lang['bar_'.$bar]."<b> </small></td>";
|
||||
if ($link_text)
|
||||
$return .= "<td> </td><td bgcolor='#e2e0e0'> <a href='$link' class='nick'><small>$link_text</small></a> </td>";
|
||||
$return .= "<td align='right' valign='middle' width='100%'>";
|
||||
if ($flags & 2)
|
||||
$return .= "<img border='0' width='11' height='9' alt='Поднять блок наверх' src='../img/up.gif' style='cursor: pointer;' onclick=\"javascript:switchBars('up', '$bar');\" />";
|
||||
else
|
||||
$return .= "<img border='0' width='11' height='9' src='../img/up-grey.gif'>";
|
||||
if ($flags & 4)
|
||||
$return .= "<img border='0' width='11' height='9' alt='Опустить блок вниз' src='../img/down.gif' style='cursor: pointer;' onclick=\"javascript:switchBars('down', '$bar');\" />";
|
||||
else
|
||||
$return .= "<img border='0' width='11' height='9' src='../img/down-grey.gif'>";
|
||||
$return .= "</td>";
|
||||
$return .= "</tr></table>";
|
||||
$style = ($flags & 1) ?"" :" style='display: none;'";
|
||||
$return .= "<div id='{$bar}c'$style><small>$content</small></div>";
|
||||
return $return;
|
||||
}
|
||||
/*Получение строки комплекта*/
|
||||
function getSetRow ($name)
|
||||
{
|
||||
$lang = $this->getLang();
|
||||
return "<div name='".str_replace(" ", "_", $name)."'><img width='200' height='1' src='../img/1x1.gif'><br> <img src='../img/icon/inf2.gif' width='10' height='10' alt='Просмотр' onclick=\"workSets('show', '$name');\" style='cursor: pointer;'><img src='../img/icon/close2.gif' width='9' height='9' alt='$lang[set_delete]' onclick=\"if (confirm('$lang[set_delete] $name?')) {workSets('delete', '$name');}\" style='cursor: pointer;'> <a href='main.php?action=wear_set&set_name=$name' class='nick'><small>$lang[equip] \"$name\"</small></a></div>";
|
||||
}
|
||||
/*Добавление/Обновление/Удаление эффекта*/
|
||||
function workEffect ($effect, $type = 1, $guid = 0)
|
||||
{
|
||||
$guid = $this->getGuid($guid);
|
||||
|
||||
if (checki($effect))
|
||||
return;
|
||||
|
||||
$char_eff = $this->db->selectCell("SELECT `guid` FROM `character_effects` WHERE `effect_id` = ?d and `guid` = ?d", $effect ,$guid);
|
||||
|
||||
if ((($type == -1 || $type == 0) && !$char_eff) || ($type == 1 && $char_eff))
|
||||
return;
|
||||
|
||||
$e_info = $this->db->selectRow("SELECT * FROM `player_effects` WHERE `id` = ?d", $effect);
|
||||
|
||||
$char_e = $this->db->selectCell("SELECT `c`.`effect_id`
|
||||
FROM `character_effects` AS `c`
|
||||
LEFT JOIN `player_effects` AS `i`
|
||||
ON `c`.`effect_id` = `i`.`id`
|
||||
WHERE `c`.`guid` = ?d
|
||||
and `i`.`set` = ?s", $guid ,$e_info['set']);
|
||||
|
||||
if ($char_e && $char_e != $effect)
|
||||
$this->workEffect($char_e, -1);
|
||||
|
||||
if ($type == 0)
|
||||
{
|
||||
if ($char_eff)
|
||||
{
|
||||
$this->db->query("UPDATE `character_effects` SET `end_time` = ?d WHERE `guid` = ?d and `effect_id` = ?d", (time() + $e_info['duration']) ,$guid ,$effect);
|
||||
return;
|
||||
}
|
||||
else
|
||||
$type = 1;
|
||||
}
|
||||
|
||||
$char_stats = $this->getChar('char_stats', '*', $guid);
|
||||
|
||||
$new_sql = array();
|
||||
$new_sql['res_sting'] = $e_info['res_dmg'];
|
||||
$new_sql['res_slash'] = $e_info['res_dmg'];
|
||||
$new_sql['res_crush'] = $e_info['res_dmg'];
|
||||
$new_sql['res_sharp'] = $e_info['res_dmg'];
|
||||
$new_sql['res_fire'] = $e_info['res_magic'];
|
||||
$new_sql['res_water'] = $e_info['res_magic'];
|
||||
$new_sql['res_air'] = $e_info['res_magic'];
|
||||
$new_sql['res_earth'] = $e_info['res_magic'];
|
||||
$new_sql['res_light'] = $e_info['res_magic'];
|
||||
$new_sql['res_gray'] = $e_info['res_magic'];
|
||||
$new_sql['res_dark'] = $e_info['res_magic'];
|
||||
$new_sql['mf_sting'] = $e_info['mf_dmg'];
|
||||
$new_sql['mf_slash'] = $e_info['mf_dmg'];
|
||||
$new_sql['mf_crush'] = $e_info['mf_dmg'];
|
||||
$new_sql['mf_sharp'] = $e_info['mf_dmg'];
|
||||
$new_sql['mf_fire'] = $e_info['mf_magic'];
|
||||
$new_sql['mf_water'] = $e_info['mf_magic'];
|
||||
$new_sql['mf_air'] = $e_info['mf_magic'];
|
||||
$new_sql['mf_earth'] = $e_info['mf_magic'];
|
||||
$new_sql['mf_critp'] = $e_info['mf_critp'];
|
||||
$new_sql['mf_adodge'] = $e_info['mf_adodge'];
|
||||
$new_sql['mf_acrit'] = $e_info['mf_acrit'];
|
||||
$new_sql['mf_dodge'] = $e_info['mf_dodge'];
|
||||
$new_sql['hitmin'] = $e_info['add_hit_min'];
|
||||
$new_sql['hitmax'] = $e_info['add_hit_max'];
|
||||
$new_sql['hp_all'] = $e_info['add_hp'];
|
||||
$new_sql['mp_all'] = $e_info['add_mp'];
|
||||
$new_sql['mp_regen'] = $e_info['mp_regen'];
|
||||
$new_sql['mp_cons'] = -$e_info['mp_cons'];
|
||||
|
||||
foreach ($new_sql as $key => $value)
|
||||
{
|
||||
$new_sql[$key] = $value*$type;
|
||||
$new_sql[$key] += $char_stats[$key];
|
||||
}
|
||||
|
||||
$char_hpmp = $this->getChar('char_stats', 'hp', 'mp', $guid);
|
||||
foreach ($char_hpmp as $key => $value)
|
||||
{
|
||||
if ($e_info['add_'.$key] != 0)
|
||||
$this->setTimeToHPMP($value, $new_sql[$key.'_all'], $char_stats[$key.'_regen'], $key, $guid);
|
||||
}
|
||||
|
||||
if ($type == 1)
|
||||
{
|
||||
$time = ($e_info['duration'] == 0) ?0 :time() + $e_info['duration'];
|
||||
$this->db->query("INSERT INTO `character_effects` (`guid`, `effect_id`, `end_time`)
|
||||
VALUES (?d, ?d, ?d)", $guid ,$effect ,$time);
|
||||
}
|
||||
else if ($type == -1)
|
||||
$this->db->query("DELETE FROM `character_effects` WHERE `guid` = ?d and `effect_id` = ?d", $guid ,$effect);
|
||||
$this->setChar('char_stats', $new_sql, $guid);
|
||||
}
|
||||
/*Бонусные эффекты от статов*/
|
||||
function statsBonus ($stat)
|
||||
{
|
||||
$stat_value = $this->getChar('char_stats', $stat);
|
||||
|
||||
if ($stat_value < 25)
|
||||
return;
|
||||
|
||||
if ($stat_value >= 25 && $stat_value < 50) $power = 1;
|
||||
else if ($stat_value >= 50 && $stat_value < 75) $power = 2;
|
||||
else if ($stat_value >= 75 && $stat_value < 100) $power = 3;
|
||||
else if ($stat_value >= 100 && $stat_value < 125) $power = 4;
|
||||
else if ($stat_value >= 125 && $stat_value < 150) $power = 5;
|
||||
else if ($stat_value >= 150) $power = 6;
|
||||
|
||||
$entry = $this->db->selectCell("SELECT `id` FROM `player_effects` WHERE `set` = ?s and `power` = ?d", $stat ,$power);
|
||||
$this->workEffect($entry, 1);
|
||||
}
|
||||
/*Добавление/Удаление травмы*/
|
||||
function workTravm ($travm, $type = 1, $guid = 0)
|
||||
{
|
||||
$guid = $this->getGuid($guid);
|
||||
|
||||
if (checki($travm))
|
||||
return;
|
||||
|
||||
$char_trm = $this->db->selectCell("SELECT `guid` FROM `character_travms` WHERE `travm_id` = ?d and `guid` = ?d", $travm ,$guid);
|
||||
|
||||
if (($type == -1 && !$char_trm) || ($type == 1 && $char_trm))
|
||||
return;
|
||||
|
||||
if ($type == 1)
|
||||
$t_info = $this->db->selectRow("SELECT * FROM `player_travms` WHERE `id` = ?d", $travm);
|
||||
else
|
||||
$t_info = $this->db->selectRow("SELECT *
|
||||
FROM `character_travms` AS `c`
|
||||
LEFT JOIN `player_travms` AS `i`
|
||||
ON `c`.`travm_id` = `i`.`id`
|
||||
WHERE `c`.`guid` = ?d
|
||||
and `c`.`travm_id` = ?d", $guid ,$travm);
|
||||
|
||||
$level = $this->getChar('char_db', 'level', $guid);
|
||||
$char_stats = $this->getChar('char_stats', '*', $guid);
|
||||
|
||||
$stats = array('str' => 0, 'dex' => 0, 'con' => 0);
|
||||
$new_sql = array();
|
||||
|
||||
if ($type == 1)
|
||||
{
|
||||
$t_info['stats'] = '';
|
||||
switch ($t_info['type'])
|
||||
{
|
||||
case 0:
|
||||
if ($t_info['id'] == 100)
|
||||
$t_info['stats'] = "mf_sting=50,mf_slash=50,mf_crush=50,mf_sharp=50,mf_fire=50,mf_water=50,mf_air=50,mf_earth=50,mf_light=50,mf_gray=50,mf_dark=50";
|
||||
break;
|
||||
case 1:
|
||||
if ($this->db->selectRow("SELECT * FROM `character_travms` AS `c` LEFT JOIN `player_travms` AS `i` ON `c`.`travm_id` = `i`.`id` WHERE `c`.`guid` = ?d and `i`.`type` = '1';", $guid))
|
||||
return;
|
||||
|
||||
$shuffle = shuffle_arr($stats);
|
||||
foreach ($shuffle as $key => $value)
|
||||
{
|
||||
$stats[$key] = $char_stats[$key];
|
||||
$minus = ($t_info['power'] == 1) ?$level*$t_info['power'] :$level*($t_info['power'] + 2);
|
||||
if ($char_stats[$key] > $minus)
|
||||
{
|
||||
$t_info['stats'] = "$key=$minus";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$t_info['stats'])
|
||||
{
|
||||
arsort($stats);
|
||||
foreach ($stats as $key => $value)
|
||||
{
|
||||
$minus = $char_stats[$key]-1;
|
||||
$t_info['stats'] = "$key=$minus";
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if ($this->db->selectRow("SELECT * FROM `character_travms` AS `c` LEFT JOIN `player_travms` AS `i` ON `c`.`travm_id` = `i`.`id` WHERE `c`.`guid` = ?d and `i`.`type` = '2';", $guid))
|
||||
return;
|
||||
|
||||
$minus = 25*$t_info['power'];
|
||||
$t_info['stats'] = "mp_regen=$minus";
|
||||
break;
|
||||
}
|
||||
$stats = array('str' => 0, 'dex' => 0, 'con' => 0);
|
||||
}
|
||||
|
||||
if ($t_info['stats'])
|
||||
{
|
||||
$modifiers = split(",", $t_info['stats']);
|
||||
foreach ($modifiers as $modifier)
|
||||
{
|
||||
$stat = split("=", $modifier);
|
||||
|
||||
if (array_key_exists($stat[0], $stats))
|
||||
$stats[$stat[0]] = -$stat[1]*$type;
|
||||
else
|
||||
$new_sql[$stat[0]] = -$stat[1]*$type + $char_stats[$stat[0]];
|
||||
}
|
||||
$this->changeStats($stats, $guid);
|
||||
if ($new_sql)
|
||||
$this->setChar('char_stats', $new_sql, $guid);
|
||||
}
|
||||
|
||||
if ($type == 1)
|
||||
{
|
||||
$time = ($t_info['dur_max'] == 0) ?0 :time() + rand($t_info['dur_min'], $t_info['dur_max']);
|
||||
$this->db->query("INSERT INTO `character_travms` (`guid`, `travm_id`, `stats`, `end_time`)
|
||||
VALUES (?d, ?d, ?s, ?d)", $guid ,$travm ,$t_info['stats'] ,$time);
|
||||
}
|
||||
else if ($type == -1)
|
||||
$this->db->query("DELETE FROM `character_travms` WHERE `guid` = ?d and `travm_id` = ?d", $guid ,$travm);
|
||||
}
|
||||
/*Показ строки персонажа*/
|
||||
function getLogin ($type = 'clan', $guid = 0)
|
||||
{
|
||||
$guid = $this->getGuid($guid);
|
||||
$char_db = $this->getChar('char_db', 'login', 'level', 'orden', 'clan', 'clan_short', 'block', 'rang', 'chat_shut', 'afk', 'dnd', 'message', $guid);
|
||||
list($login, $level, $orden, $clan_f, $clan_s, $block, $rang, $chat_shut, $afk, $dnd, $message) = array_values($char_db);
|
||||
$travm = $this->db->select("SELECT `c`.`travm_id` FROM `character_travms` AS `c` LEFT JOIN `player_travms` AS `i` ON `c`.`travm_id` = `i`.`id` WHERE `c`.`guid` = ?d and (`i`.`type` = '1' or `i`.`type` = '2');", $guid);
|
||||
switch ($orden)
|
||||
{
|
||||
case 1: $orden_img = "<img src='../img/orden/pal/$rang.gif' width='12' height='15' border='0' title='Белое братство'>"; break;
|
||||
case 2: $orden_img = "<img src='../img/orden/arm/$rang.gif' width='12' height='15' border='0' title='Темное братство'>"; break;
|
||||
case 3: $orden_img = "<img src='../img/orden/3.gif' width='12' height='15' border='0' title='Нейтральное братство'>"; break;
|
||||
case 4: $orden_img = "<img src='../img/orden/4.gif' width='12' height='15' border='0' title='Алхимик'>"; break;
|
||||
case 5: $orden_img = "<img src='../img/orden/5.gif' width='12' height='15' border='0' title='Хаос'>"; break;
|
||||
default: $orden_img = ""; break;
|
||||
}
|
||||
$clan = ($clan_s != '') ?"<img src='../img/clan/$clan_s.gif' border='0' title='$clan_f'>" :"";
|
||||
$login_link = str_replace(" ", "%20", $login);
|
||||
$login_info = "<a href='../info.php?log=$login_link' target='_blank'><img src='../img/inf.gif' border='0' title='Инф. о $login'></a>";
|
||||
$mol = ($chat_shut) ?" <img src='../img/sleep2.gif' title='Наложено заклятие молчания'>" :" ";
|
||||
$travm = ($travm) ?"<img src='../img/travma.gif' title='Инвалидность'>" :" ";
|
||||
$banned = ($block) ?"<font color='red'><b>- Забанен</b></font>" :"";
|
||||
$afk = ($afk) ?"<font title='$message'><b>afk</b></font> " :(($dnd && $message) ?"<font title='$message'><b>dnd</b></font> " :'');
|
||||
switch ($type)
|
||||
{
|
||||
case 'online': return " <a href=javascript:top.AddToPrivate('$login_link',true);><img border='0' src='../img/lock.gif' title='Приват'></a> $afk$orden_img$clan<a href=javascript:top.AddTo('$login_link'); class='nick'><b>$login</b></a>[$level]$login_info$mol$travm<br>";
|
||||
case 'mults': return "$orden_img$clan<b>$login</b> [$level]$login_info $banned <br>";
|
||||
case 'clan': return "$orden_img$clan<b>$login</b> [$level]$login_info";
|
||||
case 'turn': return $orden_img;
|
||||
case 'name': return $login;
|
||||
case 'news': return "$orden_img$clan<font class='header'>$login</font> [$level]$login_info";
|
||||
case 'mail': return "<font color='red'>$login</font> $login_info";
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
/*Распознает наличие гайда*/
|
||||
function getGuid ($guid)
|
||||
{
|
||||
return (!$guid) ?$this->guid :$guid;
|
||||
}
|
||||
}
|
||||
?>
|
71
engline/functions/class_Chat.php
Normal file
71
engline/functions/class_Chat.php
Normal file
@ -0,0 +1,71 @@
|
||||
<?
|
||||
defined('AntiBK') or die("Доступ запрещен!");
|
||||
|
||||
class Chat extends Char
|
||||
{
|
||||
public $db;
|
||||
public $char;
|
||||
function Init ($object)
|
||||
{
|
||||
$this->db = $object->db;
|
||||
$this->char = $object;
|
||||
}
|
||||
/*Отправка сообщения в чат*/
|
||||
function say ($to, $text, $sender = '')
|
||||
{
|
||||
$char_db = $this->getChar('char_db', 'login', 'room', 'city', $to);
|
||||
|
||||
if ($sender == '')
|
||||
$class = "sys";
|
||||
else
|
||||
{
|
||||
$class = "private";
|
||||
$text = "private [$char_db[login]] $text</font>";
|
||||
}
|
||||
|
||||
$this->db->query("INSERT INTO `city_chat` (`sender`, `to`, `room`, `msg`, `class`, `date_stamp`, `city`)
|
||||
VALUES (?s, ?s, ?s, ?s, ?s, ?d, ?s)", $sender ,$char_db['login'] ,$char_db['room'] ,$text ,$class ,time() ,$char_db['city']);
|
||||
echoScript("try {top.msg.updateMessages();} catch(e) {}");
|
||||
}
|
||||
/*Выполнение комманд в чате*/
|
||||
function executeCommand ($name, $message)
|
||||
{
|
||||
$char_db = $this->getChar('char_db', 'afk', 'login', 'room', 'city', $this->guid);
|
||||
switch ($name)
|
||||
{
|
||||
case '/afk':
|
||||
$message = str_replace('/afk', '', $message);
|
||||
|
||||
if (isset($message[0]) && $message[0] != ' ')
|
||||
return false;
|
||||
|
||||
$message = (isset($message[1])) ?preg_replace("/ /", "", $message, 1) :'away from keyboard';
|
||||
$this->setChar('char_db', array('afk' => 1, 'dnd' => 0, 'message' => $message));
|
||||
return true;
|
||||
break;
|
||||
case '/dnd':
|
||||
$message = str_replace('/dnd', '', $message);
|
||||
|
||||
if ($message == '' || (isset($message[0]) && $message[0] != ' ') || !isset($message[1]))
|
||||
return false;
|
||||
|
||||
$this->setChar('char_db', array('afk' => 0, 'dnd' => 1, 'message' => $message));
|
||||
return true;
|
||||
break;
|
||||
case '/e':
|
||||
$emotion = str_replace('/e', '', $message);
|
||||
|
||||
if ($emotion == '' || (isset($emotion[0]) && $emotion[0] != ' ') || !isset($emotion[1]))
|
||||
return false;
|
||||
|
||||
$this->db->query("INSERT INTO `city_chat` (`sender`, `to`, `room`, `msg`, `class`, `date_stamp`, `city`)
|
||||
VALUES (?s, ?s, ?s, ?s, ?s, ?d, ?s)", $char_db['login'] ,'' ,$char_db['room'] ,$emotion ,'emotion' ,time() ,$char_db['city']);
|
||||
return true;
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
135
engline/functions/class_City.php
Normal file
135
engline/functions/class_City.php
Normal file
@ -0,0 +1,135 @@
|
||||
<?
|
||||
defined('AntiBK') or die("Доступ запрещен!");
|
||||
|
||||
class City extends Char
|
||||
{
|
||||
public $guid;
|
||||
public $db;
|
||||
public $char;
|
||||
function Init ($object)
|
||||
{
|
||||
$this->guid = $object->guid;
|
||||
$this->db = $object->db;
|
||||
$this->char = $object;
|
||||
}
|
||||
/*Получение информации о городе*/
|
||||
function getCity ()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$args_num = func_num_args();
|
||||
$city = $args[0];
|
||||
unset($args[0]);
|
||||
|
||||
if ($args_num == 2)
|
||||
return $this->db->selectCell("SELECT ?# FROM `server_cities` WHERE `city` = ?s", $args ,$city);
|
||||
else
|
||||
return $this->db->selectRow("SELECT ?# FROM `server_cities` WHERE `city` = ?s", $args ,$city);
|
||||
}
|
||||
/*Получение информации о комнате*/
|
||||
function getRoom ()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$args_num = func_num_args();
|
||||
$room = $args[0];
|
||||
$city = $this->getCity($args[1], 'flag');
|
||||
unset($args[0], $args[1]);
|
||||
|
||||
if ($args_num == 3)
|
||||
return $this->db->selectCell("SELECT ?# FROM `city_rooms` WHERE `room` = ?s and `city` & ?d", $args ,$room ,$city);
|
||||
else
|
||||
return $this->db->selectRow("SELECT ?# FROM `city_rooms` WHERE `room` = ?s and `city` & ?d", $args ,$room ,$city);
|
||||
}
|
||||
/*Получение времени до возможности перехода*/
|
||||
function getRoomGoTime ()
|
||||
{
|
||||
$char_db = $this->getChar('char_db', 'last_go', 'room', 'city');
|
||||
$time = $this->getRoom($char_db['room'], $char_db['city'], 'time');
|
||||
|
||||
if (!$time || !$char_db['room'])
|
||||
return 0;
|
||||
|
||||
$time_to_go = $time - (time() - $char_db['last_go']);
|
||||
|
||||
return ($time_to_go >= 0) ?$time_to_go :0;
|
||||
}
|
||||
/*Получение кол-ва человек в комнате*/
|
||||
function getRoomOnline ($room, $type = 'full')
|
||||
{
|
||||
$city = $this->getChar('char_db', 'city');
|
||||
$online = $this->db->selectCell("SELECT COUNT(*) FROM `online` WHERE `room` = ?s", $room);
|
||||
$room_info = $this->getRoom($room, $city, 'name', 'time');
|
||||
|
||||
if (!$room_info) return "Bug";
|
||||
switch ($type)
|
||||
{
|
||||
case 'full': return "<strong>$room_info[name]</strong><br>Сейчас в комнате: $online";
|
||||
case 'map': return $online;
|
||||
case 'mini': return "Время перехода: $room_info[time] сек.<br>Сейчас в комнате: $online";
|
||||
default: return "Bug";
|
||||
}
|
||||
}
|
||||
/*Информация по комнате на карте*/
|
||||
function showRoomOnMap ($id)
|
||||
{
|
||||
$char_db = $this->getChar('char_db', 'room', 'city');
|
||||
$name = $this->getRoom($id, $char_db['city'], 'name');
|
||||
$flag = ($char_db['room'] == $id) ?"<img src='../img/icon/flag2.gif' width='20' height='20' alt='Вы находитесь здесь' align='right'>" :'';
|
||||
echo $flag."<strong>$name</strong> (<strong>".$this->getRoomOnline($id, 'map')."</strong>)";
|
||||
}
|
||||
/*Добавление кнопок в клубе*/
|
||||
function addButtons ($loc = 'club')
|
||||
{
|
||||
$lang = $this->getLang();
|
||||
$char_db = $this->getChar('char_db', 'room', 'city', 'last_return', 'return_time');
|
||||
$return_status = ((time() - $char_db['last_return']) >= $char_db['return_time']) | false;
|
||||
$format = ($loc == 'club') ?'<input type="button" class="btn2" value="%1$s" %2$s /> ' :'<span class="buttons_on_image" %2$s>%1$s</span> ';
|
||||
$arr = $this->getRoom($char_db['room'], $char_db['city'], 'buttons');
|
||||
$buttons = explode (',', $arr);
|
||||
foreach ($buttons as $button)
|
||||
{
|
||||
switch ($button)
|
||||
{
|
||||
default: $values = "";
|
||||
break;
|
||||
case 'fights': $values = array($lang['fights'], "id='link' link='zayavka' style='font-weight: bold; width: 102px;'");
|
||||
break;
|
||||
case 'return': $values = ($return_status) ?array($lang['return_b'], "id='link' link='return' style='font-weight: bold; width: 102px;'") :"";
|
||||
break;
|
||||
case 'map': $values = array($lang['map'], "id='link' link='map' style='font-weight: bold; width: 102px;'");
|
||||
break;
|
||||
case 'forum': $values = array($lang['forum'], "id='forum'");
|
||||
break;
|
||||
case 'hint': $values = array($lang['hint'], "id='hint' link='top' style='width: 102px;'");
|
||||
break;
|
||||
}
|
||||
if (is_array($values))
|
||||
vprintf($format, $values);
|
||||
}
|
||||
}
|
||||
/*Получение подсказки комнаты*/
|
||||
function getDescription ($room, $city)
|
||||
{
|
||||
$char_db = $this->getChar('char_db', 'login', 'room', 'city', 'level', 'exp');
|
||||
$descs = $this->getRoom($char_db['room'], $char_db['city'], 'desc1', 'desc2', 'desc3');
|
||||
$needs = $this->getRoom($char_db['room'], $char_db['city'], 'desc1_need', 'desc2_need', 'desc3_need');
|
||||
|
||||
foreach ($needs as $key => $need)
|
||||
{
|
||||
if (!$need)
|
||||
continue;
|
||||
|
||||
$need = split('\=', $need);
|
||||
|
||||
if ($char_db[$need[0]] >= $need[1])
|
||||
{
|
||||
$desc_num = utf8_substr($key, 0, -5);
|
||||
return $descs[$desc_num];
|
||||
}
|
||||
}
|
||||
if ($room == 'novice')
|
||||
return sprintf($descs['desc3'], $char_db['login']);
|
||||
else
|
||||
return $descs['desc3'];
|
||||
}
|
||||
}
|
||||
?>
|
985
engline/functions/class_Equip.php
Normal file
985
engline/functions/class_Equip.php
Normal file
@ -0,0 +1,985 @@
|
||||
<?
|
||||
defined('AntiBK') or die("Доступ запрещен!");
|
||||
|
||||
class Equip extends Char
|
||||
{
|
||||
public $guid;
|
||||
public $db;
|
||||
public $char;
|
||||
function Init ($object)
|
||||
{
|
||||
$this->guid = $object->guid;
|
||||
$this->db = $object->db;
|
||||
$this->char = $object;
|
||||
}
|
||||
/*Вычисление цены продажи предмета*/
|
||||
function getSellValue ($i_info, $text = false)
|
||||
{
|
||||
if (!$i_info)
|
||||
return 0;
|
||||
|
||||
$price = ($i_info['price_euro'] > 0) ?$i_info['price_euro'] :$i_info['price'];
|
||||
$tmax_diff = ($i_info['tear_max'] < $i_info['tear']) ?$price * 0.7 * (1 - $i_info['tear_max'] / $i_info['tear']) :0;
|
||||
$price_diff = $price * 0.7 - $tmax_diff;
|
||||
$tear_diff = ($i_info['tear_cur'] > 0) ?$price_diff * ($i_info['tear_cur'] / $i_info['tear_max']) :0;
|
||||
$sell_price = $price * 0.75 - $tmax_diff - $tear_diff;
|
||||
$sell_price = rdf($sell_price);
|
||||
|
||||
if ($sell_price < 0.01)
|
||||
$sell_price = 0.01;
|
||||
|
||||
$sell_price = ($text) ?$sell_price." кр." :$sell_price;
|
||||
return $sell_price;
|
||||
}
|
||||
/*Проверка характеристик предмета и персонажа*/
|
||||
function checkItemStats ($item_id)
|
||||
{
|
||||
if (checki($item_id))
|
||||
return false;
|
||||
|
||||
$dat = $this->db->selectRow("SELECT `i`.`min_level`,
|
||||
`i`.`sex`, `i`.`orden`,
|
||||
`i`.`min_str`, `i`.`min_dex`,
|
||||
`i`.`min_con`, `i`.`min_vit`,
|
||||
`i`.`min_int`, `i`.`min_wis`,
|
||||
`i`.`min_mp_all`,
|
||||
`i`.`min_sword`, `i`.`min_axe`,
|
||||
`i`.`min_fail`, `i`.`min_knife`,
|
||||
`i`.`min_staff`,
|
||||
`i`.`min_fire`, `i`.`min_water`,
|
||||
`i`.`min_air`, `i`.`min_earth`,
|
||||
`i`.`min_light`, `i`.`min_gray`,
|
||||
`i`.`min_dark`,
|
||||
`c`.`is_personal`, `c`.`personal_owner`,
|
||||
`c`.`tear_cur`, `c`.`tear_max`
|
||||
FROM `character_inventory` AS `c`
|
||||
LEFT JOIN `item_template` AS `i`
|
||||
ON `c`.`item_entry` = `i`.`entry`
|
||||
WHERE `c`.`guid` = ?d
|
||||
and `c`.`id` = ?d", $this->guid ,$item_id);
|
||||
$char_db = $this->getChar('char_db', 'level', 'sex', 'orden');
|
||||
$char_stats = $this->getChar('char_stats', 'str', 'dex', 'con', 'vit', 'int', 'wis', 'mp_all', 'sword', 'axe', 'fail', 'knife', 'staff', 'fire', 'water', 'air', 'earth', 'light', 'gray', 'dark');
|
||||
$char_feat = array_merge($char_db, $char_stats);
|
||||
foreach ($char_feat as $key => $value)
|
||||
{
|
||||
if ($key != 'sex' && $key != 'orden' && $value < $dat['min_'.$key]) return false;
|
||||
if ($key == 'sex' && $dat['sex'] != '' && $value != $dat['sex']) return false;
|
||||
if ($key == 'orden' && $dat['orden'] != 0 && $value != $dat['orden']) return false;
|
||||
}
|
||||
|
||||
if ($dat['is_personal'] && $dat['personal_owner'] != $this->guid)
|
||||
return false;
|
||||
|
||||
if ($dat['tear_cur'] >= $dat['tear_max'])
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
/*Проверка годности предмета*/
|
||||
function checkItemValidity ($item_id)
|
||||
{
|
||||
if (checki($item_id))
|
||||
return false;
|
||||
|
||||
$date = $this->db->selectCell("SELECT `date` FROM `character_inventory` WHERE `guid` = ?d and `id` = ?d", $this->guid ,$item_id);
|
||||
|
||||
if ($date != 0 && $date < time())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
/*Проверка отображения модификаторов*/
|
||||
function checkHandStatus ($hand)
|
||||
{
|
||||
$char_equip = $this->getChar('char_equip', 'hand_l_free', 'hand_r_free', 'hand_l_type', 'hand_l', 'hand_r');
|
||||
switch ($hand)
|
||||
{
|
||||
case 'r':
|
||||
if ($char_equip['hand_r'] != 0 || ($char_equip['hand_l_free'] == 1 & $char_equip['hand_r_free'] == 1) || $char_equip['hand_l_type'] == 'shield')
|
||||
return true;
|
||||
case 'l':
|
||||
if ($char_equip['hand_l'] != 0 && $char_equip['hand_l_type'] != 'shield')
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/*Отображение снаряжения*/
|
||||
function showCharacter ($type = '', $guid = 0)
|
||||
{
|
||||
$guid = $this->getGuid($guid);
|
||||
$char_equip = $this->getChar('char_equip', '*', $guid);
|
||||
$char_db = $this->getChar('char_db', 'level', 'login', 'shape', $guid);
|
||||
$char_stats = $this->getChar('char_stats', 'str', 'dex', 'con', 'vit', 'int', 'wis', 'spi', 'hp', 'hp_all', 'hp_regen', 'mp', 'mp_all', 'mp_regen', $guid);
|
||||
$char_feat = array_merge($char_db, $char_stats);
|
||||
$lang = $this->getLang();
|
||||
$char_type = 'clan';
|
||||
switch ($type)
|
||||
{
|
||||
case 'inv':
|
||||
$char_feat['name'] = "alt='$char_feat[login] (Перейти в \"$lang[abilities]\")' id='link' link='skills'";
|
||||
break;
|
||||
case 'fight':
|
||||
global $behaviour;
|
||||
$char_feat['name'] = "alt='<b>$char_feat[login]</b>";
|
||||
foreach ($behaviour as $key => $min_level)
|
||||
$char_feat['name'] .= ($char_feat['level'] >= $min_level) ?"<br>$lang[$key] $char_feat[$key]" :"";
|
||||
$char_feat['name'] .= "'";
|
||||
break;
|
||||
default:
|
||||
$char_feat['name'] = "alt='$char_feat[login] (Перейти в \"Инвентарь\")' id='link' link='inv'";
|
||||
break;
|
||||
}
|
||||
$char_equip['armor'] = ($char_equip['cloak']) ?$char_equip['cloak'] :(($char_equip['armor']) ?$char_equip['armor'] :$char_equip['shirt']);
|
||||
$char_equip['hand_l_s'] = (!$char_equip['hand_l_free']) ?"hand_l" :"hand_l_f";
|
||||
|
||||
echo $this->getLogin($char_type, $guid);
|
||||
echo $this->getCharacterEquipped($char_equip, $char_feat, $type, $guid);
|
||||
if ($type != 'smart')
|
||||
echoScript("showHP($char_feat[hp], $char_feat[hp_all], $char_feat[hp_regen]);".
|
||||
"showMP($char_feat[mp], $char_feat[mp_all], $char_feat[mp_regen]);");
|
||||
}
|
||||
/*Получение одетых вещей*/
|
||||
function getCharacterEquipped ($char_equip, $char_feat, $type, $guid = 0)
|
||||
{
|
||||
if (!$char_equip || !$char_feat)
|
||||
return;
|
||||
|
||||
$guid = $this->getGuid($guid);
|
||||
$backup = ($type == 'smart') ?"<img src='../img/items/slot_bottom0.gif' border='0'>" :"<img src='../img/items/w20.gif' border='0' alt='Пустой правый карман'><img src='../img/items/w20.gif' border='0' alt='Пустой карман'><img src='../img/items/w20.gif' border='0' alt='Пустой левый карман'><br><img src='../img/items/w21.gif' border='0' alt='Смена оружия'><img src='../img/items/w21.gif' border='0' alt='Смена оружия'><img src='../img/items/w21.gif' border='0' alt='Смена оружия'>";
|
||||
$effects = $this->getEffects($type, $guid);
|
||||
$equipped = "<table border='0' width='227' class='posit' cellspacing='0' cellpadding='0'>"
|
||||
. "<tr bgColor='#dedede'>"
|
||||
. "<td width='60' align='left' valign='top'>"
|
||||
. $this->getItemEquiped($char_equip['helmet'], "helmet", $type, $guid)
|
||||
. $this->getItemEquiped($char_equip['bracer'], "bracer", $type, $guid)
|
||||
. $this->getItemEquiped($char_equip['hand_r'], "hand_r", $type, $guid)
|
||||
. $this->getItemEquiped($char_equip['armor'], "armor", $type, $guid)
|
||||
. $this->getItemEquiped($char_equip['belt'], "belt", $type, $guid)
|
||||
. "</td>"
|
||||
. "<td width='120' height='220' align='center' valign='middle'><table cellspacing='0' cellpadding='0'>"
|
||||
. "<tr height='20'><td style='font-size: 9px; position: relative;'>".(($type != 'smart') ?"<div id='HP'></div><div id='MP'></div>" :'')."</td></tr>"
|
||||
. "<tr height='220'><td><div style='position: relative; z-index: 1; width: 120px; height: 220px;'><img src='../img/chars/$char_feat[shape]' $char_feat[name]>$effects</div></td></tr>"
|
||||
. "<tr height='40'><td>$backup</td></tr>"
|
||||
. "</table></td>"
|
||||
. "<td width='60' align='right' valign='top'>"
|
||||
. $this->getItemEquiped($char_equip['earring'], "earring", $type, $guid)
|
||||
. $this->getItemEquiped($char_equip['amulet'], "amulet", $type, $guid)
|
||||
. $this->getItemEquiped($char_equip['ring1'], "ring", $type, $guid)
|
||||
. $this->getItemEquiped($char_equip['ring2'], "ring", $type, $guid)
|
||||
. $this->getItemEquiped($char_equip['ring3'], "ring", $type, $guid)
|
||||
. $this->getItemEquiped($char_equip['gloves'], "gloves", $type, $guid)
|
||||
. $this->getItemEquiped($char_equip['hand_l'], $char_equip['hand_l_s'], $type, $guid)
|
||||
. $this->getItemEquiped($char_equip['pants'], "pants", $type, $guid)
|
||||
. $this->getItemEquiped($char_equip['boots'], "boots", $type, $guid)
|
||||
. "</td></tr></table>";
|
||||
return $equipped;
|
||||
}
|
||||
/*Получение отображаемых эффектов*/
|
||||
function getEffects ($type, $guid = 0)
|
||||
{
|
||||
$guid = $this->getGuid($guid);
|
||||
$i = 1;
|
||||
$left = 0;
|
||||
$top = 0;
|
||||
$return = '';
|
||||
$lang = $this->getLang();
|
||||
$travms = $this->db->select("SELECT * FROM `character_travms` AS `c` LEFT JOIN `player_travms` AS `i` ON `c`.`travm_id` = `i`.`id` WHERE `c`.`guid` = ?d and `c`.`stats` != '';", $guid);
|
||||
foreach ($travms as $travm)
|
||||
{
|
||||
$name = (isset($lang['travm_p_'.$travm['power']])) ?$lang['travm_p_'.$travm['power']].' ('.$travm['name'].')' :$travm['name'];
|
||||
$stats = ($travm['type'] == 1) ?'<br>У персонажа '.lowercase($lang['travm_p_'.$travm['power']]).' - ослаблены характеристики.' :'';
|
||||
$modifiers = split(",", $travm['stats']);
|
||||
foreach ($modifiers as $modifier)
|
||||
{
|
||||
$stat = split("=", $modifier);
|
||||
$stats .= '<br>'.$lang[$stat[0]].' -'.$stat[1];
|
||||
}
|
||||
$end_time = 'Осталось: '.getFormatedTime($travm['end_time']);
|
||||
$img = ($travm['type'] == 0) ?'' :$travm['power'];
|
||||
$return .= "<img src='../img/icon/effects/eff_travma$img.gif' style='position: absolute; left: {$left}px; top: {$top}px; z-index: 100;' alt='<u><b>$name</b></u> (Эффект)<br>$end_time<br>$stats' width='36' height='23'>";
|
||||
$left += 36;
|
||||
|
||||
if ($i % 3 == 0)
|
||||
{
|
||||
$top += 23;
|
||||
$left = 0;
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
/*Получение изображения предмета, одетого на персонажа*/
|
||||
function getItemEquiped ($item_id, $i_type, $type, $guid = 0)
|
||||
{
|
||||
$lang = $this->getLang();
|
||||
$image = $this->db->selectRow("SELECT `width`, `height`, `default`, `low_level`, `level` FROM `server_images` WHERE `name` = ?s", 'item_'.$i_type);
|
||||
$default = "<img src='../img/items/$image[default]' width='$image[width]' height='$image[height]' border='0' alt='".$lang[$i_type.'_f']."'>";
|
||||
|
||||
if (!is_numeric($item_id))
|
||||
return $default;
|
||||
|
||||
$guid = $this->getGuid($guid);
|
||||
$level = $this->getChar('char_db', 'level', $guid);
|
||||
|
||||
if ($item_id == 0 && $level < $image['level'])
|
||||
return "<img src='../img/items/$image[low_level]' width='$image[width]' height='$image[height]' border='0' alt='".$lang[$i_type.'_l']."'>";
|
||||
else if ($item_id == 0)
|
||||
return $default;
|
||||
|
||||
$color = '';
|
||||
$img = $image['default'];
|
||||
$desc = $this->getItemAlt($item_id, $type, $color, $img, $guid);
|
||||
|
||||
if (!$desc)
|
||||
return $default;
|
||||
|
||||
$slot = $this->getItemSlot($item_id);
|
||||
$return_format = ($type == 'inv') ?"<a href='main.php?action=unwear_item&item_slot=$slot'>%s</a>" :"%s";
|
||||
return sprintf($return_format, "<img src='../img/items/$img' width='$image[width]' height='$image[height]' border='0' alt='$desc'$color>");
|
||||
}
|
||||
/*Получение всплывающей подсказки о предмете*/
|
||||
function getItemAlt ($item_id, $type, &$color = '', &$img = '', $guid = 0)
|
||||
{
|
||||
if (checki($item_id))
|
||||
return '';
|
||||
|
||||
$guid = $this->getGuid($guid);
|
||||
$lang = $this->getLang();
|
||||
$i_info = $this->db->selectRow("SELECT `c`.`tear_cur`, `c`.`tear_max`,
|
||||
`i`.`attack`, `i`.`brick`,
|
||||
`i`.`name`, `i`.`img`,
|
||||
`i`.`add_hp`, `i`.`add_mp`,
|
||||
`i`.`def_h`, `i`.`def_a`,
|
||||
`i`.`def_b`, `i`.`def_l`
|
||||
FROM `character_inventory` AS `c`
|
||||
LEFT JOIN `item_template` AS `i`
|
||||
ON `c`.`item_entry` = `i`.`entry`
|
||||
WHERE `c`.`guid` = ?d
|
||||
and `c`.`id` = ?d", $guid ,$item_id);
|
||||
if (!$i_info)
|
||||
return '';
|
||||
|
||||
$img = $i_info['img'];
|
||||
$tear_check = ($i_info['tear_cur'] >= $i_info['tear_max'] * 0.90);
|
||||
$tear_show = ($tear_check) ?'<font color=#990000>%s</font>' :'%s';
|
||||
$color = ($tear_check) ?" class='broken'" :'';
|
||||
$name = (($type == 'inv') ?"Снять " :'').$i_info['name'];
|
||||
$def = array('h', 'a', 'b', 'l');
|
||||
$desc = "$name";
|
||||
|
||||
if ($i_info['attack'] > 0)
|
||||
$desc .= "<br>$lang[damage] $i_info[attack] - ".($i_info['attack'] + $i_info['brick']);
|
||||
|
||||
if ($i_info['add_hp'] > 0) $desc .= "<br>$lang[add_hp] +".$i_info['add_hp'];
|
||||
else if ($i_info['add_hp'] < 0) $desc .= "<br>$lang[add_hp] ".$i_info['add_hp'];
|
||||
if ($i_info['add_mp'] > 0) $desc .= "<br>$lang[add_mp] +".$i_info['add_mp'];
|
||||
else if ($i_info['add_mp'] < 0) $desc .= "<br>$lang[add_mp] ".$i_info['add_mp'];
|
||||
|
||||
foreach ($def as $key)
|
||||
{
|
||||
if ($i_info['def_'.$key] > 0)
|
||||
$desc .= "<br>".$lang['def_'.$key]." ".$i_info['def_'.$key]."-".($i_info['def_'.$key] + $i_info['brick'])." ".$this->getFormatedBrick($i_info['def_'.$key], $i_info['brick']);
|
||||
}
|
||||
$desc .= "<br>$lang[durability] ".sprintf($tear_show, intval($i_info['tear_cur'])."/".intval($i_info['tear_max']));
|
||||
return $desc;
|
||||
}
|
||||
/*Перечисление предметов нуждающихся в ремонте*/
|
||||
function needItemRepair ()
|
||||
{
|
||||
$rows = $this->db->select("SELECT `c`.`tear_cur`, `c`.`tear_max`,
|
||||
`i`.`name`
|
||||
FROM `character_inventory` AS `c`
|
||||
LEFT JOIN `item_template` AS `i`
|
||||
ON `c`.`item_entry` = `i`.`entry`
|
||||
WHERE `c`.`guid` = ?d
|
||||
and `c`.`wear` = '1';", $this->guid);
|
||||
$return = '';
|
||||
foreach ($rows as $repair)
|
||||
{
|
||||
list ($tear_cur, $tear_max, $name) = array_values ($repair);
|
||||
|
||||
if ($tear_cur >= $tear_max * 0.90)
|
||||
$return .= " <b>$name</b> [<font color='#990000'>".intval($tear_cur)."/".intval($tear_max)."</font>] требуется ремонт<br>";
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
/*Добавление предмета*/
|
||||
function addItem ($item_entry, $type = 'buy', $guid = 0)
|
||||
{
|
||||
$guid = $this->getGuid($guid);
|
||||
|
||||
if (checki($item_entry))
|
||||
return false;
|
||||
|
||||
$i_info = $this->db->selectRow("SELECT `name`,
|
||||
`price`,
|
||||
`price_euro`,
|
||||
`mass`,
|
||||
`tear`,
|
||||
`inc_count`,
|
||||
`validity`
|
||||
FROM `item_template`
|
||||
WHERE `entry` = ?d", $item_entry);
|
||||
if (!$i_info)
|
||||
return false;
|
||||
|
||||
$time = ($i_info['validity'] > 0) ?time() + $i_info['validity'] * 3600 :0;
|
||||
$city = $this->getChar('char_db', 'city');
|
||||
$id = ($this->db->selectCell("SELECT MAX(`id`) FROM `character_inventory` WHERE `guid` = ?d", $guid)) + 1;
|
||||
$this->changeMass($i_info['mass']);
|
||||
$this->db->query("INSERT INTO `character_inventory` (`id`, `guid`, `item_entry`, `tear_max`, `inc_count_p`, `made_in`, `date`, `last_update`)
|
||||
VALUES (?d, ?d, ?d, ?f, ?d, ?s, ?d, ?d)", $id ,$guid ,$item_entry ,rdf($i_info['tear']) ,$i_info['inc_count'] ,$city ,$time ,time());
|
||||
if ($type == 'buy')
|
||||
{
|
||||
$room = $this->getChar('char_db', 'room');
|
||||
if ($i_info['price'] > 0)
|
||||
$this->char->history->Items('Buy', "$i_info[name] за $i_info[price] кр.", $room);
|
||||
else if ($i_info['price_euro'] > 0)
|
||||
$this->char->history->Items('Buy', "$i_info[name] за $i_info[price_euro] екр.", $room);
|
||||
}
|
||||
else if ($type == 'get')
|
||||
$this->char->history->Items('Get', $i_info['name'], '');
|
||||
return true;
|
||||
}
|
||||
/*Отображение предмета в инвентаре*/
|
||||
function showItem ($i_info, $mode, $i, $mail_guid = '')
|
||||
{
|
||||
$weapons = array('knife', 'fail', 'sword', 'axe', 'staff');
|
||||
$armors = array('boots' => '_l', 'light_armor' => '_a', 'heavy_armor' => '_a', 'helmet' => '_h', 'pants' => '_b');
|
||||
$types = array('inv', 'sell', 'mail_to', 'mail_in');
|
||||
$lang = $this->getLang();
|
||||
$char_db = $this->getChar('char_db', 'money', 'level', 'sex');
|
||||
$char_stats = $this->getChar('char_stats', 'str', 'dex', 'con', 'vit', 'int', 'wis', 'mp_all', 'sword', 'axe', 'fail', 'knife', 'staff', 'fire', 'water', 'air', 'earth');
|
||||
$char_feat = array_merge($char_db, $char_stats);
|
||||
|
||||
$money = $char_feat['money'];
|
||||
$entry = $i_info['entry'];
|
||||
$name = $i_info['name'];
|
||||
$img = $i_info['img'];
|
||||
$type = $i_info['type'];
|
||||
$mass = $i_info['mass'];
|
||||
$price = $i_info['price'];
|
||||
$price_euro = $i_info['price_euro'];
|
||||
|
||||
if ($price_euro > 0)
|
||||
$price_s = $price_euro." екр.";
|
||||
else if ($price > 0)
|
||||
$price_s = ($mode == 'shop') ?(compare($price, $money))." кр." :$price." кр.";
|
||||
|
||||
$item_flags = $i_info['item_flags'];
|
||||
$item_id = (isset($i_info['id'])) ?$i_info['id'] :0;
|
||||
$made_in = (isset($i_info['made_in'])) ?$this->char->city->getCity($i_info['made_in'], 'name') :'';
|
||||
$tear_cur = (isset($i_info['tear_cur'])) ?intval($i_info['tear_cur']) :0;
|
||||
$tear_max = (isset($i_info['tear_max'])) ?ceil($i_info['tear_max']) :$i_info['tear'];
|
||||
$color = ($tear_cur >= $tear_max * 0.9) ?" class='broken'" :"";
|
||||
$validity = (isset($i_info['date'])) ?$i_info['date'] :$i_info['validity'];
|
||||
$gift = (isset($i_info['gift'])) ?$i_info['gift'] :0;
|
||||
$gift_author = (isset($i_info['gift_author'])) ?$i_info['gift_author'] :'';
|
||||
$inc_count = (isset($i_info['inc_count_p'])) ?$i_info['inc_count_p'] :$i_info['inc_count'];
|
||||
$add['str'] = $i_info['add_str'] + ((isset($i_info['inc_str'])) ?$i_info['inc_str'] :0);
|
||||
$add['dex'] = $i_info['add_dex'] + ((isset($i_info['inc_dex'])) ?$i_info['inc_dex'] :0);
|
||||
$add['con'] = $i_info['add_con'] + ((isset($i_info['inc_con'])) ?$i_info['inc_con'] :0);
|
||||
$add['int'] = $i_info['add_int'] + ((isset($i_info['inc_int'])) ?$i_info['inc_int'] :0);
|
||||
$chet = ($i) ?"C7C7C7" :"D5D5D5";
|
||||
$return = "<div id='item_id_$item_id' name='item_entry_$entry'><table width='100%' border='0' cellspacing='1' cellpadding='0' bgColor='#a5a5a5' style='margin-top: -1px;'><tr bgColor='#$chet'>";
|
||||
switch ($mode)
|
||||
{
|
||||
case 'inv':
|
||||
$wearable = $this->checkItemStats($item_id);
|
||||
$return .= "<td width='150' align='center'>";
|
||||
$return .= "<img src='../img/items/$img' border='0'$color /><br><center style='padding-top: 4px;'>";
|
||||
$return .= ($wearable) ?"<a href='?action=wear_item&item_id=$item_id' class='nick'>надеть</a> " :"";
|
||||
$return .= "<a href=\"javascript:drop($item_id, '$img', '$name');\"><img src='../img/icon/clear.gif' width='14' height='14' border='0' alt='Выбросить предмет'></a>";
|
||||
break;
|
||||
case 'shop':
|
||||
$s_price = ($price_euro > 0) ?$price_euro :$price;
|
||||
$s_kr = ($price_euro > 0) ?"екр." :"кр.";
|
||||
$return .= "<td width='200' align='center'>";
|
||||
$return .= "<img src='../img/items/$img' border='0' /><br><center style='padding-top: 4px;'>";
|
||||
$return .= "<a href='javascript:buyItem($entry);' class='nick'>купить</a> <img src='../img/icon/plus.gif' width='11' height='11' border='0' alt='Купить несколько штук' style='cursor: pointer;' onclick=\"AddCount('$entry', '$name', '$s_price', '$s_kr');\"></center>";
|
||||
break;
|
||||
case 'sell':
|
||||
$s_price = $this->getSellValue($i_info, true);
|
||||
$return .= "<td width='260' align='center'>";
|
||||
$return .= "<img src='../img/items/$img' border='0'$color /><br><center style='padding-top: 4px;'>";
|
||||
$return .= "<a href='javascript:sellItem ($item_id);' onclick=\"if (confirm('Вы уверены что хотите продать предмет $name за $s_price?')){return true;} else {return false;}\" class='nick'>продать за $s_price</a>";
|
||||
break;
|
||||
case 'mail_to':
|
||||
$s_price = $this->char->mail->getPrice($item_id)." кр.";
|
||||
$return .= "<td width='260' align='center'>";
|
||||
$return .= "<img src='../img/items/$img' border='0'$color /><br><center style='padding-top: 4px;'>";
|
||||
$return .= "<a href='main.php?do=send_item&mail_to=$mail_guid&item_id=$item_id' onclick=\"if (confirm('Отправить предмет $name?')){return true;} else {return false;}\" class='nick'>передать за $s_price</a>";
|
||||
break;
|
||||
case 'mail_in':
|
||||
$return .= "<td width='260' align='center'>";
|
||||
$return .= "<img src='../img/items/$img' border='0'$color /><br><center style='padding-top: 4px;'>";
|
||||
$return .= "<a href='main.php?do=get_item&item_id=$item_id' onclick=\"if (confirm('Забрать предмет $name?')){return true;} else {return false;}\" class='nick'>Забрать</a><br><a href='main.php?do=return_item&item_id=$item_id' onclick=\"if (confirm('Отказаться от предмета $name?')){return true;} else {return false;}\" class='nick'>Отказаться</a>";
|
||||
$return .= "<br><small>(".getFormatedTime($i_info['delivery_time'] + 5184000).")</small>";
|
||||
break;
|
||||
case 'money_in':
|
||||
$name = sprintf($name, $i_info['count']);
|
||||
$price_s = "$i_info[count] кр.";
|
||||
$mail_id = $i_info['id'];
|
||||
$return .= "<td width='260' align='center'>";
|
||||
$return .= "<img src='../img/items/$img' border='0'$color /><br><center style='padding-top: 4px;'>";
|
||||
$return .= "<a href='main.php?do=get_money&mail_id=$mail_id' onclick=\"if (confirm('Забрать $price_s?')){return true;} else {return false;}\" class='nick'>Забрать</a><br><a href='main.php?do=return_money&mail_id=$mail_id' onclick=\"if (confirm ('Отказаться от $price?')){return true;} else {return false;}\" class='nick'>Отказаться</a>";
|
||||
$return .= "<br><small>(".getFormatedTime($i_info['delivery_time'] + 5184000).")</small>";
|
||||
break;
|
||||
}
|
||||
$return .= "</td><td align='left' valign='top' style='padding: 2px;'>";
|
||||
$tear_show = compare($tear_cur, $tear_max * 0.90, "$tear_cur/$tear_max");
|
||||
$required = array('dex', 'con', 'int', 'level', 'fire', 'water', 'air', 'earth', 'sword', 'axe', 'fail', 'knife', 'staff', 'vit', 'str', 'mp_all', 'wis', 'sex');
|
||||
$modifiers = array('mf_critp', 'mf_acrit', 'mf_adodge', 'mf_parmour', 'mf_crit', 'mf_parry', 'mf_shieldb', 'mf_dodge', 'mf_contr', 'rep_magic',
|
||||
'rep_fire', 'rep_water', 'rep_air', 'rep_earth', 'mf_magic', 'mf_fire', 'mf_water', 'mf_air', 'mf_earth', 'mf_light', 'mf_gray',
|
||||
'mf_dark', 'mf_dmg', 'mf_sting', 'mf_slash', 'mf_crush', 'mf_sharp', 'all_magic', 'fire', 'water', 'air', 'earth', 'light', 'gray',
|
||||
'dark', 'all_mastery', 'sword', 'axe', 'fail', 'knife', 'staff', 'res_magic', 'res_fire', 'res_water', 'res_air',
|
||||
'res_earth', 'res_light', 'res_gray', 'res_dark', 'res_dmg', 'res_sting', 'res_slash', 'res_crush', 'res_sharp',
|
||||
'add_hp', 'add_mp', 'mp_cons', 'mp_regen', 'hp_regen', 'add_hit_min', 'add_hit_max');
|
||||
$w_modifiers = array('mf_adodge', 'mf_crit', 'mf_critp', 'mf_sting', 'mf_slash', 'mf_crush', 'mf_sharp', 'sword', 'axe', 'fail', 'knife', 'mf_parmour');
|
||||
$chances = array('ch_sting', 'ch_slash', 'ch_crush', 'ch_sharp', 'ch_fire', 'ch_water', 'ch_air', 'ch_earth', 'ch_light', 'ch_dark');
|
||||
$features = array('res_dmg', 'res_sting', 'res_slash', 'res_crush', 'res_sharp');
|
||||
$brick = $i_info['brick'];
|
||||
$def = array(
|
||||
'h' => array($i_info['def_h'], ($i_info['def_h'] + $brick), $this->getFormatedBrick($i_info['def_h'], $brick)),
|
||||
'a' => array($i_info['def_a'], ($i_info['def_a'] + $brick), $this->getFormatedBrick($i_info['def_a'], $brick)),
|
||||
'b' => array($i_info['def_b'], ($i_info['def_b'] + $brick), $this->getFormatedBrick($i_info['def_b'], $brick)),
|
||||
'l' => array($i_info['def_l'], ($i_info['def_l'] + $brick), $this->getFormatedBrick($i_info['def_l'], $brick))
|
||||
);
|
||||
$attack = $i_info['attack'];
|
||||
$block = $i_info['block'];
|
||||
$hands = $i_info['hands'];
|
||||
$url = str_replace('.gif', '.html', $i_info['img']);
|
||||
$orden = " ";
|
||||
$need_orden = $i_info['orden'];
|
||||
if ($need_orden != 0)
|
||||
{
|
||||
switch ($need_orden)
|
||||
{
|
||||
case 1: $orden_dis = "Белое братство"; break;
|
||||
case 2: $orden_dis = "Темное братство"; break;
|
||||
case 3: $orden_dis = "Нейтральное братство"; break;
|
||||
case 4: $orden_dis = "Алхимик"; break;
|
||||
case 5: $orden_dis = "Тюремный заключенный"; break;
|
||||
}
|
||||
$orden = "<img src='../img/orden/align$need_orden.gif' border='0' alt='$lang[min_bent] <strong>$orden_dis</strong>'>";
|
||||
}
|
||||
$return .= "<a href='encicl/object/$url' class='nick' target='_blank'><b>$name</b></a> $orden ($lang[mass] $mass)";
|
||||
|
||||
if ($gift == 1)
|
||||
$return .= " <img src='../img/icon/gift.gif' width='14' height='14' border='0' alt='$lang[gift] $gift_author'>";
|
||||
|
||||
if ($item_flags & 4)
|
||||
$return .= " <img src='../img/icon/artefakt.gif' width='16' height='16' border='0' alt='$lang[artefact]'>";
|
||||
|
||||
if (isset($price_s))
|
||||
$return .= "<br><b>$lang[price] $price_s</b>";
|
||||
|
||||
$return .= "<br>$lang[durability] $tear_show";
|
||||
|
||||
if (($mode == 'inv' || $mode == 'sell') && $validity > 0)$return .= "<br>".sprintf($lang['validity'], date('d.m.y H:i', $validity), getFormatedTime($validity));
|
||||
else if ($mode == 'shop' && $validity > 0) $return .= "<br>$lang[val_life] ".getFormatedTime($validity * 3600 + time());
|
||||
|
||||
$val = "";
|
||||
$require = "";
|
||||
foreach ($required as $key)
|
||||
{
|
||||
if (($key != 'sex' && $i_info['min_'.$key] <= 0) || ($key == 'sex' && $i_info[$key] == ''))
|
||||
continue;
|
||||
|
||||
if (!$val)
|
||||
$val = "<br><b>$lang[required]</b>";
|
||||
|
||||
if ($key != 'sex' && $i_info['min_'.$key] > 0) $require .= "<br>• ".(compare($i_info['min_'.$key], $char_feat[$key], "$lang[$key] ".$i_info['min_'.$key]));
|
||||
else if ($key == 'sex' && $i_info[$key] != '') $require .= "<br>• ".(compare($i_info[$key], $char_feat[$key], "$lang[$key] ".$lang['sex_'.$i_info[$key]]));
|
||||
}
|
||||
$return .= $val.$require;
|
||||
|
||||
$val = "";
|
||||
if (($add['str'] != 0 || $add['dex'] != 0 || $add['con'] != 0 || $add['int'] != 0
|
||||
|| $i_info['def_h'] != 0 || $i_info['def_a'] != 0 || $i_info['def_b'] != 0 || $i_info['def_l'] != 0 || $inc_count > 0
|
||||
|| (!in_array($type, $weapons) && $attack != 0)))
|
||||
$val = "<br><b>$lang[act]</b>";
|
||||
|
||||
$inc = ($inc_count > 0) ?"<br>• $lang[inc_count] <span id='inc_count_$item_id'>$inc_count</span>" :"";
|
||||
$modifier = "";
|
||||
foreach ($modifiers as $key)
|
||||
{
|
||||
if ($i_info[$key] == 0)
|
||||
continue;
|
||||
|
||||
if (!$val)
|
||||
$val = "<br><b>$lang[act]</b>";
|
||||
|
||||
if ($i_info[$key] > 0) $modifier .= "<br>• $lang[$key] +".$i_info[$key];
|
||||
else if ($i_info[$key] < 0) $modifier .= "<br>• $lang[$key] ".$i_info[$key];
|
||||
}
|
||||
$return .= $val.$inc.$modifier;
|
||||
foreach ($add as $key => $value)
|
||||
{
|
||||
if ($value == 0 && $mode == 'inv' && $inc_count > 0) $return .= "<br>• $lang[$key] <span id='inc_{$item_id}_{$key}_val'>$value</span> ".$this->getIncButton($item_id, $key);
|
||||
else if ($value > 0 && $mode == 'inv' && $inc_count > 0)$return .= "<br>• $lang[$key] <span id='inc_{$item_id}_{$key}_val'>+$value</span> ".$this->getIncButton($item_id, $key);
|
||||
else if ($value > 0) $return .= "<br>• $lang[$key] +$value";
|
||||
else if ($value < 0) $return .= "<br>• $lang[$key] $value";
|
||||
}
|
||||
foreach ($def as $key => $value)
|
||||
{
|
||||
if ($value[0] > 0)
|
||||
$return .= "<br>• ".$lang['def_'.$key]." $value[0]-$value[1] $value[2]";
|
||||
}
|
||||
if (in_array($type, $weapons))
|
||||
{
|
||||
$return .= "<br><b>$lang[behaviour]</b>";
|
||||
$return .= "<br>• $lang[damage] $attack - ".($attack + $brick);
|
||||
foreach ($w_modifiers as $key)
|
||||
{
|
||||
if ($i_info[$key.'_h'] != 0)
|
||||
$return .= "<br>• $lang[$key] ".$i_info[$key.'_h'];
|
||||
}
|
||||
|
||||
if ($item_flags & 16) $return .= "<br>• $lang[sec_hand]";
|
||||
else if ($hands == 2) $return .= "<br>• $lang[two_hands]";
|
||||
|
||||
$return .= "<br>• $lang[blocks] ";
|
||||
|
||||
if ($block == 1) $return .= "+";
|
||||
else if ($block == 2) $return .= "++";
|
||||
else $return .= "-";
|
||||
|
||||
$val = "";
|
||||
$chance = "";
|
||||
foreach ($chances as $key)
|
||||
{
|
||||
if ($i_info[$key] <= 0)
|
||||
continue;
|
||||
|
||||
if (!$val)
|
||||
$val = "<br><b>$lang[features]</b>";
|
||||
|
||||
$this->getFormatedChance($i_info[$key]);
|
||||
$chance .= "<br>• $lang[$key] ".$lang[$i_info[$key]];
|
||||
}
|
||||
$return .= $val.$chance;
|
||||
}
|
||||
if (in_array($type, array_keys($armors)))
|
||||
{
|
||||
$val = "";
|
||||
$armor = "";
|
||||
foreach ($features as $key)
|
||||
{
|
||||
if ($i_info[$key.$armors[$type]] <= 0)
|
||||
continue;
|
||||
|
||||
if (!$val)
|
||||
$val = "<br><b>$lang[features]</b>";
|
||||
|
||||
$armor .= "<br>• $lang[$key] ".$i_info[$key.$armors[$type]];
|
||||
}
|
||||
$return .= $val.$armor;
|
||||
}
|
||||
if ($i_info['description'])
|
||||
$return .= "<br><small>$lang[description]<br>$i_info[description]</small>";
|
||||
|
||||
if ($made_in)
|
||||
$return .= "<br><small>$lang[made_in] $made_in</small>";
|
||||
|
||||
if (!($item_flags & 2))
|
||||
$return .= "<br><small><font color='brown'>$lang[no_repair]</font></small>";
|
||||
|
||||
$return .= "</td></tr></table></div>";
|
||||
return $return;
|
||||
}
|
||||
/*Получение отформатированного шанса*/
|
||||
private function getFormatedChance (&$chance)
|
||||
{
|
||||
if ($chance == 0) $chance = "never";
|
||||
if ($chance > 0 && $chance < 10) $chance = "ex_rarely";
|
||||
if ($chance >= 10 && $chance < 20) $chance = "rarely";
|
||||
if ($chance >= 20 && $chance < 26) $chance = "little";
|
||||
if ($chance >= 26 && $chance < 60) $chance = "naa";
|
||||
if ($chance >= 60 && $chance < 81) $chance = "regular";
|
||||
if ($chance >= 81 && $chance < 91) $chance = "often";
|
||||
if ($chance >= 91 && $chance <= 100) $chance = "always";
|
||||
}
|
||||
/*Получение отформатированного кубика*/
|
||||
private function getFormatedBrick ($min, $brick)
|
||||
{
|
||||
$first = $min - 1;
|
||||
$second = $brick + 1;
|
||||
if ($min == 1) return "(d$second)";
|
||||
if ($brick == 0) return '';
|
||||
if ($min <= 0) return '';
|
||||
return "($first+d$second)";
|
||||
}
|
||||
/*Получение кнопки прибавления характеристик вещи*/
|
||||
private function getIncButton ($item_id, $stat)
|
||||
{
|
||||
return "<input type='image' id='inc_{$item_id}_btn' src='img/icon/plus.gif' style='border: 0px; vertical-align: bottom;' onclick=\"increaseItemStat('$item_id', '$stat'); this.blur();\">";
|
||||
}
|
||||
/*Одеть/Снять предмет*/
|
||||
function equipItem ($item, $type = 1, $guid = 0)
|
||||
{
|
||||
$guid = $this->getGuid($guid);
|
||||
$item_id = ($type == 1) ?$item :$this->getChar('char_equip', $item, $guid);
|
||||
|
||||
if (checki($item_id))
|
||||
return;
|
||||
|
||||
$error_id = ($type == 1) ?213 :214;
|
||||
$wear_status = ($type == 1) ?0 :1;
|
||||
$char_equip = $this->getChar('char_equip', '*', $guid);
|
||||
$i_info = $this->db->selectRow("SELECT *
|
||||
FROM `character_inventory` AS `c`
|
||||
LEFT JOIN `item_template` AS `i`
|
||||
ON `c`.`item_entry` = `i`.`entry`
|
||||
WHERE `c`.`guid` = ?d
|
||||
and `c`.`id` = ?d
|
||||
and `c`.`wear` = ?d
|
||||
and `c`.`mailed` = '0'
|
||||
and `i`.`section` = 'item';", $guid ,$item_id ,$wear_status) or $this->char->error->Inventory($error_id);
|
||||
$i_entry = $i_info['entry'];
|
||||
$i_id = $i_info['id'];
|
||||
$i_type = ($i_info['type'] == 'heavy_armor' || $i_info['type'] == 'light_armor') ?"armor" :$i_info['type'];
|
||||
$i_hands = $i_info['hands'];
|
||||
|
||||
if ($type == 1)
|
||||
{
|
||||
switch ($i_type)
|
||||
{
|
||||
case 'sword':
|
||||
case 'axe':
|
||||
case 'fail':
|
||||
case 'staff':
|
||||
case 'knife':
|
||||
if ($i_hands == 1)
|
||||
{
|
||||
$slot = "hand_r";
|
||||
|
||||
if (!$char_equip['hand_r_free'] && $char_equip['hand_l_free'])
|
||||
{
|
||||
if ($i_info['item_flags'] & 16)
|
||||
$slot = "hand_l";
|
||||
else
|
||||
$this->equipItem('hand_r', -1, $guid);
|
||||
}
|
||||
else if (!$char_equip['hand_r_free'] && !$char_equip['hand_l_free'])
|
||||
$this->equipItem('hand_r', -1, $guid);
|
||||
}
|
||||
else if ($i_hands == 2)
|
||||
{
|
||||
$slot = "hand_r";
|
||||
|
||||
if (!$char_equip['hand_r_free'])
|
||||
$this->equipItem('hand_r', -1, $guid);
|
||||
|
||||
if (!$char_equip['hand_l_free'])
|
||||
$this->equipItem('hand_l', -1, $guid);
|
||||
}
|
||||
$w_type = $i_type;
|
||||
break;
|
||||
case 'shield':
|
||||
$slot = "hand_l";
|
||||
|
||||
if ($char_equip['hand_l'])
|
||||
$this->equipItem('hand_l', -1, $guid);
|
||||
|
||||
if ($char_equip['hand_r'] && !$char_equip['hand_l_free'])
|
||||
$this->equipItem('hand_r', -1, $guid);
|
||||
|
||||
$w_type = $i_type;
|
||||
break;
|
||||
case 'ring':
|
||||
$slot = "ring1";
|
||||
|
||||
if (!$char_equip['ring1'])
|
||||
$slot = "ring1";
|
||||
else if (!$char_equip['ring2'])
|
||||
$slot = "ring2";
|
||||
else if (!$char_equip['ring3'])
|
||||
$slot = "ring3";
|
||||
else
|
||||
$this->equipItem('ring1', -1, $guid);
|
||||
break;
|
||||
default:
|
||||
$slot = $i_type;
|
||||
|
||||
if ($char_equip[$i_type])
|
||||
$this->equipItem($i_type, -1, $guid);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if ($type == -1)
|
||||
{
|
||||
unset($char_equip['guid'], $char_equip['hand_r_free'], $char_equip['hand_r_type'], $char_equip['hand_l_free'], $char_equip['hand_l_type']);
|
||||
foreach ($char_equip as $key => $value)
|
||||
{
|
||||
if ($i_id == $value)
|
||||
{
|
||||
$slot = $key;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$char_stats = $this->getChar('char_stats', '*', $guid);
|
||||
|
||||
$new_sql = array();
|
||||
$ress = array('', '_h', '_a', '_b', '_l');
|
||||
$defs = array('h', 'a', 'b', 'l');
|
||||
// Resist damage
|
||||
foreach ($ress as $key)
|
||||
{
|
||||
$new_sql['res_sting'.$key] = $i_info['res_sting'.$key] + $i_info['res_dmg'.$key];
|
||||
$new_sql['res_slash'.$key] = $i_info['res_slash'.$key] + $i_info['res_dmg'.$key];
|
||||
$new_sql['res_crush'.$key] = $i_info['res_crush'.$key] + $i_info['res_dmg'.$key];
|
||||
$new_sql['res_sharp'.$key] = $i_info['res_sharp'.$key] + $i_info['res_dmg'.$key];
|
||||
}
|
||||
// -- magic
|
||||
$new_sql['res_fire'] = $i_info['res_fire'] + $i_info['res_magic'];
|
||||
$new_sql['res_water'] = $i_info['res_water'] + $i_info['res_magic'];
|
||||
$new_sql['res_air'] = $i_info['res_air'] + $i_info['res_magic'];
|
||||
$new_sql['res_earth'] = $i_info['res_earth'] + $i_info['res_magic'];
|
||||
$new_sql['res_light'] = $i_info['res_light'] + $i_info['res_magic'];
|
||||
$new_sql['res_gray'] = $i_info['res_gray'] + $i_info['res_magic'];
|
||||
$new_sql['res_dark'] = $i_info['res_dark'] + $i_info['res_magic'];
|
||||
// Mastery
|
||||
$new_sql['sword'] = $i_info['sword'] + $i_info['all_mastery'];
|
||||
$new_sql['bow'] = $i_info['bow'] + $i_info['all_mastery'];
|
||||
$new_sql['crossbow'] = $i_info['crossbow'] + $i_info['all_mastery'];
|
||||
$new_sql['axe'] = $i_info['axe'] + $i_info['all_mastery'];
|
||||
$new_sql['fail'] = $i_info['fail'] + $i_info['all_mastery'];
|
||||
$new_sql['knife'] = $i_info['knife'] + $i_info['all_mastery'];
|
||||
// --
|
||||
$new_sql['staff'] = $i_info['staff'];
|
||||
// -- magic
|
||||
$new_sql['fire'] = $i_info['fire'] + $i_info['all_magic'];
|
||||
$new_sql['water'] = $i_info['water'] + $i_info['all_magic'];
|
||||
$new_sql['air'] = $i_info['air'] + $i_info['all_magic'];
|
||||
$new_sql['earth'] = $i_info['earth'] + $i_info['all_magic'];
|
||||
$new_sql['light'] = $i_info['light'];
|
||||
$new_sql['gray'] = $i_info['gray'];
|
||||
$new_sql['dark'] = $i_info['dark'];
|
||||
// MF damage
|
||||
$new_sql['mf_sting'] = $i_info['mf_sting'] + $i_info['mf_dmg'];
|
||||
$new_sql['mf_slash'] = $i_info['mf_slash'] + $i_info['mf_dmg'];
|
||||
$new_sql['mf_crush'] = $i_info['mf_crush'] + $i_info['mf_dmg'];
|
||||
$new_sql['mf_sharp'] = $i_info['mf_sharp'] + $i_info['mf_dmg'];
|
||||
// -- magic
|
||||
$new_sql['mf_fire'] = $i_info['mf_fire'] + $i_info['mf_magic'];
|
||||
$new_sql['mf_water'] = $i_info['mf_water'] + $i_info['mf_magic'];
|
||||
$new_sql['mf_air'] = $i_info['mf_air'] + $i_info['mf_magic'];
|
||||
$new_sql['mf_earth'] = $i_info['mf_earth'] + $i_info['mf_magic'];
|
||||
// --
|
||||
$new_sql['mf_crit'] = $i_info['mf_crit'];
|
||||
$new_sql['mf_critp'] = $i_info['mf_critp'];
|
||||
$new_sql['mf_adodge'] = $i_info['mf_adodge'];
|
||||
$new_sql['mf_parmour'] = $i_info['mf_parmour'];
|
||||
// --
|
||||
$new_sql['mf_acrit'] = $i_info['mf_acrit'];
|
||||
$new_sql['mf_dodge'] = $i_info['mf_dodge'];
|
||||
$new_sql['mf_contr'] = $i_info['mf_contr'];
|
||||
$new_sql['mf_parry'] = $i_info['mf_parry'];
|
||||
$new_sql['mf_shieldb'] = $i_info['mf_shieldb'];
|
||||
// Damage
|
||||
$new_sql['hitmin'] = $i_info['add_hit_min'];
|
||||
$new_sql['hitmax'] = $i_info['add_hit_max'];
|
||||
// Protect
|
||||
foreach ($defs as $key)
|
||||
{
|
||||
if ($i_info['def_'.$key] > 0)
|
||||
{
|
||||
$new_sql['def_'.$key.'_min'] = $i_info['def_'.$key];
|
||||
$new_sql['def_'.$key.'_max'] = $i_info['def_'.$key] + $i_info['brick'];
|
||||
}
|
||||
}
|
||||
//$new_sql['cost'] = $i_info['price'];
|
||||
$new_sql['hp_regen'] = $i_info['hp_regen'];
|
||||
$new_sql['mp_regen'] = $i_info['mp_regen'];
|
||||
$new_sql['mp_cons'] = -$i_info['mp_cons'];
|
||||
// Hand
|
||||
switch ($slot)
|
||||
{
|
||||
case 'hand_r':
|
||||
case 'hand_l':
|
||||
$new_sql[$slot.'_sword'] = $i_info['sword_h'];
|
||||
$new_sql[$slot.'_axe'] = $i_info['axe_h'];
|
||||
$new_sql[$slot.'_fail'] = $i_info['fail_h'];
|
||||
$new_sql[$slot.'_knife'] = $i_info['knife_h'];
|
||||
$new_sql[$slot.'_sting'] = $i_info['mf_sting_h'] + $i_info['mf_dmg_h'];
|
||||
$new_sql[$slot.'_slash'] = $i_info['mf_slash_h'] + $i_info['mf_dmg_h'];
|
||||
$new_sql[$slot.'_crush'] = $i_info['mf_crush_h'] + $i_info['mf_dmg_h'];
|
||||
$new_sql[$slot.'_sharp'] = $i_info['mf_sharp_h'] + $i_info['mf_dmg_h'];
|
||||
$new_sql[$slot.'_crit'] = $i_info['mf_crit_h'];
|
||||
$new_sql[$slot.'_critp'] = $i_info['mf_critp_h'];
|
||||
$new_sql[$slot.'_adodge'] = $i_info['mf_adodge_h'];
|
||||
$new_sql[$slot.'_parmour'] = $i_info['mf_parmour_h'];
|
||||
$new_sql[$slot.'_hitmin'] = $i_info['attack'];
|
||||
$new_sql[$slot.'_hitmax'] = $i_info['attack'] + $i_info['brick'];
|
||||
break;
|
||||
}
|
||||
// HP/MP
|
||||
$new_sql['hp_all'] = $i_info['add_hp'];
|
||||
$new_sql['mp_all'] = $i_info['add_mp'];
|
||||
|
||||
foreach ($new_sql as $key => $value)
|
||||
{
|
||||
if ($value == 0)
|
||||
{
|
||||
unset($new_sql[$key]);
|
||||
continue;
|
||||
}
|
||||
|
||||
$new_sql[$key] = $value*$type;
|
||||
$new_sql[$key] += $char_stats[$key];
|
||||
}
|
||||
|
||||
$char_hpmp = $this->getChar('char_stats', 'hp', 'mp', $guid);
|
||||
foreach ($char_hpmp as $key => $value)
|
||||
{
|
||||
if ($i_info['add_'.$key] != 0)
|
||||
$this->setTimeToHPMP($value, $new_sql[$key.'_all'], $char_stats[$key.'_regen'], $key, $guid);
|
||||
}
|
||||
|
||||
$stats = array ('str' => 0, 'dex' => 0, 'con' => 0, 'int' => 0);
|
||||
foreach ($stats as $key => $value)
|
||||
{
|
||||
$stats[$key] = ($i_info['add_'.$key] + $i_info['inc_'.$key])*$type;
|
||||
|
||||
if ($stats[$key] == 0)
|
||||
unset($stats[$key]);
|
||||
}
|
||||
|
||||
if ($type == 1)
|
||||
{
|
||||
$q1 = $this->db->query("UPDATE `character_inventory`
|
||||
SET `wear` = '1',
|
||||
`last_update` = ?d
|
||||
WHERE `guid` = ?d
|
||||
and `id` = ?d", time() ,$guid ,$i_id);
|
||||
$q2 = $this->setChar('char_equip', $slot, $i_id, $guid);
|
||||
}
|
||||
else if ($type == -1)
|
||||
{
|
||||
$q1 = $this->db->query("UPDATE `character_inventory`
|
||||
SET `wear` = '0',
|
||||
`last_update` = ?d
|
||||
WHERE `guid` = ?d
|
||||
and `id` = ?d", time() ,$guid ,$i_id);
|
||||
$q2 = $this->setChar('char_equip', $slot, 0, $guid);
|
||||
}
|
||||
if ($q1 && $q2)
|
||||
{
|
||||
$this->db->query("UPDATE `character_stats` SET ?a WHERE `guid` = ?d", $new_sql ,$guid);
|
||||
$this->changeStats($stats, $guid);
|
||||
if ($type == 1)
|
||||
{
|
||||
if ($i_hands == 2)
|
||||
$this->setChar('char_equip', array('hand_r_type' => $w_type, 'hand_r_free' => 0, 'hand_l_free' => 0), $guid);
|
||||
else if ($i_hands == 1)
|
||||
$this->setChar('char_equip', array($slot.'_type' => $w_type, $slot.'_free' => 0), $guid);
|
||||
}
|
||||
else if ($type == -1)
|
||||
{
|
||||
if ($i_hands == 2)
|
||||
$this->setChar('char_equip', array('hand_r_type' => 'phisic', 'hand_r_free' => 1, 'hand_l_free' => 1), $guid);
|
||||
else if ($i_hands == 1)
|
||||
$this->setChar('char_equip', array($slot.'_type' => 'phisic', $slot.'_free' => 1), $guid);
|
||||
}
|
||||
}
|
||||
}
|
||||
/*Снять все предметы*/
|
||||
function unWearAllItems ()
|
||||
{
|
||||
$char_equip = $this->getChar('char_equip', 'helmet', 'bracer', 'hand_r', 'armor', 'shirt', 'cloak', 'belt', 'earring', 'amulet', 'ring1', 'ring2', 'ring3', 'gloves', 'hand_l', 'pants', 'boots');
|
||||
foreach ($char_equip as $key => $value)
|
||||
{
|
||||
if ($value)
|
||||
$this->equipItem($key, -1);
|
||||
}
|
||||
}
|
||||
/*Удаление предмета*/
|
||||
function deleteItem ($item_id, $type = 'delete', $guid = 0)
|
||||
{
|
||||
$guid = $this->getGuid($guid);
|
||||
|
||||
if (checki($item_id))
|
||||
return false;
|
||||
|
||||
$i_info = $this->db->selectRow("SELECT `i`.`name`,
|
||||
`i`.`mass`,
|
||||
`i`.`price`,
|
||||
`i`.`price_euro`,
|
||||
`c`.`tear_cur`, `c`.`tear_max`,
|
||||
`i`.`tear`
|
||||
FROM `character_inventory` AS `c`
|
||||
LEFT JOIN `item_template` AS `i`
|
||||
ON `c`.`item_entry` = `i`.`entry`
|
||||
WHERE `c`.`guid` = ?d
|
||||
and `c`.`id` = ?d
|
||||
and `c`.`wear` = '0'
|
||||
and `c`.`mailed` = '0';", $guid ,$item_id);
|
||||
if (!$i_info)
|
||||
return false;
|
||||
|
||||
$this->changeMass(-$i_info['mass']);
|
||||
$this->db->query("DELETE FROM `character_inventory` WHERE `id` = ?d and `guid` = ?d", $item_id ,$guid);
|
||||
if ($type == 'delete')
|
||||
$this->char->history->Items('Throw out', $i_info['name'], 'Dump');
|
||||
else if ($type == 'sell')
|
||||
{
|
||||
$sell_price = $this->getSellValue($i_info);
|
||||
$this->char->history->Items('Sell', "$i_info[name] за $sell_price кр.", 'Shop');
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/*Получение слота в который одет предмет*/
|
||||
function getItemSlot ($item_id)
|
||||
{
|
||||
if (checki($item_id))
|
||||
return;
|
||||
|
||||
$char_equip = $this->getChar('char_equip', 'helmet', 'bracer', 'hand_r', 'armor', 'shirt', 'cloak', 'belt', 'earring', 'amulet', 'ring1', 'ring2', 'ring3', 'gloves', 'hand_l', 'pants', 'boots');
|
||||
foreach ($char_equip as $key => $value)
|
||||
{
|
||||
if ($item_id == $value)
|
||||
return $key;
|
||||
}
|
||||
return;
|
||||
}
|
||||
/*Одевание комплекта предметов*/
|
||||
function equipSet ($name)
|
||||
{
|
||||
if ($name == '')
|
||||
$this->char->error->Inventory(221);
|
||||
|
||||
$set = $this->db->selectRow("SELECT `helmet`, `bracer`,
|
||||
`hand_r`, `armor`,
|
||||
`shirt`, `cloak`,
|
||||
`belt`, `earring`,
|
||||
`amulet`, `ring1`,
|
||||
`ring2`, `ring3`,
|
||||
`gloves`, `hand_l`,
|
||||
`pants`, `boots`
|
||||
FROM `character_sets`
|
||||
WHERE `guid` = ?d
|
||||
and `name` = ?s", $this->guid ,$name) or $this->char->error->Inventory(221);
|
||||
foreach ($set as $slot => $item_id)
|
||||
{
|
||||
$item = $this->db->selectRow("SELECT `wear`,
|
||||
`mailed`
|
||||
FROM `character_inventory`
|
||||
WHERE `guid` = ?d
|
||||
and `id` = ?d", $this->guid ,$item_id);
|
||||
if (!$item || $item['mailed'])
|
||||
$this->db->query("UPDATE `character_sets` SET ?# = '0' WHERE `name` = ?s and `guid` = ?d", $slot ,$name ,$this->guid);
|
||||
else if ($item['wear'])
|
||||
continue;
|
||||
else
|
||||
{
|
||||
$this->equipItem($slot, -1);
|
||||
$this->equipItem($item_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
69
engline/functions/class_Error.php
Normal file
69
engline/functions/class_Error.php
Normal file
@ -0,0 +1,69 @@
|
||||
<?
|
||||
defined('AntiBK') or die("Доступ запрещен!");
|
||||
|
||||
class Error extends Char
|
||||
{
|
||||
public $db;
|
||||
public $char;
|
||||
function Init ($object)
|
||||
{
|
||||
$this->db = $object->db;
|
||||
$this->char = $object;
|
||||
}
|
||||
/*Вывод ошибки в инвентаре*/
|
||||
function Inventory ($id = 0, $parameters = '')
|
||||
{
|
||||
echoScript("location.href = 'main.php?action=inv&error=$id¶meters=$parameters';", true);
|
||||
}
|
||||
/*Вывод ошибки в умениях*/
|
||||
function Skills ($id = 0, $parameters = '')
|
||||
{
|
||||
echoScript("location.href = 'main.php?action=skills&error=$id¶meters=$parameters';", true);
|
||||
}
|
||||
/*Вывод ошибки в разделе "Анкета"*/
|
||||
function Form ($id, $do, $parameters = '')
|
||||
{
|
||||
echoScript("location.href = 'main.php?action=form&do=$do&error=$id¶meters=$parameters';", true);
|
||||
}
|
||||
/*Вывод ошибки на карте*/
|
||||
function Map ($id = 0, $parameters = '')
|
||||
{
|
||||
echoScript("location.href = 'main.php?error=$id¶meters=$parameters';", true);
|
||||
}
|
||||
/*Вывод ошибки на почте*/
|
||||
function Mail ($id = 0, $do, $parameters = '')
|
||||
{
|
||||
echoScript("location.href = 'main.php?do=$do&error=$id¶meters=$parameters';", true);
|
||||
}
|
||||
/*Оформление вида ошибки*/
|
||||
function getFormattedError ($id, $parameters, $needBr = false)
|
||||
{
|
||||
if (!$id)
|
||||
return;
|
||||
|
||||
$err_text = "";
|
||||
$parametr = array();
|
||||
|
||||
if ($parameters)
|
||||
$parametr = split("\|", $parameters);
|
||||
|
||||
$err = $this->db->selectRow("SELECT `text`,
|
||||
`bold`,
|
||||
`hyphen`
|
||||
FROM `server_errors`
|
||||
WHERE `id` = ?d", $id);
|
||||
if (!$err)
|
||||
return;
|
||||
|
||||
list($err_text, $err_bold, $err_hyph) = array_values($err);
|
||||
|
||||
if ($err_bold)
|
||||
$err_text = "<b>$err_text</b>";
|
||||
|
||||
if ($err_hyph || $needBr)
|
||||
$err_text = "$err_text<br>";
|
||||
|
||||
vprintf($err_text, $parametr);
|
||||
}
|
||||
}
|
||||
?>
|
46
engline/functions/class_History.php
Normal file
46
engline/functions/class_History.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?
|
||||
defined('AntiBK') or die("Доступ запрещен!");
|
||||
|
||||
class History extends Char
|
||||
{
|
||||
public $guid;
|
||||
public $db;
|
||||
public $char;
|
||||
function Init ($object)
|
||||
{
|
||||
$this->guid = $object->guid;
|
||||
$this->db = $object->db;
|
||||
$this->char = $object;
|
||||
}
|
||||
/*История регистрации/авторизации персонажа*/
|
||||
function Auth ($action, $city, $comment = '')
|
||||
{
|
||||
$id = ($this->db->selectCell("SELECT MAX(`id`) FROM `history_auth` WHERE `guid` = ?d", $this->guid)) + 1;
|
||||
$this->db->query("INSERT INTO `history_auth` (`id`, `guid`, `action`, `ip`, `city`, `comment`, `date`)
|
||||
VALUES (?d, ?d, ?d, ?s, ?s, ?s, ?d);", $id ,$this->guid ,$action ,$_SERVER['REMOTE_ADDR'] ,$city ,$comment ,time());
|
||||
}
|
||||
/*История покупки/продажи/передачи предмета*/
|
||||
function Items ($action, $val, $to, $guid = 0)
|
||||
{
|
||||
$guid = $this->getGuid($guid);
|
||||
$id = ($this->db->selectCell("SELECT MAX(`id`) FROM `history_items` WHERE `guid` = ?d", $guid)) + 1;
|
||||
$this->db->query("INSERT INTO `history_items` (`id`, `guid`, `receive`, `action`, `item`, `date`)
|
||||
VALUES (?d, ?d, ?s, ?s, ?s, ?d)", $id ,$guid ,$to ,$action ,$val ,time());
|
||||
}
|
||||
/*История отправки/получения/возврата предмета по почте*/
|
||||
function Mail ($action, $val, $to, $guid = 0)
|
||||
{
|
||||
$guid = $this->getGuid($guid);
|
||||
$id = ($this->db->selectCell("SELECT MAX(`id`) FROM `history_mail` WHERE `guid` = ?d", $guid)) + 1;
|
||||
$this->db->query("INSERT INTO `history_mail` (`id`, `guid`, `receive`, `action`, `item`, `date`)
|
||||
VALUES (?d, ?d, ?s, ?s, ?s, ?d)", $id ,$guid ,$to ,$action ,$val ,time());
|
||||
}
|
||||
/*История банковских операций*/
|
||||
function Bank ($credit, $credit2, $cash, $euro, $operation)
|
||||
{
|
||||
$id = ($this->db->selectCell("SELECT MAX(`id`) FROM `history_bank` WHERE `credit` = ?d", $credit)) + 1;
|
||||
$this->db->query("INSERT INTO `history_bank` (`id`, `credit`, `credit2`, `cash`, `euro`, `operation`, `date`)
|
||||
VALUES (?d, ?d, ?d, ?f, ?f, ?d, ?d)", $id ,$credit ,$credit2 ,rdf($cash) ,rdf($euro) ,$operation ,time());
|
||||
}
|
||||
}
|
||||
?>
|
200
engline/functions/class_Mail.php
Normal file
200
engline/functions/class_Mail.php
Normal file
@ -0,0 +1,200 @@
|
||||
<?
|
||||
defined('AntiBK') or die("Доступ запрещен!");
|
||||
|
||||
class Mail extends Char
|
||||
{
|
||||
public $guid;
|
||||
public $db;
|
||||
public $char;
|
||||
function Init ($object)
|
||||
{
|
||||
$this->guid = $object->guid;
|
||||
$this->db = $object->db;
|
||||
$this->char = $object;
|
||||
}
|
||||
/*Вычисление цены передачи предмета*/
|
||||
function getPrice ($item_id)
|
||||
{
|
||||
if (checki($item_id))
|
||||
return 0;
|
||||
|
||||
$i_info = $this->db->selectRow("SELECT `i`.`price`, `i`.`mass`,
|
||||
`c`.`tear_cur`, `c`.`tear_max`,
|
||||
`i`.`tear`
|
||||
FROM `character_inventory` AS `c`
|
||||
LEFT JOIN `item_template` AS `i`
|
||||
ON `c`.`item_entry` = `i`.`entry`
|
||||
WHERE `c`.`id` = ?d
|
||||
and `c`.`guid` = ?d
|
||||
and (`i`.`item_flags` & '1')
|
||||
and `i`.`price_euro` = '0';", $item_id ,$this->guid);
|
||||
list($price, $mass, $tear_cur, $tear_max, $max_tear) = array_values($i_info);
|
||||
|
||||
if (!$i_info)
|
||||
return 0;
|
||||
|
||||
$cof = abs (100 - $mass * 1.5);
|
||||
$sell = round (($price / $cof), 2);
|
||||
|
||||
if ($sell < 0.01)
|
||||
$sell = 0.01;
|
||||
|
||||
return $sell;
|
||||
}
|
||||
/*Отправка денег*/
|
||||
function sendMoney ($mail_to, $send_money)
|
||||
{
|
||||
if (checki($send_money))
|
||||
$this->char->error->Mail(325);
|
||||
|
||||
if (checki($mail_to))
|
||||
$this->char->error->Mail(106, 'money');
|
||||
|
||||
$mail_to = $this->getChar('char_db', 'guid', $mail_to);
|
||||
|
||||
if (!$mail_to)
|
||||
$this->char->error->Mail(106, 'items');
|
||||
|
||||
$transfers = $this->getChar('char_db', 'transfers');
|
||||
|
||||
if ($transfers <= 0)
|
||||
$this->char->error->Mail(113, 'money');
|
||||
|
||||
if ($send_money < 1)
|
||||
$this->char->error->Mail(410, 'money', 1);
|
||||
|
||||
if (!($this->changeMoney(-$send_money)))
|
||||
$this->char->error->Mail(107);
|
||||
|
||||
$send_money = round (0.95 * $send_money, 2);
|
||||
$this->db->query("INSERT INTO `city_mail_items` (`sender`, `to`, `item_id`, `count`, `delivery_time`, `date`)
|
||||
VALUES (?d, ?d, '1000', ?f, ?d, ?d)", $this->guid ,$mail_to ,rdf($send_money) ,time() ,time());
|
||||
$this->char->history->Mail('Send', "Деньги: $send_money кр", $mail_to);
|
||||
$this->char->error->Mail(409, 'money', $send_money);
|
||||
}
|
||||
/*Получение/Возврат денег*/
|
||||
function getMoney ($mail_id, $type)
|
||||
{
|
||||
if (checki($mail_id))
|
||||
$this->char->error->Mail(112, 'get_mail');
|
||||
|
||||
$m_info = $this->db->selectRow("SELECT `m`.`id`,
|
||||
`m`.`sender`,
|
||||
`i`.`name`,
|
||||
`m`.`count`
|
||||
FROM `city_mail_items` AS `m`
|
||||
LEFT JOIN `item_template` AS `i`
|
||||
ON `m`.`item_id` = `i`.`entry`
|
||||
WHERE `m`.`to` = ?d
|
||||
and `m`.`delivery_time` < ?d
|
||||
and `m`.`id` = ?d", $this->guid ,time (), $mail_id) or $this->char->error->Mail(112, 'get_mail');
|
||||
list($mail_id, $sender, $name, $money_count) = array_values($m_info);
|
||||
$name = sprintf($name, $money_count);
|
||||
echoScript("top.menu.location.reload();");
|
||||
$this->db->query("DELETE FROM `city_mail_items` WHERE `id` = ?d", $mail_id);
|
||||
switch ($type)
|
||||
{
|
||||
case 'get_money':
|
||||
$this->Money(-$money_count);
|
||||
$this->char->history->Mail('Receive', $name, $sender);
|
||||
$this->char->error->Mail(407, 'get_mail', $name);
|
||||
break;
|
||||
case 'return_money':
|
||||
$this->db->query("INSERT INTO `city_mail_items` (`sender`, `to`, `item_id`, `count`, `delivery_time`, `date`)
|
||||
VALUES (?d, ?d, '1000', ?f, ?d, ?d)", $this->guid ,$sender ,rdf($money_count) ,time() ,time());
|
||||
$this->char->history->Mail('Return', $name, $sender);
|
||||
$this->char->error->Mail(408, 'get_mail', $name);
|
||||
break;
|
||||
}
|
||||
}
|
||||
/*Отправка предмета*/
|
||||
function sendItem ($mail_to, $item_id)
|
||||
{
|
||||
if (checki($item_id))
|
||||
$this->char->error->Mail(213, 'items');
|
||||
|
||||
if (checki($mail_to))
|
||||
$this->char->error->Mail(106, 'items');
|
||||
|
||||
if ($mail_to == $this->guid)
|
||||
$this->char->error->Mail(218);
|
||||
|
||||
$mail_to = $this->getChar('char_db', 'guid', $mail_to);
|
||||
|
||||
if (!$mail_to)
|
||||
$this->char->error->Mail(106, 'items');
|
||||
|
||||
$transfers = $this->getChar('char_db', 'transfers');
|
||||
|
||||
if ($transfers <= 0)
|
||||
$this->char->error->Mail(113, 'items');
|
||||
|
||||
$i_info = $this->db->selectRow("SELECT `i`.`name`,
|
||||
`i`.`mass`
|
||||
FROM `character_inventory` AS `c`
|
||||
LEFT JOIN `item_template` AS `i`
|
||||
ON `c`.`item_entry` = `i`.`entry`
|
||||
WHERE `c`.`id` = ?d
|
||||
and `c`.`guid` = ?d
|
||||
and `c`.`wear` = '0'
|
||||
and `c`.`mailed` = '0'
|
||||
and `i`.`price_euro` = '0';", $item_id ,$this->guid) or $this->char->error->Mail(213, 'items');
|
||||
list($i_name, $i_mass) = array_values($i_info);
|
||||
$price = $this->getPrice($item_id);
|
||||
|
||||
if (!($this->changeMoney(-$price)))
|
||||
$this->char->error->Mail(107);
|
||||
|
||||
$delivery_time = 1800 + time ();
|
||||
$this->db->query("UPDATE `characters` SET `transfers` = `transfers` - '1' WHERE `guid` = ?d", $this->guid);
|
||||
$this->db->query("UPDATE `character_inventory` SET `mailed` = '1' WHERE `guid` = ?d and `id` = ?d", $this->guid ,$item_id);
|
||||
$this->changeMass(-$i_mass);
|
||||
$this->db->query("INSERT INTO `city_mail_items` (`sender`, `to`, `item_id`, `delivery_time`, `date`)
|
||||
VALUES (?d, ?d, ?d, ?d, ?d)", $this->guid ,$mail_to ,$item_id ,$delivery_time ,time());
|
||||
$this->char->history->Mail('Send', "$i_name ($price кр)", $mail_to);
|
||||
$this->char->error->Mail(406, 'items', "$i_name|$price");
|
||||
}
|
||||
/*Получение/Возврат предмета*/
|
||||
function getItem ($item_id, $type)
|
||||
{
|
||||
if (checki($item_id))
|
||||
$this->char->error->Mail(112, 'get_mail');
|
||||
|
||||
global $history;
|
||||
$i_info = $this->db->selectRow("SELECT `m`.`id`,
|
||||
`m`.`sender`,
|
||||
`i`.`name`,
|
||||
`i`.`mass`
|
||||
FROM `city_mail_items` AS `m`
|
||||
LEFT JOIN `character_inventory` AS `c`
|
||||
ON `m`.`item_id` = `c`.`id`
|
||||
LEFT JOIN `item_template` AS `i`
|
||||
ON `c`.`item_entry` = `i`.`entry`
|
||||
WHERE `m`.`to` = ?d
|
||||
and `m`.`sender` = `c`.`guid`
|
||||
and `m`.`item_id` = ?d
|
||||
and `m`.`delivery_time` < ?d
|
||||
and `c`.`mailed` = '1';", $this->guid ,$item_id ,time()) or $this->char->error->Mail(112, 'get_mail');
|
||||
list($mail_id, $sender, $i_name, $i_mass) = array_values($i_info);
|
||||
$this->db->query("DELETE FROM `city_mail_items` WHERE `id` = ?d", $mail_id);
|
||||
echoScript("top.menu.location.reload();");
|
||||
switch ($type)
|
||||
{
|
||||
case 'get_item':
|
||||
$this->db->query("UPDATE `character_inventory` SET `mailed` = '0', `guid` = ?d, `last_update` = ?d WHERE `guid` = ?d and `id` = ?d", $this->guid ,time() ,$sender ,$item_id);
|
||||
$this->changeMass($i_mass);
|
||||
$this->char->history->Mail('Receive', $i_name, $sender);
|
||||
$this->char->error->Mail(407, 'get_mail', $i_name);
|
||||
break;
|
||||
case 'return_item':
|
||||
$delivery_time = 1800 + time();
|
||||
$this->db->query("UPDATE `character_inventory` SET `mailed` = '1' WHERE `guid` = ?d and `id` = ?d", $sender ,$item_id);
|
||||
$this->db->query("INSERT INTO `city_mail_items` (`sender`, `to`, `item_id`, `delivery_time`, `date`)
|
||||
VALUES (?d, ?d, ?d, ?d, ?d)", $this->guid ,$sender ,$item_id ,$delivery_time ,time());
|
||||
$this->char->history->Mail('Return', $i_name, $sender);
|
||||
$this->char->error->Mail(408, 'get_mail', $i_name);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
392
engline/functions/class_Test.php
Normal file
392
engline/functions/class_Test.php
Normal file
@ -0,0 +1,392 @@
|
||||
<?
|
||||
defined('AntiBK') or die("Доступ запрещен!");
|
||||
|
||||
class Test extends Char
|
||||
{
|
||||
public $guid;
|
||||
public $db;
|
||||
public $char;
|
||||
function Init ($object)
|
||||
{
|
||||
$this->guid = $object->guid;
|
||||
$this->db = $object->db;
|
||||
$this->char = $object;
|
||||
}
|
||||
/*Проверка существования персонажа*/
|
||||
function Guid ($type = 'main', $loc = '')
|
||||
{
|
||||
if (checki($this->guid))
|
||||
toIndex($type, true, $loc);
|
||||
|
||||
$char_db = $this->getChar('char_db', 'guid');
|
||||
$char_stats = $this->getChar('char_stats', 'guid');
|
||||
$char_info = $this->getChar('char_info', 'guid');
|
||||
$sid = $this->db->selectCell("SELECT `sid` FROM `online` WHERE `guid` = ?d", $this->guid);
|
||||
|
||||
if (!$char_db || !$char_stats || !$char_info || $sid != session_id() || $sid != $_COOKIE['PHPSESSID'])
|
||||
toIndex($type, true, $loc);
|
||||
}
|
||||
/*Проверка на доступ*/
|
||||
function Admin ($type = 'main', $loc = '')
|
||||
{
|
||||
$admin_level = $this->getChar('char_db', 'admin_level');
|
||||
|
||||
if (!$admin_level)
|
||||
toIndex($type, true, $loc);
|
||||
}
|
||||
/*Проверка блока персонажа*/
|
||||
function Block ()
|
||||
{
|
||||
$block = $this->getChar('char_db', 'block');
|
||||
|
||||
if ($block)
|
||||
echoScript("top.main.location.href = 'main.php?action=exit';", true);
|
||||
}
|
||||
/*Проверка заключения персонажа*/
|
||||
function Prison ()
|
||||
{
|
||||
$prison = $this->getChar('char_db', 'prison');
|
||||
|
||||
if (!$prison || intval($prison - time()) > 0)
|
||||
return;
|
||||
|
||||
$this->setChar('char_db', array('prison' => 0));
|
||||
}
|
||||
/*Проверка участия персонажа в заявке*/
|
||||
function Zayavka ()
|
||||
{
|
||||
$battle = $this->getChar('char_db', 'battle');
|
||||
$md1 = $this->db->selectCell("SELECT `battle_id` FROM `team1` WHERE `player` = ?d", $this->guid);
|
||||
$md2 = $this->db->selectCell("SELECT `battle_id` FROM `team2` WHERE `player` = ?d", $this->guid);
|
||||
$t = 0;
|
||||
if ($md1)
|
||||
{
|
||||
$m = $md1;
|
||||
$t = 1;
|
||||
}
|
||||
else if ($md2)
|
||||
{
|
||||
$m = $md2;
|
||||
$t = 2;
|
||||
}
|
||||
$rows = $this->db->select("SELECT `creator`,
|
||||
`status`
|
||||
FROM `zayavka`;");
|
||||
foreach ($rows as $dat)
|
||||
{
|
||||
$cr = $dat['creator'];
|
||||
|
||||
if ($m == $dat['creator'] && $dat['status'] == 1)
|
||||
$zayavka_status = "awaiting";
|
||||
|
||||
if ($m == $dat['creator'] && $dat['status'] == 2 && $t == 1)
|
||||
$zayavka_status = "confirm_mine";
|
||||
|
||||
if ($m == $dat['creator'] && $dat['status'] == 2 && $t == 2)
|
||||
$zayavka_status = "confirm_opp";
|
||||
|
||||
if ($m == $dat['creator'] && $dat['status'] == 3 && $battle == 0)
|
||||
goBattle($this->guid);
|
||||
}
|
||||
if ($_SESSION['zayavka_c_m'] == 0 && $zayavka_status == "confirm_mine")
|
||||
{
|
||||
$_SESSION['zayavka_c_m'] = 1;
|
||||
echoScript("top.main.location.href = 'zayavka.php';", true);
|
||||
}
|
||||
|
||||
if ($_SESSION['zayavka_c_o'] == 0 && $t == 0)
|
||||
$_SESSION['zayavka_c_o'] = 1;
|
||||
}
|
||||
/*Проверка участия персонажа в битве*/
|
||||
function Battle ()
|
||||
{
|
||||
$battle = $this->getChar('char_db', 'battle');
|
||||
|
||||
if (!$battle)
|
||||
return;
|
||||
|
||||
echoScript("top.main.location.href = 'battle.php';", true);
|
||||
}
|
||||
/*Проверка молчанки у персонажа*/
|
||||
function Shut ()
|
||||
{
|
||||
$chat_shut = $this->getChar('char_db', 'chat_shut');
|
||||
|
||||
if (!$chat_shut || $chat_shut > time())
|
||||
return;
|
||||
|
||||
$this->setChar('char_db', array('chat_shut' => 0));
|
||||
}
|
||||
/*Восстановление здоровья/маны*/
|
||||
function Regen ()
|
||||
{
|
||||
if ($this->getChar('char_db', 'battle') != 0)
|
||||
return;
|
||||
|
||||
$char_stats = $this->getChar('char_stats', 'hp', 'hp_cure', 'hp_all', 'hp_regen', 'mp', 'mp_cure', 'mp_all', 'mp_regen');
|
||||
list($now["hp"], $cure["hp"], $all["hp"], $regen["hp"], $now["mp"], $cure["mp"], $all["mp"], $regen["mp"]) = array_values($char_stats);
|
||||
|
||||
foreach ($all as $key => $value)
|
||||
{
|
||||
if ($cure[$key] == 0 && $now[$key] < $value)
|
||||
{
|
||||
getCureValue($now[$key], $value, $regen[$key], $cure[$key]);
|
||||
$this->setChar('char_stats', array($key.'_cure' => $cure[$key]));
|
||||
}
|
||||
else if ($cure[$key] == 0)
|
||||
continue;
|
||||
|
||||
$regenerated = getRegeneratedValue($value, ($cure[$key] - time()), $regen[$key]);
|
||||
if ($regenerated >= 0 && $regenerated < $value)
|
||||
$this->setChar('char_stats', array($key => $regenerated));
|
||||
else
|
||||
{
|
||||
$this->setChar('char_stats', array($key => $value, $key.'_cure' => 0));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*Проверка травм у персонажа*/
|
||||
function Travm ()
|
||||
{
|
||||
$travms = $this->db->select("SELECT `travm_id`, `end_time` FROM `character_travms` WHERE `guid` = ?d and `end_time` != 0;", $this->guid);
|
||||
foreach ($travms as $travm)
|
||||
{
|
||||
if ($travm['end_time'] != 0 && time() > $travm['end_time'])
|
||||
$this->workTravm($travm['travm_id'], -1);
|
||||
}
|
||||
}
|
||||
/*Проверка на получение апа/уровня*/
|
||||
function Up ()
|
||||
{
|
||||
$char_db = $this->getChar('char_db', 'exp', 'next_up', 'level');
|
||||
|
||||
if ($char_db['exp'] < $char_db['next_up'])
|
||||
return;
|
||||
|
||||
$exp_table = $this->db->selectRow("SELECT `up`, `level`, `ups`,
|
||||
`skills`, `money`, `vit`,
|
||||
`spi`, `hp_regen`,
|
||||
`add_bars`
|
||||
FROM `player_exp_for_level`
|
||||
WHERE `exp` = ?d", $char_db['next_up']);
|
||||
list($this_up, $next_level, $next_ups, $next_skills, $next_money, $next_vit, $next_spi, $next_hpr, $next_bars) = array_values($exp_table);
|
||||
$next_exp = $this->db->selectCell("SELECT `exp` FROM `player_exp_for_level` WHERE `up` = ?d", ($this_up + 1));
|
||||
$this->db->query("UPDATE `characters`
|
||||
SET `next_up` = ?d,
|
||||
`money` = `money` + ?f
|
||||
WHERE `guid` = ?d", $next_exp ,rdf($next_money) ,$this->guid);
|
||||
$this->db->query("UPDATE `character_stats`
|
||||
SET `ups` = `ups` + ?d,
|
||||
`skills` = `skills` + ?d
|
||||
WHERE `guid` = ?d", $next_ups ,$next_skills ,$this->guid);
|
||||
|
||||
if ($next_vit)
|
||||
$this->changeStats('vit', $next_vit);
|
||||
|
||||
if ($next_spi)
|
||||
$this->changeStats('spi', $next_spi);
|
||||
|
||||
if ($next_money)
|
||||
$this->char->history->Items('Get', "$next_money кр.", 'Level');
|
||||
|
||||
if ($next_level <= $char_db['level'])
|
||||
{
|
||||
if ($char_db['exp'] >= $next_exp)
|
||||
$this->Up();
|
||||
return;
|
||||
}
|
||||
|
||||
$this->setChar('char_db', 'level', $next_level);
|
||||
$this->db->query("UPDATE `character_stats` SET `maxmass` = `maxmass` + ?f, `hp_regen` = `hp_regen` - ?d WHERE `guid` = ?d", 40 ,$next_hpr ,$this->guid);
|
||||
if ($next_bars)
|
||||
{
|
||||
$bar_enums = array('mod' => 2, 'power' => 3, 'def' => 4, 'set' => 5, 'btn' => 6);
|
||||
$next_bars = explode(',', $next_bars);
|
||||
foreach ($next_bars as $key => $value)
|
||||
{
|
||||
$this->setChar('char_bars', $value, $bar_enums[$value]."|1");
|
||||
}
|
||||
}
|
||||
if ($char_db['exp'] >= $next_exp)
|
||||
$this->Up();
|
||||
}
|
||||
/*Проверка участия персонажа в походе*/
|
||||
function Move ()
|
||||
{
|
||||
$speed = $this->getChar('char_db', 'speed');
|
||||
$ld = $this->db->selectRow("SELECT `time`,
|
||||
`destenation`,
|
||||
`dest_game`,
|
||||
`len`,
|
||||
`napr`
|
||||
FROM `goers`
|
||||
WHERE `guid` = ?d", $this->guid);
|
||||
if (!$ld)
|
||||
return;
|
||||
|
||||
list($all_time, $dest_g, $dest, $len, $napr) = array_values($ld);
|
||||
$to_go = $all_time - time();
|
||||
$to_go_sec = intval(($all_time - time())); /*seconds*/
|
||||
$time_to_go = intval($len / $speed * 3600); /*секунд идти*/
|
||||
$atg = $time_to_go - $to_go_sec;
|
||||
$len_done = getMoney($speed * $atg / 3600);
|
||||
$speed_form = getMoney($speed / 1000);
|
||||
if ($to_go > 0)
|
||||
{
|
||||
echo "Вы идете.<br>"
|
||||
. "Назначение: <b>$dest</b><br>"
|
||||
. "Направление: <b>$napr</b><br>"
|
||||
. "Расстояние: <b>$len (м)</b><br>"
|
||||
. "Пройдено: <b>$len_done (м)</b><br>"
|
||||
. "Скорость: <b>$speed_Form(км/час)</b><br>"
|
||||
. "Осталось времени: <b>".getFormatedTime($all_time)."</b><br><br>"
|
||||
. "<input type='button' onclick=\"location.reload();\" value='Обновить' id='refresh' size='20' class='anketa' style='background-color: #e4e4e4;'>";
|
||||
die();
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "Вы пришли в <b>$dest</b>";
|
||||
$walk_coef = $len / 10000;
|
||||
|
||||
if ($des_g == 'mountown_forest' || $des_g == 'Mountown')
|
||||
$room = "forest";
|
||||
|
||||
$this->setChar('char_db', array('city' => $dest, 'room' => $room));
|
||||
$this->db->query("UPDATE `character_stats` SET `walk` = `walk` + ?d WHERE `guid` = ?d", $walk_coef ,$this->guid);
|
||||
$this->db->query("DELETE FROM `goers` WHERE `guid` = ?d", $this->guid);
|
||||
echoScript("location.href = 'main.php?action=go&room_go=$room';", true);
|
||||
}
|
||||
}
|
||||
/*Проверка правельности перехода*/
|
||||
function Go ($room_go, $return = false)
|
||||
{
|
||||
if (!$room_go)
|
||||
$this->char->error->Map(102);
|
||||
|
||||
$char_db = $this->getChar('char_db', 'room', 'city', 'sex', 'level', 'prison');
|
||||
$char_stats = $this->getChar('char_stats', 'mass', 'maxmass');
|
||||
$travm = $this->db->select("SELECT `c`.`travm_id` FROM `character_travms` AS `c` LEFT JOIN `player_travms` AS `i` ON `c`.`travm_id` = `i`.`id` WHERE `c`.`guid` = ?d and (`i`.`power` = '3' or `i`.`power` = '2') and `i`.`type` != '2';", $this->guid);
|
||||
$room_info = $this->char->city->getRoom($room_go, $char_db['city'], 'room', 'from', 'min_level', 'max_level', 'need_orden', 'sex') or $this->char->error->Map(102);
|
||||
list($room_go, $from, $min_level, $max_level, $need_orden, $need_sex) = array_values($room_info);
|
||||
|
||||
if ($char_db['prison'] != 0)
|
||||
$this->char->error->Map(100);
|
||||
|
||||
if ($char_stats['mass'] > $char_stats['maxmass'])
|
||||
$this->char->error->Map(103, "$char_stats[mass]|$char_stats[maxmass]");
|
||||
|
||||
if ($char_db['level'] < $min_level)
|
||||
$this->char->error->Map(101);
|
||||
|
||||
if ($char_db['level'] > $max_level)
|
||||
$this->char->error->Map(109, $max_level);
|
||||
|
||||
if ($need_orden)
|
||||
$this->char->error->Map(102);
|
||||
|
||||
if ($need_sex != '' && $char_db['sex'] != $need_sex)
|
||||
{
|
||||
$need_sex = ($need_sex) ?'женщинам' :'мужчинам';
|
||||
$this->char->error->Map(104, $need_sex);
|
||||
}
|
||||
|
||||
if (!in_array($char_db['room'], explode(',', $from)) && $char_db['room'] != $room_go)
|
||||
$this->char->error->Map(102);
|
||||
|
||||
if (($this->char->city->getRoomGoTime()) > 0 && !$return)
|
||||
$this->char->error->Map(110);
|
||||
|
||||
if ($travm)
|
||||
$this->char->error->Map(115);
|
||||
}
|
||||
/*Проверка всех предметов*/
|
||||
function Items ()
|
||||
{
|
||||
$char_equip = $this->getChar('char_equip', 'helmet', 'bracer', 'hand_r', 'armor', 'shirt', 'cloak', 'belt', 'earring', 'amulet', 'ring1', 'ring2', 'ring3', 'gloves', 'hand_l', 'pants', 'boots');
|
||||
foreach ($char_equip as $key => $value)
|
||||
{
|
||||
if ($value != 0 && !($this->char->equip->checkItemStats($value)))
|
||||
$this->char->equip->equipItem($key, -1);
|
||||
}
|
||||
$rows = $this->db->select("SELECT `id`,
|
||||
`wear`,
|
||||
`mailed`
|
||||
FROM `character_inventory`
|
||||
WHERE `guid` = ?d", $this->guid);
|
||||
foreach ($rows as $inventory)
|
||||
{
|
||||
list($item_id, $item_wear, $item_mailed) = array_values($inventory);
|
||||
|
||||
if ($this->char->equip->checkItemValidity($item_id))
|
||||
continue;
|
||||
|
||||
if (!$item_wear && !$item_mailed)
|
||||
$this->char->equip->deleteItem($item_id);
|
||||
else if ($item_wear && !$item_mailed)
|
||||
{
|
||||
$slot = $this->char->equip->getItemSlot($item_id);
|
||||
$this->char->equip->equipItem($slot, -1);
|
||||
$this->char->equip->deleteItem($item_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
/*Проверка доступности комнаты*/
|
||||
function Room ()
|
||||
{
|
||||
global $action;
|
||||
$actions = array('none', 'go', 'admin', 'enter', 'exit', '');
|
||||
$room = $this->getChar('char_db', 'room');
|
||||
|
||||
if ($room == 'mail' && !in_array($action, $actions))
|
||||
$this->char->error->Map(105);
|
||||
|
||||
if ($room == 'bank' && !in_array($action, $actions))
|
||||
$this->char->error->Map();
|
||||
}
|
||||
/*Проверка состояния персонажа*/
|
||||
function Afk ()
|
||||
{
|
||||
$char_db = $this->getChar('char_db', 'last_time', 'dnd', 'afk');
|
||||
|
||||
if ($char_db['afk'])
|
||||
return;
|
||||
|
||||
if ((time () - $char_db['last_time']) >= 300 && !$char_db['dnd'])
|
||||
$this->setChar('char_db', array('afk' => 1, 'message' => 'away from keyboard'));
|
||||
}
|
||||
/*Обновление состояния персонажа*/
|
||||
function WakeUp ()
|
||||
{
|
||||
$char_db = $this->getChar('char_db', 'afk', 'message');
|
||||
|
||||
if ($char_db['afk'] && $char_db['message'] == 'away from keyboard')
|
||||
$this->setChar('char_db', array('afk' => 0, 'message' => ''));
|
||||
}
|
||||
/*Проверка эффектов*/
|
||||
function Effects ()
|
||||
{
|
||||
$effects = $this->db->select("SELECT `effect_id`, `end_time` FROM `character_effects` WHERE `guid` = ?d and `end_time` != 0;", $this->guid);
|
||||
foreach ($effects as $effect)
|
||||
{
|
||||
if ($effect['end_time'] != 0 && time() > $effect['end_time'])
|
||||
$this->workEffect($effect['effect_id'], -1);
|
||||
}
|
||||
}
|
||||
/*Проверка онлайн*/
|
||||
function Online ($guid = 0)
|
||||
{
|
||||
if ($guid == $this->guid)
|
||||
return true;
|
||||
|
||||
$last_time = $this->getChar('char_db', 'last_time', $guid);
|
||||
|
||||
if ((time() - $last_time) > 100)
|
||||
{
|
||||
$this->db->query("DELETE FROM `online` WHERE `guid` = ?d", $guid);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
?>
|
321
engline/functions/functions.php
Normal file
321
engline/functions/functions.php
Normal file
@ -0,0 +1,321 @@
|
||||
<?
|
||||
defined('AntiBK') or die("Доступ запрещен!");
|
||||
|
||||
/*Функции персонажа*/
|
||||
include("class_Char.php");
|
||||
/*Функции проверок*/
|
||||
include("class_Test.php");
|
||||
/*Функции предметов*/
|
||||
include("class_Equip.php");
|
||||
/*Функции города*/
|
||||
include("class_City.php");
|
||||
/*Функции почты*/
|
||||
include("class_Mail.php");
|
||||
/*Функции банка*/
|
||||
include("class_Bank.php");
|
||||
/*Функции чата*/
|
||||
include("class_Chat.php");
|
||||
/*Функции истории*/
|
||||
include("class_History.php");
|
||||
/*Функции ошибок*/
|
||||
include("class_Error.php");
|
||||
/*Вывод js скрипта*/
|
||||
function echoScript ($str, $die = false)
|
||||
{
|
||||
echo "<script type='text/javascript'>$str</script>";
|
||||
if ($die)
|
||||
die();
|
||||
}
|
||||
/*Преобразование массива в переменные*/
|
||||
function ArrToVar ($arr, $pref = '')
|
||||
{
|
||||
foreach ($arr as $key => $value)
|
||||
{
|
||||
$var = ($pref != '') ?$pref.$key :$key;
|
||||
global ${$var};
|
||||
${$var} = $value;
|
||||
}
|
||||
}
|
||||
/*Получение полосы загрузки*/
|
||||
function getUpdateBar ()
|
||||
{
|
||||
echo "<table width='80' border='0' cellspacing='0' cellpadding='0'>"
|
||||
. "<tr>"
|
||||
. "<td><a href='?action=none'><img src='../img/room/rel_1.png' width='15' height='16' alt='Обновить' border='0' /></a></td>"
|
||||
. "<td>"
|
||||
. "<table width='80' border='0' cellspacing='0' cellpadding='0'>"
|
||||
. "<tr><td colspan='3' align='center'><img src='../img/room/navigatin_462s.gif' width='80' height='3' /></td></tr>"
|
||||
. "<tr width='80'>"
|
||||
. "<td><img src='../img/room/navigatin_481.gif' width='9' height='8' /></td>"
|
||||
. "<td width='100%' bgcolor='#000000' nowrap><div id='prcont' align='center' style='font-size: 4px; padding: 0px; border: solid black 0px; text-align: center;'>";
|
||||
for ($i = 1; $i <= 32; $i++)
|
||||
{
|
||||
echo "<span id='progress$i' style='background-color: #00CC00;'> </span>";
|
||||
if ($i < 32)
|
||||
echo " ";
|
||||
}
|
||||
echo "</div></td>"
|
||||
. "<td><img src='../img/room/navigatin_50s.gif' width='7' height='8' /></td>"
|
||||
. "</tr>"
|
||||
. "<tr><td colspan='3'><img src='../img/room/navigatin_tt1_532.gif' width='80' height='5' /></td></tr>"
|
||||
. "</table></td></tr></table>";
|
||||
}
|
||||
/*Получение времени восстановления здоровья*/
|
||||
function getCureValue ($now, $all, $regen, &$value)
|
||||
{
|
||||
$value = intval(30000*($all-$now)/($all*$regen)) + time();
|
||||
}
|
||||
/*Получение количества восстановленного здоровья*/
|
||||
function getRegeneratedValue ($all, $cure, $regen)
|
||||
{
|
||||
return $all - intval(0.0001*$all*$cure*$regen/3);
|
||||
}
|
||||
/*Получение отформатированного времени*/
|
||||
function getFormatedTime ($timestamp)
|
||||
{
|
||||
if (!$timestamp)
|
||||
return "0 сек.";
|
||||
|
||||
if (!is_numeric($timestamp))
|
||||
$timestamp = time();
|
||||
|
||||
$seconds = ($timestamp > time()) ?$timestamp - time() :time() - $timestamp;
|
||||
$seconds = ($seconds > 0) ?$seconds :0;
|
||||
$y = intval($seconds / 31536000);
|
||||
$seconds %= 31536000;
|
||||
$m = intval($seconds / 2592000);
|
||||
$seconds %= 2592000;
|
||||
$d = intval($seconds / 86400);
|
||||
$seconds %= 86400;
|
||||
$h = intval($seconds / 3600);
|
||||
$seconds %= 3600;
|
||||
$n = intval($seconds / 60);
|
||||
$seconds %= 60;
|
||||
$s = $seconds;
|
||||
|
||||
if ($y && $m == 0) return "$y г.";
|
||||
if ($y) return "$y г. $m мес.";
|
||||
if ($m && $d == 0) return "$m мес.";
|
||||
if ($m) return "$m мес. $d дн.";
|
||||
if ($d && $h == 0) return "$d дн.";
|
||||
if ($d) return "$d дн. $h ч.";
|
||||
if ($h && $n == 0) return "$h ч.";
|
||||
if ($h) return "$h ч. $n мин.";
|
||||
if ($n && $s == 0) return "$n мин.";
|
||||
if ($n) return "$n мин. $s сек.";
|
||||
return "$s сек.";
|
||||
}
|
||||
/*Перевод в float*/
|
||||
function getMoney ($money)
|
||||
{
|
||||
return sprintf("%01.2f", $money);
|
||||
}
|
||||
/*Внедрение пробела*/
|
||||
function getExp ($exp)
|
||||
{
|
||||
return number_format($exp, 0, "", " ");
|
||||
}
|
||||
/*Получение цвета улучшения*/
|
||||
function getColor ($cur, $add)
|
||||
{
|
||||
$diff = ($add > 0) ?(1 - (($cur - $add) / $cur)) * 255 :($add < 0) ?(1 -(($cur - $add*(-1)) / $cur)) * 255 :-50;
|
||||
$diff = abs(intval($diff)) + 50;
|
||||
|
||||
if ($diff > 150 && $add > 0) return "#00AA00";
|
||||
if ($diff > 150 && $add < 0) return "#AA0000";
|
||||
if ($add > 0) return "RGB(0, $diff, 0)";
|
||||
if ($add < 0) return "RGB($diff, 0, 0)";
|
||||
return "RGB(0, 0, 0)";
|
||||
}
|
||||
/*Получение разбивки статов*/
|
||||
function getBraces ($stat, $added_stat, $type = '')
|
||||
{
|
||||
if ($added_stat > 0) return " <small>(<font id='inst_$type'>".($stat-$added_stat)."</font> + $added_stat)</small>";
|
||||
if ($added_stat < 0) return " <small>(<font id='inst_$type'>".($stat-$added_stat)."</font> - ".abs($added_stat).")</small>";
|
||||
}
|
||||
/*Сравнение двух переменных*/
|
||||
function compare ($var1, $var2, $var3 = 0)
|
||||
{
|
||||
$format = '%1$s';
|
||||
if (is_numeric($var1) && is_numeric($var2))
|
||||
$format = ($var1 > $var2) ?"<font color=\"#FF0000\">$format</font>" :$format;
|
||||
else if (is_string($var1) && is_string($var2))
|
||||
$format = ($var1 != $var2) ?"<font color=\"#FF0000\">$format</font>" :$format;
|
||||
$text = ($var3) ?$var3 :$var1;
|
||||
return sprintf($format, $text);
|
||||
}
|
||||
/*UTF-8 размер строки*/
|
||||
function utf8_strlen ($s)
|
||||
{
|
||||
return preg_match_all('/./u', $s, $tmp);
|
||||
}
|
||||
/*UTF-8 сокращение строки*/
|
||||
function utf8_substr ($s, $offset, $len = 'all')
|
||||
{
|
||||
if ($offset < 0)
|
||||
$offset = $char -> utf8_strlen($s) + $offset;
|
||||
|
||||
if ($len != 'all')
|
||||
{
|
||||
if ($len < 0)
|
||||
$len = utf8_strlen($s) - $offset + $len;
|
||||
|
||||
$xlen = utf8_strlen($s) - $offset;
|
||||
$len = ($len > $xlen) ?$xlen :$len;
|
||||
preg_match('/^.{' . $offset . '}(.{0,'.$len.'})/us', $s, $tmp);
|
||||
}
|
||||
else
|
||||
preg_match('/^.{' . $offset . '}(.*)/us', $s, $tmp);
|
||||
return (isset($tmp[1])) ?$tmp[1] :false;
|
||||
}
|
||||
/*Экранирование запроса LIKE*/
|
||||
function escapeLike ($s)
|
||||
{
|
||||
return "%".str_replace(array("'", '"', "%", "_"), array("\'", '\"', "", ""), $s)."%";
|
||||
}
|
||||
/*Error log function*/
|
||||
function databaseErrorHandler ($message, $info)
|
||||
{
|
||||
if (!error_reporting())
|
||||
return;
|
||||
|
||||
echo "<table class = report><tbody><tr><td>SQL Error: $message<br><pre>".print_r($info, true)."</pre></td></tr></tbody></table>";
|
||||
error_log($message);
|
||||
}
|
||||
/*Получение переменной GET, POST и COOKIE*/
|
||||
function getVar ($var, $stand = '', $flags = 3)
|
||||
{
|
||||
if (isset($_GET[$var]) && ($flags & 1))
|
||||
$value = $_GET[$var];
|
||||
else if (isset($_POST[$var]) && ($flags & 2))
|
||||
$value = $_POST[$var];
|
||||
else if (isset($_COOKIE[$var]) && ($flags & 4))
|
||||
$value = $_COOKIE[$var];
|
||||
else
|
||||
return $stand;
|
||||
|
||||
if (is_numeric($stand) && is_numeric($value)) return ($flags & 8) ?rdf($value) :$value;
|
||||
else if (!is_numeric($stand)) return htmlspecialchars($value);
|
||||
else return $stand;
|
||||
}
|
||||
/*Проверка существования переменной SESSION*/
|
||||
function checks ()
|
||||
{
|
||||
$args = func_get_args();
|
||||
|
||||
if (func_num_args() == 1)
|
||||
return isset($_SESSION[$args[0]]);
|
||||
|
||||
foreach ($args as $arg)
|
||||
{
|
||||
if (!isset($_SESSION[$arg]))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/*Проверка существования и правильного формата числа*/
|
||||
function checki ($int)
|
||||
{
|
||||
return (!is_numeric($int) || $int == 0);
|
||||
}
|
||||
/*Преобразование русско-язычной строки в нижний и верхний регистр*/
|
||||
define('UPCASE', 'АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯABCDEFGHIKLMNOPQRSTUVWXYZ');
|
||||
define('LOCASE', 'абвгдеёжзийклмнопрстуфхцчшщъыьэюяabcdefghiklmnopqrstuvwxyz');
|
||||
function mb_str_split ($str)
|
||||
{
|
||||
preg_match_all('/.{1}|[^\x00]{1}$/us', $str, $ar);
|
||||
return $ar[0];
|
||||
}
|
||||
function mb_strtr ($str, $from, $to)
|
||||
{
|
||||
return str_replace(mb_str_split($from), mb_str_split($to), $str);
|
||||
}
|
||||
function lowercase ($arg = '')
|
||||
{
|
||||
return mb_strtr($arg, UPCASE, LOCASE);
|
||||
}
|
||||
function uppercase ($arg = '')
|
||||
{
|
||||
return mb_strtr($arg, LOCASE, UPCASE);
|
||||
}
|
||||
/*Возврат значения ajax запроса*/
|
||||
function returnAjax ()
|
||||
{
|
||||
die(implode('$$', func_get_args()));
|
||||
}
|
||||
/*Получение место перехода*/
|
||||
function toIndex ($type = 'main', $die = true, $loc = '')
|
||||
{
|
||||
deleteSession();
|
||||
switch ($type)
|
||||
{
|
||||
case 'main':
|
||||
deleteSession();
|
||||
echoScript("top.location.href = '{$loc}index.php';", $die);
|
||||
break;
|
||||
case 'game':
|
||||
deleteSession();
|
||||
echoScript("location.href = '{$loc}index.php';", $die);
|
||||
break;
|
||||
case 'ajax':
|
||||
die('ajax_error');
|
||||
break;
|
||||
}
|
||||
}
|
||||
/*Получение guid персонажа*/
|
||||
function getGuid ($type = 'main', $loc = '')
|
||||
{
|
||||
if (empty($_SESSION['guid']))
|
||||
toIndex($type, true, $loc);
|
||||
else
|
||||
return $_SESSION['guid'];
|
||||
}
|
||||
/*Получение названия таблицы*/
|
||||
function getTable ($name)
|
||||
{
|
||||
switch ($name)
|
||||
{
|
||||
case 'char_db': return 'characters';
|
||||
case 'char_stats': return 'character_stats';
|
||||
case 'char_info': return 'character_info';
|
||||
case 'char_equip': return 'character_equip';
|
||||
case 'char_bars': return 'character_bars';
|
||||
case 'online': return 'online';
|
||||
}
|
||||
}
|
||||
/*Удаление переменных сессии*/
|
||||
function deleteSession ()
|
||||
{
|
||||
unset($_SESSION['guid'], $_SESSION['bankСredit'], $_SESSION['last_t'], $_SESSION['token']);
|
||||
}
|
||||
/*Смешивает порядок ключей массива сохраняя значения*/
|
||||
function shuffle_arr ($array)
|
||||
{
|
||||
$keys = array_keys($array);
|
||||
shuffle($keys);
|
||||
return array_merge(array_flip($keys), $array);
|
||||
}
|
||||
/*Функции для определения времени создания страницы*/
|
||||
function gettime ()
|
||||
{
|
||||
$part_time = explode(' ',microtime());
|
||||
$real_time = $part_time[1].substr($part_time[0],1);
|
||||
return $real_time;
|
||||
}
|
||||
function showtime ($start_time, &$s)
|
||||
{
|
||||
$dift_time2 = bcsub(gettime(), $start_time, 6);
|
||||
$s .= "Время $dift_time2 секунд";
|
||||
}
|
||||
/*Округление до сотых*/
|
||||
function rdf ($float)
|
||||
{
|
||||
return round($float * 100) / 100;
|
||||
}
|
||||
/*Вывод ошибки*/
|
||||
function error ($text)
|
||||
{
|
||||
echoScript("$('title').html('Произошла ошибка');");
|
||||
die("Произошла ошибка:<br><pre>$text</pre><a href='javascript:window.history.go(-1);'><b>Назад</b></a><hr><p align='right'>(c) <a href='../'>Анти Бойцовский клуб</a></p>");
|
||||
}
|
||||
?>
|
572
engline/functions/functions_info.php
Normal file
572
engline/functions/functions_info.php
Normal file
@ -0,0 +1,572 @@
|
||||
<?
|
||||
defined('AntiBK') or die("Доступ запрещен!");
|
||||
|
||||
/*Информация о персонаже*/
|
||||
class Info
|
||||
{
|
||||
public $guid;
|
||||
public $db;
|
||||
function& initialization ($guid, $adb)
|
||||
{
|
||||
$object = new Info;
|
||||
$object->guid = $guid;
|
||||
$object->db = $adb;
|
||||
return $object;
|
||||
}
|
||||
/*Получение информации о персонаже*/
|
||||
function getChar ()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$args_num = func_num_args();
|
||||
$guid = $this->guid;
|
||||
|
||||
$table = getTable($args[0]);
|
||||
unset($args[0]);
|
||||
|
||||
if ($args[1] == '*')
|
||||
return $this->db->selectRow("SELECT * FROM ?# WHERE `guid` = ?d", $table, $guid);
|
||||
else if ($args_num == 2)
|
||||
return $this->db->selectCell("SELECT ?# FROM ?# WHERE `guid` = ?d", $args, $table, $guid);
|
||||
else
|
||||
return $this->db->selectRow("SELECT ?# FROM ?# WHERE `guid` = ?d", $args, $table, $guid);
|
||||
}
|
||||
/*Получение информации о языке*/
|
||||
function getLang ()
|
||||
{
|
||||
$lang = $this->db->selectCell("SELECT `language` FROM `server_info`;");
|
||||
return $this->db->selectCol("SELECT `key` AS ARRAY_KEY, ?# FROM `server_language`;", $lang);
|
||||
}
|
||||
/*Проверка существования персонажа*/
|
||||
function Guid ()
|
||||
{
|
||||
if (checki($this->guid))
|
||||
error('Указанный персонаж не найден...');
|
||||
|
||||
$char_db = $this->getChar('char_db', 'guid');
|
||||
$char_stats = $this->getChar('char_stats', 'guid');
|
||||
$char_info = $this->getChar('char_info', 'guid');
|
||||
|
||||
if (!$char_db || !$char_stats || !$char_info)
|
||||
error('Указанный персонаж не найден...');
|
||||
}
|
||||
/*Проверка заключения персонажа*/
|
||||
function Prison ()
|
||||
{
|
||||
$prison = $this->getChar('char_db', 'prison');
|
||||
|
||||
if (!$prison || intval($prison - time()) > 0)
|
||||
return;
|
||||
|
||||
$this->db->query("UPDATE `characters` SET `prison` = '0' WHERE `guid` = ?d", $this->guid);
|
||||
}
|
||||
/*Проверка молчанки у персонажа*/
|
||||
function Shut ()
|
||||
{
|
||||
$chat_shut = $this->getChar('char_db', 'chat_shut');
|
||||
|
||||
if (!$chat_shut || $chat_shut > time())
|
||||
return;
|
||||
|
||||
$this->db->query("UPDATE `characters` SET `chat_shut` = '0' WHERE `guid` = ?d", $this->guid);
|
||||
}
|
||||
/*Восстановление здоровья/маны*/
|
||||
function Regen ()
|
||||
{
|
||||
if ($this->getChar('char_db', 'battle') != 0)
|
||||
return;
|
||||
|
||||
$char_stats = $this->getChar('char_stats', 'hp', 'hp_cure', 'hp_all', 'hp_regen', 'mp', 'mp_cure', 'mp_all', 'mp_regen');
|
||||
list($now["hp"], $cure["hp"], $all["hp"], $regen["hp"], $now["mp"], $cure["mp"], $all["mp"], $regen["mp"]) = array_values($char_stats);
|
||||
|
||||
foreach ($all as $key => $value)
|
||||
{
|
||||
if ($cure[$key] == 0 && $now[$key] < $value)
|
||||
{
|
||||
getCureValue($now[$key], $value, $regen[$key], $cure[$key]);
|
||||
$this->db->query("UPDATE `character_stats` SET ?# = ?d WHERE `guid` = ?d", $key.'_cure' ,$cure[$key] ,$this->guid);
|
||||
}
|
||||
else if ($cure[$key] == 0)
|
||||
continue;
|
||||
|
||||
$regenerated = getRegeneratedValue($value, ($cure[$key] - time()), $regen[$key]);
|
||||
if ($regenerated >= 0 && $regenerated < $value)
|
||||
$this->db->query("UPDATE `character_stats` SET ?# = ?d WHERE `guid` = ?d", $key ,$regenerated ,$this->guid);
|
||||
else
|
||||
{
|
||||
$this->db->query("UPDATE `character_stats` SET ?# = ?d, ?# = '0' WHERE `guid` = ?d", $key ,$value ,$key.'_cure' ,$this->guid);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*Проверка онлайн*/
|
||||
function Online ()
|
||||
{
|
||||
$last_time = $this->getChar('char_db', 'last_time');
|
||||
|
||||
if ((time() - $last_time) > 100)
|
||||
$this->db->query("DELETE FROM `online` WHERE `guid` = ?d", $this->guid);
|
||||
}
|
||||
/*Отображение дополнительной характеристики*/
|
||||
function showStatAddition ()
|
||||
{
|
||||
global $added;
|
||||
$added = array('str' => 0, 'dex' => 0, 'con' => 0, 'int' => 0);
|
||||
$rows = $this->db->select("SELECT `i`.`add_str`, `c`.`inc_str`,
|
||||
`i`.`add_dex`, `c`.`inc_dex`,
|
||||
`i`.`add_con`, `c`.`inc_con`,
|
||||
`i`.`add_int`, `c`.`inc_int`
|
||||
FROM `character_inventory` AS `c`
|
||||
LEFT JOIN `item_template` AS `i`
|
||||
ON `c`.`item_entry` = `i`.`entry`
|
||||
WHERE `c`.`guid` = ?d
|
||||
and `c`.`wear` = '1';", $this->guid);
|
||||
foreach ($rows as $dat)
|
||||
{
|
||||
$added['str'] += $dat['add_str'] + $dat['inc_str'];
|
||||
$added['dex'] += $dat['add_dex'] + $dat['inc_dex'];
|
||||
$added['con'] += $dat['add_con'] + $dat['inc_con'];
|
||||
$added['int'] += $dat['add_int'] + $dat['inc_int'];
|
||||
}
|
||||
$rows = $this->db->select("SELECT `stats` FROM `character_travms` WHERE `guid` = ?d and `stats` != '';", $this->guid);
|
||||
foreach ($rows as $travm)
|
||||
{
|
||||
$stats = split(",", $travm['stats']);
|
||||
foreach ($stats as $stat)
|
||||
{
|
||||
$stat = split("=", $stat);
|
||||
|
||||
if (array_key_exists($stat[0], $added))
|
||||
$added[$stat[0]] += -$stat[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
/*Отображение снаряжения*/
|
||||
function showCharacter ()
|
||||
{
|
||||
$char_equip = $this->getChar('char_equip', '*');
|
||||
$char_db = $this->getChar('char_db', 'login', 'shape', 'block');
|
||||
$char_stats = $this->getChar('char_stats', 'hp', 'hp_all', 'hp_regen', 'mp', 'mp_all', 'mp_regen');
|
||||
$char_feat = array_merge($char_db, $char_stats);
|
||||
$char_feat['name'] = "alt='$char_feat[login]'";
|
||||
$char_equip['armor'] = ($char_equip['cloak']) ?$char_equip['cloak'] :(($char_equip['armor']) ?$char_equip['armor'] :$char_equip['shirt']);
|
||||
$char_equip['hand_l_s'] = (!$char_equip['hand_l_free']) ?"hand_l" :"hand_l_f";
|
||||
|
||||
echo $this->getLogin();
|
||||
echo "<div style='height: 5px;'></div>";
|
||||
echo $this->getCharacterEquipped($char_equip, $char_feat);
|
||||
echoScript("showHP($char_feat[hp], $char_feat[hp_all], $char_feat[hp_regen]);".
|
||||
"showMP($char_feat[mp], $char_feat[mp_all], $char_feat[mp_regen]);");
|
||||
}
|
||||
/*Получение одетых вещей*/
|
||||
function getCharacterEquipped ($char_equip, $char_feat)
|
||||
{
|
||||
if (!$char_equip || !$char_feat)
|
||||
return;
|
||||
|
||||
$effects = $this->getEffects();
|
||||
$equipped = "<table border='0' width='227' class='posit' cellspacing='0' cellpadding='0'>";
|
||||
|
||||
if ($char_feat['block'])
|
||||
$equipped .= "<tr><td colspan='3' align='center'><b><font color='#FF0000'>Персонаж заблокирован!</font></b></td></tr>";
|
||||
|
||||
$equipped .= "<tr bgColor='#dedede'>"
|
||||
. "<td width='60' align='left' valign='top'>"
|
||||
. $this->getItemEquiped($char_equip['helmet'], "helmet")
|
||||
. $this->getItemEquiped($char_equip['bracer'], "bracer")
|
||||
. $this->getItemEquiped($char_equip['hand_r'], "hand_r")
|
||||
. $this->getItemEquiped($char_equip['armor'], "armor")
|
||||
. $this->getItemEquiped($char_equip['belt'], "belt")
|
||||
. "</td>"
|
||||
. "<td width='120' height='220' align='center' valign='middle'><table cellspacing='0' cellpadding='0'>"
|
||||
. "<tr height='20'><td style='font-size: 9px; position: relative;'><div id='HP'></div><div id='MP'></div></td></tr>"
|
||||
. "<tr height='220'><td><div style='position: relative; z-index: 1; width: 120px; height: 220px;'><img src='img/chars/$char_feat[shape]' $char_feat[name]>$effects</div></td></tr>"
|
||||
. "<tr height='40'><td><img src='img/items/slot_bottom0.gif' border='0'></td></tr>"
|
||||
. "</table></td>"
|
||||
. "<td width='60' align='right' valign='top'>"
|
||||
. $this->getItemEquiped($char_equip['earring'], "earring")
|
||||
. $this->getItemEquiped($char_equip['amulet'], "amulet")
|
||||
. $this->getItemEquiped($char_equip['ring1'], "ring")
|
||||
. $this->getItemEquiped($char_equip['ring2'], "ring")
|
||||
. $this->getItemEquiped($char_equip['ring3'], "ring")
|
||||
. $this->getItemEquiped($char_equip['gloves'], "gloves")
|
||||
. $this->getItemEquiped($char_equip['hand_l'], $char_equip['hand_l_s'])
|
||||
. $this->getItemEquiped($char_equip['pants'], "pants")
|
||||
. $this->getItemEquiped($char_equip['boots'], "boots")
|
||||
. "</td></tr></table>";
|
||||
return $equipped;
|
||||
}
|
||||
/*Получение отображаемых эффектов*/
|
||||
function getEffects ()
|
||||
{
|
||||
$i = 1;
|
||||
$left = 0;
|
||||
$top = 0;
|
||||
$return = '';
|
||||
$lang = $this->getLang();
|
||||
$travms = $this->db->select("SELECT * FROM `character_travms` AS `c` LEFT JOIN `player_travms` AS `i` ON `c`.`travm_id` = `i`.`id` WHERE `c`.`guid` = ?d and `c`.`stats` != '';", $this->guid);
|
||||
foreach ($travms as $travm)
|
||||
{
|
||||
$name = (isset($lang['travm_p_'.$travm['power']])) ?$lang['travm_p_'.$travm['power']].' ('.$travm['name'].')' :$travm['name'];
|
||||
$stats = ($travm['type'] == 1) ?'<br>У персонажа '.lowercase($lang['travm_p_'.$travm['power']]).' - ослаблены характеристики.' :'';
|
||||
$modifiers = split(",", $travm['stats']);
|
||||
foreach ($modifiers as $modifier)
|
||||
{
|
||||
$stat = split("=", $modifier);
|
||||
$stats .= '<br>'.$lang[$stat[0]].' -'.$stat[1];
|
||||
}
|
||||
$end_time = 'Осталось: '.getFormatedTime($travm['end_time']);
|
||||
$img = ($travm['type'] == 0) ?'' :$travm['power'];
|
||||
$return .= "<img src='img/icon/effects/eff_travma$img.gif' style='position: absolute; left: {$left}px; top: {$top}px; z-index: 100;' alt='<u><b>$name</b></u> (Эффект)<br>$end_time<br>$stats' width='36' height='23'>";
|
||||
$left += 36;
|
||||
|
||||
if ($i % 3 == 0)
|
||||
{
|
||||
$top += 23;
|
||||
$left = 0;
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
/*Получение изображения предмета, одетого на персонажа*/
|
||||
function getItemEquiped ($item_id, $i_type)
|
||||
{
|
||||
$lang = $this->getLang();
|
||||
$image = $this->db->selectRow("SELECT `width`, `height`, `default`, `low_level`, `level` FROM `server_images` WHERE `name` = ?s", 'item_'.$i_type);
|
||||
$default = "<img src='img/items/$image[default]' width='$image[width]' height='$image[height]' border='0' alt='".$lang[$i_type.'_f']."'>";
|
||||
|
||||
if (!is_numeric($item_id))
|
||||
return $default;
|
||||
|
||||
$level = $this->getChar('char_db', 'level');
|
||||
|
||||
if ($item_id == 0 && $level < $image['level'])
|
||||
return "<img src='img/items/$image[low_level]' width='$image[width]' height='$image[height]' border='0' alt='".$lang[$i_type.'_l']."'>";
|
||||
else if ($item_id == 0)
|
||||
return $default;
|
||||
|
||||
$color = '';
|
||||
$img = $image['default'];
|
||||
$desc = $this->getItemAlt($item_id, $color, $img);
|
||||
|
||||
if (!$desc)
|
||||
return $default;
|
||||
|
||||
$slot = $this->getItemSlot($item_id);
|
||||
return "<img src='img/items/$img' width='$image[width]' height='$image[height]' border='0' alt='$desc'$color>";
|
||||
}
|
||||
/*Получение всплывающей подсказки о предмете*/
|
||||
function getItemAlt ($item_id, &$color = '', &$img = '')
|
||||
{
|
||||
if (checki($item_id))
|
||||
return '';
|
||||
|
||||
$lang = $this->getLang();
|
||||
$i_info = $this->db->selectRow("SELECT `c`.`tear_cur`, `c`.`tear_max`,
|
||||
`i`.`attack`, `i`.`brick`,
|
||||
`i`.`name`, `i`.`img`,
|
||||
`i`.`add_hp`, `i`.`add_mp`,
|
||||
`i`.`def_h`, `i`.`def_a`,
|
||||
`i`.`def_b`, `i`.`def_l`
|
||||
FROM `character_inventory` AS `c`
|
||||
LEFT JOIN `item_template` AS `i`
|
||||
ON `c`.`item_entry` = `i`.`entry`
|
||||
WHERE `c`.`guid` = ?d
|
||||
and `c`.`id` = ?d", $this->guid, $item_id);
|
||||
if (!$i_info)
|
||||
return '';
|
||||
|
||||
$img = $i_info['img'];
|
||||
$tear_check = ($i_info['tear_cur'] >= $i_info['tear_max'] * 0.90);
|
||||
$tear_show = ($tear_check) ?'<font color=#990000>%s</font>' :'%s';
|
||||
$color = ($tear_check) ?" class='broken'" :'';
|
||||
$def = array('h', 'a', 'b', 'l');
|
||||
$desc = $i_info['name'];
|
||||
|
||||
if ($i_info['attack'] > 0)
|
||||
$desc .= "<br>$lang[damage] $i_info[attack] - ".($i_info['attack'] + $i_info['brick']);
|
||||
|
||||
$desc .= "<br>$lang[durability] ".sprintf($tear_show, intval($i_info['tear_cur'])."/".ceil($i_info['tear_max']));
|
||||
return $desc;
|
||||
}
|
||||
/*Получение отформатированного кубика*/
|
||||
private function getFormatedBrick ($min, $brick)
|
||||
{
|
||||
$first = $min - 1;
|
||||
$second = $brick + 1;
|
||||
if ($min == 1) return "(d$second)";
|
||||
if ($brick == 0) return '';
|
||||
if ($min <= 0) return '';
|
||||
return "($first+d$second)";
|
||||
}
|
||||
/*Получение слота в который одет предмет*/
|
||||
function getItemSlot ($item_id)
|
||||
{
|
||||
if (checki($item_id))
|
||||
return;
|
||||
|
||||
$char_equip = $this->getChar('char_equip', 'helmet', 'bracer', 'hand_r', 'armor', 'shirt', 'cloak', 'belt', 'earring', 'amulet', 'ring1', 'ring2', 'ring3', 'gloves', 'hand_l', 'pants', 'boots');
|
||||
foreach ($char_equip as $key => $value)
|
||||
{
|
||||
if ($item_id == $value)
|
||||
return $key;
|
||||
}
|
||||
return;
|
||||
}
|
||||
/*Показ строки персонажа*/
|
||||
function getLogin ()
|
||||
{
|
||||
$char_db = $this->getChar('char_db', 'login', 'level', 'orden', 'clan', 'clan_short', 'rang');
|
||||
list($login, $level, $orden, $clan_f, $clan_s, $rang) = array_values($char_db);
|
||||
switch ($orden)
|
||||
{
|
||||
case 1: $orden_img = "<img src='img/orden/pal/$rang.gif' width='12' height='15' border='0' title='Белое братство'>"; break;
|
||||
case 2: $orden_img = "<img src='img/orden/arm/$rang.gif' width='12' height='15' border='0' title='Темное братство'>"; break;
|
||||
case 3: $orden_img = "<img src='img/orden/3.gif' width='12' height='15' border='0' title='Нейтральное братство'>"; break;
|
||||
case 4: $orden_img = "<img src='img/orden/4.gif' width='12' height='15' border='0' title='Алхимик'>"; break;
|
||||
case 5: $orden_img = "<img src='img/orden/5.gif' width='12' height='15' border='0' title='Хаос'>"; break;
|
||||
default: $orden_img = ""; break;
|
||||
}
|
||||
$clan = ($clan_s != '') ?"<img src='img/clan/$clan_s.gif' border='0' title='$clan_f'>" :"";
|
||||
$login_link = str_replace(" ", "%20", $login);
|
||||
$login_info = "<a href='info.php?log=$login_link' target='_blank'><img src='img/inf.gif' border='0' title='Инф. о $login'></a>";
|
||||
return "<img src='img/icon/lock3.gif' border='0' onclick=\"window.opener.top.AddToPrivate('$login',true);\" style='cursor: pointer;'>$orden_img$clan<b>$login</b> [$level]$login_info";
|
||||
}
|
||||
/*Показ дополнительной информации по персонажу*/
|
||||
function showInfDetail ()
|
||||
{
|
||||
$char_db = $this->getChar('char_db', 'dealer', 'sex', 'block', 'block_reason', 'chat_shut', 'prison', 'prison_reason');
|
||||
$lang = $this->getLang();
|
||||
echo ($char_db['dealer']) ?"<img src='img/alchemy1.gif' alt='Регистрированный алхимик. Имеет право продавать услуги Анти Бойцовского Клуба.' height='24' width='35'><br>" :""; /*Дилер*/
|
||||
echo ($char_db['block']) ?"Причина блока :<br><b><font class='private'>$char_db[block_reason]</font></b><br>" :""; /*Блок*/
|
||||
echo ($char_db['chat_shut']) ?"<img src='img/icon/sleeps$char_db[sex].gif'><small>На персонажа наложено заклятие молчания. Будет молчать еще ".getFormatedTime($char_db['chat_shut'])."</small><br>" :""; /*Молчанка*/
|
||||
echo ($char_db['prison']) ?"<img src='img/icon/jail.png'><small>В заточении еще ".getFormatedTime($char_db['prison'])."</small><br><br>Сообщение от юстициары:<br><b><font class='private'>$char_db[prison_reason]</font></b><br>" :""; /*Тюрьма*/
|
||||
/*Травма*/
|
||||
$travms = $this->db->select("SELECT *
|
||||
FROM `character_travms` AS `c`
|
||||
LEFT JOIN `player_travms` AS `i`
|
||||
ON `c`.`travm_id` = `i`.`id`
|
||||
WHERE `c`.`guid` = ?d", $this->guid);
|
||||
foreach ($travms as $travm)
|
||||
{
|
||||
$format = '<br><img src="img/icon/travma2.gif"><small>%1$s</small>';
|
||||
switch ($travm['type'])
|
||||
{
|
||||
case 0:
|
||||
if ($travm['id'] == 100)
|
||||
printf($format, "Персонаж ослаблен из-за смерти в бою, еще ".getFormatedTime($travm['end_time']));
|
||||
else if ($travm['id'] == 1)
|
||||
printf($format, "<span alt='Не может драться, перемещаться и передавать предметы'>У персонажа тяжелая травма, <b>\"$travm[name]\"</b> еще ".getFormatedTime($travm['end_time'])."</span>");
|
||||
break;
|
||||
case 1:
|
||||
$alt = ($travm['power'] == 5) ?"Не может драться, перемещаться и передавать предметы" :"Ослаблены характеристики";
|
||||
printf($format, "<span alt='$alt'>У персонажа ".lowercase($lang['travm_p_'.$travm['power']])." - <b>\"$travm[name]\"</b> еще ".getFormatedTime($travm['end_time'])."</span>");
|
||||
break;
|
||||
case 2:
|
||||
$format = '<br><img src="img/icon/mtravma2.gif"><small>%1$s</small>';
|
||||
printf($format, "У персонажа магическая травма, еще ".getFormatedTime($travm['end_time']));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*Получение информации о городе*/
|
||||
function getCity ()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$args_num = func_num_args();
|
||||
$city = $args[0];
|
||||
unset($args[0]);
|
||||
|
||||
if ($args_num == 2)
|
||||
return $this->db->selectCell("SELECT ?# FROM `server_cities` WHERE `city` = ?s", $args, $city);
|
||||
else
|
||||
return $this->db->selectRow("SELECT ?# FROM `server_cities` WHERE `city` = ?s", $args, $city);
|
||||
}
|
||||
/*Получение информации о комнате*/
|
||||
function getRoom ()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$args_num = func_num_args();
|
||||
$room = $args[0];
|
||||
$city = $this->getCity($args[1], 'flag');
|
||||
unset($args[0], $args[1]);
|
||||
|
||||
if ($args_num == 3)
|
||||
return $this->db->selectCell("SELECT ?# FROM `city_rooms` WHERE `room` = ?s and `city` & ?d", $args, $room, $city);
|
||||
else
|
||||
return $this->db->selectRow("SELECT ?# FROM `city_rooms` WHERE `room` = ?s and `city` & ?d", $args, $room, $city);
|
||||
}
|
||||
}
|
||||
/*Вывод js скрипта*/
|
||||
function echoScript ($str, $die = false)
|
||||
{
|
||||
echo "<script>$str</script>";
|
||||
if ($die)
|
||||
die();
|
||||
}
|
||||
/*Преобразование массива в переменные*/
|
||||
function ArrToVar ($arr, $pref = '')
|
||||
{
|
||||
foreach ($arr as $key => $value)
|
||||
{
|
||||
$var = (empty($pref)) ?$key :$pref.$key;
|
||||
global ${$var};
|
||||
${$var} = $value;
|
||||
}
|
||||
}
|
||||
/*Получение времени восстановления здоровья*/
|
||||
function getCureValue ($now, $all, $regen, &$value)
|
||||
{
|
||||
$value = intval(30000*($all-$now)/($all*$regen)) + time();
|
||||
}
|
||||
/*Получение количества восстановленного здоровья*/
|
||||
function getRegeneratedValue ($all, $cure, $regen)
|
||||
{
|
||||
return ($all - intval(0.0001*$all*$cure*$regen/3));
|
||||
}
|
||||
/*Получение отформатированного времени*/
|
||||
function getFormatedTime ($timestamp)
|
||||
{
|
||||
if (!$timestamp)
|
||||
return "0 сек.";
|
||||
|
||||
if (!is_numeric($timestamp))
|
||||
$timestamp = time();
|
||||
|
||||
$seconds = ($timestamp > time()) ?$timestamp - time() :time() - $timestamp;
|
||||
$seconds = ($seconds > 0) ?$seconds :0;
|
||||
$y = intval($seconds / 31536000);
|
||||
$seconds %= 31536000;
|
||||
$m = intval($seconds / 2592000);
|
||||
$seconds %= 2592000;
|
||||
$d = intval($seconds / 86400);
|
||||
$seconds %= 86400;
|
||||
$h = intval($seconds / 3600);
|
||||
$seconds %= 3600;
|
||||
$n = intval($seconds / 60);
|
||||
$seconds %= 60;
|
||||
$s = $seconds;
|
||||
|
||||
if ($y && $m == 0) return "$y г.";
|
||||
if ($y) return "$y г. $m мес.";
|
||||
if ($m && $d == 0) return "$m мес.";
|
||||
if ($m) return "$m мес. $d дн.";
|
||||
if ($d && $h == 0) return "$d дн.";
|
||||
if ($d) return "$d дн. $h ч.";
|
||||
if ($h && $n == 0) return "$h ч.";
|
||||
if ($h) return "$h ч. $n мин.";
|
||||
if ($n && $s == 0) return "$n мин.";
|
||||
if ($n) return "$n мин. $s сек.";
|
||||
return "$s сек.";
|
||||
}
|
||||
/*Получение цвета улучшения*/
|
||||
function getColor ($cur, $add)
|
||||
{
|
||||
$diff = ($add > 0) ?(1 - (($cur - $add) / $cur)) * 255 :($add < 0) ?(1 -(($cur - $add*(-1)) / $cur)) * 255 :-50;
|
||||
$diff = abs (intval ($diff)) + 50;
|
||||
|
||||
if ($diff > 150 && $add > 0) return "#00AA00";
|
||||
if ($diff > 150 && $add < 0) return "#AA0000";
|
||||
if ($add > 0) return "RGB(0, $diff, 0)";
|
||||
if ($add < 0) return "RGB($diff, 0, 0)";
|
||||
return "RGB(0, 0, 0)";
|
||||
}
|
||||
/*Получение разбивки статов*/
|
||||
function getBraces ($stat, $added_stat, $type = '')
|
||||
{
|
||||
if ($added_stat > 0) return " <small>(<font id='inst_$type'>".($stat-$added_stat)."</font> + $added_stat)</small>";
|
||||
if ($added_stat < 0) return " <small>(<font id='inst_$type'>".($stat-$added_stat)."</font> - ".abs($added_stat).")</small>";
|
||||
}
|
||||
/*Error log function*/
|
||||
function databaseErrorHandler ($message, $info)
|
||||
{
|
||||
if (!error_reporting())
|
||||
return;
|
||||
|
||||
echo "<table class = report>";
|
||||
echo "<tbody>";
|
||||
echo "<tr><td>SQL Error: $message<br><pre>".print_r($info, true)."</pre></td></tr>";
|
||||
echo "</tbody>";
|
||||
echo "</table>";
|
||||
}
|
||||
/*Получение переменной GET, POST и COOKIE*/
|
||||
function getVar ($var, $stand = '', $flags = 3)
|
||||
{
|
||||
if (isset($_GET[$var]) && ($flags & 1))
|
||||
$value = $_GET[$var];
|
||||
else if (isset($_POST[$var]) && ($flags & 2))
|
||||
$value = $_POST[$var];
|
||||
else if (isset($_COOKIE[$var]) && ($flags & 4))
|
||||
$value = $_COOKIE[$var];
|
||||
else
|
||||
return $stand;
|
||||
|
||||
if (is_numeric($stand) && is_numeric($value)) return ($flags & 8) ?rdf($value) :$value;
|
||||
else if (!is_numeric($stand)) return htmlspecialchars($value);
|
||||
else return $stand;
|
||||
}
|
||||
/*Получение место перехода*/
|
||||
function toIndex ()
|
||||
{
|
||||
echoScript("location.href = 'index.php';", true);
|
||||
}
|
||||
/*Проверка существования и правильного формата числа*/
|
||||
function checki ($int)
|
||||
{
|
||||
return (!is_numeric($int) || $int == 0);
|
||||
}
|
||||
/*Получение названия таблицы*/
|
||||
function getTable ($name)
|
||||
{
|
||||
switch ($name)
|
||||
{
|
||||
case 'char_db': return 'characters';
|
||||
case 'char_stats': return 'character_stats';
|
||||
case 'char_info': return 'character_info';
|
||||
case 'char_equip': return 'character_equip';
|
||||
case 'char_bars': return 'character_bars';
|
||||
}
|
||||
}
|
||||
/*Преобразование русско-язычной строки в нижний и верхний регистр*/
|
||||
define('UPCASE', 'АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯABCDEFGHIKLMNOPQRSTUVWXYZ');
|
||||
define('LOCASE', 'абвгдеёжзийклмнопрстуфхцчшщъыьэюяabcdefghiklmnopqrstuvwxyz');
|
||||
|
||||
function mb_str_split ($str)
|
||||
{
|
||||
preg_match_all('/.{1}|[^\x00]{1}$/us', $str, $ar);
|
||||
return $ar[0];
|
||||
}
|
||||
function mb_strtr ($str, $from, $to)
|
||||
{
|
||||
return str_replace(mb_str_split($from), mb_str_split($to), $str);
|
||||
}
|
||||
function lowercase ($arg = '')
|
||||
{
|
||||
return mb_strtr($arg, UPCASE, LOCASE);
|
||||
}
|
||||
function uppercase ($arg = '')
|
||||
{
|
||||
return mb_strtr($arg, LOCASE, UPCASE);
|
||||
}
|
||||
/*Определение знака зодиака (Неиспользуется)
|
||||
function getZodiac ($birthday)
|
||||
{
|
||||
$b = split('\.', $birthday);
|
||||
$zodiac = array('1.3.21.4.20', '2.4.21.5.20', '3.5.21.6.20', '4.6.21.7.22', '5.7.23.8.22', '6.8.23.9.23', '7.9.24.10.23', '8.10.24.11.21', '9.11.22.12.21', '10.12.22.1.19', '11.1.20.2.18', '12.2.19.3.20');
|
||||
foreach ($zodiac as $value)
|
||||
{
|
||||
$d = split('\.', $value);
|
||||
|
||||
if (($b[1] == $d[1] && $b[0] >= $d[2] && $b[0] <= 31) || ($b[1] == $d[3] && $b[0] >= 1 && $b[0] <= $d[4]))
|
||||
return $d[0];
|
||||
}
|
||||
}*/
|
||||
/*Вывод ошибки*/
|
||||
function error ($text)
|
||||
{
|
||||
echoScript("$('title').html('Произошла ошибка');");
|
||||
echoScript("$('link[rel=StyleSheet]').remove();");
|
||||
die("Произошла ошибка:<br><pre>$text</pre><a href='javascript:window.history.go(-1);'><b>Назад</b></a><hr><p align='right'>(c) <a href='../'>Анти Бойцовский клуб</a></p>");
|
||||
}
|
||||
?>
|
53
engline/secpic.php
Normal file
53
engline/secpic.php
Normal file
@ -0,0 +1,53 @@
|
||||
<?
|
||||
session_start();
|
||||
|
||||
$width = 157; //Øèðèíà èçîáðàæåíèÿ
|
||||
$height = 49; //Âûñîòà èçîáðàæåíèÿ
|
||||
$font_size = 13; //Ðàçìåð øðèôòà
|
||||
$let_amount = 6; //Êîëè÷åñòâî ñèìâîëîâ, êîòîðûå íóæíî íàáðàòü
|
||||
$fon_let_amount = 30; //Êîëè÷åñòâî ñèìâîëîâ, êîòîðûå íàõîäÿòñÿ íà ôîíå
|
||||
$path_fonts = '../fonts/'; //Ïóòü ê øðèôòàì
|
||||
|
||||
|
||||
$letters = array('0','1','2','3','4','5','6','7','9');
|
||||
$colors = array('0');
|
||||
|
||||
$src = imagecreatetruecolor($width, $height);
|
||||
$fon = imagecolorallocate($src, 200, 200, 200);
|
||||
imagefill($src, 0, 0, $fon);
|
||||
|
||||
$fonts = array();
|
||||
$dir = opendir($path_fonts);
|
||||
while($fontName = readdir($dir))
|
||||
{
|
||||
if($fontName != "." && $fontName != "..")
|
||||
$fonts[] = $fontName;
|
||||
}
|
||||
closedir($dir);
|
||||
|
||||
for ($i = 0; $i<$fon_let_amount; $i++)
|
||||
{
|
||||
$color = imagecolorallocatealpha($src, rand(0,255), rand(0,255), rand(0,255), 100);
|
||||
$font = $path_fonts.$fonts[rand(0,sizeof($fonts)-1)];
|
||||
$letter = $letters[rand(0,sizeof($letters)-1)];
|
||||
$size = rand($font_size-2,$font_size+2);
|
||||
imagettftext($src, $size, rand(0,45), rand($width*0.1,$width-$width*0.1), rand($height*0.2,$height), $color, $font, $letter);
|
||||
}
|
||||
|
||||
for ($i = 0; $i<$let_amount; $i++)
|
||||
{
|
||||
$color = imagecolorallocatealpha($src, $colors[rand(0,sizeof($colors)-1)], $colors[rand(0,sizeof($colors)-1)], $colors[rand(0,sizeof($colors)-1)], rand(0,50));
|
||||
$font = $path_fonts.$fonts[rand(0,sizeof($fonts)-1)];
|
||||
$letter = $letters[rand(0,sizeof($letters)-1)];
|
||||
$size = rand($font_size*2.1-2, $font_size*2.1+2);
|
||||
$x = ($i == 0) ?$font_size + rand(5,10) :$x + $font_size + rand(-5,10);
|
||||
$y = (($height*2)/3) + rand(-5,15);
|
||||
$cod[] = $letter;
|
||||
imagettftext($src, $size, rand(0,15), $x, $y, $color, $font, $letter);
|
||||
}
|
||||
|
||||
$_SESSION['secpic'] = implode('', $cod);
|
||||
|
||||
header("Content-type: image/gif");
|
||||
imagegif($src);
|
||||
?>
|
7
engline/token/bootstrap.php
Normal file
7
engline/token/bootstrap.php
Normal file
@ -0,0 +1,7 @@
|
||||
<?
|
||||
if (!function_exists("getallheaders"))
|
||||
include(dirname(__FILE__)."/headers.function.php");
|
||||
|
||||
require_once(dirname(__FILE__)."/lpg.headers.function.php");
|
||||
require_once(dirname(__FILE__)."/lpg.csrf.token.php");
|
||||
?>
|
12
engline/token/headers.function.php
Normal file
12
engline/token/headers.function.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?
|
||||
function getallheaders ()
|
||||
{
|
||||
$headers = array();
|
||||
foreach ($_SERVER as $h => $v)
|
||||
{
|
||||
if (preg_match_all('/HTTP_(.+)/', $h, $hp))
|
||||
$headers[$hp[1][0]] = $v;
|
||||
}
|
||||
return $headers;
|
||||
}
|
||||
?>
|
27
engline/token/lpg.csrf.token.php
Normal file
27
engline/token/lpg.csrf.token.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?
|
||||
function create_token ($token_key)
|
||||
{
|
||||
$_SESSION['token'] = md5(time().$_SERVER['REMOTE_ADDR'].$_SERVER['HTTP_USER_AGENT'].$token_key);
|
||||
}
|
||||
|
||||
function lpg_csrf_token ($token_key, $expire_time = 5)
|
||||
{
|
||||
$headers = lpg_getallheaders();
|
||||
|
||||
if (isset($headers['X-CSRF-TOKEN']) && isset($headers['X-REQUESTED-WITH']) && ($headers['X-REQUESTED-WITH'] == 'XMLHttpRequest'))
|
||||
{
|
||||
$token = trim($headers['X-CSRF-TOKEN']);
|
||||
if ($token == '' || $token != $_SESSION['token'])
|
||||
{
|
||||
error_log("[LPG_CSRF_TOKEN] Warning: CSRF Attempt! Ajax attack from site: ".(isset($_SERVER['HTTP_REFERER']) ?$_SERVER['HTTP_REFERER'] :'This site!'));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
error_log("[LPG_CSRF_TOKEN] Warning: CSRF Attempt! Ajax attack from site: ".(isset($_SERVER['HTTP_REFERER']) ?$_SERVER['HTTP_REFERER'] :'This site!'));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
?>
|
12
engline/token/lpg.headers.function.php
Normal file
12
engline/token/lpg.headers.function.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?
|
||||
function lpg_getallheaders ()
|
||||
{
|
||||
$arr = getallheaders();
|
||||
$up_arr = array();
|
||||
|
||||
foreach ($arr as $key => $value)
|
||||
$up_arr[str_replace('_', '-', strtoupper($key))] = $value;
|
||||
|
||||
return $up_arr;
|
||||
}
|
||||
?>
|
78
enter.php
Normal file
78
enter.php
Normal file
@ -0,0 +1,78 @@
|
||||
<?
|
||||
session_start();
|
||||
define('AntiBK', true);
|
||||
|
||||
include("engline/config.php");
|
||||
include("engline/dbsimple/Generic.php");
|
||||
include("engline/functions/functions.php");
|
||||
|
||||
$adb = DbSimple_Generic::connect($database['adb']);
|
||||
$adb->query("SET NAMES ? ",$database['db_encoding']);
|
||||
$adb->setErrorHandler("databaseErrorHandler");
|
||||
|
||||
$login = getVar('login', '', 2);
|
||||
$password = getVar('password', '', 2);
|
||||
|
||||
$enter = $adb->selectCell("SELECT `login` FROM `server_info`;");
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta http-equiv="Content-Language" content="ru" />
|
||||
<title>Анти Бойцовский Клуб</title>
|
||||
<link rel="SHORTCUT ICON" href="img/favicon.ico" />
|
||||
<script src="scripts/jquery.js" type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
if (!(/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)))
|
||||
{
|
||||
alert('Поддерживается только браузер Mozilla Firefox');
|
||||
location.href = 'index.php';
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body bgcolor="#ffffff">
|
||||
<?
|
||||
if (!$enter)
|
||||
error('Сервер оффлайн');
|
||||
else if (empty($login))
|
||||
error('Вы не ввели логин');
|
||||
else if (empty($password))
|
||||
error('Укажите пароль');
|
||||
|
||||
$char_info = $adb->selectRow("SELECT `guid`,
|
||||
`password`,
|
||||
`city`,
|
||||
`block`,
|
||||
`room`,
|
||||
`city`
|
||||
FROM `characters`
|
||||
WHERE `login` = ?s", $login) or error("Логин \"$login\" не найден в базе.");
|
||||
|
||||
$guid = $char_info['guid'];
|
||||
|
||||
$char = Char::initialization($guid, $adb);
|
||||
|
||||
if (SHA1($guid.':'.$password) != $char_info['password'])
|
||||
{
|
||||
$char->history->Auth(0, $char_info['city'], 'wrong_password');
|
||||
error("Неверный пароль для \"$login\". Введите логин/пароль на <a href='index.php'>титульной странице");
|
||||
}
|
||||
else if ($char_info['block'])
|
||||
{
|
||||
$char->history->Auth(0, $char_info['city'], 'blocked');
|
||||
error("Внимание!!! Персонаж $login заблокирован!");
|
||||
}
|
||||
|
||||
if (checks('guid'))
|
||||
deleteSession();
|
||||
|
||||
$adb->query("DELETE FROM `online` WHERE `guid` = ?d", $guid);
|
||||
$adb->query("INSERT INTO `online` (`guid`, `login_display`, `sid`, `city`, `room`, `last_time`)
|
||||
VALUES (?d, ?s, ?s, ?s, ?s, ?d);", $guid, $login, session_id(), $char_info['city'], $char_info['room'], time());
|
||||
$char->setChar('char_db', array('last_go' => time()));
|
||||
$_SESSION['guid'] = $guid;
|
||||
$char->history->Auth(1, $char_info['city']);
|
||||
echoScript("location.href = 'game.php';");
|
||||
?>
|
||||
</body>
|
||||
</html>
|
BIN
fonts/cour.ttf
Normal file
BIN
fonts/cour.ttf
Normal file
Binary file not shown.
156
forum/index.php
Normal file
156
forum/index.php
Normal file
@ -0,0 +1,156 @@
|
||||
<?
|
||||
session_start();
|
||||
define('AntiBK', true);
|
||||
|
||||
include("../engline/config.php");
|
||||
include("../engline/dbsimple/Generic.php");
|
||||
include("../engline/functions/functions.php");
|
||||
|
||||
$adb = DbSimple_Generic::connect($database['adb']);
|
||||
$adb->query("SET NAMES ? ",$database['db_encoding']);
|
||||
$adb->setErrorHandler("databaseErrorHandler");
|
||||
|
||||
$lang = getVar('lang', 'ru', 5);
|
||||
$lang = ($lang == 'ru' || $lang == 'en') ?$lang :'ru';
|
||||
$cat = getVar('cat', 1, 5);
|
||||
$cat = ($adb->selectRow("SELECT `id`, `main`, `name`, `text` FROM ?# WHERE `id` = ?d", "forum_menu_$lang", $cat)) ?$cat :1;
|
||||
$cat = ($cat == 2 && $lang == 'ru') ?28 :$cat;
|
||||
setCookie('lang', $lang, time() + 3600);
|
||||
setCookie('cat', $cat, time() + 3600);
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta http-equiv="Content-Language" content="<?echo $lang;?>" />
|
||||
<title>Анти Бойцовский Клуб</title>
|
||||
<link rel="SHORTCUT ICON" href="../img/favicon.ico" />
|
||||
<link href="../styles/main.css" rel="stylesheet" type="text/css" />
|
||||
<link href="../styles/forum.css" rel="stylesheet" type="text/css" />
|
||||
<script src="../scripts/jquery.js" type="text/javascript"></script>
|
||||
<script src="../scripts/forum.js" type="text/javascript"></script>
|
||||
</head>
|
||||
<body bgcolor="#3D3D3B" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
|
||||
<?
|
||||
$forum_menu = "forum_menu_$lang";
|
||||
$forum_topics = "forum_topics_$lang";
|
||||
$language = ($lang == "en") ?"<a href='?lang=ru&cat=1'>RU</a> | EN" :"RU | <a href='?lang=en&cat=1'>EN</a>";
|
||||
|
||||
$lang = $adb->selectCol("SELECT `key` AS ARRAY_KEY, ?# FROM `forum_language`;", $lang);
|
||||
$cat = $adb->selectRow("SELECT `id`, `main`, `prev`, `name`, `text` FROM ?# WHERE `id` = ?d", $forum_menu, $cat);
|
||||
|
||||
if (isset($_SESSION['guid']))
|
||||
$char = Char::initialization($_SESSION['guid'], $adb);
|
||||
?>
|
||||
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
|
||||
<thead><tr><td background="../img/forum/sitebk_02.jpg" align="center"><img src="../img/forum/sitebk_03ru.gif" width="194" height="135"></td></tr></thead>
|
||||
<tfoot>
|
||||
<tr><td width="100%" height="13" background="../img/forum/sitebk_07.jpg"></td></tr>
|
||||
<tr><td width="100%" bgColor="#000" height="20" align="center" class="copyright"><?echo $config['copyright'];?></td></tr>
|
||||
</tfoot>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td align="center" height="90%" valign="top">
|
||||
<table width="96%" height="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#f2e5b1">
|
||||
<tr valign="top">
|
||||
<td width="29" align="right" valign="top" style="background: url(../img/forum/n21_08_1.jpg) repeat-y;"><img src="../img/forum/fr_08.jpg"></td>
|
||||
<? if (!getVar('smile', 0, 1)) {?>
|
||||
<td width="200">
|
||||
<img src="../img/forum/fr_04.jpg"><br>
|
||||
<?echo (isset($char)) ?$char->getLogin() :$lang['nologin'];?><br>
|
||||
<?echo "$lang[lang]: ".$language;?><br><br>
|
||||
<b><span style="color: #8f0000; font-family: arial; font-size: 10pt;"><?echo $lang['conf'];?></span></b><br>
|
||||
<div style="background: url(../img/forum/ram12_34.gif); height: 11px; width: 100%;">
|
||||
<div style="background: url(../img/forum/ram12_33.gif) no-repeat left top;" width="12" height="11">
|
||||
<div align="right"><img src="../img/forum/ram12_35.gif" width="13" height="11"></div></div></div>
|
||||
<? $cats = $adb->select("SELECT `id`, `name` FROM ?# WHERE `main` = '0';", $forum_menu);
|
||||
foreach ($cats as $category)
|
||||
{
|
||||
echo "<b> <img src='../img/forum/ic_acc1.gif' width='10' height='10' title='$lang[onlyread]'> <a href='?cat=$category[id]'>$category[name]</a><br></b>";
|
||||
if ($cat['id'] == $category['id'] || $cat['main'] == $category['id'])
|
||||
{
|
||||
$scats = $adb->select("SELECT `id`, `name` FROM ?# WHERE `prev` = ?d", $forum_menu, $category['id']);
|
||||
foreach ($scats as $scat)
|
||||
{
|
||||
echo "<b> <img src='../img/forum/ic_acc1.gif' width='10' height='10' title='$lang[onlyread]'> <a href='?cat=$scat[id]'>$scat[name]</a><br></b>";
|
||||
if ($cat['id'] == $scat['id'] || $cat['main'] == $scat['id'] || $cat['prev'] == $scat['id'])
|
||||
{
|
||||
$sscats = $adb->select("SELECT `id`, `name` FROM ?# WHERE `prev` = ?d", $forum_menu, $scat['id']);
|
||||
foreach ($sscats as $sscat)
|
||||
echo "<b> <img src='../img/forum/ic_acc1.gif' width='10' height='10' title='$lang[onlyread]'> <a href='?cat=$sscat[id]'>$sscat[name]</a><br></b>";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?> <br>
|
||||
<div style="background: url(../img/forum/ram12_34.gif); height: 11px; width: 100%;">
|
||||
<div style="background: url(../img/forum/ram12_33.gif) no-repeat left top;" width="12" height="11">
|
||||
<div align="right"><img src="../img/forum/ram12_35.gif" width="13" height="11"></div></div></div><br>
|
||||
<center><a href="?smile=1"><img src="../img/forum/smiles/icon7.gif" title="<?echo $lang['smiles'];?>" width="15" height="15"></a></center><br>
|
||||
</td>
|
||||
<td width="70%">
|
||||
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td>
|
||||
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr><td><br><a href="../forum"><img src="../img/forum/formz_10.gif"></a><br><br><br></td></tr>
|
||||
<tr><td>
|
||||
<? echo "<h3>$lang[conf] \"$cat[name]\"</h3>"
|
||||
. "<p>$cat[text]</p>"
|
||||
. "<br>$lang[rss] <img src='../img/forum/rss.png' align='absmiddle'>";
|
||||
?> </td></tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<? } else {?>
|
||||
<td><img src="../img/forum/fr_04.jpg"><br></td>
|
||||
<td width="75%" align="center">
|
||||
<br><br><br>
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td align="left"><h2><?echo $lang['legal'];?></h2></td>
|
||||
<td align="left"><p><a href="../forum"><?echo $lang['home'];?></a><p></td>
|
||||
</tr>
|
||||
<tr><td colspan="2"><p><h4><?echo $lang['smilelimit'];?></h4></p> </td></tr>
|
||||
</table><br>
|
||||
<table cellpadding="5" cellspacing="0" class="smile_css">
|
||||
<tr>
|
||||
<? for ($i = 0; $i < 3; $i++)
|
||||
{
|
||||
echo "<td class='smile_css'> $lang[image] </td>"
|
||||
. "<td class='smile_css'> $lang[text] </td>"
|
||||
. "<td class='smile_css'> $lang[atext] </td>";
|
||||
}
|
||||
?> </tr>
|
||||
<tr>
|
||||
<? $smiles = $adb->select("SELECT `text`, `atext`, `img` FROM `forum_smiles`;");
|
||||
$i = 0;
|
||||
foreach ($smiles as $smile)
|
||||
{
|
||||
$i++;
|
||||
echo "<td class='smile_css'><img src='../img/forum/smiles/$smile[img]' /></td>"
|
||||
. "<td class='smile_css'>$smile[text]</td>"
|
||||
. "<td class='smile_css'>$smile[atext]</td>";
|
||||
if ($i == 3)
|
||||
{
|
||||
$i = 0;
|
||||
echo "</tr><tr>";
|
||||
}
|
||||
}
|
||||
?> </tr></table>
|
||||
<br>
|
||||
<div style="background: url(../img/forum/ram12_34.gif); height: 11px; width: 100%;">
|
||||
<div style="background: url(../img/forum/ram12_33.gif) no-repeat left top;" width="12" height="11">
|
||||
<div align="right"><img src="../img/forum/ram12_35.gif" width="13" height="11"></div></div></div><br>
|
||||
<? }?>
|
||||
</td>
|
||||
<td style="background: url(../img/forum/fr_15.jpg) no-repeat bottom;"><img src="../img/forum/forumru_03.jpg" border="0" valign="top"></td>
|
||||
<td width="23" valign="top" background="../img/forum/nnn21_03_1.jpg"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
345
forum/topics.php
Normal file
345
forum/topics.php
Normal file
@ -0,0 +1,345 @@
|
||||
<?
|
||||
|
||||
$f = addslashes($f);
|
||||
$topic = addslashes($topic);
|
||||
|
||||
$conf=mysql_fetch_array(mysql_query("SELECT title FROM forums where name='".$f."'"));
|
||||
echo"<br><center><B class=title><U>Форум :: \"".$conf['title']."\"</U></B></center><br>";
|
||||
|
||||
echo"<script language=JavaScript>
|
||||
function ins (text) {
|
||||
document.all.addtext.focus();
|
||||
document.all.addtext.value+= ''+text+''; }
|
||||
</script>";
|
||||
|
||||
|
||||
|
||||
$topics=mysql_fetch_array(mysql_query("SELECT * FROM topics where id='$topic'"));
|
||||
if (empty($topics['id'])) { $err="Указанная Вами тема не найдена!"; } else {
|
||||
|
||||
|
||||
// Разбиваем на страницы
|
||||
$numo = mysql_numrows(mysql_query("SELECT * FROM posts where top_id='$topic'")); // Число топиков в данной категории
|
||||
|
||||
if ($p=="" or $p=="0" or !isset($p)) { $p="1"; }
|
||||
|
||||
$np=15; // Число новостей на странице
|
||||
|
||||
$pages_count = @ceil($numo/$np); // Определяем число страниц
|
||||
|
||||
if (is_numeric($p)) {
|
||||
if ($p>$pages_count or $p<0) $p=1; // Если страница превышает макс. число, то открываем первую
|
||||
|
||||
elseif ($p!="1") { $min=$np; }} else $p=1;
|
||||
|
||||
$l1=$p*$np-$np;
|
||||
$l2=$np;
|
||||
|
||||
$pages = "";
|
||||
|
||||
for($i=1; $i<=$pages_count; $i++){
|
||||
if ($p != $i) $pages .= " <a href=?topic=$topic&f=$f&p=$i>[<b>$i</b>]</a>";
|
||||
else $pages .= " <b>[$i]</b>"; }
|
||||
//
|
||||
|
||||
$icon="<img src='".$img_server."/i/forum/".$topics['icon'].".gif'>"; // Иконка топа
|
||||
echo"<h4 title='Дата создания: ".$topics['date']."'>".$icon." ".$topics['title']."</h4>";
|
||||
|
||||
if ($p==0 || $p==1 || !isset($p)) {
|
||||
|
||||
echo"
|
||||
<TABLE width=95% cellspacing=0 cellpadding=0 border=0>
|
||||
<TR>
|
||||
<TD height=20 background='i/forum/";
|
||||
|
||||
if ($topics['fixed'] == 1)
|
||||
echo"fixed_line";
|
||||
else
|
||||
echo"standart_line";
|
||||
|
||||
echo".gif' valign=center>
|
||||
<TABLE cellspacing=0 cellpadding=0 width=100%>
|
||||
<TR><TD><IMG src='i/forum/1.gif' WIDTH=22 HEIGHT=1><SCRIPT>show_inf('".$topics['poster']."','".$topics['p_id']."','".$topics['p_level']."','".$topics['p_rank']."','".$topics['p_tribe']."');</SCRIPT></TD><TD WIDTH=220 align=right>";
|
||||
|
||||
echo"
|
||||
</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
</TD>
|
||||
</TR>
|
||||
<TR HEIGHT=4><TD colspan=2><IMG SRC='i/forum/1.gif'></TD></TR>
|
||||
<TR>
|
||||
<TD colspan=2>";
|
||||
|
||||
$topics['text'] = stripslashes($topics['text']);
|
||||
|
||||
echo $topics['text'];
|
||||
|
||||
echo"</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
<HR COLOR=C1997C WIDTH=80%><BR>";
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Посты юзеров
|
||||
$post=mysql_query("SELECT * FROM posts where top_id='".$topic."' ORDER BY id LIMIT ".$l1.", ".$l2."");
|
||||
|
||||
for ($i=0; $i<mysql_num_rows($post); $i++) {
|
||||
$posts=mysql_fetch_array($post);
|
||||
|
||||
echo"
|
||||
<TABLE width=95% cellspacing=0 cellpadding=0 border=0>
|
||||
<TR>
|
||||
<TD height=20 background='i/forum/standart_line.gif' valign=center>
|
||||
<TABLE cellspacing=0 cellpadding=0 width=100%>
|
||||
<TR><TD><IMG src='i/forum/1.gif' WIDTH=22 HEIGHT=1><SCRIPT>show_inf('".$posts['poster']."','".$posts['p_id']."','".$posts['p_level']."','".$posts['p_rank']."','".$posts['p_tribe']."');</SCRIPT></TD><TD WIDTH=220 align=right>";
|
||||
|
||||
|
||||
if (($stat['rank'] >= 11 && $stat['rank'] <= 14) || $stat['rank'] >= 99) {
|
||||
echo" <small>[ <a href='?topic=".$topic."&f=".$f."&delpost=".$posts['id']."&p=".$p."'> Удалить</a> ]</small>";
|
||||
|
||||
}
|
||||
|
||||
echo"
|
||||
</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
</TD>
|
||||
</TR>
|
||||
<TR HEIGHT=4><TD colspan=2><IMG SRC='i/forum/1.gif'></TD></TR>
|
||||
<TR>
|
||||
<TD colspan=2>";
|
||||
|
||||
$posts['text'] = stripslashes($posts['text']);
|
||||
|
||||
echo $posts['text'];
|
||||
|
||||
echo"</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
<HR COLOR=C1997C WIDTH=80%><BR>";
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (!empty($pages)) echo "<center>Страницы: ".$pages."</center><BR>";
|
||||
|
||||
|
||||
|
||||
echo"
|
||||
|
||||
<table cellspacing=0 cellpadding=5 style='border-style: outset; border-width: 2' border=1 bgcolor=C1997C>
|
||||
|
||||
<TR HEIGHT=35>
|
||||
<TD ALIGN=CENTER style='BORDER-BOTTOM: 0px'>
|
||||
<font style='FONT-SIZE: 10pt'><b><U>Добавить ответ</U></b></font><br>
|
||||
</TD>
|
||||
</TR>
|
||||
|
||||
<TR>
|
||||
<TD ALIGN=CENTER style='BORDER-TOP: 0px'>
|
||||
|
||||
<table border=0 cellspacing=0 cellpadding=0>
|
||||
<form action='' method=post>
|
||||
|
||||
<tr><td>
|
||||
|
||||
<textarea cols=10 rows=10 name=addtext style='Background-COLOR: DAB69D; Color: 8A6246; FONT-WEIGHT: Bold; FONT-FAMILY: Verdana, Arial, Helvetica, Tahoma, sans-serif; FONT-SIZE: 9pt; WIDTH: 550px'></textarea></td><td valign=center align=center WIDTH=45>
|
||||
|
||||
<img src='i/forum/bold.gif' onclick=\"ins('<b></b>');\" style='CURSOR: Hand' alt='Жирный'><br><br>
|
||||
<img src='i/forum/italic.gif' onclick=\"ins('<i></i>');\" style='CURSOR: Hand' alt='Курсив'><br><br>
|
||||
<img src='i/forum/underline.gif' onclick=\"ins('<u></u>');\" style='CURSOR: Hand' alt='Подчёркнутый'>
|
||||
|
||||
</td></tr>
|
||||
|
||||
<tr><td>
|
||||
<input type=submit name=add class=input value=\"Добавить ответ\" style='Background-COLOR: DAB69D; Color: 8A6246; FONT-WEIGHT: Bold; border-style: outset; border-width: 2; WIDTH: 273px'>
|
||||
<input type=reset class=input value='Очистить' style='Background-COLOR: DAB69D; Color: 8A6246; FONT-WEIGHT: Bold; border-style: outset; border-width: 2; WIDTH: 274px'>
|
||||
</td></tr>
|
||||
</form>
|
||||
</table>
|
||||
|
||||
</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
<BR>
|
||||
";
|
||||
|
||||
}
|
||||
/*
|
||||
$f = addslashes($f);
|
||||
|
||||
|
||||
$numo = mysql_numrows(mysql_query("SELECT * FROM topics WHERE cat='".$f."'")); // Число топиков в данной категории
|
||||
|
||||
$np=10; // Число новостей на странице
|
||||
$pages_count = @ceil($numo/$np); // Определяем число страниц
|
||||
|
||||
if (is_numeric($p))
|
||||
{
|
||||
if ($p>$pages_count) $p=1; // Если страница превышает макс. число, то открываем первую
|
||||
if ($p=="" or $p=="0") { $p="1"; }
|
||||
elseif ($p!="1") { $min=$np; }} else $p=1;
|
||||
|
||||
|
||||
$l1=$p*$np-$np;
|
||||
$l2=$np;
|
||||
|
||||
$pages = "";
|
||||
|
||||
for($i=1; $i<=$pages_count; $i++){
|
||||
if ($p != $i) $pages .= " <a href=?f=".$f."&p=".$i.">[".$i."]</a>";
|
||||
else $pages .= " <b>[$i]</b>"; }
|
||||
//
|
||||
|
||||
$conf=mysql_fetch_array(mysql_query("SELECT title FROM forums where name='".$f."'"));
|
||||
echo"<br><center><B class=title><U>Форум :: \"".$conf['title']."\"</U></B></center><br>";
|
||||
|
||||
echo"<script language=JavaScript>
|
||||
function ins (text) {
|
||||
document.all.addtext.focus();
|
||||
document.all.addtext.value+= ''+text+''; }
|
||||
</script>";
|
||||
|
||||
$topic=mysql_query("SELECT * FROM topics where cat='".$f."' ORDER BY fixed DESC, last_update DESC limit ".$l1.",".$l2."");
|
||||
|
||||
|
||||
|
||||
for ($i=0; $i<mysql_num_rows($topic); $i++) {
|
||||
$topics=mysql_fetch_array($topic);
|
||||
|
||||
echo"
|
||||
<TABLE width=95% cellspacing=0 cellpadding=0 border=0>
|
||||
<TR>
|
||||
<TD height=20 background='i/forum/";
|
||||
|
||||
if ($topics['fixed'] == 1)
|
||||
echo"fixed_line";
|
||||
else
|
||||
echo"standart_line";
|
||||
|
||||
echo".gif' valign=center>
|
||||
<TABLE cellspacing=0 cellpadding=0 width=100%>
|
||||
<TR><TD><IMG src='i/forum/1.gif' WIDTH=22 HEIGHT=1><a href='?topic=".$topics['id']."&f=".$f."' title='Дата создания: ".$topics['date']."'>".$topics['title']."</a> - [ <SCRIPT>show_inf('".$topics['poster']."','".$topics['p_id']."','".$topics['p_level']."','".$topics['p_rank']."','".$topics['p_tribe']."');</SCRIPT> ] - <b>Ответов:</b> ".mysql_numrows(mysql_query("SELECT * FROM posts where top_id='$topics[id]'"))."</TD><TD WIDTH=220 align=right>";
|
||||
|
||||
|
||||
if (($stat['rank'] >= 11 && $stat['rank'] <= 14) || $stat['rank'] >= 99) {
|
||||
echo" <small>[ ";
|
||||
|
||||
if ($topics['fixed'] == 1)
|
||||
echo" <a href='?f=".$f."&unfix=".$topics['id']."&".$now."'><small>Снять прикрепление</small></a>";
|
||||
else
|
||||
echo" <a href='?f=".$f."&fix=".$topics['id']."&".$now."'><small>Прикрепить</small></a>";
|
||||
|
||||
echo" | <a href='?f=".$f."&deltop=".$topics['id']."'><small>Удалить</small></a>";
|
||||
|
||||
echo" ]</small>";
|
||||
|
||||
}
|
||||
|
||||
|
||||
echo"
|
||||
</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
</TD>
|
||||
</TR>
|
||||
<TR HEIGHT=4><TD colspan=2><IMG SRC='i/forum/1.gif'></TD></TR>
|
||||
<TR>
|
||||
<TD colspan=2>";
|
||||
|
||||
$topics['text'] = HtmlSpecialChars($topics['text']);
|
||||
|
||||
$topics[text]=str_replace("<b>","",$topics[text]);
|
||||
$topics[text]=str_replace("</b>","",$topics[text]);
|
||||
|
||||
$topics[text]=str_replace("<i>","",$topics[text]);
|
||||
$topics[text]=str_replace("</i>","",$topics[text]);
|
||||
|
||||
$topics[text]=str_replace("<u>","",$topics[text]);
|
||||
$topics[text]=str_replace("</u>","",$topics[text]);
|
||||
|
||||
$topics[text]=str_replace("\n","",$topics[text]);
|
||||
$topics[text]=str_replace("<br>","",$topics[text]);
|
||||
|
||||
for ($j=0; $j<180; $j++) {
|
||||
echo $topics['text'][$j];
|
||||
}
|
||||
|
||||
if (!empty($topics['text'][$j]))
|
||||
echo "...";
|
||||
else
|
||||
echo"";
|
||||
|
||||
echo"</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
<HR COLOR=C1997C WIDTH=80%><BR>";
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (!empty($pages)) echo "<center>Страницы: ".$pages."</center><BR>";
|
||||
|
||||
|
||||
|
||||
echo"
|
||||
|
||||
<table cellspacing=0 cellpadding=5 style='border-style: outset; border-width: 2' border=1 bgcolor=C1997C>
|
||||
|
||||
<TR HEIGHT=35>
|
||||
<TD ALIGN=CENTER style='BORDER-BOTTOM: 0px'>
|
||||
<font style='FONT-SIZE: 10pt'><b><U>Добавить свой вопрос в форум</U></b></font><br>
|
||||
</TD>
|
||||
</TR>
|
||||
|
||||
<TR>
|
||||
<TD ALIGN=CENTER style='BORDER-TOP: 0px'>
|
||||
|
||||
<table border=0 cellspacing=0 cellpadding=0>
|
||||
<form action='' method=post>
|
||||
<tr>
|
||||
<td></td><td><input name=addtitle class=input style='Background-COLOR: DAB69D; Color: 8A6246; FONT-WEIGHT: Bold; FONT-FAMILY: Verdana, Arial, Helvetica, Tahoma, sans-serif; FONT-SIZE: 9pt; WIDTH: 550px'></td></tr>
|
||||
|
||||
<tr><td align=left valign=center WIDTH=45>
|
||||
<input type=radio name=addicon value=0 checked> <img src='i/forum/0.gif' alt='Иконка для вопроса' width=15 height=15>
|
||||
<input type=radio name=addicon value=1> <img src='i/forum/1.gif' alt='Иконка для вопроса' width=15 height=15>
|
||||
<input type=radio name=addicon value=2> <img src='i/forum/2.gif' alt='Иконка для вопроса' width=15 height=15>
|
||||
<input type=radio name=addicon value=3> <img src='i/forum/3.gif' alt='Иконка для вопроса' width=15 height=15>
|
||||
<input type=radio name=addicon value=4> <img src='i/forum/4.gif' alt='Иконка для вопроса' width=15 height=15>
|
||||
<input type=radio name=addicon value=5> <img src='i/forum/5.gif' alt='Иконка для вопроса' width=15 height=15>
|
||||
</td><td>
|
||||
|
||||
<textarea cols=10 rows=10 name=addtext style='Background-COLOR: DAB69D; Color: 8A6246; FONT-WEIGHT: Bold; FONT-FAMILY: Verdana, Arial, Helvetica, Tahoma, sans-serif; FONT-SIZE: 9pt; WIDTH: 550px' ></textarea></td><td valign=center align=center WIDTH=45>
|
||||
|
||||
<img src='i/forum/bold.gif' onclick=\"ins('<b></b>');\" style='CURSOR: Hand' alt='Жирный'><br><br>
|
||||
<img src='i/forum/italic.gif' onclick=\"ins('<i></i>');\" style='CURSOR: Hand' alt='Курсив'><br><br>
|
||||
<img src='i/forum/underline.gif' onclick=\"ins('<u></u>');\" style='CURSOR: Hand' alt='Подчёркнутый'>
|
||||
|
||||
</td></tr>
|
||||
|
||||
<tr><td></td><td>
|
||||
<input type=submit name=addtop class=input value=\"Добавить вопрос\" style='Background-COLOR: DAB69D; Color: 8A6246; FONT-WEIGHT: Bold; border-style: outset; border-width: 2; WIDTH: 273px'>
|
||||
<input type=reset class=input value='Очистить' style='Background-COLOR: DAB69D; Color: 8A6246; FONT-WEIGHT: Bold; border-style: outset; border-width: 2; WIDTH: 274px'>
|
||||
</td></tr>
|
||||
</form>
|
||||
</table>
|
||||
|
||||
</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
<BR>
|
||||
";
|
||||
*/
|
||||
?>
|
35
game.php
Normal file
35
game.php
Normal file
@ -0,0 +1,35 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta http-equiv="Content-Language" content="ru" />
|
||||
<title>Анти Бойцовский Клуб</title>
|
||||
<link rel="SHORTCUT ICON" href="img/favicon.ico" />
|
||||
<script src="scripts/jquery.js" type="text/javascript"></script>
|
||||
<script src="scripts/scripts.js" type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
$(function (){
|
||||
$('[name=menu]').attr('src', 'topp.php');
|
||||
$('[name=msg]').attr('src', 'msg.php');
|
||||
$('[name=user]').attr('src', 'users.php');
|
||||
$('[name=talk]').attr('src', 'talk.php');
|
||||
$('[name=main]').attr('src', 'main.php?action=enter');
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<frameset rows="35, *, 30, 5" frameborder="0" border="0" framespacing="0">
|
||||
<frame name="menu" src="" target="_top" scrolling="no" noresize frameborder="0" border="0" framespacing="0" marginwidth="0" marginheight="0" />
|
||||
<frameset cols="9, *, 9" frameborder="0" border="0" framespacing="0">
|
||||
<frame src="styles/game_l.html" target="_top" scrolling="no" noresize frameborder="0" border="0" framespacing="0" marginwidth="0" marginheight="0" />
|
||||
<frameset rows="52%, *" frameborder="1" border="3">
|
||||
<frame name="main" src="" />
|
||||
<frameset cols="*, 220">
|
||||
<frame name="msg" src="" target="_top" scrolling="auto" frameborder="1" border="0" framespacing="0" marginwidth="3" marginheight="3" />
|
||||
<frame name="user" src="" target="_blank" scrolling="auto" frameborder="0" border="0" framespacing="0" marginwidth="3" marginheight="0" />
|
||||
</frameset>
|
||||
</frameset>
|
||||
<frame src="styles/game_r.html" target="_top" scrolling="no" noresize frameborder="0" border="0" framespacing="0" marginwidth="0" marginheight="0" />
|
||||
</frameset>
|
||||
<frame name="talk" src="" scrolling="no" noresize />
|
||||
<frame src="styles/game_b.html" target="_top" scrolling="no" noresize frameborder="0" border="0" framespacing="0" marginwidth="0" marginheight="0" />
|
||||
</frameset>
|
||||
</html>
|
BIN
i/align-1.gif
(Stored with Git LFS)
Normal file
BIN
i/align-1.gif
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
i/align-2.gif
(Stored with Git LFS)
Normal file
BIN
i/align-2.gif
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
i/align.gif
(Stored with Git LFS)
Normal file
BIN
i/align.gif
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
i/align0.5.gif
(Stored with Git LFS)
Normal file
BIN
i/align0.5.gif
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
i/align0.gif
(Stored with Git LFS)
Normal file
BIN
i/align0.gif
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
i/align1.1.gif
(Stored with Git LFS)
Normal file
BIN
i/align1.1.gif
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
i/align1.4.gif
(Stored with Git LFS)
Normal file
BIN
i/align1.4.gif
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
i/align1.5.gif
(Stored with Git LFS)
Normal file
BIN
i/align1.5.gif
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
i/align1.6.gif
(Stored with Git LFS)
Normal file
BIN
i/align1.6.gif
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
i/align1.7.gif
(Stored with Git LFS)
Normal file
BIN
i/align1.7.gif
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
i/align1.75.gif
(Stored with Git LFS)
Normal file
BIN
i/align1.75.gif
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
i/align1.9.gif
(Stored with Git LFS)
Normal file
BIN
i/align1.9.gif
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
i/align1.91.gif
(Stored with Git LFS)
Normal file
BIN
i/align1.91.gif
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
i/align1.92.gif
(Stored with Git LFS)
Normal file
BIN
i/align1.92.gif
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
i/align1.gif
(Stored with Git LFS)
Normal file
BIN
i/align1.gif
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
i/align23.gif
(Stored with Git LFS)
Normal file
BIN
i/align23.gif
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
i/align3.01.gif
(Stored with Git LFS)
Normal file
BIN
i/align3.01.gif
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
i/align3.05.gif
(Stored with Git LFS)
Normal file
BIN
i/align3.05.gif
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
i/align3.06.gif
(Stored with Git LFS)
Normal file
BIN
i/align3.06.gif
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
i/align3.07.gif
(Stored with Git LFS)
Normal file
BIN
i/align3.07.gif
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
i/align3.075.gif
(Stored with Git LFS)
Normal file
BIN
i/align3.075.gif
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
i/align3.09.gif
(Stored with Git LFS)
Normal file
BIN
i/align3.09.gif
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
i/align3.091.gif
(Stored with Git LFS)
Normal file
BIN
i/align3.091.gif
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
i/align3.092.gif
(Stored with Git LFS)
Normal file
BIN
i/align3.092.gif
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
i/align3.99.gif
(Stored with Git LFS)
Normal file
BIN
i/align3.99.gif
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
i/align3.gif
(Stored with Git LFS)
Normal file
BIN
i/align3.gif
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
i/align50.gif
(Stored with Git LFS)
Normal file
BIN
i/align50.gif
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
i/align7.gif
(Stored with Git LFS)
Normal file
BIN
i/align7.gif
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
i/align9.gif
(Stored with Git LFS)
Normal file
BIN
i/align9.gif
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
i/artefact.gif
(Stored with Git LFS)
Normal file
BIN
i/artefact.gif
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
i/b___translit_on.gif
(Stored with Git LFS)
Normal file
BIN
i/b___translit_on.gif
(Stored with Git LFS)
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user