Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
S
srvpro
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
nanahira
srvpro
Commits
ff8cf381
Commit
ff8cf381
authored
Apr 03, 2021
by
nanahira
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'mc'
parents
d9fc3b46
bef24b52
Pipeline
#3120
passed with stages
in 5 minutes and 15 seconds
Changes
2
Pipelines
2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
125 additions
and
215 deletions
+125
-215
ygopro-server.coffee
ygopro-server.coffee
+48
-90
ygopro-server.js
ygopro-server.js
+77
-125
No files found.
ygopro-server.coffee
View file @
ff8cf381
...
...
@@ -1803,6 +1803,48 @@ class Room
))
await
return
join_post_watch
:
(
client
)
->
if
@
duel_stage
!=
ygopro
.
constants
.
DUEL_STAGE
.
BEGIN
if
settings
.
modules
.
cloud_replay
.
enable_halfway_watch
and
!
@
hostinfo
.
no_watch
client
.
setTimeout
(
300000
)
#连接后超时5分钟
client
.
rid
=
_
.
indexOf
(
ROOM_all
,
this
)
client
.
is_post_watcher
=
true
if
settings
.
modules
.
vip
.
enabled
and
await
CLIENT_check_vip
(
client
)
playWords
=
await
dataManager
.
getUserWords
(
CLIENT_get_authorize_key
(
client
))
if
playWords
@
playLines
(
playWords
)
else
if
settings
.
modules
.
words
.
enabled
and
words
.
words
[
client
.
name
]
@
playLines
words
.
words
[
client
.
name
][
Math
.
floor
(
Math
.
random
()
*
words
.
words
[
client
.
name
].
length
)]
ygopro
.
stoc_send_chat_to_room
(
this
,
"
#{
client
.
name
}
${watch_join}"
)
@
watchers
.
push
client
ygopro
.
stoc_send_chat
(
client
,
"${watch_watching}"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
)
for
buffer
in
@
watcher_buffers
client
.
write
buffer
return
true
else
ygopro
.
stoc_die
(
client
,
"${watch_denied}"
)
return
false
else
return
false
join_player
:
(
client
)
->
if
@
error
ygopro
.
stoc_die
(
client
,
@
error
)
return
false
if
@
duel_stage
!=
ygopro
.
constants
.
DUEL_STAGE
.
BEGIN
return
@
join_post_watch
(
client
)
if
@
hostinfo
.
no_watch
and
@
players
.
length
>=
(
if
@
hostinfo
.
mode
==
2
then
4
else
2
)
ygopro
.
stoc_die
(
client
,
"${watch_denied_room}"
)
return
true
if
@
challonge_info
for
player
in
@
get_playing_player
()
when
player
and
player
!=
client
and
player
.
challonge_info
.
id
==
client
.
challonge_info
.
id
ygopro
.
stoc_die
(
client
,
"${challonge_player_already_in}"
)
return
false
client
.
setTimeout
(
300000
)
#连接后超时5分钟
client
.
rid
=
_
.
indexOf
(
ROOM_all
,
this
)
@
connect
(
client
)
return
true
playLines
:
(
lines
)
->
for
line
in
_
.
lines
lines
ygopro
.
stoc_send_chat_to_room
(
this
,
line
,
ygopro
.
constants
.
COLORS
.
PINK
)
...
...
@@ -2243,33 +2285,8 @@ ygopro.ctos_follow 'JOIN_GAME', true, (buffer, info, client, server, datas)->
if
!
room
ygopro
.
stoc_die
(
client
,
"${server_full}"
)
else
if
room
.
error
ygopro
.
stoc_die
(
client
,
room
.
error
)
else
if
room
.
duel_stage
!=
ygopro
.
constants
.
DUEL_STAGE
.
BEGIN
if
settings
.
modules
.
cloud_replay
.
enable_halfway_watch
and
!
room
.
hostinfo
.
no_watch
client
.
setTimeout
(
300000
)
#连接后超时5分钟
client
.
rid
=
_
.
indexOf
(
ROOM_all
,
room
)
client
.
is_post_watcher
=
true
if
settings
.
modules
.
vip
.
enabled
and
await
CLIENT_check_vip
(
client
)
playWords
=
await
dataManager
.
getUserWords
(
CLIENT_get_authorize_key
(
client
))
if
playWords
room
.
playLines
(
playWords
)
else
if
settings
.
modules
.
words
.
enabled
and
words
.
words
[
client
.
name
]
room
.
playLines
words
.
words
[
client
.
name
][
Math
.
floor
(
Math
.
random
()
*
words
.
words
[
client
.
name
].
length
)]
ygopro
.
stoc_send_chat_to_room
(
room
,
"
#{
client
.
name
}
${watch_join}"
)
room
.
watchers
.
push
client
ygopro
.
stoc_send_chat
(
client
,
"${watch_watching}"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
)
for
buffer
in
room
.
watcher_buffers
client
.
write
buffer
else
ygopro
.
stoc_die
(
client
,
"${watch_denied}"
)
else
if
room
.
hostinfo
.
no_watch
and
room
.
players
.
length
>=
(
if
room
.
hostinfo
.
mode
==
2
then
4
else
2
)
ygopro
.
stoc_die
(
client
,
"${watch_denied_room}"
)
else
#client.room = room
client
.
setTimeout
(
300000
)
#连接后超时5分钟
client
.
rid
=
_
.
indexOf
(
ROOM_all
,
room
)
room
.
connect
(
client
)
room
.
join_player
(
client
)
return
_async
.
auto
({
...
...
@@ -2369,15 +2386,8 @@ ygopro.ctos_follow 'JOIN_GAME', true, (buffer, info, client, server, datas)->
buffer
=
struct
.
buffer
pre_room
=
ROOM_find_by_name
(
info
.
pass
)
if
pre_room
and
pre_room
.
duel_stage
!=
ygopro
.
constants
.
DUEL_STAGE
.
BEGIN
and
settings
.
modules
.
cloud_replay
.
enable_halfway_watch
and
!
pre_room
.
hostinfo
.
no_watch
room
=
pre_room
client
.
setTimeout
(
300000
)
#连接后超时5分钟
client
.
rid
=
_
.
indexOf
(
ROOM_all
,
room
)
client
.
is_post_watcher
=
true
ygopro
.
stoc_send_chat_to_room
(
room
,
"
#{
client
.
name
}
${watch_join}"
)
room
.
watchers
.
push
client
ygopro
.
stoc_send_chat
(
client
,
"${watch_watching}"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
)
for
buffer
in
room
.
watcher_buffers
client
.
write
buffer
pre_room
.
join_post_watch
(
client
)
return
else
ygopro
.
stoc_send_chat
(
client
,
'${loading_user_info}'
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
)
client
.
setTimeout
(
300000
)
#连接后超时5分钟
...
...
@@ -2434,36 +2444,8 @@ ygopro.ctos_follow 'JOIN_GAME', true, (buffer, info, client, server, datas)->
room
.
welcome
=
"${challonge_match_created}"
if
!
room
ygopro
.
stoc_die
(
client
,
"${server_full}"
)
else
if
room
.
error
ygopro
.
stoc_die
(
client
,
room
.
error
)
else
if
room
.
duel_stage
!=
ygopro
.
constants
.
DUEL_STAGE
.
BEGIN
if
settings
.
modules
.
cloud_replay
.
enable_halfway_watch
and
!
room
.
hostinfo
.
no_watch
#client.setTimeout(300000) #连接后超时5分钟
client
.
rid
=
_
.
indexOf
(
ROOM_all
,
room
)
client
.
is_post_watcher
=
true
if
settings
.
modules
.
vip
.
enabled
and
await
CLIENT_check_vip
(
client
)
playWords
=
await
dataManager
.
getUserWords
(
CLIENT_get_authorize_key
(
client
))
if
playWords
room
.
playLines
(
playWords
)
else
if
settings
.
modules
.
words
.
enabled
and
words
.
words
[
client
.
name
]
room
.
playLines
words
.
words
[
client
.
name
][
Math
.
floor
(
Math
.
random
()
*
words
.
words
[
client
.
name
].
length
)]
ygopro
.
stoc_send_chat_to_room
(
room
,
"
#{
client
.
name
}
${watch_join}"
)
room
.
watchers
.
push
client
ygopro
.
stoc_send_chat
(
client
,
"${watch_watching}"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
)
for
buffer
in
room
.
watcher_buffers
client
.
write
buffer
else
ygopro
.
stoc_die
(
client
,
"${watch_denied}"
)
else
if
room
.
hostinfo
.
no_watch
and
room
.
players
.
length
>=
(
if
room
.
hostinfo
.
mode
==
2
then
4
else
2
)
ygopro
.
stoc_die
(
client
,
"${watch_denied_room}"
)
else
for
player
in
room
.
get_playing_player
()
when
player
and
player
!=
client
and
player
.
challonge_info
.
id
==
client
.
challonge_info
.
id
ygopro
.
stoc_die
(
client
,
"${challonge_player_already_in}"
)
return
#client.room = room
#client.setTimeout(300000) #连接后超时5分钟
client
.
rid
=
_
.
indexOf
(
ROOM_all
,
room
)
room
.
connect
(
client
)
room
.
join_player
(
client
)
return
)
...
...
@@ -2510,32 +2492,8 @@ ygopro.ctos_follow 'JOIN_GAME', true, (buffer, info, client, server, datas)->
room
=
await
ROOM_find_or_create_by_name
(
info
.
pass
,
client
.
ip
)
if
!
room
ygopro
.
stoc_die
(
client
,
"${server_full}"
)
else
if
room
.
error
ygopro
.
stoc_die
(
client
,
room
.
error
)
else
if
room
.
duel_stage
!=
ygopro
.
constants
.
DUEL_STAGE
.
BEGIN
if
settings
.
modules
.
cloud_replay
.
enable_halfway_watch
and
!
room
.
hostinfo
.
no_watch
client
.
setTimeout
(
300000
)
#连接后超时5分钟
client
.
rid
=
_
.
indexOf
(
ROOM_all
,
room
)
client
.
is_post_watcher
=
true
if
settings
.
modules
.
vip
.
enabled
and
await
CLIENT_check_vip
(
client
)
playWords
=
await
dataManager
.
getUserWords
(
CLIENT_get_authorize_key
(
client
))
if
playWords
room
.
playLines
(
playWords
)
else
if
settings
.
modules
.
words
.
enabled
and
words
.
words
[
client
.
name
]
room
.
playLines
words
.
words
[
client
.
name
][
Math
.
floor
(
Math
.
random
()
*
words
.
words
[
client
.
name
].
length
)]
ygopro
.
stoc_send_chat_to_room
(
room
,
"
#{
client
.
name
}
${watch_join}"
)
room
.
watchers
.
push
client
ygopro
.
stoc_send_chat
(
client
,
"${watch_watching}"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
)
for
buffer
in
room
.
watcher_buffers
client
.
write
buffer
else
ygopro
.
stoc_die
(
client
,
"${watch_denied}"
)
else
if
room
.
hostinfo
.
no_watch
and
room
.
players
.
length
>=
(
if
room
.
hostinfo
.
mode
==
2
then
4
else
2
)
ygopro
.
stoc_die
(
client
,
"${watch_denied_room}"
)
else
client
.
setTimeout
(
300000
)
#连接后超时5分钟
client
.
rid
=
_
.
indexOf
(
ROOM_all
,
room
)
room
.
connect
(
client
)
room
.
join_player
(
client
)
await
return
ygopro
.
stoc_follow
'JOIN_GAME'
,
false
,
(
buffer
,
info
,
client
,
server
,
datas
)
->
...
...
ygopro-server.js
View file @
ff8cf381
This diff is collapsed.
Click to expand it.
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