Commit 25584861 authored by hisuinohoshi's avatar hisuinohoshi

Merge branch 'waaagh' of https://github.com/hikawiier/phpdts into waaagh

parents 7aadb341 19c94629
......@@ -74,6 +74,7 @@ web.config
*.psd
*.xlsx
*.bak
# composer
vendor
......@@ -81,5 +82,10 @@ vendor
# env file
.env
# daemon
daemon*
# 录像文件
records
......@@ -293,15 +293,12 @@
/** 获取敌方技能页面 */
function getEnemySkillPage($tdata) {
global $cskills;
$uidata = $tdata;
$array = array();
foreach ($tdata['clbpara']['skill'] as $skid) {
$cskill = $cskills[$skid];
$name = $cskill['name'];
$cdesc = parse_skilldesc($skid, $uidata);
$num_input = $cskill['num_input'];
$input = $cskill['input'];
$unlock_flag = check_skill_unlock($skid, $uidata);
$unlock_desc = parse_skilllockdesc($skid, $unlock_flag);
$new_array = array(
'id' => $skid,
'name' => $name,
......@@ -394,6 +391,27 @@
"max" => emix_calc_maxenum(),
);
}
/** 检查获取的物品是否可进行合并 */
function checkMerge() {
global $wep, $wepk, $wepe, $weps, $wepsk;
global $itm0, $itmk0, $itme0, $itms0, $itmsk0, $nosta;
$check = false;
if (preg_match('/^(WC|WD|WF|Y|B|C|TN|GB|M|V)/', $itmk0) && $itms0 !== $nosta) {
if ($wep == $itm0 && $wepk == $itmk0 && $wepe == $itme0 && $wepsk == $itmsk0) {
$check = true;
} else {
for ($i = 1; $i <= 6; $i++) {
global ${'itm'.$i}, ${'itmk'.$i}, ${'itme'.$i}, ${'itms'.$i}, ${'itmsk'.$i};
if ((${'itms'.$i}) && ($itm0 == ${'itm'.$i}) && ($itmk0 == ${'itmk'.$i}) && ($itme0 == ${'itme'.$i}) && ($itmsk0 == ${'itmsk'.$i})) {
$check = true;
}
}
}
} else if (preg_match('/^H|^P/',$itmk0) && $itms0 !== $nosta) {
$check = true;
}
return $check;
}
echo (json_encode(array(
"page" => "game",
/** 玩家状态 */
......@@ -637,6 +655,8 @@
"areaNum" => $areanum,
/** 每次禁区增加数 */
"areaAdd" => $areaadd,
/** 是否解除禁区 */
"isHack" => $hack,
),
/** 攻击方式 */
"attackType" => array(
......@@ -687,6 +707,8 @@
"crafting" => $club != 20,
/** 元素口袋 */
"element" => $club == 20,
/** 控制面板 */
"control" => isset($clbpara['console']),
),
/** 安全箱物品 */
"depotItems" => depot_getlist($name,$type),
......@@ -705,6 +727,21 @@
"time" => $dtime,
"name" => (!empty($kname) && (in_array($state, Array(20, 21, 22, 23, 24, 28, 29)))) ? $kname : null,
) : null,
/** 弹框 */
"dialog" => $clbpara['dialogue'],
/** 不可跳过弹框 */
"noSkipDialog" => $clbpara['noskip_dialogue'],
/** 游戏状态 */
"isGameOver" => $gamestate == 0,
/** 控制面板 */
"controlPanel" => array(
/** 可用信道 */
"channel" => $gamevars['api'],
/** 共计信道 */
"channelAll" => $gamevars['apis'],
/** 按钮 */
"noButton" => $clbpara['nobutton'],
)
),
/** 搜寻状态 */
"searchState" => array(
......@@ -715,7 +752,7 @@
"props" => $itmsk0_words != '--' ? $itmsk0_words : '',
"quality" => $itme0,
"durability" => $itms0,
"canMerge" => preg_match('/^H|^P/',$itmk0) && $itms0 !== $nosta,
"canMerge" => checkMerge(),
) : null,
/** 发现敌人 */
"findEnemy" => $tdata['nameinfo'] ? array(
......
......@@ -788,7 +788,7 @@ $jgamedata = compatible_json_encode($gamedata);
//$json = new Services_JSON();
//$jgamedata = $json->encode($gamedata);
//if(!strstr($_SERVER['HTTP_REFERER'], 'php')) {
if($udata['u_templateid'] == 1 && !strstr($_SERVER['HTTP_REFERER'], 'php') && $_SERVER['HTTP_REFERER'] != ''){
if ($udata['u_templateid'] == 1 && !strstr($_SERVER['HTTP_REFERER'], 'php') && $_SERVER['HTTP_REFERER'] != '') {
include './api.php';
} else {
echo $jgamedata;
......
......@@ -64,13 +64,13 @@
// [EN] !ATTENTION! Preservation or debugging for developing
// [CH] 切勿修改以下变量,仅供程序开发调试用!
$database = 'pdo'; // 'mysql' for MySQL version and 'pgsql' for PostgreSQL version
$database = 'mysqli'; // 'mysql' for MySQL version and 'pgsql' for PostgreSQL version
// MySQL 版本请设?'mysql', PgSQL 版本请设?'pgsql'
$charset = 'utf-8'; // default character set, 'gbk', 'big5', 'utf-8' are available
// 游戏默认字符? 可?'gbk', 'big5', 'utf-8'
$dbcharset = 'utf8'; // default database character set, 'gbk', 'big5', 'utf8', 'latin1' and blank are available
$dbcharset = 'utf8mb4'; // default database character set, 'gbk', 'big5', 'utf8', 'latin1' and blank are available
// MySQL 字符? 可?'gbk', 'big5', 'utf8', 'latin1', 留空为按照游戏字符集设定
$attackevasive = 0; // protect against attacks via common request, 0=off, 1=cookie refresh limitation, 2=deny proxy request, 3=both
......@@ -93,7 +93,7 @@
$errorinfo = 0; //是否开启错误信息提示,1为开启,0为关闭。开启会泄漏游戏安装路径
// 以下为salt,请勿修改。
$salt = '3012becebcc626720409336f6375bcdd';
$salt = 'a29d8868b409591398e6ccca95f968ef';
// ============================================================================
......
......@@ -36,7 +36,20 @@ if($hp<=0 || $state>=10) {
if ($udata['u_templateid'] == 1 && !strstr($_SERVER['HTTP_REFERER'], 'php') && $_SERVER['HTTP_REFERER'] != '') {
echo json_encode(array(
"page" => "end",
"title" => $stateinfo[$state],
"title" => $hp <= 0 ? $stateinfo[$state] : $gwin[$winmode],
"deadInfo" => $hp <= 0 ? array(
"avatar" => $iconImg,
"motto" => $motto,
"info" => $dinfo[$state],
"time" => $dtime,
"killer" => !empty($kname) && $state >= 10 ? $kname : null,
) : null,
"flag" => array(
"number" => $sNo,
"killNum" => $killnum,
"winner" => $winner,
"state" => $state,
)
));
} else {
include template('ending');
......
......@@ -170,7 +170,7 @@ if(isset($opendialog))
}
//if (!strstr($_SERVER['HTTP_REFERER'], 'php') && $_SERVER['HTTP_REFERER'] != '') {
if($udata['u_templateid'] == 1 && !strstr($_SERVER['HTTP_REFERER'], 'php') && $_SERVER['HTTP_REFERER'] != ''){
if ($udata['u_templateid'] == 1 && !strstr($_SERVER['HTTP_REFERER'], 'php') && $_SERVER['HTTP_REFERER'] != '') {
include './api.php';
} else {
include template('game');
......
......@@ -372,9 +372,10 @@ text-align: center;
#chatlist{
MARGIN: 0px;
height:120px;
width:100%;
width:720px;
word-break:break-all;
overflow:auto;
overflow-x:hidden;
overflow-y:auto;
position:relative;
}
#newslist{
......@@ -414,7 +415,7 @@ background-image: url("../../img/footer_line.gif");
.clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
.clearfix {display: inline-table;} /* Hides from IE-mac \*/ * html .clearfix {height: 1%;} .clearfix {display: block;} /* End hide from IE-mac */
#gamecmd input.cmdbutton{
input.cmdbutton{
width:80px;height:25px;margin:2;
}
......@@ -591,7 +592,22 @@ input.range{
border-radius: 50px;
box-shadow:0 0 5px 1px rgba(0, 0, 0, 0.5);
}
/* 商店道具 */
.shoprow{
width:100%;display:flex;height:40px;
}
.shoprow .leftbox{
width:50px;float:left;margin-right:5px;
}
.shoprow .leftbox input{width:50px;}
.shoprow .rightbox{
width:60px;float:right;
}
.shoprow .rightbox input{width:60px;}
.shoprow .rightbox .inputunit{
position:absolute;top:5%;right:25%;color:#aaaaaa;
}
/* EmojiIcon */
.eicon{
filter: grayscale(100%) brightness(133%) blur(0px);
......
......@@ -1496,7 +1496,8 @@ function change_subwep($s=2,&$data=NULL)
$sweplog .="拿出了<span class='yellow'>{$wep}</span>";
}
$log .= $sweplog."。<br>";
if(!$sweplog) $log .= '你左手交叠右手,大喝一声:“我特殊召唤两个拳头!”<br>';
else $log .= $sweplog."。<br>";
return;
}
......
......@@ -20,6 +20,8 @@ namespace revcombat
function rev_combat_prepare(&$pa,&$pd,$active,$wep_kind='',$log_print=1)
{
global $db,$tablepre,$log,$mode,$main,$cmd,$battle_title;
# Temp - Fix Replay XHR Exploit
$pa['action'] = $pd['action'] = '';
# 格式化双方clbpara:最后保存角色数据的时候会自动转写clbpara,所以想改什么直接改就行了
$pa['clbpara'] = get_clbpara($pa['clbpara']); $pd['clbpara'] = get_clbpara($pd['clbpara']);
......
......@@ -536,7 +536,7 @@ function item_extract_trait($which, $item_position)
$itm = implode('', $matches[0]);
$itm = (string)$itm;
$itm = "名称" . $itm . '代码片段';
$itm = "🥚" . $itm . '🥚的代码片段';
$itmk = '🥚';
$itme = '0';
$itms = '1';
......@@ -608,7 +608,7 @@ function item_extract_trait($which, $item_position)
}
$itmk = '';
$itme = '0';
$itms = '1';
$itms = '0';
$itmsk = '';
${$which . $item_position} = $tmp_trait;
$itms += 1;
......@@ -624,7 +624,8 @@ function item_extract_trait($which, $item_position)
//合并代码片段逻辑
function item_add_trait($choice1, $choice2)
{
global $log, $mode, $club, $sp, $rage;
var_dump($choice1, $choice2);
global $log, $mode, $club, $sp, $rage, $pdata;
if ($club != 21) {
$log .= '你的称号不能使用该技能。';
$mode = 'command';
......@@ -633,96 +634,103 @@ function item_add_trait($choice1, $choice2)
//获取choice1和choice2的itm itmk itme itms itmsk
global ${'itm' . $choice1}, ${'itmk' . $choice1}, ${'itme' . $choice1}, ${'itms' . $choice1}, ${'itmsk' . $choice1};
global ${'itm' . $choice2}, ${'itmk' . $choice2}, ${'itme' . $choice2}, ${'itms' . $choice2}, ${'itmsk' . $choice2};
$itm1 = &${'itm' . $choice1};
$itmk1 = &${'itmk' . $choice1};
$itme1 = &${'itme' . $choice1};
$itms1 = &${'itms' . $choice1};
$itmsk1 = &${'itmsk' . $choice1};
$itm2 = &${'itm' . $choice2};
$itmk2 = &${'itmk' . $choice2};
$itme2 = &${'itme' . $choice2};
$itms2 = &${'itms' . $choice2};
$itmsk2 = &${'itmsk' . $choice2};
$itmc1 = &${'itm' . $choice1};
$itmkc1 = &${'itmk' . $choice1};
$itmec1 = &${'itme' . $choice1};
$itmsc1 = &${'itms' . $choice1};
$itmskc1 = &${'itmsk' . $choice1};
$itmc2 = &${'itm' . $choice2};
$itmkc2 = &${'itmk' . $choice2};
$itmec2 = &${'itme' . $choice2};
$itmsc2 = &${'itms' . $choice2};
$itmskc2 = &${'itmsk' . $choice2};
//检查itmk1是否为🥚,itmk2是否为D或W开头或者是否为🥚
if ($itmk1 != '🥚' || (strpos($itmk2, 'D') !== 0 && strpos($itmk2, 'W') !== 0 && ($itmk2 !== '🥚'))) {
if ($itmkc1 != '🥚' || (strpos($itmkc2, 'D') !== 0 && strpos($itmkc2, 'W') !== 0 && ($itmkc2 !== '🥚'))) {
$log .= '该物品无法合并。<br>';
return;
}
//让itm2属性合并itm1
//如果都是🥚,则去掉$itm的所有“代码片段”四个字,然后itm相加
if ($itmk1 == '🥚' && $itmk2 == '🥚') {
$itm1 = str_replace('代码片段', '', $itm1);
//$itm2 = $itm1 . $itm2;
$itm2 = '🥚复合代码片段🥚';
$itmk2 = $itmk1 . $itmk2;
$itme2 = (int)$itme1 + (int)$itme2;
if ($itmkc1 == '🥚' && $itmkc2 == '🥚') {
var_dump($itmkc1, $itmkc2);
var_dump($itmc1, $itmc2);
preg_match_all('/(改|棍棒|\+(\\d+))/u', $itmc1, $matches1);
preg_match_all('/(改|棍棒|\+(\\d+))/u', $itmc2, $matches2);
if (!empty($matches1[0]) || !empty($matches2[0])) {
$itmn_result = '';
foreach ($matches1[0] as $match) {
$itmn_result .= $match;
}
foreach ($matches2[0] as $match) {
$itmn_result .= $match;
}
$itmc2 = '🥚' . $itmn_result . '🥚复合代码片段';
}
else {
$itmc2 = '🥚复合代码片段🥚';
}
$itmkc2 = $itmkc1 . $itmkc2;
$itmec2 = (int)$itmec1 + (int)$itmec2;
//当任意一个itms为∞
if ($itms1 == '∞' || $itms2 == '∞') {
$itms2 = '∞';
if ($itmsc1 == '∞' || $itmsc2 == '∞') {
$itmsc2 = '∞';
}
else {
$itms2 = (int)$itms1 + (int)$itms2 - 1;
$itmsc2 = (int)$itmsc1 + (int)$itmsc2 - 1;
}
$itmsk2 = $itmsk1 . $itmsk2;
$itmskc2 = $itmskc1 . $itmskc2;
$itmkc2 = '🥚';
//清空itm1
$itm1 = '';
$itmk1 = '';
$itme1 = '0';
$itms1 = '0';
$itmk2 = '🥚';
$itms2 -= 1;
destory_single_item($pdata, $choice1);
return;
}
if ($rage < 50 ) {
elseif ($rage < 50 ) {
$log .= '怒气不足,无法合并代码片段。<br>';
return;
}
$rage -= 50;
//如果itm1是名称开头的
if (strpos($itm1, '名称') === 0){
//去掉名称和代码片段后合并
$itm1 = str_replace('名称', '', $itm1);
$itm1 = str_replace('代码片段', '', $itm1);
//var_dump($itm1);
//$itm2 = $itm1 . $itm2;
$itm2 = '🥚' . $itm1 . '🥚的复合代码片段';
$itmk2 = $itmk1 . $itmk2;
$itme2 = (int)$itme1 + (int)$itme2;
//如果itm1含有棍棒或者改或者n
preg_match_all('/(改|棍棒|\+(\\d+))/u', $itmc1, $matches);
if (!empty($matches[0]))
{
$itmn_result = '';
//合并match
foreach ($matches[0] as $match) {
$itmn_result .= $match;
}
$itmc2 = $itmc2 . $itmn_result;
$itmkc2 = $itmkc1 . $itmkc2;
$itmec2 = (int)$itmec1 + (int)$itmec2;
//当任意一个itms为∞
if ($itms1 == '∞' || $itms2 == '∞') {
$itms2 = '∞';
if ($itmsc1 == '∞' || $itmsc2 == '∞') {
$itmsc2 = '∞';
}
else {
$itms2 = (int)$itms1 + (int)$itms2 - 1;
$itmsc2 = (int)$itmsc1 + (int)$itmsc2 - 1;
}
$itmsk2 = $itmsk1 . $itmsk2;
$itmskc2 = $itmskc1 . $itmskc2;
//清空itm1
$itm1 = '';
$itmk1 = '';
$itme1 = '0';
$itms1 = '0';
$itmk2 = str_replace('🥚', '', $itmk2);
destory_single_item($pdata, $choice1);
$itmkc2 = str_replace('🥚', '', $itmkc2);
return;
}
$itmk2 = $itmk1 . $itmk2;
$itme2 = (int)$itme1 + (int)$itme2;
$itmkc2 = $itmkc1 . $itmkc2;
$itmec2 = (int)$itmec1 + (int)$itmec2;
//当任意一个itms为∞
if ($itms1 == '∞' || $itms2 == '∞') {
$itms2 = '∞';
if ($itmsc1 == '∞' || $itmsc2 == '∞') {
$itmsc2 = '∞';
}
else {
$itms2 = (int)$itms1 + (int)$itms2 - 1;
$itmsc2 = (int)$itmsc1 + (int)$itmsc2 - 1;
}
$itmsk2 = $itmsk1 . $itmsk2;
$itmskc2 = $itmskc1 . $itmskc2;
//清空itm1
$itm1 = '';
$itmk1 = '';
$itme1 = '0';
$itms1 = '0';
destory_single_item($pdata, $choice1);
//去除itm2重复的属性
$itmsk2 = implode(array_unique(str_split($itmsk2)));
$itmskc2 = implode(array_unique(str_split($itmskc2)));
//去除itm2属性里的🥚
$itmk2 = str_replace('🥚', '', $itmk2);
$itmkc2 = str_replace('🥚', '', $itmkc2);
}
function shoplist($sn,$getlist=NULL) {
......
......@@ -570,3 +570,121 @@ function skill_unacquired_mouseout(e)
}
}
}
function selectRecordedFile() {
var input = document.createElement("input");
input.type = "file";
input.accept = ".gz";
input.click();
// 处理选择的文件
input.onchange = function (event) {
var file = event.target.files[0];
console.log("选择的文件:", file);
displayRecordedData(file);
};
}
// 显示单个页面的内容
function showPage(pageContent, currentPageIndex) {
var recordedDataDiv = document.getElementById('recordedData');
recordedDataDiv.innerHTML = pageContent[currentPageIndex];
var previousPageButton = document.createElement('button');
previousPageButton.textContent = '上一页';
previousPageButton.onclick = function () {
if (currentPageIndex > 0) {
currentPageIndex--;
showPage(pageContent, currentPageIndex);
} else {
recordedDataDiv.innerHTML = '已经到达第一页';
}
}
var nextPageButton = document.createElement('button');
nextPageButton.textContent = '下一页';
nextPageButton.onclick = function () {
if (currentPageIndex < pageContent.length - 1) {
currentPageIndex++;
showPage(pageContent, currentPageIndex);
} else {
recordedDataDiv.innerHTML = '已经到达最后一页';
}
};
// 阻止链接跳转
var links = recordedDataDiv.getElementsByTagName('a');
for (var i = 0; i < links.length; i++) {
links[i].addEventListener('click', function (event) {
event.preventDefault();
});
}
// 删除具有 id="hidden-model" 的元素
var hiddenModelElement = document.getElementById('hidden-model');
if (hiddenModelElement) {
hiddenModelElement.remove();
}
var progressBar = document.createElement('div');
progressBar.className = 'progress-bar';
progressBar.style.width = ((currentPageIndex + 1) / pageContent.length) * 100 + '%';
var progressBar = document.createElement('input');
progressBar.type = 'range';
progressBar.min = 0;
progressBar.max = pageContent.length - 1;
progressBar.value = currentPageIndex;
progressBar.oninput = function () {
currentPageIndex = parseInt(progressBar.value);
showPage(pageContent, currentPageIndex);
};
recordedDataDiv.insertBefore(progressBar, recordedDataDiv.firstChild);
recordedDataDiv.insertBefore(nextPageButton, recordedDataDiv.firstChild);
recordedDataDiv.insertBefore(previousPageButton, recordedDataDiv.firstChild);
}
function displayRecordedData(file) {
// 检查是否选择了文件
if (file) {
// 创建一个FileReader对象来读取文件内容
var reader = new FileReader();
reader.onload = function () {
// 将文件内容转换为ArrayBuffer
var arrayBuffer = reader.result;
// 创建一个Uint8Array来存储ArrayBuffer的数据
var uint8Array = new Uint8Array(arrayBuffer);
// 解压缩文件数据
var inflatedData = pako.inflate(uint8Array, { to: 'string' });
// 将解压缩后的数据按页进行切分
var pages = inflatedData.split('\n<html>');
// 逐页展示记录的内容
var recordedDataDiv = document.getElementById('recordedData');
recordedDataDiv.innerHTML = ''; // 清空之前的内容
// 创建一个包含每页内容的数组
var pageContent = [];
for (var i = 0; i < pages.length; i++) {
pageContent.push(pages[i]);
}
// 显示第一页的内容
showPage(pageContent, 0);
};
reader.readAsArrayBuffer(file);
} else { // 如果没有选择文件,则显示选择文件的提示消息
var noticeDiv = document.getElementById('notice'); noticeDiv.textContent = '请先选择一个录像文件';
}
}
/*window.onbeforeunload = function () {
if (isRecording) {
window.alert('你正在录制游戏,之后将会自动下载录制数据。');
downloadRecordedData();
}
};*/
\ No newline at end of file
This diff is collapsed.
//录制处理
var recordedData = [];
var isRecording = true;
function startRecording() {
isRecording = true;
console.log('startRecording');
window.alert('开始录像,录制中的游戏数据会保留在浏览器内,请不要刷新或关闭该页面。');
// 监听所有按钮的点击事件
document.addEventListener('click', recordButtonClick);
var linkElement = document.querySelector('a[onclick="startRecording()"]');
if (linkElement) {
linkElement.textContent = ">>停止录像";
linkElement.setAttribute('onclick', 'stopRecording()');
}
}
document.addEventListener('click', recordButtonClick);
function stopRecording() {
isRecording = false;
var linkElement = document.querySelector('a[onclick="stopRecording()"]');
if (linkElement) {
linkElement.textContent = ">>开始录像";
linkElement.setAttribute('onclick', 'startRecording()');
}
// 停止监听
document.removeEventListener('click', recordButtonClick);
//downloadRecordedData();
}
function downloadRecordedData() {
var reader = new FileReader();
reader.onload = function () {
var arrayBuffer = reader.result;
var uint8Array = new Uint8Array(arrayBuffer);
var gzippedData = pako.gzip(uint8Array);
var downloadLink = document.createElement("a");
downloadLink.href = URL.createObjectURL(new Blob([gzippedData]));
downloadLink.download = "recorded_data.html.gz";
downloadLink.click();
};
reader.readAsArrayBuffer(new Blob(recordedData, { type: "text/html" }));
}
function recordButtonClick(event) {
// 如果录制状态为 true,则将当前前端的全部静态网页数据保存到数组中
if (isRecording) {
recordedData.push(document.documentElement.outerHTML.concat("\n"));
sendLastRecordedData(recordedData);
}
}
function sendLastRecordedData(recordedData) {
const nickinfoElement = document.getElementById('nickinfo');
if (!nickinfoElement) {
return;
}
const nickinfo = nickinfoElement.innerText;
const lastRecord = recordedData[recordedData.length - 1];
fetch('record_backend.php', {
method: 'POST',
body: JSON.stringify({ lastRecord, nickinfo }),
headers: {
'Content-Type': 'application/json'
}
})
.then(response => response.json())
.then(data => {
// 处理从后端返回的响应
//console.log(data);
})
.catch(error => {
// 处理错误
console.error(error);
});
}
......@@ -447,6 +447,19 @@ function duel($time = 0,$keyitm = ''){
function gameover($time = 0, $mode = '', $winname = '') {
global $gamestate,$winmode,$alivenum,$winner,$now,$gamenum,$db,$gtablepre,$tablepre,$gamenum,$starttime,$validnum,$hdamage,$hplayer;
global $groomid;
//遍历./records/$gamenum/下的所有txt文件
$filelist = glob("./records/$gamenum/**/*.txt");
//然后gzip压缩
foreach($filelist as $file){
$input = fopen($file, 'rb');
$output = gzopen($file . '.gz', 'wb');
while (!feof($input)) {
gzwrite($output, fread($input, 1024));
}
fclose($input);
//删除原文件
unlink($file);
}
if($gamestate < 10){return;}
if((!$mode)||(($mode==2)&&(!$winname))) {//在没提供游戏结束模式的情况下,自行判断模式
if($validnum <= 0) {//无激活者情况下,全部死亡
......
......@@ -58,6 +58,34 @@ if(!empty($roomact))
else
{
if (isset($_GET['is_new'])) {
$now_rooms = !empty($roomlist) ? count($roomlist) : 0;
$rooms = array();
foreach ($roomlist as $rkey => $rinfo) {
$room = array();
$room['id'] = $rkey;
$room['status'] = $gstate[$rinfo['gamestate']];
$room['owner'] = $rinfo['groomownid'];
$room['nums'] = $rinfo['groomnums'];
$action = array();
if (!empty($cuser) && !empty($cpass)) {
if (!empty($groomid)) {
if ($groomid == $rkey) {
$action[] = '退出';
if (!empty($rinfo['groomownid']) && $rinfo['groomownid'] == $cuser) {
$action[] = '解散';
}
} else {
$action[] = '-';
}
} else {
$action[] = '加入';
}
} else {
$action[] = '-';
}
$room['action'] = $action;
$rooms[] = $room;
}
echo json_encode(array(
// 当前回合数
"num" => $gamenum,
......@@ -90,6 +118,14 @@ else
"deathNum" => $deathnum,
// 当前房间号:
"roomID" => $groomid,
// 最大房间数
"maxRooms" => $max_rooms,
// 是否可创建房间
"canCreateRoom" => $now_rooms < $max_rooms && !$groomid && (!empty($cuser) && !empty($cpass)),
// 房间
"rooms" => $rooms,
// 站长留言
"news" => $adminmsg,
// 用户名
"username" => $cuser,
));
......
This diff is collapsed.
<?php
define('CURSCRIPT', 'record');
require './include/common.inc.php';
include template('record');
?>
<?php
define('CURSCRIPT', 'record_backend');
require './include/common.inc.php';
try {
$jsonData = file_get_contents('php://input');
$requestData = json_decode($jsonData, true);
if ($requestData === null) {
http_response_code(400);
$response = ["message" => "Invalid JSON data"];
echo json_encode($response);
return;
}
global $gamenum;
$lastRecord = $requestData['lastRecord'];
$nickinfo = $requestData['nickinfo'];
$directoryPath = "./records/$gamenum/$nickinfo";
$filePath = "$directoryPath/record.txt";
// 创建目录
if (!is_dir($directoryPath) && !mkdir($directoryPath, 0777, true)) {
throw new Exception('Failed to create directory');
}
// 写入数据到文件
if (!file_put_contents($filePath, $lastRecord . "\n", FILE_APPEND)) {
throw new Exception('Failed to write data to file');
}
// 返回信息
echo json_encode([
"message" => "Success",
]);
} catch (Exception $e) {
http_response_code(500);
$response = ["message" => $e->getMessage()];
echo json_encode($response);
}
......@@ -11,6 +11,10 @@
<script type="text/javascript" src="include/common.js"></script>
<script type="text/javascript" src="include/game20130526.js"></script>
<script type="text/javascript" src="include/json.js"></script>
<script type="text/javascript" src="include/pako.js"></script>
<!--{if (CURSCRIPT == 'game')}-->
<script type="text/javascript" src="include/record.js"></script>
<!--{/if}-->
<!--{if (CURSCRIPT == 'game' && $pls=='1')}-->
<style>
body {background-image: url("../../img/location/1.jpg");background-position: center;}
......@@ -205,6 +209,10 @@
</div>
</a>
</span>
<!--{if (CURSCRIPT == 'game')}-->
<a href="javascript:void(0)" onclick="stopRecording()">>>停止录像</a>
<!--{/if}-->
<a href="record.php">>>回放录像</a>
<a href="admin.php">>>{lang admin}</a>
<a href="https://bbs.brdts.online/" target="_blank">>>{lang report}</a>
<a href="https://bbs.brdts.online/?thread-2.htm" target="_blank">>>{lang donate}</a>
......
......@@ -4,7 +4,7 @@
<table border="0" width="720" cellspacing="0" cellpadding="0" valign="middle">
<tr>
<!--{eval $nickinfo = titles_get_desc($nick,1);}-->
<td width="210" colspan="3" class="b1"><span>{$nickinfo} {$name}</span></td>
<td width="210" colspan="3" class="b1" id="nickinfo"><span>{$nickinfo} {$name}</span></td>
<td width="100" colspan="1" class="b1"><span>{$sexinfo[$gd]}{$sNo}号</span></td>
<td width="95" colspan="2" class="b1"><span>{lang weather}:$wthinfo[$weather]</span></td>
<td width="215" colspan="1" class="b1"><span>{lang gamedate}<!--{if $gamestate == 40 }--><span class="yellow">{lang combo}</span><!--{/if}--><!--{if $gamestate == 50 }--><span class="red">{lang duel}</span><!--{/if}--></span></td>
......
{template header}
<div class="subtitle">回放录像</div>
<div id="notice"></div>
<center>
<button onclick="selectRecordedFile()">选择录像文件</button>
</center>
<div id="recordedData"></div>
{template footer}
想购买什么物品?<br><br>
<input type="hidden" name="mode" value="shop">
<input type="hidden" name="shoptype" value="$shop">
<input type="radio" name="command" id="menu" value="menu" checked><a onclick=sl('menu'); href="javascript:void(0);" onmouseover="status=' ';return true;">离开商店</a><br>
<input type="radio" name="command" id="shop" value="shop"><a onclick=sl('shop'); href="javascript:void(0);" onmouseover="status=' ';return true;">返回列表</a><br><br>
<input type="hidden" id="command" name="command" value="menu">
<input type="hidden" id="buynum" name="buynum" value="1">
<input type="button" class="cmdbutton" value="离开商店" onclick="$('command').value='menu';postCmd('gamecmd','command.php');this.disabled=true;">
&nbsp;
<input type="button" class="cmdbutton" value="返回列表" onclick="$('command').value='shop';postCmd('gamecmd','command.php');this.disabled=true;">
<br><br>
<!--{loop $itemdata $idata}-->
<!--{if $idata['sid']}-->
<a onclick=sl("$idata['sid']"); href="javascript:void(0);" onmouseover="status=' ';return true;"><input type="radio" name="command" id="$idata['sid']" value="$idata['sid']">$idata['item_words']/$idata['itmk_words']/$idata['itme']/$idata['itms']<!--{if $idata['itmsk_words']}-->/$idata['itmsk_words']<!--{/if}--> 【价:$idata['price'],数:$idata['num']】</a><br>
<!--{eval $idsid = $idata['sid'];$buynumflag = $shop==1||$shop==2||$shop==6||$shop==7||$shop==8||$shop==10||$shop==11||$shop==12 ? 1 : 0;}-->
<div class="shoprow">
<div class="leftbox">
<input type="button" class="cmdbutton" value="购买" onclick="$('command').value='$idsid';<!--{if $buynumflag}-->$('buynum').value=$('buynum{$idsid}').value;<!--{/if}-->postCmd('gamecmd','command.php');this.disabled=true;">
</div>
<div <!--{if $buynumflag}-->style="width:185px;"<!--{/if}-->>
$idata['item_words']/$idata['itmk_words']/$idata['itme']/$idata['itms']<!--{if $idata['itmsk_words']}-->/$idata['itmsk_words']<!--{/if}-->/价:$idata['price']/数:$idata['num']
</div>
<div class="rightbox">
<!--{if $buynumflag}-->
<input type="number" id="buynum{$idsid}" style="width:60px" value="1" min="1" max="1000"><span class="inputunit"></span>
<!--{/if}-->
</div>
</div>
<!--{/if}-->
<!--{/loop}-->
\ No newline at end of file
<!--{if $shop==1||$shop==2||$shop==6||$shop==7||$shop==8||$shop==10||$shop==11||$shop==12}-->
请输入购买数量:<input type="number" name="buynum" value="1" min="1" max="1000">
<!--{else}-->
<input type="hidden" name="buynum" value="1">
<!--{/if}-->
<br><br>
<input type="button" class="cmdbutton" id="zz" name="submit" value="[Z]提交" onclick="postCmd('gamecmd','command.php');this.disabled=true;">
\ No newline at end of file
想购买什么物品?<br><br>
<input type="hidden" name="mode" value="special">
<input type="radio" name="command" id="menu" value="menu" checked><a onclick=sl('menu'); href="javascript:void(0);" onmouseover="status=' ';return true;">离开商店</a><br><br>
<input type="radio" name="command" id="shop1" value="shop1"><a onclick=sl('shop1'); href="javascript:void(0);" onmouseover="status=' ';return true;">【补给品】</a><br>
<input type="radio" name="command" id="shop2" value="shop2"><a onclick=sl('shop2'); href="javascript:void(0);" onmouseover="status=' ';return true;">【药剂】</a><br>
<input type="radio" name="command" id="shop3" value="shop3"><a onclick=sl('shop3'); href="javascript:void(0);" onmouseover="status=' ';return true;">【$iteminfo['WP']】</a><br>
<input type="radio" name="command" id="shop4" value="shop4"><a onclick=sl('shop4'); href="javascript:void(0);" onmouseover="status=' ';return true;">【$iteminfo['WK']】</a><br>
<input type="radio" name="command" id="shop5" value="shop5"><a onclick=sl('shop5'); href="javascript:void(0);" onmouseover="status=' ';return true;">【$iteminfo['WG']】</a><br>
<input type="radio" name="command" id="shop6" value="shop6"><a onclick=sl('shop6'); href="javascript:void(0);" onmouseover="status=' ';return true;">【$iteminfo['WC']】</a><br>
<input type="radio" name="command" id="shop7" value="shop7"><a onclick=sl('shop7'); href="javascript:void(0);" onmouseover="status=' ';return true;">【$iteminfo['WD']】</a><br>
<input type="radio" name="command" id="shop8" value="shop8"><a onclick=sl('shop8'); href="javascript:void(0);" onmouseover="status=' ';return true;">【{$iteminfo['WF']}材料】</a><br>
<input type="radio" name="command" id="shop9" value="shop9"><a onclick=sl('shop9'); href="javascript:void(0);" onmouseover="status=' ';return true;">【防具】</a><br>
<input type="radio" name="command" id="shop10" value="shop10"><a onclick=sl('shop10'); href="javascript:void(0);" onmouseover="status=' ';return true;">【书籍】</a><br>
<input type="radio" name="command" id="shop11" value="shop11"><a onclick=sl('shop11'); href="javascript:void(0);" onmouseover="status=' ';return true;">【电子装备】</a><br>
<input type="radio" name="command" id="shop12" value="shop12"><a onclick=sl('shop12'); href="javascript:void(0);" onmouseover="status=' ';return true;">【杂物】</a><br>
<input type="radio" name="command" id="shop17" value="shop17"><a onclick=sl('shop17'); href="javascript:void(0);" onmouseover="status=' ';return true;"><font style="background:url(img/backround2.gif) repeat-x">【限量福袋】</font></a><br>
<input type="radio" name="command" id="shop13" value="shop13"><a onclick=sl('shop13'); href="javascript:void(0);" onmouseover="status=' ';return true;"><font style="background:url(img/backround3.gif) repeat-x">【埃克法轻工特供武器】</font></a><br>
<input type="radio" name="command" id="shop14" value="shop14"><a onclick=sl('shop14'); href="javascript:void(0);" onmouseover="status=' ';return true;"><font style="background:url(img/backround3.gif) repeat-x">【林苍月的提示】</font></a><br>
<input type="radio" name="command" id="shop15" value="shop15"><a onclick=sl('shop15'); href="javascript:void(0);" onmouseover="status=' ';return true;"><font style="background:url(img/backround3.gif) repeat-x">【Key社纪念品专卖】</font></a><br>
<input type="radio" name="command" id="shop16" value="shop16"><a onclick=sl('shop16'); href="javascript:void(0);" onmouseover="status=' ';return true;"><font style="background:url(img/backround3.gif) repeat-x">【NPC解锁钥匙】</font></a><br>
<input type="radio" name="command" id="shop18" value="shop18"><a onclick=sl('shop18'); href="javascript:void(0);" onmouseover="status=' ';return true;"><font style="background:url(img/backround9.gif) repeat-x">【上级者向物品】</font></a><br>
<br><br>
<input type="button" class="cmdbutton" id="zz" name="submit" value="[Z]提交" onclick="postCmd('gamecmd','command.php');this.disabled=true;">
\ No newline at end of file
<input type="hidden" id="command" name="command" value="menu">
<input type="button" class="cmdbutton" value="离开" onclick="$('command').value='menu';postCmd('gamecmd','command.php');this.disabled=true;">
<br>
<!--{loop Array(1=>'补给品',2=>'药剂',3=>$iteminfo['WP'],4=>$iteminfo['WK'],5=>$iteminfo['WG'],6=>$iteminfo['WC'],7=>$iteminfo['WD'],8=>$iteminfo['WF'].'材料',9=>'防具',10=>'书籍',11=>'电子装备',12=>'杂物',17=>'限量福袋',13=>'埃克法轻工特供武器',14=>'林苍月的提示',15=>'Key社纪念品专卖',16=>'NPC解锁钥匙',18=>'上级者向物品') $sid $scmt}-->
<!--{if $sid % 2}--><br><!--{/if}-->
<input type="button" class="cmdbutton" name="$sid" value="{$scmt}" style="
<!--{if mb_strlen($scmt)>8}-->width:140px;<!--{else}-->width:100px;<!--{/if}-->
<!--{if $sid == 17}-->background-image:url(img/backround2.gif) repeat-x<!--{elseif $sid == 13 || $sid == 14 || $sid == 15 || $sid == 16}-->background-image:url(img/backround3.gif) repeat-x<!--{elseif $sid == 18}-->background-image:url(img/backround9.gif) repeat-x<!--{/if}-->"
onclick="$('command').value='shop{$sid}';postCmd('gamecmd','command.php');this.disabled=true;">
<!--{/loop}-->
\ No newline at end of file
......@@ -3,12 +3,13 @@
<tr>
<td>{lang usertitle}</td>
<td>
<select name="nick">
<select id="nick" name="nick" onchange="var nicklabel=$('nick').options[$('nick').selectedIndex].label;if(''!=nicklabel) $('nickcmt').innerHTML=nicklabel; else $('nickcmt').innerHTML='<br><br><br>';">
<!--{loop $nicksrev['nicks'] $val}-->
<option value="{$val}"<!--{if $udata['nick'] == $val}-->selected<!--{/if}-->>$titles_list[$val]</option>
<!--{eval $title_desc_tmp = str_replace("\r","<br>",$title_desc[$val]['title']);}-->
<option value="{$val}"<!--{if $udata['nick'] == $val}-->selected<!--{/if}--> label="{$title_desc_tmp}">$titles_list[$val]</option>
<!--{/loop}-->
</select>
选择一个有趣的头衔,部分头衔存在特殊的入场效果。
<span id="nickcmt">选择一个有趣的头衔,部分头衔存在特殊的入场效果。<br><br><br></span>
</td>
</tr>
<!--{if !empty($t1_list) && !empty($t2_list)}-->
......
......@@ -55,6 +55,7 @@
<input type="button" value="角色信息" <!--{if $info['wmode'] && $info['wmode'] != 1 && $info['wmode'] !=4 && $info['wmode'] != 6}-->onclick="$('command').value='info';$('gnum').value='$gid';document.info.submit();"<!--{else}-->disabled<!--{/if}-->>
<!--{if $info['wmode'] && $info['wmode'] !=4}--><span class="white"><a href="winner.php?command=news&gnum=$info[gid]">📼</a></span><!--{else}--> <!--{/if}-->
<input type="button" value="该局状况" <!--{if $info['wmode'] && $info['wmode'] !=4}-->onclick="$('command').value='news';$('gnum').value='$gid';document.info.submit();"<!--{else}-->disabled<!--{/if}-->>
$download_buttons[$gid]
</span>
</TD>
</TR>
......
......@@ -23,6 +23,7 @@ if($command == 'info') {
$hnewsinfo = readover($hnewsfile);
}
} else {
$download_button = [];
if(!isset($start) || !$start){
$result = $db->query("SELECT gid,name,nick,icon,gd,wep,wmode,teamID,teamMate,teamIcon,getime,motto,hdp,hdmg,hkp,hkill FROM {$gtablepre}winners ORDER BY gid desc LIMIT $winlimit");
} else {
......@@ -51,6 +52,13 @@ if($command == 'info') {
}
}
$winfo[$wdata['gid']] = $wdata;
//遍历./records/$wdata['gid']/下的所有gz文件
$filelist = glob("./records/{$wdata['gid']}/**/*.gz");
foreach ($filelist as $file) {
//下载按钮,html
$dirname = basename(dirname($file));
$download_buttons[$wdata['gid']] .= "<br><a href=\"$file\" download=\"$dirname\">下载 $dirname</a>";
}
}
$listnum = floor($gamenum/$winlimit);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment