Commit d734bb3e authored by Nemo Ma's avatar Nemo Ma Committed by GitHub

Merge pull request #95 from hikawiier/waaagh

update
parents 050883a1 2d1e24f2
......@@ -63,10 +63,10 @@ if($hp > 0){
if(($now <= $noisetime+$noiselimit)&&$noisemode&&($noiseid!=$pid)&&($noiseid2!=$pid)) {
if(($now-$noisetime) < 60) {
$noisesec = $now - $noisetime;
$log .= "<span class=\"yellow b\">{$noisesec}秒前,{$plsinfo[$noisepls]}传来了{$noiseinfo[$noisemode]}。</span><br>";
$log .= "<span class=\"yellow\">{$noisesec}秒前,{$plsinfo[$noisepls]}传来了{$noiseinfo[$noisemode]}。</span><br>";
} else {
$noisemin = floor(($now-$noisetime)/60);
$log .= "<span class=\"yellow b\">{$noisemin}分钟前,{$plsinfo[$noisepls]}传来了{$noiseinfo[$noisemode]}。</span><br>";
$log .= "<span class=\"yellow\">{$noisemin}分钟前,{$plsinfo[$noisepls]}传来了{$noiseinfo[$noisemode]}。</span><br>";
}
}
......
......@@ -162,6 +162,30 @@ if(!$db->num_rows($result)) $db->query("ALTER TABLE {$tablepre}users ADD daily v
//game表结构变动
$db->query("ALTER TABLE {$tablepre}game DROP gamevars");
$db->query("ALTER TABLE {$tablepre}game ADD gamevars text NOT NULL AFTER combonum");
$result = $db->query("DESCRIBE {$tablepre}game lastupdate");
if($db->num_rows($result))
{
$db->query("ALTER TABLE {$tablepre}game DROP lastupdate");
echo "从game表中删去了字段lastupdate<br>";
}
$result = $db->query("DESCRIBE {$tablepre}game hdamage");
if(!$db->num_rows($result))
{
$db->query("ALTER TABLE {$tablepre}game ADD hdamage int(10) unsigned NOT NULL DEFAULT '0' AFTER hack");
echo "向game表中添加了字段hdamage<br>";
}
$result = $db->query("DESCRIBE {$tablepre}game hplayer");
if(!$db->num_rows($result))
{
$db->query("ALTER TABLE {$tablepre}game ADD hplayer char(15) NOT NULL DEFAULT '' AFTER hdamage");
echo "向game表中添加了字段hplayer<br>";
}
$result = $db->query("DESCRIBE {$tablepre}game noisevars");
if(!$db->num_rows($result))
{
$db->query("ALTER TABLE {$tablepre}game ADD noisevars varchar(1000) NOT NULL DEFAULT '' AFTER gamevars");
echo "向game表中添加了字段noisevars<br>";
}
echo "Update Fish.<br>";
?>
\ No newline at end of file
......@@ -62,10 +62,10 @@ if($hp > 0){//判断冷却时间是否过去
if(($now <= $noisetime+$noiselimit)&&$noisemode&&($noiseid!=$pid)&&($noiseid2!=$pid)) {
if(($now-$noisetime) < 60) {
$noisesec = $now - $noisetime;
$log .= "<span class=\"yellow b\">{$noisesec}秒前,{$plsinfo[$noisepls]}传来了{$noiseinfo[$noisemode]}。</span><br>";
$log .= "<span class=\"yellow\">{$noisesec}秒前,{$plsinfo[$noisepls]}传来了{$noiseinfo[$noisemode]}。</span><br>";
} else {
$noisemin = floor(($now-$noisetime)/60);
$log .= "<span class=\"yellow b\">{$noisemin}分钟前,{$plsinfo[$noisepls]}传来了{$noiseinfo[$noisemode]}。</span><br>";
$log .= "<span class=\"yellow\">{$noisemin}分钟前,{$plsinfo[$noisepls]}传来了{$noiseinfo[$noisemode]}。</span><br>";
}
}
if($coldtimeon){
......
......@@ -62,7 +62,6 @@ DROP TABLE IF EXISTS `acbra2_game`;
CREATE TABLE `acbra2_game` (
`gamenum` mediumint(8) unsigned NOT NULL DEFAULT '0',
`gamestate` tinyint(3) unsigned NOT NULL DEFAULT '0',
`lastupdate` int(10) unsigned NOT NULL DEFAULT '0',
`starttime` int(10) unsigned NOT NULL DEFAULT '0',
`winmode` tinyint(3) unsigned NOT NULL DEFAULT '0',
`winner` char(15) NOT NULL DEFAULT '',
......@@ -77,8 +76,11 @@ CREATE TABLE `acbra2_game` (
`optime` int(10) unsigned NOT NULL DEFAULT '0',
`weather` tinyint(3) unsigned NOT NULL DEFAULT '0',
`hack` tinyint(1) unsigned NOT NULL DEFAULT '0',
`hdamage` int(10) unsigned NOT NULL DEFAULT '0',
`hplayer` char(15) NOT NULL DEFAULT '',
`combonum` smallint(5) unsigned NOT NULL DEFAULT '0',
`gamevars` text NOT NULL,
`noisevars` varchar(1000) NOT NULL DEFAULT '',
`rdown` tinyint(1) unsigned NOT NULL DEFAULT '0',
`bdown` tinyint(1) unsigned NOT NULL DEFAULT '0',
`ldown` tinyint(1) unsigned NOT NULL DEFAULT '0',
......
......@@ -54,7 +54,7 @@ require config('dialogue',$gamecfg);
require config('audio',$gamecfg);
require config('tooltip',$gamecfg);
include GAME_ROOT.'./gamedata/combatinfo.php';
//include GAME_ROOT.'./gamedata/combatinfo.php';
ob_start();
......
......@@ -40,25 +40,6 @@ function decode_item($i){
}
return $i_list;
}
//兼容5.3以下php的json_encode()
function json_encode_comp($par){
if(version_compare(PHP_VERSION,'5.4.0')>=0){ //可以使用json_encode()的JSON_UNESCAPED_UNICODE常量
return json_encode($par,JSON_UNESCAPED_UNICODE);
}else{ //不可以使用JSON_UNESCAPED_UNICODE,用url_encode()处理
return urldecode(json_encode(url_encode($par)));
}
}
function url_encode($str) {
if(is_array($str)) {
foreach($str as $key=>$value) {
$str[urlencode($key)] = url_encode($value);
}
} else {
$str = urlencode($str);
}
return $str;
}
/* ————————————————计算部分———————————————— */
//计算背包内的道具数量(按照类别来区分)
function count_item(){
......
......@@ -1393,9 +1393,8 @@ function reload_set_items(&$pa)
if(!empty($pa['clbpara']['setitems']))
{
# TODO:失去对应的套装效果
}
$pa['clbpara']['setitems'] = Array();
}
$set_items = get_set_items();
$equip_list = get_equip_list();
# 遍历身上的装备信息 检查是否为套装的组成部分
......
......@@ -282,9 +282,16 @@ function logsave($pid,$time,$log = '',$type = 's'){
function load_gameinfo() {
global $now,$db,$tablepre;
global $gamenum,$gamestate,$lastupdate,$starttime,$winmode,$winner,$arealist,$areanum,$areatime,$areawarn,$validnum,$alivenum,$deathnum,$afktime,$optime,$weather,$hack,$combonum,$gamevars;
global $hdamage,$hplayer,$noisetime,$noisepls,$noiseid,$noiseid2,$noisemode;
$result = $db->query("SELECT * FROM {$tablepre}game");
$gameinfo = $db->fetch_array($result);
$gamenum = $gameinfo['gamenum'];
extract($gameinfo);
$arealist = explode(',',$gameinfo['arealist']);
$gamevars = json_decode($gamevars,true);
$noisevars = json_decode($noisevars,true);
extract($noisevars);
if(isset($gamevars['sanmaact']) && isset($gamevars['sanmadead'])) unset($gamevars['sanmaact']);
/*$gamenum = $gameinfo['gamenum'];
$gamestate = $gameinfo['gamestate'];
//$lastupdate = $gameinfo['lastupdate'];
$starttime = $gameinfo['starttime'];
......@@ -303,8 +310,13 @@ function load_gameinfo() {
$hack = $gameinfo['hack'];
$gamevars = $gameinfo['gamevars'];
$gamevars = json_decode($gamevars,true);
$noisevars = $gameinfo['noisevars'];
$noisevars = json_decode($noisevars,true);
extract($noisevars);
$hplayer = $gameinfo['hplayer'];
$hdamage = $gameinfo['hdamage'];
if(isset($gamevars['sanmaact']) && isset($gamevars['sanmadead'])) unset($gamevars['sanmaact']);
$combonum = $gameinfo['combonum'];
$combonum = $gameinfo['combonum'];*/
return Array($gamestate,$gamevars);
}
......@@ -334,7 +346,7 @@ function save_gameinfo() {
$gameinfo['optime'] = $optime;
$gameinfo['weather'] = $weather;
//$gamevars0 = ($gamevars['sanmaact'] ? 1 : 0) + ($gamevars['sanmadead'] ? 2 : 0);
$gameinfo['gamevars'] = json_encode($gamevars);
$gameinfo['gamevars'] = json_encode($gamevars,JSON_UNESCAPED_UNICODE);
$gameinfo['hack'] = $hack;
$gameinfo['combonum'] = $combonum;
$db->array_update("{$tablepre}game",$gameinfo,1);
......@@ -357,13 +369,26 @@ function save_gameinfo() {
function save_combatinfo(){
global $hdamage,$hplayer,$noisetime,$noisepls,$noiseid,$noiseid2,$noisemode;
global $db,$tablepre,$gamenum,$hdamage,$hplayer,$noisevars,$noisetime,$noisepls,$noiseid,$noiseid2,$noisemode;
if(!$hdamage){$hdamage = 0;}
if(!$noisetime){$noisetime = 0;}
if(!$noisepls){$noisepls = 0;}
if(!$noiseid){$noiseid = 0;}
if(!$noiseid2){$noiseid2 = 0;}
$combatinfo = "<?php\n\nif(!defined('IN_GAME')){exit('Access Denied');}\n\n\$hdamage = {$hdamage};\n\$hplayer = '{$hplayer}';\n\$noisetime = {$noisetime};\n\$noisepls = {$noisepls};\n\$noiseid = {$noiseid};\n\$noiseid2 = {$noiseid2};\n\$noisemode = '{$noisemode}';\n\n?>";
if(!$noisemode){$noisemode = '';}
$noisevars = Array();
$noisevars['noisetime'] = $noisetime;
$noisevars['noisepls'] = $noisepls;
$noisevars['noiseid'] = $noiseid;
$noisevars['noiseid2'] = $noiseid2;
$noisevars['noisemode'] = $noisemode;
$noisevars = json_encode($noisevars,JSON_UNESCAPED_UNICODE);
$nginfo = array();
foreach(array('hdamage','hplayer','noisevars') as $nval){
$nginfo[$nval] = $$nval;
}
$db->array_update("{$tablepre}game",$nginfo,1);
/*$combatinfo = "<?php\n\nif(!defined('IN_GAME')){exit('Access Denied');}\n\n\$hdamage = {$hdamage};\n\$hplayer = '{$hplayer}';\n\$noisetime = {$noisetime};\n\$noisepls = {$noisepls};\n\$noiseid = {$noiseid};\n\$noiseid2 = {$noiseid2};\n\$noisemode = '{$noisemode}';\n\n?>";
//$combatinfo = "{$hdamage},{$hplayer},{$noisetime},{$noisepls},{$noiseid},{$noiseid2},{$noisemode},\n";
$dir = GAME_ROOT.'./gamedata/';
if($fp = fopen("{$dir}combatinfo.php", 'w')) {
......@@ -375,7 +400,7 @@ function save_combatinfo(){
fclose($fp);
} else {
gexit('Can not write to cache files, please check directory ./gamedata/ .', __file__, __line__);
}
}*/
return;
}
......@@ -845,6 +870,26 @@ function middle_abbr($str,$len1,$len2=1,$elli='...') {
return mb_substr($str,0,$len1).$elli.mb_substr($str,-$len2,$len2);
}
//兼容5.3以下php的json_encode()
function json_encode_comp($par){
if(version_compare(PHP_VERSION,'5.4.0')>=0){ //可以使用json_encode()的JSON_UNESCAPED_UNICODE常量
return json_encode($par,JSON_UNESCAPED_UNICODE);
}else{ //不可以使用JSON_UNESCAPED_UNICODE,用url_encode()处理
return urldecode(json_encode(url_encode($par)));
}
}
function url_encode($str) {
if(is_array($str)) {
foreach($str as $key=>$value) {
$str[urlencode($key)] = url_encode($value);
}
} else {
$str = urlencode($str);
}
return $str;
}
//mb_strlen()兼容替代函数,直接照抄的网络
if ( !function_exists('mb_strlen') ) {
function mb_strlen ($text, $encode='UTF-8') {
......
......@@ -20,14 +20,9 @@ if(!$db->num_rows($query))
$sql = str_replace("\r", "\n", str_replace('bra_', ' '.$tablepre, $sql));
$db->queries($sql);
echo "Mysql Update Fish.<br>";
}
else
{
echo "No Update.<br>";
}
$vcdir = config('queue_vnmixitem',1);
if(file_exists($vcdir))
{
$vcdir = config('queue_vnmixitem',1);
if(file_exists($vcdir))
{
include $vcdir;
foreach($carr as $key => $arr)
{
......@@ -47,6 +42,11 @@ if(file_exists($vcdir))
$db->array_insert("{$tablepre}vnmixitem",$vr);
}
echo "Old data clear.<br>";
}
}
else
{
echo "No Update.<br>";
}
?>
\ 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