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
1715fd24
Commit
1715fd24
authored
Apr 02, 2023
by
Nemo Ma
Committed by
GitHub
Apr 02, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #106 from hikawiier/waaagh
update roommng
parents
3d9f048d
aade25b9
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
128 additions
and
39 deletions
+128
-39
admin.php
admin.php
+1
-0
dbup.php
dbup.php
+0
-12
gamedata/cache/style_20190718.css
gamedata/cache/style_20190718.css
+0
-2
include/admin/admin.lang.php
include/admin/admin.lang.php
+2
-0
include/admin/roommng.php
include/admin/roommng.php
+21
-0
include/common.inc.php
include/common.inc.php
+11
-17
include/roommng.func.php
include/roommng.func.php
+61
-0
include/system.func.php
include/system.func.php
+2
-1
index.php
index.php
+10
-2
templates/default/admin_menu.htm
templates/default/admin_menu.htm
+5
-0
templates/default/index.htm
templates/default/index.htm
+3
-0
templates/default/itemmix_tips.htm
templates/default/itemmix_tips.htm
+8
-0
templates/default/roomlist.htm
templates/default/roomlist.htm
+4
-5
No files found.
admin.php
View file @
1715fd24
...
@@ -19,6 +19,7 @@ $admin_cmd_list = Array(
...
@@ -19,6 +19,7 @@ $admin_cmd_list = Array(
'pcmng'
=>
5
,
'pcmng'
=>
5
,
'npcmng'
=>
5
,
'npcmng'
=>
5
,
'gameinfomng'
=>
5
,
'gameinfomng'
=>
5
,
'roommng'
=>
5
,
'antiAFKmng'
=>
4
,
'antiAFKmng'
=>
4
,
'templates_clean'
=>
4
,
'templates_clean'
=>
4
,
);
);
...
...
dbup.php
View file @
1715fd24
...
@@ -192,18 +192,6 @@ if(!$db->num_rows($result))
...
@@ -192,18 +192,6 @@ if(!$db->num_rows($result))
$db
->
query
(
"ALTER TABLE
{
$gtablepre
}
game ADD noisevars varchar(1000) NOT NULL DEFAULT '' AFTER gamevars"
);
$db
->
query
(
"ALTER TABLE
{
$gtablepre
}
game ADD noisevars varchar(1000) NOT NULL DEFAULT '' AFTER gamevars"
);
echo
"向game表中添加了字段noisevars<br>"
;
echo
"向game表中添加了字段noisevars<br>"
;
}
}
$result
=
$db
->
query
(
"DESCRIBE
{
$gtablepre
}
game groomid"
);
if
(
!
$db
->
num_rows
(
$result
))
{
$db
->
query
(
"ALTER TABLE
{
$gtablepre
}
game ADD groomid tinyint(3) unsigned NOT NULL DEFAULT '0' '' AFTER gamestate"
);
echo
"向game表中添加了字段groomid<br>"
;
}
$result
=
$db
->
query
(
"DESCRIBE
{
$gtablepre
}
game groomnums"
);
if
(
!
$db
->
num_rows
(
$result
))
{
$db
->
query
(
"ALTER TABLE
{
$gtablepre
}
game ADD groomnums tinyint(3) unsigned NOT NULL DEFAULT '0' AFTER groomid"
);
echo
"向game表中添加了字段groomnums<br>"
;
}
echo
"Update Fish.<br>"
;
echo
"Update Fish.<br>"
;
?>
?>
\ No newline at end of file
gamedata/cache/style_20190718.css
View file @
1715fd24
...
@@ -76,7 +76,6 @@ table.dialogue {
...
@@ -76,7 +76,6 @@ table.dialogue {
}
}
table
.infotable
{
table
.infotable
{
float
:
left
;
margin-top
:
10px
;
margin-top
:
10px
;
position
:
relative
;
position
:
relative
;
text-align
:
center
;
text-align
:
center
;
...
@@ -85,7 +84,6 @@ table.infotable {
...
@@ -85,7 +84,6 @@ table.infotable {
}
}
table
.infotable
td
,
table
.infotable
td
,
table
.infotable
th
{
table
.infotable
th
{
text-align
:
center
;
border
:
1px
solid
rgba
(
225
,
124
,
226
,
0.4
);
border
:
1px
solid
rgba
(
225
,
124
,
226
,
0.4
);
}
}
...
...
include/admin/admin.lang.php
View file @
1715fd24
...
@@ -255,6 +255,8 @@ $lang = array
...
@@ -255,6 +255,8 @@ $lang = array
'gamecheck_comment'
=>
'修正游戏人数异常和移动下拉框消失的功能'
,
'gamecheck_comment'
=>
'修正游戏人数异常和移动下拉框消失的功能'
,
'templates_clean'
=>
'清空模板缓存'
,
'templates_clean'
=>
'清空模板缓存'
,
'templates_clean_comment'
=>
'清空已生成的模板缓存文件'
,
'templates_clean_comment'
=>
'清空已生成的模板缓存文件'
,
'roommng'
=>
'临时性房间管理'
,
'roommng_comment'
=>
'强制关闭指定编号的房间<br>不能关闭0号大房间(临时功能)'
,
'pcmng'
=>
'玩家数据管理'
,
'pcmng'
=>
'玩家数据管理'
,
'pcmng_comment'
=>
'修改当前局玩家的各数值,不影响帐号'
,
'pcmng_comment'
=>
'修改当前局玩家的各数值,不影响帐号'
,
...
...
include/admin/roommng.php
0 → 100644
View file @
1715fd24
<?php
if
(
!
defined
(
'IN_ADMIN'
))
{
exit
(
'Access Denied'
);
}
if
(
$command
==
'killroom'
)
{
roommng_close_room
(
$roomkey
,
1
);
$command
=
''
;
}
echo
<<<EOT
<form method="post" name="roommng" onsubmit="admin.php">
<input type="hidden" name="mode" value="roommng">
<input type="hidden" name="command" value="killroom">
强制关闭<input type="number" name="roomkey" value=1 min="1" max="{$max_rooms}">号房间<br>
<input type="submit" value="关闭"><br>
</form>
EOT;
?>
\ No newline at end of file
include/common.inc.php
View file @
1715fd24
...
@@ -10,10 +10,6 @@ if(version_compare(PHP_VERSION, '4.3.0', '<')) {
...
@@ -10,10 +10,6 @@ if(version_compare(PHP_VERSION, '4.3.0', '<')) {
exit
(
'PHP version must >= 4.3.0!'
);
exit
(
'PHP version must >= 4.3.0!'
);
}
}
require
GAME_ROOT
.
'./include/global.func.php'
;
require
GAME_ROOT
.
'./include/global.func.php'
;
require
GAME_ROOT
.
'./include/init.func.php'
;
require
GAME_ROOT
.
'./include/resources.func.php'
;
require
GAME_ROOT
.
'./include/game/revclubskills.func.php'
;
require
GAME_ROOT
.
'./include/game/dice.func.php'
;
error_reporting
(
E_ALL
);
error_reporting
(
E_ALL
);
set_error_handler
(
'gameerrorhandler'
);
set_error_handler
(
'gameerrorhandler'
);
$magic_quotes_gpc
=
false
;
$magic_quotes_gpc
=
false
;
...
@@ -46,6 +42,11 @@ $db->connect($dbhost, $dbuser, $dbpw, $dbname, $pconnect);
...
@@ -46,6 +42,11 @@ $db->connect($dbhost, $dbuser, $dbpw, $dbname, $pconnect);
unset
(
$dbhost
,
$dbuser
,
$dbpw
,
$dbname
,
$pconnect
);
unset
(
$dbhost
,
$dbuser
,
$dbpw
,
$dbname
,
$pconnect
);
require
GAME_ROOT
.
'./gamedata/system.php'
;
require
GAME_ROOT
.
'./gamedata/system.php'
;
require
GAME_ROOT
.
'./include/init.func.php'
;
require
GAME_ROOT
.
'./include/resources.func.php'
;
require
GAME_ROOT
.
'./include/roommng.func.php'
;
require
GAME_ROOT
.
'./include/game/revclubskills.func.php'
;
require
GAME_ROOT
.
'./include/game/dice.func.php'
;
require
config
(
'resources'
,
$gamecfg
);
require
config
(
'resources'
,
$gamecfg
);
require
config
(
'gamecfg'
,
$gamecfg
);
require
config
(
'gamecfg'
,
$gamecfg
);
require
config
(
'combatcfg'
,
$gamecfg
);
require
config
(
'combatcfg'
,
$gamecfg
);
...
@@ -55,25 +56,19 @@ require config('audio',$gamecfg);
...
@@ -55,25 +56,19 @@ require config('audio',$gamecfg);
require
config
(
'tooltip'
,
$gamecfg
);
require
config
(
'tooltip'
,
$gamecfg
);
$gtablepre
=
$tablepre
;
$gtablepre
=
$tablepre
;
# 检查game表是否需要补缺
roommng_verify_db_game_structure
();
ob_start
();
ob_start
();
$cuser
=
&
$
{
$tablepre
.
'user'
};
$cuser
=
&
$
{
$
g
tablepre
.
'user'
};
$cpass
=
&
$
{
$tablepre
.
'pass'
};
$cpass
=
&
$
{
$
g
tablepre
.
'pass'
};
$roomlist
=
Array
();
$roomlist
=
Array
();
$result
=
$db
->
query
(
"SELECT * FROM
{
$gtablepre
}
game WHERE groomid>0"
);
$result
=
$db
->
query
(
"SELECT * FROM
{
$gtablepre
}
game WHERE groomid>0"
);
while
(
$roominfo
=
$db
->
fetch_array
(
$result
))
while
(
$roominfo
=
$db
->
fetch_array
(
$result
))
{
{
# 房间内没有人时自动关闭房间
$roomlist
[
$roominfo
[
'groomid'
]]
=
$roominfo
;
if
(
!
$roominfo
[
'groomnums'
])
{
$db
->
query
(
"DELETE FROM
{
$gtablepre
}
game WHERE groomid =
{
$roominfo
[
'groomid'
]
}
"
);
}
else
{
$roomlist
[
$roominfo
[
'groomid'
]]
=
$roominfo
;
}
}
}
if
(
$cuser
)
if
(
$cuser
)
...
@@ -81,7 +76,6 @@ if($cuser)
...
@@ -81,7 +76,6 @@ if($cuser)
$tr
=
$db
->
query
(
"SELECT * FROM
{
$gtablepre
}
users WHERE username='
$cuser
'"
);
$tr
=
$db
->
query
(
"SELECT * FROM
{
$gtablepre
}
users WHERE username='
$cuser
'"
);
$tp
=
$db
->
fetch_array
(
$tr
);
$tp
=
$db
->
fetch_array
(
$tr
);
}
}
$rid
=
isset
(
$tp
[
'roomid'
])
?
$tp
[
'roomid'
]
:
0
;
$rid
=
isset
(
$tp
[
'roomid'
])
?
$tp
[
'roomid'
]
:
0
;
$groomid
=
$rid
;
$groomid
=
$rid
;
...
@@ -91,7 +85,7 @@ if(!empty($rid))
...
@@ -91,7 +85,7 @@ if(!empty($rid))
if
(
!
$db
->
num_rows
(
$result
))
if
(
!
$db
->
num_rows
(
$result
))
{
{
$gr
=
$db
->
query
(
"SELECT gamenum FROM
{
$gtablepre
}
game WHERE groomid=0"
);
$gr
=
$db
->
query
(
"SELECT gamenum FROM
{
$gtablepre
}
game WHERE groomid=0"
);
$gnums
=
$db
->
fetch_array
(
$gr
)[
0
]
+
$rid
;
$gnums
=
$db
->
result
(
$result
,
0
)
+
$rid
;
$starttime
=
$now
+
$startmin
*
5
;
$starttime
=
$now
+
$startmin
*
5
;
$db
->
query
(
"INSERT INTO
{
$gtablepre
}
game (gamenum,groomid,groomnums,gamestate,starttime) VALUES ('
$gnums
','
$rid
','1','0','
$starttime
')"
);
$db
->
query
(
"INSERT INTO
{
$gtablepre
}
game (gamenum,groomid,groomnums,gamestate,starttime) VALUES ('
$gnums
','
$rid
','1','0','
$starttime
')"
);
}
}
...
...
include/roommng.func.php
View file @
1715fd24
...
@@ -4,6 +4,67 @@ if(!defined('IN_GAME')) {
...
@@ -4,6 +4,67 @@ if(!defined('IN_GAME')) {
exit
(
'Access Denied'
);
exit
(
'Access Denied'
);
}
}
function
roommng_verify_db_game_structure
()
{
global
$db
,
$gtablepre
;
$result
=
$db
->
query
(
"DESCRIBE
{
$gtablepre
}
users roomid"
);
if
(
!
$db
->
num_rows
(
$result
))
{
$db
->
query
(
"ALTER TABLE
{
$gtablepre
}
users ADD roomid tinyint(3) unsigned NOT NULL DEFAULT '0' AFTER groupid"
);
echo
"向users表中添加了字段roomid<br>"
;
}
$result
=
$db
->
query
(
"DESCRIBE
{
$gtablepre
}
game groomid"
);
if
(
!
$db
->
num_rows
(
$result
))
{
$db
->
query
(
"ALTER TABLE
{
$gtablepre
}
game ADD groomid tinyint(3) unsigned NOT NULL DEFAULT '0' '' AFTER gamestate"
);
echo
"向game表中添加了字段groomid<br>"
;
}
$result
=
$db
->
query
(
"DESCRIBE
{
$gtablepre
}
game groomnums"
);
if
(
!
$db
->
num_rows
(
$result
))
{
$db
->
query
(
"ALTER TABLE
{
$gtablepre
}
game ADD groomnums tinyint(3) unsigned NOT NULL DEFAULT '0' AFTER groomid"
);
echo
"向game表中添加了字段groomnums<br>"
;
}
$result
=
$db
->
query
(
"SHOW INDEX FROM
{
$gtablepre
}
game"
);
$gr
=
$db
->
fetch_array
(
$result
);
if
(
$gr
[
'Column_name'
]
!=
'groomid'
)
{
$db
->
query
(
"ALTER TABLE`
{
$gtablepre
}
game` DROP PRIMARY KEY"
);
$db
->
query
(
"ALTER TABLE`
{
$gtablepre
}
game` ADD PRIMARY KEY (`groomid`)"
);
echo
"将game表的索引变更为groomid<br>"
;
}
return
;
}
function
roommng_close_room
(
$rkey
,
$log_print
=
0
)
{
global
$db
,
$gtablepre
;
if
(
!
$rkey
)
{
echo
"不能关闭大房间!<br>"
;
return
;
}
$result
=
$db
->
query
(
"SELECT * FROM
{
$gtablepre
}
game WHERE groomid='
$rkey
'"
);
if
(
$db
->
num_rows
(
$result
))
{
$gdata
=
$db
->
fetch_array
(
$result
);
# 清空房间内玩家
if
(
$gdata
[
'groomnums'
])
$db
->
query
(
"UPDATE
{
$gtablepre
}
users SET roomid = 0 WHERE roomid=
{
$rkey
}
"
);
# 关闭房间
$db
->
query
(
"DELETE FROM
{
$gtablepre
}
game WHERE groomid =
{
$rkey
}
"
);
if
(
$log_print
)
echo
"已关闭房间
{
$rkey
}
号<br>"
;
}
else
{
if
(
$log_print
)
echo
"房间
{
$rkey
}
未开启,或房间不存在!<br>"
;
}
}
?>
?>
include/system.func.php
View file @
1715fd24
...
@@ -272,8 +272,9 @@ function rs_game($mode = 0) {
...
@@ -272,8 +272,9 @@ function rs_game($mode = 0) {
$qry
=
''
;
$qry
=
''
;
foreach
(
$shoplist
as
$lst
){
foreach
(
$shoplist
as
$lst
){
if
(
!
empty
(
$lst
)
&&
strpos
(
$lst
,
','
)
!==
false
){
if
(
!
empty
(
$lst
)
&&
strpos
(
$lst
,
','
)
!==
false
){
$lst
=
explode
(
','
,
$lst
);
if
(
empty
(
$lst
[
8
]))
$lst
[
8
]
=
''
;
if
(
empty
(
$lst
[
8
]))
$lst
[
8
]
=
''
;
list
(
$kind
,
$num
,
$price
,
$area
,
$item
,
$itmk
,
$itme
,
$itms
,
$itmsk
)
=
explode
(
','
,
$lst
)
;
list
(
$kind
,
$num
,
$price
,
$area
,
$item
,
$itmk
,
$itme
,
$itms
,
$itmsk
)
=
$lst
;
if
(
$kind
!=
0
){
if
(
$kind
!=
0
){
$qry
.=
"('
$kind
','
$num
','
$price
','
$area
','
$item
','
$itmk
','
$itme
','
$itms
','
$itmsk
'),"
;
$qry
.=
"('
$kind
','
$num
','
$price
','
$area
','
$item
','
$itmk
','
$itme
','
$itms
','
$itmsk
'),"
;
}
}
...
...
index.php
View file @
1715fd24
...
@@ -55,10 +55,18 @@ if(!empty($roomact))
...
@@ -55,10 +55,18 @@ if(!empty($roomact))
if
(
empty
(
$udata
[
'roomid'
]))
gexit
(
'你没有在任何房间里!'
,
__file__
,
__line__
);
if
(
empty
(
$udata
[
'roomid'
]))
gexit
(
'你没有在任何房间里!'
,
__file__
,
__line__
);
$result
=
$db
->
query
(
"SELECT groomnums FROM
{
$gtablepre
}
game WHERE groomid =
{
$udata
[
'roomid'
]
}
"
);
$result
=
$db
->
query
(
"SELECT groomnums FROM
{
$gtablepre
}
game WHERE groomid =
{
$udata
[
'roomid'
]
}
"
);
if
(
$db
->
num_rows
(
$result
))
if
(
$db
->
num_rows
(
$result
))
{
{
$join_nums
=
$db
->
result
(
$result
,
0
);
$join_nums
=
$db
->
result
(
$result
,
0
);
$join_nums
--
;
$join_nums
--
;
$db
->
query
(
"UPDATE
{
$gtablepre
}
game SET groomnums =
{
$join_nums
}
WHERE groomid =
{
$udata
[
'roomid'
]
}
"
);
# 退出房间时,检查是关闭房间还是减少房间内人数
if
(
$join_nums
>
0
)
{
$db
->
query
(
"UPDATE
{
$gtablepre
}
game SET groomnums =
{
$join_nums
}
WHERE groomid =
{
$udata
[
'roomid'
]
}
"
);
}
else
{
roommng_close_room
(
$udata
[
'roomid'
]);
}
}
}
$db
->
query
(
"UPDATE
{
$gtablepre
}
users SET roomid = 0 WHERE username='
$cuser
'"
);
$db
->
query
(
"UPDATE
{
$gtablepre
}
users SET roomid = 0 WHERE username='
$cuser
'"
);
unset
(
$roomact
);
unset
(
$roomact
);
...
...
templates/default/admin_menu.htm
View file @
1715fd24
...
@@ -91,6 +91,11 @@
...
@@ -91,6 +91,11 @@
<td>
$lang['templates_clean_comment']
</td>
<td>
$lang['templates_clean_comment']
</td>
<td>
$admin_cmd_list['templates_clean']
</td>
<td>
$admin_cmd_list['templates_clean']
</td>
</tr>
</tr>
<tr
height=
"45px"
>
<td><input
type=
"submit"
style=
"width:100;height:40;"
value=
"$lang['roommng']"
onclick=
"$('command').value='roommng'"
<!
--
{
if
$
mygroup
<
$
admin_cmd_list
['
roommng
']}
--
>
disabled="true"
<!--{/if}-->
>
</td>
<td>
$lang['roommng_comment']
</td>
<td>
$admin_cmd_list['roommng']
</td>
</tr>
</table>
</table>
</td>
</td>
</tr>
</tr>
...
...
templates/default/index.htm
View file @
1715fd24
...
@@ -14,6 +14,9 @@
...
@@ -14,6 +14,9 @@
</span>
</span>
<br>
<br>
<span
class=
"evergreen"
>
<span
class=
"evergreen"
>
<span
class=
"evergreen"
>
当前房间列表:
<input
type=
"button"
value=
"点击查看房间列表"
onclick=
"showModalDialog($('roomlist'));"
>
<div
style=
"height:5px;"
>
</div>
{template roomlist}
{template roomlist}
</span>
</span>
</td>
</td>
...
...
templates/default/itemmix_tips.htm
View file @
1715fd24
...
@@ -27,6 +27,14 @@
...
@@ -27,6 +27,14 @@
<!--{/if}-->
<!--{/if}-->
<!--{elseif $itemcmd == 'elementmix'}-->
<!--{elseif $itemcmd == 'elementmix'}-->
<style>
<style>
table
.infotable
{
float
:
left
;
margin-top
:
10px
;
position
:
relative
;
text-align
:
center
;
border-radius
:
3px
;
border
:
2px
solid
rgba
(
225
,
124
,
226
,
0.25
);
}
table
.infotable
th
{
table
.infotable
th
{
width
:
55px
;
width
:
55px
;
text-align
:
center
;
text-align
:
center
;
...
...
templates/default/roomlist.htm
View file @
1715fd24
<span
class=
"evergreen"
>
当前房间列表:
<br>
(房间状态更新可能存在延迟,如果发现房间状态不对请刷新几次)
</span><br>
<dialog
id=
"roomlist"
style=
"max-width: 90%;max-height: 80%; text-align: left;"
>
<span
class=
"evergreen"
>
当前房间列表:
<br><span
class=
"grey"
>
房间状态更新可能存在延迟
<br>
如果发现房间状态不对请刷新几次
</span></span><br>
<div
style=
"height:5px;"
>
</div>
<div
style=
"height:5px;"
>
</div>
<form
method=
"post"
name=
"roomact"
onsubmit=
"return false;"
>
<form
method=
"post"
name=
"roomact"
onsubmit=
"return false;"
>
<input
type=
"hidden"
name=
"roomact"
id=
"roomact"
value=
""
>
<input
type=
"hidden"
name=
"roomact"
id=
"roomact"
value=
""
>
<div
class=
"scroll-pane-roomlist"
style=
"width:520px;max-height:300px;"
>
<table
CellSpacing=
0
CellPadding=
0
class=
"infotable"
>
<table
CellSpacing=
0
CellPadding=
0
class=
"infotable"
>
<tr>
<tr>
<td
class=
"b1"
width=
"60px"
>
编号
</td>
<td
class=
"b1"
width=
"60px"
>
编号
</td>
...
@@ -52,6 +51,6 @@
...
@@ -52,6 +51,6 @@
</tr>
</tr>
<!--{/loop}-->
<!--{/loop}-->
</table>
</table>
</div>
</form>
</form>
<div
style=
"height:5px;"
>
</div>
<img
class=
"dialog-background"
src=
"img/profile.gif"
onclick=
"closeDialog($('roomlist'))"
>
\ No newline at end of file
</dialog>
\ 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