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
32c3fe81
Commit
32c3fe81
authored
Oct 18, 2016
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update show score
parent
a2bd1205
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
26 deletions
+32
-26
ygopro-server.coffee
ygopro-server.coffee
+14
-12
ygopro-server.js
ygopro-server.js
+18
-14
No files found.
ygopro-server.coffee
View file @
32c3fe81
...
@@ -439,6 +439,7 @@ class Room
...
@@ -439,6 +439,7 @@ class Room
for
name
,
score
of
@
scores
for
name
,
score
of
@
scores
score_array
.
push
{
name
:
name
,
score
:
score
}
score_array
.
push
{
name
:
name
,
score
:
score
}
log
.
info
@
start_time
,
score_array
log
.
info
@
start_time
,
score_array
return
if
score_array
.
length
!=
2
request
.
post
{
url
:
settings
.
modules
.
arena_mode
.
post_score
,
form
:
{
request
.
post
{
url
:
settings
.
modules
.
arena_mode
.
post_score
,
form
:
{
accesskey
:
process
.
env
.
MYCARD_ARENA_KEY
,
accesskey
:
process
.
env
.
MYCARD_ARENA_KEY
,
usernameA
:
score_array
[
0
].
name
,
usernameA
:
score_array
[
0
].
name
,
...
@@ -447,7 +448,7 @@ class Room
...
@@ -447,7 +448,7 @@ class Room
userscoreB
:
score_array
[
1
].
score
,
userscoreB
:
score_array
[
1
].
score
,
start
:
@
start_time
,
start
:
@
start_time
,
end
:
moment
().
format
(),
end
:
moment
().
format
(),
arena
:
if
room
.
hostinfo
.
mode
==
1
then
'athletic'
else
'entertain'
#settings.modules.arena_mode.mode
arena
:
if
@
hostinfo
.
mode
==
1
then
'athletic'
else
'entertain'
#settings.modules.arena_mode.mode
}},
(
error
,
response
,
body
)
=>
}},
(
error
,
response
,
body
)
=>
if
error
if
error
log
.
warn
'SCORE POST ERROR'
,
error
,
response
log
.
warn
'SCORE POST ERROR'
,
error
,
response
...
@@ -1080,17 +1081,6 @@ ygopro.stoc_follow 'JOIN_GAME', false, (buffer, info, client, server)->
...
@@ -1080,17 +1081,6 @@ ygopro.stoc_follow 'JOIN_GAME', false, (buffer, info, client, server)->
ygopro
.
stoc_send_chat
(
client
,
settings
.
modules
.
welcome
,
ygopro
.
constants
.
COLORS
.
GREEN
)
ygopro
.
stoc_send_chat
(
client
,
settings
.
modules
.
welcome
,
ygopro
.
constants
.
COLORS
.
GREEN
)
if
room
.
welcome
if
room
.
welcome
ygopro
.
stoc_send_chat
(
client
,
room
.
welcome
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
)
ygopro
.
stoc_send_chat
(
client
,
room
.
welcome
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
)
if
settings
.
modules
.
arena_mode
.
get_score
request
url
:
settings
.
modules
.
arena_mode
.
get_score
+
encodeURIComponent
(
client
.
name
),
json
:
true
,
(
error
,
response
,
body
)
->
if
error
or
!
body
or
_
.
isString
body
log
.
warn
'LOAD SCORE ERROR'
,
client
.
name
,
error
,
response
,
body
else
log
.
info
'LOAD SCORE'
,
client
.
name
,
body
ygopro
.
stoc_send_chat
(
client
,
"您有
#{
body
.
exp
}
点经验,排名第
#{
body
.
exp_rank
}
,
#{
body
.
pt
}
点战斗力,排名第
#{
body
.
arena_rank
}
。正式上线前这些积分可能被重置。"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
)
return
if
!
room
.
recorder
if
!
room
.
recorder
room
.
recorder
=
recorder
=
net
.
connect
room
.
port
,
->
room
.
recorder
=
recorder
=
net
.
connect
room
.
port
,
->
...
@@ -1329,6 +1319,18 @@ ygopro.stoc_follow 'DUEL_START', false, (buffer, info, client, server)->
...
@@ -1329,6 +1319,18 @@ ygopro.stoc_follow 'DUEL_START', false, (buffer, info, client, server)->
room
.
player_datas
.
push
ip
:
player
.
ip
,
name
:
player
.
name
room
.
player_datas
.
push
ip
:
player
.
ip
,
name
:
player
.
name
if
settings
.
modules
.
tips
if
settings
.
modules
.
tips
ygopro
.
stoc_send_random_tip
(
client
)
ygopro
.
stoc_send_random_tip
(
client
)
if
settings
.
modules
.
arena_mode
.
get_score
and
not
client
.
score_shown
request
url
:
settings
.
modules
.
arena_mode
.
get_score
+
encodeURIComponent
(
client
.
name
),
json
:
true
,
(
error
,
response
,
body
)
->
if
error
or
!
body
or
_
.
isString
body
log
.
warn
'LOAD SCORE ERROR'
,
client
.
name
,
error
,
response
,
body
else
log
.
info
'LOAD SCORE'
,
client
.
name
,
body
ygopro
.
stoc_send_chat_to_room
(
room
,
"
#{
client
.
name
}
#{
body
.
exp
}
点经验
#{
Math
.
round
(
body
.
pt
)
}
点战斗力 排名第
#{
body
.
arena_rank
}
(正式上线前这些积分可能被重置)"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
)
client
.
score_shown
=
true
return
if
(
settings
.
modules
.
enable_deck_log
or
settings
.
modules
.
post_deck
)
and
client
.
main
and
client
.
main
.
length
and
not
client
.
deck_saved
and
client
.
ip
!=
'::ffff:127.0.0.1'
if
(
settings
.
modules
.
enable_deck_log
or
settings
.
modules
.
post_deck
)
and
client
.
main
and
client
.
main
.
length
and
not
client
.
deck_saved
and
client
.
ip
!=
'::ffff:127.0.0.1'
deck_text
=
'#ygosrv233 deck log
\n
#main
\n
'
+
client
.
main
.
join
(
'
\n
'
)
+
'
\n
!side
\n
'
+
client
.
side
.
join
(
'
\n
'
)
+
'
\n
'
deck_text
=
'#ygosrv233 deck log
\n
#main
\n
'
+
client
.
main
.
join
(
'
\n
'
)
+
'
\n
!side
\n
'
+
client
.
side
.
join
(
'
\n
'
)
+
'
\n
'
if
settings
.
modules
.
enable_deck_log
if
settings
.
modules
.
enable_deck_log
...
...
ygopro-server.js
View file @
32c3fe81
...
@@ -593,6 +593,9 @@
...
@@ -593,6 +593,9 @@
});
});
}
}
log
.
info
(
this
.
start_time
,
score_array
);
log
.
info
(
this
.
start_time
,
score_array
);
if
(
score_array
.
length
!==
2
)
{
return
;
}
request
.
post
({
request
.
post
({
url
:
settings
.
modules
.
arena_mode
.
post_score
,
url
:
settings
.
modules
.
arena_mode
.
post_score
,
form
:
{
form
:
{
...
@@ -603,7 +606,7 @@
...
@@ -603,7 +606,7 @@
userscoreB
:
score_array
[
1
].
score
,
userscoreB
:
score_array
[
1
].
score
,
start
:
this
.
start_time
,
start
:
this
.
start_time
,
end
:
moment
().
format
(),
end
:
moment
().
format
(),
arena
:
room
.
hostinfo
.
mode
===
1
?
'
athletic
'
:
'
entertain
'
arena
:
this
.
hostinfo
.
mode
===
1
?
'
athletic
'
:
'
entertain
'
}
}
},
(
function
(
_this
)
{
},
(
function
(
_this
)
{
return
function
(
error
,
response
,
body
)
{
return
function
(
error
,
response
,
body
)
{
...
@@ -1308,19 +1311,6 @@
...
@@ -1308,19 +1311,6 @@
if
(
room
.
welcome
)
{
if
(
room
.
welcome
)
{
ygopro
.
stoc_send_chat
(
client
,
room
.
welcome
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
);
ygopro
.
stoc_send_chat
(
client
,
room
.
welcome
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
);
}
}
if
(
settings
.
modules
.
arena_mode
.
get_score
)
{
request
({
url
:
settings
.
modules
.
arena_mode
.
get_score
+
encodeURIComponent
(
client
.
name
),
json
:
true
},
function
(
error
,
response
,
body
)
{
if
(
error
||
!
body
||
_
.
isString
(
body
))
{
log
.
warn
(
'
LOAD SCORE ERROR
'
,
client
.
name
,
error
,
response
,
body
);
}
else
{
log
.
info
(
'
LOAD SCORE
'
,
client
.
name
,
body
);
ygopro
.
stoc_send_chat
(
client
,
"
您有
"
+
body
.
exp
+
"
点经验,排名第
"
+
body
.
exp_rank
+
"
,
"
+
body
.
pt
+
"
点战斗力,排名第
"
+
body
.
arena_rank
+
"
。正式上线前这些积分可能被重置。
"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
);
}
});
}
if
(
!
room
.
recorder
)
{
if
(
!
room
.
recorder
)
{
room
.
recorder
=
recorder
=
net
.
connect
(
room
.
port
,
function
()
{
room
.
recorder
=
recorder
=
net
.
connect
(
room
.
port
,
function
()
{
ygopro
.
ctos_send
(
recorder
,
'
PLAYER_INFO
'
,
{
ygopro
.
ctos_send
(
recorder
,
'
PLAYER_INFO
'
,
{
...
@@ -1632,6 +1622,20 @@
...
@@ -1632,6 +1622,20 @@
if
(
settings
.
modules
.
tips
)
{
if
(
settings
.
modules
.
tips
)
{
ygopro
.
stoc_send_random_tip
(
client
);
ygopro
.
stoc_send_random_tip
(
client
);
}
}
if
(
settings
.
modules
.
arena_mode
.
get_score
&&
!
client
.
score_shown
)
{
request
({
url
:
settings
.
modules
.
arena_mode
.
get_score
+
encodeURIComponent
(
client
.
name
),
json
:
true
},
function
(
error
,
response
,
body
)
{
if
(
error
||
!
body
||
_
.
isString
(
body
))
{
log
.
warn
(
'
LOAD SCORE ERROR
'
,
client
.
name
,
error
,
response
,
body
);
}
else
{
log
.
info
(
'
LOAD SCORE
'
,
client
.
name
,
body
);
ygopro
.
stoc_send_chat_to_room
(
room
,
client
.
name
+
"
"
+
body
.
exp
+
"
点经验
"
+
(
Math
.
round
(
body
.
pt
))
+
"
点战斗力 排名第
"
+
body
.
arena_rank
+
"
(正式上线前这些积分可能被重置)
"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
);
client
.
score_shown
=
true
;
}
});
}
if
((
settings
.
modules
.
enable_deck_log
||
settings
.
modules
.
post_deck
)
&&
client
.
main
&&
client
.
main
.
length
&&
!
client
.
deck_saved
&&
client
.
ip
!==
'
::ffff:127.0.0.1
'
)
{
if
((
settings
.
modules
.
enable_deck_log
||
settings
.
modules
.
post_deck
)
&&
client
.
main
&&
client
.
main
.
length
&&
!
client
.
deck_saved
&&
client
.
ip
!==
'
::ffff:127.0.0.1
'
)
{
deck_text
=
'
#ygosrv233 deck log
\n
#main
\n
'
+
client
.
main
.
join
(
'
\n
'
)
+
'
\n
!side
\n
'
+
client
.
side
.
join
(
'
\n
'
)
+
'
\n
'
;
deck_text
=
'
#ygosrv233 deck log
\n
#main
\n
'
+
client
.
main
.
join
(
'
\n
'
)
+
'
\n
!side
\n
'
+
client
.
side
.
join
(
'
\n
'
)
+
'
\n
'
;
if
(
settings
.
modules
.
enable_deck_log
)
{
if
(
settings
.
modules
.
enable_deck_log
)
{
...
...
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