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
9fd1d3ed
Commit
9fd1d3ed
authored
Jan 09, 2017
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test i18n
parent
54f06e4d
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
46 additions
and
10 deletions
+46
-10
config.json
config.json
+1
-0
i18n.json
i18n.json
+14
-0
ygopro-server.coffee
ygopro-server.coffee
+8
-4
ygopro-server.js
ygopro-server.js
+8
-4
ygopro.coffee
ygopro.coffee
+5
-0
ygopro.js
ygopro.js
+10
-2
No files found.
config.json
View file @
9fd1d3ed
...
...
@@ -18,6 +18,7 @@
"welcome"
:
"MyCard YGOPro Server"
,
"update"
:
"请更新游戏版本"
,
"stop"
:
false
,
"lang"
:
"zh-cn"
,
"tips"
:
{
"enabled"
:
true
,
"get"
:
false
...
...
i18n.json
0 → 100644
View file @
9fd1d3ed
{
"en-us"
:
{
"kicked_by_system"
:
" is kicked by system."
,
"random_duel_enter_room_waiting"
:
"Your opponent is waiting for you, start duel now!"
,
"random_duel_enter_room_new"
:
"entered new random duel room"
,
"random_duel_enter_room_match"
:
"match mode, please use powerful deck"
},
"zh-cn"
:
{
"kicked_by_system"
:
" 被系统请出了房间"
,
"random_duel_enter_room_waiting"
:
"对手已经在等你了,开始决斗吧!"
,
"random_duel_enter_room_new"
:
"已建立随机对战房间,正在等待对手!"
,
"random_duel_enter_room_match"
:
"您进入了比赛模式的房间,我们推荐使用竞技卡组!"
}
}
\ No newline at end of file
ygopro-server.coffee
View file @
9fd1d3ed
...
...
@@ -77,7 +77,7 @@ ban_user = (name) ->
bad_ip
=
player
.
ip
ROOM_bad_ip
[
bad_ip
]
=
99
settings
.
ban
.
banned_ip
.
push
(
player
.
ip
)
ygopro
.
stoc_send_chat_to_room
(
room
,
"
#{
player
.
name
}
被系统请出了房间
"
,
ygopro
.
constants
.
COLORS
.
RED
)
ygopro
.
stoc_send_chat_to_room
(
room
,
"
#{
player
.
name
}
${kicked_by_system}
"
,
ygopro
.
constants
.
COLORS
.
RED
)
player
.
destroy
()
continue
return
...
...
@@ -224,7 +224,7 @@ ROOM_find_or_create_random = (type, player_ip)->
(
room
.
get_host
()
==
null
or
room
.
get_host
().
ip
!=
ROOM_players_oppentlist
[
player_ip
])
and
(
playerbanned
==
room
.
deprecated
)
if
result
result
.
welcome
=
'
对手已经在等你了,开始决斗吧!
'
result
.
welcome
=
'
${random_duel_enter_room_waiting}
'
#log.info 'found room', player_name
else
if
get_memory_usage
()
<
90
type
=
if
type
then
type
else
'S'
...
...
@@ -232,12 +232,12 @@ ROOM_find_or_create_random = (type, player_ip)->
result
=
new
Room
(
name
)
result
.
random_type
=
type
result
.
max_player
=
max_player
result
.
welcome
=
'
已建立随机对战房间,正在等待对手!
'
result
.
welcome
=
'
${random_duel_enter_room_new}
'
result
.
deprecated
=
playerbanned
#log.info 'create room', player_name, name
else
return
null
if
result
.
random_type
==
'M'
then
result
.
welcome
=
result
.
welcome
+
'
\n
您进入了比赛模式的房间,我们推荐使用竞技卡组!
'
if
result
.
random_type
==
'M'
then
result
.
welcome
=
result
.
welcome
+
'
\n
random_duel_enter_room_match
'
return
result
ROOM_find_or_create_ai
=
(
name
)
->
...
...
@@ -843,6 +843,10 @@ ygopro.ctos_follow 'PLAYER_INFO', true, (buffer, info, client, server)->
struct
.
set
(
"name"
,
name
)
buffer
=
struct
.
buffer
client
.
name
=
name
client
.
lang
=
settings
.
modules
.
lang
if
name
==
"P233"
client
.
lang
=
"en-us"
return
false
ygopro
.
ctos_follow
'JOIN_GAME'
,
false
,
(
buffer
,
info
,
client
,
server
)
->
...
...
ygopro-server.js
View file @
9fd1d3ed
...
...
@@ -102,7 +102,7 @@
bad_ip
=
player
.
ip
;
ROOM_bad_ip
[
bad_ip
]
=
99
;
settings
.
ban
.
banned_ip
.
push
(
player
.
ip
);
ygopro
.
stoc_send_chat_to_room
(
room
,
player
.
name
+
"
被系统请出了房间
"
,
ygopro
.
constants
.
COLORS
.
RED
);
ygopro
.
stoc_send_chat_to_room
(
room
,
player
.
name
+
"
${kicked_by_system}
"
,
ygopro
.
constants
.
COLORS
.
RED
);
player
.
destroy
();
continue
;
}
...
...
@@ -310,20 +310,20 @@
return
room
&&
room
.
random_type
!==
''
&&
!
room
.
started
&&
((
type
===
''
&&
room
.
random_type
!==
'
T
'
)
||
room
.
random_type
===
type
)
&&
room
.
get_playing_player
().
length
<
max_player
&&
(
room
.
get_host
()
===
null
||
room
.
get_host
().
ip
!==
ROOM_players_oppentlist
[
player_ip
])
&&
(
playerbanned
===
room
.
deprecated
);
});
if
(
result
)
{
result
.
welcome
=
'
对手已经在等你了,开始决斗吧!
'
;
result
.
welcome
=
'
${random_duel_enter_room_waiting}
'
;
}
else
if
(
get_memory_usage
()
<
90
)
{
type
=
type
?
type
:
'
S
'
;
name
=
type
+
'
,RANDOM#
'
+
Math
.
floor
(
Math
.
random
()
*
100000
);
result
=
new
Room
(
name
);
result
.
random_type
=
type
;
result
.
max_player
=
max_player
;
result
.
welcome
=
'
已建立随机对战房间,正在等待对手!
'
;
result
.
welcome
=
'
${random_duel_enter_room_new}
'
;
result
.
deprecated
=
playerbanned
;
}
else
{
return
null
;
}
if
(
result
.
random_type
===
'
M
'
)
{
result
.
welcome
=
result
.
welcome
+
'
\n
您进入了比赛模式的房间,我们推荐使用竞技卡组!
'
;
result
.
welcome
=
result
.
welcome
+
'
\n
random_duel_enter_room_match
'
;
}
return
result
;
};
...
...
@@ -1060,6 +1060,10 @@
struct
.
set
(
"
name
"
,
name
);
buffer
=
struct
.
buffer
;
client
.
name
=
name
;
client
.
lang
=
settings
.
modules
.
lang
;
if
(
name
===
"
P233
"
)
{
client
.
lang
=
"
en-us
"
;
}
return
false
;
});
...
...
ygopro.coffee
View file @
9fd1d3ed
...
...
@@ -4,6 +4,8 @@ _.mixin(_.str.exports())
Struct
=
require
(
'./struct.js'
).
Struct
i18ns
=
require
'./i18n.json'
#常量/类型声明
structs_declaration
=
require
'./structs.json'
#结构体声明
typedefs
=
require
'./typedefs.json'
#类型声明
...
...
@@ -116,6 +118,9 @@ for name, declaration of structs_declaration
for
line
in
_
.
lines
(
msg
)
if
player
>=
10
line
=
"[System]: "
+
line
for
o
,
r
of
i18ns
[
client
.
lang
]
re
=
new
RegExp
(
"
\\
$
\\
{"
+
o
+
"
\\
}"
,
'g'
)
line
=
line
.
replace
(
re
,
r
)
@
stoc_send
client
,
'CHAT'
,
{
player
:
player
msg
:
line
...
...
ygopro.js
View file @
9fd1d3ed
// Generated by CoffeeScript 1.12.1
(
function
()
{
var
Struct
,
_
,
declaration
,
field
,
i
,
len
,
name
,
result
,
structs_declaration
,
type
,
typedefs
;
var
Struct
,
_
,
declaration
,
field
,
i
,
i18ns
,
len
,
name
,
result
,
structs_declaration
,
type
,
typedefs
;
_
=
require
(
'
underscore
'
);
...
...
@@ -10,6 +10,8 @@
Struct
=
require
(
'
./struct.js
'
).
Struct
;
i18ns
=
require
(
'
./i18n.json
'
);
structs_declaration
=
require
(
'
./structs.json
'
);
typedefs
=
require
(
'
./typedefs.json
'
);
...
...
@@ -167,7 +169,7 @@
};
this
.
stoc_send_chat
=
function
(
client
,
msg
,
player
)
{
var
j
,
len1
,
line
,
ref
;
var
j
,
len1
,
line
,
o
,
r
,
re
,
ref
,
ref1
;
if
(
player
==
null
)
{
player
=
8
;
}
...
...
@@ -181,6 +183,12 @@
if
(
player
>=
10
)
{
line
=
"
[System]:
"
+
line
;
}
ref1
=
i18ns
[
client
.
lang
];
for
(
o
in
ref1
)
{
r
=
ref1
[
o
];
re
=
new
RegExp
(
"
\\
$
\\
{
"
+
o
+
"
\\
}
"
,
'
g
'
);
line
=
line
.
replace
(
re
,
r
);
}
this
.
stoc_send
(
client
,
'
CHAT
'
,
{
player
:
player
,
msg
:
line
...
...
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