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
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
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
MyCard
srvpro
Commits
64bef582
Commit
64bef582
authored
Nov 11, 2018
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update challonge post
parent
5f70c694
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
67 additions
and
60 deletions
+67
-60
ygopro-server.coffee
ygopro-server.coffee
+31
-28
ygopro-server.js
ygopro-server.js
+36
-32
No files found.
ygopro-server.coffee
View file @
64bef582
...
@@ -814,8 +814,6 @@ class Room
...
@@ -814,8 +814,6 @@ class Room
@
duel_count
=
0
@
duel_count
=
0
@
death
=
0
@
death
=
0
@
turn
=
0
@
turn
=
0
if
settings
.
modules
.
challonge
.
enabled
@
challonge_duel_log
=
{}
ROOM_all
.
push
this
ROOM_all
.
push
this
@
hostinfo
||=
JSON
.
parse
(
JSON
.
stringify
(
settings
.
hostinfo
))
@
hostinfo
||=
JSON
.
parse
(
JSON
.
stringify
(
settings
.
hostinfo
))
...
@@ -994,11 +992,11 @@ class Room
...
@@ -994,11 +992,11 @@ class Room
# 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
and
@
started
and
!
@
kicked
if
settings
.
modules
.
challonge
.
enabled
and
@
started
and
@
hostinfo
.
mode
!=
2
and
!
@
kicked
challonge
.
matches
.
update
({
challonge
.
matches
.
update
({
id
:
settings
.
modules
.
challonge
.
tournament_id
,
id
:
settings
.
modules
.
challonge
.
tournament_id
,
matchId
:
@
challonge_info
.
id
,
matchId
:
@
challonge_info
.
id
,
match
:
@
challonge_duel_log
,
match
:
@
get_challonge_score
()
,
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
)
...
@@ -1076,6 +1074,33 @@ class Room
...
@@ -1076,6 +1074,33 @@ class Room
found
++
found
++
return
found
return
found
get_challonge_score
:
->
if
!
settings
.
modules
.
challonge
.
enabled
or
!
@
started
or
@
hostinfo
.
mode
==
2
return
null
challonge_duel_log
=
{}
if
@
scores
[
@
dueling_players
[
0
].
name
]
>
@
scores
[
@
dueling_players
[
1
].
name
]
challonge_duel_log
.
winnerId
=
@
dueling_players
[
0
].
challonge_info
.
id
else
if
@
scores
[
@
dueling_players
[
0
].
name
]
<
@
scores
[
@
dueling_players
[
1
].
name
]
challonge_duel_log
.
winnerId
=
@
dueling_players
[
1
].
challonge_info
.
id
else
challonge_duel_log
.
winnerId
=
"tie"
if
settings
.
modules
.
challonge
.
post_detailed_score
if
@
dueling_players
[
0
].
challonge_info
.
id
==
@
challonge_info
.
player1Id
and
@
dueling_players
[
1
].
challonge_info
.
id
==
@
challonge_info
.
player2Id
challonge_duel_log
.
scoresCsv
=
@
scores
[
@
dueling_players
[
0
].
name
]
+
"-"
+
@
scores
[
@
dueling_players
[
1
].
name
]
else
if
@
dueling_players
[
1
].
challonge_info
.
id
==
@
challonge_info
.
player1Id
and
@
dueling_players
[
0
].
challonge_info
.
id
==
@
challonge_info
.
player2Id
challonge_duel_log
.
scoresCsv
=
@
scores
[
@
dueling_players
[
1
].
name
]
+
"-"
+
@
scores
[
@
dueling_players
[
0
].
name
]
else
challonge_duel_log
.
scoresCsv
=
"0-0"
log
.
warn
(
"Score mismatch."
,
@
name
)
else
if
challonge_duel_log
.
winnerId
==
@
challonge_info
.
player1Id
challonge_duel_log
.
scoresCsv
=
"1-0"
else
if
challonge_duel_log
.
winnerId
==
@
challonge_info
.
player2Id
challonge_duel_log
.
scoresCsv
=
"0-1"
else
challonge_duel_log
.
scoresCsv
=
"0-0"
return
challonge_duel_log
add_windbot
:
(
botdata
)
->
add_windbot
:
(
botdata
)
->
@
windbot
=
botdata
@
windbot
=
botdata
request
request
...
@@ -2061,28 +2086,6 @@ ygopro.stoc_follow 'GAME_MSG', true, (buffer, info, client, server)->
...
@@ -2061,28 +2086,6 @@ ygopro.stoc_follow 'GAME_MSG', true, (buffer, info, client, server)->
room
.
winner_name
=
room
.
dueling_players
[
pos
].
name
room
.
winner_name
=
room
.
dueling_players
[
pos
].
name
#log.info room.dueling_players, pos
#log.info room.dueling_players, pos
room
.
scores
[
room
.
winner_name
]
=
room
.
scores
[
room
.
winner_name
]
+
1
room
.
scores
[
room
.
winner_name
]
=
room
.
scores
[
room
.
winner_name
]
+
1
if
settings
.
modules
.
challonge
.
enabled
and
!
room
.
kicked
if
room
.
scores
[
room
.
dueling_players
[
0
].
name
]
>
room
.
scores
[
room
.
dueling_players
[
1
].
name
]
room
.
challonge_duel_log
.
winnerId
=
room
.
dueling_players
[
0
].
challonge_info
.
id
else
if
room
.
scores
[
room
.
dueling_players
[
0
].
name
]
<
room
.
scores
[
room
.
dueling_players
[
1
].
name
]
room
.
challonge_duel_log
.
winnerId
=
room
.
dueling_players
[
1
].
challonge_info
.
id
else
room
.
challonge_duel_log
.
winnerId
=
"tie"
if
settings
.
modules
.
challonge
.
post_detailed_score
if
room
.
dueling_players
[
0
].
challonge_info
.
id
==
room
.
challonge_info
.
player1Id
and
room
.
dueling_players
[
1
].
challonge_info
.
id
==
room
.
challonge_info
.
player2Id
room
.
challonge_duel_log
.
scoresCsv
=
room
.
scores
[
room
.
dueling_players
[
0
].
name
]
+
"-"
+
room
.
scores
[
room
.
dueling_players
[
1
].
name
]
else
if
room
.
dueling_players
[
1
].
challonge_info
.
id
==
room
.
challonge_info
.
player1Id
and
room
.
dueling_players
[
0
].
challonge_info
.
id
==
room
.
challonge_info
.
player2Id
room
.
challonge_duel_log
.
scoresCsv
=
room
.
scores
[
room
.
dueling_players
[
1
].
name
]
+
"-"
+
room
.
scores
[
room
.
dueling_players
[
0
].
name
]
else
room
.
challonge_duel_log
.
scoresCsv
=
"0-0"
log
.
warn
(
"Score mismatch."
,
room
.
name
)
else
if
room
.
challonge_duel_log
.
winnerId
==
room
.
challonge_info
.
player1Id
room
.
challonge_duel_log
.
scoresCsv
=
"1-0"
else
if
room
.
challonge_duel_log
.
winnerId
==
room
.
challonge_info
.
player2Id
room
.
challonge_duel_log
.
scoresCsv
=
"0-1"
else
room
.
challonge_duel_log
.
scoresCsv
=
"0-0"
if
room
.
death
if
room
.
death
if
settings
.
modules
.
http
.
quick_death_rule
==
1
or
settings
.
modules
.
http
.
quick_death_rule
==
3
if
settings
.
modules
.
http
.
quick_death_rule
==
1
or
settings
.
modules
.
http
.
quick_death_rule
==
3
room
.
death
=
-
1
room
.
death
=
-
1
...
@@ -2866,8 +2869,8 @@ ygopro.stoc_follow 'CHANGE_SIDE', false, (buffer, info, client, server)->
...
@@ -2866,8 +2869,8 @@ ygopro.stoc_follow 'CHANGE_SIDE', false, (buffer, info, client, server)->
ygopro
.
stoc_send_chat
(
client
,
"${side_remain_part1}
#{
client
.
side_tcount
}
${side_remain_part2}"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
)
ygopro
.
stoc_send_chat
(
client
,
"${side_remain_part1}
#{
client
.
side_tcount
}
${side_remain_part2}"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
)
,
60000
,
60000
client
.
side_interval
=
sinterval
client
.
side_interval
=
sinterval
if
settings
.
modules
.
challonge
.
enabled
and
settings
.
modules
.
challonge
.
post_score_midduel
and
client
.
pos
==
0
if
settings
.
modules
.
challonge
.
enabled
and
settings
.
modules
.
challonge
.
post_score_midduel
and
room
.
hostinfo
.
mode
!=
2
and
client
.
pos
==
0
temp_log
=
JSON
.
parse
(
JSON
.
stringify
(
room
.
challonge_duel_log
))
temp_log
=
JSON
.
parse
(
JSON
.
stringify
(
room
.
get_challonge_score
()
))
delete
temp_log
.
winnerId
delete
temp_log
.
winnerId
challonge
.
matches
.
update
({
challonge
.
matches
.
update
({
id
:
settings
.
modules
.
challonge
.
tournament_id
,
id
:
settings
.
modules
.
challonge
.
tournament_id
,
...
...
ygopro-server.js
View file @
64bef582
...
@@ -1023,9 +1023,6 @@
...
@@ -1023,9 +1023,6 @@
this
.
duel_count
=
0
;
this
.
duel_count
=
0
;
this
.
death
=
0
;
this
.
death
=
0
;
this
.
turn
=
0
;
this
.
turn
=
0
;
if
(
settings
.
modules
.
challonge
.
enabled
)
{
this
.
challonge_duel_log
=
{};
}
ROOM_all
.
push
(
this
);
ROOM_all
.
push
(
this
);
this
.
hostinfo
||
(
this
.
hostinfo
=
JSON
.
parse
(
JSON
.
stringify
(
settings
.
hostinfo
)));
this
.
hostinfo
||
(
this
.
hostinfo
=
JSON
.
parse
(
JSON
.
stringify
(
settings
.
hostinfo
)));
delete
this
.
hostinfo
.
comment
;
delete
this
.
hostinfo
.
comment
;
...
@@ -1270,7 +1267,7 @@
...
@@ -1270,7 +1267,7 @@
challonge
.
matches
.
update
({
challonge
.
matches
.
update
({
id
:
settings
.
modules
.
challonge
.
tournament_id
,
id
:
settings
.
modules
.
challonge
.
tournament_id
,
matchId
:
this
.
challonge_info
.
id
,
matchId
:
this
.
challonge_info
.
id
,
match
:
this
.
challonge_duel_log
,
match
:
this
.
get_challonge_score
()
,
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
);
...
@@ -1372,6 +1369,40 @@
...
@@ -1372,6 +1369,40 @@
return
found
;
return
found
;
};
};
Room
.
prototype
.
get_challonge_score
=
function
()
{
var
challonge_duel_log
;
if
(
!
settings
.
modules
.
challonge
.
enabled
||
this
.
hostinfo
.
mode
===
2
)
{
return
null
;
}
challonge_duel_log
=
{};
if
(
this
.
scores
[
this
.
dueling_players
[
0
].
name
]
>
this
.
scores
[
this
.
dueling_players
[
1
].
name
])
{
challonge_duel_log
.
winnerId
=
this
.
dueling_players
[
0
].
challonge_info
.
id
;
}
else
if
(
this
.
scores
[
this
.
dueling_players
[
0
].
name
]
<
this
.
scores
[
this
.
dueling_players
[
1
].
name
])
{
challonge_duel_log
.
winnerId
=
this
.
dueling_players
[
1
].
challonge_info
.
id
;
}
else
{
challonge_duel_log
.
winnerId
=
"
tie
"
;
}
if
(
settings
.
modules
.
challonge
.
post_detailed_score
)
{
if
(
this
.
dueling_players
[
0
].
challonge_info
.
id
===
this
.
challonge_info
.
player1Id
&&
this
.
dueling_players
[
1
].
challonge_info
.
id
===
this
.
challonge_info
.
player2Id
)
{
challonge_duel_log
.
scoresCsv
=
this
.
scores
[
this
.
dueling_players
[
0
].
name
]
+
"
-
"
+
this
.
scores
[
this
.
dueling_players
[
1
].
name
];
}
else
if
(
this
.
dueling_players
[
1
].
challonge_info
.
id
===
this
.
challonge_info
.
player1Id
&&
this
.
dueling_players
[
0
].
challonge_info
.
id
===
this
.
challonge_info
.
player2Id
)
{
challonge_duel_log
.
scoresCsv
=
this
.
scores
[
this
.
dueling_players
[
1
].
name
]
+
"
-
"
+
this
.
scores
[
this
.
dueling_players
[
0
].
name
];
}
else
{
challonge_duel_log
.
scoresCsv
=
"
0-0
"
;
log
.
warn
(
"
Score mismatch.
"
,
this
.
name
);
}
}
else
{
if
(
challonge_duel_log
.
winnerId
===
this
.
challonge_info
.
player1Id
)
{
challonge_duel_log
.
scoresCsv
=
"
1-0
"
;
}
else
if
(
challonge_duel_log
.
winnerId
===
this
.
challonge_info
.
player2Id
)
{
challonge_duel_log
.
scoresCsv
=
"
0-1
"
;
}
else
{
challonge_duel_log
.
scoresCsv
=
"
0-0
"
;
}
}
return
challonge_duel_log
;
};
Room
.
prototype
.
add_windbot
=
function
(
botdata
)
{
Room
.
prototype
.
add_windbot
=
function
(
botdata
)
{
this
.
windbot
=
botdata
;
this
.
windbot
=
botdata
;
request
({
request
({
...
@@ -2482,33 +2513,6 @@
...
@@ -2482,33 +2513,6 @@
room
.
winner_name
=
room
.
dueling_players
[
pos
].
name
;
room
.
winner_name
=
room
.
dueling_players
[
pos
].
name
;
room
.
scores
[
room
.
winner_name
]
=
room
.
scores
[
room
.
winner_name
]
+
1
;
room
.
scores
[
room
.
winner_name
]
=
room
.
scores
[
room
.
winner_name
]
+
1
;
}
}
if
(
settings
.
modules
.
challonge
.
enabled
&&
!
room
.
kicked
)
{
if
(
room
.
scores
[
room
.
dueling_players
[
0
].
name
]
>
room
.
scores
[
room
.
dueling_players
[
1
].
name
])
{
room
.
challonge_duel_log
.
winnerId
=
room
.
dueling_players
[
0
].
challonge_info
.
id
;
}
else
if
(
room
.
scores
[
room
.
dueling_players
[
0
].
name
]
<
room
.
scores
[
room
.
dueling_players
[
1
].
name
])
{
room
.
challonge_duel_log
.
winnerId
=
room
.
dueling_players
[
1
].
challonge_info
.
id
;
}
else
{
room
.
challonge_duel_log
.
winnerId
=
"
tie
"
;
}
if
(
settings
.
modules
.
challonge
.
post_detailed_score
)
{
if
(
room
.
dueling_players
[
0
].
challonge_info
.
id
===
room
.
challonge_info
.
player1Id
&&
room
.
dueling_players
[
1
].
challonge_info
.
id
===
room
.
challonge_info
.
player2Id
)
{
room
.
challonge_duel_log
.
scoresCsv
=
room
.
scores
[
room
.
dueling_players
[
0
].
name
]
+
"
-
"
+
room
.
scores
[
room
.
dueling_players
[
1
].
name
];
}
else
if
(
room
.
dueling_players
[
1
].
challonge_info
.
id
===
room
.
challonge_info
.
player1Id
&&
room
.
dueling_players
[
0
].
challonge_info
.
id
===
room
.
challonge_info
.
player2Id
)
{
room
.
challonge_duel_log
.
scoresCsv
=
room
.
scores
[
room
.
dueling_players
[
1
].
name
]
+
"
-
"
+
room
.
scores
[
room
.
dueling_players
[
0
].
name
];
}
else
{
room
.
challonge_duel_log
.
scoresCsv
=
"
0-0
"
;
log
.
warn
(
"
Score mismatch.
"
,
room
.
name
);
}
}
else
{
if
(
room
.
challonge_duel_log
.
winnerId
===
room
.
challonge_info
.
player1Id
)
{
room
.
challonge_duel_log
.
scoresCsv
=
"
1-0
"
;
}
else
if
(
room
.
challonge_duel_log
.
winnerId
===
room
.
challonge_info
.
player2Id
)
{
room
.
challonge_duel_log
.
scoresCsv
=
"
0-1
"
;
}
else
{
room
.
challonge_duel_log
.
scoresCsv
=
"
0-0
"
;
}
}
}
if
(
room
.
death
)
{
if
(
room
.
death
)
{
if
(
settings
.
modules
.
http
.
quick_death_rule
===
1
||
settings
.
modules
.
http
.
quick_death_rule
===
3
)
{
if
(
settings
.
modules
.
http
.
quick_death_rule
===
1
||
settings
.
modules
.
http
.
quick_death_rule
===
3
)
{
room
.
death
=
-
1
;
room
.
death
=
-
1
;
...
@@ -3597,7 +3601,7 @@
...
@@ -3597,7 +3601,7 @@
client
.
side_interval
=
sinterval
;
client
.
side_interval
=
sinterval
;
}
}
if
(
settings
.
modules
.
challonge
.
enabled
&&
settings
.
modules
.
challonge
.
post_score_midduel
&&
client
.
pos
===
0
)
{
if
(
settings
.
modules
.
challonge
.
enabled
&&
settings
.
modules
.
challonge
.
post_score_midduel
&&
client
.
pos
===
0
)
{
temp_log
=
JSON
.
parse
(
JSON
.
stringify
(
room
.
challonge_duel_log
));
temp_log
=
JSON
.
parse
(
JSON
.
stringify
(
room
.
get_challonge_score
()
));
delete
temp_log
.
winnerId
;
delete
temp_log
.
winnerId
;
challonge
.
matches
.
update
({
challonge
.
matches
.
update
({
id
:
settings
.
modules
.
challonge
.
tournament_id
,
id
:
settings
.
modules
.
challonge
.
tournament_id
,
...
...
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