Compare commits

...

2 Commits

Author SHA1 Message Date
7692c9f658 Merge 2024-12-17 10:40:25 +02:00
70389921ea Заморозка фиксов. 2024-12-03 23:54:41 +02:00
11 changed files with 2200 additions and 35 deletions

12
.idea/dataSources.xml generated Normal file
View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
<data-source source="LOCAL" name="@sokol" uuid="c5a52191-dffb-4c22-9257-bd5d9e5d5f29">
<driver-ref>mariadb</driver-ref>
<synchronize>true</synchronize>
<jdbc-driver>org.mariadb.jdbc.Driver</jdbc-driver>
<jdbc-url>jdbc:mariadb://85.209.45.159:54001/game_production</jdbc-url>
<working-dir>$ProjectFileDir$</working-dir>
</data-source>
</component>
</project>

View File

@ -1525,6 +1525,11 @@ JS;
$jstext = json_encode($log['text']);
$jsvars = json_encode($log['vars']);
//old
//$js = "add_log({$log['id']},0,$jstext,{$log['id_hod']},0,0,$jsvars)" . $js;
//home
//$js = "add_log({$log['id']},0,$jstext,{$log['id_hod']},$jsvars);" . $js;
//work
$js = "add_log({$log['id']},$jstext,{$log['id_hod']},$jsvars);" . $js;
}
@ -1590,13 +1595,22 @@ JS;
$jstext = json_encode($log['text']);
$jsvars = json_encode($log['vars']);
$js = "add_mlog({$log['id']},0,$jstext,{$log['id_hod']},0,0,$jsvars)" . $js;
//old
//$js = "add_mlog({$log['id']},0,$jstext,{$log['id_hod']},0,0,$jsvars)" . $js;
//home
////$js = "add_mlog({$log['id']},0,$jstext,{$log['id_hod']},$jsvars);" . $js;
//$js = "add_mlog({$log['id']},0,'{$log['text']}',{$log['id_hod']},'{$log['vars']}');" . $js;
//work
$js = "add_mlog({$log['id']},$jstext,{$log['id_hod']},$jsvars)" . $js;
}
Db::sql('update stats set mlog = ? where id = ?', [$u->info['mlog'], $u->info['id']]);
$js .= "id_mlog=$pll;";
return htmlspecialchars($js, ENT_QUOTES);
//return htmlspecialchars($js, ENT_QUOTES);
return $js;
}
//Считаем урон

65
adminion/oltest.js Normal file
View File

@ -0,0 +1,65 @@
const img = '//img.new-combats.com/i';
const gett = async () => {
let response = await fetch('/api/onlinelist.php');
if (response.ok) {
document.getElementById('onlinelist').innerHTML = '';
const list = await response.json();
list.forEach((user) => {
console.log(user);
document.getElementById('onlinelist').insertAdjacentHTML('beforeend', `${ol.makelogin(user)}<br>`);
});
} else {
document.getElementById('onlinelist').insertAdjacentHTML('beforeend', `Все ушли.<br>`);
}
};
window.addEventListener('load', () => {
const fetchInterval = 10000; // 10 секунд.
gett;
//(get)(); // почему get; или get(); - неправильно?? 🤬😭
setInterval(gett, fetchInterval);
});
ol = {
tochat (login) {
const input = document.getElementById('tochat');
if (input.value === `private [${login}]`) {
return;
}
if (input.value === `to [${login}]`) {
input.value = `private [${login}]`;
return;
}
input.value = `to [${login}]`;
},
makelogin ({id, login, level, align, clan, inbattle, isadmin}) {
let style = '';
if (isadmin) {
//align = 2.9;
style = `color: crimson;`;
}
if (!level || level < 0 || level > 21 && !isadmin || typeof level !== 'number') {
level = '??';
}
let inficon = `<a href="/info/${id}" target="_blank"><img src="${img}/inf.gif" alt="Информация про ${login}"></a>`;
let html = `<span style="${style}; cursor: pointer;" onclick="ol.tochat('${login}');">${login}[${level}]</span>` + inficon;
if (clan) {
html = `<img src="${img}/clan/${clan}.gif" alt="Клан"> ` + html;
}
if (align) {
html = `<img src="${img}/align/align${align}.gif" alt="Склонность"> ` + html;
}
let battleyes = '', battlealt = '';
if (inbattle) {
battleyes = 1;
battlealt = ' (персонаж в поединке)'
}
html = `<img src="${img}/lock${battleyes}.gif" alt="Приват${battlealt}" onclick="ol.tochat('${login}')">` + html;
return html;
}
};

