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
1f2831de
Commit
1f2831de
authored
May 27, 2023
by
Nemo Ma
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Revert "feat: 完善前端接口""
This reverts commit
e625568c
.
parent
e625568c
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
125 additions
and
7 deletions
+125
-7
api.php
api.php
+8
-0
end.php
end.php
+8
-1
game.php
game.php
+1
-1
include/global.func.php
include/global.func.php
+9
-2
index.php
index.php
+40
-1
valid.php
valid.php
+59
-2
No files found.
api.php
View file @
1f2831de
...
@@ -395,6 +395,7 @@
...
@@ -395,6 +395,7 @@
);
);
}
}
echo
(
json_encode
(
array
(
echo
(
json_encode
(
array
(
"page"
=>
"game"
,
/** 玩家状态 */
/** 玩家状态 */
"playerState"
=>
array
(
"playerState"
=>
array
(
/** 玩家信息 */
/** 玩家信息 */
...
@@ -697,6 +698,13 @@
...
@@ -697,6 +698,13 @@
"radar"
=>
$radarscreen
,
"radar"
=>
$radarscreen
,
/** 元素口袋 */
/** 元素口袋 */
"element"
=>
$club
==
20
?
getElement
()
:
null
,
"element"
=>
$club
==
20
?
getElement
()
:
null
,
/** 死亡信息 */
"death"
=>
$hp
<=
0
?
array
(
"title"
=>
$stateinfo
[
$state
],
"content"
=>
$dinfo
[
$state
],
"time"
=>
$dtime
,
"name"
=>
(
!
empty
(
$kname
)
&&
(
in_array
(
$state
,
Array
(
20
,
21
,
22
,
23
,
24
,
28
,
29
))))
?
$kname
:
null
,
)
:
null
,
),
),
/** 搜寻状态 */
/** 搜寻状态 */
"searchState"
=>
array
(
"searchState"
=>
array
(
...
...
end.php
View file @
1f2831de
...
@@ -33,7 +33,14 @@ if($hp<=0 || $state>=10) {
...
@@ -33,7 +33,14 @@ if($hp<=0 || $state>=10) {
}
}
}
}
include
template
(
'ending'
);
if
(
$udata
[
'u_templateid'
]
==
1
&&
!
strstr
(
$_SERVER
[
'HTTP_REFERER'
],
'php'
)
&&
$_SERVER
[
'HTTP_REFERER'
]
!=
''
)
{
echo
json_encode
(
array
(
"page"
=>
"end"
,
"title"
=>
$stateinfo
[
$state
],
));
}
else
{
include
template
(
'ending'
);
}
?>
?>
\ No newline at end of file
game.php
View file @
1f2831de
...
@@ -16,7 +16,7 @@ if(isset($mode) && $mode == 'quit') {
...
@@ -16,7 +16,7 @@ if(isset($mode) && $mode == 'quit') {
}
}
//$result = $db->query("SELECT * FROM {$tablepre}players WHERE name = '$cuser' AND type = 0");
//$result = $db->query("SELECT * FROM {$tablepre}players WHERE name = '$cuser' AND type = 0");
$pdata
=
fetch_playerdata_by_name
(
$cuser
);
$pdata
=
fetch_playerdata_by_name
(
$cuser
);
if
(
!
$pdata
)
{
header
(
"Location: valid.php"
);
exit
();
}
if
(
!
$pdata
)
{
header
(
"Location: valid.php"
.
'?'
.
$_SERVER
[
'QUERY_STRING'
]
);
exit
();
}
//$pdata = $db->fetch_array($result);
//$pdata = $db->fetch_array($result);
if
(
$pdata
[
'pass'
]
!=
$cpass
)
{
if
(
$pdata
[
'pass'
]
!=
$cpass
)
{
...
...
include/global.func.php
View file @
1f2831de
...
@@ -30,8 +30,15 @@ function gameerrorhandler($code, $msg, $file, $line){
...
@@ -30,8 +30,15 @@ function gameerrorhandler($code, $msg, $file, $line){
function
gexit
(
$message
=
''
,
$file
=
''
,
$line
=
0
)
{
function
gexit
(
$message
=
''
,
$file
=
''
,
$line
=
0
)
{
global
$charset
,
$title
,
$extrahead
,
$allowcsscache
,
$errorinfo
;
global
$charset
,
$title
,
$extrahead
,
$allowcsscache
,
$errorinfo
;
global
$gameversion
,
$cuser
,
$cpass
;
global
$gameversion
,
$cuser
,
$cpass
;
include
template
(
'error'
);
if
(
$_GET
[
'is_new'
])
{
exit
();
echo
json_encode
(
array
(
"error"
=>
$message
,
));
exit
();
}
else
{
include
template
(
'error'
);
exit
();
}
}
}
function
output
(
$content
=
''
)
{
function
output
(
$content
=
''
)
{
...
...
index.php
View file @
1f2831de
...
@@ -57,7 +57,46 @@ if(!empty($roomact))
...
@@ -57,7 +57,46 @@ if(!empty($roomact))
}
}
else
else
{
{
include
template
(
'index'
);
if
(
$_GET
[
'is_new'
])
{
echo
json_encode
(
array
(
// 当前回合数
"num"
=>
$gamenum
,
// 当前游戏状态
"state"
=>
$gstate
[
$gamestate
],
// 当前游戏时间
"timing"
=>
$timing
,
// 显示当前游戏时间
"showNowTime"
=>
$gamestate
>
10
,
// 显示下局游戏时间
"showNextTime"
=>
$starttime
>
$now
,
// 最高伤害玩家
"maxDamagePlayer"
=>
$hplayer
,
// 最高伤害值
"maxDamage"
=>
$hdamage
,
// 上局结果
"lastResult"
=>
$gwin
[
$winmode
],
// 上局优胜者
"lastWinner"
=>
$winner
,
// 禁区
"areaHour"
=>
$areahour
,
"areaLimit"
=>
$arealimit
,
"areaAdd"
=>
$areaadd
,
"areaNum"
=>
$areanum
,
// 自动逃避禁区
"areaAutoHide"
=>
$areaesc
&&
$gamestate
<
40
,
// 人数
"validNum"
=>
$validnum
,
"aliveNum"
=>
$alivenum
,
"deathNum"
=>
$deathnum
,
// 当前房间号:
"roomID"
=>
$groomid
,
// 用户名
"username"
=>
$cuser
,
));
return
;
}
else
{
include
template
(
'index'
);
}
}
}
?>
?>
...
...
valid.php
View file @
1f2831de
...
@@ -284,7 +284,27 @@ if($mode == 'enter') {
...
@@ -284,7 +284,27 @@ if($mode == 'enter') {
save_gameinfo
();
save_gameinfo
();
include
template
(
'validover'
);
if
(
$_GET
[
'is_new'
])
{
echo
json_encode
(
array
(
"page"
=>
"validOver"
,
"nick"
=>
$nickinfo
,
"name"
=>
$cuser
,
"sub"
=>
$sexinfo
[
$gd
]
.
$sNo
.
'号'
,
"avatar"
=>
$gd
.
'_'
.
$icon
.
'.gif'
,
"nowHp"
=>
$hp
,
"maxHp"
=>
$mhp
,
"nowMp"
=>
$sp
,
"maxMp"
=>
$msp
,
"attack"
=>
$att
,
"defense"
=>
$def
,
"gift"
=>
$clubinfo
[
$club
],
"weapon"
=>
$wep
,
"randomItem1"
=>
$itm
[
3
],
"randomItem2"
=>
$itm
[
4
],
));
}
else
{
include
template
(
'validover'
);
}
}
elseif
(
$mode
==
'notice'
)
{
}
elseif
(
$mode
==
'notice'
)
{
//include template('notice');
//include template('notice');
header
(
"Location: game.php"
);
header
(
"Location: game.php"
);
...
@@ -305,7 +325,44 @@ if($mode == 'enter') {
...
@@ -305,7 +325,44 @@ if($mode == 'enter') {
$iconarray
=
get_iconlist
(
$icon
);
$iconarray
=
get_iconlist
(
$icon
);
$utlist
=
get_utitlelist
();
$utlist
=
get_utitlelist
();
$select_icon
=
$icon
;
$select_icon
=
$icon
;
include
template
(
'valid'
);
if
(
$_GET
[
'is_new'
])
{
// 获取可选称号
$nickList
=
array_map
(
function
(
$val
)
use
(
$titles_list
)
{
return
array
(
'id'
=>
$val
,
'title'
=>
$titles_list
[
$val
]
);
},
$nicksrev
[
'nicks'
]);
// 获取可选普通内定称号
$normalGiftList
=
array_map
(
function
(
$val
)
use
(
$clubinfo
)
{
return
array
(
'id'
=>
$val
,
'title'
=>
$clubinfo
[
$val
]
);
},
$t2_list
);
// 获取可选特殊内定称号
$specialGiftList
=
array_map
(
function
(
$val
)
use
(
$clubinfo
)
{
return
array
(
'id'
=>
$val
,
'title'
=>
$clubinfo
[
$val
]
);
},
$t1_list
);
echo
json_encode
(
array
(
"page"
=>
"valid"
,
"name"
=>
$username
,
// 用户名
"avatar"
=>
$select_icon
,
// 头像
"gender"
=>
$gender
,
// 性别
"nick"
=>
$udata
[
'nick'
],
// 头衔
"nickList"
=>
$nickList
,
// 可选头衔
"normalGiftList"
=>
$normalGiftList
,
// 可选普通内定称号
"specialGiftList"
=>
$specialGiftList
,
// 可选特殊内定称号
"motto"
=>
$motto
,
// 口头禅
"killMessage"
=>
$killmsg
,
// 杀人宣言
"lastWord"
=>
$lastword
,
// 遗言
));
}
else
{
include
template
(
'valid'
);
}
}
}
function
makeclub
()
{
function
makeclub
()
{
...
...
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