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
4a39b790
Commit
4a39b790
authored
Dec 21, 2016
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
read default room info and default version from config
parent
783620b4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
28 deletions
+43
-28
config.json
config.json
+14
-1
ygopro-server.coffee
ygopro-server.coffee
+12
-13
ygopro-server.js
ygopro-server.js
+17
-14
No files found.
config.json
View file @
4a39b790
...
...
@@ -8,7 +8,6 @@
"dialogues"
:
"http://mercury233.me/ygosrv233/dialogues.json"
,
"enable_random_duel"
:
false
,
"enable_halfway_watch"
:
true
,
"enable_TCG_as_default"
:
false
,
"enable_cloud_replay"
:
false
,
"enable_windbot"
:
false
,
"enable_websocket_roomlist"
:
false
,
...
...
@@ -20,6 +19,20 @@
"mycard_auth"
:
false
,
"post_deck"
:
false
,
"hang_timeout"
:
90
,
"default_version"
:
4924
,
"default_room_info"
:
{
"lflist"
:
0
,
"rule"
:
0
,
"mode"
:
0
,
"comment"
:
"rule: 0=OCGONLY, 1=TCGONLY, 2=OT; mode: 0=SINGLE, 1=MATCH, 2=TAG"
,
"enable_priority"
:
false
,
"no_check_deck"
:
false
,
"no_shuffle_deck"
:
false
,
"start_lp"
:
8000
,
"start_hand"
:
5
,
"draw_count"
:
1
,
"time_limit"
:
180
},
"arena_mode"
:
{
"mode"
:
"233"
,
"post_score"
:
false
,
...
...
ygopro-server.coffee
View file @
4a39b790
...
...
@@ -82,7 +82,11 @@ ban_user = (name) ->
continue
return
settings
.
version
=
parseInt
(
fs
.
readFileSync
(
'ygopro/gframe/game.cpp'
,
'utf8'
).
match
(
/PRO_VERSION = ([x\dABCDEF]+)/
)[
1
],
'16'
)
try
settings
.
version
=
parseInt
(
fs
.
readFileSync
(
'ygopro/gframe/game.cpp'
,
'utf8'
).
match
(
/PRO_VERSION = ([x\dABCDEF]+)/
)[
1
],
'16'
)
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"
# load the lflist of current date
settings
.
lflist
=
(
for
list
in
fs
.
readFileSync
(
'ygopro/lflist.conf'
,
'utf8'
).
match
(
/!.*/g
)
date
=
list
.
match
(
/!([\d\.]+)/
)
...
...
@@ -303,18 +307,13 @@ class Room
@
scores
=
{}
ROOM_all
.
push
this
@
hostinfo
||=
lflist
:
if
settings
.
lflist
.
length
then
0
else
-
1
rule
:
if
settings
.
modules
.
enable_TCG_as_default
then
2
else
0
mode
:
0
enable_priority
:
false
no_check_deck
:
false
no_shuffle_deck
:
false
start_lp
:
8000
start_hand
:
5
draw_count
:
1
time_limit
:
180
replay_mode
:
if
settings
.
modules
.
tournament_mode
.
enabled
then
1
else
0
@
hostinfo
||=
settings
.
modules
.
default_room_info
if
settings
.
lflist
.
length
if
@
hostinfo
.
rule
==
1
and
@
hostinfo
.
lflist
==
0
@
hostinfo
.
lflist
=
_
.
findIndex
settings
.
lflist
,
(
list
)
->
list
.
tcg
else
@
hostinfo
.
lflist
=
-
1
@
hostinfo
.
replay_mode
=
if
settings
.
modules
.
tournament_mode
.
enabled
then
1
else
0
if
name
[
0
...
2
]
==
'M#'
@
hostinfo
.
mode
=
1
...
...
ygopro-server.js
View file @
4a39b790
...
...
@@ -111,7 +111,12 @@
}
};
settings
.
version
=
parseInt
(
fs
.
readFileSync
(
'
ygopro/gframe/game.cpp
'
,
'
utf8
'
).
match
(
/PRO_VERSION =
([
x
\d
ABCDEF
]
+
)
/
)[
1
],
'
16
'
);
try
{
settings
.
version
=
parseInt
(
fs
.
readFileSync
(
'
ygopro/gframe/game.cpp
'
,
'
utf8
'
).
match
(
/PRO_VERSION =
([
x
\d
ABCDEF
]
+
)
/
)[
1
],
'
16
'
);
}
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
"
);
}
settings
.
lflist
=
(
function
()
{
var
k
,
len
,
ref
,
results
;
...
...
@@ -416,19 +421,17 @@
this
.
welcome
=
''
;
this
.
scores
=
{};
ROOM_all
.
push
(
this
);
this
.
hostinfo
||
(
this
.
hostinfo
=
{
lflist
:
settings
.
lflist
.
length
?
0
:
-
1
,
rule
:
settings
.
modules
.
enable_TCG_as_default
?
2
:
0
,
mode
:
0
,
enable_priority
:
false
,
no_check_deck
:
false
,
no_shuffle_deck
:
false
,
start_lp
:
8000
,
start_hand
:
5
,
draw_count
:
1
,
time_limit
:
180
,
replay_mode
:
settings
.
modules
.
tournament_mode
.
enabled
?
1
:
0
});
this
.
hostinfo
||
(
this
.
hostinfo
=
settings
.
modules
.
default_room_info
);
if
(
settings
.
lflist
.
length
)
{
if
(
this
.
hostinfo
.
rule
===
1
&&
this
.
hostinfo
.
lflist
===
0
)
{
this
.
hostinfo
.
lflist
=
_
.
findIndex
(
settings
.
lflist
,
function
(
list
)
{
return
list
.
tcg
;
});
}
}
else
{
this
.
hostinfo
.
lflist
=
-
1
;
}
this
.
hostinfo
.
replay_mode
=
settings
.
modules
.
tournament_mode
.
enabled
?
1
:
0
;
if
(
name
.
slice
(
0
,
2
)
===
'
M#
'
)
{
this
.
hostinfo
.
mode
=
1
;
}
else
if
(
name
.
slice
(
0
,
2
)
===
'
T#
'
)
{
...
...
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