Commit 7f6a31ac authored by hisuinohoshi's avatar hisuinohoshi

Add elementmix.func.php,elementmix.htm

change:{command.php:act();itemmain.func.php:getcorpse();command.htm;corpse.htm;itemfind.htm;game20130526.js}
实现了元素大师基本的拆解功能、元素合成页面模板。
todolist:计算拆解元素数量、元素合成功能、元素合成配置项。
parent e538d938
......@@ -126,7 +126,16 @@ if($hp > 0){
$mode = 'rest';
}
} elseif($command == 'itemmain') {
$mode = $itemcmd;
//保险起见 在这里检测下两种伪造提交情况 比较丑陋!
if(($club == 20 && $itemcmd == 'itemmix') || ($club != 20 && $itemcmd == 'elementmix'))
{
$log .= "你的手突然掐住了你的头左右摇摆!<br><span class='yellow'>“你还想要干什么,啊?你还想要干什么!!”</span><br>看来你的手和脑子之间起了一点小摩擦。<br><br>";
$mode = 'command';
}
else
{
$mode = $itemcmd;
}
} elseif($command == 'song') {
$sname=trim(trim($art,'【'),'】');
include_once GAME_ROOT.'./include/game/song.inc.php';
......@@ -247,6 +256,11 @@ if($hp > 0){
else{itemmerge($merge1,$merge2);}
} elseif($command == 'itemmove') {
itemmove($from,$to);
} elseif(strpos($command,'split_itm') === 0) {
//把道具分解为元素 在数据库里注销道具的流程已经在discover()里走完了
$split_item = substr($command,9);
include_once GAME_ROOT . './include/game/elementmix.func.php';
split_item_to_elements($split_item);
} elseif(strpos($command,'drop') === 0) {
$drop_item = substr($command,4);
itemdrop($drop_item);
......@@ -280,6 +294,36 @@ if($hp > 0){
itemmix($mixlist,$itemselect);
else itemmix($mixlist);
}
} elseif($command == 'elementmix') {
if($club == 20)
{
$e_mixlist = Array();
foreach($elements_info as $e_key=>$e_info)
{
global ${'element'.$e_key};
//偷个懒 只对合法参数进行判断 非法参数就不额外判断发log了……
${'emitm'.$e_key.'_num'} = round( ${'emitm'.$e_key.'_num'});
if(${'element'.$e_key} && ${'emitm'.$e_key}>=0 && ${'emitm'.$e_key.'_num'}>0 && ${'emitm'.$e_key.'_num'}<=${'element'.$e_key})
{
//打入参与合成的元素编号与数量
$e_mixlist[$e_key] = ${'emitm'.$e_key.'_num'};
}
}
if(count($e_mixlist)>0)
{
include_once GAME_ROOT.'./include/game/elementmix.func.php';
element_mix($e_mixlist);
}
else
{
$log.="放弃了合成。<br>";
}
}
else
{
$log.="你挠了挠头,没搞懂自己到底要干什么。<br>";
}
$mode='command';
} elseif($command == 'itemencase') {
if(strpos($arbsk,'^')!==false && $arbs && $arbe){
$ilist = array();
......
......@@ -1074,7 +1074,17 @@ $iteminfo = Array(//注意顺序,AB必须在A的前面,以此类推
'^' => '<span title="装备后,可使用「背包」相关指令存储物品。">背包</span>',
);
//club20 元素大师:
//元素列表 可能需要一些布灵布灵的特效
$elements_info = Array
(
0 => '亮晶晶',
1 => '暖洋洋',
2 => '冷冰冰',
3 => '郁萌萌',
4 => '昼闪闪',
5 => '夜静静',
);
$shops = Array(0,14,27);
$hospitals = Array(11,19,32);
......
......@@ -80,7 +80,8 @@ function findteam(&$w_pdata){
function findcorpse(&$w_pdata){
global $log,$mode,$main,$battle_title,$cmd,$iteminfo,$itemspkinfo;
global $w_type,$w_name,$w_gd,$w_sNo,$w_icon,$w_hp,$w_mhp,$w_wep,$w_wepk,$w_wepe,$w_lvl,$w_pose,$w_tactic,$w_inf;//,$itmsk0;
global $club;
$battle_title = '发现尸体';
extract($w_pdata,EXTR_PREFIX_ALL,'w');
init_battle(1);
......
<?php
if(!defined('IN_GAME')) {
exit('Access Denied');
}
//global haomafan wo hao miss mingmingspace
global $elements_info;
global $no_type_to_e_list,$no_itmk_to_e_list,$no_itmsk_to_e_list,$no_emix_circulation;
global $corpse_to_e_lvl_r,$itmk_to_e_r,$itmsk_to_e,$itmsk_to_e_r;
//过滤:
//不可以被拆解的NPC类型
$no_type_to_e_list = Array();
//不可以被拆解的道具类别
$no_itmk_to_e_list = Array('N','WN','Y','Z','p','fy','ygo');
//不可以被拆解的道具属性
$no_itmsk_to_e_list = Array('v','^');
//使用元素合成的道具自带灵魂绑定属性(启用:1)
$no_emix_circulation = 0;
//系数:
//元素合成的效果初始上限值(合成出的道具/装备效果不会超过这个值)
$max_emix_itme_start = 45;
//每1级能够提升的上限值 (前32级时的计算公式:提升值*等级*(100-等级)%)(32级后开始数值膨胀:(提升值+等级)*等级*(1+等级/(255-等级)))
$max_emix_itme_up = 29;
//拆解的对象等级与获得元素的数量关系(默认:等级*5)
$corpse_to_e_lvl_r = 5;
//拆解特定类别道具时获得元素数量的修正系数(默认:1倍)(基础的元素数量:效果+耐久/2 *系数 *浮动)
//给自己一个参考,拆掉一个小兵能获得的元素(等级10*5+武器100/2+装备55/2*4=210),好像勉强还能和钱对标,但是到真职人开始可能就要崩盘了
//真职人能提供多少元素?(等级30*5+武器88+888/2+装备888+888/2*4=4190 好像也还能接受!)
$itmk_to_e_r = Array
(
//拆解复合武器获得的元素数量x2.5
'WGK' => 2.5,
'WCF' => 2.5,
'WCP' => 2.5,
'WKF' => 2.5,
'WKP' => 2.5,
'WFK' => 2.5,
'WDG' => 2.5,
'WDF' => 2.5,
'WJ' => 1.25,
//拆解补给品获得的元素数量x0.1
'HH' => 0.1,
'HS' => 0.1,
'HB' => 0.2,
'PH' => 0.12,
'PS' => 0.12,
'PB' => 0.25,
//拆解弹药……这也要拆!?
'GBh' => 5,
'GBr' => 0.003,
'GBi' => 0.005,
'GBe' => 0.005,
'GB' => 0.004,
);
//拆解特定属性时获得元素数量(种类)的基础值
$itmsk_to_e = Array
(
'x' => 999997,//奇迹
'e' => Array(0=>77),//电击 固定给77个亮晶晶
'u' => Array(1=>101),//火焰 固定给101个暖洋洋
'i' => Array(2=>121),//冻气 固定给121个冷冰冰
'p' => Array(3=>22),//带毒 固定给22个郁萌萌
'w' => Array(4=>141),//音波 固定给141个昼闪闪
'S' => Array(5=>21),//消音 固定会给21个夜静静
);
//指定某些道具类别能拆出特定种类的元素、数量
$itmk_to_e_list = Array();
/********拆解元素部分********/
//把尸体打散成元素
function split_corpse_to_elements(&$edata)
{
if($edata)
{
global $elements_info,$no_type_to_e_list;
global $log,$rp;
//过滤不能分解的尸体
if(in_array($edata['type'],$no_type_to_e_list))
{
$log.="无法从这具尸体上提炼元素!<br>";
return;
}
//成功从尸体中提炼元素
$log.="{$edata['name']}化作点点荧光四散开来……<br>";
//计算能获得的元素种类与数量
$get_elements = 13;
//增加对应的元素
foreach($elements_info as $e_key=>$e_info)
{
global ${'element'.$e_key};
${'element'.$e_key} += $get_elements;
$log.="从{$edata['name']}身上提取到了{$get_elements}{$e_info}!<br>";
}
//销毁尸体
destory_corpse($edata);
//炼人油败人品
$ep_dice = rand(0,100);
if($ep_dice>70)
{
$rp += $ep_dice;
$log.="……但是这一切真的值得吗?<br>";
}
$log.="<br>";
}
return;
}
//把道具打散成元素 改下传入的参数其实也可以拆装备
function split_item_to_elements($iid=NULL)
{
if(isset($iid))
{
global $elements_info,$no_itmk_to_e_list,$no_itmsk_to_e_list,$itmk_to_e_list;
global $log,$rp;
global ${'itm'.$iid},${'itmk'.$iid},${'itme'.$iid},${'itms'.$iid},${'itmsk'.$iid};
if(!${'itms'.$iid})
{
$log.="道具来源非法。<br>";
return;
}
//把道具属性打散成数组
if(${'itmsk'.$iid}) $tmp_itmsk_arr = get_itmsk_array(${'itmsk'.$iid});
//过滤不能分解的道具属性、类型
if(in_array(${'itmk'.$iid},$no_itmk_to_e_list) || array_intersect($tmp_itmsk_arr,$no_itmsk_to_e_list))
{
$log.="不能分解此类道具。<br><br>";
include_once GAME_ROOT.'./include/game/itemmain.func.php';
itemfind();
return;
}
//分解道具获得元素
$log.=${'itm'.$iid}."化作点点荧光四散开来……<br>";
//计算能获得的元素种类与数量
$get_elements = 13;
$e_key = array_rand($elements_info);
//增加对应的元素
global ${'element'.$e_key};
${'element'.$e_key} += $get_elements;
$log.="提取到了{$get_elements}{$elements_info[$e_key]}!<br>";
//销毁道具
${'itm'.$iid} = ${'itmk'.$iid} = ${'itmsk'.$iid} = '';
${'itme'.$iid} = ${'itms'.$iid} = 0;
//捡垃圾涨功德
$ep_dice = rand(0,100);
if($ep_dice>70)
{
$rp = max(0,$rp-$ep_dice);
//$log.="忽闻遥远天外飞来一句赞叹:“感谢你对幻境环卫事业作出的贡献!”<br>";
}
$log.="<br>";
}
$mode='command';
return;
}
/********元素合成部分********/
function element_mix($emlist,$eitmk=NULL,$eitme_r=NULL)
{
global $log,$elements_info;
//输入了合法的元素参数 打印log
$log.="从口袋中抓出了";
//好看修正
$log_prefix = 0;
foreach($emlist as $log_e_key=>$log_e_num)
{
if($log_prefix>0) $log.="、";
$log.="{$log_e_num}{$elements_info[$log_e_key]}";
$log_prefix++;
}
$log.="。<br>……<br>开始了合成。<br><br>";
return;
}
/********一些可复用函数 也许可以挪到其他地方********/
//销毁尸体
function destory_corpse(&$edata)
{
if($edata && $edata['hp']<=0)
{
//$edata['state'] = 16;
$edata['money'] = 0;
$edata['weps'] = 0;$edata['arbs'] = 0;$edata['arhs'] = 0;$edata['aras'] = 0;$edata['arfs'] = 0;$edata['arts'] = 0;
$edata['itms0'] = 0;$edata['itms1'] = 0;$edata['itms2'] = 0;$edata['itms3'] = 0;$edata['itms4'] = 0;$edata['itms5'] = 0;$edata['itms6'] = 0;
player_save($edata);
}
return;
}
//数组化itmsk 可能是四面的遗产
function get_itmsk_array($sk_value)
{
$ret = Array();
$i = 0;
while ($i < strlen($sk_value))
{
$sub = substr($sk_value,$i,1);
$i++;
if(!empty($sub)) array_push($ret,$sub);
}
return $ret;
}
?>
\ No newline at end of file
......@@ -178,6 +178,7 @@ function trap(){
function itemfind() {
global $mode,$log,$itm0,$itmk0,$itms0,$itmsk0;
global $club;
if(!$itm0||!$itmk0||!$itms0){
$log .= '获取物品信息错误!';
$mode = 'command';
......@@ -995,6 +996,7 @@ function itembuy($item,$shop,$bnum=1) {
function getcorpse($item){
global $db,$tablepre,$log,$mode;
global $itm0,$itmk0,$itme0,$itms0,$itmsk0,$money,$pls,$action;
global $club;
$corpseid = strpos($action,'corpse')===0 ? str_replace('corpse','',$action) : str_replace('pacorpse','',$action);
if(!$corpseid || strpos($action,'corpse')===false){
$log .= '<span class="yellow">你没有遇到尸体,或已经离开现场!</span><br>';
......@@ -1024,6 +1026,22 @@ function getcorpse($item){
$mode = 'command';
return;
}
if($item == 'element_split')
{
if($club != 20)
{
$log.="你还想对这具可怜的尸体干什么?麻烦给死者一点基本的尊重!<br>";
$action = '';
$mode = 'command';
return;
}
include_once GAME_ROOT.'./include/game/elementmix.func.php';
split_corpse_to_elements($edata);
$action = '';
$mode = 'command';
return;
}
if($item == 'wep') {
$itm0 = $edata['wep'];
......
......@@ -63,6 +63,18 @@ function itemmixchooser(){
}
}
function elementmixchooser(){
//呃呃 这里可能会有点问题
for(i=0;i<=5;i++){
var mname = 'emitm'+i;
if($(mname) != null){
if($(mname).checked){
$(mname).value=i;
}
}
}
}
//icon select
//function iconMover(){
// gd = document.valid.gender[0].checked ? 'm' : 'f';
......@@ -275,7 +287,7 @@ function showData(sdata){
if(shwData['timer'] && typeof(timerid)=='undefined'){
demiSecTimerStarter(shwData['timer']);
}
if ($('HsUipfcGhU')) //ˢҳ
if ($('HsUipfcGhU')) //ˢ��ҳ����
{
window.location.reload();
}
......
......@@ -29,7 +29,12 @@
<!--{/if}-->
<br>
<!--{if $club==19}--><span class="lime">报应点数:<span id="anum">$rp</span></span><br><!--{/if}-->
<!--{if $club==20}--><span class="lime">元素口袋:<span id="anum">{$element0}/{$element1}/{$element2}/{$element3}/{$element4}/{$element5}</span></span><br><!--{/if}-->
<!--{if $club==20}-->
<input type="button" class="cmdbutton" id="elementmix" name="elementmix" value="元素炼成" onclick="$('command').value='itemmain';$('subcmd').name='itemcmd';$('subcmd').value='elementmix';postCmd('gamecmd','command.php');this.disabled=true;">
<!--{else}-->
<input type="button" class="cmdbutton" id="itemmix" name="itemmix" value="道具合成" onclick="$('command').value='itemmain';$('subcmd').name='itemcmd';$('subcmd').value='itemmix';postCmd('gamecmd','command.php');this.disabled=true;">
<!--{/if}-->
<input type="button" class="cmdbutton" id="itemmerge" name="itemmerge" value="整理包裹" onclick="$('command').value='itemmain';$('subcmd').name='itemcmd';$('subcmd').value='itemmerge';postCmd('gamecmd','command.php');this.disabled=true;">
<!--{if strpos($artk,'ss')!==false}-->
<input type="button" class="cmdbutton" id="sp_weapon" name="sp_weapon" value="歌唱" onclick="$('command').value='song';$('subcmd').name='song';postCmd('gamecmd','command.php');this.disabled=true;">
......
想要从尸体上拾取什么?<br><br>
<input type="hidden" name="mode" value="corpse">
<input type="radio" name="command" id="menu" value="menu" <!--{if !$w_money}-->checked<!--{/if}-->><a onclick=sl('menu'); href="javascript:void(0);" >返回</a><br><br>
<!--{if $club==20}-->
<input type="radio" name="command" id="element_split" value="element_split" <!--{if !$w_money}-->checked<!--{/if}-->><a onclick=sl('element_split'); href="javascript:void(0);" >提炼元素</a><br>
<!--{/if}-->
<input type="radio" name="command" id="menu" value="menu" <!--{if !$w_money && $club!=20 }-->checked<!--{/if}-->><a onclick=sl('menu'); href="javascript:void(0);" >返回</a><br><br>
<!--{if $w_weps && $w_wepe}-->
<input type="radio" name="command" id="wep" value="wep"><a onclick=sl('wep'); href="javascript:void(0);" >$w_wep/$w_wepk_words/$w_wepe/$w_weps<!--{if $w_wepsk_words}-->/$w_wepsk_words<!--{/if}--></a><br>
<!--{/if}-->
......
你伸手掏向口袋……<br>
打算投入哪些元素?<br>
<input type="hidden" name="mode" value="itemmain">
<input type="hidden" name="command" id="command" value="menu">
<br>
<!--元素选取模块-->
<!--{if $element0}-->
<input type="checkbox" id="emitm0" name="emitm0" value="-1"><a onclick="$('emitm0').click();" href="javascript:void(0);">【$elements_info[0]】 → 投入数量:</a>
<input type="number" style="width:50px" name="emitm0_num" value="0" min="0" max="$element0" oninput="if(value>$element0)value=$element0;if(value<0)value=0" /><br>
<!--{/if}-->
<!--{if $element1}-->
<input type="checkbox" id="emitm1" name="emitm1" value="-1"><a onclick="$('emitm1').click();" href="javascript:void(0);">【$elements_info[1]】 → 投入数量:</a>
<input type="number" style="width:50px" name="emitm1_num" value="0" min="0" max="$element1" oninput="if(value>$element1)value=$element1;if(value<0)value=0" /><br>
<!--{/if}-->
<!--{if $element2}-->
<input type="checkbox" id="emitm2" name="emitm2" value="-1"><a onclick="$('emitm2').click();" href="javascript:void(0);">【$elements_info[2]】 → 投入数量:</a>
<input type="number" style="width:50px" name="emitm2_num" value="0" min="0" max="$element2" oninput="if(value>$element2)value=$element2;if(value<0)value=0" /><br>
<!--{/if}-->
<!--{if $element3}-->
<input type="checkbox" id="emitm3" name="emitm3" value="-1"><a onclick="$('emitm3').click();" href="javascript:void(0);">【$elements_info[3]】 → 投入数量:</a>
<input type="number" style="width:50px" name="emitm3_num" value="0" min="0" max="$element3" oninput="if(value>$element3)value=$element3;if(value<0)value=0" /><br>
<!--{/if}-->
<!--{if $element4}-->
<input type="checkbox" id="emitm4" name="emitm4" value="-1"><a onclick="$('emitm4').click();" href="javascript:void(0);">【$elements_info[4]】 → 投入数量:</a>
<input type="number" style="width:50px" name="emitm4_num" value="0" min="0" max="$element4" oninput="if(value>$element4)value=$element4;if(value<0)value=0" /><br>
<!--{/if}-->
<!--{if $element5}-->
<input type="checkbox" id="emitm5" name="emitm5" value="-1"><a onclick="$('emitm5').click();" href="javascript:void(0);">【$elements_info[5]】 → 投入数量:</a>
<input type="number" style="width:50px" name="emitm5_num" value="0" min="0" max="$element5" oninput="if(value>$element5)value=$element5;if(value<0)value=0" /><br>
<!--{/if}-->
<br>
<!--(暂定)升级解锁:指定武器/道具类型-->
<!--(暂定)升级解锁:效果、耐久比例调节-->
<input type="button" class="cmdbutton" name="submit" value="提交" onclick="$('command').value='elementmix';elementmixchooser();postCmd('gamecmd','command.php');this.disabled=true;">
<input type="button" class="cmdbutton" name="submit" value="放弃" onclick="postCmd('gamecmd','command.php');this.disabled=true;">
\ No newline at end of file
......@@ -5,5 +5,9 @@
<br>
<input type="hidden" id="mode" name="mode" value="itemmain">
<input type="hidden" id="command" name="command" value="itemget">
<input type="button" class="cmdbutton" name="itemget" value="拾取" onclick="postCmd('gamecmd','command.php');this.disabled=true;"><br><br>
<input type="button" class="cmdbutton" name="itemget" value="拾取" onclick="postCmd('gamecmd','command.php');this.disabled=true;">
<!--{if $club==20}-->
&nbsp;&nbsp;<input type="button" class="cmdbutton" name="split_itm" value="提炼" onclick="$('command').value='split_itm0';postCmd('gamecmd','command.php');this.disabled=true;">
<!--{/if}-->
<br><br>
<input type="button" class="cmdbutton" name="dropitm0" value="丢弃" onclick="$('command').value='dropitm0';postCmd('gamecmd','command.php');this.disabled=true;">
\ 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