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
58be6d33
Commit
58be6d33
authored
May 27, 2023
by
Nemo Ma
Committed by
GitHub
May 27, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #165 from luluxia/nachster
feat: 完善前端接口
parents
f17786aa
c125298a
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 @
58be6d33
...
...
@@ -395,6 +395,7 @@
);
}
echo
(
json_encode
(
array
(
"page"
=>
"game"
,
/** 玩家状态 */
"playerState"
=>
array
(
/** 玩家信息 */
...
...
@@ -697,6 +698,13 @@
"radar"
=>
$radarscreen
,
/** 元素口袋 */
"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
(
...
...
end.php
View file @
58be6d33
...
...
@@ -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 @
58be6d33
...
...
@@ -16,7 +16,7 @@ if(isset($mode) && $mode == 'quit') {
}
//$result = $db->query("SELECT * FROM {$tablepre}players WHERE name = '$cuser' AND type = 0");
$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);
if
(
$pdata
[
'pass'
]
!=
$cpass
)
{
...
...
include/global.func.php
View file @
58be6d33
...
...
@@ -30,8 +30,15 @@ function gameerrorhandler($code, $msg, $file, $line){
function
gexit
(
$message
=
''
,
$file
=
''
,
$line
=
0
)
{
global
$charset
,
$title
,
$extrahead
,
$allowcsscache
,
$errorinfo
;
global
$gameversion
,
$cuser
,
$cpass
;
include
template
(
'error'
);
exit
();
if
(
$_GET
[
'is_new'
])
{
echo
json_encode
(
array
(
"error"
=>
$message
,
));
exit
();
}
else
{
include
template
(
'error'
);
exit
();
}
}
function
output
(
$content
=
''
)
{
...
...
index.php
View file @
58be6d33
...
...
@@ -57,7 +57,46 @@ if(!empty($roomact))
}
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 @
58be6d33
...
...
@@ -284,7 +284,27 @@ if($mode == 'enter') {
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'
)
{
//include template('notice');
header
(
"Location: game.php"
);
...
...
@@ -305,7 +325,44 @@ if($mode == 'enter') {
$iconarray
=
get_iconlist
(
$icon
);
$utlist
=
get_utitlelist
();
$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
()
{
...
...
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