22
adminion/onlinelist.php Normal file
View File

@ -0,0 +1,22 @@
<?php
$list = [
['id' => 1, 'login' => 'Paladin', 'align' => 1.9, 'level' => 4],
['id' => 2, 'login' => 'ClanUser', 'clan' => 100, 'level' => 5],
['id' => 3, 'login' => 'AlignClanUser', 'align' => 23, 'clan' => 120, 'level' => 'text'],
['id' => 4, 'login' => 'User', 'level' => -1],
['id' => 5, 'login' => 'UserInBattle', 'battle' => true, 'level' => 100500],
['id' => 6, 'login' => 'Admin', 'battle' => true, 'admin' => true],
];
?>
<!DOCTYPE html>
<html lang="ru">
<link rel="stylesheet" href="../i/main.css">
<title>onlinelist</title>
<script src="oltest.js"></script>
<script>
const onlinelist = JSON.parse('<?= json_encode($list) ?>');
</script>
<div id="onlinelist"></div>
<label><input id="tochat"> типа, поле ввода в чат (для отладки клика по логину)</label>

95
adminion/priems.php Normal file
View File

@ -0,0 +1,95 @@
<?php
use Core\Db;
use Helper\Conversion;
ini_set('xdebug.var_display_max_depth', 10);
ini_set('xdebug.var_display_max_children', 256);
ini_set('xdebug.var_display_max_data', 1024);
require_once '../_incl_data/autoload.php';
class ShowPriems
{
private array $names = [];
private array $parameters = [];
public function __construct() {
foreach (Db::getRows('select sys_name, name from const_stats') as $nrow) {
$this->names[$nrow['sys_name']] = $nrow['name'];
}
// Несовпадения по именам.
$this->names['lvl'] = $this->names['level'];
$this->printAll();
$this->printUnknown();
}
private function printer(array $data, string $title): string
{
$result = '';
foreach ($data as $k=>$v) {
if ($k === array_key_first($data)) {
$result .= "<br><b>$title</b>: ";
}
$result .= $this->namer($k, $v);
}
return $result;
}
private function printAll(): void
{
foreach (Db::getRows('select name, info, date2, date3, id, tr from priems order by name') as $prow) {
$d2 = Conversion::dataStringToArray($prow['date2']);
$d3 = Conversion::dataStringToArray($prow['date3']);
$tr = Conversion::dataStringToArray($prow['tr']);
$d2s = $this->printer($d2, 'date2');
$d3s = $this->printer($d3, 'date3');
$trs = $this->printer($tr, 'Требуется');
$dallk = array_flip(array_keys(array_merge($d2, $d3, $tr)));
$this->parameters = array_merge($dallk, $this->parameters);
echo "<div><b>{$prow['name']}</b> id:{$prow['id']}<br><i>{$prow['info']}</i> $trs $d2s $d3s</div>";
}
}
private function namer($k, $v): string
{
return match (true) {
$this->names[$k] => "<br>$this->names[$k] = $v",
str_starts_with($k, 'add_') && $this->names[str_replace('add_', '', $k)] => "<br>{$this->names[str_replace('add_', '', $k)]} = $v",
str_starts_with($k, 'tr_') && $this->names[str_replace('tr_', '', $k)] => "<br>{$this->names[str_replace('tr_', '', $k)]} = $v",
default => "<br><span style='background-color: lavender; color: crimson;'>$k = $v</span>",
};
}
private function printUnknown(): void
{
$sorted = [];
foreach ($this->parameters as $pa=>$va) {
if ($this->names[str_replace('add_', '', $pa)] || $this->names[str_replace('tr_', '', $pa)]) {
continue;
}
$sorted[] = $pa;
}
echo '<hr>Неизвестные параметры:<br>';
foreach (array_chunk($sorted, 10) as $re) {
echo implode(', ', $re) . '<br>';
}
}
}
echo <<<HTML
<style>
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono&display=swap');
body {font-family: 'JetBrains Mono', monospace; font-size: small; background-color: lavender;}
hr {border: 1px solid darkgreen;}
i {color: dimgrey;}
div {margin: 10px 0; padding: 4px; background-color: ghostwhite;}
div > b:first-child {margin-left: 5px; color: darkslategrey;}
div > b:first-child:before {content: '⭕ '}
</style>
HTML;
$np = new ShowPriems();

