Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
phpdts
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nemo Ma
phpdts
Commits
24c6b605
Commit
24c6b605
authored
Mar 28, 2023
by
hisuinohoshi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
开发相关: - combatinfo相关内容现在直接保存在数据库里,不再使用文件保存(需要dbup);
parent
c76eb7e1
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
107 additions
and
56 deletions
+107
-56
command.php
command.php
+2
-2
dbup.php
dbup.php
+24
-0
game.php
game.php
+2
-2
gamedata/sql/all.sql
gamedata/sql/all.sql
+3
-1
include/common.inc.php
include/common.inc.php
+1
-1
include/game/itembag.func.php
include/game/itembag.func.php
+0
-19
include/game/itemmain.func.php
include/game/itemmain.func.php
+1
-2
include/global.func.php
include/global.func.php
+51
-6
vndbup.php
vndbup.php
+23
-23
No files found.
command.php
View file @
24c6b605
...
...
@@ -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>"
;
}
}
...
...
dbup.php
View file @
24c6b605
...
...
@@ -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
game.php
View file @
24c6b605
...
...
@@ -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
){
...
...
gamedata/sql/all.sql
View file @
24c6b605
...
...
@@ -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'
,
...
...
include/common.inc.php
View file @
24c6b605
...
...
@@ -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
();
...
...
include/game/itembag.func.php
View file @
24c6b605
...
...
@@ -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
(){
...
...
include/game/itemmain.func.php
View file @
24c6b605
...
...
@@ -1393,9 +1393,8 @@ function reload_set_items(&$pa)
if
(
!
empty
(
$pa
[
'clbpara'
][
'setitems'
]))
{
# TODO:失去对应的套装效果
$pa
[
'clbpara'
][
'setitems'
]
=
Array
();
}
$pa
[
'clbpara'
][
'setitems'
]
=
Array
();
$set_items
=
get_set_items
();
$equip_list
=
get_equip_list
();
# 遍历身上的装备信息 检查是否为套装的组成部分
...
...
include/global.func.php
View file @
24c6b605
...
...
@@ -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\n
if(!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'
)
{
...
...
vndbup.php
View file @
24c6b605
...
...
@@ -20,33 +20,33 @@ 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
))
{
include
$vcdir
;
foreach
(
$carr
as
$key
=>
$arr
)
$vcdir
=
config
(
'queue_vnmixitem'
,
1
);
if
(
file_exists
(
$vcdir
))
{
$vr
=
Array
();
$vr
[
'class'
]
=
$arr
[
'class'
]
?:
'item'
;
$vr
[
'istatus'
]
=
$arr
[
'status'
];
$vr
[
'creator'
]
=
$arr
[
'name'
];
for
(
$i
=
0
;
$i
<
5
;
$i
++
)
include
$vcdir
;
foreach
(
$carr
as
$key
=>
$arr
)
{
$vr
[
'stf'
.
$i
]
=
$arr
[
'stuff'
][
$i
]
?:
''
;
$vr
=
Array
();
$vr
[
'class'
]
=
$arr
[
'class'
]
?:
'item'
;
$vr
[
'istatus'
]
=
$arr
[
'status'
];
$vr
[
'creator'
]
=
$arr
[
'name'
];
for
(
$i
=
0
;
$i
<
5
;
$i
++
)
{
$vr
[
'stf'
.
$i
]
=
$arr
[
'stuff'
][
$i
]
?:
''
;
}
$vr
[
'itm'
]
=
$arr
[
'result'
][
0
]
?:
''
;
$vr
[
'itmk'
]
=
$arr
[
'result'
][
1
]
?:
''
;
$vr
[
'itme'
]
=
$arr
[
'result'
][
2
]
?:
''
;
$vr
[
'itms'
]
=
$arr
[
'result'
][
3
]
?:
''
;
$vr
[
'itmsk'
]
=
$arr
[
'result'
][
4
]
?
implode
(
''
,
$arr
[
'result'
][
4
])
:
''
;
$db
->
array_insert
(
"
{
$tablepre
}
vnmixitem"
,
$vr
);
}
$vr
[
'itm'
]
=
$arr
[
'result'
][
0
]
?:
''
;
$vr
[
'itmk'
]
=
$arr
[
'result'
][
1
]
?:
''
;
$vr
[
'itme'
]
=
$arr
[
'result'
][
2
]
?:
''
;
$vr
[
'itms'
]
=
$arr
[
'result'
][
3
]
?:
''
;
$vr
[
'itmsk'
]
=
$arr
[
'result'
][
4
]
?
implode
(
''
,
$arr
[
'result'
][
4
])
:
''
;
$db
->
array_insert
(
"
{
$tablepre
}
vnmixitem"
,
$vr
);
echo
"Old data clear.<br>"
;
}
echo
"Old data clear.<br>"
;
}
else
{
echo
"No Update.<br>"
;
}
?>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment