Commit fa8a95d5 authored by satsuki8's avatar satsuki8

添加了club20的快速投料功能

parent 6e139f12
......@@ -129,6 +129,52 @@
return $smhint;
}
# 根据元素笔记中的已知公式快速投料
function quick_add_mix_elements($data)
{
global $elements_info,$r_elements_info,$gamecfg,$gamevars,$iteminfo,$itemspkinfo;
include config('elementmix',$gamecfg);
extract($data,EXTR_REFS);
include_once GAME_ROOT.'./include/game/itemplace.func.php';
if(!empty($clbpara['elements']['info']['d']))
{
foreach($emix_fixlist as $key => $list)
{
if(!empty($clbpara['elements']['info']['d']['d'.$key]))
{
$emix_arr = json_encode($list['stuff']);
$quickmix .= '<input type="button" value="投入" onclick="AddMixElements(' . $emix_arr .');"> ';
$quickmix .= "<span class=''>".parse_itemmix_resultshow($list['result'])."</span><br>";
}
}
$quickmix .= '</ul>';
}
if(!empty($clbpara['elements']['info']['hd']))
{
foreach($gamevars['rand_emixfixres'] as $key => $list)
{
if(!empty($clbpara['elements']['info']['hd']['h'.$key]))
{
$flag_complete = 1;
foreach($list['stuff'] as $skey => $slist)
{
if(empty($clbpara['elements']['info']['hd']['h'.$key]['s'.$skey]))
{
$flag_complete = 0;
break;
}
}
if($flag_complete == 0) break;
$emix_arr = json_encode($list['stuff']);
$quickmix .= '<input type="button" value="投入" onclick="AddMixElements(' . $emix_arr .');"> ';
$quickmix .= "<span class=''>".parse_itemmix_resultshow($rand_emix_fixlist[$key]['result'])."</span><br>";
}
}
$quickmix .= '</ul>';
}
return $quickmix;
}
/********拆解元素部分********/
# 把尸体打散成元素
function split_corpse_to_elements(&$edata,$emode)
......
......@@ -481,6 +481,37 @@ function AddElementsToList(ekey,enums)
$('emixinfotop').style.display = 'block';
}
function AddMixElements(emix_arr) {
var list = $('emixlist').value;
var nums = $('emixnums').value;
var desc = $('emixinfo').innerHTML;
var keyarr = [];
var numsarr = [];
var descarr = [];
const esum = [];
for (let i = 0; i < emix_arr.length; i++) {
esum[emix_arr[i][0]] = (esum[emix_arr[i][0]] || 0) + emix_arr[i][1];
}
for (let i = 0; i < emix_arr.length; i++) {
if($('maxe' + emix_arr[i][0] + 'num') === null || ($('maxe' + emix_arr[i][0] + 'num').value - esum[emix_arr[i][0]]) < 0) {
window.alert("合成所需的元素数量不足。");
return;
}
}
for (let i = 0; i < emix_arr.length; i++) {
$('maxe' + emix_arr[i][0] + 'num').value -= emix_arr[i][1];
$('e' + emix_arr[i][0] + 'num').value = $('maxe' + emix_arr[i][0] + 'num').value;
keyarr.push(emix_arr[i][0]);
numsarr.push(emix_arr[i][1]);
descarr.push(emix_arr[i][1] + '' + $('edesc' + emix_arr[i][0]).innerHTML);
}
$('emixlist').value = keyarr.join('+');
$('emixnums').value = numsarr.join('+');
$('emixinfo').innerHTML = descarr.join('');
$('emixinfotop').style.display = 'block';
}
function changeVolume(cv){
var v = $('gamebgm').volume;
v = v+cv;
......
......@@ -59,6 +59,11 @@
</div>
<br>
<!--根据元素笔记中已知的合成公式进行快速投料-->
<!--{eval include_once GAME_ROOT.'./include/game/elementmix.func.php';$quickmix = quick_add_mix_elements($pdata);}-->
<span class="yellow" >【快速合成】</span><br>
{$quickmix}
<br>
<!--自带:通过投入元素数量的奇偶决定道具类别-->
<span class="yellow" >【数术】</span><br>
› 投入份数<span class="lime">最多(±10)</span>的一种或多种元素<br>
......
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