Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro-deckform-filler
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
MyCard
ygopro-deckform-filler
Commits
fe9fa2b0
Commit
fe9fa2b0
authored
Oct 24, 2025
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support multiple languages
parent
6db538d8
Pipeline
#41240
passed with stages
in 2 minutes and 16 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
7 deletions
+40
-7
src/app.service.ts
src/app.service.ts
+1
-1
src/card-data/card-data.service.ts
src/card-data/card-data.service.ts
+20
-5
src/draw-text/draw-text.service.ts
src/draw-text/draw-text.service.ts
+1
-0
src/dto/fill-options.dto.ts
src/dto/fill-options.dto.ts
+18
-1
No files found.
src/app.service.ts
View file @
fe9fa2b0
...
@@ -147,7 +147,7 @@ export class AppService extends ConsoleLogger {
...
@@ -147,7 +147,7 @@ export class AppService extends ConsoleLogger {
);
);
await
this
.
drawTextService
.
drawTextInBox
(
await
this
.
drawTextService
.
drawTextInBox
(
doc
,
doc
,
cardData
.
name
,
cardData
[
`
${
dto
.
lang
||
'
sc
'
}
_name`
]
||
''
,
moveDown
(
cord
.
name
,
j
),
moveDown
(
cord
.
name
,
j
),
i
+
1
,
i
+
1
,
);
);
...
...
src/card-data/card-data.service.ts
View file @
fe9fa2b0
...
@@ -12,11 +12,14 @@ import * as fs from 'node:fs';
...
@@ -12,11 +12,14 @@ import * as fs from 'node:fs';
export
class
CardData
{
export
class
CardData
{
@
CacheKey
()
@
CacheKey
()
cacheKey
()
{
cacheKey
()
{
return
this
.
id
.
toString
();
return
'
0:
'
+
this
.
id
.
toString
();
}
}
id
:
number
;
id
:
number
;
name
:
string
;
sc_name
:
string
;
cn_name
:
string
;
en_name
:
string
;
jp_name
:
string
;
type
:
number
;
// 0x1 for monster, 0x2 for spell, 0x4 for trap
type
:
number
;
// 0x1 for monster, 0x2 for spell, 0x4 for trap
}
}
...
@@ -24,6 +27,8 @@ type YGOCDBData = {
...
@@ -24,6 +27,8 @@ type YGOCDBData = {
id
:
number
;
id
:
number
;
sc_name
:
string
;
sc_name
:
string
;
cn_name
:
string
;
cn_name
:
string
;
en_name
:
string
;
jp_name
:
string
;
data
:
{
type
:
number
};
data
:
{
type
:
number
};
};
};
...
@@ -40,8 +45,17 @@ export class CardDataService {
...
@@ -40,8 +45,17 @@ export class CardDataService {
// console.log(card);
// console.log(card);
const
data
=
new
CardData
();
const
data
=
new
CardData
();
if
(
!
card
.
id
||
!
card
.
data
?.
type
)
return
;
if
(
!
card
.
id
||
!
card
.
data
?.
type
)
return
;
data
.
id
=
card
.
id
;
for
(
const
field
of
[
data
.
name
=
card
.
sc_name
||
card
.
cn_name
||
'
未知卡片
'
;
'
id
'
,
'
sc_name
'
,
'
cn_name
'
,
'
en_name
'
,
'
jp_name
'
,
]
as
const
)
{
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
data
[
field
]
=
card
[
field
];
}
data
.
type
=
card
.
data
.
type
&
0x7
;
data
.
type
=
card
.
data
.
type
&
0x7
;
return
data
;
return
data
;
}
}
...
@@ -73,7 +87,7 @@ export class CardDataService {
...
@@ -73,7 +87,7 @@ export class CardDataService {
).
toException
();
).
toException
();
}
}
this
.
logger
.
log
(
this
.
logger
.
log
(
`Fetched card data for ID
${
id
}
:
${
data
.
type
}
${
data
.
name
}
`
,
`Fetched card data for ID
${
id
}
:
${
data
.
type
}
${
data
.
sc_
name
}
`
,
);
);
return
data
;
return
data
;
}
}
...
@@ -89,6 +103,7 @@ export class CardDataService {
...
@@ -89,6 +103,7 @@ export class CardDataService {
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return
JSON
.
parse
(
content
.
toString
(
'
utf-8
'
));
return
JSON
.
parse
(
content
.
toString
(
'
utf-8
'
));
};
};
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const
content
=
await
loadJson
(
'
cards
'
);
const
content
=
await
loadJson
(
'
cards
'
);
const
cards
:
YGOCDBData
[]
=
Object
.
values
(
content
);
const
cards
:
YGOCDBData
[]
=
Object
.
values
(
content
);
this
.
logger
.
log
(
`Loading
${
cards
.
length
}
cards from YGOCDB data`
);
this
.
logger
.
log
(
`Loading
${
cards
.
length
}
cards from YGOCDB data`
);
...
...
src/draw-text/draw-text.service.ts
View file @
fe9fa2b0
...
@@ -28,6 +28,7 @@ export class DrawTextService {
...
@@ -28,6 +28,7 @@ export class DrawTextService {
options
:
DrawTextOptions
,
options
:
DrawTextOptions
,
pageCount
=
0
,
pageCount
=
0
,
)
{
)
{
if
(
!
text
)
return
;
const
{
x
,
y
,
width
,
height
,
fontSize
}
=
options
;
const
{
x
,
y
,
width
,
height
,
fontSize
}
=
options
;
const
page
=
doc
.
getPage
(
pageCount
);
const
page
=
doc
.
getPage
(
pageCount
);
...
...
src/dto/fill-options.dto.ts
View file @
fe9fa2b0
import
{
Is
DateString
,
IsOptional
,
IsString
}
from
'
class-validator
'
;
import
{
Is
Enum
,
IsOptional
,
IsString
}
from
'
class-validator
'
;
import
{
ApiProperty
}
from
'
@nestjs/swagger
'
;
import
{
ApiProperty
}
from
'
@nestjs/swagger
'
;
import
moment
from
'
moment
'
;
import
moment
from
'
moment
'
;
export
enum
Lang
{
sc
=
'
sc
'
,
cn
=
'
cn
'
,
en
=
'
en
'
,
jp
=
'
jp
'
,
}
export
class
FillOptionsDto
{
export
class
FillOptionsDto
{
@
IsOptional
()
@
IsEnum
(
Lang
)
@
ApiProperty
({
description
:
'
语言选项
'
,
enum
:
Lang
,
example
:
Lang
.
sc
,
default
:
Lang
.
sc
,
})
lang
?:
Lang
;
@
IsString
()
@
IsString
()
@
IsOptional
()
@
IsOptional
()
@
ApiProperty
({
@
ApiProperty
({
...
...
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