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
1109ce18
Commit
1109ce18
authored
Aug 21, 2021
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix i18ns
parent
9ad14874
Pipeline
#4781
failed with stages
in 23 minutes and 21 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
40 deletions
+55
-40
ygopro.coffee
ygopro.coffee
+10
-7
ygopro.js
ygopro.js
+45
-33
No files found.
ygopro.coffee
View file @
1109ce18
...
...
@@ -8,13 +8,16 @@ loadJSON = require('load-json-file').sync
@
i18ns
=
loadJSON
'./data/i18n.json'
@
i18nR
=
{}
for
lang
,
data
of
@
i18ns
@
i18nR
[
lang
]
=
{}
for
key
,
text
of
data
@
i18nR
[
lang
][
key
]
=
{
regex
:
new
RegExp
(
"
\\
$
\\
{"
+
key
+
"
\\
}"
,
'g'
),
text
:
text
}
@
reloadI18nR
=
()
->
for
lang
,
data
of
@
i18ns
@
i18nR
[
lang
]
=
{}
for
key
,
text
of
data
@
i18nR
[
lang
][
key
]
=
{
regex
:
new
RegExp
(
"
\\
$
\\
{"
+
key
+
"
\\
}"
,
'g'
),
text
:
text
}
reloadI18nR
()
YGOProMessagesHelper
=
require
(
"./YGOProMessages.js"
).
YGOProMessagesHelper
# 为 SRVPro2 准备的库,这里拿这个库只用来测试,SRVPro1 对异步支持不是特别完善,因此不会有很多异步优化
@
helper
=
new
YGOProMessagesHelper
(
9000
)
...
...
ygopro.js
View file @
1109ce18
// Generated by CoffeeScript 2.5.1
(
function
()
{
var
Struct
,
YGOProMessagesHelper
,
_
,
data
,
key
,
lang
,
loadJSON
,
ref
,
text
,
translateHandler
;
var
Struct
,
YGOProMessagesHelper
,
_
,
loadJSON
,
translateHandler
;
_
=
require
(
'
underscore
'
);
...
...
@@ -16,18 +16,30 @@
this
.
i18nR
=
{};
ref
=
this
.
i18ns
;
for
(
lang
in
ref
)
{
data
=
ref
[
lang
];
this
.
i18nR
[
lang
]
=
{};
for
(
key
in
data
)
{
text
=
data
[
key
];
this
.
i18nR
[
lang
][
key
]
=
{
regex
:
new
RegExp
(
"
\\
$
\\
{
"
+
key
+
"
\\
}
"
,
'
g
'
),
text
:
text
};
this
.
reloadI18nR
=
function
()
{
var
data
,
key
,
lang
,
ref
,
results
,
text
;
ref
=
this
.
i18ns
;
results
=
[];
for
(
lang
in
ref
)
{
data
=
ref
[
lang
];
this
.
i18nR
[
lang
]
=
{};
results
.
push
((
function
()
{
var
results1
;
results1
=
[];
for
(
key
in
data
)
{
text
=
data
[
key
];
results1
.
push
(
this
.
i18nR
[
lang
][
key
]
=
{
regex
:
new
RegExp
(
"
\\
$
\\
{
"
+
key
+
"
\\
}
"
,
'
g
'
),
text
:
text
});
}
return
results1
;
}).
call
(
this
));
}
}
return
results
;
};
reloadI18nR
();
YGOProMessagesHelper
=
require
(
"
./YGOProMessages.js
"
).
YGOProMessagesHelper
;
// 为 SRVPro2 准备的库,这里拿这个库只用来测试,SRVPro1 对异步支持不是特别完善,因此不会有很多异步优化
...
...
@@ -84,20 +96,20 @@
//util
this
.
stoc_send_chat
=
function
(
client
,
msg
,
player
=
8
)
{
var
i
,
len
,
line
,
o
,
r
,
ref
1
,
ref2
;
var
i
,
len
,
line
,
o
,
r
,
ref
,
ref1
;
if
(
!
client
)
{
console
.
log
(
"
err stoc_send_chat
"
);
return
;
}
ref
1
=
_
.
lines
(
msg
);
for
(
i
=
0
,
len
=
ref
1
.
length
;
i
<
len
;
i
++
)
{
line
=
ref
1
[
i
];
ref
=
_
.
lines
(
msg
);
for
(
i
=
0
,
len
=
ref
.
length
;
i
<
len
;
i
++
)
{
line
=
ref
[
i
];
if
(
player
>=
10
)
{
line
=
"
[Server]:
"
+
line
;
}
ref
2
=
this
.
i18nR
[
client
.
lang
];
for
(
o
in
ref
2
)
{
r
=
ref
2
[
o
];
ref
1
=
this
.
i18nR
[
client
.
lang
];
for
(
o
in
ref
1
)
{
r
=
ref
1
[
o
];
line
=
line
.
replace
(
r
.
regex
,
r
.
text
);
}
this
.
stoc_send
(
client
,
'
CHAT
'
,
{
...
...
@@ -108,21 +120,21 @@
};
this
.
stoc_send_chat_to_room
=
function
(
room
,
msg
,
player
=
8
)
{
var
client
,
i
,
j
,
len
,
len1
,
ref
1
,
ref2
;
var
client
,
i
,
j
,
len
,
len1
,
ref
,
ref1
;
if
(
!
room
)
{
console
.
log
(
"
err stoc_send_chat_to_room
"
);
return
;
}
ref
1
=
room
.
players
;
for
(
i
=
0
,
len
=
ref
1
.
length
;
i
<
len
;
i
++
)
{
client
=
ref
1
[
i
];
ref
=
room
.
players
;
for
(
i
=
0
,
len
=
ref
.
length
;
i
<
len
;
i
++
)
{
client
=
ref
[
i
];
if
(
client
)
{
this
.
stoc_send_chat
(
client
,
msg
,
player
);
}
}
ref
2
=
room
.
watchers
;
for
(
j
=
0
,
len1
=
ref
2
.
length
;
j
<
len1
;
j
++
)
{
client
=
ref
2
[
j
];
ref
1
=
room
.
watchers
;
for
(
j
=
0
,
len1
=
ref
1
.
length
;
j
<
len1
;
j
++
)
{
client
=
ref
1
[
j
];
if
(
client
)
{
this
.
stoc_send_chat
(
client
,
msg
,
player
);
}
...
...
@@ -130,14 +142,14 @@
};
this
.
stoc_send_hint_card_to_room
=
function
(
room
,
card
)
{
var
client
,
i
,
j
,
len
,
len1
,
ref
1
,
ref2
;
var
client
,
i
,
j
,
len
,
len1
,
ref
,
ref1
;
if
(
!
room
)
{
console
.
log
(
"
err stoc_send_hint_card_to_room
"
);
return
;
}
ref
1
=
room
.
players
;
for
(
i
=
0
,
len
=
ref
1
.
length
;
i
<
len
;
i
++
)
{
client
=
ref
1
[
i
];
ref
=
room
.
players
;
for
(
i
=
0
,
len
=
ref
.
length
;
i
<
len
;
i
++
)
{
client
=
ref
[
i
];
if
(
client
)
{
this
.
stoc_send
(
client
,
'
GAME_MSG
'
,
{
curmsg
:
2
,
...
...
@@ -147,9 +159,9 @@
});
}
}
ref
2
=
room
.
watchers
;
for
(
j
=
0
,
len1
=
ref
2
.
length
;
j
<
len1
;
j
++
)
{
client
=
ref
2
[
j
];
ref
1
=
room
.
watchers
;
for
(
j
=
0
,
len1
=
ref
1
.
length
;
j
<
len1
;
j
++
)
{
client
=
ref
1
[
j
];
if
(
client
)
{
this
.
stoc_send
(
client
,
'
GAME_MSG
'
,
{
curmsg
:
2
,
...
...
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