Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro-cn-database-generator
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-cn-database-generator
Commits
dd1a09cb
Commit
dd1a09cb
authored
Oct 20, 2020
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix alias
parent
0f08da69
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
10 deletions
+28
-10
src/dbreader.ts
src/dbreader.ts
+28
-10
No files found.
src/dbreader.ts
View file @
dd1a09cb
...
...
@@ -28,6 +28,10 @@ export class Card {
code
:
number
;
datas
:
any
;
texts
:
any
;
preDatas
:
any
;
preTexts
:
any
;
loadedDatas
:
any
;
loadedTexts
:
any
;
constructor
(
code
:
number
)
{
this
.
code
=
code
;
this
.
datas
=
{};
...
...
@@ -47,11 +51,21 @@ export class Card {
}
return
ret
;
}
private
async
createCardFromRelatedCode
(
code
:
number
,
db
:
Database
)
{
const
card
=
new
Card
(
code
);
await
card
.
loadData
(
db
);
if
(
this
.
loadedTexts
.
name
===
card
.
loadedTexts
.
name
)
{
// is alias
card
.
texts
=
_
.
clone
(
this
.
texts
);
card
.
datas
=
_
.
clone
(
this
.
datas
);
card
.
texts
.
id
=
code
;
card
.
datas
.
id
=
code
;
}
return
card
;
}
async
getRelatedCards
(
db
:
Database
)
{
const
code
=
this
.
code
;
const
moreCodes
:
number
[]
=
(
await
db
.
all
(
'
SELECT id FROM datas WHERE id > ? AND id <= ?
'
,
[
code
,
code
+
10
])).
map
(
m
=>
m
.
id
);
const
cards
=
moreCodes
.
map
(
code
=>
new
Card
(
code
));
await
Promise
.
all
(
cards
.
map
(
card
=>
card
.
loadData
(
db
)));
const
cards
=
await
Promise
.
all
(
moreCodes
.
map
(
code
=>
this
.
createCardFromRelatedCode
(
code
,
db
)));
return
cards
;
}
isInMainDeck
()
{
...
...
@@ -69,17 +83,19 @@ export class Card {
return
(
cardType
&
(
0x4000000
|
0x800000
|
0x2000
|
0x40
))
>
0
;
}
async
loadData
(
db
:
Database
)
{
const
datas
=
await
db
.
get
(
"
select * from datas where id = ?
"
,
[
this
.
code
]);
const
texts
=
await
db
.
get
(
"
select * from texts where id = ?
"
,
[
this
.
code
]);
texts
.
desc
+=
'
\r\n\r\n\
u2605简体中文卡
'
;
this
.
preDatas
=
this
.
datas
;
this
.
preTexts
=
this
.
texts
;
this
.
loadedDatas
=
await
db
.
get
(
"
select * from datas where id = ?
"
,
[
this
.
code
]);
this
.
loadedTexts
=
await
db
.
get
(
"
select * from texts where id = ?
"
,
[
this
.
code
]);
this
.
datas
=
{
...
this
.
d
atas
,
...
d
atas
...
this
.
loadedD
atas
,
...
this
.
preD
atas
}
this
.
texts
=
{
...
this
.
t
exts
,
...
texts
...
this
.
loadedT
exts
,
...
t
his
.
preT
exts
}
this
.
texts
.
desc
+=
'
\r\n\r\n\
u2605简体中文卡
'
;
}
getSQLQueries
()
{
const
datasArray
=
this
.
getDatasArray
();
...
...
@@ -153,7 +169,9 @@ export class DBReader extends Base {
}
const
code
:
number
=
output
.
id
;
this
.
log
.
debug
(
`
${
name
}
=>
${
code
}
`
);
return
new
Card
(
code
);
const
card
=
new
Card
(
code
);
//card.texts.name = name;
return
card
;
}
async
getAllCardsFromJapaneseNames
(
names
:
string
[])
{
const
cards
:
Card
[]
=
[];
...
...
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