Commit 7aaac468 authored by Nemo Ma's avatar Nemo Ma Committed by GitHub

Merge pull request #40 from hikawiier/waaagh

fix
parents c148ee16 496acbff
......@@ -6,8 +6,6 @@ require './include/common.inc.php';
//$t_s=getmicrotime();
//require_once GAME_ROOT.'./include/JSON.php';
require GAME_ROOT.'./include/game.func.php';
include config('combatcfg',$gamecfg);
include config('dialogue',$gamecfg);
//判断是否进入游戏
if(!$cuser||!$cpass) { gexit($_ERROR['no_login'],__file__,__line__); }
......
......@@ -6,7 +6,7 @@ require GAME_ROOT.'./include/game.func.php';
require_once GAME_ROOT.'./include/game/titles.func.php';
if(!$cuser||!$cpass) { gexit($_ERROR['no_login'],__file__,__line__); }
if($mode == 'quit') {
if(isset($mode) && $mode == 'quit') {
gsetcookie('user','');
gsetcookie('pass','');
......
......@@ -258,11 +258,11 @@ $enpcinfo = array
'arbe' => 2700,
'arbs' => 200,
'arbsk' => 'aA',
//'arh' => '',
//'arhk' => 'DH',
//'arhe' => 0,
//'arhs' => 0,
//'arhsk' => '',
'arh' => '',
'arhk' => 'DH',
'arhe' => 0,
'arhs' => 0,
'arhsk' => '',
'arf' => '化学强化战靴',
'arfk' => 'DF',
'arfe' => 1200,
......
......@@ -64,8 +64,8 @@ $tacinfo = Array('通常','','重视防御','重视反击','重视躲避');
//可供玩家选择的姿态、策略
$apose = Array(0,1,3,4,5,6);
$atac = Array(0,2,3,4);
//不会生成在危险地图的NPC(女主)
$hidding_typelist = Array(14);
//不会生成在危险地图的NPC(执行官、女主)
$hidding_typelist = Array(7,14);
//不会因躲避禁区、追杀玩家等原因离开地图的NPC(红暮、■、执行官、英灵(没有巫师)、SCP、种火)
$sentinel_typelist = Array(1,4,7,9,13,20,21,22,88,92);
$typeinfo = Array(
......
......@@ -44,6 +44,9 @@ unset($dbhost, $dbuser, $dbpw, $dbname, $pconnect);
require GAME_ROOT.'./gamedata/system.php';
require config('resources',$gamecfg);
require config('gamecfg',$gamecfg);
require config('combatcfg',$gamecfg);
require config('dialogue',$gamecfg);
require config('audio',$gamecfg);
include GAME_ROOT.'./gamedata/combatinfo.php';
......
......@@ -419,12 +419,13 @@ function init_rev_battle($ismeet = 0)
function init_bgm($force_update=0)
{
global $pls,$command,$clbpara,$gamecfg;
include config('audio',$gamecfg);
global $pls,$command,$clbpara,$gamecfg,$bgmname;
global $default_volume,$event_bgm,$pls_bgm,$parea_bgm,$regular_bgm,$bgmbook,$bgmlist;
//include config('audio',$gamecfg);
# 初始化
$event_flag = 0;
$bgmname = $bgmlink = $bgmtype = $bgmplayer = $bgmnums = '';
$bgmid = $bgmlink = $bgmtype = $bgmplayer = $bgmnums = '';
# 存在最优先的事件BGM队列
if(isset($clbpara['event_bgmbook']))
......@@ -471,6 +472,7 @@ function init_bgm($force_update=0)
$bgmarr[$bgmid]['name'] = $bgmlist[$bgmid]['name'];
$bgmarr[$bgmid]['url'] = $bgmlist[$bgmid]['url'];
$bgmarr[$bgmid]['type'] = $bgmlist[$bgmid]['type'];
$bgmarr[$bgmid]['id'] = $bgmid;
}
}
# 计数当前播放队列中的BGM数
......@@ -481,6 +483,10 @@ function init_bgm($force_update=0)
$bgmname = $bgmarr[0]['name'];
$bgmlink = $bgmarr[0]['url'];
$bgmtype = $bgmarr[0]['type'];
$bgmid = $bgmarr[0]['id'];
$json_bgmarr = json_encode($bgmarr);
# 将当前播放的BGM编号保存于缓存内 留待以后用作播放记忆
gsetcookie('nowbgmid',$bgmid,0,0);
#初始化默认音量
$volume = isset($_COOKIE["volume"]) ? filter_var($_COOKIE["volume"],FILTER_VALIDATE_FLOAT)*100 : $default_volume;
$volume_r = isset($volume) ? round($volume/100,2) : round($default_volume/100,2);
......@@ -488,23 +494,19 @@ function init_bgm($force_update=0)
if(!empty($bgmlink) && !empty($bgmtype))
{
$bgmplayer = <<<EOT
<audio id="gamebgm" autoplay controls onplay="$('gamebgm').volume=$volume_r;" onplaying="$('gamebgm').volume=$volume_r;">
<audio id="gamebgm" autoplay controls onplay="$('gamebgm').volume=$volume_r;">
<source id="gbgm" src="$bgmlink" type="$bgmtype">
</audio>
<div id="bgmnums">$bgmnums</div>
<div id="nowbgm">$nowbgm</div>
<div id="bgmlist">$json_bgmarr</div>
<div id="nowbgm">0</div>
<script>
$('gamebgm').volume = $volume_r;
$('bgmname').innerHTML = $bgmname;
gamebgm.addEventListener('ended', function () {
changeBGM();
}, false);
</script>
EOT;
foreach($bgmarr as $bgmid2 => $bgms)
{
$bgmplayer .= "<div id=\"bnm{$bgmid2}\">{$bgms['name']}</div>
<div id=\"bgm{$bgmid2}\">{$bgms['url']}</div>
<div id=\"bt{$bgmid2}\">{$bgms['type']}</div>";
}
}
return $bgmplayer;
}
......
......@@ -80,7 +80,7 @@ function event(){
}else{
$log = ($log . "万幸,你没跌进池中。<BR>");
}
$event = 1;
} elseif($pls == 8) { //白穗神社
} elseif($pls == 9) { //墓地
} elseif($pls == 10) { //麦斯克林
......
......@@ -1871,8 +1871,8 @@ function itemuse($itmn) {
} elseif ($itm == '事件BGM替换器'){
// 这是一个触发事件BGM的案例,只要输入$clbpara['event_bgmbook'] = Array('事件曲集名'); 即可将当前曲集替换为特殊事件BGM
// 特殊事件曲集'event_bgmbook'的优先级高于地图曲集'pls_bgmbook',前者存在时后者不会生效
global $clbpara;
include_once config('audio',$gamecfg);
global $clbpara,$event_bgm;
//include_once config('audio',$gamecfg);
$log.="【DEBUG】你目前的播放列表被替换为了{$event_bgm['test'][0]}!<br>特殊的事件曲集不会被其他曲集覆盖,除非你使用下面的道具。<br>";
$clbpara['event_bgmbook'] = $event_bgm['test'];
} elseif ($itm == '事件BGM还原器'){
......
......@@ -63,7 +63,7 @@ function get_npc_helpinfo($nlist,$tooltip=1)
{
foreach(Array('','k','e','s','sk') as $t2)
{
if(isset($snpc[$t1.$t2]))
if(!empty($snpc[$t1.$t2]))
{
//为装备名添加tooltip效果
if($t2 == '' && $tooltip)
......@@ -110,7 +110,7 @@ function get_npc_helpinfo($nlist,$tooltip=1)
{
foreach(Array('','k','e','s','sk') as $t2)
{
if(isset($snpc['itm'.$t2.$ni]))
if(!empty($snpc['itm'.$t2.$ni]))
{
//为装备名添加tooltip效果
if($t2 == '' && $tooltip)
......
......@@ -718,8 +718,8 @@
if (!$revival_flag && $pd['club']==99 && !$pd['type'])
{
#决死结界复活效果:
$revival_flag = 99; //保存复活标记为通过奥罗拉复活
addnews($now,'revival',$dname); //玩家春哥附体称号的处理
$revival_flag = 99; //保存复活标记为通过称号复活
addnews($now,'revival',$dname);
$pd['hp'] = $pd['mhp']; $pd['sp'] = $pd['msp'];
$pd['state'] = 0; $pd['club'] = 17;
$log .= '<span class="yellow">但是,由于及时按下BOMB键,'.$pd['nm'].'原地满血复活了!</span><br>';
......
......@@ -397,7 +397,8 @@ function discover($schmode = 0) {
}
# 判定移动、探索、事件后的BGM变化
include_once config('audio',$gamecfg);
//include_once config('audio',$gamecfg);
global $pls_bgm;
if(array_key_exists($pls,$pls_bgm))
{
$clbpara['pls_bgmbook'] = $pls_bgm[$pls];
......
......@@ -387,26 +387,22 @@ function changeVolume(cv){
$('volume_num').innerHTML = s+'%';
}
function showBGMname(){
var nowid = $('nowbgm').innerHTML;
var bname = 'bnm' + nowid;
$('bgmname').innerHTML = $(bname).innerHTML;
}
//查了下才发现可以用parseJSON()……但是这样不也挺好吗^ ^
function changeBGM(mode=1){
x = Math.floor($('nowbgm').innerHTML) + Math.floor(mode);
if(x > $('bgmnums').innerHTML || x<0)
{
x = '0';
var bgmlist = JSON.parse($('bgmlist').innerHTML);
var nowbgm = Math.round($('nowbgm').innerHTML);
nowbgm = nowbgm + mode;
if(nowbgm < 0){
nowbgm = bgmlist.length - 1;
}else{
nowbgm = nowbgm % bgmlist.length;
}
$('nowbgm').innerHTML = x;
var newsrc = 'bgm'+x;
var newt = 'bt'+x;
var newname = 'bnm'+x;
$('gbgm').src = $(newsrc).innerHTML;
$('gbgm').type = $(newt).innerHTML;
$('bgmname').innerHTML = $(newname).innerHTML;
$('gbgm').src = bgmlist[nowbgm].url;
$('gbgm').type = bgmlist[nowbgm].type;
$('nowbgm').innerHTML = nowbgm;
Cookie.setCookie("nowbgmid",bgmlist[nowbgm].id, {
path: "/",
});
$('bgmname').innerHTML = bgmlist[nowbgm].name;
$('gamebgm').load();
$('gamebgm').play();
}
......
......@@ -588,6 +588,7 @@ function movehtm($atime = 0) {
function addnpc($type,$sub,$num,$time = 0,$clbstatus=NULL,$aitem=NULL,$apls=NULL) {
global $now,$db,$tablepre,$log,$plsinfo,$typeinfo,$anpcinfo,$npcinit,$arealist,$areanum,$gamecfg;
global $hidding_typelist,$deepzones;
$time = $time == 0 ? $now : $time;
$plsnum = sizeof($plsinfo);
if(empty($anpcinfo) || empty($npcinit)){
......@@ -623,7 +624,16 @@ function addnpc($type,$sub,$num,$time = 0,$clbstatus=NULL,$aitem=NULL,$apls=NULL
$npc['pls'] = 0;
}else{
shuffle($areaarr);
//特定NPC不会生成在危险区域
$npc['pls'] = $areaarr[0];
if(in_array($npc['type'],$hidding_typelist))
{
while(in_array($npc['pls'],$deepzones))
{
shuffle($areaarr);
$npc['pls'] = $areaarr[0];
}
}
}
//$npc['pls'] = rand(1,$plsnum-1);
}
......
<dialog id="terminal" style="max-width: 90%;max-height: 80%;">
<center>
<div><span class="grey">正在播放:~ <span id="bgmname"></span></span></div>
<!--{if !isset($bgmname)}-->
<!--{eval $nowbgmid = isset($_COOKIE["nowbgmid"]) ? filter_var($_COOKIE["nowbgmid"],FILTER_VALIDATE_INT) : 0; $bgmname = $bgmlist[$nowbgmid]['name'];}-->
<!--{/if}-->
<div><span class="grey">正在播放:~ <span id="bgmname">$bgmname</span></span></div>
<!-- 战场地图 -->
<!--{eval $mapdata = init_mapdata();}-->
$mapdata
......@@ -89,9 +92,6 @@
<!--{/if}-->
</table>
</center>
<script>
showBGMname();
</script>
<img class="dialog-background" src="img/profile.gif" onclick="closeDialog($('terminal'))">
</dialog>
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