Много рефактора

This commit is contained in:
Ivor Barhansky 2023-12-19 03:58:37 +02:00
parent 253eafca3b
commit 07f905ef64
24 changed files with 2748 additions and 3199 deletions

View File

@ -0,0 +1,39 @@
<?php
use Core\Db;
class Actions
{
public static function addDungeon(
int $dungeonid,
int $userid,
int $x,
int $y,
string $vars = '',
string $vals = '',
): void {
Db::sql(
'insert into dungeon_actions (dn, x, y, time, uid, vars, vals) values (?,?,?,unix_timestamp(),?,?,?)',
[
$dungeonid,
$x,
$y,
$userid,
$vars,
$vals,
]
);
}
public static function countDungeon(int $dungeonid, int $userid, string $vars = ''): int
{
return Db::getValue(
'select count(id) from dungeon_actions where dn = ? and uid = ? and vars = ?',
[
$dungeonid,
$userid,
$vars,
]
);
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,11 @@
<?php
namespace Battle;
class Helper
{
public static function getChanse(int $percent): bool
{
return mt_rand(0, 100) <= $percent;
}
}

View File

@ -7,6 +7,10 @@ use Core\Db;
class Log
{
/**
* @param array $data [text,battle,id_hod,vars,type]
* @return void
*/
public static function add(array $data): void
{
if (

View File

@ -12,7 +12,6 @@ enum ShopId: int
case ANIMALS = 8; // магазин новичка
case TAVERN = 9; // наковальня
case IZLOM = 10;
case BLOOD_ALTAR = 11; //алтарь крови
case TEMPLE = 14;
case MUSHROOMS = 17; // общий рыцарский
case REFERALS = 27;

View File

@ -4,7 +4,7 @@ namespace Helper;
class Comparsion
{
/** Не даёт значению выйти за пределы.
/** Не даёт значению выйти за пределы.
* @param $value
* @param $minimum
* @param $maximum

View File

@ -25,4 +25,10 @@ class ItemModel
{
return $this->item['img'];
}
public static function getNameById(int $id): string
{
$name = Db::getValue('select name from items_main where id = ?', [$id]);
return $name ?: '';
}
}

View File

@ -25,7 +25,7 @@ class AdmFactory
10,
'moderation.addmoderator',
$this->targetUser['id'],
'Назначен на пост модератора.'
'Назначен на пост модератора.'
);
}
@ -36,7 +36,7 @@ class AdmFactory
10,
'moderation.removemoderator',
$this->targetUser['id'],
'Уволен с поста модератора.'
'Уволен с поста модератора.'
);
}
@ -48,7 +48,7 @@ class AdmFactory
10,
'moderation.changegender',
$this->targetUser['id'],
'Изменен пол персонажа.'
'Изменен пол персонажа.'
);
}
@ -63,7 +63,7 @@ class AdmFactory
10,
'moderation.changelogin',
$this->targetUser['id'],
"Изменен логин персонажа. $this->targetLogin => " . strip_tags($login)
"Изменен логин персонажа. $this->targetLogin => " . strip_tags($login)
);
}
@ -84,7 +84,7 @@ class AdmFactory
public function kickfrombattle(): void
{
if (empty($this->targetUser['battle'])) {
$this->status = 'Персонаж не в поединке.';
$this->status = 'Персонаж не в поединке.';
return;
}
Db::sql('update users left join stats on users.id = stats.id
@ -94,6 +94,6 @@ class AdmFactory
battle_yron = default,
battle_exp = default
where id = ?', [$this->targetUser['id']]);
// В оригинале тут ещё писалась запись в лог боя, но нужна ли она?
// В оригинале тут ещё писалась запись в лог боя, но нужна ли она?
}
}

View File

@ -17,13 +17,13 @@ class Announcement
{
echo <<<HTML
<div style="padding:0 10px 5px 10px; margin:5px; border-bottom:1px solid #cac9c7;">
<h4>Ìåãàôîí</h4>
<h4>Мегафон</h4>
<form method="post"></form>
<label for="announcementText">Ñîîáùåíèå</label>
<label for="announcementText">Сообщение</label>
<input name="announcementText" type="text" id="announcementText" size="70" maxlength="1000">
<input type="submit" name="announcementModeration" id="announcementModeration" class="btn" value="Íàïèñàòü"><br>
<input type="submit" name="announcementModeration" id="announcementModeration" class="btn" value="Написать"><br>
<input name="announcementIsSigned" type="checkbox" id="announcementIsSigned" value="1">
<label for="announcementIsSigned">îò ñâîåãî èìåíè</label>
<label for="announcementIsSigned">от своего имени</label>
</form>
</div>
HTML;
@ -41,9 +41,9 @@ HTML;
return;
}
$sender = empty($_POST['announcementIsSigned']) ? '<b>Àäìèíèñòðàöèÿ</b>' : User::getLogin(User::start()->info['id']);
$sender = empty($_POST['announcementIsSigned']) ? '<b>Администрация</b>' : User::getLogin(User::start()->info['id']);
(new Chat())->sendsys("$sender: $strippedMessage");
echo '<span style="color: red; "><b>Ñîîáùåíèå óñïåøíî îòïðàâëåíî</b></span>';
echo '<span style="color: red; "><b>Сообщение успешно отправлено</b></span>';
}
}

View File

@ -10,7 +10,7 @@ use User;
class ModFactory
{
private const ERROR_WRONG_DURATION = 'Íåâåðíî óêàçàí ñðîê íàêàçàíèÿ';
private const ERROR_WRONG_DURATION = 'Неверно указан срок наказания';
public readonly string $status;
private DateTime $time;
private ChatMessage $msg;
@ -21,12 +21,12 @@ class ModFactory
public function __construct(
private readonly string $targetLogin,
private readonly string $reason,
int $moderatorsRoom // Êîìíàòà ãäå ñèäèò ìîäåðàòîð.
int $moderatorsRoom // Комната где сидит модератор.
)
{
$this->targetUser = User::getInfo($this->targetLogin);
if (empty($this->targetUser)) {
$this->status = 'Ïåðñîíàæ íå íàéäåí!';
$this->status = 'Персонаж не найден!';
return;
}
$this->chat = new Chat();
@ -46,7 +46,7 @@ class ModFactory
}
$this->time->modify("+ $minutes minute");
$this->moderation->silence($this->time, $this->reason);
$this->status = "Ïåðñîíàæó $this->targetLogin çàïðåùåíî îáùàòüñÿ â ÷àòå äî {$this->time->format(Moderation::EXPIRATION_DATETIME_FORMAT)}.";
$this->status = "Персонажу $this->targetLogin запрещено общаться в чате до {$this->time->format(Moderation::EXPIRATION_DATETIME_FORMAT)}.";
$this->msg->setText("[img[items/silence.gif]] $this->status");
$this->chat->sendMsg($this->msg);
}
@ -54,11 +54,11 @@ class ModFactory
public function unsilence(): void
{
if ($this->targetUser['molch1'] < $this->time->getTimestamp()) {
$this->status = 'Ïåðñîíàæ íå ìîë÷èò!';
$this->status = 'Персонаж не молчит!';
return;
}
$this->moderation->unsilence();
$this->status = "Ñ ïåðñîíàæà $this->targetLogin ñíÿò çàïðåò íà îáùåíèå â ÷àòå.";
$this->status = "С персонажа $this->targetLogin снят запрет на общение в чате.";
$this->msg->setText("[img[items/pal_button3.gif]] $this->status");
$this->chat->sendMsg($this->msg);
}
@ -71,8 +71,8 @@ class ModFactory
}
$this->time->modify("+ $days day");
$this->moderation->prison($this->time, $this->reason);
Db::sql('delete from dungeon_zv where uid = ?', [$this->targetUser['id']]); // Óäàëÿåì çàÿâêè â ïåùåðû.
$this->status = "Ïåðñîíàæ $this->targetLogin áûë îòïðàâëåí â òþðüìó äî {$this->time->format(Moderation::EXPIRATION_DATETIME_FORMAT)}.";
Db::sql('delete from dungeon_zv where uid = ?', [$this->targetUser['id']]); // Удаляем заявки в пещеры.
$this->status = "Персонаж $this->targetLogin был отправлен в тюрьму до {$this->time->format(Moderation::EXPIRATION_DATETIME_FORMAT)}.";
$this->msg->setText("[img[items/jail.gif]] $this->status");
$this->chat->sendMsg($this->msg);
}
@ -80,7 +80,7 @@ class ModFactory
public function unprison(): void
{
$this->moderation->unprison();
$this->status = "Ïåðñîíàæ $this->targetLogin áûë âûïóùåí èç òþðüìû.";
$this->status = "Персонаж $this->targetLogin был выпущен из тюрьмы.";
$this->msg->setText("[img[items/jail_off.gif]] $this->status");
$this->chat->sendMsg($this->msg);
}
@ -92,12 +92,12 @@ class ModFactory
return;
}
if ($this->targetUser['info_delete'] === 1 || $this->targetUser['info_delete'] >= $this->time->getTimestamp()) {
$this->status = 'Ïåðñîíàæ óæå ïîä ïîäîçðåíèåì.';
$this->status = 'Персонаж уже под подозрением.';
return;
}
$this->time->modify("+ $days day");
$this->moderation->depersonalize($this->time, $this->reason);
$this->status = "Ïåðñîíàæ $this->targetLogin ïîä ïîäîçðåíèåì äî {$this->time->format(Moderation::EXPIRATION_DATETIME_FORMAT)}";
$this->status = "Персонаж $this->targetLogin под подозрением до {$this->time->format(Moderation::EXPIRATION_DATETIME_FORMAT)}";
$this->msg->setText("[img[items/cui.gif]] $this->status");
$this->chat->sendMsg($this->msg);
}
@ -105,11 +105,11 @@ class ModFactory
public function undepersonalize(): void
{
if ($this->targetUser['info_delete'] <= $this->time->getTimestamp()) {
$this->status = 'Ïåðñîíàæ íå ïîä ïîäîçðåíèåì.';
$this->status = 'Персонаж не под подозрением.';
return;
}
$this->moderation->undepersonalize();
$this->status = "Ïåðñîíàæ $this->targetLogin áîëüøå íå ïîä ïîäîçðåíèåì";
$this->status = "Персонаж $this->targetLogin больше не под подозрением";
$this->msg->setText("[img[items/uncui.gif]] $this->status");
$this->chat->sendMsg($this->msg);
}
@ -119,15 +119,15 @@ class ModFactory
$this->moderation->ban($this->reason);
Db::sql('delete from chat where login = ?', [$this->targetLogin]);
Db::sql('insert into ban_email (email, uid, nick_name) values (?,?,?)', [$this->targetUser['mail'], $this->targetUser['id'], $this->targetLogin]);
Db::sql('delete from zayvki where creator = ?', [$this->targetUser['id']]); // Óäàëÿåì çàÿâêè íà áîé.
Db::sql('delete from dungeon_zv where uid = ?', [$this->targetUser['id']]); // Óäàëÿåì çàÿâêè â ïåùåðû.
Db::sql('delete from zayvki where creator = ?', [$this->targetUser['id']]); // Удаляем заявки на бой.
Db::sql('delete from dungeon_zv where uid = ?', [$this->targetUser['id']]); // Удаляем заявки в пещеры.
if (!empty($this->targetUser['battle'])) {
Db::sql(
'update users left join stats on users.id = stats.id set battle = default, regHP = unix_timestamp(), team = 0, battle_yron = 0, battle_exp = 0 where users.id = ?',
[$this->targetUser['id']]
);
}
$this->status = "Ïåðñîíàæ $this->targetLogin çàáëîêèðîâàí";
$this->status = "Персонаж $this->targetLogin заблокирован";
$this->msg->setText("[img[items/pal_button6.gif]] $this->status");
$this->chat->sendMsg($this->msg);
}
@ -135,12 +135,12 @@ class ModFactory
public function unban(): void
{
if (empty($this->targetUser['banned'])) {
$this->status = 'Ïåðñîíàæ íå â áëîêå.';
$this->status = 'Персонаж не в блоке.';
return;
}
$this->moderation->unban();
Db::sql('delete from ban_email where email = ?', [$this->targetUser['mail']]);
$this->status = "Ïåðñîíàæ $this->targetLogin ðàçáëîêèðîâàí";
$this->status = "Персонаж $this->targetLogin разблокирован";
$this->msg->setText("[img[items/pal_button7.gif]] $this->status");
$this->chat->sendMsg($this->msg);
}

View File

@ -7,7 +7,7 @@ use User;
class UserRegistrationList
{
/** Ðåãèñòðàöèè ïåðñîíàæåé: òîëüêî äëÿ àäìèíèñòðàòîðîâ.
/** Регистрации персонажей: только для администраторов.
* @return void
*/
public static function get(): void
@ -35,14 +35,14 @@ class UserRegistrationList
</script>
<div style="padding:0 10px 5px 10px; margin:5px; border-bottom:1px solid #cac9c7;">
<h4>Ðåãèñòðàöèè ïåðñîíàæåé</h4>
<label for="loginLD520">Äàòà ðåãèñòðàöèè</label>
<h4>Регистрации персонажей</h4>
<label for="loginLD520">Дата регистрации</label>
<input name="pometka520" class="btn btn-success" onclick="regprev()" type="submit" value="&laquo;"/>
<input value="<?= $pld520 ?>" name="loginLD520" type="text" id="loginLD520" size="20" maxlength="10"/>
<input name="pometka520" class="btn btn-success" onclick="regnext()" type="submit" value="&raquo;"/>
<input type="submit" name="pometka520" id="pometka520" class="btn" value="Ïîêàçàòü"/>
<input type="submit" name="pometka520" id="pometka520" class="btn" value="Показать"/>
<?php if (isset($_POST['pometka520'])): ?>
<br><b style="color: red;">Ïåðñîíàæè çàðåãèñòðèðîâàííûå <?= $pld520 ?></b>
<br><b style="color: red;">Персонажи зарегистрированные <?= $pld520 ?></b>
<ol>
<?php foreach (Db::getRows($query, [$pld520TS, $pld520TS + 86400]) as $pl):
$logincolor = match (true) {
@ -55,13 +55,13 @@ class UserRegistrationList
<li>
<span style="color: <?= $logincolor ?>"> <?= User::getLogin($pl['id']) ?> </span>
<?php if ($pl['molch1'] > time()): ?>
<i>(ìîë÷èò)</i>
<i>(молчит)</i>
<?php endif; ?>
<?php if ($pl['battle'] > 0): ?>
<a href="/logs.php?log=<?= $pl['battle'] ?>" target="_blank">(â áîþ)</a>
<a href="/logs.php?log=<?= $pl['battle'] ?>" target="_blank">(в бою)</a>
<?php endif; ?>
<?php if ($pl['host_reg'] > 0): ?>
<small>(ðåôåðàë ïåðñîíàæà <?= User::getLogin($pl['host_reg']) ?>)</small>
<small>(реферал персонажа <?= User::getLogin($pl['host_reg']) ?>)</small>
<?php endif; ?>
</li>
<?php endforeach; ?>

View File

@ -1174,7 +1174,7 @@ class User
public function getStats($uid, $i1 = null, $res = 0, $reimg = false, $btl_cache = false, $minimal = false): array
{
$result = new Stats($this);
return $result->getStats($uid, $i1, $res, $reimg, $btl_cache);
return $result->getStats($uid, $i1, $reimg, $btl_cache);
}
public function getUserInfoById($id)

View File

@ -31,7 +31,7 @@ class Clan
}
}
private function join(string $clanname)
private function join(string $clanname): void
{
Db::sql('update users set clan = (select id from clan where clan.name = ?) where id = ?', [$clanname, $this->userid]);
}
@ -46,7 +46,7 @@ class Clan
return $this->status;
}
public function printClan()
public function printClan(): void
{
echo '<img style="vertical-align:text-bottom;" src="' . Config::img() . '/i/align/align' . $this->getAlign() . '.gif" alt="Склонность">' . $this->printLogoImage() . $this->getName();
}
@ -88,4 +88,9 @@ class Clan
{
return !empty($this->id) && $this->status === 0;
}
public static function addExp(int $value, int $clanid): void
{
Db::sql('update clan set exp = exp + ? where id = ?',[max($value,0), $clanid]);
}
}

View File

@ -148,6 +148,11 @@ insert into eff_users
Db::sql('delete from eff_users where id in (?) and uid = ?', [implode(',', $ids), $userId]);
}
public static function removePriems(int $userid): void
{
Db::sql("delete from eff_users where v1 = 'priem' and uid = ?", [$userid]);
}
public static function hasAttackTimeLimit(int $attackerId): bool
{
return Db::getValue('select count(*) from eff_users where id_eff = 478 and `delete` = 0 and uid = ?', [$attackerId]) > 0;
@ -166,14 +171,14 @@ insert into eff_users
/**
* Духовность. Спасение.
* Из свитка нападения.
* @param $id
* @param $uid
* @return void
*/
public static function addSpasenie($id): void
public static function addSpasenie($uid): void
{
Db::sql('delete from eff_users where uid = ? and overType = 101');
self::removeByOverType($uid, 101);
Db::sql("insert into eff_users (id_eff, uid, name, data, overType, timeUse, user_use, v1, v2, img2, bj, mark)
values (22,?,'Спасение','add_spasenie=1',101,77,?,'priem',324,'preservation.gif','спасение',1)", [$id, $id]);
values (22,?,'Спасение','add_spasenie=1',101,77,?,'priem',324,'preservation.gif','спасение',1)", [$uid, $uid]);
}

View File

@ -12,21 +12,11 @@ class Reputation
public function __construct(int $userid)
{
$this->uid = $userid;
$this->r = Db::getRow(
'select *,
(repcapitalcity+repdemonscity+repangelscity+repsuncity+repdreamscity+repabandonedplain+repsandcity+repemeraldscity+repdevilscity) as allrep,
(nu_capitalcity+nu_demonscity+nu_angelscity+nu_suncity+nu_dreamscity+nu_abandonedplain+nu_sandcity+nu_emeraldscity+nu_devilscity) as allnurep
from rep where id = ?', [$this->uid]
);
$this->r = $this->getr();
if (empty($this->r)) {
Db::sql('insert into rep (id) value (?)', [$this->uid]);
$this->r = Db::getRow(
'select *,
(repcapitalcity+repdemonscity+repangelscity+repsuncity+repdreamscity+repabandonedplain+repsandcity+repemeraldscity+repdevilscity) as allrep,
(nu_capitalcity+nu_demonscity+nu_angelscity+nu_suncity+nu_dreamscity+nu_abandonedplain+nu_sandcity+nu_emeraldscity+nu_devilscity) as allnurep
from rep where id = ?', [$this->uid]
);
$this->r = $this->getr();
}
}
@ -35,7 +25,7 @@ class Reputation
return $this->r;
}
public function addRep(string $dungeonName, int $value): int
public function addRep(string $dungeonName, int $value): mixed
{
if (!isset($this->r[$dungeonName]) || $value <= 0) {
return 0;
@ -44,4 +34,14 @@ class Reputation
Db::sql("update rep set $dungeonName = ? where id = ?", [$value, $this->uid]);
return $this->r[$dungeonName];
}
private function getr()
{
return Db::getRow(
'select *,
(repcapitalcity+repdemonscity+repangelscity+repsuncity+repdreamscity+repabandonedplain+repsandcity+repemeraldscity+repdevilscity) as allrep,
(nu_capitalcity+nu_demonscity+nu_angelscity+nu_suncity+nu_dreamscity+nu_abandonedplain+nu_sandcity+nu_emeraldscity+nu_devilscity) as allnurep
from rep where id = ?', [$this->uid]
);
}
}

View File

@ -123,16 +123,13 @@ class Stats
];
}
public function getStats(int|array|null $uid = null, $i1 = 0, $res = 0, $reimg = false, $btl_cache = false): array
public function getStats(int|array|null $uid = null, $i1 = 0, $reimg = false, $btl_cache = false): array
{
if (empty($uid) || $uid == $this->u->info['id'] && $res != 1) {
//$u = $this->u->info;
$u = User::getInfo($uid);
} elseif (is_array($uid)) {
$u = $uid;
} else {
$u = User::getInfo($uid);
}
$u = match (true) {
empty($uid) => User::getInfo($this->u->info['id']),
is_array($uid) => $uid,
default => User::getInfo($uid),
};
if (!isset($u['id'])) {
return [];
@ -296,11 +293,13 @@ class Stats
//Бонусы комплектов
if (is_iterable($coms['new'])) {
foreach ($coms['new'] as $complect) {
$com = Db::getValue('select data from complects where com = ? and x <= ? order by x desc limit 1',
$com = Db::getValue(
'select data from complects where com = ? and x <= ? order by x desc limit 1',
[
(int)$complect,
(int)$coms['com'][$complect], // кол-во предметов данного комплекта
]);
]
);
if (!$com) {
continue;
@ -513,8 +512,8 @@ class Stats
/** Собираем динамически создаваемые параметры. Если ключа нет - создаём.
* @param string $key
* @param int $value
* @param array $st
* @param int $value
* @param array $st
* @return void
*/
private function addKeyIfNotExist(string $key, int $value, array &$st): void
@ -530,9 +529,11 @@ class Stats
{
//Характеристики от предметов //ТУТ tr_lvl
// Вся вторая строчка - спасибо Users.
$wearedItems = Db::getRows('select type, data, inOdet,
$wearedItems = Db::getRows(
'select type, data, inOdet,
item_id, inslot, useInBattle, btl_zd, iznosNOW, iznosMAX, magic_inci, name, items_users.id, img, `2h`
from items_users left join items_main on items_main.id = item_id where inOdet != 0 and uid = ?', [$uid]);
from items_users left join items_main on items_main.id = item_id where inOdet != 0 and uid = ?', [$uid]
);
$h = 0;
$hnd1 = 0;
@ -1080,7 +1081,7 @@ class Stats
private function addIntelligenceBonuses(array &$st): void
{
//интелект
//интелект
if ($st['s5'] > 24 && $st['s5'] < 50) {
$st['m11'] += 10;
}
@ -1110,7 +1111,7 @@ class Stats
private function addWisdomBonuses(array &$st): void
{
//мудрость
//мудрость
if ($st['s6'] > 24 && $st['s6'] < 50) {
$st['mpall'] += 150;
$st['speedmp'] += 100;
@ -1151,7 +1152,8 @@ class Stats
private function addDungeonsBonuses(int $id, array &$st): void
{
$finishedDungeons = Db::getValue('select
$finishedDungeons = Db::getValue(
'select
if(repcapitalcity > 24999, 1, 0) +
if(repdemonscity > 24999, 1, 0) +
if(repangelscity > 24999, 1, 0) +
@ -1161,7 +1163,8 @@ class Stats
if(repsandcity > 24999, 1, 0) +
if(repemeraldscity > 24999, 1, 0) +
if(repizlom > 24999, 1, 0) +
0 as finished from rep where id = ?', [$id]);
0 as finished from rep where id = ?', [$id]
);
//Бонус за количество полностью вырытых пещер.
$st['m10'] += 10 * $finishedDungeons;
@ -1180,10 +1183,12 @@ class Stats
return;
}
Db::sql("update stats set
Db::sql(
"update stats set
tactic1 = tactic2 = tactic3 = tactic4 = tactic5 = tactic6 = tactic7 = 25,
priems_z = '0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|'
where id = ?", [$u['id']]);
where id = ?", [$u['id']]
);
}
/** Переименовывает элементы массива с несовпадающими с остальным скриптом именами полей.
@ -1199,4 +1204,51 @@ class Stats
unset($st['level'], $st['hpnow'], $st['mpnow']);
}
public static function saveBattleStats(array $stats, int $id): void
{
if (!isset(
$stats['hpnow'],
$stats['mpNow'],
$stats['tactic1'],
$stats['tactic2'],
$stats['tactic3'],
$stats['tactic4'],
$stats['tactic5'],
$stats['tactic6'],
$stats['tactic7'],
$stats['enemy'],
$stats['battle_yron'],
$stats['battle_exp'],
$stats['last_hp'],
$stats['priems_z'],
)
) {
return;
}
Db::sql(
'update stats set hpNow = ?,mpNow = ?,
tactic1 = ?,tactic2 = ?,tactic3 = ?,tactic4 = ?,tactic5 = ?,tactic6 = ?,tactic7 = ?,
enemy = ?,battle_yron = ?,last_hp = ?,battle_exp = ?,priems_z = ?
where id = ?',
[
$stats['hpnow'],
$stats['mpNow'],
$stats['tactic1'],
$stats['tactic2'],
$stats['tactic3'],
$stats['tactic4'],
$stats['tactic5'],
$stats['tactic6'],
$stats['tactic7'],
$stats['enemy'],
$stats['battle_yron'],
$stats['battle_exp'],
$stats['last_hp'],
$stats['priems_z'],
$id,
]
);
}
}

View File

@ -1,44 +0,0 @@
<?php
if(!defined('GAME'))
{
die();
}
if($st['usefromfile']=='bloodring' && $u->info['battle'] > 0 && $u->info['hpNow'] >= 1)
{
if($btl->info['team_win'] != -1 ) {
$u->error = 'Использовать кольцо возможно только во время боя';
}elseif($btl->info['razdel'] != 5) {
$u->error = 'Использование кольца возможно только в хаотичных поединках!';
}elseif(ceil($u->info['tactic6']) < 15) {
$u->error = 'Не хватает '.(15-ceil($u->info['tactic6'])).' <img width=8 height=8 src=//img.new-combats.tech/i/micro/hp.gif> для &quot;Кровавый сбор&quot;';
}else{
$bu = mysql_fetch_array(mysql_query('SELECT `id` FROM `eff_users` WHERE `v1` = "priem" AND `v2` = "228" AND `delete` = "0" LIMIT 1'));
if(isset($bu['id'])) {
$u->error = 'Использование кольца возможно 1 раз за бой!';
}else{
mysql_query('UPDATE `stats` SET `tactic6` = `tactic6` - 15 WHERE `id` = "'.$u->info['id'].'" LIMIT 1');
$u->info['tactic6'] -= 15;
\User\ItemsModel::addItem(3134,$u->info['id'],'|sudba='.$u->info['login']);
$ins = mysql_query('INSERT INTO `eff_users` (`hod`,`v2`,`img2`,`id_eff`,`uid`,`name`,`data`,`overType`,`timeUse`,`v1`) VALUES
("-1",228,"invoke_create_lesserbloodstone.gif",22,"'.$u->info['id'].'","Кровавый Сбор","","30","77","priem")');
$u->error = 'Вы успешно использовали заклинание &quot;Кровавый сбор&quot;';
//Лог боя
$lastHOD = mysql_fetch_array(mysql_query('SELECT * FROM `battle_logs` WHERE `battle` = "'.$u->info['battle'].'" ORDER BY `id_hod` DESC LIMIT 1'));
$id_hod = $lastHOD['id_hod'];
if($lastHOD['type']!=6) {
$id_hod++;
}
$txt = '<font color=#006699>'.$txt.'</font>';
if($u->info['sex']==1) {
$txt = '{u1} применила заклинание &quot;<b>Кровавый сбор</b>&quot;.';
}else{
$txt = '{u1} применил заклинание &quot;<b>Кровавый сбор</b>&quot;.';
}
mysql_query('INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("'.time().'","'.$u->info['battle'].'","'.($id_hod).'","{tm1} '.$txt.'","login1='.$u->info['login'].'||t1='.$u->info['team'].'||time1='.time().'","","","","","6")');
}
}
}
?>

View File

@ -1,63 +0,0 @@
<?php
if (!defined('GAME')) {
die();
}
if ($st['usefromfile'] == 'bloodring2' && $u->info['battle'] > 0 && $u->info['hpNow'] >= 1) {
if ($btl->info['team_win'] != -1) {
$u->error = 'Использовать кольцо возможно только во время боя';
} elseif ($btl->info['razdel'] != 5) {
$u->error = 'Использование кольца возможно только в хаотичных поединках!';
} elseif (ceil($u->info['tactic6']) < 5) {
$u->error = 'Не хватает ' . (5 - ceil($u->info['tactic6'])) . ' <img width=8 height=8 src=//img.new-combats.tech/i/micro/hp.gif> для &quot;Поглотить Кровь&quot;';
} else {
if ($st['td_cast_data'] != date('d.m.Y')) {
$st['td_cast_data'] = date('d.m.Y');
$st['td_cast'] = 0;
}
if ($st['td_cast'] > 5) {
$u->error = 'Использование кольца возможно не более 6 раз в сутки!';
} else {
$bu = mysql_fetch_array(mysql_query('SELECT * FROM `eff_users` WHERE `v1` = "priem" AND `v2` = "229" AND `delete` = "0" LIMIT 1'));
$st['td_cast']++;
$stimp = Helper\Conversion::arrayToDataString($st);
mysql_query('UPDATE `items_users` SET `data` = "' . mysql_real_escape_string($stimp) . '" WHERE `id` = "' . $itm['id'] . '" LIMIT 1');
mysql_query('UPDATE `stats` SET `tactic6` = `tactic6` - 5 WHERE `id` = "' . $u->info['id'] . '" LIMIT 1');
$u->info['tactic6'] -= 5;
//\User\ItemsModel::addItem(3136,$u->info['id'],'|sudba='.$u->info['login']);
//Если эффект есть, тогда добавляем к нему +1 каст (Максимум 6)
if (isset($bu['id'])) {
if ($bu['x'] < 6) {
mysql_query('UPDATE `eff_users` SET `x` = `x` + 1 WHERE `id` = "' . $bu['id'] . '" LIMIT 1');
}
} else {
$ins = mysql_query('INSERT INTO `eff_users` (`file_finish`,`hod`,`v2`,`img2`,`id_eff`,`uid`,`name`,`data`,`overType`,`timeUse`,`v1`) VALUES
("bloodring2_end","-1",229,"invoke_create_bloodstone.gif",22,"' . $u->info['id'] . '","Поглотить Кровь","","30","77","priem")');
}
$u->error = 'Вы успешно использовали заклинание &quot;Поглотить Кровь&quot;<br>В случаи победы Вы получите &quot;Кровавый Рубин&quot;';
//Лог боя
$lastHOD = mysql_fetch_array(mysql_query('SELECT * FROM `battle_logs` WHERE `battle` = "' . $u->info['battle'] . '" ORDER BY `id_hod` DESC LIMIT 1'));
$id_hod = $lastHOD['id_hod'];
if ($lastHOD['type'] != 6) {
$id_hod++;
}
$txt = '<font color=#006699>' . $txt . '</font>';
if ($u->info['sex'] == 1) {
$txt = '{u1} применила заклинание &quot;<b>Поглотить Кровь</b>&quot;.';
} else {
$txt = '{u1} применил заклинание &quot;<b>Поглотить Кровь</b>&quot;.';
}
mysql_query('INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("' . time() . '","' . $u->info['battle'] . '","' . ($id_hod) . '","{tm1} ' . $txt . '","login1=' . $u->info['login'] . '||t1=' . $u->info['team'] . '||time1=' . time() . '","","","","","6")');
}
}
}
?>

View File

@ -1,28 +0,0 @@
<?php
if (!defined('GAME')) {
die();
}
if ($ple['file_finish'] == 'bloodring2_end' && $this->users[$i]['team'] == $this->info['team_win']) {
if ($this->info['razdel'] == 5) {
$i1k = 0;
if ($ple['x'] > 6) {
$ple['x'] = 6;
}
while ($i1k < $ple['x']) {
\User\ItemsModel::addItem(3136, $this->users[$i]['id'], '|sudba=' . $this->users[$i]['login']);
$i1k++;
}
if ($ple['x'] > 1) {
$ple['xz'] = ' (x' . $ple['x'] . ')';
} else {
$ple['xz'] = '';
}
$cmsg = new ChatMessage();
$cmsg->setCity($this->users[$i]['city']);
$cmsg->setTo($this->users[$i]['login']);
$cmsg->setText("Вы получили предмет &quot;<b>Кровавый Рубин</b>{$ple['xz']}&quot;.");
$cmsg->setType(6);
(new Chat())->sendMsg($cmsg);
}
}

View File

@ -97,7 +97,7 @@ if (!isset($btl->info['id'])) {
}
} else {
//получаем массив с игроками в бою
$btl->teamsTake();
$btl->teamsTake($u);
if (isset($_POST['useitem']) && $btl->testUsersLive()) {
$magic->useItems((int)$_POST['useitem']);

View File

@ -82,7 +82,7 @@ if (!isset($btl->info['id'])) {
}
} else {
//получаем массив с игроками в бою
$btl->teamsTake();
$btl->teamsTake($u);
if (isset($_POST['useitem']) && $btl->testUsersLive() == true) {
$magic->useItems((int)$_POST['useitem']);

View File

@ -79,7 +79,7 @@ if (isset($_POST['atack'], $_POST['block']) || (isset($_POST['id']) && $_POST['i
}
} else {
//получаем массив с игроками в бою
$btl->teamsTake();
$btl->teamsTake($u);
if (isset($_POST['useitem']) && $btl->testUsersLive() == true) {
$magic->useItems((int)$_POST['useitem']);

View File

@ -115,7 +115,7 @@ if (isset($CRON_CORE) && (isset($_POST['atack'], $_POST['block']) || (isset($_PO
}
} else {
//получаем массив с игроками в бою
$btl->teamsTake();
$btl->teamsTake($u);
if (isset($_POST['useitem'])) {
$magic->useItems((int)$_POST['useitem']);