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
a14632fc
Commit
a14632fc
authored
Apr 04, 2020
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change to async.auto
parent
bbbd3f43
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
27 deletions
+26
-27
ygopro-server.coffee
ygopro-server.coffee
+7
-9
ygopro-server.js
ygopro-server.js
+19
-18
No files found.
ygopro-server.coffee
View file @
a14632fc
...
...
@@ -2122,31 +2122,29 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server, datas)->
else
ygopro
.
stoc_send_chat
(
client
,
'${loading_user_info}'
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
)
client
.
setTimeout
(
300000
)
#连接后超时5分钟
_async
.
parallel
([
(
done
)
->
_async
.
auto
({
participant_data
:
(
done
)
->
challonge
.
participants
.
_index
({
id
:
settings
.
modules
.
challonge
.
tournament_id
,
callback
:
done
})
return
,
(
done
)
->
match_data
:
(
done
)
->
challonge
.
matches
.
_index
({
id
:
settings
.
modules
.
challonge
.
tournament_id
,
callback
:
done
})
return
]
,
(
err
,
datas
)
->
}
,
(
err
,
datas
)
->
if
client
.
closed
return
participant_data
=
datas
[
0
]
match_data
=
datas
[
1
]
if
err
or
!
participant_data
or
!
match_data
if
err
or
!
datas
.
participant_data
or
!
datas
.
match_data
log
.
warn
(
"Failed loading Challonge user info"
,
err
)
ygopro
.
stoc_die
(
client
,
'${challonge_match_load_failed}'
)
return
found
=
false
for
k
,
user
of
participant_data
for
k
,
user
of
datas
.
participant_data
if
user
.
participant
and
user
.
participant
.
name
and
deck_name_match
(
user
.
participant
.
name
,
client
.
name
)
found
=
user
.
participant
break
...
...
@@ -2155,7 +2153,7 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server, datas)->
return
client
.
challonge_info
=
found
found
=
false
for
k
,
match
of
match_data
for
k
,
match
of
datas
.
match_data
if
match
and
match
.
match
and
!
match
.
match
.
winnerId
and
match
.
match
.
state
!=
"complete"
and
match
.
match
.
player1Id
and
match
.
match
.
player2Id
and
(
match
.
match
.
player1Id
==
client
.
challonge_info
.
id
or
match
.
match
.
player2Id
==
client
.
challonge_info
.
id
)
found
=
match
.
match
break
...
...
ygopro-server.js
View file @
a14632fc
...
...
@@ -2670,33 +2670,33 @@
}
else
{
ygopro
.
stoc_send_chat
(
client
,
'
${loading_user_info}
'
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
);
client
.
setTimeout
(
300000
);
_async
.
parallel
([
function
(
done
)
{
_async
.
auto
({
participant_data
:
function
(
done
)
{
challonge
.
participants
.
_index
({
id
:
settings
.
modules
.
challonge
.
tournament_id
,
callback
:
done
});
},
function
(
done
)
{
},
match_data
:
function
(
done
)
{
challonge
.
matches
.
_index
({
id
:
settings
.
modules
.
challonge
.
tournament_id
,
callback
:
done
});
}
]
,
function
(
err
,
datas
)
{
var
found
,
k
,
len3
,
len4
,
match
,
match_data
,
n
,
o
,
participant_data
,
player
,
ref3
,
ref4
,
user
;
}
,
function
(
err
,
datas
)
{
var
found
,
k
,
len3
,
len4
,
match
,
n
,
o
,
player
,
ref3
,
ref4
,
ref5
,
ref6
,
user
;
if
(
client
.
closed
)
{
return
;
}
participant_data
=
datas
[
0
];
match_data
=
datas
[
1
];
if
(
err
||
!
participant_data
||
!
match_data
)
{
if
(
err
||
!
datas
.
participant_data
||
!
datas
.
match_data
)
{
log
.
warn
(
"
Failed loading Challonge user info
"
,
err
);
ygopro
.
stoc_die
(
client
,
'
${challonge_match_load_failed}
'
);
return
;
}
found
=
false
;
for
(
k
in
participant_data
)
{
user
=
participant_data
[
k
];
ref3
=
datas
.
participant_data
;
for
(
k
in
ref3
)
{
user
=
ref3
[
k
];
if
(
user
.
participant
&&
user
.
participant
.
name
&&
deck_name_match
(
user
.
participant
.
name
,
client
.
name
))
{
found
=
user
.
participant
;
break
;
...
...
@@ -2708,8 +2708,9 @@
}
client
.
challonge_info
=
found
;
found
=
false
;
for
(
k
in
match_data
)
{
match
=
match_data
[
k
];
ref4
=
datas
.
match_data
;
for
(
k
in
ref4
)
{
match
=
ref4
[
k
];
if
(
match
&&
match
.
match
&&
!
match
.
match
.
winnerId
&&
match
.
match
.
state
!==
"
complete
"
&&
match
.
match
.
player1Id
&&
match
.
match
.
player2Id
&&
(
match
.
match
.
player1Id
===
client
.
challonge_info
.
id
||
match
.
match
.
player2Id
===
client
.
challonge_info
.
id
))
{
found
=
match
.
match
;
break
;
...
...
@@ -2735,9 +2736,9 @@
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
);
ref
3
=
room
.
watcher_buffers
;
for
(
n
=
0
,
len3
=
ref
3
.
length
;
n
<
len3
;
n
++
)
{
buffer
=
ref
3
[
n
];
ref
5
=
room
.
watcher_buffers
;
for
(
n
=
0
,
len3
=
ref
5
.
length
;
n
<
len3
;
n
++
)
{
buffer
=
ref
5
[
n
];
client
.
write
(
buffer
);
}
}
else
{
...
...
@@ -2746,9 +2747,9 @@
}
else
if
(
room
.
hostinfo
.
no_watch
&&
room
.
players
.
length
>=
(
room
.
hostinfo
.
mode
===
2
?
4
:
2
))
{
ygopro
.
stoc_die
(
client
,
"
${watch_denied_room}
"
);
}
else
{
ref
4
=
room
.
get_playing_player
();
for
(
o
=
0
,
len4
=
ref
4
.
length
;
o
<
len4
;
o
++
)
{
player
=
ref
4
[
o
];
ref
6
=
room
.
get_playing_player
();
for
(
o
=
0
,
len4
=
ref
6
.
length
;
o
<
len4
;
o
++
)
{
player
=
ref
6
[
o
];
if
(
!
(
player
&&
player
!==
client
&&
player
.
challonge_info
.
id
===
client
.
challonge_info
.
id
))
{
continue
;
}
...
...
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