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
236cf33b
Commit
236cf33b
authored
Dec 21, 2016
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
372c160d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
17 deletions
+16
-17
config.json
config.json
+2
-1
mycard.config.json
mycard.config.json
+2
-1
ygopro-server.coffee
ygopro-server.coffee
+6
-7
ygopro-server.js
ygopro-server.js
+6
-8
No files found.
config.json
View file @
236cf33b
...
...
@@ -43,7 +43,8 @@
"post"
:
"https://mycard.moe/ygopro/analytics/deck/text"
},
"arena_mode"
:
{
"mode"
:
"233"
,
"enabled"
:
false
,
"mode"
:
"entertain"
,
"comment"
:
"mode: athletic / entertain"
,
"accesskey"
:
"233"
,
"post_score"
:
false
,
...
...
mycard.config.json
View file @
236cf33b
...
...
@@ -22,6 +22,7 @@
"post"
:
"https://mycard.moe/ygopro/analytics/deck/text"
},
"arena_mode"
:
{
"enabled"
:
true
,
"mode"
:
"entertain"
,
"accesskey"
:
"233"
,
"post_score"
:
"https://mycard.moe/ygopro/arena/index.php?c=update"
,
...
...
@@ -31,7 +32,7 @@
"port"
:
7922
,
"password"
:
"123456"
,
"ssl"
:
{
"enabled"
:
fals
e
,
"enabled"
:
tru
e
,
"port"
:
7923
,
"cert"
:
"ssl/fullchain.pem"
,
"key"
:
"ssl/privkey.pem"
...
...
ygopro-server.coffee
View file @
236cf33b
...
...
@@ -84,9 +84,10 @@ ban_user = (name) ->
try
settings
.
version
=
parseInt
(
fs
.
readFileSync
(
'ygopro/gframe/game.cpp'
,
'utf8'
).
match
(
/PRO_VERSION = ([x\dABCDEF]+)/
)[
1
],
'16'
)
log
.
info
"ygopro version 0x"
+
settings
.
version
.
toString
(
16
),
"(from source code)"
catch
settings
.
version
=
settings
.
modules
.
default_version
log
.
info
"
fail to read version from ygopro source code, using 0x"
+
settings
.
version
.
toString
(
16
),
"from config
"
log
.
info
"
ygopro version 0x"
+
settings
.
version
.
toString
(
16
),
"(from config)
"
# load the lflist of current date
settings
.
lflist
=
(
for
list
in
fs
.
readFileSync
(
'ygopro/lflist.conf'
,
'utf8'
).
match
(
/!.*/g
)
date
=
list
.
match
(
/!([\d\.]+)/
)
...
...
@@ -241,8 +242,6 @@ ROOM_find_or_create_random = (type, player_ip)->
ROOM_find_or_create_ai
=
(
name
)
->
if
name
==
''
name
=
'AI'
if
name
[
0
...
3
]
==
'AI_'
name
=
'AI#'
+
name
.
slice
(
3
)
namea
=
name
.
split
(
'#'
)
if
room
=
ROOM_find_by_name
(
name
)
return
room
...
...
@@ -433,7 +432,7 @@ class Room
delete
:
->
return
if
@
deleted
#log.info 'room-delete', this.name, ROOM_all.length
if
@
started
and
settings
.
modules
.
arena_mode
.
post_score
if
@
started
and
settings
.
modules
.
arena_mode
.
enabled
#log.info @scores
score_array
=
[]
for
name
,
score
of
@
scores
...
...
@@ -453,7 +452,7 @@ class Room
if
error
log
.
warn
'SCORE POST ERROR'
,
error
else
if
response
.
statusCode
!=
204
or
response
.
statusCode
!=
200
if
response
.
statusCode
!=
204
and
response
.
statusCode
!=
200
log
.
warn
'SCORE POST FAIL'
,
response
.
statusCode
,
response
.
statusMessage
,
@
name
,
body
else
log
.
info
'SCORE POST OK'
,
response
.
statusCode
,
response
.
statusMessage
,
@
name
,
body
...
...
@@ -888,7 +887,7 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)->
else
if
!
info
.
pass
.
length
and
!
settings
.
modules
.
enable_random_duel
and
!
settings
.
modules
.
enable_windbot
ygopro
.
stoc_die
(
client
,
"房间名不能为空,请在主机密码处填写房间名"
)
else
if
info
.
pass
.
length
and
settings
.
modules
.
mycard
.
enabled
and
info
.
pass
[
0
...
3
]
!=
'AI
_'
and
info
.
pass
[
0
...
3
]
!=
'AI
#'
else
if
info
.
pass
.
length
and
settings
.
modules
.
mycard
.
enabled
and
info
.
pass
[
0
...
3
]
!=
'AI#'
ygopro
.
stoc_send_chat
(
client
,
'正在读取用户信息...'
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
)
if
info
.
pass
.
length
<=
8
ygopro
.
stoc_die
(
client
,
'主机密码不正确 (Invalid Length)'
)
...
...
@@ -1081,7 +1080,7 @@ ygopro.stoc_follow 'JOIN_GAME', false, (buffer, info, client, server)->
ygopro
.
stoc_send_chat
(
client
,
settings
.
modules
.
welcome
,
ygopro
.
constants
.
COLORS
.
GREEN
)
if
room
.
welcome
ygopro
.
stoc_send_chat
(
client
,
room
.
welcome
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
)
if
settings
.
modules
.
arena_mode
.
get_score
#and not client.score_shown
if
settings
.
modules
.
arena_mode
.
enabled
#and not client.score_shown
request
url
:
settings
.
modules
.
arena_mode
.
get_score
+
encodeURIComponent
(
client
.
name
),
json
:
true
...
...
ygopro-server.js
View file @
236cf33b
...
...
@@ -113,9 +113,10 @@
try
{
settings
.
version
=
parseInt
(
fs
.
readFileSync
(
'
ygopro/gframe/game.cpp
'
,
'
utf8
'
).
match
(
/PRO_VERSION =
([
x
\d
ABCDEF
]
+
)
/
)[
1
],
'
16
'
);
log
.
info
(
"
ygopro version 0x
"
+
settings
.
version
.
toString
(
16
),
"
(from source code)
"
);
}
catch
(
error1
)
{
settings
.
version
=
settings
.
modules
.
default_version
;
log
.
info
(
"
fail to read version from ygopro source code, using 0x
"
+
settings
.
version
.
toString
(
16
),
"
from config
"
);
log
.
info
(
"
ygopro version 0x
"
+
settings
.
version
.
toString
(
16
),
"
(from config)
"
);
}
settings
.
lflist
=
(
function
()
{
...
...
@@ -332,9 +333,6 @@
if
(
name
===
''
)
{
name
=
'
AI
'
;
}
if
(
name
.
slice
(
0
,
3
)
===
'
AI_
'
)
{
name
=
'
AI#
'
+
name
.
slice
(
3
);
}
namea
=
name
.
split
(
'
#
'
);
if
(
room
=
ROOM_find_by_name
(
name
))
{
return
room
;
...
...
@@ -586,7 +584,7 @@
if
(
this
.
deleted
)
{
return
;
}
if
(
this
.
started
&&
settings
.
modules
.
arena_mode
.
post_score
)
{
if
(
this
.
started
&&
settings
.
modules
.
arena_mode
.
enabled
)
{
score_array
=
[];
ref
=
this
.
scores
;
for
(
name
in
ref
)
{
...
...
@@ -615,7 +613,7 @@
if
(
error
)
{
log
.
warn
(
'
SCORE POST ERROR
'
,
error
);
}
else
{
if
(
response
.
statusCode
!==
204
||
response
.
statusCode
!==
200
)
{
if
(
response
.
statusCode
!==
204
&&
response
.
statusCode
!==
200
)
{
log
.
warn
(
'
SCORE POST FAIL
'
,
response
.
statusCode
,
response
.
statusMessage
,
_this
.
name
,
body
);
}
else
{
log
.
info
(
'
SCORE POST OK
'
,
response
.
statusCode
,
response
.
statusMessage
,
_this
.
name
,
body
);
...
...
@@ -1106,7 +1104,7 @@
client
.
destroy
();
}
else
if
(
!
info
.
pass
.
length
&&
!
settings
.
modules
.
enable_random_duel
&&
!
settings
.
modules
.
enable_windbot
)
{
ygopro
.
stoc_die
(
client
,
"
房间名不能为空,请在主机密码处填写房间名
"
);
}
else
if
(
info
.
pass
.
length
&&
settings
.
modules
.
mycard
.
enabled
&&
info
.
pass
.
slice
(
0
,
3
)
!==
'
AI
_
'
&&
info
.
pass
.
slice
(
0
,
3
)
!==
'
AI
#
'
)
{
}
else
if
(
info
.
pass
.
length
&&
settings
.
modules
.
mycard
.
enabled
&&
info
.
pass
.
slice
(
0
,
3
)
!==
'
AI#
'
)
{
ygopro
.
stoc_send_chat
(
client
,
'
正在读取用户信息...
'
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
);
if
(
info
.
pass
.
length
<=
8
)
{
ygopro
.
stoc_die
(
client
,
'
主机密码不正确 (Invalid Length)
'
);
...
...
@@ -1314,7 +1312,7 @@
if
(
room
.
welcome
)
{
ygopro
.
stoc_send_chat
(
client
,
room
.
welcome
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
);
}
if
(
settings
.
modules
.
arena_mode
.
get_score
)
{
if
(
settings
.
modules
.
arena_mode
.
enabled
)
{
request
({
url
:
settings
.
modules
.
arena_mode
.
get_score
+
encodeURIComponent
(
client
.
name
),
json
:
true
...
...
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