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
2fab0ff5
Commit
2fab0ff5
authored
Jan 20, 2018
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test
parent
6e57a724
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
16 deletions
+34
-16
config.json
config.json
+4
-0
ygopro-server.js
ygopro-server.js
+30
-16
No files found.
config.json
View file @
2fab0ff5
...
...
@@ -38,6 +38,10 @@
"enabled"
:
true
,
"get"
:
"http://mercury233.me/ygosrv233/dialogues.json"
},
"music"
:
{
"enabled"
:
false
,
"dbpath"
:
"expansions/222DIY.cdb"
},
"random_duel"
:
{
"enabled"
:
false
,
"no_rematch_check"
:
false
,
...
...
ygopro-server.js
View file @
2fab0ff5
...
...
@@ -1776,6 +1776,26 @@
}
},
30000
);
}
var
music_list
=
{};
if
(
settings
.
modules
.
music
.
enabled
)
{
var
sqlite3
=
require
(
'
sqlite3
'
).
verbose
();
var
db
=
new
sqlite3
.
Database
(
"
./ygopro/
"
+
settings
.
modules
.
music
.
dbpath
);
db
.
each
(
"
select * from datas,texts where datas.id=texts.id
"
,
function
(
err
,
result
)
{
if
(
err
)
{
log
.
info
(
"
music load errored
"
,
err
);
return
;
}
else
{
for
(
i
=
1
,
len
=
16
;
i
<=
len
;
i
++
)
{
var
song_name
=
result
[
"
str
"
+
i
];
if
(
song_name
&&
!
music_list
[
song_name
])
{
music_list
[
song_name
]
=
result
.
id
*
16
+
i
-
1
;
}
}
}
},
function
()
{
log
.
info
(
"
music loaded
"
,
music_list
.
length
());
});
}
ygopro
.
stoc_follow
(
'
DUEL_START
'
,
false
,
function
(
buffer
,
info
,
client
,
server
)
{
var
deck_arena
,
deck_name
,
deck_text
,
j
,
len
,
player
,
ref
,
room
;
...
...
@@ -1966,22 +1986,16 @@
}
break
;
case
'
/music
'
:
var
card
=
cmd
[
1
];
var
seq
=
cmd
[
2
];
if
(
card
&&
seq
)
{
var
ccode
=
parseInt
(
card
);
var
seqcode
=
parseInt
(
seq
);
if
(
!
seqcode
)
{
seqcode
=
0
;
}
if
(
ccode
)
{
ygopro
.
stoc_send_hint_music_to_room
(
room
,
ccode
*
16
+
seqcode
);
}
else
{
ygopro
.
stoc_send_chat
(
client
,
"
Failed loading params.
"
,
ygopro
.
constants
.
COLORS
.
RED
);
}
}
else
{
ygopro
.
stoc_send_chat
(
client
,
"
Failed playing music.
"
,
ygopro
.
constants
.
COLORS
.
RED
);
}
var
music
=
cmd
[
1
];
if
(
settings
.
modules
.
music
.
enabled
&&
music
)
{
var
music_id
=
music_list
[
music
];
if
(
music_id
)
{
ygopro
.
stoc_send_hint_music_to_room
(
room
,
music_id
);
ygopro
.
stoc_send_chat_to_room
(
room
,
"
Playing
"
+
music
+
"
sent by
"
+
client
.
name
+
"
.
"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
);
}
else
{
ygopro
.
stoc_send_chat
(
client
,
"
Music
"
+
music
+
"
not found.
"
,
ygopro
.
constants
.
COLORS
.
RED
);
}
}
break
;
}
if
(
msg
.
length
>
100
)
{
...
...
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