53
adminion/test.php Normal file
View File

@ -0,0 +1,53 @@
<?php
use Battle\Fighter;
use Core\Db;
require_once $_SERVER['DOCUMENT_ROOT'] . '/_incl_data/autoload.php';
$a = ['foo' => 'eta', 'bar' => 'bingo', 'baz' => 'quatro', 'mill' => 'buratino erra stupido'];
\Core\Debug::x();
//$f1 = new Fighter(27319412, 4);
$f2 = new Fighter(27205347, 2);
//echo $f1;
echo $f2;
//var_dump($f1);
$u = User::start(27205347);
var_dump($u->stats['items'], $u->stats);
?>
<!--<div id="test"></div>
<div id="app">{{ message }}</div>
-->
<script type="module">
const a = <?= json_encode(['bar' => 'bingo', 'baz' => 'quatro', 'mill' => 'buratino erra stupido']) ?>;
if (a["mill"]) {
const div = document.getElementById('test');
if (a['bar']) {
div.className = a['bar'];
}
div.innerHTML = a["mill"];
document.body.append(div);
}
import { createApp, ref } from 'https://unpkg.com/vue@3/dist/vue.esm-browser.js'
createApp({
setup() {
const message = ref('Hello Vue!')
return {
message
}
}
}).mount('#app')
</script>

1891
js/gameEngine.from2014.js Normal file

File diff suppressed because one or more lines are too long

View File

