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
db2ae300
Commit
db2ae300
authored
Oct 23, 2025
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
load altart mapping as well
parent
5ff7a7b0
Pipeline
#41222
passed with stages
in 43 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
4 deletions
+30
-4
src/card-data/card-data.service.ts
src/card-data/card-data.service.ts
+30
-4
No files found.
src/card-data/card-data.service.ts
View file @
db2ae300
...
...
@@ -81,9 +81,15 @@ export class CardDataService {
private
cardIdLock
=
new
BetterLock
();
private
ygocdbExisting
=
new
Map
<
number
,
CardData
>
();
private
ygocdbAltArts
=
new
Map
<
number
,
number
>
();
// alt art id -> card id
async
loadYGOCDBData
()
{
const
content
=
await
fs
.
promises
.
readFile
(
'
./ygocdb-data/cards.json
'
);
const
loadJson
=
async
(
name
:
string
)
=>
{
const
content
=
await
fs
.
promises
.
readFile
(
`./ygocdb-data/
${
name
}
.json`
);
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return
JSON
.
parse
(
content
.
toString
(
'
utf-8
'
));
};
const
content
=
await
loadJson
(
'
cards
'
);
const
cards
:
YGOCDBData
[]
=
Object
.
values
(
JSON
.
parse
(
content
.
toString
(
'
utf-8
'
)),
);
...
...
@@ -94,14 +100,29 @@ export class CardDataService {
if
(
!
data
)
continue
;
this
.
ygocdbExisting
.
set
(
card
.
id
,
data
);
}
this
.
logger
.
log
(
`Loaded
${
this
.
ygocdbExisting
.
size
}
valid cards from YGOCDB data`
,
);
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const
altArts
:
Record
<
string
,
number
[]
>
=
await
loadJson
(
'
altarts
'
);
this
.
ygocdbAltArts
.
clear
();
for
(
const
[
key
,
ids
]
of
Object
.
entries
(
altArts
))
{
const
originalId
=
parseInt
(
key
,
10
);
for
(
const
id
of
ids
)
{
this
.
ygocdbAltArts
.
set
(
id
,
originalId
);
}
}
this
.
logger
.
log
(
`Loaded
${
this
.
ygocdbAltArts
.
size
}
alt art mappings from YGOCDB data`
,
);
}
async
onApplicationBootstrap
()
{
try
{
await
this
.
loadYGOCDBData
();
this
.
logger
.
log
(
`Loaded
${
this
.
ygocdbExisting
.
size
}
cards from YGOCDB data`
,
);
this
.
logger
.
log
(
`Loaded YGOCDB data`
);
}
catch
(
e
)
{
this
.
logger
.
warn
(
`Failed to load YGOCDB data:
${
e
.
message
}
`
);
}
...
...
@@ -110,6 +131,11 @@ export class CardDataService {
async
getCardData
(
id
:
number
):
Promise
<
CardData
>
{
if
(
this
.
ygocdbExisting
.
has
(
id
))
{
return
this
.
ygocdbExisting
.
get
(
id
);
}
else
if
(
this
.
ygocdbAltArts
.
has
(
id
))
{
const
originalId
=
this
.
ygocdbAltArts
.
get
(
id
);
if
(
this
.
ygocdbExisting
.
has
(
originalId
))
{
return
this
.
ygocdbExisting
.
get
(
originalId
);
}
}
return
this
.
cardIdLock
.
acquire
(
id
.
toString
(),
()
=>
this
.
aragami
.
cache
(
CardData
,
id
.
toString
(),
()
=>
this
.
fetchCardData
(
id
)),
...
...
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