Commit 7663b1b6 authored by hisuinohoshi's avatar hisuinohoshi

Add itemmix_tips

新增:
- 在合成界面会显示可合成配方以及已有部分素材但无法合成的配方,点击配方中指定素材/结果可查看进一步合成;
parent 6b5954ed
......@@ -57,7 +57,6 @@ if(!empty($llist)){
$llist = '('.substr($llist,0,-1).')';
$db->query("UPDATE {$tablepre}log SET prcsd=1 WHERE toid = '$pid' AND lid IN $llist");
}
//var_dump($_POST);
if($hp > 0){
//显示枪声信息
......@@ -120,6 +119,13 @@ if($hp > 0){
$mode = 'command';
}else{
//进入指令判断
if(!empty($itemindex))
{
$opendialog = 'itemmix_tips';
$mode = 'command';
$command = 'itemmain';
$itemcmd = 'itemmix';
}
if(strpos($action,'chase')===false && strpos($action,'dfight')===false && $mode !== 'combat' && $mode !== 'revcombat' && $mode !== 'corpse' && strpos($action,'pacorpse')===false && $mode !== 'senditem'){
$action = '';
}
......@@ -158,6 +164,9 @@ if($hp > 0){
$emax = get_emix_itme_max();
foreach($elements_info as $e_key=>$e_info) ${'etaginfo'.$e_key} ="<span tooltip=\"".print_elements_tags($e_key)."\">";
}
elseif($itemcmd == 'itemmix'){
$main = 'itemmix_tips';
}
$mode = $itemcmd;
}
} elseif($command == 'song') {
......@@ -339,9 +348,10 @@ if($hp > 0){
if ($mixmask&(1<<($i-1)))
$mixlist[] = $i;
}
include_once GAME_ROOT.'./include/game/itemmix.func.php';
if (isset($itemselect))
itemmix($mixlist,$itemselect);
else itemmix($mixlist);
itemmix_rev($mixlist,$itemselect);
else itemmix_rev($mixlist);
}
} elseif($command == 'elementmix') {
if($club == 20){
......
No91.雷闪龙 4,WC,380,,Aar,4,5,
No39.希望皇 霍普 4,WC,240,,A,4,2,
No9.天盖星 戴森球 9,WC,233,,ea,9,2,
星圣 欧米伽星云 4,WC,251,,Mi,4,2,
机甲忍者 刃心 4,WC,160,,cr,4,2,
英豪冠军 草雉剑王,WK,150,200,nc,4,3,
始祖守护者 提拉斯 5 -,WC,200,,,5,2,
NO7.幸运条纹人 7,WC,300,,rc,7,3,
超次元机器人 银河破坏王 10,WC,800,,rdcm,10,3,
\ No newline at end of file
No91.雷闪龙 4,WC,380,,Aar,4,5
No39.希望皇 霍普 4,WC,240,,A,4,2
No9.天盖星 戴森球 9,WC,233,,ea,9,2
星圣 欧米伽星云 4,WC,251,,Mi,4,2
机甲忍者 刃心 4,WC,160,,cr,4,2
英豪冠军 草雉剑王,WK,150,200,nc,4,3
始祖守护者 提拉斯 5 -,WC,200,,,5,2
NO7.幸运条纹人 7,WC,300,,rc,7,3
超次元机器人 银河破坏王 10,WC,800,,rdcm,10,3
\ No newline at end of file
星尘龙 8,WC08,170,100,wMc,8,-1,-1,
救世星龙 -,WC,100,,cZ,9,救世龙 1,星尘龙 8,
救世魔龙 -,WC,100,,cd,9,救世龙 1,红莲魔龙 8,
红莲魔龙 8 -,WC,130,,cu,8,-1,-1,
正义盟军 光明守望者 8 -,WC,101,,Z,8,-1,-1,
阿尔法大日 9,WC09,33,99,ebrj,9,-1,-1,
超念力枪手 9,WC09,180,,NH,9,-1,-1,
黑蔷薇龙 7,WC07,180,70,u,7,-1,-1,
机巧将军 无零 7,WC07,252,,Z,7,-1,-1,
流星龙 10 -,WC,120,,c,10,-1,-1,
\ No newline at end of file
星尘龙 8,WC08,170,100,wMc,8,,
救世星龙 -,WC,100,,cZ,9,救世龙 1+星尘龙 8,
救世魔龙 -,WC,100,,cd,9,救世龙 1+红莲魔龙 8,
红莲魔龙 8 -,WC,130,,cu,8,,
正义盟军 光明守望者 8 -,WC,101,,Z,8,,
阿尔法大日 9,WC09,33,99,ebrj,9,,
超念力枪手 9,WC09,180,,NH,9,,
黑蔷薇龙 7,WC07,180,70,u,7,,
机巧将军 无零 7,WC07,252,,Z,7,,
流星龙 10 -,WC,120,,c,10,,
\ No newline at end of file
This diff is collapsed.
......@@ -3,6 +3,193 @@ if (! defined ( 'IN_GAME' )) {
exit ( 'Access Denied' );
}
//以道具名反查mixinfo数据
//tp & 1 以原料反查,tp & 2 以产物反查
//返回mixinfo里的单个array
function smartmix_find_recipe($itm, $tp=0)
{
include_once GAME_ROOT.'./include/game/itemmix.func.php';
$mix_res = array();
$itm = htmlspecialchars_decode(itemmix_name_proc($itm));
$mixinfo = get_mixinfo();
foreach ($mixinfo as $ma)
{
$ma['type'] = 'normal';
//隐藏合成是无法查到的
if(($tp & 1 && in_array($itm, $ma['stuff']) && $ma['class']!='hidden') || ($tp & 2 && $itm == $ma['result'][0])){
$mix_res[] = $ma;
}
}
return $mix_res;
}
//检查玩家包裹,返回可合成的道具列表
function smartmix_check_available($data)
{
include_once GAME_ROOT.'./include/game/itemmix.func.php';
extract($data);
//itms为零的道具不参与判断
$packn = array();
for($i=1;$i<=6;$i++){
if(!empty(${'itms'.$i})){
$packn[] = $i;
//$packname[] = \itemmix\itemmix_name_proc(${'itm'.$i});
}
}
//生成道具序号的全组合
$fc = full_combination($packn, 2);
//所有的组合全部判断一遍是否可以合成,最简单粗暴和兼容
$mix_available = $mix_overlay_available = $mix_sync_available = array();
foreach($fc as $fcval){
$mix_res = itemmix_get_result($fcval,$data);
if($mix_res){
//$mix_res['type'] = 'normal';
$mix_available[] = $mix_res;
}
}
foreach($fc as $fval){
$mix_overlay_res = itemmix_overlay_check($fval);
if($mix_overlay_res){
foreach($mix_overlay_res as $mkey => $mval){
//$mval['type'] = 'overlay';
if(!isset($mix_overlay_available[$mkey])){
$mix_overlay_available[$mkey] = array($mval);
}else{
$mix_overlay_available[$mkey][] = $mval;
}
}
}
$mix_sync_res = itemmix_sync_check($fval);
if($mix_sync_res){
foreach($mix_sync_res as $mkey => $mval){
//$mval['type'] = 'sync';
if(!isset($mix_sync_available[$mkey])){
$mix_sync_available[$mkey] = array($mval);
}else{
$mix_sync_available[$mkey][] = $mval;
}
}
}
}
return array($mix_available,$mix_overlay_available,$mix_sync_available);
}
function init_itemmix_tips($itemindex='',&$data=NULL)
{
if(!isset($data))
{
global $pdata;
$data = &$pdata;
}
extract($data,EXTR_REFS);
$mix_type = Array('normal' => '通常','sync' => '同调', 'overlay' => '超量');
$mhint = ''; $smhint = '';
if(!empty($itemindex))
{
$mix_res = smartmix_find_recipe($itemindex, 1 + 2);
if($mix_res){
$smhint .= '<span class="blueseed b">'.$itemindex.'</span>涉及的合成公式:<br><ul>';
foreach($mix_res as $mval){
if(!isset($mval['type']) || $mval['type'] == 'normal'){
foreach($mval['stuff'] as $key => $ms){
if($key == 0) $smhint .= '<li>';
if($ms == $itemindex) $smhint .= parse_smartmix_recipelink($ms).' + ';
else $smhint .= parse_smartmix_recipelink($ms,'','grey').' + ';
}
$smhint = substr($smhint,0,-3);
}
$mr = $mval['result'][0];
$smhint .= ' → '.parse_smartmix_recipelink($mr, parse_itemmix_resultshow($mval['result']),'grey').'</li>';
}
$smhint .= "</ul>";
}
else
{
$smhint .= '没有找到<span class="blueseed b">'.$itemindex.'</span>的相关合成公式<span class="grey">(不会显示隐藏公式)</span>';
}
return $smhint;
}
list($mix_available,$mix_overlay_available,$mix_sync_available) = smartmix_check_available($data);
if(empty($mix_available) && empty($mix_overlay_available) && empty($mix_sync_available)){
$mhint .= '';
}else{
$mhint .= '<span class="blueseed b">可合成</span>:<br>';
$shown_list = array();
foreach($mix_available as $mlist){//第一层:不同配方
$mstuff = $mresult = '';
$o_type = '';
foreach ($mlist as $mval){//第二层:不同结果
if(!empty($o_type) && $o_type != $mval['type']) {//换类型时把上一合成类别显示,并且清空显示的配方和结果列表
$mtstr = '';
if(isset($mix_type[$o_type])) $mtstr = $mix_type[$o_type];
$show_str = '<span>'.$mstuff.'</span>可'.$mtstr.'合成:<ul>'.$mresult.'</ul><br>';
if(!in_array($show_str, $shown_list)){
$shown_list[] = $show_str;
$mhint .= $show_str;
}
$mstuff = $mresult = '';
}
$o_type = $mval['type'];
if(!$mstuff) {//配方只显示1次
sort($mval['stuff']);
foreach($mval['stuff'] as $ms){
$mstuff .= parse_smartmix_recipelink($ms).' + ';
}
$mstuff = substr($mstuff,0,-3);
}
$mresult .= '<li>'.parse_smartmix_recipelink($mval['result'][0], parse_itemmix_resultshow($mval['result']), 'yellow').'</li>';
}
$mtstr = '';
if(isset($mix_type[$o_type])) $mtstr = $mix_type[$o_type];
$show_str = '<span class="b">'.$mstuff.'</span>可'.$mtstr.'合成:<ul>'.$mresult.'</ul>';
if(!in_array($show_str, $shown_list)){
$shown_list[] = $show_str;
$mhint .= $show_str;
}
}
}
for($i=0;$i<=6;$i++)
{
$itemindex = ${'itm'.$i};
$mix_res = smartmix_find_recipe($itemindex, 1 + 2);
if($mix_res){
$smhint .= '<span class="blueseed b">'.$itemindex.'</span>涉及的合成公式:<br><ul>';
foreach($mix_res as $mval){
if(!isset($mval['type']) || $mval['type'] == 'normal'){
foreach($mval['stuff'] as $key => $ms){
if($key == 0) $smhint .= '<li>';
if($ms == ${'itm'.$i}) $smhint .= parse_smartmix_recipelink($ms).' + ';
else $smhint .= parse_smartmix_recipelink($ms,'','grey').' + ';
}
$smhint = substr($smhint,0,-3);
}
$mr = $mval['result'][0];
$smhint .= ' → '.parse_smartmix_recipelink($mr, parse_itemmix_resultshow($mval['result']),'grey').'</li>';
}
$smhint .= "</ul>";
}
}
if(!empty($smhint))
{
//$smhint = "<span class=\"b\">素材不足:</span><br>".$smhint;
$mhint .= $smhint;
}
$mhint .= '<br>';
return $mhint;
}
function parse_smartmix_recipelink($itemindex, $stext = '', $sstyle = ''){
return "<a ".($sstyle ? "class=\"{$sstyle}\" " : '')."onclick=\"$('itemindex').value='$itemindex';postCmd('maincmd','command.php');\">".($stext ? $stext : $itemindex).'</a>';
}
function parse_itemmix_resultshow($rarr){
$ret = $rarr[0].'/'.parse_info_desc($rarr[1],'k','',0,'tooltip2').'/'.$rarr[2].'/'.$rarr[3];
$itmskw = !empty($rarr[4]) ? parse_info_desc($rarr[4],'sk',$rarr[1],0,'tooltip2') : '';
if($itmskw) $ret .= '/'.$itmskw;
return $ret;
}
function get_npc_helpinfo($nlist,$tooltip=1)
{
global $plsinfo,$hplsinfo,$gamecfg,$iteminfo,$clubinfo;
......
......@@ -567,11 +567,12 @@ function player_format_with_db_structure($data){
}
return $ndata;
}
function parse_info_desc($info,$type,$vars='',$short=0)
function parse_info_desc($info,$type,$vars='',$short=0,$tiptype=0)
{
global $iteminfo,$itemspkinfo,$cskills;
global $tps_name,$tps_names,$tps_ik,$tps_isk;
$ttypes = $tiptype ? $tiptype : 'tooltip';
# 处理名字
if($type == 'm')
{
......@@ -580,13 +581,13 @@ function parse_info_desc($info,$type,$vars='',$short=0)
{
$ts = $tps_names[$tps_name[$tinfo]];
$tinfo_f = isset($ts['class']) ? "class=\"{$ts['class']}\"" : '';
$tinfo_tp = isset($ts['title']) ? "tooltip=\"{$ts['title']}\"" : '';
$tinfo_tp = isset($ts['title']) ? "{$ttypes}=\"{$ts['title']}\"" : '';
return "<span {$tinfo_tp} {$tinfo_f}>{$info}</span>";
}
elseif(isset($tps_name[$tinfo]))
{
$tinfo_f = isset($tps_name[$tinfo]['class']) ? "class=\"{$tps_name[$tinfo]['class']}\"" : '';
$tinfo_tp = isset($tps_name[$tinfo]['title']) ? "tooltip=\"{$tps_name[$tinfo]['title']}\"" : '';
$tinfo_tp = isset($tps_name[$tinfo]['title']) ? "{$ttypes}=\"{$tps_name[$tinfo]['title']}\"" : '';
return "<span {$tinfo_tp} {$tinfo_f}>{$info}</span>";
}
return $info;
......@@ -605,7 +606,7 @@ function parse_info_desc($info,$type,$vars='',$short=0)
# 类别不存在样式或提示时,用大类尝试一下
if(!isset($tps_ik[$info])) $info = $v_info;
$info_f = isset($tps_ik[$info]['class']) ? "class=\"{$tps_ik[$info]['class']}\"" : '';
$info_tp = isset($tps_ik[$info]['title']) ? "tooltip=\"{$tps_ik[$info]['title']}\"" : '';
$info_tp = isset($tps_ik[$info]['title']) ? "{$ttypes}=\"{$tps_ik[$info]['title']}\"" : '';
if(!isset($iteminfo[$info])) $info = $v_info;
return "<span {$info_tp} {$info_f}>{$iteminfo[$info]}</span>";
}
......@@ -621,7 +622,7 @@ function parse_info_desc($info,$type,$vars='',$short=0)
if(!empty($info) && isset($cskills[$info]))
{
$sk = $cskills[$info]; $sknm = $cskills[$info]['name'];
return "<span tooltip=\"阅读后可习得技能「{$sknm}\">知识</span>";
return "<span {$ttypes}=\"阅读后可习得技能「{$sknm}\">知识</span>";
}
return "--";
}
......@@ -670,7 +671,7 @@ function parse_info_desc($info,$type,$vars='',$short=0)
if($sk_max > $short_nums && $short) $ret = $itemspkinfo[$info[0]]."+...+".$itemspkinfo[end($info)];
if(!empty($sk_tp))
{
$ret = "<span tooltip=\"{$sk_tp}\">{$ret}</span>";
$ret = "<span {$ttypes}=\"{$sk_tp}\">{$ret}</span>";
}
}
return $ret;
......@@ -765,6 +766,38 @@ function generate_ndnumbers($min, $max, $count = 10)
return $numbers;
}
function full_combination($a, $min) {
$r = array();
$n = count($a);
if($n >= $min){
for($i=$min;$i<=$n;$i++){
$r = array_merge($r, combination($a, $i));
}
}
return $r;
}
function combination($a, $m) {
$r = array();
$n = count($a);
if ($m <= 0 || $m > $n) {
return $r;
}
for ($i=0; $i<$n; $i++) {
$t = array($a[$i]);
if ($m == 1) {
$r[] = $t;
} else {
$b = array_slice($a, $i+1);
$c = combination($b, $m-1);
foreach ($c as $v) {
$r[] = array_merge($t, $v);
}
}
}
return $r;
}
function mgzdecode($data)
{
return gzinflate(substr($data,10,-8));
......
......@@ -31,6 +31,30 @@ function get_mixinfo()
if(!empty($vn_mixinfo)) $mixinfo = array_merge($mixinfo,$vn_mixinfo);
return $mixinfo;
}
function get_syncmixinfo()
{
global $gamecfg;
$file = config("synitem",$gamecfg);
$slist = openfile($file);
$n = count($slist);
$prp_res = array();
for ($i=0;$i<$n;$i++){
$prp_res[] = explode(',',$slist[$i]);
}
return $prp_res;
}
function get_overlaymixinfo()
{
global $gamecfg;
$file = config("overlay",$gamecfg);
$olist = openfile($file);
$n = count($olist);
$prp_res = array();
for ($i=0;$i<$n;$i++){
$prp_res[] = explode(',',$olist[$i]);
}
return $prp_res;
}
# achievement_1.php
function get_achtype()
......
......@@ -4,7 +4,14 @@
<!--{eval $bgm = init_bgm(1)}-->
$bgm
</div>
<!--{loop $plsinfo $places $info}-->
<!--{if (CURSCRIPT == 'game' && $pls==$places)}-->
<!--{eval $bgurl = "img/location/".$places.".jpg"}-->
<style>
body {background-image: url("$bgurl");background-position: center;}
</style>
<!--{/if}-->
<!--{/loop}-->
<table border="0" cellspacing="10" cellpadding="0" align="center">
<tr valign=top>
<td>
......@@ -13,6 +20,8 @@
{template battle}
<!--{elseif $main=='battle_rev'}-->
{template battle_rev}
<!--{elseif $main=='itemmix_tips'}-->
{template itemmix_tips}
<!--{else}-->
{template profile}
<!--{/if}-->
......
......@@ -35,7 +35,7 @@
<div style="padding: 5px;">
<span class="grey">先选择要移位的道具,再选择要移动到的位置。</span><br>
将:
<select name="from">
<select name="from" onclick=sl('itemmove'); href="javascript:void(0);">
<option value="0">■ 道 具 ■
<!--{if $itms1}--><option value="1">$itm1/$itme1/$itms1<!--{/if}-->
<!--{if $itms2}--><option value="2">$itm2/$itme2/$itms2<!--{/if}-->
......@@ -46,7 +46,7 @@
</select>
<br>
移动至/与之交换:
<select name="to">
<select name="to" onclick=sl('itemmove'); href="javascript:void(0);">
<option value="0">■ 位 置 ■
<!--{if $itms1}--><option value="1">包裹1:$itm1/$itme1/$itms1<!--{else}--><option value="1">包裹1<!--{/if}-->
<!--{if $itms2}--><option value="2">包裹2:$itm2/$itme2/$itms2<!--{else}--><option value="2">包裹2<!--{/if}-->
......
<input type="hidden" id="mode" name="mode" value="itemmain">
<input type="hidden" id="command" name="command" value="itemmix">
<input type="hidden" id="mixmask" name="mixmask" value="{$mixmask}">
<input type="hidden" id="itemselect" name="itemselect" value="999">
<!--{eval $mt0='';}-->
<!--{loop $mix_res $mi $mv}-->
<!--{if $mv['type']!=$mt0}-->
<!--{eval $mtype = $mix_type[$mv['type']];}-->
可{$mtype}合成: <br>
<!--{eval $mt0=$mv['type'];}-->
<!--{/if}-->
<!--{eval $mname=$mv['result'][0];}-->
<input type="button" class="cmdbutton" style="width:200" value="{$mname}" onclick="$('itemselect').value='$mi';postCmd('gamecmd','command.php');this.disabled=true;"><br>
<!--{/loop}-->
\ No newline at end of file
<div style="width:720px">
<div class="b1" style="height:20px"><span>合成笔记</span></div>
<div class="b3" style="min-height:380px;display: flex;position:relative;justify-content: center;">
<div style="min-width: 500px;max-width:700px;max-height:400px;text-align:left;word-break:break-all;overflow:auto;">
<!--{eval include_once GAME_ROOT.'./include/game/itemplace.func.php';$mixhint = init_itemmix_tips();}-->
<form method="post" id="maincmd" name="maincmd">
<input type="hidden" name="itemindex" id="itemindex" value="">
{$mixhint}
</form>
</div>
</div>
</div>
<!--{if !empty($itemindex)}-->
<!--{eval include_once GAME_ROOT.'./include/game/itemplace.func.php';$mixhint2 = init_itemmix_tips($itemindex);}-->
<dialog id="itemmix_tips" style="min-width: fit-content; min-height: fit-content;max-width: 400px;max-height: 600px;">
<div id="tipsinfo">
<div class="b3" style="mdisplay: flex;position:relative;justify-content: center;">
<div style="text-align:left;word-break:break-all;overflow:auto;">
{$mixhint2}
</div>
</div>
</div>
<img class="dialog-background" src="img/profile.gif" onclick="closeDialog($('itemmix_tips'));this.disabled=true;">
</dialog>
<!--{/if}-->
\ No newline at end of file
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