dev #41
@ -9,23 +9,24 @@ require_once '../functions.php';
|
||||
|
||||
use Battles\Bank;
|
||||
use Battles\Database\DBPDO;
|
||||
use Battles\GameConfigs;
|
||||
use Battles\Moderation;
|
||||
use Battles\Nick;
|
||||
use Battles\Template;
|
||||
use Battles\User;
|
||||
|
||||
$user = $user ?? new User($_SESSION['uid']);
|
||||
if (!$user->getAdmin()) {
|
||||
header("HTTP/1.0 404 Not Found");
|
||||
exit;
|
||||
}
|
||||
|
||||
if (isset($_GET['sleep'])) {
|
||||
Moderation::muteChat($user->getId(), strtotime('15min'));
|
||||
}
|
||||
|
||||
if (isset($_POST['ldnick']) && isset($_POST['ldtext'])) {
|
||||
Moderation::addToUserLog($_POST['ldnick'], $_POST['ldtext'], $user->getId());
|
||||
$u = new User($_POST['ldnick']);
|
||||
Moderation::addToUserLog($u->getId(), $_POST['ldtext'], $user->getId());
|
||||
unset($u);
|
||||
}
|
||||
|
||||
if (isset($_POST['syschatmsg'])) {
|
||||
@ -72,7 +73,7 @@ UNREGCLANLIST;
|
||||
{
|
||||
$bank = new Bank($id);
|
||||
$this->db->execute('DELETE FROM clans WHERE status = 0 AND owner_id = ?', $id);
|
||||
$bank::setBankMoney($bank->getMoney() + Config::$clan_register_cost, $id);
|
||||
$bank::setBankMoney($bank->getMoney() + GameConfigs::CLAN_REGISTER_COST, $id);
|
||||
}
|
||||
};
|
||||
$unregisteredClans->db = new DBPDO();
|
||||
|
@ -25,7 +25,7 @@ if ($player) {
|
||||
unset($row);
|
||||
}
|
||||
if ($undress_char) {
|
||||
undressall($_SESSION['player_id']);
|
||||
\Battles\DressedItems::undressAllItems($_SESSION['player_id']);
|
||||
}
|
||||
if ($end) {
|
||||
unset($_SESSION['player_id']);
|
||||
@ -37,10 +37,11 @@ if (isset($_SESSION['player_id'])) {
|
||||
if ($del) {
|
||||
$itemdel = db::c()->query('SELECT item_type, dressed_slot FROM inventory WHERE id=?i', $del)->fetch_assoc();
|
||||
if ($itemdel['dressed_slot'] == 1) {
|
||||
dropitem($itemdel['item_type']);
|
||||
$item = new \Battles\DressedItems($del);
|
||||
$item->undressItem($itemdel['item_type']);
|
||||
if ($itemdel['item_type'] == 5) {
|
||||
dropitem(6);
|
||||
dropitem(7);
|
||||
$item->undressItem(6);
|
||||
$item->undressItem(7);
|
||||
}
|
||||
}
|
||||
db::c()->query('DELETE FROM `inventory` WHERE `id` = ?i', $del);
|
||||
|
@ -38,7 +38,7 @@
|
||||
}
|
||||
if(!$kompl_har) $kompl_har=0;
|
||||
$explim=0;
|
||||
foreach(array_keys(Config::$exptable) as $k)
|
||||
foreach(array_keys(EXPTABLE) as $k)
|
||||
{
|
||||
if($k>=$ku['exp'])
|
||||
{
|
||||
@ -47,14 +47,14 @@
|
||||
}
|
||||
}
|
||||
$sum_stat=15;
|
||||
foreach(array_keys(Config::$exptable) as $k)
|
||||
foreach(array_keys(EXPTABLE) as $k)
|
||||
{
|
||||
if($k==$explim)
|
||||
break;
|
||||
else
|
||||
{
|
||||
$sum_stat+=Config::$exptable[$k][0];
|
||||
$sum_stat+=Config::$exptable[$k][2];
|
||||
$sum_stat+=EXPTABLE[$k][0];
|
||||
$sum_stat+=EXPTABLE[$k][2];
|
||||
}
|
||||
}
|
||||
$res=mysql_fetch_array(
|
||||
|
3
bank.php
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Battles\Bank;
|
||||
use Battles\GameConfigs;
|
||||
use Battles\Rooms;
|
||||
use Battles\Template;
|
||||
use Battles\User;
|
||||
@ -75,5 +76,5 @@ Template::header('Банк');
|
||||
<input type="hidden" name="action" value="sendMoney">
|
||||
<input type="submit" value="Перевести кредиты">
|
||||
</form>
|
||||
<span class="wrap">Комиссия: <?= Config::$bank_commission * 100 ?>% от переводимой суммы, но не менее 1 кр.</span>
|
||||
<span class="wrap">Комиссия: <?= GameConfigs::BANK_COMISSION * 100 ?>% от переводимой суммы, но не менее 1 кр.</span>
|
||||
</div>
|
||||
|
20
cave.php
@ -5,7 +5,7 @@ use Battles\Template;
|
||||
session_start();
|
||||
require_once 'functions.php';
|
||||
//require_once 'cave/cave_bots.php';
|
||||
|
||||
$userslots = ['sergi', 'kulon', 'perchi', 'weap', 'bron', 'r1', 'r2', 'r3', 'helm', 'shit', 'boots', 'rybax', 'plaw', 'm1', 'm2', 'm3', 'm4', 'm5', 'm6', 'm7', 'm8', 'm9', 'm10'];
|
||||
function cancarry($m, $u)
|
||||
{
|
||||
global $user;
|
||||
@ -204,7 +204,7 @@ function gotoroom($r, $redir = 1)
|
||||
|
||||
function redirectbyroom($r)
|
||||
{
|
||||
if (in_array($r, Config::$canalenters)) {
|
||||
if (in_array($r, CANAL_ENTERS)) {
|
||||
header("location: enter_cave.php");
|
||||
exit;
|
||||
}
|
||||
@ -286,7 +286,7 @@ function takeusage($x, $y)
|
||||
function makedeath()
|
||||
{
|
||||
global $user, $floor, $loses, $x, $y, $dir;
|
||||
$cavedata = Config::$cavedata ?? [];
|
||||
$cavedata = CAVE_DATA ?? [];
|
||||
if (!isset($cavedata[$user->getRoom()]['x' . $floor])) {
|
||||
$floor = 1;
|
||||
loadmap();
|
||||
@ -430,11 +430,11 @@ function loadmap()
|
||||
|
||||
function getslot($i, $user1 = 0)
|
||||
{
|
||||
global $user;
|
||||
global $user, $userslots;
|
||||
if (!$user1) {
|
||||
$user1 = $user;
|
||||
}
|
||||
foreach (Config::$userslots as $k => $v) {
|
||||
foreach ($userslots as $k => $v) {
|
||||
if ($user1[$v] == $i) {
|
||||
return $v;
|
||||
}
|
||||
@ -482,12 +482,13 @@ if (@$_GET['kill'] && $user['id'] == $user['caveleader'] && $_GET['kill'] != $us
|
||||
mysql_query("UPDATE `users` SET `room` = (`room`-1), `caveleader` = 0 WHERE `id` = '$v[user]' LIMIT 1");
|
||||
$r = mysql_query("SELECT `id`, `dressed` FROM `inventory` WHERE `owner` = '$v[user]' AND `dressed` = 1 AND `foronetrip` = 1");
|
||||
if (mysql_num_rows($r) > 0) {
|
||||
$usr = mysql_fetch_array(mysql_query("SELECT " . implode(",", Config::$userslots) . " FROM `users` WHERE `id` = '$v[user]'"));
|
||||
$usr = mysql_fetch_array(mysql_query("SELECT " . implode(",", $userslots) . " FROM `users` WHERE `id` = '$v[user]'"));
|
||||
}
|
||||
while ($rec = mysql_fetch_assoc($r)) {
|
||||
$slot = getslot($rec['id'], $usr);
|
||||
if ($slot) {
|
||||
dropitemid(0, $v['user'], $slot);
|
||||
$item = new \Battles\DressedItems($v['user']);
|
||||
$item->undressItem($slot);
|
||||
}
|
||||
}
|
||||
mysql_query("DELETE FROM `inventory` WHERE `owner` = '$v[user]' AND `foronetrip` = 1");
|
||||
@ -737,7 +738,7 @@ if ($ambushes[$y * 2][$x * 2 - 2] && $map[$y * 2][$x * 2 - 1] == 0) {
|
||||
}
|
||||
|
||||
if ($ax && $ay && $user['hp'] > 0) {
|
||||
$cavedata = Config::$cavedata ?? [];
|
||||
$cavedata = CAVE_DATA ?? [];
|
||||
if (!($cavedata[$user->getRoom()]['x' . $floor] == $x && $cavedata[$user->getRoom()]['y' . $floor] == $y)) {
|
||||
if ($ax < $x) {
|
||||
$dir1 = 0;
|
||||
@ -898,7 +899,8 @@ if (@$_GET['exit']) {
|
||||
while ($rec = mysql_fetch_assoc($r)) {
|
||||
$slot = getslot($rec['id']);
|
||||
if ($slot) {
|
||||
dropitemid(0, $user['id'], $slot);
|
||||
$item = new \Battles\DressedItems($user['id']);
|
||||
$item->undressItem($slot);
|
||||
}
|
||||
}
|
||||
mysql_query("DELETE FROM `inventory` WHERE `owner` = '$user[id]' AND `foronetrip` = 1");
|
||||
|
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Battles\Bank;
|
||||
use Battles\GameConfigs;
|
||||
use Battles\Rooms;
|
||||
use Battles\Template;
|
||||
use Battles\User;
|
||||
@ -18,7 +19,7 @@ if ($clanFullName && $clanShortName && $clanInfo && !$userClan) {
|
||||
$eff = db::c()->query('SELECT 1 FROM users_effects WHERE type = 20 AND owner_id = ?i', $user->getId());
|
||||
$name_check = db::c()->query('SELECT owner_id FROM clans WHERE full_name = "?s" OR short_name = "?s"', $clanFullName, $clanShortName);
|
||||
$errorMessage = [];
|
||||
if (Config::$clan_register_lock) {
|
||||
if (GameConfigs::CLAN_REGISTER_LOCK) {
|
||||
$errorMessage[10] = 'Регистрация кланов закрыта! <BR>';
|
||||
}
|
||||
if ($user->getAlign()) {
|
||||
@ -27,7 +28,7 @@ if ($clanFullName && $clanShortName && $clanInfo && !$userClan) {
|
||||
if ($user->getClan()) {
|
||||
$errorMessage[1] = 'Вы уже состоите в клане!. <BR>';
|
||||
}
|
||||
if (Config::$clan_register_cost >= $userBank->getMoney()) {
|
||||
if (GameConfigs::CLAN_REGISTER_COST >= $userBank->getMoney()) {
|
||||
$errorMessage[2] = 'Не хватает денег на регистрацию клана. <BR>';
|
||||
}
|
||||
if (!$eff) {
|
||||
@ -39,7 +40,7 @@ if ($clanFullName && $clanShortName && $clanInfo && !$userClan) {
|
||||
if (!$errorMessage || $user->getAdmin()) {
|
||||
try {
|
||||
db::c()->query('INSERT INTO clans (owner_id, full_name, short_name, info) VALUES (?i,"?s","?s","?s")', $user->getId(), $clanFullName, $clanShortName, $clanInfo);
|
||||
$userBank->setMoney($userBank->getMoney() - Config::$clan_register_cost);
|
||||
$userBank->setMoney($userBank->getMoney() - GameConfigs::CLAN_REGISTER_COST);
|
||||
Battles\Bank::setBankMoney($userBank->getMoney(), $user->getId(), 'clanRegister');
|
||||
// Заглушка для отображения данных по только что зарегистрированному клану, когда запрос в базу в начале файла ещё не проходит.
|
||||
$userClan = new stdClass();
|
||||
|
@ -52,7 +52,7 @@ class Bank
|
||||
*/
|
||||
private function bankCommission(int $amount): int
|
||||
{
|
||||
$bankCommission = round($amount * Config::$bank_commission);
|
||||
$bankCommission = round($amount * GameConfigs::BANK_COMISSION);
|
||||
if ($bankCommission < 1) {
|
||||
return 1;
|
||||
} else {
|
||||
|
@ -2,11 +2,7 @@
|
||||
|
||||
|
||||
namespace Battles\Database;
|
||||
const DATABASE_HOST = '192.168.20.5';
|
||||
const DATABASE_NAME = 'battles';
|
||||
const DATABASE_USER = 'battles';
|
||||
const DATABASE_PASS = 'bottle-neck-horse';
|
||||
const DATABASE_PORT = '32101';
|
||||
use Battles\GameConfigs;
|
||||
use PDO, PDOException;
|
||||
class DBPDO
|
||||
{
|
||||
@ -37,9 +33,9 @@ class DBPDO
|
||||
{
|
||||
if (!$this->pdo) {
|
||||
|
||||
$dsn = 'mysql:dbname=' . DATABASE_NAME . ';host=' . DATABASE_HOST . ';port=' . DATABASE_PORT . ';charset=utf8;';
|
||||
$user = DATABASE_USER;
|
||||
$password = DATABASE_PASS;
|
||||
$dsn = 'mysql:dbname=' . GameConfigs::DATABASE_NAME . ';host=' . GameConfigs::DATABASE_HOST . ';port=' . GameConfigs::DATABASE_PORT . ';charset=utf8;';
|
||||
$user = GameConfigs::DATABASE_USER;
|
||||
$password = GameConfigs::DATABASE_PASS;
|
||||
|
||||
try {
|
||||
$this->pdo = new PDO($dsn, $user, $password, array(PDO::ATTR_PERSISTENT => true));
|
||||
@ -144,5 +140,4 @@ class DBPDO
|
||||
{
|
||||
return $this->pdo->lastInsertId();
|
||||
}
|
||||
|
||||
}
|
@ -8,6 +8,7 @@
|
||||
namespace Battles;
|
||||
|
||||
use Battles\Database\DBPDO;
|
||||
use stdClass;
|
||||
|
||||
class DressedItems
|
||||
{
|
||||
@ -27,94 +28,20 @@ class DressedItems
|
||||
|
||||
public static function getDressedItemBySlot($itemSlot, $ownerId)
|
||||
{
|
||||
return self::$db->fetch('SELECT * FROM inventory WHERE owner_id = ? AND dressed_slot = ?', [$ownerId, $itemSlot]);
|
||||
return self::$db->fetch('SELECT *, COUNT(1) AS count FROM inventory WHERE owner_id = ? AND dressed_slot = ?', [$ownerId, $itemSlot]);
|
||||
}
|
||||
|
||||
public function getItemsInSlots()
|
||||
public function getItemsInSlots(): stdClass
|
||||
{
|
||||
$items = self::$db->ofetchALL('SELECT * FROM inventory WHERE owner_id = ? AND dressed_slot > 0', $this->USERID);
|
||||
$i = 0;
|
||||
while ($i < count($items)) {
|
||||
$this->dressedItem[$items[$i]->dressed_slot] = $items;
|
||||
$i++;
|
||||
$this->dressedItem = new stdClass();
|
||||
foreach ($items as $item) {
|
||||
$i = $item->dressed_slot;
|
||||
$this->dressedItem->$i = $item;
|
||||
}
|
||||
return $this->dressedItem;
|
||||
}
|
||||
|
||||
private function getBonuses(): array
|
||||
{
|
||||
$query = <<<SQL
|
||||
SELECT SUM(add_strength) as sum_strength,
|
||||
SUM(add_dexterity) as sum_dexterity,
|
||||
SUM(add_intuition) as sum_intuition,
|
||||
SUM(add_endurance) as sum_endurance,
|
||||
SUM(add_intelligence) as sum_intelligence,
|
||||
SUM(add_wisdom) as sum_wisdom,
|
||||
SUM(add_accuracy) as sum_accuracy,
|
||||
SUM(add_evasion) as sum_evasion,
|
||||
SUM(add_criticals) as sum_criticals,
|
||||
SUM(add_min_physical_damage) as sum_min_phys_damage,
|
||||
SUM(add_max_physical_damage) as sum_max_phys_damage
|
||||
FROM inventory WHERE owner_id = ? AND dressed_slot > 0
|
||||
SQL;
|
||||
return self::$db->fetch($query, $this->USERID);
|
||||
}
|
||||
|
||||
public function getStrengthBonus(): ?int
|
||||
{
|
||||
return self::getBonuses()['sum_strength'];
|
||||
}
|
||||
|
||||
public function getDexterityBonus(): ?int
|
||||
{
|
||||
return self::getBonuses()['sum_dexterity'];
|
||||
}
|
||||
|
||||
public function getIntuitionBonus(): ?int
|
||||
{
|
||||
return self::getBonuses()['sum_intuition'];
|
||||
}
|
||||
|
||||
public function getEnduranceBonus(): ?int
|
||||
{
|
||||
return self::getBonuses()['sum_endurance'];
|
||||
}
|
||||
|
||||
public function getIntelliganceBonus(): ?int
|
||||
{
|
||||
return self::getBonuses()['sum_intelligence'];
|
||||
}
|
||||
|
||||
public function getWisdomBonus(): ?int
|
||||
{
|
||||
return self::getBonuses()['sum_wisdom'];
|
||||
}
|
||||
|
||||
public function getAccuracyBonus(): ?int
|
||||
{
|
||||
return self::getBonuses()['sum_accuracy'] ?? 0;
|
||||
}
|
||||
|
||||
public function getEvasionBonus(): ?int
|
||||
{
|
||||
return self::getBonuses()['sum_evasion'] ?? 0;
|
||||
}
|
||||
|
||||
public function getCriticalsBonus(): ?int
|
||||
{
|
||||
return self::getBonuses()['sum_criticals'] ?? 0;
|
||||
}
|
||||
|
||||
public function getMinPhysDamage(): ?int
|
||||
{
|
||||
return self::getBonuses()['sum_min_phys_damage'];
|
||||
}
|
||||
|
||||
public function getMaxPhysDamage(): ?int
|
||||
{
|
||||
return self::getBonuses()['sum_max_phys_damage'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Снимает с предмета статус одетого на персонажа в определённом слоте персонажа.
|
||||
* @param $slot_id - номер слота.
|
||||
@ -123,8 +50,12 @@ SQL;
|
||||
{
|
||||
self::getItemsInSlots();
|
||||
// Проверяем, что используется один из 12 слотов и наличие предмета в слоте.
|
||||
if (in_array($slot_id, Item::ITEM_TYPES_ALLOWED_IN_SLOTS) && $this->dressedItem[$slot_id]) {
|
||||
if (in_array($slot_id, Item::ITEM_TYPES_ALLOWED_IN_SLOTS) && $this->dressedItem->$slot_id) {
|
||||
self::$db->execute('UPDATE inventory SET dressed_slot = 0 WHERE dressed_slot = ? AND owner_id = ?', [$slot_id, $this->USERID]);
|
||||
}
|
||||
}
|
||||
public static function undressAllItems($user_id)
|
||||
{
|
||||
return self::$db->execute('UPDATE inventory SET dressed_slot = 0 WHERE dressed_slot BETWEEN 1 AND 12 AND owner_id = ?', $user_id);
|
||||
}
|
||||
}
|
21
classes/Battles/GameConfigs.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
# Date: 15.02.2021 (02:33)
|
||||
|
||||
namespace Battles;
|
||||
|
||||
|
||||
class GameConfigs
|
||||
{
|
||||
const DATABASE_HOST = '192.168.20.5';
|
||||
const DATABASE_NAME = 'battles';
|
||||
const DATABASE_USER = 'battles';
|
||||
const DATABASE_PASS = 'bottle-neck-horse';
|
||||
const DATABASE_PORT = '32101';
|
||||
const DATABASE_CHARSET = 'utf8';
|
||||
|
||||
const CLAN_REGISTER_COST = 10000;
|
||||
const CLAN_REGISTER_LOCK = true; // Запрет на регистрацию кланов.
|
||||
const BANK_COMISSION = 0.05; // 5%
|
||||
|
||||
const DB_SQLITE = '/volume2/web/battles/databases/logs.sqlite';
|
||||
}
|
@ -19,7 +19,7 @@ class GameLogs
|
||||
*/
|
||||
public static function addBankLog(int $senderId, int $receiverId, int $amount, string $type, string $text)
|
||||
{
|
||||
$db = new SQLite3(Config::$db_sqlite);
|
||||
$db = new SQLite3(GameConfigs::DB_SQLITE);
|
||||
$row = $db->prepare("INSERT INTO bank_logs (sender_id, receiver_id, amount, type, text) VALUES (?, ?, ?, ?, ?)");
|
||||
$row->bindParam(1, $senderId, SQLITE3_INTEGER);
|
||||
$row->bindParam(2, $receiverId, SQLITE3_INTEGER);
|
||||
@ -45,7 +45,7 @@ class GameLogs
|
||||
if (empty($type)) {
|
||||
$type = "system";
|
||||
}
|
||||
$db = new SQLite3(Config::$db_sqlite);
|
||||
$db = new SQLite3(GameConfigs::DB_SQLITE);
|
||||
$row = $db->prepare("INSERT INTO users_logs (user_id, author_id, type, text) VALUES (?,?,?,?)");
|
||||
$row->bindParam(1, $userId, SQLITE3_INTEGER);
|
||||
$row->bindParam(2, $authorId, SQLITE3_INTEGER);
|
||||
@ -57,7 +57,7 @@ class GameLogs
|
||||
|
||||
public static function getUserLogs($userId = null, $type = null): SQLite3Result
|
||||
{
|
||||
$db = new SQLite3(Config::$db_sqlite);
|
||||
$db = new SQLite3(GameConfigs::DB_SQLITE);
|
||||
|
||||
if ($userId && $type) {
|
||||
$query = "SELECT * FROM users_logs WHERE user_id = ? AND type = ?";
|
||||
|
@ -1,15 +1,27 @@
|
||||
<?php
|
||||
namespace Battles;
|
||||
|
||||
use Battles\Database\DBPDO;
|
||||
|
||||
class InventoryItem extends Item
|
||||
{
|
||||
private $present;
|
||||
private $owner_id;
|
||||
private $db;
|
||||
private const TOO_MANY_ITEMS_IN_SLOTS = 'Критическая ошибка: Переполнение слота!';
|
||||
private const UNKNOWN_ITEM_TYPE = 'Неизвестный тип предмета!';
|
||||
private const REQUIREMENTS_NOT_MET = 'Персонаж не соответствует требованиям!';
|
||||
|
||||
/**
|
||||
* InventoryItem constructor.
|
||||
*
|
||||
* @param $row
|
||||
*/
|
||||
public function __construct($row)
|
||||
{
|
||||
parent::__construct($row);
|
||||
if (isset($row['present'])) {
|
||||
$this->present = $row['present'];
|
||||
}
|
||||
$this->owner_id = $row->owner_id;
|
||||
$this->db = DBPDO::INIT();
|
||||
}
|
||||
|
||||
public function printInfo()
|
||||
@ -22,14 +34,110 @@ class InventoryItem extends Item
|
||||
|
||||
public function printImage()
|
||||
{
|
||||
if (in_array($this->item_type, range(1,12))) {
|
||||
echo "<a href=/main.php?edit=1&dress={$this->item_id} title='Надеть'>";
|
||||
parent::printImage();
|
||||
echo "</a>";
|
||||
if (in_array($this->item_type, range(1, 12))) {
|
||||
echo <<<HTML
|
||||
<a href=/main.php?edit=1&dress={$this->item_id} title='Надеть'>
|
||||
<img src="/i/sh/{$this->image}" class="item-wrap-normal" alt="">
|
||||
</a>
|
||||
HTML;
|
||||
} else {
|
||||
parent::printImage();
|
||||
echo <<<IMG
|
||||
<img src="/i/sh/{$this->image}" class="item-wrap-normal" alt="">
|
||||
IMG;
|
||||
}
|
||||
}
|
||||
|
||||
public function printControls() {}
|
||||
public function printControls()
|
||||
{
|
||||
/* Тут будут кнопки под картинкой. */
|
||||
}
|
||||
|
||||
private function dressStatsChecks(): ?string
|
||||
{
|
||||
$checkStats = new UserStats($this->owner_id);
|
||||
return
|
||||
$this->need_strength > $checkStats->getFullStats()->strength
|
||||
|| $this->need_dexterity > $checkStats->getFullStats()->dexterity
|
||||
|| $this->need_intuition > $checkStats->getFullStats()->intuition
|
||||
|| $this->need_endurance > $checkStats->getFullStats()->endurance
|
||||
|| $this->need_intelligence > $checkStats->getFullStats()->intelligence
|
||||
|| $this->need_wisdom > $checkStats->getFullStats()->wisdom
|
||||
? true : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Одевание предмета из инвентаря в слот.
|
||||
* @return bool|string
|
||||
*/
|
||||
public function dressItem()
|
||||
{
|
||||
$db = new DBPDO();
|
||||
$itemInSlot = [];
|
||||
if ($this->dressStatsChecks()) {
|
||||
return self::REQUIREMENTS_NOT_MET;
|
||||
}
|
||||
// считаем сколько ОДЕТЫХ предметов в слоте в который мы хотим одеть предмет. 1=просто вещь 1-3=шашни с кольцами
|
||||
// Count добавленный в первый запрос возвращает одну строку в любом случае.
|
||||
// fetch возвращает одну строку в любом случае.
|
||||
$weared = $db->ofetchAll('SELECT dressed_slot FROM inventory WHERE dressed_slot != 0 AND item_type = ? AND owner_id = ?', [$this->item_type, $this->owner_id]);
|
||||
$wearedCount = $db->ofetch('select count(dressed_slot) as c from inventory where dressed_slot !=0 and item_type = ? and owner_id = ?', [$this->item_type, $this->owner_id]);
|
||||
// Если в слоте есть предмет(ы), забиваем их массив одетых в слот предметов.
|
||||
if ($wearedCount) {
|
||||
foreach ($weared as $item) {
|
||||
$itemInSlot[] = $item->dressed_slot;
|
||||
}
|
||||
}
|
||||
if (in_array($this->item_type, [
|
||||
self::ITEM_TYPE_HELMET, self::ITEM_TYPE_ARMOR, self::ITEM_TYPE_LEGS, self::ITEM_TYPE_BOOTS,
|
||||
self::ITEM_TYPE_GLOVES, self::ITEM_TYPE_WEAPON, self::ITEM_TYPE_SHIELD, self::ITEM_TYPE_BELT,
|
||||
self::ITEM_TYPE_AMULET,
|
||||
])) {
|
||||
//работаем с нормальными слотами
|
||||
if ($wearedCount->c == 1) {
|
||||
//если слот занят, снимаем старый предмет и одеваем новый предмет
|
||||
DBPDO::INIT()->execute('UPDATE inventory SET dressed_slot = 0 WHERE dressed_slot = ? AND owner_id = ?', [$itemInSlot[0], $this->owner_id]);
|
||||
DBPDO::INIT()->execute('UPDATE inventory SET dressed_slot = item_type WHERE item_id = ? AND owner_id = ?', [$this->item_id, $this->owner_id]);
|
||||
} elseif (!$wearedCount->c) {
|
||||
//если слот пуст, одеваем новый предмет
|
||||
DBPDO::INIT()->execute('UPDATE inventory SET dressed_slot = item_type WHERE item_id = ? AND owner_id = ?', [$this->item_id, $this->owner_id]);
|
||||
} else {
|
||||
/* проверка на переполнение слотов */
|
||||
$error = self::TOO_MANY_ITEMS_IN_SLOTS;
|
||||
DressedItems::undressAllItems($this->owner_id);
|
||||
}
|
||||
} elseif ($this->item_type == self::ITEM_TYPE_RING) {
|
||||
// работаем с кольцами
|
||||
if ($wearedCount->c < 3) {
|
||||
// Сравниваем массив колец и массив слотов для колец.
|
||||
$emptyRingSlots = array_diff([9, 10, 11], $itemInSlot);
|
||||
// Сортируем массив свободных слотов по возрастанию.
|
||||
sort($emptyRingSlots);
|
||||
// Одеваем предмет в первый свободный слот.
|
||||
DBPDO::INIT()->execute('update inventory set dressed_slot = ? where item_id = ?', [$emptyRingSlots[0], $this->item_id]);
|
||||
} elseif ($wearedCount->c == 3) {
|
||||
// Cнимаем предмет из последнего слота 11 и одеваем новый предмет
|
||||
DBPDO::INIT()->execute('UPDATE inventory SET dressed_slot = 0 WHERE dressed_slot = 11');
|
||||
DBPDO::INIT()->execute('UPDATE inventory SET dressed_slot = 11 WHERE item_id = ?', $this->item_id);
|
||||
} else {
|
||||
/* проверка на переполнение слотов */
|
||||
$error = self::TOO_MANY_ITEMS_IN_SLOTS;
|
||||
DressedItems::undressAllItems($this->owner_id);
|
||||
}
|
||||
} else {
|
||||
$error = self::UNKNOWN_ITEM_TYPE;
|
||||
}
|
||||
|
||||
return isset($error) ? $error : true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $itemId
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function destroyItem($itemId): bool
|
||||
{
|
||||
$db = new DBPDO();
|
||||
return $db->execute('delete from inventory where dressed_slot = 0 and owner_id = ? and item_id = ?', [$_SESSION['uid'], $itemId]);
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
namespace Battles;
|
||||
abstract class Item
|
||||
class Item
|
||||
{
|
||||
protected $item_id;
|
||||
protected $name;
|
||||
@ -49,9 +49,17 @@ abstract class Item
|
||||
*/
|
||||
public function __construct($row)
|
||||
{
|
||||
foreach ($this as $key => $value) {
|
||||
if (isset($row[$key])) {
|
||||
$this->$key = $row[$key];
|
||||
if (is_array($row)) {
|
||||
foreach ($this as $key => $value) {
|
||||
if (isset($row[$key])) {
|
||||
$this->$key = $row[$key];
|
||||
}
|
||||
}
|
||||
} elseif (is_object($row)) {
|
||||
foreach ($this as $name => $value) {
|
||||
if (isset($row->$name)) {
|
||||
$this->$name = $row->$name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -94,14 +102,7 @@ abstract class Item
|
||||
}
|
||||
}
|
||||
|
||||
abstract public function printInfo();
|
||||
|
||||
public function printImage()
|
||||
{
|
||||
echo <<<IMG
|
||||
<img src="/i/sh/{$this->image}" class="item-wrap-normal" alt="">
|
||||
IMG;
|
||||
}
|
||||
|
||||
protected function wrap(int $number):string
|
||||
{
|
||||
|
@ -52,7 +52,7 @@ class CureInjury extends Magic
|
||||
} else {
|
||||
$this->target = new User($this->target);
|
||||
}
|
||||
$this->login = $this->target->login;
|
||||
$this->login = $this->target->getLogin();
|
||||
return ($this->isVisible($caster, $this->target) && $this->isNotDead($caster) && $this->enoughMana($caster) && $this->isNotInBattle($caster));
|
||||
}
|
||||
}
|
@ -3,7 +3,6 @@
|
||||
namespace Battles;
|
||||
|
||||
use Battles\Database\DBPDO;
|
||||
use Exceptions\GameException;
|
||||
|
||||
class User
|
||||
{
|
||||
@ -14,48 +13,28 @@ class User
|
||||
protected $realname;
|
||||
protected $borndate;
|
||||
protected $info;
|
||||
protected $level = 0;
|
||||
protected $align = 0;
|
||||
protected $level;
|
||||
protected $align;
|
||||
protected $clan;
|
||||
protected $money = 0;
|
||||
protected $strength = 0;
|
||||
protected $dexterity = 0;
|
||||
protected $intuition = 0;
|
||||
protected $endurance = 0;
|
||||
protected $intelligence = 0;
|
||||
protected $wisdom = 0;
|
||||
protected $health;
|
||||
protected $mana;
|
||||
protected $ip;
|
||||
protected $session_id;
|
||||
protected $money;
|
||||
protected $ip = 0;
|
||||
|
||||
protected $admin = 0;
|
||||
protected $enter_game;
|
||||
protected $room;
|
||||
protected $block;
|
||||
protected $shadow;
|
||||
// Удар кулаком всегда 1-2.
|
||||
protected $minDamage = 1;
|
||||
protected $maxDamage = 2;
|
||||
//Броня без предметов не существует.
|
||||
protected $headArmor = 0;
|
||||
protected $chestArmor = 0;
|
||||
protected $legArmor = 0;
|
||||
protected $free_stat_points = 0;
|
||||
private const STAT_MAXIMUM_AMOUNT = 40;
|
||||
private const ERROR_STAT_IS_MAXIMUM = 'Ошибка: Параметр достиг своего лимита!';
|
||||
private const ERROR_STAT_UNKNOWN = 'Ошибка: Неизвестный параметр!';
|
||||
|
||||
// Пока несуществующие, для совместимости.
|
||||
protected $married = 'Someone или нет.';
|
||||
protected $experience = 200;
|
||||
protected $battle = 0;
|
||||
protected $in_tower = 0; // Скорее башню похороним чем запустим...
|
||||
protected $zayavka = 0;
|
||||
// Динамически рассчитываемые
|
||||
protected $maxHealth = 5;
|
||||
protected $maxMana = 5;
|
||||
protected static $db;
|
||||
|
||||
public function __construct(int $user)
|
||||
public const INFO_CHAR_LIMIT = 1500;
|
||||
|
||||
public function __construct($user)
|
||||
{
|
||||
self::$db = DBPDO::INIT();
|
||||
$user_query = self::$db->fetch('SELECT * FROM users WHERE id = ? OR login = ?', [$user, $user]);
|
||||
@ -64,51 +43,8 @@ class User
|
||||
$this->$key = $user_query[$key];
|
||||
}
|
||||
}
|
||||
$this->maxHealth = round(($this->endurance * 3) + ($this->endurance / 2) * ($this->level - 1) + ($this->endurance / 5) * (($this->level - 1) * ($this->level - 2) / 2));
|
||||
$this->maxMana = round(($this->wisdom * 3) + ($this->wisdom / 2) * ($this->level - 1) + ($this->wisdom / 5) * (($this->level - 1) * ($this->level - 2) / 2));
|
||||
}
|
||||
|
||||
/**
|
||||
* Отдаёт информацию о базовом(!) стате.
|
||||
* @param $stat_name - имя стата. Может принимать значения 'strength', 'dexterity', 'intuition', 'endurance', 'intelligence', 'wisdom'.
|
||||
* @param int $isMainWindow - переключатель "главного окна". Если включить, дополнительно будет показывать ссылку на повышение стата на 1, при условии наличия свободных очков статов.
|
||||
* @return string
|
||||
* @throws GameException
|
||||
*/
|
||||
public function getStat($stat_name, $isMainWindow = 0):string
|
||||
{
|
||||
$allowed = ['strength', 'dexterity', 'intuition', 'endurance', 'intelligence', 'wisdom'];
|
||||
if (in_array($stat_name, $allowed)) {
|
||||
if ($this->free_stat_points && $isMainWindow && $this->$stat_name < self::STAT_MAXIMUM_AMOUNT) {
|
||||
return sprintf('%s <a href="/main.php?edit=%s&ups=%s">[+]</a>', $this->$stat_name, mt_rand(), $stat_name);
|
||||
} else {
|
||||
return $this->$stat_name;
|
||||
}
|
||||
} else {
|
||||
throw new GameException(self::ERROR_STAT_UNKNOWN);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Повышает один из выбранных статов на 1, но не выше self::STAT_MAXIMUM_AMOUNT при условии наличия свободных очков статов.
|
||||
* @param string $stat_name - имя стата. Может принимать значения 'strength', 'dexterity', 'intuition', 'endurance', 'intelligence', 'wisdom'.
|
||||
* @throws GameException
|
||||
*/
|
||||
public function addOnePointToStat(string $stat_name)
|
||||
{
|
||||
$allowed = ['strength', 'dexterity', 'intuition', 'endurance', 'intelligence', 'wisdom'];
|
||||
if (in_array($stat_name, $allowed)) {
|
||||
if ($this->free_stat_points > 0 && $this->$stat_name <= self::STAT_MAXIMUM_AMOUNT) {
|
||||
$query = "UPDATE users SET {$stat_name} = {$stat_name} + 1, free_stat_points = free_stat_points - 1 WHERE id = ?";
|
||||
self::$db->execute($query,$this->id);
|
||||
} else {
|
||||
throw new GameException(self::ERROR_STAT_IS_MAXIMUM);
|
||||
}
|
||||
} else {
|
||||
throw new GameException(self::ERROR_STAT_UNKNOWN);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected function showStarSign(): ?string
|
||||
{
|
||||
@ -154,22 +90,22 @@ class User
|
||||
return $sign ?? null;
|
||||
}
|
||||
|
||||
public function getHealth(): string
|
||||
|
||||
/**
|
||||
* @param int $userId
|
||||
* @param int $type
|
||||
* @param string $name
|
||||
* @param int $time
|
||||
* @param string|null $json_modifiers_list (str, dex, int, end, intel, wis).
|
||||
* @return bool
|
||||
*/
|
||||
public static function setUserEffect(int $userId, int $type, string $name, int $time, string $json_modifiers_list = null): bool
|
||||
{
|
||||
return $this->health . '/' . $this->maxHealth;
|
||||
$mods = json_decode($json_modifiers_list);
|
||||
return self::$db->execute('INSERT INTO users_effects (owner_id, type, name, remaining_time, mod_strength, mod_dexterity, mod_intuition, mod_endurance, mod_intelligence, mod_wisdom) VALUES (?,?,?,?,?,?,?,?,?,?)', [$userId, $type, $name, $time, $mods->str ?? null, $mods->dex ?? null, $mods->int ?? null, $mods->end ?? null, $mods->intel ?? null, $mods->wis ?? null]);
|
||||
}
|
||||
|
||||
public function getMana(): string
|
||||
{
|
||||
return $this->mana . '/' . $this->maxMana;
|
||||
}
|
||||
|
||||
public static function setUserEffect(int $userId, int $type, string $name, int $time):bool
|
||||
{
|
||||
return self::$db->execute('INSERT INTO users_effects (owner_id, type, name, remaining_time) VALUES (?,?,?,?)',[$userId, $type, $name, $time]);
|
||||
}
|
||||
|
||||
public static function removeUserEffect(int $userId, int $type):bool
|
||||
public static function removeUserEffect(int $userId, int $type): bool
|
||||
{
|
||||
if (self::$db->fetch('SELECT 1 FROM users_effects WHERE owner_id = ? AND type = ?', [$userId, $type])) {
|
||||
self::$db->execute('DELETE FROM users_effects WHERE owner_id = ? AND type = ?', [$userId, $type]);
|
||||
@ -185,14 +121,6 @@ class User
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
*/
|
||||
public function setId(int $id): void
|
||||
{
|
||||
$this->id = $id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
@ -225,6 +153,11 @@ class User
|
||||
$this->pass = $pass;
|
||||
}
|
||||
|
||||
public function savePass()
|
||||
{
|
||||
self::$db->execute('UPDATE users SET pass = ? WHERE id = ?', [$this->pass, $this->id]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
@ -353,101 +286,6 @@ class User
|
||||
$this->money = $money;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getStrength(): int
|
||||
{
|
||||
return $this->strength;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $strength
|
||||
*/
|
||||
public function setStrength(int $strength): void
|
||||
{
|
||||
$this->strength = $strength;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getDexterity(): int
|
||||
{
|
||||
return $this->dexterity;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $dexterity
|
||||
*/
|
||||
public function setDexterity(int $dexterity): void
|
||||
{
|
||||
$this->dexterity = $dexterity;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getIntuition(): int
|
||||
{
|
||||
return $this->intuition;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $intuition
|
||||
*/
|
||||
public function setIntuition(int $intuition): void
|
||||
{
|
||||
$this->intuition = $intuition;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getEndurance(): int
|
||||
{
|
||||
return $this->endurance;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $endurance
|
||||
*/
|
||||
public function setEndurance(int $endurance): void
|
||||
{
|
||||
$this->endurance = $endurance;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getIntelligence(): int
|
||||
{
|
||||
return $this->intelligence;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $intelligence
|
||||
*/
|
||||
public function setIntelligence(int $intelligence): void
|
||||
{
|
||||
$this->intelligence = $intelligence;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getWisdom(): int
|
||||
{
|
||||
return $this->wisdom;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $wisdom
|
||||
*/
|
||||
public function setWisdom(int $wisdom): void
|
||||
{
|
||||
$this->wisdom = $wisdom;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
@ -465,21 +303,6 @@ class User
|
||||
$this->ip = $ip;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getSessionId()
|
||||
{
|
||||
return $this->session_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $session_id
|
||||
*/
|
||||
public function setSessionId($session_id): void
|
||||
{
|
||||
$this->session_id = $session_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
@ -489,14 +312,6 @@ class User
|
||||
return $this->admin;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $admin
|
||||
*/
|
||||
public function setAdmin(int $admin): void
|
||||
{
|
||||
$this->admin = $admin;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
@ -558,103 +373,18 @@ class User
|
||||
*/
|
||||
public function setShadow($shadow): void
|
||||
{
|
||||
$this->shadow = $shadow;
|
||||
$shadows = [
|
||||
'm01', 'm02', 'm03', 'm04', 'm05', 'm06', 'm07', 'm08', 'm09', 'm10',
|
||||
'f01', 'f02', 'f03', 'f04', 'f05', 'f06', 'f07', 'f08', 'f09', 'f10',
|
||||
];
|
||||
if (in_array($shadow, $shadows) && $this->getShadow() == '0.png') {
|
||||
$this->shadow = $shadow . '.png';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getMinDamage(): int
|
||||
public function saveShadow()
|
||||
{
|
||||
return $this->minDamage;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getMaxDamage(): int
|
||||
{
|
||||
return $this->maxDamage;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getHeadArmor(): int
|
||||
{
|
||||
return $this->headArmor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $headArmor
|
||||
*/
|
||||
public function setHeadArmor(int $headArmor): void
|
||||
{
|
||||
$this->headArmor = $headArmor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getChestArmor(): int
|
||||
{
|
||||
return $this->chestArmor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $chestArmor
|
||||
*/
|
||||
public function setChestArmor(int $chestArmor): void
|
||||
{
|
||||
$this->chestArmor = $chestArmor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getLegArmor(): int
|
||||
{
|
||||
return $this->legArmor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $legArmor
|
||||
*/
|
||||
public function setLegArmor(int $legArmor): void
|
||||
{
|
||||
$this->legArmor = $legArmor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getFreeStatPoints(): int
|
||||
{
|
||||
return $this->free_stat_points;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $free_stat_points
|
||||
*/
|
||||
public function setFreeStatPoints(int $free_stat_points): void
|
||||
{
|
||||
$this->free_stat_points = $free_stat_points;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getMarried(): string
|
||||
{
|
||||
return $this->married;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $married
|
||||
*/
|
||||
public function setMarried(string $married): void
|
||||
{
|
||||
$this->married = $married;
|
||||
self::$db->execute('UPDATE users SET shadow = ? WHERE id = ?', [$this->getShadow(), $this->getId()]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -721,20 +451,47 @@ class User
|
||||
$this->zayavka = $zayavka;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return float|int
|
||||
*/
|
||||
public function getMaxHealth()
|
||||
public function saveAnketa()
|
||||
{
|
||||
return $this->maxHealth;
|
||||
self::$db->execute('UPDATE users SET realname = ?, info = ? WHERE id = ?', [$this->realname, $this->info, $this->id]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return float|int
|
||||
*/
|
||||
public function getMaxMana()
|
||||
public function setOnline()
|
||||
{
|
||||
return $this->maxMana;
|
||||
self::$db->execute('update online set real_time = ? where user_id = ?', [time(), $this->getId()]);
|
||||
}
|
||||
|
||||
public function setInjury(int $type): bool
|
||||
{
|
||||
if (!in_array($type,[11,12,13,14])) {
|
||||
return false;
|
||||
}
|
||||
$names1 = ['разбитый нос', 'сотрясение первой степени', 'потрепанные уши', 'прикушенный язык', 'перелом переносицы', 'растяжение ноги', 'растяжение руки', 'подбитый глаз', 'синяк под глазом', 'кровоточащее рассечение', 'отбитая «пятая точка»', 'заклинившая челюсть', 'выбитый зуб «мудрости»', 'косоглазие'];
|
||||
$names2 = ['отбитые почки', 'вывих «вырезано цензурой»', 'сотрясение второй степени', 'оторванное ухо', 'вывих руки', 'оторванные уши', 'поврежденный позвоночник', 'поврежденный копчик', 'разрыв сухожилия', 'перелом ребра', 'перелом двух ребер', 'вывих ноги', 'сломанная челюсть'];
|
||||
$names3 = ['пробитый череп', 'разрыв селезенки', 'смещение позвонков', 'открытый перелом руки', 'открытый перелом «вырезано цензурой»', 'излом носоглотки', 'непонятные, но множественные травмы', 'сильное внутреннее кровотечение', 'раздробленная коленная чашечка', 'перелом шеи', 'смещение позвонков', 'открытый перелом ключицы', 'перелом позвоночника', 'вывих позвоночника', 'сотрясение третьей степени'];
|
||||
$param_names = ['str','dex','int','end','intel','wis',];
|
||||
shuffle($param_names);
|
||||
switch ($type) {
|
||||
case 11:
|
||||
shuffle($names1);
|
||||
$name = UserEffects::$effectName[$type] . ': ' . $names1(0);
|
||||
self::setUserEffect($this->id, $type, $name, strtotime('30min'), json_encode([$param_names(0) => -1]));
|
||||
break;
|
||||
case 12:
|
||||
shuffle($names2);
|
||||
$name = UserEffects::$effectName[$type] . ': ' . $names2(0);
|
||||
self::setUserEffect($this->id, $type, $name, strtotime('3hours'), json_encode([$param_names(0) => mt_rand(-3,-1), $param_names(1) => mt_rand(-3,-1)]));
|
||||
break;
|
||||
case 13:
|
||||
shuffle($names3);
|
||||
$name = UserEffects::$effectName[$type] . ': ' . $names3(0);
|
||||
self::setUserEffect($this->id, $type, $name, strtotime('12hours'), json_encode([$param_names(0) => mt_rand(-5,-1), $param_names(1) => mt_rand(-5,-1), $param_names(2) => mt_rand(-5,-1)]));
|
||||
break;
|
||||
default: //type 14
|
||||
self::setUserEffect($this->id, $type, UserEffects::$effectName[$type], strtotime('1day'), json_encode([$param_names(0) => -10]));
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -10,10 +10,10 @@ trait UserEffects
|
||||
4 => 'Заклятие хаоса',
|
||||
5 => 'Заклятие обезличивания',
|
||||
10 => 'паралич',
|
||||
11 => 'легкая травма',
|
||||
12 => 'средняя травма',
|
||||
13 => 'тяжёлая травма',
|
||||
14 => 'неизлечимая травма',
|
||||
11 => 'Легкая травма',
|
||||
12 => 'Средняя травма',
|
||||
13 => 'Тяжёлая травма',
|
||||
14 => 'Неизлечимая травма',
|
||||
20 => 'Проверка Паладинов',
|
||||
21 => 'Сила нейтралитета',
|
||||
22 => 'Защита от кулачного нападения',
|
||||
@ -49,4 +49,40 @@ trait UserEffects
|
||||
1022 => 'невидимость',
|
||||
9994 => 'Антидот/Путы (Эликсир?)',
|
||||
];
|
||||
|
||||
public static $effectImage = [
|
||||
1 => 'travma.gif',
|
||||
2 => 'magic/sleep.gif',
|
||||
3 => 'magic/sleepf.gif',
|
||||
4 => 'magic/haos.gif',
|
||||
5 => 'magic/obezl.gif',
|
||||
6 => 'expx15.gif',
|
||||
7 => 'euphoria.png',
|
||||
8 => 'sleep_obj.gif',
|
||||
10 => 'magic/chains.gif',
|
||||
11 => 'travma.gif',
|
||||
12 => 'travma.gif',
|
||||
13 => 'travma.gif',
|
||||
14 => 'travma.gif',
|
||||
20 => 'check.gif',
|
||||
21 => 'magic/al_neut_power.gif',
|
||||
22 => 'magic/fist_def.gif',
|
||||
201 => 'magic/defence.gif',
|
||||
202 => 'magic/devastate.gif',
|
||||
203 => 'magic/spell_luck.gif',
|
||||
215 => 'magic/wis_air_def1.gif',
|
||||
216 => 'magic/wis_air_def2.gif',
|
||||
217 => 'magic/wis_air_def3.gif',
|
||||
218 => 'magic/wis_earth_def1.gif',
|
||||
219 => 'magic/wis_earth_def2.gif',
|
||||
220 => 'magic/wis_earth_def3.gif',
|
||||
221 => 'magic/wis_fire_def1.gif',
|
||||
222 => 'magic/wis_fire_def2.gif',
|
||||
223 => 'magic/wis_fire_def3.gif',
|
||||
224 => 'magic/wis_water_def1.gif',
|
||||
225 => 'magic/wis_water_def2.gif',
|
||||
226 => 'magic/wis_water_def3.gif',
|
||||
227 => 'magic/attack_defence.gif',
|
||||
1022 => 'sh/hidden.gif',
|
||||
];
|
||||
}
|
@ -1,9 +1,9 @@
|
||||
<?php
|
||||
namespace Battles;
|
||||
use Battles\Database\DBPDO;
|
||||
use Battles\Models\EffectsModel;
|
||||
use Exceptions\GameException;
|
||||
|
||||
class UserInfo extends User
|
||||
class UserInfo extends UserStats
|
||||
{
|
||||
use Rooms;
|
||||
//Статусы того, кто смотрит на информацию.
|
||||
@ -25,13 +25,13 @@ class UserInfo extends User
|
||||
$dressedItems = $di->getItemsInSlots();
|
||||
for ($i = 1; $i <= 12; $i++) {
|
||||
echo sprintf('<div class="slot-%s">', $i);
|
||||
if (!empty($dressedItems[$i])) {
|
||||
if (!empty($dressedItems->$i)) {
|
||||
if (!$isBattle && $isMain) {
|
||||
$itemString = '<a href="?edit=%s&drop=%s"><img src="/i/sh/%s" class="item-wrap-normal" alt="%s" title="%s"></a>';
|
||||
echo sprintf($itemString, mt_rand(), $i, $dressedItems[$i]['image'], $dressedItems[$i]['name'], $dressedItems[$i]['name']);
|
||||
echo sprintf('<a href="?edit=%s&drop=%s"><img src="/i/sh/%s" class="item-wrap-normal" alt="%s" title="%s"></a>',
|
||||
mt_rand(), $i, $dressedItems->$i->image, $dressedItems->$i->name, $dressedItems->$i->name);
|
||||
} else {
|
||||
$itemString = '<img src="/i/sh/%s" class="item-wrap-normal tip" alt="%s"><span class="tiptext"><strong>%s</strong></span>';
|
||||
echo sprintf($itemString, $dressedItems[$i]['image'], $dressedItems[$i]['name'], $dressedItems[$i]['name']);
|
||||
echo sprintf('<img src="/i/sh/%s" class="item-wrap-normal tip" alt="%s"><span class="tiptext"><strong>%s</strong></span>',
|
||||
$dressedItems->$i->image, $dressedItems->$i->name, $dressedItems->$i->name);
|
||||
}
|
||||
} else {
|
||||
echo sprintf('<img src="/i/sh/noitem.png" class="item-wrap-normal" title="Пустой слот [%s]" alt="Пустой слот [%s]">', $i, $i);
|
||||
@ -40,8 +40,8 @@ class UserInfo extends User
|
||||
}
|
||||
echo '<div class="slot-image">';
|
||||
if ($isBattle) {
|
||||
$sh = '<img src="/i/shadow/%s" alt="%s" class="tip"><span class="tiptext"><b>%s</b>Уровень: %s<br>Сила: %s<br>Ловкость: %s<br>Интуиция: %s<br>Выносливость: %s<br>Интеллект: %s<br>Мудрость: %s</span>';
|
||||
echo sprintf($sh, $this->shadow, $this->login, $this->login, $this->level, $this->strength, $this->dexterity, $this->intuition, $this->endurance, $this->intelligence, $this->wisdom);
|
||||
echo sprintf('<img src="/i/shadow/%s" alt="%s" class="tip"><span class="tiptext"><b>%s</b>Уровень: %s<br>Сила: %s<br>Ловкость: %s<br>Интуиция: %s<br>Выносливость: %s<br>Интеллект: %s<br>Мудрость: %s</span>',
|
||||
$this->shadow, $this->login, $this->login, $this->level, $this->strength, $this->dexterity, $this->intuition, $this->endurance, $this->intelligence, $this->wisdom);
|
||||
unset($sh);
|
||||
} else {
|
||||
echo '<img src="/i/shadow/' . $this->shadow . '" alt="' . $this->login . '">';
|
||||
@ -54,12 +54,12 @@ class UserInfo extends User
|
||||
$captions = 'Уровень:<br>Сила:<br>Ловкость:<br>Интуиция:<br>Выносливость:<br>Интеллект:<br>Мудрость:<br>Местонахождение:';
|
||||
$variables =
|
||||
$this->level . '<br>' .
|
||||
parent::getStat('strength') . '<br>' .
|
||||
parent::getStat('dexterity') . '<br>' .
|
||||
parent::getStat('intuition') . '<br>' .
|
||||
parent::getStat('endurance') . '<br>' .
|
||||
parent::getStat('intelligence') . '<br>' .
|
||||
parent::getStat('wisdom') . '<br>' .
|
||||
parent::getFullStats()->strength . '<br>' .
|
||||
parent::getFullStats()->dexterity . '<br>' .
|
||||
parent::getFullStats()->intuition . '<br>' .
|
||||
parent::getFullStats()->endurance . '<br>' .
|
||||
parent::getFullStats()->intelligence . '<br>' .
|
||||
parent::getFullStats()->wisdom . '<br>' .
|
||||
Rooms::$roomNames[$this->room];
|
||||
if ($isMainWindow) {
|
||||
$this->Bank = new Bank($this->id);
|
||||
@ -78,31 +78,68 @@ class UserInfo extends User
|
||||
$this->money . '<br>' .
|
||||
$this->Bank->getMoney();
|
||||
}
|
||||
$nameString = '';
|
||||
if ($this->align) {
|
||||
$nameString = sprintf('<img src="/i/align_%s.png" alt="Склонность">', $this->align);
|
||||
$nameString = null;
|
||||
$nameString .= $this->align ? "<img src='/i/align_$this->align.png' alt='Склонность'>" : "";
|
||||
$nameString .= $this->block ? "<span class='private' style='text-decoration: line-through;'>$this->login</span>" : "<b>$this->login</b>";
|
||||
$nameString .= $this->clan ? "<img src='/i/clan/$this->clan.png' alt='Клан'>" : "";
|
||||
|
||||
echo <<<HTML
|
||||
<div class="user-info">
|
||||
<div class="info"><b>$nameString</b></div><!-- info -->
|
||||
<div class="stats-container">
|
||||
<div class="column">$captions</div><!-- column -->
|
||||
<div class="column">$variables</div><!-- column -->
|
||||
</div><!-- stats-container -->
|
||||
</div><!-- user-info -->
|
||||
HTML;
|
||||
}
|
||||
|
||||
/**
|
||||
* О персонаже для модераторов.
|
||||
* @return string|null
|
||||
*/
|
||||
private function showPrivateData(): ?string
|
||||
{
|
||||
if (!$this->watcherIsAdmin || !$this->watcherIsModerator) {
|
||||
return null;
|
||||
}
|
||||
if ($this->block) {
|
||||
$nameString .= '<span class="private"><s>' . $this->login . '</s></span>';
|
||||
} else {
|
||||
$nameString .= ' <b>' . $this->login . '</b> ';
|
||||
$birthday = date('d.m.Y', strtotime($this->borndate));
|
||||
$userLogs = GameLogs::getUserLogs($this->id);
|
||||
$log = null;
|
||||
while ($userLogRow = $userLogs->fetchArray(SQLITE3_ASSOC)) {
|
||||
$log .= sprintf('<code>%s</code><br>', date('d.m.Y H:i ', strtotime($userLogRow['date'])) . $userLogRow['text']);
|
||||
}
|
||||
if ($this->clan) {
|
||||
$nameString .= sprintf('<img src="/i/clan/%s.png" alt="Клан">', $this->clan);
|
||||
}
|
||||
echo '<div class="user-info">';
|
||||
echo '<div class="info">';
|
||||
echo '<b>' . $nameString . '</b>';
|
||||
echo '</div><!-- info -->';
|
||||
echo '<div class="stats-container">';
|
||||
echo '<div class="column">';
|
||||
echo $captions;
|
||||
echo '</div><!-- column -->';
|
||||
echo '<div class="column">';
|
||||
echo $variables;
|
||||
echo '</div><!-- column -->';
|
||||
echo '</div><!-- stats-container -->';
|
||||
echo '</div><!-- user-info -->';
|
||||
$adminData = $this->watcherIsAdmin ? $this->showAdminOnlyData() : null;
|
||||
return <<<INFO
|
||||
<div class="secret-info">
|
||||
E-Mail: $this->email<br>
|
||||
ДР Игрока: $birthday<br>
|
||||
IP Регистрации: $this->ip<br>
|
||||
$adminData<br>
|
||||
<div class="secret-info-user-log"><b>Личное дело</b><br>
|
||||
$log
|
||||
</div><!-- secret-info-user-log -->
|
||||
</div><!-- secret-info -->
|
||||
INFO;
|
||||
}
|
||||
|
||||
/**
|
||||
* О персонаже для администраторов.
|
||||
* @return string|null
|
||||
*/
|
||||
private function showAdminOnlyData(): ?string
|
||||
{
|
||||
$this->Bank = new Bank($this->id);
|
||||
$bankMoney = $this->Bank->getMoney();
|
||||
return <<<INFO
|
||||
ИД Игрока: $this->id<br>
|
||||
ИД Комнаты: $this->room<br>
|
||||
Деньги: $this->money<br>
|
||||
Деньги в банке: $bankMoney<br>
|
||||
Опыт: $this->experience<br>
|
||||
Нераспределённые очки: $this->free_stat_points<br>
|
||||
INFO;
|
||||
|
||||
}
|
||||
|
||||
private function Info()
|
||||
@ -110,10 +147,7 @@ class UserInfo extends User
|
||||
echo '<div class="user-info-container">';
|
||||
$this->UserInfoDoll();
|
||||
$this->UserInfoStats();
|
||||
echo '<div class="slot-lower">';
|
||||
if ($this->married) {
|
||||
echo sprintf('<a href = "inf.php?%s" target = _blank ><img alt = "В браке с %s" src = "i/married.gif" title = "В браке с %s"></a >', $this->married, $this->married, $this->married);
|
||||
}
|
||||
echo '<div class="slot-lower"> <!-- statuses! -->';
|
||||
echo '</div><!-- slot-lower -->';
|
||||
echo '<div class="user-signs">';
|
||||
echo sprintf('<img src="i/zodiac/%s.png" alt="Родовой знак">', $this->showStarSign());
|
||||
@ -122,31 +156,10 @@ class UserInfo extends User
|
||||
echo '<hr><!-- Нижняя часть -->';
|
||||
echo '<div class="user-info-container-lower">';
|
||||
echo '<h2>Об игроке</h2>';
|
||||
if ($this->realname) {
|
||||
echo sprintf('Имя: %s<br>', $this->realname);
|
||||
}
|
||||
if ($this->info) {
|
||||
echo nl2br($this->info);
|
||||
}
|
||||
echo $this->realname ? "Имя: $this->realname" : "";
|
||||
echo $this->info ? "<br>" . nl2br($this->info) : "";
|
||||
echo '</div><!-- user-info-container-lower -->';
|
||||
|
||||
if ($this->watcherIsAdmin || $this->watcherIsModerator) {
|
||||
echo '<div class="secret-info">';
|
||||
$infoString = 'E-Mail: %s<br> ДР Игрока: %s<br> IP Регистрации: %s';
|
||||
echo sprintf($infoString, $this->email, date('d.m.Y', strtotime($this->borndate)), $this->ip);
|
||||
if ($this->watcherIsAdmin) {
|
||||
$this->Bank = new Bank($this->id);
|
||||
$infoString = '<br><span>ИД Игрока: %s<br> ИД Комнаты: %s<br> Деньги: %s<br> Деньги в банке: %s<br> Опыт: %s<br> Нераспределённые очки: %s<br> Текущая сессия: %s</span>';
|
||||
echo sprintf($infoString, $this->id, $this->room, $this->money, $this->Bank->getMoney(), $this->experience, $this->free_stat_points, $this->session_id);
|
||||
}
|
||||
$this->UserLogs = GameLogs::getUserLogs($this->id);
|
||||
echo '<div class="secret-info-user-log"><b>Личное дело</b><br>';
|
||||
while ($userLogRow = $this->UserLogs->fetchArray(SQLITE3_ASSOC)) {
|
||||
echo sprintf('<code>%s</code><br>', date("d.m.Y H:i ", strtotime($userLogRow['date'])) . $userLogRow['text']);
|
||||
}
|
||||
echo '</div><!-- secret-info-user-log -->';
|
||||
echo '</div><!-- secret-info -->';
|
||||
}
|
||||
echo $this->showPrivateData();
|
||||
}
|
||||
|
||||
public function showUserInfo()
|
||||
@ -155,14 +168,14 @@ class UserInfo extends User
|
||||
$effects = new EffectsModel($this->id);
|
||||
|
||||
if ($this->block && (!$this->watcherIsAdmin || !$this->watcherIsModerator)) {
|
||||
throw new GameException('<span class="error">Персонаж ' . $this->login . ' заблокирован!</span>');
|
||||
echo "<span class='error'>Персонаж $this->login заблокирован!</span>";
|
||||
} elseif ($effects->getHideUserInfoStatus() && (!$this->watcherIsAdmin || !$this->watcherIsModerator)) {
|
||||
if ($effects->getHideUserInfoStatus() == -1) {
|
||||
$date = 'навсегда';
|
||||
} else {
|
||||
$date = 'до' . date('d.m.Y', strtotime($effects->getHideUserInfoStatus()));
|
||||
}
|
||||
throw new GameException('<span class="error">Персонаж ' . $this->login . ' обезличен ' . $date . '.</span>');
|
||||
echo "<span class='error'>Персонаж $this->login обезличен $date.</span>";
|
||||
} else {
|
||||
$this->Info();
|
||||
}
|
||||
@ -194,4 +207,26 @@ class UserInfo extends User
|
||||
echo '</div><!-- user-info-container -->';
|
||||
}
|
||||
|
||||
public function showUserEffects(): string
|
||||
{
|
||||
$effs = DBPDO::INIT()->ofetchAll('SELECT * FROM users_effects WHERE owner_id = ?', $this->id);
|
||||
$img = UserEffects::$effectImage;
|
||||
$r = '';
|
||||
foreach ($effs as $effect) {
|
||||
$timeleft = timeOut($effect->remaining_time - time());
|
||||
$r .= "
|
||||
<div>
|
||||
<img class='image' src='/i/{$img[$effect->type]}' alt='{$effect->name}'>
|
||||
<span class='title'>{$effect->name}</span>
|
||||
<div class='timeleft'>$timeleft</div>
|
||||
</div>
|
||||
";
|
||||
}
|
||||
return $r;
|
||||
}
|
||||
public function showStarSign(): ?string
|
||||
{
|
||||
return parent::showStarSign();
|
||||
}
|
||||
|
||||
}
|
223
classes/Battles/UserStats.php
Normal file
@ -0,0 +1,223 @@
|
||||
<?php
|
||||
# Date: 03.02.2021 (11:05)
|
||||
|
||||
namespace Battles;
|
||||
|
||||
use Exceptions\GameException;
|
||||
|
||||
class UserStats extends User
|
||||
{
|
||||
protected $strength;
|
||||
protected $dexterity;
|
||||
protected $intuition;
|
||||
protected $endurance;
|
||||
protected $intelligence;
|
||||
protected $wisdom;
|
||||
protected $health;
|
||||
protected $mana;
|
||||
protected $free_stat_points;
|
||||
private const STAT_MAXIMUM_AMOUNT = 40;
|
||||
private const ERROR_STAT_IS_MAXIMUM = 'Ошибка: Параметр достиг своего лимита!';
|
||||
private const ERROR_STAT_UNKNOWN = 'Ошибка: Неизвестный параметр!';
|
||||
|
||||
//// Неизменяемые для игрока(!) переменные.
|
||||
// Удар кулаком всегда 1-2.
|
||||
protected $minDamage = 1;
|
||||
protected $maxDamage = 2;
|
||||
// Природная броня всегда 0.
|
||||
// Зачем их три, если во всех формулах она одна?
|
||||
protected $headArmor = 0;
|
||||
protected $chestArmor = 0;
|
||||
protected $legArmor = 0;
|
||||
// Динамически рассчитываемые
|
||||
protected $maxHealth;
|
||||
protected $maxMana;
|
||||
|
||||
/**
|
||||
* UserStats constructor.
|
||||
*
|
||||
* @param $user
|
||||
*/
|
||||
public function __construct($user)
|
||||
{
|
||||
parent::__construct($user);
|
||||
$this->maxHealth = round(($this->endurance * 3) + ($this->endurance / 2) * ($this->level - 1) + ($this->endurance / 5) * (($this->level - 1) * ($this->level - 2) / 2));
|
||||
$this->maxMana = round(($this->wisdom * 3) + ($this->wisdom / 2) * ($this->level - 1) + ($this->wisdom / 5) * (($this->level - 1) * ($this->level - 2) / 2));
|
||||
}
|
||||
|
||||
/**
|
||||
* Отдаёт информацию о базовом(!) стате.
|
||||
*
|
||||
* @param $stat_name - имя стата. Может принимать значения 'strength', 'dexterity', 'intuition',
|
||||
* 'endurance', 'intelligence', 'wisdom'.
|
||||
* @param int $isMainWindow - переключатель "главного окна". Если включить, дополнительно будет показывать ссылку
|
||||
* на повышение стата на 1, при условии наличия свободных очков статов.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getStat($stat_name, $isMainWindow = 0): string
|
||||
{
|
||||
if (!in_array($stat_name, ['strength', 'dexterity', 'intuition', 'endurance', 'intelligence', 'wisdom'])) {
|
||||
return self::ERROR_STAT_UNKNOWN;
|
||||
}
|
||||
if ($this->free_stat_points && $isMainWindow && $this->$stat_name < self::STAT_MAXIMUM_AMOUNT) {
|
||||
$this->$stat_name .= " <a href='/main.php?edit=" . mt_rand() . "&ups=$stat_name'>[+]</a>";
|
||||
}
|
||||
return $this->$stat_name;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Повышает один из выбранных статов на 1, но не выше self::STAT_MAXIMUM_AMOUNT при условии наличия свободных очков
|
||||
* статов.
|
||||
*
|
||||
* @param string $stat_name - имя стата. Может принимать значения 'strength', 'dexterity', 'intuition',
|
||||
* 'endurance', 'intelligence', 'wisdom'.
|
||||
*
|
||||
* @throws GameException
|
||||
*/
|
||||
public function addOnePointToStat(string $stat_name)
|
||||
{
|
||||
if (!in_array($stat_name, ['strength', 'dexterity', 'intuition', 'endurance', 'intelligence', 'wisdom'])) {
|
||||
throw new GameException(self::ERROR_STAT_UNKNOWN);
|
||||
}
|
||||
if ($this->free_stat_points <= 0 || $this->$stat_name >= self::STAT_MAXIMUM_AMOUNT) {
|
||||
throw new GameException(self::ERROR_STAT_IS_MAXIMUM);
|
||||
} else {
|
||||
$query = "UPDATE users SET {$stat_name} = {$stat_name} + 1, free_stat_points = free_stat_points - 1 WHERE id = ?";
|
||||
self::$db->execute($query, $this->id);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getStrength()
|
||||
{
|
||||
return $this->strength;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getDexterity()
|
||||
{
|
||||
return $this->dexterity;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getIntuition()
|
||||
{
|
||||
return $this->intuition;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getEndurance()
|
||||
{
|
||||
return $this->endurance;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getIntelligence()
|
||||
{
|
||||
return $this->intelligence;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getWisdom()
|
||||
{
|
||||
return $this->wisdom;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getHealth()
|
||||
{
|
||||
return $this->health;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getMana()
|
||||
{
|
||||
return $this->mana;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getFreeStatPoints()
|
||||
{
|
||||
return $this->free_stat_points;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return float
|
||||
*/
|
||||
public function getMaxHealth(): float
|
||||
{
|
||||
return $this->maxHealth;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return float
|
||||
*/
|
||||
public function getMaxMana(): float
|
||||
{
|
||||
return $this->maxMana;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getHeadArmor(): int
|
||||
{
|
||||
return $this->headArmor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getChestArmor(): int
|
||||
{
|
||||
return $this->chestArmor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getLegArmor(): int
|
||||
{
|
||||
return $this->legArmor;
|
||||
}
|
||||
|
||||
public function getFullStats()
|
||||
{
|
||||
$query = "
|
||||
select
|
||||
sum(greatest(strength + (ifnull((select sum(add_strength) from inventory where dressed_slot != 0 and owner_id = $this->id), 0)) + (ifnull((select sum(mod_strength) from users_effects where owner_id = $this->id), 0)), 0)) as strength,
|
||||
sum(greatest(dexterity + (ifnull((select sum(add_dexterity) from inventory where dressed_slot != 0 and owner_id = $this->id), 0)) + (ifnull((select sum(mod_dexterity) from users_effects where owner_id = $this->id), 0)), 0)) as dexterity,
|
||||
sum(greatest(intuition + (ifnull((select sum(add_intuition) from inventory where dressed_slot != 0 and owner_id = $this->id), 0)) + (ifnull((select sum(mod_intuition) from users_effects where owner_id = $this->id), 0)), 0)) as intuition,
|
||||
sum(greatest(endurance + (ifnull((select sum(add_endurance) from inventory where dressed_slot != 0 and owner_id = $this->id), 0)) + (ifnull((select sum(mod_endurance) from users_effects where owner_id = $this->id), 0)), 0)) as endurance,
|
||||
sum(greatest(intelligence + (ifnull((select sum(add_intelligence) from inventory where dressed_slot != 0 and owner_id = $this->id), 0)) + (ifnull((select sum(mod_intelligence) from users_effects where owner_id = $this->id), 0)), 0)) as intelligence,
|
||||
sum(greatest(wisdom + (ifnull((select sum(add_wisdom) from inventory where dressed_slot != 0 and owner_id = $this->id), 0)) + (ifnull((select sum(mod_wisdom) from users_effects where owner_id = $this->id), 0)), 0)) as wisdom,
|
||||
ifnull((select sum(add_accuracy) from inventory where dressed_slot != 0 and owner_id = $this->id), 0) as accuracy,
|
||||
ifnull((select sum(add_evasion) from inventory where dressed_slot != 0 and owner_id = $this->id), 0) as evasion,
|
||||
ifnull((select sum(add_criticals) from inventory where dressed_slot != 0 and owner_id = $this->id), 0) as criticals,
|
||||
sum(greatest($this->minDamage + (ifnull((select sum(add_min_physical_damage) from inventory where dressed_slot != 0 and owner_id = $this->id), 0)), 0)) as min_physical_damage,
|
||||
sum(greatest($this->maxDamage + (ifnull((select sum(add_max_physical_damage) from inventory where dressed_slot != 0 and owner_id = $this->id), 0)), 0)) as max_physical_damage
|
||||
from users where id = $this->id";
|
||||
return self::$db->ofetch($query);
|
||||
}
|
||||
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
if (in_array($user->getRoom(), Config::$caverooms)) {
|
||||
$cavedata = Config::$cavedata ?? [];
|
||||
if (in_array($user->getRoom(), CAVE_ROOMS)) {
|
||||
$cavedata = CAVE_DATA ?? [];
|
||||
$floor = mysql_fetch_row(mysql_query("SELECT `floor` FROM `caveparties` WHERE `user` = '$user[id]' LIMIT 1"));
|
||||
if (!isset($cavedata[$user->getRoom()]['x' . $floor])) {
|
||||
$floor = 1;
|
||||
@ -11,7 +11,7 @@ $lomka1 = $lomka;
|
||||
|
||||
foreach ($lomka1 as $k => $v) {
|
||||
if ($v < _BOTSEPARATOR_) {
|
||||
if (in_array($user->getRoom(), Config::$caverooms)) {
|
||||
if (in_array($user->getRoom(), CAVE_ROOMS)) {
|
||||
mysql_query("UPDATE `caveparties` SET `floor` = $floor, `x` = '" . $cavedata[$user->getRoom()]['x' . $floor] . "', `y` = '" . $cavedata[$user->getRoom()]['y' . $floor] . "', `dir` = '" . $cavedata[$user->getRoom()]['dir' . $floor] . "', `loses` = (`loses`+1) WHERE `user` = '$v' LIMIT 1");
|
||||
}
|
||||
if ($user['laba'] > 0) {
|
||||
|
@ -21,7 +21,7 @@ function cavesys($text)
|
||||
}
|
||||
}
|
||||
|
||||
if (in_array($user->getRoom(), Config::$caverooms)) {
|
||||
if (in_array($user->getRoom(), CAVE_ROOMS)) {
|
||||
include("CaveItems.php");
|
||||
mysql_query('LOCK TABLES `cavebots` WRITE, `caveitems` WRITE, `shop` WRITE, `caveparties` WRITE');
|
||||
$location = mysql_fetch_array(mysql_query("SELECT `x`, `y`, `dir`, `floor` FROM `caveparties` WHERE `user` = '$user[id]' LIMIT 1"));
|
||||
|
@ -1,4 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Battles\GameConfigs;
|
||||
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: lopiu
|
||||
@ -20,11 +23,16 @@ class db
|
||||
{
|
||||
if (!self::$_instance)
|
||||
{
|
||||
self::$_instance = Krugozor\Database\Mysql\Mysql::create("192.168.20.5", "battles", "bottle-neck-horse", 32101)
|
||||
self::$_instance = Krugozor\Database\Mysql\Mysql::create(
|
||||
GameConfigs::DATABASE_HOST,
|
||||
GameConfigs::DATABASE_USER,
|
||||
GameConfigs::DATABASE_PASS,
|
||||
GameConfigs::DATABASE_PORT
|
||||
)
|
||||
// Выбор базы данных
|
||||
->setDatabaseName("battles")
|
||||
->setDatabaseName(GameConfigs::DATABASE_NAME)
|
||||
// Выбор кодировки
|
||||
->setCharset("utf8");
|
||||
->setCharset(GameConfigs::DATABASE_CHARSET);
|
||||
}
|
||||
return self::$_instance;
|
||||
}
|
||||
|
@ -1700,7 +1700,7 @@ class fbattle
|
||||
}
|
||||
|
||||
|
||||
if (in_array($user->getRoom(), Config::$caverooms)) {
|
||||
if (in_array($user->getRoom(), CAVE_ROOMS)) {
|
||||
$location = mysql_fetch_array(mysql_query("SELECT `x`, `y`, `dir` FROM `caveparties` WHERE `user` = '" . $this->user['id'] . "' LIMIT 1"));
|
||||
|
||||
if ($location['dir'] == 0) {
|
||||
@ -1805,7 +1805,7 @@ class fbattle
|
||||
|
||||
function addAction($time, $vars, $vls, $uid)
|
||||
{
|
||||
$ins = mysql_query('INSERT INTO `actions` (`uid`, `time`, `city`, `room`, `vars`, `ip`, `vals`) VALUES ("' . $uid . '", "' . $time . '", "capitalcity", "0", "' . mysql_real_escape_string($vars) . '", "' . mysql_real_escape_string($_SERVER['HTTP_X_REAL_IP']) . '", "' . mysql_real_escape_string($vls) . '")');
|
||||
$ins = mysql_query('INSERT INTO `actions` (`uid`, `time`, `city`, `room`, `vars`, `ip`, `vals`) VALUES ("' . $uid . '", "' . $time . '", "capitalcity", "0", "' . mysql_real_escape_string($vars) . '", "' . $_SERVER['REMOTE_ADDR'] . '", "' . mysql_real_escape_string($vls) . '")');
|
||||
if ($ins) {
|
||||
return true;
|
||||
} else {
|
||||
|
@ -76,7 +76,7 @@ class Quests
|
||||
if (db::c()->getAffectedRows()) {
|
||||
$tms = (time() + 60 * 60 * $pl['time']);
|
||||
db::c()->query('INSERT INTO `actions` (`uid`, `time`, `city`, `room`, `vars`, `ip`, `vals`, `val`) VALUES (?i,?i,"?s",?i,"?s","?s","?s","?s")',
|
||||
$uid, time(), 'capitalcity', 0, 'start_quest' . $id, $_SERVER['HTTP_X_REAL_IP'], 'go', $tms);
|
||||
$uid, time(), 'capitalcity', 0, 'start_quest' . $id, $_SERVER['REMOTE_ADDR'], 'go', $tms);
|
||||
return 'Вы успешно получили задание "' . $pl['name'] . '"';
|
||||
} else {
|
||||
return 'Не удалось получить данное задание ...';
|
||||
|
233
config.php
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Конфиг системных настроек.
|
||||
* Copyright (c) 2018.
|
||||
* Author: Igor Barkov <lopar.4ever@gmail.com>
|
||||
* Project name: Battles-Game
|
||||
@ -35,184 +36,66 @@ spl_autoload_register(function ($className) {
|
||||
}
|
||||
});
|
||||
|
||||
trait Config
|
||||
{
|
||||
public static $db_sqlite = '/volume2/web/battles/databases/logs.sqlite';
|
||||
// Для нападалок. Сперва комнаты в которых нельзя напасть, потом персонажи на которых нельзя напасть.
|
||||
public static $unkilable = [
|
||||
'rooms' => [620, 621, 1051, 1052],
|
||||
'users' => [10962, 10964, 10965],
|
||||
];
|
||||
// Неизвестная херня.
|
||||
public static $canalenters = [620];
|
||||
public static $caverooms = [621];
|
||||
public static $userslots = ['sergi', 'kulon', 'perchi', 'weap', 'bron', 'r1', 'r2', 'r3', 'helm', 'shit', 'boots', 'rybax', 'plaw', 'm1', 'm2', 'm3', 'm4', 'm5', 'm6', 'm7', 'm8', 'm9', 'm10'];
|
||||
// Что-то связанное с магией.
|
||||
public static $elem_align = [
|
||||
"a" => ["a" => "1", "e" => "0", "f" => "0.5", "w" => "0.5"],
|
||||
"e" => ["a" => "0", "e" => "1", "f" => "0.5", "w" => "0.5"],
|
||||
"f" => ["a" => "0.5", "e" => "0.5", "f" => "1", "w" => "0"],
|
||||
"w" => ["a" => "0.5", "e" => "0.5", "f" => "0", "w" => "1"],
|
||||
];
|
||||
public static $elem_bonus = [
|
||||
"a" => ["a" => "1", "e" => "0.75", "f" => "1.25", "w" => "1"],
|
||||
"e" => ["a" => "1.25", "e" => "1", "f" => "1", "w" => "0.75"],
|
||||
"f" => ["a" => "0.75", "e" => "1", "f" => "1", "w" => "1.25"],
|
||||
"w" => ["a" => "1", "e" => "1.25", "f" => "0.75", "w" => "1"],
|
||||
];
|
||||
//Для кланов
|
||||
public static $clan_register_cost = 10000; //стоимость
|
||||
public static $clan_register_lock = 1; //запрет на регистрацию
|
||||
//Банк
|
||||
public static $bank_commission = 0.05; //5%
|
||||
// Старая таблица опыта
|
||||
public static $exptable = [
|
||||
0 => [0, 0, 0, 0, 0, 20],
|
||||
20 => [1, 0, 0, 0, 0, 45],
|
||||
45 => [1, 0, 0, 2, 0, 75],
|
||||
75 => [1, 0, 0, 4, 0, 110],
|
||||
110 => [3, 1, 1, 8, 1, 160], # Это первый уровень
|
||||
// Для нападалок. Сперва комнаты в которых нельзя напасть, потом персонажи на которых нельзя напасть.
|
||||
const UNKILABLE = [
|
||||
'rooms' => [620, 621, 1051, 1052],
|
||||
'users' => [10962, 10964, 10965],
|
||||
];
|
||||
|
||||
160 => [1, 0, 0, 2, 0, 215],
|
||||
215 => [1, 0, 0, 2, 0, 280],
|
||||
280 => [1, 0, 0, 4, 0, 350],
|
||||
350 => [1, 0, 0, 8, 0, 410],
|
||||
410 => [3, 1, 1, 16, 1, 530], # Это второй уровень
|
||||
// Кажется, для пещер.
|
||||
const CANAL_ENTERS = [620];
|
||||
const CAVE_ROOMS = [621];
|
||||
const CAVE_DATA = [
|
||||
621 => [
|
||||
'x1' => 6,
|
||||
'y1' => 11,
|
||||
'dir1' => 1,
|
||||
'x2' => 10,
|
||||
'y2' => 8,
|
||||
'dir2' => 1,
|
||||
'x3' => 20,
|
||||
'y3' => 4,
|
||||
'dir3' => 1,
|
||||
'x4' => 10,
|
||||
'y4' => 10,
|
||||
'dir4' => 1,
|
||||
'delay' => 360,
|
||||
'name1' => 'Проклятый Рудник',
|
||||
'name2' => 'Проклятого Рудника'
|
||||
],
|
||||
];
|
||||
|
||||
530 => [1, 0, 0, 8, 0, 670],
|
||||
670 => [1, 0, 0, 12, 0, 830],
|
||||
830 => [1, 0, 0, 16, 0, 950],
|
||||
950 => [1, 0, 0, 24, 0, 1100],
|
||||
1100 => [1, 0, 0, 32, 0, 1300],
|
||||
1300 => [3, 1, 1, 40, 1, 1450], # Это третий уровень
|
||||
const EXPTABLE = [
|
||||
0 => [0, 0, 0, 0, 0, 20],
|
||||
20 => [1, 0, 0, 0, 0, 45],
|
||||
45 => [1, 0, 0, 2, 0, 75],
|
||||
75 => [1, 0, 0, 4, 0, 110],
|
||||
110 => [3, 1, 1, 8, 1, 160], # Это первый уровень
|
||||
|
||||
1450 => [1, 0, 0, 10, 0, 1650],
|
||||
1650 => [1, 0, 0, 20, 0, 1850],
|
||||
1850 => [1, 0, 0, 30, 0, 2050],
|
||||
2050 => [1, 0, 0, 40, 0, 2200],
|
||||
2200 => [1, 0, 0, 50, 0, 2500],
|
||||
2500 => [5, 1, 1, 70, 1, 2900], # Это четвёртый уровень
|
||||
160 => [1, 0, 0, 2, 0, 215],
|
||||
215 => [1, 0, 0, 2, 0, 280],
|
||||
280 => [1, 0, 0, 4, 0, 350],
|
||||
350 => [1, 0, 0, 8, 0, 410],
|
||||
410 => [3, 1, 1, 16, 1, 530], # Это второй уровень
|
||||
|
||||
2900 => [1, 0, 0, 10, 0, 3350],
|
||||
3350 => [1, 0, 0, 20, 0, 3800],
|
||||
3800 => [1, 0, 0, 30, 0, 4200],
|
||||
4200 => [1, 0, 0, 40, 0, 4600],
|
||||
4600 => [1, 0, 0, 50, 0, 5000],
|
||||
5000 => [3, 1, 1, 80, 1, 6000], # Это пятый уровень
|
||||
530 => [1, 0, 0, 8, 0, 670],
|
||||
670 => [1, 0, 0, 12, 0, 830],
|
||||
830 => [1, 0, 0, 16, 0, 950],
|
||||
950 => [1, 0, 0, 24, 0, 1100],
|
||||
1100 => [1, 0, 0, 32, 0, 1300],
|
||||
1300 => [3, 1, 1, 40, 1, 1450], # Это третий уровень
|
||||
|
||||
6000 => [1, 0, 0, 15, 0, 7000],
|
||||
7000 => [1, 0, 0, 30, 0, 8000],
|
||||
8000 => [1, 0, 0, 40, 0, 9000],
|
||||
9000 => [1, 0, 0, 50, 0, 10000],
|
||||
10000 => [1, 0, 0, 40, 0, 11000],
|
||||
11000 => [1, 0, 0, 50, 0, 12000],
|
||||
12000 => [1, 0, 0, 60, 0, 12500],
|
||||
12500 => [3, 1, 1, 90, 1, 14000], # Это шестой уровень
|
||||
1450 => [1, 0, 0, 10, 0, 1650],
|
||||
1650 => [1, 0, 0, 20, 0, 1850],
|
||||
1850 => [1, 0, 0, 30, 0, 2050],
|
||||
2050 => [1, 0, 0, 40, 0, 2200],
|
||||
2200 => [1, 0, 0, 50, 0, 2500],
|
||||
2500 => [5, 1, 1, 70, 1, 2900], # Это четвёртый уровень
|
||||
|
||||
14000 => [1, 0, 0, 20, 0, 15500],
|
||||
15500 => [1, 0, 0, 30, 0, 17000],
|
||||
17000 => [1, 0, 0, 50, 0, 19000],
|
||||
19000 => [1, 0, 0, 55, 0, 21000],
|
||||
21000 => [1, 0, 0, 50, 0, 23000],
|
||||
23000 => [1, 0, 0, 55, 0, 27000],
|
||||
27000 => [1, 0, 0, 50, 0, 30000],
|
||||
30000 => [5, 1, 1, 100, 1, 60000], # Это седьмой уровень
|
||||
|
||||
60000 => [1, 0, 0, 100, 0, 75000],
|
||||
75000 => [1, 0, 0, 100, 0, 150000],
|
||||
150000 => [1, 0, 0, 150, 0, 175000],
|
||||
175000 => [1, 0, 0, 50, 0, 200000],
|
||||
200000 => [1, 0, 0, 100, 0, 225000],
|
||||
225000 => [1, 0, 0, 50, 0, 250000],
|
||||
250000 => [1, 0, 0, 100, 0, 260000],
|
||||
260000 => [1, 0, 0, 50, 0, 280000],
|
||||
280000 => [1, 0, 0, 100, 0, 300000],
|
||||
300000 => [5, 1, 1, 700, 1, 1500000], # Это восьмой уровень
|
||||
|
||||
1500000 => [1, 0, 0, 500, 0, 1750000],
|
||||
1750000 => [1, 0, 0, 200, 0, 2000000],
|
||||
2000000 => [1, 0, 0, 300, 0, 2175000],
|
||||
2175000 => [1, 0, 0, 100, 0, 2300000],
|
||||
2300000 => [1, 0, 0, 100, 0, 2400000],
|
||||
2400000 => [1, 0, 0, 100, 0, 2500000],
|
||||
2500000 => [1, 0, 0, 200, 0, 2600000],
|
||||
2600000 => [1, 0, 0, 100, 0, 2800000],
|
||||
2800000 => [1, 0, 0, 200, 0, 3000000],
|
||||
3000000 => [5, 1, 2, 1000, 1, 6000000], # Это девятый уровень
|
||||
|
||||
6000000 => [1, 0, 0, 200, 0, 6500000],
|
||||
6500000 => [1, 0, 0, 250, 0, 7500000],
|
||||
7500000 => [1, 0, 0, 200, 0, 8500000],
|
||||
8500000 => [1, 0, 0, 250, 0, 9000000],
|
||||
9000000 => [1, 0, 0, 400, 0, 9250000],
|
||||
9250000 => [1, 0, 0, 250, 0, 9500000],
|
||||
9500000 => [1, 0, 0, 400, 0, 9750000],
|
||||
9750000 => [1, 0, 0, 350, 0, 9900000],
|
||||
9900000 => [1, 0, 0, 500, 0, 10000000],
|
||||
10000000 => [9, 1, 3, 2000, 1, 13000000], # Это десятый уровень
|
||||
|
||||
13000000 => [2, 0, 0, 200, 0, 14000000],
|
||||
14000000 => [2, 0, 0, 200, 0, 15000000],
|
||||
15000000 => [2, 0, 0, 200, 0, 16000000],
|
||||
16000000 => [2, 0, 0, 200, 0, 17000000],
|
||||
17000000 => [2, 0, 0, 200, 0, 17500000],
|
||||
17500000 => [2, 0, 0, 200, 0, 18000000],
|
||||
18000000 => [2, 0, 0, 200, 0, 19000000],
|
||||
19000000 => [2, 0, 0, 200, 0, 19500000],
|
||||
19500000 => [2, 0, 0, 200, 0, 20000000],
|
||||
20000000 => [2, 0, 0, 250, 0, 30000000],
|
||||
30000000 => [2, 0, 0, 200, 0, 32000000],
|
||||
32000000 => [2, 0, 0, 250, 0, 34000000],
|
||||
34000000 => [2, 0, 0, 200, 0, 35000000],
|
||||
35000000 => [2, 0, 0, 250, 0, 36000000],
|
||||
36000000 => [2, 0, 0, 200, 0, 38000000],
|
||||
38000000 => [2, 0, 0, 250, 0, 40000000],
|
||||
40000000 => [2, 0, 0, 200, 0, 42000000],
|
||||
42000000 => [2, 0, 0, 250, 0, 44000000],
|
||||
44000000 => [2, 0, 0, 350, 0, 47000000],
|
||||
47000000 => [2, 0, 0, 300, 0, 50000000],
|
||||
50000000 => [2, 0, 0, 350, 0, 52000000],
|
||||
52000000 => [10, 1, 3, 3000, 1, 58000000], # Это одиннадцатый уровень
|
||||
|
||||
58000000 => [1, 0, 0, 350, 0, 65000000],
|
||||
65000000 => [1, 0, 0, 300, 0, 72000000],
|
||||
72000000 => [1, 0, 0, 350, 0, 77000000],
|
||||
77000000 => [1, 0, 0, 350, 0, 82000000],
|
||||
82000000 => [1, 0, 0, 300, 0, 87000000],
|
||||
87000000 => [1, 0, 0, 350, 0, 92000000],
|
||||
92000000 => [1, 0, 0, 350, 0, 100000000],
|
||||
100000000 => [1, 0, 0, 350, 0, 120000000],
|
||||
120000000 => [2, 0, 0, 400, 0, 140000000],
|
||||
140000000 => [2, 0, 0, 400, 0, 160000000],
|
||||
160000000 => [2, 0, 0, 600, 0, 180000000],
|
||||
180000000 => [2, 0, 0, 400, 0, 210000000],
|
||||
210000000 => [2, 0, 0, 400, 0, 240000000],
|
||||
240000000 => [10, 2, 4, 5000, 1, 260000000], # Это двеннадцатый уровень
|
||||
|
||||
260000000 => [2, 0, 0, 400, 0, 320000000],
|
||||
320000000 => [2, 0, 0, 400, 0, 400000000],
|
||||
400000000 => [3, 0, 0, 600, 0, 455000000],
|
||||
455000000 => [2, 0, 0, 150, 0, 510000000],
|
||||
510000000 => [2, 0, 0, 100, 0, 600000000],
|
||||
600000000 => [2, 0, 0, 300, 0, 750000000],
|
||||
750000000 => [5, 0, 0, 700, 0, 770000000],
|
||||
770000000 => [1, 0, 0, 400, 0, 815000000],
|
||||
815000000 => [1, 0, 0, 200, 0, 860000000],
|
||||
860000000 => [1, 0, 0, 600, 0, 1000000000],
|
||||
1000000000 => [1, 0, 0, 300, 0, 1100000000],
|
||||
1100000000 => [1, 0, 0, 450, 0, 1250000000],
|
||||
1250000000 => [1, 0, 0, 450, 0, 1500000000],
|
||||
1500000000 => [10, 1, 5, 8000, 1, 9999999999], # Это тринадцатый уровень
|
||||
];
|
||||
public static $cavedata = [621 => ['x1' => 6, 'y1' => 11, 'dir1' => 1, 'x2' => 10, 'y2' => 8, 'dir2' => 1, 'x3' => 20, 'y3' => 4, 'dir3' => 1, 'x4' => 10, 'y4' => 10, 'dir4' => 1, 'delay' => 360, 'name1' => 'Проклятый Рудник', 'name2' => 'Проклятого Рудника']];
|
||||
|
||||
//DB
|
||||
protected static $db = [
|
||||
'host' => '192.168.20.5',
|
||||
'name' => 'battles',
|
||||
'user' => 'battles',
|
||||
'password' => 'bottle-neck-horse',
|
||||
'port' => 32101,
|
||||
'charset' => 'utf8',
|
||||
];
|
||||
}
|
||||
2900 => [1, 0, 0, 10, 0, 3350],
|
||||
3350 => [1, 0, 0, 20, 0, 3800],
|
||||
3800 => [1, 0, 0, 30, 0, 4200],
|
||||
4200 => [1, 0, 0, 40, 0, 4600],
|
||||
4600 => [1, 0, 0, 50, 0, 5000],
|
||||
5000 => [3, 1, 1, 80, 1, 6000], # Это пятый уровень
|
||||
];
|
@ -421,7 +421,7 @@ class fbattle
|
||||
addActions(time(), 'win_fiz', 0, $this->user['id']);
|
||||
}
|
||||
|
||||
if (in_array($user->getRoom(), Config::$caverooms)) {
|
||||
if (in_array($user->getRoom(), CAVE_ROOMS)) {
|
||||
$location = mysql_fetch_array(mysql_query("SELECT `x`, `y`, `dir` FROM `caveparties` WHERE `user` = '" . $this->user['id'] . "' LIMIT 1"));
|
||||
if ($location['dir'] == 0) {
|
||||
$y = $location['y'] * 2;
|
||||
@ -451,7 +451,7 @@ class fbattle
|
||||
$winers .= implode("</B>, <B>", $this->t2);
|
||||
$lomka = $this->t1;
|
||||
} else {
|
||||
if (in_array($user->getRoom(), Config::$caverooms)) {
|
||||
if (in_array($user->getRoom(), CAVE_ROOMS)) {
|
||||
$location = mysql_fetch_array(mysql_query("SELECT `x`, `y`, `dir` FROM `caveparties` WHERE `user` = '" . $this->user['id'] . "' LIMIT 1"));
|
||||
if ($location['dir'] == 0) {
|
||||
$y = $location['y'] * 2;
|
||||
@ -486,7 +486,8 @@ class fbattle
|
||||
|
||||
$inv_broken = mysql_query("SELECT * FROM `inventory` WHERE `type` != 12 AND `dressed` = 1 AND ((`maxdur` <= `duration`) OR (`dategoden` > 0 AND `dategoden` <= '" . time() . "')) AND `owner` = '{$v}'");
|
||||
while ($br = mysql_fetch_array($inv_broken)) {
|
||||
dropitemid($br['type'], $v);
|
||||
$item = new \Battles\DressedItems($v);
|
||||
$item->undressItem($br['type']);
|
||||
}
|
||||
|
||||
$its = mysql_query("SELECT `id` FROM `inventory` WHERE `dressed` = 0 AND ((`maxdur` <= `duration`) OR (`dategoden` > 0 AND `dategoden` <= '" . time() . "')) AND `owner` = '{$v}'");
|
||||
@ -573,7 +574,8 @@ class fbattle
|
||||
$this->AddToLog('<span class=date>' . date("H:i") . '</span> <b>' . Nick::id($v)->short() . '</b> получил повреждение: <font color=red>' . $tr . '</font><BR>');
|
||||
$inv_broken = mysql_query("SELECT `id`, `type`, `dressed`, `duration`, `maxdur`, `dategoden`, `owner` FROM `inventory` WHERE `type` != 12 AND `dressed` = 1 AND ((`maxdur` <= `duration`) OR (`dategoden` > 0 AND `dategoden` <= '" . time() . "')) AND `owner` = '{$v}'");
|
||||
while ($br = mysql_fetch_array($inv_broken)) {
|
||||
dropitemid($br['type'], $v);
|
||||
$item = new \Battles\DressedItems($v);
|
||||
$item->undressItem($br['type']);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1063,7 +1065,7 @@ class fbattle
|
||||
if ($uid == NULL) {
|
||||
$uid = $this->user['id'];
|
||||
}
|
||||
$ins = mysql_query('INSERT INTO `actions` (`uid`, `time`, `city`, `room`, `vars`, `ip`, `vals`) VALUES ("' . $uid . '", "' . $time . '", "capitalcity", "0", "' . mysql_real_escape_string($vars) . '", "' . mysql_real_escape_string($_SERVER['HTTP_X_REAL_IP']) . '", "' . mysql_real_escape_string($vls) . '")');
|
||||
$ins = mysql_query('INSERT INTO `actions` (`uid`, `time`, `city`, `room`, `vars`, `ip`, `vals`) VALUES ("' . $uid . '", "' . $time . '", "capitalcity", "0", "' . mysql_real_escape_string($vars) . '", "' . $_SERVER['REMOTE_ADDR'] . '", "' . mysql_real_escape_string($vls) . '")');
|
||||
return $ins;
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@ if (!$tr && $turnirstart[0] <= time() && $dd[0] >= 2) {
|
||||
while ($row = mysql_fetch_array($data)) {
|
||||
|
||||
$pers = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `id` = "' . $row[0] . '" LIMIT 1'));
|
||||
undressall($pers['id']);
|
||||
\Battles\DressedItems::undressAllItems($pers['id']);
|
||||
###
|
||||
mysql_query('UPDATE `inventory` SET `owner` = "' . ($pers['id'] + _BOTSEPARATOR_) . '" WHERE `owner` = "' . $pers['id'] . '"');
|
||||
###
|
||||
@ -88,9 +88,9 @@ if (!$tr && $turnirstart[0] <= time() && $dd[0] >= 2) {
|
||||
}
|
||||
|
||||
// Боты: Архивариус и два помощника.
|
||||
undressall(233);
|
||||
undressall(234);
|
||||
undressall(235);
|
||||
\Battles\DressedItems::undressAllItems(233);
|
||||
\Battles\DressedItems::undressAllItems(234);
|
||||
\Battles\DressedItems::undressAllItems(235);
|
||||
|
||||
mysql_query("DELETE FROM `inventory` WHERE `owner` = 233");
|
||||
mysql_query("DELETE FROM `inventory` WHERE `owner` = 234");
|
||||
@ -158,7 +158,7 @@ if ($tur_data['endtime'] < time() && $tur_data['id']) {
|
||||
$list = mysql_query("SELECT * FROM `users` WHERE `in_tower` = 1");
|
||||
|
||||
while ($u = mysql_fetch_array($list)) {
|
||||
undressall($u['id']);
|
||||
\Battles\DressedItems::undressAllItems($u['id']);
|
||||
$rep = mysql_query("SELECT * FROM `inventory` WHERE `owner` = '" . $u['id'] . "' AND `bs` = 1");
|
||||
while ($r = mysql_fetch_array($rep)) {
|
||||
mysql_query("INSERT `deztow_items` (`iteam_id`, `name`, `img`, `room`) VALUES ('" . $r['prototype'] . "', '" . $r['name'] . "', '" . $r['img'] . "', '" . $u['room'] . "')");
|
||||
|
@ -65,7 +65,7 @@ if ($_GET['ext'] == 1) {
|
||||
}
|
||||
|
||||
|
||||
if (in_array($user->getRoom(), Config::$canalenters)) {
|
||||
if (in_array($user->getRoom(), CANAL_ENTERS)) {
|
||||
$podzemroom = $user->getRoom() + 1;
|
||||
$cavedata = [620 => ['x1' => 3, 'y1' => 2, 'dir1' => 2]];
|
||||
$podzemdata = [621 => ['name1' => 'Проклятый Рудник', 'name2' => 'Проклятого Рудника']];
|
||||
@ -308,7 +308,7 @@ if (in_array($user->getRoom(), Config::$canalenters)) {
|
||||
}
|
||||
|
||||
$den = mysql_query("SELECT `id` FROM `vxodd` WHERE `glav_id` = '" . $_GET['naw_id'] . "'");
|
||||
if (mysql_num_rows($den) >= (in_array($user->getRoom() + 1, Config::$caverooms) ? 5 : 4)) {
|
||||
if (mysql_num_rows($den) >= (in_array($user->getRoom() + 1, CAVE_ROOMS) ? 5 : 4)) {
|
||||
echo "<script>location.href='?warning=5'</script>";
|
||||
exit();
|
||||
}
|
||||
@ -356,7 +356,7 @@ if (in_array($user->getRoom(), Config::$canalenters)) {
|
||||
}
|
||||
|
||||
if ($_GET['start']) {
|
||||
if (in_array($user->getRoom() + 1, Config::$caverooms)) {
|
||||
if (in_array($user->getRoom() + 1, CAVE_ROOMS)) {
|
||||
$nc = 1;
|
||||
$locs = [];
|
||||
}
|
||||
@ -391,7 +391,7 @@ if (in_array($user->getRoom(), Config::$canalenters)) {
|
||||
mysql_query('INSERT INTO `visit_podzem` (`login`, `time`, `room`) VALUES ("' . $n_login . '", "' . $vremya . '", \'' . $podzemroom . '\')');
|
||||
$vrem = 30 * 60 + time();
|
||||
|
||||
$cavedata = Config::$cavedata ?? [];
|
||||
$cavedata = CAVE_DATA ?? [];
|
||||
mysql_query("INSERT INTO `caveparties` SET `user` = '$esth[id]', `leader` = '$user[id]', `login` = '$esth[login]', `shadow` = '0.png', `x` = '" . $cavedata[$user->getRoom() + 1]['x1'] . "', `y` = '" . $cavedata[$user->getRoom() + 1]['y1'] . "', `dir` = '" . $cavedata[$user->getRoom() + 1]['dir1'] . "', `floor` = 1");
|
||||
mysql_query("UPDATE `users`, `online` SET " . ($nc ? "`users`.`caveleader` = '$user[id]', " : "") . " `users`.`room` = '" . ($user->getRoom() + 1) . "', `online`.`room` = '" . ($user->getRoom() + 1) . "' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '" . $esth['id'] . "'");
|
||||
}
|
||||
|
434
functions.php
@ -16,11 +16,11 @@ if (empty($_SESSION['uid'])) {
|
||||
} else {
|
||||
$user = new User($_SESSION['uid']);
|
||||
}
|
||||
|
||||
if ($user->getId() && $user->getBlock()) {
|
||||
exit('user blocked!');
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Проверки на соответствие скрипта и комнаты, которые были натыканы по всем файлам.
|
||||
*/
|
||||
@ -109,7 +109,7 @@ $var_map = [
|
||||
function get_out($u)
|
||||
{
|
||||
$pers = db::c()->query('SELECT * FROM users WHERE id = ?i', $u)->fetch_assoc_array();
|
||||
undressall($pers['id']);
|
||||
\Battles\DressedItems::undressAllItems($pers['id']);
|
||||
db::c()->query('UPDATE inventory SET owner = ?i WHERE owner = ?i', $pers['id'], $pers['id'] + _BOTSEPARATOR_);
|
||||
###
|
||||
$row = db::c()->query('SELECT * FROM `effects` WHERE `owner` = ?i', $pers['id'] + _BOTSEPARATOR_);
|
||||
@ -209,13 +209,13 @@ function level_up($uid)
|
||||
{
|
||||
$us = db::c()->query('SELECT `id`, `login`, `level`, `money`, `exp`, `nextup`, `stats`, `master`, `ip`, `in_tower` FROM `users` WHERE `id` =?i', $uid)->fetch_assoc();
|
||||
if (isset($us['id']) && $us['exp'] >= $us['nextup'] && !$us['in_tower']) {
|
||||
if (Config::$exptable[$us['nextup']][4] == 1) {
|
||||
if (EXPTABLE[$us['nextup']][4] == 1) {
|
||||
addch("Персонаж <b>{$us['login']}</b> перешел на " . ($us['level'] + 1) . " уровень.");
|
||||
addchp('<span class=\'success\'>Внимание!</span> Вы перешли на новый уровень. За это Вы получаете: ' . Config::$exptable[$us['nextup']][3] . ' кр.', '{[]}' . $us['login'] . '{[]}');
|
||||
addchp('<span class=\'success\'>Внимание!</span> Вы перешли на новый уровень. За это Вы получаете: ' . EXPTABLE[$us['nextup']][3] . ' кр.', '{[]}' . $us['login'] . '{[]}');
|
||||
}
|
||||
$us['nextup'] = Config::$exptable[$us['nextup']][5];
|
||||
$us['stats'] += Config::$exptable[$us['nextup']][0];
|
||||
$us['master'] += Config::$exptable[$us['nextup']][1];
|
||||
$us['nextup'] = EXPTABLE[$us['nextup']][5];
|
||||
$us['stats'] += EXPTABLE[$us['nextup']][0];
|
||||
$us['master'] += EXPTABLE[$us['nextup']][1];
|
||||
|
||||
db::c()->query('UPDATE `users` SET `nextup` = ?i, `stats` = ?i, `master` = ?i, `level` = ?i WHERE `id` = ?i', $us['nextup'], $us['stats'], $us['master'], $us['level'], $us['id']);
|
||||
}
|
||||
@ -399,40 +399,6 @@ function timeOut($ttm)
|
||||
return $out;
|
||||
}
|
||||
|
||||
function show_eff_inf(int $u): string
|
||||
{
|
||||
$img = [
|
||||
1 => "travma.gif", 2 => "magic/sleep.gif", 3 => "magic/sleepf.gif", 4 => "magic/haos.gif",
|
||||
5 => "magic/obezl.gif", 6 => "expx15.gif", 7 => "euphoria.png", 8 => "sleep_obj.gif",
|
||||
10 => "magic/chains.gif", 11 => "travma.gif", 12 => "travma.gif", 13 => "travma.gif",
|
||||
14 => "travma.gif", 20 => "check.gif", 21 => "magic/al_neut_power.gif", 22 => "magic/fist_def.gif",
|
||||
201 => "magic/defence.gif", 202 => "magic/devastate.gif", 203 => "magic/spell_luck.gif", 215 => "magic/wis_air_def1.gif",
|
||||
216 => "magic/wis_air_def2.gif", 217 => "magic/wis_air_def3.gif", 218 => "magic/wis_earth_def1.gif", 219 => "magic/wis_earth_def2.gif",
|
||||
220 => "magic/wis_earth_def3.gif", 221 => "magic/wis_fire_def1.gif", 222 => "magic/wis_fire_def2.gif", 223 => "magic/wis_fire_def3.gif",
|
||||
224 => "magic/wis_water_def1.gif", 225 => "magic/wis_water_def2.gif", 226 => "magic/wis_water_def3.gif", 227 => "magic/attack_defence.gif",
|
||||
1022 => "sh/hidden.gif",
|
||||
];
|
||||
$r = '';
|
||||
|
||||
|
||||
$effs = DBPDO::INIT()->ofetchAll('SELECT * FROM users_effects WHERE owner_id = ?', $u);
|
||||
|
||||
$i = 0;
|
||||
while ($i < count($effs)) {
|
||||
$timeleft = timeOut($effs[$i]->remaining_time - time());
|
||||
$r .= <<<HTML
|
||||
<div>
|
||||
<img class="image" src="/i/{$img[$effs[$i]->type]}">
|
||||
<span class="title">{$effs[$i]->name}</span>
|
||||
<div class="timeleft">$timeleft</div>
|
||||
</div>
|
||||
HTML;
|
||||
$i++;
|
||||
}
|
||||
unset($i);
|
||||
return $r;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $time
|
||||
* @param $vars
|
||||
@ -444,282 +410,11 @@ HTML;
|
||||
function addActions($time, $vars, $vls, $uid)
|
||||
{
|
||||
db::c()->query('LOCK TABLES `actions` WRITE');
|
||||
$ins = db::c()->query('INSERT INTO `actions` (`uid`,`time`,`city`,`room`,`vars`,`ip`,`vals`) VALUES (?i, ?i, "?s", ?i, "?s", "?s", "?s")', $uid, $time, "capitalcity", 0, $vars, $_SERVER['HTTP_X_REAL_IP'], $vls);
|
||||
$ins = db::c()->query('INSERT INTO `actions` (`uid`,`time`,`city`,`room`,`vars`,`ip`,`vals`) VALUES (?i, ?i, "?s", ?i, "?s", "?s", "?s")', $uid, $time, "capitalcity", 0, $vars, $_SERVER['REMOTE_ADDR'], $vls);
|
||||
db::c()->query('UNLOCK TABLES');
|
||||
return $ins;
|
||||
}
|
||||
|
||||
function undressall($user_id)
|
||||
{
|
||||
db::c()->query('UPDATE inventory SET dressed_slot = 0 WHERE dressed_slot BETWEEN 1 AND 12 AND owner_id = ?i', $user_id);
|
||||
}
|
||||
|
||||
function dropitemid($slot, $id)
|
||||
{
|
||||
global $user;
|
||||
switch ($slot) {
|
||||
case 1:
|
||||
$slot1 = 'sergi';
|
||||
break;
|
||||
case 2:
|
||||
$slot1 = 'kulon';
|
||||
break;
|
||||
case 3:
|
||||
$slot1 = 'weap';
|
||||
break;
|
||||
case 4:
|
||||
$slot1 = 'bron';
|
||||
break;
|
||||
case 5:
|
||||
$slot1 = 'r1';
|
||||
break;
|
||||
case 6:
|
||||
$slot1 = 'r2';
|
||||
break;
|
||||
case 7:
|
||||
$slot1 = 'r3';
|
||||
break;
|
||||
case 8:
|
||||
$slot1 = 'helm';
|
||||
break;
|
||||
case 9:
|
||||
$slot1 = 'perchi';
|
||||
break;
|
||||
case 10:
|
||||
$slot1 = 'shit';
|
||||
break;
|
||||
case 11:
|
||||
$slot1 = 'boots';
|
||||
break;
|
||||
case 12:
|
||||
$slot1 = 'm1';
|
||||
break;
|
||||
case 13:
|
||||
$slot1 = 'm2';
|
||||
break;
|
||||
case 14:
|
||||
$slot1 = 'm3';
|
||||
break;
|
||||
case 15:
|
||||
$slot1 = 'm4';
|
||||
break;
|
||||
case 16:
|
||||
$slot1 = 'm5';
|
||||
break;
|
||||
case 17:
|
||||
$slot1 = 'm6';
|
||||
break;
|
||||
case 18:
|
||||
$slot1 = 'm7';
|
||||
break;
|
||||
case 19:
|
||||
$slot1 = 'm8';
|
||||
break;
|
||||
case 20:
|
||||
$slot1 = 'm9';
|
||||
break;
|
||||
case 21:
|
||||
$slot1 = 'm10';
|
||||
break;
|
||||
case 22:
|
||||
$slot1 = 'rybax';
|
||||
break;
|
||||
case 23:
|
||||
$slot1 = 'plaw';
|
||||
break;
|
||||
default:
|
||||
$slot1 = '';
|
||||
break;
|
||||
}
|
||||
$checkid = db::c()->query('SELECT 1 FROM `users` WHERE `id` = ?i', $id);
|
||||
if ($checkid->getNumRows()) {
|
||||
if (mysql_query('UPDATE `users`, `inventory` SET `users`.`' . $slot1 . '` = 0, `inventory`.`dressed` = 0, `users`.`sila` = `users`.`sila` - `inventory`.`gsila`, `users`.`lovk` = `users`.`lovk` - `inventory`.`glovk`, `users`.`inta` = `users`.`inta` - `inventory`.`ginta`, `users`.`intel` = `users`.`intel` - `inventory`.`gintel`, `users`.`maxhp` = `users`.`maxhp` - `inventory`.`ghp`, `users`.`noj` = `users`.`noj` - `inventory`.`gnoj`, `users`.`topor` = `users`.`topor` - `inventory`.`gtopor`, `users`.`dubina` = `users`.`dubina` - `inventory`.`gdubina`, `users`.`mec` = `users`.`mec` - `inventory`.`gmech`, `users`.`mfire` = `users`.`mfire` - `inventory`.`gfire`, `users`.`mwater` = `users`.`mwater` - `inventory`.`gwater`, `users`.`mair` = `users`.`mair` - `inventory`.`gair`, `users`.`mearth` = `users`.`mearth` - `inventory`.`gearth`, `users`.`mlight` = `users`.`mlight` - `inventory`.`glight`, `users`.`mgray` = `users`.`mgray` - `inventory`.`ggray`, `users`.`mdark` = `users`.`mdark` - `inventory`.`gdark`, `users`.`fkrit` = `users`.`fkrit` - `inventory`.`mfkrit`, `users`.`fakrit` = `users`.`fakrit` - `inventory`.`mfakrit`, `users`.`fuvorot` = `users`.`fuvorot` - `inventory`.`mfuvorot`, `users`.`fauvorot` = `users`.`fauvorot` - `inventory`.`mfauvorot`, `users`.`ubron1` = `users`.`ubron1` - `inventory`.`bron1`, `users`.`ubron2` = `users`.`ubron2` - `inventory`.`bron2`, `users`.`ubron3` = `users`.`ubron3` - `inventory`.`bron3`, `users`.`ubron4` = `users`.`ubron4` - `inventory`.`bron4`, `users`.`uminu` = `users`.`uminu` - `inventory`.`minu`, `users`.`umaxu` = `users`.`umaxu` - `inventory`.`maxu` WHERE `inventory`.`id` = `users`.`' . $slot1 . '` AND `inventory`.`dressed` = 1 AND `inventory`.`owner` = "' . $id . '" AND `users`.`id` = "' . $id . '"')) {
|
||||
db::c()->query('UPDATE `users` SET `hp` = `maxhp`, `fullhptime` = ?i WHERE `hp` > `maxhp` AND `id` = ?i', time(), $id);
|
||||
$user->$slot1 = 0;
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// снять предмет
|
||||
function dropitem($slot)
|
||||
{
|
||||
global $user;
|
||||
$wear_arr = [];
|
||||
switch ($slot) {
|
||||
case 1:
|
||||
$slot1 = 'sergi';
|
||||
break;
|
||||
case 2:
|
||||
$slot1 = 'kulon';
|
||||
break;
|
||||
case 3:
|
||||
$slot1 = 'weap';
|
||||
break;
|
||||
case 4:
|
||||
$slot1 = 'bron';
|
||||
break;
|
||||
case 5:
|
||||
$slot1 = 'r1';
|
||||
break;
|
||||
case 6:
|
||||
$slot1 = 'r2';
|
||||
break;
|
||||
case 7:
|
||||
$slot1 = 'r3';
|
||||
break;
|
||||
case 8:
|
||||
$slot1 = 'helm';
|
||||
break;
|
||||
case 9:
|
||||
$slot1 = 'perchi';
|
||||
break;
|
||||
case 10:
|
||||
$slot1 = 'shit';
|
||||
break;
|
||||
case 11:
|
||||
$slot1 = 'boots';
|
||||
break;
|
||||
case 12:
|
||||
$slot1 = 'm1';
|
||||
break;
|
||||
case 13:
|
||||
$slot1 = 'm2';
|
||||
break;
|
||||
case 14:
|
||||
$slot1 = 'm3';
|
||||
break;
|
||||
case 15:
|
||||
$slot1 = 'm4';
|
||||
break;
|
||||
case 16:
|
||||
$slot1 = 'm5';
|
||||
break;
|
||||
case 17:
|
||||
$slot1 = 'm6';
|
||||
break;
|
||||
case 18:
|
||||
$slot1 = 'm7';
|
||||
break;
|
||||
case 19:
|
||||
$slot1 = 'm8';
|
||||
break;
|
||||
case 20:
|
||||
$slot1 = 'm9';
|
||||
break;
|
||||
case 21:
|
||||
$slot1 = 'm10';
|
||||
break;
|
||||
case 22:
|
||||
$slot1 = 'rybax';
|
||||
break;
|
||||
case 23:
|
||||
$slot1 = 'plaw';
|
||||
break;
|
||||
default:
|
||||
$slot1 = '';
|
||||
break;
|
||||
}
|
||||
|
||||
if (db::c()->query('UPDATE `users` as `u`, `inventory` as `i` SET `u`.?f = 0, `i`.`dressed` = 0,
|
||||
`u`.`sila` = `u`.`sila` - `i`.`gsila`,
|
||||
`u`.`lovk` = `u`.`lovk` - `i`.`glovk`,
|
||||
`u`.`inta` = `u`.`inta` - `i`.`ginta`,
|
||||
`u`.`intel` = `u`.`intel` - `i`.`gintel`,
|
||||
`u`.`maxhp` = `u`.`maxhp` - `i`.`ghp`,
|
||||
`u`.`noj` = `u`.`noj` - `i`.`gnoj`,
|
||||
`u`.`topor` = `u`.`topor` - `i`.`gtopor`,
|
||||
`u`.`dubina` = `u`.`dubina` - `i`.`gdubina`,
|
||||
`u`.`mec` = `u`.`mec` - `i`.`gmech`,
|
||||
`u`.`mfire` = `u`.`mfire` - `i`.`gfire`,
|
||||
`u`.`mwater` = `u`.`mwater` - `i`.`gwater`,
|
||||
`u`.`mair` = `u`.`mair` - `i`.`gair`,
|
||||
`u`.`mearth` = `u`.`mearth` - `i`.`gearth`,
|
||||
`u`.`mlight` = `u`.`mlight` - `i`.`glight`,
|
||||
`u`.`mgray` = `u`.`mgray` - `i`.`ggray`,
|
||||
`u`.`mdark` = `u`.`mdark` - `i`.`gdark`,
|
||||
`u`.`ubron1` = `u`.`ubron1` - `i`.`bron1`,
|
||||
`u`.`ubron2` = `u`.`ubron2` - `i`.`bron2`,
|
||||
`u`.`ubron3` = `u`.`ubron3` - `i`.`bron3`,
|
||||
`u`.`ubron4` = `u`.`ubron4` - `i`.`bron4`,
|
||||
`u`.`fkrit` = `u`.`fkrit` - `i`.`mfkrit`,
|
||||
`u`.`fakrit` = `u`.`fakrit` - `i`.`mfakrit`,
|
||||
`u`.`fuvorot` = `u`.`fuvorot` - `i`.`mfuvorot`,
|
||||
`u`.`fauvorot` = `u`.`fauvorot` - `i`.`mfauvorot`,
|
||||
`u`.`uminu` = `u`.`uminu` - `i`.`minu`,
|
||||
`u`.`umaxu` = `u`.`umaxu` - `i`.`maxu`
|
||||
WHERE `i`.`id` = `u`.?f AND `i`.`dressed` = 1 AND `i`.`owner` = ?i AND u.id = ?i', $slot1, $slot1, $user->getId(), $user->getId())) {
|
||||
db::c()->query('UPDATE `users` SET `hp` = `maxhp`, `fullhptime` = ?i WHERE `hp` > `maxhp` AND `id` = ?i', time(), $user->getId());
|
||||
}
|
||||
|
||||
$wear_raw = db::c()->query('SELECT * FROM `inventory` where `owner` = ?i AND `dressed` = 1', $user->getId());
|
||||
while ($wear_list = $wear_raw->fetch_assoc()) {
|
||||
$wear_arr[] = $wear_list['prototype'];
|
||||
}
|
||||
|
||||
$item['id'] = $user->$slot1;
|
||||
|
||||
$get_pro = db::c()->query('SELECT * FROM `inventory` where `id` = ?i', $item['id'])->fetch_assoc();
|
||||
/////////////////////
|
||||
$sets_items = db::c()->query('SELECT * FROM `item_sets`');
|
||||
|
||||
//для каждого комплекта
|
||||
while ($items_in_set = $sets_items->fetch_assoc()) {
|
||||
$checker = 0;
|
||||
$temp_is = explode(",", $items_in_set['prot_id']);
|
||||
$set_id = $items_in_set['set_id'];
|
||||
|
||||
//если прото в комплекте и не одет
|
||||
if (in_array($get_pro['prototype'], $temp_is) && (!in_array($get_pro['prototype'], $wear_arr))) {
|
||||
$checker = 1;
|
||||
|
||||
//для каждого одетого предмета
|
||||
foreach ($temp_is as $check_proto) {
|
||||
if ($check_proto != $get_pro['prototype'] && !in_array($check_proto, $wear_arr)) {
|
||||
$checker = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
if (($checker == 1) && (!in_array($get_pro['prototype'], $wear_arr))) {
|
||||
db::c()->query('UPDATE `users` as `u`, `item_sets` as `s` SET
|
||||
`u`.`uminu` = `u`.`uminu` - `s`.`minu`,
|
||||
`u`.`umaxu` = `u`.`umaxu` - `s`.`maxu`,
|
||||
`u`.`sila = `u`.`sila - `s`.`gsila`,
|
||||
`u`.`lovk = `u`.`lovk - `s`.`glovk`,
|
||||
`u`.`inta = `u`.`inta - `s`.`ginta`,
|
||||
`u`.`intel = `u`.`intel - `s`.`gintel`,
|
||||
`u`.`maxhp = `u`.`maxhp - `s`.`ghp`,
|
||||
`u`.`maxmana = `u`.`maxmana - `s`.`gmana`,
|
||||
`u`.`fkrit = `u`.`fkrit - `s`.`mfkrit`,
|
||||
`u`.`fakrit = `u`.`fakrit - `s`.`mfakrit`,
|
||||
`u`.`fuvorot = `u`.`fuvorot - `s`.`mfuvorot`,
|
||||
`u`.`fauvorot = `u`.`fauvorot - `s`.`mfauvorot`,
|
||||
`u`.`noj = `u`.`noj - `s`.`gnoj`,
|
||||
`u`.`topor = `u`.`topor - `s`.`gtopor`,
|
||||
`u`.`dubina = `u`.`dubina - `s`.`gdubina`,
|
||||
`u`.`mec = `u`.`mec - `s`.`gmech`,
|
||||
`u`.`ubron1 = `u`.`ubron1 - `s`.`bron1`,
|
||||
`u`.`ubron2 = `u`.`ubron2 - `s`.`bron2`,
|
||||
`u`.`ubron3 = `u`.`ubron3 - `s`.`bron3`,
|
||||
`u`.`ubron4 = `u`.`ubron4 - `s`.`bron4`,
|
||||
`u`.`mfire = `u`.`mfire - `s`.`gfire`,
|
||||
`u`.`mwater = `u`.`mwater - `s`.`gwater`,
|
||||
`u`.`mair = `u`.`mair - `s`.`gair`,
|
||||
`u`.`mearth = `u`.`mearth - `s`.`gearth`,
|
||||
`u`.`mlight = `u`.`mlight - `s`.`glight`,
|
||||
`u`.`mgray = `u`.`mgray - `s`.`ggray`
|
||||
WHERE
|
||||
`u`.`id` = ?i AND `s`.`set_id`= ?i', $user->getId(), $set_id);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
#15
|
||||
function ref_drop()
|
||||
{
|
||||
@ -766,27 +461,13 @@ function ref_drop()
|
||||
$user = db::c()->query('SELECT `sergi`,`kulon`,`weap`,`bron`,`r1`,`r2`,`r3`,`helm`,`perchi`,`shit`,`boots`,`m1`,`m2`,`m3`,`m4`,`m5`,`m6`,`m7`,`m8`,`m9`,`m10` FROM `users` WHERE id = ?i', $_SESSION['uid'])->fetch_assoc();
|
||||
for ($i = 0; $i <= 20; $i++) {
|
||||
if ($user[$slot[$i]] && !derj($user[$slot[$i]])) {
|
||||
dropitem($i + 1);
|
||||
$item = new \Battles\DressedItems($_SESSION['uid']);
|
||||
$item->undressItem($i + 1);
|
||||
$user[$slot[$i]] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Уничтожить предмет, принадлежащий игроку, вызывающего функцию.
|
||||
* @param $id - ID предмета игрока.
|
||||
* @throws \Krugozor\Database\Mysql\Exception
|
||||
*/
|
||||
function destructitem($id)
|
||||
{
|
||||
global $user;
|
||||
$item = db::c()->query('SELECT 1 FROM inventory WHERE owner_id = ?i AND item_id = ?i', $user->getId(), $id);
|
||||
if ($item->getNumRows()) {
|
||||
db::c()->query('DELETE FROM `inventory` WHERE `id` = ?i', $id);
|
||||
}
|
||||
}
|
||||
|
||||
// использовать магию
|
||||
function usemagic($id, $target)
|
||||
{
|
||||
@ -847,7 +528,7 @@ function usemagic($id, $target)
|
||||
}
|
||||
if ($bat) {
|
||||
if ($row['maxdur'] <= ($row['duration'] + 1)) {
|
||||
destructitem($row['id']);
|
||||
\Battles\InventoryItem::destroyItem($row['id']);
|
||||
} else {
|
||||
if (!$row['magic']) {
|
||||
db::c()->query('UPDATE `inventory` SET `includemagicdex` =`includemagicdex` - ?i WHERE id = ?i', $bat, $row['id']);
|
||||
@ -971,47 +652,6 @@ function addlog($id, $log)
|
||||
unset($id, $log);
|
||||
}
|
||||
|
||||
function star_sign($date)
|
||||
{
|
||||
/*
|
||||
* 1 aries
|
||||
* 2 taurus
|
||||
* 3 gemini
|
||||
* 4 cancer
|
||||
* 5 leo
|
||||
* 6 virgo
|
||||
* 7 libra
|
||||
* 8 scorpio
|
||||
* 9 sagittarios
|
||||
* 10 capricorn
|
||||
* 11 aquarius
|
||||
* 12 pisches
|
||||
*/
|
||||
$zodiac[356] = "10";
|
||||
$zodiac[326] = "09";
|
||||
$zodiac[296] = "08";
|
||||
$zodiac[266] = "07";
|
||||
$zodiac[235] = "06";
|
||||
$zodiac[203] = "05";
|
||||
$zodiac[172] = "04";
|
||||
$zodiac[140] = "03";
|
||||
$zodiac[111] = "02";
|
||||
$zodiac[78] = "01";
|
||||
$zodiac[51] = "12";
|
||||
$zodiac[20] = "11";
|
||||
$zodiac[0] = "10";
|
||||
$dayOfYear = date("z", strtotime($date));
|
||||
$isLeapYear = date("L", strtotime($date)); //Высокосный?
|
||||
if ($isLeapYear && $dayOfYear > 59) {
|
||||
--$dayOfYear;
|
||||
}
|
||||
foreach ($zodiac as $day => $sign) {
|
||||
if ($dayOfYear > $day) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $sign;
|
||||
}
|
||||
|
||||
function SolveExp($at_id, $def_id, $damage)
|
||||
{
|
||||
@ -1107,55 +747,3 @@ function SolveExp($at_id, $def_id, $damage)
|
||||
|
||||
return round((($baseexp[$def['level']]) * ($def_cost[0] / (($at_cost[0] + $def_cost[0]) / 2)) * ($damage / $def['maxhp']) * $expmf * $mfit * $mfbot * $mfbot2) / 3);
|
||||
}
|
||||
|
||||
/**
|
||||
* Апаем стат или мастерство на единицу.
|
||||
*
|
||||
* @param $name - техническое имя параметра, как в базе.
|
||||
* @param null $param - выбор что повышать.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function addOnePoint($name, $param = null)
|
||||
{
|
||||
$allowed_stats = ['sila', 'lovk', 'inta', 'vinos', 'intel', 'mudra'];
|
||||
$allowed_mastery = ['noj', 'mec', 'dubina', 'topor', 'mfire', 'mwater', 'mair', 'mearth', 'mlight', 'mgray', 'mdark'];
|
||||
$naming = [
|
||||
'sila' => 'Сила',
|
||||
'lovk' => 'Ловкость',
|
||||
'inta' => 'Интуиция',
|
||||
'vinos' => 'Выносливость',
|
||||
'intel' => 'Интеллект',
|
||||
'mudra' => 'Мудрость',
|
||||
'noj' => 'Владение кинжалами',
|
||||
'mec' => 'Владение мечами',
|
||||
'dubina' => 'Владение дубинами',
|
||||
'topor' => 'Владение топорами',
|
||||
'mfire' => 'Магия огня',
|
||||
'mwater' => 'Магия воды',
|
||||
'mair' => 'Магия воздуха',
|
||||
'mearth' => 'Магия земли',
|
||||
'mlight' => 'Магия света',
|
||||
'mgray' => 'Магия серости',
|
||||
'mdark' => 'Магия тьмы',
|
||||
];
|
||||
if ($param == 'stat' && in_array($name, $allowed_stats)) {
|
||||
db::c()->query('UPDATE `users` SET ?f = ?f + 1, `stats` = `stats` - 1 WHERE `id` = ?i', $name, $name, $_SESSION['uid']);
|
||||
echo "<span style='color:darkgreen'>Параметр {$naming[$name]} увеличен на 1 ед.</span>";
|
||||
} elseif ($param == 'mastery' && in_array($name, $allowed_mastery)) {
|
||||
$mastery_level = db::c()->query('SELECT ?f FROM `users` WHERE `id` = ?i', $name, $_SESSION['uid'])->fetch_assoc();
|
||||
if ($mastery_level[$name] < 10) {
|
||||
db::c()->query('UPDATE `users` SET ?f = ?f + 1, `master` = `master` - 1 WHERE `id` = ?i', $name, $name, $_SESSION['uid']);
|
||||
echo "<span style='color:darkgreen'>Параметр {$naming[$name]} увеличен на 1 ед.</span>";
|
||||
} else {
|
||||
echo "<span style='color: maroon;'>Ошибка: параметр достиг максимального значения!</span>";
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
function checkIntInRange($int, $min = 1, $max = PHP_INT_MAX)
|
||||
{
|
||||
return (int)filter_var($int, FILTER_VALIDATE_INT, ['options' => ['min_range' => $min, 'max_range' => $max]]);
|
||||
}
|
@ -12,7 +12,7 @@ $vips = [1 => 0.15, 2 => 0.30, 3 => 0.45];
|
||||
function show_item($row, $txt, $place)
|
||||
{
|
||||
if (($row['maxdur'] <= $row['duration']) || ($row['dategoden'] && $row['dategoden'] <= time())) {
|
||||
destructitem($row['id']);
|
||||
\Battles\InventoryItem::destroyItem($row['id']);
|
||||
}
|
||||
$r = '';
|
||||
|
||||
|
BIN
i/align_0.gif
Before Width: | Height: | Size: 53 B |
BIN
i/align_0.png
Normal file
After Width: | Height: | Size: 139 B |
BIN
i/align_1.1.gif
Before Width: | Height: | Size: 79 B |
BIN
i/align_1.2.gif
Before Width: | Height: | Size: 79 B |
BIN
i/align_1.3.gif
Before Width: | Height: | Size: 79 B |
BIN
i/align_1.4.gif
Before Width: | Height: | Size: 79 B |
BIN
i/align_1.5.gif
Before Width: | Height: | Size: 79 B |
BIN
i/align_1.6.gif
Before Width: | Height: | Size: 433 B |
BIN
i/align_1.gif
Before Width: | Height: | Size: 93 B |
BIN
i/align_1.png
Normal file
After Width: | Height: | Size: 520 B |
BIN
i/align_2.1.gif
Before Width: | Height: | Size: 345 B |
BIN
i/align_2.7.gif
Before Width: | Height: | Size: 139 B |
BIN
i/align_2.8.gif
Before Width: | Height: | Size: 166 B |
BIN
i/align_2.9.gif
Before Width: | Height: | Size: 616 B |
BIN
i/align_2.gif
Before Width: | Height: | Size: 126 B |
BIN
i/align_2.png
Normal file
After Width: | Height: | Size: 518 B |
BIN
i/align_3.1.gif
Before Width: | Height: | Size: 333 B |
BIN
i/align_3.gif
Before Width: | Height: | Size: 91 B |
BIN
i/align_3.png
Normal file
After Width: | Height: | Size: 526 B |
BIN
i/align_4.png
Normal file
After Width: | Height: | Size: 519 B |
BIN
i/align_5.gif
Before Width: | Height: | Size: 977 B |
BIN
i/align_5.png
Normal file
After Width: | Height: | Size: 532 B |
BIN
i/align_6.gif
Before Width: | Height: | Size: 578 B |
BIN
i/align_6.png
Normal file
After Width: | Height: | Size: 507 B |
BIN
i/align_7.gif
Before Width: | Height: | Size: 969 B |
BIN
i/align_7.png
Normal file
After Width: | Height: | Size: 520 B |
19
inf.php
@ -1,21 +1,14 @@
|
||||
<?php
|
||||
session_start();
|
||||
include_once 'config.php';
|
||||
$login = urldecode($_SERVER['QUERY_STRING']) ?? '';
|
||||
$userInfo = new \Battles\UserInfo($login);
|
||||
$presentsModel = new \Battles\Models\PresentsModel($userInfo->id);
|
||||
$userInfo = new \Battles\UserInfo(urldecode($_SERVER['QUERY_STRING']));
|
||||
$presentsModel = new \Battles\Models\PresentsModel($userInfo->getId());
|
||||
$presentsList = $presentsModel->getAllPresents();
|
||||
$userInfo->watcher_id = $_SESSION['uid'] ?? null;
|
||||
\Battles\Template::header('Информация о ' . $userInfo->login);
|
||||
if (!$userInfo->id) {
|
||||
echo sprintf('Ошибка: персонаж <em>%s</em> не найден...<p><a style="color: #99f;" href="javascript:window.history.go(-1);">←назад</a></p>', $login);
|
||||
\Battles\Template::header('Информация о ' . $userInfo->getLogin());
|
||||
if (!$userInfo->getId()) {
|
||||
echo sprintf('Ошибка: персонаж <em>%s</em> не найден...<p><a style="color: #99f;" href="javascript:window.history.go(-1);">←назад</a></p>', urldecode($_SERVER['QUERY_STRING']));
|
||||
exit;
|
||||
}
|
||||
try {
|
||||
$userInfo->showUserInfo();
|
||||
|
||||
} catch (Exception $e_showUserInfo) {
|
||||
echo "<div class='debug'>Ошибка генератора showUserInfo() в User.php: {$e_showUserInfo}</div>";
|
||||
}
|
||||
|
||||
$userInfo->showUserInfo();
|
||||
include_once 'views/presents-list.php';
|
18
js/ch.js
@ -1,7 +1,8 @@
|
||||
//-------------------------------------------------------------
|
||||
"use strict"
|
||||
// Функция для определения координат указателя мыши
|
||||
function defPosition(event) {
|
||||
var x = y = 0;
|
||||
let x = 0;
|
||||
let y = 0;
|
||||
if (document.attachEvent != null) { // Internet Explorer & Opera
|
||||
x = window.event.clientX + (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft);
|
||||
y = window.event.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
|
||||
@ -16,7 +17,6 @@ function defPosition(event) {
|
||||
return {x:x, y:y};
|
||||
}
|
||||
|
||||
var flagpop=0;
|
||||
var clip = new ZeroClipboard.Client();
|
||||
clip.setHandCursor( true );
|
||||
clip.setCSSEffects(true);
|
||||
@ -30,12 +30,14 @@ var flagpop=0;
|
||||
* @return {boolean}
|
||||
*/
|
||||
function OpenMenu(evt,level){
|
||||
let flagpop = 0
|
||||
let login
|
||||
let menu = document.getElementById("oMenu")
|
||||
let html;
|
||||
evt = evt || window.event;
|
||||
evt.cancelBubble = true;
|
||||
// Показываем собственное контекстное меню
|
||||
var menu = document.getElementById("oMenu");
|
||||
var html = "";
|
||||
login=(evt.target || evt.srcElement).innerHTML;
|
||||
login = (evt.target || evt.srcElement).innerHTML;
|
||||
|
||||
clip.setText(login);
|
||||
|
||||
@ -60,8 +62,8 @@ function OpenMenu(evt,level){
|
||||
menu.style.left = defPosition(evt).x + "px";
|
||||
menu.style.display = "";
|
||||
}
|
||||
if (flagpop==0){
|
||||
flagpop=1;
|
||||
if (flagpop === 0){
|
||||
flagpop = 1;
|
||||
clip.glue( 'd_clip_button' )
|
||||
}
|
||||
else
|
||||
|
36
js/main.js
@ -1,3 +1,39 @@
|
||||
function hrefToFrame(link) {
|
||||
top.frames['gameframe'].location = link
|
||||
}
|
||||
|
||||
/**
|
||||
* Отображаем уведомление на 5 секунд.
|
||||
* @top Отступ сверху.
|
||||
* @right Отступ справа.
|
||||
* @className Тип уведомления.
|
||||
* @html Текст уведомления в HTML формате.
|
||||
*/
|
||||
function showNotification({top = 0, right = 0, className, html}) {
|
||||
|
||||
let notification = document.createElement('div');
|
||||
notification.style.cssText = `
|
||||
position: fixed;
|
||||
z-index: 1000;
|
||||
padding: 5px;
|
||||
border: 1px solid black;
|
||||
font-size: 20px;
|
||||
background: white;
|
||||
text-align: center;
|
||||
`;
|
||||
|
||||
if (className === "danger") {
|
||||
notification.style.cssText += `
|
||||
background: #b80000;
|
||||
color: yellow;
|
||||
`;
|
||||
}
|
||||
|
||||
notification.style.top = top + 'px';
|
||||
notification.style.right = right + 'px';
|
||||
|
||||
notification.innerHTML = html;
|
||||
document.body.append(notification);
|
||||
|
||||
setTimeout(() => notification.remove(), 5000);
|
||||
}
|
262
js/sl2.js
@ -1,147 +1,183 @@
|
||||
var Hint3Name = '';
|
||||
|
||||
step=0;
|
||||
function errmess(s)
|
||||
{
|
||||
messid.innerHTML='<B>'+s+'</B>';
|
||||
highlight();
|
||||
}
|
||||
function highlight()
|
||||
{
|
||||
if (step) return(0);
|
||||
step=10;
|
||||
setTimeout(dohi,50);
|
||||
step = 0;
|
||||
|
||||
function errmess(s) {
|
||||
messid.innerHTML = '<B>' + s + '</B>';
|
||||
highlight();
|
||||
}
|
||||
|
||||
function dohi()
|
||||
{
|
||||
var hx=new Array(0,1,2,3,4,5,6,7,8,9,"A","B","C","D","E","F");
|
||||
|
||||
step--;
|
||||
messid.style.color="#"+hx[Math.floor(15-step/2)]+((step&1)?"F":"8")+"0000";
|
||||
if (step>0) setTimeout(dohi,50);
|
||||
function highlight() {
|
||||
if (step) return (0);
|
||||
step = 10;
|
||||
setTimeout(dohi, 50);
|
||||
}
|
||||
|
||||
function fixspaces(s)
|
||||
{
|
||||
while (s.substr(s.length-1,s.length)==" ") s=s.substr(0,s.length-1);
|
||||
while (s.substr(0,1)==" ") s=s.substr(1,s.length);
|
||||
return(s);
|
||||
function dohi() {
|
||||
let hx = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, "A", "B", "C", "D", "E", "F"];
|
||||
|
||||
step--;
|
||||
messid.style.color = "#" + hx[Math.floor(15 - step / 2)] + ((step & 1) ? "F" : "8") + "0000";
|
||||
if (step > 0) setTimeout(dohi, 50);
|
||||
}
|
||||
|
||||
function fixspaces(s) {
|
||||
while (s.substr(s.length - 1, s.length) == " ") s = s.substr(0, s.length - 1);
|
||||
while (s.substr(0, 1) == " ") s = s.substr(1, s.length);
|
||||
return (s);
|
||||
}
|
||||
|
||||
// Заголовок, название скрипта, имя поля с логином
|
||||
function findlogin(title, script, name, defaultlogin)
|
||||
{
|
||||
document.all("hint3").innerHTML = '<table border=0 width=100% cellspacing="1" cellpadding="0" bgcolor="#CCC3AA"><tr><td align=center><B>'+title+'</td><td width=20 align=right valign=top style="cursor: hand" onclick="closehint3();"><BIG><B>x</td></tr><tr><td colspan=2>'+
|
||||
'<table border=0 width=100% cellspacing="0" cellpadding="2" bgcolor="#FFF6DD"><tr><form action="'+script+'" method=POST name=slform><td colspan=2>'+
|
||||
'Укажите логин персонажа:<small><BR>(можно щелкнуть по логину в чате)</TD></TR><TR><TD width=50% align=right><INPUT TYPE="text" NAME="'+name+'" value="'+defaultlogin+'"></TD><TD width=50%><INPUT type=image SRC="/i/b__ok.gif" WIDTH="25" HEIGHT="18" BORDER=0 ALT="" onclick="slform.'+name+'.value=fixspaces(slform.'+name+'.value);"></TD></TR></FORM></TABLE></td></tr></table>';
|
||||
document.all("hint3").style.visibility = "visible";
|
||||
document.all("hint3").style.left = 100;
|
||||
document.all("hint3").style.top = 60;
|
||||
document.all(name).focus();
|
||||
Hint3Name = name;
|
||||
function findlogin(title, script, name1, defaultlogin) {
|
||||
let hint3 = document.getElementById("hint3");
|
||||
hint3.innerHTML = `
|
||||
<table border=0 width=100% cellspacing="1" cellpadding="0" bgcolor="#CCC3AA">
|
||||
<tr>
|
||||
<td align=center>
|
||||
<B>${title}
|
||||
</td>
|
||||
<td width=20 align=right valign=top style="cursor: hand" onclick="closehint3();">
|
||||
<BIG>
|
||||
<B>x
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan=2>
|
||||
<table border=0 width=100% cellspacing="0" cellpadding="2" bgcolor="#FFF6DD">
|
||||
<tr>
|
||||
<form action="${script}" method=POST name=slform>
|
||||
<td colspan=2>Укажите логин персонажа:
|
||||
<small>
|
||||
<BR>(можно щелкнуть по логину в чате)
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD width=50% align=right>
|
||||
<INPUT TYPE="text" NAME="${name1}" value="${defaultlogin}">
|
||||
</TD>
|
||||
<TD width=50%>
|
||||
<INPUT type=image SRC="/i/b__ok.gif" WIDTH="25" HEIGHT="18" BORDER=0 ALT="" onclick="${slform.name1.value = fixspaces(slform.name1.value)}">
|
||||
</TD>
|
||||
</TR>
|
||||
</FORM>
|
||||
</TABLE>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
`;
|
||||
/*document.all("hint3").innerHTML = '<table border=0 width=100% cellspacing="1" cellpadding="0" bgcolor="#CCC3AA"><tr><td align=center><B>' + title + '</td><td width=20 align=right valign=top style="cursor: hand" onclick="closehint3();"><BIG><B>x</td></tr><tr><td colspan=2>' +
|
||||
'<table border=0 width=100% cellspacing="0" cellpadding="2" bgcolor="#FFF6DD"><tr><form action="' + script + '" method=POST name=slform><td colspan=2>' +
|
||||
'Укажите логин персонажа:<small><BR>(можно щелкнуть по логину в чате)</TD></TR><TR><TD width=50% align=right><INPUT TYPE="text" NAME="' + name + '" value="' + defaultlogin + '"></TD><TD width=50%><INPUT type=image SRC="/i/b__ok.gif" WIDTH="25" HEIGHT="18" BORDER=0 ALT="" onclick="slform.' + name + '.value=fixspaces(slform.' + name + '.value)"></TD></TR></FORM></TABLE></td></tr></table>';
|
||||
*/
|
||||
hint3.style.visibility = "visible";
|
||||
hint3.style.left = "100";
|
||||
hint3.style.top = "60";
|
||||
document.all(name1).focus();
|
||||
Hint3Name = name1;
|
||||
}
|
||||
|
||||
// Для магии. Заголовок, название скрипта, название магии, номер вещицы в рюкзаке, логин по умолчанию, описание доп. поля
|
||||
function magicklogin(title, script, magickname, n, defaultlogin, extparam)
|
||||
{
|
||||
var s = '<table border=0 width=100% cellspacing="1" cellpadding="0" bgcolor="#CCC3AA"><tr><td align=center><B>'+title+'</td><td width=20 align=right valign=top style="cursor: hand" onclick="closehint3();"><BIG><B>x</td></tr><tr><td colspan=2>'+
|
||||
'<table border=0 width=100% cellspacing="0" cellpadding="2" bgcolor="#FFF6DD"><tr><form action="'+script+'" method=POST name=slform><input type=hidden name="use" value="'+magickname+'"><input type=hidden name="n" value="'+n+'"><td colspan=2>'+
|
||||
'Укажите логин персонажа:<small><BR>(можно щелкнуть по логину в чате)</TD></TR><TR><TD width=50% align=right><INPUT TYPE="text" NAME="param" value="'+defaultlogin+'"></TD><TD width=50%><INPUT type=image SRC="/i/b__ok.gif" WIDTH="25" HEIGHT="18" BORDER=0 ALT="" onclick="slform.param.value=fixspaces(slform.param.value);"></TD></TR>';
|
||||
if (extparam != null && extparam != '') {
|
||||
s = s + '<TR><td colspan=2>'+extparam+'<BR><INPUT TYPE="text" NAME="param2" size=20></TD></TR>';
|
||||
}
|
||||
s = s + '</FORM></TABLE></td></tr></table>';
|
||||
document.all("hint3").innerHTML = s;
|
||||
document.all("hint3").style.visibility = "visible";
|
||||
document.all("hint3").style.left = 100;
|
||||
document.all("hint3").style.top = document.body.scrollTop+50;
|
||||
document.all("param").focus();
|
||||
Hint3Name = 'param';
|
||||
function magicklogin(title, script, magickname, n, defaultlogin, extparam) {
|
||||
var s = '<table border=0 width=100% cellspacing="1" cellpadding="0" bgcolor="#CCC3AA"><tr><td align=center><B>' + title + '</td><td width=20 align=right valign=top style="cursor: hand" onclick="closehint3();"><BIG><B>x</td></tr><tr><td colspan=2>' +
|
||||
'<table border=0 width=100% cellspacing="0" cellpadding="2" bgcolor="#FFF6DD"><tr><form action="' + script + '" method=POST name=slform><input type=hidden name="use" value="' + magickname + '"><input type=hidden name="n" value="' + n + '"><td colspan=2>' +
|
||||
'Укажите логин персонажа:<small><BR>(можно щелкнуть по логину в чате)</TD></TR><TR><TD width=50% align=right><INPUT TYPE="text" NAME="param" value="' + defaultlogin + '"></TD><TD width=50%><INPUT type=image SRC="/i/b__ok.gif" WIDTH="25" HEIGHT="18" BORDER=0 ALT="" onclick="slform.param.value=fixspaces(slform.param.value);"></TD></TR>';
|
||||
if (extparam != null && extparam != '') {
|
||||
s = s + '<TR><td colspan=2>' + extparam + '<BR><INPUT TYPE="text" NAME="param2" size=20></TD></TR>';
|
||||
}
|
||||
s = s + '</FORM></TABLE></td></tr></table>';
|
||||
document.all("hint3").innerHTML = s;
|
||||
document.all("hint3").style.visibility = "visible";
|
||||
document.all("hint3").style.left = 100;
|
||||
document.all("hint3").style.top = document.body.scrollTop + 50;
|
||||
document.all("param").focus();
|
||||
Hint3Name = 'param';
|
||||
}
|
||||
|
||||
// Магия
|
||||
function UseMagick(title, script, name, extparam, n, extparam2) {
|
||||
if ((extparam != null)&&(extparam != '')) {
|
||||
if ((extparam != null) && (extparam != '')) {
|
||||
|
||||
var t1='text',t2='text';
|
||||
var t1 = 'text', t2 = 'text';
|
||||
|
||||
if (extparam.substr(0,1) == "!")
|
||||
{
|
||||
t1='password';
|
||||
extparam=extparam.substr(1,extparam.length);
|
||||
}
|
||||
var s = '<table border=0 width=100% cellspacing="1" cellpadding="0" bgcolor="#CCC3AA"><tr><td align=center><B>'+title+'</td><td width=20 align=right valign=top style="cursor: hand" onclick="closehint3();"><BIG><B>x</td></tr><tr><td colspan=2>'+
|
||||
'<table border=0 width=100% cellspacing="0" cellpadding="2" bgcolor="#FFF6DD"><tr><form action="'+script+'" method=POST name=slform><input type=hidden name="use" value="'+name+'"><input type=hidden name="n" value="'+n+'"><td colspan=2><NOBR><SMALL>'+
|
||||
extparam + ':</NOBR></TD></TR><TR><TD width=100% align=left> <INPUT tabindex=1 size=30 TYPE="'+t1+'" NAME="param" value=""></TD><TD width=10%><INPUT type=image SRC="/i/b__ok.gif" WIDTH="25" HEIGHT="18" BORDER=0 ALT="" tabindex=3></TD></TR>';
|
||||
if (extparam2 != null && extparam2 != '') {
|
||||
if (extparam2.substr(0,1) == "!")
|
||||
{
|
||||
t2='password';
|
||||
extparam2=extparam2.substr(1,extparam2.length);
|
||||
}
|
||||
s = s + '<TR><td colspan=2><NOBR><SMALL>'+extparam2+':</NOBR><TR colspan=2><TD> <INPUT tabindex=2 TYPE="'+t2+'" NAME="param2" size=30></TD></TR>';
|
||||
}
|
||||
s = s + '</FORM></TABLE></td></tr></table>';
|
||||
document.all("hint3").innerHTML = s;
|
||||
document.all("hint3").style.visibility = "visible";
|
||||
document.all("hint3").style.left = 100;
|
||||
document.all("hint3").style.top = document.body.scrollTop+50;
|
||||
document.all("param").focus();
|
||||
Hint3Name = 'param';
|
||||
} else {
|
||||
if (confirm('Использовать сейчас?')) { location=script+'?use='+name+'&n='+n; }
|
||||
}
|
||||
if (extparam.substr(0, 1) == "!") {
|
||||
t1 = 'password';
|
||||
extparam = extparam.substr(1, extparam.length);
|
||||
}
|
||||
var s = '<table border=0 width=100% cellspacing="1" cellpadding="0" bgcolor="#CCC3AA"><tr><td align=center><B>' + title + '</td><td width=20 align=right valign=top style="cursor: hand" onclick="closehint3();"><BIG><B>x</td></tr><tr><td colspan=2>' +
|
||||
'<table border=0 width=100% cellspacing="0" cellpadding="2" bgcolor="#FFF6DD"><tr><form action="' + script + '" method=POST name=slform><input type=hidden name="use" value="' + name + '"><input type=hidden name="n" value="' + n + '"><td colspan=2><NOBR><SMALL>' +
|
||||
extparam + ':</NOBR></TD></TR><TR><TD width=100% align=left> <INPUT tabindex=1 size=30 TYPE="' + t1 + '" NAME="param" value=""></TD><TD width=10%><INPUT type=image SRC="/i/b__ok.gif" WIDTH="25" HEIGHT="18" BORDER=0 ALT="" tabindex=3></TD></TR>';
|
||||
if (extparam2 != null && extparam2 != '') {
|
||||
if (extparam2.substr(0, 1) == "!") {
|
||||
t2 = 'password';
|
||||
extparam2 = extparam2.substr(1, extparam2.length);
|
||||
}
|
||||
s = s + '<TR><td colspan=2><NOBR><SMALL>' + extparam2 + ':</NOBR><TR colspan=2><TD> <INPUT tabindex=2 TYPE="' + t2 + '" NAME="param2" size=30></TD></TR>';
|
||||
}
|
||||
s = s + '</FORM></TABLE></td></tr></table>';
|
||||
document.all("hint3").innerHTML = s;
|
||||
document.all("hint3").style.visibility = "visible";
|
||||
document.all("hint3").style.left = 100;
|
||||
document.all("hint3").style.top = document.body.scrollTop + 50;
|
||||
document.all("param").focus();
|
||||
Hint3Name = 'param';
|
||||
} else {
|
||||
if (confirm('Использовать сейчас?')) {
|
||||
location = script + '?use=' + name + '&n=' + n;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Закрывает окно ввода логина
|
||||
function closehint3()
|
||||
{
|
||||
document.all("hint3").style.visibility="hidden";
|
||||
Hint3Name='';
|
||||
function closehint3() {
|
||||
document.all("hint3").style.visibility = "hidden";
|
||||
Hint3Name = '';
|
||||
}
|
||||
|
||||
// Для боевой магии. Заголовок, название магии, номер вещицы в рюкзаке
|
||||
function Bmagicklogin(title, magickname, n)
|
||||
{
|
||||
if (defend==false)
|
||||
{
|
||||
errmess("Блок не выбран.");
|
||||
return false;
|
||||
}
|
||||
function Bmagicklogin(title, magickname, n) {
|
||||
if (defend == false) {
|
||||
errmess("Блок не выбран.");
|
||||
return false;
|
||||
}
|
||||
|
||||
document.all("hint3").innerHTML = '<table border=0 width=100% cellspacing="1" cellpadding="0" bgcolor="#CCC3AA"><tr><td align=center><B>'+title+'</td><td width=20 align=right valign=top style="cursor: hand" onclick="closehint3();"><BIG><B>x</td></tr><tr><td colspan=2>'+
|
||||
'<table border=0 width=100% cellspacing="0" cellpadding="2" bgcolor="#FFF6DD"><tr><form name="bmagic" action="/battle.pl" method=POST onsubmit="bmagic.mdefend.value=defend;"><input type=hidden name="use" value="'+magickname+'"><input type=hidden name="n" value="'+n+'"><input type=hidden name="mdefend" value="'+defend+'"><input type=hidden name="enemy" value="'+enemy+'"><input type=hidden name="myid" value="'+myid+'"><td colspan=2>'+
|
||||
'Укажите логин персонажа:<small><BR>(можно щелкнуть по логину в чате)</TD></TR><TR><TD width=50% align=right><INPUT TYPE="text" NAME="param"></TD><TD width=50%><INPUT type=image SRC="/i/b__ok.gif" WIDTH="25" HEIGHT="18" BORDER=0 ALT="" onclick="bmagic.param.value=fixspaces(bmagic.param.value);"></TD></TR></FORM></TABLE></td></tr></table>';
|
||||
document.all("hint3").style.visibility = "visible";
|
||||
document.all("hint3").style.left = 100;
|
||||
document.all("hint3").style.top = 60;
|
||||
document.all("param").focus();
|
||||
Hint3Name = 'param';
|
||||
document.all("hint3").innerHTML = '<table border=0 width=100% cellspacing="1" cellpadding="0" bgcolor="#CCC3AA"><tr><td align=center><B>' + title + '</td><td width=20 align=right valign=top style="cursor: hand" onclick="closehint3();"><BIG><B>x</td></tr><tr><td colspan=2>' +
|
||||
'<table border=0 width=100% cellspacing="0" cellpadding="2" bgcolor="#FFF6DD"><tr><form name="bmagic" action="/battle.pl" method=POST onsubmit="bmagic.mdefend.value=defend;"><input type=hidden name="use" value="' + magickname + '"><input type=hidden name="n" value="' + n + '"><input type=hidden name="mdefend" value="' + defend + '"><input type=hidden name="enemy" value="' + enemy + '"><input type=hidden name="myid" value="' + myid + '"><td colspan=2>' +
|
||||
'Укажите логин персонажа:<small><BR>(можно щелкнуть по логину в чате)</TD></TR><TR><TD width=50% align=right><INPUT TYPE="text" NAME="param"></TD><TD width=50%><INPUT type=image SRC="/i/b__ok.gif" WIDTH="25" HEIGHT="18" BORDER=0 ALT="" onclick="bmagic.param.value=fixspaces(bmagic.param.value);"></TD></TR></FORM></TABLE></td></tr></table>';
|
||||
document.all("hint3").style.visibility = "visible";
|
||||
document.all("hint3").style.left = 100;
|
||||
document.all("hint3").style.top = 60;
|
||||
document.all("param").focus();
|
||||
Hint3Name = 'param';
|
||||
}
|
||||
|
||||
// Магия
|
||||
function BUseMagick(name, extparam, n) {
|
||||
|
||||
if (defend==false)
|
||||
{
|
||||
errmess("Блок не выбран.");
|
||||
return false;
|
||||
}
|
||||
if (defend == false) {
|
||||
errmess("Блок не выбран.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((extparam != null)&&(extparam != '')) {
|
||||
var s = prompt(extparam+':', '');
|
||||
if ((s != null)&&(s != '')) {
|
||||
re = /\%/g; s=s.replace(re, "%25");
|
||||
re = /\+/g; s=s.replace(re, "%2B");
|
||||
re = /\#/g; s=s.replace(re, "%23");
|
||||
re = /\?/g; s=s.replace(re, "%3F");
|
||||
re = /\&/g; s=s.replace(re, "%26");
|
||||
window.location.href='/battle.pl?use='+name+'¶m='+s+'&n='+n+'&mdefend='+defend+'&enemy='+enemy+'&myid='+myid;
|
||||
if ((extparam != null) && (extparam != '')) {
|
||||
var s = prompt(extparam + ':', '');
|
||||
if ((s != null) && (s != '')) {
|
||||
re = /\%/g;
|
||||
s = s.replace(re, "%25");
|
||||
re = /\+/g;
|
||||
s = s.replace(re, "%2B");
|
||||
re = /\#/g;
|
||||
s = s.replace(re, "%23");
|
||||
re = /\?/g;
|
||||
s = s.replace(re, "%3F");
|
||||
re = /\&/g;
|
||||
s = s.replace(re, "%26");
|
||||
window.location.href = '/battle.pl?use=' + name + '¶m=' + s + '&n=' + n + '&mdefend=' + defend + '&enemy=' + enemy + '&myid=' + myid;
|
||||
|
||||
}
|
||||
} else {
|
||||
if (confirm('Использовать сейчас?')) { location='/battle.pl?use='+name+'&n='+n+'&mdefend='+defend+'&enemy='+enemy+'&myid='+myid;}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (confirm('Использовать сейчас?')) {
|
||||
location = '/battle.pl?use=' + name + '&n=' + n + '&mdefend=' + defend + '&enemy=' + enemy + '&myid=' + myid;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -142,7 +142,8 @@ if (isset($_POST['exit'])) {
|
||||
}
|
||||
$dresed = mysql_query('SELECT `id`, `type` FROM `inventory` WHERE `dressed` = 1 AND `laba` = 2 AND `owner` = "' . $user['id'] . '"');
|
||||
while ($pl = mysql_fetch_array($dresed)) {
|
||||
dropitemid($pl['type'], $user['id']);
|
||||
$item = new \Battles\DressedItems($user['id']);
|
||||
$item->undressItem($pl['type']);
|
||||
}
|
||||
mysql_query('DELETE FROM `inventory` WHERE `laba` > 0 AND `owner` = "' . $user['id'] . '"');
|
||||
mysql_query("UPDATE `users`, `online` SET `users`.`room` = '1051', `online`.`room` = '1051', `users`.`x` = '0', `users`.`y` = '0', `users`.`laba` = '0' WHERE `online`.`id` = `users`.`id` AND `online`.`id` = '" . $user['id'] . "'");
|
||||
@ -291,7 +292,8 @@ if ($user['y'] >= count($map_d) - 2) {
|
||||
}
|
||||
$dresed = mysql_query('SELECT `id`, `type` FROM `inventory` WHERE `dressed` = 1 AND `laba` = 2 AND `owner` = "' . $user['id'] . '"');
|
||||
while ($pl = mysql_fetch_array($dresed)) {
|
||||
dropitemid($pl['type'], $user['id']);
|
||||
$item = new \Battles\DressedItems($user['id']);
|
||||
$item->undressItem($pl['type']);
|
||||
}
|
||||
mysql_query('UPDATE `inventory` SET `laba` = 0 WHERE `laba` = 1 AND `owner` = "' . $user['id'] . '"');
|
||||
mysql_query('DELETE FROM `inventory` WHERE `laba` = 2 AND `owner` = "' . $user['id'] . '"');
|
||||
|
19
library.php
@ -211,14 +211,13 @@ if ($_GET['lib_room'] == 'hall' || !$_GET['lib_room']) {
|
||||
addchp('Вы успешно создали свиток <strong>' . $dress['name'] . '</strong>!', '{[]}' . Nick::id($user['id'])->short() . '{[]}');
|
||||
}
|
||||
}
|
||||
echo '<tr><td>Вы стоите в небольшой комнате, от пола до потолка забтиой банками, пробирками, ингредиентами и прочими полезными вещами.
|
||||
Здесь Вы можете собрать предметы по имеющимся у Вас рецептам.<br/><br/><IMG align=left alt="Знак зодиака" height=99 src="i/';
|
||||
//выводим знак зодиака
|
||||
echo star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2));
|
||||
echo '.gif" width=100>';
|
||||
$a = new \Battles\UserInfo($user['id']);
|
||||
echo "<tr><td>Вы стоите в небольшой комнате, от пола до потолка забтиой банками, пробирками, ингредиентами и прочими полезными вещами.
|
||||
Здесь Вы можете собрать предметы по имеющимся у Вас рецептам.<br><br><img align=left alt='Родовой знак' src='i/zodiac/{$a->showStarSign()}.png'";
|
||||
|
||||
//выводим инфо по стихиям
|
||||
echo 'Ваша стихия:';
|
||||
$el = element(star_sign(substr($user['borndate'], 3, 2), substr($user['borndate'], 0, 2)));
|
||||
$el = element($a->showStarSign());
|
||||
switch ($el) {
|
||||
case 'a':
|
||||
echo "<strong><font color=#0198ef><ins>Воздух</ins></font></strong>";
|
||||
@ -234,7 +233,13 @@ if ($_GET['lib_room'] == 'hall' || !$_GET['lib_room']) {
|
||||
break;
|
||||
}
|
||||
echo "<br/>Эффективность магии:";
|
||||
foreach (Config::$elem_align as $k => $ea) {
|
||||
$elem_align = [
|
||||
'a' => ['a' => '1', 'e' => '0', 'f' => '0.5', 'w' => '0.5'],
|
||||
'e' => ['a' => '0', 'e' => '1', 'f' => '0.5', 'w' => '0.5'],
|
||||
'f' => ['a' => '0.5', 'e' => '0.5', 'f' => '1', 'w' => '0'],
|
||||
'w' => ['a' => '0.5', 'e' => '0.5', 'f' => '0', 'w' => '1'],
|
||||
];
|
||||
foreach ($elem_align as $k => $ea) {
|
||||
switch ($k) {
|
||||
case 'a':
|
||||
echo "<br/><font color=#0198ef>Воздух</font>";
|
||||
|
@ -24,9 +24,9 @@ if ($user['battle'] > 0) {
|
||||
echo "Бой закрыт для вмешательства!";
|
||||
} elseif (!$us['online']) {
|
||||
echo "Персонаж не в игре!";
|
||||
} elseif(in_array($us['room'], Config::$unkilable['rooms'])) {
|
||||
} elseif(in_array($us['room'], UNKILABLE['rooms'])) {
|
||||
echo "В данной комнате запрещены нападения ...";
|
||||
} elseif(in_array($us['id'], Config::$unkilable['users'])) {
|
||||
} elseif(in_array($us['id'], UNKILABLE['users'])) {
|
||||
echo "Персонаж под защитой от нападений ...";
|
||||
} elseif(isset($effect['id'])) {
|
||||
echo "Персонаж под защитой от нападений ...";
|
||||
|
@ -16,9 +16,9 @@ if($vip['bloodattack'] <= 0) {
|
||||
echo "Запрещено входить в хаотический бой!";
|
||||
} elseif($us['battle'] > 0 && $us_b['open'] == 0) {
|
||||
echo "Бой закрыт для вмешательства!";
|
||||
} elseif(in_array($us['room'], Config::$unkilable['rooms'])) {
|
||||
} elseif(in_array($us['room'], UNKILABLE['rooms'])) {
|
||||
echo "В данной комнате запрещены нападения ...";
|
||||
} elseif(in_array($us['id'], Config::$unkilable['users'])) {
|
||||
} elseif(in_array($us['id'], UNKILABLE['users'])) {
|
||||
echo "Персонаж под защитой от нападений ...";
|
||||
} elseif(isset($effect['id'])) {
|
||||
echo "Персонаж под защитой от нападений ...";
|
||||
|
@ -21,9 +21,9 @@ elseif (!$us['online']) {
|
||||
echo "Запрещено входить в хаотический бой!";
|
||||
} elseif ($us['battle']>0 && $us_b['open']==0) {
|
||||
echo "Бой закрыт для вмешательства!";
|
||||
} elseif(in_array($us['room'], Config::$unkilable['rooms'])) {
|
||||
} elseif(in_array($us['room'], UNKILABLE['rooms'])) {
|
||||
echo "В данной комнате запрещены нападения ...";
|
||||
} elseif(in_array($us['id'], Config::$unkilable['users'])) {
|
||||
} elseif(in_array($us['id'], UNKILABLE['users'])) {
|
||||
echo "Персонаж под защитой от нападений ...";
|
||||
} elseif(isset($effect['id'])) {
|
||||
echo "Персонаж под защитой от нападений ...";
|
||||
|
@ -17,9 +17,9 @@ if ($user['battle'] > 0) {
|
||||
echo "Бой закрыт для вмешательства!";
|
||||
} elseif ($user['zayavka'] > 0) {
|
||||
echo "Вы ожидаете поединка...";
|
||||
} elseif(in_array($jert['room'], Config::$unkilable['rooms'])) {
|
||||
} elseif(in_array($jert['room'], UNKILABLE['rooms'])) {
|
||||
echo "В данной комнате запрещены нападения ...";
|
||||
} elseif(in_array($jert['id'], Config::$unkilable['users'])) {
|
||||
} elseif(in_array($jert['id'], UNKILABLE['users'])) {
|
||||
echo "Персонаж под защитой от нападений ...";
|
||||
} elseif(isset($effect['id'])) {
|
||||
echo "Персонаж под защитой от нападений ...";
|
||||
|
@ -24,9 +24,9 @@ if ($user['battle'] > 0) {
|
||||
echo "Бой закрыт для вмешательства!";
|
||||
} elseif ($user['zayavka'] > 0) {
|
||||
echo "Вы ожидаете поединка...";
|
||||
} elseif (in_array($us['room'], Config::$unkilable['rooms'])) {
|
||||
} elseif (in_array($us['room'], UNKILABLE['rooms'])) {
|
||||
echo "В данной комнате запрещены нападения ...";
|
||||
} elseif (in_array($us['id'], Config::$unkilable['users'])) {
|
||||
} elseif (in_array($us['id'], UNKILABLE['users'])) {
|
||||
echo "Персонаж под защитой от нападений ...";
|
||||
} elseif (isset($effect['id'])) {
|
||||
echo "Персонаж под защитой от нападений ...";
|
||||
@ -117,8 +117,8 @@ if ($user['battle'] > 0) {
|
||||
mysql_query("INSERT INTO `bots` (`name`,`prototype`,`battle`,`hp`) values ('Архивариус','83','','" . $jert['hp'] . "');");
|
||||
$jert['id'] = mysql_insert_id();
|
||||
}
|
||||
undressall($jert['id']);
|
||||
undressall($user['id']);
|
||||
\Battles\DressedItems::undressAllItems($jert['id']);
|
||||
\Battles\DressedItems::undressAllItems($user['id']);
|
||||
$teams = [];
|
||||
$teams[$user['id']][$jert['id']] = [0, 0, time()];
|
||||
$teams[$jert['id']][$user['id']] = [0, 0, time()];
|
||||
|
@ -31,9 +31,9 @@ elseif (!$us['online']) {
|
||||
echo "Не атакуйте Администратора!";
|
||||
} elseif ($user['zayavka'] > 0) {
|
||||
echo "Вы ожидаете поединка...";
|
||||
} elseif(in_array($us['room'], Config::$unkilable['rooms'])) {
|
||||
} elseif(in_array($us['room'], UNKILABLE['rooms'])) {
|
||||
echo "В данной комнате запрещены нападения ...";
|
||||
} elseif(in_array($us['id'], Config::$unkilable['users'])) {
|
||||
} elseif(in_array($us['id'], UNKILABLE['users'])) {
|
||||
echo "Персонаж под защитой от нападений ...";
|
||||
} elseif(isset($effect['id'])) {
|
||||
echo "Персонаж под защитой от нападений ...";
|
||||
@ -104,8 +104,8 @@ elseif (!$us['online']) {
|
||||
}
|
||||
|
||||
if(rand(0,100)<80)
|
||||
undressall($jert['id']);
|
||||
undressall($user['id']);
|
||||
\Battles\DressedItems::undressAllItems($jert['id']);
|
||||
\Battles\DressedItems::undressAllItems($user['id']);
|
||||
$teams = array();
|
||||
$teams[$user['id']][$jert['id']] = array(0,0,time());
|
||||
$teams[$jert['id']][$user['id']] = array(0,0,time());
|
||||
|
@ -29,9 +29,9 @@ if ($user['battle'] > 0) {
|
||||
echo "Персонаж защищен от кулачного нападения!";
|
||||
} elseif ($us['align']==2.99) {
|
||||
echo "Не атакуйте Администратора!";
|
||||
} elseif(in_array($us['room'], Config::$unkilable['rooms'])) {
|
||||
} elseif(in_array($us['room'], UNKILABLE['rooms'])) {
|
||||
echo "В данной комнате запрещены нападения ...";
|
||||
} elseif(in_array($us['id'], Config::$unkilable['users'])) {
|
||||
} elseif(in_array($us['id'], UNKILABLE['users'])) {
|
||||
echo "Персонаж под защитой от нападений ...";
|
||||
} elseif(isset($effect['id'])) {
|
||||
echo "Персонаж под защитой от нападений ...";
|
||||
@ -104,8 +104,8 @@ if ($user['battle'] > 0) {
|
||||
}
|
||||
|
||||
if(rand(0,100)<80)
|
||||
undressall($jert['id']);
|
||||
undressall($user['id']);
|
||||
\Battles\DressedItems::undressAllItems($jert['id']);
|
||||
\Battles\DressedItems::undressAllItems($user['id']);
|
||||
$teams = array();
|
||||
$teams[$user['id']][$jert['id']] = array(0,0,time());
|
||||
$teams[$jert['id']][$user['id']] = array(0,0,time());
|
||||
|
@ -31,9 +31,9 @@ elseif (!$us['online']) {
|
||||
echo "Бой закрыт для вмешательства!";
|
||||
} elseif ($us['align']==2.99) {
|
||||
echo "Не атакуйте Администратора!";
|
||||
} elseif(in_array($us['room'], Config::$unkilable['rooms'])) {
|
||||
} elseif(in_array($us['room'], UNKILABLE['rooms'])) {
|
||||
echo "В данной комнате запрещены нападения ...";
|
||||
} elseif(in_array($us['id'], Config::$unkilable['users'])) {
|
||||
} elseif(in_array($us['id'], UNKILABLE['users'])) {
|
||||
echo "Персонаж под защитой от нападений ...";
|
||||
} elseif(isset($effect['id'])) {
|
||||
echo "Персонаж под защитой от нападений ...";
|
||||
|
@ -3,7 +3,7 @@
|
||||
if ($user['battle'] > 0) {
|
||||
echo "Не в бою...";
|
||||
} elseif (rand(1, 100) != 1) {
|
||||
undressall($user['id']);
|
||||
\Battles\DressedItems::undressAllItems($user['id']);
|
||||
$user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '{$_SESSION['uid']}' LIMIT 1;"));
|
||||
if (empty($_SESSION['uid'])) {
|
||||
header("Location: index.php");
|
||||
|
@ -36,9 +36,9 @@ elseif ($user['zayavka'] > 0) {
|
||||
echo "Вы ожидаете поединка...";
|
||||
} elseif ($owntravma['id'] && !$us['battle']) {
|
||||
echo "Персонаж тяжело травмирован...";
|
||||
} elseif(in_array($us['room'], Config::$unkilable['rooms'])) {
|
||||
} elseif(in_array($us['room'], UNKILABLE['rooms'])) {
|
||||
echo "В данной комнате запрещены нападения ...";
|
||||
} elseif(in_array($us['id'], Config::$unkilable['users'])) {
|
||||
} elseif(in_array($us['id'], UNKILABLE['users'])) {
|
||||
echo "Персонаж под защитой от нападений ...";
|
||||
} elseif(isset($effect['id'])) {
|
||||
echo "Персонаж под защитой от нападений ...";
|
||||
|
@ -36,9 +36,9 @@ elseif ($user['zayavka'] > 0) {
|
||||
echo "Вы ожидаете поединка...";
|
||||
} elseif ($owntravma['id'] && !$us['battle']) {
|
||||
echo "Персонаж тяжело травмирован...";
|
||||
} elseif(in_array($us['room'], Config::$unkilable['rooms'])) {
|
||||
} elseif(in_array($us['room'], UNKILABLE['rooms'])) {
|
||||
echo "В данной комнате запрещены нападения ...";
|
||||
} elseif(in_array($us['id'], Config::$unkilable['users'])) {
|
||||
} elseif(in_array($us['id'], UNKILABLE['users'])) {
|
||||
echo "Персонаж под защитой от нападений ...";
|
||||
} elseif(isset($effect['id'])) {
|
||||
echo "Персонаж под защитой от нападений ...";
|
||||
|
@ -43,7 +43,7 @@ if ($user['battle'] > 0) {
|
||||
echo "<font color=red><b>Этот свиток нельзя встраивать в предметы!<b></font>";
|
||||
} else {
|
||||
// встраиваем
|
||||
destructitem($svitok['id']);
|
||||
\Battles\InventoryItem::destroyItem($svitok['id']);
|
||||
echo "<font color=red><b>Свиток \"" . $svitok['name'] . "\" удачно встроен в \"" . $dress['name'] . "\"<b></font>";
|
||||
mysql_query("UPDATE `inventory` SET
|
||||
" . ($dress['nintel'] < $svitok['nintel'] ? "`nintel`='" . $svitok['nintel'] . "'," : "") . "
|
||||
|
@ -16,9 +16,9 @@ if($vip['attack'] <= 0) {
|
||||
echo "Запрещено входить в хаотический бой!";
|
||||
} elseif($us['battle'] > 0 && $us_b['open'] == 0) {
|
||||
echo "Бой закрыт для вмешательства!";
|
||||
} elseif(in_array($us['room'], Config::$unkilable['rooms'])) {
|
||||
} elseif(in_array($us['room'], UNKILABLE['rooms'])) {
|
||||
echo "В данной комнате запрещены нападения ...";
|
||||
} elseif(in_array($us['id'], Config::$unkilable['users'])) {
|
||||
} elseif(in_array($us['id'], UNKILABLE['users'])) {
|
||||
echo "Персонаж под защитой от нападений ...";
|
||||
} elseif(isset($effect['id'])) {
|
||||
echo "Персонаж под защитой от нападений ...";
|
||||
|
@ -16,9 +16,9 @@ if($vip['bloodattack'] <= 0) {
|
||||
echo "Запрещено входить в хаотический бой!";
|
||||
} elseif($us['battle'] > 0 && $us_b['open'] == 0) {
|
||||
echo "Бой закрыт для вмешательства!";
|
||||
} elseif(in_array($us['room'], Config::$unkilable['rooms'])) {
|
||||
} elseif(in_array($us['room'], UNKILABLE['rooms'])) {
|
||||
echo "В данной комнате запрещены нападения ...";
|
||||
} elseif(in_array($us['id'], Config::$unkilable['users'])) {
|
||||
} elseif(in_array($us['id'], UNKILABLE['users'])) {
|
||||
echo "Персонаж под защитой от нападений ...";
|
||||
} elseif(isset($effect['id'])) {
|
||||
echo "Персонаж под защитой от нападений ...";
|
||||
|
@ -14,9 +14,9 @@ if($vip['attack'] <= 0) {
|
||||
echo "Не в бою...";
|
||||
} elseif($us_b['type'] == 3 || $us_b['type'] == 5) {
|
||||
echo "Запрещено входить в хаотический бой!";
|
||||
} elseif(in_array($us['room'], Config::$unkilable['rooms'])) {
|
||||
} elseif(in_array($us['room'], UNKILABLE['rooms'])) {
|
||||
echo "В данной комнате запрещены нападения ...";
|
||||
} elseif(in_array($us['id'], Config::$unkilable['users'])) {
|
||||
} elseif(in_array($us['id'], UNKILABLE['users'])) {
|
||||
echo "Персонаж под защитой от нападений ...";
|
||||
} elseif(isset($effect['id'])) {
|
||||
echo "Персонаж под защитой от нападений ...";
|
||||
|
@ -16,9 +16,9 @@ if($vip['bloodattack'] <= 0) {
|
||||
echo "Запрещено входить в хаотический бой!";
|
||||
} elseif($us['battle'] > 0 && $us_b['open'] == 0) {
|
||||
echo "Бой закрыт для вмешательства!";
|
||||
} elseif(in_array($us['room'], Config::$unkilable['rooms'])) {
|
||||
} elseif(in_array($us['room'], UNKILABLE['rooms'])) {
|
||||
echo "В данной комнате запрещены нападения ...";
|
||||
} elseif(in_array($us['id'], Config::$unkilable['users'])) {
|
||||
} elseif(in_array($us['id'], UNKILABLE['users'])) {
|
||||
echo "Персонаж под защитой от нападений ...";
|
||||
} elseif(isset($effect['id'])) {
|
||||
echo "Персонаж под защитой от нападений ...";
|
||||
|
338
main.php
@ -1,11 +1,13 @@
|
||||
<?php
|
||||
|
||||
use Battles\Database\DBPDO;
|
||||
use Battles\DressedItems;
|
||||
use Battles\GameLogs;
|
||||
use Battles\InventoryItem;
|
||||
use Battles\Template;
|
||||
use Battles\Travel;
|
||||
use Battles\UserInfo;
|
||||
use Battles\UserStats;
|
||||
|
||||
ob_start("ob_gzhandler");
|
||||
session_start();
|
||||
@ -16,11 +18,7 @@ if ($get == 'exit') {
|
||||
}
|
||||
require_once 'functions.php';
|
||||
|
||||
try {
|
||||
db::c()->query('UPDATE `online` SET `real_time` = ?i WHERE `user_id` = ?i', time(), $user->getId());
|
||||
} catch (\Krugozor\Database\Mysql\Exception $e) {
|
||||
echo "<div class='debug' '>Ошибка: " . $e->getMessage() . "<br> Стек: " . $e->getTraceAsString() . "</div>";
|
||||
}
|
||||
$user->setOnline();
|
||||
|
||||
// Инициализируем входящие GET\POST переменные.
|
||||
$goto = $_GET['goto'] ?? null;
|
||||
@ -33,13 +31,59 @@ $mfs = $_GET['modif_mf'] ?? null;
|
||||
$ids = $_GET['ids'] ?? null;
|
||||
$setShadow = $_POST['setshadow'] ?? null;
|
||||
$edit = $_GET['edit'] ?? null;
|
||||
|
||||
if ($edit) {
|
||||
$ups = $_GET['ups'] ?? null;
|
||||
$use = $_GET['use'] ?? null;
|
||||
$useTarget = $_POST['target'] ?? null;
|
||||
$drop = $_GET['drop'] ?? null;
|
||||
$dress = $_GET['dress'] ?? null;
|
||||
$undress = $_GET['undress'] ?? null;
|
||||
$destruct = $_GET['destruct'] ?? null;
|
||||
|
||||
if ($ups) {
|
||||
$user->addOnePointToStat($ups);
|
||||
}
|
||||
if ($drop) {
|
||||
$items = new DressedItems($_SESSION['uid']);
|
||||
$items->undressItem($drop);
|
||||
unset($items);
|
||||
}
|
||||
//Пока что одеваем предмет отсюда.
|
||||
if ($dress) {
|
||||
$dressing = new InventoryItem(DBPDO::INIT()->ofetch('select * from inventory where item_id = ? ', $dress));
|
||||
$dressing->dressItem();
|
||||
unset($dressing);
|
||||
}
|
||||
if ($destruct) {
|
||||
$q = DBPDO::INIT()->ofetch('select name,dressed_slot from inventory where owner_id = ? and item_id = ?', [$user->getId(), $destruct]);
|
||||
if ($q) {
|
||||
if (empty($q->dressed_slot)) {
|
||||
InventoryItem::destroyItem($destruct);
|
||||
GameLogs::addUserLog($user->getId(), $user->getLogin() . ' выбросил предмет ' . $q->name . ' id:(cap' . $destruct . ')');
|
||||
err('Предмет ' . $q->name . ' выброшен.');
|
||||
} else {
|
||||
err('Ошибка: нельзя выбросить одетый предмет!');
|
||||
}
|
||||
} else {
|
||||
err('Ошибка: предмет не найден!');
|
||||
}
|
||||
}
|
||||
if ($use) {
|
||||
usemagic($use, $useTarget);
|
||||
}
|
||||
if ($undress) {
|
||||
\Battles\DressedItems::undressAllItems($_SESSION['uid']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Подготавливаем отображение инфы и предметов.
|
||||
$userInfo = new UserInfo($user->getId());
|
||||
$getItemsBonuses = new DressedItems($_SESSION['uid']);
|
||||
$data_query = 'SELECT * FROM inventory WHERE owner_id = ?i AND dressed_slot = 0 AND on_sale = 0';
|
||||
$data = db::c()->query($data_query, $_SESSION['uid']);
|
||||
$userStats = new UserStats($user->getId());
|
||||
$data = DBPDO::INIT()->ofetchAll('SELECT * FROM inventory WHERE owner_id = ? AND dressed_slot = 0 AND on_sale = 0', $user->getId());
|
||||
$iteminfo = [];
|
||||
while ($row = $data->fetch_assoc()) {
|
||||
foreach ($data as $row) {
|
||||
$iteminfo[] = new InventoryItem($row);
|
||||
}
|
||||
|
||||
@ -89,84 +133,6 @@ function del_efs($id, $type)
|
||||
}
|
||||
}
|
||||
|
||||
// одеть предмет
|
||||
function dressitem($id)
|
||||
{
|
||||
//bug #7
|
||||
define('HELMET', 1);
|
||||
define('ARMOR', 2);
|
||||
define('LEGS', 3);
|
||||
define('BOOTS', 4);
|
||||
define('GLOVES', 5);
|
||||
define('WEAPON', 6);
|
||||
define('SHIELD', 7);
|
||||
define('BELT', 8);
|
||||
define('RING', 9);
|
||||
define('AMULET', 10);
|
||||
define('DRESSITEM_ERROR', [
|
||||
'TOO_MANY_ITEMS_IN_SLOTS' => 'Критическая ошибка: Переполнение слота!',
|
||||
'UNKNOWN_ITEM_TYPE' => 'Неизвестный тип предмета!',
|
||||
'ITEM_NOT_FOUND' => 'Предмет не найден!',
|
||||
]);
|
||||
$itemInSlot = [];
|
||||
$selectedItemRow = db::c()->query('SELECT item_type FROM `inventory` WHERE item_id = ?i AND owner_id = ?i AND `dressed_slot` = 0', $id, $_SESSION['uid']);
|
||||
if ($selectedItemRow->getNumRows()) {
|
||||
$selectedItem = $selectedItemRow->fetch_object();
|
||||
$itemInSlotRow = db::c()->query('SELECT dressed_slot FROM inventory WHERE owner_id = ?i AND dressed_slot > 0 AND item_type = ?i', $_SESSION['uid'], $selectedItem->item_type);
|
||||
$itemInSlotQuantity = $itemInSlotRow->getNumRows();
|
||||
if ($itemInSlotQuantity) {
|
||||
while ($row = $itemInSlotRow->fetch_object()) {
|
||||
$itemInSlot[] = $row->dressed_slot;
|
||||
}
|
||||
}
|
||||
if (in_array($selectedItem->item_type, [HELMET, ARMOR, LEGS, BOOTS, GLOVES, WEAPON, SHIELD, BELT, AMULET])) {
|
||||
//работаем с нормальными слотами
|
||||
if (!$itemInSlotQuantity) {
|
||||
// просто одеваем предмет
|
||||
db::c()->query('UPDATE inventory SET dressed_slot = item_type WHERE item_id = ?i', $id);
|
||||
} elseif ($itemInSlotQuantity == 1) {
|
||||
// снимаем предмет и одеваем вместо
|
||||
db::c()->query('UPDATE inventory SET dressed_slot = 0 WHERE dressed_slot = ?i', $itemInSlot[0]);
|
||||
db::c()->query('UPDATE inventory SET dressed_slot = item_type WHERE item_id = ?i', $id);
|
||||
} else {
|
||||
// невозможная ситуация - два предмета в одиночном слоте. критическая ошибка, запись в лог, раздевание.
|
||||
$error = DRESSITEM_ERROR['TOO_MANY_ITEMS_IN_SLOTS'];
|
||||
db::c()->query('UPDATE inventory SET dressed_slot = 0 WHERE dressed_slot BETWEEN 1 AND 12 AND owner_id = ?i', $_SESSION['uid']);
|
||||
}
|
||||
} elseif ($selectedItem->item_type == RING) {
|
||||
// работаем с кольцами
|
||||
if ($itemInSlotQuantity < 3) {
|
||||
// Сравниваем массив колец и массив слотов для колец.
|
||||
$emptyRingSlots = array_diff([9, 10, 11], $itemInSlot);
|
||||
// Сортируем массив свободных слотов по возрастанию.
|
||||
sort($emptyRingSlots);
|
||||
// Одеваем предмет в первый свободный слот.
|
||||
db::c()->query('UPDATE inventory SET dressed_slot = ?i WHERE item_id = ?i', $emptyRingSlots[0], $id);
|
||||
} elseif ($itemInSlotQuantity == 3) {
|
||||
db::c()->query('UPDATE inventory SET dressed_slot = 0 WHERE dressed_slot = 11');
|
||||
db::c()->query('UPDATE inventory SET dressed_slot = 11 WHERE item_id = ?i', $id);
|
||||
// снимаем предмет из слота 11 и одеваем вместо
|
||||
} else {
|
||||
// невозможная ситуация - больше трёх предметов на три слота. критическая ошибка, запись в лог, раздевание.
|
||||
$error = DRESSITEM_ERROR['TOO_MANY_ITEMS_IN_SLOTS'];
|
||||
db::c()->query('UPDATE inventory SET dressed_slot = 0 WHERE dressed_slot BETWEEN 1 AND 12 AND owner_id = ?i', $_SESSION['uid']);
|
||||
}
|
||||
} else {
|
||||
//предмет вообще не должен одеваться, ошибка
|
||||
$error = DRESSITEM_ERROR['UNKNOWN_ITEM_TYPE'];
|
||||
}
|
||||
} else {
|
||||
//с предметом что-то сильно не ок, ошибка.
|
||||
$error = DRESSITEM_ERROR['ITEM_NOT_FOUND'];
|
||||
}
|
||||
|
||||
if (isset($error)) {
|
||||
return $error;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// Входим и выходим если можем.
|
||||
if ($goto) {
|
||||
$imove = true;
|
||||
@ -174,7 +140,7 @@ if ($goto) {
|
||||
$eff = db::c()->query('SELECT 1 FROM `users_effects` WHERE `owner_id` = ?i AND (`type` = 14 OR `type` = 13)', $user->getId());
|
||||
//(масса: <?= $getItemsBonuses->getItemsWeight() . '/' . $user->strength * 4
|
||||
|
||||
if ($d['sum_weight'] > $user->getStrength() * 4 && $goto) {
|
||||
if ($d['sum_weight'] > $userStats->getStrength() * 4 && $goto) {
|
||||
err('У вас переполнен рюкзак, вы не можете передвигаться...');
|
||||
$imove = false;
|
||||
}
|
||||
@ -200,60 +166,11 @@ if (isset($_GET['use'])) {
|
||||
usemagic($_GET['use'], $_POST['target']);
|
||||
}
|
||||
|
||||
function setShadow($image)
|
||||
{
|
||||
global $user;
|
||||
$shadows = [
|
||||
'm01', 'm02', 'm03', 'm04', 'm05', 'm06', 'm07', 'm08', 'm09', 'm10',
|
||||
'f01', 'f02', 'f03', 'f04', 'f05', 'f06', 'f07', 'f08', 'f09', 'f10',
|
||||
'person',
|
||||
];
|
||||
if (in_array($image, $shadows)) {
|
||||
$i = $image . '.png';
|
||||
db::c()->query('UPDATE `users` SET `shadow` = "?s" WHERE `id` = ?i', $i, $user->getId());
|
||||
} else {
|
||||
err('Ошибка!');
|
||||
}
|
||||
if ($obraz) {
|
||||
$user->setShadow($obraz);
|
||||
$user->saveShadow();
|
||||
}
|
||||
|
||||
if ($obraz && ($user->getShadow() == 'g0.gif' || $user->getShadow() == 'man0.gif')) {
|
||||
setShadow($obraz);
|
||||
}
|
||||
|
||||
if ($del == 1 && $effectId > 0) {
|
||||
$pl = db::c()->query('SELECT type FROM users_effects WHERE owner_id = ?i AND effect_id = ?i', $user->getId(), $effectId)->fetch_assoc();
|
||||
if (isset($pl['type'])) {
|
||||
echo del_efs($effectId, $pl['type']);
|
||||
} else {
|
||||
echo "<span class='error'>Эффект не найден!</span>";
|
||||
}
|
||||
}
|
||||
|
||||
if ($brons && $ids) {
|
||||
try {
|
||||
$cur = db::c()->query('SELECT free_bron, bron1, bron2, bron3, bron4 FROM inventory WHERE owner = ?i AND id = ?i', $user->getId(), $ids)->fetch_assoc();
|
||||
} catch (\Krugozor\Database\Mysql\Exception $e) {
|
||||
echo "<div style='background-color: #ffaaaa;'>Ошибка: " . $e->getMessage() . "<br> В файле: " . $e->getFile() . " (" . $e->getLine() . ")</div>";
|
||||
}
|
||||
if ($cur['free_bron'] > 0 && $cur[$brons] > 0) {
|
||||
db::c()->query('UPDATE inventory SET free_bron = free_bron - 1, ?f = ?f +1 WHERE owner_id = ?i AND item_id = ?i', $brons, $brons, $user->getId(), $ids);
|
||||
echo "<span class='success'>Параметр брони увеличен!</span>";
|
||||
}
|
||||
}
|
||||
if ($stats && $ids) {
|
||||
$cur = db::c()->query('SELECT free_stat, gsila, glovk, ginta, gintel FROM inventory WHERE owner_id = ?i AND item_id = ?i', $user->getId(), $ids);
|
||||
if ($cur['free_stat'] > 0 && $cur[$stats] > 0) {
|
||||
db::c()->query('UPDATE inventory SET free_stat = free_stat - 1, ?f = ?f +1 WHERE owner_id = ?i AND item_id = ?i', $stats, $stats, $user->getId(), $ids);
|
||||
echo "<span class='success'>Параметр увеличен!</span>";
|
||||
}
|
||||
}
|
||||
if ($mfs && $ids) {
|
||||
$cur = db::c()->query('SELECT free_mf, mfkrit, mfuvorot, mfakrit, mfauvorot FROM inventory WHERE owner_id = ?i AND item_id = ?i', $user->getId(), $ids);
|
||||
if (isset($cur['id']) && $cur['free_mf'] > 0 && $cur[$mfs] > 0) {
|
||||
db::c()->query('UPDATE inventory SET free_mf = free_mf - 1, ?f = ?f +1 WHERE owner_id = ?i AND item_id = ?i', $mfs, $mfs, $user->getId(), $ids);
|
||||
echo "<span class='success'>Параметр увеличен!</span>";
|
||||
}
|
||||
}
|
||||
if ($setShadow) {
|
||||
Template::header('Образ персонажа');
|
||||
?>
|
||||
@ -288,53 +205,6 @@ if ($setShadow) {
|
||||
<?php
|
||||
exit();
|
||||
}
|
||||
|
||||
if ($edit) {
|
||||
$ups = $_GET['ups'] ?? null;
|
||||
$upm = $_GET['upm'] ?? null;
|
||||
$use = $_GET['use'] ?? null;
|
||||
$useTarget = $_POST['target'] ?? null;
|
||||
$drop = $_GET['drop'] ?? null;
|
||||
$dress = $_GET['dress'] ?? null;
|
||||
$undress = $_GET['undress'] ?? null;
|
||||
$destruct = $_GET['destruct'] ?? null;
|
||||
|
||||
if ($ups) {
|
||||
$user->addOnePointToStat($ups);
|
||||
}
|
||||
if ($upm) {
|
||||
addOnePoint($upm, 'mastery');
|
||||
}
|
||||
if ($drop) {
|
||||
$items = new DressedItems($_SESSION['uid']);
|
||||
$items->undressItem($drop);
|
||||
}
|
||||
//Пока что одеваем предмет отсюда.
|
||||
if ($dress) {
|
||||
echo dressitem($dress);
|
||||
}
|
||||
if ($destruct) {
|
||||
$q = db::c()->query('SELECT `id`, `dressed`, `name`, `duration`, `maxdur` FROM `inventory` WHERE `owner` = ?i AND `id` = ?i', $_SESSION['uid'], $destruct);
|
||||
if ($q->getNumRows()) {
|
||||
$q = $q->fetch_assoc();
|
||||
if (empty($q['dressed'])) {
|
||||
destructitem($q['id']);
|
||||
GameLogs::addUserLog($user->getId(), $user->getLogin() . " выбросил предмет " . $q['name'] . " id:(cap" . $q['id'] . ")");
|
||||
err('Предмет ' . $q['name'] . ' выброшен.');
|
||||
} else {
|
||||
err('Ошибка: нельзя выбросить одетый предмет!');
|
||||
}
|
||||
} else {
|
||||
err('Ошибка: предмет не найден!');
|
||||
}
|
||||
}
|
||||
if ($use) {
|
||||
usemagic($use, $useTarget);
|
||||
}
|
||||
if ($undress) {
|
||||
undressall($_SESSION['uid']);
|
||||
}
|
||||
}
|
||||
Template::header('Игра');
|
||||
?>
|
||||
<script src="js/funcs.js"></script>
|
||||
@ -351,9 +221,40 @@ Template::header('Игра');
|
||||
if (errk === 1) {
|
||||
errkom = 'Нельзя использовать символы: /\:*?"<>|+%<br>';
|
||||
}
|
||||
document.getElementById("hint3").innerHTML = '<table width=100% cellspacing=1 cellpadding=0 bgcolor=CCC3AA><tr><td align=center><B>' + title + '</td><td width=20 align=right valign=top style="cursor: pointer" onclick="closehint3();"><BIG><B>x</td></tr><tr><td colspan=2>' +
|
||||
'<form action="' + script + '" method=POST><table width=100% cellspacing=0 cellpadding=2 bgcolor=FFF6DD><tr><INPUT TYPE=hidden name=sd4 value="6"><td colspan=2><span class="error">' +
|
||||
errkom + '</span>введите название предмета</TD></TR><TR><TD width=50% align=right><INPUT TYPE=text NAME="' + name + '" value="' + com + '"></TD><TD width=50%><INPUT TYPE="submit" value=" »» "></TD></TR></TABLE></FORM></td></tr></table>';
|
||||
document.getElementById("hint3").innerHTML = `
|
||||
<table width=100% cellspacing=1 cellpadding=0 bgcolor=CCC3AA>
|
||||
<tr>
|
||||
<td align=center>
|
||||
<b>${title}</b>
|
||||
</td>
|
||||
<td width=20 align=right valign=top style='cursor: pointer' onclick='closehint3();'>
|
||||
<BIG><B>x
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan=2>
|
||||
<form action="${script}" method=POST>
|
||||
<table width=100% cellspacing=0 cellpadding=2 bgcolor=FFF6DD>
|
||||
<tr>
|
||||
<INPUT TYPE=hidden name=sd4 value='6'>
|
||||
<td colspan=2>
|
||||
<span class='error'>${errkom}</span> введите название предмета
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD width=50% align=right>
|
||||
<INPUT TYPE=text NAME="${name}" value="${com}">
|
||||
</TD>
|
||||
<TD width=50%>
|
||||
<INPUT TYPE='submit' value=' »» '>
|
||||
</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</FORM>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
`;
|
||||
document.getElementById("hint3").style.visibility = "visible";
|
||||
document.getElementById("hint3").style.left = '100';
|
||||
document.getElementById("hint3").style.top = '100';
|
||||
@ -362,16 +263,15 @@ Template::header('Игра');
|
||||
}
|
||||
</script>
|
||||
<div id=hint3 class=ahint></div>
|
||||
<div id="hint4" style="position: absolute;"></div>
|
||||
<div id="chpassbank" style="display:none; position:absolute; top:50px; left:250px;"></div>
|
||||
<table width=100%>
|
||||
<table style="width: 100%">
|
||||
<TR>
|
||||
<td style="vertical-align: top; width: 350px">
|
||||
<?php $userInfo->showUserDoll(0, 1); ?> <!-- Первый столбец -->
|
||||
<div align="center">
|
||||
<div style="text-align: center;">
|
||||
<a href='main.php?edit=1&undress=all' class="button">Снять все</a><BR>
|
||||
<div class="effectList" style="padding-top: 15px; max-height: 150px; width: 220px;">
|
||||
<?= show_eff_inf($user->getId()) ?>
|
||||
<?= $userInfo->showUserEffects() ?>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
@ -389,43 +289,43 @@ Template::header('Игра');
|
||||
<!--Параметры-->
|
||||
<div>
|
||||
<div class="container">
|
||||
Сила: <?= ($user->getFreeStatPoints() ? $user->getStat('strength', 1) . '(' . strval($user->getStrength() + $getItemsBonuses->getStrengthBonus()) . ')' : $user->getStrength() + $getItemsBonuses->getStrengthBonus()) ?>
|
||||
Сила: <?= ($userStats->getFreeStatPoints() ? $userStats->getStat('strength', 1) . '(' . strval($userStats->getFullStats()->strength) . ')' : $userStats->getFullStats()->strength) ?>
|
||||
<br>
|
||||
Ловкость: <?= ($user->getFreeStatPoints() ? $user->getStat('dexterity', 1) . '(' . strval($user->getDexterity() + $getItemsBonuses->getDexterityBonus()) . ')' : $user->getDexterity() + $getItemsBonuses->getDexterityBonus()) ?>
|
||||
Ловкость: <?= ($userStats->getFreeStatPoints() ? $userStats->getStat('dexterity', 1) . '(' . strval($userStats->getFullStats()->dexterity) . ')' : $userStats->getFullStats()->dexterity) ?>
|
||||
<br>
|
||||
Интуиция: <?= ($user->getFreeStatPoints() ? $user->getStat('intuition', 1) . '(' . strval($user->getIntuition() + $getItemsBonuses->getIntuitionBonus()) . ')' : $user->getIntuition() + $getItemsBonuses->getIntuitionBonus()) ?>
|
||||
Интуиция: <?= ($userStats->getFreeStatPoints() ? $userStats->getStat('intuition', 1) . '(' . strval($userStats->getFullStats()->intuition) . ')' : $userStats->getFullStats()->intuition) ?>
|
||||
<br>
|
||||
Выносливость: <?= ($user->getFreeStatPoints() ? $user->getStat('endurance', 1) . '(' . strval($user->getEndurance() + $getItemsBonuses->getEnduranceBonus()) . ')' : $user->getEndurance() + $getItemsBonuses->getEnduranceBonus()) ?>
|
||||
Выносливость: <?= ($userStats->getFreeStatPoints() ? $userStats->getStat('endurance', 1) . '(' . strval($userStats->getFullStats()->endurance) . ')' : $userStats->getFullStats()->endurance) ?>
|
||||
<br>
|
||||
Интеллект: <?= ($user->getFreeStatPoints() ? $user->getStat('intelligence', 1) . '(' . strval($user->getIntelligence() + $getItemsBonuses->getIntelliganceBonus()) . ')' : $user->getIntelligence() + $getItemsBonuses->getIntelliganceBonus()) ?>
|
||||
Интеллект: <?= ($userStats->getFreeStatPoints() ? $userStats->getStat('intelligence', 1) . '(' . strval($userStats->getFullStats()->intelligence) . ')' : $userStats->getFullStats()->intelligence) ?>
|
||||
<br>
|
||||
Мудрость: <?= ($user->getFreeStatPoints() ? $user->getStat('wisdom', 1) . '(' . strval($user->getWisdom() + $getItemsBonuses->getWisdomBonus()) . ')' : $user->getWisdom() + $getItemsBonuses->getWisdomBonus()) ?>
|
||||
Мудрость: <?= ($userStats->getFreeStatPoints() ? $userStats->getStat('wisdom', 1) . '(' . strval($userStats->getFullStats()->wisdom) . ')' : $userStats->getFullStats()->wisdom) ?>
|
||||
<br>
|
||||
<?php if ($user->getFreeStatPoints()): ?>
|
||||
<?php if ($userStats->getFreeStatPoints()): ?>
|
||||
<small style="color: darkgreen;">Возможных
|
||||
увеличений: <?= $user->getFreeStatPoints() ?></small><br>
|
||||
увеличений: <?= $userStats->getFreeStatPoints() ?></small><br>
|
||||
<?php endif; ?>
|
||||
<br>
|
||||
Здоровье: <?= $user->getHealth() ?><br>
|
||||
Пыль: <?= $user->getMana() ?><br>
|
||||
Уворот: <?= $getItemsBonuses->getEvasionBonus() ?><br>
|
||||
Точность: <?= $getItemsBonuses->getAccuracyBonus() ?><br>
|
||||
Шанс крита: <?= $getItemsBonuses->getCriticalsBonus() ?><br>
|
||||
Урон: <?= $user->getMinDamage() + $getItemsBonuses->getMinPhysDamage() ?>
|
||||
- <?= $user->getMaxDamage() + $getItemsBonuses->getMaxPhysDamage() ?> <br>
|
||||
Здоровье: <?= $userStats->getHealth() ?><br>
|
||||
Пыль: <?= $userStats->getMana() ?><br>
|
||||
Уворот: <?= $userStats->getFullStats()->evasion ?><br>
|
||||
Точность: <?= $userStats->getFullStats()->accuracy ?><br>
|
||||
Шанс крита: <?= $userStats->getFullStats()->criticals ?><br>
|
||||
Урон: <?= $userStats->getFullStats()->min_physical_damage ?>
|
||||
- <?= $userStats->getFullStats()->max_physical_damage ?> <br>
|
||||
<br>
|
||||
Защита от огня: ?? <br>
|
||||
Защита от воды: ?? <br>
|
||||
Защита от вохдуха: ?? <br>
|
||||
Защита от земли: ?? <br>
|
||||
Защита от яда: ?? <br>
|
||||
Броня головы: <?= $user->getHeadArmor() ?> <br>
|
||||
Броня корпуса: <?= $user->getChestArmor() ?> <br>
|
||||
Броня ног: <?= $user->getLegArmor() ?> <br>
|
||||
Броня головы: <?= $userStats->getHeadArmor() ?> <br>
|
||||
Броня корпуса: <?= $userStats->getChestArmor() ?> <br>
|
||||
Броня ног: <?= $userStats->getLegArmor() ?> <br>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<td style="vertical-align: top;">
|
||||
<div class="button-container"> <!--Меню-кнопки-->
|
||||
<FORM METHOD=POST ACTION="?edit=1" name=f1>
|
||||
<?php if ($user->getShadow() == '0.gif' || $user->getAdmin() == 1): ?>
|
||||
@ -444,20 +344,20 @@ Template::header('Игра');
|
||||
</div>
|
||||
</div>
|
||||
<div> <!--рюкзак-->
|
||||
<table BORDER=0 WIDTH=100% CELLSPACING="1" CELLPADDING="2" BGCOLOR="#A5A5A5">
|
||||
<table style="border: 0; padding: 2px; border-spacing: 1px; width: 100%; background-color: #a5a5a5">
|
||||
<caption>Рюкзак
|
||||
(масса: <?= '?? /' . $user->getStrength() * 4 ?>)
|
||||
(масса: <?= '?? /' . (int)$userStats->getStrength() * 4 ?>)
|
||||
</caption>
|
||||
<?php
|
||||
foreach ($iteminfo as $ii) {
|
||||
echo "<tr><td width='100' align='center' bgcolor='#d3d3d3'>";
|
||||
echo "<tr><td style='width: 100px; text-align: center; background-color: #d3d3d3'>";
|
||||
$ii->printImage();
|
||||
$ii->printControls();
|
||||
echo "<td valign='top' bgcolor='#d3d3d3'>";
|
||||
echo "<td style='vertical-align: top; background-color: #d3d3d3'>";
|
||||
$ii->printInfo();
|
||||
}
|
||||
if ($data->getNumRows() == 0) {
|
||||
echo "<tr><th colspan='3' align=center bgcolor=#C7C7C7>Пусто";
|
||||
if (!$data) {
|
||||
echo "<tr><th colspan='3' style='text-align: center; background-color: #c7c7c7'>Пусто";
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
|
@ -25,7 +25,7 @@ if ($_COOKIE[GAMEDOMAIN] ?? null) {
|
||||
return false;
|
||||
}
|
||||
$db->execute('INSERT INTO users (login,pass,email,borndate,ip,session_id,shadow)
|
||||
VALUES (?,?,?,?,?,?,?)', [$login, $password, $email, $birthday, $_SERVER['REMOTE_ADDR'], session_id(), '0.gif']);
|
||||
VALUES (?,?,?,?,?,?,?)', [$login, $password, $email, $birthday, $_SERVER['REMOTE_ADDR'], session_id(), '0.png']);
|
||||
$userId = $db->lastInsertId();
|
||||
$db->execute('INSERT INTO online (user_id, date, room, real_time) VALUES (?,?,1,?)', [$userId, time(), time()]);
|
||||
$db->execute('INSERT INTO bank (user_id) VALUES ?', $userId);
|
||||
|
@ -192,7 +192,7 @@ if ($rhar[$user->getRoom()][$_GET['path']] > 0 && $_GET['path'] < 5 && $_GET['pa
|
||||
$list = mysql_query("SELECT * FROM `users` WHERE `in_tower` = 1 AND `battle` = 0");
|
||||
while ($u = mysql_fetch_array($list)) {
|
||||
if ($u['hp'] <= 0) {
|
||||
undressall($u['id']);
|
||||
\Battles\DressedItems::undressAllItems($u['id']);
|
||||
$rep = mysql_query("SELECT * FROM `inventory` WHERE `owner` = '" . $u['id'] . "' AND `bs` = 1");
|
||||
while ($r = mysql_fetch_array($rep)) {
|
||||
mysql_query("INSERT `deztow_items` (`iteam_id`, `name`, `img`, `room`) VALUES ('" . $r['prototype'] . "', '" . $r['name'] . "', '" . $r['img'] . "', '" . $u['room'] . "')");
|
||||
@ -226,7 +226,7 @@ while ($u = mysql_fetch_array($list)) {
|
||||
|
||||
if (($kol_pl + $ls) < 2 && ($tur_data['start_time'] + 60) <= time()) {
|
||||
$tur = mysql_fetch_array(mysql_query("SELECT * FROM `deztow_turnir` WHERE `active` = TRUE LIMIT 1"));
|
||||
undressall($user['id']);
|
||||
\Battles\DressedItems::undressAllItems($user['id']);
|
||||
$rep = mysql_query("SELECT * FROM `inventory` WHERE `owner` = '" . $user['id'] . "' AND `bs` = 1");
|
||||
while ($r = mysql_fetch_array($rep)) {
|
||||
mysql_query("INSERT `deztow_items` (`iteam_id`, `name`, `img`, `room`) VALUES ('" . $r['prototype'] . "', '" . $r['name'] . "', '" . $r['img'] . "', '" . $user->getRoom() . "');");
|
||||
|
@ -8,7 +8,7 @@ if ($user->getRoom() != 31) {
|
||||
if (isset($effect['id'])) {
|
||||
exit('Для распределения статов на Вас не дожно быть никаких эффектов');
|
||||
}
|
||||
undressall($user['id']);
|
||||
\Battles\DressedItems::undressAllItems($user['id']);
|
||||
|
||||
if ((int)$_GET['delsn'] > 0) {
|
||||
mysql_query("DELETE FROM `deztow_charstams` WHERE `id` = '" . (int)$_GET['delsn'] . "' AND `name` = '" . $_GET['ddname'] . "' AND `owner` = '" . (int)$user['id'] . "' LIMIT 1");
|
||||
|
@ -1,43 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Battles\Template;
|
||||
use Battles\User;
|
||||
|
||||
session_start();
|
||||
require_once 'functions.php';
|
||||
define('INFO_CHAR_LIMIT', 1500);
|
||||
$name = filter_input(INPUT_POST, 'name', FILTER_SANITIZE_STRING);
|
||||
$oldpsw = filter_input(INPUT_POST, 'oldpsw', FILTER_SANITIZE_SPECIAL_CHARS);
|
||||
$newpsw = filter_input(INPUT_POST, 'newpsw', FILTER_SANITIZE_SPECIAL_CHARS);
|
||||
$color = filter_input(INPUT_POST, 'color', FILTER_VALIDATE_INT);
|
||||
$hobbie = filter_input(INPUT_POST, 'hobbie', FILTER_SANITIZE_STRING);
|
||||
$hobbie = str_replace("\\n", "<br />", $hobbie);
|
||||
$hobbie = str_replace("\\r", "", $hobbie);
|
||||
$hobbie = str_replace("<br />", "<br />", $hobbie);
|
||||
|
||||
if ($name || $color || $hobbie) {
|
||||
switch ($color) {
|
||||
case 1:
|
||||
$color = 'blue';
|
||||
break;
|
||||
case 2:
|
||||
$color = 'green';
|
||||
break;
|
||||
default:
|
||||
$color = 'black';
|
||||
break;
|
||||
}
|
||||
|
||||
if (strlen($hobbie) > INFO_CHAR_LIMIT) {
|
||||
err('Максимальная длинна поля Хобби: ' . INFO_CHAR_LIMIT . ' символов!');
|
||||
if ($name || $hobbie) {
|
||||
if (strlen($hobbie) > User::INFO_CHAR_LIMIT) {
|
||||
err('Максимальная длинна поля Хобби: ' . User::INFO_CHAR_LIMIT . ' символов!');
|
||||
} else {
|
||||
$values = ['realname' => $name, 'color' => $color, 'info' => $hobbie];
|
||||
db::c()->query('UPDATE users SET ?As WHERE id = ?i', $values, $user->getId());
|
||||
if ($name) {
|
||||
$user->setRealname($name);
|
||||
}
|
||||
if ($hobbie) {
|
||||
$user->setInfo($hobbie);
|
||||
}
|
||||
$user->saveAnketa();
|
||||
}
|
||||
}
|
||||
|
||||
if ($oldpsw && $newpsw) {
|
||||
if (password_verify($oldpsw, $user->getPass())) {
|
||||
db::c()->query('UPDATE `users` SET `pass` = "?s" WHERE `id` = ?i', password_hash($newpsw, PASSWORD_DEFAULT), $user->getId());
|
||||
$user->setPass(password_hash($newpsw, PASSWORD_DEFAULT));
|
||||
$user->savePass();
|
||||
} else {
|
||||
err('Неверный текущий пароль!');
|
||||
}
|
||||
@ -47,12 +39,10 @@ Template::header('Анкета');
|
||||
<a href="main.php">← на главную</a>
|
||||
<h1>Анкета персонажа <?= $user->getLogin() ?></h1>
|
||||
<form method="post">
|
||||
<input name="name" placeholder="Реальное имя" value="<?= $user->getRealname() ?>"><br>
|
||||
<select name="color" id="color">
|
||||
<option value="0" selected>Чёрный</option>
|
||||
<option value="1">Синий</option>
|
||||
<option value="2">Зелёный</option>
|
||||
</select><label for="color"></label><br>
|
||||
<label>
|
||||
<input name="name" placeholder="Реальное имя" value="<?= $user->getRealname() ?>">
|
||||
Реальное имя
|
||||
</label><br>
|
||||
<textarea name="hobbie" placeholder="Хобби"><?= $user->getInfo() ?></textarea><br>
|
||||
<input name="submit" type="submit">
|
||||
</form>
|
||||
|
@ -421,11 +421,11 @@ class Zayavka
|
||||
|
||||
if ($z['type'] == 4 || $z['type'] == 5) {
|
||||
foreach ($z['team1'] as $k => $v) {
|
||||
undressall($v);
|
||||
\Battles\DressedItems::undressAllItems($v);
|
||||
}
|
||||
|
||||
foreach ($z['team2'] as $k => $v) {
|
||||
undressall($v);
|
||||
\Battles\DressedItems::undressAllItems($v);
|
||||
}
|
||||
}
|
||||
|
||||
|