@ -42,7 +42,6 @@ const chat = {
efftxt: function (id, txt) {
return txt;
},
ignore: function (login) {
if (this.ignoreList[login] !== undefined) {
if ($('#ignr_alu').attr('id') !== undefined) {
@ -64,13 +63,10 @@ const chat = {
ingr_alu.html(`${ingr_alu.html()}<div id="ignr_u_${this.ignoreList.x}"><b>${login}</b> <a target="_blank" href="/info/${login}"><img alt="Инф. о ${login}" src="${c.img2}/i/inf_capitalcity.gif" onMouseOver="top.hi(this,\'<b>Инф. о ${login}</b>\',event,5,-2,2,2,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();"></a> <small><a href="javascript:void(0)" onclick="chat.ignorUn(${this.ignoreList.x})">Clear</a></small></div>`);
}
},
getRandom: function (a, b) {
return a + ((b - a) * Math.random());
},
feerverk_id: 0,
feerverk: function (name) {
const frc = {
'name': 'fw04',
@ -86,7 +82,7 @@ const chat = {
frc.left -= 35;
}
if (frc.name) {
if (frc.name !== undefined) {
const obj = top.frames.main.document.getElementById('frvrks');
if (obj !== undefined) {
let newhtml = '';
@ -106,7 +102,6 @@ const chat = {
if (zad > 0) {
setTimeout(`chat.feerverk_go(${id}, ${time_back}, "${img}", ${x}, 0);`, 500 * zad);
} else {
time_back--;
top.frames.main.document.getElementById(`frvanim_${id}`);
if (time_back > 0) {
@ -262,12 +257,10 @@ const chat = {
clearText: function () {
$('#textmsg').val('');
},
reflesh: function () {
this.time = 0;
this.testTimer(true);
},
reMoney: function () {
$('#moneyGM').html(`${c.money} кр.`);
},
@ -275,13 +268,13 @@ const chat = {
clearTimeout(this.t);
if ($.cookie('btl') !== this.btl) {
if ($.cookie('btl') > 0) {
if (!top.frames['main'].smnpty) {
if (top.frames['main'].smnpty === undefined) {
top.frames['main'].location.href = "main.php";
}
}
this.btl = $.cookie('btl');
}
if (this.rtime !== this.ct[$.cookie('chatCfg0')] && this.ct[$.cookie('chatCfg0')]) {
if (this.rtime !== this.ct[$.cookie('chatCfg0')] && this.ct[$.cookie('chatCfg0')] !== undefined) {
this.rtime = this.ct[$.cookie('chatCfg0')];
if (this.time > this.rtime) this.time = this.rtime;
}

View File

@ -3,16 +3,18 @@
use Core\Config;
use Core\Db;
session_start();
//session_start();
$tm = microtime(true);
if (!isset($CRON_CORE)) {
require_once('../../_incl_data/__config.php');
require_once dirname(__DIR__,2) . DIRECTORY_SEPARATOR . '_incl_data/autoload.php';
//require_once '../../_incl_data/__config.php';
}
if (!isset($CRON_CORE)) {
define('GAME', true);
require_once('../../_incl_data/class/__db_connect.php');
//define('GAME', true);
require_once dirname(__DIR__,2) . DIRECTORY_SEPARATOR . '_incl_data/class/__db_connect.php';
//require_once('../../_incl_data/class/__db_connect.php');
}
function e($t): void
@ -207,12 +209,6 @@ if (!$isBattle) {
$i++;
}
$jslog = $btl->lookmLog() . $btl->lookLog();
if ($jslog != '') {
$js = $jslog . $js;
}
unset($jslog);
$atk1 = isset($btl->ga[$u->info['enemy']][$u->info['id']]) ? 1 : 0;
$nabito = floor($btl->users[$btl->uids[$u->info['id']]]['battle_yron']);
$expmaybe = floor($btl->users[$btl->uids[$u->info['id']]]['battle_exp']);
@ -232,8 +228,10 @@ if (!$isBattle) {
$ggcode = PassGen::new();
$mypriems = $priem->seeMy();
$logs = $btl->lookmLog() . $btl->lookLog();
echo <<<HTML
<script>
$logs
eatk = $atk1;
getElementByIdInMainFrame('nabito').innerHTML = `$nabito`;
getElementByIdInMainFrame('expmaybe').innerHTML = `$expmaybe`;
@ -259,7 +257,6 @@ if (!$isBattle) {
tactic(7,'$tactic7');
smena_alls = '0';
ggcode='$ggcode';
$js
</script>
HTML;

View File

@ -1048,18 +1048,9 @@ $allprice = Battle::getType($allprice, $thisBattle['smert'] == 1);
</tr>
</table>
<div class="st1222" id="volna"></div>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="260">&nbsp;</td>
<td>
<div style="font-size:12px;" id="battle_logg" align="left"></div>
<div align="left">Полную версию лога боя смотрите <a
href="/logs.php?log=<?php
echo $u->info['battle']; ?>" target="blank_">здесь »»</a></div>
<br/></td>
<td width="260">&nbsp;</td>
</tr>
</table>
<div style="font-size:12px; margin: 0 260px; text-align: left;" id="battle_logg"></div>
<div style="margin: 0 260px; text-align: left;">Полную версию лога боя смотрите <a href="/logs.php?log=<?= $u->info['battle'] ?>" target="blank_">здесь »»</a></div>
<br>
</div>
<!-- <script type="text/javascript" src="js/chat-engine.js"></script> -->
@ -1132,5 +1123,5 @@ $allprice = Battle::getType($allprice, $thisBattle['smert'] == 1);
<?php
$priem = new Priems();
$btl = new Battle();
include('jx/battle/refresh1.php'); ?>
include('jx/battle/refresh.php'); ?>
</div>

32
qodana.yaml Normal file
View File

@ -0,0 +1,32 @@
#-------------------------------------------------------------------------------#
# Qodana analysis is configured by qodana.yaml file #
# https://www.jetbrains.com/help/qodana/qodana-yaml.html #
#-------------------------------------------------------------------------------#
version: "1.0"
#Specify inspection profile for code analysis
profile:
name: qodana.starter
#Enable inspections
#include:
# - name: <SomeEnabledInspectionId>
#Disable inspections
#exclude:
# - name: <SomeDisabledInspectionId>
# paths:
# - <path/where/not/run/inspection>
php:
version: 8.2 #(Applied in CI/CD pipeline)
#Execute shell command before Qodana execution (Applied in CI/CD pipeline)
#bootstrap: sh ./prepare-qodana.sh
#Install IDE plugins before Qodana execution (Applied in CI/CD pipeline)
#plugins:
# - id: <plugin.id> #(plugin id can be found at https://plugins.jetbrains.com)
#Specify Qodana linter for analysis (Applied in CI/CD pipeline)
linter: jetbrains/qodana-php:latest