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
d0155124
Commit
d0155124
authored
Jun 23, 2018
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test
parent
4077e873
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
33 deletions
+45
-33
data/i18n.json
data/i18n.json
+2
-0
ygopro-server.coffee
ygopro-server.coffee
+16
-14
ygopro-server.js
ygopro-server.js
+27
-19
No files found.
data/i18n.json
View file @
d0155124
...
@@ -142,6 +142,7 @@
...
@@ -142,6 +142,7 @@
"challonge_match_not_found"
:
"Your current match was not found."
,
"challonge_match_not_found"
:
"Your current match was not found."
,
"challonge_match_already_finished"
:
"Your current match was already finished. Please call the judge for any help."
,
"challonge_match_already_finished"
:
"Your current match was already finished. Please call the judge for any help."
,
"challonge_match_created"
:
"A room for match only is created. Your opponent will join in automatically."
,
"challonge_match_created"
:
"A room for match only is created. Your opponent will join in automatically."
,
"challonge_player_already_in"
:
"Please do not enter the room you are already in."
,
"athletic_arena_tip"
:
"During an athletic match, a game quit behavior is regarded as a surrender."
"athletic_arena_tip"
:
"During an athletic match, a game quit behavior is regarded as a surrender."
},
},
"es-es"
:
{
"es-es"
:
{
...
@@ -424,6 +425,7 @@
...
@@ -424,6 +425,7 @@
"challonge_match_not_found"
:
"你没有当前轮次的比赛。"
,
"challonge_match_not_found"
:
"你没有当前轮次的比赛。"
,
"challonge_match_already_finished"
:
"你在当前轮次的比赛已经结束,如需重赛,请联系裁判。"
,
"challonge_match_already_finished"
:
"你在当前轮次的比赛已经结束,如需重赛,请联系裁判。"
,
"challonge_match_created"
:
"已建立比赛专用房间,将会自动匹配你的对手。"
,
"challonge_match_created"
:
"已建立比赛专用房间,将会自动匹配你的对手。"
,
"challonge_player_already_in"
:
"请不要重复加入比赛房间。"
,
"athletic_arena_tip"
:
"在竞技匹配中,比赛开始前退出游戏也会视为投降。"
"athletic_arena_tip"
:
"在竞技匹配中,比赛开始前退出游戏也会视为投降。"
},
},
"ko-kr"
:
{
"ko-kr"
:
{
...
...
ygopro-server.coffee
View file @
d0155124
...
@@ -453,7 +453,7 @@ release_disconnect = (dinfo, reconnected) ->
...
@@ -453,7 +453,7 @@ release_disconnect = (dinfo, reconnected) ->
return
return
CLIENT_get_authorize_key
=
(
client
)
->
CLIENT_get_authorize_key
=
(
client
)
->
if
settings
.
modules
.
mycard
.
enabled
or
settings
.
modules
.
tournament_mode
.
enabled
or
client
.
is_local
if
settings
.
modules
.
mycard
.
enabled
or
settings
.
modules
.
tournament_mode
.
enabled
or
settings
.
modules
.
challonge
.
enabled
or
client
.
is_local
return
client
.
name
return
client
.
name
else
else
return
client
.
ip
+
":"
+
client
.
name
return
client
.
ip
+
":"
+
client
.
name
...
@@ -825,11 +825,11 @@ class Room
...
@@ -825,11 +825,11 @@ class Room
#else
#else
# log.info 'SCORE POST OK', response.statusCode, response.statusMessage, @name, body
# log.info 'SCORE POST OK', response.statusCode, response.statusMessage, @name, body
return
return
if
settings
.
modules
.
challonge
.
enabled
if
settings
.
modules
.
challonge
.
enabled
and
@
started
challonge
.
matches
.
update
({
challonge
.
matches
.
update
({
id
:
settings
.
modules
.
challonge
.
tournament_id
,
id
:
settings
.
modules
.
challonge
.
tournament_id
,
matchId
:
room
.
challonge_info
.
id
,
matchId
:
@
challonge_info
.
id
,
match
:
room
.
challonge_duel_log
,
match
:
@
challonge_duel_log
,
callback
:
(
err
,
data
)
->
callback
:
(
err
,
data
)
->
if
err
if
err
log
.
warn
(
"Errored pushing scores to Challonge."
,
err
)
log
.
warn
(
"Errored pushing scores to Challonge."
,
err
)
...
@@ -1480,22 +1480,21 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)->
...
@@ -1480,22 +1480,21 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)->
challonge
.
participants
.
index
({
challonge
.
participants
.
index
({
id
:
settings
.
modules
.
challonge
.
tournament_id
,
id
:
settings
.
modules
.
challonge
.
tournament_id
,
callback
:
(
err
,
data
)
->
callback
:
(
err
,
data
)
->
log
.
info
(
"user info"
,
client
.
name
,
data
)
if
err
or
!
data
if
err
or
!
data
if
err
if
err
log
.
warn
(
"Failed loading Challonge user info"
,
err
)
log
.
warn
(
"Failed loading Challonge user info"
,
err
)
ygopro
.
stoc_die
(
client
,
'${challonge_match_load_failed}'
)
ygopro
.
stoc_die
(
client
,
'${challonge_match_load_failed}'
)
return
return
found
=
false
found
=
false
for
user
in
data
for
k
,
user
of
data
if
user
.
participant
.
name
==
client
.
name
if
user
.
participant
and
user
.
participant
.
name
==
client
.
name
found
=
user
.
participant
found
=
user
.
participant
break
break
if
!
found
if
!
found
ygopro
.
stoc_die
(
client
,
'${challonge_user_not_found}'
)
ygopro
.
stoc_die
(
client
,
'${challonge_user_not_found}'
)
return
return
client
.
challonge_info
=
found
client
.
challonge_info
=
found
challonge
.
participant
s
.
index
({
challonge
.
matche
s
.
index
({
id
:
settings
.
modules
.
challonge
.
tournament_id
,
id
:
settings
.
modules
.
challonge
.
tournament_id
,
callback
:
(
err
,
data
)
->
callback
:
(
err
,
data
)
->
if
err
or
!
data
if
err
or
!
data
...
@@ -1504,10 +1503,10 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)->
...
@@ -1504,10 +1503,10 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)->
ygopro
.
stoc_die
(
client
,
'${challonge_match_load_failed}'
)
ygopro
.
stoc_die
(
client
,
'${challonge_match_load_failed}'
)
return
return
found
=
false
found
=
false
for
match
in
data
for
k
,
match
of
data
if
data
.
match
.
player1_id
==
client
.
challonge_info
.
id
or
data
.
match
.
player2_id
==
client
.
challonge_info
.
id
if
match
and
match
.
match
and
(
match
.
match
.
player1Id
==
client
.
challonge_info
.
id
or
match
.
match
.
player2Id
==
client
.
challonge_info
.
id
)
found
=
data
.
match_list
found
=
match
.
match
break
break
if
!
found
if
!
found
ygopro
.
stoc_die
(
client
,
'${challonge_match_not_found}'
)
ygopro
.
stoc_die
(
client
,
'${challonge_match_not_found}'
)
return
return
...
@@ -1536,6 +1535,9 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)->
...
@@ -1536,6 +1535,9 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)->
else
else
ygopro
.
stoc_die
(
client
,
"${watch_denied}"
)
ygopro
.
stoc_die
(
client
,
"${watch_denied}"
)
else
else
for
player
in
room
.
players
when
player
and
player
!=
client
and
player
.
name
==
client
.
name
ygopro
.
stoc_die
(
client
,
"${challonge_player_already_in}"
)
return
#client.room = room
#client.room = room
client
.
setTimeout
(
300000
)
#连接后超时5分钟
client
.
setTimeout
(
300000
)
#连接后超时5分钟
client
.
rid
=
_
.
indexOf
(
ROOM_all
,
room
)
client
.
rid
=
_
.
indexOf
(
ROOM_all
,
room
)
...
@@ -2515,9 +2517,9 @@ ygopro.stoc_follow 'REPLAY', true, (buffer, info, client, server)->
...
@@ -2515,9 +2517,9 @@ ygopro.stoc_follow 'REPLAY', true, (buffer, info, client, server)->
room
.
challonge_duel_log
.
winnerId
=
room
.
dueling_players
[
1
].
challonge_info
.
id
room
.
challonge_duel_log
.
winnerId
=
room
.
dueling_players
[
1
].
challonge_info
.
id
else
else
room
.
challonge_duel_log
.
winnerId
=
"tie"
room
.
challonge_duel_log
.
winnerId
=
"tie"
if
room
.
challonge_duel_log
.
winnerId
==
room
.
challonge_info
.
player1
_i
d
if
room
.
challonge_duel_log
.
winnerId
==
room
.
challonge_info
.
player1
I
d
room
.
challonge_duel_log
.
scoresCsv
=
"1-0"
room
.
challonge_duel_log
.
scoresCsv
=
"1-0"
else
if
room
.
challonge_duel_log
.
winnerId
==
room
.
challonge_info
.
player2
_i
d
else
if
room
.
challonge_duel_log
.
winnerId
==
room
.
challonge_info
.
player2
I
d
room
.
challonge_duel_log
.
scoresCsv
=
"0-1"
room
.
challonge_duel_log
.
scoresCsv
=
"0-1"
else
else
room
.
challonge_duel_log
.
scoresCsv
=
"0-0"
room
.
challonge_duel_log
.
scoresCsv
=
"0-0"
...
...
ygopro-server.js
View file @
d0155124
...
@@ -586,7 +586,7 @@
...
@@ -586,7 +586,7 @@
};
};
CLIENT_get_authorize_key
=
function
(
client
)
{
CLIENT_get_authorize_key
=
function
(
client
)
{
if
(
settings
.
modules
.
mycard
.
enabled
||
settings
.
modules
.
tournament_mode
.
enabled
||
client
.
is_local
)
{
if
(
settings
.
modules
.
mycard
.
enabled
||
settings
.
modules
.
tournament_mode
.
enabled
||
settings
.
modules
.
challonge
.
enabled
||
client
.
is_local
)
{
return
client
.
name
;
return
client
.
name
;
}
else
{
}
else
{
return
client
.
ip
+
"
:
"
+
client
.
name
;
return
client
.
ip
+
"
:
"
+
client
.
name
;
...
@@ -1066,11 +1066,11 @@
...
@@ -1066,11 +1066,11 @@
})(
this
));
})(
this
));
}
}
}
}
if
(
settings
.
modules
.
challonge
.
enabled
)
{
if
(
settings
.
modules
.
challonge
.
enabled
&&
this
.
started
)
{
challonge
.
matches
.
update
({
challonge
.
matches
.
update
({
id
:
settings
.
modules
.
challonge
.
tournament_id
,
id
:
settings
.
modules
.
challonge
.
tournament_id
,
matchId
:
room
.
challonge_info
.
id
,
matchId
:
this
.
challonge_info
.
id
,
match
:
room
.
challonge_duel_log
,
match
:
this
.
challonge_duel_log
,
callback
:
function
(
err
,
data
)
{
callback
:
function
(
err
,
data
)
{
if
(
err
)
{
if
(
err
)
{
log
.
warn
(
"
Errored pushing scores to Challonge.
"
,
err
);
log
.
warn
(
"
Errored pushing scores to Challonge.
"
,
err
);
...
@@ -1808,8 +1808,7 @@
...
@@ -1808,8 +1808,7 @@
challonge
.
participants
.
index
({
challonge
.
participants
.
index
({
id
:
settings
.
modules
.
challonge
.
tournament_id
,
id
:
settings
.
modules
.
challonge
.
tournament_id
,
callback
:
function
(
err
,
data
)
{
callback
:
function
(
err
,
data
)
{
var
found
,
len4
,
o
,
user
;
var
found
,
k
,
user
;
log
.
info
(
"
user info
"
,
client
.
name
,
data
);
if
(
err
||
!
data
)
{
if
(
err
||
!
data
)
{
if
(
err
)
{
if
(
err
)
{
log
.
warn
(
"
Failed loading Challonge user info
"
,
err
);
log
.
warn
(
"
Failed loading Challonge user info
"
,
err
);
...
@@ -1818,9 +1817,9 @@
...
@@ -1818,9 +1817,9 @@
return
;
return
;
}
}
found
=
false
;
found
=
false
;
for
(
o
=
0
,
len4
=
data
.
length
;
o
<
len4
;
o
++
)
{
for
(
k
in
data
)
{
user
=
data
[
o
];
user
=
data
[
k
];
if
(
user
.
participant
.
name
===
client
.
name
)
{
if
(
user
.
participant
&&
user
.
participant
.
name
===
client
.
name
)
{
found
=
user
.
participant
;
found
=
user
.
participant
;
break
;
break
;
}
}
...
@@ -1830,10 +1829,10 @@
...
@@ -1830,10 +1829,10 @@
return
;
return
;
}
}
client
.
challonge_info
=
found
;
client
.
challonge_info
=
found
;
challonge
.
participant
s
.
index
({
challonge
.
matche
s
.
index
({
id
:
settings
.
modules
.
challonge
.
tournament_id
,
id
:
settings
.
modules
.
challonge
.
tournament_id
,
callback
:
function
(
err
,
data
)
{
callback
:
function
(
err
,
data
)
{
var
len
5
,
len6
,
match
,
p
,
q
,
ref4
;
var
len
4
,
len5
,
match
,
o
,
p
,
player
,
ref4
,
ref5
;
if
(
err
||
!
data
)
{
if
(
err
||
!
data
)
{
if
(
err
)
{
if
(
err
)
{
log
.
warn
(
"
Failed loading Challonge match info
"
,
err
);
log
.
warn
(
"
Failed loading Challonge match info
"
,
err
);
...
@@ -1842,10 +1841,10 @@
...
@@ -1842,10 +1841,10 @@
return
;
return
;
}
}
found
=
false
;
found
=
false
;
for
(
p
=
0
,
len5
=
data
.
length
;
p
<
len5
;
p
++
)
{
for
(
k
in
data
)
{
match
=
data
[
p
];
match
=
data
[
k
];
if
(
data
.
match
.
player1_id
===
client
.
challonge_info
.
id
||
data
.
match
.
player2_id
===
client
.
challonge_info
.
id
)
{
if
(
match
&&
match
.
match
&&
(
match
.
match
.
player1Id
===
client
.
challonge_info
.
id
||
match
.
match
.
player2Id
===
client
.
challonge_info
.
id
)
)
{
found
=
data
.
match_list
;
found
=
match
.
match
;
break
;
break
;
}
}
}
}
...
@@ -1876,14 +1875,23 @@
...
@@ -1876,14 +1875,23 @@
room
.
watchers
.
push
(
client
);
room
.
watchers
.
push
(
client
);
ygopro
.
stoc_send_chat
(
client
,
"
${watch_watching}
"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
);
ygopro
.
stoc_send_chat
(
client
,
"
${watch_watching}
"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
);
ref4
=
room
.
watcher_buffers
;
ref4
=
room
.
watcher_buffers
;
for
(
q
=
0
,
len6
=
ref4
.
length
;
q
<
len6
;
q
++
)
{
for
(
o
=
0
,
len4
=
ref4
.
length
;
o
<
len4
;
o
++
)
{
buffer
=
ref4
[
q
];
buffer
=
ref4
[
o
];
client
.
write
(
buffer
);
client
.
write
(
buffer
);
}
}
}
else
{
}
else
{
ygopro
.
stoc_die
(
client
,
"
${watch_denied}
"
);
ygopro
.
stoc_die
(
client
,
"
${watch_denied}
"
);
}
}
}
else
{
}
else
{
ref5
=
room
.
players
;
for
(
p
=
0
,
len5
=
ref5
.
length
;
p
<
len5
;
p
++
)
{
player
=
ref5
[
p
];
if
(
!
(
player
&&
player
!==
client
&&
player
.
name
===
client
.
name
))
{
continue
;
}
ygopro
.
stoc_die
(
client
,
"
${challonge_player_already_in}
"
);
return
;
}
client
.
setTimeout
(
300000
);
client
.
setTimeout
(
300000
);
client
.
rid
=
_
.
indexOf
(
ROOM_all
,
room
);
client
.
rid
=
_
.
indexOf
(
ROOM_all
,
room
);
room
.
connect
(
client
);
room
.
connect
(
client
);
...
@@ -3167,9 +3175,9 @@
...
@@ -3167,9 +3175,9 @@
}
else
{
}
else
{
room
.
challonge_duel_log
.
winnerId
=
"
tie
"
;
room
.
challonge_duel_log
.
winnerId
=
"
tie
"
;
}
}
if
(
room
.
challonge_duel_log
.
winnerId
===
room
.
challonge_info
.
player1
_i
d
)
{
if
(
room
.
challonge_duel_log
.
winnerId
===
room
.
challonge_info
.
player1
I
d
)
{
room
.
challonge_duel_log
.
scoresCsv
=
"
1-0
"
;
room
.
challonge_duel_log
.
scoresCsv
=
"
1-0
"
;
}
else
if
(
room
.
challonge_duel_log
.
winnerId
===
room
.
challonge_info
.
player2
_i
d
)
{
}
else
if
(
room
.
challonge_duel_log
.
winnerId
===
room
.
challonge_info
.
player2
I
d
)
{
room
.
challonge_duel_log
.
scoresCsv
=
"
0-1
"
;
room
.
challonge_duel_log
.
scoresCsv
=
"
0-1
"
;
}
else
{
}
else
{
room
.
challonge_duel_log
.
scoresCsv
=
"
0-0
"
;
room
.
challonge_duel_log
.
scoresCsv
=
"
0-0
"
;
...
...
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