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
26fa5ac7
Commit
26fa5ac7
authored
Jan 20, 2018
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
exp
parent
e4ff0361
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
27 deletions
+55
-27
i18n.json
i18n.json
+8
-0
ygopro-server.js
ygopro-server.js
+24
-7
ygopro.js
ygopro.js
+23
-20
No files found.
i18n.json
View file @
26fa5ac7
...
@@ -85,6 +85,10 @@
...
@@ -85,6 +85,10 @@
"surrender_confirm"
:
"Are you sure? Enter /surrender again to confirm."
,
"surrender_confirm"
:
"Are you sure? Enter /surrender again to confirm."
,
"surrender_canceled"
:
"Surrender canceled."
,
"surrender_canceled"
:
"Surrender canceled."
,
"surrender_denied"
:
"Please use the Surrender button instead."
,
"surrender_denied"
:
"Please use the Surrender button instead."
,
"play_music"
:
"Playing music: "
,
"play_music_user"
:
"The current music is played by: "
,
"stop_music_user"
:
"The current music is stopped by: "
,
"music_not_found"
:
"Cannot find music: "
,
"unwelcome_warn_part1"
:
"If you keep doing "
,
"unwelcome_warn_part1"
:
"If you keep doing "
,
"unwelcome_warn_part2"
:
", your opponent may leave you."
,
"unwelcome_warn_part2"
:
", your opponent may leave you."
,
"unwelcome_tip_part1"
:
"Your oppenent did "
,
"unwelcome_tip_part1"
:
"Your oppenent did "
,
...
@@ -178,6 +182,10 @@
...
@@ -178,6 +182,10 @@
"surrender_confirm"
:
"确实要投降吗?再次输入 /投降 以确认。"
,
"surrender_confirm"
:
"确实要投降吗?再次输入 /投降 以确认。"
,
"surrender_canceled"
:
"已取消投降,加油!"
,
"surrender_canceled"
:
"已取消投降,加油!"
,
"surrender_denied"
:
"为保证双方玩家的游戏体验,随机对战中3回合后才能投降。"
,
"surrender_denied"
:
"为保证双方玩家的游戏体验,随机对战中3回合后才能投降。"
,
"play_music"
:
"正在播放:"
,
"play_music_user"
:
"当前音乐由以下玩家点选:"
,
"stop_music_user"
:
"当前音乐被以下玩家终止:"
,
"music_not_found"
:
"找不到音乐:"
,
"unwelcome_warn_part1"
:
"如果您经常"
,
"unwelcome_warn_part1"
:
"如果您经常"
,
"unwelcome_warn_part2"
:
",您的对手可能会离你而去。"
,
"unwelcome_warn_part2"
:
",您的对手可能会离你而去。"
,
"unwelcome_tip_part1"
:
"因为您的对手有"
,
"unwelcome_tip_part1"
:
"因为您的对手有"
,
...
...
ygopro-server.js
View file @
26fa5ac7
...
@@ -1571,6 +1571,16 @@
...
@@ -1571,6 +1571,16 @@
ygopro
.
stoc_send_chat_to_room
(
room
,
"
${lp_low_self}
"
,
ygopro
.
constants
.
COLORS
.
PINK
);
ygopro
.
stoc_send_chat_to_room
(
room
,
"
${lp_low_self}
"
,
ygopro
.
constants
.
COLORS
.
PINK
);
}
}
}
}
if
(
settings
.
modules
.
music
.
enabled
)
{
if
(
ygopro
.
constants
.
MSG
[
msg
]
===
'
HINT
'
)
{
var
hint_type
=
buffer
.
readUInt8
(
1
);
pos
=
buffer
.
readUInt8
(
2
);
var
music_id
=
buffer
.
readUInt32LE
(
3
);
if
(
hint_type
===
11
&&
music_list_rev
[
music_id
])
ygopro
.
stoc_send_chat
(
client
,
"
${play_music}
"
+
music_list_rev
[
music_id
],
ygopro
.
constants
.
COLORS
.
BABYBLUE
);
}
}
}
if
(
settings
.
modules
.
dialogues
.
enabled
)
{
if
(
settings
.
modules
.
dialogues
.
enabled
)
{
if
(
ygopro
.
constants
.
MSG
[
msg
]
===
'
SUMMONING
'
||
ygopro
.
constants
.
MSG
[
msg
]
===
'
SPSUMMONING
'
)
{
if
(
ygopro
.
constants
.
MSG
[
msg
]
===
'
SUMMONING
'
||
ygopro
.
constants
.
MSG
[
msg
]
===
'
SPSUMMONING
'
)
{
card
=
buffer
.
readUInt32LE
(
1
);
card
=
buffer
.
readUInt32LE
(
1
);
...
@@ -1777,10 +1787,11 @@
...
@@ -1777,10 +1787,11 @@
},
30000
);
},
30000
);
}
}
var
music_list
=
{};
var
music_list
=
{};
var
music_list_rev
=
{};
var
music_count
=
0
;
if
(
settings
.
modules
.
music
.
enabled
)
{
if
(
settings
.
modules
.
music
.
enabled
)
{
var
sqlite3
=
require
(
'
sqlite3
'
).
verbose
();
var
sqlite3
=
require
(
'
sqlite3
'
).
verbose
();
var
db
=
new
sqlite3
.
Database
(
"
./ygopro/
"
+
settings
.
modules
.
music
.
dbpath
);
var
db
=
new
sqlite3
.
Database
(
"
./ygopro/
"
+
settings
.
modules
.
music
.
dbpath
);
var count = 0;
db
.
each
(
"
select * from datas,texts where datas.id=texts.id
"
,
function
(
err
,
result
)
{
db
.
each
(
"
select * from datas,texts where datas.id=texts.id
"
,
function
(
err
,
result
)
{
if
(
err
)
{
if
(
err
)
{
log
.
info
(
"
music load errored
"
,
err
);
log
.
info
(
"
music load errored
"
,
err
);
...
@@ -1788,14 +1799,18 @@
...
@@ -1788,14 +1799,18 @@
}
else
{
}
else
{
for
(
i
=
1
,
len
=
16
;
i
<=
len
;
i
++
)
{
for
(
i
=
1
,
len
=
16
;
i
<=
len
;
i
++
)
{
var
song_name
=
result
[
"
str
"
+
i
];
var
song_name
=
result
[
"
str
"
+
i
];
if (song_name && !music_list[song_name]) {
if
(
song_name
)
{
music_list[song_name] = result.id * 16 + i - 1;
var
music_id
=
result
.
id
*
16
+
i
-
1
;
count++;
music_list_rev
[
music_id
]
=
song_name
;
if
(
!
music_list
[
song_name
])
{
music_list
[
song_name
]
=
music_id
;
music_count
++
;
}
}
}
}
}
}
}
},
function
()
{
},
function
()
{
log.info("music loaded", count);
log
.
info
(
"
music loaded
"
,
music_
count
);
});
});
}
}
...
@@ -1992,13 +2007,15 @@
...
@@ -1992,13 +2007,15 @@
if
(
settings
.
modules
.
music
.
enabled
&&
music
)
{
if
(
settings
.
modules
.
music
.
enabled
&&
music
)
{
if
(
music
===
"
stop
"
)
{
if
(
music
===
"
stop
"
)
{
ygopro
.
stoc_send_hint_music_to_room
(
room
,
0
);
ygopro
.
stoc_send_hint_music_to_room
(
room
,
0
);
ygopro.stoc_send_chat_to_room(room, "Music stopped by "+client.name+".", ygopro.constants.COLORS.BABYBLUE);
ygopro
.
stoc_send_chat_to_room
(
room
,
"
${play_music}
"
+
music
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
);
ygopro
.
stoc_send_chat_to_room
(
room
,
"
${stop_music_user}
"
+
client
.
name
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
);
break
;
break
;
}
}
var
music_id
=
music_list
[
music
];
var
music_id
=
music_list
[
music
];
if
(
music_id
)
{
if
(
music_id
)
{
ygopro
.
stoc_send_hint_music_to_room
(
room
,
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);
ygopro
.
stoc_send_chat_to_room
(
room
,
"
${play_music}
"
+
music
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
);
ygopro
.
stoc_send_chat_to_room
(
room
,
"
${play_music_user}
"
+
client
.
name
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
);
}
else
{
}
else
{
ygopro
.
stoc_send_chat
(
client
,
"
Music
"
+
music
+
"
not found.
"
,
ygopro
.
constants
.
COLORS
.
RED
);
ygopro
.
stoc_send_chat
(
client
,
"
Music
"
+
music
+
"
not found.
"
,
ygopro
.
constants
.
COLORS
.
RED
);
}
}
...
...
ygopro.js
View file @
26fa5ac7
...
@@ -220,40 +220,43 @@
...
@@ -220,40 +220,43 @@
}
}
}
}
};
};
this
.
stoc_send_hint_music
=
function
(
client
,
music
,
music_type
)
{
if
(
!
client
)
{
console
.
log
(
"
err stoc_send_hint_music
"
);
return
;
}
this
.
stoc_send
(
client
,
'
GAME_MSG
'
,
{
curmsg
:
2
,
type
:
music_type
,
player
:
0
,
data
:
music
});
};
this
.
stoc_send_hint_music_to_room
=
function
(
room
,
music
)
{
this
.
stoc_send_hint_music_to_room
=
function
(
room
,
music
,
music_type
)
{
var
client
,
j
,
k
,
len1
,
len2
,
ref
,
ref1
;
var
client
,
j
,
k
,
len1
,
len2
,
ref
,
ref1
;
if
(
!
room
)
{
if
(
!
room
)
{
console
.
log
(
"
err stoc_send_hint_
card
_to_room
"
);
console
.
log
(
"
err stoc_send_hint_
music
_to_room
"
);
return
;
return
;
}
}
ref
=
room
.
players
;
ref
=
room
.
players
;
for
(
j
=
0
,
len1
=
ref
.
length
;
j
<
len1
;
j
++
)
{
for
(
j
=
0
,
len1
=
ref
.
length
;
j
<
len1
;
j
++
)
{
client
=
ref
[
j
];
client
=
ref
[
j
];
if
(
client
)
{
if
(
client
)
{
this
.
stoc_send
(
client
,
'
GAME_MSG
'
,
{
this
.
stoc_send_hint_music
(
client
,
music
,
music_type
);
curmsg
:
2
,
type
:
11
,
player
:
0
,
data
:
music
});
}
}
}
}
ref1
=
room
.
watchers
;
ref1
=
room
.
watchers
;
for
(
k
=
0
,
len2
=
ref1
.
length
;
k
<
len2
;
k
++
)
{
for
(
k
=
0
,
len2
=
ref1
.
length
;
k
<
len2
;
k
++
)
{
client
=
ref1
[
k
];
client
=
ref1
[
k
];
if
(
client
)
{
if
(
client
)
{
this
.
stoc_send
(
client
,
'
GAME_MSG
'
,
{
this
.
stoc_send_hint_music
(
client
,
music
,
music_type
);
curmsg
:
2
,
type
:
11
,
player
:
0
,
data
:
music
});
}
}
}
}
};
};
this
.
stoc_send_hint_
card_to_room
=
function
(
room
,
card
)
{
this
.
stoc_send_hint_
music_to_room
=
function
(
room
,
music
)
{
var
client
,
j
,
k
,
len1
,
len2
,
ref
,
ref1
;
var
client
,
j
,
k
,
len1
,
len2
,
ref
,
ref1
;
if
(
!
room
)
{
if
(
!
room
)
{
console
.
log
(
"
err stoc_send_hint_card_to_room
"
);
console
.
log
(
"
err stoc_send_hint_card_to_room
"
);
...
@@ -265,9 +268,9 @@
...
@@ -265,9 +268,9 @@
if
(
client
)
{
if
(
client
)
{
this
.
stoc_send
(
client
,
'
GAME_MSG
'
,
{
this
.
stoc_send
(
client
,
'
GAME_MSG
'
,
{
curmsg
:
2
,
curmsg
:
2
,
type
:
1
0
,
type
:
1
1
,
player
:
0
,
player
:
0
,
data
:
card
data
:
music
});
});
}
}
}
}
...
@@ -277,13 +280,13 @@
...
@@ -277,13 +280,13 @@
if
(
client
)
{
if
(
client
)
{
this
.
stoc_send
(
client
,
'
GAME_MSG
'
,
{
this
.
stoc_send
(
client
,
'
GAME_MSG
'
,
{
curmsg
:
2
,
curmsg
:
2
,
type
:
1
0
,
type
:
1
1
,
player
:
0
,
player
:
0
,
data
:
card
data
:
music
});
});
}
}
}
}
};
};
this
.
stoc_send_hint_card_to_room
=
function
(
room
,
card
)
{
this
.
stoc_send_hint_card_to_room
=
function
(
room
,
card
)
{
var
client
,
j
,
k
,
len1
,
len2
,
ref
,
ref1
;
var
client
,
j
,
k
,
len1
,
len2
,
ref
,
ref1
;
...
...
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